@iqmo/browser
Version:
Browser Stlite
2 lines (1 loc) • 19.5 kB
JavaScript
import{r as y,E,_ as R,c as x,b0 as q,j as u,c1 as Q,bI as z,bW as J,bE as K,bX as k,cb as _,h as Y,g as Z,bk as ee,ao as te,cc as re,cd as ie,ce as se,l as oe,b3 as ne,D as P,cf as V,bU as ae,bT as le,b_ as ce,b$ as de,cg as he,c0 as ue}from"./index-0xtYjrTa.js";import{U as D}from"./UploadFileInfo-B5SttewO.js";import{F as pe}from"./FormClearHelper-DpOGb8He.js";import{P as ge,S as fe}from"./ProgressBar-DbcR4zPs.js";var L=y.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{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"}))});L.displayName="SwitchCamera";var W=y.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},r,{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"}))});W.displayName="Video";var $=y.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},r,{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"}))});$.displayName="X";function me(r,l){switch(r){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 A=x("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),O=x("div",{target:"etz5kuj8"})(({theme:r,width:l})=>({backgroundColor:r.colors.secondaryBg,borderRadius:`${r.radii.default} ${r.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),ve=x("p",{target:"etz5kuj7"})(({theme:r})=>({marginTop:r.spacing.sm,textAlign:"center"}),""),ye=x("img",{target:"etz5kuj6"})(({theme:r,opacity:l})=>({borderRadius:`${r.radii.default} ${r.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),Se=x("a",{target:"etz5kuj5"})(({theme:r})=>({color:r.colors.link,textDecoration:r.linkUnderline?"underline":"none",display:"block"}),""),be=x("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),we=x("div",{target:"etz5kuj3"})(({theme:r})=>({position:"absolute",top:r.spacing.lg,right:r.spacing.lg,zIndex:r.zIndices.priority,color:r.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),Me=x("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ue=x("button",{target:"etz5kuj0"})(({theme:r})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:r.colors.lightenedBg05,border:`${r.sizes.borderWidth} solid ${r.colors.borderColor}`,borderRadius:`0 0 ${r.radii.default} ${r.radii.default}`,"&:hover":{borderColor:r.colors.primary,color:r.colors.primary},"&:active":{color:r.colors.white,borderColor:r.colors.primary,backgroundColor:r.colors.primary},"&:focus:not(:active)":{borderColor:r.colors.primary,color:r.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:r.colors.fadedText40,borderColor:r.colors.borderColor,backgroundColor:r.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:r.fontWeights.normal,padding:`${r.spacing.xs} ${r.spacing.md}`,margin:r.spacing.none,lineHeight:r.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${q(r.colors.primary,.5)}`},...me("medium",r)}),"");function Ce({disabled:r,onClick:l,children:e,progress:s}){return u.jsxs(Ue,{disabled:r||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[e,s?u.jsx(Me,{children:u.jsx(ge,{value:s,size:fe.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const H=y.memo(Ce);var F=(r=>(r.USER="user",r.ENVIRONMENT="environment",r))(F||{});const xe=({switchFacingMode:r})=>u.jsx(we,{"data-testid":"stCameraInputSwitchButton",children:u.jsx(Q,{content:"Switch camera",placement:z.TOP_RIGHT,children:u.jsx(J,{kind:K.MINIMAL,onClick:r,children:u.jsx(k,{content:L,size:"twoXL",color:_.white})})})}),Ie=y.memo(xe);var T={exports:{}},je=T.exports,N;function Pe(){return N||(N=1,function(r,l){(function(e,s){r.exports=s(Y())})(je,function(e){return function(s){var o={};function n(a){if(o[a])return o[a].exports;var p=o[a]={i:a,l:!1,exports:{}};return s[a].call(p.exports,p,p.exports,n),p.l=!0,p.exports}return n.m=s,n.c=o,n.d=function(a,p,S){n.o(a,p)||Object.defineProperty(a,p,{enumerable:!0,get:S})},n.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},n.t=function(a,p){if(p&1&&(a=n(a)),p&8||p&4&&typeof a=="object"&&a&&a.__esModule)return a;var S=Object.create(null);if(n.r(S),Object.defineProperty(S,"default",{enumerable:!0,value:a}),p&2&&typeof a!="string")for(var C in a)n.d(S,C,(function(U){return a[U]}).bind(null,C));return S},n.n=function(a){var p=a&&a.__esModule?function(){return a.default}:function(){return a};return n.d(p,"a",p),p},n.o=function(a,p){return Object.prototype.hasOwnProperty.call(a,p)},n.p="",n(n.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(s,o,n){n.r(o);var a=n("react"),p=function(){var g=function(h,i){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,d){t.__proto__=d}||function(t,d){for(var c in d)d.hasOwnProperty(c)&&(t[c]=d[c])},g(h,i)};return function(h,i){g(h,i);function t(){this.constructor=h}h.prototype=i===null?Object.create(i):(t.prototype=i.prototype,new t)}}(),S=function(){return S=Object.assign||function(g){for(var h,i=1,t=arguments.length;i<t;i++){h=arguments[i];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(g[d]=h[d])}return g},S.apply(this,arguments)},C=function(g,h){var i={};for(var t in g)Object.prototype.hasOwnProperty.call(g,t)&&h.indexOf(t)<0&&(i[t]=g[t]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,t=Object.getOwnPropertySymbols(g);d<t.length;d++)h.indexOf(t[d])<0&&Object.prototype.propertyIsEnumerable.call(g,t[d])&&(i[t[d]]=g[t[d]]);return i};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var h=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return h?new Promise(function(i,t){h.call(navigator,g,i,t)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=function(g){p(h,g);function h(i){var t=g.call(this,i)||this;return t.canvas=null,t.ctx=null,t.requestUserMediaId=0,t.unmounted=!1,t.state={hasUserMedia:!1},t}return h.prototype.componentDidMount=function(){var i=this,t=i.state,d=i.props;if(this.unmounted=!1,!U()){d.onUserMediaError("getUserMedia not supported");return}t.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},h.prototype.componentDidUpdate=function(i){var t=this.props;if(!U()){t.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(i.audioConstraints)!==JSON.stringify(t.audioConstraints),c=JSON.stringify(i.videoConstraints)!==JSON.stringify(t.videoConstraints),w=i.minScreenshotWidth!==t.minScreenshotWidth,v=i.minScreenshotHeight!==t.minScreenshotHeight;(c||w||v)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},h.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},h.stopMediaStream=function(i){i&&(i.getVideoTracks&&i.getAudioTracks?(i.getVideoTracks().map(function(t){i.removeTrack(t),t.stop()}),i.getAudioTracks().map(function(t){i.removeTrack(t),t.stop()})):i.stop())},h.prototype.stopAndCleanup=function(){var i=this.state;i.hasUserMedia&&(h.stopMediaStream(this.stream),i.src&&window.URL.revokeObjectURL(i.src))},h.prototype.getScreenshot=function(i){var t=this,d=t.state,c=t.props;if(!d.hasUserMedia)return null;var w=this.getCanvas(i);return w&&w.toDataURL(c.screenshotFormat,c.screenshotQuality)},h.prototype.getCanvas=function(i){var t=this,d=t.state,c=t.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var m=w/v;w=c.minScreenshotWidth||this.video.clientWidth,v=w/m,c.minScreenshotHeight&&v<c.minScreenshotHeight&&(v=c.minScreenshotHeight,w=v*m)}this.canvas=document.createElement("canvas"),this.canvas.width=i?.width||w,this.canvas.height=i?.height||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,f=M.canvas;return b&&f&&(f.width=i?.width||f.width,f.height=i?.height||f.height,c.mirrored&&(b.translate(f.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,i?.width||f.width,i?.height||f.height),c.mirrored&&(b.scale(-1,1),b.translate(-f.width,0))),f},h.prototype.requestUserMedia=function(){var i=this,t=this.props,d=function(v,m){var M={video:typeof m<"u"?m:!0};t.audio&&(M.audio=typeof v<"u"?v:!0),i.requestUserMediaId++;var b=i.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(f){i.unmounted||b!==i.requestUserMediaId?h.stopMediaStream(f):i.handleUserMedia(null,f)}).catch(function(f){i.handleUserMedia(f)})};if("mediaDevices"in navigator)d(t.audioConstraints,t.videoConstraints);else{var c=function(v){return{optional:[{sourceId:v}]}},w=function(v){var m=v.deviceId;return typeof m=="string"?m:Array.isArray(m)&&m.length>0?m[0]:typeof m=="object"&&m.ideal?m.ideal:null};MediaStreamTrack.getSources(function(v){var m=null,M=null;v.forEach(function(j){j.kind==="audio"?m=j.id:j.kind==="video"&&(M=j.id)});var b=w(t.audioConstraints);b&&(m=b);var f=w(t.videoConstraints);f&&(M=f),d(c(m),c(M))})}},h.prototype.handleUserMedia=function(i,t){var d=this.props;if(i||!t){this.setState({hasUserMedia:!1}),d.onUserMediaError(i);return}this.stream=t;try{this.video&&(this.video.srcObject=t),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(t)})}d.onUserMedia(t)},h.prototype.render=function(){var i=this,t=this,d=t.state,c=t.props,w=c.audio;c.forceScreenshotSourceSize;var v=c.disablePictureInPicture;c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var m=c.mirrored,M=c.style,b=M===void 0?{}:M,f=c.children,j=C(c,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),B=m?S(S({},b),{transform:(b.transform||"")+" scaleX(-1)"}):b,G={getScreenshot:this.getScreenshot.bind(this)};return a.createElement(a.Fragment,null,a.createElement("video",S({autoPlay:!0,disablePictureInPicture:v,src:d.src,muted:!w,playsInline:!0,ref:function(X){i.video=X},style:B},j)),f&&f(G))},h.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},h}(a.Component);o.default=I},react:function(s,o){s.exports=e}}).default})}(T)),T.exports}var Fe=Pe();const Ee=Z(Fe),Re=({width:r})=>u.jsxs(O,{width:r,children:[u.jsx(k,{size:"threeXL",color:_.gray60,content:W}),u.jsxs(ve,{children:["This app would like to use your camera.",u.jsx(Se,{href:ie,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),ke=({handleCapture:r,width:l,disabled:e,clearPhotoInProgress:s,setClearPhotoInProgress:o,facingMode:n,setFacingMode:a,testOverride:p})=>{const[S,C]=y.useState(p||"pending"),U=y.useRef(null),[I,g]=y.useState(l),h=y.useCallback(ee(1e3,g),[]);y.useEffect(()=>{h(l)},[l,h]);function i(){if(U.current!==null){const d=U.current.getScreenshot();r(d)}}const t=te();return u.jsxs(A,{"data-testid":"stCameraInputWebcamComponent",children:[S!=="success"&&!e&&!s?u.jsx(Re,{width:I}):re()&&u.jsx(Ie,{switchFacingMode:a}),u.jsx(O,{"data-testid":"stCameraInputWebcamStyledBox",hidden:S!=="success"&&!e&&!s,width:I,children:!e&&u.jsx(Ee,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${t.radii.default} ${t.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),o(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),u.jsx(H,{onClick:i,disabled:S!=="success"||e||s,children:"Take Photo"})]})},Oe=y.memo(ke),Te=150,ze=oe.getLogger("CameraInput");class _e extends y.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new pe,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=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState(e=>({facingMode:e.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=e=>{if(e===null)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});const s=o=>new Promise(n=>setTimeout(n,o));return Ve(e,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(n=>({file:o,fileUrls:n[0]}))).then(({file:o,fileUrls:n})=>this.uploadFile(n,o)).then(()=>s(Te)).then(()=>{this.setState((o,n)=>({imgSrc:e,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ze.error(o)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(e=>this.deleteFile(e.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:s,widgetMgr:o,fragmentId:n}=this.props,a=o.getFileUploaderStateValue(s);ne(e,a)||o.setFileUploaderStateValue(s,e,{fromUi:!0},n)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(P(e))return;this.setState({imgSrc:null});const{widgetMgr:s,element:o,fragmentId:n}=this.props;s.setFileUploaderStateValue(o,e,{fromUi:!0},n)})},this.deleteFile=e=>{const s=this.getFile(e);P(s)||(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(s=>({files:[...s.files,e]}))},this.removeFile=e=>{this.setState(s=>({files:s.files.filter(o=>o.id!==e)}))},this.getFile=e=>this.state.files.find(s=>s.id===e),this.updateFile=(e,s)=>{this.setState(o=>({files:o.files.map(n=>n.id===e?s:n)}))},this.onUploadComplete=(e,s)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(e);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(e,s)=>{const o=this.getFile(s);if(P(o)||o.status.type!=="uploading")return;const n=Math.round(e.loaded*100/e.total);o.status.progress!==n&&this.updateFile(s,o.setStatus({type:"uploading",cancelToken:o.status.cancelToken,progress:n}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,s)=>{const o=V.CancelToken.source(),n=new D(s.name,s.size,this.nextLocalFileId(),{type:"uploading",cancelToken:o,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,s,a=>this.onUploadProgress(a,n.id),o.token).then(()=>this.onUploadComplete(n.id,e)).catch(a=>{V.isCancel(a)||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:a?a.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:e,element:s}=this.props,o=e.getFileUploaderStateValue(s);if(P(o))return l;const{uploadedFileInfo:n}=o;return P(n)||n.length===0?l:{files:n.map(a=>{const p=a.name,S=a.size,C=a.fileId,U=a.fileUrls;return new D(p,S,this.nextLocalFileId(),{type:"uploaded",fileId:C,fileUrls:U})}),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=e=>e.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:e,widgetMgr:s,fragmentId:o}=this.props;s.getFileUploaderStateValue(e)===void 0&&s.setFileUploaderStateValue(e,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:s,size:o,status:n}=e;return new ae({fileId:n.fileId,fileUrls:n.fileUrls,name:s,size:o})});return new le({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:e,disabled:s,width:o}=this.props;return this.formClearHelper.manageFormClearListener(e,l.formId,this.onFormCleared),u.jsxs(A,{className:"stCameraInput","data-testid":"stCameraInput",children:[u.jsx(ce,{label:l.label,disabled:s,labelVisibility:de(l.labelVisibility?.value),children:l.help&&u.jsx(he,{children:u.jsx(ue,{content:l.help,placement:z.TOP_RIGHT})})}),this.state.imgSrc?u.jsxs(u.Fragment,{children:[u.jsx(O,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&u.jsx(ye,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),u.jsx(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":u.jsxs(be,{children:[u.jsx(k,{content:$,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):u.jsx(Oe,{handleCapture:this.handleCapture,width:o,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Ve(r,l){return fetch(r).then(e=>e.arrayBuffer()).then(e=>new File([e],l,{type:"image/jpeg"}))}const De=se(_e);export{De as default};