streamlit-nightly 1.42.1.dev20250209__py2.py3-none-any.whl → 1.42.1.dev20250210__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.D9415avj.js → FileDownload.esm.CJC5yID5.js} +1 -1
- streamlit/static/static/js/{FileDropzone.Cd515bsy.js → FileDropzone.BxEWox87.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.BBpErIGP.js → FormClearHelper.D3S2tctS.js} +1 -1
- streamlit/static/static/js/{Hooks.CeSTXIj2.js → Hooks.BwOODKo2.js} +1 -1
- streamlit/static/static/js/{InputInstructions.BU5Td5cJ.js → InputInstructions.Cm2uD0mH.js} +1 -1
- streamlit/static/static/js/{ProgressBar.J2QhvKtD.js → ProgressBar.BqFWIdp2.js} +2 -2
- streamlit/static/static/js/{RenderInPortalIfExists.BbbrvJaa.js → RenderInPortalIfExists.ax0m2H0_.js} +1 -1
- streamlit/static/static/js/{Toolbar.D-hUr0RX.js → Toolbar.CRowl_WL.js} +1 -1
- streamlit/static/static/js/{base-input.CNkkCv4B.js → base-input.krLFbHyn.js} +4 -4
- streamlit/static/static/js/{createSuper.DHhKMTIx.js → createSuper.k6SaTk0j.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CRylpesE.js → data-grid-overlay-editor.BUaZRQkO.js} +1 -1
- streamlit/static/static/js/{downloader.D_08g5mI.js → downloader.CFLXdJg2.js} +1 -1
- streamlit/static/static/js/{es6.B-Rq6ajt.js → es6.gxLg_8ha.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.CFL3MAVr.js → iframeResizer.contentWindow.DkwEeyR9.js} +1 -1
- streamlit/static/static/js/{index.JSS70wsq.js → index.B7i1hjL6.js} +2 -2
- streamlit/static/static/js/{index.CEj-S3PF.js → index.BAHug0jz.js} +1 -1
- streamlit/static/static/js/index.BOCJ0fVC.js +1 -0
- streamlit/static/static/js/{index.D9M0iUu5.js → index.BOR0ctru.js} +1 -1
- streamlit/static/static/js/{index.-SmXSkUY.js → index.BOVOcQJK.js} +1 -1
- streamlit/static/static/js/{index.BlcNB-sY.js → index.BSsjknPR.js} +1 -1
- streamlit/static/static/js/index.BaBZULmv.js +1 -0
- streamlit/static/static/js/{index.D94jjl7_.js → index.BbOp1EEY.js} +5 -5
- streamlit/static/static/js/{index.zzxJWhBg.js → index.BdR17uHT.js} +1 -1
- streamlit/static/static/js/{index.CMcCB4vg.js → index.Be3Ud760.js} +1 -1
- streamlit/static/static/js/index.BiQ_POiE.js +1 -0
- streamlit/static/static/js/{index.9wBA4A4f.js → index.Blgy4CCd.js} +18 -18
- streamlit/static/static/js/{index.B2evntzQ.js → index.C-4bC9wo.js} +1 -1
- streamlit/static/static/js/{index.C-_AHUSz.js → index.C1ewZGYv.js} +2 -2
- streamlit/static/static/js/index.C8CCX_u3.js +1 -0
- streamlit/static/static/js/index.CUPb182F.js +1 -0
- streamlit/static/static/js/{index.Bw9RDCaH.js → index.CVtSssNQ.js} +1 -1
- streamlit/static/static/js/index.C_Vm41WK.js +1 -0
- streamlit/static/static/js/index.C_eNMQ0G.js +1 -0
- streamlit/static/static/js/index.Cesoqj5i.js +1 -0
- streamlit/static/static/js/{index.CuNiy4LB.js → index.Cj8uDDnI.js} +1 -1
- streamlit/static/static/js/index.Cksh9dIb.js +1 -0
- streamlit/static/static/js/index.CoIye-dC.js +1 -0
- streamlit/static/static/js/index.D69WEQtH.js +1 -0
- streamlit/static/static/js/{index.BqePTNWb.js → index.D8KPGiS9.js} +2 -2
- streamlit/static/static/js/{index.BCYuLMdi.js → index.DEpXqZe9.js} +3 -3
- streamlit/static/static/js/index.DJY4JXFf.js +1 -0
- streamlit/static/static/js/{index.CEWcZMdD.js → index.DXBI5Jkr.js} +2 -2
- streamlit/static/static/js/index.DooQ24w4.js +1 -0
- streamlit/static/static/js/{index.DYHaq5Cw.js → index.DrwNQ7G8.js} +6 -6
- streamlit/static/static/js/{index.BVbWPXFU.js → index.DxK0b7hW.js} +1 -1
- streamlit/static/static/js/{index.B9q8XlSH.js → index.FyfJgAtw.js} +2 -2
- streamlit/static/static/js/{index.BevO9CYu.js → index.PzwaVSFN.js} +2 -2
- streamlit/static/static/js/index.UW7UEFVt.js +1 -0
- streamlit/static/static/js/{index.DwWMkgFE.js → index.cRZuEjlj.js} +1 -1
- streamlit/static/static/js/{index.B0xfT3p4.js → index.waVftNUu.js} +2 -2
- streamlit/static/static/js/index.xMCeK5i-.js +2 -0
- streamlit/static/static/js/{input.Dbc83Str.js → input.RldPkbfl.js} +2 -2
- streamlit/static/static/js/{memory.BzHgTb9i.js → memory.CJUkEDwO.js} +1 -1
- streamlit/static/static/js/{mergeWith.BCa1_PWb.js → mergeWith.mP6-fMJS.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CtUWknLp.js → number-overlay-editor.Cexyv1f1.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DGVrr2j8.js → possibleConstructorReturn.Bfw_ecB7.js} +1 -1
- streamlit/static/static/js/{sandbox.C20zasAf.js → sandbox.B9QCFfso.js} +1 -1
- streamlit/static/static/js/{textarea.BeRVLTOp.js → textarea.BphfZ_P9.js} +2 -2
- streamlit/static/static/js/{timepicker.DyU-jgSC.js → timepicker.BGFe-2JD.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.D4FxxWIg.js → toConsumableArray.BtjgDmTZ.js} +1 -1
- streamlit/static/static/js/{uniqueId.CAAlIP1-.js → uniqueId.BG3aVKeE.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.C207Y3_O.js → useBasicWidgetState.GQaAM6uH.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.CsqRc0X0.js → useOnInputChange.B6mIpebi.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.DwHjQb3H.js → withFullScreenWrapper.XgZUnj3Y.js} +1 -1
- {streamlit_nightly-1.42.1.dev20250209.dist-info → streamlit_nightly-1.42.1.dev20250210.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.42.1.dev20250209.dist-info → streamlit_nightly-1.42.1.dev20250210.dist-info}/RECORD +71 -71
- streamlit/static/static/js/index.B-4MHYvl.js +0 -1
- streamlit/static/static/js/index.BA5ubsQA.js +0 -1
- streamlit/static/static/js/index.BNrZwkh1.js +0 -1
- streamlit/static/static/js/index.BpmrfDoR.js +0 -2
- streamlit/static/static/js/index.CFtAnwvU.js +0 -1
- streamlit/static/static/js/index.CQ_wmqnz.js +0 -1
- streamlit/static/static/js/index.CvADzqCD.js +0 -1
- streamlit/static/static/js/index.DPs04g4h.js +0 -1
- streamlit/static/static/js/index.DWIf4xZP.js +0 -1
- streamlit/static/static/js/index.DfCewjMv.js +0 -1
- streamlit/static/static/js/index.DgwklVRJ.js +0 -1
- streamlit/static/static/js/index.Yr32ts47.js +0 -1
- streamlit/static/static/js/index.i2uLxrqv.js +0 -1
- streamlit/static/static/js/index.joQNIDux.js +0 -1
- streamlit/static/static/js/index.pzjWTi64.js +0 -1
- {streamlit_nightly-1.42.1.dev20250209.data → streamlit_nightly-1.42.1.dev20250210.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.42.1.dev20250209.dist-info → streamlit_nightly-1.42.1.dev20250210.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.42.1.dev20250209.dist-info → streamlit_nightly-1.42.1.dev20250210.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.42.1.dev20250209.dist-info → streamlit_nightly-1.42.1.dev20250210.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
import{r as y,E as _,_ as T,n as E,az as Q,z as R,j as p,bv as J,bc as B,bq as K,b8 as Y,bp as j,bC as z,d as Z,g as ee,aN as te,y as re,bD as ie,bE as ae,am as oe,R as ne,aC as se,K as P,bm as le,bl as de,bs as ce,bF as ue,bt as fe,bu as he,F as pe}from"./index.9wBA4A4f.js";import{a as V}from"./axios.upsvKRUO.js";import{F as ge}from"./FormClearHelper.BBpErIGP.js";import{U as W}from"./UploadFileInfo.C-jY39rj.js";import{P as me,S as ve}from"./ProgressBar.J2QhvKtD.js";var A=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),y.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"}))});A.displayName="Video";var N=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),y.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"}))});N.displayName="X";var $=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.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"}))});$.displayName="SwitchCamera";var L;(function(t){t.XSMALL="xsmall",t.SMALL="small",t.MEDIUM="medium",t.LARGE="large"})(L||(L={}));function Se(t,l){switch(t){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const D=E("div",{target:"e47j7ja0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),O=E("div",{target:"e47j7ja1"})(({theme:t,width:l})=>({backgroundColor:t.colors.secondaryBg,borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),ye=E("p",{target:"e47j7ja2"})(({theme:t})=>({marginTop:t.spacing.sm,textAlign:"center"})),be=E("img",{target:"e47j7ja3"})(({theme:t,opacity:l})=>({borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,objectFit:"contain",opacity:l})),Me=E("a",{target:"e47j7ja4"})(({theme:t})=>({color:t.colors.primary,display:"block",textDecoration:"none"})),we=E("span",{target:"e47j7ja5"})({display:"flex",alignItems:"center"}),Ce=E("div",{target:"e47j7ja6"})(({theme:t})=>({position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:t.zIndices.priority,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ue=E("div",{target:"e47j7ja8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ee=E("button",{target:"e47j7ja9"})(({theme:t})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:`${t.sizes.borderWidth} solid ${t.colors.borderColor}`,borderRadius:`0 0 ${t.radii.default} ${t.radii.default}`,"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:`${t.spacing.xs} ${t.spacing.md}`,margin:t.spacing.none,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${Q(t.colors.primary,.5)}`},...Se("medium",t)}));function H({disabled:t,onClick:l,children:r,progress:o}){return R(Ee,{disabled:t||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[r,o&&p(Ue,{children:p(me,{value:o,size:ve.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F;(function(t){t.USER="user",t.ENVIRONMENT="environment"})(F||(F={}));const Ie=({switchFacingMode:t})=>p(Ce,{"data-testid":"stCameraInputSwitchButton",children:p(J,{content:"Switch camera",placement:B.TOP_RIGHT,children:p(K,{kind:Y.MINIMAL,onClick:t,children:p(j,{content:$,size:"twoXL",color:z.white})})})});var G={exports:{}};(function(t,l){(function(o,a){t.exports=a(y)})(Z,function(r){return function(o){var a={};function n(s){if(a[s])return a[s].exports;var f=a[s]={i:s,l:!1,exports:{}};return o[s].call(f.exports,f,f.exports,n),f.l=!0,f.exports}return n.m=o,n.c=a,n.d=function(s,f,g){n.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:g})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,f){if(f&1&&(s=n(s)),f&8||f&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),f&2&&typeof s!="string")for(var U in s)n.d(g,U,(function(C){return s[C]}).bind(null,U));return g},n.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(f,"a",f),f},n.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},n.p="",n(n.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(o,a,n){n.r(a);var s=n("react"),f=function(){var m=function(u,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,d){i.__proto__=d}||function(i,d){for(var c in d)d.hasOwnProperty(c)&&(i[c]=d[c])},m(u,e)};return function(u,e){m(u,e);function i(){this.constructor=u}u.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,i=arguments.length;e<i;e++){u=arguments[e];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(m[d]=u[d])}return m},g.apply(this,arguments)},U=function(m,u){var e={};for(var i in m)Object.prototype.hasOwnProperty.call(m,i)&&u.indexOf(i)<0&&(e[i]=m[i]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,i=Object.getOwnPropertySymbols(m);d<i.length;d++)u.indexOf(i[d])<0&&Object.prototype.propertyIsEnumerable.call(m,i[d])&&(e[i[d]]=m[i[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(u){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return e?new Promise(function(i,d){e.call(navigator,u,i,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function C(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(m){f(u,m);function u(e){var i=m.call(this,e)||this;return i.canvas=null,i.ctx=null,i.requestUserMediaId=0,i.unmounted=!1,i.state={hasUserMedia:!1},i}return u.prototype.componentDidMount=function(){var e=this,i=e.state,d=e.props;if(this.unmounted=!1,!C()){d.onUserMediaError("getUserMedia not supported");return}i.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var i=this.props;if(!C()){i.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(i.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(i.videoConstraints),b=e.minScreenshotWidth!==i.minScreenshotWidth,S=e.minScreenshotHeight!==i.minScreenshotHeight;(c||b||S)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(i){e.removeTrack(i),i.stop()}),e.getAudioTracks().map(function(i){e.removeTrack(i),i.stop()})):e.stop())},u.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(u.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},u.prototype.getScreenshot=function(e){var i=this,d=i.state,c=i.props;if(!d.hasUserMedia)return null;var b=this.getCanvas(e);return b&&b.toDataURL(c.screenshotFormat,c.screenshotQuality)},u.prototype.getCanvas=function(e){var i=this,d=i.state,c=i.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var b=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var h=b/S;b=c.minScreenshotWidth||this.video.clientWidth,S=b/h,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,b=S*h)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||b,this.canvas.height=(e==null?void 0:e.height)||S,this.ctx=this.canvas.getContext("2d")}var w=this,M=w.ctx,v=w.canvas;return M&&v&&(v.width=(e==null?void 0:e.width)||v.width,v.height=(e==null?void 0:e.height)||v.height,c.mirrored&&(M.translate(v.width,0),M.scale(-1,1)),M.imageSmoothingEnabled=c.imageSmoothing,M.drawImage(this.video,0,0,(e==null?void 0:e.width)||v.width,(e==null?void 0:e.height)||v.height),c.mirrored&&(M.scale(-1,1),M.translate(-v.width,0))),v},u.prototype.requestUserMedia=function(){var e=this,i=this.props,d=function(S,h){var w={video:typeof h<"u"?h:!0};i.audio&&(w.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var M=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(w).then(function(v){e.unmounted||M!==e.requestUserMediaId?u.stopMediaStream(v):e.handleUserMedia(null,v)}).catch(function(v){e.handleUserMedia(v)})};if("mediaDevices"in navigator)d(i.audioConstraints,i.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},b=function(S){var h=S.deviceId;return typeof h=="string"?h:Array.isArray(h)&&h.length>0?h[0]:typeof h=="object"&&h.ideal?h.ideal:null};MediaStreamTrack.getSources(function(S){var h=null,w=null;S.forEach(function(x){x.kind==="audio"?h=x.id:x.kind==="video"&&(w=x.id)});var M=b(i.audioConstraints);M&&(h=M);var v=b(i.videoConstraints);v&&(w=v),d(c(h),c(w))})}},u.prototype.handleUserMedia=function(e,i){var d=this.props;if(e||!i){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=i;try{this.video&&(this.video.srcObject=i),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(i)})}d.onUserMedia(i)},u.prototype.render=function(){var e=this,i=this,d=i.state,c=i.props,b=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var S=c.mirrored,h=c.style,w=h===void 0?{}:h,M=c.children,v=U(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),x=S?g(g({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,q={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,src:d.src,muted:!b,playsInline:!0,ref:function(X){e.video=X},style:x},v)),M&&M(q))},u.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);a.default=I},react:function(o,a){o.exports=r}}).default})})(G);var Fe=G.exports;const Re=ee(Fe);var k;(function(t){t.PENDING="pending",t.SUCCESS="success",t.ERROR="error"})(k||(k={}));const xe=({width:t})=>R(O,{width:t,children:[p(j,{size:"threeXL",color:z.gray60,content:A}),R(ye,{children:["This app would like to use your camera.",p(Me,{href:ae,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Pe=({handleCapture:t,width:l,disabled:r,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:n,setFacingMode:s,testOverride:f})=>{const[g,U]=y.useState(f||"pending"),C=y.useRef(null),[I,m]=y.useState(l),u=y.useCallback(te(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(C.current!==null){const d=C.current.getScreenshot();t(d)}}const i=re();return R(D,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!r&&!o?p(xe,{width:I}):ie&&p(Ie,{switchFacingMode:s}),p(O,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!r&&!o,width:I,children:!r&&p(Re,{audio:!1,ref:C,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${i.radii.default} ${i.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),p(H,{onClick:e,disabled:g!=="success"||r||o,children:"Take Photo"})]})},_e=150,Te=oe.getLogger("CameraInput");class Be extends ne.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=r=>{this.setState({clearPhotoInProgress:r})},this.setFacingMode=()=>{this.setState(r=>({facingMode:r.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=r=>{if(r===null)return Promise.resolve();this.setState({imgSrc:r,shutter:!0,minShutterEffectPassed:!1});const o=a=>new Promise(n=>setTimeout(n,a));return je(r,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(a=>this.props.uploadClient.fetchFileURLs([a]).then(n=>({file:a,fileUrls:n[0]}))).then(({file:a,fileUrls:n})=>this.uploadFile(n,a)).then(()=>o(_e)).then(()=>{this.setState((a,n)=>({imgSrc:r,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{Te.error(a)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(r=>this.deleteFile(r.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const r=this.createWidgetValue(),{element:o,widgetMgr:a,fragmentId:n}=this.props,s=a.getFileUploaderStateValue(o);se(r,s)||a.setFileUploaderStateValue(o,r,{fromUi:!0},n)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const r=this.createWidgetValue();if(P(r))return;this.setState({imgSrc:null});const{widgetMgr:o,element:a,fragmentId:n}=this.props;o.setFileUploaderStateValue(a,r,{fromUi:!0},n)})},this.deleteFile=r=>{const o=this.getFile(r);P(o)||(o.status.type==="uploading"&&o.status.cancelToken.cancel(),o.status.type==="uploaded"&&o.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(o.status.fileUrls.deleteUrl),this.removeFile(r))},this.addFile=r=>{this.setState(o=>({files:[...o.files,r]}))},this.removeFile=r=>{this.setState(o=>({files:o.files.filter(a=>a.id!==r)}))},this.getFile=r=>this.state.files.find(o=>o.id===r),this.updateFile=(r,o)=>{this.setState(a=>({files:a.files.map(n=>n.id===r?o:n)}))},this.onUploadComplete=(r,o)=>{this.setState(()=>({shutter:!1}));const a=this.getFile(r);P(a)||a.status.type!=="uploading"||this.updateFile(a.id,a.setStatus({type:"uploaded",fileId:o.fileId,fileUrls:o}))},this.onUploadProgress=(r,o)=>{const a=this.getFile(o);if(P(a)||a.status.type!=="uploading")return;const n=Math.round(r.loaded*100/r.total);a.status.progress!==n&&this.updateFile(o,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:n}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(r,o)=>{const a=V.CancelToken.source(),n=new W(o.name,o.size,this.nextLocalFileId(),{type:"uploading",cancelToken:a,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,r.uploadUrl,o,s=>this.onUploadProgress(s,n.id),a.token).then(()=>this.onUploadComplete(n.id,r)).catch(s=>{V.isCancel(s)||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:s?s.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:r,element:o}=this.props,a=r.getFileUploaderStateValue(o);if(P(a))return l;const{uploadedFileInfo:n}=a;return P(n)||n.length===0?l:{files:n.map(s=>{const f=s.name,g=s.size,U=s.fileId,C=s.fileUrls;return new W(f,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:C})}),imgSrc:n.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=r=>r.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:r,widgetMgr:o,fragmentId:a}=this.props;o.getFileUploaderStateValue(r)===void 0&&o.setFileUploaderStateValue(r,l,{fromUi:!1},a)}createWidgetValue(){const l=this.state.files.filter(r=>r.status.type==="uploaded").map(r=>{const{name:o,size:a,status:n}=r;return new le({fileId:n.fileId,fileUrls:n.fileUrls,name:o,size:a})});return new de({uploadedFileInfo:l})}render(){var n;const{element:l,widgetMgr:r,disabled:o,width:a}=this.props;return this.formClearHelper.manageFormClearListener(r,l.formId,this.onFormCleared),R(D,{className:"stCameraInput","data-testid":"stCameraInput",children:[p(he,{label:l.label,disabled:o,labelVisibility:ce((n=l.labelVisibility)==null?void 0:n.value),children:l.help&&p(ue,{children:p(fe,{content:l.help,placement:B.TOP_RIGHT})})}),this.state.imgSrc?R(pe,{children:[p(O,{width:a,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&p(be,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:a,height:a*9/16})}),p(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||o,children:this.getProgress()?"Uploading...":R(we,{children:[p(j,{content:N,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):p(Pe,{handleCapture:this.handleCapture,width:a,disabled:o,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function je(t,l){return fetch(t).then(r=>r.arrayBuffer()).then(r=>new File([r],l,{type:"image/jpeg"}))}export{Be as default};
|
1
|
+
import{r as y,E as _,_ as T,n as E,az as Q,z as R,j as p,bu as J,bb as B,bp as K,b7 as Y,bo as j,bB as z,d as Z,g as ee,aN as te,y as re,bC as ie,bD as ae,am as oe,R as ne,aC as se,K as P,bl as le,bk as de,br as ce,bE as ue,bs as fe,bt as he,F as pe}from"./index.Blgy4CCd.js";import{a as V}from"./axios.upsvKRUO.js";import{F as ge}from"./FormClearHelper.D3S2tctS.js";import{U as W}from"./UploadFileInfo.C-jY39rj.js";import{P as me,S as ve}from"./ProgressBar.BqFWIdp2.js";var A=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),y.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"}))});A.displayName="Video";var N=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),y.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"}))});N.displayName="X";var $=y.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(_,T({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.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"}))});$.displayName="SwitchCamera";var L;(function(t){t.XSMALL="xsmall",t.SMALL="small",t.MEDIUM="medium",t.LARGE="large"})(L||(L={}));function Se(t,l){switch(t){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const D=E("div",{target:"e47j7ja0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),O=E("div",{target:"e47j7ja1"})(({theme:t,width:l})=>({backgroundColor:t.colors.secondaryBg,borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"})),ye=E("p",{target:"e47j7ja2"})(({theme:t})=>({marginTop:t.spacing.sm,textAlign:"center"})),be=E("img",{target:"e47j7ja3"})(({theme:t,opacity:l})=>({borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,objectFit:"contain",opacity:l})),Me=E("a",{target:"e47j7ja4"})(({theme:t})=>({color:t.colors.primary,display:"block",textDecoration:"none"})),we=E("span",{target:"e47j7ja5"})({display:"flex",alignItems:"center"}),Ce=E("div",{target:"e47j7ja6"})(({theme:t})=>({position:"absolute",top:t.spacing.lg,right:t.spacing.lg,zIndex:t.zIndices.priority,color:t.colors.fadedText40,mixBlendMode:"difference",opacity:.6})),Ue=E("div",{target:"e47j7ja8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ee=E("button",{target:"e47j7ja9"})(({theme:t})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:t.colors.lightenedBg05,border:`${t.sizes.borderWidth} solid ${t.colors.borderColor}`,borderRadius:`0 0 ${t.radii.default} ${t.radii.default}`,"&:hover":{borderColor:t.colors.primary,color:t.colors.primary},"&:active":{color:t.colors.white,borderColor:t.colors.primary,backgroundColor:t.colors.primary},"&:focus:not(:active)":{borderColor:t.colors.primary,color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:t.colors.fadedText40},fontWeight:t.fontWeights.normal,padding:`${t.spacing.xs} ${t.spacing.md}`,margin:t.spacing.none,lineHeight:t.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${Q(t.colors.primary,.5)}`},...Se("medium",t)}));function H({disabled:t,onClick:l,children:r,progress:o}){return R(Ee,{disabled:t||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[r,o&&p(Ue,{children:p(me,{value:o,size:ve.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F;(function(t){t.USER="user",t.ENVIRONMENT="environment"})(F||(F={}));const Ie=({switchFacingMode:t})=>p(Ce,{"data-testid":"stCameraInputSwitchButton",children:p(J,{content:"Switch camera",placement:B.TOP_RIGHT,children:p(K,{kind:Y.MINIMAL,onClick:t,children:p(j,{content:$,size:"twoXL",color:z.white})})})});var G={exports:{}};(function(t,l){(function(o,a){t.exports=a(y)})(Z,function(r){return function(o){var a={};function n(s){if(a[s])return a[s].exports;var f=a[s]={i:s,l:!1,exports:{}};return o[s].call(f.exports,f,f.exports,n),f.l=!0,f.exports}return n.m=o,n.c=a,n.d=function(s,f,g){n.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:g})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,f){if(f&1&&(s=n(s)),f&8||f&4&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(n.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),f&2&&typeof s!="string")for(var U in s)n.d(g,U,(function(C){return s[C]}).bind(null,U));return g},n.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(f,"a",f),f},n.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},n.p="",n(n.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(o,a,n){n.r(a);var s=n("react"),f=function(){var m=function(u,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,d){i.__proto__=d}||function(i,d){for(var c in d)d.hasOwnProperty(c)&&(i[c]=d[c])},m(u,e)};return function(u,e){m(u,e);function i(){this.constructor=u}u.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),g=function(){return g=Object.assign||function(m){for(var u,e=1,i=arguments.length;e<i;e++){u=arguments[e];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(m[d]=u[d])}return m},g.apply(this,arguments)},U=function(m,u){var e={};for(var i in m)Object.prototype.hasOwnProperty.call(m,i)&&u.indexOf(i)<0&&(e[i]=m[i]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,i=Object.getOwnPropertySymbols(m);d<i.length;d++)u.indexOf(i[d])<0&&Object.prototype.propertyIsEnumerable.call(m,i[d])&&(e[i[d]]=m[i[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(u){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return e?new Promise(function(i,d){e.call(navigator,u,i,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function C(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(m){f(u,m);function u(e){var i=m.call(this,e)||this;return i.canvas=null,i.ctx=null,i.requestUserMediaId=0,i.unmounted=!1,i.state={hasUserMedia:!1},i}return u.prototype.componentDidMount=function(){var e=this,i=e.state,d=e.props;if(this.unmounted=!1,!C()){d.onUserMediaError("getUserMedia not supported");return}i.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(e){var i=this.props;if(!C()){i.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(i.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(i.videoConstraints),b=e.minScreenshotWidth!==i.minScreenshotWidth,S=e.minScreenshotHeight!==i.minScreenshotHeight;(c||b||S)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(i){e.removeTrack(i),i.stop()}),e.getAudioTracks().map(function(i){e.removeTrack(i),i.stop()})):e.stop())},u.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(u.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},u.prototype.getScreenshot=function(e){var i=this,d=i.state,c=i.props;if(!d.hasUserMedia)return null;var b=this.getCanvas(e);return b&&b.toDataURL(c.screenshotFormat,c.screenshotQuality)},u.prototype.getCanvas=function(e){var i=this,d=i.state,c=i.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var b=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var h=b/S;b=c.minScreenshotWidth||this.video.clientWidth,S=b/h,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,b=S*h)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||b,this.canvas.height=(e==null?void 0:e.height)||S,this.ctx=this.canvas.getContext("2d")}var w=this,M=w.ctx,v=w.canvas;return M&&v&&(v.width=(e==null?void 0:e.width)||v.width,v.height=(e==null?void 0:e.height)||v.height,c.mirrored&&(M.translate(v.width,0),M.scale(-1,1)),M.imageSmoothingEnabled=c.imageSmoothing,M.drawImage(this.video,0,0,(e==null?void 0:e.width)||v.width,(e==null?void 0:e.height)||v.height),c.mirrored&&(M.scale(-1,1),M.translate(-v.width,0))),v},u.prototype.requestUserMedia=function(){var e=this,i=this.props,d=function(S,h){var w={video:typeof h<"u"?h:!0};i.audio&&(w.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var M=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(w).then(function(v){e.unmounted||M!==e.requestUserMediaId?u.stopMediaStream(v):e.handleUserMedia(null,v)}).catch(function(v){e.handleUserMedia(v)})};if("mediaDevices"in navigator)d(i.audioConstraints,i.videoConstraints);else{var c=function(S){return{optional:[{sourceId:S}]}},b=function(S){var h=S.deviceId;return typeof h=="string"?h:Array.isArray(h)&&h.length>0?h[0]:typeof h=="object"&&h.ideal?h.ideal:null};MediaStreamTrack.getSources(function(S){var h=null,w=null;S.forEach(function(x){x.kind==="audio"?h=x.id:x.kind==="video"&&(w=x.id)});var M=b(i.audioConstraints);M&&(h=M);var v=b(i.videoConstraints);v&&(w=v),d(c(h),c(w))})}},u.prototype.handleUserMedia=function(e,i){var d=this.props;if(e||!i){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=i;try{this.video&&(this.video.srcObject=i),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(i)})}d.onUserMedia(i)},u.prototype.render=function(){var e=this,i=this,d=i.state,c=i.props,b=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var S=c.mirrored,h=c.style,w=h===void 0?{}:h,M=c.children,v=U(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),x=S?g(g({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,q={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,src:d.src,muted:!b,playsInline:!0,ref:function(X){e.video=X},style:x},v)),M&&M(q))},u.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u}(s.Component);a.default=I},react:function(o,a){o.exports=r}}).default})})(G);var Fe=G.exports;const Re=ee(Fe);var k;(function(t){t.PENDING="pending",t.SUCCESS="success",t.ERROR="error"})(k||(k={}));const xe=({width:t})=>R(O,{width:t,children:[p(j,{size:"threeXL",color:z.gray60,content:A}),R(ye,{children:["This app would like to use your camera.",p(Me,{href:ae,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Pe=({handleCapture:t,width:l,disabled:r,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:n,setFacingMode:s,testOverride:f})=>{const[g,U]=y.useState(f||"pending"),C=y.useRef(null),[I,m]=y.useState(l),u=y.useCallback(te(1e3,m),[]);y.useEffect(()=>{u(l)},[l,u]);function e(){if(C.current!==null){const d=C.current.getScreenshot();t(d)}}const i=re();return R(D,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!r&&!o?p(xe,{width:I}):ie&&p(Ie,{switchFacingMode:s}),p(O,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!r&&!o,width:I,children:!r&&p(Re,{audio:!1,ref:C,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${i.radii.default} ${i.radii.default} 0 0`},onUserMediaError:()=>{U("error")},onUserMedia:()=>{U("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),p(H,{onClick:e,disabled:g!=="success"||r||o,children:"Take Photo"})]})},_e=150,Te=oe.getLogger("CameraInput");class Be extends ne.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new ge,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=r=>{this.setState({clearPhotoInProgress:r})},this.setFacingMode=()=>{this.setState(r=>({facingMode:r.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=r=>{if(r===null)return Promise.resolve();this.setState({imgSrc:r,shutter:!0,minShutterEffectPassed:!1});const o=a=>new Promise(n=>setTimeout(n,a));return je(r,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(a=>this.props.uploadClient.fetchFileURLs([a]).then(n=>({file:a,fileUrls:n[0]}))).then(({file:a,fileUrls:n})=>this.uploadFile(n,a)).then(()=>o(_e)).then(()=>{this.setState((a,n)=>({imgSrc:r,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{Te.error(a)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(r=>this.deleteFile(r.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const r=this.createWidgetValue(),{element:o,widgetMgr:a,fragmentId:n}=this.props,s=a.getFileUploaderStateValue(o);se(r,s)||a.setFileUploaderStateValue(o,r,{fromUi:!0},n)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const r=this.createWidgetValue();if(P(r))return;this.setState({imgSrc:null});const{widgetMgr:o,element:a,fragmentId:n}=this.props;o.setFileUploaderStateValue(a,r,{fromUi:!0},n)})},this.deleteFile=r=>{const o=this.getFile(r);P(o)||(o.status.type==="uploading"&&o.status.cancelToken.cancel(),o.status.type==="uploaded"&&o.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(o.status.fileUrls.deleteUrl),this.removeFile(r))},this.addFile=r=>{this.setState(o=>({files:[...o.files,r]}))},this.removeFile=r=>{this.setState(o=>({files:o.files.filter(a=>a.id!==r)}))},this.getFile=r=>this.state.files.find(o=>o.id===r),this.updateFile=(r,o)=>{this.setState(a=>({files:a.files.map(n=>n.id===r?o:n)}))},this.onUploadComplete=(r,o)=>{this.setState(()=>({shutter:!1}));const a=this.getFile(r);P(a)||a.status.type!=="uploading"||this.updateFile(a.id,a.setStatus({type:"uploaded",fileId:o.fileId,fileUrls:o}))},this.onUploadProgress=(r,o)=>{const a=this.getFile(o);if(P(a)||a.status.type!=="uploading")return;const n=Math.round(r.loaded*100/r.total);a.status.progress!==n&&this.updateFile(o,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:n}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(r,o)=>{const a=V.CancelToken.source(),n=new W(o.name,o.size,this.nextLocalFileId(),{type:"uploading",cancelToken:a,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,r.uploadUrl,o,s=>this.onUploadProgress(s,n.id),a.token).then(()=>this.onUploadComplete(n.id,r)).catch(s=>{V.isCancel(s)||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:s?s.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:r,element:o}=this.props,a=r.getFileUploaderStateValue(o);if(P(a))return l;const{uploadedFileInfo:n}=a;return P(n)||n.length===0?l:{files:n.map(s=>{const f=s.name,g=s.size,U=s.fileId,C=s.fileUrls;return new W(f,g,this.nextLocalFileId(),{type:"uploaded",fileId:U,fileUrls:C})}),imgSrc:n.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=r=>r.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:r,widgetMgr:o,fragmentId:a}=this.props;o.getFileUploaderStateValue(r)===void 0&&o.setFileUploaderStateValue(r,l,{fromUi:!1},a)}createWidgetValue(){const l=this.state.files.filter(r=>r.status.type==="uploaded").map(r=>{const{name:o,size:a,status:n}=r;return new le({fileId:n.fileId,fileUrls:n.fileUrls,name:o,size:a})});return new de({uploadedFileInfo:l})}render(){var n;const{element:l,widgetMgr:r,disabled:o,width:a}=this.props;return this.formClearHelper.manageFormClearListener(r,l.formId,this.onFormCleared),R(D,{className:"stCameraInput","data-testid":"stCameraInput",children:[p(he,{label:l.label,disabled:o,labelVisibility:ce((n=l.labelVisibility)==null?void 0:n.value),children:l.help&&p(ue,{children:p(fe,{content:l.help,placement:B.TOP_RIGHT})})}),this.state.imgSrc?R(pe,{children:[p(O,{width:a,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&p(be,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:a,height:a*9/16})}),p(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||o,children:this.getProgress()?"Uploading...":R(we,{children:[p(j,{content:N,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):p(Pe,{handleCapture:this.handleCapture,width:a,disabled:o,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function je(t,l){return fetch(t).then(r=>r.arrayBuffer()).then(r=>new File([r],l,{type:"image/jpeg"}))}export{Be as default};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{az as J6,n as Q6,aH as ga,aI as Od,C as jn,aJ as Z6,aK as eL,aL as dE,aM as tL,L as nL,y as iL,r as xt,K as Hy,g as rL,a6 as oL,ai as sL,ae as hE,af as pE,Q as aL,am as Mk,aN as uL,N as gE,aC as mE,z as lL,j as hm,aO as cL}from"./index.9wBA4A4f.js";import{S as yE,T as fL}from"./Toolbar.D-hUr0RX.js";import{u as Dk,E as Ok,w as dL}from"./withFullScreenWrapper.DwHjQb3H.js";import{m as hL}from"./mergeWith.BCa1_PWb.js";import{a as rc,n as pL,b as gL,c as up,t as Os,p as mL,d as yL,e as bL,i as Wo,f as lp,g as bE,l as ku,h as Gy,j as cp,k as vE,m as po,o as Va,q as vL,r as qo,s as xL,u as wL,v as EL,w as SL}from"./threshold.B8r8f5kt.js";import{f as _L,a as z0,b as Rk,c as $L,d as Vy,e as Xy,R as fp,C as Yy,r as Nk,g as xE,h as wE,i as dp,j as I0,n as zt,k as Oc,l as AL,m as kL,o as CL,p as FL,q as TL,s as ML,t as DL,u as OL,v as RL,w as NL,x as LL,y as Rd}from"./value.iufjd77T.js";import{P as PL,i as zL,a as IL,b as BL,p as Ky,n as UL,T as jL,t as WL,d as qL}from"./timer.RueuYoQV.js";import{u as HL}from"./FormClearHelper.BBpErIGP.js";const GL=e=>({"#vg-tooltip-element":{visibility:"hidden",position:"fixed",fontFamily:e.genericFonts.bodyFont,color:e.colors.bodyText,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,backgroundColor:J6(e.colors.bgColor,.05),fontSize:e.fontSizes.twoSm,boxShadow:"rgb(0 0 0 / 16%) 0px 1px 4px",maxWidth:e.sizes.maxChartTooltipWidth,padding:`${e.spacing.xs} ${e.spacing.md}`,borderRadius:e.radii.default,zIndex:e.zIndices.popup,"&.visible":{visibility:"visible"},h2:{marginTop:e.spacing.none,marginBottom:e.spacing.sm,fontSize:e.fontSizes.sm},td:{border:"none"},table:{borderSpacing:0,tr:{border:"none",td:{overflow:"hidden",textOverflow:"ellipsis",paddingTop:e.spacing.threeXS,paddingBottom:e.spacing.threeXS},"td.key":{maxWidth:`calc((${e.sizes.maxChartTooltipWidth} - 2 * ${e.spacing.md}) * 0.4)`,textAlign:"right",color:e.colors.fadedText60,whiteSpace:"nowrap",paddingRight:e.spacing.twoXS},"td.value":{maxWidth:`calc((${e.sizes.maxChartTooltipWidth} - 2 * ${e.spacing.md}) * 0.6)`,textAlign:"left",display:"-webkit-box",WebkitLineClamp:"5",WebkitBoxOrient:"vertical",lineClamp:"5",wordWrap:"break-word"}}}}}),VL=Q6("div",{target:"e1xm3y80"})(({theme:e,useContainerWidth:t,isFullScreen:n})=>({width:t||n?"100%":"auto",height:n?"100%":"auto","&.vega-embed":{position:"relative",display:"inline-block",boxSizing:"border-box","details:not([open]) > :not(summary)":{display:"none !important"},"details[open] summary":{opacity:.7},"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&:hover summary, &:focus-within summary":{opacity:"1 !important",transition:"opacity 0.2s ease"},"&.has-actions":{paddingRight:0},".vega-actions":{position:"absolute",display:"flex",flexDirection:"column",paddingBottom:e.spacing.sm,paddingTop:e.spacing.sm,zIndex:e.zIndices.popup,top:`calc(${e.iconSizes.md} + 2 * ${e.spacing.xs} + ${e.spacing.xs})`,right:0,backgroundColor:e.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`${e.sizes.borderWidth} solid ${e.colors.fadedText10}`,animationDuration:"0.15s",animationName:"scale-in",animationTimingFunction:"cubic-bezier(0.2, 0, 0.13, 1.5)",textAlign:"left",borderRadius:e.radii.default,a:{fontFamily:e.genericFonts.bodyFont,fontWeight:e.fontWeights.normal,fontSize:e.fontSizes.md,margin:0,padding:`${e.spacing.twoXS} ${e.spacing.twoXL}`,color:e.colors.bodyText,whiteSpace:"nowrap",textDecoration:"none"},"a:hover, a:focus":{backgroundColor:e.colors.secondaryBg,color:e.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},"@keyframes scale-in":{from:{opacity:0,transform:"scale(0.6)"},to:{opacity:1,transform:"scale(1)"}},".chart-wrapper":{"&.fit-x":{width:"100%"},"&.fit-y":{height:"100%"}},summary:{position:"absolute",top:0,right:0,opacity:0,listStyle:"none",cursor:"pointer",display:"list-item",padding:e.spacing.xs,height:"auto",zIndex:e.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:e.radii.default,color:e.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms",lineHeight:0,"&::-webkit-details-marker":{display:"none"},"&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:e.colors.bodyText,opacity:"1 !important",background:e.colors.darkenedBgMix25},svg:{width:e.iconSizes.md,height:e.iconSizes.md}}}}));function EE(e,t){const n={font:t.genericFonts.bodyFont,background:t.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:t.colors.headingColor,titleFontStyle:"normal",fontWeight:t.fontWeights.bold,fontSize:t.fontSizes.mdPx,orient:"top",offset:26},header:{titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.mdPx,titleColor:ga(t),titleFontStyle:"normal",labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:ga(t),labelFontStyle:"normal"},axis:{labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:ga(t),labelFontStyle:"normal",titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.smPx,titleColor:ga(t),titleFontStyle:"normal",ticks:!1,gridColor:Od(t),domain:!1,domainWidth:1,domainColor:Od(t),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:jn(t.spacing.lg),labelPadding:jn(t.spacing.lg),labelSeparation:jn(t.spacing.twoXS),labelOverlap:!0},legend:{labelFontSize:t.fontSizes.smPx,labelFontWeight:t.fontWeights.normal,labelColor:ga(t),titleFontSize:t.fontSizes.smPx,titleFontWeight:t.fontWeights.normal,titleFontStyle:"normal",titleColor:ga(t),titlePadding:5,labelPadding:jn(t.spacing.lg),columnPadding:jn(t.spacing.sm),rowPadding:jn(t.spacing.twoXS),padding:7,symbolStrokeWidth:jn(t.spacing.twoXS)},range:{category:Z6(t),diverging:eL(t),ramp:dE(t),heatmap:dE(t)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:jn(t.sizes.defaultChartHeight),continuousWidth:jn(t.sizes.defaultChartWidth)},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,color:tL(t)},bar:{binSpacing:jn(t.spacing.twoXS),discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return e?hL({},n,e,(i,r)=>Array.isArray(r)?r:void 0):n}function XL(e,t){const{colors:n,fontSizes:i,genericFonts:r}=t,o={labelFont:r.bodyFont,titleFont:r.bodyFont,labelFontSize:i.twoSmPx,titleFontSize:i.twoSmPx},s={background:n.bgColor,axis:{labelColor:n.bodyText,titleColor:n.bodyText,gridColor:Od(t),...o},legend:{labelColor:n.bodyText,titleColor:n.bodyText,...o},title:{color:n.bodyText,subtitleColor:n.bodyText,...o},header:{labelColor:n.bodyText,titleColor:n.bodyText,...o},view:{stroke:Od(t),continuousHeight:jn(t.sizes.defaultChartHeight),continuousWidth:jn(t.sizes.defaultChartWidth)},mark:{tooltip:!0}};return e?nL({},s,e):s}const YL=20;function KL(e){"params"in e&&"encoding"in e&&e.params.forEach(t=>{"select"in t&&(["interval","point"].includes(t.select)&&(t.select={type:t.select}),"type"in t.select&&t.select.type==="point"&&!("encodings"in t.select)&&Hy(t.select.encodings)&&(t.select.encodings=Object.keys(e.encoding)))})}const JL=(e,t,n,i,r,o,s,a)=>{var l,c;const u=JSON.parse(e);if(n==="streamlit"?u.config=EE(u.config,r):((c=(l=u.usermeta)==null?void 0:l.embedOptions)==null?void 0:c.theme)==="streamlit"?(u.config=EE(u.config,r),u.usermeta.embedOptions.theme=void 0):u.config=XL(u.config,r),o?(u.width=s,u.height=a,"vconcat"in u&&u.vconcat.forEach(f=>{f.width=s})):t&&(u.width=s,"vconcat"in u&&u.vconcat.forEach(f=>{f.width=s})),u.padding||(u.padding={}),Hy(u.padding.bottom)&&(u.padding.bottom=YL),u.datasets)throw new Error("Datasets should not be passed as part of the spec");return i.length>0&&KL(u),u},QL=e=>{const t=iL(),{expanded:n,width:i,height:r}=Dk(Ok),{id:o,formId:s,spec:a,data:u,datasets:l,useContainerWidth:c,vegaLiteTheme:f,selectionMode:d}=e,h=xt.useMemo(()=>d,[JSON.stringify(d)]),p=xt.useMemo(()=>JL(a,c,f,h,t,n,i,r),[a,c,f,h,t,n,i,r]);return{id:o,formId:s,vegaLiteTheme:f,spec:p,selectionMode:h,data:u,datasets:l,useContainerWidth:c}};function Sn(e,t,n){return e.fields=t||[],e.fname=n,e}function Je(e){return e==null?null:e.fname}function Ut(e){return e==null?null:e.fields}function Lk(e){return e.length===1?ZL(e[0]):eP(e)}const ZL=e=>function(t){return t[e]},eP=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function N(e){throw Error(e)}function ur(e){const t=[],n=e.length;let i=null,r=0,o="",s,a,u;e=e+"";function l(){t.push(o+e.substring(s,a)),o="",s=a+1}for(s=a=0;a<n;++a)if(u=e[a],u==="\\")o+=e.substring(s,a++),s=a;else if(u===i)l(),i=null,r=-1;else{if(i)continue;s===r&&u==='"'||s===r&&u==="'"?(s=a+1,i=u):u==="."&&!r?a>s?l():s=a+1:u==="["?(a>s&&l(),r=s=a+1):u==="]"&&(r||N("Access path missing open bracket: "+e),r>0&&l(),r=0,s=a+1)}return r&&N("Access path missing closing bracket: "+e),i&&N("Access path missing closing quote: "+e),a>s&&(a++,l()),t}function Jn(e,t,n){const i=ur(e);return e=i.length===1?i[0]:e,Sn((n&&n.get||Lk)(i),[e],t||e)}const Rc=Jn("id"),Ht=Sn(e=>e,[],"identity"),ho=Sn(()=>0,[],"zero"),Cu=Sn(()=>1,[],"one"),Nn=Sn(()=>!0,[],"true"),ro=Sn(()=>!1,[],"false");function tP(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const Pk=0,Jy=1,Qy=2,zk=3,Ik=4;function Zy(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tP,i=e||Pk;return{level(r){return arguments.length?(i=+r,this):i},error(){return i>=Jy&&n(t||"error","ERROR",arguments),this},warn(){return i>=Qy&&n(t||"warn","WARN",arguments),this},info(){return i>=zk&&n(t||"log","INFO",arguments),this},debug(){return i>=Ik&&n(t||"log","DEBUG",arguments),this}}}var L=Array.isArray;function X(e){return e===Object(e)}const SE=e=>e!=="__proto__";function Fu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce((i,r)=>{for(const o in r)if(o==="signals")i.signals=nP(i.signals,r.signals);else{const s=o==="legend"?{layout:1}:o==="style"?!0:null;Tu(i,o,r[o],s)}return i},{})}function Tu(e,t,n,i){if(!SE(t))return;let r,o;if(X(n)&&!L(n)){o=X(e[t])?e[t]:e[t]={};for(r in n)i&&(i===!0||i[r])?Tu(o,r,n[r]):SE(r)&&(o[r]=n[r])}else e[t]=n}function nP(e,t){if(e==null)return t;const n={},i=[];function r(o){n[o.name]||(n[o.name]=1,i.push(o))}return t.forEach(r),e.forEach(r),i}function xe(e){return e[e.length-1]}function It(e){return e==null||e===""?null:+e}const Bk=e=>t=>e*Math.exp(t),Uk=e=>t=>Math.log(e*t),jk=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Wk=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Nd=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function hp(e,t,n,i){const r=n(e[0]),o=n(xe(e)),s=(o-r)*t;return[i(r-s),i(o-s)]}function qk(e,t){return hp(e,t,It,Ht)}function Hk(e,t){var n=Math.sign(e[0]);return hp(e,t,Uk(n),Bk(n))}function Gk(e,t,n){return hp(e,t,Nd(n),Nd(1/n))}function Vk(e,t,n){return hp(e,t,jk(n),Wk(n))}function pp(e,t,n,i,r){const o=i(e[0]),s=i(xe(e)),a=t!=null?i(t):(o+s)/2;return[r(a+(o-a)*n),r(a+(s-a)*n)]}function eb(e,t,n){return pp(e,t,n,It,Ht)}function tb(e,t,n){const i=Math.sign(e[0]);return pp(e,t,n,Uk(i),Bk(i))}function Ld(e,t,n,i){return pp(e,t,n,Nd(i),Nd(1/i))}function nb(e,t,n,i){return pp(e,t,n,jk(i),Wk(i))}function Xk(e){return 1+~~(new Date(e).getMonth()/3)}function Yk(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Y(e){return e!=null?L(e)?e:[e]:[]}function Kk(e,t,n){let i=e[0],r=e[1],o;return r<i&&(o=r,r=i,i=o),o=r-i,o>=n-t?[t,n]:[i=Math.min(Math.max(i,t),n-o),i+o]}function fe(e){return typeof e=="function"}const iP="descending";function ib(e,t,n){n=n||{},t=Y(t)||[];const i=[],r=[],o={},s=n.comparator||rP;return Y(e).forEach((a,u)=>{a!=null&&(i.push(t[u]===iP?-1:1),r.push(a=fe(a)?a:Jn(a,null,n)),(Ut(a)||[]).forEach(l=>o[l]=1))}),r.length===0?null:Sn(s(r,i),Object.keys(o))}const gp=(e,t)=>(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0),rP=(e,t)=>e.length===1?oP(e[0],t[0]):sP(e,t,e.length),oP=(e,t)=>function(n,i){return gp(e(n),e(i))*t},sP=(e,t,n)=>(t.push(0),function(i,r){let o,s=0,a=-1;for(;s===0&&++a<n;)o=e[a],s=gp(o(i),o(r));return s*t[a]});function Gt(e){return fe(e)?e:()=>e}function rb(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout(()=>(t(i),n=null),e)}}function ce(e){for(let t,n,i=1,r=arguments.length;i<r;++i){t=arguments[i];for(n in t)e[n]=t[n]}return e}function Zi(e,t){let n=0,i,r,o,s;if(e&&(i=e.length))if(t==null){for(r=e[n];n<i&&(r==null||r!==r);r=e[++n]);for(o=s=r;n<i;++n)r=e[n],r!=null&&(r<o&&(o=r),r>s&&(s=r))}else{for(r=t(e[n]);n<i&&(r==null||r!==r);r=t(e[++n]));for(o=s=r;n<i;++n)r=t(e[n]),r!=null&&(r<o&&(o=r),r>s&&(s=r))}return[o,s]}function Jk(e,t){const n=e.length;let i=-1,r,o,s,a,u;if(t==null){for(;++i<n;)if(o=e[i],o!=null&&o>=o){r=s=o;break}if(i===n)return[-1,-1];for(a=u=i;++i<n;)o=e[i],o!=null&&(r>o&&(r=o,a=i),s<o&&(s=o,u=i))}else{for(;++i<n;)if(o=t(e[i],i,e),o!=null&&o>=o){r=s=o;break}if(i===n)return[-1,-1];for(a=u=i;++i<n;)o=t(e[i],i,e),o!=null&&(r>o&&(r=o,a=i),s<o&&(s=o,u=i))}return[a,u]}const aP=Object.prototype.hasOwnProperty;function J(e,t){return aP.call(e,t)}const $f={};function Mu(e){let t={},n;function i(o){return J(t,o)&&t[o]!==$f}const r={size:0,empty:0,object:t,has:i,get(o){return i(o)?t[o]:void 0},set(o,s){return i(o)||(++r.size,t[o]===$f&&--r.empty),t[o]=s,this},delete(o){return i(o)&&(--r.size,++r.empty,t[o]=$f),this},clear(){r.size=r.empty=0,r.object=t={}},test(o){return arguments.length?(n=o,r):n},clean(){const o={};let s=0;for(const a in t){const u=t[a];u!==$f&&(!n||!n(u))&&(o[a]=u,++s)}r.size=s,r.empty=0,r.object=t=o}};return e&&Object.keys(e).forEach(o=>{r.set(o,e[o])}),r}function Qk(e,t,n,i,r,o){if(!n&&n!==0)return o;const s=+n;let a=e[0],u=xe(e),l;u<a&&(l=a,a=u,u=l),l=Math.abs(t-a);const c=Math.abs(u-t);return l<c&&l<=s?i:c<=s?r:o}function G(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),ce(i,n)}function Ma(e,t,n,i){let r=t[0],o=t[t.length-1],s;return r>o&&(s=r,r=o,o=s),n=n===void 0||n,i=i===void 0||i,(n?r<=e:r<e)&&(i?e<=o:e<o)}function Ho(e){return typeof e=="boolean"}function _o(e){return Object.prototype.toString.call(e)==="[object Date]"}function Zk(e){return e&&fe(e[Symbol.iterator])}function $e(e){return typeof e=="number"}function eC(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function K(e){return typeof e=="string"}function ob(e,t,n){e&&(e=t?Y(e).map(a=>a.replace(/\\(.)/g,"$1")):Y(e));const i=e&&e.length,r=n&&n.get||Lk,o=a=>r(t?[a]:ur(a));let s;if(!i)s=function(){return""};else if(i===1){const a=o(e[0]);s=function(u){return""+a(u)}}else{const a=e.map(o);s=function(u){let l=""+a[0](u),c=0;for(;++c<i;)l+="|"+a[c](u);return l}}return Sn(s,e,"key")}function tC(e,t){const n=e[0],i=xe(e),r=+t;return r?r===1?i:n+r*(i-n):n}const uP=1e4;function nC(e){e=+e||uP;let t,n,i;const r=()=>{t={},n={},i=0},o=(s,a)=>(++i>e&&(n=t,t={},i=1),t[s]=a);return r(),{clear:r,has:s=>J(t,s)||J(n,s),get:s=>J(t,s)?t[s]:J(n,s)?o(s,n[s]):void 0,set:(s,a)=>J(t,s)?t[s]=a:o(s,a)}}function iC(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const s=i||new t.constructor(r+o);let a=0,u=0,l=0;for(;a<r&&u<o;++l)s[l]=e(t[a],n[u])>0?n[u++]:t[a++];for(;a<r;++a,++l)s[l]=t[a];for(;u<o;++u,++l)s[l]=n[u];return s}function El(e,t){let n="";for(;--t>=0;)n+=e;return n}function rC(e,t,n,i){const r=n||" ",o=e+"",s=t-o.length;return s<=0?o:i==="left"?El(r,s)+o:i==="center"?El(r,~~(s/2))+o+El(r,Math.ceil(s/2)):o+El(r,s)}function Nc(e){return e&&xe(e)-e[0]||0}function H(e){return L(e)?"["+e.map(H)+"]":X(e)||K(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function sb(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const lP=e=>$e(e)||_o(e)?e:Date.parse(e);function ab(e,t){return t=t||lP,e==null||e===""?null:t(e)}function ub(e){return e==null||e===""?null:e+""}function vi(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}function oC(e,t,n,i){const r=i??"…",o=e+"",s=o.length,a=Math.max(0,t-r.length);return s<=t?o:n==="left"?r+o.slice(s-a):n==="center"?o.slice(0,Math.ceil(a/2))+r+o.slice(s-~~(a/2)):o.slice(0,a)+r}function ao(e,t,n){if(e)if(t){const i=e.length;for(let r=0;r<i;++r){const o=t(e[r]);o&&n(o,r,e)}}else e.forEach(n)}var _E={},pm={},gm=34,Qu=10,mm=13;function sC(e){return new Function("d","return {"+e.map(function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'}).join(",")+"}")}function cP(e,t){var n=sC(e);return function(i,r){return t(n(i),r,e)}}function $E(e){var t=Object.create(null),n=[];return e.forEach(function(i){for(var r in i)r in t||n.push(t[r]=r)}),n}function fn(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function fP(e){return e<0?"-"+fn(-e,6):e>9999?"+"+fn(e,6):fn(e,4)}function dP(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),r=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":fP(e.getUTCFullYear())+"-"+fn(e.getUTCMonth()+1,2)+"-"+fn(e.getUTCDate(),2)+(r?"T"+fn(t,2)+":"+fn(n,2)+":"+fn(i,2)+"."+fn(r,3)+"Z":i?"T"+fn(t,2)+":"+fn(n,2)+":"+fn(i,2)+"Z":n||t?"T"+fn(t,2)+":"+fn(n,2)+"Z":"")}function hP(e){var t=new RegExp('["'+e+`
|
1
|
+
import{az as J6,n as Q6,aH as ga,aI as Od,C as jn,aJ as Z6,aK as eL,aL as dE,aM as tL,L as nL,y as iL,r as xt,K as Hy,g as rL,a6 as oL,ai as sL,ae as hE,af as pE,Q as aL,am as Mk,aN as uL,N as gE,aC as mE,z as lL,j as hm,aO as cL}from"./index.Blgy4CCd.js";import{S as yE,T as fL}from"./Toolbar.CRowl_WL.js";import{u as Dk,E as Ok,w as dL}from"./withFullScreenWrapper.XgZUnj3Y.js";import{m as hL}from"./mergeWith.mP6-fMJS.js";import{a as rc,n as pL,b as gL,c as up,t as Os,p as mL,d as yL,e as bL,i as Wo,f as lp,g as bE,l as ku,h as Gy,j as cp,k as vE,m as po,o as Va,q as vL,r as qo,s as xL,u as wL,v as EL,w as SL}from"./threshold.B8r8f5kt.js";import{f as _L,a as z0,b as Rk,c as $L,d as Vy,e as Xy,R as fp,C as Yy,r as Nk,g as xE,h as wE,i as dp,j as I0,n as zt,k as Oc,l as AL,m as kL,o as CL,p as FL,q as TL,s as ML,t as DL,u as OL,v as RL,w as NL,x as LL,y as Rd}from"./value.iufjd77T.js";import{P as PL,i as zL,a as IL,b as BL,p as Ky,n as UL,T as jL,t as WL,d as qL}from"./timer.RueuYoQV.js";import{u as HL}from"./FormClearHelper.D3S2tctS.js";const GL=e=>({"#vg-tooltip-element":{visibility:"hidden",position:"fixed",fontFamily:e.genericFonts.bodyFont,color:e.colors.bodyText,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,backgroundColor:J6(e.colors.bgColor,.05),fontSize:e.fontSizes.twoSm,boxShadow:"rgb(0 0 0 / 16%) 0px 1px 4px",maxWidth:e.sizes.maxChartTooltipWidth,padding:`${e.spacing.xs} ${e.spacing.md}`,borderRadius:e.radii.default,zIndex:e.zIndices.popup,"&.visible":{visibility:"visible"},h2:{marginTop:e.spacing.none,marginBottom:e.spacing.sm,fontSize:e.fontSizes.sm},td:{border:"none"},table:{borderSpacing:0,tr:{border:"none",td:{overflow:"hidden",textOverflow:"ellipsis",paddingTop:e.spacing.threeXS,paddingBottom:e.spacing.threeXS},"td.key":{maxWidth:`calc((${e.sizes.maxChartTooltipWidth} - 2 * ${e.spacing.md}) * 0.4)`,textAlign:"right",color:e.colors.fadedText60,whiteSpace:"nowrap",paddingRight:e.spacing.twoXS},"td.value":{maxWidth:`calc((${e.sizes.maxChartTooltipWidth} - 2 * ${e.spacing.md}) * 0.6)`,textAlign:"left",display:"-webkit-box",WebkitLineClamp:"5",WebkitBoxOrient:"vertical",lineClamp:"5",wordWrap:"break-word"}}}}}),VL=Q6("div",{target:"e1xm3y80"})(({theme:e,useContainerWidth:t,isFullScreen:n})=>({width:t||n?"100%":"auto",height:n?"100%":"auto","&.vega-embed":{position:"relative",display:"inline-block",boxSizing:"border-box","details:not([open]) > :not(summary)":{display:"none !important"},"details[open] summary":{opacity:.7},"&:hover summary, .vega-embed:focus summary":{background:"transparent"},"&:hover summary, &:focus-within summary":{opacity:"1 !important",transition:"opacity 0.2s ease"},"&.has-actions":{paddingRight:0},".vega-actions":{position:"absolute",display:"flex",flexDirection:"column",paddingBottom:e.spacing.sm,paddingTop:e.spacing.sm,zIndex:e.zIndices.popup,top:`calc(${e.iconSizes.md} + 2 * ${e.spacing.xs} + ${e.spacing.xs})`,right:0,backgroundColor:e.colors.bgColor,boxShadow:"rgb(0 0 0 / 16%) 0px 4px 16px",border:`${e.sizes.borderWidth} solid ${e.colors.fadedText10}`,animationDuration:"0.15s",animationName:"scale-in",animationTimingFunction:"cubic-bezier(0.2, 0, 0.13, 1.5)",textAlign:"left",borderRadius:e.radii.default,a:{fontFamily:e.genericFonts.bodyFont,fontWeight:e.fontWeights.normal,fontSize:e.fontSizes.md,margin:0,padding:`${e.spacing.twoXS} ${e.spacing.twoXL}`,color:e.colors.bodyText,whiteSpace:"nowrap",textDecoration:"none"},"a:hover, a:focus":{backgroundColor:e.colors.secondaryBg,color:e.colors.bodyText},":before":{content:"none"},":after":{content:"none"}},"@keyframes scale-in":{from:{opacity:0,transform:"scale(0.6)"},to:{opacity:1,transform:"scale(1)"}},".chart-wrapper":{"&.fit-x":{width:"100%"},"&.fit-y":{height:"100%"}},summary:{position:"absolute",top:0,right:0,opacity:0,listStyle:"none",cursor:"pointer",display:"list-item",padding:e.spacing.xs,height:"auto",zIndex:e.zIndices.menuButton,border:"none",boxShadow:"none",borderRadius:e.radii.default,color:e.colors.fadedText10,backgroundColor:"transparent",transition:"opacity 300ms 150ms,transform 300ms 150ms",lineHeight:0,"&::-webkit-details-marker":{display:"none"},"&:active, &:focus-visible, &:hover":{border:"none",boxShadow:"none",color:e.colors.bodyText,opacity:"1 !important",background:e.colors.darkenedBgMix25},svg:{width:e.iconSizes.md,height:e.iconSizes.md}}}}));function EE(e,t){const n={font:t.genericFonts.bodyFont,background:t.colors.bgColor,fieldTitle:"verbal",autosize:{type:"fit",contains:"padding"},title:{align:"left",anchor:"start",color:t.colors.headingColor,titleFontStyle:"normal",fontWeight:t.fontWeights.bold,fontSize:t.fontSizes.mdPx,orient:"top",offset:26},header:{titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.mdPx,titleColor:ga(t),titleFontStyle:"normal",labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:ga(t),labelFontStyle:"normal"},axis:{labelFontSize:t.fontSizes.twoSmPx,labelFontWeight:t.fontWeights.normal,labelColor:ga(t),labelFontStyle:"normal",titleFontWeight:t.fontWeights.normal,titleFontSize:t.fontSizes.smPx,titleColor:ga(t),titleFontStyle:"normal",ticks:!1,gridColor:Od(t),domain:!1,domainWidth:1,domainColor:Od(t),labelFlush:!0,labelFlushOffset:1,labelBound:!1,labelLimit:100,titlePadding:jn(t.spacing.lg),labelPadding:jn(t.spacing.lg),labelSeparation:jn(t.spacing.twoXS),labelOverlap:!0},legend:{labelFontSize:t.fontSizes.smPx,labelFontWeight:t.fontWeights.normal,labelColor:ga(t),titleFontSize:t.fontSizes.smPx,titleFontWeight:t.fontWeights.normal,titleFontStyle:"normal",titleColor:ga(t),titlePadding:5,labelPadding:jn(t.spacing.lg),columnPadding:jn(t.spacing.sm),rowPadding:jn(t.spacing.twoXS),padding:7,symbolStrokeWidth:jn(t.spacing.twoXS)},range:{category:Z6(t),diverging:eL(t),ramp:dE(t),heatmap:dE(t)},view:{columns:1,strokeWidth:0,stroke:"transparent",continuousHeight:jn(t.sizes.defaultChartHeight),continuousWidth:jn(t.sizes.defaultChartWidth)},concat:{columns:1},facet:{columns:1},mark:{tooltip:!0,color:tL(t)},bar:{binSpacing:jn(t.spacing.twoXS),discreteBandSize:{band:.85}},axisDiscrete:{grid:!1},axisXPoint:{grid:!1},axisTemporal:{grid:!1},axisXBand:{grid:!1}};return e?hL({},n,e,(i,r)=>Array.isArray(r)?r:void 0):n}function XL(e,t){const{colors:n,fontSizes:i,genericFonts:r}=t,o={labelFont:r.bodyFont,titleFont:r.bodyFont,labelFontSize:i.twoSmPx,titleFontSize:i.twoSmPx},s={background:n.bgColor,axis:{labelColor:n.bodyText,titleColor:n.bodyText,gridColor:Od(t),...o},legend:{labelColor:n.bodyText,titleColor:n.bodyText,...o},title:{color:n.bodyText,subtitleColor:n.bodyText,...o},header:{labelColor:n.bodyText,titleColor:n.bodyText,...o},view:{stroke:Od(t),continuousHeight:jn(t.sizes.defaultChartHeight),continuousWidth:jn(t.sizes.defaultChartWidth)},mark:{tooltip:!0}};return e?nL({},s,e):s}const YL=20;function KL(e){"params"in e&&"encoding"in e&&e.params.forEach(t=>{"select"in t&&(["interval","point"].includes(t.select)&&(t.select={type:t.select}),"type"in t.select&&t.select.type==="point"&&!("encodings"in t.select)&&Hy(t.select.encodings)&&(t.select.encodings=Object.keys(e.encoding)))})}const JL=(e,t,n,i,r,o,s,a)=>{var l,c;const u=JSON.parse(e);if(n==="streamlit"?u.config=EE(u.config,r):((c=(l=u.usermeta)==null?void 0:l.embedOptions)==null?void 0:c.theme)==="streamlit"?(u.config=EE(u.config,r),u.usermeta.embedOptions.theme=void 0):u.config=XL(u.config,r),o?(u.width=s,u.height=a,"vconcat"in u&&u.vconcat.forEach(f=>{f.width=s})):t&&(u.width=s,"vconcat"in u&&u.vconcat.forEach(f=>{f.width=s})),u.padding||(u.padding={}),Hy(u.padding.bottom)&&(u.padding.bottom=YL),u.datasets)throw new Error("Datasets should not be passed as part of the spec");return i.length>0&&KL(u),u},QL=e=>{const t=iL(),{expanded:n,width:i,height:r}=Dk(Ok),{id:o,formId:s,spec:a,data:u,datasets:l,useContainerWidth:c,vegaLiteTheme:f,selectionMode:d}=e,h=xt.useMemo(()=>d,[JSON.stringify(d)]),p=xt.useMemo(()=>JL(a,c,f,h,t,n,i,r),[a,c,f,h,t,n,i,r]);return{id:o,formId:s,vegaLiteTheme:f,spec:p,selectionMode:h,data:u,datasets:l,useContainerWidth:c}};function Sn(e,t,n){return e.fields=t||[],e.fname=n,e}function Je(e){return e==null?null:e.fname}function Ut(e){return e==null?null:e.fields}function Lk(e){return e.length===1?ZL(e[0]):eP(e)}const ZL=e=>function(t){return t[e]},eP=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function N(e){throw Error(e)}function ur(e){const t=[],n=e.length;let i=null,r=0,o="",s,a,u;e=e+"";function l(){t.push(o+e.substring(s,a)),o="",s=a+1}for(s=a=0;a<n;++a)if(u=e[a],u==="\\")o+=e.substring(s,a++),s=a;else if(u===i)l(),i=null,r=-1;else{if(i)continue;s===r&&u==='"'||s===r&&u==="'"?(s=a+1,i=u):u==="."&&!r?a>s?l():s=a+1:u==="["?(a>s&&l(),r=s=a+1):u==="]"&&(r||N("Access path missing open bracket: "+e),r>0&&l(),r=0,s=a+1)}return r&&N("Access path missing closing bracket: "+e),i&&N("Access path missing closing quote: "+e),a>s&&(a++,l()),t}function Jn(e,t,n){const i=ur(e);return e=i.length===1?i[0]:e,Sn((n&&n.get||Lk)(i),[e],t||e)}const Rc=Jn("id"),Ht=Sn(e=>e,[],"identity"),ho=Sn(()=>0,[],"zero"),Cu=Sn(()=>1,[],"one"),Nn=Sn(()=>!0,[],"true"),ro=Sn(()=>!1,[],"false");function tP(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}const Pk=0,Jy=1,Qy=2,zk=3,Ik=4;function Zy(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tP,i=e||Pk;return{level(r){return arguments.length?(i=+r,this):i},error(){return i>=Jy&&n(t||"error","ERROR",arguments),this},warn(){return i>=Qy&&n(t||"warn","WARN",arguments),this},info(){return i>=zk&&n(t||"log","INFO",arguments),this},debug(){return i>=Ik&&n(t||"log","DEBUG",arguments),this}}}var L=Array.isArray;function X(e){return e===Object(e)}const SE=e=>e!=="__proto__";function Fu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce((i,r)=>{for(const o in r)if(o==="signals")i.signals=nP(i.signals,r.signals);else{const s=o==="legend"?{layout:1}:o==="style"?!0:null;Tu(i,o,r[o],s)}return i},{})}function Tu(e,t,n,i){if(!SE(t))return;let r,o;if(X(n)&&!L(n)){o=X(e[t])?e[t]:e[t]={};for(r in n)i&&(i===!0||i[r])?Tu(o,r,n[r]):SE(r)&&(o[r]=n[r])}else e[t]=n}function nP(e,t){if(e==null)return t;const n={},i=[];function r(o){n[o.name]||(n[o.name]=1,i.push(o))}return t.forEach(r),e.forEach(r),i}function xe(e){return e[e.length-1]}function It(e){return e==null||e===""?null:+e}const Bk=e=>t=>e*Math.exp(t),Uk=e=>t=>Math.log(e*t),jk=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),Wk=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,Nd=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function hp(e,t,n,i){const r=n(e[0]),o=n(xe(e)),s=(o-r)*t;return[i(r-s),i(o-s)]}function qk(e,t){return hp(e,t,It,Ht)}function Hk(e,t){var n=Math.sign(e[0]);return hp(e,t,Uk(n),Bk(n))}function Gk(e,t,n){return hp(e,t,Nd(n),Nd(1/n))}function Vk(e,t,n){return hp(e,t,jk(n),Wk(n))}function pp(e,t,n,i,r){const o=i(e[0]),s=i(xe(e)),a=t!=null?i(t):(o+s)/2;return[r(a+(o-a)*n),r(a+(s-a)*n)]}function eb(e,t,n){return pp(e,t,n,It,Ht)}function tb(e,t,n){const i=Math.sign(e[0]);return pp(e,t,n,Uk(i),Bk(i))}function Ld(e,t,n,i){return pp(e,t,n,Nd(i),Nd(1/i))}function nb(e,t,n,i){return pp(e,t,n,jk(i),Wk(i))}function Xk(e){return 1+~~(new Date(e).getMonth()/3)}function Yk(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Y(e){return e!=null?L(e)?e:[e]:[]}function Kk(e,t,n){let i=e[0],r=e[1],o;return r<i&&(o=r,r=i,i=o),o=r-i,o>=n-t?[t,n]:[i=Math.min(Math.max(i,t),n-o),i+o]}function fe(e){return typeof e=="function"}const iP="descending";function ib(e,t,n){n=n||{},t=Y(t)||[];const i=[],r=[],o={},s=n.comparator||rP;return Y(e).forEach((a,u)=>{a!=null&&(i.push(t[u]===iP?-1:1),r.push(a=fe(a)?a:Jn(a,null,n)),(Ut(a)||[]).forEach(l=>o[l]=1))}),r.length===0?null:Sn(s(r,i),Object.keys(o))}const gp=(e,t)=>(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0),rP=(e,t)=>e.length===1?oP(e[0],t[0]):sP(e,t,e.length),oP=(e,t)=>function(n,i){return gp(e(n),e(i))*t},sP=(e,t,n)=>(t.push(0),function(i,r){let o,s=0,a=-1;for(;s===0&&++a<n;)o=e[a],s=gp(o(i),o(r));return s*t[a]});function Gt(e){return fe(e)?e:()=>e}function rb(e,t){let n;return i=>{n&&clearTimeout(n),n=setTimeout(()=>(t(i),n=null),e)}}function ce(e){for(let t,n,i=1,r=arguments.length;i<r;++i){t=arguments[i];for(n in t)e[n]=t[n]}return e}function Zi(e,t){let n=0,i,r,o,s;if(e&&(i=e.length))if(t==null){for(r=e[n];n<i&&(r==null||r!==r);r=e[++n]);for(o=s=r;n<i;++n)r=e[n],r!=null&&(r<o&&(o=r),r>s&&(s=r))}else{for(r=t(e[n]);n<i&&(r==null||r!==r);r=t(e[++n]));for(o=s=r;n<i;++n)r=t(e[n]),r!=null&&(r<o&&(o=r),r>s&&(s=r))}return[o,s]}function Jk(e,t){const n=e.length;let i=-1,r,o,s,a,u;if(t==null){for(;++i<n;)if(o=e[i],o!=null&&o>=o){r=s=o;break}if(i===n)return[-1,-1];for(a=u=i;++i<n;)o=e[i],o!=null&&(r>o&&(r=o,a=i),s<o&&(s=o,u=i))}else{for(;++i<n;)if(o=t(e[i],i,e),o!=null&&o>=o){r=s=o;break}if(i===n)return[-1,-1];for(a=u=i;++i<n;)o=t(e[i],i,e),o!=null&&(r>o&&(r=o,a=i),s<o&&(s=o,u=i))}return[a,u]}const aP=Object.prototype.hasOwnProperty;function J(e,t){return aP.call(e,t)}const $f={};function Mu(e){let t={},n;function i(o){return J(t,o)&&t[o]!==$f}const r={size:0,empty:0,object:t,has:i,get(o){return i(o)?t[o]:void 0},set(o,s){return i(o)||(++r.size,t[o]===$f&&--r.empty),t[o]=s,this},delete(o){return i(o)&&(--r.size,++r.empty,t[o]=$f),this},clear(){r.size=r.empty=0,r.object=t={}},test(o){return arguments.length?(n=o,r):n},clean(){const o={};let s=0;for(const a in t){const u=t[a];u!==$f&&(!n||!n(u))&&(o[a]=u,++s)}r.size=s,r.empty=0,r.object=t=o}};return e&&Object.keys(e).forEach(o=>{r.set(o,e[o])}),r}function Qk(e,t,n,i,r,o){if(!n&&n!==0)return o;const s=+n;let a=e[0],u=xe(e),l;u<a&&(l=a,a=u,u=l),l=Math.abs(t-a);const c=Math.abs(u-t);return l<c&&l<=s?i:c<=s?r:o}function G(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),ce(i,n)}function Ma(e,t,n,i){let r=t[0],o=t[t.length-1],s;return r>o&&(s=r,r=o,o=s),n=n===void 0||n,i=i===void 0||i,(n?r<=e:r<e)&&(i?e<=o:e<o)}function Ho(e){return typeof e=="boolean"}function _o(e){return Object.prototype.toString.call(e)==="[object Date]"}function Zk(e){return e&&fe(e[Symbol.iterator])}function $e(e){return typeof e=="number"}function eC(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function K(e){return typeof e=="string"}function ob(e,t,n){e&&(e=t?Y(e).map(a=>a.replace(/\\(.)/g,"$1")):Y(e));const i=e&&e.length,r=n&&n.get||Lk,o=a=>r(t?[a]:ur(a));let s;if(!i)s=function(){return""};else if(i===1){const a=o(e[0]);s=function(u){return""+a(u)}}else{const a=e.map(o);s=function(u){let l=""+a[0](u),c=0;for(;++c<i;)l+="|"+a[c](u);return l}}return Sn(s,e,"key")}function tC(e,t){const n=e[0],i=xe(e),r=+t;return r?r===1?i:n+r*(i-n):n}const uP=1e4;function nC(e){e=+e||uP;let t,n,i;const r=()=>{t={},n={},i=0},o=(s,a)=>(++i>e&&(n=t,t={},i=1),t[s]=a);return r(),{clear:r,has:s=>J(t,s)||J(n,s),get:s=>J(t,s)?t[s]:J(n,s)?o(s,n[s]):void 0,set:(s,a)=>J(t,s)?t[s]=a:o(s,a)}}function iC(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const s=i||new t.constructor(r+o);let a=0,u=0,l=0;for(;a<r&&u<o;++l)s[l]=e(t[a],n[u])>0?n[u++]:t[a++];for(;a<r;++a,++l)s[l]=t[a];for(;u<o;++u,++l)s[l]=n[u];return s}function El(e,t){let n="";for(;--t>=0;)n+=e;return n}function rC(e,t,n,i){const r=n||" ",o=e+"",s=t-o.length;return s<=0?o:i==="left"?El(r,s)+o:i==="center"?El(r,~~(s/2))+o+El(r,Math.ceil(s/2)):o+El(r,s)}function Nc(e){return e&&xe(e)-e[0]||0}function H(e){return L(e)?"["+e.map(H)+"]":X(e)||K(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function sb(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const lP=e=>$e(e)||_o(e)?e:Date.parse(e);function ab(e,t){return t=t||lP,e==null||e===""?null:t(e)}function ub(e){return e==null||e===""?null:e+""}function vi(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}function oC(e,t,n,i){const r=i??"…",o=e+"",s=o.length,a=Math.max(0,t-r.length);return s<=t?o:n==="left"?r+o.slice(s-a):n==="center"?o.slice(0,Math.ceil(a/2))+r+o.slice(s-~~(a/2)):o.slice(0,a)+r}function ao(e,t,n){if(e)if(t){const i=e.length;for(let r=0;r<i;++r){const o=t(e[r]);o&&n(o,r,e)}}else e.forEach(n)}var _E={},pm={},gm=34,Qu=10,mm=13;function sC(e){return new Function("d","return {"+e.map(function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'}).join(",")+"}")}function cP(e,t){var n=sC(e);return function(i,r){return t(n(i),r,e)}}function $E(e){var t=Object.create(null),n=[];return e.forEach(function(i){for(var r in i)r in t||n.push(t[r]=r)}),n}function fn(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function fP(e){return e<0?"-"+fn(-e,6):e>9999?"+"+fn(e,6):fn(e,4)}function dP(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),r=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":fP(e.getUTCFullYear())+"-"+fn(e.getUTCMonth()+1,2)+"-"+fn(e.getUTCDate(),2)+(r?"T"+fn(t,2)+":"+fn(n,2)+":"+fn(i,2)+"."+fn(r,3)+"Z":i?"T"+fn(t,2)+":"+fn(n,2)+":"+fn(i,2)+"Z":n||t?"T"+fn(t,2)+":"+fn(n,2)+"Z":"")}function hP(e){var t=new RegExp('["'+e+`
|
2
2
|
\r]`),n=e.charCodeAt(0);function i(f,d){var h,p,g=r(f,function(m,y){if(h)return h(m,y-1);p=m,h=d?cP(m,d):sC(m)});return g.columns=p||[],g}function r(f,d){var h=[],p=f.length,g=0,m=0,y,b=p<=0,v=!1;f.charCodeAt(p-1)===Qu&&--p,f.charCodeAt(p-1)===mm&&--p;function x(){if(b)return pm;if(v)return v=!1,_E;var S,w=g,_;if(f.charCodeAt(w)===gm){for(;g++<p&&f.charCodeAt(g)!==gm||f.charCodeAt(++g)===gm;);return(S=g)>=p?b=!0:(_=f.charCodeAt(g++))===Qu?v=!0:_===mm&&(v=!0,f.charCodeAt(g)===Qu&&++g),f.slice(w+1,S-1).replace(/""/g,'"')}for(;g<p;){if((_=f.charCodeAt(S=g++))===Qu)v=!0;else if(_===mm)v=!0,f.charCodeAt(g)===Qu&&++g;else if(_!==n)continue;return f.slice(w,S)}return b=!0,f.slice(w,p)}for(;(y=x())!==pm;){for(var E=[];y!==_E&&y!==pm;)E.push(y),y=x();d&&(E=d(E,m++))==null||h.push(E)}return h}function o(f,d){return f.map(function(h){return d.map(function(p){return c(h[p])}).join(e)})}function s(f,d){return d==null&&(d=$E(f)),[d.map(c).join(e)].concat(o(f,d)).join(`
|
3
3
|
`)}function a(f,d){return d==null&&(d=$E(f)),o(f,d).join(`
|
4
4
|
`)}function u(f){return f.map(l).join(`
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as o,E as X,_ as q,n as x,am as lt,y as ut,cp as ct,N as J,cA as I,K as f,z,j as c,br as dt,bE as pt,bs as ft,bb as bt,bt as mt,bo as K}from"./index.Blgy4CCd.js";import{s as gt}from"./sprintf.C-r3gIuM.js";import{u as yt}from"./uniqueId.BG3aVKeE.js";import{u as It}from"./FormClearHelper.D3S2tctS.js";import{I as ht}from"./InputInstructions.Cm2uD0mH.js";import{I as Tt}from"./input.RldPkbfl.js";import"./base-input.krLFbHyn.js";var Q=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(X,q({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(X,q({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const Ct=x("div",{target:"e5tuigk0"})(({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}}})),wt=x("div",{target:"e5tuigk1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),G=x("button",{target:"e5tuigk2"})(({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"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),St=x("div",{target:"e5tuigk3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),Vt=lt.getLogger("NumberInput");function vt(t){return f(t)||t===""?void 0:t}const kt=t=>(t.element.dataType===I.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,M=({step:t,dataType:e})=>t||(e===I.DataType.INT?1:.01),W=({value:t,format:e,step:r,dataType:h})=>{if(f(t))return null;let i=vt(e);if(f(i)&&J(r)){const n=r.toString();h===I.DataType.FLOAT&&r!==0&&n.includes(".")&&(i=`%0.${n.split(".")[1].length}f`)}if(f(i))return t.toString();try{return gt.sprintf(i,t)}catch(n){return Vt.warn(`Error in sprintf(${i}, ${t}): ${n}`),String(t)}},xt=(t,e,r)=>f(t)?!1:t-e>=r,Rt=(t,e,r)=>f(t)?!1:t+e<=r,Dt=({disabled:t,element:e,widgetMgr:r,width:h,fragmentId:i})=>{var O;const n=ut(),{dataType:w,id:R,formId:p,default:B,format:A}=e,b=e.hasMin?e.min:-1/0,m=e.hasMax?e.max:1/0,[s,Z]=o.useState(M(e)),H=kt({element:e,widgetMgr:r}),[g,T]=o.useState(!1),[l,C]=o.useState(H),[P,S]=o.useState(W({value:H,...e,step:s})),[L,U]=o.useState(!1),D=o.useRef(null),$=o.useRef(yt("number_input_")),V=xt(l,s,b),v=Rt(l,s,m),_=ct({formId:p}),tt=_?r.allowFormEnterToSubmit(p):g,et=L&&h>n.breakpoints.hideWidgetDetails;o.useEffect(()=>{Z(M({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const u=o.useCallback(({value:a,source:d})=>{var y;if(J(a)&&(b>a||a>m))(y=D.current)==null||y.reportValidity();else{const k=a??B??null;switch(w){case I.DataType.INT:r.setIntValue({id:R,formId:p},k,d,i);break;case I.DataType.FLOAT:r.setDoubleValue({id:R,formId:p},k,d,i);break;default:throw new Error("Invalid data type")}T(!1),C(k),S(W({value:k,dataType:w,format:A,step:s}))}},[b,m,D,r,i,s,w,R,p,B,A]),ot=o.useCallback(()=>{g&&u({value:l,source:{fromUi:!0}}),U(!1)},[g,l,u]),rt=o.useCallback(()=>{U(!0)},[]),j=o.useCallback(()=>{const{value:a}=e;e.setValue=!1,C(a??null),S(W({value:a??null,...e,step:s})),u({value:a??null,source:{fromUi:!1}})},[e,s,u]);o.useEffect(()=>{e.setValue?j():u({value:l,source:{fromUi:!1}})},[]),e.setValue&&j();const E=f(e.default)&&!t,nt=o.useCallback(()=>{const a=e.default??null;C(a),u({value:a,source:{fromUi:!0}})},[e]);It({element:e,widgetMgr:r,onFormCleared:nt});const at=a=>{const{value:d}=a.target;if(d==="")T(!0),C(null),S(null);else{let y;e.dataType===I.DataType.INT?y=parseInt(d,10):y=parseFloat(d),T(!0),C(y),S(d)}},N=o.useCallback(()=>{v&&(T(!0),u({value:(l??b)+s,source:{fromUi:!0}}))},[l,b,s,v]),F=o.useCallback(()=>{V&&(T(!0),u({value:(l??m)-s,source:{fromUi:!0}}))},[l,m,s,V]),st=o.useCallback(a=>{const{key:d}=a;switch(d){case"ArrowUp":a.preventDefault(),N();break;case"ArrowDown":a.preventDefault(),F();break}},[N,F]),it=o.useCallback(a=>{a.key==="Enter"&&(g&&u({value:l,source:{fromUi:!0}}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,i))},[g,l,u,r,p,i]);return z("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:h},children:[c(mt,{label:e.label,disabled:t,labelVisibility:dt((O=e.labelVisibility)==null?void 0:O.value),htmlFor:$.current,children:e.help&&c(pt,{children:c(ft,{content:e.help,placement:bt.TOP_RIGHT})})}),z(Ct,{className:L?"focused":"","data-testid":"stNumberInputContainer",children:[c(Tt,{type:"number",inputRef:D,value:P??"",placeholder:e.placeholder,onBlur:ot,onFocus:rt,onChange:at,onKeyPress:it,onKeyDown:st,clearable:E,clearOnEscape:E,disabled:t,"aria-label":e.label,id:$.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:n.colors.darkGray,padding:n.spacing.threeXS,height:n.sizes.clearIconSize,width:n.sizes.clearIconSize,":hover":{fill:n.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:b,max:m,type:"number",inputMode:""},style:{lineHeight:n.lineHeights.inputWidget,paddingRight:n.spacing.sm,paddingLeft:n.spacing.sm,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm}},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}}}}),h>n.breakpoints.hideNumberInputControls&&z(wt,{children:[c(G,{"data-testid":"stNumberInputStepDown",onClick:F,disabled:!V||t,tabIndex:-1,children:c(K,{content:Q,size:"xs",color:V?"inherit":n.colors.disabled})}),c(G,{"data-testid":"stNumberInputStepUp",onClick:N,disabled:!v||t,tabIndex:-1,children:c(K,{content:Y,size:"xs",color:v?"inherit":n.colors.disabled})})]})]}),et&&c(St,{clearable:E,children:c(ht,{dirty:g,value:P??"",inForm:_,allowEnterToSubmit:tt})})]})},Ht=o.memo(Dt);export{Ht as default};
|