@stlite/desktop 0.91.0 → 0.91.1

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/assets/{ErrorOutline.esm-5cmZjQRC-icYL4BM5.js → ErrorOutline.esm-BLjkDUgO-BiXylF9Q.js} +1 -1
  3. package/build/assets/{FileDownload.esm-rDRR6AEq-DjpuiBZc.js → FileDownload.esm-BP6Yw6Mo-BauI2spi.js} +1 -1
  4. package/build/assets/{FileHelper-DDgj8qUb-DZYWXyeE.js → FileHelper-BCkX4r3T-DFMmrw88.js} +1 -1
  5. package/build/assets/{FormClearHelper-Bi1RDDCw-CUfvtGEu.js → FormClearHelper-Dgu5Halt-BxICjxpW.js} +1 -1
  6. package/build/assets/{Hooks-BLb3umpI-D_n25nUE.js → Hooks-BLb3umpI-9FUxV5o-.js} +1 -1
  7. package/build/assets/{InputInstructions-DK4vKQJt-CxHQuxCq.js → InputInstructions-yTnPUqJo-CoOBrVL7.js} +1 -1
  8. package/build/assets/{Particles-CVTDiAXz-DxW9qGxs.js → Particles-Dlshfcc8-CNq_pZlo.js} +1 -1
  9. package/build/assets/{ProgressBar-DBzTytnw-KD3bOGNH.js → ProgressBar-bzD0ionS-CaMxdV67.js} +1 -1
  10. package/build/assets/{Toolbar-C79vGzHM-4gREjS-R.js → Toolbar-Ba82LOXi-C-TMlOex.js} +1 -1
  11. package/build/assets/{base-input-DqwZ6cLM-CfKARdZH.js → base-input-DjjpNP8Y-DtsTHlXD.js} +1 -1
  12. package/build/assets/{checkbox-DSLjv1hz-C5dTTEJn.js → checkbox-i_07yegq-B7N8fYE1.js} +1 -1
  13. package/build/assets/{createSuper-B3kpwht8-vR1ZxlfE.js → createSuper-Bj1hzAgo-DTBN9Cdm.js} +1 -1
  14. package/build/assets/{data-grid-overlay-editor-DlwBF2tR-B5qTFESv.js → data-grid-overlay-editor-BiH9JogL-SwK5dD6O.js} +1 -1
  15. package/build/assets/{downloader-DcCTL3Wz-B8zcxQVm.js → downloader-DcCTL3Wz-szZSaHY-.js} +1 -1
  16. package/build/assets/{es6--XPcqeHG-Ct8fR_QW.js → es6--XPcqeHG-B7r8Rb2B.js} +2 -2
  17. package/build/assets/{iframeResizer.contentWindow-BYeUxEkG-BGHgpKaO.js → iframeResizer.contentWindow-D_iySM1B-C8GQUol2.js} +1 -1
  18. package/build/assets/{index-B77TIzH--_sfHBOLj.js → index-0Kn1AVK2-CFHLqZQv.js} +1 -1
  19. package/build/assets/{index-DJv86VV6-BxF_m0zQ.js → index-B-TfdrsK-M9kXXCZC.js} +1 -1
  20. package/build/assets/{index-CFJPpmiv-DJLEtKZ0.js → index-B-p8cwea-D1OIlg5n.js} +1 -1
  21. package/build/assets/{index-fJZU9fvL-CKGTaTkl.js → index-B3KILbqX-BzOz8wK5.js} +1 -1
  22. package/build/assets/{index-DfmwwL-F-BtkRVq0J.js → index-BB-Jchwk-Bom7C4Yg.js} +1 -1
  23. package/build/assets/{index-p30tlBB--Bny4OpXe.js → index-BPtHoAnG-Bw2wANqW.js} +1 -1
  24. package/build/assets/{index-fUOYudAa-DwvNVa4q.js → index-B_WoYQrI-DzwQulx6.js} +1 -1
  25. package/build/assets/{index-DpgEDPmz-DJh9zWZb.js → index-BhasphER-CtCV9cV8.js} +1 -1
  26. package/build/assets/{index-BFxpMDN6-DR2ES9VX.js → index-Bo7cn_f6-DkJNz7_c.js} +1 -1
  27. package/build/assets/{index-j0zTFwH2-B6bjwCqo.js → index-BxHa0gYF-QN3i1uRA.js} +1 -1
  28. package/build/assets/{index-B7QM9sAr-BJJ9a1xS.js → index-CATwv37T-B7vouX3Y.js} +1 -1
  29. package/build/assets/{index-CQ0SOKgT-K7zOmyHq.js → index-CAzavyuT-BhYS_U-d.js} +1 -1
  30. package/build/assets/{index-xHja9EuR-BJAq-yTR.js → index-CSKWQlNk-CT5sDNrq.js} +1 -1
  31. package/build/assets/{index-DUxsAr3N-YOYvjsWo.js → index-CTwTw5ms-DakzaYYn.js} +1 -1
  32. package/build/assets/{index-CK3GkxeH-D2XBcs5n.js → index-C_q9gQa7-DDnyjQrF.js} +1 -1
  33. package/build/assets/{index-CKLXnSph-0c1m_tEn.js → index-Ct4am237-CcMxDLpd.js} +1 -1
  34. package/build/assets/{index-D6seXbqB-BPSqxK2r.js → index-CugHuPaw-BlbAJDrs.js} +1 -1
  35. package/build/assets/{index-DdN7bQv1-B-kAc3Ut.js → index-CvM3pTat-B8q07d1y.js} +1 -1
  36. package/build/assets/{index-DlIOBmG6-fWsA1K6o.js → index-D0GcWpyX--juTltdu.js} +1 -1
  37. package/build/assets/{index-BUGX2TMK.js → index-D3uELfdo.js} +44 -44
  38. package/build/assets/{index-BV9PPylv-DWAKeZC_.js → index-D5JbiLwX-CJBgVo_3.js} +1 -1
  39. package/build/assets/{index-CqUzXpnq-BkRqyTZ-.js → index-DDqIvyop-CtB9mW2T.js} +1 -1
  40. package/build/assets/{index-BkEF79ga-BDywftDb.js → index-DMjPNVEr-D5adQnea.js} +1 -1
  41. package/build/assets/{index-CZG1F3wS-BFc-W9r-.js → index-DOzur6Jw-BNtjcqTY.js} +1 -1
  42. package/build/assets/{index-BacWTAj2-C6QHLACm.js → index-DU9g9Sd6-Daa3488f.js} +1 -1
  43. package/build/assets/{index-BPsr3GBY-CJGmhZ4p.js → index-DUaAy90Q-XjKFsjy5.js} +1 -1
  44. package/build/assets/{index-0V3zFawH-dk2qSnUj.js → index-DhLLbarZ-JEJ3GjGo.js} +1 -1
  45. package/build/assets/{index-CxQBvv94-C1cgCYzN.js → index-DmB3SAP2-X6jwpSIv.js} +1 -1
  46. package/build/assets/{index-zCpSIFXF-CNWD8XSX.js → index-EaQvJARH-BtsSVy_Q.js} +1 -1
  47. package/build/assets/{index-D--Ibtdf-DP7qoXbQ.js → index-Fts1z9_x-20UUj5MC.js} +1 -1
  48. package/build/assets/{index-DDzvi540-BP83xTE8.js → index-GJmmE3rK-9unNgOON.js} +1 -1
  49. package/build/assets/{index-Cwu3avS4-DiDBV46w.js → index-GLEJ4uEg-Df22L041.js} +16 -16
  50. package/build/assets/{index-BQabGVla-C_9TU-y1.js → index-NlD3wxQH-BRnDRGJG.js} +1 -1
  51. package/build/assets/{index-pBZdYFXV-CISZ02sQ.js → index-X1p_3J78-Vt5ccOoW.js} +1 -1
  52. package/build/assets/index-kYeUTGL3-OTlUcjkG.js +1 -0
  53. package/build/assets/{index-Ng0C2pop-CzH2RCjT.js → index-p-pTZlQx-8zFcur2d.js} +1 -1
  54. package/build/assets/{index-Hwxwzkvz-BrKybKu3.js → index-vYM99bZC-_qzTrUih.js} +1 -1
  55. package/build/assets/{inherits-V2B09WF6-BfQai87E.js → inherits-Rx5YJbse-DVYurFFp.js} +1 -1
  56. package/build/assets/{input-0QG8D109-QEdIPUBc.js → input-BDVeiWWL-DMiIFeVV.js} +1 -1
  57. package/build/assets/{memory-B3L1Fctl-DNNZq00W.js → memory-B3L1Fctl-Bm8c-YGK.js} +1 -1
  58. package/build/assets/{number-overlay-editor-CQf9AWEA-RmKnGQqj.js → number-overlay-editor-BGJ9OD_Z-DIBxtO2v.js} +1 -1
  59. package/build/assets/{sandbox-ChAzL-i--Bt92ucFR.js → sandbox-ChAzL-i--D3ngLCsZ.js} +1 -1
  60. package/build/assets/{slicedToArray-bXF_q2D_-C8JYb8qs.js → slicedToArray-DCtO1hP1-DNgLFFIn.js} +1 -1
  61. package/build/assets/{timepicker-BaiGCRZ1-Sm9ehMNI.js → timepicker-BTEFSiul-BiCu9n-C.js} +1 -1
  62. package/build/assets/{uniqueId-DEZw4fCm-ChV-p6H5.js → uniqueId-DFKpdKNq-BgvPpMK3.js} +1 -1
  63. package/build/assets/{useBasicWidgetState-gAw0WJ0t-BlUmDiku.js → useBasicWidgetState-DqA4I-I_-DtgK63iS.js} +1 -1
  64. package/build/assets/{useTextInputAutoExpand-CrQdinCr-BiEwhNXe.js → useTextInputAutoExpand-Di5cdshf-IDsnD2RC.js} +1 -1
  65. package/build/assets/{useUpdateUiValue-Bz-Z5Int-0QBs3uQx.js → useUpdateUiValue-09I2_X1f-DW6jbCsf.js} +1 -1
  66. package/build/assets/{withFullScreenWrapper-BKnfDWJg-dLKoL1-0.js → withFullScreenWrapper-WW0e_nhm-CAjrnrPK.js} +1 -1
  67. package/build/index.html +1 -1
  68. package/package.json +2 -2
  69. package/wheels/streamlit-1.50.0-cp313-none-any.whl +0 -0
  70. package/build/assets/index-BaDPYxKb-eLNjgO02.js +0 -1
