streamlit-nightly 1.45.2.dev20250527__py3-none-any.whl → 1.45.2.dev20250530__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/auth_util.py +3 -3
- streamlit/commands/echo.py +1 -1
- streamlit/config.py +32 -12
- streamlit/config_option.py +3 -5
- streamlit/config_util.py +4 -5
- streamlit/connections/snowflake_connection.py +4 -3
- streamlit/delta_generator.py +10 -14
- streamlit/elements/arrow.py +1 -0
- streamlit/elements/deck_gl_json_chart.py +1 -0
- streamlit/elements/doc_string.py +7 -15
- streamlit/elements/exception.py +4 -12
- streamlit/elements/form.py +14 -0
- streamlit/elements/graphviz_chart.py +1 -1
- streamlit/elements/heading.py +3 -4
- streamlit/elements/json.py +7 -6
- streamlit/elements/layouts.py +21 -3
- streamlit/elements/lib/image_utils.py +2 -3
- streamlit/elements/lib/layout_utils.py +24 -0
- streamlit/elements/lib/mutable_status_container.py +9 -0
- streamlit/elements/lib/streamlit_plotly_theme.py +54 -53
- streamlit/elements/lib/utils.py +15 -0
- streamlit/elements/markdown.py +34 -4
- streamlit/elements/media.py +1 -1
- streamlit/elements/plotly_chart.py +1 -0
- streamlit/elements/progress.py +6 -15
- streamlit/elements/spinner.py +5 -4
- streamlit/elements/vega_charts.py +1 -0
- streamlit/elements/widgets/audio_input.py +4 -10
- streamlit/elements/widgets/button.py +3 -1
- streamlit/elements/widgets/button_group.py +1 -0
- streamlit/elements/widgets/camera_input.py +6 -9
- streamlit/elements/widgets/chat.py +11 -13
- streamlit/elements/widgets/checkbox.py +1 -0
- streamlit/elements/widgets/color_picker.py +9 -14
- streamlit/elements/widgets/data_editor.py +9 -5
- streamlit/elements/widgets/file_uploader.py +10 -9
- streamlit/elements/widgets/multiselect.py +1 -0
- streamlit/elements/widgets/number_input.py +12 -12
- streamlit/elements/widgets/radio.py +2 -1
- streamlit/elements/widgets/select_slider.py +4 -10
- streamlit/elements/widgets/selectbox.py +11 -13
- streamlit/elements/widgets/slider.py +28 -41
- streamlit/elements/widgets/text_widgets.py +16 -24
- streamlit/elements/widgets/time_widgets.py +15 -22
- streamlit/hello/animation_demo.py +9 -9
- streamlit/hello/dataframe_demo.py +2 -2
- streamlit/hello/hello.py +1 -0
- streamlit/hello/mapping_demo.py +5 -6
- streamlit/hello/streamlit_app.py +27 -25
- streamlit/logger.py +1 -1
- streamlit/proto/AudioInput_pb2.py +3 -4
- streamlit/proto/AudioInput_pb2.pyi +2 -7
- streamlit/proto/Block_pb2.py +27 -27
- streamlit/proto/Block_pb2.pyi +3 -17
- streamlit/proto/CameraInput_pb2.py +3 -4
- streamlit/proto/CameraInput_pb2.pyi +2 -8
- streamlit/proto/ChatInput_pb2.py +7 -8
- streamlit/proto/ChatInput_pb2.pyi +1 -10
- streamlit/proto/Code_pb2.py +3 -4
- streamlit/proto/DateInput_pb2.py +3 -4
- streamlit/proto/DateInput_pb2.pyi +2 -8
- streamlit/proto/DocString_pb2.py +5 -6
- streamlit/proto/DocString_pb2.pyi +1 -9
- streamlit/proto/FileUploader_pb2.py +3 -4
- streamlit/proto/FileUploader_pb2.pyi +2 -8
- streamlit/proto/Json_pb2.py +3 -4
- streamlit/proto/Json_pb2.pyi +2 -9
- streamlit/proto/NewSession_pb2.py +16 -16
- streamlit/proto/NewSession_pb2.pyi +7 -2
- streamlit/proto/NumberInput_pb2.py +5 -6
- streamlit/proto/NumberInput_pb2.pyi +2 -9
- streamlit/proto/Progress_pb2.py +3 -4
- streamlit/proto/Progress_pb2.pyi +1 -7
- streamlit/proto/Selectbox_pb2.py +3 -4
- streamlit/proto/Selectbox_pb2.pyi +2 -9
- streamlit/proto/Slider_pb2.py +7 -8
- streamlit/proto/Slider_pb2.pyi +2 -8
- streamlit/proto/TextArea_pb2.py +3 -4
- streamlit/proto/TextArea_pb2.pyi +2 -9
- streamlit/proto/TextInput_pb2.py +5 -6
- streamlit/proto/TextInput_pb2.pyi +2 -9
- streamlit/proto/TimeInput_pb2.py +3 -4
- streamlit/proto/TimeInput_pb2.pyi +2 -9
- streamlit/runtime/app_session.py +11 -8
- streamlit/runtime/caching/hashing.py +8 -9
- streamlit/runtime/caching/storage/local_disk_cache_storage.py +3 -3
- streamlit/runtime/connection_factory.py +12 -12
- streamlit/runtime/credentials.py +13 -26
- streamlit/runtime/runtime_util.py +2 -2
- streamlit/runtime/scriptrunner/script_runner.py +8 -7
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +1240 -0
- streamlit/static/static/js/{ErrorOutline.esm.qteVcUUN.js → ErrorOutline.esm.D5NgCh5m.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.ncu7N-Hr.js → FileDownload.esm.NuObx1Tl.js} +1 -1
- streamlit/static/static/js/{FileHelper.zsMZ7RXt.js → FileHelper.BH7o4_P9.js} +5 -5
- streamlit/static/static/js/{FormClearHelper.W8yVYXZp.js → FormClearHelper.BAxB8JFY.js} +1 -1
- streamlit/static/static/js/{Hooks.DBj6srQ1.js → Hooks.Bjt8oBOT.js} +1 -1
- streamlit/static/static/js/{InputInstructions.BobLsJJb.js → InputInstructions.BZZLp6t9.js} +1 -1
- streamlit/static/static/js/{ProgressBar.CtvJrIzN.js → ProgressBar.BwRgGfI0.js} +2 -2
- streamlit/static/static/js/{RenderInPortalIfExists.DnT_UdzV.js → RenderInPortalIfExists.C_c286r8.js} +1 -1
- streamlit/static/static/js/{Toolbar.BVF7NtOB.js → Toolbar.5tXjF_eX.js} +1 -1
- streamlit/static/static/js/{base-input.B4sdS3vw.js → base-input.wfBDFTlB.js} +1 -1
- streamlit/static/static/js/{checkbox.DKDitzF8.js → checkbox.D1GhNngU.js} +1 -1
- streamlit/static/static/js/{createSuper.mhx956J9.js → createSuper.CudEEVs2.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.CmXS0PAX.js → data-grid-overlay-editor.DUTI_Rbg.js} +1 -1
- streamlit/static/static/js/{downloader.Cnd9SuxG.js → downloader.BwLpAoXN.js} +1 -1
- streamlit/static/static/js/{es6.DM-pf09u.js → es6.B_HLnUb9.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.Gc5GAjZM.js → iframeResizer.contentWindow.BNcjOcan.js} +1 -1
- streamlit/static/static/js/{index.D4XRYl23.js → index.3WJoJFGb.js} +1 -1
- streamlit/static/static/js/{index.C_2m4F7k.js → index.B0h616Th.js} +1 -1
- streamlit/static/static/js/{index.p2Wl4zMi.js → index.B0paBg5x.js} +1 -1
- streamlit/static/static/js/index.B3vWaIrN.js +1 -0
- streamlit/static/static/js/{index.B45ExNhw.js → index.B4PbMsBe.js} +1 -1
- streamlit/static/static/js/{index.BWTBe3a1.js → index.BGKVW2u9.js} +1 -1
- streamlit/static/static/js/index.BJQPxOFd.js +12 -0
- streamlit/static/static/js/{index.DdyZtGcg.js → index.BOHEcsVb.js} +1 -1
- streamlit/static/static/js/{index.BR-S54Iv.js → index.BPGAPI9w.js} +1 -1
- streamlit/static/static/js/{index.gBOr8z2K.js → index.Bj6uLiaA.js} +1 -1
- streamlit/static/static/js/{index.I3iNnzJx.js → index.BkvVxUIW.js} +1 -1
- streamlit/static/static/js/{index._BaeK1t7.js → index.Bs0m0eUy.js} +1 -1
- streamlit/static/static/js/{index.DwUISpCs.js → index.BtpsTdHN.js} +177 -174
- streamlit/static/static/js/index.C1GNiWbH.js +1 -0
- streamlit/static/static/js/{index.B6xTo8b8.js → index.CL0UH4WF.js} +1 -1
- streamlit/static/static/js/{index.BJQNG4O1.js → index.CXP5ffxh.js} +1 -1
- streamlit/static/static/js/{index.DAvhwYMG.js → index.Ca-9xoC2.js} +1 -1
- streamlit/static/static/js/{index.COBionvf.js → index.Cdd7Ri21.js} +1 -1
- streamlit/static/static/js/index.Cf8KcH2X.js +1 -0
- streamlit/static/static/js/{index.BkLkRTpZ.js → index.CfzaRR6P.js} +1 -1
- streamlit/static/static/js/{index.CkKptP1T.js → index.CjRwuAdg.js} +1 -1
- streamlit/static/static/js/{index.CjBaoWYr.js → index.CkOUlPYT.js} +1 -1
- streamlit/static/static/js/{index.DQGSbu2C.js → index.CxtkoiKl.js} +1 -1
- streamlit/static/static/js/index.D3wYqvI6.js +1 -0
- streamlit/static/static/js/index.D8i27llu.js +3 -0
- streamlit/static/static/js/{index.BfusYuD8.js → index.DA7wmIe4.js} +1 -1
- streamlit/static/static/js/index.DIG9Mo9J.js +1 -0
- streamlit/static/static/js/index.DNR4wKJg.js +1 -0
- streamlit/static/static/js/{index.B29JQLHa.js → index.DNS8a-dx.js} +20 -20
- streamlit/static/static/js/{index.BNNR5Jmd.js → index.NveskZ7j.js} +1 -1
- streamlit/static/static/js/{index.CWgnk1N4.js → index.PR2mcvVR.js} +1 -1
- streamlit/static/static/js/{index.CJ-XXd1r.js → index.df4uuSoD.js} +1 -1
- streamlit/static/static/js/{index.WWYmGCrM.js → index.flyQEkeT.js} +1 -1
- streamlit/static/static/js/{index.vOqxh1m2.js → index.iF9jUtwl.js} +1 -1
- streamlit/static/static/js/{index.C5KKmyWy.js → index.jyqBAhvH.js} +1 -1
- streamlit/static/static/js/{index.AWkO-7e-.js → index.sYLAHlH0.js} +1 -1
- streamlit/static/static/js/{index.CZ5fZcT5.js → index.zq3LdRhj.js} +1 -1
- streamlit/static/static/js/{input.BvD9DHLa.js → input.CtZjQ6Pv.js} +1 -1
- streamlit/static/static/js/{memory.DCVB1HOm.js → memory.Ddl3R0up.js} +1 -1
- streamlit/static/static/js/{mergeWith.BqTORFAq.js → mergeWith.D-TqDY0-.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.VB_OvuPv.js → number-overlay-editor.Dndf05Hx.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DhYxBDlj.js → possibleConstructorReturn.DNEY6J9G.js} +1 -1
- streamlit/static/static/js/{sandbox.CoN7LRFk.js → sandbox.B_XDPkfx.js} +1 -1
- streamlit/static/static/js/{textarea.DkHpIjdT.js → textarea.BZ9lTMhV.js} +1 -1
- streamlit/static/static/js/{timepicker.C8UIzYhf.js → timepicker.D9UUwpRT.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.DXfr1fvT.js → toConsumableArray.DNJjbOUS.js} +1 -1
- streamlit/static/static/js/{uniqueId.CgrMSBTb.js → uniqueId.psBJ_tSg.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.C-e-WEFS.js → useBasicWidgetState.CTpx4w-3.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.CtRJhZD6.js → useOnInputChange.WKTDSC4O.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.od0SAvAK.js → withFullScreenWrapper.oyWCn2-3.js} +1 -1
- streamlit/watcher/local_sources_watcher.py +1 -1
- streamlit/watcher/path_watcher.py +2 -3
- streamlit/web/bootstrap.py +1 -1
- streamlit/web/cli.py +5 -5
- streamlit/web/server/authlib_tornado_integration.py +3 -3
- streamlit/web/server/oauth_authlib_routes.py +4 -2
- streamlit/web/server/oidc_mixin.py +6 -5
- streamlit/web/server/server.py +1 -1
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/METADATA +2 -2
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/RECORD +172 -171
- streamlit/static/static/js/index.B0E6Rv1F.js +0 -1
- streamlit/static/static/js/index.BONHiJUZ.js +0 -1
- streamlit/static/static/js/index.BV38yp5k.js +0 -1
- streamlit/static/static/js/index.CgOynO1t.js +0 -1
- streamlit/static/static/js/index.DIyx-z1Q.js +0 -1
- streamlit/static/static/js/index.DOYomqqU.js +0 -1
- streamlit/static/static/js/index.DOl-SOKu.js +0 -3
- streamlit/static/static/js/index.DTU7qmDP.js +0 -12
- {streamlit_nightly-1.45.2.dev20250527.data → streamlit_nightly-1.45.2.dev20250530.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.45.2.dev20250527.dist-info → streamlit_nightly-1.45.2.dev20250530.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
import{r as i,E as J,_ as Q,n as g,B as ht,z as W,j as n,b5 as Z,br as ft,C as F,bm as tt,b0 as et,bl as T,aW as mt,bD as yt,bg as Ct,bE as v,bp as It,F as ot,bd as bt,bF as vt,M,bi as xt,bh as wt}from"./index.DwUISpCs.js";import{g as St,F as N,C as Ft,I as Et,E as Ut,a as zt,s as Tt,u as Ht,b as Bt}from"./FileHelper.zsMZ7RXt.js";import{I as Dt}from"./InputInstructions.BobLsJJb.js";import{i as Rt}from"./inputUtils.CQWz5UKz.js";import{E as Lt}from"./ErrorOutline.esm.qteVcUUN.js";import{a as q,U as nt}from"./UploadFileInfo.0DCkpDDf.js";import{T as Mt}from"./textarea.DkHpIjdT.js";import"./base-input.B4sdS3vw.js";var at=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.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"}))});at.displayName="AttachFile";var rt=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),i.createElement("rect",{width:24,height:24,fill:"none"}),i.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"}))});rt.displayName="Send";const $t=g("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),kt=g("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??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}})),Vt=g("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:s})=>{const p=ht(t),[f,u]=p?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:s?"0":t.radii.chatInput,borderTopLeftRadius:s?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:u,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:p?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"}}}),Nt=g("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),Wt=g("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),At=g("div",{target:"e15560op0"})(({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})),Pt=g("div",{target:"e15560op1"})(({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})),Kt=g("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),Ot=g("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),_t=g("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Xt=g("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Gt=g("div",{target:"e15560op6"})({display:"flex"}),jt=g("div",{target:"e15560op7"})({flex:"0 0 auto"}),Yt=g("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),qt=g("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Jt=g("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Qt=g("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Zt=g("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function te({children:t,content:e}){const s=W();return n(ft,{content:e,placement:Z.TOP,overrides:{Body:{style:{top:`-${s.sizes.minElementHeight}`}}},children:t})}const ee=({fileInfo:t})=>{const e=W(),{type:s}=t.status;switch(s){case"uploading":return n(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(te,{content:t.status.errorMessage,children:n(T,{color:e.colors.red,content:Lt,size:"lg"})});case"uploaded":return n(T,{content:Et,size:"lg"});default:return mt(s),null}},oe=({fileInfo:t,onDelete:e})=>F(Yt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(qt,{children:n(ee,{fileInfo:t})}),n(Jt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(Qt,{children:St(t.size,N.Byte)}),n(Zt,{"data-testid":"stChatInputDeleteBtn",children:n(tt,{onClick:()=>e(t.id),kind:et.MINIMAL,children:n(T,{content:Ft,size:"lg"})})})]}),ne=i.memo(oe),ae=({items:t,onDelete:e})=>n(Xt,{"data-testid":"stChatUploadedFiles",children:n(Gt,{children:t.map(s=>n(jt,{children:n(ne,{fileInfo:s,onDelete:e})},s.id))})}),re=i.memo(ae),ie=({getNextLocalFileId:t,addFiles:e,updateFile:s,uploadClient:p,element:f,onUploadProgress:u,onUploadComplete:I})=>(y,d)=>{const m=q.CancelToken.source(),c=new nt(d.name,d.size,t(),{type:"uploading",cancelToken:m,progress:1});e([c]),p.uploadFile({formId:"",...f},y.uploadUrl,d,h=>u(h,c.id),m.token).then(()=>I(c.id,y)).catch(h=>{q.isCancel(h)||s(c.id,c.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},se=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:s,uploadFile:p,addFiles:f,getNextLocalFileId:u,deleteExistingFiles:I,onUploadComplete:y})=>(d,m)=>{if(!t&&d.length===0&&m.length>1){const c=m.findIndex(h=>{var x;return((x=h.errors)==null?void 0:x[0].code)===Ut.TooManyFiles});c>=0&&(d.push(m[c].file),m.splice(c,1))}if(!t&&d.length>0&&I(),s.fetchFileURLs(d).then(c=>{Ct(c,d).forEach(([h,x])=>{p(h,x)})}).catch(c=>{f(d.map(h=>new nt(h.name,h.size,u(),{type:"error",errorMessage:c})))}),m.length>0){const c=m.map(h=>zt(h,u(),e));f(c)}y()},le=({getRootProps:t,getInputProps:e,acceptFile:s,disabled:p,theme:f})=>F(Kt,{disabled:p,children:[F(Ot,{"data-testid":"stChatInputFileUploadButton",disabled:p,...t(),children:[n("input",{...e()}),n(It,{content:`Upload or drag and drop ${s===v.Multiple?"files":"a file"}`,placement:Z.TOP,onMouseEnterDelay:500,children:n(tt,{kind:et.MINIMAL,disabled:p,children:n(T,{content:at,size:"lg",color:p?f.colors.fadedText40:f.colors.fadedText60})})})]}),n(_t,{})]}),de=i.memo(le),ce=({getRootProps:t,getInputProps:e,acceptFile:s,inputHeight:p})=>F(ot,{children:[n(At,{height:p,...t(),children:n("input",{...e()})}),n(Pt,{height:p,children:`Drag and drop ${s===v.Multiple?"files":"a file"} here`})]}),pe=i.memo(ce),ue=6.5,$=1,k=(t,e,s)=>s.map(p=>p.id===t?e:p),V=(t,e)=>e.find(s=>s.id===t);function ge({disabled:t,element:e,widgetMgr:s,fragmentId:p,uploadClient:f}){const u=W(),{placeholder:I,maxChars:y}=e,d=i.useRef(null),m=i.useRef(0),c=i.useRef({minHeight:0,maxHeight:0}),[h,x]=bt(),[E,B]=i.useState(e.default),[U,D]=i.useState(0),[H,it]=i.useState(!1),[w,S]=i.useState([]),[z,R]=i.useState(!1),L=i.useMemo(()=>w.some(o=>o.status.type==="uploading")?!1:E!==""||w.length>0,[w,E]),b=vt(e.acceptFile),A=Tt(e.maxUploadSizeMb,N.Megabyte,N.Byte),P=i.useCallback(o=>S(a=>[...a,...o]),[]),K=i.useCallback(o=>{S(a=>{const l=V(o,a);return M(l)?a:(l.status.type==="uploading"&&l.status.cancelToken.cancel(),l.status.type==="uploaded"&&l.status.fileUrls.deleteUrl&&f.deleteFile(l.status.fileUrls.deleteUrl),a.filter(r=>r.id!==o))})},[f]),st=()=>{const o=w.filter(a=>a.status.type==="uploaded").map(a=>{const{name:l,size:r,status:C}=a,{fileId:ut,fileUrls:gt}=C;return new xt({fileId:ut,fileUrls:gt,name:l,size:r})});return new wt({uploadedFileInfo:o})},O=()=>m.current++,lt=se({acceptMultipleFiles:b===v.Multiple,maxFileSize:A,uploadClient:f,uploadFile:ie({getNextLocalFileId:O,addFiles:P,updateFile:(o,a)=>{S(l=>k(o,a,l))},uploadClient:f,element:e,onUploadProgress:(o,a)=>{S(l=>{const r=V(a,l);if(M(r)||r.status.type!=="uploading")return l;const C=Math.round(o.loaded*100/o.total);return r.status.progress===C?l:k(a,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:C}),l)})},onUploadComplete:(o,a)=>{S(l=>{const r=V(o,l);return M(r)||r.status.type!=="uploading"?l:k(r.id,r.setStatus({type:"uploaded",fileId:a.fileId,fileUrls:a}),l)})}}),addFiles:P,getNextLocalFileId:O,deleteExistingFiles:()=>w.forEach(o=>K(o.id)),onUploadComplete:()=>{d.current&&d.current.focus()}}),{getRootProps:_,getInputProps:X}=Ht({onDrop:lt,multiple:b===v.Multiple,accept:Bt(e.fileType),maxSize:A}),G=()=>{let o=0;const{current:a}=d;return a&&(a.style.height="auto",o=a.scrollHeight,a.style.height=""),o},j=()=>{if(d.current&&d.current.focus(),!L||t)return;const o={data:E,fileUploaderState:st()};s.setChatInputValue(e,o,{fromUi:!0},p),S([]),B(""),D(0)},dt=o=>{const{metaKey:a,ctrlKey:l,shiftKey:r}=o;Rt(o)&&!r&&!l&&!a&&(o.preventDefault(),j())},ct=o=>{const{value:a}=o.target;y!==0&&a.length>y||(B(a),D(G()))};i.useEffect(()=>{if(e.setValue){e.setValue=!1;const o=e.value||"";B(o)}},[e]),i.useLayoutEffect(()=>{if(d.current){const{offsetHeight:o}=d.current;c.current.minHeight=o,c.current.maxHeight=o*ue}},[d]),i.useEffect(()=>{const o=r=>{var C;r.preventDefault(),r.stopPropagation(),!z&&((C=r.dataTransfer)!=null&&C.types.includes("Files"))&&R(!0)},a=r=>{r.preventDefault(),r.stopPropagation(),z&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&R(!1)},l=r=>{r.preventDefault(),r.stopPropagation(),z&&R(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",l),window.addEventListener("dragleave",a),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",l),window.removeEventListener("dragleave",a)}},[z]),i.useLayoutEffect(()=>{const{minHeight:o}=c.current;it(U>0&&d.current?Math.abs(U-o)>$:!1)},[U]),i.useLayoutEffect(()=>{D(G())},[I]);const{maxHeight:Y}=c.current,pt=b!==v.None&&z;return F(ot,{children:[b===v.None?null:n(re,{items:[...w],onDelete:K}),n($t,{className:"stChatInput","data-testid":"stChatInput",ref:x,children:pt?n(pe,{getRootProps:_,getInputProps:X,acceptFile:b,inputHeight:H?`${U+$}px`:u.sizes.minElementHeight}):F(kt,{extended:H,children:[b===v.None?null:n(de,{getRootProps:_,getInputProps:X,acceptFile:b,disabled:t,theme:u}),n(Mt,{inputRef:d,value:E,placeholder:I,onChange:ct,onKeyDown:dt,"aria-label":I,disabled:t,rows:1,overrides:{Root:{style:{minHeight:u.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:u.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:H?`${U+$}px`:"auto",maxHeight:Y?`${Y}px`:"none",paddingLeft:u.spacing.none,paddingBottom:u.spacing.sm,paddingTop:u.spacing.sm,paddingRight:`calc(${u.iconSizes.xl} + 2 * ${u.spacing.sm} + ${u.spacing.sm})`}}}}),h>u.breakpoints.hideWidgetDetails&&n(Wt,{children:n(Dt,{dirty:L,value:E,maxLength:y,type:"chat",inForm:!1})}),n(Nt,{children:n(Vt,{onClick:j,disabled:!L||t,extended:H,"data-testid":"stChatInputSubmitButton",children:n(T,{content:rt,size:"xl",color:"inherit"})})})]})})]})}const xe=i.memo(ge);export{xe as default};
|
1
|
+
import{r as i,E as J,_ as Q,n as g,B as ht,z as W,j as n,b5 as Z,br as ft,C as F,bm as tt,b0 as et,bl as T,aW as mt,bD as yt,bg as Ct,bE as v,bp as It,F as ot,bd as bt,bF as vt,M,bi as xt,bh as wt}from"./index.BtpsTdHN.js";import{g as St,C as Ft,I as Et,F as N,E as Ut,a as zt,s as Tt,u as Ht,b as Bt}from"./FileHelper.BH7o4_P9.js";import{I as Dt}from"./InputInstructions.BZZLp6t9.js";import{i as Rt}from"./inputUtils.CQWz5UKz.js";import{E as Lt}from"./ErrorOutline.esm.D5NgCh5m.js";import{a as q,U as nt}from"./UploadFileInfo.0DCkpDDf.js";import{T as Mt}from"./textarea.BZ9lTMhV.js";import"./base-input.wfBDFTlB.js";var at=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.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"}))});at.displayName="AttachFile";var rt=i.forwardRef(function(t,e){var s={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(J,Q({iconAttrs:s,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),i.createElement("rect",{width:24,height:24,fill:"none"}),i.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"}))});rt.displayName="Send";const $t=g("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),kt=g("div",{target:"e1togvvn1"})(({theme:t,extended:e})=>({border:`${t.sizes.borderWidth} solid`,borderColor:t.colors.widgetBorderColor??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}})),Vt=g("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:s})=>{const p=ht(t),[f,u]=p?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:s?"0":t.radii.chatInput,borderTopLeftRadius:s?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:u,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:p?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"}}}),Nt=g("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),Wt=g("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),At=g("div",{target:"e15560op0"})(({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})),Pt=g("div",{target:"e15560op1"})(({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})),Kt=g("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),Ot=g("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),_t=g("div",{target:"e15560op4"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20})),Xt=g("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Gt=g("div",{target:"e15560op6"})({display:"flex"}),jt=g("div",{target:"e15560op7"})({flex:"0 0 auto"}),Yt=g("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),qt=g("div",{target:"e15560op9"})(({theme:t})=>({color:t.colors.fadedText60})),Jt=g("div",{target:"e15560op10"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60})),Qt=g("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),Zt=g("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}));function te({children:t,content:e}){const s=W();return n(ft,{content:e,placement:Z.TOP,overrides:{Body:{style:{top:`-${s.sizes.minElementHeight}`}}},children:t})}const ee=({fileInfo:t})=>{const e=W(),{type:s}=t.status;switch(s){case"uploading":return n(yt,{usingCustomTheme:!1,"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(te,{content:t.status.errorMessage,children:n(T,{color:e.colors.red,content:Lt,size:"lg"})});case"uploaded":return n(T,{content:Et,size:"lg"});default:return mt(s),null}},oe=({fileInfo:t,onDelete:e})=>F(Yt,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(qt,{children:n(ee,{fileInfo:t})}),n(Jt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(Qt,{children:St(t.size,N.Byte)}),n(Zt,{"data-testid":"stChatInputDeleteBtn",children:n(tt,{onClick:()=>e(t.id),kind:et.MINIMAL,children:n(T,{content:Ft,size:"lg"})})})]}),ne=i.memo(oe),ae=({items:t,onDelete:e})=>n(Xt,{"data-testid":"stChatUploadedFiles",children:n(Gt,{children:t.map(s=>n(jt,{children:n(ne,{fileInfo:s,onDelete:e})},s.id))})}),re=i.memo(ae),ie=({getNextLocalFileId:t,addFiles:e,updateFile:s,uploadClient:p,element:f,onUploadProgress:u,onUploadComplete:I})=>(y,d)=>{const m=q.CancelToken.source(),c=new nt(d.name,d.size,t(),{type:"uploading",cancelToken:m,progress:1});e([c]),p.uploadFile({formId:"",...f},y.uploadUrl,d,h=>u(h,c.id),m.token).then(()=>I(c.id,y)).catch(h=>{q.isCancel(h)||s(c.id,c.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},se=({acceptMultipleFiles:t,maxFileSize:e,uploadClient:s,uploadFile:p,addFiles:f,getNextLocalFileId:u,deleteExistingFiles:I,onUploadComplete:y})=>(d,m)=>{if(!t&&d.length===0&&m.length>1){const c=m.findIndex(h=>{var x;return((x=h.errors)==null?void 0:x[0].code)===Ut.TooManyFiles});c>=0&&(d.push(m[c].file),m.splice(c,1))}if(!t&&d.length>0&&I(),s.fetchFileURLs(d).then(c=>{Ct(c,d).forEach(([h,x])=>{p(h,x)})}).catch(c=>{f(d.map(h=>new nt(h.name,h.size,u(),{type:"error",errorMessage:c})))}),m.length>0){const c=m.map(h=>zt(h,u(),e));f(c)}y()},le=({getRootProps:t,getInputProps:e,acceptFile:s,disabled:p,theme:f})=>F(Kt,{disabled:p,children:[F(Ot,{"data-testid":"stChatInputFileUploadButton",disabled:p,...t(),children:[n("input",{...e()}),n(It,{content:`Upload or drag and drop ${s===v.Multiple?"files":"a file"}`,placement:Z.TOP,onMouseEnterDelay:500,children:n(tt,{kind:et.MINIMAL,disabled:p,children:n(T,{content:at,size:"lg",color:p?f.colors.fadedText40:f.colors.fadedText60})})})]}),n(_t,{})]}),de=i.memo(le),ce=({getRootProps:t,getInputProps:e,acceptFile:s,inputHeight:p})=>F(ot,{children:[n(At,{height:p,...t(),children:n("input",{...e()})}),n(Pt,{height:p,children:`Drag and drop ${s===v.Multiple?"files":"a file"} here`})]}),pe=i.memo(ce),ue=6.5,$=1,k=(t,e,s)=>s.map(p=>p.id===t?e:p),V=(t,e)=>e.find(s=>s.id===t);function ge({disabled:t,element:e,widgetMgr:s,fragmentId:p,uploadClient:f}){const u=W(),{placeholder:I,maxChars:y}=e,d=i.useRef(null),m=i.useRef(0),c=i.useRef({minHeight:0,maxHeight:0}),[h,x]=bt(),[E,B]=i.useState(e.default),[U,D]=i.useState(0),[H,it]=i.useState(!1),[w,S]=i.useState([]),[z,R]=i.useState(!1),L=i.useMemo(()=>w.some(o=>o.status.type==="uploading")?!1:E!==""||w.length>0,[w,E]),b=vt(e.acceptFile),A=Tt(e.maxUploadSizeMb,N.Megabyte,N.Byte),P=i.useCallback(o=>S(a=>[...a,...o]),[]),K=i.useCallback(o=>{S(a=>{const l=V(o,a);return M(l)?a:(l.status.type==="uploading"&&l.status.cancelToken.cancel(),l.status.type==="uploaded"&&l.status.fileUrls.deleteUrl&&f.deleteFile(l.status.fileUrls.deleteUrl),a.filter(r=>r.id!==o))})},[f]),st=()=>{const o=w.filter(a=>a.status.type==="uploaded").map(a=>{const{name:l,size:r,status:C}=a,{fileId:ut,fileUrls:gt}=C;return new xt({fileId:ut,fileUrls:gt,name:l,size:r})});return new wt({uploadedFileInfo:o})},O=()=>m.current++,lt=se({acceptMultipleFiles:b===v.Multiple,maxFileSize:A,uploadClient:f,uploadFile:ie({getNextLocalFileId:O,addFiles:P,updateFile:(o,a)=>{S(l=>k(o,a,l))},uploadClient:f,element:e,onUploadProgress:(o,a)=>{S(l=>{const r=V(a,l);if(M(r)||r.status.type!=="uploading")return l;const C=Math.round(o.loaded*100/o.total);return r.status.progress===C?l:k(a,r.setStatus({type:"uploading",cancelToken:r.status.cancelToken,progress:C}),l)})},onUploadComplete:(o,a)=>{S(l=>{const r=V(o,l);return M(r)||r.status.type!=="uploading"?l:k(r.id,r.setStatus({type:"uploaded",fileId:a.fileId,fileUrls:a}),l)})}}),addFiles:P,getNextLocalFileId:O,deleteExistingFiles:()=>w.forEach(o=>K(o.id)),onUploadComplete:()=>{d.current&&d.current.focus()}}),{getRootProps:_,getInputProps:X}=Ht({onDrop:lt,multiple:b===v.Multiple,accept:Bt(e.fileType),maxSize:A}),G=()=>{let o=0;const{current:a}=d;return a&&(a.style.height="auto",o=a.scrollHeight,a.style.height=""),o},j=()=>{if(d.current&&d.current.focus(),!L||t)return;const o={data:E,fileUploaderState:st()};s.setChatInputValue(e,o,{fromUi:!0},p),S([]),B(""),D(0)},dt=o=>{const{metaKey:a,ctrlKey:l,shiftKey:r}=o;Rt(o)&&!r&&!l&&!a&&(o.preventDefault(),j())},ct=o=>{const{value:a}=o.target;y!==0&&a.length>y||(B(a),D(G()))};i.useEffect(()=>{if(e.setValue){e.setValue=!1;const o=e.value||"";B(o)}},[e]),i.useLayoutEffect(()=>{if(d.current){const{offsetHeight:o}=d.current;c.current.minHeight=o,c.current.maxHeight=o*ue}},[d]),i.useEffect(()=>{const o=r=>{var C;r.preventDefault(),r.stopPropagation(),!z&&((C=r.dataTransfer)!=null&&C.types.includes("Files"))&&R(!0)},a=r=>{r.preventDefault(),r.stopPropagation(),z&&(r.clientX<=0&&r.clientY<=0||r.clientX>=window.innerWidth&&r.clientY>=window.innerHeight)&&R(!1)},l=r=>{r.preventDefault(),r.stopPropagation(),z&&R(!1)};return window.addEventListener("dragover",o),window.addEventListener("drop",l),window.addEventListener("dragleave",a),()=>{window.removeEventListener("dragover",o),window.removeEventListener("drop",l),window.removeEventListener("dragleave",a)}},[z]),i.useLayoutEffect(()=>{const{minHeight:o}=c.current;it(U>0&&d.current?Math.abs(U-o)>$:!1)},[U]),i.useLayoutEffect(()=>{D(G())},[I]);const{maxHeight:Y}=c.current,pt=b!==v.None&&z;return F(ot,{children:[b===v.None?null:n(re,{items:[...w],onDelete:K}),n($t,{className:"stChatInput","data-testid":"stChatInput",ref:x,children:pt?n(pe,{getRootProps:_,getInputProps:X,acceptFile:b,inputHeight:H?`${U+$}px`:u.sizes.minElementHeight}):F(kt,{extended:H,children:[b===v.None?null:n(de,{getRootProps:_,getInputProps:X,acceptFile:b,disabled:t,theme:u}),n(Mt,{inputRef:d,value:E,placeholder:I,onChange:ct,onKeyDown:dt,"aria-label":I,disabled:t,rows:1,overrides:{Root:{style:{minHeight:u.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:u.lineHeights.inputWidget,"::placeholder":{opacity:"0.7"},height:H?`${U+$}px`:"auto",maxHeight:Y?`${Y}px`:"none",paddingLeft:u.spacing.none,paddingBottom:u.spacing.sm,paddingTop:u.spacing.sm,paddingRight:`calc(${u.iconSizes.xl} + 2 * ${u.spacing.sm} + ${u.spacing.sm})`}}}}),h>u.breakpoints.hideWidgetDetails&&n(Wt,{children:n(Dt,{dirty:L,value:E,maxLength:y,type:"chat",inForm:!1})}),n(Nt,{children:n(Vt,{onClick:j,disabled:!L||t,extended:H,"data-testid":"stChatInputSubmitButton",children:n(T,{content:rt,size:"xl",color:"inherit"})})})]})})]})}const xe=i.memo(ge);export{xe as default};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{n as s,k as i,r as m,j as e}from"./index.
|
1
|
+
import{n as s,k as i,r as m,j as e}from"./index.BtpsTdHN.js";import{P as c,R as l}from"./RenderInPortalIfExists.C_c286r8.js";const p=""+new URL("../media/flake-0.DgWaVvm5.png",import.meta.url).href,d=""+new URL("../media/flake-1.B2r5AHMK.png",import.meta.url).href,f=""+new URL("../media/flake-2.BnWSExPC.png",import.meta.url).href,o=150,S=150,g=10,E=90,u=4e3,n=(t,a=0)=>Math.random()*(t-a)+a,w=()=>i(`from{transform:translateY(0)
|
2
2
|
rotateX(`,n(360),`deg)
|
3
3
|
rotateY(`,n(360),`deg)
|
4
4
|
rotateZ(`,n(360),"deg);}to{transform:translateY(calc(100vh + ",o,`px))
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{bs as Z,bt as J,r as f,bu as Q,z as Y,bv as s,j as S,C as ee,bo as te,bw as re,bp as ne,b5 as oe,bx as ie,bq as ae,bm as ue,b0 as C,a$ as W,b2 as le}from"./index.
|
1
|
+
import{bs as Z,bt as J,r as f,bu as Q,z as Y,bv as s,j as S,C as ee,bo as te,bw as re,bp as ne,b5 as oe,bx as ie,bq as ae,bm as ue,b0 as C,a$ as W,b2 as le}from"./index.BtpsTdHN.js";import{a as ce}from"./useBasicWidgetState.CTpx4w-3.js";import"./FormClearHelper.BAxB8JFY.js";var se={secondary:"secondary"},G={default:"default"},fe={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=Z("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==G.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function j(e){"@babel/helpers - typeof";return j=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},j(e)}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},M.apply(this,arguments)}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t){return he(e)||me(e,t)||be(e,t)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function be(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function me(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,p;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,p=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw p}}return n}}function he(e){if(Array.isArray(e))return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Se(e,t,r){return t&&ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oe(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,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$(e,t)}function Ee(e){var t=we();return function(){var n=I(e),o;if(t){var i=I(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _e(this,o)}}function _e(e,t){if(t&&(j(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){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 I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},I(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var F=function(e){Oe(r,e);var t=Ee(r);function r(){var n;ge(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(K(n),"childRefs",{}),n}return Se(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,p=a===void 0?{}:a,c=i.mode,P=c===void 0?k.checkbox:c,d=i.children,y=i.selected,m=i.disabled,l=i.onClick,_=i.kind,h=i.shape,w=i.size,T=J(p.Root,z),O=de(T,2),E=O[0],L=O[1],H=this.props["aria-label"]||this.props.ariaLabel,g=P===k.radio,V=f.Children.count(d);return f.createElement(Q.Consumer,null,function(q){return f.createElement(E,M({"aria-label":H||q.buttongroup.ariaLabel,"data-baseweb":"button-group",role:g?"radiogroup":"group",$shape:h,$length:d.length},L),f.Children.map(d,function(b,R){if(!f.isValidElement(b))return null;var A=b.props.isSelected?b.props.isSelected:Le(y,R);return g&&(o.childRefs[R]=f.createRef()),f.cloneElement(b,{disabled:m||b.props.disabled,isSelected:A,ref:g?o.childRefs[R]:void 0,tabIndex:!g||A||g&&(!y||y===-1)&&R===0?0:-1,onKeyDown:function(u){if(g){var v=Number(y)?Number(y):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var B=v-1<0?V-1:v-1;l&&l(u,B),o.childRefs[B].current&&o.childRefs[B].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var D=v+1>V-1?0:v+1;l&&l(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}}},kind:_,onClick:function(u){m||(b.props.onClick&&b.props.onClick(u),l&&l(u,R))},shape:h,size:w,overrides:pe({BaseButton:{style:function(u){var v=u.$theme;return d.length===1?{}:h!==G.default?{marginLeft:v.sizing.scale100,marginRight:v.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":A,role:g?"radio":"checkbox"}}},b.props.overrides)})}))})}}]),r}(f.Component);N(F,"defaultProps",{disabled:!1,onClick:function(){},shape:G.default,size:fe.default,kind:se.secondary});function Re(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Ce(e,t,r){return e==s.ClickMode.MULTI_SELECT?Re(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Pe(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ie(e,t,r){const n=r===s.Style.PILLS?C.PILLS:r===s.Style.BORDERLESS?C.BORDERLESS_ICON:C.SEGMENTED_CONTROL,o=r===s.Style.BORDERLESS?W.XSMALL:W.MEDIUM,i=n===C.PILLS||n===C.SEGMENTED_CONTROL,a=r===s.Style.BORDERLESS?"lg":"base";return{element:S(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Te(e,t,r,n){return r.indexOf(n)>-1?!0:t!==s.ClickMode.SINGLE_SELECT||e!==s.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function Ae(e,t){return e&&(t=`${t}Active`),t}function Be(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case s.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case s.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case s.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function De(e,t,r,n,o,i){const a=Te(r,n,o,t);let p=e.content,c=e.contentIcon;return a&&(p=e.selectedContent?e.selectedContent:p,c=e.selectedContentIcon?e.selectedContentIcon:c),f.forwardRef(function(d,y){const{element:m,kind:l,size:_}=Ie(p??"",c??void 0,i),h=Ae(!!(a&&!e.selectedContent&&!e.selectedContentIcon),l);return S(ue,{...d,size:_,kind:h,children:m})})}function je(e,t){return e.getIntArrayValue(t)}function Me(e){return e.default??null}function $e(e){return e.value??null}function Ge(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:p,style:c,label:P,labelVisibility:d,help:y}=r,m=Y(),[l,_]=ce({getStateFromWidgetMgr:je,getDefaultStateFromProto:Me,getCurrStateFromProto:$e,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),h=(O,E)=>{const L=Ce(i,E,l);_({value:L,fromUi:!0})};let w;i===s.ClickMode.SINGLE_SELECT?w=k.radio:i===s.ClickMode.MULTI_SELECT&&(w=k.checkbox);const T=f.useMemo(()=>a.map((O,E)=>{const L=De(O,E,p,i,l,c);return S(L,{},`${O.content}-${E}`)}),[i,a,p,c,l]);return ee("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[S(ae,{label:P,disabled:t,labelVisibility:te((d==null?void 0:d.value)??ie.LabelVisibilityOptions.COLLAPSED),children:y&&S(re,{children:S(ne,{content:y,placement:oe.TOP})})}),S(F,{disabled:t,mode:w,onClick:h,selected:i===s.ClickMode.MULTI_SELECT?l:Pe(l),overrides:{Root:{style:f.useCallback(()=>Be(c,m.spacing),[c,m.spacing])}},children:T})]})}const Ue=f.memo(Ge);export{Ue as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{n as h,r as i,bf as T,j as p,l as b}from"./index.
|
1
|
+
import{n as h,r as i,bf as T,j as p,l as b}from"./index.BtpsTdHN.js";const L=h("iframe",{target:"eymnmwl0"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"})),N=b.getLogger("Video"),U={width:"100%"};function R({element:r,endpoints:s,elementMgr:l}){const n=i.useRef(null),{type:y,url:f,startTime:a,subtitles:d,endTime:o,loop:c,autoplay:m,muted:E}=r,S=i.useMemo(()=>{if(!r.id)return!0;const e=l.getElementState(r.id,"preventAutoplay");return e||l.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,l]),v=i.useMemo(()=>JSON.stringify(d?d.map(e=>s.buildMediaURL(`${e.url}`)):[]),[d,s]);i.useEffect(()=>{const e=JSON.parse(v);e.length!==0&&e.forEach(t=>{s.checkSourceUrlResponse(t,"Video Subtitle")})},[v,s]),i.useEffect(()=>{n.current&&(n.current.currentTime=a)},[a]),i.useEffect(()=>{const e=n.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),i.useEffect(()=>{const e=n.current;if(!e)return;let t=!1;const u=()=>{o>0&&e.currentTime>=o&&(c?(e.currentTime=a||0,e.play()):t||(t=!0,e.pause()))};return o>0&&e.addEventListener("timeupdate",u),()=>{e&&o>0&&e.removeEventListener("timeupdate",u)}},[o,c,a]),i.useEffect(()=>{const e=n.current;if(!e)return;const t=()=>{c&&(e.currentTime=a||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[c,a]);const g=e=>{const t=new URL(e);if(a&&!isNaN(a)&&t.searchParams.append("start",a.toString()),o&&!isNaN(o)&&t.searchParams.append("end",o.toString()),c){t.searchParams.append("loop","1");const u=t.pathname.split("/").pop();u&&t.searchParams.append("playlist",u)}return m&&t.searchParams.append("autoplay","1"),E&&t.searchParams.append("mute","1"),t.toString()};if(y===T.Type.YOUTUBE_IFRAME)return p(L,{className:"stVideo","data-testid":"stVideo",title:f,src:g(f),allow:"autoplay; encrypted-media",allowFullScreen:!0});const V=e=>{const t=e.currentTarget.src;N.error(`Client Error: Video source error - ${t}`),s.sendClientErrorToHost("Video","Video source failed to load","onerror triggered",t)};return p("video",{className:"stVideo","data-testid":"stVideo",ref:n,controls:!0,muted:E,autoPlay:m&&!S,src:s.buildMediaURL(f),style:U,crossOrigin:void 0,onError:V,children:d&&d.map((e,t)=>p("track",{kind:"captions",src:s.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0,"data-testid":"stVideoSubtitle"},t))})}const A=i.memo(R);export{A as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{n as e,r as a,C as t,j as r,aC as o}from"./index.
|
1
|
+
import{n as e,r as a,C as t,j as r,aC as o}from"./index.BtpsTdHN.js";import{P as i}from"./ProgressBar.BwRgGfI0.js";const l=e("div",{target:"e1675qd10"})(({theme:s})=>({paddingBottom:s.spacing.sm,lineHeight:"normal"}));function n({element:s}){return t("div",{className:"stProgress","data-testid":"stProgress",children:[r(l,{children:r(o,{source:s.text,allowHTML:!1,isLabel:!0})}),r(i,{value:s.value})]})}const m=a.memo(n);export{m as default};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{r as h,E as $,_ as H,b6 as mt,bg as $t,bh as Ht,bi as Vt,M as X,O as q,aE as jt,n as P,bj as Gt,C as N,j as v,bk as Xt,b0 as qt,bl as Yt,bm as Kt,l as Jt,z as Qt,bn as tt,H as Zt,aA as te,bo as ee,bp as ie,b5 as se,bq as ne}from"./index.DwUISpCs.js";import{u as re,F as oe}from"./FormClearHelper.W8yVYXZp.js";import{T as ae,a as ft}from"./Toolbar.BVF7NtOB.js";import{u as le}from"./Hooks.DBj6srQ1.js";import{c as ce}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as de,D as he}from"./FileDownload.esm.ncu7N-Hr.js";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});yt.displayName="Mic";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});wt.displayName="Pause";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});St.displayName="PlayArrow";var Ct=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});Ct.displayName="Refresh";var Et=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});Et.displayName="StopCircle";function R(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(c){try{d(i.next(c))}catch(l){r(l)}}function o(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return R(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let a=0;a<n;a++){const o=Math.abs(i[a]);o>r&&(r=o)}for(const a of e)for(let o=0;o<n;o++)a[o]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s==null?void 0:s[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Rt(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children")for(const[r,a]of Object.entries(t))typeof a=="string"?e.appendChild(document.createTextNode(a)):e.appendChild(Rt(r,a));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function gt(s,t,e){const i=Rt(s,t||{});return e==null||e.appendChild(i),i}var ue=Object.freeze({__proto__:null,createElement:gt,default:gt});const pe={fetchBlob:function(s,t,e){return R(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){R(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const a=n.body.getReader(),o=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>R(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const u=Math.round(d/o*100);r(u)}),l=()=>R(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class me extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;i&&(this.media.src="");try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return R(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class U extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,a=(e+n)/i;this.emit("scroll",r,a,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,a=0,o=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const b=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-b<o)return;const D=w.clientX,T=w.clientY,k=D-u,W=T-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i==null||i(u-F,m-L),f=!0),e(k,W,D-F,T-L),u=D,m=T}},S=w=>{if(f){const D=w.clientX,T=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n==null||n(D-W,T-O)}c()},y=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},x=w=>{f&&(w.stopPropagation(),w.preventDefault())},A=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",A,{passive:!1}),document.addEventListener("click",x,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",A),setTimeout(()=>{document.removeEventListener("click",x,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e!=null&&e.every(a=>!a.overlay)?r/n:r}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
|
1
|
+
import{r as h,E as $,_ as H,b6 as mt,bg as $t,bh as Ht,bi as Vt,M as X,O as q,aE as jt,n as P,bj as Gt,C as N,j as v,bk as Xt,b0 as qt,bl as Yt,bm as Kt,l as Jt,z as Qt,bn as tt,H as Zt,aA as te,bo as ee,bp as ie,b5 as se,bq as ne}from"./index.BtpsTdHN.js";import{u as re,F as oe}from"./FormClearHelper.BAxB8JFY.js";import{T as ae,a as ft}from"./Toolbar.5tXjF_eX.js";import{u as le}from"./Hooks.Bjt8oBOT.js";import{c as ce}from"./createDownloadLinkElement.DZMwyjvU.js";import{F as de,D as he}from"./FileDownload.esm.NuObx1Tl.js";var yt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),h.createElement("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"}))});yt.displayName="Mic";var wt=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 19c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2v10c0 1.1.9 2 2 2zm6-12v10c0 1.1.9 2 2 2s2-.9 2-2V7c0-1.1-.9-2-2-2s-2 .9-2 2z"}))});wt.displayName="Pause";var St=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("rect",{width:24,height:24,fill:"none"}),h.createElement("path",{d:"M8 6.82v10.36c0 .79.87 1.27 1.54.84l8.14-5.18a1 1 0 000-1.69L9.54 5.98A.998.998 0 008 6.82z"}))});St.displayName="PlayArrow";var Ct=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),h.createElement("path",{d:"M17.65 6.35a7.95 7.95 0 00-6.48-2.31c-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20a7.98 7.98 0 007.21-4.56c.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53a5.994 5.994 0 01-6.8 3.31c-2.22-.49-4.01-2.3-4.48-4.52A6.002 6.002 0 0112 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71l-.64.65z"}))});Ct.displayName="Refresh";var Et=h.forwardRef(function(s,t){var e={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return h.createElement($,H({iconAttrs:e,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},s,{ref:t}),h.createElement("g",{fill:"none"},h.createElement("rect",{width:24,height:24}),h.createElement("rect",{width:24,height:24})),h.createElement("path",{fillRule:"evenodd",d:"M9 16h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"}))});Et.displayName="StopCircle";function R(s,t,e,i){return new(e||(e=Promise))(function(n,r){function a(c){try{d(i.next(c))}catch(l){r(l)}}function o(c){try{d(i.throw(c))}catch(l){r(l)}}function d(c){var l;c.done?n(c.value):(l=c.value,l instanceof e?l:new e(function(p){p(l)})).then(a,o)}d((i=i.apply(s,t||[])).next())})}let V=class{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),this.listeners[t].add(e),i==null?void 0:i.once){const n=()=>{this.un(t,n),this.un(t,e)};return this.on(t,n),n}return()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(i=>i(...e))}};const j={decode:function(s,t){return R(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(s).finally(()=>e.close())})},createBuffer:function(s,t){return typeof s[0]=="number"&&(s=[s]),function(e){const i=e[0];if(i.some(n=>n>1||n<-1)){const n=i.length;let r=0;for(let a=0;a<n;a++){const o=Math.abs(i[a]);o>r&&(r=o)}for(const a of e)for(let o=0;o<n;o++)a[o]/=r}}(s),{duration:t,length:s[0].length,sampleRate:s[0].length/t,numberOfChannels:s.length,getChannelData:e=>s==null?void 0:s[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Rt(s,t){const e=t.xmlns?document.createElementNS(t.xmlns,s):document.createElement(s);for(const[i,n]of Object.entries(t))if(i==="children")for(const[r,a]of Object.entries(t))typeof a=="string"?e.appendChild(document.createTextNode(a)):e.appendChild(Rt(r,a));else i==="style"?Object.assign(e.style,n):i==="textContent"?e.textContent=n:e.setAttribute(i,n.toString());return e}function gt(s,t,e){const i=Rt(s,t||{});return e==null||e.appendChild(i),i}var ue=Object.freeze({__proto__:null,createElement:gt,default:gt});const pe={fetchBlob:function(s,t,e){return R(this,void 0,void 0,function*(){const i=yield fetch(s,e);if(i.status>=400)throw new Error(`Failed to fetch ${s}: ${i.status} (${i.statusText})`);return function(n,r){R(this,void 0,void 0,function*(){if(!n.body||!n.headers)return;const a=n.body.getReader(),o=Number(n.headers.get("Content-Length"))||0;let d=0;const c=p=>R(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const u=Math.round(d/o*100);r(u)}),l=()=>R(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(c(p.value),yield l())});l()})}(i.clone(),t),i.blob()})}};class me extends V{constructor(t){super(),this.isExternalMedia=!1,t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)},{once:!0})}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;i&&(this.media.src="");try{this.media.src=n}catch{this.media.src=t}}destroy(){this.isExternalMedia||(this.media.pause(),this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(t){this.media=t}play(){return R(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}class U extends V{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,r]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=r.querySelector(".scroll"),this.wrapper=r.querySelector(".wrapper"),this.canvasWrapper=r.querySelector(".canvases"),this.progressWrapper=r.querySelector(".progress"),this.cursor=r.querySelector(".cursor"),e&&r.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const i=this.wrapper.getBoundingClientRect(),n=e.clientX-i.left,r=e.clientY-i.top;return[n/i.width,r/i.height]};if(this.wrapper.addEventListener("click",e=>{const[i,n]=t(e);this.emit("click",i,n)}),this.wrapper.addEventListener("dblclick",e=>{const[i,n]=t(e);this.emit("dblclick",i,n)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:i,clientWidth:n}=this.scrollContainer,r=e/i,a=(e+n)/i;this.emit("scroll",r,a,e,e+n)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,i,n,r=3,a=0,o=100){if(!t)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let c=()=>{};const l=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,m=p.clientY,f=!1;const b=Date.now(),g=w=>{if(w.preventDefault(),w.stopPropagation(),d&&Date.now()-b<o)return;const D=w.clientX,T=w.clientY,k=D-u,W=T-m;if(f||Math.abs(k)>r||Math.abs(W)>r){const O=t.getBoundingClientRect(),{left:F,top:L}=O;f||(i==null||i(u-F,m-L),f=!0),e(k,W,D-F,T-L),u=D,m=T}},S=w=>{if(f){const D=w.clientX,T=w.clientY,k=t.getBoundingClientRect(),{left:W,top:O}=k;n==null||n(D-W,T-O)}c()},y=w=>{w.relatedTarget&&w.relatedTarget!==document.documentElement||S(w)},x=w=>{f&&(w.stopPropagation(),w.preventDefault())},A=w=>{f&&w.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",S),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",A,{passive:!1}),document.addEventListener("click",x,{capture:!0}),c=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",S),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",A),setTimeout(()=>{document.removeEventListener("click",x,{capture:!0})},10)}};return t.addEventListener("pointerdown",l),()=>{c(),t.removeEventListener("pointerdown",l)}}(this.wrapper,(t,e,i)=>{this.emit("drag",Math.max(0,Math.min(1,i/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var i;const n=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const r=this.parent.clientHeight||128;return e!=null&&e.every(a=>!a.overlay)?r/n:r}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
|
2
2
|
<style${i?` nonce="${i}"`:""}>
|
3
3
|
:host {
|
4
4
|
user-select: none;
|
@@ -1 +1 @@
|
|
1
|
-
import{n as p,r as s,z as T,C as x,j as i,D as w,aC as h,aQ as r,
|
1
|
+
import{n as p,r as s,z as T,C as x,j as i,D as w,aC as h,aQ as r,F as v,B as m,aR as k,aS as z}from"./index.BtpsTdHN.js";const R=p("button",{target:"e1rpgzpk0"})(({theme:o})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,color:o.colors.fadedText60,backgroundColor:o.colors.transparent,fontFamily:"inherit",margin:o.spacing.none,border:"none",boxShadow:"none",padding:o.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:o.colors.primary}})),C=p("div",{target:"e1rpgzpk1"})(({theme:o})=>({display:"flex",flexDirection:"row",gap:o.spacing.lg,"> span":{marginTop:o.spacing.twoXS}})),L=p("div",{target:"e1rpgzpk3"})(({theme:o})=>({display:"flex",flexDirection:"column",gap:o.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,div:{display:"inline-flex"}}));function B(o){const a=m(o);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:o.spacing.md,width:o.sizes.toastWidth,marginTop:o.spacing.sm,borderTopLeftRadius:o.radii.default,borderTopRightRadius:o.radii.default,borderBottomLeftRadius:o.radii.default,borderBottomRightRadius:o.radii.default,paddingTop:o.spacing.lg,paddingBottom:o.spacing.lg,paddingLeft:o.spacing.twoXL,paddingRight:o.spacing.twoXL,backgroundColor:a?o.colors.gray10:o.colors.gray90,color:o.colors.bodyText,boxShadow:a?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:o.colors.fadedText40,width:o.fontSizes.lg,height:o.fontSizes.lg,marginRight:`calc(-1 * ${o.spacing.lg} / 2)`,":hover":{color:o.colors.bodyText}}}}}function E(o){if(o.length>104){let t=o.replace(/^(.{104}[^\s]*).*/,"$1");return t.length>104&&(t=t.substring(0,104).split(" ").slice(0,-1).join(" ")),t.trim()}return o}function D({body:o,icon:a}){const t=T(),n=E(o),d=o!==n,[e,y]=s.useState(!d),[u,b]=s.useState(0),f=s.useCallback(()=>{y(!e)},[e]),c=s.useMemo(()=>B(t),[t]),l=s.useMemo(()=>x(C,{expanded:e,children:[a&&i(w,{iconValue:a,size:"xl",testid:"stToastDynamicIcon"}),x(L,{children:[i(h,{source:e?o:n,allowHTML:!1,isToast:!0}),d&&i(R,{"data-testid":"stToastViewButton",onClick:f,children:e?"view less":"view more"})]})]}),[d,e,o,a,n,f]);s.useEffect(()=>{if(t.inSidebar)return;const g=r.info(l,{overrides:{...c}});return b(g),()=>{r.update(g,{overrides:{Body:{style:{display:"none"}}}}),r.clear(g)}},[]),s.useEffect(()=>{r.update(u,{children:l,overrides:{...c}})},[u,l,c]);const S=i(z,{kind:k.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`. See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information."});return i(v,{children:t.inSidebar&&S})}const I=s.memo(D);export{I as default};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{d as Ze,bs as J,r as C,bW as vt,bJ as mt,bt as G,bX as bt,bY as yt,n as me,J as Tt,bB as kt,z as Ot,aM as wt,C as ze,j as re,cl as Rt,bo as St,bC as Mt,bp as _t,b5 as $t,bq as Et,S as It,cm as $e}from"./index.DwUISpCs.js";import{s as Ve}from"./sprintf.D7DtBTRn.js";import{a as Ct}from"./useBasicWidgetState.C-e-WEFS.js";import"./FormClearHelper.W8yVYXZp.js";var se={},H={},ue={},ce={},Ne;function Ie(){if(Ne)return ce;Ne=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 Ue;function Ge(){return Ue||(Ue=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=Ze(),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*_),V=Math.floor(i*_-Math.abs(U)),W=U===0?i:V/_,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(V,W){return V-W}).map(function(V){return(V-h)/(b-h)*100}),U=I.reduce(function(V,W,A){return"".concat(V,", ").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),V=o[I].x;o.forEach(function(W,A){var L=W.x,Z=M(u[A],h[A],b,g,O);I!==A&&(V>=L&&V<=L+Z||V+U>=L&&V+U<=L+Z)&&(_.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))),V=U[0],W=U[1];return(0,a.useEffect)(function(){if(i){var A=i.getThumbs();if(A.length<1)return;var L={},Z=i.getOffsets(),ne=D(u,Z,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),[Z[pe[ge]].x],!1):[Z[pe[ge]].x]},[]);if(Math.min.apply(Math,Q)===Z[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]),[V,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 z=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=z}(ue)),ue}var He;function xt(){if(He)return H;He=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(Ze()),c=Ge(),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(),z=(0,c.getMargin)(M);switch(l){case f.Direction.Right:return m.x=(z.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=(z.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+z.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+z.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,z=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(z&&(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)}z&&(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,z=x.draggedThumbIndex,i=x.thumbZIndexes,o=x.markOffsets;return v({props:{style:{transform:"scale(1)",cursor:z>-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 We;function Dt(){return We||(We=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(xt());e.Range=a.default;var s=Ge();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 Je=Dt();function qe(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?qe(Object(a),!0).forEach(function(s){Pt(e,s,a[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):qe(Object(a)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(a,s))})}return e}function Pt(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:Je.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 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 Bt(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){At(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 At(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)||jt(e,r)||Ft(e,r)||Lt()}function Lt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
1
|
+
import{d as Ze,bs as J,r as C,bW as vt,bJ as mt,bt as G,bX as bt,bY as yt,n as me,J as Tt,bB as kt,z as Ot,aM as wt,C as ze,j as re,cl as Rt,bo as St,bC as Mt,bp as _t,b5 as $t,bq as Et,S as It,cm as $e}from"./index.BtpsTdHN.js";import{s as Ve}from"./sprintf.D7DtBTRn.js";import{a as Ct}from"./useBasicWidgetState.CTpx4w-3.js";import"./FormClearHelper.BAxB8JFY.js";var se={},H={},ue={},ce={},Ne;function Ie(){if(Ne)return ce;Ne=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 Ue;function Ge(){return Ue||(Ue=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=Ze(),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*_),V=Math.floor(i*_-Math.abs(U)),W=U===0?i:V/_,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(V,W){return V-W}).map(function(V){return(V-h)/(b-h)*100}),U=I.reduce(function(V,W,A){return"".concat(V,", ").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),V=o[I].x;o.forEach(function(W,A){var L=W.x,Z=M(u[A],h[A],b,g,O);I!==A&&(V>=L&&V<=L+Z||V+U>=L&&V+U<=L+Z)&&(_.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))),V=U[0],W=U[1];return(0,a.useEffect)(function(){if(i){var A=i.getThumbs();if(A.length<1)return;var L={},Z=i.getOffsets(),ne=D(u,Z,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),[Z[pe[ge]].x],!1):[Z[pe[ge]].x]},[]);if(Math.min.apply(Math,Q)===Z[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]),[V,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 z=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=z}(ue)),ue}var He;function xt(){if(He)return H;He=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(Ze()),c=Ge(),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(),z=(0,c.getMargin)(M);switch(l){case f.Direction.Right:return m.x=(z.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=(z.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+z.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+z.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,z=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(z&&(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)}z&&(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,z=x.draggedThumbIndex,i=x.thumbZIndexes,o=x.markOffsets;return v({props:{style:{transform:"scale(1)",cursor:z>-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 We;function Dt(){return We||(We=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(xt());e.Range=a.default;var s=Ge();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 Je=Dt();function qe(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?qe(Object(a),!0).forEach(function(s){Pt(e,s,a[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):qe(Object(a)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(a,s))})}return e}function Pt(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:Je.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 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 Bt(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){At(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 At(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)||jt(e,r)||Ft(e,r)||Lt()}function Lt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ft(e,r){if(e){if(typeof e=="string")return Ye(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 Ye(e,r)}}function Ye(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 jt(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 Vt=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 Nt(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(X){return X}:k,w=e.value,R=C.useContext(vt),M=C.useState(!1),D=K(M,2),m=D[0],x=D[1],z=C.useState(!1),i=K(z,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],V=C.useCallback(function(X){mt(X)&&O(!0);var N=X.target.parentNode.firstChild===X.target?0:1;U(N)},[]),W=C.useCallback(function(X){g!==!1&&O(!1),U(-1)},[]),A=Vt(w),L={$disabled:p,$step:l,$min:T,$max:t,$marks:c,$value:A,$isFocusVisible:g},Z=G(a.Root,be),ne=K(Z,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],Qe=G(a.Thumb,Re),Ce=K(Qe,2),et=Ce[0],tt=Ce[1],rt=G(a.InnerThumb,Se),xe=K(rt,2),nt=xe[0],at=xe[1],it=G(a.ThumbValue,Me),De=K(it,2),ot=De[0],st=De[1],ut=G(a.Tick,Oe),Pe=K(ut,2),Be=Pe[0],Ae=Pe[1],ct=G(a.TickBar,we),Le=K(ct,2),lt=Le[0],dt=Le[1],ft=G(a.Mark,ke),Fe=K(ft,2),ht=Fe[0],gt=Fe[1];return C.createElement(le,Y({"data-baseweb":"slider"},L,Q,{onFocus:yt(Q,V),onBlur:bt(Q,W)}),C.createElement(Je.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(et,Y({},te,{onMouseEnter:function(){q===0?x(!0):u(!0)},onMouseLeave:function(){q===0?x(!1):u(!1)},$thumbIndex:q,$isDragged:ae,style:Bt({},te.style)},L,tt,{$isFocusVisible:g&&I===q}),je&&C.createElement(ot,Y({$thumbIndex:q,$isDragged:ae},L,st),E(A[q])),je&&C.createElement(nt,Y({$thumbIndex:q,$isDragged:ae},L,at)))}},c?{renderMark:function(N){var te=N.props,q=N.index;return C.createElement(ht,Y({$markIndex:q},te,L,gt))}}:{})),C.createElement(lt,Y({},L,dt),C.createElement(Be,Y({},L,Ae),E(T)),C.createElement(Be,Y({},L,Ae),E(t))))}const Ut=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 ${Tt(r.colors.primary,.5)}`}})),Ht=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"})),Wt=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"})),qt=200;function Kt({disabled:e,element:r,widgetMgr:a,fragmentId:s}){var D;const[p,S]=Ct({getStateFromWidgetMgr:Yt,getDefaultStateFromProto:Xt,getCurrStateFromProto:Zt,updateWidgetMgrState:Gt,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}=Ot(),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(wt(qt,m=>{S({value:m,fromUi:!0})}),[]),E=C.useCallback(({value:m})=>{f(m),k(m)},[k]),w=C.useCallback(()=>ze(Wt,{"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(C.forwardRef(function(x,z){const{$thumbIndex:i}=x,o=i||0;F[o]=z,B[o]||(B[o]=C.createRef());const u=Rt(x,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),h=n[o];return re(Ut,{...u,disabled:x.$disabled===!0,ref:F[o],"aria-valuetext":h,"aria-label":y,children:re(Ht,{"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,z=(u=F[1])==null?void 0:u.current,i=B[0].current,o=(h=B[1])==null?void 0:h.current;er(m,x,z,i,o)});const M=C.useCallback(({$disabled:m})=>({height:t.twoXS,...m?{background:$.darkenedBgMix25}:{}}),[$,t]);return ze("div",{ref:j,className:"stSlider","data-testid":"stSlider",children:[re(Et,{label:r.label,disabled:e,labelVisibility:St((D=r.labelVisibility)==null?void 0:D.value),children:r.help&&re(Mt,{children:re(_t,{content:r.help,placement:$t.TOP_RIGHT})})}),re(Nt,{min:r.min,max:r.max,step:r.step,value:Qt(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 Yt(e,r){return e.getDoubleArrayValue(r)}function Xt(e){return e.default}function Zt(e){return e.value}function Gt(e,r,a,s){r.setDoubleArrayValue(e,a.value,{fromUi:a.fromUi},s)}function Jt(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 Jt(r)?It.utc(e/1e3).format(a):s.length>0?Ve.sprintf(a,s[e]):Ve.sprintf(a,e)}function Qt(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 er(e,r,a,s,p){!e||!r||!s||(ie(e,r,s),a&&p&&(ie(e,a,p),tr(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 tr(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 or=kt(C.memo(Kt));export{or as default};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{bt as v,r as l,cf as q,ck as S,ch as p}from"./index.
|
1
|
+
import{bt as v,r as l,cf as q,ck as S,ch as p}from"./index.BtpsTdHN.js";import{R as C,c as w,d as J,B as M}from"./base-input.wfBDFTlB.js";function _(e){"@babel/helpers - typeof";return _=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(e)}var U=["Root","StartEnhancer","EndEnhancer"],Z=["startEnhancer","endEnhancer","overrides"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function O(e,t){return V(e)||Q(e,t)||K(e,t)||G()}function G(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(e,t){if(e){if(typeof e=="string")return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(e,t)}}function j(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Q(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,i,u;try{for(r=r.call(e);!(o=(i=r.next()).done)&&(n.push(i.value),!(t&&n.length===t));o=!0);}catch(b){a=!0,u=b}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}return n}}function V(e){if(Array.isArray(e))return e}function I(e,t){if(e==null)return{};var r=X(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function X(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function te(e,t,r){return t&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function re(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},m(e,t)}function ne(e){var t=ae();return function(){var n=h(e),o;if(t){var a=h(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return oe(this,o)}}function oe(e,t){if(t&&(_(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ie=function(e){re(r,e);var t=ne(r);function r(){var n;Y(this,r);for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=t.call.apply(t,[this].concat(a)),d(y(n),"state",{isFocused:n.props.autoFocus||!1}),d(y(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),d(y(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return te(r,[{key:"render",value:function(){var o=this.props,a=o.startEnhancer,i=o.endEnhancer,u=o.overrides,b=u.Root,A=u.StartEnhancer,B=u.EndEnhancer,F=I(u,U),T=I(o,Z),x=v(b,C),g=O(x,2),$=g[0],N=g[1],D=v(A,w),E=O(D,2),W=E[0],k=E[1],z=v(B,w),P=O(z,2),H=P[0],L=P[1],s=J(this.props,this.state);return l.createElement($,f({"data-baseweb":"input"},s,N,{$adjoined:R(a,i),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),c(a)&&l.createElement(W,f({},s,k,{$position:S.start}),typeof a=="function"?a(s):a),l.createElement(M,f({},T,{overrides:F,adjoined:R(a,i),onFocus:this.onFocus,onBlur:this.onBlur})),c(i)&&l.createElement(H,f({},s,L,{$position:S.end}),typeof i=="function"?i(s):i))}}]),r}(l.Component);d(ie,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:q.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function R(e,t){return c(e)&&c(t)?p.both:c(e)?p.left:c(t)?p.right:p.none}function c(e){return!!(e||e===0)}export{ie as I};
|
@@ -1 +1 @@
|
|
1
|
-
import{c as p,e as c}from"./es6.
|
1
|
+
import{c as p,e as c}from"./es6.B_HLnUb9.js";import"./index.BtpsTdHN.js";const{File:n,Blob:_,DOMException:s}=p,{INVALID:z,GONE:r,MISMATCH:w,MOD_ERR:b,SYNTAX:a,SECURITY:I,DISALLOWED:m}=c;class g{constructor(e,i){this.fileHandle=e,this.file=i,this.size=i.size,this.position=0}write(e){let i=this.file;if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.position=e.position,this.size<e.position&&(this.file=new n([this.file,new ArrayBuffer(e.position-this.size)],this.file.name,this.file))),!("data"in e))throw new s(...a("write requires a data argument"));e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.size<e.position)throw new s(...z);this.position=e.position;return}else throw new s(...a("seek requires a position argument"));else if(e.type==="truncate")if(Number.isInteger(e.size)&&e.size>=0){i=e.size<this.size?new n([i.slice(0,e.size)],i.name,i):new n([i,new Uint8Array(e.size-this.size)],i.name),this.size=i.size,this.position>i.size&&(this.position=i.size),this.file=i;return}else throw new s(...a("truncate requires a size argument"))}e=new _([e]);let t=this.file;const o=t.slice(0,this.position),y=t.slice(this.position+e.size);let l=this.position-o.size;l<0&&(l=0),t=new n([o,new Uint8Array(l),e,y],t.name),this.size=t.size,this.position+=e.size,this.file=t}close(){if(this.fileHandle._deleted)throw new s(...r);this.fileHandle._file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class f{constructor(e="",i=new n([],e),t=!0){this._file=i,this.name=e,this.kind="file",this._deleted=!1,this.writable=t,this.readable=!0}async getFile(){if(this._deleted)throw new s(...r);return this._file}async createWritable(e){if(!this.writable)throw new s(...m);if(this._deleted)throw new s(...r);const i=e.keepExistingData?await this.getFile():new n([],this.name);return new g(this,i)}async isSameEntry(e){return this===e}async _destroy(){this._deleted=!0,this._file=null}}class h{constructor(e,i=!0){this.name=e,this.kind="directory",this._deleted=!1,this._entries={},this.writable=i,this.readable=!0}async*entries(){if(this._deleted)throw new s(...r);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i){if(this._deleted)throw new s(...r);const t=this._entries[e];if(t){if(t instanceof f)throw new s(...w);return t}else{if(i.create)return this._entries[e]=new h(e);throw new s(...r)}}async getFileHandle(e,i){const t=this._entries[e],o=t instanceof f;if(t&&o)return t;if(t&&!o)throw new s(...w);if(!t&&!i.create)throw new s(...r);if(!t&&i.create)return this._entries[e]=new f(e)}async removeEntry(e,i){const t=this._entries[e];if(!t)throw new s(...r);await t._destroy(i.recursive),delete this._entries[e]}async _destroy(e){for(let i of Object.values(this._entries)){if(!e)throw new s(...b);await i._destroy(e)}this._entries={},this._deleted=!0}}const u=new h(""),A=()=>u;export{f as FileHandle,h as FolderHandle,g as Sink,A as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{aO as u,aP as m,g as h}from"./index.
|
1
|
+
import{aO as u,aP as m,g as h}from"./index.BtpsTdHN.js";var e,r;function W(){if(r)return e;r=1;var t=u(),a=m(),i=a(function(s,g,n,o){t(s,g,n,o)});return e=i,e}var c=W();const v=h(c);export{v as m};
|
streamlit/static/static/js/{number-overlay-editor.VB_OvuPv.js → number-overlay-editor.Dndf05Hx.js}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
import{R as X,r as T}from"./index.DwUISpCs.js";import{s as Te}from"./index.B29JQLHa.js";import"./FormClearHelper.W8yVYXZp.js";import"./withFullScreenWrapper.od0SAvAK.js";import"./Toolbar.BVF7NtOB.js";import"./checkbox.DKDitzF8.js";import"./mergeWith.BqTORFAq.js";import"./sprintf.D7DtBTRn.js";import"./createDownloadLinkElement.DZMwyjvU.js";import"./toConsumableArray.DXfr1fvT.js";import"./possibleConstructorReturn.DhYxBDlj.js";import"./createSuper.mhx956J9.js";import"./FileDownload.esm.ncu7N-Hr.js";const Be=Te("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function Se(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var re;(function(e){e.event="event",e.props="prop"})(re||(re={}));function q(){}function Fe(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(i,l){return i===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function Y(e){return e==null}function _e(e){return typeof e=="number"&&isNaN(e)}function pe(e){return Y(e)||_e(e)||typeof e=="number"&&!isFinite(e)}function xe(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function je(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Le(e,t,r){var n=je(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function Me(e){var t=T.useRef(e);t.current=e;var r=T.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function se(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),i=a[0],l=a[1]||"";return{beforeDecimal:i,afterDecimal:l,hasNegation:r,addNegation:n}}function ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function ye(e,t,r){for(var n="",a=r?"0":"",i=0;i<=t-1;i++)n+=e[i]||a;return n}function de(e,t){return Array(t+1).join(e)}function be(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],i=n[1];if(i=Number(i),!i)return r+a;a=a.replace(".","");var l=1+i,h=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=h?a=a+de("0",l-h):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function ge(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,l=a.afterDecimal,h=a.hasNegation,p=parseFloat("0."+(l||"0")),x=l.length<=t?"0."+l:p.toFixed(t),S=x.split("."),c=i;i&&Number(S[0])&&(c=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},S[0]));var m=ye(S[1]||"",t,r),y=h?"-":"",s=n?".":"";return""+y+c+s+m}function H(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ve=Fe(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[i-1-n]&&i-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,l){l===void 0&&(l=$e);var h=a.findIndex(function(k){return k}),p=e.slice(0,h);!t&&!r.startsWith(p)&&(t=p,r=p+r,n=n+p.length);for(var x=r.length,S=e.length,c={},m=new Array(x),y=0;y<x;y++){m[y]=-1;for(var s=0,I=S;s<I;s++){var C=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:s});if(C&&c[s]!==!0){m[y]=s,c[s]=!0;break}}}for(var g=n;g<x&&(m[g]===-1||!i(r[g]));)g++;var B=g===x||m[g]===-1?S:m[g];for(g=n-1;g>0&&m[g]===-1;)g--;var F=g===-1||m[g]===-1?0:m[g]+1;return F>B?B:n-F<B-n?F:B}function me(e,t,r,n){var a=e.length;if(t=Ke(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function Ne(e,t,r,n,a,i){i===void 0&&(i=q);var l=Me(function(s,I){var C,g;return pe(s)?(g="",C=""):typeof s=="number"||I?(g=typeof s=="number"?be(s):s,C=n(g)):(g=a(s,void 0),C=n(g)),{formattedValue:C,numAsString:g}}),h=T.useState(function(){return l(Y(e)?t:e,r)}),p=h[0],x=h[1],S=function(s,I){s.formattedValue!==p.formattedValue&&x({formattedValue:s.formattedValue,numAsString:s.value}),i(s,I)},c=e,m=r;Y(e)&&(c=p.numAsString,m=!0);var y=l(c,m);return T.useMemo(function(){x(y)},[y.formattedValue]),[p,S]}function qe(e){return e.replace(/[^0-9]/g,"")}function ze(e){return e}function He(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,i=e.getInputRef,l=e.format;l===void 0&&(l=ze);var h=e.removeFormatting;h===void 0&&(h=qe);var p=e.defaultValue,x=e.valueIsNumericString,S=e.onValueChange,c=e.isAllowed,m=e.onChange;m===void 0&&(m=q);var y=e.onKeyDown;y===void 0&&(y=q);var s=e.onMouseUp;s===void 0&&(s=q);var I=e.onFocus;I===void 0&&(I=q);var C=e.onBlur;C===void 0&&(C=q);var g=e.value,B=e.getCaretBoundary;B===void 0&&(B=Ze);var F=e.isValidInputCharacter;F===void 0&&(F=ae);var k=e.isCharacterSame,j=Se(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),z=Ne(g,p,!!x,l,h,S),P=z[0],V=P.formattedValue,L=P.numAsString,W=z[1],M=T.useRef(),U=T.useRef({formattedValue:V,numAsString:L}),$=function(o,u){U.current={formattedValue:o.formattedValue,numAsString:o.value},W(o,u)},J=T.useState(!1),ee=J[0],d=J[1],f=T.useRef(null),N=T.useRef({setCaretTimeout:null,focusTimeout:null});T.useEffect(function(){return d(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var R=l,A=function(o,u){var v=parseFloat(u);return{formattedValue:o,value:u,floatValue:isNaN(v)?void 0:v}},E=function(o,u,v){o.selectionStart===0&&o.selectionEnd===o.value.length||(H(o,u),N.current.setCaretTimeout=setTimeout(function(){o.value===v&&o.selectionStart!==u&&H(o,u)},0))},O=function(o,u,v){return me(o,u,B(o),v)},Q=function(o,u,v){var w=B(u),_=Ge(u,V,o,v,w,F,k);return _=me(u,_,w),_},oe=function(o){var u=o.formattedValue;u===void 0&&(u="");var v=o.input,w=o.source,_=o.event,D=o.numAsString,b;if(v){var K=o.inputValue||v.value,G=ce(v);v.value=u,b=Q(K,u,G),b!==void 0&&E(v,b,u)}u!==V&&$(A(u,D),{event:_,source:w})};T.useEffect(function(){var o=U.current,u=o.formattedValue,v=o.numAsString;(V!==u||L!==v)&&$(A(V,L),{event:void 0,source:re.props})},[V,L]);var te=f.current?ce(f.current):void 0,ne=typeof window<"u"?T.useLayoutEffect:T.useEffect;ne(function(){var o=f.current;if(V!==U.current.formattedValue&&o){var u=Q(U.current.formattedValue,V,te);o.value=V,E(o,u,V)}},[V]);var ue=function(o,u,v){var w=u.target,_=M.current?Pe(M.current,w.selectionEnd):Ve(V,o),D=Object.assign(Object.assign({},_),{lastValue:V}),b=h(o,D),K=R(b);if(b=h(K,void 0),c&&!c(A(K,b))){var G=u.target,Z=ce(G),fe=Q(o,V,Z);return G.value=V,E(G,fe,V),!1}return oe({formattedValue:K,numAsString:b,inputValue:o,event:u,source:v,input:u.target}),!0},le=function(o,u){u===void 0&&(u=0);var v=o.selectionStart,w=o.selectionEnd;M.current={selectionStart:v,selectionEnd:w+u}},De=function(o){var u=o.target,v=u.value,w=ue(v,o,re.event);w&&m(o),M.current=void 0},Ie=function(o){var u=o.target,v=o.key,w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b;v==="ArrowLeft"||v==="Backspace"?b=Math.max(w-1,0):v==="ArrowRight"?b=Math.min(w+1,D.length):v==="Delete"&&(b=w);var K=0;v==="Delete"&&w===_&&(K=1);var G=v==="ArrowLeft"||v==="ArrowRight";if(b===void 0||w!==_&&!G){y(o),le(u,K);return}var Z=b;if(G){var fe=v==="ArrowLeft"?"left":"right";Z=O(D,b,fe),Z!==b&&o.preventDefault()}else v==="Delete"&&!F(D[b])?Z=O(D,b,"right"):v==="Backspace"&&!F(D[b])&&(Z=O(D,b,"left"));Z!==b&&E(u,Z,D),y(o),le(u,K)},Ce=function(o){var u=o.target,v=function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;if(D===void 0&&(D=""),w===_){var b=O(D,w);b!==w&&E(u,b,D)}};v(),requestAnimationFrame(function(){v()}),s(o),le(u)},Ee=function(o){o.persist&&o.persist();var u=o.target,v=o.currentTarget;f.current=u,N.current.focusTimeout=setTimeout(function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b=O(D,w);b!==w&&!(w===0&&_===D.length)&&E(u,b,D),I(Object.assign(Object.assign({},o),{currentTarget:v}))},0)},Re=function(o){f.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(o)},Ae=ee&&We()?"numeric":void 0,ve=Object.assign({inputMode:Ae},j,{type:t,value:V,onChange:De,onKeyDown:Ie,onMouseUp:Ce,onFocus:Ee,onBlur:Re});if(r==="text")return a?X.createElement(X.Fragment,null,a(V,j)||null):X.createElement("span",Object.assign({},j,{ref:i}),V);if(n){var Oe=n;return X.createElement(Oe,Object.assign({},ve,{ref:i}))}return X.createElement("input",Object.assign({},ve,{ref:i}))}function he(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var i=t.suffix;i===void 0&&(i="");var l=t.allowNegative,h=t.thousandsGroupStyle;if(h===void 0&&(h="thousand"),e===""||e==="-")return e;var p=ie(t),x=p.thousandSeparator,S=p.decimalSeparator,c=r!==0&&e.indexOf(".")!==-1||r&&n,m=se(e,l),y=m.beforeDecimal,s=m.afterDecimal,I=m.addNegation;return r!==void 0&&(s=ye(s,r,!!n)),x&&(y=Le(y,x,h)),a&&(y=a+y),i&&(s=s+i),I&&(y="-"+y),e=y+(c&&S||"")+s,e}function ie(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Je(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),i=n.test(e);return e=e.replace(/-/g,""),a&&!i&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+xe(e),"g")}function Xe(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Ye(e,t,r){var n;t===void 0&&(t=Ue(e));var a=r.allowNegative,i=r.prefix;i===void 0&&(i="");var l=r.suffix;l===void 0&&(l="");var h=r.decimalScale,p=t.from,x=t.to,S=x.start,c=x.end,m=ie(r),y=m.allowedDecimalSeparators,s=m.decimalSeparator,I=e[c]===s;if(ae(e)&&(e===i||e===l)&&t.lastValue==="")return e;if(c-S===1&&y.indexOf(e[S])!==-1){var C=h===0?"":s;e=e.substring(0,S)+C+e.substring(S+1,e.length)}var g=function(f,N,R){var A=!1,E=!1;i.startsWith("-")?A=!1:f.startsWith("--")?(A=!1,E=!0):l.startsWith("-")&&f.length===l.length?A=!1:f[0]==="-"&&(A=!0);var O=A?1:0;return E&&(O=2),O&&(f=f.substring(O),N-=O,R-=O),{value:f,start:N,end:R,hasNegation:A}},B=g(e,S,c),F=B.hasNegation;n=B,e=n.value,S=n.start,c=n.end;var k=g(t.lastValue,p.start,p.end),j=k.start,z=k.end,P=k.value,V=e.substring(S,c);e.length&&P.length&&(j>P.length-l.length||z<i.length)&&!(V&&l.startsWith(V))&&(e=P);var L=0;e.startsWith(i)?L+=i.length:S<i.length&&(L=S),e=e.substring(L),c-=L;var W=e.length,M=e.length-l.length;e.endsWith(l)?W=M:(c>M||c>e.length-l.length)&&(W=c),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(s))||[]).join("");var U=e.indexOf(s);e=e.replace(new RegExp(xe(s),"g"),function(f,N){return N===U?".":""});var $=se(e,a),J=$.beforeDecimal,ee=$.afterDecimal,d=$.addNegation;return x.end-x.start<p.end-p.start&&J===""&&I&&!parseFloat(ee)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,r.length+(i?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
|
1
|
+
import{R as X,r as T}from"./index.BtpsTdHN.js";import{s as Te}from"./index.DNS8a-dx.js";import"./FormClearHelper.BAxB8JFY.js";import"./withFullScreenWrapper.oyWCn2-3.js";import"./Toolbar.5tXjF_eX.js";import"./checkbox.D1GhNngU.js";import"./mergeWith.D-TqDY0-.js";import"./sprintf.D7DtBTRn.js";import"./createDownloadLinkElement.DZMwyjvU.js";import"./toConsumableArray.DNJjbOUS.js";import"./possibleConstructorReturn.DNEY6J9G.js";import"./createSuper.CudEEVs2.js";import"./FileDownload.esm.NuObx1Tl.js";const Be=Te("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function Se(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var re;(function(e){e.event="event",e.props="prop"})(re||(re={}));function q(){}function Fe(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(i,l){return i===t[l]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function Y(e){return e==null}function _e(e){return typeof e=="number"&&isNaN(e)}function pe(e){return Y(e)||_e(e)||typeof e=="number"&&!isFinite(e)}function xe(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function je(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Le(e,t,r){var n=je(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function Me(e){var t=T.useRef(e);t.current=e;var r=T.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function se(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),i=a[0],l=a[1]||"";return{beforeDecimal:i,afterDecimal:l,hasNegation:r,addNegation:n}}function ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function ye(e,t,r){for(var n="",a=r?"0":"",i=0;i<=t-1;i++)n+=e[i]||a;return n}function de(e,t){return Array(t+1).join(e)}function be(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],i=n[1];if(i=Number(i),!i)return r+a;a=a.replace(".","");var l=1+i,h=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=h?a=a+de("0",l-h):a=(a.substring(0,l)||"0")+"."+a.substring(l),r+a}function ge(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,l=a.afterDecimal,h=a.hasNegation,p=parseFloat("0."+(l||"0")),x=l.length<=t?"0."+l:p.toFixed(t),S=x.split("."),c=i;i&&Number(S[0])&&(c=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},S[0]));var m=ye(S[1]||"",t,r),y=h?"-":"",s=n?".":"";return""+y+c+s+m}function H(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ve=Fe(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[i-1-n]&&i-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,l){l===void 0&&(l=$e);var h=a.findIndex(function(k){return k}),p=e.slice(0,h);!t&&!r.startsWith(p)&&(t=p,r=p+r,n=n+p.length);for(var x=r.length,S=e.length,c={},m=new Array(x),y=0;y<x;y++){m[y]=-1;for(var s=0,I=S;s<I;s++){var C=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:s});if(C&&c[s]!==!0){m[y]=s,c[s]=!0;break}}}for(var g=n;g<x&&(m[g]===-1||!i(r[g]));)g++;var B=g===x||m[g]===-1?S:m[g];for(g=n-1;g>0&&m[g]===-1;)g--;var F=g===-1||m[g]===-1?0:m[g]+1;return F>B?B:n-F<B-n?F:B}function me(e,t,r,n){var a=e.length;if(t=Ke(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function Ne(e,t,r,n,a,i){i===void 0&&(i=q);var l=Me(function(s,I){var C,g;return pe(s)?(g="",C=""):typeof s=="number"||I?(g=typeof s=="number"?be(s):s,C=n(g)):(g=a(s,void 0),C=n(g)),{formattedValue:C,numAsString:g}}),h=T.useState(function(){return l(Y(e)?t:e,r)}),p=h[0],x=h[1],S=function(s,I){s.formattedValue!==p.formattedValue&&x({formattedValue:s.formattedValue,numAsString:s.value}),i(s,I)},c=e,m=r;Y(e)&&(c=p.numAsString,m=!0);var y=l(c,m);return T.useMemo(function(){x(y)},[y.formattedValue]),[p,S]}function qe(e){return e.replace(/[^0-9]/g,"")}function ze(e){return e}function He(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,i=e.getInputRef,l=e.format;l===void 0&&(l=ze);var h=e.removeFormatting;h===void 0&&(h=qe);var p=e.defaultValue,x=e.valueIsNumericString,S=e.onValueChange,c=e.isAllowed,m=e.onChange;m===void 0&&(m=q);var y=e.onKeyDown;y===void 0&&(y=q);var s=e.onMouseUp;s===void 0&&(s=q);var I=e.onFocus;I===void 0&&(I=q);var C=e.onBlur;C===void 0&&(C=q);var g=e.value,B=e.getCaretBoundary;B===void 0&&(B=Ze);var F=e.isValidInputCharacter;F===void 0&&(F=ae);var k=e.isCharacterSame,j=Se(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),z=Ne(g,p,!!x,l,h,S),P=z[0],V=P.formattedValue,L=P.numAsString,W=z[1],M=T.useRef(),U=T.useRef({formattedValue:V,numAsString:L}),$=function(o,u){U.current={formattedValue:o.formattedValue,numAsString:o.value},W(o,u)},J=T.useState(!1),ee=J[0],d=J[1],f=T.useRef(null),N=T.useRef({setCaretTimeout:null,focusTimeout:null});T.useEffect(function(){return d(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var R=l,A=function(o,u){var v=parseFloat(u);return{formattedValue:o,value:u,floatValue:isNaN(v)?void 0:v}},E=function(o,u,v){o.selectionStart===0&&o.selectionEnd===o.value.length||(H(o,u),N.current.setCaretTimeout=setTimeout(function(){o.value===v&&o.selectionStart!==u&&H(o,u)},0))},O=function(o,u,v){return me(o,u,B(o),v)},Q=function(o,u,v){var w=B(u),_=Ge(u,V,o,v,w,F,k);return _=me(u,_,w),_},oe=function(o){var u=o.formattedValue;u===void 0&&(u="");var v=o.input,w=o.source,_=o.event,D=o.numAsString,b;if(v){var K=o.inputValue||v.value,G=ce(v);v.value=u,b=Q(K,u,G),b!==void 0&&E(v,b,u)}u!==V&&$(A(u,D),{event:_,source:w})};T.useEffect(function(){var o=U.current,u=o.formattedValue,v=o.numAsString;(V!==u||L!==v)&&$(A(V,L),{event:void 0,source:re.props})},[V,L]);var te=f.current?ce(f.current):void 0,ne=typeof window<"u"?T.useLayoutEffect:T.useEffect;ne(function(){var o=f.current;if(V!==U.current.formattedValue&&o){var u=Q(U.current.formattedValue,V,te);o.value=V,E(o,u,V)}},[V]);var ue=function(o,u,v){var w=u.target,_=M.current?Pe(M.current,w.selectionEnd):Ve(V,o),D=Object.assign(Object.assign({},_),{lastValue:V}),b=h(o,D),K=R(b);if(b=h(K,void 0),c&&!c(A(K,b))){var G=u.target,Z=ce(G),fe=Q(o,V,Z);return G.value=V,E(G,fe,V),!1}return oe({formattedValue:K,numAsString:b,inputValue:o,event:u,source:v,input:u.target}),!0},le=function(o,u){u===void 0&&(u=0);var v=o.selectionStart,w=o.selectionEnd;M.current={selectionStart:v,selectionEnd:w+u}},De=function(o){var u=o.target,v=u.value,w=ue(v,o,re.event);w&&m(o),M.current=void 0},Ie=function(o){var u=o.target,v=o.key,w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b;v==="ArrowLeft"||v==="Backspace"?b=Math.max(w-1,0):v==="ArrowRight"?b=Math.min(w+1,D.length):v==="Delete"&&(b=w);var K=0;v==="Delete"&&w===_&&(K=1);var G=v==="ArrowLeft"||v==="ArrowRight";if(b===void 0||w!==_&&!G){y(o),le(u,K);return}var Z=b;if(G){var fe=v==="ArrowLeft"?"left":"right";Z=O(D,b,fe),Z!==b&&o.preventDefault()}else v==="Delete"&&!F(D[b])?Z=O(D,b,"right"):v==="Backspace"&&!F(D[b])&&(Z=O(D,b,"left"));Z!==b&&E(u,Z,D),y(o),le(u,K)},Ce=function(o){var u=o.target,v=function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;if(D===void 0&&(D=""),w===_){var b=O(D,w);b!==w&&E(u,b,D)}};v(),requestAnimationFrame(function(){v()}),s(o),le(u)},Ee=function(o){o.persist&&o.persist();var u=o.target,v=o.currentTarget;f.current=u,N.current.focusTimeout=setTimeout(function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b=O(D,w);b!==w&&!(w===0&&_===D.length)&&E(u,b,D),I(Object.assign(Object.assign({},o),{currentTarget:v}))},0)},Re=function(o){f.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(o)},Ae=ee&&We()?"numeric":void 0,ve=Object.assign({inputMode:Ae},j,{type:t,value:V,onChange:De,onKeyDown:Ie,onMouseUp:Ce,onFocus:Ee,onBlur:Re});if(r==="text")return a?X.createElement(X.Fragment,null,a(V,j)||null):X.createElement("span",Object.assign({},j,{ref:i}),V);if(n){var Oe=n;return X.createElement(Oe,Object.assign({},ve,{ref:i}))}return X.createElement("input",Object.assign({},ve,{ref:i}))}function he(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var i=t.suffix;i===void 0&&(i="");var l=t.allowNegative,h=t.thousandsGroupStyle;if(h===void 0&&(h="thousand"),e===""||e==="-")return e;var p=ie(t),x=p.thousandSeparator,S=p.decimalSeparator,c=r!==0&&e.indexOf(".")!==-1||r&&n,m=se(e,l),y=m.beforeDecimal,s=m.afterDecimal,I=m.addNegation;return r!==void 0&&(s=ye(s,r,!!n)),x&&(y=Le(y,x,h)),a&&(y=a+y),i&&(s=s+i),I&&(y="-"+y),e=y+(c&&S||"")+s,e}function ie(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Je(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),i=n.test(e);return e=e.replace(/-/g,""),a&&!i&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+xe(e),"g")}function Xe(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Ye(e,t,r){var n;t===void 0&&(t=Ue(e));var a=r.allowNegative,i=r.prefix;i===void 0&&(i="");var l=r.suffix;l===void 0&&(l="");var h=r.decimalScale,p=t.from,x=t.to,S=x.start,c=x.end,m=ie(r),y=m.allowedDecimalSeparators,s=m.decimalSeparator,I=e[c]===s;if(ae(e)&&(e===i||e===l)&&t.lastValue==="")return e;if(c-S===1&&y.indexOf(e[S])!==-1){var C=h===0?"":s;e=e.substring(0,S)+C+e.substring(S+1,e.length)}var g=function(f,N,R){var A=!1,E=!1;i.startsWith("-")?A=!1:f.startsWith("--")?(A=!1,E=!0):l.startsWith("-")&&f.length===l.length?A=!1:f[0]==="-"&&(A=!0);var O=A?1:0;return E&&(O=2),O&&(f=f.substring(O),N-=O,R-=O),{value:f,start:N,end:R,hasNegation:A}},B=g(e,S,c),F=B.hasNegation;n=B,e=n.value,S=n.start,c=n.end;var k=g(t.lastValue,p.start,p.end),j=k.start,z=k.end,P=k.value,V=e.substring(S,c);e.length&&P.length&&(j>P.length-l.length||z<i.length)&&!(V&&l.startsWith(V))&&(e=P);var L=0;e.startsWith(i)?L+=i.length:S<i.length&&(L=S),e=e.substring(L),c-=L;var W=e.length,M=e.length-l.length;e.endsWith(l)?W=M:(c>M||c>e.length-l.length)&&(W=c),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(s))||[]).join("");var U=e.indexOf(s);e=e.replace(new RegExp(xe(s),"g"),function(f,N){return N===U?".":""});var $=se(e,a),J=$.beforeDecimal,ee=$.afterDecimal,d=$.addNegation;return x.end-x.start<p.end-p.start&&J===""&&I&&!parseFloat(ee)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,r.length+(i?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
|
2
2
|
Decimal separator can't be same as thousand separator.
|
3
3
|
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
4
4
|
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
@@ -1 +1 @@
|
|
1
|
-
import{c6 as u,c7 as c,aw as s,aU as f}from"./index.
|
1
|
+
import{c6 as u,c7 as c,aw as s,aU as f}from"./index.BtpsTdHN.js";function n(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=Array(e);r<e;r++)o[r]=t[r];return o}function p(t,e){if(t){if(typeof t=="string")return n(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,u(o.key),o)}}function b(t,e,r){return e&&a(t.prototype,e),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i(t)}function d(t,e){if(e&&(s(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(t)}export{_,b as a,y as b,i as c,d,p as e,n as f};
|
@@ -1 +1 @@
|
|
1
|
-
import{e as l}from"./es6.
|
1
|
+
import{e as l}from"./es6.B_HLnUb9.js";import"./index.BtpsTdHN.js";const{DISALLOWED:d}=l;class a{constructor(e,t){this.writer=e,this.fileEntry=t}async write(e){if(typeof e=="object"){if(e.type==="write"){if(Number.isInteger(e.position)&&e.position>=0&&(this.writer.seek(e.position),this.writer.position!==e.position&&(await new Promise((t,i)=>{this.writer.onwriteend=t,this.writer.onerror=i,this.writer.truncate(e.position)}),this.writer.seek(e.position))),!("data"in e))throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. write requires a data argument","SyntaxError");e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.writer.seek(e.position),this.writer.position!==e.position)throw new DOMException("seeking position failed","InvalidStateError");return}else throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. seek requires a position argument","SyntaxError");else if(e.type==="truncate")return new Promise(t=>{if(Number.isInteger(e.size)&&e.size>=0)this.writer.onwriteend=i=>t(),this.writer.truncate(e.size);else throw new DOMException("Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. truncate requires a size argument","SyntaxError")})}await new Promise((t,i)=>{this.writer.onwriteend=t,this.writer.onerror=i,this.writer.write(new Blob([e]))})}close(){return new Promise(this.fileEntry.file.bind(this.fileEntry))}}class w{constructor(e,t=!0){this.file=e,this.kind="file",this.writable=t,this.readable=!0}get name(){return this.file.name}isSameEntry(e){return this.file.toURL()===e.file.toURL()}getFile(){return new Promise(this.file.file.bind(this.file))}createWritable(e){if(!this.writable)throw new DOMException(...d);return new Promise((t,i)=>this.file.createWriter(r=>{e.keepExistingData===!1?(r.onwriteend=s=>t(new a(r,this.file)),r.truncate(0)):t(new a(r,this.file))},i))}}class n{constructor(e,t=!0){this.dir=e,this.writable=t,this.readable=!0,this.kind="directory",this.name=e.name}isSameEntry(e){return this.dir.fullPath===e.dir.fullPath}async*entries(){const e=this.dir.createReader(),t=await new Promise(e.readEntries.bind(e));for(const i of t)yield[i.name,i.isFile?new w(i,this.writable):new n(i,this.writable)]}getDirectoryHandle(e,t){return new Promise((i,r)=>{this.dir.getDirectory(e,t,s=>{i(new n(s))},r)})}getFileHandle(e,t){return new Promise((i,r)=>this.dir.getFile(e,t,s=>i(new w(s)),r))}async removeEntry(e,t){const i=await this.getDirectoryHandle(e,{create:!1}).catch(r=>r.name==="TypeMismatchError"?this.getFileHandle(e,{create:!1}):r);if(i instanceof Error)throw i;return new Promise((r,s)=>{i instanceof n?t.recursive?i.dir.removeRecursively(()=>r(),s):i.dir.remove(()=>r(),s):i.file&&i.file.remove(()=>r(),s)})}}const p=(o={})=>new Promise((e,t)=>window.webkitRequestFileSystem(o._persistent,0,i=>e(new n(i.root)),t));export{w as FileHandle,n as FolderHandle,p as default};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{bs as v,bt as T,bU as j,r as d,cf as x,cg as R}from"./index.
|
1
|
+
import{bs as v,bt as T,bU as j,r as d,cf as x,cg as R}from"./index.BtpsTdHN.js";import{g as $,a as I,b as A,B as F}from"./base-input.wfBDFTlB.js";function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_(Object(r),!0).forEach(function(n){E(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=v("div",function(e){return s(s({},$(s(s({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})});O.displayName="StyledTextAreaRoot";O.displayName="StyledTextAreaRoot";var m=v("div",function(e){return I(s({$positive:!1},e))});m.displayName="StyledTextareaContainer";m.displayName="StyledTextareaContainer";var g=v("textarea",function(e){return s(s({},A(e)),{},{resize:e.$resize||"none"})});g.displayName="StyledTextarea";g.displayName="StyledTextarea";function b(e){"@babel/helpers - typeof";return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(e)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}function B(e,t){return D(e)||C(e,t)||N(e,t)||z()}function z(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N(e,t){if(e){if(typeof e=="string")return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(e,t)}}function P(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function C(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,u;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(y){i=!0,u=y}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw u}}return n}}function D(e){if(Array.isArray(e))return e}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t,r){return t&&U(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function M(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},h(e,t)}function H(e){var t=W();return function(){var n=p(e),o;if(t){var i=p(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return L(this,o)}}function L(e,t){if(t&&(b(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},p(e)}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Y=function(e){M(r,e);var t=H(r);function r(){var n;K(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),c(f(n),"state",{isFocused:n.props.autoFocus||!1}),c(f(n),"onFocus",function(u){n.setState({isFocused:!0}),n.props.onFocus(u)}),c(f(n),"onBlur",function(u){n.setState({isFocused:!1}),n.props.onBlur(u)}),n}return q(r,[{key:"render",value:function(){var o=this.props.overrides,i=o===void 0?{}:o,a=T(i.Root,O),u=B(a,2),y=u[0],S=u[1],w=j({Input:{component:g},InputContainer:{component:m}},i);return d.createElement(y,l({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},S),d.createElement(F,l({},this.props,{type:R.textarea,overrides:w,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}]),r}(d.Component);c(Y,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:x.default});export{Y as T};
|