streamlit-nightly 1.42.3.dev20250223__py2.py3-none-any.whl → 1.42.3.dev20250225__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. streamlit/dataframe_util.py +6 -1
  2. streamlit/elements/arrow.py +16 -8
  3. streamlit/elements/bokeh_chart.py +6 -0
  4. streamlit/elements/markdown.py +2 -0
  5. streamlit/elements/widgets/data_editor.py +12 -7
  6. streamlit/runtime/caching/hashing.py +67 -5
  7. streamlit/static/index.html +1 -1
  8. streamlit/static/static/js/{FileDownload.esm.B1kyp21I.js → FileDownload.esm.BlYgQAwd.js} +1 -1
  9. streamlit/static/static/js/FileHelper.Da-FUCX4.js +5 -0
  10. streamlit/static/static/js/{FormClearHelper.CEl0YyS3.js → FormClearHelper.B4WYSqDL.js} +1 -1
  11. streamlit/static/static/js/{Hooks.B_-0sclb.js → Hooks.BoeFlDaA.js} +1 -1
  12. streamlit/static/static/js/{InputInstructions.M8GsfWtP.js → InputInstructions.DiPa6u6x.js} +1 -1
  13. streamlit/static/static/js/{ProgressBar.DDliFXvs.js → ProgressBar.B-iCNc1a.js} +2 -2
  14. streamlit/static/static/js/{RenderInPortalIfExists.DON5no2j.js → RenderInPortalIfExists.DPgp77ia.js} +1 -1
  15. streamlit/static/static/js/{Toolbar.DGwjBtCI.js → Toolbar.9G2Er6_r.js} +1 -1
  16. streamlit/static/static/js/{base-input.Dz6cKnV_.js → base-input.z22leTiB.js} +4 -4
  17. streamlit/static/static/js/checkbox.DT5JbCKx.js +9 -0
  18. streamlit/static/static/js/{createSuper.bXxYJzro.js → createSuper.9dngDO4F.js} +1 -1
  19. streamlit/static/static/js/data-grid-overlay-editor.DnBgrJEy.js +1 -0
  20. streamlit/static/static/js/{downloader.BUh1naKp.js → downloader.BgiOz4Dy.js} +1 -1
  21. streamlit/static/static/js/{es6.C8XVTTHj.js → es6.C2nbxS8x.js} +2 -2
  22. streamlit/static/static/js/{iframeResizer.contentWindow.DGWt48-l.js → iframeResizer.contentWindow.XvWZp7Dg.js} +1 -1
  23. streamlit/static/static/js/{index.DcA_kXA1.js → index.B5-iXfzx.js} +2 -2
  24. streamlit/static/static/js/{index.6zGrdP7S.js → index.BDSGWkr0.js} +15 -15
  25. streamlit/static/static/js/{index.B1Y_k9Fh.js → index.BFYGskaf.js} +1 -1
  26. streamlit/static/static/js/{index.DB9G9YYY.js → index.BNc20KTN.js} +1 -1
  27. streamlit/static/static/js/{index.D-4pSvTG.js → index.BTK3gx3H.js} +1 -1
  28. streamlit/static/static/js/index.BdtKHTgl.js +1 -0
  29. streamlit/static/static/js/{index.iYzAfcLx.js → index.Bgn4z-Mp.js} +1 -1
  30. streamlit/static/static/js/index.BiPYzGZi.js +1 -0
  31. streamlit/static/static/js/{index.CNDCHhth.js → index.BkyYp5Em.js} +1 -1
  32. streamlit/static/static/js/{index.C9nK-VoQ.js → index.BxYliQ9c.js} +3 -3
  33. streamlit/static/static/js/{index.94WymsOx.js → index.C5bx6jEW.js} +2 -2
  34. streamlit/static/static/js/index.CAC6FyHh.js +1 -0
  35. streamlit/static/static/js/{index.jSEMrPEJ.js → index.CBYIbEuv.js} +1 -1
  36. streamlit/static/static/js/{index.DU4gaNU_.js → index.CBoIJv6M.js} +1 -1
  37. streamlit/static/static/js/{index.NifETEVc.js → index.CMvo7Iwl.js} +1 -1
  38. streamlit/static/static/js/{index.C2skmlN3.js → index.CrNuA-BG.js} +2 -2
  39. streamlit/static/static/js/index.D-9nQW74.js +1 -0
  40. streamlit/static/static/js/{index.C2VChsA1.js → index.D5wciRNz.js} +1 -1
  41. streamlit/static/static/js/{index.lCzpOFcS.js → index.D9bqDCB_.js} +18 -18
  42. streamlit/static/static/js/index.DC6PJYZU.js +1 -0
  43. streamlit/static/static/js/index.DMreumKF.js +1 -0
  44. streamlit/static/static/js/{index.DgCaLwAb.js → index.DTP3exjF.js} +1 -1
  45. streamlit/static/static/js/index.DV46EgCO.js +201 -0
  46. streamlit/static/static/js/{index.BiCX2JZK.js → index.DZ_FHOJd.js} +1 -1
  47. streamlit/static/static/js/{index.DvUg88R_.js → index.DcXXaGYK.js} +1 -1
  48. streamlit/static/static/js/index.DjTdTgti.js +197 -0
  49. streamlit/static/static/js/{index.BhKdTR4z.js → index.DkwDCuk1.js} +1 -1
  50. streamlit/static/static/js/index.DyyHt_xV.js +1 -0
  51. streamlit/static/static/js/index.Hnms5TSS.js +1 -0
  52. streamlit/static/static/js/{index.BBotNZr-.js → index.JgS0whqe.js} +1 -1
  53. streamlit/static/static/js/{index.BrXMfzqp.js → index.T5vKsEVA.js} +1 -1
  54. streamlit/static/static/js/{index.BXFE-6NA.js → index.UrE-Phqy.js} +1 -1
  55. streamlit/static/static/js/index.bDDanN90.js +2 -0
  56. streamlit/static/static/js/{index.C5zcxetk.js → index.exPoJHIW.js} +1 -1
  57. streamlit/static/static/js/index.pWHQEj0Q.js +1 -0
  58. streamlit/static/static/js/index.qC8qMz0q.js +3865 -0
  59. streamlit/static/static/js/{index.DO1Rv491.js → index.rECpAXqX.js} +1 -1
  60. streamlit/static/static/js/{input.DqK048_c.js → input.mCBQrtCY.js} +2 -2
  61. streamlit/static/static/js/{memory.BYwXutbg.js → memory.Te_zHgq3.js} +1 -1
  62. streamlit/static/static/js/{mergeWith.CwfhUp-s.js → mergeWith.Di9Yv3PE.js} +1 -1
  63. streamlit/static/static/js/number-overlay-editor.Du6B2U8c.js +9 -0
  64. streamlit/static/static/js/{possibleConstructorReturn.CCjgmGB4.js → possibleConstructorReturn.DqqPe-iu.js} +1 -1
  65. streamlit/static/static/js/{sandbox.CzVH3fBX.js → sandbox.iqWXuowq.js} +1 -1
  66. streamlit/static/static/js/{textarea.D47OO5VD.js → textarea.DUN7d2zN.js} +2 -2
  67. streamlit/static/static/js/{timepicker.Dq2FqiYO.js → timepicker.BkmEJ-b8.js} +4 -4
  68. streamlit/static/static/js/{toConsumableArray.7OyX1dIj.js → toConsumableArray.D4OFzlWy.js} +1 -1
  69. streamlit/static/static/js/uniqueId.6OlKTkzK.js +1 -0
  70. streamlit/static/static/js/{useBasicWidgetState.DH0ClB0l.js → useBasicWidgetState.Btr3rzhN.js} +1 -1
  71. streamlit/static/static/js/{useOnInputChange.3GZT2mEx.js → useOnInputChange.BM7LVpC-.js} +1 -1
  72. streamlit/static/static/js/withFullScreenWrapper.BCTIo1o2.js +1 -0
  73. streamlit/user_info.py +12 -14
  74. {streamlit_nightly-1.42.3.dev20250223.dist-info → streamlit_nightly-1.42.3.dev20250225.dist-info}/METADATA +1 -1
  75. {streamlit_nightly-1.42.3.dev20250223.dist-info → streamlit_nightly-1.42.3.dev20250225.dist-info}/RECORD +79 -78
  76. {streamlit_nightly-1.42.3.dev20250223.dist-info → streamlit_nightly-1.42.3.dev20250225.dist-info}/WHEEL +1 -1
  77. streamlit/static/static/js/FileDropzone.uWzTac7M.js +0 -5
  78. streamlit/static/static/js/data-grid-overlay-editor.BrHDbHOn.js +0 -1
  79. streamlit/static/static/js/index.B66JaJi3.js +0 -1
  80. streamlit/static/static/js/index.BUnE-2Mi.js +0 -201
  81. streamlit/static/static/js/index.BxBwZJQr.js +0 -1
  82. streamlit/static/static/js/index.CNYNhiEk.js +0 -1
  83. streamlit/static/static/js/index.CUKOkOB2.js +0 -197
  84. streamlit/static/static/js/index.Ceuq3IzZ.js +0 -1
  85. streamlit/static/static/js/index.ChSsIvr7.js +0 -3865
  86. streamlit/static/static/js/index.DKFH0WYB.js +0 -1
  87. streamlit/static/static/js/index.DQT0NMTW.js +0 -1
  88. streamlit/static/static/js/index.D_tVZ0u0.js +0 -2
  89. streamlit/static/static/js/index.Da7VTJGp.js +0 -9
  90. streamlit/static/static/js/index.DiXeiIyQ.js +0 -1
  91. streamlit/static/static/js/index.Dl_RyApM.js +0 -1
  92. streamlit/static/static/js/number-overlay-editor.B-1TJraW.js +0 -9
  93. streamlit/static/static/js/uniqueId.naIyoATl.js +0 -1
  94. streamlit/static/static/js/withFullScreenWrapper.HzikaPlG.js +0 -1
  95. {streamlit_nightly-1.42.3.dev20250223.data → streamlit_nightly-1.42.3.dev20250225.data}/scripts/streamlit.cmd +0 -0
  96. {streamlit_nightly-1.42.3.dev20250223.dist-info → streamlit_nightly-1.42.3.dev20250225.dist-info}/entry_points.txt +0 -0
  97. {streamlit_nightly-1.42.3.dev20250223.dist-info → streamlit_nightly-1.42.3.dev20250225.dist-info}/top_level.txt +0 -0