@@ -1 +1 @@
1
- import{r as c,m as W,f as ce,aF as pe,b4 as ue,v as L,b5 as b,j as o,c as g,aR as R,aL as ge,M as he,E as K,_ as X,aK as me,ap as _,aQ as q,ai as Q,aN as fe,aM as xe,N as Y,aO as be,aS as ye}from"./index-BUGX2TMK.js";import{q as ve,A as H,D as Ie,S as je,I as Z,C as we,f as Ce,_ as Fe,P as ze}from"./FileHelper-DDgj8qUb-DZYWXyeE.js";import{e as Ee}from"./InputInstructions-DK4vKQJt-CxHQuxCq.js";import{p as Re,r as Se}from"./useTextInputAutoExpand-CrQdinCr-BiEwhNXe.js";import{r as Te}from"./inputUtils-DCYiajnz-DsrlAoKH.js";import{i as Me}from"./ErrorOutline.esm-5cmZjQRC-icYL4BM5.js";import{t as J}from"./UploadFileInfo-B5SttewO-BfvME59S.js";import"./base-input-DqwZ6cLM-CfKARdZH.js";var G=c.forwardRef(function(e,t){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(K,X({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.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"}))});G.displayName="AttachFile";var ee=c.forwardRef(function(e,t){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(K,X({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),c.createElement("rect",{width:24,height:24,fill:"none"}),c.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"}))});ee.displayName="Send";const te=(e,t)=>t===b.Directory?{...e,webkitdirectory:"",multiple:!0}:e,De=(e,t)=>{if(!t||t.length===0)return!0;const i=e.name.toLowerCase(),a=i.lastIndexOf(".");if(a===-1||a===i.length-1)return t.some(f=>f===""||f===".");const p=i.substring(a),n=i.substring(a+1);return t.some(f=>{const y=f.toLowerCase();return y.startsWith(".")?p===y:n===y})},Le=(e,t)=>De(e,t)?{isValid:!0}:{isValid:!1,errorMessage:`${e.type||"This type of"} files are not allowed.`},oe=e=>{switch(e){case b.None:return"a file";case b.Single:return"a file";case b.Multiple:return"files";case b.Directory:return"a directory";default:return Y(e),"a file"}},Be=g("div",{target:"e3id6jz12"})(({theme:e,height:t})=>({backgroundColor:e.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${e.sizes.emptyDropdownHeight}, ${t})`,width:"100%",zIndex:e.zIndices.priority}),""),Ue=g("div",{target:"e3id6jz11"})(({theme:e,height:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.primary,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,color:e.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:t,width:"100%",fontWeight:e.fontWeights.bold}),""),He=g("div",{target:"e3id6jz10"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${e.sizes.borderWidth}`,cursor:t?"not-allowed":"auto"}),""),We=g("div",{target:"e3id6jz9"})(({disabled:e})=>({pointerEvents:e?"none":"auto"}),""),Pe=g("div",{target:"e3id6jz8"})(({theme:e})=>({marginTop:"0.625em",marginLeft:e.spacing.sm,height:e.spacing.xl,width:e.sizes.borderWidth,backgroundColor:e.colors.fadedText20}),""),Ne=g("div",{target:"e3id6jz7"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,overflowX:"auto"}),""),$e=g("div",{target:"e3id6jz6"})({name:"zjik7",styles:"display:flex"}),ke=g("div",{target:"e3id6jz5"})({name:"ou8xsw",styles:"flex:0 0 auto"}),Ve=g("div",{target:"e3id6jz4"})(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing.sm,gap:e.spacing.twoXS}),""),Ae=g("div",{target:"e3id6jz3"})(({theme:e})=>({color:e.colors.fadedText60}),""),Oe=g("div",{target:"e3id6jz2"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploaded"?e.colors.bodyText:e.colors.fadedText60}),""),Ke=g("div",{target:"e3id6jz1"})(({theme:e})=>({marginRight:e.spacing.md,color:e.colors.fadedText60}),""),Xe=g("small",{target:"e3id6jz0"})(({theme:e})=>({display:"flex",alignItems:"center",maxHeight:e.sizes.smallElementHeight,color:e.colors.fadedText60,"& :hover":{color:e.colors.bodyText}}),""),_e=({getRootProps:e,getInputProps:t,acceptFile:i,disabled:a,theme:p})=>{const n=te(t(),i);return o.jsxs(He,{disabled:a,children:[o.jsxs(We,{"data-testid":"stChatInputFileUploadButton",disabled:a,...e(),children:[o.jsx("input",{...n}),o.jsx(me,{content:`Upload or drag and drop ${oe(i)}`,placement:_.TOP,onMouseEnterDelay:500,children:o.jsx(q,{kind:Q.MINIMAL,disabled:a,children:o.jsx(R,{content:G,size:"lg",color:a?p.colors.fadedText40:p.colors.fadedText60})})})]}),o.jsx(Pe,{})]})},qe=c.memo(_e),Qe=({getRootProps:e,getInputProps:t,acceptFile:i,inputHeight:a})=>{const p=te(t(),i);return o.jsxs(o.Fragment,{children:[o.jsx(Be,{height:a,...e(),children:o.jsx("input",{...p})}),o.jsx(Ue,{height:a,children:`Drag and drop ${oe(i)} here`})]})},Ye=c.memo(Qe);function Ze({children:e,content:t}){const i=W();return o.jsx(ye,{content:t,placement:_.TOP,overrides:{Body:{style:{top:`-${i.sizes.minElementHeight}`}}},children:e})}const Je=({fileInfo:e})=>{const t=W(),{type:i}=e.status;switch(i){case"uploading":return o.jsx(be,{"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o.jsx(Ze,{content:e.status.errorMessage,children:o.jsx(R,{color:t.colors.redTextColor,content:Me,size:"lg"})});case"uploaded":return o.jsx(R,{content:ze,size:"lg"});default:return Y(i),null}},Ge=({fileInfo:e,onDelete:t})=>o.jsxs(Ve,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o.jsx(Ae,{children:o.jsx(Je,{fileInfo:e})}),o.jsx(Oe,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:e.name}),o.jsx(Ke,{children:Ce(e.size,H.Byte)}),o.jsx(Xe,{"data-testid":"stChatInputDeleteBtn",children:o.jsx(q,{onClick:()=>t(e.id),kind:Q.MINIMAL,children:o.jsx(R,{content:Fe,size:"lg"})})})]}),et=c.memo(Ge),tt=({items:e,onDelete:t})=>o.jsx(Ne,{"data-testid":"stChatUploadedFiles",children:o.jsx($e,{children:e.map(i=>o.jsx(ke,{children:o.jsx(et,{fileInfo:i,onDelete:t})},i.id))})}),ot=c.memo(tt),it=(e,t)=>{const i=[],a=[];return e.forEach(p=>{const n=Le(p,t.fileType);n.isValid?i.push(p):a.push({file:p,errors:[{code:Z.FileInvalidType,message:n.errorMessage||"File type not allowed."}]})}),{accepted:i,rejected:a}},rt=({acceptMultipleFiles:e,acceptDirectoryFiles:t,maxFileSize:i,uploadClient:a,uploadFile:p,addFiles:n,getNextLocalFileId:f,deleteExistingFiles:y,onUploadComplete:j,element:v})=>(m,h)=>{if(t&&m.length>0){const{accepted:u,rejected:x}=it(m,v);m=u,h=[...h,...x]}if(!e&&m.length===0&&h.length>1){const u=h.findIndex(x=>x.errors?.[0].code===Z.TooManyFiles);u>=0&&(m.push(h[u].file),h.splice(u,1))}if(!e&&m.length>0&&y(),a.fetchFileURLs(m).then(u=>{ge(u,m).forEach(([x,w])=>{p(x,w)})}).catch(u=>{n(m.map(x=>new J(x.name,x.size,f(),{type:"error",errorMessage:u})))}),h.length>0){const u=h.map(x=>we(x,f(),i));n(u)}j()},st=({getNextLocalFileId:e,addFiles:t,updateFile:i,uploadClient:a,element:p,onUploadProgress:n,onUploadComplete:f})=>(y,j)=>{const v=j.webkitRelativePath||j.name,m=new AbortController,h=new J(v,j.size,e(),{type:"uploading",abortController:m,progress:1});t([h]),a.uploadFile({formId:"",...p},y.uploadUrl,j,u=>n(u,h.id),m.signal).then(()=>f(h.id,y)).catch(u=>{u instanceof DOMException&&u.name==="AbortError"||i(h.id,h.setStatus({type:"error",errorMessage:u?u.toString():"Unknown error"}))})},at=g("div",{target:"e1d2x3se4"})({name:"1nibcdy",styles:"border:none;position:relative;display:flex"}),nt=g("div",{target:"e1d2x3se3"})(({theme:e,extended:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:e.spacing.lg,maxHeight:t?"none":e.sizes.minElementHeight,gap:e.spacing.sm,overflow:"hidden",":focus-within":{borderColor:e.colors.primary}}),""),lt=g("button",{target:"e1d2x3se2"})(({theme:e,disabled:t,extended:i})=>{const a=he(e),[p,n]=a?[e.colors.gray60,e.colors.gray80]:[e.colors.gray80,e.colors.gray40];return{border:"none",backgroundColor:e.colors.transparent,borderTopRightRadius:i?"0":e.radii.chatInput,borderTopLeftRadius:i?e.radii.default:"0",borderBottomRightRadius:e.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.sm,color:t?p:n,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:a?e.colors.gray10:e.colors.gray90},"&:hover":{color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.gray60,cursor:"not-allowed"}}},""),dt=g("div",{target:"e1d2x3se1"})(({theme:e})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${e.sizes.borderWidth}`,pointerEvents:"none"}),""),ct=g("div",{target:"e1d2x3se0"})(({theme:e})=>({position:"absolute",bottom:"0px",right:`calc(${e.iconSizes.xl} + 2 * ${e.spacing.sm} + ${e.spacing.sm})`}),""),B=(e,t,i)=>i.map(a=>a.id===e?t:a),U=(e,t)=>t.find(i=>i.id===e);function pt({disabled:e,element:t,widgetMgr:i,fragmentId:a,uploadClient:p}){const n=W(),{placeholder:f,maxChars:y}=t,j=c.useRef(0),v=c.useRef(null),{width:m,elementRef:h}=ce(),{innerWidth:u,innerHeight:x}=pe(),[w,T]=c.useState(t.default),[F,z]=c.useState([]),[E,M]=c.useState(!1),C=Re({textareaRef:v,dependencies:[f]}),D=c.useMemo(()=>F.some(r=>r.status.type==="uploading")?!1:w!==""||F.length>0,[F,w]),I=ue(t.acceptFile),P=ve(t.maxUploadSizeMb,H.Megabyte,H.Byte),N=c.useCallback(r=>z(l=>[...l,...r]),[]),$=c.useCallback(r=>{z(l=>{const d=U(r,l);return L(d)?l:(d.status.type==="uploading"&&d.status.abortController.abort(),d.status.type==="uploaded"&&d.status.fileUrls.deleteUrl&&p.deleteFile(d.status.fileUrls.deleteUrl),l.filter(s=>s.id!==r))})},[p]),ie=()=>{const r=F.filter(l=>l.status.type==="uploaded").map(l=>{const{name:d,size:s,status:S}=l,{fileId:le,fileUrls:de}=S;return new fe({fileId:le,fileUrls:de,name:d,size:s})});return new xe({uploadedFileInfo:r})},k=()=>j.current++,re=rt({acceptMultipleFiles:I===b.Multiple||I===b.Directory,acceptDirectoryFiles:I===b.Directory,maxFileSize:P,uploadClient:p,uploadFile:st({getNextLocalFileId:k,addFiles:N,updateFile:(r,l)=>{z(d=>B(r,l,d))},uploadClient:p,element:t,onUploadProgress:(r,l)=>{z(d=>{const s=U(l,d);if(L(s)||s.status.type!=="uploading")return d;const S=Math.round(r.loaded*100/r.total);return s.status.progress===S?d:B(l,s.setStatus({type:"uploading",abortController:s.status.abortController,progress:S}),d)})},onUploadComplete:(r,l)=>{z(d=>{const s=U(r,d);return L(s)||s.status.type!=="uploading"?d:B(s.id,s.setStatus({type:"uploaded",fileId:l.fileId,fileUrls:l}),d)})}}),addFiles:N,getNextLocalFileId:k,deleteExistingFiles:()=>F.forEach(r=>$(r.id)),onUploadComplete:()=>{v.current&&v.current.focus()},element:t}),{getRootProps:V,getInputProps:A}=Ie({onDrop:re,multiple:I===b.Multiple||I===b.Directory,accept:je(t.fileType),maxSize:P}),O=()=>{if(v.current&&v.current.focus(),!D||e)return;const r={data:w,fileUploaderState:ie()};i.setChatInputValue(t,r,{fromUi:!0},a),z([]),T(""),C.clearScrollHeight()},se=r=>{const{metaKey:l,ctrlKey:d,shiftKey:s}=r;Te(r)&&!s&&!d&&!l&&(r.preventDefault(),O())},ae=r=>{const{value:l}=r.target;y!==0&&l.length>y||(T(l),C.updateScrollHeight())};c.useEffect(()=>{if(t.setValue){t.setValue=!1;const r=t.value||"";T(r)}},[t]),c.useEffect(()=>{const r=s=>{s.preventDefault(),s.stopPropagation(),!E&&s.dataTransfer?.types.includes("Files")&&M(!0)},l=s=>{s.preventDefault(),s.stopPropagation(),E&&(s.clientX<=0&&s.clientY<=0||s.clientX>=u&&s.clientY>=x)&&M(!1)},d=s=>{s.preventDefault(),s.stopPropagation(),E&&M(!1)};return window.addEventListener("dragover",r),window.addEventListener("drop",d),window.addEventListener("dragleave",l),()=>{window.removeEventListener("dragover",r),window.removeEventListener("drop",d),window.removeEventListener("dragleave",l)}},[E,u,x]);const ne=I!==b.None&&E;return o.jsxs(o.Fragment,{children:[I===b.None?null:o.jsx(ot,{items:[...F],onDelete:$}),o.jsx(at,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:ne?o.jsx(Ye,{getRootProps:V,getInputProps:A,acceptFile:I,inputHeight:C.height}):o.jsxs(nt,{extended:C.isExtended,children:[I===b.None?null:o.jsx(qe,{getRootProps:V,getInputProps:A,acceptFile:I,disabled:e,theme:n}),o.jsx(Se,{inputRef:v,value:w,placeholder:f,onChange:ae,onKeyDown:se,"aria-label":f,disabled:e,rows:1,overrides:{Root:{style:{minHeight:n.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:n.fontWeights.normal,lineHeight:n.lineHeights.inputWidget,"::placeholder":{color:n.colors.fadedText60},height:C.height,maxHeight:C.maxHeight,paddingLeft:n.spacing.none,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm,paddingRight:`calc(${n.iconSizes.xl} + 2 * ${n.spacing.sm} + ${n.spacing.sm})`}}}}),m>n.breakpoints.hideWidgetDetails&&o.jsx(ct,{children:o.jsx(Ee,{dirty:D,value:w,maxLength:y,type:"chat",inForm:!1})}),o.jsx(dt,{children:o.jsx(lt,{onClick:O,disabled:!D||e,extended:C.isExtended,"data-testid":"stChatInputSubmitButton",children:o.jsx(R,{content:ee,size:"xl",color:"inherit"})})})]})})]})}const vt=c.memo(pt);export{vt as default};
1
+ import{r as c,m as W,f as ce,aF as pe,b4 as ue,v as L,b5 as b,j as o,c as g,aR as R,aL as ge,M as he,E as K,_ as X,aK as me,ap as _,aQ as q,ai as Q,aN as fe,aM as xe,N as Y,aO as be,aS as ye}from"./index-D3uELfdo.js";import{q as ve,A as H,D as Ie,S as je,I as Z,C as we,f as Ce,_ as Fe,P as ze}from"./FileHelper-BCkX4r3T-DFMmrw88.js";import{e as Ee}from"./InputInstructions-yTnPUqJo-CoOBrVL7.js";import{p as Re,r as Se}from"./useTextInputAutoExpand-Di5cdshf-IDsnD2RC.js";import{r as Te}from"./inputUtils-DCYiajnz-DsrlAoKH.js";import{i as Me}from"./ErrorOutline.esm-BLjkDUgO-BiXylF9Q.js";import{t as J}from"./UploadFileInfo-B5SttewO-BfvME59S.js";import"./base-input-DjjpNP8Y-DtsTHlXD.js";var G=c.forwardRef(function(e,t){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(K,X({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.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"}))});G.displayName="AttachFile";var ee=c.forwardRef(function(e,t){var i={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(K,X({iconAttrs:i,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),c.createElement("rect",{width:24,height:24,fill:"none"}),c.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"}))});ee.displayName="Send";const te=(e,t)=>t===b.Directory?{...e,webkitdirectory:"",multiple:!0}:e,De=(e,t)=>{if(!t||t.length===0)return!0;const i=e.name.toLowerCase(),a=i.lastIndexOf(".");if(a===-1||a===i.length-1)return t.some(f=>f===""||f===".");const p=i.substring(a),n=i.substring(a+1);return t.some(f=>{const y=f.toLowerCase();return y.startsWith(".")?p===y:n===y})},Le=(e,t)=>De(e,t)?{isValid:!0}:{isValid:!1,errorMessage:`${e.type||"This type of"} files are not allowed.`},oe=e=>{switch(e){case b.None:return"a file";case b.Single:return"a file";case b.Multiple:return"files";case b.Directory:return"a directory";default:return Y(e),"a file"}},Be=g("div",{target:"e3id6jz12"})(({theme:e,height:t})=>({backgroundColor:e.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${e.sizes.emptyDropdownHeight}, ${t})`,width:"100%",zIndex:e.zIndices.priority}),""),Ue=g("div",{target:"e3id6jz11"})(({theme:e,height:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.primary,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,color:e.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:t,width:"100%",fontWeight:e.fontWeights.bold}),""),He=g("div",{target:"e3id6jz10"})(({theme:e,disabled:t})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${e.sizes.borderWidth}`,cursor:t?"not-allowed":"auto"}),""),We=g("div",{target:"e3id6jz9"})(({disabled:e})=>({pointerEvents:e?"none":"auto"}),""),Pe=g("div",{target:"e3id6jz8"})(({theme:e})=>({marginTop:"0.625em",marginLeft:e.spacing.sm,height:e.spacing.xl,width:e.sizes.borderWidth,backgroundColor:e.colors.fadedText20}),""),$e=g("div",{target:"e3id6jz7"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,overflowX:"auto"}),""),Ne=g("div",{target:"e3id6jz6"})({name:"zjik7",styles:"display:flex"}),ke=g("div",{target:"e3id6jz5"})({name:"ou8xsw",styles:"flex:0 0 auto"}),Ve=g("div",{target:"e3id6jz4"})(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing.sm,gap:e.spacing.twoXS}),""),Ae=g("div",{target:"e3id6jz3"})(({theme:e})=>({color:e.colors.fadedText60}),""),Oe=g("div",{target:"e3id6jz2"})(({theme:e,fileStatus:t})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t.type==="uploaded"?e.colors.bodyText:e.colors.fadedText60}),""),Ke=g("div",{target:"e3id6jz1"})(({theme:e})=>({marginRight:e.spacing.md,color:e.colors.fadedText60}),""),Xe=g("small",{target:"e3id6jz0"})(({theme:e})=>({display:"flex",alignItems:"center",maxHeight:e.sizes.smallElementHeight,color:e.colors.fadedText60,"& :hover":{color:e.colors.bodyText}}),""),_e=({getRootProps:e,getInputProps:t,acceptFile:i,disabled:a,theme:p})=>{const n=te(t(),i);return o.jsxs(He,{disabled:a,children:[o.jsxs(We,{"data-testid":"stChatInputFileUploadButton",disabled:a,...e(),children:[o.jsx("input",{...n}),o.jsx(me,{content:`Upload or drag and drop ${oe(i)}`,placement:_.TOP,onMouseEnterDelay:500,children:o.jsx(q,{kind:Q.MINIMAL,disabled:a,children:o.jsx(R,{content:G,size:"lg",color:a?p.colors.fadedText40:p.colors.fadedText60})})})]}),o.jsx(Pe,{})]})},qe=c.memo(_e),Qe=({getRootProps:e,getInputProps:t,acceptFile:i,inputHeight:a})=>{const p=te(t(),i);return o.jsxs(o.Fragment,{children:[o.jsx(Be,{height:a,...e(),children:o.jsx("input",{...p})}),o.jsx(Ue,{height:a,children:`Drag and drop ${oe(i)} here`})]})},Ye=c.memo(Qe);function Ze({children:e,content:t}){const i=W();return o.jsx(ye,{content:t,placement:_.TOP,overrides:{Body:{style:{top:`-${i.sizes.minElementHeight}`}}},children:e})}const Je=({fileInfo:e})=>{const t=W(),{type:i}=e.status;switch(i){case"uploading":return o.jsx(be,{"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o.jsx(Ze,{content:e.status.errorMessage,children:o.jsx(R,{color:t.colors.redTextColor,content:Me,size:"lg"})});case"uploaded":return o.jsx(R,{content:ze,size:"lg"});default:return Y(i),null}},Ge=({fileInfo:e,onDelete:t})=>o.jsxs(Ve,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o.jsx(Ae,{children:o.jsx(Je,{fileInfo:e})}),o.jsx(Oe,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:e.name,fileStatus:e.status,children:e.name}),o.jsx(Ke,{children:Ce(e.size,H.Byte)}),o.jsx(Xe,{"data-testid":"stChatInputDeleteBtn",children:o.jsx(q,{onClick:()=>t(e.id),kind:Q.MINIMAL,children:o.jsx(R,{content:Fe,size:"lg"})})})]}),et=c.memo(Ge),tt=({items:e,onDelete:t})=>o.jsx($e,{"data-testid":"stChatUploadedFiles",children:o.jsx(Ne,{children:e.map(i=>o.jsx(ke,{children:o.jsx(et,{fileInfo:i,onDelete:t})},i.id))})}),ot=c.memo(tt),it=(e,t)=>{const i=[],a=[];return e.forEach(p=>{const n=Le(p,t.fileType);n.isValid?i.push(p):a.push({file:p,errors:[{code:Z.FileInvalidType,message:n.errorMessage||"File type not allowed."}]})}),{accepted:i,rejected:a}},rt=({acceptMultipleFiles:e,acceptDirectoryFiles:t,maxFileSize:i,uploadClient:a,uploadFile:p,addFiles:n,getNextLocalFileId:f,deleteExistingFiles:y,onUploadComplete:j,element:v})=>(m,h)=>{if(t&&m.length>0){const{accepted:u,rejected:x}=it(m,v);m=u,h=[...h,...x]}if(!e&&m.length===0&&h.length>1){const u=h.findIndex(x=>x.errors?.[0].code===Z.TooManyFiles);u>=0&&(m.push(h[u].file),h.splice(u,1))}if(!e&&m.length>0&&y(),a.fetchFileURLs(m).then(u=>{ge(u,m).forEach(([x,w])=>{p(x,w)})}).catch(u=>{n(m.map(x=>new J(x.name,x.size,f(),{type:"error",errorMessage:u})))}),h.length>0){const u=h.map(x=>we(x,f(),i));n(u)}j()},st=({getNextLocalFileId:e,addFiles:t,updateFile:i,uploadClient:a,element:p,onUploadProgress:n,onUploadComplete:f})=>(y,j)=>{const v=j.webkitRelativePath||j.name,m=new AbortController,h=new J(v,j.size,e(),{type:"uploading",abortController:m,progress:1});t([h]),a.uploadFile({formId:"",...p},y.uploadUrl,j,u=>n(u,h.id),m.signal).then(()=>f(h.id,y)).catch(u=>{u instanceof DOMException&&u.name==="AbortError"||i(h.id,h.setStatus({type:"error",errorMessage:u?u.toString():"Unknown error"}))})},at=g("div",{target:"e1d2x3se4"})({name:"1nibcdy",styles:"border:none;position:relative;display:flex"}),nt=g("div",{target:"e1d2x3se3"})(({theme:e,extended:t})=>({border:`${e.sizes.borderWidth} solid`,borderColor:e.colors.widgetBorderColor??e.colors.transparent,borderRadius:e.radii.chatInput,backgroundColor:e.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:e.spacing.lg,maxHeight:t?"none":e.sizes.minElementHeight,gap:e.spacing.sm,overflow:"hidden",":focus-within":{borderColor:e.colors.primary}}),""),lt=g("button",{target:"e1d2x3se2"})(({theme:e,disabled:t,extended:i})=>{const a=he(e),[p,n]=a?[e.colors.gray60,e.colors.gray80]:[e.colors.gray80,e.colors.gray40];return{border:"none",backgroundColor:e.colors.transparent,borderTopRightRadius:i?"0":e.radii.chatInput,borderTopLeftRadius:i?e.radii.default:"0",borderBottomRightRadius:e.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:e.lineHeights.none,margin:e.spacing.none,padding:e.spacing.sm,color:t?p:n,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:a?e.colors.gray10:e.colors.gray90},"&:hover":{color:e.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:e.colors.transparent,borderColor:e.colors.transparent,color:e.colors.gray60,cursor:"not-allowed"}}},""),dt=g("div",{target:"e1d2x3se1"})(({theme:e})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${e.sizes.borderWidth}`,pointerEvents:"none"}),""),ct=g("div",{target:"e1d2x3se0"})(({theme:e})=>({position:"absolute",bottom:"0px",right:`calc(${e.iconSizes.xl} + 2 * ${e.spacing.sm} + ${e.spacing.sm})`}),""),B=(e,t,i)=>i.map(a=>a.id===e?t:a),U=(e,t)=>t.find(i=>i.id===e);function pt({disabled:e,element:t,widgetMgr:i,fragmentId:a,uploadClient:p}){const n=W(),{placeholder:f,maxChars:y}=t,j=c.useRef(0),v=c.useRef(null),{width:m,elementRef:h}=ce(),{innerWidth:u,innerHeight:x}=pe(),[w,T]=c.useState(t.default),[F,z]=c.useState([]),[E,M]=c.useState(!1),C=Re({textareaRef:v,dependencies:[f]}),D=c.useMemo(()=>F.some(r=>r.status.type==="uploading")?!1:w!==""||F.length>0,[F,w]),I=ue(t.acceptFile),P=ve(t.maxUploadSizeMb,H.Megabyte,H.Byte),$=c.useCallback(r=>z(l=>[...l,...r]),[]),N=c.useCallback(r=>{z(l=>{const d=U(r,l);return L(d)?l:(d.status.type==="uploading"&&d.status.abortController.abort(),d.status.type==="uploaded"&&d.status.fileUrls.deleteUrl&&p.deleteFile(d.status.fileUrls.deleteUrl),l.filter(s=>s.id!==r))})},[p]),ie=()=>{const r=F.filter(l=>l.status.type==="uploaded").map(l=>{const{name:d,size:s,status:S}=l,{fileId:le,fileUrls:de}=S;return new fe({fileId:le,fileUrls:de,name:d,size:s})});return new xe({uploadedFileInfo:r})},k=()=>j.current++,re=rt({acceptMultipleFiles:I===b.Multiple||I===b.Directory,acceptDirectoryFiles:I===b.Directory,maxFileSize:P,uploadClient:p,uploadFile:st({getNextLocalFileId:k,addFiles:$,updateFile:(r,l)=>{z(d=>B(r,l,d))},uploadClient:p,element:t,onUploadProgress:(r,l)=>{z(d=>{const s=U(l,d);if(L(s)||s.status.type!=="uploading")return d;const S=Math.round(r.loaded*100/r.total);return s.status.progress===S?d:B(l,s.setStatus({type:"uploading",abortController:s.status.abortController,progress:S}),d)})},onUploadComplete:(r,l)=>{z(d=>{const s=U(r,d);return L(s)||s.status.type!=="uploading"?d:B(s.id,s.setStatus({type:"uploaded",fileId:l.fileId,fileUrls:l}),d)})}}),addFiles:$,getNextLocalFileId:k,deleteExistingFiles:()=>F.forEach(r=>N(r.id)),onUploadComplete:()=>{v.current&&v.current.focus()},element:t}),{getRootProps:V,getInputProps:A}=Ie({onDrop:re,multiple:I===b.Multiple||I===b.Directory,accept:je(t.fileType),maxSize:P}),O=()=>{if(v.current&&v.current.focus(),!D||e)return;const r={data:w,fileUploaderState:ie()};i.setChatInputValue(t,r,{fromUi:!0},a),z([]),T(""),C.clearScrollHeight()},se=r=>{const{metaKey:l,ctrlKey:d,shiftKey:s}=r;Te(r)&&!s&&!d&&!l&&(r.preventDefault(),O())},ae=r=>{const{value:l}=r.target;y!==0&&l.length>y||(T(l),C.updateScrollHeight())};c.useEffect(()=>{if(t.setValue){t.setValue=!1;const r=t.value||"";T(r)}},[t]),c.useEffect(()=>{const r=s=>{s.preventDefault(),s.stopPropagation(),!E&&s.dataTransfer?.types.includes("Files")&&M(!0)},l=s=>{s.preventDefault(),s.stopPropagation(),E&&(s.clientX<=0&&s.clientY<=0||s.clientX>=u&&s.clientY>=x)&&M(!1)},d=s=>{s.preventDefault(),s.stopPropagation(),E&&M(!1)};return window.addEventListener("dragover",r),window.addEventListener("drop",d),window.addEventListener("dragleave",l),()=>{window.removeEventListener("dragover",r),window.removeEventListener("drop",d),window.removeEventListener("dragleave",l)}},[E,u,x]);const ne=I!==b.None&&E;return o.jsxs(o.Fragment,{children:[I===b.None?null:o.jsx(ot,{items:[...F],onDelete:N}),o.jsx(at,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:ne?o.jsx(Ye,{getRootProps:V,getInputProps:A,acceptFile:I,inputHeight:C.height}):o.jsxs(nt,{extended:C.isExtended,children:[I===b.None?null:o.jsx(qe,{getRootProps:V,getInputProps:A,acceptFile:I,disabled:e,theme:n}),o.jsx(Se,{inputRef:v,value:w,placeholder:f,onChange:ae,onKeyDown:se,"aria-label":f,disabled:e,rows:1,overrides:{Root:{style:{minHeight:n.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:n.fontWeights.normal,lineHeight:n.lineHeights.inputWidget,"::placeholder":{color:n.colors.fadedText60},height:C.height,maxHeight:C.maxHeight,paddingLeft:n.spacing.none,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm,paddingRight:`calc(${n.iconSizes.xl} + 2 * ${n.spacing.sm} + ${n.spacing.sm})`}}}}),m>n.breakpoints.hideWidgetDetails&&o.jsx(ct,{children:o.jsx(Ee,{dirty:D,value:w,maxLength:y,type:"chat",inForm:!1})}),o.jsx(dt,{children:o.jsx(lt,{onClick:O,disabled:!D||e,extended:C.isExtended,"data-testid":"stChatInputSubmitButton",children:o.jsx(R,{content:ee,size:"xl",color:"inherit"})})})]})})]})}const vt=c.memo(pt);export{vt as default};
@@ -1 +1 @@
1
- import{a$ as X,r as S,l as q,y as Q,v as P,aN as J,aM as K,j as h,c as b,aI as Y,aJ as Z,b0 as ee,aK as te,ap as _,aR as R,E as O,_ as T,w as re,m as ie,b1 as se,X as oe,ao as ae,b2 as $,b3 as ne,aS as le,aQ as de,ai as ce,aC as ue}from"./index-BUGX2TMK.js";import{t as V}from"./UploadFileInfo-B5SttewO-BfvME59S.js";import{d as he}from"./FormClearHelper-Bi1RDDCw-CUfvtGEu.js";import{q as pe,U as fe}from"./ProgressBar-DBzTytnw-KD3bOGNH.js";var L=S.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(O,T({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:l}),S.createElement("rect",{width:24,height:24,fill:"none"}),S.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});L.displayName="SwitchCamera";var D=S.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(O,T({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},r,{ref:l}),S.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"}))});D.displayName="Video";var A=S.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(O,T({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},r,{ref:l}),S.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"}))});A.displayName="X";function ge(r,l){switch(r){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const H=b("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),k=b("div",{target:"etz5kuj8"})(({theme:r,width:l})=>({backgroundColor:r.colors.secondaryBg,borderRadius:`${r.radii.default} ${r.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),me=b("p",{target:"etz5kuj7"})(({theme:r})=>({marginTop:r.spacing.sm,textAlign:"center"}),""),ve=b("img",{target:"etz5kuj6"})(({theme:r,opacity:l})=>({borderRadius:`${r.radii.default} ${r.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),Se=b("a",{target:"etz5kuj5"})(({theme:r})=>({color:r.colors.link,textDecoration:r.linkUnderline?"underline":"none",display:"block"}),""),ye=b("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),we=b("div",{target:"etz5kuj3"})(({theme:r})=>({position:"absolute",top:r.spacing.lg,right:r.spacing.lg,zIndex:r.zIndices.priority,color:r.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),Me=b("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ue=b("button",{target:"etz5kuj0"})(({theme:r})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:r.colors.lightenedBg05,border:`${r.sizes.borderWidth} solid ${r.colors.borderColor}`,borderRadius:`0 0 ${r.radii.default} ${r.radii.default}`,"&:hover":{borderColor:r.colors.primary,color:r.colors.primary},"&:active":{color:r.colors.white,borderColor:r.colors.primary,backgroundColor:r.colors.primary},"&:focus:not(:active)":{borderColor:r.colors.primary,color:r.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:r.colors.fadedText40,borderColor:r.colors.borderColor,backgroundColor:r.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:r.fontWeights.normal,padding:`${r.spacing.xs} ${r.spacing.md}`,margin:r.spacing.none,lineHeight:r.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${ae(r.colors.primary,.5)}`},...ge("medium",r)}),"");function Ce({disabled:r,onClick:l,children:e,progress:s}){return h.jsxs(Ue,{disabled:r||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[e,s?h.jsx(Me,{children:h.jsx(pe,{value:s,size:fe.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const N=S.memo(Ce);var E=(r=>(r.USER="user",r.ENVIRONMENT="environment",r))(E||{});const xe=({switchFacingMode:r})=>h.jsx(we,{"data-testid":"stCameraInputSwitchButton",children:h.jsx(le,{content:"Switch camera",placement:_.TOP_RIGHT,children:h.jsx(de,{kind:ce.MINIMAL,onClick:r,children:h.jsx(R,{content:L,size:"twoXL",color:$.white})})})}),be=S.memo(xe);var F={exports:{}},Ie=F.exports,z;function je(){return z||(z=1,(function(r,l){(function(e,s){r.exports=s(ue)})(Ie,function(e){return(function(s){var o={};function a(n){if(o[n])return o[n].exports;var p=o[n]={i:n,l:!1,exports:{}};return s[n].call(p.exports,p,p.exports,a),p.l=!0,p.exports}return a.m=s,a.c=o,a.d=function(n,p,y){a.o(n,p)||Object.defineProperty(n,p,{enumerable:!0,get:y})},a.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},a.t=function(n,p){if(p&1&&(n=a(n)),p&8||p&4&&typeof n=="object"&&n&&n.__esModule)return n;var y=Object.create(null);if(a.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:n}),p&2&&typeof n!="string")for(var x in n)a.d(y,x,(function(C){return n[C]}).bind(null,x));return y},a.n=function(n){var p=n&&n.__esModule?(function(){return n.default}):(function(){return n});return a.d(p,"a",p),p},a.o=function(n,p){return Object.prototype.hasOwnProperty.call(n,p)},a.p="",a(a.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(s,o,a){a.r(o);var n=a("react"),p=(function(){var f=function(u,i){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,c){t.__proto__=c}||function(t,c){for(var d in c)c.hasOwnProperty(d)&&(t[d]=c[d])},f(u,i)};return function(u,i){f(u,i);function t(){this.constructor=u}u.prototype=i===null?Object.create(i):(t.prototype=i.prototype,new t)}})(),y=function(){return y=Object.assign||function(f){for(var u,i=1,t=arguments.length;i<t;i++){u=arguments[i];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(f[c]=u[c])}return f},y.apply(this,arguments)},x=function(f,u){var i={};for(var t in f)Object.prototype.hasOwnProperty.call(f,t)&&u.indexOf(t)<0&&(i[t]=f[t]);if(f!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,t=Object.getOwnPropertySymbols(f);c<t.length;c++)u.indexOf(t[c])<0&&Object.prototype.propertyIsEnumerable.call(f,t[c])&&(i[t[c]]=f[t[c]]);return i};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(f){var u=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return u?new Promise(function(i,t){u.call(navigator,f,i,t)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function C(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=(function(f){p(u,f);function u(i){var t=f.call(this,i)||this;return t.canvas=null,t.ctx=null,t.requestUserMediaId=0,t.unmounted=!1,t.state={hasUserMedia:!1},t}return u.prototype.componentDidMount=function(){var i=this,t=i.state,c=i.props;if(this.unmounted=!1,!C()){c.onUserMediaError("getUserMedia not supported");return}t.hasUserMedia||this.requestUserMedia(),c.children&&typeof c.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(i){var t=this.props;if(!C()){t.onUserMediaError("getUserMedia not supported");return}var c=JSON.stringify(i.audioConstraints)!==JSON.stringify(t.audioConstraints),d=JSON.stringify(i.videoConstraints)!==JSON.stringify(t.videoConstraints),M=i.minScreenshotWidth!==t.minScreenshotWidth,v=i.minScreenshotHeight!==t.minScreenshotHeight;(d||M||v)&&(this.canvas=null,this.ctx=null),(c||d)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(i){i&&(i.getVideoTracks&&i.getAudioTracks?(i.getVideoTracks().map(function(t){i.removeTrack(t),t.stop()}),i.getAudioTracks().map(function(t){i.removeTrack(t),t.stop()})):i.stop())},u.prototype.stopAndCleanup=function(){var i=this.state;i.hasUserMedia&&(u.stopMediaStream(this.stream),i.src&&window.URL.revokeObjectURL(i.src))},u.prototype.getScreenshot=function(i){var t=this,c=t.state,d=t.props;if(!c.hasUserMedia)return null;var M=this.getCanvas(i);return M&&M.toDataURL(d.screenshotFormat,d.screenshotQuality)},u.prototype.getCanvas=function(i){var t=this,c=t.state,d=t.props;if(!this.video||!c.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var M=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var m=M/v;M=d.minScreenshotWidth||this.video.clientWidth,v=M/m,d.minScreenshotHeight&&v<d.minScreenshotHeight&&(v=d.minScreenshotHeight,M=v*m)}this.canvas=document.createElement("canvas"),this.canvas.width=i?.width||M,this.canvas.height=i?.height||v,this.ctx=this.canvas.getContext("2d")}var U=this,w=U.ctx,g=U.canvas;return w&&g&&(g.width=i?.width||g.width,g.height=i?.height||g.height,d.mirrored&&(w.translate(g.width,0),w.scale(-1,1)),w.imageSmoothingEnabled=d.imageSmoothing,w.drawImage(this.video,0,0,i?.width||g.width,i?.height||g.height),d.mirrored&&(w.scale(-1,1),w.translate(-g.width,0))),g},u.prototype.requestUserMedia=function(){var i=this,t=this.props,c=function(v,m){var U={video:typeof m<"u"?m:!0};t.audio&&(U.audio=typeof v<"u"?v:!0),i.requestUserMediaId++;var w=i.requestUserMediaId;navigator.mediaDevices.getUserMedia(U).then(function(g){i.unmounted||w!==i.requestUserMediaId?u.stopMediaStream(g):i.handleUserMedia(null,g)}).catch(function(g){i.handleUserMedia(g)})};if("mediaDevices"in navigator)c(t.audioConstraints,t.videoConstraints);else{var d=function(v){return{optional:[{sourceId:v}]}},M=function(v){var m=v.deviceId;return typeof m=="string"?m:Array.isArray(m)&&m.length>0?m[0]:typeof m=="object"&&m.ideal?m.ideal:null};MediaStreamTrack.getSources(function(v){var m=null,U=null;v.forEach(function(j){j.kind==="audio"?m=j.id:j.kind==="video"&&(U=j.id)});var w=M(t.audioConstraints);w&&(m=w);var g=M(t.videoConstraints);g&&(U=g),c(d(m),d(U))})}},u.prototype.handleUserMedia=function(i,t){var c=this.props;if(i||!t){this.setState({hasUserMedia:!1}),c.onUserMediaError(i);return}this.stream=t;try{this.video&&(this.video.srcObject=t),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(t)})}c.onUserMedia(t)},u.prototype.render=function(){var i=this,t=this,c=t.state,d=t.props,M=d.audio;d.forceScreenshotSourceSize;var v=d.disablePictureInPicture;d.onUserMedia,d.onUserMediaError,d.screenshotFormat,d.screenshotQuality,d.minScreenshotWidth,d.minScreenshotHeight,d.audioConstraints,d.videoConstraints,d.imageSmoothing;var m=d.mirrored,U=d.style,w=U===void 0?{}:U,g=d.children,j=x(d,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),W=m?y(y({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,B={getScreenshot:this.getScreenshot.bind(this)};return n.createElement(n.Fragment,null,n.createElement("video",y({autoPlay:!0,disablePictureInPicture:v,src:c.src,muted:!M,playsInline:!0,ref:function(G){i.video=G},style:W},j)),g&&g(B))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u})(n.Component);o.default=I}),react:(function(s,o){s.exports=e})}).default})})(F)),F.exports}var Pe=je();const Ee=oe(Pe),Fe=({width:r})=>h.jsxs(k,{width:r,children:[h.jsx(R,{size:"threeXL",color:$.gray60,content:D}),h.jsxs(me,{children:["This app would like to use your camera.",h.jsx(Se,{href:ne,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Re=({handleCapture:r,width:l,disabled:e,clearPhotoInProgress:s,setClearPhotoInProgress:o,facingMode:a,setFacingMode:n,testOverride:p})=>{const[y,x]=S.useState(p||"pending"),C=S.useRef(null),[I,f]=S.useState(l),u=S.useCallback(re(1e3,f),[]);S.useEffect(()=>{u(l)},[l,u]);function i(){if(C.current!==null){const c=C.current.getScreenshot();r(c)}}const t=ie();return h.jsxs(H,{"data-testid":"stCameraInputWebcamComponent",children:[y!=="success"&&!e&&!s?h.jsx(Fe,{width:I}):se()&&h.jsx(be,{switchFacingMode:n}),h.jsx(k,{"data-testid":"stCameraInputWebcamStyledBox",hidden:y!=="success"&&!e&&!s,width:I,children:!e&&h.jsx(Ee,{audio:!1,ref:C,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${t.radii.default} ${t.radii.default} 0 0`},onUserMediaError:()=>{x("error")},onUserMedia:()=>{x("success"),o(!1)},videoConstraints:{width:{ideal:I},facingMode:a}})}),h.jsx(N,{onClick:i,disabled:y!=="success"||e||s,children:"Take Photo"})]})},Oe=S.memo(Re),Te=150,ke=q.getLogger("CameraInput");class Ve extends S.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new he,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState(e=>({facingMode:e.facingMode===E.USER?E.ENVIRONMENT:E.USER}))},this.handleCapture=e=>{if(e===null)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});const s=o=>new Promise(a=>setTimeout(a,o));return ze(e,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(a=>({file:o,fileUrls:a[0]}))).then(({file:o,fileUrls:a})=>this.uploadFile(a,o)).then(()=>s(Te)).then(()=>{this.setState((o,a)=>({imgSrc:e,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ke.error(o)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(e=>this.deleteFile(e.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:s,widgetMgr:o,fragmentId:a}=this.props,n=o.getFileUploaderStateValue(s);Q(e,n)||o.setFileUploaderStateValue(s,e,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(P(e))return;this.setState({imgSrc:null});const{widgetMgr:s,element:o,fragmentId:a}=this.props;s.setFileUploaderStateValue(o,e,{fromUi:!0},a)})},this.deleteFile=e=>{const s=this.getFile(e);P(s)||(s.status.type==="uploading"&&s.status.abortController.abort(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(s=>({files:[...s.files,e]}))},this.removeFile=e=>{this.setState(s=>({files:s.files.filter(o=>o.id!==e)}))},this.getFile=e=>this.state.files.find(s=>s.id===e),this.updateFile=(e,s)=>{this.setState(o=>({files:o.files.map(a=>a.id===e?s:a)}))},this.onUploadComplete=(e,s)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(e);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(e,s)=>{const o=this.getFile(s);if(P(o)||o.status.type!=="uploading")return;const a=Math.round(e.loaded*100/e.total);o.status.progress!==a&&this.updateFile(s,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,s)=>{const o=new AbortController,a=new V(s.name,s.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,s,n=>this.onUploadProgress(n,a.id),o.signal).then(()=>this.onUploadComplete(a.id,e)).catch(n=>{n instanceof DOMException&&n.name==="AbortError"||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:E.USER},{widgetMgr:e,element:s}=this.props,o=e.getFileUploaderStateValue(s);if(P(o))return l;const{uploadedFileInfo:a}=o;return P(a)||a.length===0?l:{files:a.map(n=>{const p=n.name,y=n.size,x=n.fileId,C=n.fileUrls;return new V(p,y,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:C})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:E.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=e=>e.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:e,widgetMgr:s,fragmentId:o}=this.props;s.getFileUploaderStateValue(e)===void 0&&s.setFileUploaderStateValue(e,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:s,size:o,status:a}=e;return new J({fileId:a.fileId,fileUrls:a.fileUrls,name:s,size:o})});return new K({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:e,disabled:s,width:o}=this.props;return this.formClearHelper.manageFormClearListener(e,l.formId,this.onFormCleared),h.jsxs(H,{className:"stCameraInput","data-testid":"stCameraInput",children:[h.jsx(Y,{label:l.label,disabled:s,labelVisibility:Z(l.labelVisibility?.value),children:l.help&&h.jsx(ee,{children:h.jsx(te,{content:l.help,placement:_.TOP_RIGHT})})}),this.state.imgSrc?h.jsxs(h.Fragment,{children:[h.jsx(k,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h.jsx(ve,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),h.jsx(N,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":h.jsxs(ye,{children:[h.jsx(R,{content:A,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h.jsx(Oe,{handleCapture:this.handleCapture,width:o,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function ze(r,l){return fetch(r).then(e=>e.arrayBuffer()).then(e=>new File([e],l,{type:"image/jpeg"}))}const Ae=X(Ve);export{Ae as default};
1
+ import{a$ as X,r as S,l as q,y as Q,v as P,aN as J,aM as K,j as h,c as b,aI as Y,aJ as Z,b0 as ee,aK as te,ap as _,aR as R,E as O,_ as T,w as re,m as ie,b1 as se,X as oe,ao as ae,b2 as $,b3 as ne,aS as le,aQ as de,ai as ce,aC as ue}from"./index-D3uELfdo.js";import{t as V}from"./UploadFileInfo-B5SttewO-BfvME59S.js";import{d as he}from"./FormClearHelper-Dgu5Halt-BxICjxpW.js";import{q as pe,U as fe}from"./ProgressBar-bzD0ionS-CaMxdV67.js";var L=S.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(O,T({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:l}),S.createElement("rect",{width:24,height:24,fill:"none"}),S.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});L.displayName="SwitchCamera";var D=S.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(O,T({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},r,{ref:l}),S.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"}))});D.displayName="Video";var A=S.forwardRef(function(r,l){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return S.createElement(O,T({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},r,{ref:l}),S.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"}))});A.displayName="X";function ge(r,l){switch(r){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const H=b("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),k=b("div",{target:"etz5kuj8"})(({theme:r,width:l})=>({backgroundColor:r.colors.secondaryBg,borderRadius:`${r.radii.default} ${r.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),me=b("p",{target:"etz5kuj7"})(({theme:r})=>({marginTop:r.spacing.sm,textAlign:"center"}),""),ve=b("img",{target:"etz5kuj6"})(({theme:r,opacity:l})=>({borderRadius:`${r.radii.default} ${r.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),Se=b("a",{target:"etz5kuj5"})(({theme:r})=>({color:r.colors.link,textDecoration:r.linkUnderline?"underline":"none",display:"block"}),""),ye=b("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),we=b("div",{target:"etz5kuj3"})(({theme:r})=>({position:"absolute",top:r.spacing.lg,right:r.spacing.lg,zIndex:r.zIndices.priority,color:r.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),Me=b("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),Ue=b("button",{target:"etz5kuj0"})(({theme:r})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:r.colors.lightenedBg05,border:`${r.sizes.borderWidth} solid ${r.colors.borderColor}`,borderRadius:`0 0 ${r.radii.default} ${r.radii.default}`,"&:hover":{borderColor:r.colors.primary,color:r.colors.primary},"&:active":{color:r.colors.white,borderColor:r.colors.primary,backgroundColor:r.colors.primary},"&:focus:not(:active)":{borderColor:r.colors.primary,color:r.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:r.colors.fadedText40,borderColor:r.colors.borderColor,backgroundColor:r.colors.lightenedBg05,cursor:"not-allowed"},fontWeight:r.fontWeights.normal,padding:`${r.spacing.xs} ${r.spacing.md}`,margin:r.spacing.none,lineHeight:r.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${ae(r.colors.primary,.5)}`},...ge("medium",r)}),"");function Ce({disabled:r,onClick:l,children:e,progress:s}){return h.jsxs(Ue,{disabled:r||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[e,s?h.jsx(Me,{children:h.jsx(pe,{value:s,size:fe.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})}):null]})}const N=S.memo(Ce);var E=(r=>(r.USER="user",r.ENVIRONMENT="environment",r))(E||{});const xe=({switchFacingMode:r})=>h.jsx(we,{"data-testid":"stCameraInputSwitchButton",children:h.jsx(le,{content:"Switch camera",placement:_.TOP_RIGHT,children:h.jsx(de,{kind:ce.MINIMAL,onClick:r,children:h.jsx(R,{content:L,size:"twoXL",color:$.white})})})}),be=S.memo(xe);var F={exports:{}},Ie=F.exports,z;function je(){return z||(z=1,(function(r,l){(function(e,s){r.exports=s(ue)})(Ie,function(e){return(function(s){var o={};function a(n){if(o[n])return o[n].exports;var p=o[n]={i:n,l:!1,exports:{}};return s[n].call(p.exports,p,p.exports,a),p.l=!0,p.exports}return a.m=s,a.c=o,a.d=function(n,p,y){a.o(n,p)||Object.defineProperty(n,p,{enumerable:!0,get:y})},a.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},a.t=function(n,p){if(p&1&&(n=a(n)),p&8||p&4&&typeof n=="object"&&n&&n.__esModule)return n;var y=Object.create(null);if(a.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:n}),p&2&&typeof n!="string")for(var x in n)a.d(y,x,(function(C){return n[C]}).bind(null,x));return y},a.n=function(n){var p=n&&n.__esModule?(function(){return n.default}):(function(){return n});return a.d(p,"a",p),p},a.o=function(n,p){return Object.prototype.hasOwnProperty.call(n,p)},a.p="",a(a.s="./src/react-webcam.tsx")})({"./src/react-webcam.tsx":(function(s,o,a){a.r(o);var n=a("react"),p=(function(){var f=function(u,i){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,c){t.__proto__=c}||function(t,c){for(var d in c)c.hasOwnProperty(d)&&(t[d]=c[d])},f(u,i)};return function(u,i){f(u,i);function t(){this.constructor=u}u.prototype=i===null?Object.create(i):(t.prototype=i.prototype,new t)}})(),y=function(){return y=Object.assign||function(f){for(var u,i=1,t=arguments.length;i<t;i++){u=arguments[i];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(f[c]=u[c])}return f},y.apply(this,arguments)},x=function(f,u){var i={};for(var t in f)Object.prototype.hasOwnProperty.call(f,t)&&u.indexOf(t)<0&&(i[t]=f[t]);if(f!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,t=Object.getOwnPropertySymbols(f);c<t.length;c++)u.indexOf(t[c])<0&&Object.prototype.propertyIsEnumerable.call(f,t[c])&&(i[t[c]]=f[t[c]]);return i};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(f){var u=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return u?new Promise(function(i,t){u.call(navigator,f,i,t)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function C(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var I=(function(f){p(u,f);function u(i){var t=f.call(this,i)||this;return t.canvas=null,t.ctx=null,t.requestUserMediaId=0,t.unmounted=!1,t.state={hasUserMedia:!1},t}return u.prototype.componentDidMount=function(){var i=this,t=i.state,c=i.props;if(this.unmounted=!1,!C()){c.onUserMediaError("getUserMedia not supported");return}t.hasUserMedia||this.requestUserMedia(),c.children&&typeof c.children!="function"&&console.warn("children must be a function")},u.prototype.componentDidUpdate=function(i){var t=this.props;if(!C()){t.onUserMediaError("getUserMedia not supported");return}var c=JSON.stringify(i.audioConstraints)!==JSON.stringify(t.audioConstraints),d=JSON.stringify(i.videoConstraints)!==JSON.stringify(t.videoConstraints),M=i.minScreenshotWidth!==t.minScreenshotWidth,v=i.minScreenshotHeight!==t.minScreenshotHeight;(d||M||v)&&(this.canvas=null,this.ctx=null),(c||d)&&(this.stopAndCleanup(),this.requestUserMedia())},u.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},u.stopMediaStream=function(i){i&&(i.getVideoTracks&&i.getAudioTracks?(i.getVideoTracks().map(function(t){i.removeTrack(t),t.stop()}),i.getAudioTracks().map(function(t){i.removeTrack(t),t.stop()})):i.stop())},u.prototype.stopAndCleanup=function(){var i=this.state;i.hasUserMedia&&(u.stopMediaStream(this.stream),i.src&&window.URL.revokeObjectURL(i.src))},u.prototype.getScreenshot=function(i){var t=this,c=t.state,d=t.props;if(!c.hasUserMedia)return null;var M=this.getCanvas(i);return M&&M.toDataURL(d.screenshotFormat,d.screenshotQuality)},u.prototype.getCanvas=function(i){var t=this,c=t.state,d=t.props;if(!this.video||!c.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var M=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var m=M/v;M=d.minScreenshotWidth||this.video.clientWidth,v=M/m,d.minScreenshotHeight&&v<d.minScreenshotHeight&&(v=d.minScreenshotHeight,M=v*m)}this.canvas=document.createElement("canvas"),this.canvas.width=i?.width||M,this.canvas.height=i?.height||v,this.ctx=this.canvas.getContext("2d")}var U=this,w=U.ctx,g=U.canvas;return w&&g&&(g.width=i?.width||g.width,g.height=i?.height||g.height,d.mirrored&&(w.translate(g.width,0),w.scale(-1,1)),w.imageSmoothingEnabled=d.imageSmoothing,w.drawImage(this.video,0,0,i?.width||g.width,i?.height||g.height),d.mirrored&&(w.scale(-1,1),w.translate(-g.width,0))),g},u.prototype.requestUserMedia=function(){var i=this,t=this.props,c=function(v,m){var U={video:typeof m<"u"?m:!0};t.audio&&(U.audio=typeof v<"u"?v:!0),i.requestUserMediaId++;var w=i.requestUserMediaId;navigator.mediaDevices.getUserMedia(U).then(function(g){i.unmounted||w!==i.requestUserMediaId?u.stopMediaStream(g):i.handleUserMedia(null,g)}).catch(function(g){i.handleUserMedia(g)})};if("mediaDevices"in navigator)c(t.audioConstraints,t.videoConstraints);else{var d=function(v){return{optional:[{sourceId:v}]}},M=function(v){var m=v.deviceId;return typeof m=="string"?m:Array.isArray(m)&&m.length>0?m[0]:typeof m=="object"&&m.ideal?m.ideal:null};MediaStreamTrack.getSources(function(v){var m=null,U=null;v.forEach(function(j){j.kind==="audio"?m=j.id:j.kind==="video"&&(U=j.id)});var w=M(t.audioConstraints);w&&(m=w);var g=M(t.videoConstraints);g&&(U=g),c(d(m),d(U))})}},u.prototype.handleUserMedia=function(i,t){var c=this.props;if(i||!t){this.setState({hasUserMedia:!1}),c.onUserMediaError(i);return}this.stream=t;try{this.video&&(this.video.srcObject=t),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(t)})}c.onUserMedia(t)},u.prototype.render=function(){var i=this,t=this,c=t.state,d=t.props,M=d.audio;d.forceScreenshotSourceSize;var v=d.disablePictureInPicture;d.onUserMedia,d.onUserMediaError,d.screenshotFormat,d.screenshotQuality,d.minScreenshotWidth,d.minScreenshotHeight,d.audioConstraints,d.videoConstraints,d.imageSmoothing;var m=d.mirrored,U=d.style,w=U===void 0?{}:U,g=d.children,j=x(d,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),W=m?y(y({},w),{transform:(w.transform||"")+" scaleX(-1)"}):w,B={getScreenshot:this.getScreenshot.bind(this)};return n.createElement(n.Fragment,null,n.createElement("video",y({autoPlay:!0,disablePictureInPicture:v,src:c.src,muted:!M,playsInline:!0,ref:function(G){i.video=G},style:W},j)),g&&g(B))},u.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},u})(n.Component);o.default=I}),react:(function(s,o){s.exports=e})}).default})})(F)),F.exports}var Pe=je();const Ee=oe(Pe),Fe=({width:r})=>h.jsxs(k,{width:r,children:[h.jsx(R,{size:"threeXL",color:$.gray60,content:D}),h.jsxs(me,{children:["This app would like to use your camera.",h.jsx(Se,{href:ne,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),Re=({handleCapture:r,width:l,disabled:e,clearPhotoInProgress:s,setClearPhotoInProgress:o,facingMode:a,setFacingMode:n,testOverride:p})=>{const[y,x]=S.useState(p||"pending"),C=S.useRef(null),[I,f]=S.useState(l),u=S.useCallback(re(1e3,f),[]);S.useEffect(()=>{u(l)},[l,u]);function i(){if(C.current!==null){const c=C.current.getScreenshot();r(c)}}const t=ie();return h.jsxs(H,{"data-testid":"stCameraInputWebcamComponent",children:[y!=="success"&&!e&&!s?h.jsx(Fe,{width:I}):se()&&h.jsx(be,{switchFacingMode:n}),h.jsx(k,{"data-testid":"stCameraInputWebcamStyledBox",hidden:y!=="success"&&!e&&!s,width:I,children:!e&&h.jsx(Ee,{audio:!1,ref:C,screenshotFormat:"image/jpeg",screenshotQuality:1,width:I,height:I*9/16,style:{borderRadius:`${t.radii.default} ${t.radii.default} 0 0`},onUserMediaError:()=>{x("error")},onUserMedia:()=>{x("success"),o(!1)},videoConstraints:{width:{ideal:I},facingMode:a}})}),h.jsx(N,{onClick:i,disabled:y!=="success"||e||s,children:"Take Photo"})]})},Oe=S.memo(Re),Te=150,ke=q.getLogger("CameraInput");class Ve extends S.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new he,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=e=>{this.setState({clearPhotoInProgress:e})},this.setFacingMode=()=>{this.setState(e=>({facingMode:e.facingMode===E.USER?E.ENVIRONMENT:E.USER}))},this.handleCapture=e=>{if(e===null)return Promise.resolve();this.setState({imgSrc:e,shutter:!0,minShutterEffectPassed:!1});const s=o=>new Promise(a=>setTimeout(a,o));return ze(e,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(o=>this.props.uploadClient.fetchFileURLs([o]).then(a=>({file:o,fileUrls:a[0]}))).then(({file:o,fileUrls:a})=>this.uploadFile(a,o)).then(()=>s(Te)).then(()=>{this.setState((o,a)=>({imgSrc:e,shutter:o.shutter,minShutterEffectPassed:!0}))}).catch(o=>{ke.error(o)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(e=>this.deleteFile(e.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:s,widgetMgr:o,fragmentId:a}=this.props,n=o.getFileUploaderStateValue(s);Q(e,n)||o.setFileUploaderStateValue(s,e,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(P(e))return;this.setState({imgSrc:null});const{widgetMgr:s,element:o,fragmentId:a}=this.props;s.setFileUploaderStateValue(o,e,{fromUi:!0},a)})},this.deleteFile=e=>{const s=this.getFile(e);P(s)||(s.status.type==="uploading"&&s.status.abortController.abort(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(s=>({files:[...s.files,e]}))},this.removeFile=e=>{this.setState(s=>({files:s.files.filter(o=>o.id!==e)}))},this.getFile=e=>this.state.files.find(s=>s.id===e),this.updateFile=(e,s)=>{this.setState(o=>({files:o.files.map(a=>a.id===e?s:a)}))},this.onUploadComplete=(e,s)=>{this.setState(()=>({shutter:!1}));const o=this.getFile(e);P(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(e,s)=>{const o=this.getFile(s);if(P(o)||o.status.type!=="uploading")return;const a=Math.round(e.loaded*100/e.total);o.status.progress!==a&&this.updateFile(s,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(e,s)=>{const o=new AbortController,a=new V(s.name,s.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,s,n=>this.onUploadProgress(n,a.id),o.signal).then(()=>this.onUploadComplete(a.id,e)).catch(n=>{n instanceof DOMException&&n.name==="AbortError"||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:n?n.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:E.USER},{widgetMgr:e,element:s}=this.props,o=e.getFileUploaderStateValue(s);if(P(o))return l;const{uploadedFileInfo:a}=o;return P(a)||a.length===0?l:{files:a.map(n=>{const p=n.name,y=n.size,x=n.fileId,C=n.fileUrls;return new V(p,y,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:C})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:E.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=e=>e.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:e,widgetMgr:s,fragmentId:o}=this.props;s.getFileUploaderStateValue(e)===void 0&&s.setFileUploaderStateValue(e,l,{fromUi:!1},o)}createWidgetValue(){const l=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:s,size:o,status:a}=e;return new J({fileId:a.fileId,fileUrls:a.fileUrls,name:s,size:o})});return new K({uploadedFileInfo:l})}render(){const{element:l,widgetMgr:e,disabled:s,width:o}=this.props;return this.formClearHelper.manageFormClearListener(e,l.formId,this.onFormCleared),h.jsxs(H,{className:"stCameraInput","data-testid":"stCameraInput",children:[h.jsx(Y,{label:l.label,disabled:s,labelVisibility:Z(l.labelVisibility?.value),children:l.help&&h.jsx(ee,{children:h.jsx(te,{content:l.help,placement:_.TOP_RIGHT})})}),this.state.imgSrc?h.jsxs(h.Fragment,{children:[h.jsx(k,{width:o,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&h.jsx(ve,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:o,height:o*9/16})}),h.jsx(N,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":h.jsxs(ye,{children:[h.jsx(R,{content:A,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):h.jsx(Oe,{handleCapture:this.handleCapture,width:o,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function ze(r,l){return fetch(r).then(e=>e.arrayBuffer()).then(e=>new File([e],l,{type:"image/jpeg"}))}const Ae=X(Ve);export{Ae as default};
@@ -0,0 +1 @@
1
+ import{r as c,L as A,ai as h,j as u,ak as C,aQ as E,al as R,am as T,a_ as B}from"./index-D3uELfdo.js";import{a as v}from"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";const L=/%([0-9A-Fa-f]{2})/g,$=/[^\x20-\x7e\xa0-\xff]/g,k=/\\([\u0000-\u007f])/g,w=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,z=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,I=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/,U=r=>String(r).replace($,"?");class j{constructor(e,t){this.type=e,this.parameters=t}}const D=(r,e)=>String.fromCharCode(Number.parseInt(e,16));function Z(r){const e=z.exec(r);if(!e)throw new TypeError("invalid extended field value");const t=e[1].toLowerCase(),a=e[2];let n;switch(t){case"iso-8859-1":n=U(a.replace(L,D));break;case"utf-8":try{n=decodeURIComponent(a)}catch{throw new TypeError("invalid encoded utf-8")}break;default:throw new TypeError("unsupported charset in extended field")}return n}function S(r){let e=I.exec(r);if(!e)throw new TypeError("invalid type format");let t=e[0].length;const a=e[1].toLowerCase();let n;const l=[],i={};let o;for(t=w.lastIndex=e[0].slice(-1)===";"?t-1:t;e=w.exec(r);){if(e.index!==t)throw new TypeError("invalid parameter format");if(t+=e[0].length,n=e[1].toLowerCase(),o=e[2],l.indexOf(n)!==-1)throw new TypeError("invalid duplicate parameter");if(l.push(n),n.indexOf("*")+1===n.length){n=n.slice(0,-1),o=Z(o),i[n]=o;continue}typeof i[n]!="string"&&(o[0]==='"'&&(o=o.slice(1,o.length-1).replace(k,"$1")),i[n]=o)}if(t!==-1&&t!==r.length)throw new TypeError("invalid parameter format");return new j(a,i)}function _(r){const e=S(r);if(e.type!=="attachment")return;const t=e.parameters.filename;if(typeof t=="string")return t}function N(r,e){return r.sendHttpRequest({method:"GET",path:`${e}?title=${encodeURIComponent(document.title)}`,headers:{},body:""}).then(({statusCode:t,headers:a,body:n})=>{if(t!==200)return;const l=a.get("Content-Disposition"),i=(l&&_(l))??"",o=a.get("Content-Type"),f=new Blob([n],o?{type:o}:void 0),d=URL.createObjectURL(f),s=document.createElement("a");s.setAttribute("href",d),s.setAttribute("target","_blank"),s.setAttribute("download",i),s.click(),URL.revokeObjectURL(d),s.remove()})}function O(){const r=B();return c.useCallback(e=>N(r,e),[r])}function M(r){const{disabled:e,element:t,widgetMgr:a,endpoints:n,fragmentId:l}=r,{help:i,label:o,icon:f,ignoreRerun:d,type:s,url:m}=t,{libConfig:{enforceDownloadInNewTab:b=!1}}=c.useContext(A);let p=h.SECONDARY;s==="primary"?p=h.PRIMARY:s==="tertiary"&&(p=h.TERTIARY);const x=c.useMemo(()=>n.buildDownloadUrl(m),[n,m]);c.useEffect(()=>{n.checkSourceUrlResponse(x,"Download Button")},[x,n]);const g=O(),y=()=>{if(d||a.setTriggerValue(t,{fromUi:!0},l),t.url.startsWith("/media")){g(t.url);return}v({filename:"",url:x,enforceDownloadInNewTab:b}).click()};return u.jsx("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:u.jsx(C,{help:i,containerWidth:!0,children:u.jsx(E,{kind:p,size:R.SMALL,disabled:e,onClick:y,containerWidth:!0,children:u.jsx(T,{icon:f,label:o})})})})}const Y=c.memo(M);export{Y as default};
@@ -1 +1 @@
1
- import{r as p,m as k,M as T,j as n,b6 as y,b7 as C,aJ as S,H as $,aV as L,aK as w,ap as R,ao as W,b8 as B}from"./index-BUGX2TMK.js";import{S as v}from"./useBasicWidgetState-gAw0WJ0t-BlUmDiku.js";import{v as H,y as M,T as u}from"./checkbox-DSLjv1hz-C5dTTEJn.js";import"./FormClearHelper-Bi1RDDCw-CUfvtGEu.js";function V({element:e,disabled:a,widgetMgr:s,fragmentId:c}){const[f,g]=v({getStateFromWidgetMgr:j,getDefaultStateFromProto:X,getCurrStateFromProto:I,updateWidgetMgrState:P,element:e,widgetMgr:s,fragmentId:c}),x=p.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=k(),{colors:o,spacing:h,sizes:r}=t,b=T(t),m=a?o.fadedText40:o.bodyText;return n.jsx(y,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n.jsx(H,{checked:f,disabled:a,onChange:x,"aria-label":e.label,checkmarkType:e.type===B.StyleType.TOGGLE?u.toggle:u.default,labelPlacement:M.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let d=b?o.bgColor:o.bodyText;return a&&(d=b?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:d,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:d})=>{let l=o.fadedText40;return d&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:d})=>{const l=d&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&d?`0 0 0 0.2rem ${W(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:m}}},children:n.jsxs(C,{visibility:S(e.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[n.jsx($,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&n.jsx(L,{color:m,children:n.jsx(w,{content:e.help,placement:R.TOP_RIGHT})})]})})})}function j(e,a){return e.getBoolValue(a)}function X(e){return e.default??null}function I(e){return e.value??null}function P(e,a,s,c){a.setBoolValue(e,s.value,{fromUi:s.fromUi},c)}const U=p.memo(V);export{U as default};
1
+ import{r as p,m as k,M as T,j as n,b6 as y,b7 as C,aJ as S,H as $,aV as L,aK as w,ap as R,ao as W,b8 as B}from"./index-D3uELfdo.js";import{S as v}from"./useBasicWidgetState-DqA4I-I_-DtgK63iS.js";import{v as H,y as M,T as u}from"./checkbox-i_07yegq-B7N8fYE1.js";import"./FormClearHelper-Dgu5Halt-BxICjxpW.js";function V({element:e,disabled:a,widgetMgr:s,fragmentId:c}){const[f,g]=v({getStateFromWidgetMgr:j,getDefaultStateFromProto:X,getCurrStateFromProto:I,updateWidgetMgrState:P,element:e,widgetMgr:s,fragmentId:c}),x=p.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=k(),{colors:o,spacing:h,sizes:r}=t,b=T(t),m=a?o.fadedText40:o.bodyText;return n.jsx(y,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n.jsx(H,{checked:f,disabled:a,onChange:x,"aria-label":e.label,checkmarkType:e.type===B.StyleType.TOGGLE?u.toggle:u.default,labelPlacement:M.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let d=b?o.bgColor:o.bodyText;return a&&(d=b?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:d,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:d})=>{let l=o.fadedText40;return d&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:d})=>{const l=d&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&d?`0 0 0 0.2rem ${W(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:m}}},children:n.jsxs(C,{visibility:S(e.labelVisibility?.value),"data-testid":"stWidgetLabel",children:[n.jsx($,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&n.jsx(L,{color:m,children:n.jsx(w,{content:e.help,placement:R.TOP_RIGHT})})]})})})}function j(e,a){return e.getBoolValue(a)}function X(e){return e.default??null}function I(e){return e.value??null}function P(e,a,s,c){a.setBoolValue(e,s.value,{fromUi:s.fromUi},c)}const U=p.memo(V);export{U as default};
@@ -1,3 +1,3 @@
1
- import{r as u,j as m,aJ as ge,m as ye,aI as ve,aV as we,aK as Oe,ap as Re,H as re,aB as oe,bA as ne,aX as R,b9 as ke,aY as w}from"./index-BUGX2TMK.js";import{S as je}from"./useBasicWidgetState-gAw0WJ0t-BlUmDiku.js";import"./FormClearHelper-Bi1RDDCw-CUfvtGEu.js";var ie={vertical:"vertical",horizontal:"horizontal"};function ae(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),o.push.apply(o,r)}return o}function A(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(o),!0).forEach(function(r){O(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ae(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function O(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var x=0,E=1,I=2;function B(e){return e.$isActive?I:e.$isHovered?E:x}function Se(e){var t=e.$theme.colors,o=e.$disabled,r=e.$checked,n=e.$isFocusVisible,i=e.$error;if(o)return t.tickFillDisabled;if(r)if(i)switch(B(e)){case x:return t.tickFillErrorSelected;case E:return t.tickFillErrorSelectedHover;case I:return t.tickFillErrorSelectedHoverActive}else switch(B(e)){case x:return t.tickFillSelected;case E:return t.tickFillSelectedHover;case I:return t.tickFillSelectedHoverActive}else return n?t.borderSelected:i?t.tickBorderError:t.tickBorder;return null}function Me(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(B(e)){case x:return t.tickFillError;case E:return t.tickFillErrorHover;case I:return t.tickFillErrorHoverActive}else switch(B(e)){case x:return t.tickFill;case E:return t.tickFillHover;case I:return t.tickFillActive}}function $e(e){var t=e.$labelPlacement,o=t===void 0?"":t,r=e.$theme,n;switch(o){case"top":n="Bottom";break;case"bottom":n="Top";break;case"left":n=r.direction==="rtl"?"Left":"Right";break;default:case"right":n=r.direction==="rtl"?"Right":"Left";break}var i=r.sizing,a=i.scale300;return O({},"padding".concat(n),a)}function Fe(e){var t=e.$disabled,o=e.$theme,r=o.colors;return t?r.contentSecondary:r.contentPrimary}var W=R("div",function(e){var t=e.$disabled,o=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:o==="horizontal"?"row":"column",alignItems:o==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});W.displayName="RadioGroupRoot";W.displayName="RadioGroupRoot";var X=R("label",function(e){var t,o=e.$disabled,r=e.$hasDescription,n=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,c=a==="horizontal",d=i.direction==="rtl"?"Left":"Right";return t={flexDirection:n==="top"||n==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:o?"not-allowed":"pointer",marginTop:s.scale200},O(t,"margin".concat(d),c?s.scale200:null),O(t,"marginBottom",r&&!c?null:s.scale200),t});X.displayName="Root";X.displayName="Root";var J=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{backgroundColor:Me(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});J.displayName="RadioMarkInner";J.displayName="RadioMarkInner";var K=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:Se(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve}});K.displayName="RadioMarkOuter";K.displayName="RadioMarkOuter";var Y=R("div",function(e){var t=e.$theme.typography;return A(A({verticalAlign:"middle"},$e(e)),{},{color:Fe(e)},t.LabelMedium)});Y.displayName="Label";Y.displayName="Label";var Q=R("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});Q.displayName="Input";Q.displayName="Input";var Z=R("div",function(e){var t,o=e.$theme,r=e.$align,n=r==="horizontal",i=o.direction==="rtl"?"Right":"Left",a=o.direction==="rtl"?"Left":"Right";return A(A({},o.typography.ParagraphSmall),{},(t={color:o.colors.contentSecondary,cursor:"auto"},O(t,"margin".concat(i),r==="horizontal"?null:o.sizing.scale900),O(t,"margin".concat(a),n?o.sizing.scale200:null),O(t,"maxWidth","240px"),t))});Z.displayName="Description";Z.displayName="Description";function N(e){"@babel/helpers - typeof";return N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(e)}function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},_.apply(this,arguments)}function Pe(e,t){return Le(e)||Ie(e,t)||Ee(e,t)||xe()}function xe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as u,j as m,aJ as ge,m as ye,aI as ve,aV as we,aK as Oe,ap as Re,H as re,aB as oe,bA as ne,aX as R,b9 as ke,aY as w}from"./index-D3uELfdo.js";import{S as je}from"./useBasicWidgetState-DqA4I-I_-DtgK63iS.js";import"./FormClearHelper-Dgu5Halt-BxICjxpW.js";var ie={vertical:"vertical",horizontal:"horizontal"};function ae(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),o.push.apply(o,r)}return o}function A(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(o),!0).forEach(function(r){O(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ae(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function O(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var x=0,E=1,I=2;function B(e){return e.$isActive?I:e.$isHovered?E:x}function Se(e){var t=e.$theme.colors,o=e.$disabled,r=e.$checked,n=e.$isFocusVisible,i=e.$error;if(o)return t.tickFillDisabled;if(r)if(i)switch(B(e)){case x:return t.tickFillErrorSelected;case E:return t.tickFillErrorSelectedHover;case I:return t.tickFillErrorSelectedHoverActive}else switch(B(e)){case x:return t.tickFillSelected;case E:return t.tickFillSelectedHover;case I:return t.tickFillSelectedHoverActive}else return n?t.borderSelected:i?t.tickBorderError:t.tickBorder;return null}function Me(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(B(e)){case x:return t.tickFillError;case E:return t.tickFillErrorHover;case I:return t.tickFillErrorHoverActive}else switch(B(e)){case x:return t.tickFill;case E:return t.tickFillHover;case I:return t.tickFillActive}}function $e(e){var t=e.$labelPlacement,o=t===void 0?"":t,r=e.$theme,n;switch(o){case"top":n="Bottom";break;case"bottom":n="Top";break;case"left":n=r.direction==="rtl"?"Left":"Right";break;default:case"right":n=r.direction==="rtl"?"Right":"Left";break}var i=r.sizing,a=i.scale300;return O({},"padding".concat(n),a)}function Fe(e){var t=e.$disabled,o=e.$theme,r=o.colors;return t?r.contentSecondary:r.contentPrimary}var W=R("div",function(e){var t=e.$disabled,o=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:o==="horizontal"?"row":"column",alignItems:o==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});W.displayName="RadioGroupRoot";W.displayName="RadioGroupRoot";var X=R("label",function(e){var t,o=e.$disabled,r=e.$hasDescription,n=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,c=a==="horizontal",d=i.direction==="rtl"?"Left":"Right";return t={flexDirection:n==="top"||n==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:o?"not-allowed":"pointer",marginTop:s.scale200},O(t,"margin".concat(d),c?s.scale200:null),O(t,"marginBottom",r&&!c?null:s.scale200),t});X.displayName="Root";X.displayName="Root";var J=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{backgroundColor:Me(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});J.displayName="RadioMarkInner";J.displayName="RadioMarkInner";var K=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:Se(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve}});K.displayName="RadioMarkOuter";K.displayName="RadioMarkOuter";var Y=R("div",function(e){var t=e.$theme.typography;return A(A({verticalAlign:"middle"},$e(e)),{},{color:Fe(e)},t.LabelMedium)});Y.displayName="Label";Y.displayName="Label";var Q=R("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});Q.displayName="Input";Q.displayName="Input";var Z=R("div",function(e){var t,o=e.$theme,r=e.$align,n=r==="horizontal",i=o.direction==="rtl"?"Right":"Left",a=o.direction==="rtl"?"Left":"Right";return A(A({},o.typography.ParagraphSmall),{},(t={color:o.colors.contentSecondary,cursor:"auto"},O(t,"margin".concat(i),r==="horizontal"?null:o.sizing.scale900),O(t,"margin".concat(a),n?o.sizing.scale200:null),O(t,"maxWidth","240px"),t))});Z.displayName="Description";Z.displayName="Description";function N(e){"@babel/helpers - typeof";return N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(e)}function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},_.apply(this,arguments)}function Pe(e,t){return Le(e)||Ie(e,t)||Ee(e,t)||xe()}function xe(){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 Ee(e,t){if(e){if(typeof e=="string")return se(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(e);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return se(e,t)}}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function Ie(e,t){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r=[],n=!0,i=!1,a,s;try{for(o=o.call(e);!(n=(a=o.next()).done)&&(r.push(a.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,s=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw s}}return r}}function Le(e){if(Array.isArray(e))return e}function Te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ce(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ae(e,t,o){return t&&Ce(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Be(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},U(e,t)}function De(e){var t=ze();return function(){var o=D(e),r;if(t){var n=D(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Ve(this,r)}}function Ve(e,t){if(t&&(N(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}function T(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ze(){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 D(e){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},D(e)}function C(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var ue=(function(e){Be(o,e);var t=De(o);function o(){var r;Te(this,o);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i)),C(T(r),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),C(T(r),"handleFocus",function(s,c){ke(s)&&r.setState({isFocusVisible:!0}),r.setState({focusedRadioIndex:c}),r.props.onFocus&&r.props.onFocus(s)}),C(T(r),"handleBlur",function(s,c){r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1}),r.setState({focusedRadioIndex:-1}),r.props.onBlur&&r.props.onBlur(s)}),r}return Ae(o,[{key:"render",value:function(){var r=this,n=this.props.overrides,i=n===void 0?{}:n,a=w(i.RadioGroupRoot,W),s=Pe(a,2),c=s[0],d=s[1];return u.createElement(c,_({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},d),u.Children.map(this.props.children,function(p,b){if(!u.isValidElement(p))return null;var l=r.props.value===p.props.value;return u.cloneElement(p,{align:r.props.align,autoFocus:r.props.autoFocus,checked:l,disabled:r.props.disabled||p.props.disabled,error:r.props.error,isFocused:r.state.focusedRadioIndex===b,isFocusVisible:r.state.isFocusVisible,tabIndex:b===0&&!r.props.value||l?"0":"-1",labelPlacement:r.props.labelPlacement,name:r.props.name,onBlur:function(f){return r.handleBlur(f,b)},onFocus:function(f){return r.handleFocus(f,b)},onChange:r.props.onChange,onMouseEnter:r.props.onMouseEnter,onMouseLeave:r.props.onMouseLeave})}))}}]),o})(u.Component);C(ue,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});function q(e){"@babel/helpers - typeof";return q=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},q(e)}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},v.apply(this,arguments)}function S(e,t){return Ue(e)||_e(e,t)||Ne(e,t)||He()}function He(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ne(e,t){if(e){if(typeof e=="string")return le(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(e);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return le(e,t)}}function le(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function _e(e,t){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r=[],n=!0,i=!1,a,s;try{for(o=o.call(e);!(n=(a=o.next()).done)&&(r.push(a.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,s=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw s}}return r}}function Ue(e){if(Array.isArray(e))return e}function qe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ge(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function We(e,t,o){return t&&Ge(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xe(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&&G(e,t)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},G(e,t)}function Je(e){var t=Ye();return function(){var o=V(e),r;if(t){var n=V(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Ke(this,r)}}function Ke(e,t){if(t&&(q(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return M(e)}function M(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ye(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(e)}function $(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function Qe(e){return e==="top"||e==="left"}function Ze(e){return e==="bottom"||e==="right"}var et=function(e){return e.stopPropagation()},ce=(function(e){Xe(o,e);var t=Je(o);function o(){var r;qe(this,o);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=t.call.apply(t,[this].concat(i)),$(M(r),"state",{isActive:!1,isHovered:!1}),$(M(r),"onMouseEnter",function(s){r.setState({isHovered:!0}),r.props.onMouseEnter&&r.props.onMouseEnter(s)}),$(M(r),"onMouseLeave",function(s){r.setState({isHovered:!1}),r.props.onMouseLeave&&r.props.onMouseLeave(s)}),$(M(r),"onMouseDown",function(s){r.setState({isActive:!0}),r.props.onMouseDown&&r.props.onMouseDown(s)}),$(M(r),"onMouseUp",function(s){r.setState({isActive:!1}),r.props.onMouseUp&&r.props.onMouseUp(s)}),r}return We(o,[{key:"componentDidMount",value:function(){var r;this.props.autoFocus&&(r=this.props.inputRef)!==null&&r!==void 0&&r.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var r=this.props.overrides,n=r===void 0?{}:r,i=w(n.Root,X),a=S(i,2),s=a[0],c=a[1],d=w(n.Label,Y),p=S(d,2),b=p[0],l=p[1],f=w(n.Input,Q),F=S(f,2),z=F[0],k=F[1],H=w(n.Description,Z),P=S(H,2),L=P[0],g=P[1],y=w(n.RadioMarkInner,J),h=S(y,2),pe=h[0],fe=h[1],de=w(n.RadioMarkOuter,K),ee=S(de,2),be=ee[0],he=ee[1],j={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},te=u.createElement(b,v({},j,l),this.props.containsInteractiveElement?u.createElement("div",{onClick:function(me){return me.preventDefault()}},this.props.children):this.props.children);return u.createElement(u.Fragment,null,u.createElement(s,v({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},j,c),Qe(this.props.labelPlacement)&&te,u.createElement(be,v({},j,he),u.createElement(pe,v({},j,fe))),u.createElement(z,v({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:et,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},j,k)),Ze(this.props.labelPlacement)&&te),!!this.props.description&&u.createElement(L,v({},j,g),this.props.description))}}]),o})(u.Component);$(ce,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:u.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function tt(e){const t=parseFloat(e.sizes.checkbox),o=parseFloat(e.spacing.threeXS),r=oe(t.toString()),n=Math.round(r*.375);let i=Math.round(oe((t-o).toString()));return i>=r&&(i-=1),[ne(n,"px"),ne(i,"px")]}function rt({disabled:e,horizontal:t,value:o,onChange:r,options:n,captions:i,label:a,labelVisibility:s,help:c}){const[d,p]=u.useState(o??null);u.useEffect(()=>{o!==d&&p(o??null)},[o]);const b=u.useCallback(g=>{const y=parseInt(g.target.value,10);p(y),r(y)},[r]),l=ye(),f=i.length>0,F=n.length>0,z=F?n:["No options to select."],k=e||!F,H=g=>g==""&&t&&f?"&nbsp;":g,[P,L]=tt(l);return m.jsxs("div",{className:"stRadio","data-testid":"stRadio",children:[m.jsx(ve,{label:a,disabled:k,labelVisibility:s,children:c&&m.jsx(we,{children:m.jsx(Oe,{content:c,placement:Re.TOP_RIGHT})})}),m.jsx(ue,{onChange:b,value:d!==null?d.toString():void 0,disabled:k,align:t?ie.horizontal:ie.vertical,"aria-label":a,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:f?l.spacing.sm:l.spacing.none,minHeight:l.sizes.minElementHeight}}},children:z.map((g,y)=>m.jsxs(ce,{value:y.toString(),overrides:{Root:{style:({$isFocusVisible:h})=>({marginBottom:l.spacing.none,marginTop:l.spacing.none,marginRight:f?l.spacing.sm:l.spacing.lg,paddingLeft:l.spacing.none,alignItems:"start",paddingRight:l.spacing.threeXS,backgroundColor:h?l.colors.darkenedBgMix25:""})},RadioMarkOuter:{style:({$checked:h})=>({width:l.sizes.checkbox,height:l.sizes.checkbox,marginTop:"0.35rem",marginRight:l.spacing.none,marginLeft:l.spacing.none,backgroundColor:h&&!k?l.colors.primary:l.colors.fadedText40})},RadioMarkInner:{style:({$checked:h})=>({height:h?P:L,width:h?P:L})},Label:{style:{color:k?l.colors.fadedText40:l.colors.bodyText,position:"relative",top:l.spacing.px}}},children:[m.jsx(re,{source:g,allowHTML:!1,isLabel:!0,largerLabel:!0}),f&&m.jsx(re,{source:H(i[y]),allowHTML:!1,isCaption:!0,isLabel:!0})]},y))})]})}const ot=u.memo(rt);function nt({disabled:e,element:t,widgetMgr:o,fragmentId:r}){const[n,i]=je({getStateFromWidgetMgr:it,getDefaultStateFromProto:at,getCurrStateFromProto:st,updateWidgetMgrState:lt,element:t,widgetMgr:o,fragmentId:r}),a=u.useCallback(f=>{i({value:f,fromUi:!0})},[i]),{horizontal:s,options:c,captions:d,label:p,labelVisibility:b,help:l}=t;return m.jsx(ot,{label:p,onChange:a,options:c,captions:d,disabled:e,horizontal:s,labelVisibility:ge(b?.value),value:n??null,help:l})}function it(e,t){return e.getIntValue(t)}function at(e){return e.default??null}function st(e){return e.value??null}function lt(e,t,o,r){t.setIntValue(e,o.value??null,{fromUi:o.fromUi},r)}const ft=u.memo(nt);export{ft as default};
@@ -1 +1 @@
1
- import{bF as f,bG as u,bH as a,Z as c}from"./index-BUGX2TMK.js";function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,f(r.key),r)}}function l(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t,e){if(e&&(a(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i(t)}function s(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&&u(t,e)}export{i as a,s as b,l,b as p,y};
1
+ import{bF as f,bG as u,bH as a,Z as c}from"./index-D3uELfdo.js";function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,f(r.key),r)}}function l(t,e,o){return e&&n(t.prototype,e),o&&n(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t,e){if(e&&(a(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i(t)}function s(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&&u(t,e)}export{i as a,s as b,l,b as p,y};
@@ -1,2 +1,2 @@
1
- import{aY as m,r as f,bP as z,bU as S,bS as p}from"./index-BUGX2TMK.js";import{s as H,u as P,e as Y,t as Z}from"./base-input-DqwZ6cLM-CfKARdZH.js";function O(t){"@babel/helpers - typeof";return O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(t)}var G=["Root","StartEnhancer","EndEnhancer"],J=["startEnhancer","endEnhancer","overrides"];function c(){return c=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c.apply(this,arguments)}function v(t,e){return V(t)||Q(t,e)||M(t,e)||K()}function K(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{aY as m,r as f,bP as z,bU as S,bS as p}from"./index-D3uELfdo.js";import{s as H,u as P,e as Y,t as Z}from"./base-input-DjjpNP8Y-DtsTHlXD.js";function O(t){"@babel/helpers - typeof";return O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(t)}var G=["Root","StartEnhancer","EndEnhancer"],J=["startEnhancer","endEnhancer","overrides"];function c(){return c=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c.apply(this,arguments)}function v(t,e){return V(t)||Q(t,e)||M(t,e)||K()}function K(){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 M(t,e){if(t){if(typeof t=="string")return F(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(t,e)}}function F(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Q(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,u=!1,a,i;try{for(n=n.call(t);!(o=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));o=!0);}catch(d){u=!0,i=d}finally{try{!o&&n.return!=null&&n.return()}finally{if(u)throw i}}return r}}function V(t){if(Array.isArray(t))return t}function A(t,e){if(t==null)return{};var n=W(t,e),r,o;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(o=0;o<u.length;o++)r=u[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function W(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,u;for(u=0;u<r.length;u++)o=r[u],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function X(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function tt(t,e,n){return e&&L(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function et(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&&g(t,e)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},g(t,e)}function rt(t){var e=ot();return function(){var n=h(t),r;if(e){var o=h(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return nt(this,r)}}function nt(t,e){if(e&&(O(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function y(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ot(){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(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(t)}function b(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ut=(function(t){et(n,t);var e=rt(n);function n(){var r;X(this,n);for(var o=arguments.length,u=new Array(o),a=0;a<o;a++)u[a]=arguments[a];return r=e.call.apply(e,[this].concat(u)),b(y(r),"state",{isFocused:r.props.autoFocus||!1}),b(y(r),"onFocus",function(i){r.setState({isFocused:!0}),r.props.onFocus(i)}),b(y(r),"onBlur",function(i){r.setState({isFocused:!1}),r.props.onBlur(i)}),r}return tt(n,[{key:"render",value:function(){var r=this.props,o=r.startEnhancer,u=r.endEnhancer,a=r.overrides,i=a.Root,d=a.StartEnhancer,R=a.EndEnhancer,_=A(a,G),x=A(r,J),B=m(i,H),E=v(B,2),$=E[0],T=E[1],C=m(d,P),j=v(C,2),N=j[0],k=j[1],D=m(R,P),w=v(D,2),U=w[0],q=w[1],l=Y(this.props,this.state);return f.createElement($,c({"data-baseweb":"input"},l,T,{$adjoined:I(o,u),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),s(o)&&f.createElement(N,c({},l,k,{$position:S.start}),typeof o=="function"?o(l):o),f.createElement(Z,c({},x,{overrides:_,adjoined:I(o,u),onFocus:this.onFocus,onBlur:this.onBlur})),s(u)&&f.createElement(U,c({},l,q,{$position:S.end}),typeof u=="function"?u(l):u))}}]),n})(f.Component);b(ut,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:z.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function I(t,e){return s(t)&&s(e)?p.both:s(t)?p.left:s(e)?p.right:p.none}function s(t){return!!(t||t===0)}export{ut as a};
@@ -1 +1 @@
1
- import{c as u,e as p}from"./es6--XPcqeHG-Ct8fR_QW.js";import"./index-BUGX2TMK.js";const{File:r,Blob:y,DOMException:s}=u,{INVALID:_,GONE:n,MISMATCH:w,MOD_ERR:z,SYNTAX:l,SECURITY:I,DISALLOWED:m}=p;class b{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 r([this.file,new ArrayBuffer(e.position-this.size)],this.file.name,this.file))),!("data"in e))throw new s(...l("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(..._);this.position=e.position;return}else throw new s(...l("seek requires a position argument"));else if(e.type==="truncate")if(Number.isInteger(e.size)&&e.size>=0){i=e.size<this.size?new r([i.slice(0,e.size)],i.name,i):new r([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(...l("truncate requires a size argument"))}e=new y([e]);let t=this.file;const o=t.slice(0,this.position),d=t.slice(this.position+e.size);let h=this.position-o.size;h<0&&(h=0),t=new r([o,new Uint8Array(h),e,d],t.name),this.size=t.size,this.position+=e.size,this.file=t}close(){if(this.fileHandle._deleted)throw new s(...n);this.fileHandle._file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class a{constructor(e="",i=new r([],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(...n);return this._file}async createWritable(e){if(!this.writable)throw new s(...m);if(this._deleted)throw new s(...n);const i=e.keepExistingData?await this.getFile():new r([],this.name);return new b(this,i)}async isSameEntry(e){return this===e}async _destroy(){this._deleted=!0,this._file=null}}class f{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(...n);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i){if(this._deleted)throw new s(...n);const t=this._entries[e];if(t){if(t instanceof a)throw new s(...w);return t}else{if(i.create)return this._entries[e]=new f(e);throw new s(...n)}}async getFileHandle(e,i){const t=this._entries[e],o=t instanceof a;if(t&&o)return t;if(t&&!o)throw new s(...w);if(!t&&!i.create)throw new s(...n);if(!t&&i.create)return this._entries[e]=new a(e)}async removeEntry(e,i){const t=this._entries[e];if(!t)throw new s(...n);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(...z);await i._destroy(e)}this._entries={},this._deleted=!0}}const g=new f(""),A=()=>g;export{a as FileHandle,f as FolderHandle,b as Sink,A as default};
1
+ import{c as u,e as p}from"./es6--XPcqeHG-B7r8Rb2B.js";import"./index-D3uELfdo.js";const{File:r,Blob:y,DOMException:s}=u,{INVALID:_,GONE:n,MISMATCH:w,MOD_ERR:z,SYNTAX:l,SECURITY:I,DISALLOWED:m}=p;class b{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 r([this.file,new ArrayBuffer(e.position-this.size)],this.file.name,this.file))),!("data"in e))throw new s(...l("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(..._);this.position=e.position;return}else throw new s(...l("seek requires a position argument"));else if(e.type==="truncate")if(Number.isInteger(e.size)&&e.size>=0){i=e.size<this.size?new r([i.slice(0,e.size)],i.name,i):new r([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(...l("truncate requires a size argument"))}e=new y([e]);let t=this.file;const o=t.slice(0,this.position),d=t.slice(this.position+e.size);let h=this.position-o.size;h<0&&(h=0),t=new r([o,new Uint8Array(h),e,d],t.name),this.size=t.size,this.position+=e.size,this.file=t}close(){if(this.fileHandle._deleted)throw new s(...n);this.fileHandle._file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class a{constructor(e="",i=new r([],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(...n);return this._file}async createWritable(e){if(!this.writable)throw new s(...m);if(this._deleted)throw new s(...n);const i=e.keepExistingData?await this.getFile():new r([],this.name);return new b(this,i)}async isSameEntry(e){return this===e}async _destroy(){this._deleted=!0,this._file=null}}class f{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(...n);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i){if(this._deleted)throw new s(...n);const t=this._entries[e];if(t){if(t instanceof a)throw new s(...w);return t}else{if(i.create)return this._entries[e]=new f(e);throw new s(...n)}}async getFileHandle(e,i){const t=this._entries[e],o=t instanceof a;if(t&&o)return t;if(t&&!o)throw new s(...w);if(!t&&!i.create)throw new s(...n);if(!t&&i.create)return this._entries[e]=new a(e)}async removeEntry(e,i){const t=this._entries[e];if(!t)throw new s(...n);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(...z);await i._destroy(e)}this._entries={},this._deleted=!0}}const g=new f(""),A=()=>g;export{a as FileHandle,f as FolderHandle,b as Sink,A as default};
@@ -1,4 +1,4 @@
1
- import{r as I,aC as Y}from"./index-BUGX2TMK.js";import{a as Ie}from"./index-Cwu3avS4-DiDBV46w.js";import"./withFullScreenWrapper-BKnfDWJg-dLKoL1-0.js";import"./Toolbar-C79vGzHM-4gREjS-R.js";import"./FormClearHelper-Bi1RDDCw-CUfvtGEu.js";import"./sprintf-D5E86llw-6tzWM3a-.js";import"./checkbox-DSLjv1hz-C5dTTEJn.js";import"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";import"./slicedToArray-bXF_q2D_-C8JYb8qs.js";import"./inherits-V2B09WF6-BfQai87E.js";import"./createSuper-B3kpwht8-vR1ZxlfE.js";import"./FileDownload.esm-rDRR6AEq-DjpuiBZc.js";const je=Ie("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function he(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 H(){}function Be(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(u,l){return u===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function X(e){return e==null}function Fe(e){return typeof e=="number"&&isNaN(e)}function Se(e){return X(e)||Fe(e)||typeof e=="number"&&!isFinite(e)}function be(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Me(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 ke(e,t,r){var n=Me(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 We(e){var t=I.useRef(e);t.current=e;var r=I.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function fe(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),u=a[0],l=a[1]||"";return{beforeDecimal:u,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":"",u=0;u<=t-1;u++)n+=e[u]||a;return n}function de(e,t){return Array(t+1).join(e)}function Ve(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],u=n[1];if(u=Number(u),!u)return r+a;a=a.replace(".","");var l=1+u,g=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=g?a=a+de("0",l-g):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=fe(e),u=a.beforeDecimal,l=a.afterDecimal,g=a.hasNegation,h=parseFloat("0."+(l||"0")),S=l.length<=t?"0."+l:h.toFixed(t),p=S.split("."),v=u;u&&Number(p[0])&&(v=u.split("").reverse().reduce(function(O,E,m){return O.length>m?(Number(O[0])+Number(E)).toString()+O.substring(1,O.length):E+O},p[0]));var V=ye(p[1]||"",t,r),b=g?"-":"",c=n?".":"";return""+b+v+c+V}function $(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 we=Be(function(e,t){for(var r=0,n=0,a=e.length,u=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[u-1-n]&&u-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:u-n}}}),Le=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Pe(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function Ue(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function _e(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function qe(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,u,l){l===void 0&&(l=qe);var g=a.findIndex(function(K){return K}),h=e.slice(0,g);!t&&!r.startsWith(h)&&(t=h,r=h+r,n=n+h.length);for(var S=r.length,p=e.length,v={},V=new Array(S),b=0;b<S;b++){V[b]=-1;for(var c=0,O=p;c<O;c++){var E=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:b,formattedValueIndex:c});if(E&&v[c]!==!0){V[b]=c,v[c]=!0;break}}}for(var m=n;m<S&&(V[m]===-1||!u(r[m]));)m++;var j=m===S||V[m]===-1?p:V[m];for(m=n-1;m>0&&V[m]===-1;)m--;var B=m===-1||V[m]===-1?0:V[m]+1;return B>j?j:n-B<j-n?B:j}function ge(e,t,r,n){var a=e.length;if(t=Pe(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 He(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 xe(e,t,r,n,a,u){u===void 0&&(u=H);var l=We(function(c,O){var E,m;return Se(c)?(m="",E=""):typeof c=="number"||O?(m=typeof c=="number"?Ve(c):c,E=n(m)):(m=a(c,void 0),E=n(m)),{formattedValue:E,numAsString:m}}),g=I.useState(function(){return l(X(e)?t:e,r)}),h=g[0],S=g[1],p=function(c,O){c.formattedValue!==h.formattedValue&&S({formattedValue:c.formattedValue,numAsString:c.value}),u(c,O)},v=e,V=r;X(e)&&(v=h.numAsString,V=!0);var b=l(v,V);return I.useMemo(function(){S(b)},[b.formattedValue]),[h,p]}function Ze(e){return e.replace(/[^0-9]/g,"")}function Je(e){return e}function $e(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,u=e.getInputRef,l=e.format;l===void 0&&(l=Je);var g=e.removeFormatting;g===void 0&&(g=Ze);var h=e.defaultValue,S=e.valueIsNumericString,p=e.onValueChange,v=e.isAllowed,V=e.onChange;V===void 0&&(V=H);var b=e.onKeyDown;b===void 0&&(b=H);var c=e.onMouseUp;c===void 0&&(c=H);var O=e.onFocus;O===void 0&&(O=H);var E=e.onBlur;E===void 0&&(E=H);var m=e.value,j=e.getCaretBoundary;j===void 0&&(j=He);var B=e.isValidInputCharacter;B===void 0&&(B=ae);var K=e.isCharacterSame,M=he(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),Z=xe(m,h,!!S,l,g,p),L=Z[0],w=L.formattedValue,k=L.numAsString,J=Z[1],W=I.useRef(),U=I.useRef({formattedValue:w,numAsString:k}),_=function(o,i){U.current={formattedValue:o.formattedValue,numAsString:o.value},J(o,i)},z=I.useState(!1),ee=z[0],d=z[1],s=I.useRef(null),x=I.useRef({setCaretTimeout:null,focusTimeout:null});I.useEffect(function(){return d(!0),function(){clearTimeout(x.current.setCaretTimeout),clearTimeout(x.current.focusTimeout)}},[]);var C=l,A=function(o,i){var f=parseFloat(i);return{formattedValue:o,value:i,floatValue:isNaN(f)?void 0:f}},T=function(o,i,f){o.selectionStart===0&&o.selectionEnd===o.value.length||($(o,i),x.current.setCaretTimeout=setTimeout(function(){o.value===f&&o.selectionStart!==i&&$(o,i)},0))},R=function(o,i,f){return ge(o,i,j(o),f)},Q=function(o,i,f){var D=j(i),F=Ge(i,w,o,f,D,B,K);return F=ge(i,F,D),F},oe=function(o){var i=o.formattedValue;i===void 0&&(i="");var f=o.input,D=o.source,F=o.event,N=o.numAsString,y;if(f){var P=o.inputValue||f.value,q=ce(f);f.value=i,y=Q(P,i,q),y!==void 0&&T(f,y,i)}i!==w&&_(A(i,N),{event:F,source:D})};I.useEffect(function(){var o=U.current,i=o.formattedValue,f=o.numAsString;(w!==i||k!==f)&&_(A(w,k),{event:void 0,source:re.props})},[w,k]);var te=s.current?ce(s.current):void 0,ne=typeof window<"u"?I.useLayoutEffect:I.useEffect;ne(function(){var o=s.current;if(w!==U.current.formattedValue&&o){var i=Q(U.current.formattedValue,w,te);o.value=w,T(o,i,w)}},[w]);var ie=function(o,i,f){var D=i.target,F=W.current?Le(W.current,D.selectionEnd):we(w,o),N=Object.assign(Object.assign({},F),{lastValue:w}),y=g(o,N),P=C(y);if(y=g(P,void 0),v&&!v(A(P,y))){var q=i.target,G=ce(q),se=Q(o,w,G);return q.value=w,T(q,se,w),!1}return oe({formattedValue:P,numAsString:y,inputValue:o,event:i,source:f,input:i.target}),!0},le=function(o,i){i===void 0&&(i=0);var f=o.selectionStart,D=o.selectionEnd;W.current={selectionStart:f,selectionEnd:D+i}},Ne=function(o){var i=o.target,f=i.value,D=ie(f,o,re.event);D&&V(o),W.current=void 0},Oe=function(o){var i=o.target,f=o.key,D=i.selectionStart,F=i.selectionEnd,N=i.value;N===void 0&&(N="");var y;f==="ArrowLeft"||f==="Backspace"?y=Math.max(D-1,0):f==="ArrowRight"?y=Math.min(D+1,N.length):f==="Delete"&&(y=D);var P=0;f==="Delete"&&D===F&&(P=1);var q=f==="ArrowLeft"||f==="ArrowRight";if(y===void 0||D!==F&&!q){b(o),le(i,P);return}var G=y;if(q){var se=f==="ArrowLeft"?"left":"right";G=R(N,y,se),G!==y&&o.preventDefault()}else f==="Delete"&&!B(N[y])?G=R(N,y,"right"):f==="Backspace"&&!B(N[y])&&(G=R(N,y,"left"));G!==y&&T(i,G,N),b(o),le(i,P)},Ee=function(o){var i=o.target,f=function(){var D=i.selectionStart,F=i.selectionEnd,N=i.value;if(N===void 0&&(N=""),D===F){var y=R(N,D);y!==D&&T(i,y,N)}};f(),requestAnimationFrame(function(){f()}),c(o),le(i)},Te=function(o){o.persist&&o.persist();var i=o.target,f=o.currentTarget;s.current=i,x.current.focusTimeout=setTimeout(function(){var D=i.selectionStart,F=i.selectionEnd,N=i.value;N===void 0&&(N="");var y=R(N,D);y!==D&&!(D===0&&F===N.length)&&T(i,y,N),O(Object.assign(Object.assign({},o),{currentTarget:f}))},0)},Ce=function(o){s.current=null,clearTimeout(x.current.focusTimeout),clearTimeout(x.current.setCaretTimeout),E(o)},Ae=ee&&Ue()?"numeric":void 0,ve=Object.assign({inputMode:Ae},M,{type:t,value:w,onChange:Ne,onKeyDown:Oe,onMouseUp:Ee,onFocus:Te,onBlur:Ce});if(r==="text")return a?Y.createElement(Y.Fragment,null,a(w,M)||null):Y.createElement("span",Object.assign({},M,{ref:u}),w);if(n){var Re=n;return Y.createElement(Re,Object.assign({},ve,{ref:u}))}return Y.createElement("input",Object.assign({},ve,{ref:u}))}function pe(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var u=t.suffix;u===void 0&&(u="");var l=t.allowNegative,g=t.thousandsGroupStyle;if(g===void 0&&(g="thousand"),e===""||e==="-")return e;var h=ue(t),S=h.thousandSeparator,p=h.decimalSeparator,v=r!==0&&e.indexOf(".")!==-1||r&&n,V=fe(e,l),b=V.beforeDecimal,c=V.afterDecimal,O=V.addNegation;return r!==void 0&&(c=ye(c,r,!!n)),S&&(b=ke(b,S,g)),a&&(b=a+b),u&&(c=c+u),O&&(b="-"+b),e=b+(v&&p||"")+c,e}function ue(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 ze(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),u=n.test(e);return e=e.replace(/-/g,""),a&&!u&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+be(e),"g")}function Ye(e,t,r){return e===""?!0:!t?.match(/\d/)&&!r?.match(/\d/)&&typeof e=="string"&&!isNaN(Number(e))}function Xe(e,t,r){var n;t===void 0&&(t=_e(e));var a=r.allowNegative,u=r.prefix;u===void 0&&(u="");var l=r.suffix;l===void 0&&(l="");var g=r.decimalScale,h=t.from,S=t.to,p=S.start,v=S.end,V=ue(r),b=V.allowedDecimalSeparators,c=V.decimalSeparator,O=e[v]===c;if(ae(e)&&(e===u||e===l)&&t.lastValue==="")return e;if(v-p===1&&b.indexOf(e[p])!==-1){var E=g===0?"":c;e=e.substring(0,p)+E+e.substring(p+1,e.length)}var m=function(s,x,C){var A=!1,T=!1;u.startsWith("-")?A=!1:s.startsWith("--")?(A=!1,T=!0):l.startsWith("-")&&s.length===l.length?A=!1:s[0]==="-"&&(A=!0);var R=A?1:0;return T&&(R=2),R&&(s=s.substring(R),x-=R,C-=R),{value:s,start:x,end:C,hasNegation:A}},j=m(e,p,v),B=j.hasNegation;n=j,e=n.value,p=n.start,v=n.end;var K=m(t.lastValue,h.start,h.end),M=K.start,Z=K.end,L=K.value,w=e.substring(p,v);e.length&&L.length&&(M>L.length-l.length||Z<u.length)&&!(w&&l.startsWith(w))&&(e=L);var k=0;e.startsWith(u)?k+=u.length:p<u.length&&(k=p),e=e.substring(k),v-=k;var J=e.length,W=e.length-l.length;e.endsWith(l)?J=W:(v>W||v>e.length-l.length)&&(J=v),e=e.substring(0,J),e=ze(B?"-"+e:e,a),e=(e.match(Qe(c))||[]).join("");var U=e.indexOf(c);e=e.replace(new RegExp(be(c),"g"),function(s,x){return x===U?".":""});var _=fe(e,a),z=_.beforeDecimal,ee=_.afterDecimal,d=_.addNegation;return S.end-S.start<h.end-h.start&&z===""&&O&&!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}),u=e[0]==="-";a.fill(!1,0,r.length+(u?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ue(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var u=e.allowNegative;if(u===void 0&&(u=!0),r===n)throw new Error(`
1
+ import{r as I,aC as Y}from"./index-D3uELfdo.js";import{a as Ie}from"./index-GLEJ4uEg-Df22L041.js";import"./withFullScreenWrapper-WW0e_nhm-CAjrnrPK.js";import"./Toolbar-Ba82LOXi-C-TMlOex.js";import"./FormClearHelper-Dgu5Halt-BxICjxpW.js";import"./sprintf-D5E86llw-6tzWM3a-.js";import"./checkbox-i_07yegq-B7N8fYE1.js";import"./createDownloadLinkElement-CbRjLJ8e-NbV49OP9.js";import"./slicedToArray-DCtO1hP1-DNgLFFIn.js";import"./inherits-Rx5YJbse-DVYurFFp.js";import"./createSuper-Bj1hzAgo-DTBN9Cdm.js";import"./FileDownload.esm-BP6Yw6Mo-BauI2spi.js";const je=Ie("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function he(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 H(){}function Be(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(u,l){return u===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function X(e){return e==null}function Fe(e){return typeof e=="number"&&isNaN(e)}function Se(e){return X(e)||Fe(e)||typeof e=="number"&&!isFinite(e)}function be(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Me(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 ke(e,t,r){var n=Me(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 We(e){var t=I.useRef(e);t.current=e;var r=I.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function fe(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),u=a[0],l=a[1]||"";return{beforeDecimal:u,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":"",u=0;u<=t-1;u++)n+=e[u]||a;return n}function de(e,t){return Array(t+1).join(e)}function Ve(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],u=n[1];if(u=Number(u),!u)return r+a;a=a.replace(".","");var l=1+u,g=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=g?a=a+de("0",l-g):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=fe(e),u=a.beforeDecimal,l=a.afterDecimal,g=a.hasNegation,h=parseFloat("0."+(l||"0")),S=l.length<=t?"0."+l:h.toFixed(t),p=S.split("."),v=u;u&&Number(p[0])&&(v=u.split("").reverse().reduce(function(O,E,m){return O.length>m?(Number(O[0])+Number(E)).toString()+O.substring(1,O.length):E+O},p[0]));var V=ye(p[1]||"",t,r),b=g?"-":"",c=n?".":"";return""+b+v+c+V}function $(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 we=Be(function(e,t){for(var r=0,n=0,a=e.length,u=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[u-1-n]&&u-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:u-n}}}),Le=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Pe(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function Ue(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function _e(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function qe(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,u,l){l===void 0&&(l=qe);var g=a.findIndex(function(K){return K}),h=e.slice(0,g);!t&&!r.startsWith(h)&&(t=h,r=h+r,n=n+h.length);for(var S=r.length,p=e.length,v={},V=new Array(S),b=0;b<S;b++){V[b]=-1;for(var c=0,O=p;c<O;c++){var E=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:b,formattedValueIndex:c});if(E&&v[c]!==!0){V[b]=c,v[c]=!0;break}}}for(var m=n;m<S&&(V[m]===-1||!u(r[m]));)m++;var j=m===S||V[m]===-1?p:V[m];for(m=n-1;m>0&&V[m]===-1;)m--;var B=m===-1||V[m]===-1?0:V[m]+1;return B>j?j:n-B<j-n?B:j}function ge(e,t,r,n){var a=e.length;if(t=Pe(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 He(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 xe(e,t,r,n,a,u){u===void 0&&(u=H);var l=We(function(c,O){var E,m;return Se(c)?(m="",E=""):typeof c=="number"||O?(m=typeof c=="number"?Ve(c):c,E=n(m)):(m=a(c,void 0),E=n(m)),{formattedValue:E,numAsString:m}}),g=I.useState(function(){return l(X(e)?t:e,r)}),h=g[0],S=g[1],p=function(c,O){c.formattedValue!==h.formattedValue&&S({formattedValue:c.formattedValue,numAsString:c.value}),u(c,O)},v=e,V=r;X(e)&&(v=h.numAsString,V=!0);var b=l(v,V);return I.useMemo(function(){S(b)},[b.formattedValue]),[h,p]}function Ze(e){return e.replace(/[^0-9]/g,"")}function Je(e){return e}function $e(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,u=e.getInputRef,l=e.format;l===void 0&&(l=Je);var g=e.removeFormatting;g===void 0&&(g=Ze);var h=e.defaultValue,S=e.valueIsNumericString,p=e.onValueChange,v=e.isAllowed,V=e.onChange;V===void 0&&(V=H);var b=e.onKeyDown;b===void 0&&(b=H);var c=e.onMouseUp;c===void 0&&(c=H);var O=e.onFocus;O===void 0&&(O=H);var E=e.onBlur;E===void 0&&(E=H);var m=e.value,j=e.getCaretBoundary;j===void 0&&(j=He);var B=e.isValidInputCharacter;B===void 0&&(B=ae);var K=e.isCharacterSame,M=he(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),Z=xe(m,h,!!S,l,g,p),L=Z[0],w=L.formattedValue,k=L.numAsString,J=Z[1],W=I.useRef(),U=I.useRef({formattedValue:w,numAsString:k}),_=function(o,i){U.current={formattedValue:o.formattedValue,numAsString:o.value},J(o,i)},z=I.useState(!1),ee=z[0],d=z[1],s=I.useRef(null),x=I.useRef({setCaretTimeout:null,focusTimeout:null});I.useEffect(function(){return d(!0),function(){clearTimeout(x.current.setCaretTimeout),clearTimeout(x.current.focusTimeout)}},[]);var C=l,A=function(o,i){var f=parseFloat(i);return{formattedValue:o,value:i,floatValue:isNaN(f)?void 0:f}},T=function(o,i,f){o.selectionStart===0&&o.selectionEnd===o.value.length||($(o,i),x.current.setCaretTimeout=setTimeout(function(){o.value===f&&o.selectionStart!==i&&$(o,i)},0))},R=function(o,i,f){return ge(o,i,j(o),f)},Q=function(o,i,f){var D=j(i),F=Ge(i,w,o,f,D,B,K);return F=ge(i,F,D),F},oe=function(o){var i=o.formattedValue;i===void 0&&(i="");var f=o.input,D=o.source,F=o.event,N=o.numAsString,y;if(f){var P=o.inputValue||f.value,q=ce(f);f.value=i,y=Q(P,i,q),y!==void 0&&T(f,y,i)}i!==w&&_(A(i,N),{event:F,source:D})};I.useEffect(function(){var o=U.current,i=o.formattedValue,f=o.numAsString;(w!==i||k!==f)&&_(A(w,k),{event:void 0,source:re.props})},[w,k]);var te=s.current?ce(s.current):void 0,ne=typeof window<"u"?I.useLayoutEffect:I.useEffect;ne(function(){var o=s.current;if(w!==U.current.formattedValue&&o){var i=Q(U.current.formattedValue,w,te);o.value=w,T(o,i,w)}},[w]);var ie=function(o,i,f){var D=i.target,F=W.current?Le(W.current,D.selectionEnd):we(w,o),N=Object.assign(Object.assign({},F),{lastValue:w}),y=g(o,N),P=C(y);if(y=g(P,void 0),v&&!v(A(P,y))){var q=i.target,G=ce(q),se=Q(o,w,G);return q.value=w,T(q,se,w),!1}return oe({formattedValue:P,numAsString:y,inputValue:o,event:i,source:f,input:i.target}),!0},le=function(o,i){i===void 0&&(i=0);var f=o.selectionStart,D=o.selectionEnd;W.current={selectionStart:f,selectionEnd:D+i}},Ne=function(o){var i=o.target,f=i.value,D=ie(f,o,re.event);D&&V(o),W.current=void 0},Oe=function(o){var i=o.target,f=o.key,D=i.selectionStart,F=i.selectionEnd,N=i.value;N===void 0&&(N="");var y;f==="ArrowLeft"||f==="Backspace"?y=Math.max(D-1,0):f==="ArrowRight"?y=Math.min(D+1,N.length):f==="Delete"&&(y=D);var P=0;f==="Delete"&&D===F&&(P=1);var q=f==="ArrowLeft"||f==="ArrowRight";if(y===void 0||D!==F&&!q){b(o),le(i,P);return}var G=y;if(q){var se=f==="ArrowLeft"?"left":"right";G=R(N,y,se),G!==y&&o.preventDefault()}else f==="Delete"&&!B(N[y])?G=R(N,y,"right"):f==="Backspace"&&!B(N[y])&&(G=R(N,y,"left"));G!==y&&T(i,G,N),b(o),le(i,P)},Ee=function(o){var i=o.target,f=function(){var D=i.selectionStart,F=i.selectionEnd,N=i.value;if(N===void 0&&(N=""),D===F){var y=R(N,D);y!==D&&T(i,y,N)}};f(),requestAnimationFrame(function(){f()}),c(o),le(i)},Te=function(o){o.persist&&o.persist();var i=o.target,f=o.currentTarget;s.current=i,x.current.focusTimeout=setTimeout(function(){var D=i.selectionStart,F=i.selectionEnd,N=i.value;N===void 0&&(N="");var y=R(N,D);y!==D&&!(D===0&&F===N.length)&&T(i,y,N),O(Object.assign(Object.assign({},o),{currentTarget:f}))},0)},Ce=function(o){s.current=null,clearTimeout(x.current.focusTimeout),clearTimeout(x.current.setCaretTimeout),E(o)},Ae=ee&&Ue()?"numeric":void 0,ve=Object.assign({inputMode:Ae},M,{type:t,value:w,onChange:Ne,onKeyDown:Oe,onMouseUp:Ee,onFocus:Te,onBlur:Ce});if(r==="text")return a?Y.createElement(Y.Fragment,null,a(w,M)||null):Y.createElement("span",Object.assign({},M,{ref:u}),w);if(n){var Re=n;return Y.createElement(Re,Object.assign({},ve,{ref:u}))}return Y.createElement("input",Object.assign({},ve,{ref:u}))}function pe(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var u=t.suffix;u===void 0&&(u="");var l=t.allowNegative,g=t.thousandsGroupStyle;if(g===void 0&&(g="thousand"),e===""||e==="-")return e;var h=ue(t),S=h.thousandSeparator,p=h.decimalSeparator,v=r!==0&&e.indexOf(".")!==-1||r&&n,V=fe(e,l),b=V.beforeDecimal,c=V.afterDecimal,O=V.addNegation;return r!==void 0&&(c=ye(c,r,!!n)),S&&(b=ke(b,S,g)),a&&(b=a+b),u&&(c=c+u),O&&(b="-"+b),e=b+(v&&p||"")+c,e}function ue(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 ze(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),u=n.test(e);return e=e.replace(/-/g,""),a&&!u&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+be(e),"g")}function Ye(e,t,r){return e===""?!0:!t?.match(/\d/)&&!r?.match(/\d/)&&typeof e=="string"&&!isNaN(Number(e))}function Xe(e,t,r){var n;t===void 0&&(t=_e(e));var a=r.allowNegative,u=r.prefix;u===void 0&&(u="");var l=r.suffix;l===void 0&&(l="");var g=r.decimalScale,h=t.from,S=t.to,p=S.start,v=S.end,V=ue(r),b=V.allowedDecimalSeparators,c=V.decimalSeparator,O=e[v]===c;if(ae(e)&&(e===u||e===l)&&t.lastValue==="")return e;if(v-p===1&&b.indexOf(e[p])!==-1){var E=g===0?"":c;e=e.substring(0,p)+E+e.substring(p+1,e.length)}var m=function(s,x,C){var A=!1,T=!1;u.startsWith("-")?A=!1:s.startsWith("--")?(A=!1,T=!0):l.startsWith("-")&&s.length===l.length?A=!1:s[0]==="-"&&(A=!0);var R=A?1:0;return T&&(R=2),R&&(s=s.substring(R),x-=R,C-=R),{value:s,start:x,end:C,hasNegation:A}},j=m(e,p,v),B=j.hasNegation;n=j,e=n.value,p=n.start,v=n.end;var K=m(t.lastValue,h.start,h.end),M=K.start,Z=K.end,L=K.value,w=e.substring(p,v);e.length&&L.length&&(M>L.length-l.length||Z<u.length)&&!(w&&l.startsWith(w))&&(e=L);var k=0;e.startsWith(u)?k+=u.length:p<u.length&&(k=p),e=e.substring(k),v-=k;var J=e.length,W=e.length-l.length;e.endsWith(l)?J=W:(v>W||v>e.length-l.length)&&(J=v),e=e.substring(0,J),e=ze(B?"-"+e:e,a),e=(e.match(Qe(c))||[]).join("");var U=e.indexOf(c);e=e.replace(new RegExp(be(c),"g"),function(s,x){return x===U?".":""});var _=fe(e,a),z=_.beforeDecimal,ee=_.afterDecimal,d=_.addNegation;return S.end-S.start<h.end-h.start&&z===""&&O&&!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}),u=e[0]==="-";a.fill(!1,0,r.length+(u?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ue(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var u=e.allowNegative;if(u===void 0&&(u=!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{e as w}from"./es6--XPcqeHG-Ct8fR_QW.js";import"./index-BUGX2TMK.js";const{DISALLOWED:h}=w;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 l{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(...h);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 l(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 l(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 u=(o={})=>new Promise((e,t)=>window.webkitRequestFileSystem(o._persistent,0,i=>e(new n(i.root)),t));export{l as FileHandle,n as FolderHandle,u as default};
1
+ import{e as w}from"./es6--XPcqeHG-B7r8Rb2B.js";import"./index-D3uELfdo.js";const{DISALLOWED:h}=w;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 l{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(...h);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 l(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 l(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 u=(o={})=>new Promise((e,t)=>window.webkitRequestFileSystem(o._persistent,0,i=>e(new n(i.root)),t));export{l as FileHandle,n as FolderHandle,u as default};
@@ -1,2 +1,2 @@
1
- import{r as a,E as m,_ as p,a0 as y}from"./index-BUGX2TMK.js";var d=a.forwardRef(function(r,e){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(m,p({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:e}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))});d.displayName="Close";function h(r){if(Array.isArray(r))return r}function b(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var i,u,c,o,l=[],n=!0,f=!1;try{if(c=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;n=!1}else for(;!(n=(i=c.call(t)).done)&&(l.push(i.value),l.length!==e);n=!0);}catch(s){f=!0,u=s}finally{try{if(!n&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(f)throw u}}return l}}function v(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as a,E as m,_ as p,a0 as y}from"./index-D3uELfdo.js";var d=a.forwardRef(function(r,e){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return a.createElement(m,p({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},r,{ref:e}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),a.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))});d.displayName="Close";function h(r){if(Array.isArray(r))return r}function b(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var i,u,c,o,l=[],n=!0,f=!1;try{if(c=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;n=!1}else for(;!(n=(i=c.call(t)).done)&&(l.push(i.value),l.length!==e);n=!0);}catch(s){f=!0,u=s}finally{try{if(!n&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(f)throw u}}return l}}function v(){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 E(r,e){return h(r)||b(r,e)||y(r,e)||v()}export{E as _,d as p};