streamlit-nightly 1.42.1.dev20250216__py2.py3-none-any.whl → 1.42.2.dev20250217__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/elements/bokeh_chart.py +2 -3
- streamlit/elements/graphviz_chart.py +2 -3
- streamlit/elements/lib/column_types.py +97 -44
- streamlit/elements/lib/subtitle_utils.py +2 -2
- streamlit/elements/lib/utils.py +1 -2
- streamlit/elements/vega_charts.py +2 -5
- streamlit/runtime/caching/cache_utils.py +2 -3
- streamlit/runtime/caching/hashing.py +1 -2
- streamlit/runtime/forward_msg_cache.py +1 -5
- streamlit/runtime/fragment.py +3 -5
- streamlit/runtime/memory_media_file_storage.py +1 -2
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.K0RIIaSL.js → FileDownload.esm.NwWY1bYI.js} +1 -1
- streamlit/static/static/js/{FileDropzone.DRcTUuNN.js → FileDropzone.CZxPg3X2.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.Dha_cfuU.js → FormClearHelper.Doa6Lh7Q.js} +1 -1
- streamlit/static/static/js/{Hooks.BrulV197.js → Hooks.CxtftrJy.js} +1 -1
- streamlit/static/static/js/{InputInstructions.C_m6JNSV.js → InputInstructions.CWLH2hJc.js} +1 -1
- streamlit/static/static/js/{ProgressBar.CXgDz0lS.js → ProgressBar.WE22u_Ob.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.DbjYtj_E.js → RenderInPortalIfExists.BUcod3KW.js} +1 -1
- streamlit/static/static/js/{Toolbar.B5RomQbU.js → Toolbar.C714dqzb.js} +1 -1
- streamlit/static/static/js/{base-input.B_U9Mij-.js → base-input.C0t7SpL6.js} +1 -1
- streamlit/static/static/js/{createSuper.DiPn7x2M.js → createSuper.ViswZ8TH.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CxpMznuV.js → data-grid-overlay-editor.BhPr4kO6.js} +1 -1
- streamlit/static/static/js/{downloader.CMxfwi0g.js → downloader.91Q7jIso.js} +1 -1
- streamlit/static/static/js/{es6.CWDfc2yc.js → es6.DNX_sNKu.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.CyCMpBzy.js → iframeResizer.contentWindow.CDWUcDmU.js} +1 -1
- streamlit/static/static/js/{index.CTrIDSw5.js → index.-b7dNs6l.js} +1 -1
- streamlit/static/static/js/{index.eP8uJaty.js → index.0VYiXfju.js} +1 -1
- streamlit/static/static/js/{index.vyj1usur.js → index.B3HJ1joN.js} +28 -28
- streamlit/static/static/js/{index.B7-ka68B.js → index.BJ2gQSjT.js} +1 -1
- streamlit/static/static/js/{index.FVzOj77v.js → index.BLBTL57W.js} +1 -1
- streamlit/static/static/js/{index.OiKVkRzb.js → index.BNP-YHIi.js} +1 -1
- streamlit/static/static/js/{index.CLXysuIS.js → index.BOAkIKUg.js} +1 -1
- streamlit/static/static/js/{index.CxX3WJZV.js → index.BU0eO7qf.js} +1 -1
- streamlit/static/static/js/{index.11KmKkMp.js → index.BVHKdy_B.js} +1 -1
- streamlit/static/static/js/{index.YBzhCbWe.js → index.BY7jwxwh.js} +1 -1
- streamlit/static/static/js/{index.BoLiyuG0.js → index.BeOYoTtD.js} +1 -1
- streamlit/static/static/js/{index.CMM3vxd_.js → index.Byw8b24h.js} +1 -1
- streamlit/static/static/js/{index.DcCioSks.js → index.C2dTzC3_.js} +1 -1
- streamlit/static/static/js/{index.DaR46enR.js → index.CC8zeoS7.js} +1 -1
- streamlit/static/static/js/{index.BW9gD4O1.js → index.CCj1lvY2.js} +1 -1
- streamlit/static/static/js/{index.Ctuil2Zq.js → index.CPeAZG1R.js} +1 -1
- streamlit/static/static/js/{index.Djk5RccG.js → index.CX29idWq.js} +1 -1
- streamlit/static/static/js/{index.CxT-55oh.js → index.ChTsHUaC.js} +1 -1
- streamlit/static/static/js/{index.Di8ddb5O.js → index.CiWJLcV9.js} +1 -1
- streamlit/static/static/js/{index.B9xlEQvM.js → index.DAlDuq3e.js} +1 -1
- streamlit/static/static/js/{index.CnzapoES.js → index.DZlSz8lf.js} +1 -1
- streamlit/static/static/js/{index.DsPUu3xS.js → index.Df7Lr-8j.js} +1 -1
- streamlit/static/static/js/{index.CBswNuTs.js → index.DoLrZkRU.js} +1 -1
- streamlit/static/static/js/{index.CmyE8x29.js → index.DxXPukev.js} +1 -1
- streamlit/static/static/js/{index.FjL8doTL.js → index.Dz2gm3-U.js} +1 -1
- streamlit/static/static/js/{index.CZjrVNQ3.js → index.FawRMwD-.js} +1 -1
- streamlit/static/static/js/{index.CGHmjGTj.js → index.VDF9za4g.js} +1 -1
- streamlit/static/static/js/{index.D4y-ZpWF.js → index.Vo9Xk_-P.js} +1 -1
- streamlit/static/static/js/{index.CrDkQv4h.js → index.aoRAdNJI.js} +1 -1
- streamlit/static/static/js/{index.DeuQX1T6.js → index.bLZVjplR.js} +3 -3
- streamlit/static/static/js/{index.fz6QTJde.js → index.hEabuvQl.js} +1 -1
- streamlit/static/static/js/{index.DUqWz4q7.js → index.idE2oxkV.js} +1 -1
- streamlit/static/static/js/{index.Bb_vborY.js → index.jaOfuXT_.js} +1 -1
- streamlit/static/static/js/{index.XB-MiuZp.js → index.mQsqDFei.js} +1 -1
- streamlit/static/static/js/{index.B5QCo4O8.js → index.rqm-tyVr.js} +1 -1
- streamlit/static/static/js/{index.68LnD3a5.js → index.wclN5y6j.js} +1 -1
- streamlit/static/static/js/{index.ZlPieA63.js → index.xj8ZjDtP.js} +1 -1
- streamlit/static/static/js/{input.D-b9-dhW.js → input.CeAboTLQ.js} +1 -1
- streamlit/static/static/js/{memory.C27_0JRm.js → memory.BilaH12K.js} +1 -1
- streamlit/static/static/js/{mergeWith.D8F46YVj.js → mergeWith.B34IaY8d.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.CaHpEyvW.js → number-overlay-editor.BCo5wJKi.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.CnSJ4CFa.js → possibleConstructorReturn.CRrAWWQi.js} +1 -1
- streamlit/static/static/js/{sandbox.Cx5mAMmC.js → sandbox.ZIG5vd5E.js} +1 -1
- streamlit/static/static/js/{textarea.YeGMY3Ts.js → textarea.B7ggnxCh.js} +1 -1
- streamlit/static/static/js/{timepicker.BSApuR_7.js → timepicker.D1BZ0rZq.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.DFJurSxu.js → toConsumableArray.bbNBXf55.js} +1 -1
- streamlit/static/static/js/{uniqueId.B4ugkryR.js → uniqueId.BRO0jXkb.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.e9cw5rKa.js → useBasicWidgetState.DNqxSbNL.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.CHDPgswc.js → useOnInputChange.LSJywRT_.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.BKBYrOn-.js → withFullScreenWrapper.wyYj-oat.js} +1 -1
- streamlit/testing/v1/app_test.py +2 -4
- streamlit/util.py +6 -9
- streamlit/watcher/util.py +2 -7
- streamlit/web/server/app_static_file_handler.py +16 -1
- {streamlit_nightly-1.42.1.dev20250216.dist-info → streamlit_nightly-1.42.2.dev20250217.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.42.1.dev20250216.dist-info → streamlit_nightly-1.42.2.dev20250217.dist-info}/RECORD +86 -86
- {streamlit_nightly-1.42.1.dev20250216.data → streamlit_nightly-1.42.2.dev20250217.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.42.1.dev20250216.dist-info → streamlit_nightly-1.42.2.dev20250217.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.42.1.dev20250216.dist-info → streamlit_nightly-1.42.2.dev20250217.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.42.1.dev20250216.dist-info → streamlit_nightly-1.42.2.dev20250217.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
import{r as s,E as k,_ as M,n as g,D as ht,y as q,j as a,b6 as J,bp as ft,C as w,bk as Q,b2 as Z,bj as E,aY as mt,bA as yt,bB as S,bn as vt,be as Ct,bC as wt,K as B,F as X,bg as It,bf as bt}from"./index.DeuQX1T6.js";import{g as xt,F as St,C as Ft,I as Et,E as zt,u as Ut,a as Tt}from"./FileDropzone.DRcTUuNN.js";import{I as Ht}from"./InputInstructions.C_m6JNSV.js";import{i as Dt}from"./inputUtils.CQWz5UKz.js";import{a as G}from"./index.DW_MHI2K.js";import{U as V}from"./UploadFileInfo.C-jY39rj.js";import{T as Bt}from"./textarea.YeGMY3Ts.js";import"./base-input.B_U9Mij-.js";var tt=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(k,M({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),s.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});tt.displayName="AttachFile";var et=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(k,M({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))});et.displayName="ErrorOutline";var ot=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(k,M({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("rect",{width:24,height:24,fill:"none"}),s.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});ot.displayName="Send";const Lt=g("div",{target:"e1w2ot2t0"})(({theme:t,width:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,borderRadius:t.radii.chatInput,display:"flex",backgroundColor:t.colors.secondaryBg,width:`${e}px`,overflow:"hidden",":focus-within":{borderColor:t.colors.primary},"&.dropzone":{borderColor:t.colors.primary,borderRadius:t.radii.full,height:t.sizes.emptyDropdownHeight}})),Rt=g("div",{target:"e1w2ot2t1"})(({theme:t})=>({position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,gap:t.spacing.sm})),Vt=g("button",{target:"e1w2ot2t2"})(({theme:t,disabled:e,extended:l})=>{const f=ht(t),[y,p]=f?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:l?"0":t.radii.chatInput,borderTopLeftRadius:l?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?y:p,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:f?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray}}}),kt=g("div",{target:"e1w2ot2t3"})({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,pointerEvents:"none"}),Mt=g("div",{target:"e1w2ot2t4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Nt=g("div",{target:"e12v7o8j0"})(({theme:t})=>({display:"flex",alignItems:"center",justifyContent:"center",margin:"auto",height:"100%",width:"100%",color:t.colors.primary,fontWeight:t.fontWeights.bold})),At=g("div",{target:"e12v7o8j1"})(({})=>({display:"flex",alignItems:"top",height:"100%"})),$t=g("div",{target:"e12v7o8j2"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Wt=g("div",{target:"e12v7o8j3"})(({theme:t})=>({left:0,right:0,border:`${t.sizes.borderWidth} solid ${t.colors.transparent}`,minHeight:t.sizes.minChatInputFileListHeight,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),jt=g("div",{target:"e12v7o8j4"})(({})=>({display:"flex"})),Pt=g("div",{target:"e12v7o8j5"})(({})=>({flex:"0 0 auto"})),Kt=g("div",{target:"e12v7o8j6"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Ot=g("div",{target:"e12v7o8j7"})(({theme:t})=>({color:t.colors.fadedText60})),_t=g("div",{target:"e12v7o8j8"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Xt=g("div",{target:"e12v7o8j9"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Gt=g("small",{target:"e12v7o8j10"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function Yt({children:t,content:e}){const l=q();return a(ft,{content:e,placement:J.TOP,overrides:{Body:{style:{top:`-${l.sizes.minElementHeight}`}}},children:t})}const qt=({fileInfo:t})=>{const{type:e}=t.status;switch(e){case"uploading":return a(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return a(Yt,{content:t.status.errorMessage,children:a(E,{content:et,size:"lg"})});case"uploaded":return a(E,{content:Et,size:"lg"});default:return mt(e),null}},Jt=({fileInfo:t,onDelete:e})=>w(Kt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[a(Ot,{children:a(qt,{fileInfo:t})}),a(_t,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),a(Xt,{children:xt(t.size,St.Byte)}),a(Gt,{"data-testid":"stChatInputDeleteBtn",children:a(Q,{onClick:()=>e(t.id),kind:Z.MINIMAL,children:a(E,{content:Ft,size:"lg"})})})]}),Qt=({items:t,onDelete:e})=>a(Wt,{"data-testid":"stChatUploadedFiles",children:a(jt,{children:t.map(l=>a(Pt,{children:a(Jt,{fileInfo:l,onDelete:e})},l.id))})}),Zt=({getRootProps:t,getInputProps:e,acceptFile:l,showDropzone:f,disabled:y,theme:p})=>f?w(Nt,{...t(),children:[a("input",{...e()}),"Drag and drop files here"]}):w(At,{children:[w("div",{"data-testid":"stChatInputFileUploadButton",...t(),children:[a("input",{...e()}),a(vt,{content:`Upload or drag and drop ${l===S.Multiple?"files":"a file"}`,placement:J.TOP,children:a(Q,{kind:Z.MINIMAL,disabled:y,children:a(E,{content:tt,size:"lg",color:p.colors.fadedText60})})})]}),a($t,{})]}),te=({getNextLocalFileId:t,addFiles:e,updateFile:l,uploadClient:f,element:y,onUploadProgress:p,onUploadComplete:m})=>(v,h)=>{const u=G.CancelToken.source(),d=new V(h.name,h.size,t(),{type:"uploading",cancelToken:u,progress:1});e([d]),f.uploadFile({formId:"",...y},v.uploadUrl,h,c=>p(c,d.id),u.token).then(()=>m(d.id,v)).catch(c=>{G.isCancel(c)||l(d.id,d.setStatus({type:"error",errorMessage:c?c.toString():"Unknown error"}))})},ee=({acceptMultipleFiles:t,uploadClient:e,uploadFile:l,addFiles:f,getNextLocalFileId:y,deleteExistingFiles:p,onUploadComplete:m})=>(v,h)=>{if(!t&&v.length===0&&h.length>1){const u=h.findIndex(d=>{var c;return((c=d.errors)==null?void 0:c[0].code)===zt.TooManyFiles});u>=0&&(v.push(h[u].file),h.splice(u,1))}if(!t&&v.length>0&&p(),e.fetchFileURLs(v).then(u=>{Ct(u,v).forEach(([d,c])=>{l(d,c)})}).catch(u=>{f(v.map(d=>new V(d.name,d.size,y(),{type:"error",errorMessage:u})))}),h.length>0){const u=h.map(d=>new V(d.file.name,d.file.size,y(),{type:"error",errorMessage:d.errors.map(c=>c.message).filter(c=>!!c).join(", ")}));f(u)}m()},oe=6.5,Y=1,L=(t,e,l)=>l.map(f=>f.id===t?e:f),R=(t,e)=>e.find(l=>l.id===t);function ne({width:t,element:e,widgetMgr:l,fragmentId:f,uploadClient:y}){const p=q(),m=s.useRef(null),v=s.useRef(0),h=s.useRef({minHeight:0,maxHeight:0}),[u,d]=s.useState(!1),[c,U]=s.useState(e.default),[z,N]=s.useState(0),[A,nt]=s.useState(!1),[I,b]=s.useState([]),[F,T]=s.useState(!1),x=wt(e.acceptFile),$=s.useCallback(o=>b(n=>[...n,...o]),[]),W=s.useCallback(o=>{b(n=>{const i=R(o,n);return B(i)?n:(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&y.deleteFile(i.status.fileUrls.deleteUrl),n.filter(r=>r.id!==o))})},[y]),at=()=>{const o=I.filter(n=>n.status.type==="uploaded").map(n=>{const{name:i,size:r,status:C}=n,{fileId:ut,fileUrls:gt}=C;return new It({fileId:ut,fileUrls:gt,name:i,size:r})});return new bt({uploadedFileInfo:o})},j=()=>v.current++,rt=ee({acceptMultipleFiles:x===S.Multiple,uploadClient:y,uploadFile:te({getNextLocalFileId:j,addFiles:$,updateFile:(o,n)=>{b(i=>L(o,n,i))},uploadClient:y,element:e,onUploadProgress:(o,n)=>{b(i=>{const r=R(n,i);if(B(r)||r.status.type!=="uploading")return i;const C=Math.round(o.loaded*100/o.total);return r.status.progress===C?i:L(n,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:C}),i)})},onUploadComplete:(o,n)=>{b(i=>{const r=R(o,i);return B(r)||r.status.type!=="uploading"?i:L(r.id,r.setStatus({type:"uploaded",fileId:n.fileId,fileUrls:n}),i)})}}),addFiles:$,getNextLocalFileId:j,deleteExistingFiles:()=>I.forEach(o=>W(o.id)),onUploadComplete:()=>{m.current&&m.current.focus()}}),{getRootProps:it,getInputProps:st}=Ut({onDrop:rt,multiple:x===S.Multiple,accept:Tt(e.fileType)}),lt=()=>{let o=0;const{current:n}=m;if(n){const i=n.placeholder;n.placeholder="",n.style.height="auto",o=n.scrollHeight,n.placeholder=i,n.style.height=""}return o},P=()=>{if(m.current&&m.current.focus(),!u||e.disabled)return;const o={data:c,fileUploaderState:at()};l.setChatInputValue(e,o,{fromUi:!0},f),d(!1),b([]),U(""),N(0)},dt=o=>{const{metaKey:n,ctrlKey:i,shiftKey:r}=o;Dt(o)&&!r&&!i&&!n&&(o.preventDefault(),P())},ct=o=>{const{value:n}=o.target,{maxChars:i}=e;i!==0&&n.length>i||(U(n),N(lt()))};s.useEffect(()=>I.some(o=>o.status.type==="uploading")?d(!1):d(c!==""||I.length>0),[I,c]),s.useEffect(()=>{if(e.setValue){e.setValue=!1;const o=e.value||"";U(o)}},[e]),s.useEffect(()=>{if(m.current){const{offsetHeight:o}=m.current;h.current.minHeight=o,h.current.maxHeight=o*oe}},[m]),s.useEffect(()=>{const o=r=>{var C;r.preventDefault(),r.stopPropagation(),!F&&((C=r.dataTransfer)!=null&&C.types.includes("Files"))&&T(!0)},n=r=>{r.preventDefault(),r.stopPropagation(),F&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&T(!1)},i=r=>{r.preventDefault(),r.stopPropagation(),F&&T(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",i),window.addEventListener("dragleave",n),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",i),window.removeEventListener("dragleave",n)}},[F]),s.useEffect(()=>{const{minHeight:o}=h.current;nt(z>0&&m.current?Math.abs(z-o)>Y:!1)},[z]);const{disabled:H,placeholder:K,maxChars:pt}=e,{maxHeight:O}=h.current,D=x!==S.None&&F,_="stChatInput";return w(X,{children:[x===S.None?null:a(Qt,{items:[...I],onDelete:W}),a(Lt,{className:D?`${_} dropzone`:_,"data-testid":"stChatInput",width:t,children:w(Rt,{children:[x===S.None?null:a(Zt,{getRootProps:it,getInputProps:st,acceptFile:x,showDropzone:D,disabled:H,theme:p}),D?null:w(X,{children:[a(Bt,{inputRef:m,value:c,placeholder:K,onChange:ct,onKeyDown:dt,"aria-label":K,disabled:H,rows:1,overrides:{Root:{style:{minHeight:p.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:p.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:A?`${z+Y}px`:"auto",maxHeight:O?`${O}px`:"none",paddingLeft:p.spacing.none,paddingBottom:p.spacing.sm,paddingTop:p.spacing.sm,paddingRight:`calc(${p.iconSizes.xl} + 2 * ${p.spacing.sm} + ${p.spacing.sm})`}}}}),t>p.breakpoints.hideWidgetDetails&&a(Mt,{children:a(Ht,{dirty:u,value:c,maxLength:pt,type:"chat",inForm:!1})}),a(kt,{children:a(Vt,{onClick:P,disabled:!u||H,extended:A,"data-testid":"stChatInputSubmitButton",children:a(E,{content:ot,size:"xl",color:"inherit"})})})]})]})})]})}const ue=s.memo(ne);export{ue as default};
|
1
|
+
import{r as s,E as k,_ as M,n as g,D as ht,y as q,j as a,b6 as J,bp as ft,C as w,bk as Q,b2 as Z,bj as E,aY as mt,bA as yt,bB as S,bn as vt,be as Ct,bC as wt,K as B,F as X,bg as It,bf as bt}from"./index.bLZVjplR.js";import{g as xt,F as St,C as Ft,I as Et,E as zt,u as Ut,a as Tt}from"./FileDropzone.CZxPg3X2.js";import{I as Ht}from"./InputInstructions.CWLH2hJc.js";import{i as Dt}from"./inputUtils.CQWz5UKz.js";import{a as G}from"./index.DW_MHI2K.js";import{U as V}from"./UploadFileInfo.C-jY39rj.js";import{T as Bt}from"./textarea.B7ggnxCh.js";import"./base-input.C0t7SpL6.js";var tt=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(k,M({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),s.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});tt.displayName="AttachFile";var et=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(k,M({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))});et.displayName="ErrorOutline";var ot=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(k,M({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("rect",{width:24,height:24,fill:"none"}),s.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});ot.displayName="Send";const Lt=g("div",{target:"e1w2ot2t0"})(({theme:t,width:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??t.colors.transparent,borderRadius:t.radii.chatInput,display:"flex",backgroundColor:t.colors.secondaryBg,width:`${e}px`,overflow:"hidden",":focus-within":{borderColor:t.colors.primary},"&.dropzone":{borderColor:t.colors.primary,borderRadius:t.radii.full,height:t.sizes.emptyDropdownHeight}})),Rt=g("div",{target:"e1w2ot2t1"})(({theme:t})=>({position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,gap:t.spacing.sm})),Vt=g("button",{target:"e1w2ot2t2"})(({theme:t,disabled:e,extended:l})=>{const f=ht(t),[y,p]=f?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:l?"0":t.radii.chatInput,borderTopLeftRadius:l?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?y:p,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:f?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray}}}),kt=g("div",{target:"e1w2ot2t3"})({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,pointerEvents:"none"}),Mt=g("div",{target:"e1w2ot2t4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),Nt=g("div",{target:"e12v7o8j0"})(({theme:t})=>({display:"flex",alignItems:"center",justifyContent:"center",margin:"auto",height:"100%",width:"100%",color:t.colors.primary,fontWeight:t.fontWeights.bold})),At=g("div",{target:"e12v7o8j1"})(({})=>({display:"flex",alignItems:"top",height:"100%"})),$t=g("div",{target:"e12v7o8j2"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Wt=g("div",{target:"e12v7o8j3"})(({theme:t})=>({left:0,right:0,border:`${t.sizes.borderWidth} solid ${t.colors.transparent}`,minHeight:t.sizes.minChatInputFileListHeight,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),jt=g("div",{target:"e12v7o8j4"})(({})=>({display:"flex"})),Pt=g("div",{target:"e12v7o8j5"})(({})=>({flex:"0 0 auto"})),Kt=g("div",{target:"e12v7o8j6"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Ot=g("div",{target:"e12v7o8j7"})(({theme:t})=>({color:t.colors.fadedText60})),_t=g("div",{target:"e12v7o8j8"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Xt=g("div",{target:"e12v7o8j9"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Gt=g("small",{target:"e12v7o8j10"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function Yt({children:t,content:e}){const l=q();return a(ft,{content:e,placement:J.TOP,overrides:{Body:{style:{top:`-${l.sizes.minElementHeight}`}}},children:t})}const qt=({fileInfo:t})=>{const{type:e}=t.status;switch(e){case"uploading":return a(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return a(Yt,{content:t.status.errorMessage,children:a(E,{content:et,size:"lg"})});case"uploaded":return a(E,{content:Et,size:"lg"});default:return mt(e),null}},Jt=({fileInfo:t,onDelete:e})=>w(Kt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[a(Ot,{children:a(qt,{fileInfo:t})}),a(_t,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),a(Xt,{children:xt(t.size,St.Byte)}),a(Gt,{"data-testid":"stChatInputDeleteBtn",children:a(Q,{onClick:()=>e(t.id),kind:Z.MINIMAL,children:a(E,{content:Ft,size:"lg"})})})]}),Qt=({items:t,onDelete:e})=>a(Wt,{"data-testid":"stChatUploadedFiles",children:a(jt,{children:t.map(l=>a(Pt,{children:a(Jt,{fileInfo:l,onDelete:e})},l.id))})}),Zt=({getRootProps:t,getInputProps:e,acceptFile:l,showDropzone:f,disabled:y,theme:p})=>f?w(Nt,{...t(),children:[a("input",{...e()}),"Drag and drop files here"]}):w(At,{children:[w("div",{"data-testid":"stChatInputFileUploadButton",...t(),children:[a("input",{...e()}),a(vt,{content:`Upload or drag and drop ${l===S.Multiple?"files":"a file"}`,placement:J.TOP,children:a(Q,{kind:Z.MINIMAL,disabled:y,children:a(E,{content:tt,size:"lg",color:p.colors.fadedText60})})})]}),a($t,{})]}),te=({getNextLocalFileId:t,addFiles:e,updateFile:l,uploadClient:f,element:y,onUploadProgress:p,onUploadComplete:m})=>(v,h)=>{const u=G.CancelToken.source(),d=new V(h.name,h.size,t(),{type:"uploading",cancelToken:u,progress:1});e([d]),f.uploadFile({formId:"",...y},v.uploadUrl,h,c=>p(c,d.id),u.token).then(()=>m(d.id,v)).catch(c=>{G.isCancel(c)||l(d.id,d.setStatus({type:"error",errorMessage:c?c.toString():"Unknown error"}))})},ee=({acceptMultipleFiles:t,uploadClient:e,uploadFile:l,addFiles:f,getNextLocalFileId:y,deleteExistingFiles:p,onUploadComplete:m})=>(v,h)=>{if(!t&&v.length===0&&h.length>1){const u=h.findIndex(d=>{var c;return((c=d.errors)==null?void 0:c[0].code)===zt.TooManyFiles});u>=0&&(v.push(h[u].file),h.splice(u,1))}if(!t&&v.length>0&&p(),e.fetchFileURLs(v).then(u=>{Ct(u,v).forEach(([d,c])=>{l(d,c)})}).catch(u=>{f(v.map(d=>new V(d.name,d.size,y(),{type:"error",errorMessage:u})))}),h.length>0){const u=h.map(d=>new V(d.file.name,d.file.size,y(),{type:"error",errorMessage:d.errors.map(c=>c.message).filter(c=>!!c).join(", ")}));f(u)}m()},oe=6.5,Y=1,L=(t,e,l)=>l.map(f=>f.id===t?e:f),R=(t,e)=>e.find(l=>l.id===t);function ne({width:t,element:e,widgetMgr:l,fragmentId:f,uploadClient:y}){const p=q(),m=s.useRef(null),v=s.useRef(0),h=s.useRef({minHeight:0,maxHeight:0}),[u,d]=s.useState(!1),[c,U]=s.useState(e.default),[z,N]=s.useState(0),[A,nt]=s.useState(!1),[I,b]=s.useState([]),[F,T]=s.useState(!1),x=wt(e.acceptFile),$=s.useCallback(o=>b(n=>[...n,...o]),[]),W=s.useCallback(o=>{b(n=>{const i=R(o,n);return B(i)?n:(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&y.deleteFile(i.status.fileUrls.deleteUrl),n.filter(r=>r.id!==o))})},[y]),at=()=>{const o=I.filter(n=>n.status.type==="uploaded").map(n=>{const{name:i,size:r,status:C}=n,{fileId:ut,fileUrls:gt}=C;return new It({fileId:ut,fileUrls:gt,name:i,size:r})});return new bt({uploadedFileInfo:o})},j=()=>v.current++,rt=ee({acceptMultipleFiles:x===S.Multiple,uploadClient:y,uploadFile:te({getNextLocalFileId:j,addFiles:$,updateFile:(o,n)=>{b(i=>L(o,n,i))},uploadClient:y,element:e,onUploadProgress:(o,n)=>{b(i=>{const r=R(n,i);if(B(r)||r.status.type!=="uploading")return i;const C=Math.round(o.loaded*100/o.total);return r.status.progress===C?i:L(n,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:C}),i)})},onUploadComplete:(o,n)=>{b(i=>{const r=R(o,i);return B(r)||r.status.type!=="uploading"?i:L(r.id,r.setStatus({type:"uploaded",fileId:n.fileId,fileUrls:n}),i)})}}),addFiles:$,getNextLocalFileId:j,deleteExistingFiles:()=>I.forEach(o=>W(o.id)),onUploadComplete:()=>{m.current&&m.current.focus()}}),{getRootProps:it,getInputProps:st}=Ut({onDrop:rt,multiple:x===S.Multiple,accept:Tt(e.fileType)}),lt=()=>{let o=0;const{current:n}=m;if(n){const i=n.placeholder;n.placeholder="",n.style.height="auto",o=n.scrollHeight,n.placeholder=i,n.style.height=""}return o},P=()=>{if(m.current&&m.current.focus(),!u||e.disabled)return;const o={data:c,fileUploaderState:at()};l.setChatInputValue(e,o,{fromUi:!0},f),d(!1),b([]),U(""),N(0)},dt=o=>{const{metaKey:n,ctrlKey:i,shiftKey:r}=o;Dt(o)&&!r&&!i&&!n&&(o.preventDefault(),P())},ct=o=>{const{value:n}=o.target,{maxChars:i}=e;i!==0&&n.length>i||(U(n),N(lt()))};s.useEffect(()=>I.some(o=>o.status.type==="uploading")?d(!1):d(c!==""||I.length>0),[I,c]),s.useEffect(()=>{if(e.setValue){e.setValue=!1;const o=e.value||"";U(o)}},[e]),s.useEffect(()=>{if(m.current){const{offsetHeight:o}=m.current;h.current.minHeight=o,h.current.maxHeight=o*oe}},[m]),s.useEffect(()=>{const o=r=>{var C;r.preventDefault(),r.stopPropagation(),!F&&((C=r.dataTransfer)!=null&&C.types.includes("Files"))&&T(!0)},n=r=>{r.preventDefault(),r.stopPropagation(),F&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&T(!1)},i=r=>{r.preventDefault(),r.stopPropagation(),F&&T(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",i),window.addEventListener("dragleave",n),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",i),window.removeEventListener("dragleave",n)}},[F]),s.useEffect(()=>{const{minHeight:o}=h.current;nt(z>0&&m.current?Math.abs(z-o)>Y:!1)},[z]);const{disabled:H,placeholder:K,maxChars:pt}=e,{maxHeight:O}=h.current,D=x!==S.None&&F,_="stChatInput";return w(X,{children:[x===S.None?null:a(Qt,{items:[...I],onDelete:W}),a(Lt,{className:D?`${_} dropzone`:_,"data-testid":"stChatInput",width:t,children:w(Rt,{children:[x===S.None?null:a(Zt,{getRootProps:it,getInputProps:st,acceptFile:x,showDropzone:D,disabled:H,theme:p}),D?null:w(X,{children:[a(Bt,{inputRef:m,value:c,placeholder:K,onChange:ct,onKeyDown:dt,"aria-label":K,disabled:H,rows:1,overrides:{Root:{style:{minHeight:p.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:p.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:A?`${z+Y}px`:"auto",maxHeight:O?`${O}px`:"none",paddingLeft:p.spacing.none,paddingBottom:p.spacing.sm,paddingTop:p.spacing.sm,paddingRight:`calc(${p.iconSizes.xl} + 2 * ${p.spacing.sm} + ${p.spacing.sm})`}}}}),t>p.breakpoints.hideWidgetDetails&&a(Mt,{children:a(Ht,{dirty:u,value:c,maxLength:pt,type:"chat",inForm:!1})}),a(kt,{children:a(Vt,{onClick:P,disabled:!u||H,extended:A,"data-testid":"stChatInputSubmitButton",children:a(E,{content:ot,size:"xl",color:"inherit"})})})]})]})})]})}const ue=s.memo(ne);export{ue as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{n as o,r as S,C as m,j as i,ay as y}from"./index.
|
1
|
+
import{n as o,r as S,C as m,j as i,ay as y}from"./index.bLZVjplR.js";import{S as g,T as W}from"./Toolbar.C714dqzb.js";import{w as b,u as M,E}from"./withFullScreenWrapper.wyYj-oat.js";const L=o("div",{target:"evl31sl0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg,maxWidth:"100%",width:"fit-content"})),O=o("div",{target:"evl31sl1"})(({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0,">img":{borderRadius:t.radii.default}})),T=o("div",{target:"evl31sl2"})(({theme:t})=>({textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:t.spacing.threeXS}));var p;(function(t){t[t.OriginalWidth=-1]="OriginalWidth",t[t.ColumnWidth=-2]="ColumnWidth",t[t.AutoWidth=-3]="AutoWidth",t[t.MinImageOrContainer=-4]="MinImageOrContainer",t[t.MaxImageOrContainer=-5]="MaxImageOrContainer"})(p||(p={}));function j({element:t,width:u,endpoints:x,disableFullscreenMode:f}){const{expanded:n,width:w,height:l,expand:C,collapse:h}=M(E),d=n?w:u;let r;const a=t.width;if([-1,-3,-4].includes(a))r=void 0;else if([-2,-5].includes(a))r=d;else if(a>0)r=a;else throw Error(`Invalid image width: ${a}`);const e={};return l&&n?(e.maxHeight=l,e.objectFit="contain"):(e.width=r,e.maxWidth="100%"),m(g,{width:d,height:l,useContainerWidth:n,topCentered:!0,children:[i(W,{target:g,isFullScreen:n,onExpand:C,onCollapse:h,disableFullscreenMode:f}),i(L,{className:"stImage","data-testid":"stImage",children:t.imgs.map((I,c)=>{const s=I;return m(O,{"data-testid":"stImageContainer",children:[i("img",{style:e,src:x.buildMediaURL(s.url),alt:c.toString()}),s.caption&&i(T,{"data-testid":"stImageCaption",style:e,children:i(y,{source:s.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]},c)})})]})}const k=S.memo(b(j));export{k as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{r as o,E as X,_ as q,n as x,y as lt,cl as ut,M as J,cv as I,K as f,C as z,j as c,bm as ct,bz as dt,bn as pt,b6 as ft,bo as bt,bj as K,an as mt}from"./index.
|
1
|
+
import{r as o,E as X,_ as q,n as x,y as lt,cl as ut,M as J,cv as I,K as f,C as z,j as c,bm as ct,bz as dt,bn as pt,b6 as ft,bo as bt,bj as K,an as mt}from"./index.bLZVjplR.js";import{s as gt}from"./sprintf.D7DtBTRn.js";import{u as yt}from"./uniqueId.BRO0jXkb.js";import{u as It}from"./FormClearHelper.Doa6Lh7Q.js";import{I as ht}from"./InputInstructions.CWLH2hJc.js";import{I as Tt}from"./input.CeAboTLQ.js";import"./base-input.C0t7SpL6.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"}),M=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}})),vt=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"})`})),St=mt.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,G=({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 St.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=lt(),{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(G(e)),H=kt({element:e,widgetMgr:r}),[g,T]=o.useState(!1),[l,C]=o.useState(H),[P,v]=o.useState(W({value:H,...e,step:s})),[L,U]=o.useState(!1),D=o.useRef(null),$=o.useRef(yt("number_input_")),S=xt(l,s,b),V=Rt(l,s,m),j=ut({formId:p}),tt=j?r.allowFormEnterToSubmit(p):g,et=L&&h>n.breakpoints.hideWidgetDetails;o.useEffect(()=>{Z(G({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),v(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)},[]),_=o.useCallback(()=>{const{value:a}=e;e.setValue=!1,C(a??null),v(W({value:a??null,...e,step:s})),u({value:a??null,source:{fromUi:!1}})},[e,s,u]);o.useEffect(()=>{e.setValue?_():u({value:l,source:{fromUi:!1}})},[]),e.setValue&&_();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),v(null);else{let y;e.dataType===I.DataType.INT?y=parseInt(d,10):y=parseFloat(d),T(!0),C(y),v(d)}},F=o.useCallback(()=>{V&&(T(!0),u({value:(l??b)+s,source:{fromUi:!0}}))},[l,b,s,V]),N=o.useCallback(()=>{S&&(T(!0),u({value:(l??m)-s,source:{fromUi:!0}}))},[l,m,s,S]),st=o.useCallback(a=>{const{key:d}=a;switch(d){case"ArrowUp":a.preventDefault(),F();break;case"ArrowDown":a.preventDefault(),N();break}},[F,N]),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(bt,{label:e.label,disabled:t,labelVisibility:ct((O=e.labelVisibility)==null?void 0:O.value),htmlFor:$.current,children:e.help&&c(dt,{children:c(pt,{content:e.help,placement:ft.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(M,{"data-testid":"stNumberInputStepDown",onClick:N,disabled:!S||t,tabIndex:-1,children:c(K,{content:Q,size:"xs",color:S?"inherit":n.colors.disabled})}),c(M,{"data-testid":"stNumberInputStepUp",onClick:F,disabled:!V||t,tabIndex:-1,children:c(K,{content:Y,size:"xs",color:V?"inherit":n.colors.disabled})})]})]}),et&&c(vt,{clearable:E,children:c(ht,{dirty:g,value:P??"",inForm:j,allowEnterToSubmit:tt})})]})},Ht=o.memo(Dt);export{Ht as default};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{r as u,E as $,_ as H,aS as ut,be as Ht,bf as Vt,bg as jt,K as G,M as X,R as yt,az as Gt,n as x,bh as Xt,C as z,j as v,bi as qt,b2 as Yt,bj as Kt,bk as Zt,an as Jt,y as Qt,bl as Q,z as te,aw as ee,bm as ie,bn as se,b6 as ne,bo as re}from"./index.DeuQX1T6.js";import{u as oe,F as ae}from"./FormClearHelper.Dha_cfuU.js";import{T as le,a as pt}from"./Toolbar.B5RomQbU.js";import{u as ce}from"./Hooks.BrulV197.js";import{c as de}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as he,D as ue}from"./FileDownload.esm.K0RIIaSL.js";var wt=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("g",{fill:"none"},u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24})),u.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),u.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});wt.displayName="Mic";var Ct=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("rect",{width:24,height:24,fill:"none"}),u.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});Ct.displayName="Pause";var St=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("rect",{width:24,height:24,fill:"none"}),u.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});St.displayName="PlayArrow";var Rt=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),u.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});Rt.displayName="Refresh";var Et=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("g",{fill:"none"},u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24})),u.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});Et.displayName="StopCircle";function E(s,t,e,i){return new(e||(e=Promise))(function(r,n){function a(c){try{d(i.next(c))}catch(l){n(l)}}function o(c){try{d(i.throw(c))}catch(l){n(l)}}function d(c){var l;c.done?r(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const r=()=>{this.un(t,r),this.un(t,e)};return this.on(t,r),r}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const mt={decode:function(s,t){return E(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(r=>r>1||r<-1)){const r=i.length;let n=0;for(let a=0;a<r;a++){const o=Math.abs(i[a]);o>n&&(n=o)}for(const a of e)for(let o=0;o<r;o++)a[o]/=n}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s==null?void 0:s[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function xt(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,r]of Object.entries(t))if(i==="children")for(const[n,a]of Object.entries(t))typeof a=="string"?e.appendChild(document.createTextNode(a)):e.appendChild(xt(n,a));else i==="style"?Object.assign(e.style,r):i==="textContent"?e.textContent=r:e.setAttribute(i,r.toString());return e}function ft(s,t,e){const i=xt(s,t||{});return e==null||e.appendChild(i),i}var pe=Object.freeze({__proto__:null,createElement:ft,default:ft});const me={fetchBlob:function(s,t,e){return E(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(r,n){E(this,void 0,void 0,function*(){if(!r.body||!r.headers)return;const a=r.body.getReader(),o=Number(r.headers.get("Content-Length"))||0;let d=0;const c=p=>E(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const h=Math.round(d/o*100);n(h)}),l=()=>E(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class fe extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const r=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;try{this.media.src=r}catch{this.media.src=t}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return E(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=t}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class N extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[r,n]=this.initHtml();i.appendChild(r),this.container=r,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),r=e.clientX-i.left,n=e.clientY-i.top;return[r/i.width,n/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,r]=t(e);this.emit("click",i,r)}),this.wrapper.addEventListener("dblclick",e=>{const[i,r]=t(e);this.emit("dblclick",i,r)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:r}=this.scrollContainer,n=e/i,a=(e+r)/i;this.emit("scroll",n,a,e,e+r)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,r,n=3,a=0,o=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let h=p.clientX,m=p.clientY,f=!1;const b=Date.now(),g=C=>{if(C.preventDefault(),C.stopPropagation(),d&&Date.now()-b<o)return;const D=C.clientX,W=C.clientY,M=D-h,A=W-m;if(f||Math.abs(M)>n||Math.abs(A)>n){const I=t.getBoundingClientRect(),{left:U,top:O}=I;f||(i==null||i(h-U,m-O),f=!0),e(M,A,D-U,W-O),h=D,m=W}},w=C=>{if(f){const D=C.clientX,W=C.clientY,M=t.getBoundingClientRect(),{left:A,top:I}=M;r==null||r(D-A,W-I)}c()},y=C=>{C.relatedTarget&&C.relatedTarget!==document.documentElement||w(C)},P=C=>{f&&(C.stopPropagation(),C.preventDefault())},T=C=>{f&&C.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",w),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("click",P,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",w),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",T),setTimeout(()=>{document.removeEventListener("click",P,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const r=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const n=this.parent.clientHeight||128;return e!=null&&e.every(a=>!a.overlay)?n/r:n}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
|
1
|
+
import{r as u,E as $,_ as H,aS as ut,be as Ht,bf as Vt,bg as jt,K as G,M as X,R as yt,az as Gt,n as x,bh as Xt,C as z,j as v,bi as qt,b2 as Yt,bj as Kt,bk as Zt,an as Jt,y as Qt,bl as Q,z as te,aw as ee,bm as ie,bn as se,b6 as ne,bo as re}from"./index.bLZVjplR.js";import{u as oe,F as ae}from"./FormClearHelper.Doa6Lh7Q.js";import{T as le,a as pt}from"./Toolbar.C714dqzb.js";import{u as ce}from"./Hooks.CxtftrJy.js";import{c as de}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as he,D as ue}from"./FileDownload.esm.NwWY1bYI.js";var wt=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("g",{fill:"none"},u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24})),u.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),u.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});wt.displayName="Mic";var Ct=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("rect",{width:24,height:24,fill:"none"}),u.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});Ct.displayName="Pause";var St=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("rect",{width:24,height:24,fill:"none"}),u.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});St.displayName="PlayArrow";var Rt=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),u.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});Rt.displayName="Refresh";var Et=u.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return u.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),u.createElement("g",{fill:"none"},u.createElement("rect",{width:24,height:24}),u.createElement("rect",{width:24,height:24})),u.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});Et.displayName="StopCircle";function E(s,t,e,i){return new(e||(e=Promise))(function(r,n){function a(c){try{d(i.next(c))}catch(l){n(l)}}function o(c){try{d(i.throw(c))}catch(l){n(l)}}function d(c){var l;c.done?r(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const r=()=>{this.un(t,r),this.un(t,e)};return this.on(t,r),r}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const mt={decode:function(s,t){return E(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(r=>r>1||r<-1)){const r=i.length;let n=0;for(let a=0;a<r;a++){const o=Math.abs(i[a]);o>n&&(n=o)}for(const a of e)for(let o=0;o<r;o++)a[o]/=n}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s==null?void 0:s[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function xt(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,r]of Object.entries(t))if(i==="children")for(const[n,a]of Object.entries(t))typeof a=="string"?e.appendChild(document.createTextNode(a)):e.appendChild(xt(n,a));else i==="style"?Object.assign(e.style,r):i==="textContent"?e.textContent=r:e.setAttribute(i,r.toString());return e}function ft(s,t,e){const i=xt(s,t||{});return e==null||e.appendChild(i),i}var pe=Object.freeze({__proto__:null,createElement:ft,default:ft});const me={fetchBlob:function(s,t,e){return E(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(r,n){E(this,void 0,void 0,function*(){if(!r.body||!r.headers)return;const a=r.body.getReader(),o=Number(r.headers.get("Content-Length"))||0;let d=0;const c=p=>E(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const h=Math.round(d/o*100);n(h)}),l=()=>E(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class fe extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const r=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;try{this.media.src=r}catch{this.media.src=t}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return E(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=t}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class N extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[r,n]=this.initHtml();i.appendChild(r),this.container=r,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),r=e.clientX-i.left,n=e.clientY-i.top;return[r/i.width,n/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,r]=t(e);this.emit("click",i,r)}),this.wrapper.addEventListener("dblclick",e=>{const[i,r]=t(e);this.emit("dblclick",i,r)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:r}=this.scrollContainer,n=e/i,a=(e+r)/i;this.emit("scroll",n,a,e,e+r)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,r,n=3,a=0,o=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let h=p.clientX,m=p.clientY,f=!1;const b=Date.now(),g=C=>{if(C.preventDefault(),C.stopPropagation(),d&&Date.now()-b<o)return;const D=C.clientX,W=C.clientY,M=D-h,A=W-m;if(f||Math.abs(M)>n||Math.abs(A)>n){const I=t.getBoundingClientRect(),{left:U,top:O}=I;f||(i==null||i(h-U,m-O),f=!0),e(M,A,D-U,W-O),h=D,m=W}},w=C=>{if(f){const D=C.clientX,W=C.clientY,M=t.getBoundingClientRect(),{left:A,top:I}=M;r==null||r(D-A,W-I)}c()},y=C=>{C.relatedTarget&&C.relatedTarget!==document.documentElement||w(C)},P=C=>{f&&(C.stopPropagation(),C.preventDefault())},T=C=>{f&&C.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",w),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",T,{passive:!1}),document.addEventListener("click",P,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",w),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",T),setTimeout(()=>{document.removeEventListener("click",P,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const r=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const n=this.parent.clientHeight||128;return e!=null&&e.every(a=>!a.overlay)?n/r:n}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
|
2
2
|
<style${i?` nonce="${i}"`:""}>
|
3
3
|
:host {
|
4
4
|
user-select: none;
|
@@ -1 +1 @@
|
|
1
|
-
import{r as M,E as T,_ as j,n as E,at as J,C as R,j as h,bp as K,b6 as z,bk as Y,b2 as Z,bj as O,bw as $,d as ee,g as te,aH as re,y as ie,bx as ae,by as oe,R as ne,an as se,aw as le,K as P,bg as de,bf as ce,bm as ue,bz as fe,bn as pe,bo as he,F as ge}from"./index.DeuQX1T6.js";import{a as W}from"./index.DW_MHI2K.js";import{F as me}from"./FormClearHelper.Dha_cfuU.js";import{U as L}from"./UploadFileInfo.C-jY39rj.js";import{P as ve,S as Se}from"./ProgressBar.CXgDz0lS.js";var N=M.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return M.createElement(T,j({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),M.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"}))});N.displayName="Video";var H=M.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return M.createElement(T,j({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),M.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"}))});H.displayName="X";var D=M.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return M.createElement(T,j({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:l}),M.createElement("rect",{width:24,height:24,fill:"none"}),M.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"}))});D.displayName="SwitchCamera";var k;(function(t){t.XSMALL="xsmall",t.SMALL="small",t.MEDIUM="medium",t.LARGE="large"})(k||(k={}));function ye(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 G=E("div",{target:"e47j7ja0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),V=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"})),be=E("p",{target:"e47j7ja2"})(({theme:t})=>({marginTop:t.spacing.sm,textAlign:"center"})),Me=E("img",{target:"e47j7ja3"})(({theme:t,opacity:l})=>({borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,objectFit:"contain",opacity:l})),we=E("a",{target:"e47j7ja4"})(({theme:t})=>({color:t.colors.primary,display:"block",textDecoration:"none"})),Ue=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})),Ee=E("div",{target:"e47j7ja8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ie=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 ${J(t.colors.primary,.5)}`},...ye("medium",t)}));function q({disabled:t,onClick:l,children:r,progress:o}){return R(Ie,{disabled:t||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[r,o&&h(Ee,{children:h(ve,{value:o,size:Se.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 Fe=({switchFacingMode:t})=>h(Ce,{"data-testid":"stCameraInputSwitchButton",children:h(K,{content:"Switch camera",placement:z.TOP_RIGHT,children:h(Y,{kind:Z.MINIMAL,onClick:t,children:h(O,{content:D,size:"twoXL",color:$.white})})})});var _={exports:{}},Re=_.exports,B;function xe(){return B||(B=1,function(t,l){(function(o,a){t.exports=a(ee())})(Re,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 C in s)n.d(g,C,(function(U){return s[U]}).bind(null,C));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)},C=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 U(){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,!U()){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(!U()){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),y=e.minScreenshotWidth!==i.minScreenshotWidth,S=e.minScreenshotHeight!==i.minScreenshotHeight;(c||y||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 y=this.getCanvas(e);return y&&y.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 y=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var p=y/S;y=c.minScreenshotWidth||this.video.clientWidth,S=y/p,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,y=S*p)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||y,this.canvas.height=(e==null?void 0:e.height)||S,this.ctx=this.canvas.getContext("2d")}var w=this,b=w.ctx,v=w.canvas;return b&&v&&(v.width=(e==null?void 0:e.width)||v.width,v.height=(e==null?void 0:e.height)||v.height,c.mirrored&&(b.translate(v.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,(e==null?void 0:e.width)||v.width,(e==null?void 0:e.height)||v.height),c.mirrored&&(b.scale(-1,1),b.translate(-v.width,0))),v},u.prototype.requestUserMedia=function(){var e=this,i=this.props,d=function(S,p){var w={video:typeof p<"u"?p:!0};i.audio&&(w.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(w).then(function(v){e.unmounted||b!==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}]}},y=function(S){var p=S.deviceId;return typeof p=="string"?p:Array.isArray(p)&&p.length>0?p[0]:typeof p=="object"&&p.ideal?p.ideal:null};MediaStreamTrack.getSources(function(S){var p=null,w=null;S.forEach(function(x){x.kind==="audio"?p=x.id:x.kind==="video"&&(w=x.id)});var b=y(i.audioConstraints);b&&(p=b);var v=y(i.videoConstraints);v&&(w=v),d(c(p),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,y=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,p=c.style,w=p===void 0?{}:p,b=c.children,v=C(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,X={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,src:d.src,muted:!y,playsInline:!0,ref:function(Q){e.video=Q},style:x},v)),b&&b(X))},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})}(_)),_.exports}var Pe=xe();const _e=te(Pe);var A;(function(t){t.PENDING="pending",t.SUCCESS="success",t.ERROR="error"})(A||(A={}));const Te=({width:t})=>R(V,{width:t,children:[h(O,{size:"threeXL",color:$.gray60,content:N}),R(be,{children:["This app would like to use your camera.",h(we,{href:oe,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),je=({handleCapture:t,width:l,disabled:r,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:n,setFacingMode:s,testOverride:f})=>{const[g,C]=M.useState(f||"pending"),U=M.useRef(null),[I,m]=M.useState(l),u=M.useCallback(re(1e3,m),[]);M.useEffect(()=>{u(l)},[l,u]);function e(){if(U.current!==null){const d=U.current.getScreenshot();t(d)}}const i=ie();return R(G,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!r&&!o?h(Te,{width:I}):ae.isMobile&&h(Fe,{switchFacingMode:s}),h(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!r&&!o,width:I,children:!r&&h(_e,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${i.radii.default} ${i.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),h(q,{onClick:e,disabled:g!=="success"||r||o,children:"Take Photo"})]})},Oe=150,Ve=se.getLogger("CameraInput");class $e extends ne.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new me,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 We(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(Oe)).then(()=>{this.setState((a,n)=>({imgSrc:r,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{Ve.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);le(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=W.CancelToken.source(),n=new L(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=>{W.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,C=s.fileId,U=s.fileUrls;return new L(f,g,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=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 de({fileId:n.fileId,fileUrls:n.fileUrls,name:o,size:a})});return new ce({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(G,{className:"stCameraInput","data-testid":"stCameraInput",children:[h(he,{label:l.label,disabled:o,labelVisibility:ue((n=l.labelVisibility)==null?void 0:n.value),children:l.help&&h(fe,{children:h(pe,{content:l.help,placement:z.TOP_RIGHT})})}),this.state.imgSrc?R(ge,{children:[h(V,{width:a,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h(Me,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:a,height:a*9/16})}),h(q,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||o,children:this.getProgress()?"Uploading...":R(Ue,{children:[h(O,{content:H,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h(je,{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 We(t,l){return fetch(t).then(r=>r.arrayBuffer()).then(r=>new File([r],l,{type:"image/jpeg"}))}export{$e as default};
|
1
|
+
import{r as M,E as T,_ as j,n as E,at as J,C as R,j as h,bp as K,b6 as z,bk as Y,b2 as Z,bj as O,bw as $,d as ee,g as te,aH as re,y as ie,bx as ae,by as oe,R as ne,an as se,aw as le,K as P,bg as de,bf as ce,bm as ue,bz as fe,bn as pe,bo as he,F as ge}from"./index.bLZVjplR.js";import{a as W}from"./index.DW_MHI2K.js";import{F as me}from"./FormClearHelper.Doa6Lh7Q.js";import{U as L}from"./UploadFileInfo.C-jY39rj.js";import{P as ve,S as Se}from"./ProgressBar.WE22u_Ob.js";var N=M.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return M.createElement(T,j({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),M.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"}))});N.displayName="Video";var H=M.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return M.createElement(T,j({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:l}),M.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"}))});H.displayName="X";var D=M.forwardRef(function(t,l){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return M.createElement(T,j({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:l}),M.createElement("rect",{width:24,height:24,fill:"none"}),M.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"}))});D.displayName="SwitchCamera";var k;(function(t){t.XSMALL="xsmall",t.SMALL="small",t.MEDIUM="medium",t.LARGE="large"})(k||(k={}));function ye(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 G=E("div",{target:"e47j7ja0"})({position:"relative",overflow:"hidden",width:"100%",objectFit:"contain"}),V=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"})),be=E("p",{target:"e47j7ja2"})(({theme:t})=>({marginTop:t.spacing.sm,textAlign:"center"})),Me=E("img",{target:"e47j7ja3"})(({theme:t,opacity:l})=>({borderRadius:`${t.radii.default} ${t.radii.default} 0 0`,objectFit:"contain",opacity:l})),we=E("a",{target:"e47j7ja4"})(({theme:t})=>({color:t.colors.primary,display:"block",textDecoration:"none"})),Ue=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})),Ee=E("div",{target:"e47j7ja8"})({height:"fit-content",width:"100%",position:"absolute",bottom:0}),Ie=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 ${J(t.colors.primary,.5)}`},...ye("medium",t)}));function q({disabled:t,onClick:l,children:r,progress:o}){return R(Ie,{disabled:t||!1,onClick:l||(()=>{}),progress:o||null,"data-testid":"stCameraInputButton",children:[r,o&&h(Ee,{children:h(ve,{value:o,size:Se.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 Fe=({switchFacingMode:t})=>h(Ce,{"data-testid":"stCameraInputSwitchButton",children:h(K,{content:"Switch camera",placement:z.TOP_RIGHT,children:h(Y,{kind:Z.MINIMAL,onClick:t,children:h(O,{content:D,size:"twoXL",color:$.white})})})});var _={exports:{}},Re=_.exports,B;function xe(){return B||(B=1,function(t,l){(function(o,a){t.exports=a(ee())})(Re,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 C in s)n.d(g,C,(function(U){return s[U]}).bind(null,C));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)},C=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 U(){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,!U()){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(!U()){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),y=e.minScreenshotWidth!==i.minScreenshotWidth,S=e.minScreenshotHeight!==i.minScreenshotHeight;(c||y||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 y=this.getCanvas(e);return y&&y.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 y=this.video.videoWidth,S=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var p=y/S;y=c.minScreenshotWidth||this.video.clientWidth,S=y/p,c.minScreenshotHeight&&S<c.minScreenshotHeight&&(S=c.minScreenshotHeight,y=S*p)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||y,this.canvas.height=(e==null?void 0:e.height)||S,this.ctx=this.canvas.getContext("2d")}var w=this,b=w.ctx,v=w.canvas;return b&&v&&(v.width=(e==null?void 0:e.width)||v.width,v.height=(e==null?void 0:e.height)||v.height,c.mirrored&&(b.translate(v.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,(e==null?void 0:e.width)||v.width,(e==null?void 0:e.height)||v.height),c.mirrored&&(b.scale(-1,1),b.translate(-v.width,0))),v},u.prototype.requestUserMedia=function(){var e=this,i=this.props,d=function(S,p){var w={video:typeof p<"u"?p:!0};i.audio&&(w.audio=typeof S<"u"?S:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(w).then(function(v){e.unmounted||b!==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}]}},y=function(S){var p=S.deviceId;return typeof p=="string"?p:Array.isArray(p)&&p.length>0?p[0]:typeof p=="object"&&p.ideal?p.ideal:null};MediaStreamTrack.getSources(function(S){var p=null,w=null;S.forEach(function(x){x.kind==="audio"?p=x.id:x.kind==="video"&&(w=x.id)});var b=y(i.audioConstraints);b&&(p=b);var v=y(i.videoConstraints);v&&(w=v),d(c(p),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,y=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,p=c.style,w=p===void 0?{}:p,b=c.children,v=C(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,X={getScreenshot:this.getScreenshot.bind(this)};return s.createElement(s.Fragment,null,s.createElement("video",g({autoPlay:!0,src:d.src,muted:!y,playsInline:!0,ref:function(Q){e.video=Q},style:x},v)),b&&b(X))},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})}(_)),_.exports}var Pe=xe();const _e=te(Pe);var A;(function(t){t.PENDING="pending",t.SUCCESS="success",t.ERROR="error"})(A||(A={}));const Te=({width:t})=>R(V,{width:t,children:[h(O,{size:"threeXL",color:$.gray60,content:N}),R(be,{children:["This app would like to use your camera.",h(we,{href:oe,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),je=({handleCapture:t,width:l,disabled:r,clearPhotoInProgress:o,setClearPhotoInProgress:a,facingMode:n,setFacingMode:s,testOverride:f})=>{const[g,C]=M.useState(f||"pending"),U=M.useRef(null),[I,m]=M.useState(l),u=M.useCallback(re(1e3,m),[]);M.useEffect(()=>{u(l)},[l,u]);function e(){if(U.current!==null){const d=U.current.getScreenshot();t(d)}}const i=ie();return R(G,{"data-testid":"stCameraInputWebcamComponent",children:[g!=="success"&&!r&&!o?h(Te,{width:I}):ae.isMobile&&h(Fe,{switchFacingMode:s}),h(V,{"data-testid":"stCameraInputWebcamStyledBox",hidden:g!=="success"&&!r&&!o,width:I,children:!r&&h(_e,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${i.radii.default} ${i.radii.default} 0 0`},onUserMediaError:()=>{C("error")},onUserMedia:()=>{C("success"),a(!1)},videoConstraints:{width:{ideal:I},facingMode:n}})}),h(q,{onClick:e,disabled:g!=="success"||r||o,children:"Take Photo"})]})},Oe=150,Ve=se.getLogger("CameraInput");class $e extends ne.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new me,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 We(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(Oe)).then(()=>{this.setState((a,n)=>({imgSrc:r,shutter:a.shutter,minShutterEffectPassed:!0}))}).catch(a=>{Ve.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);le(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=W.CancelToken.source(),n=new L(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=>{W.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,C=s.fileId,U=s.fileUrls;return new L(f,g,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=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 de({fileId:n.fileId,fileUrls:n.fileUrls,name:o,size:a})});return new ce({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(G,{className:"stCameraInput","data-testid":"stCameraInput",children:[h(he,{label:l.label,disabled:o,labelVisibility:ue((n=l.labelVisibility)==null?void 0:n.value),children:l.help&&h(fe,{children:h(pe,{content:l.help,placement:z.TOP_RIGHT})})}),this.state.imgSrc?R(ge,{children:[h(V,{width:a,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h(Me,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:a,height:a*9/16})}),h(q,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||o,children:this.getProgress()?"Uploading...":R(Ue,{children:[h(O,{content:H,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h(je,{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 We(t,l){return fetch(t).then(r=>r.arrayBuffer()).then(r=>new File([r],l,{type:"image/jpeg"}))}export{$e as default};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var yk=Object.defineProperty;var vk=(r,e,t)=>e in r?yk(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var $=(r,e,t)=>vk(r,typeof e!="symbol"?e+"":e,t);import{g as Uh,r as Pt,ao as yr,aO as dt,aP as _u,_ as qM,j as Es,C as Fl,aQ as xy,F as jT,aR as wy,aS as bk,aT as HT,aU as xk,az as wk,aV as Tk,n as XM,D as $M,aW as v1,aX as GT,aw as Ek,y as Sk,aY as Ck,aZ as WT}from"./index.DeuQX1T6.js";import{_ as as,a as Pk,C as Ik}from"./toConsumableArray.DFJurSxu.js";import{a as Fu,b as ku,_ as Yb,c as Fd,d as Kb}from"./possibleConstructorReturn.CnSJ4CFa.js";import{a as Mk,T as Rk}from"./Toolbar.B5RomQbU.js";import{u as ZM,E as YM,w as Bk}from"./withFullScreenWrapper.BKBYrOn-.js";import{u as Ok}from"./useBasicWidgetState.e9cw5rKa.js";import{u as Dk,s as Fk}from"./threshold.DjX0wlsa.js";import{a as kk}from"./index.DW_MHI2K.js";import"./FormClearHelper.Dha_cfuU.js";import"./value.CgPGBV_l.js";function Lk(r,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in r)){const o=Object.getOwnPropertyDescriptor(i,n);o&&Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}const hu={};async function zp(r,e,t,i){return i._parse(r,e,t,i)}function An(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const r_=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),qT=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);qT&&parseFloat(qT[1]);const U0=globalThis,Lf=globalThis.process||{},Nk=globalThis.navigator||{};function KM(r){var i,n;if(typeof window<"u"&&((i=window.process)==null?void 0:i.type)==="renderer"||typeof process<"u"&&((n=process.versions)!=null&&n.electron))return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function Lu(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||KM()}function Uk(r){return Lu()?KM()?"Electron":(Nk.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const JM="4.0.7";function zk(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}class Vk{constructor(e,t,i="sessionStorage"){this.storage=zk(i),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function jk(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Hk(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var em;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(em||(em={}));const Gk=10;function XT(r){return typeof r!="string"?r:(r=r.toUpperCase(),em[r]||em.WHITE)}function Wk(r,e,t){return!Lu&&typeof r=="string"&&(e&&(r=`\x1B[${XT(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${XT(t)+Gk}m${r}\x1B[49m`)),r}function qk(r,e=["constructor"]){const t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),n=r;for(const o of i){const s=n[o];typeof s=="function"&&(e.find(u=>o===u)||(n[o]=s.bind(r)))}}function Jb(r,e){if(!r)throw new Error("Assertion failed")}function Nf(){var e,t,i;let r;if(Lu()&&U0.performance)r=(t=(e=U0==null?void 0:U0.performance)==null?void 0:e.now)==null?void 0:t.call(e);else if("hrtime"in Lf){const n=(i=Lf==null?void 0:Lf.hrtime)==null?void 0:i.call(Lf);r=n[0]*1e3+n[1]/1e6}else r=Date.now();return r}const Uf={debug:Lu()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Xk={enabled:!0,level:0};function zf(){}const $T={},ZT={once:!0};class Kd{constructor({id:e}={id:""}){this.VERSION=JM,this._startTs=Nf(),this._deltaTs=Nf(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Vk(`__probe-${this.id}__`,Xk),this.timeStamp(`${this.id} started`),qk(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Nf()-this._startTs).toPrecision(10))}getDelta(){return Number((Nf()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Uf.warn,arguments,ZT)}error(e){return this._getLogFunction(0,e,Uf.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,Uf.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Uf.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Uf.debug||Uf.info,arguments,ZT)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||zf,i&&[i],{tag:Zk(t)}):zf}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||zf)}group(e,t,i={collapsed:!1}){const n=YT({logLevel:e,message:t,opts:i}),{collapsed:o}=i;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||zf)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=QM(e)}_getLogFunction(e,t,i,n,o){if(this._shouldLog(e)){o=YT({logLevel:e,message:t,args:n,opts:o}),i=i||o.method,Jb(i),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Nf();const s=o.tag||o.message;if(o.once&&s)if(!$T[s])$T[s]=Nf();else return zf;return t=$k(this.id,o.message,o),i.bind(console,t,...o.args)}return zf}}Kd.VERSION=JM;function QM(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Jb(Number.isFinite(e)&&e>=0),e}function YT(r){const{logLevel:e,message:t}=r;r.logLevel=QM(e);const i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const n=typeof r.message;return Jb(n==="string"||n==="object"),Object.assign(r,{args:i},r.opts)}function $k(r,e,t){if(typeof e=="string"){const i=t.time?Hk(jk(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=Wk(e,t.color,t.background)}return e}function Zk(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}globalThis.probe={};const eR=new Kd({id:"@probe.gl/log"});function tR(r,e){return rR(r||{},e)}function rR(r,e,t=0){if(t>3)return e;const i={...r};for(const[n,o]of Object.entries(e))o&&typeof o=="object"&&!Array.isArray(o)?i[n]=rR(i[n]||{},e[n],t+1):i[n]=e[n];return i}function Yk(r){var e;globalThis.loaders||(globalThis.loaders={}),(e=globalThis.loaders).modules||(e.modules={}),Object.assign(globalThis.loaders.modules,r)}function Kk(r){var t,i;return((i=(t=globalThis.loaders)==null?void 0:t.modules)==null?void 0:i[r])||null}const Jk="latest";function Qk(){var r;return(r=globalThis._loadersgl_)!=null&&r.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.4"),globalThis._loadersgl_.version}const iR=Qk();function Pc(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const va=typeof process!="object"||String(process)!=="[object process]"||process.browser,Qb=typeof importScripts=="function",eL=typeof window<"u"&&typeof window.orientation<"u",KT=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);KT&&parseFloat(KT[1]);class tL{constructor(e,t){$(this,"name");$(this,"workerThread");$(this,"isRunning",!0);$(this,"result");$(this,"_resolve",()=>{});$(this,"_reject",()=>{});this.name=e,this.workerThread=t,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){Pc(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Pc(this.isRunning),this.isRunning=!1,this._reject(e)}}class Ty{terminate(){}}const Ey=new Map;function rL(r){Pc(r.source&&!r.url||!r.source&&r.url);let e=Ey.get(r.source||r.url);return e||(r.url&&(e=iL(r.url),Ey.set(r.url,e)),r.source&&(e=nR(r.source),Ey.set(r.source,e))),Pc(e),e}function iL(r){if(!r.startsWith("http"))return r;const e=nL(r);return nR(e)}function nR(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function nL(r){return`try {
|
1
|
+
var yk=Object.defineProperty;var vk=(r,e,t)=>e in r?yk(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var $=(r,e,t)=>vk(r,typeof e!="symbol"?e+"":e,t);import{g as Uh,r as Pt,ao as yr,aO as dt,aP as _u,_ as qM,j as Es,C as Fl,aQ as xy,F as jT,aR as wy,aS as bk,aT as HT,aU as xk,az as wk,aV as Tk,n as XM,D as $M,aW as v1,aX as GT,aw as Ek,y as Sk,aY as Ck,aZ as WT}from"./index.bLZVjplR.js";import{_ as as,a as Pk,C as Ik}from"./toConsumableArray.bbNBXf55.js";import{a as Fu,b as ku,_ as Yb,c as Fd,d as Kb}from"./possibleConstructorReturn.CRrAWWQi.js";import{a as Mk,T as Rk}from"./Toolbar.C714dqzb.js";import{u as ZM,E as YM,w as Bk}from"./withFullScreenWrapper.wyYj-oat.js";import{u as Ok}from"./useBasicWidgetState.DNqxSbNL.js";import{u as Dk,s as Fk}from"./threshold.DjX0wlsa.js";import{a as kk}from"./index.DW_MHI2K.js";import"./FormClearHelper.Doa6Lh7Q.js";import"./value.CgPGBV_l.js";function Lk(r,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in r)){const o=Object.getOwnPropertyDescriptor(i,n);o&&Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}const hu={};async function zp(r,e,t,i){return i._parse(r,e,t,i)}function An(r,e){if(!r)throw new Error(e||"loader assertion failed.")}const r_=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),qT=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);qT&&parseFloat(qT[1]);const U0=globalThis,Lf=globalThis.process||{},Nk=globalThis.navigator||{};function KM(r){var i,n;if(typeof window<"u"&&((i=window.process)==null?void 0:i.type)==="renderer"||typeof process<"u"&&((n=process.versions)!=null&&n.electron))return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function Lu(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||KM()}function Uk(r){return Lu()?KM()?"Electron":(Nk.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const JM="4.0.7";function zk(r){try{const e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}class Vk{constructor(e,t,i="sessionStorage"){this.storage=zk(i),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function jk(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Hk(r,e=8){const t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var em;(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(em||(em={}));const Gk=10;function XT(r){return typeof r!="string"?r:(r=r.toUpperCase(),em[r]||em.WHITE)}function Wk(r,e,t){return!Lu&&typeof r=="string"&&(e&&(r=`\x1B[${XT(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${XT(t)+Gk}m${r}\x1B[49m`)),r}function qk(r,e=["constructor"]){const t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),n=r;for(const o of i){const s=n[o];typeof s=="function"&&(e.find(u=>o===u)||(n[o]=s.bind(r)))}}function Jb(r,e){if(!r)throw new Error("Assertion failed")}function Nf(){var e,t,i;let r;if(Lu()&&U0.performance)r=(t=(e=U0==null?void 0:U0.performance)==null?void 0:e.now)==null?void 0:t.call(e);else if("hrtime"in Lf){const n=(i=Lf==null?void 0:Lf.hrtime)==null?void 0:i.call(Lf);r=n[0]*1e3+n[1]/1e6}else r=Date.now();return r}const Uf={debug:Lu()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Xk={enabled:!0,level:0};function zf(){}const $T={},ZT={once:!0};class Kd{constructor({id:e}={id:""}){this.VERSION=JM,this._startTs=Nf(),this._deltaTs=Nf(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Vk(`__probe-${this.id}__`,Xk),this.timeStamp(`${this.id} started`),qk(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Nf()-this._startTs).toPrecision(10))}getDelta(){return Number((Nf()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e){return this._getLogFunction(0,e,Uf.warn,arguments,ZT)}error(e){return this._getLogFunction(0,e,Uf.error,arguments)}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t){return this._getLogFunction(e,t,Uf.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Uf.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,Uf.debug||Uf.info,arguments,ZT)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||zf,i&&[i],{tag:Zk(t)}):zf}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||zf)}group(e,t,i={collapsed:!1}){const n=YT({logLevel:e,message:t,opts:i}),{collapsed:o}=i;return n.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||zf)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=QM(e)}_getLogFunction(e,t,i,n,o){if(this._shouldLog(e)){o=YT({logLevel:e,message:t,args:n,opts:o}),i=i||o.method,Jb(i),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Nf();const s=o.tag||o.message;if(o.once&&s)if(!$T[s])$T[s]=Nf();else return zf;return t=$k(this.id,o.message,o),i.bind(console,t,...o.args)}return zf}}Kd.VERSION=JM;function QM(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return Jb(Number.isFinite(e)&&e>=0),e}function YT(r){const{logLevel:e,message:t}=r;r.logLevel=QM(e);const i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break}typeof r.message=="function"&&(r.message=r.message());const n=typeof r.message;return Jb(n==="string"||n==="object"),Object.assign(r,{args:i},r.opts)}function $k(r,e,t){if(typeof e=="string"){const i=t.time?Hk(jk(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=Wk(e,t.color,t.background)}return e}function Zk(r){for(const e in r)for(const t in r[e])return t||"untitled";return"empty"}globalThis.probe={};const eR=new Kd({id:"@probe.gl/log"});function tR(r,e){return rR(r||{},e)}function rR(r,e,t=0){if(t>3)return e;const i={...r};for(const[n,o]of Object.entries(e))o&&typeof o=="object"&&!Array.isArray(o)?i[n]=rR(i[n]||{},e[n],t+1):i[n]=e[n];return i}function Yk(r){var e;globalThis.loaders||(globalThis.loaders={}),(e=globalThis.loaders).modules||(e.modules={}),Object.assign(globalThis.loaders.modules,r)}function Kk(r){var t,i;return((i=(t=globalThis.loaders)==null?void 0:t.modules)==null?void 0:i[r])||null}const Jk="latest";function Qk(){var r;return(r=globalThis._loadersgl_)!=null&&r.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.4"),globalThis._loadersgl_.version}const iR=Qk();function Pc(r,e){if(!r)throw new Error(e||"loaders.gl assertion failed.")}const va=typeof process!="object"||String(process)!=="[object process]"||process.browser,Qb=typeof importScripts=="function",eL=typeof window<"u"&&typeof window.orientation<"u",KT=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);KT&&parseFloat(KT[1]);class tL{constructor(e,t){$(this,"name");$(this,"workerThread");$(this,"isRunning",!0);$(this,"result");$(this,"_resolve",()=>{});$(this,"_reject",()=>{});this.name=e,this.workerThread=t,this.result=new Promise((i,n)=>{this._resolve=i,this._reject=n})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){Pc(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){Pc(this.isRunning),this.isRunning=!1,this._reject(e)}}class Ty{terminate(){}}const Ey=new Map;function rL(r){Pc(r.source&&!r.url||!r.source&&r.url);let e=Ey.get(r.source||r.url);return e||(r.url&&(e=iL(r.url),Ey.set(r.url,e)),r.source&&(e=nR(r.source),Ey.set(r.source,e))),Pc(e),e}function iL(r){if(!r.startsWith("http"))return r;const e=nL(r);return nR(e)}function nR(r){const e=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(e)}function nL(r){return`try {
|
2
2
|
importScripts('${r}');
|
3
3
|
} catch (error) {
|
4
4
|
console.error(error);
|
@@ -1 +1 @@
|
|
1
|
-
import{n as W,r,y as T,bX as C,bY as V,C as L,j as l,bm as O,bz as P,bn as k,b6 as E,bo as N,bW as $,bZ as B,bS as A,b_ as F,bx as H}from"./index.
|
1
|
+
import{n as W,r,y as T,bX as C,bY as V,C as L,j as l,bm as O,bz as P,bn as k,b6 as E,bo as N,bW as $,bZ as B,bS as A,b_ as F,bx as H}from"./index.bLZVjplR.js";import{a as D}from"./useBasicWidgetState.DNqxSbNL.js";import"./FormClearHelper.Doa6Lh7Q.js";const U=W("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),j=(s,t)=>s.getIntArrayValue(t),G=s=>s.default??null,K=s=>s.value??null,Y=(s,t,a,u)=>{t.setIntArrayValue(s,a.value,{fromUi:a.fromUi},u)},X=s=>{var S;const{element:t,widgetMgr:a,width:u,fragmentId:y}=s,e=T(),[n,g]=D({getStateFromWidgetMgr:j,getDefaultStateFromProto:G,getCurrStateFromProto:K,updateWidgetMgrState:Y,element:t,widgetMgr:a,fragmentId:y}),m=t.maxSelections>0&&n.length>=t.maxSelections,f=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(n.length===t.maxSelections){const o=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${o}. Remove an option first.`}return"No results"},[t.maxSelections,n.length]),v=r.useMemo(()=>n.map(o=>{const i=t.options[o];return{value:o.toString(),label:i}}),[t.options,n]),h=r.useCallback(o=>{const i=()=>{var d;const p=(d=o.option)==null?void 0:d.value;return parseInt(p,10)};switch(o.type){case"remove":return C(n,i());case"clear":return[];case"select":return n.concat([i()]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[n]),x=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&n.length>=t.maxSelections||g({value:h(o),fromUi:!0})},[t.maxSelections,h,g,n.length]),z=r.useCallback((o,i)=>{if(m)return[];const p=o.filter(d=>!n.includes(Number(d.value)));return V(p,i)},[m,n]),w={width:u},{options:c}=t,b=c.length===0?!0:s.disabled,I=c.length===0?"No options to select.":t.placeholder,R=c.map((o,i)=>({label:o,value:i.toString()})),M=c.length>10;return L("div",{className:"stMultiSelect","data-testid":"stMultiSelect",style:w,children:[l(N,{label:t.label,disabled:b,labelVisibility:O((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&l(P,{children:l(k,{content:t.help,placement:E.TOP_RIGHT})})}),l(U,{children:l($,{options:R,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:I,type:F.select,multi:!0,onChange:x,value:v,disabled:b,size:"compact",noResultsMsg:f,filterOptions:z,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:A,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",opacity:"0.7"})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:H.isMobile&&M===!1?"readonly":null}},Dropdown:{component:B}}})})]})},J=r.memo(X);export{J as default};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{br as v,r as l,cb as q,cg as S,cd as p}from"./index.
|
1
|
+
import{br as v,r as l,cb as q,cg as S,cd as p}from"./index.bLZVjplR.js";import{R as C,c as w,d as J,B as M}from"./base-input.C0t7SpL6.js";function _(e){"@babel/helpers - typeof";return _=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(e)}var U=["Root","StartEnhancer","EndEnhancer"],Z=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function O(e,t){return V(e)||Q(e,t)||K(e,t)||G()}function G(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(e,t){if(e){if(typeof e=="string")return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}function j(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Q(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,u;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(b){a=!0,u=b}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}return n}}function V(e){if(Array.isArray(e))return e}function I(e,t){if(e==null)return{};var r=X(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function te(e,t,r){return t&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function re(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function ne(e){var t=ae();return function(){var n=h(e),o;if(t){var a=h(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return oe(this,o)}}function oe(e,t){if(t&&(_(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ie=function(e){re(r,e);var t=ne(r);function r(){var n;Y(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),d(y(n),"state",{isFocused:n.props.autoFocus||!1}),d(y(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),d(y(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return te(r,[{key:"render",value:function(){var o=this.props,a=o.startEnhancer,i=o.endEnhancer,u=o.overrides,b=u.Root,A=u.StartEnhancer,B=u.EndEnhancer,F=I(u,U),T=I(o,Z),x=v(b,C),g=O(x,2),$=g[0],N=g[1],D=v(A,w),E=O(D,2),W=E[0],z=E[1],H=v(B,w),P=O(H,2),L=P[0],k=P[1],s=J(this.props,this.state);return l.createElement($,f({"data-baseweb":"input"},s,N,{$adjoined:R(a,i),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),c(a)&&l.createElement(W,f({},s,z,{$position:S.start}),typeof a=="function"?a(s):a),l.createElement(M,f({},T,{overrides:F,adjoined:R(a,i),onFocus:this.onFocus,onBlur:this.onBlur})),c(i)&&l.createElement(L,f({},s,k,{$position:S.end}),typeof i=="function"?i(s):i))}}]),r}(l.Component);d(ie,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:q.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function R(e,t){return c(e)&&c(t)?p.both:c(e)?p.left:c(t)?p.right:p.none}function c(e){return!!(e||e===0)}export{ie as I};
|
@@ -1 +1 @@
|
|
1
|
-
import{c as p,e as c}from"./es6.
|
1
|
+
import{c as p,e as c}from"./es6.DNX_sNKu.js";import"./index.bLZVjplR.js";const{File:n,Blob:_,DOMException:s}=p,{INVALID:z,GONE:r,MISMATCH:w,MOD_ERR:b,SYNTAX:a,SECURITY:I,DISALLOWED:m}=c;class g{constructor(e,i){this.fileHandle=e,this.file=i,this.size=i.size,this.position=0}write(e){let i=this.file;if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.position=e.position,this.size<e.position&&(this.file=new n([this.file,new ArrayBuffer(e.position-this.size)],this.file.name,this.file))),!("data"in e))throw new s(...a("write requires a data argument"));e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.size<e.position)throw new s(...z);this.position=e.position;return}else throw new s(...a("seek requires a position argument"));else if(e.type==="truncate")if(Number.isInteger(e.size)&&e.size>=0){i=e.size<this.size?new n([i.slice(0,e.size)],i.name,i):new n([i,new Uint8Array(e.size-this.size)],i.name),this.size=i.size,this.position>i.size&&(this.position=i.size),this.file=i;return}else throw new s(...a("truncate requires a size argument"))}e=new _([e]);let t=this.file;const o=t.slice(0,this.position),y=t.slice(this.position+e.size);let l=this.position-o.size;l<0&&(l=0),t=new n([o,new Uint8Array(l),e,y],t.name),this.size=t.size,this.position+=e.size,this.file=t}close(){if(this.fileHandle._deleted)throw new s(...r);this.fileHandle._file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class f{constructor(e="",i=new n([],e),t=!0){this._file=i,this.name=e,this.kind="file",this._deleted=!1,this.writable=t,this.readable=!0}async getFile(){if(this._deleted)throw new s(...r);return this._file}async createWritable(e){if(!this.writable)throw new s(...m);if(this._deleted)throw new s(...r);const i=e.keepExistingData?await this.getFile():new n([],this.name);return new g(this,i)}async isSameEntry(e){return this===e}async _destroy(){this._deleted=!0,this._file=null}}class h{constructor(e,i=!0){this.name=e,this.kind="directory",this._deleted=!1,this._entries={},this.writable=i,this.readable=!0}async*entries(){if(this._deleted)throw new s(...r);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i){if(this._deleted)throw new s(...r);const t=this._entries[e];if(t){if(t instanceof f)throw new s(...w);return t}else{if(i.create)return this._entries[e]=new h(e);throw new s(...r)}}async getFileHandle(e,i){const t=this._entries[e],o=t instanceof f;if(t&&o)return t;if(t&&!o)throw new s(...w);if(!t&&!i.create)throw new s(...r);if(!t&&i.create)return this._entries[e]=new f(e)}async removeEntry(e,i){const t=this._entries[e];if(!t)throw new s(...r);await t._destroy(i.recursive),delete this._entries[e]}async _destroy(e){for(let i of Object.values(this._entries)){if(!e)throw new s(...b);await i._destroy(e)}this._entries={},this._deleted=!0}}const u=new h(""),A=()=>u;export{f as FileHandle,h as FolderHandle,g as Sink,A as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{aJ as u,aK as m,g as h}from"./index.
|
1
|
+
import{aJ as u,aK as m,g as h}from"./index.bLZVjplR.js";var e,r;function W(){if(r)return e;r=1;var t=u(),a=m(),i=a(function(s,g,n,o){t(s,g,n,o)});return e=i,e}var c=W();const v=h(c);export{v as m};
|
streamlit/static/static/js/{number-overlay-editor.CaHpEyvW.js → number-overlay-editor.BCo5wJKi.js}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
import{R as X,r as T}from"./index.DeuQX1T6.js";import{s as Te}from"./index.vyj1usur.js";import"./FormClearHelper.Dha_cfuU.js";import"./withFullScreenWrapper.BKBYrOn-.js";import"./Toolbar.B5RomQbU.js";import"./mergeWith.D8F46YVj.js";import"./sprintf.D7DtBTRn.js";import"./createDownloadLinkElement.DZMwyjvU.js";import"./toConsumableArray.DFJurSxu.js";import"./possibleConstructorReturn.CnSJ4CFa.js";import"./createSuper.DiPn7x2M.js";import"./FileDownload.esm.K0RIIaSL.js";const Be=Te("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function Se(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var re;(function(e){e.event="event",e.props="prop"})(re||(re={}));function q(){}function Fe(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(i,l){return i===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function Y(e){return e==null}function _e(e){return typeof e=="number"&&isNaN(e)}function pe(e){return Y(e)||_e(e)||typeof e=="number"&&!isFinite(e)}function xe(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function je(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Le(e,t,r){var n=je(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function Me(e){var t=T.useRef(e);t.current=e;var r=T.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function se(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),i=a[0],l=a[1]||"";return{beforeDecimal:i,afterDecimal:l,hasNegation:r,addNegation:n}}function ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function ye(e,t,r){for(var n="",a=r?"0":"",i=0;i<=t-1;i++)n+=e[i]||a;return n}function de(e,t){return Array(t+1).join(e)}function be(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],i=n[1];if(i=Number(i),!i)return r+a;a=a.replace(".","");var l=1+i,h=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=h?a=a+de("0",l-h):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function ge(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,l=a.afterDecimal,h=a.hasNegation,p=parseFloat("0."+(l||"0")),x=l.length<=t?"0."+l:p.toFixed(t),S=x.split("."),c=i;i&&Number(S[0])&&(c=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},S[0]));var m=ye(S[1]||"",t,r),y=h?"-":"",s=n?".":"";return""+y+c+s+m}function H(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ve=Fe(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[i-1-n]&&i-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,l){l===void 0&&(l=$e);var h=a.findIndex(function(k){return k}),p=e.slice(0,h);!t&&!r.startsWith(p)&&(t=p,r=p+r,n=n+p.length);for(var x=r.length,S=e.length,c={},m=new Array(x),y=0;y<x;y++){m[y]=-1;for(var s=0,I=S;s<I;s++){var C=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:s});if(C&&c[s]!==!0){m[y]=s,c[s]=!0;break}}}for(var g=n;g<x&&(m[g]===-1||!i(r[g]));)g++;var B=g===x||m[g]===-1?S:m[g];for(g=n-1;g>0&&m[g]===-1;)g--;var F=g===-1||m[g]===-1?0:m[g]+1;return F>B?B:n-F<B-n?F:B}function me(e,t,r,n){var a=e.length;if(t=Ke(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function Ne(e,t,r,n,a,i){i===void 0&&(i=q);var l=Me(function(s,I){var C,g;return pe(s)?(g="",C=""):typeof s=="number"||I?(g=typeof s=="number"?be(s):s,C=n(g)):(g=a(s,void 0),C=n(g)),{formattedValue:C,numAsString:g}}),h=T.useState(function(){return l(Y(e)?t:e,r)}),p=h[0],x=h[1],S=function(s,I){s.formattedValue!==p.formattedValue&&x({formattedValue:s.formattedValue,numAsString:s.value}),i(s,I)},c=e,m=r;Y(e)&&(c=p.numAsString,m=!0);var y=l(c,m);return T.useMemo(function(){x(y)},[y.formattedValue]),[p,S]}function qe(e){return e.replace(/[^0-9]/g,"")}function ze(e){return e}function He(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,i=e.getInputRef,l=e.format;l===void 0&&(l=ze);var h=e.removeFormatting;h===void 0&&(h=qe);var p=e.defaultValue,x=e.valueIsNumericString,S=e.onValueChange,c=e.isAllowed,m=e.onChange;m===void 0&&(m=q);var y=e.onKeyDown;y===void 0&&(y=q);var s=e.onMouseUp;s===void 0&&(s=q);var I=e.onFocus;I===void 0&&(I=q);var C=e.onBlur;C===void 0&&(C=q);var g=e.value,B=e.getCaretBoundary;B===void 0&&(B=Ze);var F=e.isValidInputCharacter;F===void 0&&(F=ae);var k=e.isCharacterSame,j=Se(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),z=Ne(g,p,!!x,l,h,S),P=z[0],V=P.formattedValue,L=P.numAsString,W=z[1],M=T.useRef(),U=T.useRef({formattedValue:V,numAsString:L}),$=function(o,u){U.current={formattedValue:o.formattedValue,numAsString:o.value},W(o,u)},J=T.useState(!1),ee=J[0],d=J[1],f=T.useRef(null),N=T.useRef({setCaretTimeout:null,focusTimeout:null});T.useEffect(function(){return d(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var R=l,A=function(o,u){var v=parseFloat(u);return{formattedValue:o,value:u,floatValue:isNaN(v)?void 0:v}},E=function(o,u,v){o.selectionStart===0&&o.selectionEnd===o.value.length||(H(o,u),N.current.setCaretTimeout=setTimeout(function(){o.value===v&&o.selectionStart!==u&&H(o,u)},0))},O=function(o,u,v){return me(o,u,B(o),v)},Q=function(o,u,v){var w=B(u),_=Ge(u,V,o,v,w,F,k);return _=me(u,_,w),_},oe=function(o){var u=o.formattedValue;u===void 0&&(u="");var v=o.input,w=o.source,_=o.event,D=o.numAsString,b;if(v){var K=o.inputValue||v.value,G=ce(v);v.value=u,b=Q(K,u,G),b!==void 0&&E(v,b,u)}u!==V&&$(A(u,D),{event:_,source:w})};T.useEffect(function(){var o=U.current,u=o.formattedValue,v=o.numAsString;(V!==u||L!==v)&&$(A(V,L),{event:void 0,source:re.props})},[V,L]);var te=f.current?ce(f.current):void 0,ne=typeof window<"u"?T.useLayoutEffect:T.useEffect;ne(function(){var o=f.current;if(V!==U.current.formattedValue&&o){var u=Q(U.current.formattedValue,V,te);o.value=V,E(o,u,V)}},[V]);var ue=function(o,u,v){var w=u.target,_=M.current?Pe(M.current,w.selectionEnd):Ve(V,o),D=Object.assign(Object.assign({},_),{lastValue:V}),b=h(o,D),K=R(b);if(b=h(K,void 0),c&&!c(A(K,b))){var G=u.target,Z=ce(G),fe=Q(o,V,Z);return G.value=V,E(G,fe,V),!1}return oe({formattedValue:K,numAsString:b,inputValue:o,event:u,source:v,input:u.target}),!0},le=function(o,u){u===void 0&&(u=0);var v=o.selectionStart,w=o.selectionEnd;M.current={selectionStart:v,selectionEnd:w+u}},De=function(o){var u=o.target,v=u.value,w=ue(v,o,re.event);w&&m(o),M.current=void 0},Ie=function(o){var u=o.target,v=o.key,w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b;v==="ArrowLeft"||v==="Backspace"?b=Math.max(w-1,0):v==="ArrowRight"?b=Math.min(w+1,D.length):v==="Delete"&&(b=w);var K=0;v==="Delete"&&w===_&&(K=1);var G=v==="ArrowLeft"||v==="ArrowRight";if(b===void 0||w!==_&&!G){y(o),le(u,K);return}var Z=b;if(G){var fe=v==="ArrowLeft"?"left":"right";Z=O(D,b,fe),Z!==b&&o.preventDefault()}else v==="Delete"&&!F(D[b])?Z=O(D,b,"right"):v==="Backspace"&&!F(D[b])&&(Z=O(D,b,"left"));Z!==b&&E(u,Z,D),y(o),le(u,K)},Ce=function(o){var u=o.target,v=function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;if(D===void 0&&(D=""),w===_){var b=O(D,w);b!==w&&E(u,b,D)}};v(),requestAnimationFrame(function(){v()}),s(o),le(u)},Ee=function(o){o.persist&&o.persist();var u=o.target,v=o.currentTarget;f.current=u,N.current.focusTimeout=setTimeout(function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b=O(D,w);b!==w&&!(w===0&&_===D.length)&&E(u,b,D),I(Object.assign(Object.assign({},o),{currentTarget:v}))},0)},Re=function(o){f.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(o)},Ae=ee&&We()?"numeric":void 0,ve=Object.assign({inputMode:Ae},j,{type:t,value:V,onChange:De,onKeyDown:Ie,onMouseUp:Ce,onFocus:Ee,onBlur:Re});if(r==="text")return a?X.createElement(X.Fragment,null,a(V,j)||null):X.createElement("span",Object.assign({},j,{ref:i}),V);if(n){var Oe=n;return X.createElement(Oe,Object.assign({},ve,{ref:i}))}return X.createElement("input",Object.assign({},ve,{ref:i}))}function he(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var i=t.suffix;i===void 0&&(i="");var l=t.allowNegative,h=t.thousandsGroupStyle;if(h===void 0&&(h="thousand"),e===""||e==="-")return e;var p=ie(t),x=p.thousandSeparator,S=p.decimalSeparator,c=r!==0&&e.indexOf(".")!==-1||r&&n,m=se(e,l),y=m.beforeDecimal,s=m.afterDecimal,I=m.addNegation;return r!==void 0&&(s=ye(s,r,!!n)),x&&(y=Le(y,x,h)),a&&(y=a+y),i&&(s=s+i),I&&(y="-"+y),e=y+(c&&S||"")+s,e}function ie(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Je(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),i=n.test(e);return e=e.replace(/-/g,""),a&&!i&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+xe(e),"g")}function Xe(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Ye(e,t,r){var n;t===void 0&&(t=Ue(e));var a=r.allowNegative,i=r.prefix;i===void 0&&(i="");var l=r.suffix;l===void 0&&(l="");var h=r.decimalScale,p=t.from,x=t.to,S=x.start,c=x.end,m=ie(r),y=m.allowedDecimalSeparators,s=m.decimalSeparator,I=e[c]===s;if(ae(e)&&(e===i||e===l)&&t.lastValue==="")return e;if(c-S===1&&y.indexOf(e[S])!==-1){var C=h===0?"":s;e=e.substring(0,S)+C+e.substring(S+1,e.length)}var g=function(f,N,R){var A=!1,E=!1;i.startsWith("-")?A=!1:f.startsWith("--")?(A=!1,E=!0):l.startsWith("-")&&f.length===l.length?A=!1:f[0]==="-"&&(A=!0);var O=A?1:0;return E&&(O=2),O&&(f=f.substring(O),N-=O,R-=O),{value:f,start:N,end:R,hasNegation:A}},B=g(e,S,c),F=B.hasNegation;n=B,e=n.value,S=n.start,c=n.end;var k=g(t.lastValue,p.start,p.end),j=k.start,z=k.end,P=k.value,V=e.substring(S,c);e.length&&P.length&&(j>P.length-l.length||z<i.length)&&!(V&&l.startsWith(V))&&(e=P);var L=0;e.startsWith(i)?L+=i.length:S<i.length&&(L=S),e=e.substring(L),c-=L;var W=e.length,M=e.length-l.length;e.endsWith(l)?W=M:(c>M||c>e.length-l.length)&&(W=c),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(s))||[]).join("");var U=e.indexOf(s);e=e.replace(new RegExp(xe(s),"g"),function(f,N){return N===U?".":""});var $=se(e,a),J=$.beforeDecimal,ee=$.afterDecimal,d=$.addNegation;return x.end-x.start<p.end-p.start&&J===""&&I&&!parseFloat(ee)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,r.length+(i?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
|
1
|
+
import{R as X,r as T}from"./index.bLZVjplR.js";import{s as Te}from"./index.B3HJ1joN.js";import"./FormClearHelper.Doa6Lh7Q.js";import"./withFullScreenWrapper.wyYj-oat.js";import"./Toolbar.C714dqzb.js";import"./mergeWith.B34IaY8d.js";import"./sprintf.D7DtBTRn.js";import"./createDownloadLinkElement.DZMwyjvU.js";import"./toConsumableArray.bbNBXf55.js";import"./possibleConstructorReturn.CRrAWWQi.js";import"./createSuper.ViswZ8TH.js";import"./FileDownload.esm.NwWY1bYI.js";const Be=Te("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function Se(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var re;(function(e){e.event="event",e.props="prop"})(re||(re={}));function q(){}function Fe(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(i,l){return i===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function Y(e){return e==null}function _e(e){return typeof e=="number"&&isNaN(e)}function pe(e){return Y(e)||_e(e)||typeof e=="number"&&!isFinite(e)}function xe(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function je(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Le(e,t,r){var n=je(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function Me(e){var t=T.useRef(e);t.current=e;var r=T.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function se(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),i=a[0],l=a[1]||"";return{beforeDecimal:i,afterDecimal:l,hasNegation:r,addNegation:n}}function ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function ye(e,t,r){for(var n="",a=r?"0":"",i=0;i<=t-1;i++)n+=e[i]||a;return n}function de(e,t){return Array(t+1).join(e)}function be(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],i=n[1];if(i=Number(i),!i)return r+a;a=a.replace(".","");var l=1+i,h=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=h?a=a+de("0",l-h):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function ge(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,l=a.afterDecimal,h=a.hasNegation,p=parseFloat("0."+(l||"0")),x=l.length<=t?"0."+l:p.toFixed(t),S=x.split("."),c=i;i&&Number(S[0])&&(c=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},S[0]));var m=ye(S[1]||"",t,r),y=h?"-":"",s=n?".":"";return""+y+c+s+m}function H(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ve=Fe(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[i-1-n]&&i-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,l){l===void 0&&(l=$e);var h=a.findIndex(function(k){return k}),p=e.slice(0,h);!t&&!r.startsWith(p)&&(t=p,r=p+r,n=n+p.length);for(var x=r.length,S=e.length,c={},m=new Array(x),y=0;y<x;y++){m[y]=-1;for(var s=0,I=S;s<I;s++){var C=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:s});if(C&&c[s]!==!0){m[y]=s,c[s]=!0;break}}}for(var g=n;g<x&&(m[g]===-1||!i(r[g]));)g++;var B=g===x||m[g]===-1?S:m[g];for(g=n-1;g>0&&m[g]===-1;)g--;var F=g===-1||m[g]===-1?0:m[g]+1;return F>B?B:n-F<B-n?F:B}function me(e,t,r,n){var a=e.length;if(t=Ke(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function Ne(e,t,r,n,a,i){i===void 0&&(i=q);var l=Me(function(s,I){var C,g;return pe(s)?(g="",C=""):typeof s=="number"||I?(g=typeof s=="number"?be(s):s,C=n(g)):(g=a(s,void 0),C=n(g)),{formattedValue:C,numAsString:g}}),h=T.useState(function(){return l(Y(e)?t:e,r)}),p=h[0],x=h[1],S=function(s,I){s.formattedValue!==p.formattedValue&&x({formattedValue:s.formattedValue,numAsString:s.value}),i(s,I)},c=e,m=r;Y(e)&&(c=p.numAsString,m=!0);var y=l(c,m);return T.useMemo(function(){x(y)},[y.formattedValue]),[p,S]}function qe(e){return e.replace(/[^0-9]/g,"")}function ze(e){return e}function He(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,i=e.getInputRef,l=e.format;l===void 0&&(l=ze);var h=e.removeFormatting;h===void 0&&(h=qe);var p=e.defaultValue,x=e.valueIsNumericString,S=e.onValueChange,c=e.isAllowed,m=e.onChange;m===void 0&&(m=q);var y=e.onKeyDown;y===void 0&&(y=q);var s=e.onMouseUp;s===void 0&&(s=q);var I=e.onFocus;I===void 0&&(I=q);var C=e.onBlur;C===void 0&&(C=q);var g=e.value,B=e.getCaretBoundary;B===void 0&&(B=Ze);var F=e.isValidInputCharacter;F===void 0&&(F=ae);var k=e.isCharacterSame,j=Se(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),z=Ne(g,p,!!x,l,h,S),P=z[0],V=P.formattedValue,L=P.numAsString,W=z[1],M=T.useRef(),U=T.useRef({formattedValue:V,numAsString:L}),$=function(o,u){U.current={formattedValue:o.formattedValue,numAsString:o.value},W(o,u)},J=T.useState(!1),ee=J[0],d=J[1],f=T.useRef(null),N=T.useRef({setCaretTimeout:null,focusTimeout:null});T.useEffect(function(){return d(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var R=l,A=function(o,u){var v=parseFloat(u);return{formattedValue:o,value:u,floatValue:isNaN(v)?void 0:v}},E=function(o,u,v){o.selectionStart===0&&o.selectionEnd===o.value.length||(H(o,u),N.current.setCaretTimeout=setTimeout(function(){o.value===v&&o.selectionStart!==u&&H(o,u)},0))},O=function(o,u,v){return me(o,u,B(o),v)},Q=function(o,u,v){var w=B(u),_=Ge(u,V,o,v,w,F,k);return _=me(u,_,w),_},oe=function(o){var u=o.formattedValue;u===void 0&&(u="");var v=o.input,w=o.source,_=o.event,D=o.numAsString,b;if(v){var K=o.inputValue||v.value,G=ce(v);v.value=u,b=Q(K,u,G),b!==void 0&&E(v,b,u)}u!==V&&$(A(u,D),{event:_,source:w})};T.useEffect(function(){var o=U.current,u=o.formattedValue,v=o.numAsString;(V!==u||L!==v)&&$(A(V,L),{event:void 0,source:re.props})},[V,L]);var te=f.current?ce(f.current):void 0,ne=typeof window<"u"?T.useLayoutEffect:T.useEffect;ne(function(){var o=f.current;if(V!==U.current.formattedValue&&o){var u=Q(U.current.formattedValue,V,te);o.value=V,E(o,u,V)}},[V]);var ue=function(o,u,v){var w=u.target,_=M.current?Pe(M.current,w.selectionEnd):Ve(V,o),D=Object.assign(Object.assign({},_),{lastValue:V}),b=h(o,D),K=R(b);if(b=h(K,void 0),c&&!c(A(K,b))){var G=u.target,Z=ce(G),fe=Q(o,V,Z);return G.value=V,E(G,fe,V),!1}return oe({formattedValue:K,numAsString:b,inputValue:o,event:u,source:v,input:u.target}),!0},le=function(o,u){u===void 0&&(u=0);var v=o.selectionStart,w=o.selectionEnd;M.current={selectionStart:v,selectionEnd:w+u}},De=function(o){var u=o.target,v=u.value,w=ue(v,o,re.event);w&&m(o),M.current=void 0},Ie=function(o){var u=o.target,v=o.key,w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b;v==="ArrowLeft"||v==="Backspace"?b=Math.max(w-1,0):v==="ArrowRight"?b=Math.min(w+1,D.length):v==="Delete"&&(b=w);var K=0;v==="Delete"&&w===_&&(K=1);var G=v==="ArrowLeft"||v==="ArrowRight";if(b===void 0||w!==_&&!G){y(o),le(u,K);return}var Z=b;if(G){var fe=v==="ArrowLeft"?"left":"right";Z=O(D,b,fe),Z!==b&&o.preventDefault()}else v==="Delete"&&!F(D[b])?Z=O(D,b,"right"):v==="Backspace"&&!F(D[b])&&(Z=O(D,b,"left"));Z!==b&&E(u,Z,D),y(o),le(u,K)},Ce=function(o){var u=o.target,v=function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;if(D===void 0&&(D=""),w===_){var b=O(D,w);b!==w&&E(u,b,D)}};v(),requestAnimationFrame(function(){v()}),s(o),le(u)},Ee=function(o){o.persist&&o.persist();var u=o.target,v=o.currentTarget;f.current=u,N.current.focusTimeout=setTimeout(function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b=O(D,w);b!==w&&!(w===0&&_===D.length)&&E(u,b,D),I(Object.assign(Object.assign({},o),{currentTarget:v}))},0)},Re=function(o){f.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(o)},Ae=ee&&We()?"numeric":void 0,ve=Object.assign({inputMode:Ae},j,{type:t,value:V,onChange:De,onKeyDown:Ie,onMouseUp:Ce,onFocus:Ee,onBlur:Re});if(r==="text")return a?X.createElement(X.Fragment,null,a(V,j)||null):X.createElement("span",Object.assign({},j,{ref:i}),V);if(n){var Oe=n;return X.createElement(Oe,Object.assign({},ve,{ref:i}))}return X.createElement("input",Object.assign({},ve,{ref:i}))}function he(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var i=t.suffix;i===void 0&&(i="");var l=t.allowNegative,h=t.thousandsGroupStyle;if(h===void 0&&(h="thousand"),e===""||e==="-")return e;var p=ie(t),x=p.thousandSeparator,S=p.decimalSeparator,c=r!==0&&e.indexOf(".")!==-1||r&&n,m=se(e,l),y=m.beforeDecimal,s=m.afterDecimal,I=m.addNegation;return r!==void 0&&(s=ye(s,r,!!n)),x&&(y=Le(y,x,h)),a&&(y=a+y),i&&(s=s+i),I&&(y="-"+y),e=y+(c&&S||"")+s,e}function ie(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Je(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),i=n.test(e);return e=e.replace(/-/g,""),a&&!i&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+xe(e),"g")}function Xe(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Ye(e,t,r){var n;t===void 0&&(t=Ue(e));var a=r.allowNegative,i=r.prefix;i===void 0&&(i="");var l=r.suffix;l===void 0&&(l="");var h=r.decimalScale,p=t.from,x=t.to,S=x.start,c=x.end,m=ie(r),y=m.allowedDecimalSeparators,s=m.decimalSeparator,I=e[c]===s;if(ae(e)&&(e===i||e===l)&&t.lastValue==="")return e;if(c-S===1&&y.indexOf(e[S])!==-1){var C=h===0?"":s;e=e.substring(0,S)+C+e.substring(S+1,e.length)}var g=function(f,N,R){var A=!1,E=!1;i.startsWith("-")?A=!1:f.startsWith("--")?(A=!1,E=!0):l.startsWith("-")&&f.length===l.length?A=!1:f[0]==="-"&&(A=!0);var O=A?1:0;return E&&(O=2),O&&(f=f.substring(O),N-=O,R-=O),{value:f,start:N,end:R,hasNegation:A}},B=g(e,S,c),F=B.hasNegation;n=B,e=n.value,S=n.start,c=n.end;var k=g(t.lastValue,p.start,p.end),j=k.start,z=k.end,P=k.value,V=e.substring(S,c);e.length&&P.length&&(j>P.length-l.length||z<i.length)&&!(V&&l.startsWith(V))&&(e=P);var L=0;e.startsWith(i)?L+=i.length:S<i.length&&(L=S),e=e.substring(L),c-=L;var W=e.length,M=e.length-l.length;e.endsWith(l)?W=M:(c>M||c>e.length-l.length)&&(W=c),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(s))||[]).join("");var U=e.indexOf(s);e=e.replace(new RegExp(xe(s),"g"),function(f,N){return N===U?".":""});var $=se(e,a),J=$.beforeDecimal,ee=$.afterDecimal,d=$.addNegation;return x.end-x.start<p.end-p.start&&J===""&&I&&!parseFloat(ee)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,r.length+(i?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
|
2
2
|
Decimal separator can't be same as thousand separator.
|
3
3
|
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
4
4
|
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
@@ -1 +1 @@
|
|
1
|
-
import{c2 as u,c3 as c,ar as s,aP as f}from"./index.
|
1
|
+
import{c2 as u,c3 as c,ar as s,aP as f}from"./index.bLZVjplR.js";function n(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=Array(e);r<e;r++)o[r]=t[r];return o}function p(t,e){if(t){if(typeof t=="string")return n(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,u(o.key),o)}}function b(t,e,r){return e&&a(t.prototype,e),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i(t)}function d(t,e){if(e&&(s(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(t)}export{_,b as a,y as b,i as c,d,p as e,n as f};
|
@@ -1 +1 @@
|
|
1
|
-
import{e as l}from"./es6.
|
1
|
+
import{e as l}from"./es6.DNX_sNKu.js";import"./index.bLZVjplR.js";const{DISALLOWED:d}=l;class a{constructor(e,t){this.writer=e,this.fileEntry=t}async write(e){if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.writer.seek(e.position),this.writer.position!==e.position&&(await new Promise((t,i)=>{this.writer.onwriteend=t,this.writer.onerror=i,this.writer.truncate(e.position)}),this.writer.seek(e.position))),!("data"in e))throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. write requires a data argument","SyntaxError");e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.writer.seek(e.position),this.writer.position!==e.position)throw new DOMException("seeking position failed","InvalidStateError");return}else throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. seek requires a position argument","SyntaxError");else if(e.type==="truncate")return new Promise(t=>{if(Number.isInteger(e.size)&&e.size>=0)this.writer.onwriteend=i=>t(),this.writer.truncate(e.size);else throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. truncate requires a size argument","SyntaxError")})}await new Promise((t,i)=>{this.writer.onwriteend=t,this.writer.onerror=i,this.writer.write(new Blob([e]))})}close(){return new Promise(this.fileEntry.file.bind(this.fileEntry))}}class w{constructor(e,t=!0){this.file=e,this.kind="file",this.writable=t,this.readable=!0}get name(){return this.file.name}isSameEntry(e){return this.file.toURL()===e.file.toURL()}getFile(){return new Promise(this.file.file.bind(this.file))}createWritable(e){if(!this.writable)throw new DOMException(...d);return new Promise((t,i)=>this.file.createWriter(r=>{e.keepExistingData===!1?(r.onwriteend=s=>t(new a(r,this.file)),r.truncate(0)):t(new a(r,this.file))},i))}}class n{constructor(e,t=!0){this.dir=e,this.writable=t,this.readable=!0,this.kind="directory",this.name=e.name}isSameEntry(e){return this.dir.fullPath===e.dir.fullPath}async*entries(){const e=this.dir.createReader(),t=await new Promise(e.readEntries.bind(e));for(const i of t)yield[i.name,i.isFile?new w(i,this.writable):new n(i,this.writable)]}getDirectoryHandle(e,t){return new Promise((i,r)=>{this.dir.getDirectory(e,t,s=>{i(new n(s))},r)})}getFileHandle(e,t){return new Promise((i,r)=>this.dir.getFile(e,t,s=>i(new w(s)),r))}async removeEntry(e,t){const i=await this.getDirectoryHandle(e,{create:!1}).catch(r=>r.name==="TypeMismatchError"?this.getFileHandle(e,{create:!1}):r);if(i instanceof Error)throw i;return new Promise((r,s)=>{i instanceof n?t.recursive?i.dir.removeRecursively(()=>r(),s):i.dir.remove(()=>r(),s):i.file&&i.file.remove(()=>r(),s)})}}const p=(o={})=>new Promise((e,t)=>window.webkitRequestFileSystem(o._persistent,0,i=>e(new n(i.root)),t));export{w as FileHandle,n as FolderHandle,p as default};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{bq as v,br as T,bR as j,r as d,cb as x,cc as R}from"./index.
|
1
|
+
import{bq as v,br as T,bR as j,r as d,cb as x,cc as R}from"./index.bLZVjplR.js";import{g as $,a as I,b as A,B as F}from"./base-input.C0t7SpL6.js";function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_(Object(r),!0).forEach(function(n){E(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=v("div",function(e){return s(s({},$(s(s({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})});O.displayName="StyledTextAreaRoot";O.displayName="StyledTextAreaRoot";var m=v("div",function(e){return I(s({$positive:!1},e))});m.displayName="StyledTextareaContainer";m.displayName="StyledTextareaContainer";var g=v("textarea",function(e){return s(s({},A(e)),{},{resize:e.$resize||"none"})});g.displayName="StyledTextarea";g.displayName="StyledTextarea";function b(e){"@babel/helpers - typeof";return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(e)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}function B(e,t){return D(e)||C(e,t)||N(e,t)||z()}function z(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N(e,t){if(e){if(typeof e=="string")return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}}function P(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function C(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,u;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(y){i=!0,u=y}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw u}}return n}}function D(e){if(Array.isArray(e))return e}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t,r){return t&&U(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function M(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},h(e,t)}function H(e){var t=W();return function(){var n=p(e),o;if(t){var i=p(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return L(this,o)}}function L(e,t){if(t&&(b(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},p(e)}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Y=function(e){M(r,e);var t=H(r);function r(){var n;K(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),c(f(n),"state",{isFocused:n.props.autoFocus||!1}),c(f(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),c(f(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return q(r,[{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,a=T(i.Root,O),u=B(a,2),y=u[0],S=u[1],w=j({Input:{component:g},InputContainer:{component:m}},i);return d.createElement(y,l({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},S),d.createElement(F,l({},this.props,{type:R.textarea,overrides:w,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}]),r}(d.Component);c(Y,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:x.default});export{Y as T};
|