streamlit-nightly 1.21.1.dev20230424__py2.py3-none-any.whl → 1.21.1.dev20230425__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.
- streamlit/__init__.py +0 -7
- streamlit/elements/data_editor.py +104 -96
- streamlit/elements/file_uploader.py +17 -0
- streamlit/elements/layouts.py +0 -5
- streamlit/elements/lib/column_config_utils.py +371 -0
- streamlit/static/asset-manifest.json +20 -20
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{14.a19a6cd8.chunk.js → 14.9399e424.chunk.js} +1 -1
- streamlit/static/static/js/{227.087adf66.chunk.js → 227.9ccac1d5.chunk.js} +1 -1
- streamlit/static/static/js/{242.0daf8b47.chunk.js → 242.1b3289e0.chunk.js} +1 -1
- streamlit/static/static/js/{279.fdac58fc.chunk.js → 279.35b01780.chunk.js} +1 -1
- streamlit/static/static/js/{289.481fd42d.chunk.js → 289.e6157e40.chunk.js} +1 -1
- streamlit/static/static/js/{467.242e14ff.chunk.js → 467.50ac84df.chunk.js} +1 -1
- streamlit/static/static/js/{491.d0b710e9.chunk.js → 491.5a33a8ce.chunk.js} +1 -1
- streamlit/static/static/js/503.15864587.chunk.js +1 -0
- streamlit/static/static/js/{511.9f04ae9e.chunk.js → 511.e6ca580f.chunk.js} +1 -1
- streamlit/static/static/js/{578.ceaadcd5.chunk.js → 578.a65fcea0.chunk.js} +1 -1
- streamlit/static/static/js/{619.365611c8.chunk.js → 619.0325af0e.chunk.js} +1 -1
- streamlit/static/static/js/{628.7f41e2de.chunk.js → 628.9c70196b.chunk.js} +1 -1
- streamlit/static/static/js/{681.a2ba76c7.chunk.js → 681.9e30a8cd.chunk.js} +1 -1
- streamlit/static/static/js/{745.e2bcf16d.chunk.js → 745.e75ba963.chunk.js} +1 -1
- streamlit/static/static/js/{807.6789990f.chunk.js → 807.122f8b05.chunk.js} +1 -1
- streamlit/static/static/js/{828.096c1ad3.chunk.js → 828.0fde3da8.chunk.js} +1 -1
- streamlit/static/static/js/{871.ba625aee.chunk.js → 871.90a7dbae.chunk.js} +1 -1
- streamlit/static/static/js/{main.e7d9d363.js → main.ff35bd72.js} +2 -2
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/RECORD +33 -33
- streamlit/elements/show.py +0 -105
- streamlit/static/static/js/728.79e35e5d.chunk.js +0 -1
- /streamlit/static/static/css/{728.23fa976d.chunk.css → 503.23fa976d.chunk.css} +0 -0
- /streamlit/static/static/js/{main.e7d9d363.js.LICENSE.txt → main.ff35bd72.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.21.1.dev20230424.data → streamlit_nightly-1.21.1.dev20230425.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[279],{83279:function(e,t,r){r.r(t),r.d(t,{default:function(){return fe}});var o=r(15671),n=r(43144),i=r(60136),a=r(29388),s=r(47313),l=r(93433),u=r(83985),c=r(74969),p=r(15160);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){return e.$isActive?2:e.$isHovered?1:0}function m(e){var t=e.$theme.colors,r=e.$disabled,o=e.$checked,n=e.$isFocusVisible,i=e.$error;if(r)return t.tickFillDisabled;if(!o)return n?t.borderSelected:i?t.tickBorderError:t.tickBorder;if(i)switch(b(e)){case 0:return t.tickFillErrorSelected;case 1:return t.tickFillErrorSelectedHover;case 2:return t.tickFillErrorSelectedHoverActive}else switch(b(e)){case 0:return t.tickFillSelected;case 1:return t.tickFillSelectedHover;case 2:return t.tickFillSelectedHoverActive}return null}function v(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(b(e)){case 0:return t.tickFillError;case 1:return t.tickFillErrorHover;case 2:return t.tickFillErrorHoverActive}else switch(b(e)){case 0:return t.tickFill;case 1:return t.tickFillHover;case 2:return t.tickFillActive}}function y(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var g=(0,p.zo)("div",(function(e){var t=e.$disabled,r=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:"horizontal"===r?"row":"column",alignItems:"horizontal"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}}));g.displayName="RadioGroupRoot",g.displayName="RadioGroupRoot";var w=(0,p.zo)("label",(function(e){var t,r=e.$disabled,o=e.$hasDescription,n=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,l="horizontal"===a,u="rtl"===i.direction?"Left":"Right";return h(t={flexDirection:"top"===n||"bottom"===n?"column":"row",display:"flex",alignItems:"center",cursor:r?"not-allowed":"pointer",marginTop:s.scale200},"margin".concat(u),l?s.scale200:null),h(t,"marginBottom",o&&!l?null:s.scale200),t}));w.displayName="Root",w.displayName="Root";var k=(0,p.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{backgroundColor:v(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?o.scale200:o.scale550,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve,width:e.$checked?o.scale200:o.scale550}}));k.displayName="RadioMarkInner",k.displayName="RadioMarkInner";var O=(0,p.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{alignItems:"center",backgroundColor:m(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:o.scale700,justifyContent:"center",marginTop:o.scale0,marginRight:o.scale0,marginBottom:o.scale0,marginLeft:o.scale0,outline:"none",verticalAlign:"middle",width:o.scale700,flexShrink:0,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve}}));O.displayName="RadioMarkOuter",O.displayName="RadioMarkOuter";var R=(0,p.zo)("div",(function(e){var t=e.$theme.typography;return f(f({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,n=e.$theme;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="rtl"===n.direction?"Left":"Right";break;default:t="rtl"===n.direction?"Right":"Left"}var i=n.sizing.scale300;return h({},"padding".concat(t),i)}(e)),{},{color:y(e)},t.LabelMedium)}));R.displayName="Label",R.displayName="Label";var j=(0,p.zo)("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});j.displayName="Input",j.displayName="Input";var F=(0,p.zo)("div",(function(e){var t,r=e.$theme,o=e.$align,n="horizontal"===o,i="rtl"===r.direction?"Right":"Left",a="rtl"===r.direction?"Left":"Right";return f(f({},r.typography.ParagraphSmall),{},(h(t={color:r.colors.contentSecondary,cursor:"auto"},"margin".concat(i),"horizontal"===o?null:r.sizing.scale900),h(t,"margin".concat(a),n?r.sizing.scale200:null),h(t,"maxWidth","240px"),t))}));F.displayName="Description",F.displayName="Description";var P=r(75643);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 S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},S.apply(this,arguments)}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}function L(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 r,o=D(e);if(t){var n=D(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return A(this,r)}}function A(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 B(e)}function B(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},D(e)}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var V=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&&I(e,t)}(i,e);var t,r,o,n=L(i);function i(){var e;x(this,i);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return T(B(e=n.call.apply(n,[this].concat(r))),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),T(B(e),"handleFocus",(function(t,r){(0,P.E)(t)&&e.setState({isFocusVisible:!0}),e.setState({focusedRadioIndex:r}),e.props.onFocus&&e.props.onFocus(t)})),T(B(e),"handleBlur",(function(t,r){!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1}),e.setState({focusedRadioIndex:-1}),e.props.onBlur&&e.props.onBlur(t)})),e}return t=i,(r=[{key:"render",value:function(){var e=this,t=this.props.overrides,r=void 0===t?{}:t,o=M((0,c.jb)(r.RadioGroupRoot,g),2),n=o[0],i=o[1];return s.createElement(n,S({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},i),s.Children.map(this.props.children,(function(t,r){if(!s.isValidElement(t))return null;var o=e.props.value===t.props.value;return s.cloneElement(t,{align:e.props.align,autoFocus:e.props.autoFocus,checked:o,disabled:e.props.disabled||t.props.disabled,error:e.props.error,isFocused:e.state.focusedRadioIndex===r,isFocusVisible:e.state.isFocusVisible,tabIndex:0===r&&!e.props.value||o?"0":"-1",labelPlacement:e.props.labelPlacement,name:e.props.name,onBlur:function(t){return e.handleBlur(t,r)},onFocus:function(t){return e.handleFocus(t,r)},onChange:e.props.onChange,onMouseEnter:e.props.onMouseEnter,onMouseLeave:e.props.onMouseLeave})})))}}])&&C(t.prototype,r),o&&C(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(s.Component);T(V,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});var z=V,_="vertical",H="horizontal";function N(e){return N="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},N(e)}function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},U.apply(this,arguments)}function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return W(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},K(e,t)}function J(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 r,o=Y(e);if(t){var n=Y(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Q(this,r)}}function Q(e,t){if(t&&("object"===N(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return X(e)}function X(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}function ee(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var te=function(e){return e.stopPropagation()},re=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&&K(e,t)}(i,e);var t,r,o,n=J(i);function i(){var e;q(this,i);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return ee(X(e=n.call.apply(n,[this].concat(r))),"state",{isActive:!1,isHovered:!1}),ee(X(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter&&e.props.onMouseEnter(t)})),ee(X(e),"onMouseLeave",(function(t){e.setState({isHovered:!1}),e.props.onMouseLeave&&e.props.onMouseLeave(t)})),ee(X(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown&&e.props.onMouseDown(t)})),ee(X(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp&&e.props.onMouseUp(t)})),e}return t=i,(r=[{key:"componentDidMount",value:function(){var e;this.props.autoFocus&&null!==(e=this.props.inputRef)&&void 0!==e&&e.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var e,t=this.props.overrides,r=void 0===t?{}:t,o=Z((0,c.jb)(r.Root,w),2),n=o[0],i=o[1],a=Z((0,c.jb)(r.Label,R),2),l=a[0],u=a[1],p=Z((0,c.jb)(r.Input,j),2),d=p[0],f=p[1],h=Z((0,c.jb)(r.Description,F),2),b=h[0],m=h[1],v=Z((0,c.jb)(r.RadioMarkInner,k),2),y=v[0],g=v[1],P=Z((0,c.jb)(r.RadioMarkOuter,O),2),$=P[0],S=P[1],M={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},E=s.createElement(l,U({},M,u),this.props.containsInteractiveElement?s.createElement("div",{onClick:function(e){return e.preventDefault()}},this.props.children):this.props.children);return s.createElement(s.Fragment,null,s.createElement(n,U({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},M,i),("top"===(e=this.props.labelPlacement)||"left"===e)&&E,s.createElement($,U({},M,S),s.createElement(y,U({},M,g))),s.createElement(d,U({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:te,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},M,f)),function(e){return"bottom"===e||"right"===e}(this.props.labelPlacement)&&E),!!this.props.description&&s.createElement(b,U({},M,m),this.props.description))}}])&&G(t.prototype,r),o&&G(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(s.Component);ee(re,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:s.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});var oe=re,ne=r(65167),ie=r(73290),ae=r(80213),se=r(46417),le=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){var e;(0,o.Z)(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).state={value:e.props.value},e.onChange=function(t){var r=parseInt(t.target.value,10);e.setState({value:r},(function(){return e.props.onChange(r)}))},e}return(0,n.Z)(r,[{key:"componentDidUpdate",value:function(e){e.value!==this.props.value&&this.props.value!==this.state.value&&this.setState((function(e,t){return{value:t.value}}))}},{key:"render",value:function(){var e=this.props,t=e.theme,r=e.width,o=e.help,n=e.label,i=e.horizontal,a=e.labelVisibility,s=this.props.disabled,u=t.colors,c=t.radii,p={width:r},d=(0,l.Z)(this.props.options);return 0===d.length&&(d.push("No options to select."),s=!0),(0,se.jsxs)("div",{className:"row-widget stRadio",style:p,children:[(0,se.jsx)(ne.ON,{label:n,disabled:s,labelVisibility:a,children:o&&(0,se.jsx)(ne.Hp,{children:(0,se.jsx)(ie.ZP,{content:o,placement:ae.ug.TOP_RIGHT})})}),(0,se.jsx)(z,{onChange:this.onChange,value:this.state.value.toString(),disabled:s,align:i?H:_,"aria-label":n,children:d.map((function(e,t){return(0,se.jsx)(oe,{value:t.toString(),overrides:{Root:{style:function(e){return{marginBottom:0,marginTop:0,marginRight:"1rem",paddingLeft:0,alignItems:"start",paddingRight:"2px",backgroundColor:e.$isFocusVisible?u.darkenedBgMix25:"",borderTopLeftRadius:c.md,borderTopRightRadius:c.md,borderBottomLeftRadius:c.md,borderBottomRightRadius:c.md}}},RadioMarkOuter:{style:function(e){return{width:"1rem",height:"1rem",marginTop:"0.35rem",marginRight:"0",backgroundColor:e.$checked&&!s?u.primary:u.fadedText40}}},RadioMarkInner:{style:function(e){var t=e.$checked;return{height:t?"6px":".75rem",width:t?"6px":".75rem"}}},Label:{style:{color:s?u.fadedText40:u.bodyText,position:"relative",top:"1px"}}},children:e},t)}))})]})}}]),r}(s.PureComponent),ue=(0,u.b)(le),ce=r(46332),pe=r(64243),de=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){var e;(0,o.Z)(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new ce.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setIntValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onChange=function(t){e.setState({value:t},(function(){return e.commitWidgetValue({fromUi:!0})}))},e}return(0,n.Z)(r,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getIntValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e=this.props,t=e.disabled,r=e.element,o=e.width,n=e.widgetMgr,i=r.horizontal,a=r.options,s=r.label,l=r.labelVisibility,u=r.help;return this.formClearHelper.manageFormClearListener(n,r.formId,this.onFormCleared),(0,se.jsx)(ue,{label:s,onChange:this.onChange,options:a,width:o,disabled:t,horizontal:i,labelVisibility:(0,pe.iF)(null===l||void 0===l?void 0:l.value),value:this.state.value,help:u})}}]),r}(s.PureComponent),fe=de}}]);
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[279],{83279:function(e,t,r){r.r(t),r.d(t,{default:function(){return fe}});var o=r(15671),n=r(43144),i=r(60136),a=r(29388),s=r(47313),l=r(93433),u=r(83985),c=r(74969),p=r(15160);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){return e.$isActive?2:e.$isHovered?1:0}function m(e){var t=e.$theme.colors,r=e.$disabled,o=e.$checked,n=e.$isFocusVisible,i=e.$error;if(r)return t.tickFillDisabled;if(!o)return n?t.borderSelected:i?t.tickBorderError:t.tickBorder;if(i)switch(b(e)){case 0:return t.tickFillErrorSelected;case 1:return t.tickFillErrorSelectedHover;case 2:return t.tickFillErrorSelectedHoverActive}else switch(b(e)){case 0:return t.tickFillSelected;case 1:return t.tickFillSelectedHover;case 2:return t.tickFillSelectedHoverActive}return null}function v(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(b(e)){case 0:return t.tickFillError;case 1:return t.tickFillErrorHover;case 2:return t.tickFillErrorHoverActive}else switch(b(e)){case 0:return t.tickFill;case 1:return t.tickFillHover;case 2:return t.tickFillActive}}function y(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var g=(0,p.zo)("div",(function(e){var t=e.$disabled,r=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:"horizontal"===r?"row":"column",alignItems:"horizontal"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}}));g.displayName="RadioGroupRoot",g.displayName="RadioGroupRoot";var w=(0,p.zo)("label",(function(e){var t,r=e.$disabled,o=e.$hasDescription,n=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,l="horizontal"===a,u="rtl"===i.direction?"Left":"Right";return h(t={flexDirection:"top"===n||"bottom"===n?"column":"row",display:"flex",alignItems:"center",cursor:r?"not-allowed":"pointer",marginTop:s.scale200},"margin".concat(u),l?s.scale200:null),h(t,"marginBottom",o&&!l?null:s.scale200),t}));w.displayName="Root",w.displayName="Root";var k=(0,p.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{backgroundColor:v(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?o.scale200:o.scale550,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve,width:e.$checked?o.scale200:o.scale550}}));k.displayName="RadioMarkInner",k.displayName="RadioMarkInner";var O=(0,p.zo)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{alignItems:"center",backgroundColor:m(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:o.scale700,justifyContent:"center",marginTop:o.scale0,marginRight:o.scale0,marginBottom:o.scale0,marginLeft:o.scale0,outline:"none",verticalAlign:"middle",width:o.scale700,flexShrink:0,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve}}));O.displayName="RadioMarkOuter",O.displayName="RadioMarkOuter";var R=(0,p.zo)("div",(function(e){var t=e.$theme.typography;return f(f({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,n=e.$theme;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="rtl"===n.direction?"Left":"Right";break;default:t="rtl"===n.direction?"Right":"Left"}var i=n.sizing.scale300;return h({},"padding".concat(t),i)}(e)),{},{color:y(e)},t.LabelMedium)}));R.displayName="Label",R.displayName="Label";var j=(0,p.zo)("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});j.displayName="Input",j.displayName="Input";var F=(0,p.zo)("div",(function(e){var t,r=e.$theme,o=e.$align,n="horizontal"===o,i="rtl"===r.direction?"Right":"Left",a="rtl"===r.direction?"Left":"Right";return f(f({},r.typography.ParagraphSmall),{},(h(t={color:r.colors.contentSecondary,cursor:"auto"},"margin".concat(i),"horizontal"===o?null:r.sizing.scale900),h(t,"margin".concat(a),n?r.sizing.scale200:null),h(t,"maxWidth","240px"),t))}));F.displayName="Description",F.displayName="Description";var P=r(75643);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 S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},S.apply(this,arguments)}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}function L(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 r,o=D(e);if(t){var n=D(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return A(this,r)}}function A(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 B(e)}function B(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},D(e)}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var V=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&&I(e,t)}(i,e);var t,r,o,n=L(i);function i(){var e;x(this,i);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return T(B(e=n.call.apply(n,[this].concat(r))),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),T(B(e),"handleFocus",(function(t,r){(0,P.E)(t)&&e.setState({isFocusVisible:!0}),e.setState({focusedRadioIndex:r}),e.props.onFocus&&e.props.onFocus(t)})),T(B(e),"handleBlur",(function(t,r){!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1}),e.setState({focusedRadioIndex:-1}),e.props.onBlur&&e.props.onBlur(t)})),e}return t=i,(r=[{key:"render",value:function(){var e=this,t=this.props.overrides,r=void 0===t?{}:t,o=M((0,c.jb)(r.RadioGroupRoot,g),2),n=o[0],i=o[1];return s.createElement(n,S({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},i),s.Children.map(this.props.children,(function(t,r){if(!s.isValidElement(t))return null;var o=e.props.value===t.props.value;return s.cloneElement(t,{align:e.props.align,autoFocus:e.props.autoFocus,checked:o,disabled:e.props.disabled||t.props.disabled,error:e.props.error,isFocused:e.state.focusedRadioIndex===r,isFocusVisible:e.state.isFocusVisible,tabIndex:0===r&&!e.props.value||o?"0":"-1",labelPlacement:e.props.labelPlacement,name:e.props.name,onBlur:function(t){return e.handleBlur(t,r)},onFocus:function(t){return e.handleFocus(t,r)},onChange:e.props.onChange,onMouseEnter:e.props.onMouseEnter,onMouseLeave:e.props.onMouseLeave})})))}}])&&C(t.prototype,r),o&&C(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(s.Component);T(V,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});var z=V,_="vertical",H="horizontal";function N(e){return N="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},N(e)}function U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},U.apply(this,arguments)}function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return W(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},K(e,t)}function J(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 r,o=Y(e);if(t){var n=Y(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Q(this,r)}}function Q(e,t){if(t&&("object"===N(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return X(e)}function X(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(e)}function ee(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var te=function(e){return e.stopPropagation()},re=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&&K(e,t)}(i,e);var t,r,o,n=J(i);function i(){var e;q(this,i);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return ee(X(e=n.call.apply(n,[this].concat(r))),"state",{isActive:!1,isHovered:!1}),ee(X(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter&&e.props.onMouseEnter(t)})),ee(X(e),"onMouseLeave",(function(t){e.setState({isHovered:!1}),e.props.onMouseLeave&&e.props.onMouseLeave(t)})),ee(X(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown&&e.props.onMouseDown(t)})),ee(X(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp&&e.props.onMouseUp(t)})),e}return t=i,(r=[{key:"componentDidMount",value:function(){var e;this.props.autoFocus&&null!==(e=this.props.inputRef)&&void 0!==e&&e.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var e,t=this.props.overrides,r=void 0===t?{}:t,o=Z((0,c.jb)(r.Root,w),2),n=o[0],i=o[1],a=Z((0,c.jb)(r.Label,R),2),l=a[0],u=a[1],p=Z((0,c.jb)(r.Input,j),2),d=p[0],f=p[1],h=Z((0,c.jb)(r.Description,F),2),b=h[0],m=h[1],v=Z((0,c.jb)(r.RadioMarkInner,k),2),y=v[0],g=v[1],P=Z((0,c.jb)(r.RadioMarkOuter,O),2),$=P[0],S=P[1],M={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},E=s.createElement(l,U({},M,u),this.props.containsInteractiveElement?s.createElement("div",{onClick:function(e){return e.preventDefault()}},this.props.children):this.props.children);return s.createElement(s.Fragment,null,s.createElement(n,U({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},M,i),("top"===(e=this.props.labelPlacement)||"left"===e)&&E,s.createElement($,U({},M,S),s.createElement(y,U({},M,g))),s.createElement(d,U({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:te,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},M,f)),function(e){return"bottom"===e||"right"===e}(this.props.labelPlacement)&&E),!!this.props.description&&s.createElement(b,U({},M,m),this.props.description))}}])&&G(t.prototype,r),o&&G(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(s.Component);ee(re,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:s.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});var oe=re,ne=r(65167),ie=r(73290),ae=r(10612),se=r(46417),le=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){var e;(0,o.Z)(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).state={value:e.props.value},e.onChange=function(t){var r=parseInt(t.target.value,10);e.setState({value:r},(function(){return e.props.onChange(r)}))},e}return(0,n.Z)(r,[{key:"componentDidUpdate",value:function(e){e.value!==this.props.value&&this.props.value!==this.state.value&&this.setState((function(e,t){return{value:t.value}}))}},{key:"render",value:function(){var e=this.props,t=e.theme,r=e.width,o=e.help,n=e.label,i=e.horizontal,a=e.labelVisibility,s=this.props.disabled,u=t.colors,c=t.radii,p={width:r},d=(0,l.Z)(this.props.options);return 0===d.length&&(d.push("No options to select."),s=!0),(0,se.jsxs)("div",{className:"row-widget stRadio",style:p,children:[(0,se.jsx)(ne.ON,{label:n,disabled:s,labelVisibility:a,children:o&&(0,se.jsx)(ne.Hp,{children:(0,se.jsx)(ie.ZP,{content:o,placement:ae.ug.TOP_RIGHT})})}),(0,se.jsx)(z,{onChange:this.onChange,value:this.state.value.toString(),disabled:s,align:i?H:_,"aria-label":n,children:d.map((function(e,t){return(0,se.jsx)(oe,{value:t.toString(),overrides:{Root:{style:function(e){return{marginBottom:0,marginTop:0,marginRight:"1rem",paddingLeft:0,alignItems:"start",paddingRight:"2px",backgroundColor:e.$isFocusVisible?u.darkenedBgMix25:"",borderTopLeftRadius:c.md,borderTopRightRadius:c.md,borderBottomLeftRadius:c.md,borderBottomRightRadius:c.md}}},RadioMarkOuter:{style:function(e){return{width:"1rem",height:"1rem",marginTop:"0.35rem",marginRight:"0",backgroundColor:e.$checked&&!s?u.primary:u.fadedText40}}},RadioMarkInner:{style:function(e){var t=e.$checked;return{height:t?"6px":".75rem",width:t?"6px":".75rem"}}},Label:{style:{color:s?u.fadedText40:u.bodyText,position:"relative",top:"1px"}}},children:e},t)}))})]})}}]),r}(s.PureComponent),ue=(0,u.b)(le),ce=r(46332),pe=r(64243),de=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){var e;(0,o.Z)(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new ce.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setIntValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onChange=function(t){e.setState({value:t},(function(){return e.commitWidgetValue({fromUi:!0})}))},e}return(0,n.Z)(r,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getIntValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e=this.props,t=e.disabled,r=e.element,o=e.width,n=e.widgetMgr,i=r.horizontal,a=r.options,s=r.label,l=r.labelVisibility,u=r.help;return this.formClearHelper.manageFormClearListener(n,r.formId,this.onFormCleared),(0,se.jsx)(ue,{label:s,onChange:this.onChange,options:a,width:o,disabled:t,horizontal:i,labelVisibility:(0,pe.iF)(null===l||void 0===l?void 0:l.value),value:this.state.value,help:u})}}]),r}(s.PureComponent),fe=de}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[289],{75006:function(e,t,r){r.d(t,{Z:function(){return f}});r(47313);var n,o=r(64243),i=r(65167),a=r(1413),u=r(30168),l=r(47167),s=(0,r(30686).F4)(n||(n=(0,u.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),c=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,r=e.shouldBlink,n=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:"0 5px"}}:{}),r?{color:n.colors.red,animationName:"".concat(s),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),p=r(46417),f=function(e){var t=e.dirty,r=e.value,n=e.maxLength,a=e.className,u=e.type,l=[],s=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,p.jsx)(c,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===u?"single":u)?(0,o.Ge)()?s("Press \u2318+Enter to apply"):s("Press Ctrl+Enter to apply"):s("Press Enter to apply")),n&&s("".concat(r.length,"/").concat(n),t&&r.length>=n),(0,p.jsx)(i.X7,{className:a,children:l})}},69289:function(e,t,r){r.r(t),r.d(t,{default:function(){return _}});var n=r(15671),o=r(43144),i=r(60136),a=r(29388),u=r(47313),l=r(46332),s=r(74969),c=r(53998),p=r(37613),f=r(15160),d=r(12903);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=(0,f.zo)("div",(function(e){return m(m({},(0,d.d5)(m(m({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));b.displayName="StyledTextAreaRoot",b.displayName="StyledTextAreaRoot";var v=(0,f.zo)("div",(function(e){return(0,d.hB)(m({$positive:!1},e))}));v.displayName="StyledTextareaContainer",v.displayName="StyledTextareaContainer";var g=(0,f.zo)("textarea",(function(e){return m(m({},(0,d.Hx)(e)),{},{resize:e.$resize||"none"})}));function O(e){return O="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},O(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(this,arguments)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){u=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},C(e,t)}function F(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 r,n=V(e);if(t){var o=V(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return k(this,r)}}function k(e,t){if(t&&("object"===O(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},V(e)}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}g.displayName="StyledTextarea",g.displayName="StyledTextarea";var D=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&&C(e,t)}(i,e);var t,r,n,o=F(i);function i(){var e;x(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return B(T(e=o.call.apply(o,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),B(T(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),B(T(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=i,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=j((0,s.jb)(t.Root,b),2),n=r[0],o=r[1],i=(0,s.aO)({Input:{component:g},InputContainer:{component:v}},t);return u.createElement(n,w({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},o),u.createElement(c.Z,w({},this.props,{type:p.iB.textarea,overrides:i,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&S(t.prototype,r),n&&S(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(u.Component);B(D,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:p.NO.default});var E=D,$=r(75006),z=r(65167),Z=r(73290),A=r(80213),N=r(64243);var R=(0,r(47167).Z)("div",{target:"e1y61itm0"})({name:"1om1ktf",styles:"div{border-width:1px;}"}),U=r(46417),K=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){var e;(0,n.Z)(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new l.Kz,e.state={dirty:!1,value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringValue(e.props.element,e.state.value,t),e.setState({dirty:!1})},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onBlur=function(){e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e.onChange=function(t){var r=t.target.value,n=e.props.element.maxChars;0!==n&&r.length>n||((0,N.$b)(e.props.element)?e.setState({dirty:!1,value:r},(function(){return e.commitWidgetValue({fromUi:!0})})):e.setState({dirty:!0,value:r}))},e.isEnterKeyPressed=function(e){var t=e.keyCode;return"Enter"===e.key||13===t||10===t},e.onKeyDown=function(t){var r=t.metaKey,n=t.ctrlKey,o=e.state.dirty;e.isEnterKeyPressed(t)&&(n||r)&&o&&(t.preventDefault(),e.commitWidgetValue({fromUi:!0}))},e}return(0,o.Z)(r,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e,t=this.props,r=t.element,n=t.disabled,o=t.width,i=t.widgetMgr,a=this.state,u=a.value,l=a.dirty,s={width:o},c=r.height,p=r.placeholder;return this.formClearHelper.manageFormClearListener(i,r.formId,this.onFormCleared),(0,U.jsxs)("div",{className:"stTextArea",style:s,children:[(0,U.jsx)(z.ON,{label:r.label,disabled:n,labelVisibility:(0,N.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),children:r.help&&(0,U.jsx)(z.dT,{children:(0,U.jsx)(Z.ZP,{content:r.help,placement:A.ug.TOP_RIGHT})})}),(0,U.jsx)(R,{children:(0,U.jsx)(E,{"data-testid":"stTextArea",value:u,placeholder:p,onBlur:this.onBlur,onChange:this.onChange,onKeyDown:this.onKeyDown,"aria-label":r.label,disabled:n,overrides:{Input:{style:{lineHeight:"1.4",height:c?"".concat(c,"px"):"",minHeight:"95px",resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:"1rem",paddingLeft:"1rem",paddingBottom:"1rem",paddingTop:"1rem"}}}})}),(0,U.jsx)($.Z,{dirty:l,value:u,maxLength:r.maxChars,type:"multiline"})]})}}]),r}(u.PureComponent),_=K}}]);
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[289],{75006:function(e,t,r){r.d(t,{Z:function(){return f}});r(47313);var n,o=r(64243),i=r(65167),a=r(1413),u=r(30168),l=r(47167),s=(0,r(30686).F4)(n||(n=(0,u.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),c=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,r=e.shouldBlink,n=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:"0 5px"}}:{}),r?{color:n.colors.red,animationName:"".concat(s),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),p=r(46417),f=function(e){var t=e.dirty,r=e.value,n=e.maxLength,a=e.className,u=e.type,l=[],s=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,p.jsx)(c,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===u?"single":u)?(0,o.Ge)()?s("Press \u2318+Enter to apply"):s("Press Ctrl+Enter to apply"):s("Press Enter to apply")),n&&s("".concat(r.length,"/").concat(n),t&&r.length>=n),(0,p.jsx)(i.X7,{className:a,children:l})}},69289:function(e,t,r){r.r(t),r.d(t,{default:function(){return _}});var n=r(15671),o=r(43144),i=r(60136),a=r(29388),u=r(47313),l=r(46332),s=r(74969),c=r(53998),p=r(37613),f=r(15160),d=r(12903);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=(0,f.zo)("div",(function(e){return m(m({},(0,d.d5)(m(m({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));b.displayName="StyledTextAreaRoot",b.displayName="StyledTextAreaRoot";var v=(0,f.zo)("div",(function(e){return(0,d.hB)(m({$positive:!1},e))}));v.displayName="StyledTextareaContainer",v.displayName="StyledTextareaContainer";var g=(0,f.zo)("textarea",(function(e){return m(m({},(0,d.Hx)(e)),{},{resize:e.$resize||"none"})}));function O(e){return O="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},O(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(this,arguments)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,u=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){u=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},C(e,t)}function F(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 r,n=V(e);if(t){var o=V(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return k(this,r)}}function k(e,t){if(t&&("object"===O(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},V(e)}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}g.displayName="StyledTextarea",g.displayName="StyledTextarea";var D=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&&C(e,t)}(i,e);var t,r,n,o=F(i);function i(){var e;x(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return B(T(e=o.call.apply(o,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),B(T(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),B(T(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=i,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=j((0,s.jb)(t.Root,b),2),n=r[0],o=r[1],i=(0,s.aO)({Input:{component:g},InputContainer:{component:v}},t);return u.createElement(n,w({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},o),u.createElement(c.Z,w({},this.props,{type:p.iB.textarea,overrides:i,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&S(t.prototype,r),n&&S(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(u.Component);B(D,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:p.NO.default});var E=D,$=r(75006),z=r(65167),Z=r(73290),A=r(10612),N=r(64243);var R=(0,r(47167).Z)("div",{target:"e1y61itm0"})({name:"1om1ktf",styles:"div{border-width:1px;}"}),U=r(46417),K=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(){var e;(0,n.Z)(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new l.Kz,e.state={dirty:!1,value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringValue(e.props.element,e.state.value,t),e.setState({dirty:!1})},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onBlur=function(){e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e.onChange=function(t){var r=t.target.value,n=e.props.element.maxChars;0!==n&&r.length>n||((0,N.$b)(e.props.element)?e.setState({dirty:!1,value:r},(function(){return e.commitWidgetValue({fromUi:!0})})):e.setState({dirty:!0,value:r}))},e.isEnterKeyPressed=function(e){var t=e.keyCode;return"Enter"===e.key||13===t||10===t},e.onKeyDown=function(t){var r=t.metaKey,n=t.ctrlKey,o=e.state.dirty;e.isEnterKeyPressed(t)&&(n||r)&&o&&(t.preventDefault(),e.commitWidgetValue({fromUi:!0}))},e}return(0,o.Z)(r,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e,t=this.props,r=t.element,n=t.disabled,o=t.width,i=t.widgetMgr,a=this.state,u=a.value,l=a.dirty,s={width:o},c=r.height,p=r.placeholder;return this.formClearHelper.manageFormClearListener(i,r.formId,this.onFormCleared),(0,U.jsxs)("div",{className:"stTextArea",style:s,children:[(0,U.jsx)(z.ON,{label:r.label,disabled:n,labelVisibility:(0,N.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),children:r.help&&(0,U.jsx)(z.dT,{children:(0,U.jsx)(Z.ZP,{content:r.help,placement:A.ug.TOP_RIGHT})})}),(0,U.jsx)(R,{children:(0,U.jsx)(E,{"data-testid":"stTextArea",value:u,placeholder:p,onBlur:this.onBlur,onChange:this.onChange,onKeyDown:this.onKeyDown,"aria-label":r.label,disabled:n,overrides:{Input:{style:{lineHeight:"1.4",height:c?"".concat(c,"px"):"",minHeight:"95px",resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:"1rem",paddingLeft:"1rem",paddingBottom:"1rem",paddingTop:"1rem"}}}})}),(0,U.jsx)($.Z,{dirty:l,value:u,maxLength:r.maxChars,type:"multiline"})]})}}]),r}(u.PureComponent),_=K}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[467],{82467:function(e,r,n){n.r(r),n.d(r,{default:function(){return h}});var t=n(47313),o=n(83985),s=n(
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[467],{82467:function(e,r,n){n.r(r),n.d(r,{default:function(){return h}});var t=n(47313),o=n(83985),s=n(81512),i=n(50412),a=n(54922),l=n(47167),c=n(17208),u=n(81097),m=(0,l.Z)(c.Q,{shouldForwardProp:u.Z,target:"e17lx80j1"})((function(e){var r=e.theme,n=e.$usingCustomTheme;return{marginTop:r.spacing.none,marginBottom:r.spacing.none,marginRight:r.spacing.none,marginLeft:r.spacing.none,borderColor:r.colors.fadedText10,borderTopColor:n?r.colors.primary:r.colors.blue70,flexGrow:0,flexShrink:0}}),""),g=(0,l.Z)("div",{target:"e17lx80j0"})((function(e){return{display:"flex",gap:e.theme.spacing.lg,alignItems:"center",width:"100%"}}),""),d=n(46417);var h=function(e){var r=e.width,n=e.element,l=(0,o.u)(),c=t.useContext(a.I).activeTheme,u=!(0,s.MJ)(c),h={width:r};return(0,d.jsx)("div",{className:"stSpinner",style:h,children:(0,d.jsxs)(g,{children:[(0,d.jsx)(m,{$size:l.iconSizes.twoXL,$usingCustomTheme:u}),(0,d.jsx)(i.Z,{source:n.text,allowHTML:!1})]})})}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[491],{8798:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return H}});var i=n(4942),r=n(15671),a=n(43144),o=n(60136),s=n(29388),c=n(1413),h=n(47313),l=n(59603),u=n(1905),p=n.n(u),d=n(16117),m=n(83985),f=n(
|
1
|
+
(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[491],{8798:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return H}});var i=n(4942),r=n(15671),a=n(43144),o=n(60136),s=n(29388),c=n(1413),h=n(47313),l=n(59603),u=n(1905),p=n.n(u),d=n(16117),m=n(83985),f=n(81512),w=n(24821),v=n(41043),g=n(49774),x=n(40519),b=n(31186),k=n(96721),Z=n(20024),S=n(21906),y=n(26419),j=n(74165),T=n(15861),V=n(317),C=n(53499),E=n(28664),M=n(31881),O=n.n(M),F=n(81003),L=function(t){(0,o.Z)(n,t);var e=(0,s.Z)(n);function n(){return(0,r.Z)(this,n),e.apply(this,arguments)}return(0,a.Z)(n)}((0,E.Z)(Error)),N=function(t){(0,o.Z)(n,t);var e=(0,s.Z)(n);function n(){return(0,r.Z)(this,n),e.apply(this,arguments)}return(0,a.Z)(n)}((0,E.Z)(Error)),P=function(){function t(){(0,r.Z)(this,t)}return(0,a.Z)(t,null,[{key:"get",value:function(){var e=(0,T.Z)((0,j.Z)().mark((function e(n){var i,r,a;return(0,j.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.current,r=i.commandLine,a=i.userMapboxToken,t.token&&t.commandLine===r.toLowerCase()){e.next=10;break}if(""===a){e.next=6;break}t.token=a,e.next=9;break;case 6:return e.next=8,this.fetchToken("https://data.streamlit.io/tokens.json","mapbox");case 8:t.token=e.sent;case 9:t.commandLine=r.toLowerCase();case 10:return e.abrupt("return",t.token);case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"fetchToken",value:function(){var t=(0,T.Z)((0,j.Z)().mark((function t(e,n){var i,r,a;return(0,j.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,O().get(e);case 3:if(i=t.sent,null!=(r=i.data[n])&&""!==r){t.next=7;break}throw new Error('Missing token "'.concat(n,'"'));case 7:return t.abrupt("return",r);case 10:throw t.prev=10,t.t0=t.catch(0),a=(0,F.b)(t.t0),new N("".concat(a.message," (").concat(e,")"));case 14:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}()}]),t}();P.token=void 0,P.commandLine=void 0,P.isRunningLocal=function(){var t=window.location.hostname;return"localhost"===t||"127.0.0.1"===t};var I=n(67861),z=n.n(I),D=n(46135),q=n(46417),A=function(t){var e=t.error,n=t.width,i=t.deltaType;return e instanceof L?(0,q.jsx)(D.Z,{width:n,name:"No Mapbox token provided",message:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("p",{children:["To use ",(0,q.jsxs)("code",{children:["st.",i]})," or ",(0,q.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,q.jsxs)("p",{children:["To get a token, create an account at"," ",(0,q.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,q.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,q.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,q.jsxs)("p",{children:["See"," ",(0,q.jsx)("a",{href:"https://docs.streamlit.io/library/advanced-features/configuration#view-all-configuration-options",children:"our documentation"})," ","for more info on how to set config options."]})]})}):e instanceof N?(0,q.jsx)(D.Z,{width:n,name:"Error fetching Streamlit Mapbox token",message:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{children:"This app requires an internet connection."}),(0,q.jsx)("p",{children:"Please check your connection and try again."}),(0,q.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,q.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,q.jsx)(D.Z,{width:n,name:"Error fetching Streamlit Mapbox token",message:e.message})},J=function(t){return function(e){var n=function(n){(0,o.Z)(h,n);var i=(0,s.Z)(h);function h(n){var a;return(0,r.Z)(this,h),(a=i.call(this,n)).initMapboxToken=(0,T.Z)((0,j.Z)().mark((function t(){var e,n;return(0,j.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,P.get(a.props.sessionInfo);case 3:e=t.sent,a.setState({mapboxToken:e,isFetching:!1}),t.next=11;break;case 7:t.prev=7,t.t0=t.catch(0),n=(0,F.b)(t.t0),a.setState({mapboxTokenError:n,isFetching:!1});case 11:case"end":return t.stop()}}),t,null,[[0,7]])}))),a.render=function(){var n=a.state,i=n.mapboxToken,r=n.mapboxTokenError,o=n.isFetching,s=a.props.width;return r?(0,q.jsx)(A,{width:s,error:r,deltaType:t}):o?(0,q.jsx)(V.Z,{body:"Loading...",kind:C.h.INFO,width:s}):(0,q.jsx)(e,(0,c.Z)((0,c.Z)({},a.props),{},{mapboxToken:i,width:s}))},a.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0},a.initMapboxToken(),a}return(0,a.Z)(h)}(h.PureComponent);return n.displayName="withMapboxToken(".concat(e.displayName||e.name,")"),z()(n,e)}},_=n(64243),B=n(47167),G=(0,B.Z)("div",{target:"e1q4dr931"})((function(t){var e=t.width,n=t.height;return{marginTop:t.theme.spacing.sm,position:"relative",height:n,width:e}}),""),R=(0,B.Z)("div",{target:"e1q4dr930"})((function(t){var e=t.theme;return{position:"absolute",right:"2.625rem",top:e.spacing.md,zIndex:1,"button:not(:disabled)":{background:e.colors.bgColor,"& + button":{borderTopColor:e.colors.secondaryBg},"& span":{filter:(0,f.Iy)(e)?"":"invert(100%)"}}}}),""),W=(n(81627),{classes:(0,c.Z)((0,c.Z)((0,c.Z)((0,c.Z)({},w),x),g),b)});(0,S.fh)([k.w,Z.E]);var X=new v.Z({configuration:W}),$=function(t){(0,o.Z)(n,t);var e=(0,s.Z)(n);function n(){var t;(0,r.Z)(this,n);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return(t=e.call.apply(e,[this].concat(a))).state={viewState:{bearing:0,pitch:0,zoom:11},initialized:!1,initialViewState:{}},t.componentDidMount=function(){t.setState({initialized:!0})},t.createTooltip=function(e){var n=t.props.element;if(!e||!e.object||!n.tooltip)return!1;var i=JSON.parse(n.tooltip);return i.html?i.html=t.interpolate(e,i.html):i.text=t.interpolate(e,i.text),i},t.interpolate=function(t,e){var n=e.match(/{(.*?)}/g);return n&&n.forEach((function(n){var i=n.substring(1,n.length-1);t.object.hasOwnProperty(i)&&(e=e.replace(n,t.object[i]))})),e},t.onViewStateChange=function(e){var n=e.viewState;t.setState({viewState:n})},t}return(0,a.Z)(n,[{key:"render",value:function(){var t=n.getDeckObject(this.props),e=this.state.viewState;return(0,q.jsx)(G,{className:"stDeckGlJsonChart",width:t.initialViewState.width,height:t.initialViewState.height,children:(0,q.jsxs)(l.Z,{viewState:e,onViewStateChange:this.onViewStateChange,height:t.initialViewState.height,width:t.initialViewState.width,layers:this.state.initialized?t.layers:[],getTooltip:this.createTooltip,ContextProvider:d.X$.Provider,controller:!0,children:[(0,q.jsx)(d.Z3,{height:t.initialViewState.height,width:t.initialViewState.width,mapStyle:t.mapStyle&&("string"===typeof t.mapStyle?t.mapStyle:t.mapStyle[0]),mapboxApiAccessToken:this.props.mapboxToken}),(0,q.jsx)(R,{children:(0,q.jsx)(d.Pv,{className:"zoomButton",showCompass:!1})})]})})}}],[{key:"getDerivedStateFromProps",value:function(t,e){var r=n.getDeckObject(t);if(!p()(r.initialViewState,e.initialViewState)){var a=Object.keys(r.initialViewState).reduce((function(t,n){return r.initialViewState[n]===e.initialViewState[n]?t:(0,c.Z)((0,c.Z)({},t),{},(0,i.Z)({},n,r.initialViewState[n]))}),{});return{viewState:(0,c.Z)((0,c.Z)({},e.viewState),a),initialViewState:r.initialViewState}}return null}}]),n}(h.PureComponent);$.getDeckObject=function(t){var e=t.element,n=t.width,i=t.height,r=t.theme,a=JSON.parse(e.json);if(!(0,_.bb)(a.mapStyle)){var o=(0,f.Iy)(r)?"light":"dark";a.mapStyle="mapbox://styles/mapbox/".concat(o,"-v9")}return i?(a.initialViewState.height=i,a.initialViewState.width=n):(a.initialViewState.height||(a.initialViewState.height=500),e.useContainerWidth&&(a.initialViewState.width=n)),delete a.views,X.convert(a)};var H=(0,m.b)(J("st.pydeck_chart")((0,y.Z)($)))},50413:function(){},30643:function(){},69081:function(){},49125:function(){}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[503],{5655:function(e,t,n){n.r(t),n.d(t,{default:function(){return xe}});var i=n(29439),r=n(1413),o=n(47313),a=n(56130),l=n(91719),d=n(30161),u=n(46332),s=n(26419),c=n(7976),f=n(64243),h=n(15671),g=n(43144),m=function(){function e(t){(0,h.Z)(this,e),this.editedCells=new Map,this.addedRows=[],this.deletedRows=[],this.numRows=0,this.numRows=t}return(0,g.Z)(e,[{key:"toJson",value:function(e){var t=new Map;e.forEach((function(e){t.set(e.indexNumber,e)}));var n={edited_cells:{},added_rows:[],deleted_rows:[]};return this.editedCells.forEach((function(e,i,r){e.forEach((function(e,r,o){var a=t.get(r);a&&(n.edited_cells["".concat(i,":").concat(r)]=a.getCellValue(e))}))})),this.addedRows.forEach((function(e){var i={};e.forEach((function(e,n,r){var o=t.get(n);if(o){var a=o.getCellValue(e);(0,f.bb)(a)&&(i[n]=a)}})),n.added_rows.push(i)})),n.deleted_rows=this.deletedRows,JSON.stringify(n,(function(e,t){return void 0===t?null:t}))}},{key:"fromJson",value:function(e,t){var n=this,r=JSON.parse(e),o=new Map;t.forEach((function(e){o.set(e.indexNumber,e)})),Object.keys(r.edited_cells).forEach((function(e){var t=e.split(":").map(Number),a=(0,i.Z)(t,2),l=a[0],d=a[1],u=o.get(d);if(u){var s,c=u.getCell(r.edited_cells[e]);if(c)0==n.editedCells.has(l)&&n.editedCells.set(l,new Map),null===(s=n.editedCells.get(l))||void 0===s||s.set(d,c)}})),r.added_rows.forEach((function(e){var i=new Map;t.forEach((function(e){i.set(e.indexNumber,e.getCell(void 0))})),Object.keys(e).forEach((function(t){var n=o.get(Number(t));if(n){var r=n.getCell(e[Number(t)]);r&&i.set(Number(t),r)}})),n.addedRows.push(i)})),this.deletedRows=r.deleted_rows}},{key:"isAddedRow",value:function(e){return e>=this.numRows}},{key:"getCell",value:function(e,t){if(this.isAddedRow(t))return this.addedRows[t-this.numRows].get(e);var n=this.editedCells.get(t);return void 0!==n?n.get(e):void 0}},{key:"setCell",value:function(e,t,n){if(this.isAddedRow(t)){if(t-this.numRows>=this.addedRows.length)return;this.addedRows[t-this.numRows].set(e,n)}else{void 0===this.editedCells.get(t)&&this.editedCells.set(t,new Map),this.editedCells.get(t).set(e,n)}}},{key:"addRow",value:function(e){this.addedRows.push(e)}},{key:"deleteRows",value:function(e){var t=this;e.sort((function(e,t){return t-e})).forEach((function(e){t.deleteRow(e)}))}},{key:"deleteRow",value:function(e){(0,f.le)(e)||e<0||(this.isAddedRow(e)?this.addedRows.splice(e-this.numRows,1):(this.deletedRows.includes(e)||(this.deletedRows.push(e),this.deletedRows=this.deletedRows.sort((function(e,t){return e-t}))),this.editedCells.delete(e)))}},{key:"getOriginalRowIndex",value:function(e){for(var t=e,n=0;n<this.deletedRows.length&&!(this.deletedRows[n]>t);n++)t+=1;return t}},{key:"getNumRows",value:function(){return this.numRows+this.addedRows.length-this.deletedRows.length}}]),e}(),v=n(2120),p=n(83985);var b=function(){var e=(0,p.u)(),t=o.useMemo((function(){return{editable:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" height="40" viewBox="0 96 960 960" width="40" fill="'.concat(e.bgColor,'"><path d="m800.641 679.743-64.384-64.384 29-29q7.156-6.948 17.642-6.948 10.485 0 17.742 6.948l29 29q6.948 7.464 6.948 17.95 0 10.486-6.948 17.434l-29 29Zm-310.64 246.256v-64.383l210.82-210.821 64.384 64.384-210.821 210.82h-64.383Zm-360-204.872v-50.254h289.743v50.254H130.001Zm0-162.564v-50.255h454.615v50.255H130.001Zm0-162.307v-50.255h454.615v50.255H130.001Z"/></svg>')}}}),[]);return{accentColor:e.colors.primary,accentFg:e.colors.white,accentLight:(0,v.DZ)(e.colors.primary,.9),borderColor:e.colors.fadedText05,horizontalBorderColor:e.colors.fadedText05,fontFamily:e.genericFonts.bodyFont,bgSearchResult:(0,v.DZ)(e.colors.primary,.9),bgIconHeader:e.colors.fadedText60,fgIconHeader:e.colors.white,bgHeader:e.colors.bgMix,bgHeaderHasFocus:e.colors.secondaryBg,bgHeaderHovered:e.colors.bgMix,textHeader:e.colors.fadedText60,textHeaderSelected:e.colors.white,textGroupHeader:e.colors.fadedText60,headerFontStyle:"".concat(e.fontSizes.sm),baseFontStyle:e.fontSizes.sm,editorFontSize:e.fontSizes.sm,textDark:e.colors.bodyText,textMedium:(0,v.DZ)(e.colors.bodyText,.2),textLight:e.colors.fadedText40,textBubble:e.colors.fadedText60,bgCell:e.colors.bgColor,bgCellMedium:e.colors.bgColor,cellHorizontalPadding:8,cellVerticalPadding:3,bgBubble:e.colors.secondaryBg,bgBubbleSelected:e.colors.secondaryBg,linkColor:e.colors.linkText,drilldownBorder:e.colors.darkenedBgMix25,tableBorderRadius:e.radii.md,headerIcons:t}},w=n(72599),y=n(45429),C=n(16031),x=n(35394),R=n.n(x),Z=["true","t","yes","y","on","1"],M=["false","f","no","n","off","0"];function E(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e="\u26a0\ufe0f ".concat(e),{kind:a.p6.Text,readonly:!0,allowOverlay:!0,data:e+(t?"\n\n".concat(t,"\n"):""),displayData:e,isError:!0}}function k(e){return e.hasOwnProperty("isError")&&e.isError}function N(e){return(0,r.Z)((0,r.Z)({id:e.id,title:e.title,hasMenu:!1,themeOverride:e.themeOverride,icon:e.icon},e.isStretched&&{grow:e.isIndex?1:3}),e.width&&{width:e.width})}function T(e,t){return(0,f.le)(e)?t||{}:(0,f.le)(t)?e||{}:(0,C.merge)(e,t)}function S(e){if((0,f.le)(e))return[];if("number"===typeof e||"boolean"===typeof e)return[e];if("string"===typeof e){if(""===e)return[];if(!e.trim().startsWith("[")||!e.trim().endsWith("]"))return e.split(",");try{return JSON.parse(e)}catch(n){return[e]}}try{var t=JSON.parse(JSON.stringify(e,(function(e,t){return"bigint"===typeof t?Number(t):t})));return(0,C.isArray)(t)?t.map((function(e){return["string","number","boolean","null"].includes(typeof e)?e:O(e)})):[O(t)]}catch(n){return[O(e)]}}function O(e){try{try{return(0,C.toString)(e)}catch(t){return JSON.stringify(e,(function(e,t){return"bigint"===typeof t?Number(t):t}))}}catch(t){return"[".concat(typeof e,"]")}}function I(e){if((0,f.le)(e))return null;if("boolean"===typeof e)return e;var t=O(e).toLowerCase().trim();return""===t?null:!!Z.includes(t)||!M.includes(t)&&void 0}function H(e){if((0,f.le)(e))return null;if((0,C.isArray)(e))return NaN;if("string"===typeof e){if(0===e.trim().length)return null;try{var t=R().unformat(e.trim());if((0,f.bb)(t))return t}catch(n){}}else if(e instanceof Int32Array)return Number(e[0]);return Number(e)}function A(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!Number.isNaN(e)&&Number.isFinite(e)?(0===t&&(e=Math.round(e)),R()(e).format(n?"0,0.".concat("0".repeat(t)):"0,0.[".concat("0".repeat(t),"]"))):""}function D(e){var t={kind:a.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!0,style:e.isIndex?"faded":"normal"};return(0,r.Z)((0,r.Z)({},e),{},{kind:"object",sortMode:"default",isEditable:!1,getCell:function(e){try{var n=(0,f.bb)(e)?O(e):null,i=(0,f.bb)(n)?n:"";return(0,r.Z)((0,r.Z)({},t),{},{data:n,displayData:i,isMissingValue:(0,f.le)(e)})}catch(o){return E(O(e),"The value cannot be interpreted as a string. Error: ".concat(o))}},getCellValue:function(e){return void 0===e.data?null:e.data}})}D.isEditableType=!1;var z=D;function V(e){var t=e.columnTypeOptions||{},n=void 0;if(t.validate)try{n=new RegExp(t.validate,"us")}catch(l){n="Invalid validate regex: ".concat(t.validate,".\nError: ").concat(l)}var i={kind:a.p6.Text,data:"",displayData:"",allowOverlay:!0,contentAlignment:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"},o=function(i){if((0,f.le)(i))return!e.isRequired;var r=O(i);return!(n instanceof RegExp&&!1===n.test(r))&&(!(t.max_chars&&r.length>t.max_chars)||r.slice(0,t.max_chars))};return(0,r.Z)((0,r.Z)({},e),{},{kind:"text",sortMode:"default",validateInput:o,getCell:function(e,t){if("string"===typeof n)return E(O(e),n);if(t){var a=o(e);if(!1===a)return E(O(e),"Invalid input.");"string"===typeof a&&(e=a)}try{var d=(0,f.bb)(e)?O(e):null,u=(0,f.bb)(d)?d:"";return(0,r.Z)((0,r.Z)({},i),{},{isMissingValue:(0,f.le)(d),data:d,displayData:u})}catch(l){return E("Incompatible value","The value cannot be interpreted as string. Error: ".concat(l))}},getCellValue:function(e){return void 0===e.data?null:e.data}})}V.isEditableType=!0;var L=V;function W(e){var t={kind:a.p6.Boolean,data:!1,allowOverlay:!1,contentAlign:e.contentAlignment,readonly:!e.isEditable,style:e.isIndex?"faded":"normal"};return(0,r.Z)((0,r.Z)({},e),{},{kind:"checkbox",sortMode:"default",getCell:function(e){var n;return void 0===(n=I(e))?E(O(e),"The value cannot be interpreted as boolean."):(0,r.Z)((0,r.Z)({},t),{},{data:n})},getCellValue:function(e){return void 0===e.data?null:e.data}})}W.isEditableType=!0;var B=W,_=n(93433);function j(e){var t="string",n=T({options:"bool"===y.fu.getTypeName(e.arrowType)?[!0,!1]:[]},e.columnTypeOptions),i=new Set(n.options.map((function(e){return typeof e})));1===i.size&&(i.has("number")||i.has("bigint")?t="number":i.has("boolean")&&(t="boolean"));var o={kind:a.p6.Custom,allowOverlay:e.isEditable,copyData:"",contentAlign:e.contentAlignment,readonly:!e.isEditable,data:{kind:"dropdown-cell",allowedValues:[].concat((0,_.Z)(!0!==e.isRequired?[""]:[]),(0,_.Z)(n.options.filter((function(e){return""!==e})).map((function(e){return O(e)})))),value:"",readonly:!e.isEditable}};return(0,r.Z)((0,r.Z)({},e),{},{kind:"selectbox",sortMode:"default",getCell:function(e,t){var n="";return(0,f.bb)(e)&&(n=O(e)),t&&!o.data.allowedValues.includes(n)?E(O(n),"The value is not part of the allowed options."):(0,r.Z)((0,r.Z)({},o),{},{isMissingValue:""===n,copyData:n,data:(0,r.Z)((0,r.Z)({},o.data),{},{value:n})})},getCellValue:function(e){var n,i,r,o,a,l,d;return void 0===(null===(n=e.data)||void 0===n?void 0:n.value)||""===(null===(i=e.data)||void 0===i?void 0:i.value)?null:"number"===t?null!==(o=H(null===(a=e.data)||void 0===a?void 0:a.value))&&void 0!==o?o:null:"boolean"===t?null!==(l=I(null===(d=e.data)||void 0===d?void 0:d.value))&&void 0!==l?l:null:null===(r=e.data)||void 0===r?void 0:r.value}})}j.isEditableType=!0;var F=j;function P(e){var t={kind:a.p6.Bubble,data:[],allowOverlay:!0,contentAlign:e.contentAlignment,style:e.isIndex?"faded":"normal"};return(0,r.Z)((0,r.Z)({},e),{},{kind:"list",sortMode:"default",isEditable:!1,getCell:function(e){return(0,r.Z)((0,r.Z)({},t),{},{data:S(e),isMissingValue:(0,f.le)(e)})},getCellValue:function(e){return void 0===e.data?null:e.data}})}P.isEditableType=!1;var J=P;function Y(e){var t=y.fu.getTypeName(e.arrowType),n=T({precision:t.startsWith("int")||"range"===t||t.startsWith("uint")?0:void 0,min:t.startsWith("uint")?0:void 0},e.columnTypeOptions),i=(0,f.le)(n.min)||n.min<0,o=(0,f.bb)(n.precision)?n.precision:void 0,l={kind:a.p6.Number,data:void 0,displayData:"",readonly:!e.isEditable,allowOverlay:!0,contentAlign:e.contentAlignment||"right",style:e.isIndex?"faded":"normal",allowNegative:i,fixedDecimals:o};return(0,r.Z)((0,r.Z)({},e),{},{kind:"number",sortMode:"smart",getCell:function(e){var t=H(e);if((0,f.bb)(t)){if(Number.isNaN(t))return E(O(e),"The value cannot be interpreted as a number.");if((0,f.bb)(n.precision)&&(t=0===n.precision?Math.trunc(t):Math.trunc(t*Math.pow(10,n.precision))/Math.pow(10,n.precision)),(0,f.bb)(n.min)&&(t=Math.max(t,n.min)),(0,f.bb)(n.max)&&(t=Math.min(t,n.max)),Number.isInteger(t)&&!Number.isSafeInteger(t))return E(O(e),"The value is larger than the maximum supported integer values in number columns (2^53).")}return(0,r.Z)((0,r.Z)({},l),{},{data:t,displayData:(0,f.bb)(t)?A(t):"",isMissingValue:(0,f.le)(t)})},getCellValue:function(e){return void 0===e.data?null:e.data}})}Y.isEditableType=!0;var q=Y,U=new Map(Object.entries({object:z,text:L,checkbox:B,selectbox:F,list:J,number:q}));function G(e,t,n){var i=new RegExp("".concat(e,"[,\\s].*{(?:[^}]*[\\s;]{1})?").concat(t,":\\s*([^;}]+)[;]?.*}"),"gm");n=n.replace(/{/g," {");var r=i.exec(n);if(r)return r[1].trim()}function K(e){return e.replace(/(\r\n|\n|\r)/gm," ")}function X(e,t,n){var i={},o=G(t,"color",n);o&&(i.textDark=o);var a=G(t,"background-color",n);return a&&(i.bgCell=a),"yellow"===a&&void 0===o&&(i.textDark="#31333F"),i?(0,r.Z)((0,r.Z)({},e),{},{themeOverride:i}):e}function Q(e,t){var n=e.types.index[t],i=e.indexNames[t],r=!0;return"range"===y.fu.getTypeName(n)&&(r=!1),{id:"index-".concat(t),name:i,title:i,isEditable:r,arrowType:n,isIndex:!0,isHidden:!1}}function $(e,t){var n,i=e.columns[0][t],r=e.types.data[t];if((0,f.le)(r)&&(r={meta:null,numpy_type:"object",pandas_type:"object"}),"categorical"===y.fu.getTypeName(r)){var o=e.getCategoricalOptions(t);(0,f.bb)(o)&&(n={options:o})}return{id:"column-".concat(i,"-").concat(t),name:i,title:i,isEditable:!0,arrowType:r,columnTypeOptions:n,isIndex:!1,isHidden:!1}}var ee=function(e,t,n,l){var d=o.useCallback((function(o){var d=(0,i.Z)(o,2),u=d[0],s=d[1];if(u>t.length-1)return E("Column index out of bounds.","This should never happen. Please report this bug.");if(s>n-1)return E("Row index out of bounds.","This should never happen. Please report this bug.");var c=t[u],h=c.indexNumber,g=l.current.getOriginalRowIndex(s);if(c.isEditable||l.current.isAddedRow(g)){var m=l.current.getCell(h,g);if(void 0!==m)return m}try{return function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(k(n="object"===e.kind?e.getCell((0,f.bb)(t.content)?K(y.fu.format(t.content,t.contentType,t.field)):null):e.getCell(t.content)))return n;if(!e.isEditable){if((0,f.bb)(t.displayContent)){var o=K(t.displayContent);(n.kind===a.p6.Text||n.kind===a.p6.Number)&&(n=(0,r.Z)((0,r.Z)({},n),{},{displayData:o}))}i&&t.cssId&&(n=X(n,t.cssId,i))}return n}(c,e.getCell(g+1,h),e.cssStyles)}catch(v){return(0,w.H)(v),E("Error during cell creation.","This should never happen. Please report this bug. \nError: ".concat(v))}}),[t,n,e,l]);return{getCellContent:d}};var te=function(e,t,n,r,a){var l,d=function(e){return Math.max(35*e+1+2,73)}(t+1+(e.editingMode===c.Eh.EditingMode.DYNAMIC?1:0)),u=Math.min(d,400);e.height&&(u=Math.max(e.height,73),d=Math.max(e.height,d)),r&&(u=Math.min(u,r),d=Math.min(d,r),e.height||(u=d));var s=n;e.useContainerWidth?l=n:e.width&&(l=Math.min(Math.max(e.width,52),n),s=Math.min(Math.max(e.width,s),n));var h=o.useState({width:l||"100%",height:u}),g=(0,i.Z)(h,2),m=g[0],v=g[1];return o.useLayoutEffect((function(){e.useContainerWidth&&"100%"===m.width&&v({width:n,height:m.height})}),[n]),o.useLayoutEffect((function(){v({width:m.width,height:u})}),[t]),o.useLayoutEffect((function(){v({width:l||"100%",height:m.height})}),[l]),o.useLayoutEffect((function(){v({width:m.width,height:u})}),[u]),o.useLayoutEffect((function(){if(a){var t=e.useContainerWidth||(0,f.bb)(e.width)&&e.width>0;v({width:t?s:"100%",height:d})}else v({width:l||"100%",height:u})}),[a]),{rowHeight:35,minHeight:73,maxHeight:d,minWidth:52,maxWidth:s,resizableSize:m,setResizableSize:v}};var ne=function(e,t,n,a,l,d,u){var s=o.useCallback((function(t,o){var d=(0,i.Z)(t,2),s=d[0],c=d[1],f=e[s],h=f.indexNumber,g=n.current.getOriginalRowIndex(l(c)),m=a([s,c]),v=f.getCellValue(m),p=f.getCellValue(o);if(k(m)||p!==v){var b=f.getCell(p,!0);k(b)?(0,w.KE)("Not applying the cell edit since it causes this error:\n ".concat(b.data)):(n.current.setCell(h,g,(0,r.Z)((0,r.Z)({},b),{},{lastUpdated:performance.now()})),u())}}),[e,n,l,a,u]),c=o.useCallback((function(){if(!t){var i=new Map;e.forEach((function(e){i.set(e.indexNumber,e.getCell(e.defaultValue))})),n.current.addRow(i),u(!1,!1)}}),[e,n,t,u]),h=o.useCallback((function(i){var r;if(i.rows.length>0){if(t)return!0;var o=i.rows.toArray().map((function(e){return n.current.getOriginalRowIndex(l(e))}));return n.current.deleteRows(o),u(!0),!1}if(null!==(r=i.current)&&void 0!==r&&r.range){for(var a=[],c=i.current.range,f=c.y;f<c.y+c.height;f++)for(var h=c.x;h<c.x+c.width;h++){var g=e[h];g.isEditable&&!g.isRequired&&(a.push({cell:[h,f]}),s([h,f],g.getCell(null)))}return a.length>0&&(u(),d(a)),!1}return!0}),[e,n,t,d,l,u,s]),g=o.useCallback((function(o,s){for(var h=(0,i.Z)(o,2),g=h[0],m=h[1],v=[],p=0;p<s.length;p++){var b=s[p];if(p+m>=n.current.getNumRows()){if(t)break;c()}for(var w=0;w<b.length;w++){var y=b[w],C=p+m,x=w+g;if(x>=e.length)break;var R=e[x];if(R.isEditable){var Z=R.getCell(y,!0);if((0,f.bb)(Z)&&!k(Z)){var M=R.indexNumber,E=n.current.getOriginalRowIndex(l(C)),N=R.getCellValue(a([x,C]));R.getCellValue(Z)!==N&&(n.current.setCell(M,E,(0,r.Z)((0,r.Z)({},Z),{},{lastUpdated:performance.now()})),v.push({cell:[x,C]}))}}}v.length>0&&(u(),d(v))}return!1}),[e,n,t,l,a,c,u,d]),m=o.useCallback((function(t,n){var i=t[0];if(i>=e.length)return!0;var r=e[i];if(r.validateInput){var o=r.validateInput(r.getCellValue(n));return!0===o||!1===o?o:r.getCell(o)}return!0}),[e]);return{onCellEdited:s,onPaste:g,onRowAppended:c,onDelete:h,validateCell:m}};var ie=function(e){var t=(0,o.useState)((function(){return new Map})),n=(0,i.Z)(t,2),a=n[0],l=n[1],d=o.useCallback((function(e,t,n,i){e.id&&l(new Map(a).set(e.id,i))}),[a]);return{columns:e.map((function(e){return e.id&&a.has(e.id)&&void 0!==a.get(e.id)?(0,r.Z)((0,r.Z)({},e),{},{width:a.get(e.id),grow:0}):e})),onColumnResize:d}},re=n(34264);var oe=function(e,t,n){var a=o.useState(),l=(0,i.Z)(a,2),d=l[0],u=l[1],s=(0,re.fF)({columns:t.map((function(e){return N(e)})),getCellContent:n,rows:e,sort:d}),c=s.getCellContent,f=s.getOriginalIndex,h=function(e,t){return void 0===t?e:e.map((function(e){return e.id===t.column.id?(0,r.Z)((0,r.Z)({},e),{},{title:"asc"===t.direction?"\u2191 ".concat(e.title):"\u2193 ".concat(e.title)}):e}))}(t,d),g=o.useCallback((function(e){var t="asc",n=h[e];if(d&&d.column.id===n.id){if("asc"!==d.direction)return void u(void 0);t="desc"}u({column:N(n),direction:t,mode:n.sortMode})}),[d,h]);return{columns:h,sortColumn:g,getOriginalIndex:f,getCellContent:c}},ae="index",le="col:",de={small:75,medium:200,large:400};function ue(e){var t;return(0,f.bb)(e.customType)&&(U.has(e.customType)?t=U.get(e.customType):(0,w.KE)("Unknown column type configured in column configuration: ".concat(e.customType))),(0,f.le)(t)&&(t=function(e){var t=e?y.fu.getTypeName(e):null;return t?(t=t.toLowerCase().trim(),["unicode","empty"].includes(t)?L:["object","date","time","datetime","datetimetz","decimal","bytes"].includes(t)?z:["bool"].includes(t)?B:["int8","int16","int32","int64","uint8","uint16","uint32","uint64","float16","float32","float64","float96","float128","range"].includes(t)?q:"categorical"===t?F:t.startsWith("list")?J:z):z}(e.arrowType)),t}var se=function(e,t,n){var i=function(e){if(!e.columns)return new Map;try{return new Map(Object.entries(JSON.parse(e.columns)))}catch(t){return(0,w.H)(t),new Map}}(e),o=e.useContainerWidth||(0,f.bb)(e.width)&&e.width>0,a=function(e){var t,n,i,o,a,l,d=[],u=null!==(t=null===(n=e.types)||void 0===n||null===(i=n.index)||void 0===i?void 0:i.length)&&void 0!==t?t:0,s=null!==(o=null===(a=e.columns)||void 0===a||null===(l=a[0])||void 0===l?void 0:l.length)&&void 0!==o?o:0;if(0===u&&0===s)return d.push({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0}),d;for(var c=0;c<u;c++){var f=(0,r.Z)((0,r.Z)({},Q(e,c)),{},{indexNumber:c});d.push(f)}for(var h=0;h<s;h++){var g=(0,r.Z)((0,r.Z)({},$(e,h)),{},{indexNumber:h+u});d.push(g)}return d}(t).map((function(t){var a=(0,r.Z)((0,r.Z)((0,r.Z)({},t),function(e,t){var n,i;return t?(t.has(e.name)?i=t.get(e.name):t.has("".concat(le).concat(e.indexNumber))?i=t.get("".concat(le).concat(e.indexNumber)):e.isIndex&&t.has(ae)&&(i=t.get(ae)),i?(0,C.merge)((0,r.Z)({},e),{title:i.title,width:(0,f.bb)(i.width)&&i.width in de?de[i.width]:void 0,customType:null===(n=i.type)||void 0===n?void 0:n.toLowerCase().trim(),isEditable:(0,f.bb)(i.disabled)?!i.disabled:void 0,isHidden:i.hidden,isRequired:i.required,columnTypeOptions:i.type_options,contentAlignment:i.alignment,defaultValue:i.default,help:i.help}):e):e}(t,i)),{},{isStretched:o}),l=ue(a);return(e.editingMode===c.Eh.EditingMode.READ_ONLY||n||!1===l.isEditableType)&&(a=(0,r.Z)((0,r.Z)({},a),{},{isEditable:!1})),e.editingMode!==c.Eh.EditingMode.READ_ONLY&&1==a.isEditable&&(a=(0,r.Z)((0,r.Z)({},a),{},{icon:"editable"})),l(a)})).filter((function(e){return!e.isHidden}));return{columns:a.length>0?a:[z({id:"empty-index",title:"",indexNumber:0,isEditable:!1,isIndex:!0})]}};var ce=function(e,t){var n=o.useState(),r=(0,i.Z)(n,2),a=r[0],l=r[1],d=o.useRef(null),u=o.useCallback((function(n){if(clearTimeout(d.current),d.current=0,l(void 0),("header"===n.kind||"cell"===n.kind)&&n.location){var i,r=n.location[0],o=n.location[1];if(r<0)return;if("header"===n.kind&&e.length>r&&(0,f.bb)(e[r]))i=e[r].help;else if("cell"===n.kind){var a=t([r,o]);(function(e){return e.hasOwnProperty("tooltip")&&""!==e.tooltip})(a)&&(i=a.tooltip)}i&&(d.current=setTimeout((function(){i&&l({content:i,left:n.bounds.x+n.bounds.width/2,top:n.bounds.y})}),600))}}),[e,t,l,d]);return{tooltip:a,clearTooltip:o.useCallback((function(){l(void 0)}),[l]),onItemHovered:u}},fe=n(4942),he=(0,n(47167).Z)("div",{target:"e17g77xh0"})((function(e){var t;return{position:"relative",display:"inline-block","& .glideDataEditor":{height:"100%",minWidth:"100%",borderRadius:e.theme.radii.md},"& .dvn-scroller":(t={scrollbarWidth:"thin"},(0,fe.Z)(t,"overflowX","overlay !important"),(0,fe.Z)(t,"overflowY","overlay !important"),t)}}),""),ge=n(84028),me=n(18550),ve=n(98345),pe=n(44642),be=n(74903),we=n(46417);var ye=function(e){var t=e.top,n=e.left,r=e.content,a=e.clearTooltip,l=o.useState(!0),d=(0,i.Z)(l,2),u=d[0],s=d[1],c=(0,p.u)(),f=c.colors,h=c.fontSizes,g=c.radii,m=o.useCallback((function(){s(!1),a()}),[a,s]);return(0,we.jsx)(ge.Z,{content:(0,we.jsx)(pe.Uo,{className:"stTooltipContent",children:(0,we.jsx)(ve.ZP,{style:{fontSize:h.sm},source:r,allowHTML:!1})}),placement:me.r4.top,accessibilityType:me.SI.tooltip,showArrow:!1,popoverMargin:5,onClickOutside:m,onEsc:m,overrides:{Body:{style:{borderTopLeftRadius:g.md,borderTopRightRadius:g.md,borderBottomLeftRadius:g.md,borderBottomRightRadius:g.md,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important",backgroundColor:"transparent"}},Inner:{style:{backgroundColor:(0,be.Iy)(c)?f.bgColor:f.secondaryBg,color:f.bodyText,fontSize:h.sm,fontWeight:"normal",paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important"}}},isOpen:u,children:(0,we.jsx)("div",{className:"stTooltipTarget",style:{position:"fixed",top:t,left:n}})})},Ce=(n(47288),function(e){var t=e.cell,n=e.theme;return!!function(e){return e.hasOwnProperty("isMissingValue")&&e.isMissingValue}(t)&&((0,a.uN)((0,r.Z)((0,r.Z)({},e),{},{theme:(0,r.Z)((0,r.Z)({},n),{},{textDark:n.textLight,textMedium:n.textLight}),spriteManager:{},hyperWrapping:!1}),"None",t.contentAlign),!0)});var xe=(0,s.Z)((function(e){var t=e.element,n=e.data,s=e.width,h=e.height,g=e.disabled,v=e.widgetMgr,p=e.isFullScreen,w=o.useRef(null),y=o.useRef(null),C=(0,l.Bn)(),x=b(),R=o.useState(!0),Z=(0,i.Z)(R,2),M=Z[0],E=Z[1],k=o.useMemo((function(){return window.matchMedia&&window.matchMedia("(pointer: coarse)").matches}),[]),T=o.useState({columns:a.EV.empty(),rows:a.EV.empty(),current:void 0}),S=(0,i.Z)(T,2),O=S[0],I=S[1],H=o.useCallback((function(){I({columns:a.EV.empty(),rows:a.EV.empty(),current:void 0})}),[]),A=o.useCallback((function(e){var t;null===(t=y.current)||void 0===t||t.updateCells(e)}),[]);(0,f.le)(t.editingMode)&&(t.editingMode=c.Eh.EditingMode.READ_ONLY);var D=c.Eh.EditingMode,z=D.READ_ONLY,V=D.DYNAMIC,L=n.dimensions,W=Math.max(0,L.rows-1),B=0===W&&!(t.editingMode===V&&L.dataColumns>0),_=W>15e4,j=o.useRef(new m(W)),F=o.useState(j.current.getNumRows()),P=(0,i.Z)(F,2),J=P[0],Y=P[1];o.useEffect((function(){j.current=new m(W),Y(j.current.getNumRows())}),[W]);var q=o.useCallback((function(){j.current=new m(W),Y(j.current.getNumRows())}),[W]),U=se(t,n,g).columns;o.useEffect((function(){if(t.editingMode!==z){var e=v.getStringValue(t);e&&(j.current.fromJson(e,U),Y(j.current.getNumRows()))}}),[]);var G=ee(n,U,J,j).getCellContent,K=oe(W,U,G),X=K.columns,Q=K.sortColumn,$=K.getOriginalIndex,re=K.getCellContent,ae=o.useCallback((function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];J!==j.current.getNumRows()&&Y(j.current.getNumRows()),e&&H(),(0,f.Ds)(100,(function(){var e=j.current.toJson(X),i=v.getStringValue(t);void 0===i&&(i=new m(0).toJson([])),e!==i&&v.setStringValue(t,e,{fromUi:n})}))()}),[v,t,J,H,X]),le=ne(X,t.editingMode!==V,j,re,$,A,ae),de=le.onCellEdited,ue=le.onPaste,fe=le.onRowAppended,ge=le.onDelete,me=le.validateCell,ve=ce(X,re),pe=ve.tooltip,be=ve.clearTooltip,xe=ve.onItemHovered,Re=ie(X.map((function(e){return N(e)}))),Ze=Re.columns,Me=Re.onColumnResize,Ee=te(t,J,s,h,p),ke=Ee.rowHeight,Ne=Ee.minHeight,Te=Ee.maxHeight,Se=Ee.minWidth,Oe=Ee.maxWidth,Ie=Ee.resizableSize,He=Ee.setResizableSize,Ae=o.useCallback((function(e){var t=(0,i.Z)(e,2);t[0],t[1];return(0,r.Z)((0,r.Z)({},function(e,t){var n=t?"faded":"normal";return{kind:a.p6.Text,data:"",displayData:"",allowOverlay:!0,readonly:e,style:n}}(!0,!1)),{},{displayData:"empty",contentAlign:"center",allowOverlay:!1,themeOverride:{textDark:x.textLight},span:[0,Math.max(X.length-1,0)]})}),[X,x.textLight]);return o.useEffect((function(){var e=new u.Kz;return e.manageFormClearListener(v,t.formId,q),function(){e.disconnect()}}),[t.formId,q,v]),(0,we.jsxs)(he,{className:"stDataFrame",onBlur:function(){M||k||H()},children:[(0,we.jsx)(d.e,{"data-testid":"stDataFrameResizable",ref:w,defaultSize:Ie,style:{border:"1px solid ".concat(x.borderColor),borderRadius:"".concat(x.tableBorderRadius)},minHeight:Ne,maxHeight:Te,minWidth:Se,maxWidth:Oe,size:Ie,enable:{top:!1,right:!1,bottom:!1,left:!1,topRight:!1,bottomRight:!0,bottomLeft:!1,topLeft:!1},grid:[1,ke],snapGap:ke/3,onResizeStop:function(e,t,n,i){w.current&&He({width:w.current.size.width,height:Te-w.current.size.height===3?w.current.size.height+3:w.current.size.height})},children:(0,we.jsx)(a.Nd,(0,r.Z)((0,r.Z)({className:"glideDataEditor",ref:y,columns:Ze,rows:B?1:J,minColumnWidth:50,maxColumnWidth:1e3,maxColumnAutoWidth:500,rowHeight:ke,headerHeight:ke,getCellContent:B?Ae:re,onColumnResize:Me,freezeColumns:B?0:X.filter((function(e){return e.isIndex})).length,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:function(e){return!(e>=X.length&&(t.useContainerWidth||"100%"===Ie.width))},getCellsForSelection:!0,rowMarkers:"none",rangeSelect:k?"none":"rect",columnSelect:"none",rowSelect:"none",onItemHovered:xe,keybindings:{search:!0,downFill:!0},onHeaderClicked:B||_?void 0:Q,gridSelection:O,onGridSelectionChange:function(e){(M||k)&&(I(e),void 0!==pe&&be())},drawCell:Ce,theme:x,onMouseMove:function(e){"out-of-bounds"===e.kind&&M?E(!1):"out-of-bounds"===e.kind||M||E(!0)},fixedShadowX:!0,fixedShadowY:!0,experimental:{scrollbarWidthOverride:1},customRenderers:C.customRenderers,headerIcons:x.headerIcons,validateCell:me,onPaste:!1},!B&&t.editingMode!==z&&!g&&{fillHandle:!k,onCellEdited:de,onPaste:ue,onDelete:ge}),!B&&t.editingMode===V&&{trailingRowOptions:{sticky:!1,tint:!0},rowMarkerTheme:{bgCell:x.bgHeader,bgCellMedium:x.bgHeader},rowMarkers:"checkbox",rowSelectionMode:"auto",rowSelect:g?"none":"multi",onRowAppended:g?void 0:fe,onHeaderClicked:void 0}))}),pe&&pe.content&&(0,we.jsx)(ye,{top:pe.top,left:pe.left,content:pe.content,clearTooltip:be})]})}))}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[511],{4371:function(e,t,n){n.d(t,{$:function(){return i},Z:function(){return c}});var i,r=n(47313),a=n(83985),s=n(54922),o=n(16168),l=n(75314),d=n(74969),u=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(i||(i={}));var c=function(e){var t=e.value,n=e.width,c=e.size,g=void 0===c?i.SMALL:c,p=e.overrides,f=(0,a.u)(),m={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},h=r.useContext(s.I).activeTheme,v=!(0,o.MJ)(h),x={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:m[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:v?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,u.jsx)(l.Z,{value:t,overrides:(0,d.aO)(x,p)})}},84677:function(e,t,n){n.d(t,{R:function(){return a}});var i=n(15671),r=n(43144),a=function(){function e(t,n,r,a){(0,i.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=r,this.status=a}return(0,r.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()},41511:function(e,t,n){n.r(t),n.d(t,{default:function(){return ye}});var i,r=n(93433),a=n(15671),s=n(43144),o=n(60136),l=n(29388),d=n(31881),u=n.n(d),c=n(16031),g=n.n(c),p=n(47313),f=n(7976),m=n(46332),h=n(64243);!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(i||(i={}));var v=(0,h.rA)()?1024:1e3,x=[i.Gigabyte,i.Megabyte,i.Kilobyte,i.Byte],y=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n||(n=i.Byte),r<0&&(r=0),t<0)throw new Error("Size must be greater than or equal to 0");var a=x.indexOf(n),s=t/v;return a&&t>v/2?e(s,x[a-1],r):"".concat(t.toFixed(r)).concat(n.toUpperCase())},S=n(65167),w=n(73290),b=n(80213),F=n(1413),Z=n(80614),j=n(69367),I=n(4942),z=n(47167);var M=(0,z.Z)("section",{target:"exg6vvm15"})((function(e){var t=e.isDisabled,n=e.theme;return{display:"flex",alignItems:"center",padding:n.spacing.lg,backgroundColor:n.colors.secondaryBg,borderRadius:n.radii.md,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(n.colors.primary)},color:t?n.colors.gray:n.colors.bodyText}}),""),B=(0,z.Z)("div",{target:"exg6vvm14"})((function(){return{marginRight:"auto",alignItems:"center",display:"flex"}}),""),k=(0,z.Z)("span",{target:"exg6vvm13"})((function(e){var t=e.theme;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),L=(0,z.Z)("span",{target:"exg6vvm12"})((function(e){return{marginBottom:e.theme.spacing.twoXS}}),""),R=(0,z.Z)("div",{target:"exg6vvm11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),C=(0,z.Z)("div",{target:"exg6vvm10"})((function(e){var t=e.theme;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),U=(0,z.Z)("ul",{target:"exg6vvm9"})((function(){return{listStyleType:"none",marginBottom:0}}),""),P=(0,z.Z)("li",{target:"exg6vvm8"})((function(e){var t=e.theme;return{margin:t.spacing.none,padding:t.spacing.none}}),""),T=(0,z.Z)("div",{target:"exg6vvm7"})((function(e){return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.theme.spacing.lg,overflow:"hidden"}}),""),X=(0,z.Z)("div",{target:"exg6vvm6"})((function(e){var t=e.theme;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),A=(0,z.Z)("div",{target:"exg6vvm5"})((function(e){return{display:"flex",alignItems:"center",marginBottom:e.theme.spacing.twoXS}}),""),D=(0,z.Z)("span",{target:"exg6vvm4"})((function(e){return{marginRight:e.theme.spacing.twoXS}}),""),E=(0,z.Z)("div",{target:"exg6vvm3"})((function(e){var t=e.theme;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),N=(0,z.Z)("small",{target:"exg6vvm2"})((function(e){var t=e.theme;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),O=(0,z.Z)("span",{target:"exg6vvm1"})({name:"0",styles:""}),V=function(e){var t;return t={},(0,I.Z)(t,M,{display:"flex",flexDirection:"column",alignItems:"flex-start"}),(0,I.Z)(t,B,{marginBottom:e.spacing.lg}),(0,I.Z)(t,k,{display:"none"}),(0,I.Z)(t,C,{paddingRight:e.spacing.lg}),(0,I.Z)(t,A,{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm}),(0,I.Z)(t,X,{width:e.sizes.full}),(0,I.Z)(t,T,{flexDirection:"column"}),(0,I.Z)(t,N,{height:"auto",whiteSpace:"initial"}),(0,I.Z)(t,O,{display:"none"}),(0,I.Z)(t,P,{margin:e.spacing.none,padding:e.spacing.none}),t},H=(0,z.Z)("div",{target:"exg6vvm0"})((function(e){var t=e.theme;return t.inSidebar?V(t):(0,I.Z)({},"@media (max-width: ".concat(t.breakpoints.sm,")"),V(t))}),""),G=n(66071),W=n(49089),Y=n(49986),q=n(46417),$=function(e){var t=e.multiple,n=e.acceptedExtensions,r=e.maxSizeBytes;return(0,q.jsxs)(B,{children:[(0,q.jsx)(k,{children:(0,q.jsx)(W.ZP,{content:G.n,size:"threeXL"})}),(0,q.jsxs)(R,{children:[(0,q.jsxs)(L,{children:["Drag and drop file",t?"s":""," here"]}),(0,q.jsxs)(Y.x,{children:["Limit ".concat(y(r,i.Byte,0)," per file"),n.length?" \u2022 ".concat(n.join(", ").replace(/\./g,"").toUpperCase()):null]})]})]})},_=function(e){var t=e.onDrop,n=e.multiple,i=e.acceptedExtensions,r=e.maxSizeBytes,a=e.disabled,s=e.label;return(0,q.jsx)(Z.ZP,{onDrop:t,multiple:n,accept:i.length?i:void 0,maxSize:r,disabled:a,useFsAccessApi:!1,children:function(e){var t=e.getRootProps,o=e.getInputProps;return(0,q.jsxs)(M,(0,F.Z)((0,F.Z)({},t()),{},{"data-testid":"stFileUploadDropzone",isDisabled:a,"aria-label":s,children:[(0,q.jsx)("input",(0,F.Z)({},o())),(0,q.jsx)($,{multiple:n,acceptedExtensions:i,maxSizeBytes:r}),(0,q.jsx)(j.ZP,{kind:j.hY.SECONDARY,disabled:a,size:j.$u.SMALL,children:"Browse files"})]}))}})},K=n(29439),J=n(45987),Q=n(67861),ee=n.n(Q),te=n(71054),ne=n(87669),ie=(0,z.Z)("div",{target:"e1f8s2qs1"})((function(e){var t=e.theme;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),re=(0,z.Z)("div",{target:"e1f8s2qs0"})((function(e){return{display:"flex",alignItems:"center",justifyContent:"center",color:e.theme.colors.fadedText40}}),""),ae=function(e){var t=e.className,n=e.currentPage,i=e.totalPages,r=e.onNext,a=e.onPrevious;return(0,q.jsxs)(ie,{className:t,children:[(0,q.jsx)(Y.x,{children:"Showing page ".concat(n," of ").concat(i)}),(0,q.jsxs)(re,{children:[(0,q.jsx)(j.ZP,{onClick:a,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:te.s,size:"xl"})}),(0,q.jsx)(j.ZP,{onClick:r,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ne._,size:"xl"})})]})]})},se=n(74424),oe=["pageSize","items","resetOnAdd"],le=function(e,t){return Math.ceil(e.length/t)},de=function(e){return ee()((function(t){var n=t.pageSize,i=t.items,r=t.resetOnAdd,a=(0,J.Z)(t,oe),s=(0,p.useState)(0),o=(0,K.Z)(s,2),l=o[0],d=o[1],u=(0,p.useState)(le(i,n)),c=(0,K.Z)(u,2),g=c[0],f=c[1],m=(0,se.D)(i);(0,p.useEffect)((function(){m&&m.length!==i.length&&f(le(i,n)),m&&m.length<i.length?r&&d(0):l+1>=g&&d(g-1)}),[i,l,n,m,r,g]);var h=i.slice(l*n,l*n+n);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(e,(0,F.Z)({items:h},a)),i.length>n?(0,q.jsx)(ae,{className:"streamlit-paginator",pageSize:n,totalPages:g,currentPage:l+1,onNext:function(){d(Math.min(l+1,g-1))},onPrevious:function(){d(Math.max(0,l-1))}}):null]})}),e)},ue=n(2029),ce=n(70782),ge=n(98664),pe=n(4371),fe=function(e){var t=e.fileInfo;return"uploading"===t.status.type?(0,q.jsx)(pe.Z,{value:t.status.progress,size:pe.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,q.jsxs)(N,{children:[(0,q.jsx)(D,{"data-testid":"stUploadedFileErrorMessage",children:t.status.errorMessage}),(0,q.jsx)(O,{children:(0,q.jsx)(W.ZP,{content:ue.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,q.jsx)(Y.x,{children:y(t.size,i.Byte)}):null},me=function(e){var t=e.fileInfo,n=e.onDelete;return(0,q.jsxs)(A,{className:"uploadedFile",children:[(0,q.jsx)(E,{children:(0,q.jsx)(W.ZP,{content:ce.h,size:"twoXL"})}),(0,q.jsxs)(T,{className:"uploadedFileData",children:[(0,q.jsx)(X,{className:"uploadedFileName",title:t.name,children:t.name}),(0,q.jsx)(fe,{fileInfo:t})]}),(0,q.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,q.jsx)(j.ZP,{onClick:function(){return n(t.id)},kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ge.U,size:"lg"})})})]})},he=de((function(e){var t=e.items,n=e.onDelete;return(0,q.jsx)(U,{children:t.map((function(e){return(0,q.jsx)(P,{children:(0,q.jsx)(me,{fileInfo:e,onDelete:n})},e.id)}))})})),ve=function(e){return(0,q.jsx)(C,{children:(0,q.jsx)(he,(0,F.Z)({},e))})},xe=n(84677),ye=function(e){(0,o.Z)(n,e);var t=(0,l.Z)(n);function n(e){var s;return(0,a.Z)(this,n),(s=t.call(this,e)).formClearHelper=new m.Kz,s.localFileIdCounter=1,s.componentDidUpdate=function(e){var t=s.props,n=t.element,i=t.widgetMgr;if(e.disabled!==s.props.disabled&&s.props.disabled)return s.reset(),void i.setFileUploaderStateValue(n,new f.xO,{fromUi:!1});if("ready"===s.status){var r=s.createWidgetValue();if(void 0!==r){var a=i.getFileUploaderStateValue(n);g().isEqual(r,a)||i.setFileUploaderStateValue(n,r,{fromUi:!0})}}},s.reset=function(){s.setState({files:[]})},s.dropHandler=function(e,t){var n=s.props.element.multipleFiles;if(!n&&0===e.length&&t.length>1){var i=t.findIndex((function(e){return 1===e.errors.length&&"too-many-files"===e.errors[0].code}));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(!n&&e.length>0&&s.state.files.length>0&&s.removeFile(s.state.files[0].id),e.forEach(s.uploadFile),t.length>0){var r=t.map((function(e){var t=e.file;return new xe.R(t.name,t.size,s.nextLocalFileId(),{type:"error",errorMessage:s.getErrorMessage(e.errors[0].code,e.file)})}));s.addFiles(r)}},s.uploadFile=function(e){var t=u().CancelToken.source(),n=new xe.R(e.name,e.size,s.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});s.addFile(n),s.props.uploadClient.uploadFile(s.props.element,e,(function(e){return s.onUploadProgress(e,n.id)}),t.token).then((function(e){return s.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||s.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},s.onUploadComplete=function(e,t){s.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t)}}));var n=s.getFile(e);null!=n&&"uploading"===n.status.type&&s.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},s.getErrorMessage=function(e,t){switch(e){case"file-too-large":return"File must be ".concat(y(s.maxUploadSizeInBytes,i.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."}},s.deleteFile=function(e){var t=s.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),s.removeFile(e))},s.addFile=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),[e])}}))},s.addFiles=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),(0,r.Z)(e))}}))},s.removeFile=function(e){s.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},s.getFile=function(e){return s.state.files.find((function(t){return t.id===e}))},s.updateFile=function(e,t){s.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},s.onUploadProgress=function(e,t){var n=s.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&s.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},s.onFormCleared=function(){s.setState({files:[]},(function(){var e=s.createWidgetValue();null!=e&&s.props.widgetMgr.setFileUploaderStateValue(s.props.element,e,{fromUi:!0})}))},s.state=s.initialValue,s}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0},n=this.props,i=n.widgetMgr,r=n.element,a=i.getFileUploaderStateValue(r);if(null==a)return t;var s=a.maxFileId,o=a.uploadedFileInfo;return null==s||0===s||null==o?t:{files:o.map((function(t){var n=t.name,i=t.size,r=t.id;return new xe.R(n,i,e.nextLocalFileId(),{type:"uploaded",serverFileId:r})})),newestServerFileId:Number(s)}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maxUploadSizeInBytes",get:function(){return function(e,t,n){if(e<0)throw Error("Size must be 0 or greater");var i=x.findIndex((function(e){return e===t})),r=x.findIndex((function(e){return e===n}));if(-1===i||-1===r)throw Error("Unexpected byte unit provided");if(i===r)return e;var a=Math.abs(i-r),s=Math.pow(v,a);return i>r?e/s:e*s}(this.props.element.maxUploadSizeMb,i.Megabyte,i.Byte)}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,i=e.status;return new f.jM({id:i.serverFileId,name:t,size:n})}));return new f.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.state.files,n=this.props,i=n.element,r=n.disabled,a=n.widgetMgr,s=i.type;this.formClearHelper.manageFormClearListener(a,i.formId,this.onFormCleared);var o=t.slice().reverse();return(0,q.jsxs)(H,{"data-testid":"stFileUploader",children:[(0,q.jsx)(S.ON,{label:i.label,disabled:r,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,q.jsx)(S.dT,{children:(0,q.jsx)(w.ZP,{content:i.help,placement:b.ug.TOP_RIGHT})})}),(0,q.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:s,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:r}),o.length>0&&(0,q.jsx)(ve,{items:o,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(p.PureComponent)}}]);
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[511],{4371:function(e,t,n){n.d(t,{$:function(){return i},Z:function(){return c}});var i,r=n(47313),a=n(83985),s=n(54922),o=n(81512),l=n(75314),d=n(74969),u=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(i||(i={}));var c=function(e){var t=e.value,n=e.width,c=e.size,g=void 0===c?i.SMALL:c,p=e.overrides,f=(0,a.u)(),m={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},h=r.useContext(s.I).activeTheme,v=!(0,o.MJ)(h),x={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:m[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:v?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,u.jsx)(l.Z,{value:t,overrides:(0,d.aO)(x,p)})}},84677:function(e,t,n){n.d(t,{R:function(){return a}});var i=n(15671),r=n(43144),a=function(){function e(t,n,r,a){(0,i.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=r,this.status=a}return(0,r.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()},41511:function(e,t,n){n.r(t),n.d(t,{default:function(){return ye}});var i,r=n(93433),a=n(15671),s=n(43144),o=n(60136),l=n(29388),d=n(31881),u=n.n(d),c=n(16031),g=n.n(c),p=n(47313),f=n(7976),m=n(46332),h=n(64243);!function(e){e.Gigabyte="gb",e.Megabyte="mb",e.Kilobyte="kb",e.Byte="b"}(i||(i={}));var v=(0,h.rA)()?1024:1e3,x=[i.Gigabyte,i.Megabyte,i.Kilobyte,i.Byte],y=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(n||(n=i.Byte),r<0&&(r=0),t<0)throw new Error("Size must be greater than or equal to 0");var a=x.indexOf(n),s=t/v;return a&&t>v/2?e(s,x[a-1],r):"".concat(t.toFixed(r)).concat(n.toUpperCase())},S=n(65167),w=n(73290),b=n(10612),F=n(1413),Z=n(80614),j=n(69367),I=n(4942),z=n(47167);var M=(0,z.Z)("section",{target:"exg6vvm15"})((function(e){var t=e.isDisabled,n=e.theme;return{display:"flex",alignItems:"center",padding:n.spacing.lg,backgroundColor:n.colors.secondaryBg,borderRadius:n.radii.md,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 1px ".concat(n.colors.primary)},color:t?n.colors.gray:n.colors.bodyText}}),""),B=(0,z.Z)("div",{target:"exg6vvm14"})((function(){return{marginRight:"auto",alignItems:"center",display:"flex"}}),""),k=(0,z.Z)("span",{target:"exg6vvm13"})((function(e){var t=e.theme;return{color:t.colors.darkenedBgMix100,marginRight:t.spacing.lg}}),""),L=(0,z.Z)("span",{target:"exg6vvm12"})((function(e){return{marginBottom:e.theme.spacing.twoXS}}),""),R=(0,z.Z)("div",{target:"exg6vvm11"})({name:"1fttcpj",styles:"display:flex;flex-direction:column"}),C=(0,z.Z)("div",{target:"exg6vvm10"})((function(e){var t=e.theme;return{left:0,right:0,lineHeight:t.lineHeights.tight,paddingTop:t.spacing.md,paddingLeft:t.spacing.lg,paddingRight:t.spacing.lg}}),""),U=(0,z.Z)("ul",{target:"exg6vvm9"})((function(){return{listStyleType:"none",marginBottom:0}}),""),P=(0,z.Z)("li",{target:"exg6vvm8"})((function(e){var t=e.theme;return{margin:t.spacing.none,padding:t.spacing.none}}),""),T=(0,z.Z)("div",{target:"exg6vvm7"})((function(e){return{display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.theme.spacing.lg,overflow:"hidden"}}),""),X=(0,z.Z)("div",{target:"exg6vvm6"})((function(e){var t=e.theme;return{marginRight:t.spacing.sm,marginBottom:t.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),""),A=(0,z.Z)("div",{target:"exg6vvm5"})((function(e){return{display:"flex",alignItems:"center",marginBottom:e.theme.spacing.twoXS}}),""),D=(0,z.Z)("span",{target:"exg6vvm4"})((function(e){return{marginRight:e.theme.spacing.twoXS}}),""),E=(0,z.Z)("div",{target:"exg6vvm3"})((function(e){var t=e.theme;return{display:"flex",padding:t.spacing.twoXS,color:t.colors.darkenedBgMix100}}),""),N=(0,z.Z)("small",{target:"exg6vvm2"})((function(e){var t=e.theme;return{color:t.colors.danger,fontSize:t.fontSizes.sm,height:t.fontSizes.sm,lineHeight:t.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"}}),""),O=(0,z.Z)("span",{target:"exg6vvm1"})({name:"0",styles:""}),V=function(e){var t;return t={},(0,I.Z)(t,M,{display:"flex",flexDirection:"column",alignItems:"flex-start"}),(0,I.Z)(t,B,{marginBottom:e.spacing.lg}),(0,I.Z)(t,k,{display:"none"}),(0,I.Z)(t,C,{paddingRight:e.spacing.lg}),(0,I.Z)(t,A,{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm}),(0,I.Z)(t,X,{width:e.sizes.full}),(0,I.Z)(t,T,{flexDirection:"column"}),(0,I.Z)(t,N,{height:"auto",whiteSpace:"initial"}),(0,I.Z)(t,O,{display:"none"}),(0,I.Z)(t,P,{margin:e.spacing.none,padding:e.spacing.none}),t},H=(0,z.Z)("div",{target:"exg6vvm0"})((function(e){var t=e.theme;return t.inSidebar?V(t):(0,I.Z)({},"@media (max-width: ".concat(t.breakpoints.sm,")"),V(t))}),""),G=n(66071),W=n(49089),Y=n(49986),q=n(46417),$=function(e){var t=e.multiple,n=e.acceptedExtensions,r=e.maxSizeBytes;return(0,q.jsxs)(B,{children:[(0,q.jsx)(k,{children:(0,q.jsx)(W.ZP,{content:G.n,size:"threeXL"})}),(0,q.jsxs)(R,{children:[(0,q.jsxs)(L,{children:["Drag and drop file",t?"s":""," here"]}),(0,q.jsxs)(Y.x,{children:["Limit ".concat(y(r,i.Byte,0)," per file"),n.length?" \u2022 ".concat(n.join(", ").replace(/\./g,"").toUpperCase()):null]})]})]})},_=function(e){var t=e.onDrop,n=e.multiple,i=e.acceptedExtensions,r=e.maxSizeBytes,a=e.disabled,s=e.label;return(0,q.jsx)(Z.ZP,{onDrop:t,multiple:n,accept:i.length?i:void 0,maxSize:r,disabled:a,useFsAccessApi:!1,children:function(e){var t=e.getRootProps,o=e.getInputProps;return(0,q.jsxs)(M,(0,F.Z)((0,F.Z)({},t()),{},{"data-testid":"stFileUploadDropzone",isDisabled:a,"aria-label":s,children:[(0,q.jsx)("input",(0,F.Z)({},o())),(0,q.jsx)($,{multiple:n,acceptedExtensions:i,maxSizeBytes:r}),(0,q.jsx)(j.ZP,{kind:j.hY.SECONDARY,disabled:a,size:j.$u.SMALL,children:"Browse files"})]}))}})},K=n(29439),J=n(45987),Q=n(67861),ee=n.n(Q),te=n(71054),ne=n(87669),ie=(0,z.Z)("div",{target:"e1f8s2qs1"})((function(e){var t=e.theme;return{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:t.spacing.twoXS,marginBottom:t.spacing.twoXS}}),""),re=(0,z.Z)("div",{target:"e1f8s2qs0"})((function(e){return{display:"flex",alignItems:"center",justifyContent:"center",color:e.theme.colors.fadedText40}}),""),ae=function(e){var t=e.className,n=e.currentPage,i=e.totalPages,r=e.onNext,a=e.onPrevious;return(0,q.jsxs)(ie,{className:t,children:[(0,q.jsx)(Y.x,{children:"Showing page ".concat(n," of ").concat(i)}),(0,q.jsxs)(re,{children:[(0,q.jsx)(j.ZP,{onClick:a,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:te.s,size:"xl"})}),(0,q.jsx)(j.ZP,{onClick:r,kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ne._,size:"xl"})})]})]})},se=n(74424),oe=["pageSize","items","resetOnAdd"],le=function(e,t){return Math.ceil(e.length/t)},de=function(e){return ee()((function(t){var n=t.pageSize,i=t.items,r=t.resetOnAdd,a=(0,J.Z)(t,oe),s=(0,p.useState)(0),o=(0,K.Z)(s,2),l=o[0],d=o[1],u=(0,p.useState)(le(i,n)),c=(0,K.Z)(u,2),g=c[0],f=c[1],m=(0,se.D)(i);(0,p.useEffect)((function(){m&&m.length!==i.length&&f(le(i,n)),m&&m.length<i.length?r&&d(0):l+1>=g&&d(g-1)}),[i,l,n,m,r,g]);var h=i.slice(l*n,l*n+n);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(e,(0,F.Z)({items:h},a)),i.length>n?(0,q.jsx)(ae,{className:"streamlit-paginator",pageSize:n,totalPages:g,currentPage:l+1,onNext:function(){d(Math.min(l+1,g-1))},onPrevious:function(){d(Math.max(0,l-1))}}):null]})}),e)},ue=n(2029),ce=n(70782),ge=n(98664),pe=n(4371),fe=function(e){var t=e.fileInfo;return"uploading"===t.status.type?(0,q.jsx)(pe.Z,{value:t.status.progress,size:pe.$.SMALL,overrides:{Bar:{style:{marginLeft:0,marginTop:"4px"}}}}):"error"===t.status.type?(0,q.jsxs)(N,{children:[(0,q.jsx)(D,{"data-testid":"stUploadedFileErrorMessage",children:t.status.errorMessage}),(0,q.jsx)(O,{children:(0,q.jsx)(W.ZP,{content:ue.j,size:"lg"})})]}):"uploaded"===t.status.type?(0,q.jsx)(Y.x,{children:y(t.size,i.Byte)}):null},me=function(e){var t=e.fileInfo,n=e.onDelete;return(0,q.jsxs)(A,{className:"uploadedFile",children:[(0,q.jsx)(E,{children:(0,q.jsx)(W.ZP,{content:ce.h,size:"twoXL"})}),(0,q.jsxs)(T,{className:"uploadedFileData",children:[(0,q.jsx)(X,{className:"uploadedFileName",title:t.name,children:t.name}),(0,q.jsx)(fe,{fileInfo:t})]}),(0,q.jsx)("div",{"data-testid":"fileDeleteBtn",children:(0,q.jsx)(j.ZP,{onClick:function(){return n(t.id)},kind:j.hY.MINIMAL,children:(0,q.jsx)(W.ZP,{content:ge.U,size:"lg"})})})]})},he=de((function(e){var t=e.items,n=e.onDelete;return(0,q.jsx)(U,{children:t.map((function(e){return(0,q.jsx)(P,{children:(0,q.jsx)(me,{fileInfo:e,onDelete:n})},e.id)}))})})),ve=function(e){return(0,q.jsx)(C,{children:(0,q.jsx)(he,(0,F.Z)({},e))})},xe=n(84677),ye=function(e){(0,o.Z)(n,e);var t=(0,l.Z)(n);function n(e){var s;return(0,a.Z)(this,n),(s=t.call(this,e)).formClearHelper=new m.Kz,s.localFileIdCounter=1,s.componentDidUpdate=function(e){var t=s.props,n=t.element,i=t.widgetMgr;if(e.disabled!==s.props.disabled&&s.props.disabled)return s.reset(),void i.setFileUploaderStateValue(n,new f.xO,{fromUi:!1});if("ready"===s.status){var r=s.createWidgetValue();if(void 0!==r){var a=i.getFileUploaderStateValue(n);g().isEqual(r,a)||i.setFileUploaderStateValue(n,r,{fromUi:!0})}}},s.reset=function(){s.setState({files:[]})},s.dropHandler=function(e,t){var n=s.props.element.multipleFiles;if(!n&&0===e.length&&t.length>1){var i=t.findIndex((function(e){return 1===e.errors.length&&"too-many-files"===e.errors[0].code}));i>=0&&(e.push(t[i].file),t.splice(i,1))}if(!n&&e.length>0&&s.state.files.length>0&&s.removeFile(s.state.files[0].id),e.forEach(s.uploadFile),t.length>0){var r=t.map((function(e){var t=e.file;return new xe.R(t.name,t.size,s.nextLocalFileId(),{type:"error",errorMessage:s.getErrorMessage(e.errors[0].code,e.file)})}));s.addFiles(r)}},s.uploadFile=function(e){var t=u().CancelToken.source(),n=new xe.R(e.name,e.size,s.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});s.addFile(n),s.props.uploadClient.uploadFile(s.props.element,e,(function(e){return s.onUploadProgress(e,n.id)}),t.token).then((function(e){return s.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||s.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},s.onUploadComplete=function(e,t){s.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t)}}));var n=s.getFile(e);null!=n&&"uploading"===n.status.type&&s.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},s.getErrorMessage=function(e,t){switch(e){case"file-too-large":return"File must be ".concat(y(s.maxUploadSizeInBytes,i.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."}},s.deleteFile=function(e){var t=s.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),s.removeFile(e))},s.addFile=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),[e])}}))},s.addFiles=function(e){s.setState((function(t){return{files:[].concat((0,r.Z)(t.files),(0,r.Z)(e))}}))},s.removeFile=function(e){s.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},s.getFile=function(e){return s.state.files.find((function(t){return t.id===e}))},s.updateFile=function(e,t){s.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},s.onUploadProgress=function(e,t){var n=s.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&s.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},s.onFormCleared=function(){s.setState({files:[]},(function(){var e=s.createWidgetValue();null!=e&&s.props.widgetMgr.setFileUploaderStateValue(s.props.element,e,{fromUi:!0})}))},s.state=s.initialValue,s}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0},n=this.props,i=n.widgetMgr,r=n.element,a=i.getFileUploaderStateValue(r);if(null==a)return t;var s=a.maxFileId,o=a.uploadedFileInfo;return null==s||0===s||null==o?t:{files:o.map((function(t){var n=t.name,i=t.size,r=t.id;return new xe.R(n,i,e.nextLocalFileId(),{type:"uploaded",serverFileId:r})})),newestServerFileId:Number(s)}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maxUploadSizeInBytes",get:function(){return function(e,t,n){if(e<0)throw Error("Size must be 0 or greater");var i=x.findIndex((function(e){return e===t})),r=x.findIndex((function(e){return e===n}));if(-1===i||-1===r)throw Error("Unexpected byte unit provided");if(i===r)return e;var a=Math.abs(i-r),s=Math.pow(v,a);return i>r?e/s:e*s}(this.props.element.maxUploadSizeMb,i.Megabyte,i.Byte)}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,i=e.status;return new f.jM({id:i.serverFileId,name:t,size:n})}));return new f.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.state.files,n=this.props,i=n.element,r=n.disabled,a=n.widgetMgr,s=i.type;this.formClearHelper.manageFormClearListener(a,i.formId,this.onFormCleared);var o=t.slice().reverse();return(0,q.jsxs)(H,{"data-testid":"stFileUploader",children:[(0,q.jsx)(S.ON,{label:i.label,disabled:r,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,q.jsx)(S.dT,{children:(0,q.jsx)(w.ZP,{content:i.help,placement:b.ug.TOP_RIGHT})})}),(0,q.jsx)(_,{onDrop:this.dropHandler,multiple:i.multipleFiles,acceptedExtensions:s,maxSizeBytes:this.maxUploadSizeInBytes,label:i.label,disabled:r}),o.length>0&&(0,q.jsx)(ve,{items:o,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(p.PureComponent)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[578],{18578:function(l,e,o){o.r(e),o.d(e,{default:function(){return h}});var r=o(29439),t=o(47313),a=o(83985),c=o(26419),i=o(24483),n=o(1413),p=o(16031),s=o(
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[578],{18578:function(l,e,o){o.r(e),o.d(e,{default:function(){return h}});var r=o(29439),t=o(47313),a=o(83985),c=o(26419),i=o(24483),n=o(1413),p=o(16031),s=o(81512),f=o(81003),y=o(72599);function u(l,e,o){return l=function(l,e){return(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll("#000032",(0,s.By)(e))).replaceAll("#000033",(0,s.He)(e))).replaceAll("#000034",(0,s.Iy)(e)?e.colors.blue80:e.colors.blue40)).replaceAll("#000035",(0,s.ny)(e))).replaceAll("#000036",(0,s.Xy)(e))).replaceAll("#000037",(0,s.yq)(e))).replaceAll("#000038",e.colors.bgColor)).replaceAll("#000039",e.colors.fadedText05)).replaceAll("#000040",e.colors.bgMix)}(l,e),l=function(l,e,o){var r="#000001",t="#000002",a="#000003",c="#000004",i="#000005",n="#000006",p="#000007",f="#000008",y="#000009",u="#000010";if("streamlit"===o){var d=(0,s.iY)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,d[0])).replaceAll(t,d[1])).replaceAll(a,d[2])).replaceAll(c,d[3])).replaceAll(i,d[4])).replaceAll(n,d[5])).replaceAll(p,d[6])).replaceAll(f,d[7])).replaceAll(y,d[8])).replaceAll(u,d[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#636efa")).replaceAll(t,"#EF553B")).replaceAll(a,"#00cc96")).replaceAll(c,"#ab63fa")).replaceAll(i,"#FFA15A")).replaceAll(n,"#19d3f3")).replaceAll(p,"#FF6692")).replaceAll(f,"#B6E880")).replaceAll(y,"#FF97FF")).replaceAll(u,"#FECB52");return l}(l,e,o),l=function(l,e,o){var r="#000011",t="#000012",a="#000013",c="#000014",i="#000015",n="#000016",p="#000017",f="#000018",y="#000019",u="#000020";if("streamlit"===o){var d=(0,s.Gy)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,d[0])).replaceAll(t,d[1])).replaceAll(a,d[2])).replaceAll(c,d[3])).replaceAll(i,d[4])).replaceAll(n,d[5])).replaceAll(p,d[6])).replaceAll(f,d[7])).replaceAll(y,d[8])).replaceAll(u,d[9])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#0d0887")).replaceAll(t,"#46039f")).replaceAll(a,"#7201a8")).replaceAll(c,"#9c179e")).replaceAll(i,"#bd3786")).replaceAll(n,"#d8576b")).replaceAll(p,"#ed7953")).replaceAll(f,"#fb9f3a")).replaceAll(y,"#fdca26")).replaceAll(u,"#f0f921");return l}(l,e,o),l=function(l,e,o){var r="#000021",t="#000022",a="#000023",c="#000024",i="#000025",n="#000026",p="#000027",f="#000028",y="#000029",u="#000030",d="#000031";if("streamlit"===o){var A=(0,s.ru)(e);l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,A[0])).replaceAll(t,A[1])).replaceAll(a,A[2])).replaceAll(c,A[3])).replaceAll(i,A[4])).replaceAll(n,A[5])).replaceAll(p,A[6])).replaceAll(f,A[7])).replaceAll(y,A[8])).replaceAll(u,A[9])).replaceAll(d,A[10])}else l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replaceAll(r,"#8e0152")).replaceAll(t,"#c51b7d")).replaceAll(a,"#de77ae")).replaceAll(c,"#f1b6da")).replaceAll(i,"#fde0ef")).replaceAll(n,"#f7f7f7")).replaceAll(p,"#e6f5d0")).replaceAll(f,"#b8e186")).replaceAll(y,"#7fbc41")).replaceAll(u,"#4d9221")).replaceAll(d,"#276419");return l}(l,e,o),l}function d(l,e){try{!function(l,e){var o=e.genericFonts,r=e.colors,t=e.fontSizes,a={font:{color:(0,s.Xy)(e),family:o.bodyFont,size:t.twoSmPx},title:{color:r.headingColor,subtitleColor:r.bodyText,font:{family:o.headingFont,size:t.mdPx,color:r.headingColor},pad:{l:e.spacing.twoXSPx},xanchor:"left",x:0},legend:{title:{font:{size:t.twoSmPx,color:(0,s.Xy)(e)},side:"top"},valign:"top",bordercolor:r.transparent,borderwidth:e.spacing.nonePx,font:{size:t.twoSmPx,color:(0,s.yq)(e)}},paper_bgcolor:r.bgColor,plot_bgcolor:r.bgColor,yaxis:{ticklabelposition:"outside",zerolinecolor:(0,s.ny)(e),title:{font:{color:(0,s.Xy)(e),size:t.smPx},standoff:e.spacing.twoXLPx},tickcolor:(0,s.ny)(e),tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx},gridcolor:(0,s.ny)(e),minor:{gridcolor:(0,s.ny)(e)},automargin:!0},xaxis:{zerolinecolor:(0,s.ny)(e),gridcolor:(0,s.ny)(e),showgrid:!1,tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx},tickcolor:(0,s.ny)(e),title:{font:{color:(0,s.Xy)(e),size:t.smPx},standoff:e.spacing.xlPx},minor:{gridcolor:(0,s.ny)(e)},zeroline:!1,automargin:!0,rangeselector:{bgcolor:r.bgColor,bordercolor:(0,s.ny)(e),borderwidth:1,x:0}},margin:{pad:e.spacing.smPx,r:e.spacing.nonePx,l:e.spacing.nonePx},hoverlabel:{bgcolor:r.bgColor,bordercolor:r.fadedText10,font:{color:(0,s.Xy)(e),family:o.bodyFont,size:t.twoSmPx}},coloraxis:{colorbar:{thickness:16,xpad:e.spacing.twoXLPx,ticklabelposition:"outside",outlinecolor:r.transparent,outlinewidth:8,len:.75,y:.5745,title:{font:{color:(0,s.Xy)(e),size:t.smPx}},tickfont:{color:(0,s.Xy)(e),size:t.twoSmPx}}},ternary:{gridcolor:(0,s.Xy)(e),bgcolor:r.bgColor,title:{font:{family:o.bodyFont,size:t.smPx}},color:(0,s.Xy)(e),aaxis:{gridcolor:(0,s.Xy)(e),linecolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},baxis:{linecolor:(0,s.Xy)(e),gridcolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}},caxis:{linecolor:(0,s.Xy)(e),gridcolor:(0,s.Xy)(e),tickfont:{family:o.bodyFont,size:t.twoSmPx}}}};(0,p.merge)(l,a)}(l.layout.template.layout,e)}catch(r){var o=(0,f.b)(r);(0,y.H)(o)}"title"in l.layout&&(l.layout.title=(0,p.merge)(l.layout.title,{text:"<b>".concat(l.layout.title.text,"</b>")}))}var A=o(46417);function g(l){return!!l}function b(l){var e=l.element,o=l.width,c=l.height,p=e.figure,s=(0,a.u)(),f=(0,t.useCallback)((function(){var l=JSON.parse(u(p.spec,s,e.theme)),r=l.layout.height,t=l.layout.width;return g(c)?(l.layout.width=o,l.layout.height=c):e.useContainerWidth?l.layout.width=o:(l.layout.width=t,l.layout.height=r),"streamlit"===e.theme?d(l,s):l.layout=function(l,e){var o=e.colors,r=e.genericFonts,t={font:{color:o.bodyText,family:r.bodyFont},paper_bgcolor:o.bgColor,plot_bgcolor:o.secondaryBg};return(0,n.Z)((0,n.Z)({},l),{},{font:(0,n.Z)((0,n.Z)({},t.font),l.font),paper_bgcolor:l.paper_bgcolor||t.paper_bgcolor,plot_bgcolor:l.plot_bgcolor||t.plot_bgcolor})}(l.layout,s),l}),[e.theme,e.useContainerWidth,p.spec,c,s,o]),y=(0,t.useState)(JSON.parse(p.config)),b=(0,r.Z)(y,2),h=b[0],m=b[1],x=(0,t.useState)(f()),w=(0,r.Z)(x,2),P=w[0],X=w[1];(0,t.useLayoutEffect)((function(){m(JSON.parse(p.config)),X(f())}),[e,s,c,o,p.config,f]);var z=P.data,F=P.layout,v=P.frames;return(0,A.jsx)(i.Z,{className:"stPlotlyChart",data:z,layout:F,config:h,frames:v},g(c)?"fullscreen":"original")}var h=(0,c.Z)((function(l){var e=l.width,o=l.element,r=l.height;switch(o.chart){case"url":return function(l){var e=l.url,o=l.width,r=l.height||450;return(0,A.jsx)("iframe",{title:"Plotly",src:e,style:{width:o,height:r}})}({url:o.url,height:r,width:e});case"figure":return(0,A.jsx)(b,{width:e,element:o,height:r});default:throw new Error("Unrecognized PlotlyChart type: ".concat(o.chart))}}))}}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[619],{4619:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return C}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),l=n(47313),s=n(34862),u=n(38587),p=n.n(u),c=n(83985),d=n(46332),f=n(85540),m=n(58325),h=n(65167),v=(0,n(47167).Z)("div",{target:"ede6r8z0"})((function(e){return{"span[aria-disabled='true']":{background:e.theme.colors.fadedText05}}}),""),g=n(73290),y=n(
|
1
|
+
(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[619],{4619:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return C}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),l=n(47313),s=n(34862),u=n(38587),p=n.n(u),c=n(83985),d=n(46332),f=n(85540),m=n(58325),h=n(65167),v=(0,n(47167).Z)("div",{target:"ede6r8z0"})((function(e){return{"span[aria-disabled='true']":{background:e.theme.colors.fadedText05}}}),""),g=n(73290),y=n(10612),b=n(24161),x=n(69319),S=n(64243),w=n(46417),k=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new d.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setIntArrayValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onChange=function(t){e.props.element.maxSelections&&"select"===t.type&&e.state.value.length>=e.props.element.maxSelections||e.setState(e.generateNewState(t),(function(){e.commitWidgetValue({fromUi:!0})}))},e.filterOptions=function(t,n){if(e.overMaxSelections())return[];var r=t.filter((function(t){return!e.state.value.includes(Number(t.value))}));return(0,x.H)(r,n)},e}return(0,o.Z)(n,[{key:"overMaxSelections",value:function(){return this.props.element.maxSelections>0&&this.state.value.length>=this.props.element.maxSelections}},{key:"getNoResultsMsg",value:function(){if(0===this.props.element.maxSelections)return"No results";var e=1!==this.props.element.maxSelections?"options":"option";return"You can only select up to ".concat(this.props.element.maxSelections," ").concat(e,". Remove an option first.")}},{key:"initialValue",get:function(){var e=this.props.widgetMgr.getIntArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"valueFromState",get:function(){var e=this;return this.state.value.map((function(t){var n=e.props.element.options[t];return{value:t.toString(),label:n}}))}},{key:"generateNewState",value:function(e){var t=function(){var t,n=null===(t=e.option)||void 0===t?void 0:t.value;return parseInt(n,10)};switch(e.type){case"remove":return{value:p()(this.state.value,t())};case"clear":return{value:[]};case"select":return{value:this.state.value.concat([t()])};default:throw new Error("State transition is unknown: ".concat(e.type))}}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.theme,o=t.width,i=t.widgetMgr,a={width:o},l=n.options,u=0===l.length||this.props.disabled,p=0===l.length?"No options to select.":"Choose an option",c=l.map((function(e,t){return{label:e,value:t.toString()}}));this.formClearHelper.manageFormClearListener(i,n.formId,this.onFormCleared);var d=l.length>10;return(0,w.jsxs)("div",{className:"row-widget stMultiSelect",style:a,children:[(0,w.jsx)(h.ON,{label:n.label,disabled:u,labelVisibility:(0,S.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,w.jsx)(h.dT,{children:(0,w.jsx)(g.ZP,{content:n.help,placement:y.ug.TOP_RIGHT})})}),(0,w.jsx)(v,{children:(0,w.jsx)(f.Z,{options:c,labelKey:"label",valueKey:"value","aria-label":n.label,placeholder:p,type:m.wD.select,multi:!0,onChange:this.onChange,value:this.valueFromState,disabled:u,size:"compact",noResultsMsg:this.getNoResultsMsg(),filterOptions:this.filterOptions,closeOnSelect:!1,overrides:{IconsContainer:{style:function(){return{paddingRight:r.spacing.sm}}},ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},Placeholder:{style:function(){return{flex:"inherit"}}},ValueContainer:{style:function(){return{minHeight:"38.4px",paddingLeft:r.spacing.sm,paddingTop:0,paddingBottom:0,paddingRight:0}}},ClearIcon:{props:{overrides:{Svg:{style:{color:r.colors.darkGray,transform:"scale(1.5)",width:r.spacing.twoXL,":hover":{fill:r.colors.bodyText}}}}}},SearchIcon:{style:{color:r.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:r.radii.md,borderTopRightRadius:r.radii.md,borderBottomRightRadius:r.radii.md,borderBottomLeftRadius:r.radii.md,fontSize:r.fontSizes.sm,paddingLeft:r.spacing.sm,marginLeft:0,marginRight:r.spacing.sm,height:"28px"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"10px",height:"10px"}}}}},Text:{style:{fontSize:r.fontSizes.md}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:r.fontSizes.sm}}}}},Input:{props:{readOnly:s.tq&&!1===d?"readonly":null}},Dropdown:{component:b.s}}})})]})}}]),n}(l.PureComponent),C=(0,c.b)(k)},34405:function(e,t,n){var r=n(99038);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},86722:function(e){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}},29131:function(e,t,n){var r=n(44526),o=n(34405),i=n(86722),a=n(95434),l=n(36902),s=n(88905);e.exports=function(e,t,n,u){var p=-1,c=o,d=!0,f=e.length,m=[],h=t.length;if(!f)return m;n&&(t=a(t,l(n))),u?(c=i,d=!1):t.length>=200&&(c=s,d=!1,t=new r(t));e:for(;++p<f;){var v=e[p],g=null==n?v:n(v);if(v=u||0!==v?v:0,d&&g===g){for(var y=h;y--;)if(t[y]===g)continue e;m.push(v)}else c(t,g,u)||m.push(v)}return m}},93527:function(e){e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},99038:function(e,t,n){var r=n(93527),o=n(57700),i=n(13245);e.exports=function(e,t,n){return t===t?i(e,t,n):r(e,o,n)}},57700:function(e){e.exports=function(e){return e!==e}},13245:function(e){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},38587:function(e,t,n){var r=n(29131),o=n(44409),i=n(79312),a=o((function(e,t){return i(e)?r(e,t):[]}));e.exports=a}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[628],{75006:function(e,t,n){n.d(t,{Z:function(){return f}});n(47313);var r,o=n(64243),i=n(65167),a=n(1413),u=n(30168),l=n(47167),c=(0,n(30686).F4)(r||(r=(0,u.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),s=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,n=e.shouldBlink,r=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{}),n?{color:r.colors.red,animationName:"".concat(c),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),p=n(46417),f=function(e){var t=e.dirty,n=e.value,r=e.maxLength,a=e.className,u=e.type,l=[],c=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,p.jsx)(s,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===u?"single":u)?(0,o.Ge)()?c("Press \u2318+Enter to apply"):c("Press Ctrl+Enter to apply"):c("Press Enter to apply")),r&&c("".concat(n.length,"/").concat(r),t&&n.length>=r),(0,p.jsx)(i.X7,{className:a,children:l})}},14628:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),u=n(47313),l=n(3208),c=n(7976),s=n(46332),p=n(75006),f=n(65167),d=n(73290),y=n(
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[628],{75006:function(e,t,n){n.d(t,{Z:function(){return f}});n(47313);var r,o=n(64243),i=n(65167),a=n(1413),u=n(30168),l=n(47167),c=(0,n(30686).F4)(r||(r=(0,u.Z)(["\n 50% {\n color: rgba(0, 0, 0, 0);\n }\n"]))),s=(0,l.Z)("span",{target:"e1m4n6jn0"})((function(e){var t=e.includeDot,n=e.shouldBlink,r=e.theme;return(0,a.Z)((0,a.Z)({},t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:r.colors.gray,margin:"0 5px"}}:{}),n?{color:r.colors.red,animationName:"".concat(c),animationDuration:"0.5s",animationIterationCount:5}:{})}),""),p=n(46417),f=function(e){var t=e.dirty,n=e.value,r=e.maxLength,a=e.className,u=e.type,l=[],c=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l.push((0,p.jsx)(s,{includeDot:l.length>0,shouldBlink:t,children:e},l.length))};return t&&("multiline"===(void 0===u?"single":u)?(0,o.Ge)()?c("Press \u2318+Enter to apply"):c("Press Ctrl+Enter to apply"):c("Press Enter to apply")),r&&c("".concat(n.length,"/").concat(r),t&&n.length>=r),(0,p.jsx)(i.X7,{className:a,children:l})}},14628:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var r=n(15671),o=n(43144),i=n(60136),a=n(29388),u=n(47313),l=n(3208),c=n(7976),s=n(46332),p=n(75006),f=n(65167),d=n(73290),y=n(10612),h=n(64243),m=(0,n(47167).Z)("div",{target:"edfmue0"})((function(e){return{position:"relative",width:e.width}}),""),b=n(46417),v=function(e){(0,i.Z)(n,e);var t=(0,a.Z)(n);function n(){var e;(0,r.Z)(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).formClearHelper=new s.Kz,e.state={dirty:!1,value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringValue(e.props.element,e.state.value,t),e.setState({dirty:!1})},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onBlur=function(){e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e.onChange=function(t){var n=t.target.value,r=e.props.element.maxChars;0!==r&&n.length>r||((0,h.$b)(e.props.element)?e.setState({dirty:!1,value:n},(function(){return e.commitWidgetValue({fromUi:!0})})):e.setState({dirty:!0,value:n}))},e.onKeyPress=function(t){"Enter"===t.key&&e.state.dirty&&e.commitWidgetValue({fromUi:!0})},e}return(0,o.Z)(n,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"getTypeString",value:function(){return this.props.element.type===c.oi.Type.PASSWORD?"password":"text"}},{key:"render",value:function(){var e,t=this.state,n=t.dirty,r=t.value,o=this.props,i=o.element,a=o.width,u=o.disabled,c=o.widgetMgr,s=i.placeholder;return this.formClearHelper.manageFormClearListener(c,i.formId,this.onFormCleared),(0,b.jsxs)(m,{className:"row-widget stTextInput",width:a,children:[(0,b.jsx)(f.ON,{label:i.label,disabled:u,labelVisibility:(0,h.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,b.jsx)(f.dT,{children:(0,b.jsx)(d.ZP,{content:i.help,placement:y.ug.TOP_RIGHT})})}),(0,b.jsx)(l.Z,{value:r,placeholder:s,onBlur:this.onBlur,onChange:this.onChange,onKeyPress:this.onKeyPress,"aria-label":i.label,disabled:u,type:this.getTypeString(),autoComplete:i.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:"1.4",paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}},Root:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}}}}),(0,b.jsx)(p.Z,{dirty:n,value:r,maxLength:i.maxChars})]})}}]),n}(u.PureComponent),g=v},3208:function(e,t,n){var r=n(47313),o=n(74969),i=n(84886),a=n(53998),u=n(12903),l=n(37613);function c(e){return c="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},c(e)}var s=["Root","StartEnhancer","EndEnhancer"],p=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(l){u=!0,o=l}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function g(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 n,r=O(e);if(t){var o=O(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){if(t&&("object"===c(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=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&&v(e,t)}(w,e);var t,n,c,y=g(w);function w(){var e;m(this,w);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return P(j(e=y.call.apply(y,[this].concat(n))),"state",{isFocused:e.props.autoFocus||!1}),P(j(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),P(j(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=w,(n=[{key:"render",value:function(){var e=this.props,t=e.startEnhancer,n=e.endEnhancer,c=e.overrides,y=c.Root,m=c.StartEnhancer,b=c.EndEnhancer,v=h(c,s),g=h(e,p),w=d((0,o.jb)(y,u.fC),2),j=w[0],O=w[1],P=d((0,o.jb)(m,u.Fp),2),S=P[0],C=P[1],F=d((0,o.jb)(b,u.Fp),2),k=F[0],V=F[1],B=(0,i.t)(this.props,this.state);return r.createElement(j,f({"data-baseweb":"input"},B,O,{$adjoined:E(t,n),$hasIconTrailing:this.props.clearable||"password"==this.props.type}),x(t)&&r.createElement(S,f({},B,C,{$position:l.Xf.start}),"function"===typeof t?t(B):t),r.createElement(a.Z,f({},g,{overrides:v,adjoined:E(t,n),onFocus:this.onFocus,onBlur:this.onBlur})),x(n)&&r.createElement(k,f({},B,V,{$position:l.Xf.end}),"function"===typeof n?n(B):n))}}])&&b(t.prototype,n),c&&b(t,c),Object.defineProperty(t,"prototype",{writable:!1}),w}(r.Component);function E(e,t){return x(e)&&x(t)?l.y4.both:x(e)?l.y4.left:x(t)?l.y4.right:l.y4.none}function x(e){return Boolean(e||0===e)}P(S,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:l.NO.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1}),t.Z=S}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[681],{4371:function(e,t,n){n.d(t,{$:function(){return r},Z:function(){return u}});var r,i=n(47313),o=n(83985),s=n(54922),a=n(16168),l=n(75314),c=n(74969),d=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(r||(r={}));var u=function(e){var t=e.value,n=e.width,u=e.size,g=void 0===u?r.SMALL:u,p=e.overrides,f=(0,o.u)(),h={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},m=i.useContext(s.I).activeTheme,S=!(0,a.MJ)(m),v={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:h[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:S?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,d.jsx)(l.Z,{value:t,overrides:(0,c.aO)(v,p)})}},44681:function(e,t,n){n.r(t),n.d(t,{default:function(){return ee}});var r,i=n(93433),o=n(15671),s=n(43144),a=n(60136),l=n(29388),c=n(92653),d=n(31881),u=n.n(d),g=n(16031),p=n.n(g),f=n(47313),h=n(7976),m=n(49089),S=n(80213),v=n(73290),w=n(65167),R=n(46332),x=n(72599),b=n(64243),F=n(84677),C=n(4371),I=n(1413),j=n(47167),y=n(2120);!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(r||(r={}));var E=(0,j.Z)("div",{target:"ejtjsn29"})((function(){return{position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}}),""),P=(0,j.Z)("div",{target:"ejtjsn28"})((function(e){var t=e.theme,n=e.width;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),width:"100%",height:9*n/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),M=(0,j.Z)("p",{target:"ejtjsn27"})((function(e){return{marginTop:e.theme.spacing.sm,textAlign:"center"}}),""),T=(0,j.Z)("img",{target:"ejtjsn26"})((function(e){var t=e.theme,n=e.opacity;return{borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),objectFit:"contain",opacity:n}}),""),L=(0,j.Z)("a",{target:"ejtjsn25"})((function(e){return{color:e.theme.colors.primary,display:"block",textDecoration:"none"}}),""),k=(0,j.Z)("span",{target:"ejtjsn24"})((function(){return{display:"flex",alignItems:"center"}}),""),U=(0,j.Z)("div",{target:"ejtjsn23"})((function(e){var t=e.theme;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),Z=(0,j.Z)("div",{target:"ejtjsn21"})((function(){return{height:"fit-content",width:"100%",position:"absolute",bottom:0}}),""),D=(0,j.Z)("button",{target:"ejtjsn20"})((function(e){var t=e.theme;return(0,I.Z)({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"1px solid ".concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.md," ").concat(t.radii.md),"&: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,y.DZ)(t.colors.primary,.5))}},function(e,t){switch(e){case r.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case r.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case r.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}(r.MEDIUM,t))}),""),X=n(46417);var O,A=function(e){var t=e.disabled,n=e.onClick,r=e.children,i=e.progress;return(0,X.jsxs)(D,{disabled:t||!1,onClick:n||function(){},progress:i||null,"data-testid":"stCameraInputButton",children:[r,i&&(0,X.jsx)(Z,{children:(0,X.jsx)(C.Z,{value:i,size:C.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})},B=n(29975),N=n(69367),_=n(5207);!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));var z,G=function(e){var t=e.switchFacingMode;return(0,X.jsx)(U,{children:(0,X.jsx)(S.ZP,{content:"Switch camera",placement:S.ug.TOP_RIGHT,children:(0,X.jsx)(N.ZP,{kind:N.hY.MINIMAL,onClick:t,children:(0,X.jsx)(m.ZP,{content:B.Z,size:"twoXL",color:_.Z.white})})})})},V=n(29439),W=n(86101),H=n(83985),$=n(34862),q=n(62790),J=n.n(q),K=n(73989);!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(z||(z={}));var Q=function(e){var t=e.width;return(0,X.jsxs)(P,{width:t,children:[(0,X.jsx)(m.ZP,{size:"threeXL",color:_.Z.gray60,content:W.n}),(0,X.jsxs)(M,{children:["This app would like to use your camera.",(0,X.jsx)(L,{href:K.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},Y=function(e){var t=e.handleCapture,n=e.width,r=e.disabled,i=e.clearPhotoInProgress,o=e.setClearPhotoInProgress,s=e.facingMode,a=e.setFacingMode,l=(0,f.useState)(z.PENDING),c=(0,V.Z)(l,2),d=c[0],u=c[1],g=(0,f.useRef)(null),p=(0,f.useState)(n),h=(0,V.Z)(p,2),m=h[0],S=h[1],v=(0,f.useCallback)((function(e){return(0,b.Ds)(1e3,S(e))}),[]);(0,f.useEffect)((function(){v(n)}),[n,v]);var w=(0,H.u)();return(0,X.jsxs)(E,{width:m,children:[d===z.SUCCESS||r||i?$.tq&&(0,X.jsx)(G,{switchFacingMode:a}):(0,X.jsx)(Q,{width:m}),(0,X.jsx)(P,{hidden:d!==z.SUCCESS&&!r&&!i,width:m,children:!r&&(0,X.jsx)(J(),{audio:!1,ref:g,screenshotFormat:"image/jpeg",screenshotQuality:1,width:m,height:9*m/16,style:{borderRadius:"".concat(w.radii.md," ").concat(w.radii.md," 0 0")},onUserMediaError:function(){u(z.ERROR)},onUserMedia:function(){u(z.SUCCESS),o(!1)},videoConstraints:{width:{ideal:m},facingMode:s}})}),(0,X.jsx)(A,{onClick:function(){if(null!==g.current){var e=g.current.getScreenshot();t(e)}},disabled:d!==z.SUCCESS||r||i,children:"Take Photo"})]})};var ee=function(e){(0,a.Z)(n,e);var t=(0,l.Z)(n);function n(e){var r;return(0,o.Z)(this,n),(r=t.call(this,e)).localFileIdCounter=1,r.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",r.formClearHelper=new R.Kz,r.getProgress=function(){if(r.state.files.length>0&&"uploading"===r.state.files[r.state.files.length-1].status.type)return r.state.files[r.state.files.length-1].status.progress},r.setClearPhotoInProgress=function(e){r.setState({clearPhotoInProgress:e})},r.setFacingMode=function(){r.setState((function(e){return{facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER}}))},r.handleCapture=function(e){if(null===e)return Promise.resolve();r.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});var t,n;return(t=e,n="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((function(e){return e.arrayBuffer()})).then((function(e){return new File([e],n,{type:"image/jpeg"})}))).then((function(e){return r.uploadFile(e)})).then((function(){return e=150,new Promise((function(t){return setTimeout(t,e)}));var e})).then((function(){r.setState((function(t,n){return{imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0}}))})).catch((function(e){(0,x.H)(e)}))},r.removeCapture=function(){0!==r.state.files.length&&(r.state.files.forEach((function(e){return r.deleteFile(e.id)})),r.setState({imgSrc:null,clearPhotoInProgress:!0}))},r.componentDidUpdate=function(e){var t=r.props,n=t.element,i=t.widgetMgr;if(e.disabled!==r.props.disabled&&r.props.disabled)return r.reset(),void i.setFileUploaderStateValue(n,new h.xO,{fromUi:!1});if("ready"===r.status){var o=r.createWidgetValue();if(void 0!==o){var s=i.getFileUploaderStateValue(n);p().isEqual(o,s)||i.setFileUploaderStateValue(n,o,{fromUi:!0})}}},r.onFormCleared=function(){r.setState({files:[]},(function(){var e=r.createWidgetValue();null!=e&&(r.setState({imgSrc:null}),r.props.widgetMgr.setFileUploaderStateValue(r.props.element,e,{fromUi:!0}))}))},r.deleteFile=function(e){var t=r.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),r.removeFile(e))},r.addFile=function(e){r.setState((function(t){return{files:[].concat((0,i.Z)(t.files),[e])}}))},r.removeFile=function(e){r.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},r.getFile=function(e){return r.state.files.find((function(t){return t.id===e}))},r.updateFile=function(e,t){r.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},r.onUploadComplete=function(e,t){r.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t),shutter:!1}}));var n=r.getFile(e);null!=n&&"uploading"===n.status.type&&r.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},r.onUploadProgress=function(e,t){var n=r.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&r.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},r.reset=function(){r.setState({files:[],imgSrc:null})},r.uploadFile=function(e){var t=u().CancelToken.source(),n=new F.R(e.name,e.size,r.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});r.addFile(n),r.props.uploadClient.uploadFile(r.props.element,e,(function(e){return r.onUploadProgress(e,n.id)}),t.token).then((function(e){return r.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||r.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},r.state=r.initialValue,r}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0,imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},n=this.props,r=n.widgetMgr,i=n.element,o=r.getFileUploaderStateValue(i);if(null==o)return t;var s=o.maxFileId,a=o.uploadedFileInfo;return null==s||0===s||null==a?t:{files:a.map((function(t){var n=t.name,r=t.size,i=t.id;return new F.R(n,r,e.nextLocalFileId(),{type:"uploaded",serverFileId:i})})),newestServerFileId:Number(s),imgSrc:0===a.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,r=e.status;return new h.jM({id:r.serverFileId,name:t,size:n})}));return new h.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.widgetMgr,i=t.disabled,o=t.width;return this.formClearHelper.manageFormClearListener(r,n.formId,this.onFormCleared),(0,X.jsxs)(E,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,X.jsx)(w.ON,{label:n.label,disabled:i,labelVisibility:(0,b.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,X.jsx)(w.dT,{children:(0,X.jsx)(v.ZP,{content:n.help,placement:S.ug.TOP_RIGHT})})}),this.state.imgSrc?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,X.jsx)(T,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,X.jsx)(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,X.jsxs)(k,{children:[(0,X.jsx)(m.ZP,{content:c.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,X.jsx)(Y,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(f.PureComponent)},84677:function(e,t,n){n.d(t,{R:function(){return o}});var r=n(15671),i=n(43144),o=function(){function e(t,n,i,o){(0,r.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=i,this.status=o}return(0,i.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()}}]);
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[681],{4371:function(e,t,n){n.d(t,{$:function(){return r},Z:function(){return u}});var r,i=n(47313),o=n(83985),s=n(54922),a=n(81512),l=n(75314),c=n(74969),d=n(46417);!function(e){e.EXTRASMALL="xs",e.SMALL="sm",e.MEDIUM="md",e.LARGE="lg",e.EXTRALARGE="xl"}(r||(r={}));var u=function(e){var t=e.value,n=e.width,u=e.size,g=void 0===u?r.SMALL:u,p=e.overrides,f=(0,o.u)(),h={xs:f.spacing.twoXS,sm:f.spacing.sm,md:f.spacing.lg,lg:f.spacing.xl,xl:f.spacing.twoXL},m=i.useContext(s.I).activeTheme,S=!(0,a.MJ)(m),v={BarContainer:{style:{marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none}},Bar:{style:function(e){var t=e.$theme;return{width:n?n.toString():void 0,marginTop:f.spacing.none,marginBottom:f.spacing.none,marginRight:f.spacing.none,marginLeft:f.spacing.none,height:h[g],backgroundColor:t.colors.progressbarTrackFill,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}},BarProgress:{style:function(){return{backgroundColor:S?f.colors.primary:f.colors.blue70,borderTopLeftRadius:f.spacing.twoXS,borderTopRightRadius:f.spacing.twoXS,borderBottomLeftRadius:f.spacing.twoXS,borderBottomRightRadius:f.spacing.twoXS}}}};return(0,d.jsx)(l.Z,{value:t,overrides:(0,c.aO)(v,p)})}},44681:function(e,t,n){n.r(t),n.d(t,{default:function(){return ee}});var r,i=n(93433),o=n(15671),s=n(43144),a=n(60136),l=n(29388),c=n(92653),d=n(31881),u=n.n(d),g=n(16031),p=n.n(g),f=n(47313),h=n(7976),m=n(49089),S=n(10612),v=n(73290),w=n(65167),R=n(46332),x=n(72599),b=n(64243),F=n(84677),C=n(4371),I=n(1413),j=n(47167),y=n(2120);!function(e){e.XSMALL="xsmall",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large"}(r||(r={}));var E=(0,j.Z)("div",{target:"ejtjsn29"})((function(){return{position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}}),""),P=(0,j.Z)("div",{target:"ejtjsn28"})((function(e){var t=e.theme,n=e.width;return{backgroundColor:t.colors.secondaryBg,borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),width:"100%",height:9*n/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}}),""),M=(0,j.Z)("p",{target:"ejtjsn27"})((function(e){return{marginTop:e.theme.spacing.sm,textAlign:"center"}}),""),T=(0,j.Z)("img",{target:"ejtjsn26"})((function(e){var t=e.theme,n=e.opacity;return{borderRadius:"".concat(t.radii.md," ").concat(t.radii.md," 0 0"),objectFit:"contain",opacity:n}}),""),L=(0,j.Z)("a",{target:"ejtjsn25"})((function(e){return{color:e.theme.colors.primary,display:"block",textDecoration:"none"}}),""),k=(0,j.Z)("span",{target:"ejtjsn24"})((function(){return{display:"flex",alignItems:"center"}}),""),U=(0,j.Z)("div",{target:"ejtjsn23"})((function(e){var t=e.theme;return{position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:1,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6}}),""),Z=(0,j.Z)("div",{target:"ejtjsn21"})((function(){return{height:"fit-content",width:"100%",position:"absolute",bottom:0}}),""),D=(0,j.Z)("button",{target:"ejtjsn20"})((function(e){var t=e.theme;return(0,I.Z)({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:"1px solid ".concat(t.colors.fadedText10),borderRadius:"0 0 ".concat(t.radii.md," ").concat(t.radii.md),"&: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,y.DZ)(t.colors.primary,.5))}},function(e,t){switch(e){case r.XSMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.sm),fontSize:t.fontSizes.sm};case r.SMALL:return{padding:"".concat(t.spacing.twoXS," ").concat(t.spacing.md)};case r.LARGE:return{padding:"".concat(t.spacing.md," ").concat(t.spacing.md)};default:return{padding:"".concat(t.spacing.xs," ").concat(t.spacing.md)}}}(r.MEDIUM,t))}),""),X=n(46417);var O,A=function(e){var t=e.disabled,n=e.onClick,r=e.children,i=e.progress;return(0,X.jsxs)(D,{disabled:t||!1,onClick:n||function(){},progress:i||null,"data-testid":"stCameraInputButton",children:[r,i&&(0,X.jsx)(Z,{children:(0,X.jsx)(C.Z,{value:i,size:C.$.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarProgress:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}},BarContainer:{style:{borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}}}})})]})},B=n(29975),N=n(69367),_=n(5207);!function(e){e.USER="user",e.ENVIRONMENT="environment"}(O||(O={}));var z,G=function(e){var t=e.switchFacingMode;return(0,X.jsx)(U,{children:(0,X.jsx)(S.ZP,{content:"Switch camera",placement:S.ug.TOP_RIGHT,children:(0,X.jsx)(N.ZP,{kind:N.hY.MINIMAL,onClick:t,children:(0,X.jsx)(m.ZP,{content:B.Z,size:"twoXL",color:_.Z.white})})})})},V=n(29439),W=n(86101),H=n(83985),$=n(34862),q=n(62790),J=n.n(q),K=n(73989);!function(e){e.PENDING="pending",e.SUCCESS="success",e.ERROR="error"}(z||(z={}));var Q=function(e){var t=e.width;return(0,X.jsxs)(P,{width:t,children:[(0,X.jsx)(m.ZP,{size:"threeXL",color:_.Z.gray60,content:W.n}),(0,X.jsxs)(M,{children:["This app would like to use your camera.",(0,X.jsx)(L,{href:K.U3,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]})},Y=function(e){var t=e.handleCapture,n=e.width,r=e.disabled,i=e.clearPhotoInProgress,o=e.setClearPhotoInProgress,s=e.facingMode,a=e.setFacingMode,l=(0,f.useState)(z.PENDING),c=(0,V.Z)(l,2),d=c[0],u=c[1],g=(0,f.useRef)(null),p=(0,f.useState)(n),h=(0,V.Z)(p,2),m=h[0],S=h[1],v=(0,f.useCallback)((function(e){return(0,b.Ds)(1e3,S(e))}),[]);(0,f.useEffect)((function(){v(n)}),[n,v]);var w=(0,H.u)();return(0,X.jsxs)(E,{width:m,children:[d===z.SUCCESS||r||i?$.tq&&(0,X.jsx)(G,{switchFacingMode:a}):(0,X.jsx)(Q,{width:m}),(0,X.jsx)(P,{hidden:d!==z.SUCCESS&&!r&&!i,width:m,children:!r&&(0,X.jsx)(J(),{audio:!1,ref:g,screenshotFormat:"image/jpeg",screenshotQuality:1,width:m,height:9*m/16,style:{borderRadius:"".concat(w.radii.md," ").concat(w.radii.md," 0 0")},onUserMediaError:function(){u(z.ERROR)},onUserMedia:function(){u(z.SUCCESS),o(!1)},videoConstraints:{width:{ideal:m},facingMode:s}})}),(0,X.jsx)(A,{onClick:function(){if(null!==g.current){var e=g.current.getScreenshot();t(e)}},disabled:d!==z.SUCCESS||r||i,children:"Take Photo"})]})};var ee=function(e){(0,a.Z)(n,e);var t=(0,l.Z)(n);function n(e){var r;return(0,o.Z)(this,n),(r=t.call(this,e)).localFileIdCounter=1,r.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",r.formClearHelper=new R.Kz,r.getProgress=function(){if(r.state.files.length>0&&"uploading"===r.state.files[r.state.files.length-1].status.type)return r.state.files[r.state.files.length-1].status.progress},r.setClearPhotoInProgress=function(e){r.setState({clearPhotoInProgress:e})},r.setFacingMode=function(){r.setState((function(e){return{facingMode:e.facingMode===O.USER?O.ENVIRONMENT:O.USER}}))},r.handleCapture=function(e){if(null===e)return Promise.resolve();r.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});var t,n;return(t=e,n="camera-input-".concat((new Date).toISOString().replace(/:/g,"_"),".jpg"),fetch(t).then((function(e){return e.arrayBuffer()})).then((function(e){return new File([e],n,{type:"image/jpeg"})}))).then((function(e){return r.uploadFile(e)})).then((function(){return e=150,new Promise((function(t){return setTimeout(t,e)}));var e})).then((function(){r.setState((function(t,n){return{imgSrc:e,shutter:t.shutter,minShutterEffectPassed:!0}}))})).catch((function(e){(0,x.H)(e)}))},r.removeCapture=function(){0!==r.state.files.length&&(r.state.files.forEach((function(e){return r.deleteFile(e.id)})),r.setState({imgSrc:null,clearPhotoInProgress:!0}))},r.componentDidUpdate=function(e){var t=r.props,n=t.element,i=t.widgetMgr;if(e.disabled!==r.props.disabled&&r.props.disabled)return r.reset(),void i.setFileUploaderStateValue(n,new h.xO,{fromUi:!1});if("ready"===r.status){var o=r.createWidgetValue();if(void 0!==o){var s=i.getFileUploaderStateValue(n);p().isEqual(o,s)||i.setFileUploaderStateValue(n,o,{fromUi:!0})}}},r.onFormCleared=function(){r.setState({files:[]},(function(){var e=r.createWidgetValue();null!=e&&(r.setState({imgSrc:null}),r.props.widgetMgr.setFileUploaderStateValue(r.props.element,e,{fromUi:!0}))}))},r.deleteFile=function(e){var t=r.getFile(e);null!=t&&("uploading"===t.status.type&&t.status.cancelToken.cancel(),r.removeFile(e))},r.addFile=function(e){r.setState((function(t){return{files:[].concat((0,i.Z)(t.files),[e])}}))},r.removeFile=function(e){r.setState((function(t){return{files:t.files.filter((function(t){return t.id!==e}))}}))},r.getFile=function(e){return r.state.files.find((function(t){return t.id===e}))},r.updateFile=function(e,t){r.setState((function(n){return{files:n.files.map((function(n){return n.id===e?t:n}))}}))},r.onUploadComplete=function(e,t){r.setState((function(e){return{newestServerFileId:Math.max(e.newestServerFileId,t),shutter:!1}}));var n=r.getFile(e);null!=n&&"uploading"===n.status.type&&r.updateFile(n.id,n.setStatus({type:"uploaded",serverFileId:t}))},r.onUploadProgress=function(e,t){var n=r.getFile(t);if(null!=n&&"uploading"===n.status.type){var i=Math.round(100*e.loaded/e.total);n.status.progress!==i&&r.updateFile(t,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:i}))}},r.reset=function(){r.setState({files:[],imgSrc:null})},r.uploadFile=function(e){var t=u().CancelToken.source(),n=new F.R(e.name,e.size,r.nextLocalFileId(),{type:"uploading",cancelToken:t,progress:1});r.addFile(n),r.props.uploadClient.uploadFile(r.props.element,e,(function(e){return r.onUploadProgress(e,n.id)}),t.token).then((function(e){return r.onUploadComplete(n.id,e)})).catch((function(e){u().isCancel(e)||r.updateFile(n.id,n.setStatus({type:"error",errorMessage:e?e.toString():"Unknown error"}))}))},r.state=r.initialValue,r}return(0,s.Z)(n,[{key:"initialValue",get:function(){var e=this,t={files:[],newestServerFileId:0,imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:O.USER},n=this.props,r=n.widgetMgr,i=n.element,o=r.getFileUploaderStateValue(i);if(null==o)return t;var s=o.maxFileId,a=o.uploadedFileInfo;return null==s||0===s||null==a?t:{files:a.map((function(t){var n=t.name,r=t.size,i=t.id;return new F.R(n,r,e.nextLocalFileId(),{type:"uploaded",serverFileId:i})})),newestServerFileId:Number(s),imgSrc:0===a.length?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:O.USER}}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"status",get:function(){return this.state.files.some((function(e){return"uploading"===e.status.type}))?"updating":"ready"}},{key:"createWidgetValue",value:function(){if(0!==this.state.newestServerFileId){var e=this.state.files.filter((function(e){return"uploaded"===e.status.type})).map((function(e){var t=e.name,n=e.size,r=e.status;return new h.jM({id:r.serverFileId,name:t,size:n})}));return new h.xO({maxFileId:this.state.newestServerFileId,uploadedFileInfo:e})}}},{key:"render",value:function(){var e,t=this.props,n=t.element,r=t.widgetMgr,i=t.disabled,o=t.width;return this.formClearHelper.manageFormClearListener(r,n.formId,this.onFormCleared),(0,X.jsxs)(E,{width:o,className:"row-widget","data-testid":"stCameraInput",children:[(0,X.jsx)(w.ON,{label:n.label,disabled:i,labelVisibility:(0,b.iF)(null===(e=n.labelVisibility)||void 0===e?void 0:e.value),children:n.help&&(0,X.jsx)(w.dT,{children:(0,X.jsx)(v.ZP,{content:n.help,placement:S.ug.TOP_RIGHT})})}),this.state.imgSrc?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&(0,X.jsx)(T,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:9*o/16})}),(0,X.jsx)(A,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||i,children:this.getProgress()?"Uploading...":(0,X.jsxs)(k,{children:[(0,X.jsx)(m.ZP,{content:c.X,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):(0,X.jsx)(Y,{handleCapture:this.handleCapture,width:o,disabled:i,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode})]})}},{key:"nextLocalFileId",value:function(){return this.localFileIdCounter++}}]),n}(f.PureComponent)},84677:function(e,t,n){n.d(t,{R:function(){return o}});var r=n(15671),i=n(43144),o=function(){function e(t,n,i,o){(0,r.Z)(this,e),this.name=void 0,this.size=void 0,this.status=void 0,this.id=void 0,this.name=t,this.size=n,this.id=i,this.status=o}return(0,i.Z)(e,[{key:"setStatus",value:function(t){return new e(this.name,this.size,this.id,t)}}]),e}()}}]);
|