streamlit 1.48.1__py3-none-any.whl → 1.49.1__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/__init__.py +3 -10
- streamlit/commands/logo.py +4 -3
- streamlit/commands/navigation.py +1 -1
- streamlit/commands/page_config.py +4 -1
- streamlit/components/v1/custom_component.py +2 -2
- streamlit/config.py +82 -1
- streamlit/connections/snowflake_connection.py +3 -1
- streamlit/delta_generator.py +3 -0
- streamlit/elements/arrow.py +155 -70
- streamlit/elements/bokeh_chart.py +13 -3
- streamlit/elements/deck_gl_json_chart.py +0 -1
- streamlit/elements/dialog_decorator.py +7 -59
- streamlit/elements/form.py +10 -1
- streamlit/elements/graphviz_chart.py +57 -6
- streamlit/elements/heading.py +17 -16
- streamlit/elements/image.py +64 -37
- streamlit/elements/layouts.py +2 -2
- streamlit/elements/lib/built_in_chart_utils.py +2 -5
- streamlit/elements/lib/column_config_utils.py +18 -4
- streamlit/elements/lib/column_types.py +75 -30
- streamlit/elements/lib/dialog.py +3 -3
- streamlit/elements/lib/image_utils.py +19 -11
- streamlit/elements/lib/layout_utils.py +19 -6
- streamlit/elements/lib/utils.py +20 -41
- streamlit/elements/markdown.py +7 -6
- streamlit/elements/media.py +6 -13
- streamlit/elements/metric.py +78 -1
- streamlit/elements/pdf.py +192 -0
- streamlit/elements/plotly_chart.py +3 -2
- streamlit/elements/pyplot.py +53 -11
- streamlit/elements/toast.py +81 -5
- streamlit/elements/vega_charts.py +3 -8
- streamlit/elements/widgets/audio_input.py +0 -1
- streamlit/elements/widgets/button.py +0 -4
- streamlit/elements/widgets/button_group.py +5 -4
- streamlit/elements/widgets/camera_input.py +0 -1
- streamlit/elements/widgets/chat.py +11 -13
- streamlit/elements/widgets/checkbox.py +0 -1
- streamlit/elements/widgets/color_picker.py +0 -1
- streamlit/elements/widgets/data_editor.py +142 -62
- streamlit/elements/widgets/file_uploader.py +74 -37
- streamlit/elements/widgets/multiselect.py +0 -1
- streamlit/elements/widgets/number_input.py +0 -1
- streamlit/elements/widgets/radio.py +0 -1
- streamlit/elements/widgets/select_slider.py +0 -1
- streamlit/elements/widgets/selectbox.py +0 -1
- streamlit/elements/widgets/slider.py +0 -1
- streamlit/elements/widgets/text_widgets.py +0 -2
- streamlit/elements/widgets/time_widgets.py +0 -2
- streamlit/errors.py +11 -0
- streamlit/material_icon_names.py +1 -1
- streamlit/proto/Arrow_pb2.py +14 -8
- streamlit/proto/Arrow_pb2.pyi +11 -3
- streamlit/proto/Block_pb2.py +16 -16
- streamlit/proto/Block_pb2.pyi +2 -0
- streamlit/proto/ChatInput_pb2.py +3 -3
- streamlit/proto/ChatInput_pb2.pyi +2 -0
- streamlit/proto/FileUploader_pb2.py +2 -2
- streamlit/proto/FileUploader_pb2.pyi +5 -1
- streamlit/proto/GraphVizChart_pb2.py +4 -2
- streamlit/proto/GraphVizChart_pb2.pyi +1 -1
- streamlit/proto/Image_pb2.py +4 -2
- streamlit/proto/Image_pb2.pyi +1 -10
- streamlit/proto/Metric_pb2.py +8 -6
- streamlit/proto/Metric_pb2.pyi +34 -10
- streamlit/proto/Toast_pb2.py +2 -2
- streamlit/proto/Toast_pb2.pyi +10 -1
- streamlit/runtime/caching/__init__.py +14 -2
- streamlit/runtime/caching/cache_data_api.py +0 -17
- streamlit/runtime/caching/cache_resource_api.py +0 -16
- streamlit/runtime/caching/cached_message_replay.py +8 -20
- streamlit/runtime/caching/hashing.py +31 -1
- streamlit/runtime/credentials.py +4 -4
- streamlit/runtime/fragment.py +0 -42
- streamlit/runtime/websocket_session_manager.py +1 -1
- streamlit/static/index.html +2 -2
- streamlit/static/manifest.json +223 -251
- streamlit/static/static/css/{index.CJVRHjQZ.css → index.C8X8rNzw.css} +1 -1
- streamlit/static/static/css/index.COe1010n.css +1 -0
- streamlit/static/static/js/{ErrorOutline.esm.DjObtx4K.js → ErrorOutline.esm.DcGrhbBP.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.Bz9nxNC5.js → FileDownload.esm.DgBvV6Pq.js} +1 -1
- streamlit/static/static/js/FileHelper.M6AAaeuA.js +5 -0
- streamlit/static/static/js/FormClearHelper.DHh1GFzm.js +1 -0
- streamlit/static/static/js/{Hooks.DEoLCfOE.js → Hooks.DGu1od_L.js} +1 -1
- streamlit/static/static/js/InputInstructions.z6sVgyYt.js +1 -0
- streamlit/static/static/js/Particles.DDVT-6Qc.js +1 -0
- streamlit/static/static/js/ProgressBar.BEY0cXXV.js +2 -0
- streamlit/static/static/js/Toolbar.DSnK1fUh.js +1 -0
- streamlit/static/static/js/{base-input.BmvSaPd2.js → base-input.CK3UVGp1.js} +4 -4
- streamlit/static/static/js/{checkbox.Cgxgc0et.js → checkbox.D8W881TL.js} +2 -2
- streamlit/static/static/js/createSuper.B6W-Dh9S.js +1 -0
- streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +1 -0
- streamlit/static/static/js/{downloader.M6jQeNDf.js → downloader.DiKpuU_S.js} +1 -1
- streamlit/static/static/js/es6.B8zRNPZ-.js +2 -0
- streamlit/static/static/js/iframeResizer.contentWindow.DIewJmmh.js +1 -0
- streamlit/static/static/js/index.452cqrrL.js +1 -0
- streamlit/static/static/js/index.4eF4NxG2.js +1 -0
- streamlit/static/static/js/index.B6U8LQo3.js +1 -0
- streamlit/static/static/js/index.B9mjBcgE.js +1 -0
- streamlit/static/static/js/index.BXYmrqnf.js +1 -0
- streamlit/static/static/js/index.B_8AnktO.js +1 -0
- streamlit/static/static/js/index.Bl7zGQSh.js +7 -0
- streamlit/static/static/js/index.BnEpvLEz.js +1 -0
- streamlit/static/static/js/{index.D1EayrNh.js → index.BnJIOYn9.js} +2 -2
- streamlit/static/static/js/index.Bte_9Lyq.js +1 -0
- streamlit/static/static/js/index.C1HcTl5K.js +1 -0
- streamlit/static/static/js/index.C7fRKRs4.js +1 -0
- streamlit/static/static/js/index.C7lSmSOP.js +1 -0
- streamlit/static/static/js/index.CD8HuT3N.js +976 -0
- streamlit/static/static/js/index.CP5TD2z1.js +1 -0
- streamlit/static/static/js/index.C_tmcx4B.js +1 -0
- streamlit/static/static/js/index.CcJf6BCU.js +3858 -0
- streamlit/static/static/js/{index.CbdWnLqS.js → index.CejBxbg1.js} +3 -3
- streamlit/static/static/js/index.Ch7MBCx0.js +5367 -0
- streamlit/static/static/js/index.CjXWwH-y.js +1 -0
- streamlit/static/static/js/index.CvYYtxD_.js +1 -0
- streamlit/static/static/js/index.D2-atlaQ.js +3 -0
- streamlit/static/static/js/index.D3K5nOu9.js +197 -0
- streamlit/static/static/js/index.D5naqx-J.js +1 -0
- streamlit/static/static/js/index.Dk4C7X3i.js +1 -0
- streamlit/static/static/js/index.DkKT3LUI.js +1 -0
- streamlit/static/static/js/index.DtYN2x4k.js +1 -0
- streamlit/static/static/js/index.MTPPBDHk.js +2 -0
- streamlit/static/static/js/{index.Cqa4gqqN.js → index.Ts_0SdB9.js} +1 -1
- streamlit/static/static/js/{index.CgZDfhN4.js → index.cnnXF7xQ.js} +2 -2
- streamlit/static/static/js/index.ho6NIXGl.js +1 -0
- streamlit/static/static/js/index.pqW9AMJD.js +3 -0
- streamlit/static/static/js/{index.D1jHqUJq.js → index.qhs54UAB.js} +1 -1
- streamlit/static/static/js/{index.tsvTLdio.js → index.urHgTgMQ.js} +9 -9
- streamlit/static/static/js/index.wzkv_11M.js +1 -0
- streamlit/static/static/js/index.yF5AncHY.js +1 -0
- streamlit/static/static/js/{index.BXDq9dj4.js → index.zecpGxtj.js} +1 -1
- streamlit/static/static/js/{input.DZd6EQlV.js → input.nzVJphXi.js} +2 -2
- streamlit/static/static/js/{memory.ptkfuI71.js → memory.CjCgTQz3.js} +1 -1
- streamlit/static/static/js/number-overlay-editor.DaRFzZEO.js +9 -0
- streamlit/static/static/js/{possibleConstructorReturn.Bd4ImlQ9.js → possibleConstructorReturn.DgiPnZ9N.js} +1 -1
- streamlit/static/static/js/{sandbox.DsH8LuID.js → sandbox.mithfq7Z.js} +1 -1
- streamlit/static/static/js/{timepicker.QVekV78C.js → timepicker.Dbl5KFh6.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.BJvaP8gb.js → toConsumableArray.D-Dx88BQ.js} +3 -3
- streamlit/static/static/js/uniqueId.Bh26R_3S.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.DB3vMS9V.js → useBasicWidgetState.DeK-QJpD.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.CBkGkaRt.js → useTextInputAutoExpand.4iAdLWD-.js} +2 -2
- streamlit/static/static/js/useUpdateUiValue.CmT7_nJN.js +1 -0
- streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +1 -0
- streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
- streamlit/user_info.py +3 -1
- streamlit/web/server/browser_websocket_handler.py +15 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/METADATA +4 -2
- {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/RECORD +153 -156
- streamlit/static/static/css/index.CQt5TjGB.css +0 -1
- streamlit/static/static/js/FileHelper.BrQvUXVD.js +0 -5
- streamlit/static/static/js/FormClearHelper.DF4gFAOO.js +0 -1
- streamlit/static/static/js/InputInstructions.D8zoMog9.js +0 -1
- streamlit/static/static/js/Particles.CCFySwdL.js +0 -1
- streamlit/static/static/js/ProgressBar.COK9j1l0.js +0 -2
- streamlit/static/static/js/Toolbar.Dt4jIKlY.js +0 -1
- streamlit/static/static/js/createSuper.siQeagI2.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.Ct51iCb_.js +0 -1
- streamlit/static/static/js/es6.CMaUdEZ5.js +0 -2
- streamlit/static/static/js/iframeResizer.contentWindow.C33BryyP.js +0 -1
- streamlit/static/static/js/index.8GJD0eeD.js +0 -1
- streamlit/static/static/js/index.8QEYHMQD.js +0 -1
- streamlit/static/static/js/index.Ay41Wnu9.js +0 -1
- streamlit/static/static/js/index.BLiKiJ7_.js +0 -1
- streamlit/static/static/js/index.BT78cJmU.js +0 -1
- streamlit/static/static/js/index.BdGvnhlM.js +0 -1
- streamlit/static/static/js/index.BfasrT0d.js +0 -1
- streamlit/static/static/js/index.CCdtFMFG.js +0 -1
- streamlit/static/static/js/index.CFRGZDz1.js +0 -1
- streamlit/static/static/js/index.CFSFYiPA.js +0 -5366
- streamlit/static/static/js/index.CeiIiXap.js +0 -1
- streamlit/static/static/js/index.CzX2xpyc.js +0 -1
- streamlit/static/static/js/index.D1ErX5go.js +0 -2
- streamlit/static/static/js/index.D5gweoL5.js +0 -7
- streamlit/static/static/js/index.DByVKZgq.js +0 -1
- streamlit/static/static/js/index.DEND45D1.js +0 -3
- streamlit/static/static/js/index.DKN5MVff.js +0 -781
- streamlit/static/static/js/index.DfoxW1gP.js +0 -3855
- streamlit/static/static/js/index.Dtf1Ac0x.js +0 -1
- streamlit/static/static/js/index.DxrLhpeO.js +0 -1
- streamlit/static/static/js/index.J7o-_HIh.js +0 -1
- streamlit/static/static/js/index.LU8juINp.js +0 -197
- streamlit/static/static/js/index.L_N2iylt.js +0 -1
- streamlit/static/static/js/index.PZUX2kRz.js +0 -3
- streamlit/static/static/js/index.ROjU6K0k.js +0 -1
- streamlit/static/static/js/index.WSNLkF94.js +0 -1
- streamlit/static/static/js/index.X5W3gJLn.js +0 -1
- streamlit/static/static/js/index.k9LYqfSL.js +0 -1
- streamlit/static/static/js/index.pnHtHv_c.js +0 -203
- streamlit/static/static/js/index.tPUXqsfW.js +0 -1
- streamlit/static/static/js/mergeWith.GRNk8iwv.js +0 -1
- streamlit/static/static/js/number-overlay-editor.DXS2qb1U.js +0 -9
- streamlit/static/static/js/threshold.DjX0wlsa.js +0 -1
- streamlit/static/static/js/timer.CAwTRJ_g.js +0 -1
- streamlit/static/static/js/uniqueId.D_5M8Dgf.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.C7ZKpLQK.js +0 -1
- streamlit/static/static/js/value.CgPGBV_l.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.C-gXt0Rl.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.DsbC8sYI.woff2 +0 -0
- {streamlit-1.48.1.data → streamlit-1.49.1.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/WHEEL +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/entry_points.txt +0 -0
- {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as c,E as j,_ as Y,bm as C,bn as _,v as g,e as D,j as n,P as G,b as q,B as J,ao as T,T as ut,F as Q,u as W,an as gt,ai as ht,bo as ft,h as mt,a6 as yt,as as Ct,bp as bt,m as H,bh as vt,bi as It}from"./index.CD8HuT3N.js";import{g as wt,C as xt,I as St,F as $,E as Z,a as Ft,s as Ut,u as Dt,b as Et}from"./FileHelper.M6AAaeuA.js";import{I as zt}from"./InputInstructions.z6sVgyYt.js";import{u as Tt,T as Bt}from"./useTextInputAutoExpand.4iAdLWD-.js";import{i as Rt}from"./inputUtils.CptNuJwn.js";import{E as Lt}from"./ErrorOutline.esm.DcGrhbBP.js";import{U as tt}from"./UploadFileInfo.C-jY39rj.js";import"./base-input.CK3UVGp1.js";var et=c.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(j,Y({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 015 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 005 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"}))});et.displayName="AttachFile";var ot=c.forwardRef(function(t,e){var o={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(j,Y({iconAttrs:o,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:e}),c.createElement("rect",{width:24,height:24,fill:"none"}),c.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))});ot.displayName="Send";const nt=(t,e)=>e===C.Directory?{...t,webkitdirectory:"",multiple:!0}:t,Ht=(t,e)=>{if(!e||e.length===0)return!0;const o=t.name.toLowerCase(),i=o.lastIndexOf(".");if(i===-1||i===o.length-1)return e.some(m=>m===""||m===".");const p=o.substring(i),s=o.substring(i+1);return e.some(m=>{const b=m.toLowerCase();return b.startsWith(".")?p===b:s===b})},Vt=(t,e)=>Ht(t,e)?{isValid:!0}:{isValid:!1,errorMessage:`${t.type||"This type of"} files are not allowed.`},rt=t=>{switch(t){case C.None:return"a file";case C.Single:return"a file";case C.Multiple:return"files";case C.Directory:return"a directory";default:return _(t),"a file"}},Mt=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})),$t=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})),Wt=g("div",{target:"e15560op2"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"})),kt=g("div",{target:"e15560op3"})(({disabled:t})=>({pointerEvents:t?"none":"auto"})),Nt=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})),At=g("div",{target:"e15560op5"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"})),Pt=g("div",{target:"e15560op6"})({display:"flex"}),Kt=g("div",{target:"e15560op7"})({flex:"0 0 auto"}),Ot=g("div",{target:"e15560op8"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS})),Xt=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})),Yt=g("div",{target:"e15560op11"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60})),_t=g("small",{target:"e15560op12"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}})),Gt=({getRootProps:t,getInputProps:e,acceptFile:o,disabled:i,theme:p})=>{const s=nt(e(),o);return D(Wt,{disabled:i,children:[D(kt,{"data-testid":"stChatInputFileUploadButton",disabled:i,...t(),children:[n("input",{...s}),n(ut,{content:`Upload or drag and drop ${rt(o)}`,placement:G.TOP,onMouseEnterDelay:500,children:n(q,{kind:J.MINIMAL,disabled:i,children:n(T,{content:et,size:"lg",color:i?p.colors.fadedText40:p.colors.fadedText60})})})]}),n(Nt,{})]})},qt=c.memo(Gt),Jt=({getRootProps:t,getInputProps:e,acceptFile:o,inputHeight:i})=>{const p=nt(e(),o);return D(Q,{children:[n(Mt,{height:i,...t(),children:n("input",{...p})}),n($t,{height:i,children:`Drag and drop ${rt(o)} here`})]})},Qt=c.memo(Jt);function Zt({children:t,content:e}){const o=W();return n(gt,{content:e,placement:G.TOP,overrides:{Body:{style:{top:`-${o.sizes.minElementHeight}`}}},children:t})}const te=({fileInfo:t})=>{const e=W(),{type:o}=t.status;switch(o){case"uploading":return n(ht,{"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return n(Zt,{content:t.status.errorMessage,children:n(T,{color:e.colors.red,content:Lt,size:"lg"})});case"uploaded":return n(T,{content:St,size:"lg"});default:return _(o),null}},ee=({fileInfo:t,onDelete:e})=>D(Ot,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[n(Xt,{children:n(te,{fileInfo:t})}),n(jt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),n(Yt,{children:wt(t.size,$.Byte)}),n(_t,{"data-testid":"stChatInputDeleteBtn",children:n(q,{onClick:()=>e(t.id),kind:J.MINIMAL,children:n(T,{content:xt,size:"lg"})})})]}),oe=c.memo(ee),ne=({items:t,onDelete:e})=>n(At,{"data-testid":"stChatUploadedFiles",children:n(Pt,{children:t.map(o=>n(Kt,{children:n(oe,{fileInfo:o,onDelete:e})},o.id))})}),re=c.memo(ne),ae=(t,e)=>{const o=[],i=[];return t.forEach(p=>{const s=Vt(p,e.fileType);s.isValid?o.push(p):i.push({file:p,errors:[{code:Z.FileInvalidType,message:s.errorMessage||"File type not allowed."}]})}),{accepted:o,rejected:i}},ie=({acceptMultipleFiles:t,acceptDirectoryFiles:e,maxFileSize:o,uploadClient:i,uploadFile:p,addFiles:s,getNextLocalFileId:m,deleteExistingFiles:b,onUploadComplete:w,element:v})=>(f,h)=>{if(e&&f.length>0){const{accepted:u,rejected:y}=ae(f,v);f=u,h=[...h,...y]}if(!t&&f.length===0&&h.length>1){const u=h.findIndex(y=>y.errors?.[0].code===Z.TooManyFiles);u>=0&&(f.push(h[u].file),h.splice(u,1))}if(!t&&f.length>0&&b(),i.fetchFileURLs(f).then(u=>{ft(u,f).forEach(([y,x])=>{p(y,x)})}).catch(u=>{s(f.map(y=>new tt(y.name,y.size,m(),{type:"error",errorMessage:u})))}),h.length>0){const u=h.map(y=>Ft(y,m(),o));s(u)}w()},se=({getNextLocalFileId:t,addFiles:e,updateFile:o,uploadClient:i,element:p,onUploadProgress:s,onUploadComplete:m})=>(b,w)=>{const v=w.webkitRelativePath||w.name,f=new AbortController,h=new tt(v,w.size,t(),{type:"uploading",abortController:f,progress:1});e([h]),i.uploadFile({formId:"",...p},b.uploadUrl,w,u=>s(u,h.id),f.signal).then(()=>m(h.id,b)).catch(u=>{u instanceof DOMException&&u.name==="AbortError"||o(h.id,h.setStatus({type:"error",errorMessage:u?u.toString():"Unknown error"}))})},le=g("div",{target:"e1togvvn0"})("border:none;position:relative;display:flex;"),de=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}})),ce=g("button",{target:"e1togvvn2"})(({theme:t,disabled:e,extended:o})=>{const i=mt(t),[p,s]=i?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:o?"0":t.radii.chatInput,borderTopLeftRadius:o?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?p:s,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:i?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"}}}),pe=g("div",{target:"e1togvvn3"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"})),ue=g("div",{target:"e1togvvn4"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`})),V=(t,e,o)=>o.map(i=>i.id===t?e:i),M=(t,e)=>e.find(o=>o.id===t);function ge({disabled:t,element:e,widgetMgr:o,fragmentId:i,uploadClient:p}){const s=W(),{placeholder:m,maxChars:b}=e,w=c.useRef(0),v=c.useRef(null),{width:f,elementRef:h}=yt(),{innerWidth:u,innerHeight:y}=Ct(),[x,B]=c.useState(e.default),[F,U]=c.useState([]),[E,R]=c.useState(!1),S=Tt({textareaRef:v,dependencies:[m]}),L=c.useMemo(()=>F.some(r=>r.status.type==="uploading")?!1:x!==""||F.length>0,[F,x]),I=bt(e.acceptFile),k=Ut(e.maxUploadSizeMb,$.Megabyte,$.Byte),N=c.useCallback(r=>U(l=>[...l,...r]),[]),A=c.useCallback(r=>{U(l=>{const d=M(r,l);return H(d)?l:(d.status.type==="uploading"&&d.status.abortController.abort(),d.status.type==="uploaded"&&d.status.fileUrls.deleteUrl&&p.deleteFile(d.status.fileUrls.deleteUrl),l.filter(a=>a.id!==r))})},[p]),at=()=>{const r=F.filter(l=>l.status.type==="uploaded").map(l=>{const{name:d,size:a,status:z}=l,{fileId:ct,fileUrls:pt}=z;return new vt({fileId:ct,fileUrls:pt,name:d,size:a})});return new It({uploadedFileInfo:r})},P=()=>w.current++,it=ie({acceptMultipleFiles:I===C.Multiple||I===C.Directory,acceptDirectoryFiles:I===C.Directory,maxFileSize:k,uploadClient:p,uploadFile:se({getNextLocalFileId:P,addFiles:N,updateFile:(r,l)=>{U(d=>V(r,l,d))},uploadClient:p,element:e,onUploadProgress:(r,l)=>{U(d=>{const a=M(l,d);if(H(a)||a.status.type!=="uploading")return d;const z=Math.round(r.loaded*100/r.total);return a.status.progress===z?d:V(l,a.setStatus({type:"uploading",abortController:a.status.abortController,progress:z}),d)})},onUploadComplete:(r,l)=>{U(d=>{const a=M(r,d);return H(a)||a.status.type!=="uploading"?d:V(a.id,a.setStatus({type:"uploaded",fileId:l.fileId,fileUrls:l}),d)})}}),addFiles:N,getNextLocalFileId:P,deleteExistingFiles:()=>F.forEach(r=>A(r.id)),onUploadComplete:()=>{v.current&&v.current.focus()},element:e}),{getRootProps:K,getInputProps:O}=Dt({onDrop:it,multiple:I===C.Multiple||I===C.Directory,accept:Et(e.fileType),maxSize:k}),X=()=>{if(v.current&&v.current.focus(),!L||t)return;const r={data:x,fileUploaderState:at()};o.setChatInputValue(e,r,{fromUi:!0},i),U([]),B(""),S.clearScrollHeight()},st=r=>{const{metaKey:l,ctrlKey:d,shiftKey:a}=r;Rt(r)&&!a&&!d&&!l&&(r.preventDefault(),X())},lt=r=>{const{value:l}=r.target;b!==0&&l.length>b||(B(l),S.updateScrollHeight())};c.useEffect(()=>{if(e.setValue){e.setValue=!1;const r=e.value||"";B(r)}},[e]),c.useEffect(()=>{const r=a=>{a.preventDefault(),a.stopPropagation(),!E&&a.dataTransfer?.types.includes("Files")&&R(!0)},l=a=>{a.preventDefault(),a.stopPropagation(),E&&(a.clientX<=0&&a.clientY<=0||a.clientX>=u&&a.clientY>=y)&&R(!1)},d=a=>{a.preventDefault(),a.stopPropagation(),E&&R(!1)};return window.addEventListener("dragover",r),window.addEventListener("drop",d),window.addEventListener("dragleave",l),()=>{window.removeEventListener("dragover",r),window.removeEventListener("drop",d),window.removeEventListener("dragleave",l)}},[E,u,y]);const dt=I!==C.None&&E;return D(Q,{children:[I===C.None?null:n(re,{items:[...F],onDelete:A}),n(le,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:dt?n(Qt,{getRootProps:K,getInputProps:O,acceptFile:I,inputHeight:S.height}):D(de,{extended:S.isExtended,children:[I===C.None?null:n(qt,{getRootProps:K,getInputProps:O,acceptFile:I,disabled:t,theme:s}),n(Bt,{inputRef:v,value:x,placeholder:m,onChange:lt,onKeyDown:st,"aria-label":m,disabled:t,rows:1,overrides:{Root:{style:{minHeight:s.sizes.minElementHeight,outline:"none",borderLeftWidth:"0",borderRightWidth:"0",borderTopWidth:"0",borderBottomWidth:"0",borderTopLeftRadius:"0",borderTopRightRadius:"0",borderBottomRightRadius:"0",borderBottomLeftRadius:"0"}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{fontWeight:s.fontWeights.normal,lineHeight:s.lineHeights.inputWidget,"::placeholder":{color:s.colors.fadedText60},height:S.height,maxHeight:S.maxHeight,paddingLeft:s.spacing.none,paddingBottom:s.spacing.sm,paddingTop:s.spacing.sm,paddingRight:`calc(${s.iconSizes.xl} + 2 * ${s.spacing.sm} + ${s.spacing.sm})`}}}}),f>s.breakpoints.hideWidgetDetails&&n(ue,{children:n(zt,{dirty:L,value:x,maxLength:b,type:"chat",inForm:!1})}),n(pe,{children:n(ce,{onClick:X,disabled:!L||t,extended:S.isExtended,"data-testid":"stChatInputSubmitButton",children:n(T,{content:ot,size:"xl",color:"inherit"})})})]})})]})}const we=c.memo(ge);export{we as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as c,E as x,_ as U,v as p,aA as X,e as g,j as a,ao as m,b as y,c as O,B as w,at as j,F as _,bg as G,aR as K,bo as Y,m as f,aa as F,bh as J,bi as Q,l as Z,R as ee,T as te,P as ie,W as se}from"./index.CD8HuT3N.js";import{F as oe}from"./FormClearHelper.DHh1GFzm.js";import{g as I,F as S,b as le,D as ne,I as ae,C as re,a as de,s as ce}from"./FileHelper.M6AAaeuA.js";import{S as pe,P as ge}from"./ProgressBar.BEY0cXXV.js";import{u as ue}from"./Hooks.DGu1od_L.js";import{U as v}from"./UploadFileInfo.C-jY39rj.js";var C=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(x,U({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z"}))});C.displayName="ChevronLeft";var b=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(x,U({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"}))});b.displayName="ChevronRight";var M=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(x,U({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),c.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});M.displayName="CloudUpload";var B=c.forwardRef(function(e,s){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(x,U({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:s}),c.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});B.displayName="Error";const D=p("section",{target:"e1d2qte90"})(({isDisabled:e,theme:s})=>({display:"flex",gap:s.spacing.lg,alignItems:"center",padding:s.spacing.lg,backgroundColor:s.colors.secondaryBg,borderRadius:s.radii.default,border:s.colors.widgetBorderColor?`${s.sizes.borderWidth} solid ${s.colors.widgetBorderColor}`:void 0,height:s.sizes.largestElementHeight,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 1px ${s.colors.primary}`},cursor:e?"not-allowed":"pointer"})),he=p("div",{target:"e1d2qte91"})(({theme:e})=>({marginRight:"auto",alignItems:"center",display:"flex",gap:e.spacing.lg,minWidth:0,width:"100%"})),V=p("span",{target:"e1d2qte92"})(({theme:e})=>({color:e.colors.darkenedBgMix100})),L=p("span",{target:"e1d2qte93"})(({theme:e,disabled:s})=>({color:s?e.colors.fadedText40:e.colors.bodyText})),fe=p("span",{target:"e1d2qte94"})(({theme:e,disabled:s})=>({fontSize:e.fontSizes.sm,color:s?e.colors.fadedText40:e.colors.fadedText60,display:"block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"100%"})),me=p("div",{target:"e1d2qte95"})({display:"flex",flexDirection:"column",minWidth:0,maxWidth:"100%"}),Fe=p("span",{target:"e1d2qte96"})({whiteSpace:"nowrap"}),E=p("div",{target:"e1d2qte97"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),ye=p("ul",{target:"e1d2qte98"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),P=p("li",{target:"e1d2qte99"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),A=p("div",{target:"e1d2qte910"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),T=p("div",{target:"e1d2qte911"})(({theme:e,disabled:s})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:s?e.colors.fadedText40:e.colors.bodyText})),W=p("div",{target:"e1d2qte912"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),we=p("span",{target:"e1d2qte913"})(({theme:e})=>({marginRight:e.spacing.twoXS})),Se=p("div",{target:"e1d2qte914"})(({theme:e,disabled:s})=>({display:"flex",padding:e.spacing.twoXS,color:s?e.colors.fadedText40:e.colors.darkenedBgMix100})),N=p("small",{target:"e1d2qte915"})(({theme:e})=>({color:e.colors.red,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),R=p("span",{target:"e1d2qte916"})({}),xe=e=>({[D]:{display:"flex",flexDirection:"column",alignItems:"flex-start",height:"auto",gap:e.spacing.sm},[V]:{display:"none"},[L]:{marginBottom:e.spacing.twoXS},[E]:{paddingRight:e.spacing.lg},[W]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[T]:{width:e.sizes.full},[A]:{flexDirection:"column"},[N]:{height:"auto",whiteSpace:"initial"},[R]:{display:"none"},[P]:{margin:e.spacing.none,padding:e.spacing.none}}),Ue=p("div",{target:"e1d2qte917"})(({theme:e,width:s})=>{if(s<X("23rem"))return xe(e)}),ve=({multiple:e,acceptedExtensions:s,maxSizeBytes:t,acceptDirectory:i=!1,disabled:o})=>{const l=()=>i?"directories":e?"files":"file",n=()=>s.length?` • ${s.map(d=>d.replace(/^\./,"").toUpperCase()).join(", ")}`:null,r=()=>`Limit ${I(t,S.Byte,0)} per file`;return g(he,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a(V,{children:a(m,{content:M,size:"threeXL"})}),g(me,{children:[g(L,{disabled:o,children:["Drag and drop ",l()," here"]}),g(fe,{disabled:o,children:[r(),n()]})]})]})},ze=c.memo(ve),Ie=({onDrop:e,multiple:s,acceptedExtensions:t,maxSizeBytes:i,disabled:o,label:l,acceptDirectory:n=!1})=>a(ne,{onDrop:e,multiple:s,accept:le(t),maxSize:i,disabled:o,useFsAccessApi:!1,children:({getRootProps:r,getInputProps:d})=>{const u=d({multiple:s||!!n});return g(D,{...r(),"data-testid":"stFileUploaderDropzone",isDisabled:o,"aria-label":l,"aria-disabled":o,children:[a("input",{"data-testid":"stFileUploaderDropzoneInput",...u,...n&&{webkitdirectory:""}}),a(ze,{multiple:s,acceptedExtensions:t,maxSizeBytes:i,acceptDirectory:n,disabled:o}),a(Fe,{children:a(y,{kind:w.SECONDARY,disabled:o,size:O.SMALL,children:n?"Browse directories":"Browse files"})})]})}}),Ce=c.memo(Ie),q=p("small",{target:"e1w49r0d0"})(({kind:e,disabled:s,theme:t})=>{const{danger:i,fadedText60:o,fadedText40:l}=t.colors;let n=o;return s&&(n=l),e==="danger"&&(n=i),{color:n,fontSize:t.fontSizes.sm,lineHeight:t.lineHeights.tight}}),be=({fileInfo:e,disabled:s})=>e.status.type==="uploading"?a(ge,{value:e.status.progress,size:pe.SMALL}):e.status.type==="error"?g(N,{children:[a(we,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a(R,{children:a(m,{content:B,size:"lg"})})]}):e.status.type==="uploaded"?a(q,{disabled:s,children:I(e.size,S.Byte)}):null,Me=({fileInfo:e,onDelete:s,disabled:t})=>g(W,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a(Se,{disabled:t,children:a(m,{content:ae,size:"twoXL"})}),g(A,{className:"stFileUploaderFileData",children:[a(T,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,disabled:t,children:e.name}),a(be,{fileInfo:e,disabled:t})]}),a("div",{"data-testid":"stFileUploaderDeleteBtn",children:a(y,{onClick:()=>s(e.id),kind:w.MINIMAL,disabled:t,"aria-label":`Remove ${e.name}`,children:a(m,{content:re,size:"lg"})})})]}),Be=c.memo(Me),De=p("div",{target:"egc9vxm0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),Ve=p("div",{target:"egc9vxm1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),Le=({currentPage:e,totalPages:s,onNext:t,onPrevious:i})=>g(De,{"data-testid":"stFileUploaderPagination",children:[a(q,{children:`Showing page ${e} of ${s}`}),g(Ve,{children:[a(y,{onClick:i,kind:w.MINIMAL,children:a(m,{content:C,size:"xl"})}),a(y,{onClick:t,kind:w.MINIMAL,children:a(m,{content:b,size:"xl"})})]})]}),Ee=c.memo(Le),z=(e,s)=>Math.ceil(e.length/s),Pe=e=>j(({pageSize:t,items:i,resetOnAdd:o,...l})=>{const[n,r]=c.useState(0),[d,u]=c.useState(()=>z(i,t)),h=ue(i);c.useEffect(()=>{h&&h.length!==i.length&&u(z(i,t)),h&&h.length<i.length?o&&r(0):n+1>=d&&r(d-1)},[i,n,t,h,o,d]);const H=()=>{r(Math.min(n+1,d-1))},k=()=>{r(Math.max(0,n-1))},$=i.slice(n*t,n*t+t);return g(_,{children:[a(e,{items:$,...l}),i.length>t?a(Ee,{pageSize:t,totalPages:d,currentPage:n+1,onNext:H,onPrevious:k}):null]})},e),Ae=({items:e,onDelete:s,disabled:t})=>a(ye,{children:e.map(i=>a(P,{children:a(Be,{fileInfo:i,onDelete:s,disabled:t})},i.id))}),Te=Pe(Ae),We=e=>a(E,{children:a(Te,{...e})}),Ne=c.memo(We);class Re extends c.PureComponent{constructor(s){super(s),this.formClearHelper=new oe,this.localFileIdCounter=1,this.forceUpdatingStatus=!1,this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:i,widgetMgr:o,fragmentId:l}=this.props,n=o.getFileUploaderStateValue(i);K(t,n)||o.setFileUploaderStateValue(i,t,{fromUi:!0},l)},this.isFileTypeAllowed=t=>{const{element:i}=this.props,{type:o}=i;if(!o||o.length===0)return!0;const l=t.name.toLowerCase();return o.some(n=>l.endsWith(n.toLowerCase()))},this.filterDirectoryFiles=t=>{const i=[],o=[];return t.forEach(l=>{this.isFileTypeAllowed(l)?i.push(l):o.push({file:l,errors:[{code:"file-invalid-type",message:`${l.type} files are not allowed.`}]})}),{accepted:i,rejected:o}},this.dropHandler=(t,i)=>{const{element:o}=this.props,{multipleFiles:l}=o;if(!!o.acceptDirectory&&t.length>0){const{accepted:r,rejected:d}=this.filterDirectoryFiles(t);t=r,i=[...i,...d]}if(!l&&t.length===0&&i.length>1){const r=i.findIndex(d=>d.errors.length===1&&d.errors[0].code==="too-many-files");r>=0&&(t.push(i[r].file),i.splice(r,1))}if(this.props.uploadClient.fetchFileURLs(t).then(r=>{if(!l&&t.length>0){const d=this.state.files.find(u=>u.status.type!=="error");d&&(this.forceUpdatingStatus=!0,this.deleteFile(d.id),this.forceUpdatingStatus=!1)}Y(r,t).forEach(([d,u])=>{this.uploadFile(d,u)})}).catch(r=>{this.addFiles(t.map(d=>new v(d.name,d.size,this.nextLocalFileId(),{type:"error",errorMessage:r})))}),i.length>0){const r=i.map(d=>de(d,this.nextLocalFileId(),this.maxUploadSizeInBytes));this.addFiles(r)}},this.uploadFile=(t,i)=>{const o=new AbortController,l=i.webkitRelativePath||i.name,n=new v(l,i.size,this.nextLocalFileId(),{type:"uploading",abortController:o,progress:1});this.addFile(n),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,i,r=>this.onUploadProgress(r,n.id),o.signal).then(()=>this.onUploadComplete(n.id,t)).catch(r=>{r instanceof DOMException&&r.name==="AbortError"||this.updateFile(n.id,n.setStatus({type:"error",errorMessage:r?r.toString():"Unknown error"}))})},this.onUploadComplete=(t,i)=>{const o=this.getFile(t);f(o)||o.status.type!=="uploading"||this.updateFile(o.id,o.setStatus({type:"uploaded",fileId:i.fileId,fileUrls:i}))},this.deleteFile=t=>{if(this.props.disabled)return;const i=this.getFile(t);f(i)||(i.status.type==="uploading"&&i.status.abortController.abort(),i.status.type==="uploaded"&&i.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(i.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{F.flushSync(()=>{this.setState(i=>({files:[...i.files,t]}))})},this.addFiles=t=>{F.flushSync(()=>{this.setState(i=>({files:[...i.files,...t]}))})},this.removeFile=t=>{F.flushSync(()=>{this.setState(i=>({files:i.files.filter(o=>o.id!==t)}))})},this.getFile=t=>this.state.files.find(i=>i.id===t),this.updateFile=(t,i)=>{F.flushSync(()=>{this.setState(o=>({files:o.files.map(l=>l.id===t?i:l)}))})},this.onUploadProgress=(t,i)=>{const o=this.getFile(i);if(f(o)||o.status.type!=="uploading")return;const l=Math.round(t.loaded*100/t.total);o.status.progress!==l&&this.updateFile(i,o.setStatus({type:"uploading",abortController:o.status.abortController,progress:l}))},this.onFormCleared=()=>{F.flushSync(()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(f(t))return;const{widgetMgr:i,element:o,fragmentId:l}=this.props;i.setFileUploaderStateValue(o,t,{fromUi:!0},l)})})},this.state=this.initialValue}get initialValue(){const s={files:[]},{widgetMgr:t,element:i}=this.props,o=t.getFileUploaderStateValue(i);if(f(o))return s;const{uploadedFileInfo:l}=o;return f(l)||l.length===0?s:{files:l.map(n=>{const r=n.name,d=n.size,u=n.fileId,h=n.fileUrls;return new v(r,d,this.nextLocalFileId(),{type:"uploaded",fileId:u,fileUrls:h})})}}componentWillUnmount(){this.formClearHelper.disconnect()}get maxUploadSizeInBytes(){const s=this.props.element.maxUploadSizeMb;return ce(s,S.Megabyte,S.Byte)}get status(){const s=t=>t.status.type==="uploading";return this.state.files.some(s)||this.forceUpdatingStatus?"updating":"ready"}componentDidMount(){const s=this.createWidgetValue(),{element:t,widgetMgr:i,fragmentId:o}=this.props;i.getFileUploaderStateValue(t)===void 0&&i.setFileUploaderStateValue(t,s,{fromUi:!1},o)}createWidgetValue(){const s=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:i,size:o,status:l}=t,{fileId:n,fileUrls:r}=l;return new J({fileId:n,fileUrls:r,name:i,size:o})});return new Q({uploadedFileInfo:s})}render(){const{files:s}=this.state,{element:t,disabled:i,widgetMgr:o,width:l}=this.props,n=t.type;this.formClearHelper.manageFormClearListener(o,t.formId,this.onFormCleared);const r=s.slice().reverse();return g(Ue,{className:"stFileUploader","data-testid":"stFileUploader",width:l,children:[a(se,{label:t.label,disabled:i,labelVisibility:Z(t.labelVisibility?.value),children:t.help&&a(ee,{children:a(te,{content:t.help,placement:ie.TOP_RIGHT})})}),a(Ce,{onDrop:this.dropHandler,multiple:t.multipleFiles,acceptedExtensions:n,maxSizeBytes:this.maxUploadSizeInBytes,label:t.label,disabled:i,acceptDirectory:!!t.acceptDirectory}),r.length>0&&a(Ne,{items:r,pageSize:3,onDelete:this.deleteFile,resetOnAdd:!0,disabled:i})]})}nextLocalFileId(){return this.localFileIdCounter++}}const je=G(c.memo(Re));export{je as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as l,r as i,w as A,j as f,x as g}from"./index.CD8HuT3N.js";const T=l("div",{target:"ea9qfvi0"})(()=>({lineHeight:0})),y=l("audio",{target:"ea9qfvi1"})(({theme:t})=>({width:"100%",height:t.sizes.minElementHeight,margin:0,padding:0})),h=g.getLogger("Audio");function L({element:t,endpoints:a,elementMgr:s}){const o=i.useRef(null),{startTime:n,endTime:d,loop:u,autoplay:p}=t,E=i.useMemo(()=>{if(!t.id)return!0;const e=s.getElementState(t.id,"preventAutoplay");return e||s.setElementState(t.id,"preventAutoplay",!0),e??!1},[t.id,s]);i.useEffect(()=>{o.current&&(o.current.currentTime=n)},[n]),i.useEffect(()=>{const e=o.current,r=()=>{e&&(e.currentTime=t.startTime)};return e&&e.addEventListener("loadedmetadata",r),()=>{e&&e.removeEventListener("loadedmetadata",r)}},[t]),i.useEffect(()=>{const e=o.current;if(!e)return;let r=!1;const c=()=>{d>0&&e.currentTime>=d&&(u?(e.currentTime=n||0,e.play()):r||(r=!0,e.pause()))};return d>0&&e.addEventListener("timeupdate",c),()=>{e&&d>0&&e.removeEventListener("timeupdate",c)}},[d,u,n]),i.useEffect(()=>{const e=o.current;if(!e)return;const r=()=>{u&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",r),()=>{e&&e.removeEventListener("ended",r)}},[u,n]);const m=A(t.url),v=a.buildMediaURL(t.url);return f(T,{children:f(y,{className:"stAudio","data-testid":"stAudio",ref:o,controls:!0,autoPlay:p&&!E,src:v,onError:e=>{const r=e.currentTarget.src;h.error(`Client Error: Audio source error - ${r}`),a.sendClientErrorToHost("Audio","Audio source failed to load","onerror triggered",r)},crossOrigin:m})})}const C=i.memo(L);export{C as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
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],
|
|
1
|
+
import{p as v,r as l,q as k,s as S,A as p}from"./index.CD8HuT3N.js";import{R as C,I as w,g as J,B as M}from"./base-input.CK3UVGp1.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
|
+
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],q=E[1],z=v(B,w),P=O(z,2),H=P[0],L=P[1],c=J(this.props,this.state);return l.createElement($,f({"data-baseweb":"input"},c,N,{$adjoined:R(a,i),$hasIconTrailing:this.props.clearable||this.props.type=="password"}),s(a)&&l.createElement(W,f({},c,q,{$position:S.start}),typeof a=="function"?a(c):a),l.createElement(M,f({},T,{overrides:F,adjoined:R(a,i),onFocus:this.onFocus,onBlur:this.onBlur})),s(i)&&l.createElement(H,f({},c,L,{$position:S.end}),typeof i=="function"?i(c):i))}}]),r}(l.Component);d(ie,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:k.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});function R(e,t){return s(e)&&s(t)?p.both:s(e)?p.left:s(t)?p.right:p.none}function s(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.B8zRNPZ-.js";import"./index.CD8HuT3N.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};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{am as X,r as T}from"./index.CD8HuT3N.js";import{s as Te}from"./index.D3K5nOu9.js";import"./withFullScreenWrapper.DLp1ENGm.js";import"./Toolbar.DSnK1fUh.js";import"./FormClearHelper.DHh1GFzm.js";import"./sprintf.D7DtBTRn.js";import"./checkbox.D8W881TL.js";import"./createDownloadLinkElement.ZaXNnPK4.js";import"./toConsumableArray.D-Dx88BQ.js";import"./possibleConstructorReturn.DgiPnZ9N.js";import"./createSuper.B6W-Dh9S.js";import"./FileDownload.esm.DgBvV6Pq.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,m=a.length;return l<0?a="0."+de("0",Math.abs(l))+a:l>=m?a=a+de("0",l-m):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,m=a.hasNegation,S=parseFloat("0."+(l||"0")),p=l.length<=t?"0."+l:S.toFixed(t),h=p.split("."),c=i;i&&Number(h[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},h[0]));var x=ye(h[1]||"",t,r),y=m?"-":"",s=n?".":"";return""+y+c+s+x}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 m=a.findIndex(function(k){return k}),S=e.slice(0,m);!t&&!r.startsWith(S)&&(t=S,r=S+r,n=n+S.length);for(var p=r.length,h=e.length,c={},x=new Array(p),y=0;y<p;y++){x[y]=-1;for(var s=0,I=h;s<I;s++){var C=l({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:s});if(C&&c[s]!==!0){x[y]=s,c[s]=!0;break}}}for(var g=n;g<p&&(x[g]===-1||!i(r[g]));)g++;var B=g===p||x[g]===-1?h:x[g];for(g=n-1;g>0&&x[g]===-1;)g--;var F=g===-1||x[g]===-1?0:x[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}}),m=T.useState(function(){return l(Y(e)?t:e,r)}),S=m[0],p=m[1],h=function(s,I){s.formattedValue!==S.formattedValue&&p({formattedValue:s.formattedValue,numAsString:s.value}),i(s,I)},c=e,x=r;Y(e)&&(c=S.numAsString,x=!0);var y=l(c,x);return T.useMemo(function(){p(y)},[y.formattedValue]),[S,h]}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 m=e.removeFormatting;m===void 0&&(m=qe);var S=e.defaultValue,p=e.valueIsNumericString,h=e.onValueChange,c=e.isAllowed,x=e.onChange;x===void 0&&(x=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,S,!!p,l,m,h),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=m(o,D),K=R(b);if(b=m(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&&x(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,m=t.thousandsGroupStyle;if(m===void 0&&(m="thousand"),e===""||e==="-")return e;var S=ie(t),p=S.thousandSeparator,h=S.decimalSeparator,c=r!==0&&e.indexOf(".")!==-1||r&&n,x=se(e,l),y=x.beforeDecimal,s=x.afterDecimal,I=x.addNegation;return r!==void 0&&(s=ye(s,r,!!n)),p&&(y=Le(y,p,m)),a&&(y=a+y),i&&(s=s+i),I&&(y="-"+y),e=y+(c&&h||"")+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?.match(/\d/)&&!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 m=r.decimalScale,S=t.from,p=t.to,h=p.start,c=p.end,x=ie(r),y=x.allowedDecimalSeparators,s=x.decimalSeparator,I=e[c]===s;if(ae(e)&&(e===i||e===l)&&t.lastValue==="")return e;if(c-h===1&&y.indexOf(e[h])!==-1){var C=m===0?"":s;e=e.substring(0,h)+C+e.substring(h+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,h,c),F=B.hasNegation;n=B,e=n.value,h=n.start,c=n.end;var k=g(t.lastValue,S.start,S.end),j=k.start,z=k.end,P=k.value,V=e.substring(h,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:h<i.length&&(L=h),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 p.end-p.start<S.end-S.start&&J===""&&I&&!parseFloat(ee)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,r.length+(i?1:0));var l=e.length;return a.fill(!1,l-n.length+1,l+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
|
|
2
|
+
Decimal separator can't be same as thousand separator.
|
|
3
|
+
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
4
|
+
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
|
5
|
+
`);return a.startsWith("-")&&i&&(console.error(`
|
|
6
|
+
Prefix can't start with '-' when allowNegative is true.
|
|
7
|
+
prefix: `+a+`
|
|
8
|
+
allowNegative: `+i+`
|
|
9
|
+
`),i=!1),Object.assign(Object.assign({},e),{allowNegative:i})}function rt(e){e=tt(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,a=e.onKeyDown;a===void 0&&(a=q);var i=e.onBlur;i===void 0&&(i=q);var l=e.thousandSeparator,m=e.decimalScale,S=e.fixedDecimalScale,p=e.prefix;p===void 0&&(p="");var h=e.defaultValue,c=e.value,x=e.valueIsNumericString,y=e.onValueChange,s=Se(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),I=ie(e),C=I.decimalSeparator,g=I.allowedDecimalSeparators,B=function(d){return he(d,e)},F=function(d,f){return Ye(d,f,e)},k=Y(c)?h:c,j=x??Xe(k,p,t);Y(c)?Y(h)||(j=j||typeof h=="number"):j=j||typeof c=="number";var z=function(d){return pe(d)?d:(typeof d=="number"&&(d=be(d)),j&&typeof m=="number"?ge(d,m,!!S):d)},P=Ne(z(c),z(h),!!j,B,F,y),V=P[0],L=V.numAsString,W=V.formattedValue,M=P[1],U=function(d){var f=d.target,N=d.key,R=f.selectionStart,A=f.selectionEnd,E=f.value;if(E===void 0&&(E=""),(N==="Backspace"||N==="Delete")&&A<p.length){d.preventDefault();return}if(R!==A){a(d);return}N==="Backspace"&&E[0]==="-"&&R===p.length+1&&r&&H(f,1),m&&S&&(N==="Backspace"&&E[R-1]===C?(H(f,R-1),d.preventDefault()):N==="Delete"&&E[R]===C&&d.preventDefault()),g?.includes(N)&&E[R]===C&&H(f,R+1);var O=l===!0?",":l;N==="Backspace"&&E[R-1]===O&&H(f,R-1),N==="Delete"&&E[R]===O&&H(f,R+1),a(d)},$=function(d){var f=L;if(f.match(/\d/g)||(f=""),n||(f=ke(f)),S&&m&&(f=ge(f,m,S)),f!==L){var N=he(f,e);M({formattedValue:N,value:f,floatValue:parseFloat(f)},{event:d,source:re.event})}i(d)},J=function(d){return d===C?!0:ae(d)},ee=function(d){var f=d.currentValue,N=d.lastValue,R=d.formattedValue,A=d.currentValueIndex,E=d.formattedValueIndex,O=f[A],Q=R[E],oe=Ve(N,f),te=oe.to,ne=function(ue){return F(ue).indexOf(".")+p.length};return c===0&&S&&m&&f[te.start]===C&&ne(f)<A&&ne(R)>E?!1:A>=te.start&&A<te.end&&g&&g.includes(O)&&Q===C?!0:O===Q};return Object.assign(Object.assign({},s),{value:W,valueIsNumericString:!1,isValidInputCharacter:J,isCharacterSame:ee,onValueChange:M,format:B,removeFormatting:F,getCaretBoundary:function(d){return et(d,e)},onKeyDown:U,onBlur:$})}function at(e){var t=rt(e);return X.createElement(He,Object.assign({},t))}function we(){return Intl.NumberFormat()?.formatToParts(1.1)?.find(r=>r.type==="decimal")?.value??"."}function nt(){return we()==="."?",":"."}const St=e=>{const{value:t,onChange:r,disabled:n,highlight:a,validatedSelection:i,fixedDecimals:l,allowNegative:m,thousandSeparator:S,decimalSeparator:p}=e,h=T.useRef();return T.useLayoutEffect(()=>{if(i!==void 0){const c=typeof i=="number"?[i,null]:i;h.current?.setSelectionRange(c[0],c[1])}},[i]),T.createElement(Be,null,T.createElement(at,{autoFocus:!0,getInputRef:h,className:"gdg-input",onFocus:c=>c.target.setSelectionRange(a?0:c.target.value.length,c.target.value.length),disabled:n===!0,decimalScale:l,allowNegative:m,thousandSeparator:S??nt(),decimalSeparator:p??we(),value:Object.is(t,-0)?"-":t??"",onValueChange:r}))};export{St as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aY as u,aZ as s,a_ as c,a$ as f}from"./index.CD8HuT3N.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&&s(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&&(c(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{i as _,d as a,p as b,n as c,_ as d,y as e,b as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as l}from"./es6.
|
|
1
|
+
import{e as l}from"./es6.B8zRNPZ-.js";import"./index.CD8HuT3N.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};
|