streamlit-nightly 1.37.1.dev20240727__py2.py3-none-any.whl → 1.37.1.dev20240729__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 (26) hide show
  1. streamlit/static/asset-manifest.json +13 -13
  2. streamlit/static/index.html +1 -1
  3. streamlit/static/static/js/{1074.a92bc15f.chunk.js → 1074.d1dd1731.chunk.js} +1 -1
  4. streamlit/static/static/js/2469.31e2695e.chunk.js +1 -0
  5. streamlit/static/static/js/{3466.05d62820.chunk.js → 3466.bb8e2e0c.chunk.js} +2 -2
  6. streamlit/static/static/js/4335.a695f906.chunk.js +1 -0
  7. streamlit/static/static/js/{4666.a9344a3a.chunk.js → 4666.b9eab191.chunk.js} +1 -1
  8. streamlit/static/static/js/{5106.44f0ff51.chunk.js → 5106.086585ae.chunk.js} +1 -1
  9. streamlit/static/static/js/{7175.2779947a.chunk.js → 7175.24e7dd6b.chunk.js} +1 -1
  10. streamlit/static/static/js/{7602.a20a999b.chunk.js → 7602.85e7b7bf.chunk.js} +1 -1
  11. streamlit/static/static/js/{8427.5192ee0c.chunk.js → 8427.e051b59f.chunk.js} +1 -1
  12. streamlit/static/static/js/{8477.de889fe5.chunk.js → 8477.4d2a23c2.chunk.js} +1 -1
  13. streamlit/static/static/js/8536.572570cc.chunk.js +1 -0
  14. streamlit/static/static/js/main.b29f5517.js +2 -0
  15. {streamlit_nightly-1.37.1.dev20240727.dist-info → streamlit_nightly-1.37.1.dev20240729.dist-info}/METADATA +1 -1
  16. {streamlit_nightly-1.37.1.dev20240727.dist-info → streamlit_nightly-1.37.1.dev20240729.dist-info}/RECORD +22 -22
  17. {streamlit_nightly-1.37.1.dev20240727.dist-info → streamlit_nightly-1.37.1.dev20240729.dist-info}/WHEEL +1 -1
  18. streamlit/static/static/js/2469.5a75ba8e.chunk.js +0 -1
  19. streamlit/static/static/js/4335.f27a4b4a.chunk.js +0 -1
  20. streamlit/static/static/js/8536.44f53d6e.chunk.js +0 -1
  21. streamlit/static/static/js/main.2719a280.js +0 -2
  22. /streamlit/static/static/js/{3466.05d62820.chunk.js.LICENSE.txt → 3466.bb8e2e0c.chunk.js.LICENSE.txt} +0 -0
  23. /streamlit/static/static/js/{main.2719a280.js.LICENSE.txt → main.b29f5517.js.LICENSE.txt} +0 -0
  24. {streamlit_nightly-1.37.1.dev20240727.data → streamlit_nightly-1.37.1.dev20240729.data}/scripts/streamlit.cmd +0 -0
  25. {streamlit_nightly-1.37.1.dev20240727.dist-info → streamlit_nightly-1.37.1.dev20240729.dist-info}/entry_points.txt +0 -0
  26. {streamlit_nightly-1.37.1.dev20240727.dist-info → streamlit_nightly-1.37.1.dev20240729.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4335],{94335:(e,t,o)=>{o.r(t),o.d(t,{default:()=>N});var r=o(66845),i=o(25621),n=o(80318),a=o(80745);function l(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function s(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){c(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function c(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function d(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme.colors;return t?o||r?l.tickFillDisabled:l.tickFill:i&&(r||o)?a?l.tickFillErrorSelectedHoverActive:n?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:n?l.tickFillErrorHover:l.tickFillError:r||o?a?l.tickFillSelectedHoverActive:n?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:n?l.tickFillHover:l.tickFill}function u(e){var t=e.$disabled,o=e.$theme.colors;return t?o.contentSecondary:o.contentPrimary}var p=(0,a.zo)("label",(function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:"top"===o||"bottom"===o?"column":"row",display:"flex",alignItems:"top"===o||"bottom"===o?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));p.displayName="Root",p.displayName="Root";var h=(0,a.zo)("span",(function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,s=n.animation,c=o?n.colors.tickMarkFillDisabled:r?n.colors.tickMarkFillError:n.colors.tickMarkFill,u=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(c,'"/>\n </svg>\n ')),p=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(c,'"/>\n </svg>\n ')),h=n.borders.checkboxBorderRadius,m=function(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:o||i?"transparent":r?l.borderNegative:a?l.borderSelected:l.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:s.timing200,transitionTimingFunction:s.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:l.scale700,height:l.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:m,borderRightColor:m,borderTopColor:m,borderBottomColor:m,borderTopLeftRadius:h,borderTopRightRadius:h,borderBottomRightRadius:h,borderBottomLeftRadius:h,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(u,"');"):t?"url('data:image/svg+xml,".concat(p,"');"):null,backgroundColor:d(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));h.displayName="Checkmark",h.displayName="Checkmark";var m=(0,a.zo)("div",(function(e){var t=e.$theme.typography;return s(s(s({verticalAlign:"middle"},function(e){var t,o=e.$labelPlacement,r=void 0===o?"":o,i=e.$theme,n=i.sizing.scale300;switch(r){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),c({},"padding".concat(t),n)}(e)),{},{color:u(e)},t.LabelMedium),{},{lineHeight:"24px"})}));m.displayName="Label",m.displayName="Label";var g=(0,a.zo)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});g.displayName="Input",g.displayName="Input";var b=(0,a.zo)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));b.displayName="Toggle",b.displayName="Toggle";var f=(0,a.zo)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));f.displayName="ToggleTrack",f.displayName="ToggleTrack";var v=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),y=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),k=o(17964);function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},w.apply(this,arguments)}function F(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function R(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,r=C(e);if(t){var i=C(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return function(e,t){if(t&&("object"===$(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}(this,o)}}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function L(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var O=function(e){return e.stopPropagation()},P=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(l,e);var t,o,i,a=R(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return L(T(e=a.call.apply(a,[this].concat(o))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),L(T(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),L(T(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),L(T(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),L(T(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),L(T(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,k.E)(t)&&e.setState({isFocusVisible:!0})})),L(T(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=l,(o=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,o=e.inputRef;t&&o.current&&o.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,o=void 0===t?{}:t,i=e.onChange,a=e.labelPlacement,l=void 0===a?this.props.checkmarkType===v.toggle?"left":"right":a,s=e.inputRef,c=e.isIndeterminate,d=e.error,u=e.disabled,y=e.value,k=e.name,$=e.type,F=e.checked,x=e.children,R=e.required,T=e.title,C=o.Root,L=o.Checkmark,P=o.Label,S=o.Input,M=o.Toggle,j=o.ToggleTrack,B=(0,n.XG)(C)||p,E=(0,n.XG)(L)||h,H=(0,n.XG)(P)||m,V=(0,n.XG)(S)||g,z=(0,n.XG)(M)||b,I=(0,n.XG)(j)||f,W={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},D={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},U={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:F,$isIndeterminate:c,$required:R,$disabled:u,$value:y},A=x&&r.createElement(H,w({$labelPlacement:l},U,(0,n.ch)(P)),this.props.containsInteractiveElement?r.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return r.createElement(B,w({"data-baseweb":"checkbox",title:T||null,$labelPlacement:l},U,D,(0,n.ch)(C)),("top"===l||"left"===l)&&A,this.props.checkmarkType===v.toggle?r.createElement(I,w({},U,(0,n.ch)(j)),r.createElement(z,w({},U,(0,n.ch)(M)))):r.createElement(E,w({},U,(0,n.ch)(L))),r.createElement(V,w({value:y,name:k,checked:F,required:R,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":c?"mixed":F,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":R||null,disabled:u,type:$,ref:s,onClick:O},U,W,(0,n.ch)(S))),("bottom"===l||"right"===l)&&A)}}])&&F(t.prototype,o),i&&F(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(r.Component);L(P,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:r.createRef(),error:!1,type:"checkbox",checkmarkType:v.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const S=P;var M=o(35704),j=o(50641),B=o(16295),E=o(87814),H=o(27466),V=o(8879),z=o(68411),I=o(86659),W=o(63730),D=o(86977),U=o(40864);class A extends r.PureComponent{constructor(){super(...arguments),this.formClearHelper=new E.K,this.state={value:this.initialValue},this.commitWidgetValue=e=>{const{widgetMgr:t,element:o,fragmentId:r}=this.props;t.setBoolValue(o,this.state.value,e,r)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{const t=e.target.checked;this.setState({value:t},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getBoolValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{theme:t,width:o,element:r,disabled:i,widgetMgr:n}=this.props,{colors:a,spacing:l,sizes:s}=t,c=(0,H.Iy)(t),d=i?a.fadedText40:a.bodyText;return this.formClearHelper.manageFormClearListener(n,r.formId,this.onFormCleared),(0,U.jsx)(D.P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",width:o,children:(0,U.jsx)(S,{checked:this.state.value,disabled:i,onChange:this.onChange,"aria-label":r.label,checkmarkType:r.type===B.XZ.StyleType.TOGGLE?v.toggle:v.default,labelPlacement:y.right,overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:0,marginTop:0,paddingRight:l.twoThirdsSmFont,backgroundColor:t?a.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Toggle:{style:e=>{let{$checked:t}=e,o=c?a.bgColor:a.bodyText;return i&&(o=c?a.gray70:a.gray90),{width:"12px",height:"12px",transform:t?"translateX(16px)":"",backgroundColor:o,boxShadow:""}}},ToggleTrack:{style:e=>{let{$checked:o,$isHovered:r}=e,n=a.fadedText40;return r&&!i&&(n=a.fadedText20),o&&!i&&(n=a.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:"0.25rem",paddingLeft:"2px",paddingRight:"2px",width:"32px",minWidth:"32px",height:"16px",minHeight:"16px",borderBottomLeftRadius:t.radii.lg,borderTopLeftRadius:t.radii.lg,borderBottomRightRadius:t.radii.lg,borderTopRightRadius:t.radii.lg,backgroundColor:n}}},Checkmark:{style:e=>{let{$isFocusVisible:t,$checked:o}=e;const r=o&&!i?a.primary:a.fadedText40;return{outline:0,width:"1rem",height:"1rem",marginTop:"0.25rem",marginLeft:0,marginBottom:0,boxShadow:t&&o?"0 0 0 0.2rem ".concat((0,M.DZ)(a.primary,.5)):"",borderLeftWidth:s.borderWidth,borderRightWidth:s.borderWidth,borderTopWidth:s.borderWidth,borderBottomWidth:s.borderWidth,borderLeftColor:r,borderRightColor:r,borderTopColor:r,borderBottomColor:r}}},Label:{style:{position:"relative",color:d}}},children:(0,U.jsxs)(D.H,{visibility:(0,j.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),"data-testid":"stWidgetLabel",children:[(0,U.jsx)(W.ZP,{source:r.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),r.help&&(0,U.jsx)(I.Hp,{color:d,children:(0,U.jsx)(V.Z,{content:r.help,placement:z.u.TOP_RIGHT})})]})})})}}const N=(0,i.b)(A)},87814:(e,t,o)=>{o.d(t,{K:()=>i});var r=o(50641);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,o){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,r.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,o),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4666],{90186:(e,t,i)=>{i.d(t,{$:()=>p,Z:()=>c});var s=i(66845),n=i(25621),l=i(66694),a=i(27466),r=i(38570),o=i(80318),d=i(40864);let p;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(p||(p={}));const c=function(e){let{value:t,width:i,size:c=p.SMALL,overrides:g}=e;const h=(0,n.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(l.E),f=!(0,a.MJ)(m),x={BarContainer:{style:{marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:i?i.toString():void 0,marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none,height:u[c],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?h.colors.primary:h.colors.blue70,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS})}};return(0,d.jsx)(r.Z,{value:t,overrides:(0,o.aO)(x,g)})}},77367:(e,t,i)=>{i.d(t,{R:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},14666:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var s=i(18080),n=i(62813),l=i.n(n),a=i(84693),r=i.n(a),o=i(66845),d=i(16295),p=i(87814),c=i(50641);let g;!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(g||(g={}));const h=(0,c.rA)()?1024:1e3,u=[g.Gigabyte,g.Megabyte,g.Kilobyte,g.Byte],m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=g.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=u.indexOf(t);return s&&e>h/2?m(e/h,u[s-1],i):"".concat(e.toFixed(i)).concat(t.toUpperCase())};var f=i(98478),x=i(86659),w=i(8879),y=i(68411),b=i(51622),F=i(9003),S=i(81354),v=i(1515);const j=(0,v.Z)("section",{target:"e1b2p2ww15"})((e=>{let{isDisabled:t,theme:i}=e;return{display:"flex",alignItems:"center",padding:i.spacing.lg,backgroundColor:i.colors.secondaryBg,borderRadius:i.radii.default,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(i.colors.primary)},color:t?i.colors.gray:i.colors.bodyText}}),""),I=(0,v.Z)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),U=(0,v.Z)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),M=(0,v.Z)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),z=(0,v.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),L=(0,v.Z)("div",{target:"e1b2p2ww10"})((e=>{let{theme:t}=e;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),C=(0,v.Z)("ul",{target:"e1b2p2ww9"})((()=>({listStyleType:"none",marginBottom:0})),""),B=(0,v.Z)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),Z=(0,v.Z)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),R=(0,v.Z)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),k=(0,v.Z)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),T=(0,v.Z)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),D=(0,v.Z)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),X=(0,v.Z)("small",{target:"e1b2p2ww2"})((e=>{let{theme:t}=e;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),P=(0,v.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),E=e=>({[j]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[I]:{marginBottom:e.spacing.lg},[U]:{display:"none"},[L]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[R]:{width:e.sizes.full},[Z]:{flexDirection:"column"},[X]:{height:"auto",whiteSpace:"initial"},[P]:{display:"none"},[B]:{margin:e.spacing.none,padding:e.spacing.none}}),A=(0,v.Z)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?E(t):{["@media (max-width: ".concat(t.breakpoints.sm,")")]:E(t)}}),"");var V=i(74529),N=i(46927),W=i(33746),O=i(40864);const H=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,O.jsxs)(I,{"data-testid":"stFileUploaderDropzoneInstructions",children:[(0,O.jsx)(U,{children:(0,O.jsx)(N.Z,{content:V.n,size:"threeXL"})}),(0,O.jsxs)(z,{children:[(0,O.jsxs)(M,{children:["Drag and drop file",t?"s":""," here"]}),(0,O.jsxs)(W.x,{children:["Limit ".concat(m(s,g.Byte,0)," per file"),i.length?" \u2022 ".concat(i.map((e=>e.replace(/^\./,"").toUpperCase())).join(", ")):null]})]})]})},_=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:n,disabled:l,label:a}=e;return(0,O.jsx)(b.ZP,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:n,disabled:l,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:r}=e;return(0,O.jsxs)(j,{...t(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":a,children:[(0,O.jsx)("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),(0,O.jsx)(H,{multiple:i,acceptedExtensions:s,maxSizeBytes:n}),(0,O.jsx)(F.ZP,{kind:S.nW.SECONDARY,disabled:l,size:S.V5.SMALL,children:"Browse files"})]})}})};var G=i(13005),K=i.n(G),$=i(30351),q=i(14609);const J=(0,v.Z)("div",{target:"e16k0npc1"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),Y=(0,v.Z)("div",{target:"e16k0npc0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),Q=e=>{let{className:t,currentPage:i,totalPages:s,onNext:n,onPrevious:l}=e;return(0,O.jsxs)(J,{className:t,"data-testid":"stPagination",children:[(0,O.jsx)(W.x,{children:"Showing page ".concat(i," of ").concat(s)}),(0,O.jsxs)(Y,{children:[(0,O.jsx)(F.ZP,{onClick:l,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:$.s,size:"xl"})}),(0,O.jsx)(F.ZP,{onClick:n,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:q._,size:"xl"})})]})]})};var ee=i(88235);const te=(e,t)=>Math.ceil(e.length/t),ie=e=>K()((t=>{let{pageSize:i,items:s,resetOnAdd:n,...l}=t;const[a,r]=(0,o.useState)(0),[d,p]=(0,o.useState)(te(s,i)),c=(0,ee.D)(s);(0,o.useEffect)((()=>{c&&c.length!==s.length&&p(te(s,i)),c&&c.length<s.length?n&&r(0):a+1>=d&&r(d-1)}),[s,a,i,c,n,d]);const g=s.slice(a*i,a*i+i);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(e,{items:g,...l}),s.length>i?(0,O.jsx)(Q,{className:"streamlit-paginator",pageSize:i,totalPages:d,currentPage:a+1,onNext:()=>{r(Math.min(a+1,d-1))},onPrevious:()=>{r(Math.max(0,a-1))}}):null]})}),e);var se=i(62288),ne=i(87847),le=i(31197),ae=i(90186);const re=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,O.jsx)(ae.Z,{value:t.status.progress,size:ae.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,O.jsxs)(X,{children:[(0,O.jsx)(T,{"data-testid":"stFileUploaderFileErrorMessage",children:t.status.errorMessage}),(0,O.jsx)(P,{children:(0,O.jsx)(N.Z,{content:se.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,O.jsx)(W.x,{children:m(t.size,g.Byte)}):null},oe=e=>{let{fileInfo:t,onDelete:i}=e;return(0,O.jsxs)(k,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[(0,O.jsx)(D,{children:(0,O.jsx)(N.Z,{content:ne.h,size:"twoXL"})}),(0,O.jsxs)(Z,{className:"stFileUploaderFileData",children:[(0,O.jsx)(R,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:t.name,children:t.name}),(0,O.jsx)(re,{fileInfo:t})]}),(0,O.jsx)("div",{"data-testid":"stFileUploaderDeleteBtn",children:(0,O.jsx)(F.ZP,{onClick:()=>i(t.id),kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:le.U,size:"lg"})})})]})},de=ie((e=>{let{items:t,onDelete:i}=e;return(0,O.jsx)(C,{children:t.map((e=>(0,O.jsx)(B,{children:(0,O.jsx)(oe,{fileInfo:e,onDelete:i})},e.id)))})})),pe=e=>(0,O.jsx)(L,{children:(0,O.jsx)(de,{...e})});var ce=i(77367);class ge extends o.PureComponent{constructor(e){super(e),this.formClearHelper=new p.K,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props,n=i.getFileUploaderStateValue(t);l()(e,n)||i.setFileUploaderStateValue(t,e,{fromUi:!0},s)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then((t=>{if(!s&&e.length>0){const e=this.state.files.find((e=>"error"!==e.status.type));e&&(this.forceUpdatingStatus=!0,this.deleteFile(e.id),this.forceUpdatingStatus=!1)}r()(t,e).forEach((e=>{let[t,i]=e;this.uploadFile(t,i)}))})).catch((t=>{this.addFiles(e.map((e=>new ce.R(e.name,e.size,this.nextLocalFileId(),{type:"error",errorMessage:t}))))})),t.length>0){const e=t.map((e=>{const{file:t}=e;return new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=(e,t)=>{const i=s.Z.CancelToken.source(),n=new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,n.id)),i.token).then((()=>this.onUploadComplete(n.id,e))).catch((e=>{s.Z.isCancel(e)||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{const i=this.getFile(e);null!=i&&"uploading"===i.status.type&&this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return"File must be ".concat(m(this.maxUploadSizeInBytes,g.Byte)," or smaller.");case"file-invalid-type":return"".concat(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);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&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((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if(null==i||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if(null==e)return;const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setFileUploaderStateValue(i,e,{fromUi:!0},s)}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if(null==s)return e;const{uploadedFileInfo:n}=s;return null==n||0===n.length?e:{files:n.map((e=>{const t=e.name,i=e.size,s=e.fileId,n=e.fileUrls;return new ce.R(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:n})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=u.findIndex((e=>e===t)),n=u.findIndex((e=>e===i));if(-1===s||-1===n)throw Error("Unexpected byte unit provided");if(s===n)return e;const l=Math.abs(s-n),a=h**l;return s>n?e/a:e*a})(this.props.element.maxUploadSizeMb,g.Megabyte,g.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1},s)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:n,fileUrls:l}=s;return new d.jM({fileId:n,fileUrls:l,name:t,size:i})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:n}=this.props,l=i.type;this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared);const a=t.slice().reverse();return(0,O.jsxs)(A,{"data-testid":"stFileUploader",children:[(0,O.jsx)(f.O,{label:i.label,disabled:s,labelVisibility:(0,c.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,O.jsx)(x.dT,{children:(0,O.jsx)(w.Z,{content:i.help,placement:y.u.TOP_RIGHT})})}),(0,O.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:l,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),a.length>0&&(0,O.jsx)(pe,{items:a,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const he=ge},87814:(e,t,i)=>{i.d(t,{K:()=>n});var s=i(50641);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4666],{90186:(e,t,i)=>{i.d(t,{$:()=>p,Z:()=>c});var s=i(66845),n=i(25621),l=i(38570),a=i(80318),r=i(27466),o=i(66694),d=i(40864);let p;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(p||(p={}));const c=function(e){let{value:t,width:i,size:c=p.SMALL,overrides:g}=e;const h=(0,n.u)(),u={xs:h.spacing.twoXS,sm:h.spacing.sm,md:h.spacing.lg,lg:h.spacing.xl,xl:h.spacing.twoXL},{activeTheme:m}=s.useContext(o.E),f=!(0,r.MJ)(m),x={BarContainer:{style:{marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:i?i.toString():void 0,marginTop:h.spacing.none,marginBottom:h.spacing.none,marginRight:h.spacing.none,marginLeft:h.spacing.none,height:u[c],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?h.colors.primary:h.colors.blue70,borderTopLeftRadius:h.spacing.twoXS,borderTopRightRadius:h.spacing.twoXS,borderBottomLeftRadius:h.spacing.twoXS,borderBottomRightRadius:h.spacing.twoXS})}};return(0,d.jsx)(l.Z,{value:t,overrides:(0,a.aO)(x,g)})}},77367:(e,t,i)=>{i.d(t,{R:()=>s});class s{setStatus(e){return new s(this.name,this.size,this.id,e)}constructor(e,t,i,s){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=i,this.status=s}}},14666:(e,t,i)=>{i.r(t),i.d(t,{default:()=>he});var s=i(66845),n=i(18080),l=i(62813),a=i.n(l),r=i(84693),o=i.n(r),d=i(16295),p=i(87814),c=i(50641);let g;!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(g||(g={}));const h=(0,c.rA)()?1024:1e3,u=[g.Gigabyte,g.Megabyte,g.Kilobyte,g.Byte],m=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t||(t=g.Byte),i<0&&(i=0),e<0)throw new Error("Size must be greater than or equal to 0");const s=u.indexOf(t);return s&&e>h/2?m(e/h,u[s-1],i):"".concat(e.toFixed(i)).concat(t.toUpperCase())};var f=i(98478),x=i(86659),w=i(8879),y=i(68411),b=i(51622),F=i(9003),S=i(81354),v=i(1515);const j=(0,v.Z)("section",{target:"e1b2p2ww15"})((e=>{let{isDisabled:t,theme:i}=e;return{display:"flex",alignItems:"center",padding:i.spacing.lg,backgroundColor:i.colors.secondaryBg,borderRadius:i.radii.default,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(i.colors.primary)},color:t?i.colors.gray:i.colors.bodyText}}),""),I=(0,v.Z)("div",{target:"e1b2p2ww14"})((()=>({marginRight:"auto",alignItems:"center",display:"flex"})),""),U=(0,v.Z)("span",{target:"e1b2p2ww13"})((e=>{let{theme:t}=e;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),M=(0,v.Z)("span",{target:"e1b2p2ww12"})((e=>{let{theme:t}=e;return{marginBottom:t.spacing.twoXS}}),""),z=(0,v.Z)("div",{target:"e1b2p2ww11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),L=(0,v.Z)("div",{target:"e1b2p2ww10"})((e=>{let{theme:t}=e;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),C=(0,v.Z)("ul",{target:"e1b2p2ww9"})((()=>({listStyleType:"none",marginBottom:0})),""),B=(0,v.Z)("li",{target:"e1b2p2ww8"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,padding:t.spacing.none}}),""),Z=(0,v.Z)("div",{target:"e1b2p2ww7"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:t.spacing.lg,overflow:"hidden"}}),""),R=(0,v.Z)("div",{target:"e1b2p2ww6"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),k=(0,v.Z)("div",{target:"e1b2p2ww5"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",marginBottom:t.spacing.twoXS}}),""),T=(0,v.Z)("span",{target:"e1b2p2ww4"})((e=>{let{theme:t}=e;return{marginRight:t.spacing.twoXS}}),""),D=(0,v.Z)("div",{target:"e1b2p2ww3"})((e=>{let{theme:t}=e;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),X=(0,v.Z)("small",{target:"e1b2p2ww2"})((e=>{let{theme:t}=e;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),P=(0,v.Z)("span",{target:"e1b2p2ww1"})({name:"0",styles:""}),E=e=>({[j]:{display:"flex",flexDirection:"column",alignItems:"flex-start"},[I]:{marginBottom:e.spacing.lg},[U]:{display:"none"},[L]:{paddingRight:e.spacing.lg},[k]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[R]:{width:e.sizes.full},[Z]:{flexDirection:"column"},[X]:{height:"auto",whiteSpace:"initial"},[P]:{display:"none"},[B]:{margin:e.spacing.none,padding:e.spacing.none}}),A=(0,v.Z)("div",{target:"e1b2p2ww0"})((e=>{let{theme:t}=e;return t.inSidebar?E(t):{["@media (max-width: ".concat(t.breakpoints.sm,")")]:E(t)}}),"");var V=i(74529),N=i(46927),W=i(33746),O=i(40864);const H=e=>{let{multiple:t,acceptedExtensions:i,maxSizeBytes:s}=e;return(0,O.jsxs)(I,{"data-testid":"stFileUploaderDropzoneInstructions",children:[(0,O.jsx)(U,{children:(0,O.jsx)(N.Z,{content:V.n,size:"threeXL"})}),(0,O.jsxs)(z,{children:[(0,O.jsxs)(M,{children:["Drag and drop file",t?"s":""," here"]}),(0,O.jsxs)(W.x,{children:["Limit ".concat(m(s,g.Byte,0)," per file"),i.length?" \u2022 ".concat(i.map((e=>e.replace(/^\./,"").toUpperCase())).join(", ")):null]})]})]})},_=e=>{let{onDrop:t,multiple:i,acceptedExtensions:s,maxSizeBytes:n,disabled:l,label:a}=e;return(0,O.jsx)(b.ZP,{onDrop:t,multiple:i,accept:s.length?s:void 0,maxSize:n,disabled:l,useFsAccessApi:!1,children:e=>{let{getRootProps:t,getInputProps:r}=e;return(0,O.jsxs)(j,{...t(),"data-testid":"stFileUploaderDropzone",isDisabled:l,"aria-label":a,children:[(0,O.jsx)("input",{"data-testid":"stFileUploaderDropzoneInput",...r()}),(0,O.jsx)(H,{multiple:i,acceptedExtensions:s,maxSizeBytes:n}),(0,O.jsx)(F.ZP,{kind:S.nW.SECONDARY,disabled:l,size:S.V5.SMALL,children:"Browse files"})]})}})};var G=i(13005),K=i.n(G),$=i(30351),q=i(14609);const J=(0,v.Z)("div",{target:"e16k0npc1"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),Y=(0,v.Z)("div",{target:"e16k0npc0"})((e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",color:t.colors.fadedText40}}),""),Q=e=>{let{className:t,currentPage:i,totalPages:s,onNext:n,onPrevious:l}=e;return(0,O.jsxs)(J,{className:t,"data-testid":"stPagination",children:[(0,O.jsx)(W.x,{children:"Showing page ".concat(i," of ").concat(s)}),(0,O.jsxs)(Y,{children:[(0,O.jsx)(F.ZP,{onClick:l,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:$.s,size:"xl"})}),(0,O.jsx)(F.ZP,{onClick:n,kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:q._,size:"xl"})})]})]})};var ee=i(88235);const te=(e,t)=>Math.ceil(e.length/t),ie=e=>K()((t=>{let{pageSize:i,items:n,resetOnAdd:l,...a}=t;const[r,o]=(0,s.useState)(0),[d,p]=(0,s.useState)(te(n,i)),c=(0,ee.D)(n);(0,s.useEffect)((()=>{c&&c.length!==n.length&&p(te(n,i)),c&&c.length<n.length?l&&o(0):r+1>=d&&o(d-1)}),[n,r,i,c,l,d]);const g=n.slice(r*i,r*i+i);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(e,{items:g,...a}),n.length>i?(0,O.jsx)(Q,{className:"streamlit-paginator",pageSize:i,totalPages:d,currentPage:r+1,onNext:()=>{o(Math.min(r+1,d-1))},onPrevious:()=>{o(Math.max(0,r-1))}}):null]})}),e);var se=i(62288),ne=i(87847),le=i(31197),ae=i(90186);const re=e=>{let{fileInfo:t}=e;return"uploading"===t.status.type?(0,O.jsx)(ae.Z,{value:t.status.progress,size:ae.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,O.jsxs)(X,{children:[(0,O.jsx)(T,{"data-testid":"stFileUploaderFileErrorMessage",children:t.status.errorMessage}),(0,O.jsx)(P,{children:(0,O.jsx)(N.Z,{content:se.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,O.jsx)(W.x,{children:m(t.size,g.Byte)}):null},oe=e=>{let{fileInfo:t,onDelete:i}=e;return(0,O.jsxs)(k,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[(0,O.jsx)(D,{children:(0,O.jsx)(N.Z,{content:ne.h,size:"twoXL"})}),(0,O.jsxs)(Z,{className:"stFileUploaderFileData",children:[(0,O.jsx)(R,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:t.name,children:t.name}),(0,O.jsx)(re,{fileInfo:t})]}),(0,O.jsx)("div",{"data-testid":"stFileUploaderDeleteBtn",children:(0,O.jsx)(F.ZP,{onClick:()=>i(t.id),kind:S.nW.MINIMAL,children:(0,O.jsx)(N.Z,{content:le.U,size:"lg"})})})]})},de=ie((e=>{let{items:t,onDelete:i}=e;return(0,O.jsx)(C,{children:t.map((e=>(0,O.jsx)(B,{children:(0,O.jsx)(oe,{fileInfo:e,onDelete:i})},e.id)))})})),pe=e=>(0,O.jsx)(L,{children:(0,O.jsx)(de,{...e})});var ce=i(77367);class ge extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new p.K,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props,n=i.getFileUploaderStateValue(t);a()(e,n)||i.setFileUploaderStateValue(t,e,{fromUi:!0},s)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:i}=this.props,{multipleFiles:s}=i;if(!s&&0===e.length&&t.length>1){const i=t.findIndex((e=>1===e.errors.length&&"too-many-files"===e.errors[0].code));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then((t=>{if(!s&&e.length>0){const e=this.state.files.find((e=>"error"!==e.status.type));e&&(this.forceUpdatingStatus=!0,this.deleteFile(e.id),this.forceUpdatingStatus=!1)}o()(t,e).forEach((e=>{let[t,i]=e;this.uploadFile(t,i)}))})).catch((t=>{this.addFiles(e.map((e=>new ce.R(e.name,e.size,this.nextLocalFileId(),{type:"error",errorMessage:t}))))})),t.length>0){const e=t.map((e=>{const{file:t}=e;return new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(e.errors[0].code,e.file)})}));this.addFiles(e)}},this.uploadFile=(e,t)=>{const i=n.Z.CancelToken.source(),s=new ce.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:i,progress:1});this.addFile(s),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,s.id)),i.token).then((()=>this.onUploadComplete(s.id,e))).catch((e=>{n.Z.isCancel(e)||this.updateFile(s.id,s.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.onUploadComplete=(e,t)=>{const i=this.getFile(e);null!=i&&"uploading"===i.status.type&&this.updateFile(i.id,i.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return"File must be ".concat(m(this.maxUploadSizeInBytes,g.Byte)," or smaller.");case"file-invalid-type":return"".concat(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);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&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((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((i=>({files:i.files.map((i=>i.id===e?t:i))})))},this.onUploadProgress=(e,t)=>{const i=this.getFile(t);if(null==i||"uploading"!==i.status.type)return;const s=Math.round(100*e.loaded/e.total);i.status.progress!==s&&this.updateFile(t,i.setStatus({type:"uploading",cancelToken:i.status.cancelToken,progress:s}))},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if(null==e)return;const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setFileUploaderStateValue(i,e,{fromUi:!0},s)}))},this.state=this.initialValue}get initialValue(){const e={files:[],newestServerFileId:0},{widgetMgr:t,element:i}=this.props,s=t.getFileUploaderStateValue(i);if(null==s)return e;const{uploadedFileInfo:n}=s;return null==n||0===n.length?e:{files:n.map((e=>{const t=e.name,i=e.size,s=e.fileId,n=e.fileUrls;return new ce.R(t,i,this.nextLocalFileId(),{type:"uploaded",fileId:s,fileUrls:n})}))}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){return((e,t,i)=>{if(e<0)throw Error("Size must be 0 or greater");const s=u.findIndex((e=>e===t)),n=u.findIndex((e=>e===i));if(-1===s||-1===n)throw Error("Unexpected byte unit provided");if(s===n)return e;const l=Math.abs(s-n),a=h**l;return s>n?e/a:e*a})(this.props.element.maxUploadSizeMb,g.Megabyte,g.Byte)}get status(){return this.state.files.some((e=>"uploading"===e.status.type))||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:s}=this.props;void 0===i.getFileUploaderStateValue(t)&&i.setFileUploaderStateValue(t,e,{fromUi:!1},s)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:i,status:s}=e,{fileId:n,fileUrls:l}=s;return new d.jM({fileId:n,fileUrls:l,name:t,size:i})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{files:t}=this.state,{element:i,disabled:s,widgetMgr:n}=this.props,l=i.type;this.formClearHelper.manageFormClearListener(n,i.formId,this.onFormCleared);const a=t.slice().reverse();return(0,O.jsxs)(A,{"data-testid":"stFileUploader",children:[(0,O.jsx)(f.O,{label:i.label,disabled:s,labelVisibility:(0,c.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,O.jsx)(x.dT,{children:(0,O.jsx)(w.Z,{content:i.help,placement:y.u.TOP_RIGHT})})}),(0,O.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:l,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:s}),a.length>0&&(0,O.jsx)(pe,{items:a,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const he=ge},87814:(e,t,i)=>{i.d(t,{K:()=>n});var s=i(50641);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5106],{87814:(e,t,i)=>{i.d(t,{K:()=>n});var s=i(50641);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}},5106:(e,t,i)=>{i.r(t),i.d(t,{default:()=>F});var s=i(66845),n=i(1866),o=i.n(n),a=i(70461),r=i(25621),l=i(52347),d=i(87814),h=i(16295),m=i(50641),u=i(53608),c=i.n(u),g=i(98478),p=i(86659),f=i(8879),b=i(68411),v=i(1515),T=i(35704);const y=(0,v.Z)("div",{target:"ew7r33m3"})((e=>{let{disabled:t,theme:i}=e;return{alignItems:"center",backgroundColor:t?i.colors.gray:i.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",height:i.radii.xl,justifyContent:"center",width:i.radii.xl,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,T.DZ)(i.colors.primary,.5))}}}),""),R=(0,v.Z)("div",{target:"ew7r33m2"})((e=>{let{disabled:t,theme:i}=e;return{fontFamily:i.genericFonts.codeFont,fontSize:i.fontSizes.sm,paddingBottom:i.spacing.twoThirdsSmFont,color:t?i.colors.gray:i.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:i.colors.transparent,lineHeight:i.lineHeights.base,fontWeight:"normal"}}),""),V=(0,v.Z)("div",{target:"ew7r33m1"})((e=>{let{theme:t}=e;return{paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:t.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"}}),""),x=(0,v.Z)("div",{target:"ew7r33m0"})((e=>{let{disabled:t,theme:i}=e;return{lineHeight:i.lineHeights.base,fontWeight:"normal",fontSize:i.fontSizes.sm,fontFamily:i.genericFonts.codeFont,color:t?i.colors.fadedText40:"inherit"}}),"");var C=i(40864);class w extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new d.K,this.state=void 0,this.sliderRef=s.createRef(),this.thumbRef=[],this.thumbValueRef=[],this.commitWidgetValueDebounced=void 0,this.commitWidgetValue=e=>{const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setDoubleArrayValue(i,this.state.value,e,s)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=e=>{let{value:t}=e;this.setState({value:t},(()=>this.commitWidgetValueDebounced({fromUi:!0})))},this.renderThumb=s.forwardRef(((e,t)=>{var i;const{$value:n,$thumbIndex:a}=e,r=a||0;this.thumbRef[r]=t,(i=this.thumbValueRef)[r]||(i[r]=s.createRef());const l=n?this.formatValue(n[a]):"",d=o()(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),h={};return(this.props.element.options.length>0||this.isDateTimeType())&&(h["aria-valuetext"]=l),(0,C.jsx)(y,{...d,disabled:!0===e.$disabled,ref:this.thumbRef[r],"aria-valuetext":l,"aria-label":this.props.element.label,children:(0,C.jsx)(R,{className:"StyledThumbValue","data-testid":"stThumbValue",disabled:!0===e.$disabled,ref:this.thumbValueRef[r],children:l})})})),this.renderTickBar=()=>{const{disabled:e,element:t}=this.props,{max:i,min:s}=t;return(0,C.jsxs)(V,{"data-testid":"stTickBar",children:[(0,C.jsx)(x,{disabled:e,"data-testid":"stTickBarMin",children:this.formatValue(s)}),(0,C.jsx)(x,{disabled:e,"data-testid":"stTickBarMax",children:this.formatValue(i)})]})},this.commitWidgetValueDebounced=(0,m.Ds)(200,this.commitWidgetValue.bind(this)),this.state={value:this.initialValue}}get initialValue(){const e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){setTimeout((()=>{this.thumbValueAlignment()}),0),this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get value(){const{min:e,max:t}=this.props.element,{value:i}=this.state;let s=i[0],n=i.length>1?i[1]:i[0];return s>n&&(s=n),s<e&&(s=e),s>t&&(s=t),n<e&&(n=e),n>t&&(n=t),i.length>1?[s,n]:[s]}isDateTimeType(){const{dataType:e}=this.props.element;return e===h.iR.DataType.DATETIME||e===h.iR.DataType.DATE||e===h.iR.DataType.TIME}formatValue(e){const{format:t,options:i}=this.props.element;return this.isDateTimeType()?c().utc(e/1e3).format(t):i.length>0?(0,l.sprintf)(t,i[e]):(0,l.sprintf)(t,e)}alignValueOnThumb(e,t,i){if(e&&t&&i){const s=e.getBoundingClientRect(),n=t.getBoundingClientRect(),o=i.getBoundingClientRect(),a=n.left+n.width/2,r=a-o.width/2<s.left,l=a+o.width/2>s.right;i.style.left=r?"0":"",i.style.right=l?"0":""}}thumbValueAlignment(){var e,t,i,s;const n=this.sliderRef.current,o=null===(e=this.thumbRef[0])||void 0===e?void 0:e.current,a=null===(t=this.thumbRef[1])||void 0===t?void 0:t.current,r=null===(i=this.thumbValueRef[0])||void 0===i?void 0:i.current,l=null===(s=this.thumbValueRef[1])||void 0===s?void 0:s.current;if(this.alignValueOnThumb(n,o,r),this.alignValueOnThumb(n,a,l),n&&o&&a&&r&&l){const e=n.getBoundingClientRect(),t=o.getBoundingClientRect(),i=a.getBoundingClientRect(),s=r.getBoundingClientRect(),d=l.getBoundingClientRect();if(s.right+16>d.left){d.left-16-s.width>e.left?r.style.right="".concat(d.width+16-(i.right-t.right),"px"):l.style.left="".concat(s.width+16-(i.left-t.left),"px")}}}render(){var e;const{disabled:t,element:i,theme:s,width:n,widgetMgr:o}=this.props,{colors:r,fonts:l,fontSizes:d,spacing:h}=s,u={width:n};return this.formClearHelper.manageFormClearListener(o,i.formId,this.onFormCleared),this.thumbValueAlignment(),(0,C.jsxs)("div",{ref:this.sliderRef,className:"stSlider","data-testid":"stSlider",style:u,children:[(0,C.jsx)(g.O,{label:i.label,disabled:t,labelVisibility:(0,m.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,C.jsx)(p.dT,{children:(0,C.jsx)(f.Z,{content:i.help,placement:b.u.TOP_RIGHT})})}),(0,C.jsx)(a.Z,{min:i.min,max:i.max,step:i.step,value:this.value,onChange:this.handleChange,disabled:t,overrides:{Root:{style:{paddingTop:h.twoThirdsSmFont}},Thumb:this.renderThumb,Tick:{style:{fontFamily:l.monospace,fontSize:d.sm}},Track:{style:{backgroundColor:"none !important",paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:h.twoThirdsSmFont}},InnerTrack:{style:e=>{let{$disabled:t}=e;return{height:"4px",...t?{background:r.darkenedBgMix25}:{}}}},TickBar:this.renderTickBar}})]})}}const F=(0,r.b)(w)}}]);
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5106],{87814:(e,t,i)=>{i.d(t,{K:()=>n});var s=i(50641);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,i){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,s.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}},5106:(e,t,i)=>{i.r(t),i.d(t,{default:()=>F});var s=i(66845),n=i(1866),o=i.n(n),a=i(70461),r=i(25621),l=i(52347),d=i(53608),h=i.n(d),m=i(87814),u=i(16295),c=i(50641),g=i(98478),p=i(86659),f=i(8879),b=i(68411),v=i(1515),T=i(35704);const y=(0,v.Z)("div",{target:"ew7r33m3"})((e=>{let{disabled:t,theme:i}=e;return{alignItems:"center",backgroundColor:t?i.colors.gray:i.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",height:i.radii.xl,justifyContent:"center",width:i.radii.xl,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,T.DZ)(i.colors.primary,.5))}}}),""),R=(0,v.Z)("div",{target:"ew7r33m2"})((e=>{let{disabled:t,theme:i}=e;return{fontFamily:i.genericFonts.codeFont,fontSize:i.fontSizes.sm,paddingBottom:i.spacing.twoThirdsSmFont,color:t?i.colors.gray:i.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:i.colors.transparent,lineHeight:i.lineHeights.base,fontWeight:"normal"}}),""),V=(0,v.Z)("div",{target:"ew7r33m1"})((e=>{let{theme:t}=e;return{paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:t.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"}}),""),x=(0,v.Z)("div",{target:"ew7r33m0"})((e=>{let{disabled:t,theme:i}=e;return{lineHeight:i.lineHeights.base,fontWeight:"normal",fontSize:i.fontSizes.sm,fontFamily:i.genericFonts.codeFont,color:t?i.colors.fadedText40:"inherit"}}),"");var C=i(40864);class w extends s.PureComponent{constructor(e){super(e),this.formClearHelper=new m.K,this.state=void 0,this.sliderRef=s.createRef(),this.thumbRef=[],this.thumbValueRef=[],this.commitWidgetValueDebounced=void 0,this.commitWidgetValue=e=>{const{widgetMgr:t,element:i,fragmentId:s}=this.props;t.setDoubleArrayValue(i,this.state.value,e,s)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.handleChange=e=>{let{value:t}=e;this.setState({value:t},(()=>this.commitWidgetValueDebounced({fromUi:!0})))},this.renderThumb=s.forwardRef(((e,t)=>{var i;const{$value:n,$thumbIndex:a}=e,r=a||0;this.thumbRef[r]=t,(i=this.thumbValueRef)[r]||(i[r]=s.createRef());const l=n?this.formatValue(n[a]):"",d=o()(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),h={};return(this.props.element.options.length>0||this.isDateTimeType())&&(h["aria-valuetext"]=l),(0,C.jsx)(y,{...d,disabled:!0===e.$disabled,ref:this.thumbRef[r],"aria-valuetext":l,"aria-label":this.props.element.label,children:(0,C.jsx)(R,{className:"StyledThumbValue","data-testid":"stThumbValue",disabled:!0===e.$disabled,ref:this.thumbValueRef[r],children:l})})})),this.renderTickBar=()=>{const{disabled:e,element:t}=this.props,{max:i,min:s}=t;return(0,C.jsxs)(V,{"data-testid":"stTickBar",children:[(0,C.jsx)(x,{disabled:e,"data-testid":"stTickBarMin",children:this.formatValue(s)}),(0,C.jsx)(x,{disabled:e,"data-testid":"stTickBarMax",children:this.formatValue(i)})]})},this.commitWidgetValueDebounced=(0,c.Ds)(200,this.commitWidgetValue.bind(this)),this.state={value:this.initialValue}}get initialValue(){const e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){setTimeout((()=>{this.thumbValueAlignment()}),0),this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}get value(){const{min:e,max:t}=this.props.element,{value:i}=this.state;let s=i[0],n=i.length>1?i[1]:i[0];return s>n&&(s=n),s<e&&(s=e),s>t&&(s=t),n<e&&(n=e),n>t&&(n=t),i.length>1?[s,n]:[s]}isDateTimeType(){const{dataType:e}=this.props.element;return e===u.iR.DataType.DATETIME||e===u.iR.DataType.DATE||e===u.iR.DataType.TIME}formatValue(e){const{format:t,options:i}=this.props.element;return this.isDateTimeType()?h().utc(e/1e3).format(t):i.length>0?(0,l.sprintf)(t,i[e]):(0,l.sprintf)(t,e)}alignValueOnThumb(e,t,i){if(e&&t&&i){const s=e.getBoundingClientRect(),n=t.getBoundingClientRect(),o=i.getBoundingClientRect(),a=n.left+n.width/2,r=a-o.width/2<s.left,l=a+o.width/2>s.right;i.style.left=r?"0":"",i.style.right=l?"0":""}}thumbValueAlignment(){var e,t,i,s;const n=this.sliderRef.current,o=null===(e=this.thumbRef[0])||void 0===e?void 0:e.current,a=null===(t=this.thumbRef[1])||void 0===t?void 0:t.current,r=null===(i=this.thumbValueRef[0])||void 0===i?void 0:i.current,l=null===(s=this.thumbValueRef[1])||void 0===s?void 0:s.current;if(this.alignValueOnThumb(n,o,r),this.alignValueOnThumb(n,a,l),n&&o&&a&&r&&l){const e=n.getBoundingClientRect(),t=o.getBoundingClientRect(),i=a.getBoundingClientRect(),s=r.getBoundingClientRect(),d=l.getBoundingClientRect();if(s.right+16>d.left){d.left-16-s.width>e.left?r.style.right="".concat(d.width+16-(i.right-t.right),"px"):l.style.left="".concat(s.width+16-(i.left-t.left),"px")}}}render(){var e;const{disabled:t,element:i,theme:s,width:n,widgetMgr:o}=this.props,{colors:r,fonts:l,fontSizes:d,spacing:h}=s,m={width:n};return this.formClearHelper.manageFormClearListener(o,i.formId,this.onFormCleared),this.thumbValueAlignment(),(0,C.jsxs)("div",{ref:this.sliderRef,className:"stSlider","data-testid":"stSlider",style:m,children:[(0,C.jsx)(g.O,{label:i.label,disabled:t,labelVisibility:(0,c.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,C.jsx)(p.dT,{children:(0,C.jsx)(f.Z,{content:i.help,placement:b.u.TOP_RIGHT})})}),(0,C.jsx)(a.Z,{min:i.min,max:i.max,step:i.step,value:this.value,onChange:this.handleChange,disabled:t,overrides:{Root:{style:{paddingTop:h.twoThirdsSmFont}},Thumb:this.renderThumb,Tick:{style:{fontFamily:l.monospace,fontSize:d.sm}},Track:{style:{backgroundColor:"none !important",paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:h.twoThirdsSmFont}},InnerTrack:{style:e=>{let{$disabled:t}=e;return{height:"4px",...t?{background:r.darkenedBgMix25}:{}}}},TickBar:this.renderTickBar}})]})}}const F=(0,r.b)(w)}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7175],{79986:(e,t,r)=>{r.d(t,{Z:()=>c});r(66845);var o,n=r(50641),l=r(86659),a=r(50669),i=r(1515);const s=(0,r(7865).F4)(o||(o=(0,a.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),d=(0,i.Z)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:o}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:o.colors.gray,margin:"0 5px"}}:{},...r?{color:o.colors.red,animationName:"".concat(s),animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var u=r(40864);const c=e=>{let{dirty:t,value:r,maxLength:o,className:a,type:i="single",inForm:s}=e;const c=[],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c.push((0,u.jsx)(d,{includeDot:c.length>0,shouldBlink:t,children:e},c.length))};if(t){const e=s?"submit form":"apply";if("multiline"===i){const t=(0,n.Ge)()?"\u2318":"Ctrl";p("Press ".concat(t,"+Enter to ").concat(e))}else"single"===i&&p("Press Enter to ".concat(e))}return o&&("chat"!==i||t)&&p("".concat(r.length,"/").concat(o),t&&r.length>=o),(0,u.jsx)(l.X7,{"data-testid":"InputInstructions",className:a,children:c})}},87814:(e,t,r)=>{r.d(t,{K:()=>n});var o=r(50641);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}},67175:(e,t,r)=>{r.r(t),r.d(t,{default:()=>j});var o=r(66845),n=r(20607),l=r(89997),a=r(25621),i=r(52347),s=r(87814),d=r(23849),u=r(16295),c=r(48266),p=r(8879),m=r(68411),g=r(46927),h=r(82534),b=r(79986),f=r(98478),v=r(86659),y=r(50641),I=r(1515);const x=(0,I.Z)("div",{target:"e116k4er3"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor||t.colors.widgetBackgroundColor||t.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}}}),""),w=(0,I.Z)("div",{target:"e116k4er2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),C=(0,I.Z)("button",{target:"e116k4er1"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:"".concat(32,"px"),justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}}}),""),T=(0,I.Z)("div",{target:"e116k4er0"})((e=>{let{theme:t,clearable:r}=e;return{position:"absolute",marginRight:t.spacing.twoXS,left:0,right:"".concat(64+(r?12:0),"px")}}),"");var k=r(70479),R=r.n(k),D=r(40864);const F=e=>{let{step:t,dataType:r}=e;return t||(r===u.Y2.DataType.INT?1:.01)},N=e=>{let{value:t,format:r,step:o,dataType:n}=e;if((0,y.le)(t))return null;let l=function(e){return null==e||""===e?void 0:e}(r);if(null==l&&null!=o){const e=o.toString();if(n===u.Y2.DataType.FLOAT&&0!==o&&e.includes(".")){const t=e.split(".")[1].length;l="%0.".concat(t,"f")}}if(null==l)return t.toString();try{return(0,i.sprintf)(l,t)}catch(a){return(0,d.KE)("Error in sprintf(".concat(l,", ").concat(t,"): ").concat(a)),String(t)}},j=(0,a.b)((e=>{var t;let{disabled:r,element:a,widgetMgr:i,width:d,theme:I,fragmentId:k}=e;const{dataType:j,id:W,formId:L,default:S,format:B}=a,M=a.hasMin?a.min:-1/0,Z=a.hasMax?a.max:1/0,[E,V]=o.useState(F(a)),U=(e=>{var t;const r=e.element.dataType===u.Y2.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element);return null!==(t=null!==r&&void 0!==r?r:e.element.default)&&void 0!==t?t:null})({element:a,widgetMgr:i}),[z,A]=o.useState(!1),[_,Y]=o.useState(U),[K,O]=o.useState(N({value:U,...a,step:E})),[P,H]=o.useState(!1),G=o.useRef(null),X=o.useRef(new s.K),$=o.useRef(R()("number_input_")),q=((e,t,r)=>!(0,y.le)(e)&&e-t>=r)(_,E,M),J=((e,t,r)=>!(0,y.le)(e)&&e+t<=r)(_,E,Z);o.useEffect((()=>{V(F({step:a.step,dataType:a.dataType}))}),[a.dataType,a.step]);const Q=o.useCallback((e=>{let{value:t,source:r}=e;if((0,y.bb)(t)&&(M>t||t>Z)){var o;null===(o=G.current)||void 0===o||o.reportValidity()}else{var n;const e=null!==(n=null!==t&&void 0!==t?t:S)&&void 0!==n?n:null;switch(j){case u.Y2.DataType.INT:i.setIntValue({id:W,formId:L},e,r,k);break;case u.Y2.DataType.FLOAT:i.setDoubleValue({id:W,formId:L},e,r,k);break;default:throw new Error("Invalid data type")}A(!1),Y(e),O(N({value:e,dataType:j,format:B,step:E}))}}),[M,Z,G,i,k,E,j,W,L,S,B]),ee=()=>{const{value:e}=a;a.setValue=!1,Y(null!==e&&void 0!==e?e:null),O(N({value:null!==e&&void 0!==e?e:null,...a,step:E})),Q({value:null!==e&&void 0!==e?e:null,source:{fromUi:!1}})};o.useEffect((()=>{const e=X.current;return a.setValue?ee():Q({value:_,source:{fromUi:!1}}),()=>{e.disconnect()}}),[]),a.setValue&&ee();const te=(0,y.le)(a.default)&&!r;X.current.manageFormClearListener(i,a.formId,(()=>{var e;Y(null!==(e=a.default)&&void 0!==e?e:null),Q({value:_,source:{fromUi:!0}})}));const re=o.useCallback((()=>{J&&(A(!0),Q({value:(null!==_&&void 0!==_?_:M)+E,source:{fromUi:!0}}))}),[_,M,E,J]),oe=o.useCallback((()=>{q&&(A(!0),Q({value:(null!==_&&void 0!==_?_:Z)-E,source:{fromUi:!0}}))}),[_,Z,E,q]),ne=o.useCallback((e=>{const{key:t}=e;switch(t){case"ArrowUp":e.preventDefault(),re();break;case"ArrowDown":e.preventDefault(),oe()}}),[re,oe]),le=o.useCallback((e=>{"Enter"===e.key&&(z&&Q({value:_,source:{fromUi:!0}}),(0,y.$b)({formId:L})&&i.submitForm(L,k))}),[z,_,Q,i,L,k]);return(0,D.jsxs)("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:d},children:[(0,D.jsx)(f.O,{label:a.label,disabled:r,labelVisibility:(0,y.iF)(null===(t=a.labelVisibility)||void 0===t?void 0:t.value),htmlFor:$.current,children:a.help&&(0,D.jsx)(v.dT,{children:(0,D.jsx)(p.Z,{content:a.help,placement:m.u.TOP_RIGHT})})}),(0,D.jsxs)(x,{className:P?"focused":"","data-testid":"stNumberInputContainer",children:[(0,D.jsx)(h.Z,{type:"number",inputRef:G,value:null!==K&&void 0!==K?K:"",placeholder:a.placeholder,onBlur:()=>(z&&Q({value:_,source:{fromUi:!0}}),void H(!1)),onFocus:()=>{H(!0)},onChange:e=>(e=>{const{value:t}=e.target;if(""===t)A(!0),Y(null),O(null);else{let e;e=a.dataType===u.Y2.DataType.INT?parseInt(t,10):parseFloat(t),A(!0),Y(e),O(t)}})(e),onKeyPress:e=>le(e),onKeyDown:e=>ne(e),clearable:te,clearOnEscape:te,disabled:r,"aria-label":a.label,id:$.current,overrides:{ClearIcon:{props:{overrides:{Svg:{style:{color:I.colors.darkGray,transform:"scale(1.4)",width:I.spacing.twoXL,marginRight:"-1.25em",":hover":{fill:I.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInput-Input",step:E,min:M,max:Z},style:{lineHeight:I.lineHeights.inputWidget,paddingRight:I.spacing.sm,paddingLeft:I.spacing.sm,paddingBottom:I.spacing.sm,paddingTop:I.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0})}}}),d>c.A.hideNumberInputControls&&(0,D.jsxs)(w,{children:[(0,D.jsx)(C,{className:"step-down","data-testid":"stNumberInput-StepDown",onClick:oe,disabled:!q||r,tabIndex:-1,children:(0,D.jsx)(g.Z,{content:n.W,size:"xs",color:q?"inherit":"disabled"})}),(0,D.jsx)(C,{className:"step-up","data-testid":"stNumberInput-StepUp",onClick:re,disabled:!J||r,tabIndex:-1,children:(0,D.jsx)(g.Z,{content:l.v,size:"xs",color:J?"inherit":"disabled"})})]})]}),d>c.A.hideWidgetDetails&&(0,D.jsx)(T,{clearable:te,children:(0,D.jsx)(b.Z,{dirty:z,value:null!==K&&void 0!==K?K:"",inForm:(0,y.$b)({formId:a.formId})})})]})}))}}]);
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7175],{79986:(e,t,r)=>{r.d(t,{Z:()=>c});r(66845);var o,n=r(50641),l=r(86659),a=r(50669),i=r(1515);const s=(0,r(7865).F4)(o||(o=(0,a.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),d=(0,i.Z)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:o}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:o.colors.gray,margin:"0 5px"}}:{},...r?{color:o.colors.red,animationName:"".concat(s),animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var u=r(40864);const c=e=>{let{dirty:t,value:r,maxLength:o,className:a,type:i="single",inForm:s}=e;const c=[],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c.push((0,u.jsx)(d,{includeDot:c.length>0,shouldBlink:t,children:e},c.length))};if(t){const e=s?"submit form":"apply";if("multiline"===i){const t=(0,n.Ge)()?"\u2318":"Ctrl";p("Press ".concat(t,"+Enter to ").concat(e))}else"single"===i&&p("Press Enter to ".concat(e))}return o&&("chat"!==i||t)&&p("".concat(r.length,"/").concat(o),t&&r.length>=o),(0,u.jsx)(l.X7,{"data-testid":"InputInstructions",className:a,children:c})}},87814:(e,t,r)=>{r.d(t,{K:()=>n});var o=r(50641);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}},67175:(e,t,r)=>{r.r(t),r.d(t,{default:()=>j});var o=r(66845),n=r(20607),l=r(89997),a=r(25621),i=r(52347),s=r(82534),d=r(70479),u=r.n(d),c=r(87814),p=r(23849),m=r(16295),g=r(48266),h=r(8879),b=r(68411),f=r(46927),v=r(79986),y=r(98478),I=r(86659),x=r(50641),w=r(1515);const C=(0,w.Z)("div",{target:"e116k4er3"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor||t.colors.widgetBackgroundColor||t.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}}}),""),T=(0,w.Z)("div",{target:"e116k4er2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),k=(0,w.Z)("button",{target:"e116k4er1"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:"".concat(32,"px"),justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}}}),""),R=(0,w.Z)("div",{target:"e116k4er0"})((e=>{let{theme:t,clearable:r}=e;return{position:"absolute",marginRight:t.spacing.twoXS,left:0,right:"".concat(64+(r?12:0),"px")}}),"");var D=r(40864);const F=e=>{let{step:t,dataType:r}=e;return t||(r===m.Y2.DataType.INT?1:.01)},N=e=>{let{value:t,format:r,step:o,dataType:n}=e;if((0,x.le)(t))return null;let l=function(e){return null==e||""===e?void 0:e}(r);if(null==l&&null!=o){const e=o.toString();if(n===m.Y2.DataType.FLOAT&&0!==o&&e.includes(".")){const t=e.split(".")[1].length;l="%0.".concat(t,"f")}}if(null==l)return t.toString();try{return(0,i.sprintf)(l,t)}catch(a){return(0,p.KE)("Error in sprintf(".concat(l,", ").concat(t,"): ").concat(a)),String(t)}},j=(0,a.b)((e=>{var t;let{disabled:r,element:a,widgetMgr:i,width:d,theme:p,fragmentId:w}=e;const{dataType:j,id:W,formId:L,default:S,format:B}=a,M=a.hasMin?a.min:-1/0,Z=a.hasMax?a.max:1/0,[E,V]=o.useState(F(a)),U=(e=>{var t;const r=e.element.dataType===m.Y2.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element);return null!==(t=null!==r&&void 0!==r?r:e.element.default)&&void 0!==t?t:null})({element:a,widgetMgr:i}),[z,A]=o.useState(!1),[_,Y]=o.useState(U),[K,O]=o.useState(N({value:U,...a,step:E})),[P,H]=o.useState(!1),G=o.useRef(null),X=o.useRef(new c.K),$=o.useRef(u()("number_input_")),q=((e,t,r)=>!(0,x.le)(e)&&e-t>=r)(_,E,M),J=((e,t,r)=>!(0,x.le)(e)&&e+t<=r)(_,E,Z);o.useEffect((()=>{V(F({step:a.step,dataType:a.dataType}))}),[a.dataType,a.step]);const Q=o.useCallback((e=>{let{value:t,source:r}=e;if((0,x.bb)(t)&&(M>t||t>Z)){var o;null===(o=G.current)||void 0===o||o.reportValidity()}else{var n;const e=null!==(n=null!==t&&void 0!==t?t:S)&&void 0!==n?n:null;switch(j){case m.Y2.DataType.INT:i.setIntValue({id:W,formId:L},e,r,w);break;case m.Y2.DataType.FLOAT:i.setDoubleValue({id:W,formId:L},e,r,w);break;default:throw new Error("Invalid data type")}A(!1),Y(e),O(N({value:e,dataType:j,format:B,step:E}))}}),[M,Z,G,i,w,E,j,W,L,S,B]),ee=()=>{const{value:e}=a;a.setValue=!1,Y(null!==e&&void 0!==e?e:null),O(N({value:null!==e&&void 0!==e?e:null,...a,step:E})),Q({value:null!==e&&void 0!==e?e:null,source:{fromUi:!1}})};o.useEffect((()=>{const e=X.current;return a.setValue?ee():Q({value:_,source:{fromUi:!1}}),()=>{e.disconnect()}}),[]),a.setValue&&ee();const te=(0,x.le)(a.default)&&!r;X.current.manageFormClearListener(i,a.formId,(()=>{var e;Y(null!==(e=a.default)&&void 0!==e?e:null),Q({value:_,source:{fromUi:!0}})}));const re=o.useCallback((()=>{J&&(A(!0),Q({value:(null!==_&&void 0!==_?_:M)+E,source:{fromUi:!0}}))}),[_,M,E,J]),oe=o.useCallback((()=>{q&&(A(!0),Q({value:(null!==_&&void 0!==_?_:Z)-E,source:{fromUi:!0}}))}),[_,Z,E,q]),ne=o.useCallback((e=>{const{key:t}=e;switch(t){case"ArrowUp":e.preventDefault(),re();break;case"ArrowDown":e.preventDefault(),oe()}}),[re,oe]),le=o.useCallback((e=>{"Enter"===e.key&&(z&&Q({value:_,source:{fromUi:!0}}),(0,x.$b)({formId:L})&&i.submitForm(L,w))}),[z,_,Q,i,L,w]);return(0,D.jsxs)("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:d},children:[(0,D.jsx)(y.O,{label:a.label,disabled:r,labelVisibility:(0,x.iF)(null===(t=a.labelVisibility)||void 0===t?void 0:t.value),htmlFor:$.current,children:a.help&&(0,D.jsx)(I.dT,{children:(0,D.jsx)(h.Z,{content:a.help,placement:b.u.TOP_RIGHT})})}),(0,D.jsxs)(C,{className:P?"focused":"","data-testid":"stNumberInputContainer",children:[(0,D.jsx)(s.Z,{type:"number",inputRef:G,value:null!==K&&void 0!==K?K:"",placeholder:a.placeholder,onBlur:()=>(z&&Q({value:_,source:{fromUi:!0}}),void H(!1)),onFocus:()=>{H(!0)},onChange:e=>(e=>{const{value:t}=e.target;if(""===t)A(!0),Y(null),O(null);else{let e;e=a.dataType===m.Y2.DataType.INT?parseInt(t,10):parseFloat(t),A(!0),Y(e),O(t)}})(e),onKeyPress:e=>le(e),onKeyDown:e=>ne(e),clearable:te,clearOnEscape:te,disabled:r,"aria-label":a.label,id:$.current,overrides:{ClearIcon:{props:{overrides:{Svg:{style:{color:p.colors.darkGray,transform:"scale(1.4)",width:p.spacing.twoXL,marginRight:"-1.25em",":hover":{fill:p.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInput-Input",step:E,min:M,max:Z},style:{lineHeight:p.lineHeights.inputWidget,paddingRight:p.spacing.sm,paddingLeft:p.spacing.sm,paddingBottom:p.spacing.sm,paddingTop:p.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0})}}}),d>g.A.hideNumberInputControls&&(0,D.jsxs)(T,{children:[(0,D.jsx)(k,{className:"step-down","data-testid":"stNumberInput-StepDown",onClick:oe,disabled:!q||r,tabIndex:-1,children:(0,D.jsx)(f.Z,{content:n.W,size:"xs",color:q?"inherit":"disabled"})}),(0,D.jsx)(k,{className:"step-up","data-testid":"stNumberInput-StepUp",onClick:re,disabled:!J||r,tabIndex:-1,children:(0,D.jsx)(f.Z,{content:l.v,size:"xs",color:J?"inherit":"disabled"})})]})]}),d>g.A.hideWidgetDetails&&(0,D.jsx)(R,{clearable:te,children:(0,D.jsx)(v.Z,{dirty:z,value:null!==K&&void 0!==K?K:"",inForm:(0,x.$b)({formId:a.formId})})})]})}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7602],{90186:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(66845),r=s(25621),o=s(66694),a=s(27466),n=s(38570),l=s(80318),d=s(40864);let c;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(c||(c={}));const h=function(e){let{value:t,width:s,size:h=c.SMALL,overrides:u}=e;const g=(0,r.u)(),p={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:m}=i.useContext(o.E),f=!(0,a.MJ)(m),S={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:s?s.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:p[h],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?g.colors.primary:g.colors.blue70,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})}};return(0,d.jsx)(n.Z,{value:t,overrides:(0,l.aO)(S,u)})}},47602:(e,t,s)=>{s.r(t),s.d(t,{default:()=>q});var i,r=s(47869),o=s(18080),a=s(62813),n=s.n(a),l=s(66845),d=s(16295),c=s(46927),h=s(68411),u=s(8879),g=s(98478),p=s(86659),m=s(87814),f=s(23849),S=s(50641),C=s(77367),R=s(90186),b=s(1515),w=s(35704);function x(e,t){switch(e){case i.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case i.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case i.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(i||(i={}));const F=(0,b.Z)("div",{target:"etz5kuj9"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),I=(0,b.Z)("div",{target:"etz5kuj8"})((e=>{let{theme:t,width:s}=e;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.default," ").concat(t.radii.default," 0 0"),width:"100%",height:9*s/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),v=(0,b.Z)("p",{target:"etz5kuj7"})((e=>{let{theme:t}=e;return{marginTop:t.spacing.sm,textAlign:"center"}}),""),M=(0,b.Z)("img",{target:"etz5kuj6"})((e=>{let{theme:t,opacity:s}=e;return{borderRadius:"".concat(t.radii.default," ").concat(t.radii.default," 0 0"),objectFit:"contain",opacity:s}}),""),y=(0,b.Z)("a",{target:"etz5kuj5"})((e=>{let{theme:t}=e;return{color:t.colors.primary,display:"block",textDecoration:"none"}}),""),E=(0,b.Z)("span",{target:"etz5kuj4"})((()=>({display:"flex",alignItems:"center"})),""),T=(0,b.Z)("div",{target:"etz5kuj3"})((e=>{let{theme:t}=e;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),j=(0,b.Z)("div",{target:"etz5kuj1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),L=(0,b.Z)("button",{target:"etz5kuj0"})((e=>{let{theme:t}=e;return{position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"".concat(t.sizes.borderWidth," solid ").concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.default," ").concat(t.radii.default),"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:"".concat(t.spacing.xs," ").concat(t.spacing.md),margin:0,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,w.DZ)(t.colors.primary,.5))},...x(i.MEDIUM,t)}}),"");var U=s(40864);const P=function(e){let{disabled:t,onClick:s,children:i,progress:r}=e;return(0,U.jsxs)(L,{disabled:t||!1,onClick:s||(()=>{}),progress:r||null,"data-testid":"stCameraInputButton",children:[i,r&&(0,U.jsx)(j,{children:(0,U.jsx)(R.Z,{value:r,size:R.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var k=s(77979),z=s(9003),Z=s(81354),D=s(11765);let O;!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));const X=e=>{let{switchFacingMode:t}=e;return(0,U.jsx)(T,{"data-testid":"stCameraSwitchButton",children:(0,U.jsx)(h.Z,{content:"Switch camera",placement:h.u.TOP_RIGHT,children:(0,U.jsx)(z.ZP,{kind:Z.nW.MINIMAL,onClick:t,children:(0,U.jsx)(c.Z,{content:k.Z,size:"twoXL",color:D.Z.white})})})})};var B=s(3084),W=s(25621),_=s(91706),A=s(48051),V=s.n(A),G=s(84192);let N;!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(N||(N={}));const H=e=>{let{width:t}=e;return(0,U.jsxs)(I,{width:t,children:[(0,U.jsx)(c.Z,{size:"threeXL",color:D.Z.gray60,content:B.n}),(0,U.jsxs)(v,{children:["This app would like to use your camera.",(0,U.jsx)(y,{href:G.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},$=e=>{let{handleCapture:t,width:s,disabled:i,clearPhotoInProgress:r,setClearPhotoInProgress:o,facingMode:a,setFacingMode:n,testOverride:d}=e;const[c,h]=(0,l.useState)(d||N.PENDING),u=(0,l.useRef)(null),[g,p]=(0,l.useState)(s),m=(0,l.useCallback)((0,S.Ds)(1e3,p),[]);(0,l.useEffect)((()=>{m(s)}),[s,m]);const f=(0,W.u)();return(0,U.jsxs)(F,{width:g,"data-testid":"stWebcamComponent",children:[c===N.SUCCESS||i||r?_.tq&&(0,U.jsx)(X,{switchFacingMode:n}):(0,U.jsx)(H,{width:g}),(0,U.jsx)(I,{"data-testid":"stWebcamStyledBox",hidden:c!==N.SUCCESS&&!i&&!r,width:g,children:!i&&(0,U.jsx)(V(),{audio:!1,ref:u,screenshotFormat:"image/jpeg",screenshotQuality:1,width:g,height:9*g/16,style:{borderRadius:"".concat(f.radii.default," ").concat(f.radii.default," 0 0")},onUserMediaError:()=>{h(N.ERROR)},onUserMedia:()=>{h(N.SUCCESS),o(!1)},videoConstraints:{width:{ideal:g},facingMode:a}})}),(0,U.jsx)(P,{onClick:function(){if(null!==u.current){const e=u.current.getScreenshot();t(e)}},disabled:c!==N.SUCCESS||i||r,children:"Take Photo"})]})};class K extends l.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new m.K,this.getProgress=()=>{if(this.state.files.length>0&&"uploading"===this.state.files[this.state.files.length-1].status.type){return this.state.files[this.state.files.length-1].status.progress}},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState((e=>({facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});return(t=e,s="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.props.uploadClient.fetchFileURLs([e]).then((t=>({file:e,fileUrls:t[0]}))))).then((e=>{let{file:t,fileUrls:s}=e;return this.uploadFile(s,t)})).then((()=>{return e=150,new Promise((t=>setTimeout(t,e)));var e})).then((()=>{this.setState(((t,s)=>({imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0})))})).catch((e=>{(0,f.H)(e)}));var t,s},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:i}=this.props,r=s.getFileUploaderStateValue(t);n()(e,r)||s.setFileUploaderStateValue(t,e,{fromUi:!0},i)},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if(null==e)return;this.setState({imgSrc:null});const{widgetMgr:t,element:s,fragmentId:i}=this.props;t.setFileUploaderStateValue(s,e,{fromUi:!0},i)}))},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&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.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((s=>({files:s.files.map((s=>s.id===e?t:s))})))},this.onUploadComplete=(e,t)=>{this.setState((()=>({shutter:!1})));const s=this.getFile(e);null!=s&&"uploading"===s.status.type&&this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(null==s||"uploading"!==s.status.type)return;const i=Math.round(100*e.loaded/e.total);s.status.progress!==i&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:i}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,t)=>{const s=o.Z.CancelToken.source(),i=new C.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(i),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,i.id)),s.token).then((()=>this.onUploadComplete(i.id,e))).catch((e=>{o.Z.isCancel(e)||this.updateFile(i.id,i.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if(null==i)return e;const{uploadedFileInfo:r}=i;return null==r||0===r.length?e:{files:r.map((e=>{const t=e.name,s=e.size,i=e.fileId,r=e.fileUrls;return new C.R(t,s,this.nextLocalFileId(),{type:"uploaded",fileId:i,fileUrls:r})})),imgSrc:0===r.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:i}=this.props;void 0===s.getFileUploaderStateValue(t)&&s.setFileUploaderStateValue(t,e,{fromUi:!1},i)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new d.jM({fileId:i.fileId,fileUrls:i.fileUrls,name:t,size:s})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:i,width:o}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,U.jsxs)(F,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,U.jsx)(g.O,{label:t.label,disabled:i,labelVisibility:(0,S.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,U.jsx)(p.dT,{children:(0,U.jsx)(u.Z,{content:t.help,placement:h.u.TOP_RIGHT})})}),this.state.imgSrc?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(I,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,U.jsx)(M,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,U.jsx)(P,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,U.jsxs)(E,{children:[(0,U.jsx)(c.Z,{content:r.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,U.jsx)($,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}const q=K},77367:(e,t,s)=>{s.d(t,{R:()=>i});class i{setStatus(e){return new i(this.name,this.size,this.id,e)}constructor(e,t,s,i){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=s,this.status=i}}},87814:(e,t,s)=>{s.d(t,{K:()=>r});var i=s(50641);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7602],{90186:(e,t,s)=>{s.d(t,{$:()=>c,Z:()=>h});var i=s(66845),r=s(25621),o=s(38570),a=s(80318),n=s(27466),l=s(66694),d=s(40864);let c;!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(c||(c={}));const h=function(e){let{value:t,width:s,size:h=c.SMALL,overrides:u}=e;const g=(0,r.u)(),p={xs:g.spacing.twoXS,sm:g.spacing.sm,md:g.spacing.lg,lg:g.spacing.xl,xl:g.spacing.twoXL},{activeTheme:m}=i.useContext(l.E),f=!(0,n.MJ)(m),S={BarContainer:{style:{marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none}},Bar:{style:e=>{let{$theme:t}=e;return{width:s?s.toString():void 0,marginTop:g.spacing.none,marginBottom:g.spacing.none,marginRight:g.spacing.none,marginLeft:g.spacing.none,height:p[h],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:f?g.colors.primary:g.colors.blue70,borderTopLeftRadius:g.spacing.twoXS,borderTopRightRadius:g.spacing.twoXS,borderBottomLeftRadius:g.spacing.twoXS,borderBottomRightRadius:g.spacing.twoXS})}};return(0,d.jsx)(o.Z,{value:t,overrides:(0,a.aO)(S,u)})}},47602:(e,t,s)=>{s.r(t),s.d(t,{default:()=>q});var i,r=s(66845),o=s(47869),a=s(18080),n=s(62813),l=s.n(n),d=s(16295),c=s(46927),h=s(68411),u=s(8879),g=s(98478),p=s(86659),m=s(87814),f=s(23849),S=s(50641),C=s(77367),R=s(90186),b=s(1515),w=s(35704);function x(e,t){switch(e){case i.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case i.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case i.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(i||(i={}));const F=(0,b.Z)("div",{target:"etz5kuj9"})((()=>({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"})),""),I=(0,b.Z)("div",{target:"etz5kuj8"})((e=>{let{theme:t,width:s}=e;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.default," ").concat(t.radii.default," 0 0"),width:"100%",height:9*s/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),v=(0,b.Z)("p",{target:"etz5kuj7"})((e=>{let{theme:t}=e;return{marginTop:t.spacing.sm,textAlign:"center"}}),""),M=(0,b.Z)("img",{target:"etz5kuj6"})((e=>{let{theme:t,opacity:s}=e;return{borderRadius:"".concat(t.radii.default," ").concat(t.radii.default," 0 0"),objectFit:"contain",opacity:s}}),""),y=(0,b.Z)("a",{target:"etz5kuj5"})((e=>{let{theme:t}=e;return{color:t.colors.primary,display:"block",textDecoration:"none"}}),""),E=(0,b.Z)("span",{target:"etz5kuj4"})((()=>({display:"flex",alignItems:"center"})),""),T=(0,b.Z)("div",{target:"etz5kuj3"})((e=>{let{theme:t}=e;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),j=(0,b.Z)("div",{target:"etz5kuj1"})((()=>({height:"fit-content",width:"100%",position:"absolute",bottom:0})),""),L=(0,b.Z)("button",{target:"etz5kuj0"})((e=>{let{theme:t}=e;return{position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"".concat(t.sizes.borderWidth," solid ").concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.default," ").concat(t.radii.default),"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:"".concat(t.spacing.xs," ").concat(t.spacing.md),margin:0,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,w.DZ)(t.colors.primary,.5))},...x(i.MEDIUM,t)}}),"");var U=s(40864);const P=function(e){let{disabled:t,onClick:s,children:i,progress:r}=e;return(0,U.jsxs)(L,{disabled:t||!1,onClick:s||(()=>{}),progress:r||null,"data-testid":"stCameraInputButton",children:[i,r&&(0,U.jsx)(j,{children:(0,U.jsx)(R.Z,{value:r,size:R.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})};var k=s(77979),z=s(9003),Z=s(81354),D=s(11765);let O;!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));const X=e=>{let{switchFacingMode:t}=e;return(0,U.jsx)(T,{"data-testid":"stCameraSwitchButton",children:(0,U.jsx)(h.Z,{content:"Switch camera",placement:h.u.TOP_RIGHT,children:(0,U.jsx)(z.ZP,{kind:Z.nW.MINIMAL,onClick:t,children:(0,U.jsx)(c.Z,{content:k.Z,size:"twoXL",color:D.Z.white})})})})};var B=s(3084),W=s(25621),_=s(91706),A=s(48051),V=s.n(A),G=s(84192);let N;!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(N||(N={}));const H=e=>{let{width:t}=e;return(0,U.jsxs)(I,{width:t,children:[(0,U.jsx)(c.Z,{size:"threeXL",color:D.Z.gray60,content:B.n}),(0,U.jsxs)(v,{children:["This app would like to use your camera.",(0,U.jsx)(y,{href:G.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},$=e=>{let{handleCapture:t,width:s,disabled:i,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:n,setFacingMode:l,testOverride:d}=e;const[c,h]=(0,r.useState)(d||N.PENDING),u=(0,r.useRef)(null),[g,p]=(0,r.useState)(s),m=(0,r.useCallback)((0,S.Ds)(1e3,p),[]);(0,r.useEffect)((()=>{m(s)}),[s,m]);const f=(0,W.u)();return(0,U.jsxs)(F,{width:g,"data-testid":"stWebcamComponent",children:[c===N.SUCCESS||i||o?_.tq&&(0,U.jsx)(X,{switchFacingMode:l}):(0,U.jsx)(H,{width:g}),(0,U.jsx)(I,{"data-testid":"stWebcamStyledBox",hidden:c!==N.SUCCESS&&!i&&!o,width:g,children:!i&&(0,U.jsx)(V(),{audio:!1,ref:u,screenshotFormat:"image/jpeg",screenshotQuality:1,width:g,height:9*g/16,style:{borderRadius:"".concat(f.radii.default," ").concat(f.radii.default," 0 0")},onUserMediaError:()=>{h(N.ERROR)},onUserMedia:()=>{h(N.SUCCESS),a(!1)},videoConstraints:{width:{ideal:g},facingMode:n}})}),(0,U.jsx)(P,{onClick:function(){if(null!==u.current){const e=u.current.getScreenshot();t(e)}},disabled:c!==N.SUCCESS||i||o,children:"Take Photo"})]})};class K extends r.PureComponent{constructor(e){super(e),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new m.K,this.getProgress=()=>{if(this.state.files.length>0&&"uploading"===this.state.files[this.state.files.length-1].status.type){return this.state.files[this.state.files.length-1].status.progress}},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState((e=>({facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER})))},this.handleCapture=e=>{if(null===e)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});return(t=e,s="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((e=>e.arrayBuffer())).then((e=>new File([e],s,{type:"image/jpeg"})))).then((e=>this.props.uploadClient.fetchFileURLs([e]).then((t=>({file:e,fileUrls:t[0]}))))).then((e=>{let{file:t,fileUrls:s}=e;return this.uploadFile(s,t)})).then((()=>{return e=150,new Promise((t=>setTimeout(t,e)));var e})).then((()=>{this.setState(((t,s)=>({imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0})))})).catch((e=>{(0,f.H)(e)}));var t,s},this.removeCapture=()=>{0!==this.state.files.length&&(this.state.files.forEach((e=>this.deleteFile(e.id))),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if("ready"!==this.status)return;const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:i}=this.props,r=s.getFileUploaderStateValue(t);l()(e,r)||s.setFileUploaderStateValue(t,e,{fromUi:!0},i)},this.onFormCleared=()=>{this.setState({files:[]},(()=>{const e=this.createWidgetValue();if(null==e)return;this.setState({imgSrc:null});const{widgetMgr:t,element:s,fragmentId:i}=this.props;t.setFileUploaderStateValue(s,e,{fromUi:!0},i)}))},this.deleteFile=e=>{const t=this.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),"uploaded"===t.status.type&&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.removeFile=e=>{this.setState((t=>({files:t.files.filter((t=>t.id!==e))})))},this.getFile=e=>this.state.files.find((t=>t.id===e)),this.updateFile=(e,t)=>{this.setState((s=>({files:s.files.map((s=>s.id===e?t:s))})))},this.onUploadComplete=(e,t)=>{this.setState((()=>({shutter:!1})));const s=this.getFile(e);null!=s&&"uploading"===s.status.type&&this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(null==s||"uploading"!==s.status.type)return;const i=Math.round(100*e.loaded/e.total);s.status.progress!==i&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:i}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,t)=>{const s=a.Z.CancelToken.source(),i=new C.R(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(i),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,(e=>this.onUploadProgress(e,i.id)),s.token).then((()=>this.onUploadComplete(i.id,e))).catch((e=>{a.Z.isCancel(e)||this.updateFile(i.id,i.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},this.state=this.initialValue}get initialValue(){const e={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},{widgetMgr:t,element:s}=this.props,i=t.getFileUploaderStateValue(s);if(null==i)return e;const{uploadedFileInfo:r}=i;return null==r||0===r.length?e:{files:r.map((e=>{const t=e.name,s=e.size,i=e.fileId,r=e.fileUrls;return new C.R(t,s,this.nextLocalFileId(),{type:"uploaded",fileId:i,fileUrls:r})})),imgSrc:0===r.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){return this.state.files.some((e=>"uploading"===e.status.type))?"updating":"ready"}componentDidMount(){const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:i}=this.props;void 0===s.getFileUploaderStateValue(t)&&s.setFileUploaderStateValue(t,e,{fromUi:!1},i)}createWidgetValue(){const e=this.state.files.filter((e=>"uploaded"===e.status.type)).map((e=>{const{name:t,size:s,status:i}=e;return new d.jM({fileId:i.fileId,fileUrls:i.fileUrls,name:t,size:s})}));return new d.xO({uploadedFileInfo:e})}render(){var e;const{element:t,widgetMgr:s,disabled:i,width:r}=this.props;return this.formClearHelper.manageFormClearListener(s,t.formId,this.onFormCleared),(0,U.jsxs)(F,{width:r,className:"row-widget","data-testid":"stCameraInput",children:[(0,U.jsx)(g.O,{label:t.label,disabled:i,labelVisibility:(0,S.iF)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),children:t.help&&(0,U.jsx)(p.dT,{children:(0,U.jsx)(u.Z,{content:t.help,placement:h.u.TOP_RIGHT})})}),this.state.imgSrc?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(I,{width:r,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,U.jsx)(M,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:r,height:9*r/16})}),(0,U.jsx)(P,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,U.jsxs)(E,{children:[(0,U.jsx)(c.Z,{content:o.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,U.jsx)($,{handleCapture:this.handleCapture,width:r,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}const q=K},77367:(e,t,s)=>{s.d(t,{R:()=>i});class i{setStatus(e){return new i(this.name,this.size,this.id,e)}constructor(e,t,s,i){this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=e,this.size=t,this.id=s,this.status=i}}},87814:(e,t,s)=>{s.d(t,{K:()=>r});var i=s(50641);class r{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,s){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,s),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8427],{18427:(e,t,o)=>{o.r(t),o.d(t,{default:()=>m});var i=o(66845),r=o(25621),s=o(69021),a=o(27466),n=o(63730),d=o(59033),l=o(36989),c=o(1515);const p=(0,c.Z)("button",{target:"elibz2u3"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,lineHeight:"1.4rem",color:t.colors.fadedText60,backgroundColor:t.colors.transparent,border:"none",boxShadow:"none",padding:"0px","&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:t.colors.primary}}}),""),u=(0,c.Z)("div",{target:"elibz2u2"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",gap:t.spacing.lg,"> span":{marginTop:"0.25rem"}}}),""),g=(0,c.Z)("div",{target:"elibz2u0"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"column",gap:t.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.base}}),"");var f=o(22704),h=o(40864);const m=(0,r.b)((function(e){let{theme:t,body:o,icon:r,width:c}=e;const m=function(e){if(e.length>104){let t=e.replace(/^(.{104}[^\s]*).*/,"$1");return t.length>104&&(t=t.substring(0,104).split(" ").slice(0,-1).join(" ")),t.trim()}return e}(o),b=o!==m,[x,w]=(0,i.useState)(!b),[y,v]=(0,i.useState)(0),S=(0,i.useCallback)((()=>{w(!x)}),[x]),T=(0,i.useMemo)((()=>function(e){const t=(0,a.Iy)(e);return{Body:{props:{"data-testid":"stToast"},style:{display:"flex",flexDirection:"row",gap:e.spacing.md,width:e.sizes.sidebar,marginTop:"8px",borderTopLeftRadius:e.radii.default,borderTopRightRadius:e.radii.default,borderBottomLeftRadius:e.radii.default,borderBottomRightRadius:e.radii.default,paddingTop:e.spacing.lg,paddingBottom:e.spacing.lg,paddingLeft:e.spacing.twoXL,paddingRight:e.spacing.twoXL,backgroundColor:t?e.colors.gray10:e.colors.gray90,color:e.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:e.colors.fadedText40,width:e.fontSizes.lg,height:e.fontSizes.lg,marginRight:"calc(-1 * ".concat(e.spacing.lg," / 2)"),":hover":{color:e.colors.bodyText}}}}}(t)),[t]),z=(0,i.useMemo)((()=>(0,h.jsx)(h.Fragment,{children:(0,h.jsxs)(u,{expanded:x,children:[r&&(0,h.jsx)(f.p,{iconValue:r,size:"xl",testid:"stToastDynamicIcon"}),(0,h.jsxs)(g,{children:[(0,h.jsx)(n.ZP,{source:x?o:m,allowHTML:!1,isToast:!0}),b&&(0,h.jsx)(p,{"data-testid":"toastViewButton",className:"toastViewButton",onClick:S,children:x?"view less":"view more"})]})]})})),[b,x,o,r,m,S]);(0,i.useEffect)((()=>{if(t.inSidebar)return;const e=s.Z.info(z,{overrides:{...T}});return v(e),()=>{s.Z.update(e,{overrides:{Body:{style:{transitionDuration:0}}}}),s.Z.clear(e)}}),[]),(0,i.useEffect)((()=>{s.Z.update(y,{children:z,overrides:{...T}})}),[y,z,T]);const R=(0,h.jsx)(l.Z,{kind:d.h.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information.",width:c});return(0,h.jsx)(h.Fragment,{children:t.inSidebar&&R})}))}}]);
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8427],{18427:(e,t,o)=>{o.r(t),o.d(t,{default:()=>m});var i=o(66845),r=o(25621),s=o(69021),a=o(27466),n=o(63730),d=o(59033),l=o(36989),c=o(22704),p=o(1515);const u=(0,p.Z)("button",{target:"elibz2u3"})((e=>{let{theme:t}=e;return{fontSize:t.fontSizes.sm,lineHeight:"1.4rem",color:t.colors.fadedText60,backgroundColor:t.colors.transparent,border:"none",boxShadow:"none",padding:"0px","&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:t.colors.primary}}}),""),g=(0,p.Z)("div",{target:"elibz2u2"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",gap:t.spacing.lg,"> span":{marginTop:"0.25rem"}}}),""),f=(0,p.Z)("div",{target:"elibz2u0"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"column",gap:t.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.base}}),"");var h=o(40864);const m=(0,r.b)((function(e){let{theme:t,body:o,icon:r,width:p}=e;const m=function(e){if(e.length>104){let t=e.replace(/^(.{104}[^\s]*).*/,"$1");return t.length>104&&(t=t.substring(0,104).split(" ").slice(0,-1).join(" ")),t.trim()}return e}(o),b=o!==m,[x,w]=(0,i.useState)(!b),[y,v]=(0,i.useState)(0),S=(0,i.useCallback)((()=>{w(!x)}),[x]),T=(0,i.useMemo)((()=>function(e){const t=(0,a.Iy)(e);return{Body:{props:{"data-testid":"stToast"},style:{display:"flex",flexDirection:"row",gap:e.spacing.md,width:e.sizes.sidebar,marginTop:"8px",borderTopLeftRadius:e.radii.default,borderTopRightRadius:e.radii.default,borderBottomLeftRadius:e.radii.default,borderBottomRightRadius:e.radii.default,paddingTop:e.spacing.lg,paddingBottom:e.spacing.lg,paddingLeft:e.spacing.twoXL,paddingRight:e.spacing.twoXL,backgroundColor:t?e.colors.gray10:e.colors.gray90,color:e.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:e.colors.fadedText40,width:e.fontSizes.lg,height:e.fontSizes.lg,marginRight:"calc(-1 * ".concat(e.spacing.lg," / 2)"),":hover":{color:e.colors.bodyText}}}}}(t)),[t]),z=(0,i.useMemo)((()=>(0,h.jsx)(h.Fragment,{children:(0,h.jsxs)(g,{expanded:x,children:[r&&(0,h.jsx)(c.p,{iconValue:r,size:"xl",testid:"stToastDynamicIcon"}),(0,h.jsxs)(f,{children:[(0,h.jsx)(n.ZP,{source:x?o:m,allowHTML:!1,isToast:!0}),b&&(0,h.jsx)(u,{"data-testid":"toastViewButton",className:"toastViewButton",onClick:S,children:x?"view less":"view more"})]})]})})),[b,x,o,r,m,S]);(0,i.useEffect)((()=>{if(t.inSidebar)return;const e=s.Z.info(z,{overrides:{...T}});return v(e),()=>{s.Z.update(e,{overrides:{Body:{style:{transitionDuration:0}}}}),s.Z.clear(e)}}),[]),(0,i.useEffect)((()=>{s.Z.update(y,{children:z,overrides:{...T}})}),[y,z,T]);const R=(0,h.jsx)(l.Z,{kind:d.h.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information.",width:p});return(0,h.jsx)(h.Fragment,{children:t.inSidebar&&R})}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8477],{58477:(t,e,o)=>{o.r(e),o.d(e,{default:()=>c});o(66845);var s=o(90186),i=o(1515),n=o(27466);const r=(0,i.Z)("div",{target:"e18r7x300"})((t=>{let{theme:e}=t;return{paddingBottom:e.spacing.smPx,lineHeight:e.lineHeights.normal,color:(0,n.yq)(e)}}),"");var a=o(63730),g=o(40864);const c=function(t){let{element:e,width:o}=t;return(0,g.jsxs)("div",{className:"stProgress","data-testid":"stProgress",children:[(0,g.jsx)(r,{children:(0,g.jsx)(a.ZP,{source:e.text,allowHTML:!1,isLabel:!0})}),(0,g.jsx)(s.Z,{value:e.value,width:o})]})}},90186:(t,e,o)=>{o.d(e,{$:()=>l,Z:()=>d});var s=o(66845),i=o(25621),n=o(66694),r=o(27466),a=o(38570),g=o(80318),c=o(40864);let l;!function(t){t.EXTRASMALL="xs",t.SMALL="sm",t.MEDIUM="md",t.LARGE="lg",t.EXTRALARGE="xl"}(l||(l={}));const d=function(t){let{value:e,width:o,size:d=l.SMALL,overrides:p}=t;const m=(0,i.u)(),u={xs:m.spacing.twoXS,sm:m.spacing.sm,md:m.spacing.lg,lg:m.spacing.xl,xl:m.spacing.twoXL},{activeTheme:h}=s.useContext(n.E),R=!(0,r.MJ)(h),w={BarContainer:{style:{marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none}},Bar:{style:t=>{let{$theme:e}=t;return{width:o?o.toString():void 0,marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none,height:u[d],backgroundColor:e.colors.progressbarTrackFill,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:R?m.colors.primary:m.colors.blue70,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS})}};return(0,c.jsx)(a.Z,{value:e,overrides:(0,g.aO)(w,p)})}}}]);
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8477],{58477:(t,e,o)=>{o.r(e),o.d(e,{default:()=>c});o(66845);var s=o(90186),i=o(1515),n=o(27466);const r=(0,i.Z)("div",{target:"e18r7x300"})((t=>{let{theme:e}=t;return{paddingBottom:e.spacing.smPx,lineHeight:e.lineHeights.normal,color:(0,n.yq)(e)}}),"");var a=o(63730),g=o(40864);const c=function(t){let{element:e,width:o}=t;return(0,g.jsxs)("div",{className:"stProgress","data-testid":"stProgress",children:[(0,g.jsx)(r,{children:(0,g.jsx)(a.ZP,{source:e.text,allowHTML:!1,isLabel:!0})}),(0,g.jsx)(s.Z,{value:e.value,width:o})]})}},90186:(t,e,o)=>{o.d(e,{$:()=>l,Z:()=>d});var s=o(66845),i=o(25621),n=o(38570),r=o(80318),a=o(27466),g=o(66694),c=o(40864);let l;!function(t){t.EXTRASMALL="xs",t.SMALL="sm",t.MEDIUM="md",t.LARGE="lg",t.EXTRALARGE="xl"}(l||(l={}));const d=function(t){let{value:e,width:o,size:d=l.SMALL,overrides:p}=t;const m=(0,i.u)(),u={xs:m.spacing.twoXS,sm:m.spacing.sm,md:m.spacing.lg,lg:m.spacing.xl,xl:m.spacing.twoXL},{activeTheme:h}=s.useContext(g.E),R=!(0,a.MJ)(h),w={BarContainer:{style:{marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none}},Bar:{style:t=>{let{$theme:e}=t;return{width:o?o.toString():void 0,marginTop:m.spacing.none,marginBottom:m.spacing.none,marginRight:m.spacing.none,marginLeft:m.spacing.none,height:u[d],backgroundColor:e.colors.progressbarTrackFill,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS}}},BarProgress:{style:()=>({backgroundColor:R?m.colors.primary:m.colors.blue70,borderTopLeftRadius:m.spacing.twoXS,borderTopRightRadius:m.spacing.twoXS,borderBottomLeftRadius:m.spacing.twoXS,borderBottomRightRadius:m.spacing.twoXS})}};return(0,c.jsx)(n.Z,{value:e,overrides:(0,r.aO)(w,p)})}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8536],{72394:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>K});var o=i(66845),n=i(70145),s=i(97365),r=i(62813),a=i.n(r),l=i(3717),c=i(25621),h=i(88766),d=i(699),p=i(96260),m=i(24002),u=i(29378),g=i(80248),x=i(87072),w=i(12879),b=i(47203),y=i(61355),S=i(56264),v=i(19754),f=i(27466),k=i(23593),j=i(13005),T=i.n(j),C=i(18080),z=i(63765),E=i(16295),F=i(72012),V=i(66694),Z=i(82309),I=i(40864);const O=e=>{let{error:t,width:i,deltaType:o}=e;return t instanceof D?(0,I.jsx)(Z.Z,{width:i,name:"No Mapbox token provided",message:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)("p",{children:["To use ",(0,I.jsxs)("code",{children:["st.",o]})," or ",(0,I.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,I.jsxs)("p",{children:["To get a token, create an account at"," ",(0,I.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,I.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,I.jsx)("code",{children:"mapbox.token"})," and don't forget to restart your Streamlit server at this point if it's still running, then reload this tab."]}),(0,I.jsxs)("p",{children:["See"," ",(0,I.jsx)("a",{href:"https://docs.streamlit.io/develop/api-reference/configuration/config.toml",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof M?(0,I.jsx)(Z.Z,{width:i,name:"Error fetching Streamlit Mapbox token",message:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("p",{children:"This app requires an internet connection."}),(0,I.jsx)("p",{children:"Please check your connection and try again."}),(0,I.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,I.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,I.jsx)(Z.Z,{width:i,name:"Error fetching Streamlit Mapbox token",message:t.message})};class D extends Error{}class M extends Error{}const P="https://data.streamlit.io/tokens.json",W="mapbox",J=e=>t=>{class i extends o.PureComponent{constructor(i){super(i),this.context=void 0,this.initMapboxToken=async()=>{try{const e=await C.Z.get(P),{[W]:t}=e.data;if(!t)throw new Error("Missing token ".concat(W));this.setState({mapboxToken:t,isFetching:!1})}catch(e){const t=(0,z.b)(e);throw this.setState({mapboxTokenError:t,isFetching:!1}),new M("".concat(t.message," (").concat(P,")"))}},this.render=()=>{const{mapboxToken:i,mapboxTokenError:o,isFetching:n}=this.state,{width:s}=this.props;return o?(0,I.jsx)(O,{width:s,error:o,deltaType:e}):n?(0,I.jsx)(F.O,{element:E.Od.create({style:E.Od.SkeletonStyle.ELEMENT})}):(0,I.jsx)(t,{...this.props,mapboxToken:i,width:s})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0}}componentDidMount(){const e=this.props.element.mapboxToken||this.context.libConfig.mapboxToken;e?this.setState({mapboxToken:e,isFetching:!1}):this.initMapboxToken()}}return i.displayName="withMapboxToken(".concat(t.displayName||t.name,")"),i.contextType=V.E,T()(i,t)};var L=i(1515);const N=(0,L.Z)("div",{target:"e1az0zs51"})((e=>{let{width:t,height:i,theme:o}=e;return{marginTop:o.spacing.sm,position:"relative",height:i,width:t}}),""),B=(0,L.Z)("div",{target:"e1az0zs50"})((e=>{let{theme:t}=e;return{position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"& span":{filter:(0,f.Iy)(t)?"":"invert(100%)"}}}}),"");i(79259);const _={classes:{...u,...w,...x,...b,CartoLayer:h.Z},functions:{colorBins:d.Z,colorCategories:p.Z,colorContinuous:m.Z}};(0,v.fh)([y.w,S.E]);const R=new g.Z({configuration:_});class H extends o.PureComponent{constructor(){super(...arguments),this.state={viewState:{bearing:0,pitch:0,zoom:11},initialized:!1,initialViewState:{},id:void 0,pydeckJson:void 0,isFullScreen:!1,isLightTheme:(0,f.Iy)(this.props.theme)},this.componentDidMount=()=>{this.setState({initialized:!0})},this.createTooltip=e=>{const{element:t}=this.props;if(!e||!e.object||!t.tooltip)return!1;const i=s.Z.parse(t.tooltip);return i.html?i.html=this.interpolate(e,i.html):i.text=this.interpolate(e,i.text),i},this.interpolate=(e,t)=>{const i=t.match(/{(.*?)}/g);return i&&i.forEach((i=>{const o=i.substring(1,i.length-1);e.object.hasOwnProperty(o)?t=t.replace(i,e.object[o]):e.object.hasOwnProperty("properties")&&e.object.properties.hasOwnProperty(o)&&(t=t.replace(i,e.object.properties[o]))})),t},this.onViewStateChange=e=>{let{viewState:t}=e;this.setState({viewState:t})}}static getDerivedStateFromProps(e,t){const i=H.getDeckObject(e,t);if(!a()(i.initialViewState,t.initialViewState)){const e=Object.keys(i.initialViewState).reduce(((e,o)=>i.initialViewState[o]===t.initialViewState[o]?e:{...e,[o]:i.initialViewState[o]}),{});return{viewState:{...t.viewState,...e},initialViewState:i.initialViewState}}return null}render(){const e=H.getDeckObject(this.props,this.state),{viewState:t}=this.state,{width:i}=this.props;return(0,I.jsx)(N,{className:"stDeckGlJsonChart",width:i,height:e.initialViewState.height,"data-testid":"stDeckGlJsonChart",children:(0,I.jsxs)(n.Z,{viewState:t,onViewStateChange:this.onViewStateChange,height:e.initialViewState.height,width:i,layers:this.state.initialized?e.layers:[],getTooltip:this.createTooltip,ContextProvider:l.X$.Provider,controller:!0,children:[(0,I.jsx)(l.Z3,{height:e.initialViewState.height,width:i,mapStyle:e.mapStyle&&("string"===typeof e.mapStyle?e.mapStyle:e.mapStyle[0]),mapboxApiAccessToken:this.props.element.mapboxToken||this.props.mapboxToken}),(0,I.jsx)(B,{children:(0,I.jsx)(l.Pv,{className:"zoomButton",showCompass:!1})})]})})}}H.getDeckObject=(e,t)=>{var i,o;const{element:n,width:r,height:a,theme:l,isFullScreen:c}=e,h=null!==c&&void 0!==c&&c;var d,p,m;(n.id===t.id&&t.isFullScreen===h&&t.isLightTheme===(0,f.Iy)(l)||(t.pydeckJson=s.Z.parse(n.json),t.id=n.id),null!==(i=t.pydeckJson)&&void 0!==i&&i.mapStyle||(t.pydeckJson.mapStyle="mapbox://styles/mapbox/".concat((0,f.Iy)(l)?"light":"dark","-v9")),c)?Object.assign(null===(d=t.pydeckJson)||void 0===d?void 0:d.initialViewState,{width:r,height:a}):(null!==(p=t.pydeckJson)&&void 0!==p&&null!==(m=p.initialViewState)&&void 0!==m&&m.height||(t.pydeckJson.initialViewState.height=500),n.useContainerWidth&&(t.pydeckJson.initialViewState.width=r));return t.isFullScreen=c,t.isLightTheme=(0,f.Iy)(l),null===(o=t.pydeckJson)||void 0===o||delete o.views,R.convert(t.pydeckJson)};const K=(0,c.b)(J("st.pydeck_chart")((0,k.Z)(H)))},23593:(e,t,i)=>{"use strict";i.d(t,{Z:()=>w});var o=i(66845),n=i(13005),s=i.n(n),r=i(25621),a=i(82218),l=i(97781),c=i(46927),h=i(66694),d=i(1515);const p=(0,d.Z)("button",{target:"e1vs0wn31"})((e=>{let{isExpanded:t,theme:i}=e;const o=t?{right:"0.4rem",top:"0.5rem",backgroundColor:"transparent"}:{right:"-3.0rem",top:"-0.375rem",opacity:0,transform:"scale(0)",backgroundColor:i.colors.lightenedBg05};return{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",zIndex:i.zIndices.sidebar+1,height:"2.5rem",width:"2.5rem",transition:"opacity 300ms 150ms, transform 300ms 150ms",border:"none",color:i.colors.fadedText60,borderRadius:"50%",...o,"&:focus":{outline:"none"},"&:active, &:focus-visible, &:hover":{opacity:1,outline:"none",transform:"scale(1)",color:i.colors.bodyText,transition:"none"}}}),""),m=(0,d.Z)("div",{target:"e1vs0wn30"})((e=>{let{theme:t,isExpanded:i}=e;return{"&:hover":{[p]:{opacity:1,transform:"scale(1)",transition:"none"}},...i?{position:"fixed",top:0,left:0,bottom:0,right:0,background:t.colors.bgColor,zIndex:t.zIndices.fullscreenWrapper,padding:t.spacing.md,paddingTop:"2.875rem",overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}}}),"");var u=i(40864);class g extends o.PureComponent{constructor(e){super(e),this.context=void 0,this.controlKeys=e=>{const{expanded:t}=this.state;27===e.keyCode&&t&&this.zoomOut()},this.zoomIn=()=>{document.body.style.overflow="hidden",this.context.setFullScreen(!0),this.setState({expanded:!0})},this.zoomOut=()=>{document.body.style.overflow="unset",this.context.setFullScreen(!1),this.setState({expanded:!1})},this.convertScssRemValueToPixels=e=>parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),this.getWindowDimensions=()=>{const e=this.convertScssRemValueToPixels(this.props.theme.spacing.md),t=this.convertScssRemValueToPixels("2.875rem");return{fullWidth:window.innerWidth-2*e,fullHeight:window.innerHeight-(e+t)}},this.updateWindowDimensions=()=>{this.setState(this.getWindowDimensions())},this.state={expanded:!1,...this.getWindowDimensions()}}componentDidMount(){window.addEventListener("resize",this.updateWindowDimensions),document.addEventListener("keydown",this.controlKeys,!1)}componentWillUnmount(){window.removeEventListener("resize",this.updateWindowDimensions),document.removeEventListener("keydown",this.controlKeys,!1)}render(){const{expanded:e,fullWidth:t,fullHeight:i}=this.state,{children:o,width:n,height:s,disableFullscreenMode:r}=this.props;let h=a.d,d=this.zoomIn,g="View fullscreen";return e&&(h=l.m,d=this.zoomOut,g="Exit fullscreen"),(0,u.jsxs)(m,{isExpanded:e,"data-testid":"stFullScreenFrame",children:[!r&&(0,u.jsx)(p,{"data-testid":"StyledFullScreenButton",onClick:d,title:g,isExpanded:e,children:(0,u.jsx)(c.Z,{content:h})}),o(e?{width:t,height:i,expanded:e,expand:this.zoomIn,collapse:this.zoomOut}:{width:n,height:s,expanded:e,expand:this.zoomIn,collapse:this.zoomOut})]})}}g.contextType=h.E;const x=(0,r.b)(g);const w=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];class i extends o.PureComponent{constructor(){super(...arguments),this.render=()=>{const{width:i,height:o,disableFullscreenMode:n}=this.props;return(0,u.jsx)(x,{width:i,height:o,disableFullscreenMode:t||n,children:t=>{let{width:i,height:o,expanded:n,expand:s,collapse:r}=t;return(0,u.jsx)(e,{...this.props,width:i,height:o,isFullScreen:n,expand:s,collapse:r})}})}}}return i.displayName="withFullScreenWrapper(".concat(e.displayName||e.name,")"),s()(i,e)}},72709:()=>{},72672:()=>{}}]);