@@ -1 +0,0 @@
1
- import{r as p,E as V,_ as z,n as I,C as u,j as r,b4 as U,bo as g,co as E,bp as y,cp as L,aY as B,F as k,bh as W,R as N,az as T,bj as D,K as h,bl as H,bk as A,br as R,bE as $,bs as O,b9 as X,bt as _}from"./index.6zGrdP7S.js";import{a as S}from"./index.DW_MHI2K.js";import{F as K}from"./FormClearHelper.CEl0YyS3.js";import{S as x,I as j,b as q,c as G,d as Y,C as J,e as Q,f as Z,h as ee,i as te,g as b,F as f,j as se,k as ie,l as le,s as ae,m as re,n as ne}from"./FileDropzone.uWzTac7M.js";import{S as oe,P as de}from"./ProgressBar.DDliFXvs.js";import{u as ce}from"./Hooks.B_-0sclb.js";import{U as m}from"./UploadFileInfo.C-jY39rj.js";var C=p.forwardRef(function(l,o){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return p.createElement(V,z({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},l,{ref:o}),p.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});C.displayName="Error";const pe=I("div",{target:"egc9vxm0"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:l.spacing.twoXS,marginBottom:l.spacing.twoXS})),ue=I("div",{target:"egc9vxm1"})(({theme:l})=>({display:"flex",alignItems:"center",justifyContent:"center",color:l.colors.fadedText40})),he=({currentPage:l,totalPages:o,onNext:e,onPrevious:t})=>u(pe,{"data-testid":"stFileUploaderPagination",children:[r(x,{children:`Showing page ${l} of ${o}`}),u(ue,{children:[r(y,{onClick:t,kind:U.MINIMAL,children:r(g,{content:E,size:"xl"})}),r(y,{onClick:e,kind:U.MINIMAL,children:r(g,{content:L,size:"xl"})})]})]}),w=(l,o)=>Math.ceil(l.length/o),ge=l=>B(({pageSize:e,items:t,resetOnAdd:s,...a})=>{const[i,n]=p.useState(0),[d,F]=p.useState(w(t,e)),c=ce(t);p.useEffect(()=>{c&&c.length!==t.length&&F(w(t,e)),c&&c.length<t.length?s&&n(0):i+1>=d&&n(d-1)},[t,i,e,c,s,d]);const v=()=>{n(Math.min(i+1,d-1))},M=()=>{n(Math.max(0,i-1))},P=t.slice(i*e,i*e+e);return u(k,{children:[r(l,{items:P,...a}),t.length>e?r(he,{pageSize:e,totalPages:d,currentPage:i+1,onNext:v,onPrevious:M}):null]})},l),me=({fileInfo:l})=>l.status.type==="uploading"?r(de,{value:l.status.progress,size:oe.SMALL}):l.status.type==="error"?u(te,{children:[r(Z,{"data-testid":"stFileUploaderFileErrorMessage",children:l.status.errorMessage}),r(ee,{children:r(g,{content:C,size:"lg"})})]}):l.status.type==="uploaded"?r(x,{children:b(l.size,f.Byte)}):null,fe=({fileInfo:l,onDelete:o})=>u(Q,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[r(q,{children:r(g,{content:j,size:"twoXL"})}),u(G,{className:"stFileUploaderFileData",children:[r(Y,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:l.name,children:l.name}),r(me,{fileInfo:l})]}),r("div",{"data-testid":"stFileUploaderDeleteBtn",children:r(y,{onClick:()=>o(l.id),kind:U.MINIMAL,children:r(g,{content:J,size:"lg"})})})]}),Fe=({items:l,onDelete:o})=>r(le,{children:l.map(e=>r(ie,{children:r(fe,{fileInfo:e,onDelete:o})},e.id))}),Ue=ge(Fe),ye=l=>r(se,{children:r(Ue,{...l})});class Se extends N.PureComponent{constructor(o){super(o),this.formClearHelper=new K,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const e=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:a}=this.props,i=s.getFileUploaderStateValue(t);T(e,i)||s.setFileUploaderStateValue(t,e,{fromUi:!0},a)},this.reset=()=>{this.setState({files:[]})},this.dropHandler=(e,t)=>{const{element:s}=this.props,{multipleFiles:a}=s;if(!a&&e.length===0&&t.length>1){const i=t.findIndex(n=>n.errors.length===1&&n.errors[0].code==="too-many-files");i>=0&&(e.push(t[i].file),t.splice(i,1))}if(this.props.uploadClient.fetchFileURLs(e).then(i=>{if(!a&&e.length>0){const n=this.state.files.find(d=>d.status.type!=="error");n&&(this.forceUpdatingStatus=!0,this.deleteFile(n.id),this.forceUpdatingStatus=!1)}D(i,e).forEach(([n,d])=>{this.uploadFile(n,d)})}).catch(i=>{this.addFiles(e.map(n=>new m(n.name,n.size,this.nextLocalFileId(),{type:"error",errorMessage:i})))}),t.length>0){const i=t.map(n=>{const{file:d}=n;return new m(d.name,d.size,this.nextLocalFileId(),{type:"error",errorMessage:this.getErrorMessage(n.errors[0].code,n.file)})});this.addFiles(i)}},this.uploadFile=(e,t)=>{const s=S.CancelToken.source(),a=new m(t.name,t.size,this.nextLocalFileId(),{type:"uploading",cancelToken:s,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,e.uploadUrl,t,i=>this.onUploadProgress(i,a.id),s.token).then(()=>this.onUploadComplete(a.id,e)).catch(i=>{S.isCancel(i)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:i?i.toString():"Unknown error"}))})},this.onUploadComplete=(e,t)=>{const s=this.getFile(e);h(s)||s.status.type!=="uploading"||this.updateFile(s.id,s.setStatus({type:"uploaded",fileId:t.fileId,fileUrls:t}))},this.getErrorMessage=(e,t)=>{switch(e){case"file-too-large":return`File must be ${b(this.maxUploadSizeInBytes,f.Byte)} or smaller.`;case"file-invalid-type":return`${t.type} files are not allowed.`;case"file-too-small":return"File size is too small.";case"too-many-files":return"Only one file is allowed.";default:return"Unexpected error. Please try again."}},this.deleteFile=e=>{const t=this.getFile(e);h(t)||(t.status.type==="uploading"&&t.status.cancelToken.cancel(),t.status.type==="uploaded"&&t.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(t.status.fileUrls.deleteUrl),this.removeFile(e))},this.addFile=e=>{this.setState(t=>({files:[...t.files,e]}))},this.addFiles=e=>{this.setState(t=>({files:[...t.files,...e]}))},this.removeFile=e=>{this.setState(t=>({files:t.files.filter(s=>s.id!==e)}))},this.getFile=e=>this.state.files.find(t=>t.id===e),this.updateFile=(e,t)=>{this.setState(s=>({files:s.files.map(a=>a.id===e?t:a)}))},this.onUploadProgress=(e,t)=>{const s=this.getFile(t);if(h(s)||s.status.type!=="uploading")return;const a=Math.round(e.loaded*100/e.total);s.status.progress!==a&&this.updateFile(t,s.setStatus({type:"uploading",cancelToken:s.status.cancelToken,progress:a}))},this.onFormCleared=()=>{this.setState({files:[]},()=>{const e=this.createWidgetValue();if(h(e))return;const{widgetMgr:t,element:s,fragmentId:a}=this.props;t.setFileUploaderStateValue(s,e,{fromUi:!0},a)})},this.state=this.initialValue}get initialValue(){const o={files:[],newestServerFileId:0},{widgetMgr:e,element:t}=this.props,s=e.getFileUploaderStateValue(t);if(h(s))return o;const{uploadedFileInfo:a}=s;return h(a)||a.length===0?o:{files:a.map(i=>{const n=i.name,d=i.size,F=i.fileId,c=i.fileUrls;return new m(n,d,this.nextLocalFileId(),{type:"uploaded",fileId:F,fileUrls:c})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const o=this.props.element.maxUploadSizeMb;return ae(o,f.Megabyte,f.Byte)}get status(){const o=e=>e.status.type==="uploading";return this.state.files.some(o)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const o=this.createWidgetValue(),{element:e,widgetMgr:t,fragmentId:s}=this.props;t.getFileUploaderStateValue(e)===void 0&&t.setFileUploaderStateValue(e,o,{fromUi:!1},s)}createWidgetValue(){const o=this.state.files.filter(e=>e.status.type==="uploaded").map(e=>{const{name:t,size:s,status:a}=e,{fileId:i,fileUrls:n}=a;return new H({fileId:i,fileUrls:n,name:t,size:s})});return new A({uploadedFileInfo:o})}render(){var d;const{files:o}=this.state,{element:e,disabled:t,widgetMgr:s,width:a}=this.props,i=e.type;this.formClearHelper.manageFormClearListener(s,e.formId,this.onFormCleared);const n=o.slice().reverse();return u(ne,{className:"stFileUploader","data-testid":"stFileUploader",width:a,children:[r(_,{label:e.label,disabled:t,labelVisibility:R((d=e.labelVisibility)==null?void 0:d.value),children:e.help&&r($,{children:r(O,{content:e.help,placement:X.TOP_RIGHT})})}),r(re,{onDrop:this.dropHandler,multiple:e.multipleFiles,acceptedExtensions:i,maxSizeBytes:this.maxUploadSizeInBytes,label:e.label,disabled:t}),n.length>0&&r(ye,{items:n,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0})]})}nextLocalFileId(){return this.localFileIdCounter++}}const Pe=W(p.memo(Se));export{Pe as default};
@@ -1 +0,0 @@
1
- import{r as s,E as N,_ as $,n as u,D as ht,y as Y,j as n,b9 as J,bu as ft,C as S,bp as Q,b4 as Z,bo as U,a_ as mt,bF as yt,bj as vt,bG as I,bs as wt,F as tt,bg as Ct,bH as It,K as B,bl as bt,bk as xt}from"./index.6zGrdP7S.js";import{g as St,F as zt,C as Ft,I as Et,E as Ut,u as Ht,a as Tt}from"./FileDropzone.uWzTac7M.js";import{I as Dt}from"./InputInstructions.M8GsfWtP.js";import{i as kt}from"./inputUtils.CQWz5UKz.js";import{a as G}from"./index.DW_MHI2K.js";import{U as V}from"./UploadFileInfo.C-jY39rj.js";import{T as Bt}from"./textarea.D47OO5VD.js";import"./base-input.Dz6cKnV_.js";var et=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(N,$({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),s.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});et.displayName="AttachFile";var ot=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(N,$({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))});ot.displayName="ErrorOutline";var nt=s.forwardRef(function(t,e){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return s.createElement(N,$({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),s.createElement("rect",{width:24,height:24,fill:"none"}),s.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});nt.displayName="Send";const Rt=u("div",{target:"e1djkbjp0"})("border:none;position:relative;display:flex;"),Lt=u("div",{target:"e1djkbjp1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.transparent,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,position:"relative",flexGrow:1,display:"flex",alignItems:"center",paddingLeft:t.spacing.lg,maxHeight:e?"none":t.sizes.minElementHeight,gap:t.spacing.sm,overflow:"hidden",":focus-within":{borderColor:t.colors.primary}})),Mt=u("button",{target:"e1djkbjp2"})(({theme:t,disabled:e,extended:l})=>{const d=ht(t),[f,g]=d?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:l?"0":t.radii.chatInput,borderTopLeftRadius:l?t.radii.default:"0",borderBottomRightRadius:t.radii.chatInput,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:e?f:g,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:d?t.colors.gray10:t.colors.gray90},"&:hover":{color:t.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray,cursor:"not-allowed"}}}),Vt=u("div",{target:"e1djkbjp3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),Nt=u("div",{target:"e1djkbjp4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),$t=u("div",{target:"ewqvugz0"})(({theme:t,height:e})=>({backgroundColor:t.colors.transparent,position:"absolute",left:0,bottom:0,minHeight:`max(${t.sizes.emptyDropdownHeight}, ${e})`,width:"100%",zIndex:t.zIndices.priority})),At=u("div",{target:"ewqvugz1"})(({theme:t,height:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.primary,borderRadius:t.radii.chatInput,backgroundColor:t.colors.secondaryBg,color:t.colors.primary,display:"flex",alignItems:"center",justifyContent:"center",height:e,width:"100%",fontWeight:t.fontWeights.bold})),Wt=u("div",{target:"ewqvugz2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),qt=u("div",{target:"ewqvugz3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Pt=u("div",{target:"ewqvugz4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),jt=u("div",{target:"ewqvugz5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Kt=u("div",{target:"ewqvugz6"})(({})=>({display:"flex"})),Ot=u("div",{target:"ewqvugz7"})(({})=>({flex:"0 0 auto"})),_t=u("div",{target:"ewqvugz8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Xt=u("div",{target:"ewqvugz9"})(({theme:t})=>({color:t.colors.fadedText60})),Gt=u("div",{target:"ewqvugz10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Yt=u("div",{target:"ewqvugz11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Jt=u("small",{target:"ewqvugz12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function Qt({children:t,content:e}){const l=Y();return n(ft,{content:e,placement:J.TOP,overrides:{Body:{style:{top:`-${l.sizes.minElementHeight}`}}},children:t})}const Zt=({fileInfo:t})=>{const{type:e}=t.status;switch(e){case"uploading":return n(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(Qt,{content:t.status.errorMessage,children:n(U,{content:ot,size:"lg"})});case"uploaded":return n(U,{content:Et,size:"lg"});default:return mt(e),null}},te=({fileInfo:t,onDelete:e})=>S(_t,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(Xt,{children:n(Zt,{fileInfo:t})}),n(Gt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(Yt,{children:St(t.size,zt.Byte)}),n(Jt,{"data-testid":"stChatInputDeleteBtn",children:n(Q,{onClick:()=>e(t.id),kind:Z.MINIMAL,children:n(U,{content:Ft,size:"lg"})})})]}),ee=({items:t,onDelete:e})=>n(jt,{"data-testid":"stChatUploadedFiles",children:n(Kt,{children:t.map(l=>n(Ot,{children:n(te,{fileInfo:l,onDelete:e})},l.id))})}),oe=({getNextLocalFileId:t,addFiles:e,updateFile:l,uploadClient:d,element:f,onUploadProgress:g,onUploadComplete:m})=>(v,h)=>{const y=G.CancelToken.source(),c=new V(h.name,h.size,t(),{type:"uploading",cancelToken:y,progress:1});e([c]),d.uploadFile({formId:"",...f},v.uploadUrl,h,p=>g(p,c.id),y.token).then(()=>m(c.id,v)).catch(p=>{G.isCancel(p)||l(c.id,c.setStatus({type:"error",errorMessage:p?p.toString():"Unknown error"}))})},ne=({acceptMultipleFiles:t,uploadClient:e,uploadFile:l,addFiles:d,getNextLocalFileId:f,deleteExistingFiles:g,onUploadComplete:m})=>(v,h)=>{if(!t&&v.length===0&&h.length>1){const y=h.findIndex(c=>{var p;return((p=c.errors)==null?void 0:p[0].code)===Ut.TooManyFiles});y>=0&&(v.push(h[y].file),h.splice(y,1))}if(!t&&v.length>0&&g(),e.fetchFileURLs(v).then(y=>{vt(y,v).forEach(([c,p])=>{l(c,p)})}).catch(y=>{d(v.map(c=>new V(c.name,c.size,f(),{type:"error",errorMessage:y})))}),h.length>0){const y=h.map(c=>new V(c.file.name,c.file.size,f(),{type:"error",errorMessage:c.errors.map(p=>p.message).filter(p=>!!p).join(", ")}));d(y)}m()},re=({getRootProps:t,getInputProps:e,acceptFile:l,disabled:d,theme:f})=>S(Wt,{disabled:d,children:[S(qt,{"data-testid":"stChatInputFileUploadButton",disabled:d,...t(),children:[n("input",{...e()}),n(wt,{content:`Upload or drag and drop ${l===I.Multiple?"files":"a file"}`,placement:J.TOP,onMouseEnterDelay:500,children:n(Q,{kind:Z.MINIMAL,disabled:d,children:n(U,{content:et,size:"lg",color:d?f.colors.fadedText40:f.colors.fadedText60})})})]}),n(Pt,{})]}),ae=({getRootProps:t,getInputProps:e,acceptFile:l,inputHeight:d})=>S(tt,{children:[n($t,{height:d,...t(),children:n("input",{...e()})}),n(At,{height:d,children:`Drag and drop ${l===I.Multiple?"files":"a file"} here`})]}),ie=6.5,R=1,L=(t,e,l)=>l.map(d=>d.id===t?e:d),M=(t,e)=>e.find(l=>l.id===t);function se({disabled:t,element:e,widgetMgr:l,fragmentId:d,uploadClient:f}){const g=Y(),m=s.useRef(null),v=s.useRef(0),h=s.useRef({minHeight:0,maxHeight:0}),{values:[y],elementRef:c}=Ct(s.useMemo(()=>["width"],[])),[p,T]=s.useState(!1),[z,D]=s.useState(e.default),[F,A]=s.useState(0),[H,rt]=s.useState(!1),[b,x]=s.useState([]),[E,k]=s.useState(!1),C=It(e.acceptFile),W=s.useCallback(o=>x(r=>[...r,...o]),[]),q=s.useCallback(o=>{x(r=>{const i=M(o,r);return B(i)?r:(i.status.type==="uploading"&&i.status.cancelToken.cancel(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&f.deleteFile(i.status.fileUrls.deleteUrl),r.filter(a=>a.id!==o))})},[f]),at=()=>{const o=b.filter(r=>r.status.type==="uploaded").map(r=>{const{name:i,size:a,status:w}=r,{fileId:ut,fileUrls:gt}=w;return new bt({fileId:ut,fileUrls:gt,name:i,size:a})});return new xt({uploadedFileInfo:o})},P=()=>v.current++,it=ne({acceptMultipleFiles:C===I.Multiple,uploadClient:f,uploadFile:oe({getNextLocalFileId:P,addFiles:W,updateFile:(o,r)=>{x(i=>L(o,r,i))},uploadClient:f,element:e,onUploadProgress:(o,r)=>{x(i=>{const a=M(r,i);if(B(a)||a.status.type!=="uploading")return i;const w=Math.round(o.loaded*100/o.total);return a.status.progress===w?i:L(r,a.setStatus({type:"uploading",cancelToken:a.status.cancelToken,progress:w}),i)})},onUploadComplete:(o,r)=>{x(i=>{const a=M(o,i);return B(a)||a.status.type!=="uploading"?i:L(a.id,a.setStatus({type:"uploaded",fileId:r.fileId,fileUrls:r}),i)})}}),addFiles:W,getNextLocalFileId:P,deleteExistingFiles:()=>b.forEach(o=>q(o.id)),onUploadComplete:()=>{m.current&&m.current.focus()}}),{getRootProps:j,getInputProps:K}=Ht({onDrop:it,multiple:C===I.Multiple,accept:Tt(e.fileType)}),st=()=>{let o=0;const{current:r}=m;if(r){const i=r.placeholder;r.placeholder="",r.style.height="auto",o=r.scrollHeight,r.placeholder=i,r.style.height=""}return o},O=()=>{if(m.current&&m.current.focus(),!p||t)return;const o={data:z,fileUploaderState:at()};l.setChatInputValue(e,o,{fromUi:!0},d),T(!1),x([]),D(""),A(0)},lt=o=>{const{metaKey:r,ctrlKey:i,shiftKey:a}=o;kt(o)&&!a&&!i&&!r&&(o.preventDefault(),O())},dt=o=>{const{value:r}=o.target,{maxChars:i}=e;i!==0&&r.length>i||(D(r),A(st()))};s.useEffect(()=>b.some(o=>o.status.type==="uploading")?T(!1):T(z!==""||b.length>0),[b,z]),s.useEffect(()=>{if(e.setValue){e.setValue=!1;const o=e.value||"";D(o)}},[e]),s.useEffect(()=>{if(m.current){const{offsetHeight:o}=m.current;h.current.minHeight=o,h.current.maxHeight=o*ie}},[m]),s.useEffect(()=>{const o=a=>{var w;a.preventDefault(),a.stopPropagation(),!E&&((w=a.dataTransfer)!=null&&w.types.includes("Files"))&&k(!0)},r=a=>{a.preventDefault(),a.stopPropagation(),E&&(a.clientX<=0&&a.clientY<=0||a.clientX>=window.innerWidth&&a.clientY>=window.innerHeight)&&k(!1)},i=a=>{a.preventDefault(),a.stopPropagation(),E&&k(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",i),window.addEventListener("dragleave",r),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",i),window.removeEventListener("dragleave",r)}},[E]),s.useEffect(()=>{const{minHeight:o}=h.current;rt(F>0&&m.current?Math.abs(F-o)>R:!1)},[F]);const{placeholder:_,maxChars:ct}=e,{maxHeight:X}=h.current,pt=C!==I.None&&E;return S(tt,{children:[C===I.None?null:n(ee,{items:[...b],onDelete:q}),n(Rt,{className:"stChatInput","data-testid":"stChatInput",ref:c,children:pt?n(ae,{getRootProps:j,getInputProps:K,acceptFile:C,inputHeight:H?`${F+R}px`:g.sizes.minElementHeight}):S(Lt,{extended:H,children:[C===I.None?null:n(re,{getRootProps:j,getInputProps:K,acceptFile:C,disabled:t,theme:g}),n(Bt,{inputRef:m,value:z,placeholder:_,onChange:dt,onKeyDown:lt,"aria-label":_,disabled:t,rows:1,overrides:{Root:{style:{minHeight:g.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:g.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:H?`${F+R}px`:"auto",maxHeight:X?`${X}px`:"none",paddingLeft:g.spacing.none,paddingBottom:g.spacing.sm,paddingTop:g.spacing.sm,paddingRight:`calc(${g.iconSizes.xl} + 2 * ${g.spacing.sm} + ${g.spacing.sm})`}}}}),y>g.breakpoints.hideWidgetDetails&&n(Nt,{children:n(Dt,{dirty:p,value:z,maxLength:ct,type:"chat",inForm:!1})}),n(Vt,{children:n(Mt,{onClick:O,disabled:!p||t,extended:H,"data-testid":"stChatInputSubmitButton",children:n(U,{content:nt,size:"xl",color:"inherit"})})})]})})]})}const me=s.memo(se);export{me as default};
@@ -1,2 +0,0 @@
1
- import{d as Ge,bv as J,r as C,bY as mt,bI as bt,bw as G,bZ as yt,b_ as Tt,n as me,aw as kt,bh as Ot,y as wt,aK as Rt,C as Ve,j as re,R as ze,cm as St,br as Mt,bE as _t,bs as $t,b9 as Et,bt as It,O as Ct,cn as $e}from"./index.6zGrdP7S.js";import{s as Ne}from"./sprintf.D7DtBTRn.js";import{a as xt}from"./useBasicWidgetState.DH0ClB0l.js";import"./FormClearHelper.CEl0YyS3.js";var se={},H={},ue={},ce={},Ue;function Ie(){if(Ue)return ce;Ue=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.Direction=void 0;var e;return function(r){r.Right="to right",r.Left="to left",r.Down="to bottom",r.Up="to top"}(e||(ce.Direction=e={})),ce}var He;function Je(){return He||(He=1,function(e){var r=ue&&ue.__spreadArray||function(i,o,u){if(u||arguments.length===2)for(var h=0,b=o.length,g;h<b;h++)(g||!(h in o))&&(g||(g=Array.prototype.slice.call(o,0,h)),g[h]=o[h]);return i.concat(g||Array.prototype.slice.call(o))};Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.useThumbOverlap=e.assertUnreachable=e.voidFn=e.getTrackBackground=e.replaceAt=e.schd=e.translate=e.getClosestThumbIndex=e.translateThumbs=e.getPaddingAndBorder=e.getMargin=e.checkInitialOverlap=e.checkValuesAgainstBoundaries=e.checkBoundaries=e.isVertical=e.relativeValue=e.normalizeValue=e.isStepDivisible=e.isTouchEvent=e.getStepDecimals=void 0;var a=Ge(),s=Ie(),p=function(i){var o=i.toString().split(".")[1];return o?o.length:0};e.getStepDecimals=p;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function c(i,o,u){var h=(o-i)/u,b=8,g=Number(h.toFixed(b));return parseInt(g.toString(),10)===g}e.isStepDivisible=c;function f(i,o,u,h,b,g,O){var _=1e11;if(i=Math.round(i*_)/_,!g){var P=O[o-1],I=O[o+1];if(P&&P>i)return P;if(I&&I<i)return I}if(i>h)return h;if(i<u)return u;var U=Math.floor(i*_-u*_)%Math.floor(b*_),z=Math.floor(i*_-Math.abs(U)),W=U===0?i:z/_,A=Math.abs(U/_)<b/2?W:W+b,L=(0,e.getStepDecimals)(b);return parseFloat(A.toFixed(L))}e.normalizeValue=f;function j(i,o,u){return(i-o)/(u-o)}e.relativeValue=j;function F(i){return i===s.Direction.Up||i===s.Direction.Down}e.isVertical=F;function B(i,o,u){if(o>=u)throw new RangeError("min (".concat(o,") is equal/bigger than max (").concat(u,")"));if(i<o)throw new RangeError("value (".concat(i,") is smaller than min (").concat(o,")"));if(i>u)throw new RangeError("value (".concat(i,") is bigger than max (").concat(u,")"))}e.checkBoundaries=B;function $(i,o,u){return i<o?o:i>u?u:i}e.checkValuesAgainstBoundaries=$;function T(i){if(!(i.length<2)&&!i.slice(1).every(function(o,u){return i[u]<=o}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=T;function d(i){var o=window.getComputedStyle(i);return{top:parseInt(o["margin-top"],10),bottom:parseInt(o["margin-bottom"],10),left:parseInt(o["margin-left"],10),right:parseInt(o["margin-right"],10)}}e.getMargin=d;function t(i){var o=window.getComputedStyle(i);return{top:parseInt(o["padding-top"],10)+parseInt(o["border-top-width"],10),bottom:parseInt(o["padding-bottom"],10)+parseInt(o["border-bottom-width"],10),left:parseInt(o["padding-left"],10)+parseInt(o["border-left-width"],10),right:parseInt(o["padding-right"],10)+parseInt(o["border-right-width"],10)}}e.getPaddingAndBorder=t;function n(i,o,u){var h=u?-1:1;i.forEach(function(b,g){return v(b,h*o[g].x,o[g].y)})}e.translateThumbs=n;function l(i,o,u,h){for(var b=0,g=x(i[0],o,u,h),O=1;O<i.length;O++){var _=x(i[O],o,u,h);_<g&&(g=_,b=O)}return b}e.getClosestThumbIndex=l;function v(i,o,u){i.style.transform="translate(".concat(o,"px, ").concat(u,"px)")}e.translate=v;var y=function(i){var o=[],u=null,h=function(){for(var b=[],g=0;g<arguments.length;g++)b[g]=arguments[g];o=b,!u&&(u=requestAnimationFrame(function(){u=null,i.apply(void 0,o)}))};return h};e.schd=y;function k(i,o,u){var h=i.slice(0);return h[o]=u,h}e.replaceAt=k;function E(i){var o=i.values,u=i.colors,h=i.min,b=i.max,g=i.direction,O=g===void 0?s.Direction.Right:g,_=i.rtl,P=_===void 0?!1:_;P&&O===s.Direction.Right?O=s.Direction.Left:P&&s.Direction.Left&&(O=s.Direction.Right);var I=o.slice(0).sort(function(z,W){return z-W}).map(function(z){return(z-h)/(b-h)*100}),U=I.reduce(function(z,W,A){return"".concat(z,", ").concat(u[A]," ").concat(W,"%, ").concat(u[A+1]," ").concat(W,"%")},"");return"linear-gradient(".concat(O,", ").concat(u[0]," 0%").concat(U,", ").concat(u[u.length-1]," 100%)")}e.getTrackBackground=E;function w(){}e.voidFn=w;function R(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=R;var M=function(i,o,u,h,b){b===void 0&&(b=function(O){return O});var g=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(O,_){var P=Math.ceil(_.getBoundingClientRect().width);if(_.innerText&&_.innerText.includes(u)&&_.childElementCount===0){var I=_.cloneNode(!0);I.innerHTML=b(o.toFixed(h)),I.style.visibility="hidden",document.body.appendChild(I),P=Math.ceil(I.getBoundingClientRect().width),document.body.removeChild(I)}return P>O?P:O},i.getBoundingClientRect().width));return g},D=function(i,o,u,h,b,g,O){O===void 0&&(O=function(I){return I});var _=[],P=function(I){var U=M(u[I],h[I],b,g,O),z=o[I].x;o.forEach(function(W,A){var L=W.x,X=M(u[A],h[A],b,g,O);I!==A&&(z>=L&&z<=L+X||z+U>=L&&z+U<=L+X)&&(_.includes(A)||(_.push(I),_.push(A),_=r(r([],_,!0),[I,A],!1),P(A)))})};return P(i),Array.from(new Set(_.sort()))},m=function(i,o,u,h,b,g){h===void 0&&(h=.1),b===void 0&&(b=" - "),g===void 0&&(g=function(A){return A});var O=(0,e.getStepDecimals)(h),_=(0,a.useState)({}),P=_[0],I=_[1],U=(0,a.useState)(g(o[u].toFixed(O))),z=U[0],W=U[1];return(0,a.useEffect)(function(){if(i){var A=i.getThumbs();if(A.length<1)return;var L={},X=i.getOffsets(),ne=D(u,X,A,o,b,O,g),le=g(o[u].toFixed(O));if(ne.length){var Q=ne.reduce(function(ee,oe,ge,pe){return ee.length?r(r([],ee,!0),[X[pe[ge]].x],!1):[X[pe[ge]].x]},[]);if(Math.min.apply(Math,Q)===X[u].x){var de=[];ne.forEach(function(ee){de.push(o[ee].toFixed(O))}),le=Array.from(new Set(de.sort(function(ee,oe){return parseFloat(ee)-parseFloat(oe)}))).map(g).join(b);var fe=Math.min.apply(Math,Q),he=Math.max.apply(Math,Q),_e=A[ne[Q.indexOf(he)]].getBoundingClientRect().width;L.left="".concat(Math.abs(fe-(he+_e))/2,"px"),L.transform="translate(-50%, 0)"}else L.visibility="hidden"}W(le),I(L)}},[i,o]),[z,P]};e.useThumbOverlap=m;function x(i,o,u,h){var b=i.getBoundingClientRect(),g=b.left,O=b.top,_=b.width,P=b.height;return F(h)?Math.abs(u-(O+P/2)):Math.abs(o-(g+_/2))}var V=function(){var i,o=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(o)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=V}(ue)),ue}var We;function Dt(){if(We)return H;We=1;var e=H&&H.__extends||function(){var $=function(T,d){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])},$(T,d)};return function(T,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");$(T,d);function t(){this.constructor=T}T.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}}(),r=H&&H.__createBinding||(Object.create?function($,T,d,t){t===void 0&&(t=d);var n=Object.getOwnPropertyDescriptor(T,d);(!n||("get"in n?!T.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return T[d]}}),Object.defineProperty($,t,n)}:function($,T,d,t){t===void 0&&(t=d),$[t]=T[d]}),a=H&&H.__setModuleDefault||(Object.create?function($,T){Object.defineProperty($,"default",{enumerable:!0,value:T})}:function($,T){$.default=T}),s=H&&H.__importStar||function($){if($&&$.__esModule)return $;var T={};if($!=null)for(var d in $)d!=="default"&&Object.prototype.hasOwnProperty.call($,d)&&r(T,$,d);return a(T,$),T},p=H&&H.__spreadArray||function($,T,d){if(d||arguments.length===2)for(var t=0,n=T.length,l;t<n;t++)(l||!(t in T))&&(l||(l=Array.prototype.slice.call(T,0,t)),l[t]=T[t]);return $.concat(l||Array.prototype.slice.call(T))};Object.defineProperty(H,"__esModule",{value:!0});var S=s(Ge()),c=Je(),f=Ie(),j=["ArrowRight","ArrowUp","k","PageUp"],F=["ArrowLeft","ArrowDown","j","PageDown"],B=function($){e(T,$);function T(d){var t=$.call(this,d)||this;if(t.trackRef=S.createRef(),t.thumbRefs=[],t.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(t.props.values.length).fill(0).map(function(n,l){return l}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var n=t.props,l=n.direction,v=n.values,y=n.min,k=n.max,E=t.trackRef.current;if(!E)return console.warn("No track element found."),[];var w=E.getBoundingClientRect(),R=(0,c.getPaddingAndBorder)(E);return t.getThumbs().map(function(M,D){var m={x:0,y:0},x=M.getBoundingClientRect(),V=(0,c.getMargin)(M);switch(l){case f.Direction.Right:return m.x=(V.left+R.left)*-1,m.y=((x.height-w.height)/2+R.top)*-1,m.x+=w.width*(0,c.relativeValue)(v[D],y,k)-x.width/2,m;case f.Direction.Left:return m.x=(V.right+R.right)*-1,m.y=((x.height-w.height)/2+R.top)*-1,m.x+=w.width-w.width*(0,c.relativeValue)(v[D],y,k)-x.width/2,m;case f.Direction.Up:return m.x=((x.width-w.width)/2+V.left+R.left)*-1,m.y=-R.left,m.y+=w.height-w.height*(0,c.relativeValue)(v[D],y,k)-x.height/2,m;case f.Direction.Down:return m.x=((x.width-w.width)/2+V.left+R.left)*-1,m.y=-R.left,m.y+=w.height*(0,c.relativeValue)(v[D],y,k)-x.height/2,m;default:return(0,c.assertUnreachable)(l)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.trackRef.current.children).filter(function(n){return n.hasAttribute("aria-valuenow")}):(console.warn("No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?"),[])},t.getTargetIndex=function(n){return t.getThumbs().findIndex(function(l){return l===n.target||l.contains(n.target)})},t.addTouchEvents=function(n){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(n){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(n){var l;if(!(n.button!==0||(0,c.isIOS)()))if(n.persist(),n.preventDefault(),t.addMouseEvents(n.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(y){var k;return(k=y.current)===null||k===void 0?void 0:k.contains(n.target)}))return;t.setState({draggedTrackPos:[n.clientX,n.clientY]},function(){return t.onMove(n.clientX,n.clientY)})}else{var v=(0,c.getClosestThumbIndex)(t.thumbRefs.map(function(y){return y.current}),n.clientX,n.clientY,t.props.direction);(l=t.thumbRefs[v].current)===null||l===void 0||l.focus(),t.setState({draggedThumbIndex:v},function(){return t.onMove(n.clientX,n.clientY)})}},t.onResize=function(){(0,c.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(n){var l;if(n.persist(),t.addTouchEvents(n.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(y){var k;return(k=y.current)===null||k===void 0?void 0:k.contains(n.target)}))return;t.setState({draggedTrackPos:[n.touches[0].clientX,n.touches[0].clientY]},function(){return t.onMove(n.touches[0].clientX,n.touches[0].clientY)})}else{var v=(0,c.getClosestThumbIndex)(t.thumbRefs.map(function(y){return y.current}),n.touches[0].clientX,n.touches[0].clientY,t.props.direction);(l=t.thumbRefs[v].current)===null||l===void 0||l.focus(),t.setState({draggedThumbIndex:v},function(){return t.onMove(n.touches[0].clientX,n.touches[0].clientY)})}},t.onMouseOrTouchStart=function(n){if(!t.props.disabled){var l=(0,c.isTouchEvent)(n);if(!(!l&&n.button!==0)){var v=t.getTargetIndex(n);v!==-1&&(l?t.addTouchEvents(n):t.addMouseEvents(n),t.setState({draggedThumbIndex:v,thumbZIndexes:t.state.thumbZIndexes.map(function(y,k){return k===v?Math.max.apply(Math,t.state.thumbZIndexes):y<=t.state.thumbZIndexes[v]?y:y-1})}))}}},t.onMouseMove=function(n){n.preventDefault(),t.onMove(n.clientX,n.clientY)},t.onTouchMove=function(n){n.preventDefault(),t.onMove(n.touches[0].clientX,n.touches[0].clientY)},t.onKeyDown=function(n){var l=t.props,v=l.values,y=l.onChange,k=l.step,E=l.rtl,w=l.direction,R=t.state.isChanged,M=t.getTargetIndex(n.nativeEvent),D=E||w===f.Direction.Left||w===f.Direction.Down?-1:1;M!==-1&&(j.includes(n.key)?(n.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),y((0,c.replaceAt)(v,M,t.normalizeValue(v[M]+D*(n.key==="PageUp"?k*10:k),M)))):F.includes(n.key)?(n.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),y((0,c.replaceAt)(v,M,t.normalizeValue(v[M]-D*(n.key==="PageDown"?k*10:k),M)))):n.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){R&&t.fireOnFinalChange()}):R&&t.fireOnFinalChange())},t.onKeyUp=function(n){var l=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){l&&t.fireOnFinalChange()})},t.onMove=function(n,l){var v=t.state,y=v.draggedThumbIndex,k=v.draggedTrackPos,E=t.props,w=E.direction,R=E.min,M=E.max,D=E.onChange,m=E.values,x=E.step,V=E.rtl;if(y===-1&&k[0]===-1&&k[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var o=i.getBoundingClientRect(),u=(0,c.isVertical)(w)?o.height:o.width;if(k[0]!==-1&&k[1]!==-1){var h=n-k[0],b=l-k[1],g=0;switch(w){case f.Direction.Right:case f.Direction.Left:g=h/u*(M-R);break;case f.Direction.Down:case f.Direction.Up:g=b/u*(M-R);break;default:(0,c.assertUnreachable)(w)}if(V&&(g*=-1),Math.abs(g)>=x/2){for(var O=0;O<t.thumbRefs.length;O++){if(m[O]===M&&Math.sign(g)===1||m[O]===R&&Math.sign(g)===-1)return;var _=m[O]+g;_>M?g=M-m[O]:_<R&&(g=R-m[O])}for(var P=m.slice(0),O=0;O<t.thumbRefs.length;O++)P=(0,c.replaceAt)(P,O,t.normalizeValue(m[O]+g,O));t.setState({draggedTrackPos:[n,l]}),D(P)}}else{var I=0;switch(w){case f.Direction.Right:I=(n-o.left)/u*(M-R)+R;break;case f.Direction.Left:I=(u-(n-o.left))/u*(M-R)+R;break;case f.Direction.Down:I=(l-o.top)/u*(M-R)+R;break;case f.Direction.Up:I=(u-(l-o.top))/u*(M-R)+R;break;default:(0,c.assertUnreachable)(w)}V&&(I=M+R-I),Math.abs(m[y]-I)>=x/2&&D((0,c.replaceAt)(m,y,t.normalizeValue(I,y)))}},t.normalizeValue=function(n,l){var v=t.props,y=v.min,k=v.max,E=v.step,w=v.allowOverlap,R=v.values;return(0,c.normalizeValue)(n,l,y,k,E,w,R)},t.onEnd=function(n){if(n.preventDefault(),document.removeEventListener("mousemove",t.schdOnMouseMove),document.removeEventListener("touchmove",t.schdOnTouchMove),document.removeEventListener("mouseup",t.schdOnEnd),document.removeEventListener("touchend",t.schdOnEnd),document.removeEventListener("touchcancel",t.schdOnEnd),t.state.draggedThumbIndex===-1&&t.state.draggedTrackPos[0]===-1&&t.state.draggedTrackPos[1]===-1)return null;t.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){t.fireOnFinalChange()})},t.fireOnFinalChange=function(){t.setState({isChanged:!1});var n=t.props,l=n.onFinalChange,v=n.values;l&&l(v)},t.updateMarkRefs=function(n){if(!n.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(n.max-n.min)/t.props.step,t.markRefs=[];for(var l=0;l<t.numOfMarks+1;l++)t.markRefs[l]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var n=window.getComputedStyle(t.trackRef.current),l=parseInt(n.width,10),v=parseInt(n.height,10),y=parseInt(n.paddingLeft,10),k=parseInt(n.paddingTop,10),E=[],w=0;w<t.numOfMarks+1;w++){var R=9999,M=9999;if(t.markRefs[w].current){var D=t.markRefs[w].current.getBoundingClientRect();R=D.height,M=D.width}t.props.direction===f.Direction.Left||t.props.direction===f.Direction.Right?E.push([Math.round(l/t.numOfMarks*w+y-M/2),-Math.round((R-v)/2)]):E.push([Math.round(v/t.numOfMarks*w+k-R/2),-Math.round((M-l)/2)])}t.setState({markOffsets:E})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,c.schd)(t.onMouseMove),t.schdOnTouchMove=(0,c.schd)(t.onTouchMove),t.schdOnEnd=(0,c.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return T.prototype.componentDidMount=function(){var d=this,t=this.props,n=t.values,l=t.min,v=t.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",d.onResize)},unobserve:function(){return window.removeEventListener("resize",d.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,c.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(y){return(0,c.checkBoundaries)(y,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,c.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),n.forEach(function(y){(0,c.isStepDivisible)(l,y,v)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")})},T.prototype.componentDidUpdate=function(d,t){var n=this.props,l=n.max,v=n.min,y=n.step,k=n.values,E=n.rtl;(d.max!==l||d.min!==v||d.step!==y)&&this.updateMarkRefs(this.props),(0,c.translateThumbs)(this.getThumbs(),this.getOffsets(),E),(d.max!==l||d.min!==v||d.step!==y||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),k.forEach(function(w){(0,c.isStepDivisible)(v,w,y)||console.warn("The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.")}))},T.prototype.componentWillUnmount=function(){var d={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,d),document.removeEventListener("mousemove",this.schdOnMouseMove),document.removeEventListener("touchmove",this.schdOnTouchMove),document.removeEventListener("touchstart",this.onMouseOrTouchStart),document.removeEventListener("mouseup",this.schdOnEnd),document.removeEventListener("touchend",this.schdOnEnd),this.resizeObserver.unobserve(this.trackRef.current)},T.prototype.render=function(){var d=this,t=this.props,n=t.label,l=t.labelledBy,v=t.renderTrack,y=t.renderThumb,k=t.renderMark,E=k===void 0?function(){return null}:k,w=t.values,R=t.min,M=t.max,D=t.allowOverlap,m=t.disabled,x=this.state,V=x.draggedThumbIndex,i=x.thumbZIndexes,o=x.markOffsets;return v({props:{style:{transform:"scale(1)",cursor:V>-1?"grabbing":this.props.draggableTrack?(0,c.isVertical)(this.props.direction)?"ns-resize":"ew-resize":w.length===1&&!m?"pointer":"inherit"},onMouseDown:m?c.voidFn:this.onMouseDownTrack,onTouchStart:m?c.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:m,children:p(p([],o.map(function(u,h,b){return E({props:{style:d.props.direction===f.Direction.Left||d.props.direction===f.Direction.Right?{position:"absolute",left:"".concat(u[0],"px"),marginTop:"".concat(u[1],"px")}:{position:"absolute",top:"".concat(u[0],"px"),marginLeft:"".concat(u[1],"px")},key:"mark".concat(h),ref:d.markRefs[h]},index:h})}),!0),w.map(function(u,h){var b=d.state.draggedThumbIndex===h;return y({index:h,value:u,isDragged:b,props:{style:{position:"absolute",zIndex:i[h],cursor:m?"inherit":b?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:h,tabIndex:m?void 0:0,"aria-valuemax":D?M:w[h+1]||M,"aria-valuemin":D?R:w[h-1]||R,"aria-valuenow":u,draggable:!1,ref:d.thumbRefs[h],"aria-label":n,"aria-labelledby":l,role:"slider",onKeyDown:m?c.voidFn:d.onKeyDown,onKeyUp:m?c.voidFn:d.onKeyUp}})}),!0)})},T.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:f.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},T}(S.Component);return H.default=B,H}var qe;function Pt(){return qe||(qe=1,function(e){var r=se&&se.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.checkValuesAgainstBoundaries=e.relativeValue=e.useThumbOverlap=e.Direction=e.getTrackBackground=e.Range=void 0;var a=r(Dt());e.Range=a.default;var s=Je();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return s.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return s.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return s.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return s.checkValuesAgainstBoundaries}});var p=Ie();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return p.Direction}})}(se)),se}var Qe=Pt();function Ke(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(p){return Object.getOwnPropertyDescriptor(e,p).enumerable})),a.push.apply(a,s)}return a}function ve(e){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Ke(Object(a),!0).forEach(function(s){Bt(e,s,a[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Ke(Object(a)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(a,s))})}return e}function Bt(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}var be=J("div",{position:"relative",width:"100%"});be.displayName="Root";be.displayName="Root";be.displayName="StyledRoot";var ye=J("div",function(e){var r=e.$theme,a=e.$value,s=a===void 0?[]:a,p=e.$disabled,S=e.$isDragged,c=r.sizing,f="inherit";return p?f="not-allowed":S?f="grabbing":s.length===1&&(f="pointer"),{paddingTop:c.scale600,paddingBottom:c.scale600,paddingRight:c.scale600,paddingLeft:c.scale600,display:"flex",cursor:f,backgroundColor:r.colors.sliderTrackFill}});ye.displayName="Track";ye.displayName="Track";ye.displayName="StyledTrack";var Te=J("div",function(e){var r=e.$theme,a=e.$value,s=a===void 0?[]:a,p=e.$min,S=e.$max,c=e.$disabled,f=r.colors,j=r.borders,F=r.direction,B=r.borders.useRoundedCorners?j.radius100:0;return{borderTopLeftRadius:B,borderTopRightRadius:B,borderBottomRightRadius:B,borderBottomLeftRadius:B,background:Qe.getTrackBackground({values:s,colors:s.length===1?[c?f.borderOpaque:f.primary,c?f.backgroundSecondary:f.borderOpaque]:[c?f.backgroundSecondary:f.borderOpaque,c?f.borderOpaque:f.primary,c?f.backgroundSecondary:f.borderOpaque],min:p||0,max:S||0,rtl:F==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:c?"not-allowed":"inherit"}});Te.displayName="InnerTrack";Te.displayName="InnerTrack";Te.displayName="StyledInnerTrack";var ke=J("div",function(e){return{width:"4px",height:"2px",backgroundColor:e.$theme.colors.backgroundPrimary,marginLeft:"16px"}});ke.displayName="Mark";ke.displayName="Mark";ke.displayName="StyledMark";var Oe=J("div",function(e){return ve(ve({},e.$theme.typography.font200),{},{color:e.$theme.colors.contentPrimary})});Oe.displayName="Tick";Oe.displayName="Tick";Oe.displayName="StyledTick";var we=J("div",function(e){var r=e.$theme,a=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:a.scale600,paddingLeft:a.scale600,paddingBottom:a.scale400}});we.displayName="TickBar";we.displayName="TickBar";we.displayName="StyledTickBar";var Re=J("div",function(e){var r=e.$theme,a=e.$value,s=a===void 0?[]:a,p=e.$thumbIndex,S=e.$disabled,c=s.length===2&&p===0,f=s.length===2&&p===1;return r.direction==="rtl"&&(f||c)&&(c=!c,f=!f),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:S?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleFill,outline:"none",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(r.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:S?"not-allowed":"inherit"}});Re.displayName="Thumb";Re.displayName="Thumb";Re.displayName="StyledThumb";var Se=J("div",function(e){var r=e.$disabled,a=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?a.colors.sliderHandleFillDisabled:a.colors.sliderHandleInnerFill}});Se.displayName="InnerThumb";Se.displayName="InnerThumb";Se.displayName="StyledInnerThumb";var Me=J("div",function(e){var r=e.$disabled,a=e.$theme;return ve(ve({position:"absolute",top:"-".concat(a.sizing.scale1400)},a.typography.font200),{},{backgroundColor:r?a.colors.sliderHandleFillDisabled:a.colors.sliderHandleInnerFill,color:a.colors.contentInversePrimary,paddingLeft:a.sizing.scale600,paddingRight:a.sizing.scale600,paddingTop:a.sizing.scale500,paddingBottom:a.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Me.displayName="ThumbValue";Me.displayName="ThumbValue";Me.displayName="StyledThumbValue";function Ye(e,r){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(p){return Object.getOwnPropertyDescriptor(e,p).enumerable})),a.push.apply(a,s)}return a}function At(e){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Ye(Object(a),!0).forEach(function(s){Lt(e,s,a[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Ye(Object(a)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(a,s))})}return e}function Lt(e,r,a){return r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a,e}function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},Y.apply(this,arguments)}function K(e,r){return zt(e)||Vt(e,r)||jt(e,r)||Ft()}function Ft(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jt(e,r){if(e){if(typeof e=="string")return Ze(e,r);var a=Object.prototype.toString.call(e).slice(8,-1);if(a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set")return Array.from(e);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Ze(e,r)}}function Ze(e,r){(r==null||r>e.length)&&(r=e.length);for(var a=0,s=new Array(r);a<r;a++)s[a]=e[a];return s}function Vt(e,r){var a=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a!=null){var s=[],p=!0,S=!1,c,f;try{for(a=a.call(e);!(p=(c=a.next()).done)&&(s.push(c.value),!(r&&s.length===r));p=!0);}catch(j){S=!0,f=j}finally{try{!p&&a.return!=null&&a.return()}finally{if(S)throw f}}return s}}function zt(e){if(Array.isArray(e))return e}var Nt=function(r){if(r.length>2||r.length===0)throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");return r};function Ut(e){var r=e.overrides,a=r===void 0?{}:r,s=e.disabled,p=s===void 0?!1:s,S=e.marks,c=S===void 0?!1:S,f=e.onChange,j=f===void 0?function(){}:f,F=e.onFinalChange,B=F===void 0?function(){}:F,$=e.min,T=$===void 0?0:$,d=e.max,t=d===void 0?100:d,n=e.step,l=n===void 0?1:n,v=e.persistentThumb,y=v===void 0?!1:v,k=e.valueToLabel,E=k===void 0?function(Z){return Z}:k,w=e.value,R=C.useContext(mt),M=C.useState(!1),D=K(M,2),m=D[0],x=D[1],V=C.useState(!1),i=K(V,2),o=i[0],u=i[1],h=C.useState(!1),b=K(h,2),g=b[0],O=b[1],_=C.useState(-1),P=K(_,2),I=P[0],U=P[1],z=C.useCallback(function(Z){bt(Z)&&O(!0);var N=Z.target.parentNode.firstChild===Z.target?0:1;U(N)},[]),W=C.useCallback(function(Z){g!==!1&&O(!1),U(-1)},[]),A=Nt(w),L={$disabled:p,$step:l,$min:T,$max:t,$marks:c,$value:A,$isFocusVisible:g},X=G(a.Root,be),ne=K(X,2),le=ne[0],Q=ne[1],de=G(a.Track,ye),fe=K(de,2),he=fe[0],_e=fe[1],ee=G(a.InnerTrack,Te),oe=K(ee,2),ge=oe[0],pe=oe[1],et=G(a.Thumb,Re),Ce=K(et,2),tt=Ce[0],rt=Ce[1],nt=G(a.InnerThumb,Se),xe=K(nt,2),at=xe[0],it=xe[1],ot=G(a.ThumbValue,Me),De=K(ot,2),st=De[0],ut=De[1],ct=G(a.Tick,Oe),Pe=K(ct,2),Be=Pe[0],Ae=Pe[1],lt=G(a.TickBar,we),Le=K(lt,2),dt=Le[0],ft=Le[1],ht=G(a.Mark,ke),Fe=K(ht,2),gt=Fe[0],pt=Fe[1];return C.createElement(le,Y({"data-baseweb":"slider"},L,Q,{onFocus:Tt(Q,z),onBlur:yt(Q,W)}),C.createElement(Qe.Range,Y({step:l,min:T,max:t,values:A,disabled:p,onChange:function(N){return j({value:N})},onFinalChange:function(N){return B({value:N})},rtl:R.direction==="rtl",renderTrack:function(N){var te=N.props,q=N.children,ae=N.isDragged;return C.createElement(he,Y({onMouseDown:te.onMouseDown,onTouchStart:te.onTouchStart,$isDragged:ae},L,_e),C.createElement(ge,Y({$isDragged:ae,ref:te.ref},L,pe),q))},renderThumb:function(N){var te=N.props,q=N.index,ae=N.isDragged,je=y||(!!q&&o||!q&&m||ae)&&!p;return C.createElement(tt,Y({},te,{onMouseEnter:function(){q===0?x(!0):u(!0)},onMouseLeave:function(){q===0?x(!1):u(!1)},$thumbIndex:q,$isDragged:ae,style:At({},te.style)},L,rt,{$isFocusVisible:g&&I===q}),je&&C.createElement(st,Y({$thumbIndex:q,$isDragged:ae},L,ut),E(A[q])),je&&C.createElement(at,Y({$thumbIndex:q,$isDragged:ae},L,it)))}},c?{renderMark:function(N){var te=N.props,q=N.index;return C.createElement(gt,Y({$markIndex:q},te,L,pt))}}:{})),C.createElement(dt,Y({},L,ft),C.createElement(Be,Y({},L,Ae),E(T)),C.createElement(Be,Y({},L,Ae),E(t))))}const Ht=me("div",{target:"e8lt0n70"})(({disabled:e,theme:r})=>({alignItems:"center",backgroundColor:e?r.colors.gray:r.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",justifyContent:"center",height:r.sizes.sliderThumb,width:r.sizes.sliderThumb,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${kt(r.colors.primary,.5)}`}})),Wt=me("div",{target:"e8lt0n71"})(({disabled:e,theme:r})=>({fontFamily:r.genericFonts.codeFont,fontSize:r.fontSizes.sm,color:e?r.colors.gray:r.colors.primary,top:"-1.6em",position:"absolute",whiteSpace:"nowrap",backgroundColor:r.colors.transparent,lineHeight:r.lineHeights.base,fontWeight:r.fontWeights.normal,pointerEvents:"none"})),qt=me("div",{target:"e8lt0n72"})(({theme:e})=>({fontSize:e.fontSizes.sm,paddingBottom:e.spacing.none,paddingLeft:e.spacing.none,paddingRight:e.spacing.none,paddingTop:"0.65em",justifyContent:"space-between",alignItems:"center",display:"flex"})),Xe=me("div",{target:"e8lt0n73"})(({disabled:e,theme:r})=>({lineHeight:r.lineHeights.base,fontWeight:r.fontWeights.normal,fontFamily:r.genericFonts.codeFont,color:e?r.colors.fadedText40:"inherit"})),Kt=200;function Yt({disabled:e,element:r,widgetMgr:a,fragmentId:s}){var D;const[p,S]=xt({getStateFromWidgetMgr:Zt,getDefaultStateFromProto:Xt,getCurrStateFromProto:Gt,updateWidgetMgrState:Jt,element:r,widgetMgr:a,fragmentId:s}),[c,f]=C.useState(p),j=C.useRef(null),[F]=C.useState([]),[B]=C.useState([]),{colors:$,fonts:T,fontSizes:d,spacing:t}=wt(),n=c.map(m=>Ee(m,r)),l=Ee(r.min,r),v=Ee(r.max,r),y=r.label;C.useEffect(()=>{f(p)},[p]);const k=C.useCallback(Rt(Kt,m=>{S({value:m,fromUi:!0})}),[]),E=C.useCallback(({value:m})=>{f(m),k(m)},[k]),w=C.useCallback(()=>Ve(qt,{"data-testid":"stSliderTickBar",children:[re(Xe,{disabled:e,"data-testid":"stSliderTickBarMin",children:l}),re(Xe,{disabled:e,"data-testid":"stSliderTickBarMax",children:v})]}),[l,v,e]),R=C.useCallback(ze.forwardRef(function(x,V){const{$thumbIndex:i}=x,o=i||0;F[o]=V,B[o]||(B[o]=ze.createRef());const u=St(x,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),h=n[o];return re(Ht,{...u,disabled:x.$disabled===!0,ref:F[o],"aria-valuetext":h,"aria-label":y,children:re(Wt,{"data-testid":"stSliderThumbValue",disabled:x.$disabled===!0,ref:B[o],children:h})})}),[]);C.useEffect(()=>{var u,h;B.map((b,g)=>{b.current&&(b.current.innerText=n[g])}),F.map((b,g)=>{b.current&&b.current.setAttribute("aria-valuetext",n[g])});const m=j.current??null,x=F[0].current,V=(u=F[1])==null?void 0:u.current,i=B[0].current,o=(h=B[1])==null?void 0:h.current;tr(m,x,V,i,o)});const M=C.useCallback(({$disabled:m})=>({height:t.twoXS,...m?{background:$.darkenedBgMix25}:{}}),[$,t]);return Ve("div",{ref:j,className:"stSlider","data-testid":"stSlider",children:[re(It,{label:r.label,disabled:e,labelVisibility:Mt((D=r.labelVisibility)==null?void 0:D.value),children:r.help&&re(_t,{children:re($t,{content:r.help,placement:Et.TOP_RIGHT})})}),re(Ut,{min:r.min,max:r.max,step:r.step,value:er(c,r),onChange:E,disabled:e,overrides:{Thumb:R,Tick:{style:{fontFamily:T.monospace}},Track:{style:{backgroundColor:"none !important",paddingBottom:t.none,paddingLeft:t.none,paddingRight:t.none,paddingTop:`calc(${d.sm} * 1.35)`}},InnerTrack:{style:M},TickBar:w}})]})}function Zt(e,r){return e.getDoubleArrayValue(r)}function Xt(e){return e.default}function Gt(e){return e.value}function Jt(e,r,a,s){r.setDoubleArrayValue(e,a.value,{fromUi:a.fromUi},s)}function Qt(e){const{dataType:r}=e;return r===$e.DataType.DATETIME||r===$e.DataType.DATE||r===$e.DataType.TIME}function Ee(e,r){const{format:a,options:s}=r;return Qt(r)?Ct.utc(e/1e3).format(a):s.length>0?Ne.sprintf(a,s[e]):Ne.sprintf(a,e)}function er(e,r){const{min:a,max:s}=r;let p=e[0],S=e.length>1?e[1]:e[0];return p>S&&(p=S),p<a&&(p=a),p>s&&(p=s),S<a&&(S=a),S>s&&(S=s),e.length>1?[p,S]:[p]}function tr(e,r,a,s,p){!e||!r||!s||(ie(e,r,s),a&&p&&(ie(e,a,p),rr(e,r,a,s,p)))}function ie(e,r,a){const s=e.getBoundingClientRect(),p=r.getBoundingClientRect(),S=a.getBoundingClientRect(),c=p.left+p.width/2,f=c-S.width/2<s.left,j=c+S.width/2>s.right;a.style.left=f?"0":"",a.style.right=j?"0":""}function rr(e,r,a,s,p){const c=e.getBoundingClientRect(),f=r.getBoundingClientRect(),j=a.getBoundingClientRect(),F=s.getBoundingClientRect(),B=p.getBoundingClientRect(),$=c.left+c.width/2,T=f.left+f.width/2,d=j.left+j.width/2,t=T-F.width/2>=c.left,n=d+B.width/2<=c.right,l=f.left-F.width>=c.left,v=j.right+B.width<=c.right,y=t?F.width/2:F.width,k=n?B.width/2:B.width,E=T+y;if(d-k-E>24){ie(e,r,s),ie(e,a,p);return}if(l&&v){s.style.left="",s.style.right=`${Math.round(f.width)}px`,p.style.left=`${Math.round(j.width)}px`,p.style.right="";return}T<$?(ie(e,r,s),p.style.left=`${Math.round(T+y+24-d)}px`,p.style.right=""):(ie(e,a,p),s.style.left="",s.style.right=`${-Math.round(d-k-24-T)}px`)}const sr=Ot(C.memo(Yt));export{sr as default};
@@ -1,9 +0,0 @@
1
- import{bv as x,bI as ae,bJ as T,r as f,bK as w,y as le,D as ce,j as R,C as se,br as ue,aB as de,bz as fe,bs as ge,b9 as he,bL as be,aw as me,bM as ve,bN as pe}from"./index.6zGrdP7S.js";import{a as $e}from"./useBasicWidgetState.DH0ClB0l.js";import"./FormClearHelper.CEl0YyS3.js";var S=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),ye=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"});function q(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,r)}return o}function P(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?q(Object(o),!0).forEach(function(r){G(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):q(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function G(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function ke(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,c=e.$theme,a=e.$isFocusVisible,n=c.colors;return t?n.tickFillDisabled:o||i?"transparent":r?n.borderNegative:a?n.borderSelected:n.tickBorder}function Te(e){var t=e.$labelPlacement,o=t===void 0?"":t,r=e.$theme,i=r.sizing,c=i.scale300,a;switch(o){case"top":a="Bottom";break;case"bottom":a="Top";break;case"left":a="Right";break;default:case"right":a="Left";break}return r.direction==="rtl"&&a==="Left"?a="Right":r.direction==="rtl"&&a==="Right"&&(a="Left"),G({},"padding".concat(a),c)}function we(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,c=e.$isHovered,a=e.$isActive,n=e.$theme,l=n.colors;return t?o||r?l.tickFillDisabled:l.tickFill:i&&(r||o)?a?l.tickFillErrorSelectedHoverActive:c?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:c?l.tickFillErrorHover:l.tickFillError:r||o?a?l.tickFillSelectedHoverActive:c?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:c?l.tickFillHover:l.tickFill}function xe(e){var t=e.$disabled,o=e.$theme,r=o.colors;return t?r.contentSecondary:r.contentPrimary}var M=x("label",function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:o==="top"||o==="bottom"?"column":"row",display:"flex",alignItems:o==="top"||o==="bottom"?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}});M.displayName="Root";M.displayName="Root";var _=x("span",function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,c=e.$theme,a=e.$isFocusVisible,n=c.sizing,l=c.animation,u=o?c.colors.tickMarkFillDisabled:r?c.colors.tickMarkFillError:c.colors.tickMarkFill,s=encodeURIComponent(`
2
- <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">
3
- <path d="M14 0.5H0V3.5H14V0.5Z" fill="`.concat(u,`"/>
4
- </svg>
5
- `)),y=encodeURIComponent(`
6
- <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">
7
- <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="`.concat(u,`"/>
8
- </svg>
9
- `)),g=c.borders.checkboxBorderRadius,h=ke(e);return{flex:"0 0 auto",transitionDuration:l.timing200,transitionTimingFunction:l.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:n.scale700,height:n.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:h,borderRightColor:h,borderTopColor:h,borderBottomColor:h,borderTopLeftRadius:g,borderTopRightRadius:g,borderBottomRightRadius:g,borderBottomLeftRadius:g,outline:a&&t?"3px solid ".concat(c.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(s,"');"):t?"url('data:image/svg+xml,".concat(y,"');"):null,backgroundColor:we(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:c.sizing.scale0,marginBottom:c.sizing.scale0,marginLeft:c.sizing.scale0,marginRight:c.sizing.scale0}});_.displayName="Checkmark";_.displayName="Checkmark";var I=x("div",function(e){var t=e.$theme,o=t.typography;return P(P(P({verticalAlign:"middle"},Te(e)),{},{color:xe(e)},o.LabelMedium),{},{lineHeight:"24px"})});I.displayName="Label";I.displayName="Label";var z=x("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});z.displayName="Input";z.displayName="Input";var D=x("div",function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat(e.$theme.direction==="rtl"?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}});D.displayName="Toggle";D.displayName="Toggle";var H=x("div",function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}});H.displayName="ToggleTrack";H.displayName="ToggleTrack";function B(e){"@babel/helpers - typeof";return B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(e)}function $(){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 Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(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 Le(e,t,o){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ce(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&&E(e,t)}function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},E(e,t)}function Fe(e){var t=Pe();return function(){var r=L(e),i;if(t){var c=L(this).constructor;i=Reflect.construct(r,arguments,c)}else i=r.apply(this,arguments);return Oe(this,i)}}function Oe(e,t){if(t&&(B(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function v(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pe(){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 L(e){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},L(e)}function p(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var Be=function(t){return t.stopPropagation()},K=function(e){Ce(o,e);var t=Fe(o);function o(){var r;Re(this,o);for(var i=arguments.length,c=new Array(i),a=0;a<i;a++)c[a]=arguments[a];return r=t.call.apply(t,[this].concat(c)),p(v(r),"state",{isFocused:r.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),p(v(r),"onMouseEnter",function(n){r.setState({isHovered:!0}),r.props.onMouseEnter(n)}),p(v(r),"onMouseLeave",function(n){r.setState({isHovered:!1,isActive:!1}),r.props.onMouseLeave(n)}),p(v(r),"onMouseDown",function(n){r.setState({isActive:!0}),r.props.onMouseDown(n)}),p(v(r),"onMouseUp",function(n){r.setState({isActive:!1}),r.props.onMouseUp(n)}),p(v(r),"onFocus",function(n){r.setState({isFocused:!0}),r.props.onFocus(n),ae(n)&&r.setState({isFocusVisible:!0})}),p(v(r),"onBlur",function(n){r.setState({isFocused:!1}),r.props.onBlur(n),r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1})}),r}return Le(o,[{key:"componentDidMount",value:function(){var i=this.props,c=i.autoFocus,a=i.inputRef;c&&a.current&&a.current.focus()}},{key:"render",value:function(){var i=this.props,c=i.overrides,a=c===void 0?{}:c,n=i.onChange,l=i.labelPlacement,u=l===void 0?this.props.checkmarkType===S.toggle?"left":"right":l,s=i.inputRef,y=i.isIndeterminate,g=i.error,h=i.disabled,d=i.value,m=i.name,b=i.type,C=i.checked,F=i.children,O=i.required,Y=i.title,j=a.Root,V=a.Checkmark,W=a.Label,N=a.Input,A=a.Toggle,U=a.ToggleTrack,Z=T(j)||M,J=T(V)||_,Q=T(W)||I,ee=T(N)||z,te=T(A)||D,re=T(U)||H,oe={onChange:n,onFocus:this.onFocus,onBlur:this.onBlur},ie={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},k={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:g,$checked:C,$isIndeterminate:y,$required:O,$disabled:h,$value:d},X=F&&f.createElement(Q,$({$labelPlacement:u},k,w(W)),this.props.containsInteractiveElement?f.createElement("div",{onClick:function(ne){return ne.preventDefault()}},F):F);return f.createElement(Z,$({"data-baseweb":"checkbox",title:Y||null,$labelPlacement:u},k,ie,w(j)),(u==="top"||u==="left")&&X,this.props.checkmarkType===S.toggle?f.createElement(re,$({},k,w(U)),f.createElement(te,$({},k,w(A)))):f.createElement(J,$({},k,w(V))),f.createElement(ee,$({value:d,name:m,checked:C,required:O,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":y?"mixed":C,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":g||null,"aria-required":O||null,disabled:h,type:b,ref:s,onClick:Be},k,oe,w(N))),(u==="bottom"||u==="right")&&X)}}]),o}(f.Component);p(K,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:f.createRef(),error:!1,type:"checkbox",checkmarkType:S.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function Ee({element:e,disabled:t,widgetMgr:o,fragmentId:r}){var h;const[i,c]=$e({getStateFromWidgetMgr:Me,getDefaultStateFromProto:_e,getCurrStateFromProto:Ie,updateWidgetMgrState:ze,element:e,widgetMgr:o,fragmentId:r}),a=f.useCallback(d=>{c({value:d.target.checked,fromUi:!0})},[c]),n=le(),{colors:l,spacing:u,sizes:s}=n,y=ce(n),g=t?l.fadedText40:l.bodyText;return R(pe,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:R(K,{checked:i,disabled:t,onChange:a,"aria-label":e.label,checkmarkType:e.type===ve.StyleType.TOGGLE?S.toggle:S.default,labelPlacement:ye.right,overrides:{Root:{style:({$isFocusVisible:d})=>({marginBottom:u.none,marginTop:u.none,backgroundColor:d?l.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:d})=>{let m=y?l.bgColor:l.bodyText;return t&&(m=y?l.gray70:l.gray90),{width:`calc(${s.checkbox} - ${n.spacing.twoXS})`,height:`calc(${s.checkbox} - ${n.spacing.twoXS})`,transform:d?`translateX(${s.checkbox})`:"",backgroundColor:m,boxShadow:""}}},ToggleTrack:{style:({$checked:d,$isHovered:m})=>{let b=l.fadedText40;return m&&!t&&(b=l.fadedText20),d&&!t&&(b=l.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:n.spacing.twoXS,paddingLeft:n.spacing.threeXS,paddingRight:n.spacing.threeXS,width:`calc(2 * ${s.checkbox})`,minWidth:`calc(2 * ${s.checkbox})`,height:s.checkbox,minHeight:s.checkbox,borderBottomLeftRadius:n.radii.full,borderTopLeftRadius:n.radii.full,borderBottomRightRadius:n.radii.full,borderTopRightRadius:n.radii.full,backgroundColor:b}}},Checkmark:{style:({$isFocusVisible:d,$checked:m})=>{const b=m&&!t?l.primary:l.fadedText40;return{outline:0,width:s.checkbox,height:s.checkbox,marginTop:n.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:d&&m?`0 0 0 0.2rem ${me(l.primary,.5)}`:"",borderLeftWidth:s.borderWidth,borderRightWidth:s.borderWidth,borderTopWidth:s.borderWidth,borderBottomWidth:s.borderWidth,borderLeftColor:b,borderRightColor:b,borderTopColor:b,borderBottomColor:b}}},Label:{style:{lineHeight:n.lineHeights.small,paddingLeft:n.spacing.sm,position:"relative",color:g}}},children:se(be,{visibility:ue((h=e.labelVisibility)==null?void 0:h.value),"data-testid":"stWidgetLabel",children:[R(de,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&R(fe,{color:g,children:R(ge,{content:e.help,placement:he.TOP_RIGHT})})]})})})}function Me(e,t){return e.getBoolValue(t)}function _e(e){return e.default??null}function Ie(e){return e.value??null}function ze(e,t,o,r){t.setBoolValue(e,o.value,{fromUi:o.fromUi},r)}const We=f.memo(Ee);export{We as default};
@@ -1 +0,0 @@
1
- import{r as s,bg as U,y as k,cq as x,C as A,j as l,br as L,bE as P,bs as B,b9 as D,bt as j}from"./index.6zGrdP7S.js";import{u as w}from"./uniqueId.naIyoATl.js";import{u as O,a as _,b as q}from"./useOnInputChange.3GZT2mEx.js";import{I as K}from"./InputInstructions.M8GsfWtP.js";import{a as $}from"./useBasicWidgetState.DH0ClB0l.js";import{T as G}from"./textarea.D47OO5VD.js";import"./inputUtils.CQWz5UKz.js";import"./FormClearHelper.CEl0YyS3.js";import"./base-input.Dz6cKnV_.js";const T=(a,t)=>a.getStringValue(t)??t.default??null,N=a=>a.default??null,J=a=>a.value??null,M=(a,t,o,u)=>{t.setStringValue(a,o.value,{fromUi:o.fromUi},u)},Q=({disabled:a,element:t,widgetMgr:o,fragmentId:u})=>{var f;const h=s.useRef(w("text_area_")).current,{values:[W],elementRef:S}=U(s.useMemo(()=>["width"],[])),[r,n]=s.useState(!1),[y,b]=s.useState(!1),[i,d]=s.useState(T(o,t)??null),I=s.useCallback(()=>{d(t.default??null),n(!0)},[t]),[C,c]=$({getStateFromWidgetMgr:T,getDefaultStateFromProto:N,getCurrStateFromProto:J,updateWidgetMgrState:M,element:t,widgetMgr:o,fragmentId:u,onFormCleared:I});O(C,i,d,r);const e=k(),m=s.useCallback(()=>{n(!1),c({value:i,fromUi:!0})},[i,c]),V=s.useCallback(()=>{r&&m(),b(!1)},[r,m]),v=s.useCallback(()=>{b(!0)},[]),F=_({formId:t.formId,maxChars:t.maxChars,setDirty:n,setUiValue:d,setValueWithSource:c}),E=q(t.formId,m,r,o,u,!0),{height:g,placeholder:R,formId:p}=t,z=x({formId:p})?o.allowFormEnterToSubmit(p):r,H=y&&W>e.breakpoints.hideWidgetDetails;return A("div",{className:"stTextArea","data-testid":"stTextArea",ref:S,children:[l(j,{label:t.label,disabled:a,labelVisibility:L((f=t.labelVisibility)==null?void 0:f.value),htmlFor:h,children:t.help&&l(P,{children:l(B,{content:t.help,placement:D.TOP_RIGHT})})}),l(G,{value:i??"",placeholder:R,onBlur:V,onFocus:v,onChange:F,onKeyDown:E,"aria-label":t.label,disabled:a,id:h,overrides:{Input:{style:{lineHeight:e.lineHeights.inputWidget,height:g?`${g}px`:"",minHeight:e.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:e.spacing.lg,paddingLeft:e.spacing.lg,paddingBottom:e.spacing.lg,paddingTop:e.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}}}}),H&&l(K,{dirty:r,value:i??"",maxLength:t.maxChars,type:"multiline",inForm:x({formId:p}),allowEnterToSubmit:z})]})},it=s.memo(Q);export{it as default};
@@ -1 +0,0 @@
1
- import{r as o,E as G,_ as X,n as x,y as ut,bg as ct,cq as dt,M as J,cA as I,K as b,C as N,j as u,br as pt,bE as ft,bs as bt,b9 as mt,bt as gt,bo as M,aq as ht}from"./index.6zGrdP7S.js";import{s as yt}from"./sprintf.D7DtBTRn.js";import{u as It}from"./uniqueId.naIyoATl.js";import{u as Tt}from"./FormClearHelper.CEl0YyS3.js";import{I as wt}from"./InputInstructions.M8GsfWtP.js";import{I as Ct}from"./input.DqK048_c.js";import"./base-input.Dz6cKnV_.js";var Q=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(G,X({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M0 3v2h8V3H0z"}))});Q.displayName="Minus";var Y=o.forwardRef(function(t,e){var r={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(G,X({iconAttrs:r,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},t,{ref:e}),o.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const vt=x("div",{target:"e5tuigk0"})(({theme:t})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor??t.colors.secondaryBg,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}})),St=x("div",{target:"e5tuigk1"})({display:"flex",flexDirection:"row",alignSelf:"stretch"}),q=x("button",{target:"e5tuigk2"})(({theme:t})=>({margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:t.sizes.numberInputControlsWidth,justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}})),Vt=x("div",{target:"e5tuigk3"})(({theme:t,clearable:e})=>({position:"absolute",marginRight:t.spacing.twoXS,left:0,right:`calc(${t.sizes.numberInputControlsWidth} * 2 + ${e?"1em":"0em"})`})),kt=ht.getLogger("NumberInput");function xt(t){return b(t)||t===""?void 0:t}const Rt=t=>(t.element.dataType===I.DataType.INT?t.widgetMgr.getIntValue(t.element):t.widgetMgr.getDoubleValue(t.element))??t.element.default??null,K=({step:t,dataType:e})=>t||(e===I.DataType.INT?1:.01),z=({value:t,format:e,step:r,dataType:f})=>{if(b(t))return null;let n=xt(e);if(b(n)&&J(r)){const d=r.toString();f===I.DataType.FLOAT&&r!==0&&d.includes(".")&&(n=`%0.${d.split(".")[1].length}f`)}if(b(n))return t.toString();try{return yt.sprintf(n,t)}catch(d){return kt.warn(`Error in sprintf(${n}, ${t}): ${d}`),String(t)}},Dt=(t,e,r)=>b(t)?!1:t-e>=r,Et=(t,e,r)=>b(t)?!1:t+e<=r,Ft=({disabled:t,element:e,widgetMgr:r,fragmentId:f})=>{var j;const n=ut(),{dataType:d,id:C,formId:p,default:W,format:B}=e,m=e.hasMin?e.min:-1/0,g=e.hasMax?e.max:1/0,{values:[A],elementRef:Z}=ct(o.useMemo(()=>["width"],[])),[s,tt]=o.useState(K(e)),H=Rt({element:e,widgetMgr:r}),[h,T]=o.useState(!1),[i,w]=o.useState(H),[P,v]=o.useState(z({value:H,...e,step:s})),[L,U]=o.useState(!1),R=o.useRef(null),$=o.useRef(It("number_input_")),S=Dt(i,s,m),V=Et(i,s,g),O=dt({formId:p}),et=O?r.allowFormEnterToSubmit(p):h,ot=L&&A>n.breakpoints.hideWidgetDetails;o.useEffect(()=>{tt(K({step:e.step,dataType:e.dataType}))},[e.dataType,e.step]);const l=o.useCallback(({value:a,source:c})=>{var y;if(J(a)&&(m>a||a>g))(y=R.current)==null||y.reportValidity();else{const k=a??W??null;switch(d){case I.DataType.INT:r.setIntValue({id:C,formId:p},k,c,f);break;case I.DataType.FLOAT:r.setDoubleValue({id:C,formId:p},k,c,f);break;default:throw new Error("Invalid data type")}T(!1),w(k),v(z({value:k,dataType:d,format:B,step:s}))}},[m,g,R,r,f,s,d,C,p,W,B]),rt=o.useCallback(()=>{h&&l({value:i,source:{fromUi:!0}}),U(!1)},[h,i,l]),nt=o.useCallback(()=>{U(!0)},[]),_=o.useCallback(()=>{const{value:a}=e;e.setValue=!1,w(a??null),v(z({value:a??null,...e,step:s})),l({value:a??null,source:{fromUi:!1}})},[e,s,l]);o.useEffect(()=>{e.setValue?_():l({value:i,source:{fromUi:!1}})},[]),e.setValue&&_();const D=b(e.default)&&!t,at=o.useCallback(()=>{const a=e.default??null;w(a),l({value:a,source:{fromUi:!0}})},[e]);Tt({element:e,widgetMgr:r,onFormCleared:at});const st=a=>{const{value:c}=a.target;if(c==="")T(!0),w(null),v(null);else{let y;e.dataType===I.DataType.INT?y=parseInt(c,10):y=parseFloat(c),T(!0),w(y),v(c)}},E=o.useCallback(()=>{V&&(T(!0),l({value:(i??m)+s,source:{fromUi:!0}}))},[i,m,s,V]),F=o.useCallback(()=>{S&&(T(!0),l({value:(i??g)-s,source:{fromUi:!0}}))},[i,g,s,S]),it=o.useCallback(a=>{const{key:c}=a;switch(c){case"ArrowUp":a.preventDefault(),E();break;case"ArrowDown":a.preventDefault(),F();break}},[E,F]),lt=o.useCallback(a=>{a.key==="Enter"&&(h&&l({value:i,source:{fromUi:!0}}),r.allowFormEnterToSubmit(p)&&r.submitForm(p,f))},[h,i,l,r,p,f]);return N("div",{className:"stNumberInput","data-testid":"stNumberInput",ref:Z,children:[u(gt,{label:e.label,disabled:t,labelVisibility:pt((j=e.labelVisibility)==null?void 0:j.value),htmlFor:$.current,children:e.help&&u(ft,{children:u(bt,{content:e.help,placement:mt.TOP_RIGHT})})}),N(vt,{className:L?"focused":"","data-testid":"stNumberInputContainer",children:[u(Ct,{type:"number",inputRef:R,value:P??"",placeholder:e.placeholder,onBlur:rt,onFocus:nt,onChange:st,onKeyPress:lt,onKeyDown:it,clearable:D,clearOnEscape:D,disabled:t,"aria-label":e.label,id:$.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:n.colors.darkGray,padding:n.spacing.threeXS,height:n.sizes.clearIconSize,width:n.sizes.clearIconSize,":hover":{fill:n.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:m,max:g,type:"number",inputMode:""},style:{lineHeight:n.lineHeights.inputWidget,paddingRight:n.spacing.sm,paddingLeft:n.spacing.sm,paddingBottom:n.spacing.sm,paddingTop:n.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0}}}}),A>n.breakpoints.hideNumberInputControls&&N(St,{children:[u(q,{"data-testid":"stNumberInputStepDown",onClick:F,disabled:!S||t,tabIndex:-1,children:u(M,{content:Q,size:"xs",color:S?"inherit":n.colors.disabled})}),u(q,{"data-testid":"stNumberInputStepUp",onClick:E,disabled:!V||t,tabIndex:-1,children:u(M,{content:Y,size:"xs",color:V?"inherit":n.colors.disabled})})]})]}),ot&&u(Vt,{clearable:D,children:u(wt,{dirty:h,value:P??"",inForm:O,allowEnterToSubmit:et})})]})},Lt=o.memo(Ft);export{Lt as default};
@@ -1,9 +0,0 @@
1
- import{R as X,r as T}from"./index.6zGrdP7S.js";import{s as Te}from"./index.CUKOkOB2.js";import"./FormClearHelper.CEl0YyS3.js";import"./withFullScreenWrapper.HzikaPlG.js";import"./Toolbar.DGwjBtCI.js";import"./mergeWith.CwfhUp-s.js";import"./sprintf.D7DtBTRn.js";import"./createDownloadLinkElement.DZMwyjvU.js";import"./toConsumableArray.7OyX1dIj.js";import"./possibleConstructorReturn.CCjgmGB4.js";import"./createSuper.bXxYJzro.js";import"./FileDownload.esm.B1kyp21I.js";const Be=Te("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function Se(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var re;(function(e){e.event="event",e.props="prop"})(re||(re={}));function q(){}function Fe(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(i,l){return i===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function Y(e){return e==null}function _e(e){return typeof e=="number"&&isNaN(e)}function pe(e){return Y(e)||_e(e)||typeof e=="number"&&!isFinite(e)}function xe(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function je(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Le(e,t,r){var n=je(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function Me(e){var t=T.useRef(e);t.current=e;var r=T.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function se(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),i=a[0],l=a[1]||"";return{beforeDecimal:i,afterDecimal:l,hasNegation:r,addNegation:n}}function ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function ye(e,t,r){for(var n="",a=r?"0":"",i=0;i<=t-1;i++)n+=e[i]||a;return n}function de(e,t){return Array(t+1).join(e)}function be(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],i=n[1];if(i=Number(i),!i)return r+a;a=a.replace(".","");var l=1+i,h=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=h?a=a+de("0",l-h):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function ge(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,l=a.afterDecimal,h=a.hasNegation,p=parseFloat("0."+(l||"0")),x=l.length<=t?"0."+l:p.toFixed(t),S=x.split("."),c=i;i&&Number(S[0])&&(c=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},S[0]));var m=ye(S[1]||"",t,r),y=h?"-":"",s=n?".":"";return""+y+c+s+m}function H(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ve=Fe(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[i-1-n]&&i-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,l){l===void 0&&(l=$e);var h=a.findIndex(function(k){return k}),p=e.slice(0,h);!t&&!r.startsWith(p)&&(t=p,r=p+r,n=n+p.length);for(var x=r.length,S=e.length,c={},m=new Array(x),y=0;y<x;y++){m[y]=-1;for(var s=0,I=S;s<I;s++){var C=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:s});if(C&&c[s]!==!0){m[y]=s,c[s]=!0;break}}}for(var g=n;g<x&&(m[g]===-1||!i(r[g]));)g++;var B=g===x||m[g]===-1?S:m[g];for(g=n-1;g>0&&m[g]===-1;)g--;var F=g===-1||m[g]===-1?0:m[g]+1;return F>B?B:n-F<B-n?F:B}function me(e,t,r,n){var a=e.length;if(t=Ke(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function Ne(e,t,r,n,a,i){i===void 0&&(i=q);var l=Me(function(s,I){var C,g;return pe(s)?(g="",C=""):typeof s=="number"||I?(g=typeof s=="number"?be(s):s,C=n(g)):(g=a(s,void 0),C=n(g)),{formattedValue:C,numAsString:g}}),h=T.useState(function(){return l(Y(e)?t:e,r)}),p=h[0],x=h[1],S=function(s,I){s.formattedValue!==p.formattedValue&&x({formattedValue:s.formattedValue,numAsString:s.value}),i(s,I)},c=e,m=r;Y(e)&&(c=p.numAsString,m=!0);var y=l(c,m);return T.useMemo(function(){x(y)},[y.formattedValue]),[p,S]}function qe(e){return e.replace(/[^0-9]/g,"")}function ze(e){return e}function He(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,i=e.getInputRef,l=e.format;l===void 0&&(l=ze);var h=e.removeFormatting;h===void 0&&(h=qe);var p=e.defaultValue,x=e.valueIsNumericString,S=e.onValueChange,c=e.isAllowed,m=e.onChange;m===void 0&&(m=q);var y=e.onKeyDown;y===void 0&&(y=q);var s=e.onMouseUp;s===void 0&&(s=q);var I=e.onFocus;I===void 0&&(I=q);var C=e.onBlur;C===void 0&&(C=q);var g=e.value,B=e.getCaretBoundary;B===void 0&&(B=Ze);var F=e.isValidInputCharacter;F===void 0&&(F=ae);var k=e.isCharacterSame,j=Se(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),z=Ne(g,p,!!x,l,h,S),P=z[0],V=P.formattedValue,L=P.numAsString,W=z[1],M=T.useRef(),U=T.useRef({formattedValue:V,numAsString:L}),$=function(o,u){U.current={formattedValue:o.formattedValue,numAsString:o.value},W(o,u)},J=T.useState(!1),ee=J[0],d=J[1],f=T.useRef(null),N=T.useRef({setCaretTimeout:null,focusTimeout:null});T.useEffect(function(){return d(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var R=l,A=function(o,u){var v=parseFloat(u);return{formattedValue:o,value:u,floatValue:isNaN(v)?void 0:v}},E=function(o,u,v){o.selectionStart===0&&o.selectionEnd===o.value.length||(H(o,u),N.current.setCaretTimeout=setTimeout(function(){o.value===v&&o.selectionStart!==u&&H(o,u)},0))},O=function(o,u,v){return me(o,u,B(o),v)},Q=function(o,u,v){var w=B(u),_=Ge(u,V,o,v,w,F,k);return _=me(u,_,w),_},oe=function(o){var u=o.formattedValue;u===void 0&&(u="");var v=o.input,w=o.source,_=o.event,D=o.numAsString,b;if(v){var K=o.inputValue||v.value,G=ce(v);v.value=u,b=Q(K,u,G),b!==void 0&&E(v,b,u)}u!==V&&$(A(u,D),{event:_,source:w})};T.useEffect(function(){var o=U.current,u=o.formattedValue,v=o.numAsString;(V!==u||L!==v)&&$(A(V,L),{event:void 0,source:re.props})},[V,L]);var te=f.current?ce(f.current):void 0,ne=typeof window<"u"?T.useLayoutEffect:T.useEffect;ne(function(){var o=f.current;if(V!==U.current.formattedValue&&o){var u=Q(U.current.formattedValue,V,te);o.value=V,E(o,u,V)}},[V]);var ue=function(o,u,v){var w=u.target,_=M.current?Pe(M.current,w.selectionEnd):Ve(V,o),D=Object.assign(Object.assign({},_),{lastValue:V}),b=h(o,D),K=R(b);if(b=h(K,void 0),c&&!c(A(K,b))){var G=u.target,Z=ce(G),fe=Q(o,V,Z);return G.value=V,E(G,fe,V),!1}return oe({formattedValue:K,numAsString:b,inputValue:o,event:u,source:v,input:u.target}),!0},le=function(o,u){u===void 0&&(u=0);var v=o.selectionStart,w=o.selectionEnd;M.current={selectionStart:v,selectionEnd:w+u}},De=function(o){var u=o.target,v=u.value,w=ue(v,o,re.event);w&&m(o),M.current=void 0},Ie=function(o){var u=o.target,v=o.key,w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b;v==="ArrowLeft"||v==="Backspace"?b=Math.max(w-1,0):v==="ArrowRight"?b=Math.min(w+1,D.length):v==="Delete"&&(b=w);var K=0;v==="Delete"&&w===_&&(K=1);var G=v==="ArrowLeft"||v==="ArrowRight";if(b===void 0||w!==_&&!G){y(o),le(u,K);return}var Z=b;if(G){var fe=v==="ArrowLeft"?"left":"right";Z=O(D,b,fe),Z!==b&&o.preventDefault()}else v==="Delete"&&!F(D[b])?Z=O(D,b,"right"):v==="Backspace"&&!F(D[b])&&(Z=O(D,b,"left"));Z!==b&&E(u,Z,D),y(o),le(u,K)},Ce=function(o){var u=o.target,v=function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;if(D===void 0&&(D=""),w===_){var b=O(D,w);b!==w&&E(u,b,D)}};v(),requestAnimationFrame(function(){v()}),s(o),le(u)},Ee=function(o){o.persist&&o.persist();var u=o.target,v=o.currentTarget;f.current=u,N.current.focusTimeout=setTimeout(function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b=O(D,w);b!==w&&!(w===0&&_===D.length)&&E(u,b,D),I(Object.assign(Object.assign({},o),{currentTarget:v}))},0)},Re=function(o){f.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(o)},Ae=ee&&We()?"numeric":void 0,ve=Object.assign({inputMode:Ae},j,{type:t,value:V,onChange:De,onKeyDown:Ie,onMouseUp:Ce,onFocus:Ee,onBlur:Re});if(r==="text")return a?X.createElement(X.Fragment,null,a(V,j)||null):X.createElement("span",Object.assign({},j,{ref:i}),V);if(n){var Oe=n;return X.createElement(Oe,Object.assign({},ve,{ref:i}))}return X.createElement("input",Object.assign({},ve,{ref:i}))}function he(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var i=t.suffix;i===void 0&&(i="");var l=t.allowNegative,h=t.thousandsGroupStyle;if(h===void 0&&(h="thousand"),e===""||e==="-")return e;var p=ie(t),x=p.thousandSeparator,S=p.decimalSeparator,c=r!==0&&e.indexOf(".")!==-1||r&&n,m=se(e,l),y=m.beforeDecimal,s=m.afterDecimal,I=m.addNegation;return r!==void 0&&(s=ye(s,r,!!n)),x&&(y=Le(y,x,h)),a&&(y=a+y),i&&(s=s+i),I&&(y="-"+y),e=y+(c&&S||"")+s,e}function ie(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Je(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),i=n.test(e);return e=e.replace(/-/g,""),a&&!i&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+xe(e),"g")}function Xe(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Ye(e,t,r){var n;t===void 0&&(t=Ue(e));var a=r.allowNegative,i=r.prefix;i===void 0&&(i="");var l=r.suffix;l===void 0&&(l="");var h=r.decimalScale,p=t.from,x=t.to,S=x.start,c=x.end,m=ie(r),y=m.allowedDecimalSeparators,s=m.decimalSeparator,I=e[c]===s;if(ae(e)&&(e===i||e===l)&&t.lastValue==="")return e;if(c-S===1&&y.indexOf(e[S])!==-1){var C=h===0?"":s;e=e.substring(0,S)+C+e.substring(S+1,e.length)}var g=function(f,N,R){var A=!1,E=!1;i.startsWith("-")?A=!1:f.startsWith("--")?(A=!1,E=!0):l.startsWith("-")&&f.length===l.length?A=!1:f[0]==="-"&&(A=!0);var O=A?1:0;return E&&(O=2),O&&(f=f.substring(O),N-=O,R-=O),{value:f,start:N,end:R,hasNegation:A}},B=g(e,S,c),F=B.hasNegation;n=B,e=n.value,S=n.start,c=n.end;var k=g(t.lastValue,p.start,p.end),j=k.start,z=k.end,P=k.value,V=e.substring(S,c);e.length&&P.length&&(j>P.length-l.length||z<i.length)&&!(V&&l.startsWith(V))&&(e=P);var L=0;e.startsWith(i)?L+=i.length:S<i.length&&(L=S),e=e.substring(L),c-=L;var W=e.length,M=e.length-l.length;e.endsWith(l)?W=M:(c>M||c>e.length-l.length)&&(W=c),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(s))||[]).join("");var U=e.indexOf(s);e=e.replace(new RegExp(xe(s),"g"),function(f,N){return N===U?".":""});var $=se(e,a),J=$.beforeDecimal,ee=$.afterDecimal,d=$.addNegation;return x.end-x.start<p.end-p.start&&J===""&&I&&!parseFloat(ee)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,r.length+(i?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
2
- Decimal separator can't be same as thousand separator.
3
- thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
4
- decimalSeparator: `+n+` (default value for decimalSeparator is .)
5
- `);return a.startsWith("-")&&i&&(console.error(`
6
- Prefix can't start with '-' when allowNegative is true.
7
- prefix: `+a+`
8
- allowNegative: `+i+`
9
- `),i=!1),Object.assign(Object.assign({},e),{allowNegative:i})}function rt(e){e=tt(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,a=e.onKeyDown;a===void 0&&(a=q);var i=e.onBlur;i===void 0&&(i=q);var l=e.thousandSeparator,h=e.decimalScale,p=e.fixedDecimalScale,x=e.prefix;x===void 0&&(x="");var S=e.defaultValue,c=e.value,m=e.valueIsNumericString,y=e.onValueChange,s=Se(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),I=ie(e),C=I.decimalSeparator,g=I.allowedDecimalSeparators,B=function(d){return he(d,e)},F=function(d,f){return Ye(d,f,e)},k=Y(c)?S:c,j=m??Xe(k,x,t);Y(c)?Y(S)||(j=j||typeof S=="number"):j=j||typeof c=="number";var z=function(d){return pe(d)?d:(typeof d=="number"&&(d=be(d)),j&&typeof h=="number"?ge(d,h,!!p):d)},P=Ne(z(c),z(S),!!j,B,F,y),V=P[0],L=V.numAsString,W=V.formattedValue,M=P[1],U=function(d){var f=d.target,N=d.key,R=f.selectionStart,A=f.selectionEnd,E=f.value;if(E===void 0&&(E=""),(N==="Backspace"||N==="Delete")&&A<x.length){d.preventDefault();return}if(R!==A){a(d);return}N==="Backspace"&&E[0]==="-"&&R===x.length+1&&r&&H(f,1),h&&p&&(N==="Backspace"&&E[R-1]===C?(H(f,R-1),d.preventDefault()):N==="Delete"&&E[R]===C&&d.preventDefault()),g!=null&&g.includes(N)&&E[R]===C&&H(f,R+1);var O=l===!0?",":l;N==="Backspace"&&E[R-1]===O&&H(f,R-1),N==="Delete"&&E[R]===O&&H(f,R+1),a(d)},$=function(d){var f=L;if(f.match(/\d/g)||(f=""),n||(f=ke(f)),p&&h&&(f=ge(f,h,p)),f!==L){var N=he(f,e);M({formattedValue:N,value:f,floatValue:parseFloat(f)},{event:d,source:re.event})}i(d)},J=function(d){return d===C?!0:ae(d)},ee=function(d){var f=d.currentValue,N=d.lastValue,R=d.formattedValue,A=d.currentValueIndex,E=d.formattedValueIndex,O=f[A],Q=R[E],oe=Ve(N,f),te=oe.to,ne=function(ue){return F(ue).indexOf(".")+x.length};return c===0&&p&&h&&f[te.start]===C&&ne(f)<A&&ne(R)>E?!1:A>=te.start&&A<te.end&&g&&g.includes(O)&&Q===C?!0:O===Q};return Object.assign(Object.assign({},s),{value:W,valueIsNumericString:!1,isValidInputCharacter:J,isCharacterSame:ee,onValueChange:M,format:B,removeFormatting:F,getCaretBoundary:function(d){return et(d,e)},onKeyDown:U,onBlur:$})}function at(e){var t=rt(e);return X.createElement(He,Object.assign({},t))}function we(){var r,n,a;return((a=(n=(r=Intl.NumberFormat())==null?void 0:r.formatToParts(1.1))==null?void 0:n.find(i=>i.type==="decimal"))==null?void 0:a.value)??"."}function nt(){return we()==="."?",":"."}const St=e=>{const{value:t,onChange:r,disabled:n,highlight:a,validatedSelection:i,fixedDecimals:l,allowNegative:h,thousandSeparator:p,decimalSeparator:x}=e,S=T.useRef();return T.useLayoutEffect(()=>{var c;if(i!==void 0){const m=typeof i=="number"?[i,null]:i;(c=S.current)==null||c.setSelectionRange(m[0],m[1])}},[i]),T.createElement(Be,null,T.createElement(at,{autoFocus:!0,getInputRef:S,className:"gdg-input",onFocus:c=>c.target.setSelectionRange(a?0:c.target.value.length,c.target.value.length),disabled:n===!0,decimalScale:l,allowNegative:h,thousandSeparator:p??nt(),decimalSeparator:x??we(),value:Object.is(t,-0)?"-":t??"",onValueChange:r}))};export{St as default};
@@ -1 +0,0 @@
1
- import{I as a,g as d}from"./index.6zGrdP7S.js";var r,u;function q(){if(u)return r;u=1;var e=a(),i=0;function n(t){var o=++i;return e(t)+o}return r=n,r}var s=q();const v=d(s);export{v as u};
@@ -1 +0,0 @@
1
- import{n as p,r as n,aC as x,bf as y,y as h,bg as C,j as i,aY as w}from"./index.6zGrdP7S.js";const b=p("div",{target:"ek8upll0"})(({theme:e,isExpanded:t})=>({width:"100%",...t?{position:"fixed",top:0,left:0,bottom:0,right:0,background:e.colors.bgColor,zIndex:e.zIndices.fullscreenWrapper,padding:e.spacing.md,paddingTop:e.sizes.fullScreenHeaderHeight,overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}})),f=n.createContext(null);f.displayName="ElementFullscreenContext";const v=e=>{const t=n.useContext(e);if(t==null)throw new Error(`useRequiredContext: ${e.displayName??"context"} not found`);return t},g=()=>{const{setFullScreen:e}=n.useContext(x),[t,u]=n.useState(!1),{fullHeight:s,fullWidth:c}=v(y),o=n.useCallback(a=>{u(a),e(a)},[e]),d=n.useCallback(()=>{document.body.style.overflow="hidden",o(!0)},[o]),l=n.useCallback(()=>{document.body.style.overflow="unset",o(!1)},[o]),r=n.useCallback(a=>{a.keyCode===27&&t&&l()},[l,t]);return n.useEffect(()=>(document.addEventListener("keydown",r,!1),()=>{document.removeEventListener("keydown",r,!1)}),[r]),n.useMemo(()=>({expanded:t,zoomIn:d,zoomOut:l,fullHeight:s,fullWidth:c}),[t,d,l,s,c])},F=({children:e,height:t})=>{const u=h(),{expanded:s,fullHeight:c,fullWidth:o,zoomIn:d,zoomOut:l}=g(),{values:[r],elementRef:a}=C(n.useMemo(()=>["width"],[])),m=n.useMemo(()=>({width:s?o:r,height:s?c:t,expanded:s,expand:d,collapse:l}),[s,c,o,t,r,d,l]);return i(f.Provider,{value:m,children:i(b,{ref:a,isExpanded:s,"data-testid":"stFullScreenFrame",theme:u,children:e})})};function E(e){const t=u=>i(F,{children:i(e,{...u})});return t.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,w(t,e)}export{f as E,v as u,E as w};