streamlit-nightly 1.52.3.dev20260109__py3-none-any.whl → 1.52.3.dev20260111__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/static/index.html +1 -1
- streamlit/static/manifest.json +296 -296
- streamlit/static/static/js/{ErrorOutline.esm.BcqUpfNe.js → ErrorOutline.esm.D0HiUB0L.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.CtJWBuub.js → FileDownload.esm.BuUS-pfi.js} +1 -1
- streamlit/static/static/js/{FileHelper.D0dQPhOs.js → FileHelper.Pf8URFng.js} +5 -5
- streamlit/static/static/js/{FormClearHelper.Cm3GDSk6.js → FormClearHelper.By4vKj6A.js} +1 -1
- streamlit/static/static/js/{InputInstructions.D7Hxdzwv.js → InputInstructions.BiaGyIXk.js} +1 -1
- streamlit/static/static/js/{Particles.vAUDtAR8.js → Particles.2-EdjYhR.js} +1 -1
- streamlit/static/static/js/{ProgressBar.Dp2CGRba.js → ProgressBar.Dgbh0B0d.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.DC0000nJ.js → StreamlitSyntaxHighlighter.DSl8Wr3R.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.DDVoSKOT.js → TableChart.esm.MOwyTUPh.js} +1 -1
- streamlit/static/static/js/{Toolbar.CuMH-Gqe.js → Toolbar.CowuXIFr.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.WAReecol.js → WidgetLabelHelpIconInline.BdGIJQe4.js} +1 -1
- streamlit/static/static/js/{base-input.BX9Jll5o.js → base-input.CHPo5oJ1.js} +1 -1
- streamlit/static/static/js/{checkbox.BzMHUSz1.js → checkbox.Dkt2TQVS.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.CviG5BQx.js → createDownloadLinkElement.BaE-_v8I.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.Dzo9A4l6.js → data-grid-overlay-editor.C1ncL-Nr.js} +1 -1
- streamlit/static/static/js/{downloader.DIDvj0d5.js → downloader.yaq2AzD9.js} +1 -1
- streamlit/static/static/js/{embed.C8qeQ38b.js → embed.DJJvCVz2.js} +1 -1
- streamlit/static/static/js/{es6.Dpcc-U7U.js → es6.D2jK98VU.js} +2 -2
- streamlit/static/static/js/{formatNumber.CPvuaBa8.js → formatNumber.Cxr2q_Sk.js} +1 -1
- streamlit/static/static/js/{iconPosition.y0q-Rqem.js → iconPosition.5dHEZYw2.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.DblExdXF.js → iframeResizer.contentWindow.Cedt4qbc.js} +1 -1
- streamlit/static/static/js/{index.BZBWLU1C.js → index.01VsD2h1.js} +4 -4
- streamlit/static/static/js/{index.BDb0PRvK.js → index.1djeb6e0.js} +1 -1
- streamlit/static/static/js/{index.BXYgO5B8.js → index.6_D2Y2jA.js} +1 -1
- streamlit/static/static/js/{index.gr6yGiCL.js → index.B0GsKOuI.js} +1 -1
- streamlit/static/static/js/{index.BVN9cI-k.js → index.B2TDaHdI.js} +1 -1
- streamlit/static/static/js/{index.DaU1ayM7.js → index.B4x2O71H.js} +1 -1
- streamlit/static/static/js/{index.DppScppA.js → index.B6EliwN_.js} +1 -1
- streamlit/static/static/js/{index.DB4MbQ40.js → index.B6Uhb_NP.js} +1 -1
- streamlit/static/static/js/{index.BfZdZpv-.js → index.B7EzT2pL.js} +1 -1
- streamlit/static/static/js/{index.DTK-btqV.js → index.B9DrCSR6.js} +1 -1
- streamlit/static/static/js/{index.kKkHk9Mc.js → index.BCCeRfnu.js} +1 -1
- streamlit/static/static/js/{index.pMvzHC7z.js → index.BFopzcDu.js} +1 -1
- streamlit/static/static/js/{index.D42y-GeO.js → index.BHMoYAbd.js} +1 -1
- streamlit/static/static/js/{index.B6vCS66f.js → index.BMPclSge.js} +5 -5
- streamlit/static/static/js/{index.CCDejIvL.js → index.BVit6ClT.js} +1 -1
- streamlit/static/static/js/{index.BItU4jMo.js → index.BXCQzqUL.js} +1 -1
- streamlit/static/static/js/{index.u2AvcQQT.js → index.Ba6hzYdl.js} +1 -1
- streamlit/static/static/js/{index.DmQqT9OM.js → index.Bb9kjc_v.js} +1 -1
- streamlit/static/static/js/{index.VSsf6tsu.js → index.BgVtKHgk.js} +1 -1
- streamlit/static/static/js/{index.DZEQ0G7H.js → index.BkDplL5I.js} +1 -1
- streamlit/static/static/js/{index.BWOP7HFT.js → index.C8PH2B2k.js} +1 -1
- streamlit/static/static/js/{index.RRAKXgBZ.js → index.CAobVzMK.js} +1 -1
- streamlit/static/static/js/{index.BPMqWDef.js → index.CD8IIWcc.js} +1 -1
- streamlit/static/static/js/{index.C1ElSZEy.js → index.CIlqaESj.js} +1 -1
- streamlit/static/static/js/{index.BTHi5W25.js → index.CT9jvPcD.js} +1 -1
- streamlit/static/static/js/{index.D69ULFWq.js → index.CcHnYd9w.js} +1 -1
- streamlit/static/static/js/{index.C7lwRBvF.js → index.CcJEaOpw.js} +1 -1
- streamlit/static/static/js/{index.B-g6lwYa.js → index.CjQo7CUO.js} +1 -1
- streamlit/static/static/js/{index.DRFJgBf-.js → index.D2EVLt1U.js} +1 -1
- streamlit/static/static/js/{index.F-NmmwfK.js → index.D2v1x0i_.js} +1 -1
- streamlit/static/static/js/{index.DvQ7-afx.js → index.D6ea3OJl.js} +1 -1
- streamlit/static/static/js/{index.eweE9HKU.js → index.DKUtJ1wC.js} +1 -1
- streamlit/static/static/js/{index.w2_VrtVw.js → index.DLB_Wwth.js} +1 -1
- streamlit/static/static/js/{index.aEeM0ekc.js → index.DaITTdfQ.js} +1 -1
- streamlit/static/static/js/{index.Dr8b3Vn6.js → index.DbTMA1_Q.js} +1 -1
- streamlit/static/static/js/{index.Dla9XiNe.js → index.DcKOiCiE.js} +1 -1
- streamlit/static/static/js/{index.C26ZOVFL.js → index.DeGjj5Xy.js} +1 -1
- streamlit/static/static/js/{index.B10MmI2m.js → index.Dewn3Ni9.js} +1 -1
- streamlit/static/static/js/{index.wv1DYVsn.js → index.DozBVd6-.js} +1 -1
- streamlit/static/static/js/{index.x4j6nnNb.js → index.DredtYc0.js} +1 -1
- streamlit/static/static/js/{index.CcMmNHAq.js → index.Dt0Psatx.js} +1 -1
- streamlit/static/static/js/{index.B9TG5Ah8.js → index.DtGneC7j.js} +1 -1
- streamlit/static/static/js/{index.pgifwCIr.js → index.P-CMMGUY.js} +1 -1
- streamlit/static/static/js/{index.BGufEmCz.js → index.TO9vodwr.js} +1 -1
- streamlit/static/static/js/{index.Bxe7fKbw.js → index._nL4Yjdr.js} +1 -1
- streamlit/static/static/js/index.i_eQw7NS.js +1 -0
- streamlit/static/static/js/{index.C93QGPyk.js → index.qzz9PjCO.js} +1 -1
- streamlit/static/static/js/{index.MKI8t7l2.js → index.wLJVkoPD.js} +1 -1
- streamlit/static/static/js/{input.BoJqOS7a.js → input.27t-DftI.js} +1 -1
- streamlit/static/static/js/{main.B5XmUwmQ.js → main.BEfv2Y8-.js} +1 -1
- streamlit/static/static/js/{memory.9izgq54V.js → memory.CaZBVQ_1.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.PqOGQcLn.js → number-overlay-editor.CAIp-3oo.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.DUtF2t3R.js → pandasStylerUtils.BY9qaz81.js} +1 -1
- streamlit/static/static/js/{sandbox.DgKTHPLO.js → sandbox.BJUaaWFJ.js} +1 -1
- streamlit/static/static/js/{styled-components.D4x8jmOI.js → styled-components.DQsMkvXn.js} +1 -1
- streamlit/static/static/js/{throttle.DxEHIIp7.js → throttle.DSR3q89S.js} +1 -1
- streamlit/static/static/js/{timepicker.CDks5DWI.js → timepicker.gie5YwtP.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.CvTQRsV-.js → toConsumableArray.C9lVwnAo.js} +1 -1
- streamlit/static/static/js/uniqueId.BdEQNrWF.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.D6_b0IqA.js → useBasicWidgetState.DrTKs46R.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.Ctz17A7g.js → useIntlLocale.CmSionuT.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.PAFB5o1T.js → useTextInputAutoExpand.D7lViJSu.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.CcTvmGlb.js → useUpdateUiValue.Ct3CJQBQ.js} +1 -1
- streamlit/static/static/js/{useWaveformController.vLi36Ir4.js → useWaveformController.D-KQLpLI.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.BtA2jL5-.js → withCalculatedWidth.CD0pPoZr.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.CeeoYBpc.js → withFullScreenWrapper.Ch22PgdD.js} +1 -1
- {streamlit_nightly-1.52.3.dev20260109.dist-info → streamlit_nightly-1.52.3.dev20260111.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.52.3.dev20260109.dist-info → streamlit_nightly-1.52.3.dev20260111.dist-info}/RECORD +95 -95
- streamlit/static/static/js/index.q83b8_8b.js +0 -1
- streamlit/static/static/js/uniqueId.RScLN3St.js +0 -1
- {streamlit_nightly-1.52.3.dev20260109.data → streamlit_nightly-1.52.3.dev20260111.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.52.3.dev20260109.dist-info → streamlit_nightly-1.52.3.dev20260111.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.52.3.dev20260109.dist-info → streamlit_nightly-1.52.3.dev20260111.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.52.3.dev20260109.dist-info → streamlit_nightly-1.52.3.dev20260111.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ao as O,ap as ye,x as $,r as u,l as $e,o as ne,j as M,P as Re,ad as Oe,q as oe,ab as ie,bs as ae,p as _e}from"./index.
|
|
1
|
+
import{ao as O,ap as ye,x as $,r as u,l as $e,o as ne,j as M,P as Re,ad as Oe,q as oe,ab as ie,bs as ae,p as _e}from"./index.01VsD2h1.js";import{W as Se}from"./WidgetLabelHelpIconInline.BdGIJQe4.js";import{u as Pe}from"./useBasicWidgetState.DrTKs46R.js";import"./FormClearHelper.By4vKj6A.js";var se={vertical:"vertical",horizontal:"horizontal"};function le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?le(Object(n),!0).forEach(function(r){R(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):le(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=0,L=1,T=2;function z(e){return e.$isActive?T:e.$isHovered?L:E}function we(e){var t=e.$theme.colors,n=e.$disabled,r=e.$checked,o=e.$isFocusVisible,i=e.$error;if(n)return t.tickFillDisabled;if(r)if(i)switch(z(e)){case E:return t.tickFillErrorSelected;case L:return t.tickFillErrorSelectedHover;case T:return t.tickFillErrorSelectedHoverActive}else switch(z(e)){case E:return t.tickFillSelected;case L:return t.tickFillSelectedHover;case T:return t.tickFillSelectedHoverActive}else return o?t.borderSelected:i?t.tickBorderError:t.tickBorder;return null}function Me(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(z(e)){case E:return t.tickFillError;case L:return t.tickFillErrorHover;case T:return t.tickFillErrorHoverActive}else switch(z(e)){case E:return t.tickFill;case L:return t.tickFillHover;case T:return t.tickFillActive}}function ke(e){var t=e.$labelPlacement,n=t===void 0?"":t,r=e.$theme,o;switch(n){case"top":o="Bottom";break;case"bottom":o="Top";break;case"left":o=r.direction==="rtl"?"Left":"Right";break;default:case"right":o=r.direction==="rtl"?"Right":"Left";break}var i=r.sizing,a=i.scale300;return R({},"padding".concat(o),a)}function Fe(e){var t=e.$disabled,n=e.$theme,r=n.colors;return t?r.contentSecondary:r.contentPrimary}var q=O("div",function(e){var t=e.$disabled,n=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:n==="horizontal"?"row":"column",alignItems:n==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});q.displayName="RadioGroupRoot";q.displayName="RadioGroupRoot";var X=O("label",function(e){var t,n=e.$disabled,r=e.$hasDescription,o=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,c=a==="horizontal",p=i.direction==="rtl"?"Left":"Right";return t={flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:n?"not-allowed":"pointer",marginTop:s.scale200},R(t,"margin".concat(p),c?s.scale200:null),R(t,"marginBottom",r&&!c?null:s.scale200),t});X.displayName="Root";X.displayName="Root";var K=O("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{backgroundColor:Me(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});K.displayName="RadioMarkInner";K.displayName="RadioMarkInner";var J=O("div",function(e){var t=e.$theme,n=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:we(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:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:n.timing200,transitionTimingFunction:n.easeOutCurve}});J.displayName="RadioMarkOuter";J.displayName="RadioMarkOuter";var Q=O("div",function(e){var t=e.$theme.typography;return D(D({verticalAlign:"middle"},ke(e)),{},{color:Fe(e)},t.LabelMedium)});Q.displayName="Label";Q.displayName="Label";var Y=O("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"});Y.displayName="Input";Y.displayName="Input";var Z=O("div",function(e){var t,n=e.$theme,r=e.$align,o=r==="horizontal",i=n.direction==="rtl"?"Right":"Left",a=n.direction==="rtl"?"Left":"Right";return D(D({},n.typography.ParagraphSmall),{},(t={color:n.colors.contentSecondary,cursor:"auto"},R(t,"margin".concat(i),r==="horizontal"?null:n.sizing.scale900),R(t,"margin".concat(a),o?n.sizing.scale200:null),R(t,"maxWidth","240px"),t))});Z.displayName="Description";Z.displayName="Description";function N(e){"@babel/helpers - typeof";return N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(e)}function V(){return V=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},V.apply(this,arguments)}function Ie(e,t){return xe(e)||Te(e,t)||Le(e,t)||Ee()}function Ee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Le(e,t){if(e){if(typeof e=="string")return ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ue(e,t)}}function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Te(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,s;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,s=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw s}}return r}}function xe(e){if(Array.isArray(e))return e}function Ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function je(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 De(e,t,n){return t&&je(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ze(e,t){if(typeof t!="function"&&t!==null)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&&U(e,t)}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},U(e,t)}function Be(e){var t=He();return function(){var r=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Ce(this,o)}}function Ce(e,t){if(t&&(N(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A(e)}function A(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function He(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},B(e)}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pe=(function(e){ze(n,e);var t=Be(n);function n(){var r;Ae(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i)),j(A(r),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),j(A(r),"handleFocus",function(s,c){ye(s)&&r.setState({isFocusVisible:!0}),r.setState({focusedRadioIndex:c}),r.props.onFocus&&r.props.onFocus(s)}),j(A(r),"handleBlur",function(s,c){r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1}),r.setState({focusedRadioIndex:-1}),r.props.onBlur&&r.props.onBlur(s)}),r}return De(n,[{key:"render",value:function(){var o=this,i=this.props.overrides,a=i===void 0?{}:i,s=$(a.RadioGroupRoot,q),c=Ie(s,2),p=c[0],g=c[1];return u.createElement(p,V({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},g),u.Children.map(this.props.children,function(f,l){if(!u.isValidElement(f))return null;var d=o.props.value===f.props.value;return u.cloneElement(f,{align:o.props.align,autoFocus:o.props.autoFocus,checked:d,disabled:o.props.disabled||f.props.disabled,error:o.props.error,isFocused:o.state.focusedRadioIndex===l,isFocusVisible:o.state.isFocusVisible,tabIndex:l===0&&!o.props.value||d?"0":"-1",labelPlacement:o.props.labelPlacement,name:o.props.name,onBlur:function(b){return o.handleBlur(b,l)},onFocus:function(b){return o.handleFocus(b,l)},onChange:o.props.onChange,onMouseEnter:o.props.onMouseEnter,onMouseLeave:o.props.onMouseLeave})}))}}]),n})(u.Component);j(pe,"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:{}});function G(e){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(e)}function y(){return y=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},y.apply(this,arguments)}function w(e,t){return Ge(e)||Ue(e,t)||Ve(e,t)||Ne()}function Ne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ve(e,t){if(e){if(typeof e=="string")return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}}function ce(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ue(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,s;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,s=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw s}}return r}}function Ge(e){if(Array.isArray(e))return e}function We(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qe(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 Xe(e,t,n){return t&&qe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ke(e,t){if(typeof t!="function"&&t!==null)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&&W(e,t)}function W(e,t){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},W(e,t)}function Je(e){var t=Ye();return function(){var r=C(e),o;if(t){var i=C(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Qe(this,o)}}function Qe(e,t){if(t&&(G(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}function k(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ye(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},C(e)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ze(e){return e==="top"||e==="left"}function et(e){return e==="bottom"||e==="right"}var tt=function(t){return t.stopPropagation()},fe=(function(e){Ke(n,e);var t=Je(n);function n(){var r;We(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i)),F(k(r),"state",{isActive:!1,isHovered:!1}),F(k(r),"onMouseEnter",function(s){r.setState({isHovered:!0}),r.props.onMouseEnter&&r.props.onMouseEnter(s)}),F(k(r),"onMouseLeave",function(s){r.setState({isHovered:!1}),r.props.onMouseLeave&&r.props.onMouseLeave(s)}),F(k(r),"onMouseDown",function(s){r.setState({isActive:!0}),r.props.onMouseDown&&r.props.onMouseDown(s)}),F(k(r),"onMouseUp",function(s){r.setState({isActive:!1}),r.props.onMouseUp&&r.props.onMouseUp(s)}),r}return Xe(n,[{key:"componentDidMount",value:function(){var o;this.props.autoFocus&&(o=this.props.inputRef)!==null&&o!==void 0&&o.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,a=$(i.Root,X),s=w(a,2),c=s[0],p=s[1],g=$(i.Label,Q),f=w(g,2),l=f[0],d=f[1],_=$(i.Input,Y),b=w(_,2),S=b[0],H=b[1],x=$(i.Description,Z),I=w(x,2),m=I[0],h=I[1],v=$(i.RadioMarkInner,K),ee=w(v,2),de=ee[0],he=ee[1],ge=$(i.RadioMarkOuter,J),te=w(ge,2),be=te[0],me=te[1],P={$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},re=u.createElement(l,y({},P,d),this.props.containsInteractiveElement?u.createElement("div",{onClick:function(ve){return ve.preventDefault()}},this.props.children):this.props.children);return u.createElement(u.Fragment,null,u.createElement(c,y({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},P,p),Ze(this.props.labelPlacement)&&re,u.createElement(be,y({},P,me),u.createElement(de,y({},P,he))),u.createElement(S,y({"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:tt,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},P,H)),et(this.props.labelPlacement)&&re),!!this.props.description&&u.createElement(m,y({},P,h),this.props.description))}}]),n})(u.Component);F(fe,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:u.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function rt(e){const t=parseFloat(e.sizes.checkbox),n=parseFloat(e.spacing.threeXS),r=ie(t.toString()),o=Math.round(r*.375);let i=Math.round(ie((t-n).toString()));return i>=r&&(i-=1),[ae(o,"px"),ae(i,"px")]}function nt({disabled:e,horizontal:t,value:n,onChange:r,options:o,captions:i,label:a,labelVisibility:s,help:c}){const[p,g]=u.useState(n??null);u.useEffect(()=>{n!==p&&g(n??null)},[n]);const f=u.useCallback(m=>{const h=parseInt(m.target.value,10);g(h),r(h)},[r]),l=$e(),d=i.length>0,_=o.length>0,b=_?o:["No options to select."],S=e||!_,H=m=>m==""&&t&&d?" ":m,[x,I]=rt(l);return ne("div",{className:"stRadio","data-testid":"stRadio",children:[M(Oe,{label:a,disabled:S,labelVisibility:s,children:c&&M(Se,{content:c,placement:Re.TOP_RIGHT,label:a})}),M(pe,{onChange:f,value:p!==null?p.toString():void 0,disabled:S,align:t?se.horizontal:se.vertical,"aria-label":a,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:d?l.spacing.sm:l.spacing.none,minHeight:l.sizes.minElementHeight}}},children:b.map((m,h)=>ne(fe,{value:h.toString(),overrides:{Root:{style:({$isFocusVisible:v})=>({marginBottom:l.spacing.none,marginTop:l.spacing.none,marginRight:d?l.spacing.sm:l.spacing.lg,paddingLeft:l.spacing.none,alignItems:"start",paddingRight:l.spacing.threeXS,backgroundColor:v?l.colors.darkenedBgMix25:""})},RadioMarkOuter:{style:({$checked:v})=>({width:l.sizes.checkbox,height:l.sizes.checkbox,marginTop:"0.35rem",marginRight:l.spacing.none,marginLeft:l.spacing.none,backgroundColor:v&&!S?l.colors.primary:l.colors.borderColor})},RadioMarkInner:{style:({$checked:v})=>({height:v?x:I,width:v?x:I})},Label:{style:{color:S?l.colors.fadedText40:l.colors.bodyText,position:"relative",top:l.spacing.px}}},children:[M(oe,{source:m,allowHTML:!1,isLabel:!0,largerLabel:!0}),d&&M(oe,{source:H(i[h]),allowHTML:!1,isCaption:!0,isLabel:!0})]},h))})]})}const ot=u.memo(nt);function it({disabled:e,element:t,widgetMgr:n,fragmentId:r}){const[o,i]=Pe({getStateFromWidgetMgr:at,getDefaultStateFromProto:st,getCurrStateFromProto:lt,updateWidgetMgrState:ut,element:t,widgetMgr:n,fragmentId:r}),a=u.useCallback(d=>{i({value:d,fromUi:!0})},[i]),{horizontal:s,options:c,captions:p,label:g,labelVisibility:f,help:l}=t;return M(ot,{label:g,onChange:a,options:c,captions:p,disabled:e,horizontal:s,labelVisibility:_e(f?.value),value:o??null,help:l})}function at(e,t){return e.getIntValue(t)}function st(e){return e.default??null}function lt(e){return e.value??null}function ut(e,t,n,r){t.setIntValue(e,n.value??null,{fromUi:n.fromUi},r)}const gt=u.memo(it);export{gt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{F as f,aj as S,r as s,l as b,aK as y,j as l,aL as x,ay as R,o as h,m as T,Z as v,aM as B,aN as E,aO as j}from"./index.
|
|
1
|
+
import{F as f,aj as S,r as s,l as b,aK as y,j as l,aL as x,ay as R,o as h,m as T,Z as v,aM as B,aN as E,aO as j}from"./index.01VsD2h1.js";import{l as k}from"./index.8HslT92O.js";import{R as J}from"./main.BEfv2Y8-.js";const w=f("div",{target:"e1l93qjt0"})(({theme:o})=>({overflowY:"auto",position:"relative",".react-json-view .copy-icon svg":{fontSize:"1em !important",marginRight:`${o.spacing.threeXS} !important`,verticalAlign:"middle !important"}})),L=f("div",{target:"e1l93qjt1"})(({theme:o})=>({display:"flex",alignItems:"center",gap:o.spacing.sm,padding:o.spacing.sm,paddingLeft:o.spacing.md,fontFamily:o.genericFonts.codeFont,fontSize:o.fontSizes.twoSm,color:o.colors.bodyText,maxWidth:"90vw",wordBreak:"break-all"})),P=f("button",{target:"e1l93qjt2"})(({theme:o})=>({display:"flex",alignItems:"center",justifyContent:"center",padding:o.spacing.threeXS,backgroundColor:"transparent",border:"none",borderRadius:o.radii.md,cursor:"pointer",color:o.colors.fadedText60,transition:"color 0.15s ease, background-color 0.15s ease","&:hover":{backgroundColor:o.colors.darkenedBgMix15,color:o.colors.bodyText},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:S(o)}})),$=f("div",{target:"e1l93qjt3"})(({top:o,left:e})=>({position:"fixed",top:o,left:e}));function I({top:o,left:e,path:t,clearTooltip:d}){const[p,n]=s.useState(!0),r=b(),{colors:i,radii:a}=r,{isCopied:c,copyToClipboard:u,label:m}=y(),g=s.useCallback(()=>{n(!1),d()},[d]),C=s.useCallback(()=>{u(t)},[u,t]);return l(B,{content:h(L,{"data-testid":"stJsonPathTooltip",children:[l("code",{children:t}),l(P,{onClick:C,title:m,"aria-label":m,autoFocus:!0,children:l(v,{size:"sm",iconValue:c?":material/check:":":material/content_copy:"})})]}),placement:R.top,accessibilityType:x.tooltip,showArrow:!1,popoverMargin:15,onClickOutside:g,onEsc:g,overrides:{Body:{style:{borderTopLeftRadius:a.default,borderTopRightRadius:a.default,borderBottomLeftRadius:a.default,borderBottomRightRadius:a.default,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important",backgroundColor:"transparent"}},Inner:{style:{backgroundColor:T(r)?i.bgColor:i.secondaryBg,color:i.bodyText,borderTopLeftRadius:a.default,borderTopRightRadius:a.default,borderBottomLeftRadius:a.default,borderBottomRightRadius:a.default,paddingTop:"0 !important",paddingBottom:"0 !important",paddingLeft:"0 !important",paddingRight:"0 !important"}}},isOpen:p,children:l($,{"data-testid":"stJsonPathTooltipTarget",top:o,left:e})})}const F=s.memo(I);function z(o){return o.length===0?"$":o.reduce((e,t,d)=>{if(t===null)return e;if(/^\d+$/.test(t))return`${e}[${t}]`;if(t===""||/[^a-zA-Z0-9_$]/.test(t)||/^\d/.test(t)){const r=t.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return`${e}["${r}"]`}return d===0||e===""?t:`${e}.${t}`},"")}function O(){const[o,e]=s.useState(null),t=s.useRef({x:0,y:0});s.useEffect(()=>{const n=r=>{t.current={x:r.clientX,y:r.clientY}};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[]);const d=s.useCallback(n=>{const{x:r,y:i}=t.current,a=[...n.namespace,n.name],c=z(a);e({path:c,x:r,y:i})},[]),p=s.useCallback(()=>{e(null)},[]);return{tooltip:o,handleSelect:d,clearTooltip:p}}function A({element:o}){const e=b(),{tooltip:t,handleSelect:d,clearTooltip:p}=O(),{copyToClipboard:n}=y(),r=s.useCallback(c=>{n(JSON.stringify(c.src))},[n]);let i;try{i=JSON.parse(o.body)}catch(c){const u=E(c);try{i=k.parse(o.body)}catch{const g=parseInt(u.message.replace(/[^0-9]/g,""),10);return u.message+=`
|
|
2
2
|
${o.body.substring(0,g+1)} ← here`,l(j,{name:"Json Parse Error",message:u.message})}}const a=T(e)?"rjv-default":"monokai";return h(w,{className:"stJson","data-testid":"stJson",children:[l(J,{src:i,collapsed:o.maxExpandDepth??!o.expanded,displayDataTypes:!1,displayObjectSize:!1,name:!1,theme:a,enableClipboard:r,onSelect:d,style:{fontFamily:e.genericFonts.codeFont,fontSize:e.fontSizes.codeFontSize,fontWeight:e.fontWeights.code,backgroundColor:e.colors.bgColor,whiteSpace:"pre-wrap"}}),t&&l(F,{top:t.y,left:t.x,path:t.path,clearTooltip:p})]})}const D=s.memo(A);export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aT as L,aU as B,aV as E,aW as O,F as A,r as n,l as H,aB as $,aX as k,j as h,aY as F,o as N,p as D,ac as P,ad as U,aZ as Y,a_ as j,ax as _,a$ as K,af as X}from"./index.
|
|
1
|
+
import{aT as L,aU as B,aV as E,aW as O,F as A,r as n,l as H,aB as $,aX as k,j as h,aY as F,o as N,p as D,ac as P,ad as U,aZ as Y,a_ as j,ax as _,a$ as K,af as X}from"./index.01VsD2h1.js";import{u as Z}from"./useBasicWidgetState.DrTKs46R.js";import{a as q}from"./_arrayIncludes.B19Iyn2B.js";import"./FormClearHelper.By4vKj6A.js";import"./_baseIndexOf.BTknn6Gb.js";var G=200;function J(o,t,d,u){var e=-1,m=q,l=!0,p=o.length,s=[],f=t.length;if(!p)return s;t.length>=G&&(m=B,l=!1,t=new L(t));e:for(;++e<p;){var i=o[e],c=i;if(i=i!==0?i:0,l&&c===c){for(var g=f;g--;)if(t[g]===c)continue e;s.push(i)}else m(t,c,u)||s.push(i)}return s}var Q=E(function(o,t){return O(o)?J(o,t):[]});const ee=A("div",{target:"ekqzr6e0"})(({theme:o})=>({"span[aria-disabled='true']":{background:o.colors.fadedText05}})),te=(o,t)=>o.getStringArrayValue(t),oe=o=>o.default.map(t=>o.options[t])??null,re=o=>o.rawValues??null,se=(o,t,d,u)=>{t.setStringArrayValue(o,d.value,{fromUi:d.fromUi},u)},ne=o=>{const{element:t,widgetMgr:d,fragmentId:u}=o,e=H(),m=n.useContext($),l=n.useRef(null),p=n.useRef(0),[s,f]=Z({getStateFromWidgetMgr:te,getDefaultStateFromProto:oe,getCurrStateFromProto:re,updateWidgetMgrState:se,element:t,widgetMgr:d,fragmentId:u}),i=t.maxSelections>0&&s.length>=t.maxSelections,c=n.useMemo(()=>{if(t.maxSelections===0)return"No results";if(s.length===t.maxSelections){const r=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${r}. Remove an option first.`}return"No results"},[t.maxSelections,s.length]),g=n.useCallback(r=>{switch(r.type){case"remove":return Q(s,r.option?.value);case"clear":return[];case"select":return s.concat([r.option?.value]);default:throw new Error(`State transition is unknown: ${r.type}`)}},[s]),C=n.useCallback(r=>{t.maxSelections&&r.type==="select"&&s.length>=t.maxSelections||f({value:g(r),fromUi:!0})},[t.maxSelections,g,f,s.length]),{options:v}=t,{placeholder:R,disabled:w,selectOptions:z,inputReadOnly:T,valuesToUiMulti:b,createFilterOptions:x}=k({options:v,isMulti:!0,acceptNewOptions:t.acceptNewOptions??!1,placeholderInput:t.placeholder}),M=n.useCallback((r,a)=>i?[]:x(s)(r,a),[x,i,s]),S=o.disabled||w,W=n.useMemo(()=>b(s),[b,s]),V=n.useMemo(()=>{const r=e.fontSizes.baseFontSize*1.6+14;return`${Math.round(r*4.25)}px`},[e.fontSizes.baseFontSize]);n.useLayoutEffect(()=>{l.current&&(l.current.scrollTop=p.current)});const y=n.useCallback(r=>{p.current=r.currentTarget.scrollTop},[]),I=n.useMemo(()=>(function(a){return h(F,{...a,ref:l,onScroll:y})}),[y]);return N("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[h(U,{label:t.label,disabled:S,labelVisibility:D(t.labelVisibility?.value),children:t.help&&h(P,{content:t.help,label:t.label})}),h(ee,{children:h(Y,{creatable:t.acceptNewOptions??!1,options:z,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:R,type:K.select,multi:!0,onChange:C,value:W,disabled:S,size:"compact",noResultsMsg:c,filterOptions:M,closeOnSelect:!1,ignoreCase:!1,overrides:{Popover:{props:{ignoreBoundary:m,overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:_,props:{style:{cursor:"pointer"},overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:({$isFocused:r})=>{const a=X(e.colors,r);return{maxHeight:V,minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a}}},Placeholder:{style:()=>({flex:"inherit",color:S?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{component:I,style:()=>({overflowY:"auto",paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.grayTextColor,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.grayTextColor}},Tag:{props:{overrides:{Root:{style:{fontWeight:e.fontWeights.normal,borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:T}},Dropdown:{component:j}}})})]})},ue=n.memo(ne);export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,E as H,_ as D,F as _,aj as he,o as O,j as U,aA as ge,P as ve,b as me,B as Se,az as q,bQ as re,an as be,ah as ye,bi as Ce,l as Ue,bR as we,k as Me,al as Ee,e as L,W as xe,bj as Ie,p as Fe,ac as Re,ad as _e,a0 as Pe,bS as Oe,bT as ke}from"./index.BZBWLU1C.js";import{U as ie}from"./UploadFileInfo.Dr-zDST7.js";import{u as Te}from"./FormClearHelper.Cm3GDSk6.js";import{P as We,S as Le}from"./ProgressBar.Dp2CGRba.js";import{b as je}from"./urls.BwSlolu9.js";var oe=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:a}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});oe.displayName="SwitchCamera";var ne=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});ne.displayName="Video";var ae=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});ae.displayName="X";function Be(e,a){switch(e){case"xsmall":return{padding:`${a.spacing.twoXS} ${a.spacing.sm}`,fontSize:a.fontSizes.sm};case"small":return{padding:`${a.spacing.twoXS} ${a.spacing.md}`};case"large":return{padding:`${a.spacing.md} ${a.spacing.md}`};default:return{padding:`${a.spacing.xs} ${a.spacing.md}`}}}const se=_("div",{target:"e1dr6u8s0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),G=_("div",{target:"e1dr6u8s1"})(({theme:e,width:a})=>({backgroundColor:e.colors.secondaryBg,borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,width:"100%",height:a*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),Ve=_("p",{target:"e1dr6u8s2"})(({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),Ae=_("img",{target:"e1dr6u8s3"})(({theme:e,opacity:a})=>({borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,objectFit:"contain",opacity:a})),ze=_("a",{target:"e1dr6u8s4"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none",display:"block"})),$e=_("span",{target:"e1dr6u8s5"})({display:"flex",alignItems:"center"}),Ne=_("div",{target:"e1dr6u8s6"})(({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:e.zIndices.priority,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),He=_("div",{target:"e1dr6u8s8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),De=_("button",{target:"e1dr6u8s9"})(({theme:e})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:e.colors.lightenedBg05,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,borderRadius:`0 0 ${e.radii.default} ${e.radii.default}`,"&:hover":{borderColor:e.colors.primary,color:e.colors.primary},"&:active":{color:e.colors.white,borderColor:e.colors.primary,backgroundColor:e.colors.primary},"&:focus:not(:active)":{borderColor:e.colors.primary,color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:e.colors.fadedText40,borderColor:e.colors.borderColor,backgroundColor:e.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:e.fontWeights.normal,padding:`${e.spacing.xs} ${e.spacing.md}`,margin:e.spacing.none,lineHeight:e.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:he(e)},...Be("medium",e)}));function qe({disabled:e,onClick:a,children:d,progress:g}){return O(De,{disabled:e||!1,onClick:a||(()=>{}),progress:g||null,"data-testid":"stCameraInputButton",children:[d,g?U(He,{children:U(We,{value:g,size:Le.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const le=n.memo(qe);var V=(function(e){return e.USER="user",e.ENVIRONMENT="environment",e})({});const Ge=({switchFacingMode:e})=>U(Ne,{"data-testid":"stCameraInputSwitchButton",children:U(ge,{content:"Switch camera",placement:ve.TOP_RIGHT,children:U(me,{kind:Se.MINIMAL,onClick:e,children:U(q,{content:oe,size:"twoXL",color:re.white})})})}),Xe=n.memo(Ge);var A={exports:{}},Qe=A.exports,te;function Je(){return te||(te=1,(function(e,a){(function(g,v){e.exports=v(be())})(Qe,function(d){return(function(g){var v={};function p(o){if(v[o])return v[o].exports;var f=v[o]={i:o,l:!1,exports:{}};return g[o].call(f.exports,f,f.exports,p),f.l=!0,f.exports}return p.m=g,p.c=v,p.d=function(o,f,m){p.o(o,f)||Object.defineProperty(o,f,{enumerable:!0,get:m})},p.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},p.t=function(o,f){if(f&1&&(o=p(o)),f&8||f&4&&typeof o=="object"&&o&&o.__esModule)return o;var m=Object.create(null);if(p.r(m),Object.defineProperty(m,"default",{enumerable:!0,value:o}),f&2&&typeof o!="string")for(var F in o)p.d(m,F,(function(I){return o[I]}).bind(null,F));return m},p.n=function(o){var f=o&&o.__esModule?function(){return o.default}:function(){return o};return p.d(f,"a",f),f},p.o=function(o,f){return Object.prototype.hasOwnProperty.call(o,f)},p.p="",p(p.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(g,v,p){p.r(v);var o=p("react"),f=(function(){var b=function(i,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l])},b(i,t)};return function(i,t){b(i,t);function r(){this.constructor=i}i.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})(),m=function(){return m=Object.assign||function(b){for(var i,t=1,r=arguments.length;t<r;t++){i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(b[s]=i[s])}return b},m.apply(this,arguments)},F=function(b,i){var t={};for(var r in b)Object.prototype.hasOwnProperty.call(b,r)&&i.indexOf(r)<0&&(t[r]=b[r]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(b);s<r.length;s++)i.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(b,r[s])&&(t[r[s]]=b[r[s]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(i){var t=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return t?new Promise(function(r,s){t.call(navigator,i,r,s)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function I(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var R=(function(b){f(i,b);function i(t){var r=b.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return i.prototype.componentDidMount=function(){var t=this,r=t.state,s=t.props;if(this.unmounted=!1,!I()){s.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),s.children&&typeof s.children!="function"&&console.warn("children must be a function")},i.prototype.componentDidUpdate=function(t){var r=this.props;if(!I()){r.onUserMediaError("getUserMedia not supported");return}var s=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),l=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),M=t.minScreenshotWidth!==r.minScreenshotWidth,y=t.minScreenshotHeight!==r.minScreenshotHeight;(l||M||y)&&(this.canvas=null,this.ctx=null),(s||l)&&(this.stopAndCleanup(),this.requestUserMedia())},i.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},i.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},i.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(i.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},i.prototype.getScreenshot=function(t){var r=this,s=r.state,l=r.props;if(!s.hasUserMedia)return null;var M=this.getCanvas(t);return M&&M.toDataURL(l.screenshotFormat,l.screenshotQuality)},i.prototype.getCanvas=function(t){var r=this,s=r.state,l=r.props;if(!this.video||!s.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var M=this.video.videoWidth,y=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var C=M/y;M=l.minScreenshotWidth||this.video.clientWidth,y=M/C,l.minScreenshotHeight&&y<l.minScreenshotHeight&&(y=l.minScreenshotHeight,M=y*C)}this.canvas=document.createElement("canvas"),this.canvas.width=t?.width||M,this.canvas.height=t?.height||y,this.ctx=this.canvas.getContext("2d")}var x=this,w=x.ctx,S=x.canvas;return w&&S&&(S.width=t?.width||S.width,S.height=t?.height||S.height,l.mirrored&&(w.translate(S.width,0),w.scale(-1,1)),w.imageSmoothingEnabled=l.imageSmoothing,w.drawImage(this.video,0,0,t?.width||S.width,t?.height||S.height),l.mirrored&&(w.scale(-1,1),w.translate(-S.width,0))),S},i.prototype.requestUserMedia=function(){var t=this,r=this.props,s=function(y,C){var x={video:typeof C<"u"?C:!0};r.audio&&(x.audio=typeof y<"u"?y:!0),t.requestUserMediaId++;var w=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(x).then(function(S){t.unmounted||w!==t.requestUserMediaId?i.stopMediaStream(S):t.handleUserMedia(null,S)}).catch(function(S){t.handleUserMedia(S)})};if("mediaDevices"in navigator)s(r.audioConstraints,r.videoConstraints);else{var l=function(y){return{optional:[{sourceId:y}]}},M=function(y){var C=y.deviceId;return typeof C=="string"?C:Array.isArray(C)&&C.length>0?C[0]:typeof C=="object"&&C.ideal?C.ideal:null};MediaStreamTrack.getSources(function(y){var C=null,x=null;y.forEach(function(P){P.kind==="audio"?C=P.id:P.kind==="video"&&(x=P.id)});var w=M(r.audioConstraints);w&&(C=w);var S=M(r.videoConstraints);S&&(x=S),s(l(C),l(x))})}},i.prototype.handleUserMedia=function(t,r){var s=this.props;if(t||!r){this.setState({hasUserMedia:!1}),s.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}s.onUserMedia(r)},i.prototype.render=function(){var t=this,r=this,s=r.state,l=r.props,M=l.audio;l.forceScreenshotSourceSize;var y=l.disablePictureInPicture;l.onUserMedia,l.onUserMediaError,l.screenshotFormat,l.screenshotQuality,l.minScreenshotWidth,l.minScreenshotHeight,l.audioConstraints,l.videoConstraints,l.imageSmoothing;var C=l.mirrored,x=l.style,w=x===void 0?{}:x,S=l.children,P=F(l,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),z=C?m(m({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,j={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",m({autoPlay:!0,disablePictureInPicture:y,src:s.src,muted:!M,playsInline:!0,ref:function(B){t.video=B},style:z},P)),S&&S(j))},i.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},i})(o.Component);v.default=R}),react:(function(g,v){g.exports=d})}).default})})(A)),A.exports}var Ke=Je();const Ye=ye(Ke),Ze=({width:e})=>O(G,{width:e,children:[U(q,{size:"threeXL",color:re.gray60,content:ne}),O(Ve,{children:["This app would like to use your camera.",U(ze,{href:je,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),et=({handleCapture:e,width:a,disabled:d,clearPhotoInProgress:g,setClearPhotoInProgress:v,facingMode:p,setFacingMode:o,testOverride:f})=>{const[m,F]=n.useState(f||"pending"),I=n.useRef(null),[R,b]=n.useState(a),i=n.useCallback(Ce(1e3,b),[]);n.useEffect(()=>{i(a)},[a,i]);function t(){if(I.current!==null){const s=I.current.getScreenshot();e(s)}}const r=Ue();return O(se,{"data-testid":"stCameraInputWebcamComponent",children:[m!=="success"&&!d&&!g?U(Ze,{width:R}):we()&&U(Xe,{switchFacingMode:o}),U(G,{"data-testid":"stCameraInputWebcamStyledBox",hidden:m!=="success"&&!d&&!g,width:R,children:!d&&U(Ye,{audio:!1,ref:I,screenshotFormat:"image/jpeg",screenshotQuality:1,width:R,height:R*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{F("error")},onUserMedia:()=>{F("success"),v(!1)},videoConstraints:{width:{ideal:R},facingMode:p}})}),U(le,{onClick:t,disabled:m!=="success"||d||g,children:"Take Photo"})]})},tt=n.memo(et),ce="RESTORED_FROM_WIDGET",rt=150,it=xe.getLogger("CameraInput"),N=e=>{const a=e.filter(d=>d.status.type==="uploaded").map(d=>{const{name:g,size:v,status:p}=d,{fileId:o,fileUrls:f}=p;return new Oe({fileId:o,fileUrls:f,name:g,size:v})});return new ke({uploadedFileInfo:a})},ot=(e,a)=>{const d=a.getFileUploaderStateValue(e);if(L(d))return{files:[],nextLocalId:1,imgSrc:null};const{uploadedFileInfo:g}=d;if(L(g)||g.length===0)return{files:[],nextLocalId:1,imgSrc:null};let v=1;const p=g.map(o=>{const f=o.name,m=o.size,F=o.fileId,I=o.fileUrls,R=new ie(f,m,v,{type:"uploaded",fileId:F,fileUrls:I});return v+=1,R});return{files:p,nextLocalId:v,imgSrc:p.length>0?ce:null}};function nt(e,a){return fetch(e).then(d=>d.arrayBuffer()).then(d=>new File([d],a,{type:"image/jpeg"}))}const at=({element:e,widgetMgr:a,uploadClient:d,disabled:g,fragmentId:v,testOverride:p})=>{const{width:o,elementRef:f}=Me(),m=n.useRef(null);m.current===null&&(m.current=ot(e,a));const{files:F,nextLocalId:I,imgSrc:R}=m.current,b=n.useRef(I),[i,t]=n.useState(()=>F),r=n.useRef(i);n.useLayoutEffect(()=>{r.current=i},[i]);const[s,l]=n.useState(()=>R),[M,y]=n.useState(!1),[C,x]=n.useState(!0),[w,S]=n.useState(!1),[P,z]=n.useState(V.USER),j=n.useCallback(()=>{const c=b.current;return b.current+=1,c},[]),B=n.useMemo(()=>{const c=u=>u.status.type==="uploading";return i.some(c)?"updating":"ready"},[i]),$=n.useMemo(()=>{if(i.length>0&&i[i.length-1].status.type==="uploading")return i[i.length-1].status.progress},[i]),de=n.useCallback(()=>{z(c=>c===V.USER?V.ENVIRONMENT:V.USER)},[]),k=n.useCallback(c=>r.current.find(u=>u.id===c),[]),X=n.useCallback(c=>{Ee.flushSync(()=>{t(u=>[...u,c])})},[]),Q=n.useCallback(c=>{t(u=>u.filter(h=>h.id!==c))},[]),T=n.useCallback((c,u)=>{t(h=>h.map(E=>E.id===c?u:E))},[]),J=n.useCallback((c,u)=>{y(!1);const h=k(c);L(h)||h.status.type!=="uploading"||T(h.id,h.setStatus({type:"uploaded",fileId:u.fileId,fileUrls:u}))},[k,T]),K=n.useCallback((c,u)=>{const h=k(u);if(L(h)||h.status.type!=="uploading")return;const E=Math.round(c.loaded*100/c.total);h.status.progress!==E&&T(u,h.setStatus({type:"uploading",abortController:h.status.abortController,progress:E}))},[k,T]),Y=n.useCallback((c,u)=>{const h=new AbortController,E=new ie(u.name,u.size,j(),{type:"uploading",abortController:h,progress:1});X(E),d.uploadFile(e,c.uploadUrl,u,W=>K(W,E.id),h.signal).then(()=>J(E.id,c)).catch(W=>{W instanceof DOMException&&W.name==="AbortError"||T(E.id,E.setStatus({type:"error",errorMessage:W?W.toString():"Unknown error"}))})},[X,e,j,J,K,T,d]),Z=n.useCallback(c=>{const u=k(c);L(u)||(u.status.type==="uploading"&&u.status.abortController.abort(),u.status.type==="uploaded"&&u.status.fileUrls.deleteUrl&&d.deleteFile(u.status.fileUrls.deleteUrl),Q(c))},[k,Q,d]),ee=n.useCallback(c=>{if(c===null)return Promise.resolve();l(c),y(!0),x(!1);const u=h=>new Promise(E=>setTimeout(E,h));return nt(c,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(h=>d.fetchFileURLs([h]).then(E=>({file:h,fileUrls:E[0]}))).then(({file:h,fileUrls:E})=>Y(E,h)).then(()=>u(rt)).then(()=>{x(!0)}).catch(h=>{it.error(h)})},[d,Y]),ue=n.useCallback(c=>{ee(c)},[ee]),fe=n.useCallback(()=>{i.length!==0&&(i.forEach(c=>Z(c.id)),l(null),S(!0))},[i,Z]);n.useEffect(()=>{a.getFileUploaderStateValue(e)===void 0&&a.setFileUploaderStateValue(e,N(i),{fromUi:!1},v)},[]),n.useEffect(()=>{if(B!=="ready")return;const c=N(i),u=a.getFileUploaderStateValue(e);Ie(c,u)||a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[B,i,a,e,v]);const pe=n.useCallback(()=>{t([]),l(null);const c=N([]);a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[e,v,a]);return Te({element:e,widgetMgr:a,onFormCleared:pe}),O(se,{className:"stCameraInput","data-testid":"stCameraInput",ref:f,children:[U(_e,{label:e.label,disabled:g,labelVisibility:Fe(e.labelVisibility?.value),children:e.help&&U(Re,{content:e.help,label:e.label})}),s?O(Pe,{children:[U(G,{width:o,children:s!==ce&&U(Ae,{src:s,alt:"Snapshot",opacity:M||!C?"50%":"100%",width:o,height:o*9/16})}),U(le,{onClick:fe,progress:$,disabled:!!$||g,children:$?"Uploading...":O($e,{children:[U(q,{content:ae,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):U(tt,{handleCapture:ue,width:o,disabled:g,clearPhotoInProgress:w,setClearPhotoInProgress:S,facingMode:P,setFacingMode:de,testOverride:p})]})},ft=n.memo(at);export{ft as default};
|
|
1
|
+
import{r as n,E as H,_ as D,F as _,aj as he,o as O,j as U,aA as ge,P as ve,b as me,B as Se,az as q,bQ as re,an as be,ah as ye,bi as Ce,l as Ue,bR as we,k as Me,al as Ee,e as L,W as xe,bj as Ie,p as Fe,ac as Re,ad as _e,a0 as Pe,bS as Oe,bT as ke}from"./index.01VsD2h1.js";import{U as ie}from"./UploadFileInfo.Dr-zDST7.js";import{u as Te}from"./FormClearHelper.By4vKj6A.js";import{P as We,S as Le}from"./ProgressBar.Dgbh0B0d.js";import{b as je}from"./urls.BwSlolu9.js";var oe=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:a}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});oe.displayName="SwitchCamera";var ne=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});ne.displayName="Video";var ae=n.forwardRef(function(e,a){var d={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return n.createElement(H,D({iconAttrs:d,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:a}),n.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});ae.displayName="X";function Be(e,a){switch(e){case"xsmall":return{padding:`${a.spacing.twoXS} ${a.spacing.sm}`,fontSize:a.fontSizes.sm};case"small":return{padding:`${a.spacing.twoXS} ${a.spacing.md}`};case"large":return{padding:`${a.spacing.md} ${a.spacing.md}`};default:return{padding:`${a.spacing.xs} ${a.spacing.md}`}}}const se=_("div",{target:"e1dr6u8s0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),G=_("div",{target:"e1dr6u8s1"})(({theme:e,width:a})=>({backgroundColor:e.colors.secondaryBg,borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,width:"100%",height:a*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),Ve=_("p",{target:"e1dr6u8s2"})(({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),Ae=_("img",{target:"e1dr6u8s3"})(({theme:e,opacity:a})=>({borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,objectFit:"contain",opacity:a})),ze=_("a",{target:"e1dr6u8s4"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none",display:"block"})),$e=_("span",{target:"e1dr6u8s5"})({display:"flex",alignItems:"center"}),Ne=_("div",{target:"e1dr6u8s6"})(({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:e.zIndices.priority,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),He=_("div",{target:"e1dr6u8s8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),De=_("button",{target:"e1dr6u8s9"})(({theme:e})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:e.colors.lightenedBg05,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,borderRadius:`0 0 ${e.radii.default} ${e.radii.default}`,"&:hover":{borderColor:e.colors.primary,color:e.colors.primary},"&:active":{color:e.colors.white,borderColor:e.colors.primary,backgroundColor:e.colors.primary},"&:focus:not(:active)":{borderColor:e.colors.primary,color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:e.colors.fadedText40,borderColor:e.colors.borderColor,backgroundColor:e.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:e.fontWeights.normal,padding:`${e.spacing.xs} ${e.spacing.md}`,margin:e.spacing.none,lineHeight:e.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:he(e)},...Be("medium",e)}));function qe({disabled:e,onClick:a,children:d,progress:g}){return O(De,{disabled:e||!1,onClick:a||(()=>{}),progress:g||null,"data-testid":"stCameraInputButton",children:[d,g?U(He,{children:U(We,{value:g,size:Le.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const le=n.memo(qe);var V=(function(e){return e.USER="user",e.ENVIRONMENT="environment",e})({});const Ge=({switchFacingMode:e})=>U(Ne,{"data-testid":"stCameraInputSwitchButton",children:U(ge,{content:"Switch camera",placement:ve.TOP_RIGHT,children:U(me,{kind:Se.MINIMAL,onClick:e,children:U(q,{content:oe,size:"twoXL",color:re.white})})})}),Xe=n.memo(Ge);var A={exports:{}},Qe=A.exports,te;function Je(){return te||(te=1,(function(e,a){(function(g,v){e.exports=v(be())})(Qe,function(d){return(function(g){var v={};function p(o){if(v[o])return v[o].exports;var f=v[o]={i:o,l:!1,exports:{}};return g[o].call(f.exports,f,f.exports,p),f.l=!0,f.exports}return p.m=g,p.c=v,p.d=function(o,f,m){p.o(o,f)||Object.defineProperty(o,f,{enumerable:!0,get:m})},p.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},p.t=function(o,f){if(f&1&&(o=p(o)),f&8||f&4&&typeof o=="object"&&o&&o.__esModule)return o;var m=Object.create(null);if(p.r(m),Object.defineProperty(m,"default",{enumerable:!0,value:o}),f&2&&typeof o!="string")for(var F in o)p.d(m,F,(function(I){return o[I]}).bind(null,F));return m},p.n=function(o){var f=o&&o.__esModule?function(){return o.default}:function(){return o};return p.d(f,"a",f),f},p.o=function(o,f){return Object.prototype.hasOwnProperty.call(o,f)},p.p="",p(p.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(g,v,p){p.r(v);var o=p("react"),f=(function(){var b=function(i,t){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l])},b(i,t)};return function(i,t){b(i,t);function r(){this.constructor=i}i.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})(),m=function(){return m=Object.assign||function(b){for(var i,t=1,r=arguments.length;t<r;t++){i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(b[s]=i[s])}return b},m.apply(this,arguments)},F=function(b,i){var t={};for(var r in b)Object.prototype.hasOwnProperty.call(b,r)&&i.indexOf(r)<0&&(t[r]=b[r]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(b);s<r.length;s++)i.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(b,r[s])&&(t[r[s]]=b[r[s]]);return t};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(i){var t=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return t?new Promise(function(r,s){t.call(navigator,i,r,s)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function I(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var R=(function(b){f(i,b);function i(t){var r=b.call(this,t)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return i.prototype.componentDidMount=function(){var t=this,r=t.state,s=t.props;if(this.unmounted=!1,!I()){s.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),s.children&&typeof s.children!="function"&&console.warn("children must be a function")},i.prototype.componentDidUpdate=function(t){var r=this.props;if(!I()){r.onUserMediaError("getUserMedia not supported");return}var s=JSON.stringify(t.audioConstraints)!==JSON.stringify(r.audioConstraints),l=JSON.stringify(t.videoConstraints)!==JSON.stringify(r.videoConstraints),M=t.minScreenshotWidth!==r.minScreenshotWidth,y=t.minScreenshotHeight!==r.minScreenshotHeight;(l||M||y)&&(this.canvas=null,this.ctx=null),(s||l)&&(this.stopAndCleanup(),this.requestUserMedia())},i.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},i.stopMediaStream=function(t){t&&(t.getVideoTracks&&t.getAudioTracks?(t.getVideoTracks().map(function(r){t.removeTrack(r),r.stop()}),t.getAudioTracks().map(function(r){t.removeTrack(r),r.stop()})):t.stop())},i.prototype.stopAndCleanup=function(){var t=this.state;t.hasUserMedia&&(i.stopMediaStream(this.stream),t.src&&window.URL.revokeObjectURL(t.src))},i.prototype.getScreenshot=function(t){var r=this,s=r.state,l=r.props;if(!s.hasUserMedia)return null;var M=this.getCanvas(t);return M&&M.toDataURL(l.screenshotFormat,l.screenshotQuality)},i.prototype.getCanvas=function(t){var r=this,s=r.state,l=r.props;if(!this.video||!s.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var M=this.video.videoWidth,y=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var C=M/y;M=l.minScreenshotWidth||this.video.clientWidth,y=M/C,l.minScreenshotHeight&&y<l.minScreenshotHeight&&(y=l.minScreenshotHeight,M=y*C)}this.canvas=document.createElement("canvas"),this.canvas.width=t?.width||M,this.canvas.height=t?.height||y,this.ctx=this.canvas.getContext("2d")}var x=this,w=x.ctx,S=x.canvas;return w&&S&&(S.width=t?.width||S.width,S.height=t?.height||S.height,l.mirrored&&(w.translate(S.width,0),w.scale(-1,1)),w.imageSmoothingEnabled=l.imageSmoothing,w.drawImage(this.video,0,0,t?.width||S.width,t?.height||S.height),l.mirrored&&(w.scale(-1,1),w.translate(-S.width,0))),S},i.prototype.requestUserMedia=function(){var t=this,r=this.props,s=function(y,C){var x={video:typeof C<"u"?C:!0};r.audio&&(x.audio=typeof y<"u"?y:!0),t.requestUserMediaId++;var w=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(x).then(function(S){t.unmounted||w!==t.requestUserMediaId?i.stopMediaStream(S):t.handleUserMedia(null,S)}).catch(function(S){t.handleUserMedia(S)})};if("mediaDevices"in navigator)s(r.audioConstraints,r.videoConstraints);else{var l=function(y){return{optional:[{sourceId:y}]}},M=function(y){var C=y.deviceId;return typeof C=="string"?C:Array.isArray(C)&&C.length>0?C[0]:typeof C=="object"&&C.ideal?C.ideal:null};MediaStreamTrack.getSources(function(y){var C=null,x=null;y.forEach(function(P){P.kind==="audio"?C=P.id:P.kind==="video"&&(x=P.id)});var w=M(r.audioConstraints);w&&(C=w);var S=M(r.videoConstraints);S&&(x=S),s(l(C),l(x))})}},i.prototype.handleUserMedia=function(t,r){var s=this.props;if(t||!r){this.setState({hasUserMedia:!1}),s.onUserMediaError(t);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}s.onUserMedia(r)},i.prototype.render=function(){var t=this,r=this,s=r.state,l=r.props,M=l.audio;l.forceScreenshotSourceSize;var y=l.disablePictureInPicture;l.onUserMedia,l.onUserMediaError,l.screenshotFormat,l.screenshotQuality,l.minScreenshotWidth,l.minScreenshotHeight,l.audioConstraints,l.videoConstraints,l.imageSmoothing;var C=l.mirrored,x=l.style,w=x===void 0?{}:x,S=l.children,P=F(l,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),z=C?m(m({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,j={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",m({autoPlay:!0,disablePictureInPicture:y,src:s.src,muted:!M,playsInline:!0,ref:function(B){t.video=B},style:z},P)),S&&S(j))},i.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},i})(o.Component);v.default=R}),react:(function(g,v){g.exports=d})}).default})})(A)),A.exports}var Ke=Je();const Ye=ye(Ke),Ze=({width:e})=>O(G,{width:e,children:[U(q,{size:"threeXL",color:re.gray60,content:ne}),O(Ve,{children:["This app would like to use your camera.",U(ze,{href:je,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),et=({handleCapture:e,width:a,disabled:d,clearPhotoInProgress:g,setClearPhotoInProgress:v,facingMode:p,setFacingMode:o,testOverride:f})=>{const[m,F]=n.useState(f||"pending"),I=n.useRef(null),[R,b]=n.useState(a),i=n.useCallback(Ce(1e3,b),[]);n.useEffect(()=>{i(a)},[a,i]);function t(){if(I.current!==null){const s=I.current.getScreenshot();e(s)}}const r=Ue();return O(se,{"data-testid":"stCameraInputWebcamComponent",children:[m!=="success"&&!d&&!g?U(Ze,{width:R}):we()&&U(Xe,{switchFacingMode:o}),U(G,{"data-testid":"stCameraInputWebcamStyledBox",hidden:m!=="success"&&!d&&!g,width:R,children:!d&&U(Ye,{audio:!1,ref:I,screenshotFormat:"image/jpeg",screenshotQuality:1,width:R,height:R*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{F("error")},onUserMedia:()=>{F("success"),v(!1)},videoConstraints:{width:{ideal:R},facingMode:p}})}),U(le,{onClick:t,disabled:m!=="success"||d||g,children:"Take Photo"})]})},tt=n.memo(et),ce="RESTORED_FROM_WIDGET",rt=150,it=xe.getLogger("CameraInput"),N=e=>{const a=e.filter(d=>d.status.type==="uploaded").map(d=>{const{name:g,size:v,status:p}=d,{fileId:o,fileUrls:f}=p;return new Oe({fileId:o,fileUrls:f,name:g,size:v})});return new ke({uploadedFileInfo:a})},ot=(e,a)=>{const d=a.getFileUploaderStateValue(e);if(L(d))return{files:[],nextLocalId:1,imgSrc:null};const{uploadedFileInfo:g}=d;if(L(g)||g.length===0)return{files:[],nextLocalId:1,imgSrc:null};let v=1;const p=g.map(o=>{const f=o.name,m=o.size,F=o.fileId,I=o.fileUrls,R=new ie(f,m,v,{type:"uploaded",fileId:F,fileUrls:I});return v+=1,R});return{files:p,nextLocalId:v,imgSrc:p.length>0?ce:null}};function nt(e,a){return fetch(e).then(d=>d.arrayBuffer()).then(d=>new File([d],a,{type:"image/jpeg"}))}const at=({element:e,widgetMgr:a,uploadClient:d,disabled:g,fragmentId:v,testOverride:p})=>{const{width:o,elementRef:f}=Me(),m=n.useRef(null);m.current===null&&(m.current=ot(e,a));const{files:F,nextLocalId:I,imgSrc:R}=m.current,b=n.useRef(I),[i,t]=n.useState(()=>F),r=n.useRef(i);n.useLayoutEffect(()=>{r.current=i},[i]);const[s,l]=n.useState(()=>R),[M,y]=n.useState(!1),[C,x]=n.useState(!0),[w,S]=n.useState(!1),[P,z]=n.useState(V.USER),j=n.useCallback(()=>{const c=b.current;return b.current+=1,c},[]),B=n.useMemo(()=>{const c=u=>u.status.type==="uploading";return i.some(c)?"updating":"ready"},[i]),$=n.useMemo(()=>{if(i.length>0&&i[i.length-1].status.type==="uploading")return i[i.length-1].status.progress},[i]),de=n.useCallback(()=>{z(c=>c===V.USER?V.ENVIRONMENT:V.USER)},[]),k=n.useCallback(c=>r.current.find(u=>u.id===c),[]),X=n.useCallback(c=>{Ee.flushSync(()=>{t(u=>[...u,c])})},[]),Q=n.useCallback(c=>{t(u=>u.filter(h=>h.id!==c))},[]),T=n.useCallback((c,u)=>{t(h=>h.map(E=>E.id===c?u:E))},[]),J=n.useCallback((c,u)=>{y(!1);const h=k(c);L(h)||h.status.type!=="uploading"||T(h.id,h.setStatus({type:"uploaded",fileId:u.fileId,fileUrls:u}))},[k,T]),K=n.useCallback((c,u)=>{const h=k(u);if(L(h)||h.status.type!=="uploading")return;const E=Math.round(c.loaded*100/c.total);h.status.progress!==E&&T(u,h.setStatus({type:"uploading",abortController:h.status.abortController,progress:E}))},[k,T]),Y=n.useCallback((c,u)=>{const h=new AbortController,E=new ie(u.name,u.size,j(),{type:"uploading",abortController:h,progress:1});X(E),d.uploadFile(e,c.uploadUrl,u,W=>K(W,E.id),h.signal).then(()=>J(E.id,c)).catch(W=>{W instanceof DOMException&&W.name==="AbortError"||T(E.id,E.setStatus({type:"error",errorMessage:W?W.toString():"Unknown error"}))})},[X,e,j,J,K,T,d]),Z=n.useCallback(c=>{const u=k(c);L(u)||(u.status.type==="uploading"&&u.status.abortController.abort(),u.status.type==="uploaded"&&u.status.fileUrls.deleteUrl&&d.deleteFile(u.status.fileUrls.deleteUrl),Q(c))},[k,Q,d]),ee=n.useCallback(c=>{if(c===null)return Promise.resolve();l(c),y(!0),x(!1);const u=h=>new Promise(E=>setTimeout(E,h));return nt(c,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(h=>d.fetchFileURLs([h]).then(E=>({file:h,fileUrls:E[0]}))).then(({file:h,fileUrls:E})=>Y(E,h)).then(()=>u(rt)).then(()=>{x(!0)}).catch(h=>{it.error(h)})},[d,Y]),ue=n.useCallback(c=>{ee(c)},[ee]),fe=n.useCallback(()=>{i.length!==0&&(i.forEach(c=>Z(c.id)),l(null),S(!0))},[i,Z]);n.useEffect(()=>{a.getFileUploaderStateValue(e)===void 0&&a.setFileUploaderStateValue(e,N(i),{fromUi:!1},v)},[]),n.useEffect(()=>{if(B!=="ready")return;const c=N(i),u=a.getFileUploaderStateValue(e);Ie(c,u)||a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[B,i,a,e,v]);const pe=n.useCallback(()=>{t([]),l(null);const c=N([]);a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[e,v,a]);return Te({element:e,widgetMgr:a,onFormCleared:pe}),O(se,{className:"stCameraInput","data-testid":"stCameraInput",ref:f,children:[U(_e,{label:e.label,disabled:g,labelVisibility:Fe(e.labelVisibility?.value),children:e.help&&U(Re,{content:e.help,label:e.label})}),s?O(Pe,{children:[U(G,{width:o,children:s!==ce&&U(Ae,{src:s,alt:"Snapshot",opacity:M||!C?"50%":"100%",width:o,height:o*9/16})}),U(le,{onClick:fe,progress:$,disabled:!!$||g,children:$?"Uploading...":O($e,{children:[U(q,{content:ae,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):U(tt,{handleCapture:ue,width:o,disabled:g,clearPhotoInProgress:w,setClearPhotoInProgress:S,facingMode:P,setFacingMode:de,testOverride:p})]})},ft=n.memo(at);export{ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{X as f,a7 as p,B as i,r as l,u as h,j as o,a as S,b as F,c as I,D as R,d as C,a8 as M}from"./index.
|
|
1
|
+
import{X as f,a7 as p,B as i,r as l,u as h,j as o,a as S,b as F,c as I,D as R,d as C,a8 as M}from"./index.01VsD2h1.js";import{a9 as D}from"./index.01VsD2h1.js";import{m as x}from"./iconPosition.5dHEZYw2.js";import{F as E,u as O}from"./FormClearHelper.By4vKj6A.js";function y(a){const{disabled:d,element:t,widgetMgr:e,fragmentId:u}=a,{formId:s}=t,m=t.shortcut?t.shortcut:void 0,{formsData:B}=f(p),b=B.formsWithUploads.has(s);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const r=d||b;l.useEffect(()=>(e.addSubmitButton(s,t),()=>e.removeSubmitButton(s,t)),[e,s,t]);const c=l.useCallback(()=>{r||e.submitForm(t.formId,u,t)},[r,e,t,u]);return h({shortcut:m,disabled:r,onActivate:c}),o(C,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:o(S,{help:t.help,containerWidth:!0,children:o(F,{kind:n,size:I.SMALL,containerWidth:!0,disabled:r,onClick:c,children:o(R,{icon:t.icon,iconPosition:x(t.iconPosition),label:t.label,shortcut:m})})})})}function _(a){return o(M,{children:o(y,{...a})})}export{E as FormClearHelper,y as FormSubmitButton,_ as FormSubmitContent,D as default,O as useFormClearHelper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as c,ai as d,aj as C,c as t,r as a,B as l,j as n,u as x,a as S,D as L,d as $}from"./index.
|
|
1
|
+
import{F as c,ai as d,aj as C,c as t,r as a,B as l,j as n,u as x,a as S,D as L,d as $}from"./index.01VsD2h1.js";import{m as R}from"./iconPosition.5dHEZYw2.js";function T(o,r){switch(o){case t.XSMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.sm}`,fontSize:r.fontSizes.sm};case t.SMALL:return{padding:`${r.spacing.twoXS} ${r.spacing.md}`};case t.LARGE:return{padding:`${r.spacing.md} ${r.spacing.md}`};default:return{padding:`${r.spacing.xs} ${r.spacing.md}`}}}const f=c("a",{target:"e8hm1sp0"})(({containerWidth:o,size:r,theme:i})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,borderRadius:i.radii.button,minHeight:i.sizes.minElementHeight,margin:0,lineHeight:i.lineHeights.base,color:i.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:i.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:C(i)},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...T(r,i)})),w=c(f,{target:"e8hm1sp1"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:d(o.colors.primary,.15),borderColor:d(o.colors.primary,.15)},"&:active":{backgroundColor:o.colors.primary,borderColor:d(o.colors.primary,.15)},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),A=c(f,{target:"e8hm1sp2"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),z=c(f,{target:"e8hm1sp3"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{color:o.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:"inherit !important"}},"&:active":{color:d(o.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}})),y=a.forwardRef(function({kind:r,size:i,disabled:s,children:e,autoFocus:u,href:b,rel:p,target:B,onClick:k},v){let g=w;return r===l.SECONDARY?g=A:r===l.TERTIARY&&(g=z),n(g,{ref:v,kind:r,size:i||t.MEDIUM,containerWidth:!0,disabled:s||!1,autoFocus:u||!1,href:b,target:B,rel:p,onClick:k,tabIndex:s?-1:0,"data-testid":`stBaseLinkButton-${r}`,children:e})});y.displayName="BaseLinkButton";const D=a.memo(y);function M(o){const{element:r}=o,i=r.shortcut?r.shortcut:void 0;let s=l.SECONDARY;r.type==="primary"?s=l.PRIMARY:r.type==="tertiary"&&(s=l.TERTIARY);const e=a.useRef(null),u=a.useCallback(()=>{r.disabled||e.current?.click()},[r.disabled]),b=a.useCallback(p=>{r.disabled&&p.preventDefault()},[r.disabled]);return x({shortcut:i,disabled:r.disabled,onActivate:u}),n($,{className:"stLinkButton","data-testid":"stLinkButton",children:n(S,{help:r.help,containerWidth:!0,children:n(D,{ref:e,kind:s,size:t.SMALL,disabled:r.disabled,onClick:b,href:r.url,target:"_blank",rel:"noreferrer","aria-disabled":r.disabled,children:n(L,{icon:r.icon,iconPosition:R(r.iconPosition),label:r.label,shortcut:i})})})})}const P=a.memo(M);export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,E as G,_ as Z,F as V,be as C,e as h,n as J,W as dt,l as pt,k as ft,aa as mt,ab as k,o as B,j as d,p as bt,ac as ht,ad as gt,ae as yt,Z as It,az as j}from"./index.
|
|
1
|
+
import{r as a,E as G,_ as Z,F as V,be as C,e as h,n as J,W as dt,l as pt,k as ft,aa as mt,ab as k,o as B,j as d,p as bt,ac as ht,ad as gt,ae as yt,Z as It,az as j}from"./index.01VsD2h1.js";import{I as Ct}from"./InputInstructions.BiaGyIXk.js";import{u as Tt}from"./useBasicWidgetState.DrTKs46R.js";import{s as St}from"./sprintf.DpPCfzXw.js";import{u as wt}from"./uniqueId.BdEQNrWF.js";import{I as vt}from"./input.27t-DftI.js";import"./FormClearHelper.By4vKj6A.js";import"./base-input.CHPo5oJ1.js";var Q=a.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(G,Z({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=a.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(G,Z({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),a.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const xt=V("div",{target:"eaeic2i0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor??t.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),Dt=V("div",{target:"eaeic2i1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),K=V("button",{target:"eaeic2i2"})(({theme:t})=>({margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:t.sizes.numberInputControlsWidth,justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),kt=V("div",{target:"eaeic2i3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Vt=dt.getLogger("NumberInput");function Nt(t){return h(t)||t===""?void 0:t}const tt=t=>{const e=t.toString();if(e.includes("e-")){const r=e.match(/(\d+(?:\.\d+)?)e-(\d+)/);if(r){const s=(r[1]?.split(".")[1]||"").length,n=parseInt(r[2],10);return s+n}return 0}return(e.split(".")[1]||"").length},_=({value:t,format:e,step:r,dataType:s})=>{if(h(t))return null;let n=Nt(e);if(h(n)&&J(r)&&s===C.DataType.FLOAT&&r!==0){const l=tt(r);l>0&&(n=`%0.${l}f`)}if(h(n))return t.toString();try{return St.sprintf(n,t)}catch(l){return Vt.warn(`Error in sprintf(${n}, ${t}): ${l}`),String(t)}},Et=(t,e,r)=>h(t)?!1:t-e>=r,Ft=(t,e,r)=>h(t)?!1:t+e<=r,X=(t,e,r)=>{const s=tt(e);if(s===0)switch(r){case"add":return t+e;case"subtract":return t-e}const n=Math.pow(10,s),l=Math.round(t*n),p=Math.round(e*n);switch(r){case"add":return(l+p)/n;case"subtract":return(l-p)/n}},Rt=({step:t,dataType:e})=>t||(e===C.DataType.INT?1:.01);function q(t,e){return e.dataType===C.DataType.INT?t.getIntValue(e):t.getDoubleValue(e)}function Wt(t){return t.default??null}function zt(t){return t.value??t.default??null}function Bt(t,e,r,s){switch(t.dataType){case C.DataType.INT:e.setIntValue(t,r.value,{fromUi:r.fromUi},s);break;case C.DataType.FLOAT:e.setDoubleValue(t,r.value,{fromUi:r.fromUi},s);break;default:throw new Error("Invalid data type")}}const Lt=({disabled:t,element:e,widgetMgr:r,fragmentId:s})=>{const n=pt(),{dataType:l,formId:p,default:T,format:N,icon:E,min:g,max:y}=e,{width:L,elementRef:et}=ft(),c=a.useMemo(()=>Rt({step:e.step,dataType:e.dataType}),[e.step,e.dataType]),I=a.useCallback(o=>_({value:o,dataType:l,format:N,step:c}),[l,N,c]),[f,w]=a.useState(!1),[b,S]=a.useState(()=>{const o=q(r,e)??T??null;return _({value:o,dataType:l,format:N,step:c})}),[P,U]=Tt({getStateFromWidgetMgr:q,getDefaultStateFromProto:Wt,getCurrStateFromProto:zt,updateWidgetMgrState:Bt,element:e,widgetMgr:r,fragmentId:s,onFormCleared:a.useCallback(()=>{const o=T??null;w(!1),S(I(o))},[T,I])}),[A,H]=a.useState(!1),F=a.useRef(null),[$]=a.useState(()=>wt("number_input_")),M=mt({formId:p}),nt=M?r.allowFormEnterToSubmit(p):f,rt=A&&L>k(n.breakpoints.hideWidgetDetails);a.useEffect(()=>{f||S(I(P))},[P,f,I]);const m=a.useCallback(({value:o,fromUi:i})=>{if(J(o)&&(g>o||o>y)){F.current?.reportValidity();return}const D=o??T??null;U({value:D,fromUi:i}),w(!1),S(I(D))},[g,y,T,I,U]),ot=a.useCallback(()=>{H(!0)},[]);a.useEffect(()=>{const o=F.current;if(o){const i=D=>{D.preventDefault()};return o.addEventListener("wheel",i),()=>{o.removeEventListener("wheel",i)}}},[]);const R=h(e.default)&&!t,at=a.useCallback(o=>{const{value:i}=o.target;i===""?(w(!0),S(null)):(w(!0),S(i))},[]),u=a.useMemo(()=>{if(b===null||b==="")return null;if(e.dataType===C.DataType.INT){const i=parseInt(b,10);return isNaN(i)?null:i}const o=parseFloat(b);return isNaN(o)?null:o},[b,e.dataType]),v=Et(u,c,g),x=Ft(u,c,y),st=a.useCallback(()=>{f&&m({value:u,fromUi:!0}),H(!1)},[f,u,m]),W=a.useCallback(()=>{if(x){const o=X(u??g,c,"add");m({value:o,fromUi:!0})}},[u,g,c,x,m]),z=a.useCallback(()=>{if(v){const o=X(u??y,c,"subtract");m({value:o,fromUi:!0})}},[u,y,c,v,m]),it=a.useCallback(o=>{const{key:i}=o;switch(i){case"ArrowUp":o.preventDefault(),W();break;case"ArrowDown":o.preventDefault(),z();break}},[W,z]),lt=a.useCallback(o=>{o.key==="Enter"&&(f&&m({value:u,fromUi:!0}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,s))},[f,u,m,r,p,s]),ct=k(n.iconSizes.lg)+2*k(n.spacing.twoXS),O=k(n.breakpoints.hideNumberInputControls),ut=E?O+ct:O;return B("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:et,children:[d(gt,{label:e.label,disabled:t,labelVisibility:bt(e.labelVisibility?.value),htmlFor:$,children:e.help&&d(ht,{content:e.help,label:e.label})}),B(xt,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[d(vt,{type:"number",inputRef:F,value:b??"",placeholder:e.placeholder,onBlur:st,onFocus:ot,onChange:at,onKeyPress:lt,onKeyDown:it,clearable:R,clearOnEscape:R,disabled:t,"aria-label":e.label,startEnhancer:e.icon&&d(It,{"data-testid":"stNumberInputIcon",iconValue:e.icon,size:"lg"}),id:$,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:n.colors.grayTextColor,padding:n.spacing.threeXS,height:n.sizes.clearIconSize,width:n.sizes.clearIconSize,":hover":{fill:n.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:c,min:g,max:y,type:"number",inputMode:""},style:{fontWeight:n.fontWeights.normal,lineHeight:n.lineHeights.inputWidget,paddingRight:n.spacing.sm,paddingLeft:n.spacing.md,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm,"::placeholder":{color:n.colors.fadedText60}}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0,paddingLeft:E?n.spacing.sm:0}},StartEnhancer:{style:{paddingLeft:0,paddingRight:0,minWidth:n.iconSizes.lg,color:yt(E)?n.colors.fadedText60:"inherit"}}}}),L>ut&&B(Dt,{children:[d(K,{"data-testid":"stNumberInputStepDown",onClick:z,disabled:!v||t,tabIndex:-1,children:d(j,{content:Q,size:"xs",color:v?"inherit":n.colors.fadedText40})}),d(K,{"data-testid":"stNumberInputStepUp",onClick:W,disabled:!x||t,tabIndex:-1,children:d(j,{content:Y,size:"xs",color:x?"inherit":n.colors.fadedText40})})]})]}),rt&&d(kt,{clearable:R,children:d(Ct,{dirty:f,value:b??"",inForm:M,allowEnterToSubmit:nt})})]})},Kt=a.memo(Lt);export{Kt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as a,r as t,n as i,j as d,e}from"./index.
|
|
1
|
+
import{F as a,r as t,n as i,j as d,e}from"./index.01VsD2h1.js";import{D as c,a as l}from"./IFrameUtil.DefezniK.js";const m=a("iframe",{target:"eu9re3w0"})(({theme:o,disableScrolling:r})=>({width:"100%",height:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function n(o){return e(o)||o===""?void 0:o}function g({element:o}){const r=n(o.src),s=i(r)?void 0:n(o.srcdoc);return d(m,{className:"stIFrame","data-testid":"stIFrame",allow:l,disableScrolling:!o.scrolling,src:r,srcDoc:s,scrolling:o.scrolling?"auto":"no",sandbox:c,title:"st.iframe",tabIndex:o.tabIndex??void 0})}const F=t.memo(g);export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as s,r as p,Y as x,l as b,j as i,a as k,P as v,o as y,Z as g,q as L}from"./index.
|
|
1
|
+
import{F as s,r as p,Y as x,l as b,j as i,a as k,P as v,o as y,Z as g,q as L}from"./index.01VsD2h1.js";import{m as C}from"./iconPosition.5dHEZYw2.js";const S=s("div",{target:"e175gajv0"})({display:"flex",flexDirection:"column",width:"100%"}),P=s("a",{target:"e175gajv1"})(({disabled:e,isCurrentPage:r,theme:o})=>({textDecoration:"none",width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:o.spacing.sm,borderRadius:o.radii.default,paddingLeft:o.spacing.sm,paddingRight:o.spacing.sm,marginTop:o.spacing.threeXS,marginBottom:o.spacing.threeXS,lineHeight:o.lineHeights.menuItem,backgroundColor:r?o.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:r?o.colors.darkenedBgMix25:o.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"@media print":{paddingLeft:o.spacing.none},...e?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed","&:hover":{color:o.colors.fadedText40,backgroundColor:o.colors.transparent}}:{}})),T=s("span",{target:"e175gajv2"})(({disabled:e,theme:r})=>({color:r.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...e?{borderColor:r.colors.borderColor,backgroundColor:r.colors.transparent,color:r.colors.fadedText40,cursor:"not-allowed"}:{}}));function h(e){let r=e.page;if(e.queryString)if(e.external)try{const o=new URL(e.page);new URLSearchParams(e.queryString).forEach((t,a)=>o.searchParams.append(a,t)),r=o.toString()}catch{const[o,n]=r.split("#");r=o+(o.includes("?")?"&":"?")+e.queryString+(n?"#"+n:"")}else r+=(r.includes("?")?"&":"?")+e.queryString;return r}function w(e){const{onPageChange:r,currentPageScriptHash:o}=p.useContext(x),{colors:n}=b(),{disabled:t,element:a}=e,l=o===a.pageScriptHash,u=d=>{a.external?t&&d.preventDefault():(d.preventDefault(),t||r(a.pageScriptHash,a.queryString))},c=C(a.iconPosition),f=h(a);return i("div",{className:"stPageLink","data-testid":"stPageLink",children:i(k,{help:a.help,placement:v.TOP_RIGHT,containerWidth:!0,children:i(S,{children:y(P,{"data-testid":"stPageLink-NavLink",disabled:t,isCurrentPage:l,href:f,target:a.external?"_blank":"",rel:"noreferrer",onClick:u,children:[a.icon&&c==="left"&&i(g,{size:"lg",color:t?n.fadedText40:n.bodyText,iconValue:a.icon}),i(T,{disabled:t,children:i(L,{source:a.label,allowHTML:!1,isLabel:!0,boldLabel:l,largerLabel:!0,disableLinks:!0})}),a.icon&&c==="right"&&i(g,{size:"lg",color:t?n.fadedText40:n.bodyText,iconValue:a.icon})]})})})})}const j=p.memo(w);export{j as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{F as c,a4 as l,r as i,j as a,b4 as p}from"./index.
|
|
1
|
+
import{F as c,a4 as l,r as i,j as a,b4 as p}from"./index.01VsD2h1.js";import{P as d,R as f}from"./Particles.2-EdjYhR.js";const g=""+new URL("../media/flake-0.DgWaVvm5.png",import.meta.url).href,u=""+new URL("../media/flake-1.B2r5AHMK.png",import.meta.url).href,E=""+new URL("../media/flake-2.BnWSExPC.png",import.meta.url).href,o=150,s=150,S=10,w=90,x=4e3,e=(t,n=0)=>Math.random()*(t-n)+n,_=()=>l(`from{transform:translateY(0)
|
|
2
2
|
rotateX(`,e(360),`deg)
|
|
3
3
|
rotateY(`,e(360),`deg)
|
|
4
4
|
rotateZ(`,e(360),"deg);}to{transform:translateY(calc(100vh + ",o,`px))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,E as B,_ as X,l as $,e as L,R as Q,Q as K,bf as j,bg as z,bh as Y,bi as Z,n as k,bj as M,W as P,X as q,k as ee,ba as te,bk as ne,j as A,o as re,b3 as se}from"./index.
|
|
1
|
+
import{r as a,E as B,_ as X,l as $,e as L,R as Q,Q as K,bf as j,bg as z,bh as Y,bi as Z,n as k,bj as M,W as P,X as q,k as ee,ba as te,bk as ne,j as A,o as re,b3 as se}from"./index.01VsD2h1.js";import{w as oe,E as ae}from"./withFullScreenWrapper.Ch22PgdD.js";import{a as _,S as H,T as ce}from"./Toolbar.CowuXIFr.js";import{R as ie}from"./index.BMPclSge.js";import{a as J,c as le,b as ue,e as fe,t as de,S as me,d as pe}from"./embed.DJJvCVz2.js";import{u as he}from"./FormClearHelper.By4vKj6A.js";import{T as ge}from"./TableChart.esm.MOwyTUPh.js";import"./moment.C7qA8nIE.js";import"./pandasStylerUtils.BY9qaz81.js";import"./numbro.B9_PXfzp.js";import"./_baseIndexOf.BTknn6Gb.js";import"./index.8HslT92O.js";import"./main.BEfv2Y8-.js";import"./throttle.DSR3q89S.js";import"./formatNumber.Cxr2q_Sk.js";import"./sprintf.DpPCfzXw.js";import"./formatMoment.C6Hwn6X5.js";import"./checkbox.Dkt2TQVS.js";import"./createDownloadLinkElement.BaE-_v8I.js";import"./toConsumableArray.C9lVwnAo.js";import"./FileDownload.esm.BuUS-pfi.js";import"./_arrayIncludes.B19Iyn2B.js";import"./threshold.CUNQbqMA.js";import"./value.DaKxGC7O.js";import"./timer.BZio6gjG.js";var U=a.forwardRef(function(n,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(B,X({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},n,{ref:e}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"}))});U.displayName="InsertChart";const Se=20;function ye(n){"params"in n&&"encoding"in n&&n.params.forEach(e=>{"select"in e&&(["interval","point"].includes(e.select)&&(e.select={type:e.select}),"type"in e.select&&e.select.type==="point"&&!("encodings"in e.select)&&L(e.select.encodings)&&(e.select.encodings=Object.keys(n.encoding)))})}const be=(n,e,s,r,u,l,f,p)=>{const t=JSON.parse(n);if(r==="streamlit"?t.config=J(t.config,l):t.usermeta?.embedOptions?.theme==="streamlit"?(t.config=J(t.config,l),t.usermeta.embedOptions.theme=void 0):t.config=le(t.config,l),t.title&&(typeof t.title=="string"&&(t.title={text:t.title}),t.title.limit=t.title.limit??Math.max(f-40,0)),s&&(t.height=p),e&&(t.width=f,"vconcat"in t&&t.vconcat.forEach(o=>{o===null||typeof o!="object"||"hconcat"in o||"vconcat"in o||"concat"in o||"layer"in o||(o.width=f)})),t.padding||(t.padding={}),L(t.padding.bottom)&&(t.padding.bottom=Se),t.datasets)throw new Error("Datasets should not be passed as part of the spec");return u.length>0&&ye(t),t},we=(n,e,s,r,u)=>{const l=$(),{id:f,formId:p,spec:t,data:o,datasets:c,vegaLiteTheme:d,selectionMode:i}=n,h=a.useMemo(()=>i,[JSON.stringify(i)]),S=a.useMemo(()=>be(t,r,u,d,h,l,e,s),[t,r,u,d,h,l,e,s]);return{id:f,formId:p,vegaLiteTheme:d,spec:S,selectionMode:h,data:o,datasets:c,useContainerWidth:r}},Ce={DATAFRAME_INDEX:"(index)"};function Ee(n){return!n||n.dimensions.numDataRows===0?null:F(n)}function Ne(n){const e=I(n);if(L(e))return null;const s={};for(const[r,u]of Object.entries(e))s[r]=F(u);return s}function I(n){if(n?.length===0)return null;const e={};return n.forEach(s=>{if(!s)return;const r=s.hasName?s.name:null;e[r]=s.data}),e}function F(n,e=0){if(n.dimensions.numDataRows===0)return[];const s=[],{numDataRows:r,numDataColumns:u,numIndexColumns:l}=n.dimensions,f=n.columnTypes[0]??void 0,p=f?.type===Q.INDEX&&(K(f)||j(f)||z(f));for(let t=e;t<r;t++){const o={};if(p){const{content:c}=n.getCell(t,0);o[Ce.DATAFRAME_INDEX]=typeof c=="bigint"?Number(c):c}for(let c=0;c<u;c++){const d=c+l,{content:i,contentType:h}=n.getCell(t,d);if((i instanceof Date||typeof i=="number"&&Number.isFinite(i))&&(j(h)||z(h))&&!Y(h)){const S=new Date(i).getTimezoneOffset()*60*1e3;o[n.columnNames[0][d]]=i.valueOf()+S}else o[n.columnNames[0][d]]=typeof i=="bigint"?Number(i):i}s.push(o)}return s}const De=150,Ve=P.getLogger("useVegaLiteSelections"),Oe=(n,e,s)=>{const{id:r,formId:u,selectionMode:l}=n,f=a.useCallback(t=>{l.forEach(c=>{t.addSignalListener(c,Z(De,(d,i)=>{const h=t.getState({data:(E,v)=>l.some(g=>`${g}_store`===E),recurse:!1});k(h)&&e.setElementState(r,"viewState",h);let S=i;"vlPoint"in i&&"or"in i.vlPoint&&(S=i.vlPoint.or);const V={id:r,formId:u},N=JSON.parse(e.getStringValue(V)||"{}"),D={selection:{...N?.selection||{},[d]:S||{}}};M(N,D)||e.setStringValue(V,JSON.stringify(D),{fromUi:!0},s)}))});const o=e.getElementState(r,"viewState");if(k(o))try{return t.setState(o)}catch(c){Ve.warn("Failed to restore view state",c)}return t},[r,l,e,u,s]),p=a.useCallback(()=>{const t={selection:{}};l.forEach(i=>{t.selection[i]={}});const o={id:r,formId:u},c=e.getStringValue(o),d=c?JSON.parse(c):t;M(d,t)||e.setStringValue(o,JSON.stringify(t),{fromUi:!0},s)},[r,u,s,l,e]);return{maybeConfigureSelections:f,onFormCleared:p}},W="source",Te=P.getLogger("useVegaEmbed");function ve(n,e,s){const r=a.useRef(null),u=a.useRef(null),l=a.useRef(W),f=a.useRef(null),p=a.useRef([]),t=a.useRef(null),o=a.useRef([]),[c,d]=a.useState(!1),{maybeConfigureSelections:i,onFormCleared:h}=Oe(n,e,s);he({widgetMgr:e,element:n,onFormCleared:h});const{data:S,datasets:V}=n;a.useEffect(()=>{t.current=S,o.current=V,r.current===null&&(f.current=S,p.current=V)},[S,V]);const N=a.useCallback(()=>{u.current&&u.current(),u.current=null,r.current=null},[]),D=a.useCallback(async(g,b)=>{if(g.current===null)throw new Error("Element missing.");d(!0);try{N();const w={ast:!0,expr:ue,tooltip:{disableDefaultStyle:!0},defaultStyle:!1,forceActionsMenu:!0},{vgSpec:y,view:R,finalize:T}=await fe(g.current,b,w);r.current=i(R),u.current=T;const m=Ne(o.current),C=m?Object.keys(m):[];if(C.length===1){const[x]=C;l.current=x}else C.length===0&&y.data&&(l.current=W);const O=Ee(t.current);if(O&&r.current.insert(l.current,O),m)for(const[x,G]of Object.entries(m))r.current.insert(x,G);return await r.current.runAsync(),await r.current.resize().runAsync(),f.current=t.current,p.current=o.current,r.current}finally{d(!1)}},[N,i]),E=a.useCallback((g,b,w,y)=>{if(!y||y.dimensions.numDataRows===0){try{g.remove(b,de)}catch{}return}if(!w||w.dimensions.numDataRows===0){g.insert(b,F(y));return}y.hash!==w.hash&&(g.data(b,F(y)),Te.info(`Had to clear the ${b} dataset before inserting data through Vega view.`))},[]),v=a.useCallback(async(g,b)=>{if(r.current===null||c)return null;const w=f.current,y=p.current;(w||g)&&E(r.current,l.current,w,g);const R=I(y)??{},T=I(b)??{};for(const[m,C]of Object.entries(T)){const O=m||l.current,x=R[O];E(r.current,O,x,C)}for(const m of Object.keys(R))!Object.hasOwn(T,m)&&m!==l.current&&E(r.current,m,null,null);return await r.current?.resize().runAsync(),f.current=g,p.current=b,r.current},[E,c]);return{createView:D,updateView:v,finalizeView:N}}function Re(n){try{const e=typeof n=="string"?JSON.parse(n):n;return!!(e.facet||e.encoding?.row||e.encoding?.column||e.encoding?.facet)}catch{return!1}}function Ae(n){try{const e=typeof n=="string"?JSON.parse(n):n;return!("vconcat"in e)||!Array.isArray(e.vconcat)?!1:e.vconcat.some(s=>s!==null&&typeof s=="object"&&("hconcat"in s||"vconcat"in s||"concat"in s||"layer"in s))}catch{return!1}}const xe=({disableFullscreenMode:n,element:e,fragmentId:s,widgetMgr:r,widthConfig:u,heightConfig:l})=>{const[f,p]=a.useState(!1),[t,o]=a.useState(!1),{expanded:c,height:d,width:i,expand:h,collapse:S}=q(ae),{width:V,height:N,elementRef:D}=ee([f],0),E=te(u)||e.useContainerWidth,v=ne(l),g=Re(e.spec),b=Ae(e.spec),w=we(e,g?i??0:V,(c?d:N)??0,c&&!b?!0:E,c?!0:v),{createView:y,updateView:R,finalizeView:T}=ve(w,r,s),{data:m,datasets:C,spec:O}=w;return a.useLayoutEffect(()=>(D.current!==null&&y(D,O),T),[y,T,O,i,d,f,D]),a.useEffect(()=>{R(m,C)},[m,C]),a.useEffect(()=>{m||C?.[0]?.data?o(!0):o(!1)},[m,C]),f?A(ie,{data:m??C[0]?.data,height:d??N??void 0,width:u??void 0,customToolbarActions:[A(_,{label:"Show chart",icon:U,onClick:()=>{p(!1)}},"show-chart")]}):re(H,{height:v?c?d:"100%":d,useContainerWidth:c?!0:E,children:[A(ce,{target:H,isFullScreen:c,onExpand:h,onCollapse:S,disableFullscreenMode:n,children:t&&A(_,{label:"Show data",icon:ge,onClick:()=>{p(!0)}})}),A(se,{styles:[me]}),A(pe,{"data-testid":"stVegaLiteChart",className:"stVegaLiteChart",useContainerWidth:E,useContainerHeight:v,ref:D})]})},Fe=oe(xe),st=a.memo(Fe);export{me as StyledVegaLiteChartTooltips,J as applyStreamlitTheme,st as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,E as y,_ as x,W as te,F as m,aj as St,ct as b,cu as Rt,o as E,j as a,P as it,az as z,aA as st,a0 as W,b as ee,B as re,Z as At,bX as oe,l as ne,k as ae,b8 as ie,cv as se,e as tt,bS as It,bT as le,ab as ce}from"./index.01VsD2h1.js";import{I as de,g as zt,F as j,E as ot,b as ue,s as pe,u as ge,a as fe}from"./FileHelper.Pf8URFng.js";import{u as he}from"./useWaveformController.D-KQLpLI.js";import{I as we}from"./InputInstructions.BiaGyIXk.js";import{u as me,T as Vt}from"./useTextInputAutoExpand.D7lViJSu.js";import{i as ve}from"./inputUtils.CptNuJwn.js";import{T as Ce}from"./TableChart.esm.MOwyTUPh.js";import{E as ye}from"./ErrorOutline.esm.D0HiUB0L.js";import{U as Mt}from"./UploadFileInfo.Dr-zDST7.js";import"./base-input.CHPo5oJ1.js";var Dt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),r.createElement("path",{d:"M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}))});Dt.displayName="Article";var Ft=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}))});Ft.displayName="Code";var Tt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"}))});Tt.displayName="Description";var Ut=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M9.17 6l2 2H20v10H4V6h5.17M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"}))});Ut.displayName="Folder";var Ht=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}))});Ht.displayName="Image";var Bt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 3l.01 10.55c-.59-.34-1.27-.55-2-.55a4.001 4.001 0 100 8c2.22 0 3.99-1.79 3.99-4V7h4V3h-6zm-1.99 16c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"}))});Bt.displayName="MusicNote";var Nt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M15 8v8H5V8h10m1-2H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4V7c0-.55-.45-1-1-1z"}))});Nt.displayName="Videocam";var Lt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z"}))});Lt.displayName="Add";var nt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0a.996.996 0 000-1.41l-6.59-6.59a.996.996 0 00-1.41 0l-6.6 6.58a.996.996 0 101.41 1.41L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1z"}))});nt.displayName="ArrowUpward";var Pt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.29 12.89a.996.996 0 11-1.41 1.41L12 13.41 9.11 16.3a.996.996 0 11-1.41-1.41L10.59 12 7.71 9.11A.996.996 0 119.12 7.7L12 10.59l2.89-2.89a.996.996 0 111.41 1.41L13.41 12l2.88 2.89z"}))});Pt.displayName="Cancel";var Wt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18 6.7l-8.48 8.48-3.54-3.54a.996.996 0 10-1.41 1.41l4.24 4.24c.39.39 1.02.39 1.41 0l9.18-9.18a.999.999 0 00-.01-1.42c-.37-.38-1-.38-1.39.01z"}))});Wt.displayName="Check";var Ot=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),r.createElement("path",{d:"M18.3 5.71a.996.996 0 00-1.41 0L12 10.59 7.11 5.7A.996.996 0 105.7 7.11L10.59 12 5.7 16.89a.996.996 0 101.41 1.41L12 13.41l4.89 4.89a.996.996 0 101.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"}))});Ot.displayName="Close";var $t=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm0 4c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"}))});$t.displayName="ErrorOutline";var Xt=r.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(y,x({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),r.createElement("rect",{width:24,height:24,fill:"none"}),r.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),r.createElement("path",{d:"M17.91 11c-.49 0-.9.36-.98.85C16.52 14.21 14.47 16 12 16s-4.52-1.79-4.93-4.15a.998.998 0 00-.98-.85c-.61 0-1.09.54-1 1.14.49 3 2.89 5.34 5.91 5.78V20c0 .55.45 1 1 1s1-.45 1-1v-2.08c3.02-.44 5.42-2.78 5.91-5.78.1-.6-.39-1.14-1-1.14z"}))});Xt.displayName="Mic";const X=te.getLogger("ChatInput"),xe=m("div",{target:"e1ek8sgn0"})({position:"relative",display:"flex",flexDirection:"column"}),be=m("div",{target:"e1ek8sgn1"})(({theme:t})=>({backgroundColor:t.colors.secondaryBg,border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,position:"relative",display:"flex",flexDirection:"column",alignItems:"stretch",flex:1,padding:t.spacing.lg,borderRadius:t.radii.default,boxSizing:"border-box",":focus-within":{borderColor:t.colors.primary}})),Ee=m("div",{target:"e1ek8sgn2"})(({theme:t})=>({position:"relative",display:"flex",flexDirection:"column",gap:t.spacing.sm})),Se=m("div",{target:"e1ek8sgn3"})({position:"relative",display:"flex",flexDirection:"column"}),Ie=m("div",{target:"e1ek8sgn4"})(({theme:t})=>({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:t.spacing.sm})),ze=m("div",{target:"e1ek8sgn5"})(({theme:t})=>({display:"flex",flexDirection:"row",alignItems:"flex-end",width:"100%",marginTop:"auto",gap:t.spacing.lg})),Ve=m("div",{target:"e1ek8sgn6"})(({theme:t})=>({display:"flex",flexDirection:"row",flex:"1 0 0",gap:t.spacing.sm,alignItems:"center"})),ke=m("div",{target:"e1ek8sgn7"})(({theme:t})=>({display:"flex",flexDirection:"row",gap:t.spacing.sm,alignItems:"center",position:"relative"})),Re=m("div",{target:"e1ek8sgn8"})(({theme:t})=>({position:"absolute",top:t.spacing.twoXS,right:t.spacing.lg,color:t.colors.fadedText60,fontSize:t.fontSizes.twoSm,textAlign:"right",whiteSpace:"nowrap",pointerEvents:"auto",cursor:"text",zIndex:t.zIndices.priority,"& .stChatInputInstructions":{position:"static"}})),F=m("button",{target:"e1ek8sgn9"})(({theme:t,disabled:e,hasError:o,primary:l,withVerticalOffset:c})=>{if(l)return{border:"none",backgroundColor:e?t.colors.darkenedBgMix15:t.colors.primary,borderRadius:t.radii.button,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,marginBottom:c?t.sizes.chatInputButtonVerticalOffset:void 0,padding:t.spacing.xs,width:t.sizes.chatInputPrimaryButtonSize,height:t.sizes.chatInputPrimaryButtonSize,color:e?t.colors.fadedText40:t.colors.white,cursor:e?"not-allowed":"pointer",transition:"background-color 200ms ease","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:St(t)},"&:hover":{backgroundColor:e?t.colors.darkenedBgMix15:t.colors.primary}};const f=()=>o?t.colors.redTextColor:e?t.colors.fadedText40:t.colors.fadedText60;return{border:"none",backgroundColor:t.colors.transparent,borderRadius:t.radii.default,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.none,color:f(),pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{boxShadow:St(t)},"&:hover":{color:o?t.colors.redColor:t.colors.bodyText},"&:active":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.fadedText40,cursor:"not-allowed"},"& svg":{width:t.iconSizes.lg,height:t.iconSizes.lg}}}),Ae=m("div",{target:"e1ek8sgn10"})(({isRecording:t})=>({display:t?"flex":"none",flex:1,alignItems:"center",minWidth:0})),Me=m("div",{target:"e1ek8sgn11"})(({theme:t})=>({position:"relative",width:"100%",minHeight:t.sizes.minElementHeight,borderRadius:t.radii.default,overflow:"hidden","& > div":{position:"absolute",inset:0}})),jt=(t,e)=>e===b.Directory?{...t,webkitdirectory:"",multiple:!0}:t,De=(t,e)=>{if(!e||e.length===0)return!0;const o=t.name.toLowerCase(),l=o.lastIndexOf(".");if(l===-1||l===o.length-1)return e.some(d=>d===""||d===".");const c=o.substring(l),f=o.substring(l+1);return e.some(d=>{const v=d.toLowerCase();return v.startsWith(".")?c===v:f===v})},Fe=(t,e)=>De(t,e)?{isValid:!0}:{isValid:!1,errorMessage:`${t.type||"This type of"} files are not allowed.`},at=t=>{switch(t){case b.None:return"a file";case b.Single:return"a file";case b.Multiple:return"files";case b.Directory:return"a directory";default:return Rt(t),"a file"}},Te=m("div",{target:"e8ata110"})(({theme:t})=>({backgroundColor:t.colors.transparent,position:"absolute",inset:0,zIndex:t.zIndices.priority,borderRadius:t.radii.chatInput})),Ue=m("div",{target:"e8ata111"})(({theme:t})=>({position:"absolute",inset:0,border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:t.fontWeights.bold,pointerEvents:"none",zIndex:t.zIndices.priority})),He=m("div",{target:"e8ata112"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Be=m("div",{target:"e8ata113"})(({theme:t})=>({lineHeight:t.lineHeights.tight})),Ne=m("div",{target:"e8ata114"})(({theme:t})=>({display:"flex",flexWrap:"wrap",gap:t.spacing.sm})),Le=m("div",{target:"e8ata115"})({flex:"0 0 auto",maxWidth:"100%"}),Pe=m("div",{target:"e8ata116"})(({theme:t,isError:e,isClickable:o})=>({position:"relative",display:"inline-flex",alignItems:"center",width:"fit-content",minWidth:"9rem",maxWidth:"100%",backgroundColor:e?t.colors.redBackgroundColor:t.colors.bgColor,padding:t.spacing.twoXS,paddingRight:t.spacing.twoXL,borderRadius:t.radii.default,gap:t.spacing.sm,cursor:o?"pointer":"default"})),We=m("div",{target:"e8ata117"})({display:"flex",flexDirection:"column",minWidth:0}),Oe=m("div",{target:"e8ata118"})(({theme:t,fileStatus:e})=>({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.radii.default,width:t.sizes.chatInputFileIconSize,height:t.sizes.chatInputFileIconSize,flexShrink:0,...e==="uploaded"&&{backgroundColor:t.colors.bodyText,color:t.colors.bgColor},...e==="uploading"&&{backgroundColor:t.colors.fadedText10,color:t.colors.fadedText60},...e==="error"&&{backgroundColor:t.colors.redBackgroundColor,color:t.colors.redTextColor}})),$e=m("div",{target:"e8ata119"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploading"?t.colors.fadedText60:t.colors.bodyText})),Xe=m("div",{target:"e8ata1110"})(({theme:t})=>({color:t.colors.fadedText60,fontSize:t.fontSizes.sm})),je=m("small",{target:"e8ata1111"})(({theme:t})=>({position:"absolute",top:t.spacing.twoXS,right:t.spacing.twoXS,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,"& button":{display:"flex",alignItems:"center",justifyContent:"center",width:"fit-content",height:"fit-content",minHeight:"unset",minWidth:"unset",maxHeight:"unset",maxWidth:"unset",borderRadius:"50%",backgroundColor:"transparent",color:t.colors.fadedText20,padding:0,overflow:"hidden",boxSizing:"border-box",lineHeight:0,"&:hover":{backgroundColor:"transparent",color:t.colors.fadedText40}}})),_e=m("span",{target:"e8ata1112"})({position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}),Ke=({getRootProps:t,getInputProps:e,acceptFile:o,disabled:l})=>{const c=jt(e(),o),f=t({tabIndex:-1});return E(He,{"data-testid":"stChatInputFileUploadButton",disabled:l,...f,children:[a("input",{...c}),a(st,{content:`Upload or drag and drop ${at(o)}`,placement:it.TOP,onMouseEnterDelay:500,children:a(F,{disabled:l,"aria-label":`Upload ${at(o)}`,children:a(z,{content:Lt,size:"xl",color:"inherit"})})})]})},Ge=r.memo(Ke),Ye=({getRootProps:t,getInputProps:e,acceptFile:o})=>{const l=jt(e(),o);return E(W,{children:[a(Te,{...t(),children:a("input",{...l})}),a(Ue,{children:`Drag and drop ${at(o)} here`})]})},qe=r.memo(Ye),Ze=new Set(["jpg","jpeg","png","gif","webp","svg","bmp"]),Je=new Set(["pdf"]),Qe=new Set(["csv","tsv","xlsx","xls"]),tr=new Set(["txt","md","json","xml","yaml","yml"]),er=new Set(["py","js","ts","jsx","tsx","css","html","java","cpp","c","go","rs","rb","php","swift","kt","scala","sh","bash","sql"]),rr=new Set(["mp3","wav","m4a","ogg","flac","aac"]),or=new Set(["mp4","webm","mov","avi","mkv","wmv"]),nr=new Set(["zip","tar","gz","rar","7z","bz2"]);function ar(t){const e=t.lastIndexOf(".");return e===-1||e===t.length-1?"":t.slice(e+1).toLowerCase()}function ir(t){const e=ar(t);return Ze.has(e)?Ht:Je.has(e)?Dt:Qe.has(e)?Ce:tr.has(e)?Tt:er.has(e)?Ft:rr.has(e)?Bt:or.has(e)?Nt:nr.has(e)?Ut:de}const sr=36;function lr(t,e=sr){if(t.length<=e)return t;const o=t.lastIndexOf(".");if(!(o>0&&o<t.length-1)){const h=Math.floor((e-3)/2),g=h>0?t.slice(-h):"";return`${t.slice(0,h)}...${g}`}const c=t.slice(o),f=t.slice(0,o),d=e-c.length-3;if(d<=0){const h=Math.floor((e-3)/2),g=h>0?t.slice(-h):"";return`${t.slice(0,h)}...${g}`}const v=Math.ceil(d/2),C=Math.floor(d/2),u=C>0?f.slice(-C):"";return`${f.slice(0,v)}...${u}${c}`}const cr=({fileInfo:t})=>{const{type:e}=t.status;switch(e){case"uploading":return a(At,{iconValue:"spinner",testid:"stChatInputFileIconSpinner",size:"lg"});case"error":return a(z,{content:ye,size:"lg",testid:"stChatInputFileIconError"});case"uploaded":return a(z,{content:ir(t.name),size:"lg"});default:return Rt(e),null}},dr=({fileInfo:t,onDelete:e,onRetry:o})=>{const l=t.status.type,c=l==="error",f=l==="uploading",d=c&&o!==void 0&&t.file!==void 0,v=r.useId(),C=t.status.type==="error"?t.status.errorMessage:"Upload failed",u=r.useCallback(()=>{d&&o(t)},[d,o,t]),h=r.useCallback(k=>{d&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),o(t))},[d,o,t]),g=r.useCallback(k=>{k.stopPropagation(),e(t.id)},[e,t.id]),w=f?`Cancel upload of ${t.name}`:`Remove ${t.name}`,U=zt(t.size,j.Byte),_=`${t.name}, ${U}`,H=E(Pe,{className:"stChatInputFile","data-testid":"stChatInputFile",isError:c,isClickable:d,onClick:d?u:void 0,onKeyDown:d?h:void 0,title:d?"Click to retry upload":void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":_,"aria-invalid":c||void 0,"aria-describedby":c?v:void 0,children:[a(Oe,{fileStatus:l,children:a(cr,{fileInfo:t})}),E(We,{children:[a($e,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:lr(t.name)}),a(Xe,{children:zt(t.size,j.Byte)})]}),a(je,{"data-testid":"stChatInputDeleteBtn",children:a(ee,{onClick:g,kind:re.MINIMAL,"aria-label":w,children:a(z,{content:Pt,size:"md"})})}),c&&E(_e,{id:v,role:"alert",children:["Error: ",C]})]});return c?a(st,{content:C,placement:it.TOP,error:!0,children:H}):H},ur=r.memo(dr),pr=({items:t,onDelete:e,onRetry:o})=>a(Be,{"data-testid":"stChatUploadedFiles",children:a(Ne,{children:t.map(l=>a(Le,{children:a(ur,{fileInfo:l,onDelete:e,onRetry:o})},l.id))})}),gr=r.memo(pr),fr=(t,e,o)=>{const l=[],c=[];return t.forEach(f=>{if(f.size>o){c.push({file:f,errors:[{code:ot.FileTooLarge,message:`File is too large. Maximum size is ${o} bytes.`}]});return}const d=Fe(f,e.fileType);if(!d.isValid){c.push({file:f,errors:[{code:ot.FileInvalidType,message:d.errorMessage||"File type not allowed."}]});return}l.push(f)}),{accepted:l,rejected:c}},hr=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:o,uploadFile:l,addFiles:c,getNextLocalFileId:f,deleteExistingFiles:d,onUploadComplete:v,element:C})=>(u,h)=>{if(u.length>0){const{accepted:g,rejected:w}=fr(u,C,e);u=g,h=[...h,...w]}if(!t&&u.length===0&&h.length>1){const g=h.findIndex(w=>w.errors?.[0].code===ot.TooManyFiles);g>=0&&(u.push(h[g].file),h.splice(g,1))}if(!t&&u.length>0&&d(),o.fetchFileURLs(u).then(g=>{oe(g,u).forEach(([w,U])=>{l(w,U)})}).catch(g=>{c(u.map(w=>new Mt(w.name,w.size,f(),{type:"error",errorMessage:g},w)))}),h.length>0){const g=h.map(w=>ue(w,f(),e));c(g)}v()},wr=({getNextLocalFileId:t,addFiles:e,updateFile:o,uploadClient:l,element:c,onUploadProgress:f,onUploadComplete:d})=>(v,C)=>{const u=C.webkitRelativePath||C.name,h=new AbortController,g=new Mt(u,C.size,t(),{type:"uploading",abortController:h,progress:1},C);e([g]),l.uploadFile({formId:"",...c},v.uploadUrl,C,w=>f(w,g.id),h.signal).then(()=>d(g.id,v)).catch(w=>{w instanceof DOMException&&w.name==="AbortError"||o(g.id,g.setStatus({type:"error",errorMessage:w?w.toString():"Unknown error"}))})};function kt(t,e,o){return{Root:{style:{minHeight:t.sizes.chatInputTextareaMinHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0",...o}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:t.fontWeights.normal,lineHeight:t.lineHeights.inputWidget,"::placeholder":{color:t.colors.fadedText60},height:e.height,maxHeight:e.maxHeight,overflowY:"auto",paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingBottom:t.spacing.sm,paddingTop:t.spacing.sm,width:"100%"}}}}const et=(t,e,o)=>o.map(l=>l.id===t?e:l),rt=(t,e)=>e.find(o=>o.id===t);function mr({disabled:t,element:e,widgetMgr:o,fragmentId:l,uploadClient:c}){const f=ne(),{placeholder:d,maxChars:v}=e,C=r.useRef(0),u=r.useRef(null),h=r.useRef(!1),g=r.useRef(null),w=r.useRef(null),{width:U,elementRef:_}=ae(),{innerWidth:H,innerHeight:k}=ie(),[A,K]=r.useState(e.default),[R,M]=r.useState([]),[B,G]=r.useState(!1),[N,lt]=r.useState(!1),[Y,L]=r.useState(null),O=e.acceptAudio??!1;r.useEffect(()=>()=>{w.current&&w.current.abort()},[]);const T=me({textareaRef:u,dependencies:[d]}),P=r.useMemo(()=>R.some(n=>n.status.type==="uploading")?!1:A!==""||R.length>0,[R,A]),I=se(e.acceptFile),ct=pe(e.maxUploadSizeMb,j.Megabyte,j.Byte),dt=r.useCallback(n=>M(s=>[...s,...n]),[]),ut=r.useCallback(n=>{n.status.type==="uploading"&&n.status.abortController.abort(),n.status.type==="uploaded"&&n.status.fileUrls.deleteUrl&&c.deleteFile(n.status.fileUrls.deleteUrl).catch(s=>{X.error("Failed to delete file from server:",s)})},[c]),pt=r.useCallback(n=>{M(s=>{const p=rt(n,s);return tt(p)?s:(ut(p),s.filter(i=>i.id!==n))})},[ut]),q=r.useRef(null),_t=r.useCallback(n=>{!n.file||n.status.type!=="error"||(M(s=>s.filter(p=>p.id!==n.id)),q.current&&q.current([n.file],[]))},[]),gt=r.useCallback(()=>{const n=R.filter(s=>s.status.type==="uploaded").map(s=>{const{name:p,size:i,status:S}=s,{fileId:Q,fileUrls:Qt}=S;return new It({fileId:Q,fileUrls:Qt,name:p,size:i})});return new le({uploadedFileInfo:n})},[R]),ft=()=>C.current++,ht=hr({acceptMultipleFiles:I===b.Multiple||I===b.Directory,maxFileSize:ct,uploadClient:c,uploadFile:wr({getNextLocalFileId:ft,addFiles:dt,updateFile:(n,s)=>{M(p=>et(n,s,p))},uploadClient:c,element:e,onUploadProgress:(n,s)=>{M(p=>{const i=rt(s,p);if(tt(i)||i.status.type!=="uploading")return p;const S=Math.round(n.loaded*100/n.total);return i.status.progress===S?p:et(s,i.setStatus({type:"uploading",abortController:i.status.abortController,progress:S}),p)})},onUploadComplete:(n,s)=>{M(p=>{const i=rt(n,p);return tt(i)||i.status.type!=="uploading"?p:et(i.id,i.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}),p)})}}),addFiles:dt,getNextLocalFileId:ft,deleteExistingFiles:()=>R.forEach(n=>pt(n.id)),onUploadComplete:()=>{u.current&&u.current.focus()},element:e});q.current=ht;const{getRootProps:wt,getInputProps:mt}=ge({onDrop:ht,multiple:I===b.Multiple||I===b.Directory,accept:fe(e.fileType),maxSize:ct}),$=r.useCallback(n=>{if(u.current&&u.current.focus(),!P&&!n||t)return;const s=gt(),p={data:A,fileUploaderState:s,audioFileInfo:n};o.setChatInputValue(e,p,{fromUi:!0},l),M([]),K(""),T.clearScrollHeight()},[P,t,A,gt,o,e,l,T]),vt=r.useCallback(async n=>{const s=new Date().toISOString().replace(/[:.]/g,"-"),p=new File([n],`audio-${s}.wav`,{type:"audio/wav"});try{lt(!0);const i=await c.fetchFileURLs([p]);if(i.length===0)throw new Error("Failed to get upload URL for audio file");const S=i[0];w.current=new AbortController,await c.uploadFile({formId:"",...e},S.uploadUrl,p,()=>{},w.current.signal);const Q=new It({fileId:S.fileId,fileUrls:S,name:p.name,size:p.size});$(Q)}catch(i){const S="Recording failed";X.error("Audio upload failed:",i),L(S),u.current&&u.current.focus()}finally{lt(!1)}},[c,e,$]),Kt=r.useMemo(()=>({onApprove:vt,onPermissionDenied:()=>{const n="Microphone access denied";L(n),X.error("Permission denied:",n)},onError:n=>{L("Recording failed"),X.error("Recording error:",n)},onRecordStart:()=>{L(null)}}),[vt]),V=he({containerRef:g,sampleRate:e.audioSampleRate??void 0,events:Kt}),Z=r.useCallback(()=>{$()},[$]),Ct=n=>{const{metaKey:s,ctrlKey:p,shiftKey:i}=n;ve(n)&&!i&&!p&&!s&&(n.preventDefault(),Z())},yt=n=>{const{value:s}=n.target;v!==0&&s.length>v||(K(s),T.updateScrollHeight(),Y&&L(null))},xt=r.useCallback(async n=>{n.preventDefault(),n.stopPropagation(),!(!O||t||V.state==="recording")&&await V.start()},[O,t,V]),Gt=r.useCallback(()=>{V.cancel(),u.current&&u.current.focus()},[V]),bt=r.useCallback(async()=>{const{blob:n}=await V.stop();await V.approve(n)},[V]),Et=r.useCallback(n=>{xt(n)},[xt]),Yt=r.useCallback(()=>{bt()},[bt]),qt=r.useCallback(()=>{u.current&&u.current.focus()},[]);r.useEffect(()=>{if(e.setValue&&!h.current){h.current=!0;const n=e.value||"";K(n)}},[e.setValue,e.value]),r.useEffect(()=>{h.current=!1},[e]),r.useEffect(()=>{const n=i=>{i.preventDefault(),i.stopPropagation(),!B&&i.dataTransfer?.types.includes("Files")&&G(!0)},s=i=>{i.preventDefault(),i.stopPropagation(),B&&(i.clientX<=0&&i.clientY<=0||i.clientX>=H&&i.clientY>=k)&&G(!1)},p=i=>{i.preventDefault(),i.stopPropagation(),B&&G(!1)};return window.addEventListener("dragover",n),window.addEventListener("drop",p),window.addEventListener("dragleave",s),()=>{window.removeEventListener("dragover",n),window.removeEventListener("drop",p),window.removeEventListener("dragleave",s)}},[B,H,k]);const Zt=I!==b.None&&B,D=V.state==="recording",Jt=I===b.None&&!O&&!D,J=!D&&U>ce(f.breakpoints.hideWidgetDetails)&&v>0;return a(xe,{className:"stChatInput","data-testid":"stChatInput",ref:_,children:E(be,{extended:T.isExtended||D,children:[J&&a(Re,{onClick:qt,id:"stChatInputInstructions",children:a(we,{dirty:P,value:A,maxLength:v,type:"chat",inForm:!1,className:"stChatInputInstructions"})}),Jt?E(ze,{children:[a(Vt,{inputRef:u,value:A,placeholder:d,onChange:yt,onKeyDown:Ct,"aria-label":d,disabled:t,rows:1,"aria-describedby":J?"stChatInputInstructions":void 0,overrides:kt(f,T,{flex:1})}),a(F,{onClick:Z,disabled:!P||t,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,withVerticalOffset:!0,children:a(z,{content:nt,size:"lg",color:"inherit"})})]}):E(W,{children:[E(Ee,{children:[Zt&&a(qe,{getRootProps:wt,getInputProps:mt,acceptFile:I}),I!==b.None&&R.length>0&&a(gr,{items:[...R],onDelete:pt,onRetry:_t}),E(Se,{children:[a(Ae,{isRecording:D,children:a(Me,{ref:g})}),!D&&a(Vt,{inputRef:u,value:A,placeholder:d,onChange:yt,onKeyDown:Ct,"aria-label":d,disabled:t,rows:1,"aria-describedby":J?"stChatInputInstructions":void 0,overrides:kt(f,T,{width:"100%"})})]})]}),E(Ie,{children:[a(Ve,{children:I!==b.None&&!D&&a(Ge,{getRootProps:wt,getInputProps:mt,acceptFile:I,disabled:t})}),a(ke,{children:D?E(W,{children:[a(F,{onClick:Gt,disabled:t,"data-testid":"stChatInputCancelButton","aria-label":"Cancel recording",children:a(z,{content:Ot,size:"lg",color:"inherit"})}),a(F,{onClick:Yt,disabled:t||N,"data-testid":"stChatInputApproveButton","aria-label":"Submit recording",children:N?a(At,{size:"lg",iconValue:"spinner"}):a(z,{content:Wt,size:"lg",color:"inherit"})})]}):E(W,{children:[O&&a(W,{children:Y?a(st,{content:Y,placement:it.TOP,error:!0,children:a(F,{onClick:Et,disabled:t||N,hasError:!0,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(z,{content:$t,size:"xl",color:"inherit"})})}):a(F,{onClick:Et,disabled:t||N,"data-testid":"stChatInputMicButton","aria-label":"Start recording",children:a(z,{content:Xt,size:"xl",color:"inherit"})})}),a(F,{onClick:Z,disabled:!P||t||N,"data-testid":"stChatInputSubmitButton","aria-label":"Send message",primary:!0,children:a(z,{content:nt,size:"lg",color:"inherit"})})]})})]})]})]})})}const kr=r.memo(mr);export{kr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as T,r as i,V as b,a3 as L,j as p,W as N}from"./index.
|
|
1
|
+
import{F as T,r as i,V as b,a3 as L,j as p,W as N}from"./index.01VsD2h1.js";const U=T("iframe",{target:"e655cq30"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"})),R=N.getLogger("Video"),A={width:"100%"};function O({element:r,endpoints:s,elementMgr:f}){const n=i.useRef(null),{type:v,url:c,startTime:a,subtitles:l,endTime:o,loop:d,autoplay:m,muted:E}=r;let y=b(c);const S=i.useMemo(()=>{if(!r.id)return!0;const e=f.getElementState(r.id,"preventAutoplay");return e||f.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,f]),g=i.useMemo(()=>JSON.stringify(l?l.map(e=>s.buildMediaURL(`${e.url}`)):[]),[l,s]);i.useEffect(()=>{const e=JSON.parse(g);e.length!==0&&e.forEach(t=>{s.checkSourceUrlResponse(t,"Video Subtitle")})},[g,s]),i.useEffect(()=>{n.current&&(n.current.currentTime=a)},[a]),i.useEffect(()=>{const e=n.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),i.useEffect(()=>{const e=n.current;if(!e)return;let t=!1;const u=()=>{o>0&&e.currentTime>=o&&(d?(e.currentTime=a||0,e.play()):t||(t=!0,e.pause()))};return o>0&&e.addEventListener("timeupdate",u),()=>{e&&o>0&&e.removeEventListener("timeupdate",u)}},[o,d,a]),i.useEffect(()=>{const e=n.current;if(!e)return;const t=()=>{d&&(e.currentTime=a||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[d,a]);const V=e=>{const t=new URL(e);if(a&&!isNaN(a)&&t.searchParams.append("start",a.toString()),o&&!isNaN(o)&&t.searchParams.append("end",o.toString()),d){t.searchParams.append("loop","1");const u=t.pathname.split("/").pop();u&&t.searchParams.append("playlist",u)}return m&&t.searchParams.append("autoplay","1"),E&&t.searchParams.append("mute","1"),t.toString()};if(v===L.Type.YOUTUBE_IFRAME)return p(U,{className:"stVideo","data-testid":"stVideo",title:c,src:V(c),allow:"autoplay; encrypted-media",allowFullScreen:!0});const h=e=>{const t=e.currentTarget.src;R.error(`Client Error: Video source error - ${t}`),s.sendClientErrorToHost("Video","Video source failed to load","onerror triggered",t)};return p("video",{className:"stVideo","data-testid":"stVideo",ref:n,controls:!0,muted:E,autoPlay:m&&!S,src:s.buildMediaURL(c),style:A,crossOrigin:y,onError:h,children:l?.map((e,t)=>p("track",{kind:"captions",src:s.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0,"data-testid":"stVideoSubtitle"},t))})}const $=i.memo(O);export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as f,r as a,l as m,o as x,j as i,Z as v,q as L,$ as r,a0 as R,m as C,n as k,a1 as B,a2 as E}from"./index.
|
|
1
|
+
import{F as f,r as a,l as m,o as x,j as i,Z as v,q as L,$ as r,a0 as R,m as C,n as k,a1 as B,a2 as E}from"./index.01VsD2h1.js";const z=f("button",{target:"e1a81sb30"})(({theme:o})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,color:o.colors.fadedText60,backgroundColor:o.colors.transparent,fontFamily:"inherit",margin:o.spacing.none,border:"none",boxShadow:"none",padding:o.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:o.colors.primary}})),H=f("div",{target:"e1a81sb31"})(({theme:o})=>({display:"flex",flexDirection:"row",gap:o.spacing.lg,"> span":{marginTop:o.spacing.twoXS}})),D=f("div",{target:"e1a81sb32"})(({theme:o})=>({display:"flex",flexDirection:"column",gap:o.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,div:{display:"inline-flex"}}));function M(o){const t=C(o);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:o.spacing.md,width:o.sizes.toastWidth,marginTop:o.spacing.sm,borderTopLeftRadius:o.radii.default,borderTopRightRadius:o.radii.default,borderBottomLeftRadius:o.radii.default,borderBottomRightRadius:o.radii.default,paddingTop:o.spacing.lg,paddingBottom:o.spacing.lg,paddingLeft:o.spacing.twoXL,paddingRight:o.spacing.twoXL,backgroundColor:o.colors.bgColor,filter:t?"brightness(0.98)":"brightness(1.2)",color:o.colors.bodyText,boxShadow:t?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:o.colors.fadedText40,width:o.fontSizes.lg,height:o.fontSizes.lg,marginRight:`calc(-1 * ${o.spacing.lg} / 2)`,":hover":{color:o.colors.bodyText}}}}}function I(o){if(o.length>104){let s=o.replace(/^(.{104}[^\s]*).*/,"$1");return s.length>104&&(s=s.substring(0,104).split(" ").slice(0,-1).join(" ")),s.trim()}return o}function j({element:o}){const{body:t,icon:s,duration:d}=o,n=m(),c=I(t),l=t!==c,[e,T]=a.useState(!l),[b,S]=a.useState(0),y=a.useCallback(()=>{T(!e)},[e]),g=a.useMemo(()=>M(n),[n]),p=a.useMemo(()=>x(H,{expanded:e,children:[s&&i(v,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),x(D,{children:[i(L,{source:e?t:c,allowHTML:!1,isToast:!0}),l&&i(z,{"data-testid":"stToastViewButton",onClick:y,children:e?"view less":"view more"})]})]}),[l,e,t,s,c,y]);a.useEffect(()=>{if(n.inSidebar)return;const w=k(d)?d===0?0:d*1e3:4e3,u=r.info(p,{overrides:{...g},autoHideDuration:w});return S(u),()=>{r.update(u,{overrides:{Body:{style:{display:"none"}}}}),r.clear(u)}},[]),a.useEffect(()=>{r.update(b,{children:p,overrides:{...g}})},[b,p,g]);const h=i(E,{kind:B.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information."});return i(R,{children:n.inSidebar&&h})}const O=a.memo(j);export{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{x as v,r as l,y as q,z as S,A as p}from"./index.
|
|
1
|
+
import{x as v,r as l,y as q,z as S,A as p}from"./index.01VsD2h1.js";import{R as C,I as w,g as J,B as M}from"./base-input.CHPo5oJ1.js";function _(e){"@babel/helpers - typeof";return _=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(e)}var U=["Root","StartEnhancer","EndEnhancer"],Z=["startEnhancer","endEnhancer","overrides"];function f(){return f=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},f.apply(this,arguments)}function O(e,t){return V(e)||Q(e,t)||K(e,t)||G()}function G(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(e,t){if(e){if(typeof e=="string")return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}function j(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Q(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,u;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(b){a=!0,u=b}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}return n}}function V(e){if(Array.isArray(e))return e}function I(e,t){if(e==null)return{};var r=X(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(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 te(e,t,r){return t&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function re(e,t){if(typeof t!="function"&&t!==null)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&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function ne(e){var t=ae();return function(){var n=h(e),o;if(t){var a=h(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return oe(this,o)}}function oe(e,t){if(t&&(_(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ie=(function(e){re(r,e);var t=ne(r);function r(){var n;Y(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),d(y(n),"state",{isFocused:n.props.autoFocus||!1}),d(y(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),d(y(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return te(r,[{key:"render",value:function(){var o=this.props,a=o.startEnhancer,i=o.endEnhancer,u=o.overrides,b=u.Root,A=u.StartEnhancer,x=u.EndEnhancer,B=I(u,U),F=I(o,Z),T=v(b,C),g=O(T,2),$=g[0],N=g[1],z=v(A,w),E=O(z,2),D=E[0],W=E[1],H=v(x,w),P=O(H,2),L=P[0],k=P[1],c=J(this.props,this.state);return l.createElement($,f({"data-baseweb":"input"},c,N,{$adjoined:R(a,i),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),s(a)&&l.createElement(D,f({},c,W,{$position:S.start}),typeof a=="function"?a(c):a),l.createElement(M,f({},F,{overrides:B,adjoined:R(a,i),onFocus:this.onFocus,onBlur:this.onBlur})),s(i)&&l.createElement(L,f({},c,k,{$position:S.end}),typeof i=="function"?i(c):i))}}]),r})(l.Component);d(ie,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:q.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function R(e,t){return s(e)&&s(t)?p.both:s(e)?p.left:s(t)?p.right:p.none}function s(e){return!!(e||e===0)}export{ie as I};
|