streamlit-nightly 1.53.2.dev20260125__py3-none-any.whl → 1.53.2.dev20260128__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/commands/logo.py +81 -25
- streamlit/config.py +11 -0
- streamlit/deprecation_util.py +19 -1
- streamlit/elements/arrow.py +2 -1
- streamlit/elements/lib/built_in_chart_utils.py +2 -2
- streamlit/elements/lib/options_selector_utils.py +72 -22
- streamlit/elements/widgets/select_slider.py +123 -37
- streamlit/hello/plotting_demo.py +19 -12
- streamlit/proto/Logo_pb2.py +5 -3
- streamlit/proto/Logo_pb2.pyi +25 -1
- streamlit/proto/NewSession_pb2.py +24 -22
- streamlit/proto/NewSession_pb2.pyi +23 -1
- streamlit/proto/Slider_pb2.py +6 -6
- streamlit/proto/Slider_pb2.pyi +9 -1
- streamlit/runtime/app_session.py +19 -0
- streamlit/runtime/scriptrunner/script_runner.py +17 -0
- streamlit/runtime/scriptrunner_utils/script_run_context.py +13 -10
- streamlit/runtime/state/__init__.py +7 -1
- streamlit/runtime/state/common.py +13 -0
- streamlit/runtime/state/query_params.py +494 -6
- streamlit/runtime/state/session_state.py +178 -3
- streamlit/runtime/state/widgets.py +26 -1
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +299 -299
- streamlit/static/static/js/{ErrorOutline.esm.CIFYUdwC.js → ErrorOutline.esm.D71F8ziR.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DWVTnTHm.js → FileDownload.esm.yTkppsJy.js} +1 -1
- streamlit/static/static/js/{FileHelper.BPYQIPd1.js → FileHelper.hUOqtbwa.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.CypmvhYZ.js → FormClearHelper.DN8D_YXO.js} +1 -1
- streamlit/static/static/js/{InputInstructions.Bi62hDTQ.js → InputInstructions.DbssY6d4.js} +1 -1
- streamlit/static/static/js/{Particles.yebG0VuV.js → Particles.BznyVdfo.js} +1 -1
- streamlit/static/static/js/{ProgressBar.Dy9CI6w4.js → ProgressBar.C5uBOtcx.js} +1 -1
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.Btk92CPv.js → StreamlitSyntaxHighlighter.Nf1895x-.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.DBeVaFNt.js → TableChart.esm.DHKzVs3a.js} +1 -1
- streamlit/static/static/js/{Toolbar.DC2Tp-qb.js → Toolbar.CQsWYXer.js} +1 -1
- streamlit/static/static/js/{WidgetLabelHelpIconInline.3DnEd9BK.js → WidgetLabelHelpIconInline.6xCU76OE.js} +1 -1
- streamlit/static/static/js/{base-input.7Sj6pVk0.js → base-input.Cs-E6S71.js} +1 -1
- streamlit/static/static/js/{checkbox.CcUx3XuQ.js → checkbox.OTGupu18.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.DZuwkCqy.js → createDownloadLinkElement.DnBEQQbK.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.Dw-AewlN.js → data-grid-overlay-editor.COiiMi5r.js} +1 -1
- streamlit/static/static/js/{downloader.Bsx5M2Du.js → downloader.K0GUNeuj.js} +1 -1
- streamlit/static/static/js/embed.o8HvK3mH.js +193 -0
- streamlit/static/static/js/{es6.BpAqZaR_.js → es6.BHy5pqTP.js} +2 -2
- streamlit/static/static/js/{formatNumber.DjehVPVS.js → formatNumber.BK7h0k2z.js} +1 -1
- streamlit/static/static/js/{iconPosition.D02OPE-d.js → iconPosition.2YynQUxu.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.xtstqPd7.js → iframeResizer.contentWindow.D5h3hQuU.js} +1 -1
- streamlit/static/static/js/{index.5H98WqjT.js → index.5zqfJ-in.js} +1 -1
- streamlit/static/static/js/{index.B5tD5YeV.js → index.6c-qDsD7.js} +1 -1
- streamlit/static/static/js/{index.CA0RmxJF.js → index.8MlRyIxN.js} +1 -1
- streamlit/static/static/js/{index.DSSapl3Q.js → index.BIqcOZ_u.js} +1 -1
- streamlit/static/static/js/{index.DJjSqPAx.js → index.BPdmXoYW.js} +1 -1
- streamlit/static/static/js/{index.iXzAofuY.js → index.BZ-GJVxB.js} +2 -2
- streamlit/static/static/js/{index.CKUBdVQ9.js → index.BfMPq234.js} +1 -1
- streamlit/static/static/js/{index.B8-HOwf1.js → index.Bfo1cXfC.js} +1 -1
- streamlit/static/static/js/{index.-faJDV20.js → index.Bgf49D1Z.js} +1 -1
- streamlit/static/static/js/{index.CgARjn28.js → index.Bqmx23jK.js} +1 -1
- streamlit/static/static/js/{index.D6Z9hKJY.js → index.BtRWcqZV.js} +1 -1
- streamlit/static/static/js/{index.ZIA43eTF.js → index.BtuskCwg.js} +1 -1
- streamlit/static/static/js/{index.BV6XgCij.js → index.BzTVI_BY.js} +1 -1
- streamlit/static/static/js/{index.DDu_qTm0.js → index.C2EoeVjP.js} +1 -1
- streamlit/static/static/js/{index.8FPw0_gD.js → index.C65jHNhe.js} +1 -1
- streamlit/static/static/js/{index.D6J2UPzF.js → index.C6wyTXhz.js} +1 -1
- streamlit/static/static/js/{index.CGbvkEtg.js → index.C7wst9Tm.js} +1 -1
- streamlit/static/static/js/{index.BIcJe97b.js → index.COh5V_89.js} +1 -1
- streamlit/static/static/js/index.CSPY26T2.js +1 -0
- streamlit/static/static/js/{index.CEwnDCn9.js → index.CUkhn-vu.js} +1 -1
- streamlit/static/static/js/{index.DO2T-QzF.js → index.CX0KdFyR.js} +1 -1
- streamlit/static/static/js/{index.BDlI2pRp.js → index.CYhhEdja.js} +1 -1
- streamlit/static/static/js/{index.DgLRJfs3.js → index.CZf7Go1Z.js} +1 -1
- streamlit/static/static/js/{index.DZv5AoR1.js → index.Cb03y5I8.js} +1 -1
- streamlit/static/static/js/{index.BVhVdVeE.js → index.CdsyTabv.js} +1 -1
- streamlit/static/static/js/{index.JL0uGAeJ.js → index.CgVv04GM.js} +1 -1
- streamlit/static/static/js/index.CjRU8O1O.js +2 -0
- streamlit/static/static/js/{index.BqfJJr3c.js → index.CwtpGPHA.js} +1 -1
- streamlit/static/static/js/{index.iF5zYERg.js → index.CxWzt6oi.js} +1 -1
- streamlit/static/static/js/{index.m3dn5Bai.js → index.DBPWUJsj.js} +5 -5
- streamlit/static/static/js/{index.D9RL5sRp.js → index.DJfMW0Gy.js} +1 -1
- streamlit/static/static/js/{index.BOkpEbJS.js → index.DLUSo6de.js} +1 -1
- streamlit/static/static/js/{index.S-mjkUeF.js → index.DL_yE83J.js} +1 -1
- streamlit/static/static/js/{index.BK9S5qug.js → index.DVRCyxMp.js} +1 -1
- streamlit/static/static/js/{index.D_TIyPF4.js → index.Dc5-tFdw.js} +1 -1
- streamlit/static/static/js/index.DcngUOyD.js +2 -0
- streamlit/static/static/js/{index.B9gbSNsw.js → index.Dh3PJIlq.js} +1 -1
- streamlit/static/static/js/{index.BvZbnSMC.js → index.DlgcEr0f.js} +1 -1
- streamlit/static/static/js/{index.Bo1ztye0.js → index.DxGXuhh6.js} +1 -1
- streamlit/static/static/js/{index.x1B588Xu.js → index.DxfYCrPp.js} +1 -1
- streamlit/static/static/js/{index.CyDHwK5P.js → index.HmRK3HyC.js} +1 -1
- streamlit/static/static/js/{index.DdxofXV8.js → index.TjMWsKSH.js} +3 -3
- streamlit/static/static/js/{index.Bri1T2TS.js → index.VwDKazgt.js} +1 -1
- streamlit/static/static/js/{index.BB_iwaVr.js → index.aCorc3Yt.js} +34 -34
- streamlit/static/static/js/{index.CdRwiHPm.js → index.cfuZ69LI.js} +1 -1
- streamlit/static/static/js/{index.C9v49R-a.js → index.hlAfdSqC.js} +1 -1
- streamlit/static/static/js/{index.BGTMh3Uu.js → index.iUV9rb8C.js} +1 -1
- streamlit/static/static/js/{index.XFMDBL5n.js → index.q0ceUXt6.js} +1 -1
- streamlit/static/static/js/{input.VYKyGuhi.js → input.CXGIJ7D6.js} +1 -1
- streamlit/static/static/js/{main.u5Bb3MY7.js → main.CCVkbuxC.js} +1 -1
- streamlit/static/static/js/{memory.BOMt4yAV.js → memory.CNbnYs2A.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CihlAHgl.js → number-overlay-editor.CvI6wkld.js} +1 -1
- streamlit/static/static/js/{pandasStylerUtils.BuqSgXpk.js → pandasStylerUtils.CFSReOTm.js} +1 -1
- streamlit/static/static/js/{sandbox.COGR4pqz.js → sandbox.Bld0L3us.js} +1 -1
- streamlit/static/static/js/{styled-components.BEf3c4IJ.js → styled-components.BoUHK6TA.js} +1 -1
- streamlit/static/static/js/{throttle.Bl-XsA9N.js → throttle.ByDFm7WV.js} +1 -1
- streamlit/static/static/js/{timepicker.B-HgBYlK.js → timepicker.CN6CUZEL.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.BrQebwtE.js → toConsumableArray.DwMycSpg.js} +1 -1
- streamlit/static/static/js/uniqueId.DcCWa2cf.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.8WwISl9r.js → useBasicWidgetState.Bg0ZMUt5.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.D37LWdCR.js → useIntlLocale.DgBUDcPA.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.Bb_KqJvq.js → useTextInputAutoExpand.DDBezxks.js} +1 -1
- streamlit/static/static/js/{useUpdateUiValue.D1BLS5t7.js → useUpdateUiValue.Df1h6fXC.js} +1 -1
- streamlit/static/static/js/{useWaveformController.Ce0-qTws.js → useWaveformController.DbWw5MEk.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.BX2K3UVv.js → withCalculatedWidth.YaK0HIIP.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.CqfGs8T2.js → withFullScreenWrapper.CcWCKoY8.js} +1 -1
- streamlit/testing/v1/element_tree.py +23 -8
- streamlit/web/bootstrap.py +5 -2
- streamlit/web/server/server_util.py +22 -0
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260128.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260128.dist-info}/RECORD +120 -120
- streamlit/static/static/js/embed.C7by6AoE.js +0 -195
- streamlit/static/static/js/index.Bhy8EBYI.js +0 -2
- streamlit/static/static/js/index.C5ehUqNt.js +0 -2
- streamlit/static/static/js/index.m4WkwGMu.js +0 -1
- streamlit/static/static/js/uniqueId.8R4hbkYl.js +0 -1
- {streamlit_nightly-1.53.2.dev20260125.data → streamlit_nightly-1.53.2.dev20260128.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260128.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260128.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.53.2.dev20260125.dist-info → streamlit_nightly-1.53.2.dev20260128.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cF as Rt,cG as _t,cH as Ot,cI as _e,cJ as Mt,cK as Ft,cL as Bt,cM as Pt,cN as Ht,cO as At,c7 as fe,cP as Tt,cQ as $t,al as Ee,ag as Oe,aB as s,r as C,bB as g,bE as _,z as ge,l as Nt,cR as Dt,o as qe,j as T,P as jt,ac as Lt,cS as zt,p as Gt}from"./index.BB_iwaVr.js";import{u as Wt}from"./useBasicWidgetState.8WwISl9r.js";import{t as Ut,d as It}from"./throttle.Bl-XsA9N.js";import{W as Vt}from"./WidgetLabelHelpIconInline.3DnEd9BK.js";import"./FormClearHelper.CypmvhYZ.js";function xt(r){return typeof r=="function"?r:Rt}function qt(r,e){var t=_e(r)?_t:Ot;return t(r,xt(e))}function $(r,e){var t=_e(r)?Mt:Ft;return t(r,Bt(e))}const Xt=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"}));function Yt(r,e){return r&&Pt(r,xt(e))}const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));var Zt="[object String]";function Jt(r){return typeof r=="string"||!_e(r)&&Ht(r)&&At(r)==Zt}const Qt=Object.freeze(Object.defineProperty({__proto__:null,default:Jt},Symbol.toStringTag,{value:"Module"}));function Xe(r){return r===void 0}var R={},j={};const er=fe(Qt),Me=fe(Kt),tr=fe(Tt),rr=fe(Xt);var Ye;function nr(){if(Ye)return j;Ye=1,Object.defineProperty(j,"__esModule",{value:!0}),j.flattenNames=void 0;var r=er,e=h(r),t=Me,n=h(t),a=tr,i=h(a),o=rr,l=h(o);function h(p){return p&&p.__esModule?p:{default:p}}var c=j.flattenNames=function p(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=[];return(0,l.default)(u,function(f){Array.isArray(f)?p(f).map(function(v){return d.push(v)}):(0,i.default)(f)?(0,n.default)(f,function(v,b){v===!0&&d.push(b),d.push(b+"-"+v)}):(0,e.default)(f)&&d.push(f)}),d};return j.default=c,j}var L={};const ar=fe($t);var Ke;function ir(){if(Ke)return L;Ke=1,Object.defineProperty(L,"__esModule",{value:!0}),L.mergeClasses=void 0;var r=Me,e=i(r),t=ar,n=i(t),a=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var c=arguments[h];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p])}return l};function i(l){return l&&l.__esModule?l:{default:l}}var o=L.mergeClasses=function(h){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],p=h.default&&(0,n.default)(h.default)||{};return c.map(function(u){var d=h[u];return d&&(0,e.default)(d,function(f,v){p[v]||(p[v]={}),p[v]=a({},p[v],d[v])}),u}),p};return L.default=o,L}var z={},Ze;function or(){if(Ze)return z;Ze=1,Object.defineProperty(z,"__esModule",{value:!0}),z.autoprefix=void 0;var r=Me,e=n(r),t=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(o[c]=h[c])}return o};function n(o){return o&&o.__esModule?o:{default:o}}var a={borderRadius:function(l){return{msBorderRadius:l,MozBorderRadius:l,OBorderRadius:l,WebkitBorderRadius:l,borderRadius:l}},boxShadow:function(l){return{msBoxShadow:l,MozBoxShadow:l,OBoxShadow:l,WebkitBoxShadow:l,boxShadow:l}},userSelect:function(l){return{WebkitTouchCallout:l,KhtmlUserSelect:l,MozUserSelect:l,msUserSelect:l,WebkitUserSelect:l,userSelect:l}},flex:function(l){return{WebkitBoxFlex:l,MozBoxFlex:l,WebkitFlex:l,msFlex:l,flex:l}},flexBasis:function(l){return{WebkitFlexBasis:l,flexBasis:l}},justifyContent:function(l){return{WebkitJustifyContent:l,justifyContent:l}},transition:function(l){return{msTransition:l,MozTransition:l,OTransition:l,WebkitTransition:l,transition:l}},transform:function(l){return{msTransform:l,MozTransform:l,OTransform:l,WebkitTransform:l,transform:l}},absolute:function(l){var h=l&&l.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(l,h){var c=h[l];return c||{extend:l}}},i=z.autoprefix=function(l){var h={};return(0,e.default)(l,function(c,p){var u={};(0,e.default)(c,function(d,f){var v=a[f];v?u=t({},u,v(d)):u[f]=d}),h[p]=u}),h};return z.default=i,z}var G={},Je;function lr(){if(Je)return G;Je=1,Object.defineProperty(G,"__esModule",{value:!0}),G.hover=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=G.hover=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={hover:!1},b.handleMouseOver=function(){return b.setState({hover:!0})},b.handleMouseOut=function(){return b.setState({hover:!1})},b.render=function(){return t.default.createElement(p,{onMouseOver:b.handleMouseOver,onMouseOut:b.handleMouseOut},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d})(t.default.Component)};return G.default=l,G}var W={},Qe;function sr(){if(Qe)return W;Qe=1,Object.defineProperty(W,"__esModule",{value:!0}),W.active=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=W.active=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={active:!1},b.handleMouseDown=function(){return b.setState({active:!0})},b.handleMouseUp=function(){return b.setState({active:!1})},b.render=function(){return t.default.createElement(p,{onMouseDown:b.handleMouseDown,onMouseUp:b.handleMouseUp},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d})(t.default.Component)};return W.default=l,W}var xe={},et;function hr(){if(et)return xe;et=1,Object.defineProperty(xe,"__esModule",{value:!0});var r=function(t,n){var a={},i=function(l){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a[l]=h};return t===0&&i("first-child"),t===n-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),a};return xe.default=r,xe}var tt;function cr(){if(tt)return R;tt=1,Object.defineProperty(R,"__esModule",{value:!0}),R.ReactCSS=R.loop=R.handleActive=R.handleHover=R.hover=void 0;var r=nr(),e=d(r),t=ir(),n=d(t),a=or(),i=d(a),o=lr(),l=d(o),h=sr(),c=d(h),p=hr(),u=d(p);function d(v){return v&&v.__esModule?v:{default:v}}R.hover=l.default,R.handleHover=l.default,R.handleActive=c.default,R.loop=u.default;var f=R.ReactCSS=function(b){for(var m=arguments.length,E=Array(m>1?m-1:0),M=1;M<m;M++)E[M-1]=arguments[M];var k=(0,e.default)(E),A=(0,n.default)(b,k);return(0,i.default)(A)};return R.default=f,R}var Fe=cr();const y=Oe(Fe);var pr=function(e,t,n,a,i){var o=i.clientWidth,l=i.clientHeight,h=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,c=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,p=h-(i.getBoundingClientRect().left+window.pageXOffset),u=c-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var d=void 0;if(u<0?d=0:u>l?d=1:d=Math.round(u*100/l)/100,t.a!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}else{var f=void 0;if(p<0?f=0:p>o?f=1:f=Math.round(p*100/o)/100,a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}return null},Ce={},ur=function(e,t,n,a){if(typeof document>"u"&&!a)return null;var i=a?new a:document.createElement("canvas");i.width=n*2,i.height=n*2;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,n,n),o.translate(n,n),o.fillRect(0,0,n,n),i.toDataURL()):null},dr=function(e,t,n,a){var i=e+"-"+t+"-"+n+(a?"-server":"");if(Ce[i])return Ce[i];var o=ur(e,t,n,a);return Ce[i]=o,o},rt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},le=function(e){var t=e.white,n=e.grey,a=e.size,i=e.renderers,o=e.borderRadius,l=e.boxShadow,h=e.children,c=y({default:{grid:{borderRadius:o,boxShadow:l,absolute:"0px 0px 0px 0px",background:"url("+dr(t,n,a,i.canvas)+") center left"}}});return C.isValidElement(h)?s.cloneElement(h,rt({},h.props,{style:rt({},h.props.style,c.grid)})):s.createElement("div",{style:c.grid})};le.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var fr=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},gr=(function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}})();function br(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function nt(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function vr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Be=(function(r){vr(e,r);function e(){var t,n,a,i;br(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=nt(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=pr(c,a.props.hsl,a.props.direction,a.props.a,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleChange),window.removeEventListener("mouseup",a.handleMouseUp)},n),nt(a,i)}return gr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var n=this,a=this.props.rgb,i=y({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
1
|
+
import{cH as Rt,cI as _t,cJ as Ot,cK as _e,cL as Mt,cM as Ft,cN as Bt,cO as Pt,cP as Ht,cQ as At,c9 as fe,cR as Tt,cS as $t,al as Ee,ag as Oe,aB as s,r as C,bB as g,bE as _,z as ge,l as Nt,bS as Dt,o as qe,j as T,P as jt,ac as Lt,cT as zt,p as Gt}from"./index.aCorc3Yt.js";import{u as Wt}from"./useBasicWidgetState.Bg0ZMUt5.js";import{t as Ut,d as It}from"./throttle.ByDFm7WV.js";import{W as Vt}from"./WidgetLabelHelpIconInline.6xCU76OE.js";import"./FormClearHelper.DN8D_YXO.js";function xt(r){return typeof r=="function"?r:Rt}function qt(r,e){var t=_e(r)?_t:Ot;return t(r,xt(e))}function $(r,e){var t=_e(r)?Mt:Ft;return t(r,Bt(e))}const Xt=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"}));function Yt(r,e){return r&&Pt(r,xt(e))}const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));var Zt="[object String]";function Jt(r){return typeof r=="string"||!_e(r)&&Ht(r)&&At(r)==Zt}const Qt=Object.freeze(Object.defineProperty({__proto__:null,default:Jt},Symbol.toStringTag,{value:"Module"}));function Xe(r){return r===void 0}var R={},j={};const er=fe(Qt),Me=fe(Kt),tr=fe(Tt),rr=fe(Xt);var Ye;function nr(){if(Ye)return j;Ye=1,Object.defineProperty(j,"__esModule",{value:!0}),j.flattenNames=void 0;var r=er,e=h(r),t=Me,n=h(t),a=tr,i=h(a),o=rr,l=h(o);function h(p){return p&&p.__esModule?p:{default:p}}var c=j.flattenNames=function p(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d=[];return(0,l.default)(u,function(f){Array.isArray(f)?p(f).map(function(v){return d.push(v)}):(0,i.default)(f)?(0,n.default)(f,function(v,b){v===!0&&d.push(b),d.push(b+"-"+v)}):(0,e.default)(f)&&d.push(f)}),d};return j.default=c,j}var L={};const ar=fe($t);var Ke;function ir(){if(Ke)return L;Ke=1,Object.defineProperty(L,"__esModule",{value:!0}),L.mergeClasses=void 0;var r=Me,e=i(r),t=ar,n=i(t),a=Object.assign||function(l){for(var h=1;h<arguments.length;h++){var c=arguments[h];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p])}return l};function i(l){return l&&l.__esModule?l:{default:l}}var o=L.mergeClasses=function(h){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],p=h.default&&(0,n.default)(h.default)||{};return c.map(function(u){var d=h[u];return d&&(0,e.default)(d,function(f,v){p[v]||(p[v]={}),p[v]=a({},p[v],d[v])}),u}),p};return L.default=o,L}var z={},Ze;function or(){if(Ze)return z;Ze=1,Object.defineProperty(z,"__esModule",{value:!0}),z.autoprefix=void 0;var r=Me,e=n(r),t=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(o[c]=h[c])}return o};function n(o){return o&&o.__esModule?o:{default:o}}var a={borderRadius:function(l){return{msBorderRadius:l,MozBorderRadius:l,OBorderRadius:l,WebkitBorderRadius:l,borderRadius:l}},boxShadow:function(l){return{msBoxShadow:l,MozBoxShadow:l,OBoxShadow:l,WebkitBoxShadow:l,boxShadow:l}},userSelect:function(l){return{WebkitTouchCallout:l,KhtmlUserSelect:l,MozUserSelect:l,msUserSelect:l,WebkitUserSelect:l,userSelect:l}},flex:function(l){return{WebkitBoxFlex:l,MozBoxFlex:l,WebkitFlex:l,msFlex:l,flex:l}},flexBasis:function(l){return{WebkitFlexBasis:l,flexBasis:l}},justifyContent:function(l){return{WebkitJustifyContent:l,justifyContent:l}},transition:function(l){return{msTransition:l,MozTransition:l,OTransition:l,WebkitTransition:l,transition:l}},transform:function(l){return{msTransform:l,MozTransform:l,OTransform:l,WebkitTransform:l,transform:l}},absolute:function(l){var h=l&&l.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(l,h){var c=h[l];return c||{extend:l}}},i=z.autoprefix=function(l){var h={};return(0,e.default)(l,function(c,p){var u={};(0,e.default)(c,function(d,f){var v=a[f];v?u=t({},u,v(d)):u[f]=d}),h[p]=u}),h};return z.default=i,z}var G={},Je;function lr(){if(Je)return G;Je=1,Object.defineProperty(G,"__esModule",{value:!0}),G.hover=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=G.hover=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={hover:!1},b.handleMouseOver=function(){return b.setState({hover:!0})},b.handleMouseOut=function(){return b.setState({hover:!1})},b.render=function(){return t.default.createElement(p,{onMouseOver:b.handleMouseOver,onMouseOut:b.handleMouseOut},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d})(t.default.Component)};return G.default=l,G}var W={},Qe;function sr(){if(Qe)return W;Qe=1,Object.defineProperty(W,"__esModule",{value:!0}),W.active=void 0;var r=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var p=arguments[c];for(var u in p)Object.prototype.hasOwnProperty.call(p,u)&&(h[u]=p[u])}return h},e=Ee(),t=n(e);function n(h){return h&&h.__esModule?h:{default:h}}function a(h,c){if(!(h instanceof c))throw new TypeError("Cannot call a class as a function")}function i(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:h}function o(h,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)}var l=W.active=function(c){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(u){o(d,u);function d(){var f,v,b,m;a(this,d);for(var E=arguments.length,M=Array(E),k=0;k<E;k++)M[k]=arguments[k];return m=(v=(b=i(this,(f=d.__proto__||Object.getPrototypeOf(d)).call.apply(f,[this].concat(M))),b),b.state={active:!1},b.handleMouseDown=function(){return b.setState({active:!0})},b.handleMouseUp=function(){return b.setState({active:!1})},b.render=function(){return t.default.createElement(p,{onMouseDown:b.handleMouseDown,onMouseUp:b.handleMouseUp},t.default.createElement(c,r({},b.props,b.state)))},v),i(b,m)}return d})(t.default.Component)};return W.default=l,W}var xe={},et;function hr(){if(et)return xe;et=1,Object.defineProperty(xe,"__esModule",{value:!0});var r=function(t,n){var a={},i=function(l){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;a[l]=h};return t===0&&i("first-child"),t===n-1&&i("last-child"),(t===0||t%2===0)&&i("even"),Math.abs(t%2)===1&&i("odd"),i("nth-child",t),a};return xe.default=r,xe}var tt;function cr(){if(tt)return R;tt=1,Object.defineProperty(R,"__esModule",{value:!0}),R.ReactCSS=R.loop=R.handleActive=R.handleHover=R.hover=void 0;var r=nr(),e=d(r),t=ir(),n=d(t),a=or(),i=d(a),o=lr(),l=d(o),h=sr(),c=d(h),p=hr(),u=d(p);function d(v){return v&&v.__esModule?v:{default:v}}R.hover=l.default,R.handleHover=l.default,R.handleActive=c.default,R.loop=u.default;var f=R.ReactCSS=function(b){for(var m=arguments.length,E=Array(m>1?m-1:0),M=1;M<m;M++)E[M-1]=arguments[M];var k=(0,e.default)(E),A=(0,n.default)(b,k);return(0,i.default)(A)};return R.default=f,R}var Fe=cr();const y=Oe(Fe);var pr=function(e,t,n,a,i){var o=i.clientWidth,l=i.clientHeight,h=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,c=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,p=h-(i.getBoundingClientRect().left+window.pageXOffset),u=c-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var d=void 0;if(u<0?d=0:u>l?d=1:d=Math.round(u*100/l)/100,t.a!==d)return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}else{var f=void 0;if(p<0?f=0:p>o?f=1:f=Math.round(p*100/o)/100,a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}return null},Ce={},ur=function(e,t,n,a){if(typeof document>"u"&&!a)return null;var i=a?new a:document.createElement("canvas");i.width=n*2,i.height=n*2;var o=i.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,i.width,i.height),o.fillStyle=t,o.fillRect(0,0,n,n),o.translate(n,n),o.fillRect(0,0,n,n),i.toDataURL()):null},dr=function(e,t,n,a){var i=e+"-"+t+"-"+n+(a?"-server":"");if(Ce[i])return Ce[i];var o=ur(e,t,n,a);return Ce[i]=o,o},rt=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},le=function(e){var t=e.white,n=e.grey,a=e.size,i=e.renderers,o=e.borderRadius,l=e.boxShadow,h=e.children,c=y({default:{grid:{borderRadius:o,boxShadow:l,absolute:"0px 0px 0px 0px",background:"url("+dr(t,n,a,i.canvas)+") center left"}}});return C.isValidElement(h)?s.cloneElement(h,rt({},h.props,{style:rt({},h.props.style,c.grid)})):s.createElement("div",{style:c.grid})};le.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var fr=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},gr=(function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}})();function br(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function nt(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function vr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Be=(function(r){vr(e,r);function e(){var t,n,a,i;br(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=nt(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=pr(c,a.props.hsl,a.props.direction,a.props.a,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleChange),window.removeEventListener("mouseup",a.handleMouseUp)},n),nt(a,i)}return gr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var n=this,a=this.props.rgb,i=y({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
2
2
|
rgba(`+a.r+","+a.g+","+a.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:a.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+a.r+","+a.g+","+a.b+`, 0) 0%,
|
|
3
3
|
rgba(`+a.r+","+a.g+","+a.b+", 1) 100%)"},pointer:{left:0,top:a.a*100+"%"}},overwrite:fr({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return s.createElement("div",{style:i.alpha},s.createElement("div",{style:i.checkboard},s.createElement(le,{renderers:this.props.renderers})),s.createElement("div",{style:i.gradient}),s.createElement("div",{style:i.container,ref:function(l){return n.container=l},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("div",{style:i.pointer},this.props.pointer?s.createElement(this.props.pointer,this.props):s.createElement("div",{style:i.slider}))))}}]),e})(C.PureComponent||C.Component),xr=(function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}})();function mr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function wr(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Er(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Sr=1,mt=38,Cr=40,kr=[mt,Cr],Rr=function(e){return kr.indexOf(e)>-1},_r=function(e){return Number(String(e).replace(/%/g,""))},Or=1,w=(function(r){Er(e,r);function e(t){yr(this,e);var n=wr(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.handleBlur=function(){n.state.blurValue&&n.setState({value:n.state.blurValue,blurValue:null})},n.handleChange=function(a){n.setUpdatedValue(a.target.value,a)},n.handleKeyDown=function(a){var i=_r(a.target.value);if(!isNaN(i)&&Rr(a.keyCode)){var o=n.getArrowOffset(),l=a.keyCode===mt?i+o:i-o;n.setUpdatedValue(l,a)}},n.handleDrag=function(a){if(n.props.dragLabel){var i=Math.round(n.props.value+a.movementX);i>=0&&i<=n.props.dragMax&&n.props.onChange&&n.props.onChange(n.getValueObjectWithLabel(i),a)}},n.handleMouseDown=function(a){n.props.dragLabel&&(a.preventDefault(),n.handleDrag(a),window.addEventListener("mousemove",n.handleDrag),window.addEventListener("mouseup",n.handleMouseUp))},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleDrag),window.removeEventListener("mouseup",n.handleMouseUp)},n.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},n.inputId="rc-editable-input-"+Or++,n}return xr(e,[{key:"componentDidUpdate",value:function(n,a){this.props.value!==this.state.value&&(n.value!==this.props.value||a.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(n){return mr({},this.props.label,n)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||Sr}},{key:"setUpdatedValue",value:function(n,a){var i=this.props.label?this.getValueObjectWithLabel(n):n;this.props.onChange&&this.props.onChange(i,a),this.setState({value:n})}},{key:"render",value:function(){var n=this,a=y({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return s.createElement("div",{style:a.wrap},s.createElement("input",{id:this.inputId,style:a.input,ref:function(o){return n.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?s.createElement("label",{htmlFor:this.inputId,style:a.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e})(C.PureComponent||C.Component),Mr=function(e,t,n,a){var i=a.clientWidth,o=a.clientHeight,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,h=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(a.getBoundingClientRect().left+window.pageXOffset),p=h-(a.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(p<0)u=359;else if(p>o)u=0;else{var d=-(p*100/o)+100;u=360*d/100}if(n.h!==u)return{h:u,s:n.s,l:n.l,a:n.a,source:"hsl"}}else{var f=void 0;if(c<0)f=0;else if(c>i)f=359;else{var v=c*100/i;f=360*v/100}if(n.h!==f)return{h:f,s:n.s,l:n.l,a:n.a,source:"hsl"}}return null},Fr=(function(){function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}})();function Br(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function at(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Pr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var se=(function(r){Pr(e,r);function e(){var t,n,a,i;Br(this,e);for(var o=arguments.length,l=Array(o),h=0;h<o;h++)l[h]=arguments[h];return i=(n=(a=at(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(l))),a),a.handleChange=function(c){var p=Mr(c,a.props.direction,a.props.hsl,a.container);p&&typeof a.props.onChange=="function"&&a.props.onChange(p,c)},a.handleMouseDown=function(c){a.handleChange(c),window.addEventListener("mousemove",a.handleChange),window.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},n),at(a,i)}return Fr(e,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var n=this,a=this.props.direction,i=a===void 0?"horizontal":a,o=y({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:i==="vertical"});return s.createElement("div",{style:o.hue},s.createElement("div",{className:"hue-"+i,style:o.container,ref:function(h){return n.container=h},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},s.createElement("style",null,`
|
|
4
4
|
.hue-horizontal {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as i,a3 as m,r as c,j as n,b2 as p}from"./index.
|
|
1
|
+
import{z as i,a3 as m,r as c,j as n,b2 as p}from"./index.aCorc3Yt.js";import{P as d,R as f}from"./Particles.BznyVdfo.js";const g=""+new URL("../media/balloon-0.Czj7AKwE.png",import.meta.url).href,B=""+new URL("../media/balloon-1.CNvFFrND.png",import.meta.url).href,h=""+new URL("../media/balloon-2.DTvC6B1t.png",import.meta.url).href,L=""+new URL("../media/balloon-3.CgSk4tbL.png",import.meta.url).href,u=""+new URL("../media/balloon-4.mbtFrzxf.png",import.meta.url).href,x=""+new URL("../media/balloon-5.CSwkUfRA.png",import.meta.url).href,t=300,e=121,s=20,A=80,_=1e3,b=m("from{transform:translateY(calc(100vh + ",t,"px));}to{transform:translateY(0);}"),I=i("img",{target:"e19msdho0"})(({theme:o})=>({position:"fixed",top:`${-t}px`,marginLeft:`${-e/2}px`,zIndex:o.zIndices.balloons,left:`${Math.random()*(A-s)+s}vw`,animationDelay:`${Math.random()*_}ms`,height:`${t}px`,width:`${e}px`,pointerEvents:"none",animationDuration:"750ms",animationName:b,animationTimingFunction:"ease-in",animationDirection:"normal",animationIterationCount:1,opacity:1})),M=30,l=[g,B,h,L,u,x],w=l.length,E=({particleType:o,resourceCrossOriginMode:r})=>{const a=l[o];return n(I,{src:a,crossOrigin:p(r,a)})},N=({scriptRunId:o})=>n(f,{children:n(d,{className:"stBalloons","data-testid":"stBalloons",scriptRunId:o,numParticleTypes:w,numParticles:M,ParticleComponent:E})}),P=c.memo(N);export{M as NUM_BALLOONS,P as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as Bt,
|
|
1
|
+
import{r as Bt,cY as Er,c_ as ef,cX as tf,d6 as At,ag as uh,d7 as gs,d8 as wN,cV as j2,cZ as ku,d9 as ap,da as H2,_ as KR,j as Gf,$ as TN,z as ZR,m as YR,W as QR,db as rC,bh as EN,L as CN,l as SN,o as nC,ct as IN,dc as iC}from"./index.aCorc3Yt.js";import{_ as BN,C as PN}from"./toConsumableArray.DwMycSpg.js";import{E as e4,w as MN}from"./withFullScreenWrapper.CcWCKoY8.js";import{a as RN,T as ON}from"./Toolbar.CQsWYXer.js";import{l as d1}from"./index.8HslT92O.js";import{a as DN}from"./useBasicWidgetState.Bg0ZMUt5.js";import{u as FN,s as LN}from"./threshold.CUNQbqMA.js";import"./FormClearHelper.DN8D_YXO.js";import"./value.DaKxGC7O.js";function kN(r,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in r)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(r,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}function sC(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const t4=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),oC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);oC&&parseFloat(oC[1]);const aC=globalThis,lC=globalThis.process||{},NN=globalThis.navigator||{};function r4(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function fh(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||r4()}function UN(r){return fh()?r4()?"Electron":(NN.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const n4="4.1.0";function zN(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}class VN{constructor(e,t,n="sessionStorage"){this.storage=zN(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function GN(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function jN(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var Dm;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Dm||(Dm={}));const HN=10;function cC(r){return typeof r!="string"?r:(r=r.toUpperCase(),Dm[r]||Dm.WHITE)}function WN(r,e,t){return!fh&&typeof r=="string"&&(e&&(r=`\x1B[${cC(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${cC(t)+HN}m${r}\x1B[49m`)),r}function $N(r,e=["constructor"]){const t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),i=r;for(const s of n){const o=i[s];typeof o=="function"&&(e.find(l=>s===l)||(i[s]=o.bind(r)))}}function W2(r,e){if(!r)throw new Error("Assertion failed")}function ld(){let r;if(fh()&&aC.performance)r=aC?.performance?.now?.();else if("hrtime"in lC){const e=lC?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}const cd={debug:fh()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},XN={enabled:!0,level:0};function ud(){}const uC={},fC={once:!0};class wp{constructor({id:e}={id:""}){this.VERSION=n4,this._startTs=ld(),this._deltaTs=ld(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new VN(`__probe-${this.id}__`,XN),this.timeStamp(`${this.id} started`),$N(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((ld()-this._startTs).toPrecision(10))}getDelta(){return Number((ld()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,cd.warn,arguments,fC)}error(e){return this._getLogFunction(0,e,cd.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,cd.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,cd.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,cd.debug||cd.info,arguments,fC)}table(e,t,n){return t?this._getLogFunction(e,t,console.table||ud,n&&[n],{tag:JN(t)}):ud}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||ud)}group(e,t,n={collapsed:!1}){const i=hC({logLevel:e,message:t,opts:n}),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||ud)}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=i4(e)}_getLogFunction(e,t,n,i,s){if(this._shouldLog(e)){s=hC({logLevel:e,message:t,args:i,opts:s}),n=n||s.method,W2(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=ld();const o=s.tag||s.message;if(s.once&&o)if(!uC[o])uC[o]=ld();else return ud;return t=qN(this.id,s.message,s),n.bind(console,t,...s.args)}return ud}}wp.VERSION=n4;function i4(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return W2(Number.isFinite(e)&&e>=0),e}function hC(r){const{logLevel:e,message:t}=r;r.logLevel=i4(e);const n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const i=typeof r.message;return W2(i==="string"||i==="object"),Object.assign(r,{args:n},r.opts)}function qN(r,e,t){if(typeof e=="string"){const n=t.time?jN(GN(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=WN(e,t.color,t.background)}return e}function JN(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}globalThis.probe={};const s4=new wp({id:"@probe.gl/log"}),Qy="4.3.3",KN=Qy[0]>="0"&&Qy[0]<="9"?`v${Qy}`:"";function ZN(){const r=new wp({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=r,globalThis.loaders.version=KN,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=r,r}const YN=ZN();function QN(r,e){return o4(r||{},e)}function o4(r,e,t=0){if(t>3)return e;const n={...r};for(const[i,s]of Object.entries(e))s&&typeof s=="object"&&!Array.isArray(s)?n[i]=o4(n[i]||{},e[i],t+1):n[i]=e[i];return n}const e5="latest";function t5(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}const r5=t5();function qu(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const Kf=typeof process!="object"||String(process)!=="[object process]"||process.browser,n5=typeof window<"u"&&typeof window.orientation<"u",dC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);dC&&parseFloat(dC[1]);class i5{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){qu(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){qu(this.isRunning),this.isRunning=!1,this._reject(e)}}class ev{terminate(){}}const tv=new Map;function s5(r){qu(r.source&&!r.url||!r.source&&r.url);let e=tv.get(r.source||r.url);return e||(r.url&&(e=o5(r.url),tv.set(r.url,e)),r.source&&(e=a4(r.source),tv.set(r.source,e))),qu(e),e}function o5(r){if(!r.startsWith("http"))return r;const e=a5(r);return a4(e)}function a4(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function a5(r){return`try {
|
|
2
2
|
importScripts('${r}');
|
|
3
3
|
} catch (error) {
|
|
4
4
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as c,r as a,j as o,o as u,ak as g,Y as f,q as S}from"./index.
|
|
1
|
+
import{z as c,r as a,j as o,o as u,ak as g,Y as f,q as S}from"./index.aCorc3Yt.js";const x=c("div",{target:"e1l5y6pi0"})(({theme:e,cache:n})=>({...n?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),T=c("div",{target:"e1l5y6pi1"})(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",gap:e.spacing.sm})),$=c("div",{target:"e1l5y6pi2"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"baseline"})),h=c("span",{target:"e1l5y6pi3"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.none,whiteSpace:"nowrap"})),y=e=>{const n=Math.floor(e/3600),t=Math.floor(e%3600/60),s=e%60;if(n===0&&t===0)return`(${s.toFixed(1)} seconds)`;if(n===0){const p=`${t} minute${t===1?"":"s"}`,d=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${p}${d})`}const l=`${n} hour${n===1?"":"s"}`,i=t===0?"":`, ${t} minute${t===1?"":"s"}`,r=s===0?"":`, ${s.toFixed(1)} seconds`;return`(${l}${i}${r})`};function w({element:e}){const{cache:n,showTime:t}=e,[s,l]=a.useState(0),i=a.useRef(null);return a.useEffect(()=>{if(!t)return;i.current=Date.now();const r=()=>{if(i.current!==null){const m=(Date.now()-i.current)/1e3;l(m)}};r();const p=setInterval(r,100);return()=>clearInterval(p)},[t]),o(x,{className:g({stSpinner:!0,stCacheSpinner:n}),"data-testid":"stSpinner",cache:n,children:u(T,{children:[o(f,{size:"lg",iconValue:"spinner"}),u($,{children:[o(S,{source:e.text,allowHTML:!1}),t&&o(h,{children:y(s)})]})]})})}const v=a.memo(w);export{v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{z as c,a3 as l,r as i,j as a,b2 as p}from"./index.
|
|
1
|
+
import{z as c,a3 as l,r as i,j as a,b2 as p}from"./index.aCorc3Yt.js";import{P as d,R as f}from"./Particles.BznyVdfo.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 n,E as H,_ as D,z as k,o as O,j as U,ay as ge,P as he,b as ve,B as me,ax as q,bN as re,al as Se,ag as be,bg as ye,l as Ce,bO as Ue,k as we,aj as Me,e as W,V as xe,bh as Ee,p as Ie,ab as Fe,ac as Re,$ as ke,bP as _e,bQ as Oe}from"./index.BB_iwaVr.js";import{U as ie}from"./UploadFileInfo.Dr-zDST7.js";import{u as Pe}from"./FormClearHelper.CypmvhYZ.js";import{P as Te,S as Le}from"./ProgressBar.Dy9CI6w4.js";import{b as We}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 Ve(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=k("div",{target:"exxgkyt0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),G=k("div",{target:"exxgkyt1"})(({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"})),je=k("p",{target:"exxgkyt2"})(({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),Be=k("img",{target:"exxgkyt3"})(({theme:e,opacity:a})=>({borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,objectFit:"contain",opacity:a})),$e=k("a",{target:"exxgkyt4"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none",display:"block"})),ze=k("span",{target:"exxgkyt5"})({display:"flex",alignItems:"center"}),Ae=k("div",{target:"exxgkyt6"})(({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:e.zIndices.priority,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ne=k("div",{target:"exxgkyt8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),He=k("button",{target:"exxgkyt9"})(({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:e.shadows.focusRing},...Ve("medium",e)}));function De({disabled:e,onClick:a,children:d,progress:h}){return O(He,{disabled:e||!1,onClick:a||(()=>{}),progress:h||null,"data-testid":"stCameraInputButton",children:[d,h?U(Ne,{children:U(Te,{value:h,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(De);var B=(function(e){return e.USER="user",e.ENVIRONMENT="environment",e})({});const qe=({switchFacingMode:e})=>U(Ae,{"data-testid":"stCameraInputSwitchButton",children:U(ge,{content:"Switch camera",placement:he.TOP_RIGHT,children:U(ve,{kind:me.MINIMAL,onClick:e,children:U(q,{content:oe,size:"twoXL",color:re.white})})})}),Ge=n.memo(qe);var $={exports:{}},Xe=$.exports,te;function Qe(){return te||(te=1,(function(e,a){(function(h,v){e.exports=v(Se())})(Xe,function(d){return(function(h){var v={};function p(o){if(v[o])return v[o].exports;var f=v[o]={i:o,l:!1,exports:{}};return h[o].call(f.exports,f,f.exports,p),f.l=!0,f.exports}return p.m=h,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(h,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 E=this,w=E.ctx,S=E.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 E={video:typeof C<"u"?C:!0};r.audio&&(E.audio=typeof y<"u"?y:!0),t.requestUserMediaId++;var w=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(E).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,E=null;y.forEach(function(_){_.kind==="audio"?C=_.id:_.kind==="video"&&(E=_.id)});var w=M(r.audioConstraints);w&&(C=w);var S=M(r.videoConstraints);S&&(E=S),s(l(C),l(E))})}},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,E=l.style,w=E===void 0?{}:E,S=l.children,_=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,V={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(j){t.video=j},style:z},_)),S&&S(V))},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(h,v){h.exports=d})}).default})})($)),$.exports}var Je=Qe();const Ke=be(Je),Ye=({width:e})=>O(G,{width:e,children:[U(q,{size:"threeXL",color:re.gray60,content:ne}),O(je,{children:["This app would like to use your camera.",U($e,{href:We,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Ze=({handleCapture:e,width:a,disabled:d,clearPhotoInProgress:h,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(ye(1e3,b),[]);n.useEffect(()=>{i(a)},[a,i]);function t(){if(I.current!==null){const s=I.current.getScreenshot();e(s)}}const r=Ce();return O(se,{"data-testid":"stCameraInputWebcamComponent",children:[m!=="success"&&!d&&!h?U(Ye,{width:R}):Ue()&&U(Ge,{switchFacingMode:o}),U(G,{"data-testid":"stCameraInputWebcamStyledBox",hidden:m!=="success"&&!d&&!h,width:R,children:!d&&U(Ke,{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||h,children:"Take Photo"})]})},et=n.memo(Ze),ce="RESTORED_FROM_WIDGET",tt=150,rt=xe.getLogger("CameraInput"),N=e=>{const a=e.filter(d=>d.status.type==="uploaded").map(d=>{const{name:h,size:v,status:p}=d,{fileId:o,fileUrls:f}=p;return new _e({fileId:o,fileUrls:f,name:h,size:v})});return new Oe({uploadedFileInfo:a})},it=(e,a)=>{const d=a.getFileUploaderStateValue(e);if(W(d))return{files:[],nextLocalId:1,imgSrc:null};const{uploadedFileInfo:h}=d;if(W(h)||h.length===0)return{files:[],nextLocalId:1,imgSrc:null};let v=1;const p=h.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 ot(e,a){return fetch(e).then(d=>d.arrayBuffer()).then(d=>new File([d],a,{type:"image/jpeg"}))}const nt=({element:e,widgetMgr:a,uploadClient:d,disabled:h,fragmentId:v,testOverride:p})=>{const{width:o,elementRef:f}=we(),m=n.useRef(null);m.current===null&&(m.current=it(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,E]=n.useState(!0),[w,S]=n.useState(!1),[_,z]=n.useState(B.USER),V=n.useCallback(()=>{const c=b.current;return b.current+=1,c},[]),j=n.useMemo(()=>{const c=u=>u.status.type==="uploading";return i.some(c)?"updating":"ready"},[i]),A=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===B.USER?B.ENVIRONMENT:B.USER)},[]),P=n.useCallback(c=>r.current.find(u=>u.id===c),[]),X=n.useCallback(c=>{Me.flushSync(()=>{t(u=>[...u,c])})},[]),Q=n.useCallback(c=>{t(u=>u.filter(g=>g.id!==c))},[]),T=n.useCallback((c,u)=>{t(g=>g.map(x=>x.id===c?u:x))},[]),J=n.useCallback((c,u)=>{y(!1);const g=P(c);W(g)||g.status.type!=="uploading"||T(g.id,g.setStatus({type:"uploaded",fileId:u.fileId,fileUrls:u}))},[P,T]),K=n.useCallback((c,u)=>{const g=P(u);if(W(g)||g.status.type!=="uploading")return;const x=Math.round(c.loaded*100/c.total);g.status.progress!==x&&T(u,g.setStatus({type:"uploading",abortController:g.status.abortController,progress:x}))},[P,T]),Y=n.useCallback((c,u)=>{const g=new AbortController,x=new ie(u.name,u.size,V(),{type:"uploading",abortController:g,progress:1});X(x),d.uploadFile(e,c.uploadUrl,u,L=>K(L,x.id),g.signal).then(()=>J(x.id,c)).catch(L=>{L instanceof DOMException&&L.name==="AbortError"||T(x.id,x.setStatus({type:"error",errorMessage:L?L.toString():"Unknown error"}))})},[X,e,V,J,K,T,d]),Z=n.useCallback(c=>{const u=P(c);W(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))},[P,Q,d]),ee=n.useCallback(c=>{if(c===null)return Promise.resolve();l(c),y(!0),E(!1);const u=g=>new Promise(x=>setTimeout(x,g));return ot(c,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(g=>d.fetchFileURLs([g]).then(x=>({file:g,fileUrls:x[0]}))).then(({file:g,fileUrls:x})=>Y(x,g)).then(()=>u(tt)).then(()=>{E(!0)}).catch(g=>{rt.error(g)})},[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(j!=="ready")return;const c=N(i),u=a.getFileUploaderStateValue(e);Ee(c,u)||a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[j,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 Pe({element:e,widgetMgr:a,onFormCleared:pe}),O(se,{className:"stCameraInput","data-testid":"stCameraInput",ref:f,children:[U(Re,{label:e.label,disabled:h,labelVisibility:Ie(e.labelVisibility?.value),children:e.help&&U(Fe,{content:e.help,label:e.label})}),s?O(ke,{children:[U(G,{width:o,children:s!==ce&&U(Be,{src:s,alt:"Snapshot",opacity:M||!C?"50%":"100%",width:o,height:o*9/16})}),U(le,{onClick:fe,progress:A,disabled:!!A||h,children:A?"Uploading...":O(ze,{children:[U(q,{content:ae,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):U(et,{handleCapture:ue,width:o,disabled:h,clearPhotoInProgress:w,setClearPhotoInProgress:S,facingMode:_,setFacingMode:de,testOverride:p})]})},ut=n.memo(nt);export{ut as default};
|
|
1
|
+
import{r as n,E as H,_ as D,z as k,o as O,j as U,ay as ge,P as he,b as ve,B as me,ax as q,bN as re,al as Se,ag as be,bg as ye,l as Ce,bO as Ue,k as we,aj as Me,e as W,V as xe,bh as Ee,p as Ie,ab as Fe,ac as Re,$ as ke,bP as _e,bQ as Oe}from"./index.aCorc3Yt.js";import{U as ie}from"./UploadFileInfo.Dr-zDST7.js";import{u as Pe}from"./FormClearHelper.DN8D_YXO.js";import{P as Te,S as Le}from"./ProgressBar.C5uBOtcx.js";import{b as We}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 Ve(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=k("div",{target:"exxgkyt0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),G=k("div",{target:"exxgkyt1"})(({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"})),je=k("p",{target:"exxgkyt2"})(({theme:e})=>({marginTop:e.spacing.sm,textAlign:"center"})),Be=k("img",{target:"exxgkyt3"})(({theme:e,opacity:a})=>({borderRadius:`${e.radii.default} ${e.radii.default} 0 0`,objectFit:"contain",opacity:a})),$e=k("a",{target:"exxgkyt4"})(({theme:e})=>({color:e.colors.link,textDecoration:e.linkUnderline?"underline":"none",display:"block"})),ze=k("span",{target:"exxgkyt5"})({display:"flex",alignItems:"center"}),Ae=k("div",{target:"exxgkyt6"})(({theme:e})=>({position:"absolute",top:e.spacing.lg,right:e.spacing.lg,zIndex:e.zIndices.priority,color:e.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ne=k("div",{target:"exxgkyt8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),He=k("button",{target:"exxgkyt9"})(({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:e.shadows.focusRing},...Ve("medium",e)}));function De({disabled:e,onClick:a,children:d,progress:h}){return O(He,{disabled:e||!1,onClick:a||(()=>{}),progress:h||null,"data-testid":"stCameraInputButton",children:[d,h?U(Ne,{children:U(Te,{value:h,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(De);var B=(function(e){return e.USER="user",e.ENVIRONMENT="environment",e})({});const qe=({switchFacingMode:e})=>U(Ae,{"data-testid":"stCameraInputSwitchButton",children:U(ge,{content:"Switch camera",placement:he.TOP_RIGHT,children:U(ve,{kind:me.MINIMAL,onClick:e,children:U(q,{content:oe,size:"twoXL",color:re.white})})})}),Ge=n.memo(qe);var $={exports:{}},Xe=$.exports,te;function Qe(){return te||(te=1,(function(e,a){(function(h,v){e.exports=v(Se())})(Xe,function(d){return(function(h){var v={};function p(o){if(v[o])return v[o].exports;var f=v[o]={i:o,l:!1,exports:{}};return h[o].call(f.exports,f,f.exports,p),f.l=!0,f.exports}return p.m=h,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(h,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 E=this,w=E.ctx,S=E.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 E={video:typeof C<"u"?C:!0};r.audio&&(E.audio=typeof y<"u"?y:!0),t.requestUserMediaId++;var w=t.requestUserMediaId;navigator.mediaDevices.getUserMedia(E).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,E=null;y.forEach(function(_){_.kind==="audio"?C=_.id:_.kind==="video"&&(E=_.id)});var w=M(r.audioConstraints);w&&(C=w);var S=M(r.videoConstraints);S&&(E=S),s(l(C),l(E))})}},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,E=l.style,w=E===void 0?{}:E,S=l.children,_=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,V={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(j){t.video=j},style:z},_)),S&&S(V))},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(h,v){h.exports=d})}).default})})($)),$.exports}var Je=Qe();const Ke=be(Je),Ye=({width:e})=>O(G,{width:e,children:[U(q,{size:"threeXL",color:re.gray60,content:ne}),O(je,{children:["This app would like to use your camera.",U($e,{href:We,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Ze=({handleCapture:e,width:a,disabled:d,clearPhotoInProgress:h,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(ye(1e3,b),[]);n.useEffect(()=>{i(a)},[a,i]);function t(){if(I.current!==null){const s=I.current.getScreenshot();e(s)}}const r=Ce();return O(se,{"data-testid":"stCameraInputWebcamComponent",children:[m!=="success"&&!d&&!h?U(Ye,{width:R}):Ue()&&U(Ge,{switchFacingMode:o}),U(G,{"data-testid":"stCameraInputWebcamStyledBox",hidden:m!=="success"&&!d&&!h,width:R,children:!d&&U(Ke,{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||h,children:"Take Photo"})]})},et=n.memo(Ze),ce="RESTORED_FROM_WIDGET",tt=150,rt=xe.getLogger("CameraInput"),N=e=>{const a=e.filter(d=>d.status.type==="uploaded").map(d=>{const{name:h,size:v,status:p}=d,{fileId:o,fileUrls:f}=p;return new _e({fileId:o,fileUrls:f,name:h,size:v})});return new Oe({uploadedFileInfo:a})},it=(e,a)=>{const d=a.getFileUploaderStateValue(e);if(W(d))return{files:[],nextLocalId:1,imgSrc:null};const{uploadedFileInfo:h}=d;if(W(h)||h.length===0)return{files:[],nextLocalId:1,imgSrc:null};let v=1;const p=h.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 ot(e,a){return fetch(e).then(d=>d.arrayBuffer()).then(d=>new File([d],a,{type:"image/jpeg"}))}const nt=({element:e,widgetMgr:a,uploadClient:d,disabled:h,fragmentId:v,testOverride:p})=>{const{width:o,elementRef:f}=we(),m=n.useRef(null);m.current===null&&(m.current=it(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,E]=n.useState(!0),[w,S]=n.useState(!1),[_,z]=n.useState(B.USER),V=n.useCallback(()=>{const c=b.current;return b.current+=1,c},[]),j=n.useMemo(()=>{const c=u=>u.status.type==="uploading";return i.some(c)?"updating":"ready"},[i]),A=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===B.USER?B.ENVIRONMENT:B.USER)},[]),P=n.useCallback(c=>r.current.find(u=>u.id===c),[]),X=n.useCallback(c=>{Me.flushSync(()=>{t(u=>[...u,c])})},[]),Q=n.useCallback(c=>{t(u=>u.filter(g=>g.id!==c))},[]),T=n.useCallback((c,u)=>{t(g=>g.map(x=>x.id===c?u:x))},[]),J=n.useCallback((c,u)=>{y(!1);const g=P(c);W(g)||g.status.type!=="uploading"||T(g.id,g.setStatus({type:"uploaded",fileId:u.fileId,fileUrls:u}))},[P,T]),K=n.useCallback((c,u)=>{const g=P(u);if(W(g)||g.status.type!=="uploading")return;const x=Math.round(c.loaded*100/c.total);g.status.progress!==x&&T(u,g.setStatus({type:"uploading",abortController:g.status.abortController,progress:x}))},[P,T]),Y=n.useCallback((c,u)=>{const g=new AbortController,x=new ie(u.name,u.size,V(),{type:"uploading",abortController:g,progress:1});X(x),d.uploadFile(e,c.uploadUrl,u,L=>K(L,x.id),g.signal).then(()=>J(x.id,c)).catch(L=>{L instanceof DOMException&&L.name==="AbortError"||T(x.id,x.setStatus({type:"error",errorMessage:L?L.toString():"Unknown error"}))})},[X,e,V,J,K,T,d]),Z=n.useCallback(c=>{const u=P(c);W(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))},[P,Q,d]),ee=n.useCallback(c=>{if(c===null)return Promise.resolve();l(c),y(!0),E(!1);const u=g=>new Promise(x=>setTimeout(x,g));return ot(c,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(g=>d.fetchFileURLs([g]).then(x=>({file:g,fileUrls:x[0]}))).then(({file:g,fileUrls:x})=>Y(x,g)).then(()=>u(tt)).then(()=>{E(!0)}).catch(g=>{rt.error(g)})},[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(j!=="ready")return;const c=N(i),u=a.getFileUploaderStateValue(e);Ee(c,u)||a.setFileUploaderStateValue(e,c,{fromUi:!0},v)},[j,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 Pe({element:e,widgetMgr:a,onFormCleared:pe}),O(se,{className:"stCameraInput","data-testid":"stCameraInput",ref:f,children:[U(Re,{label:e.label,disabled:h,labelVisibility:Ie(e.labelVisibility?.value),children:e.help&&U(Fe,{content:e.help,label:e.label})}),s?O(ke,{children:[U(G,{width:o,children:s!==ce&&U(Be,{src:s,alt:"Snapshot",opacity:M||!C?"50%":"100%",width:o,height:o*9/16})}),U(le,{onClick:fe,progress:A,disabled:!!A||h,children:A?"Uploading...":O(ze,{children:[U(q,{content:ae,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):U(et,{handleCapture:ue,width:o,disabled:h,clearPhotoInProgress:w,setClearPhotoInProgress:S,facingMode:_,setFacingMode:de,testOverride:p})]})},ut=n.memo(nt);export{ut as default};
|