@stlite/desktop 0.90.13 → 0.90.14
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.
- package/CHANGELOG.md +6 -0
- package/build/assets/{ErrorOutline.esm-CJGMKtXr.js → ErrorOutline.esm-BnBxotPi.js} +1 -1
- package/build/assets/{FileDownload.esm-DVbGfwz7.js → FileDownload.esm-RGPPDhk8.js} +1 -1
- package/build/assets/{FileHelper-BAjDG49X.js → FileHelper-tNTMbDMm.js} +1 -1
- package/build/assets/{FormClearHelper-CaLJK07N.js → FormClearHelper-DGQP9oxJ.js} +1 -1
- package/build/assets/{Hooks-D54IehuR.js → Hooks-Bo61ucn1.js} +1 -1
- package/build/assets/{InputInstructions-BLplNLW9.js → InputInstructions-Ck_istEY.js} +1 -1
- package/build/assets/{Particles-VYhfVp_p.js → Particles-BlxXqWnI.js} +1 -1
- package/build/assets/{ProgressBar-DX8k7XSZ.js → ProgressBar-C-iICo4w.js} +1 -1
- package/build/assets/{Toolbar-BbbydoLD.js → Toolbar-ByIPpsVy.js} +1 -1
- package/build/assets/{base-input-d4WKPeU6.js → base-input-DRJDHdAL.js} +1 -1
- package/build/assets/{checkbox-DUA9ewQT.js → checkbox-2-JpNSRW.js} +1 -1
- package/build/assets/{createSuper-CoIMxZYP.js → createSuper-vJD5mbw5.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-cvHWuOOd.js → data-grid-overlay-editor-BIgAXG8E.js} +1 -1
- package/build/assets/{downloader-CR6bzPv-.js → downloader-JpXWtQ-P.js} +1 -1
- package/build/assets/{es6-BCBcAdQS.js → es6-Lsq1Gov6.js} +2 -2
- package/build/assets/{iframeResizer.contentWindow-CEqjsNrn.js → iframeResizer.contentWindow-Guiwg0xE.js} +1 -1
- package/build/assets/{index-CJWk1YT9.js → index-0HifpjrJ.js} +1 -1
- package/build/assets/{index-gb2ePejP.js → index-B-7gUeK8.js} +1 -1
- package/build/assets/{index-D9P3ZYiC.js → index-B5XMuJqP.js} +1 -1
- package/build/assets/{index-BRiK5gVx.js → index-B7T6_RXn.js} +1 -1
- package/build/assets/{index-VVwti7cA.js → index-B9RImrnB.js} +1 -1
- package/build/assets/{index-NigQ67t-.js → index-BYmSaStp.js} +1 -1
- package/build/assets/{index-BMSSeqlt.js → index-BZmLxv-D.js} +1 -1
- package/build/assets/{index-BD2ZweM9.js → index-Bb6UZSFO.js} +1 -1
- package/build/assets/{index-B3GOsGpL.js → index-BhFJX5Vn.js} +1 -1
- package/build/assets/{index-CHBxMYoz.js → index-BhoSXjxz.js} +1 -1
- package/build/assets/{index-wnKDraWU.js → index-BwsrXI9O.js} +87 -87
- package/build/assets/{index-BGUuVZft.js → index-C0jxm_PH.js} +1 -1
- package/build/assets/{index-BJK2Ym_S.js → index-C636A-W7.js} +1 -1
- package/build/assets/{index-CD0SY35r.js → index-C9n8vq5U.js} +1 -1
- package/build/assets/{index-PHqcnj3c.js → index-CE3r0KWL.js} +1 -1
- package/build/assets/{index-j6pFDYKO.js → index-CFCb7WWw.js} +1 -1
- package/build/assets/{index-CdAXvPf5.js → index-CO2Aw19y.js} +1 -1
- package/build/assets/{index-CIRTE79j.js → index-CRhYEwNP.js} +1 -1
- package/build/assets/{index-Dynm-1sH.js → index-CRiFLKI5.js} +1 -1
- package/build/assets/{index-B7yzG-4X.js → index-CRtbPdb-.js} +5 -5
- package/build/assets/{index-C91sP-jG.js → index-CoAdDGfF.js} +1 -1
- package/build/assets/{index-wUVGuFfU.js → index-D4BdQDBD.js} +1 -1
- package/build/assets/{index-DOiS7VE9.js → index-D94FJ5GB.js} +1 -1
- package/build/assets/{index-B58bWjQH.js → index-DIjJwKUC.js} +1 -1
- package/build/assets/{index-DoQHaClc.js → index-DImx2D5B.js} +1 -1
- package/build/assets/{index-CTZrIDfL.js → index-DV5icRRG.js} +1 -1
- package/build/assets/{index-CwPp5UqK.js → index-DgEYnWf9.js} +1 -1
- package/build/assets/{index-mHvUvPYI.js → index-DkqUDAbB.js} +1 -1
- package/build/assets/{index-Bhgfj5y5.js → index-DqH3HG1G.js} +1 -1
- package/build/assets/{index-vLb3c1eZ.js → index-Dtvm0G3c.js} +1 -1
- package/build/assets/{index-Bwfh73dd.js → index-Q623jih7.js} +1 -1
- package/build/assets/{index-DCv3Ovf7.js → index-Zd5xxmFR.js} +1 -1
- package/build/assets/{index-CeNNLDtJ.js → index-a4tM28AE.js} +1 -1
- package/build/assets/{index-HqlJZ3Ag.js → index-lw_DueTS.js} +1 -1
- package/build/assets/{index-BdVfRySM.js → index-m7vCKamN.js} +1 -1
- package/build/assets/{index-D_4iXBI5.js → index-mytcrsu7.js} +1 -1
- package/build/assets/{index-XsxWL5x-.js → index-pOokbnGQ.js} +1 -1
- package/build/assets/{inherits-xHSaJdUZ.js → inherits-DgEBZpYa.js} +1 -1
- package/build/assets/{input-PliHooUw.js → input-BRw1nRj1.js} +1 -1
- package/build/assets/{memory-BJMhKXeY.js → memory-Do9YV2fF.js} +1 -1
- package/build/assets/{number-overlay-editor-DRf5xgI3.js → number-overlay-editor-CBg6iMqb.js} +1 -1
- package/build/assets/{sandbox-DBdCCxaG.js → sandbox-DO_nuL9g.js} +1 -1
- package/build/assets/{slicedToArray-Cuk3tbTR.js → slicedToArray-CCKNURYu.js} +1 -1
- package/build/assets/{timepicker-DjzHzJAt.js → timepicker-CBaJIVEG.js} +1 -1
- package/build/assets/{uniqueId-ikSpJ9AP.js → uniqueId-7HN9pV-Z.js} +1 -1
- package/build/assets/{useBasicWidgetState-raTjAqZP.js → useBasicWidgetState-CQoPeUHV.js} +1 -1
- package/build/assets/{useTextInputAutoExpand-Uac3U0I_.js → useTextInputAutoExpand-CJ0SgjFi.js} +1 -1
- package/build/assets/{useUpdateUiValue-BbEmiOZQ.js → useUpdateUiValue-CakBWvqR.js} +1 -1
- package/build/assets/{withFullScreenWrapper-C7u7nPsK.js → withFullScreenWrapper-6omMDHWT.js} +1 -1
- package/build/assets/{worker-CiNU4sgs.js → worker-CO569BKa.js} +4 -4
- package/build/electron/worker.js +5 -5
- package/build/index.html +1 -1
- package/package.json +4 -4
- package/wheels/streamlit-1.50.0-cp313-none-any.whl +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as g,r as j,I as E,J as L,j as s,w as b,f as C,x as v}from"./index-
|
|
1
|
+
import{s as g,r as j,I as E,J as L,j as s,w as b,f as C,x as v}from"./index-BwsrXI9O.js";import{w as T,E as W}from"./withFullScreenWrapper-6omMDHWT.js";import{S as x,T as y}from"./Toolbar-ByIPpsVy.js";const F=g("div",{target:"e115fcil2"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:e.spacing.lg,maxWidth:"100%",width:t?"100%":"fit-content"}),""),M=g("div",{target:"e115fcil1"})(({theme:e,shouldStretch:t})=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:t?"100%":"auto",flexGrow:t?1:0,">img":{borderRadius:e.radii.default}}),""),R=g("div",{target:"e115fcil0"})(({theme:e})=>({textAlign:"center",marginTop:e.spacing.xs,wordWrap:"break-word",padding:e.spacing.threeXS}),""),H=v.getLogger("ImageList");function O(e,t,r){if(e){if(e.useStretch)return r;if(e.useContent)return;if(e.pixelWidth)return e.pixelWidth}if(t!=null)switch(t){case-1:case-3:case-4:return;case-2:case-5:return r;default:return t>0?t:void 0}}const G=({itemKey:e,image:t,imgStyle:r,buildMediaURL:n,handleImageError:l,shouldStretch:i})=>{const c=b(t.url);return s.jsxs(M,{"data-testid":"stImageContainer",shouldStretch:i,children:[s.jsx("img",{style:r,src:n(t.url),alt:e,onError:l,crossOrigin:c}),t.caption&&s.jsx(R,{"data-testid":"stImageCaption",style:r,children:s.jsx(C,{source:t.caption,allowHTML:!1,isCaption:!0,isLabel:!0})})]})};function U({element:e,endpoints:t,widthConfig:r,disableFullscreenMode:n}){const l=E(e.imgs),{expanded:i,width:c,height:d,expand:f,collapse:h}=L(W),m=c||0,I=O(r,e.width,m),p=r?.useStretch||e.width===-5,a={};d&&i?(a.maxHeight=d,a.objectFit="contain",a.width="100%"):(a.width=I??"100%",a.maxWidth="100%");const S=u=>{const o=u.currentTarget.src;H.error(`Client Error: Image source error - ${o}`),t.sendClientErrorToHost("Image","Image source failed to load","onerror triggered",o)};return s.jsxs(x,{width:m,height:d,useContainerWidth:i,topCentered:!0,children:[s.jsx(y,{target:x,isFullScreen:i,onExpand:f,onCollapse:h,disableFullscreenMode:n}),s.jsx(F,{className:"stImage","data-testid":"stImage",shouldStretch:p,children:l.map((u,o)=>s.jsx(G,{itemKey:o.toString(),image:u,imgStyle:a,buildMediaURL:w=>t.buildMediaURL(w),handleImageError:S,shouldStretch:p},o))})]})}const k=T(U),J=j.memo(k);export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as n,i as c,l as g}from"./index-
|
|
1
|
+
import{r as a,j as n,i as c,l as g}from"./index-BwsrXI9O.js";import{u as m}from"./useBasicWidgetState-CQoPeUHV.js";import"./FormClearHelper-DGQP9oxJ.js";const b=(t,e)=>t.getStringValue(e),f=t=>t.default??null,p=t=>t.value??null,d=(t,e,r,o)=>{e.setStringValue(t,r.value,{fromUi:r.fromUi},o)},C=({element:t,disabled:e,widgetMgr:r,fragmentId:o})=>{const[i,l]=m({getStateFromWidgetMgr:b,getDefaultStateFromProto:f,getCurrStateFromProto:p,updateWidgetMgrState:d,element:t,widgetMgr:r,fragmentId:o}),s=a.useCallback(u=>{l({value:u,fromUi:!0})},[l]);return n.jsx(c,{label:t.label,labelVisibility:g(t.labelVisibility?.value),help:t.help,onChange:s,disabled:e,value:i})},x=a.memo(C);export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b1 as Ye,ac as J,r as x,bs as pt,ad as vt,o as Q,aL as mt,aM as bt,s as me,t as Ve,bi as yt,u as Tt,bt as kt,j as Z,W as Ot,l as wt,Q as Rt,T as St,P as Mt,bu as _t,bv as Ee}from"./index-wnKDraWU.js";import{s as ze}from"./sprintf-DpPCfzXw.js";import{u as Et}from"./useBasicWidgetState-raTjAqZP.js";import"./FormClearHelper-CaLJK07N.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 Ze(){return Ue||(Ue=1,(function(e){var r=ue&&ue.__spreadArray||function(i,s,u){if(u||arguments.length===2)for(var h=0,m=s.length,v;h<m;h++)(v||!(h in s))&&(v||(v=Array.prototype.slice.call(s,0,h)),v[h]=s[h]);return i.concat(v||Array.prototype.slice.call(s))};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 n=Ye(),o=Ie(),p=function(i){var s=i.toString().split(".")[1];return s?s.length:0};e.getStepDecimals=p;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function l(i,s,u){var h=(s-i)/u,m=8,v=Number(h.toFixed(m));return parseInt(v.toString(),10)===v}e.isStepDivisible=l;function g(i,s,u,h,m,v,T){var _=1e11;if(i=Math.round(i*_)/_,!v){var P=T[s-1],C=T[s+1];if(P&&P>i)return P;if(C&&C<i)return C}if(i>h)return h;if(i<u)return u;var U=Math.floor(i*_-u*_)%Math.floor(m*_),z=Math.floor(i*_-Math.abs(U)),W=U===0?i:z/_,A=Math.abs(U/_)<m/2?W:W+m,L=(0,e.getStepDecimals)(m);return parseFloat(A.toFixed(L))}e.normalizeValue=g;function F(i,s,u){return(i-s)/(u-s)}e.relativeValue=F;function $(i){return i===o.Direction.Up||i===o.Direction.Down}e.isVertical=$;function V(i,s,u){if(s>=u)throw new RangeError("min (".concat(s,") is equal/bigger than max (").concat(u,")"));if(i<s)throw new RangeError("value (".concat(i,") is smaller than min (").concat(s,")"));if(i>u)throw new RangeError("value (".concat(i,") is bigger than max (").concat(u,")"))}e.checkBoundaries=V;function E(i,s,u){return i<s?s:i>u?u:i}e.checkValuesAgainstBoundaries=E;function y(i){if(!(i.length<2)&&!i.slice(1).every(function(s,u){return i[u]<=s}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=y;function d(i){var s=window.getComputedStyle(i);return{top:parseInt(s["margin-top"],10),bottom:parseInt(s["margin-bottom"],10),left:parseInt(s["margin-left"],10),right:parseInt(s["margin-right"],10)}}e.getMargin=d;function t(i){var s=window.getComputedStyle(i);return{top:parseInt(s["padding-top"],10)+parseInt(s["border-top-width"],10),bottom:parseInt(s["padding-bottom"],10)+parseInt(s["border-bottom-width"],10),left:parseInt(s["padding-left"],10)+parseInt(s["border-left-width"],10),right:parseInt(s["padding-right"],10)+parseInt(s["border-right-width"],10)}}e.getPaddingAndBorder=t;function a(i,s,u){var h=u?-1:1;i.forEach(function(m,v){return f(m,h*s[v].x,s[v].y)})}e.translateThumbs=a;function c(i,s,u,h){for(var m=0,v=D(i[0],s,u,h),T=1;T<i.length;T++){var _=D(i[T],s,u,h);_<v&&(v=_,m=T)}return m}e.getClosestThumbIndex=c;function f(i,s,u){i.style.transform="translate(".concat(s,"px, ").concat(u,"px)")}e.translate=f;var b=function(i){var s=[],u=null,h=function(){for(var m=[],v=0;v<arguments.length;v++)m[v]=arguments[v];s=m,!u&&(u=requestAnimationFrame(function(){u=null,i.apply(void 0,s)}))};return h};e.schd=b;function k(i,s,u){var h=i.slice(0);return h[s]=u,h}e.replaceAt=k;function I(i){var s=i.values,u=i.colors,h=i.min,m=i.max,v=i.direction,T=v===void 0?o.Direction.Right:v,_=i.rtl,P=_===void 0?!1:_;P&&T===o.Direction.Right?T=o.Direction.Left:P&&o.Direction.Left&&(T=o.Direction.Right);var C=s.slice(0).sort(function(z,W){return z-W}).map(function(z){return(z-h)/(m-h)*100}),U=C.reduce(function(z,W,A){return"".concat(z,", ").concat(u[A]," ").concat(W,"%, ").concat(u[A+1]," ").concat(W,"%")},"");return"linear-gradient(".concat(T,", ").concat(u[0]," 0%").concat(U,", ").concat(u[u.length-1]," 100%)")}e.getTrackBackground=I;function O(){}e.voidFn=O;function w(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=w;var M=function(i,s,u,h,m){m===void 0&&(m=function(T){return T});var v=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(T,_){var P=Math.ceil(_.getBoundingClientRect().width);if(_.innerText&&_.innerText.includes(u)&&_.childElementCount===0){var C=_.cloneNode(!0);C.innerHTML=m(s.toFixed(h)),C.style.visibility="hidden",document.body.appendChild(C),P=Math.ceil(C.getBoundingClientRect().width),document.body.removeChild(C)}return P>T?P:T},i.getBoundingClientRect().width));return v},B=function(i,s,u,h,m,v,T){T===void 0&&(T=function(C){return C});var _=[],P=function(C){var U=M(u[C],h[C],m,v,T),z=s[C].x;s.forEach(function(W,A){var L=W.x,G=M(u[A],h[A],m,v,T);C!==A&&(z>=L&&z<=L+G||z+U>=L&&z+U<=L+G)&&(_.includes(A)||(_.push(C),_.push(A),_=r(r([],_,!0),[C,A],!1),P(A)))})};return P(i),Array.from(new Set(_.sort()))},R=function(i,s,u,h,m,v){h===void 0&&(h=.1),m===void 0&&(m=" - "),v===void 0&&(v=function(A){return A});var T=(0,e.getStepDecimals)(h),_=(0,n.useState)({}),P=_[0],C=_[1],U=(0,n.useState)(v(s[u].toFixed(T))),z=U[0],W=U[1];return(0,n.useEffect)(function(){if(i){var A=i.getThumbs();if(A.length<1)return;var L={},G=i.getOffsets(),ne=B(u,G,A,s,m,T,v),le=v(s[u].toFixed(T));if(ne.length){var ee=ne.reduce(function(te,oe,ge,pe){return te.length?r(r([],te,!0),[G[pe[ge]].x],!1):[G[pe[ge]].x]},[]);if(Math.min.apply(Math,ee)===G[u].x){var de=[];ne.forEach(function(te){de.push(s[te].toFixed(T))}),le=Array.from(new Set(de.sort(function(te,oe){return parseFloat(te)-parseFloat(oe)}))).map(v).join(m);var fe=Math.min.apply(Math,ee),he=Math.max.apply(Math,ee),_e=A[ne[ee.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),C(L)}},[i,s]),[z,P]};e.useThumbOverlap=R;function D(i,s,u,h){var m=i.getBoundingClientRect(),v=m.left,T=m.top,_=m.width,P=m.height;return $(h)?Math.abs(u-(T+P/2)):Math.abs(s-(v+_/2))}var j=function(){var i,s=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(s)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=j})(ue)),ue}var He;function xt(){if(He)return H;He=1;var e=H&&H.__extends||(function(){var E=function(y,d){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])},E(y,d)};return function(y,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");E(y,d);function t(){this.constructor=y}y.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}})(),r=H&&H.__createBinding||(Object.create?(function(E,y,d,t){t===void 0&&(t=d);var a=Object.getOwnPropertyDescriptor(y,d);(!a||("get"in a?!y.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return y[d]}}),Object.defineProperty(E,t,a)}):(function(E,y,d,t){t===void 0&&(t=d),E[t]=y[d]})),n=H&&H.__setModuleDefault||(Object.create?(function(E,y){Object.defineProperty(E,"default",{enumerable:!0,value:y})}):function(E,y){E.default=y}),o=H&&H.__importStar||function(E){if(E&&E.__esModule)return E;var y={};if(E!=null)for(var d in E)d!=="default"&&Object.prototype.hasOwnProperty.call(E,d)&&r(y,E,d);return n(y,E),y},p=H&&H.__spreadArray||function(E,y,d){if(d||arguments.length===2)for(var t=0,a=y.length,c;t<a;t++)(c||!(t in y))&&(c||(c=Array.prototype.slice.call(y,0,t)),c[t]=y[t]);return E.concat(c||Array.prototype.slice.call(y))};Object.defineProperty(H,"__esModule",{value:!0});var S=o(Ye()),l=Ze(),g=Ie(),F=["ArrowRight","ArrowUp","k","PageUp"],$=["ArrowLeft","ArrowDown","j","PageDown"],V=(function(E){e(y,E);function y(d){var t=E.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(a,c){return c}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var a=t.props,c=a.direction,f=a.values,b=a.min,k=a.max,I=t.trackRef.current;if(!I)return console.warn("No track element found."),[];var O=I.getBoundingClientRect(),w=(0,l.getPaddingAndBorder)(I);return t.getThumbs().map(function(M,B){var R={x:0,y:0},D=M.getBoundingClientRect(),j=(0,l.getMargin)(M);switch(c){case g.Direction.Right:return R.x=(j.left+w.left)*-1,R.y=((D.height-O.height)/2+w.top)*-1,R.x+=O.width*(0,l.relativeValue)(f[B],b,k)-D.width/2,R;case g.Direction.Left:return R.x=(j.right+w.right)*-1,R.y=((D.height-O.height)/2+w.top)*-1,R.x+=O.width-O.width*(0,l.relativeValue)(f[B],b,k)-D.width/2,R;case g.Direction.Up:return R.x=((D.width-O.width)/2+j.left+w.left)*-1,R.y=-w.left,R.y+=O.height-O.height*(0,l.relativeValue)(f[B],b,k)-D.height/2,R;case g.Direction.Down:return R.x=((D.width-O.width)/2+j.left+w.left)*-1,R.y=-w.left,R.y+=O.height*(0,l.relativeValue)(f[B],b,k)-D.height/2,R;default:return(0,l.assertUnreachable)(c)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.trackRef.current.children).filter(function(a){return a.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(a){return t.getThumbs().findIndex(function(c){return c===a.target||c.contains(a.target)})},t.addTouchEvents=function(a){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(a){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(a){var c;if(!(a.button!==0||(0,l.isIOS)()))if(a.persist(),a.preventDefault(),t.addMouseEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return t.onMove(a.clientX,a.clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.clientX,a.clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.clientX,a.clientY)})}},t.onResize=function(){(0,l.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(a){var c;if(a.persist(),t.addTouchEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.touches[0].clientX,a.touches[0].clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},t.onMouseOrTouchStart=function(a){if(!t.props.disabled){var c=(0,l.isTouchEvent)(a);if(!(!c&&a.button!==0)){var f=t.getTargetIndex(a);f!==-1&&(c?t.addTouchEvents(a):t.addMouseEvents(a),t.setState({draggedThumbIndex:f,thumbZIndexes:t.state.thumbZIndexes.map(function(b,k){return k===f?Math.max.apply(Math,t.state.thumbZIndexes):b<=t.state.thumbZIndexes[f]?b:b-1})}))}}},t.onMouseMove=function(a){a.preventDefault(),t.onMove(a.clientX,a.clientY)},t.onTouchMove=function(a){a.preventDefault(),t.onMove(a.touches[0].clientX,a.touches[0].clientY)},t.onKeyDown=function(a){var c=t.props,f=c.values,b=c.onChange,k=c.step,I=c.rtl,O=c.direction,w=t.state.isChanged,M=t.getTargetIndex(a.nativeEvent),B=I||O===g.Direction.Left||O===g.Direction.Down?-1:1;M!==-1&&(F.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]+B*(a.key==="PageUp"?k*10:k),M)))):$.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]-B*(a.key==="PageDown"?k*10:k),M)))):a.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){w&&t.fireOnFinalChange()}):w&&t.fireOnFinalChange())},t.onKeyUp=function(a){var c=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){c&&t.fireOnFinalChange()})},t.onMove=function(a,c){var f=t.state,b=f.draggedThumbIndex,k=f.draggedTrackPos,I=t.props,O=I.direction,w=I.min,M=I.max,B=I.onChange,R=I.values,D=I.step,j=I.rtl;if(b===-1&&k[0]===-1&&k[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var s=i.getBoundingClientRect(),u=(0,l.isVertical)(O)?s.height:s.width;if(k[0]!==-1&&k[1]!==-1){var h=a-k[0],m=c-k[1],v=0;switch(O){case g.Direction.Right:case g.Direction.Left:v=h/u*(M-w);break;case g.Direction.Down:case g.Direction.Up:v=m/u*(M-w);break;default:(0,l.assertUnreachable)(O)}if(j&&(v*=-1),Math.abs(v)>=D/2){for(var T=0;T<t.thumbRefs.length;T++){if(R[T]===M&&Math.sign(v)===1||R[T]===w&&Math.sign(v)===-1)return;var _=R[T]+v;_>M?v=M-R[T]:_<w&&(v=w-R[T])}for(var P=R.slice(0),T=0;T<t.thumbRefs.length;T++)P=(0,l.replaceAt)(P,T,t.normalizeValue(R[T]+v,T));t.setState({draggedTrackPos:[a,c]}),B(P)}}else{var C=0;switch(O){case g.Direction.Right:C=(a-s.left)/u*(M-w)+w;break;case g.Direction.Left:C=(u-(a-s.left))/u*(M-w)+w;break;case g.Direction.Down:C=(c-s.top)/u*(M-w)+w;break;case g.Direction.Up:C=(u-(c-s.top))/u*(M-w)+w;break;default:(0,l.assertUnreachable)(O)}j&&(C=M+w-C),Math.abs(R[b]-C)>=D/2&&B((0,l.replaceAt)(R,b,t.normalizeValue(C,b)))}},t.normalizeValue=function(a,c){var f=t.props,b=f.min,k=f.max,I=f.step,O=f.allowOverlap,w=f.values;return(0,l.normalizeValue)(a,c,b,k,I,O,w)},t.onEnd=function(a){if(a.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 a=t.props,c=a.onFinalChange,f=a.values;c&&c(f)},t.updateMarkRefs=function(a){if(!a.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(a.max-a.min)/t.props.step,t.markRefs=[];for(var c=0;c<t.numOfMarks+1;c++)t.markRefs[c]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var a=window.getComputedStyle(t.trackRef.current),c=parseInt(a.width,10),f=parseInt(a.height,10),b=parseInt(a.paddingLeft,10),k=parseInt(a.paddingTop,10),I=[],O=0;O<t.numOfMarks+1;O++){var w=9999,M=9999;if(t.markRefs[O].current){var B=t.markRefs[O].current.getBoundingClientRect();w=B.height,M=B.width}t.props.direction===g.Direction.Left||t.props.direction===g.Direction.Right?I.push([Math.round(c/t.numOfMarks*O+b-M/2),-Math.round((w-f)/2)]):I.push([Math.round(f/t.numOfMarks*O+k-w/2),-Math.round((M-c)/2)])}t.setState({markOffsets:I})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,l.schd)(t.onMouseMove),t.schdOnTouchMove=(0,l.schd)(t.onTouchMove),t.schdOnEnd=(0,l.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return y.prototype.componentDidMount=function(){var d=this,t=this.props,a=t.values,c=t.min,f=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,l.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(b){return(0,l.checkBoundaries)(b,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(b){(0,l.isStepDivisible)(c,b,f)||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.")})},y.prototype.componentDidUpdate=function(d,t){var a=this.props,c=a.max,f=a.min,b=a.step,k=a.values,I=a.rtl;(d.max!==c||d.min!==f||d.step!==b)&&this.updateMarkRefs(this.props),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),I),(d.max!==c||d.min!==f||d.step!==b||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),k.forEach(function(O){(0,l.isStepDivisible)(f,O,b)||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.")}))},y.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)},y.prototype.render=function(){var d=this,t=this.props,a=t.label,c=t.labelledBy,f=t.renderTrack,b=t.renderThumb,k=t.renderMark,I=k===void 0?function(){return null}:k,O=t.values,w=t.min,M=t.max,B=t.allowOverlap,R=t.disabled,D=this.state,j=D.draggedThumbIndex,i=D.thumbZIndexes,s=D.markOffsets;return f({props:{style:{transform:"scale(1)",cursor:j>-1?"grabbing":this.props.draggableTrack?(0,l.isVertical)(this.props.direction)?"ns-resize":"ew-resize":O.length===1&&!R?"pointer":"inherit"},onMouseDown:R?l.voidFn:this.onMouseDownTrack,onTouchStart:R?l.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:R,children:p(p([],s.map(function(u,h,m){return I({props:{style:d.props.direction===g.Direction.Left||d.props.direction===g.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),O.map(function(u,h){var m=d.state.draggedThumbIndex===h;return b({index:h,value:u,isDragged:m,props:{style:{position:"absolute",zIndex:i[h],cursor:R?"inherit":m?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:h,tabIndex:R?void 0:0,"aria-valuemax":B?M:O[h+1]||M,"aria-valuemin":B?w:O[h-1]||w,"aria-valuenow":u,draggable:!1,ref:d.thumbRefs[h],"aria-label":a,"aria-labelledby":c,role:"slider",onKeyDown:R?l.voidFn:d.onKeyDown,onKeyUp:R?l.voidFn:d.onKeyUp}})}),!0)})},y.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:g.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},y})(S.Component);return H.default=V,H}var We;function It(){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 n=r(xt());e.Range=n.default;var o=Ze();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return o.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return o.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return o.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return o.checkValuesAgainstBoundaries}});var p=Ie();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return p.Direction}})})(se)),se}var Ge=It();function qe(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(p){return Object.getOwnPropertyDescriptor(e,p).enumerable})),n.push.apply(n,o)}return n}function ve(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?qe(Object(n),!0).forEach(function(o){Ct(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Ct(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,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,n=e.$value,o=n===void 0?[]:n,p=e.$disabled,S=e.$isDragged,l=r.sizing,g="inherit";return p?g="not-allowed":S?g="grabbing":o.length===1&&(g="pointer"),{paddingTop:l.scale600,paddingBottom:l.scale600,paddingRight:l.scale600,paddingLeft:l.scale600,display:"flex",cursor:g,backgroundColor:r.colors.sliderTrackFill}});ye.displayName="Track";ye.displayName="Track";ye.displayName="StyledTrack";var Te=J("div",function(e){var r=e.$theme,n=e.$value,o=n===void 0?[]:n,p=e.$min,S=e.$max,l=e.$disabled,g=r.colors,F=r.borders,$=r.direction,V=r.borders.useRoundedCorners?F.radius100:0;return{borderTopLeftRadius:V,borderTopRightRadius:V,borderBottomRightRadius:V,borderBottomLeftRadius:V,background:Ge.getTrackBackground({values:o,colors:o.length===1?[l?g.borderOpaque:g.primary,l?g.backgroundSecondary:g.borderOpaque]:[l?g.backgroundSecondary:g.borderOpaque,l?g.borderOpaque:g.primary,l?g.backgroundSecondary:g.borderOpaque],min:p||0,max:S||0,rtl:$==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:l?"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,n=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:n.scale600,paddingLeft:n.scale600,paddingBottom:n.scale400}});we.displayName="TickBar";we.displayName="TickBar";we.displayName="StyledTickBar";var Re=J("div",function(e){var r=e.$theme,n=e.$value,o=n===void 0?[]:n,p=e.$thumbIndex,S=e.$disabled,l=o.length===2&&p===0,g=o.length===2&&p===1;return r.direction==="rtl"&&(g||l)&&(l=!l,g=!g),{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,n=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill}});Se.displayName="InnerThumb";Se.displayName="InnerThumb";Se.displayName="StyledInnerThumb";var Me=J("div",function(e){var r=e.$disabled,n=e.$theme;return ve(ve({position:"absolute",top:"-".concat(n.sizing.scale1400)},n.typography.font200),{},{backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill,color:n.colors.contentInversePrimary,paddingLeft:n.sizing.scale600,paddingRight:n.sizing.scale600,paddingTop:n.sizing.scale500,paddingBottom:n.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 n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(p){return Object.getOwnPropertyDescriptor(e,p).enumerable})),n.push.apply(n,o)}return n}function Dt(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ke(Object(n),!0).forEach(function(o){Pt(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Pt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},X.apply(this,arguments)}function K(e,r){return jt(e)||Lt(e,r)||At(e,r)||Bt()}function Bt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{b1 as Ye,ac as J,r as x,bs as pt,ad as vt,o as Q,aL as mt,aM as bt,s as me,t as Ve,bi as yt,u as Tt,bt as kt,j as Z,W as Ot,l as wt,Q as Rt,T as St,P as Mt,bu as _t,bv as Ee}from"./index-BwsrXI9O.js";import{s as ze}from"./sprintf-DpPCfzXw.js";import{u as Et}from"./useBasicWidgetState-CQoPeUHV.js";import"./FormClearHelper-DGQP9oxJ.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 Ze(){return Ue||(Ue=1,(function(e){var r=ue&&ue.__spreadArray||function(i,s,u){if(u||arguments.length===2)for(var h=0,m=s.length,v;h<m;h++)(v||!(h in s))&&(v||(v=Array.prototype.slice.call(s,0,h)),v[h]=s[h]);return i.concat(v||Array.prototype.slice.call(s))};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 n=Ye(),o=Ie(),p=function(i){var s=i.toString().split(".")[1];return s?s.length:0};e.getStepDecimals=p;function S(i){return i.touches&&i.touches.length||i.changedTouches&&i.changedTouches.length}e.isTouchEvent=S;function l(i,s,u){var h=(s-i)/u,m=8,v=Number(h.toFixed(m));return parseInt(v.toString(),10)===v}e.isStepDivisible=l;function g(i,s,u,h,m,v,T){var _=1e11;if(i=Math.round(i*_)/_,!v){var P=T[s-1],C=T[s+1];if(P&&P>i)return P;if(C&&C<i)return C}if(i>h)return h;if(i<u)return u;var U=Math.floor(i*_-u*_)%Math.floor(m*_),z=Math.floor(i*_-Math.abs(U)),W=U===0?i:z/_,A=Math.abs(U/_)<m/2?W:W+m,L=(0,e.getStepDecimals)(m);return parseFloat(A.toFixed(L))}e.normalizeValue=g;function F(i,s,u){return(i-s)/(u-s)}e.relativeValue=F;function $(i){return i===o.Direction.Up||i===o.Direction.Down}e.isVertical=$;function V(i,s,u){if(s>=u)throw new RangeError("min (".concat(s,") is equal/bigger than max (").concat(u,")"));if(i<s)throw new RangeError("value (".concat(i,") is smaller than min (").concat(s,")"));if(i>u)throw new RangeError("value (".concat(i,") is bigger than max (").concat(u,")"))}e.checkBoundaries=V;function E(i,s,u){return i<s?s:i>u?u:i}e.checkValuesAgainstBoundaries=E;function y(i){if(!(i.length<2)&&!i.slice(1).every(function(s,u){return i[u]<=s}))throw new RangeError("values={[".concat(i,"]} needs to be sorted when allowOverlap={false}"))}e.checkInitialOverlap=y;function d(i){var s=window.getComputedStyle(i);return{top:parseInt(s["margin-top"],10),bottom:parseInt(s["margin-bottom"],10),left:parseInt(s["margin-left"],10),right:parseInt(s["margin-right"],10)}}e.getMargin=d;function t(i){var s=window.getComputedStyle(i);return{top:parseInt(s["padding-top"],10)+parseInt(s["border-top-width"],10),bottom:parseInt(s["padding-bottom"],10)+parseInt(s["border-bottom-width"],10),left:parseInt(s["padding-left"],10)+parseInt(s["border-left-width"],10),right:parseInt(s["padding-right"],10)+parseInt(s["border-right-width"],10)}}e.getPaddingAndBorder=t;function a(i,s,u){var h=u?-1:1;i.forEach(function(m,v){return f(m,h*s[v].x,s[v].y)})}e.translateThumbs=a;function c(i,s,u,h){for(var m=0,v=D(i[0],s,u,h),T=1;T<i.length;T++){var _=D(i[T],s,u,h);_<v&&(v=_,m=T)}return m}e.getClosestThumbIndex=c;function f(i,s,u){i.style.transform="translate(".concat(s,"px, ").concat(u,"px)")}e.translate=f;var b=function(i){var s=[],u=null,h=function(){for(var m=[],v=0;v<arguments.length;v++)m[v]=arguments[v];s=m,!u&&(u=requestAnimationFrame(function(){u=null,i.apply(void 0,s)}))};return h};e.schd=b;function k(i,s,u){var h=i.slice(0);return h[s]=u,h}e.replaceAt=k;function I(i){var s=i.values,u=i.colors,h=i.min,m=i.max,v=i.direction,T=v===void 0?o.Direction.Right:v,_=i.rtl,P=_===void 0?!1:_;P&&T===o.Direction.Right?T=o.Direction.Left:P&&o.Direction.Left&&(T=o.Direction.Right);var C=s.slice(0).sort(function(z,W){return z-W}).map(function(z){return(z-h)/(m-h)*100}),U=C.reduce(function(z,W,A){return"".concat(z,", ").concat(u[A]," ").concat(W,"%, ").concat(u[A+1]," ").concat(W,"%")},"");return"linear-gradient(".concat(T,", ").concat(u[0]," 0%").concat(U,", ").concat(u[u.length-1]," 100%)")}e.getTrackBackground=I;function O(){}e.voidFn=O;function w(i){throw new Error("Didn't expect to get here")}e.assertUnreachable=w;var M=function(i,s,u,h,m){m===void 0&&(m=function(T){return T});var v=Math.ceil(r([i],Array.from(i.children),!0).reduce(function(T,_){var P=Math.ceil(_.getBoundingClientRect().width);if(_.innerText&&_.innerText.includes(u)&&_.childElementCount===0){var C=_.cloneNode(!0);C.innerHTML=m(s.toFixed(h)),C.style.visibility="hidden",document.body.appendChild(C),P=Math.ceil(C.getBoundingClientRect().width),document.body.removeChild(C)}return P>T?P:T},i.getBoundingClientRect().width));return v},B=function(i,s,u,h,m,v,T){T===void 0&&(T=function(C){return C});var _=[],P=function(C){var U=M(u[C],h[C],m,v,T),z=s[C].x;s.forEach(function(W,A){var L=W.x,G=M(u[A],h[A],m,v,T);C!==A&&(z>=L&&z<=L+G||z+U>=L&&z+U<=L+G)&&(_.includes(A)||(_.push(C),_.push(A),_=r(r([],_,!0),[C,A],!1),P(A)))})};return P(i),Array.from(new Set(_.sort()))},R=function(i,s,u,h,m,v){h===void 0&&(h=.1),m===void 0&&(m=" - "),v===void 0&&(v=function(A){return A});var T=(0,e.getStepDecimals)(h),_=(0,n.useState)({}),P=_[0],C=_[1],U=(0,n.useState)(v(s[u].toFixed(T))),z=U[0],W=U[1];return(0,n.useEffect)(function(){if(i){var A=i.getThumbs();if(A.length<1)return;var L={},G=i.getOffsets(),ne=B(u,G,A,s,m,T,v),le=v(s[u].toFixed(T));if(ne.length){var ee=ne.reduce(function(te,oe,ge,pe){return te.length?r(r([],te,!0),[G[pe[ge]].x],!1):[G[pe[ge]].x]},[]);if(Math.min.apply(Math,ee)===G[u].x){var de=[];ne.forEach(function(te){de.push(s[te].toFixed(T))}),le=Array.from(new Set(de.sort(function(te,oe){return parseFloat(te)-parseFloat(oe)}))).map(v).join(m);var fe=Math.min.apply(Math,ee),he=Math.max.apply(Math,ee),_e=A[ne[ee.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),C(L)}},[i,s]),[z,P]};e.useThumbOverlap=R;function D(i,s,u,h){var m=i.getBoundingClientRect(),v=m.left,T=m.top,_=m.width,P=m.height;return $(h)?Math.abs(u-(T+P/2)):Math.abs(s-(v+_/2))}var j=function(){var i,s=((i=navigator.userAgentData)===null||i===void 0?void 0:i.platform)||navigator.platform;return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(s)||navigator.userAgent.includes("Mac")&&"ontouchend"in document};e.isIOS=j})(ue)),ue}var He;function xt(){if(He)return H;He=1;var e=H&&H.__extends||(function(){var E=function(y,d){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(t[c]=a[c])},E(y,d)};return function(y,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");E(y,d);function t(){this.constructor=y}y.prototype=d===null?Object.create(d):(t.prototype=d.prototype,new t)}})(),r=H&&H.__createBinding||(Object.create?(function(E,y,d,t){t===void 0&&(t=d);var a=Object.getOwnPropertyDescriptor(y,d);(!a||("get"in a?!y.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return y[d]}}),Object.defineProperty(E,t,a)}):(function(E,y,d,t){t===void 0&&(t=d),E[t]=y[d]})),n=H&&H.__setModuleDefault||(Object.create?(function(E,y){Object.defineProperty(E,"default",{enumerable:!0,value:y})}):function(E,y){E.default=y}),o=H&&H.__importStar||function(E){if(E&&E.__esModule)return E;var y={};if(E!=null)for(var d in E)d!=="default"&&Object.prototype.hasOwnProperty.call(E,d)&&r(y,E,d);return n(y,E),y},p=H&&H.__spreadArray||function(E,y,d){if(d||arguments.length===2)for(var t=0,a=y.length,c;t<a;t++)(c||!(t in y))&&(c||(c=Array.prototype.slice.call(y,0,t)),c[t]=y[t]);return E.concat(c||Array.prototype.slice.call(y))};Object.defineProperty(H,"__esModule",{value:!0});var S=o(Ye()),l=Ze(),g=Ie(),F=["ArrowRight","ArrowUp","k","PageUp"],$=["ArrowLeft","ArrowDown","j","PageDown"],V=(function(E){e(y,E);function y(d){var t=E.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(a,c){return c}),isChanged:!1,markOffsets:[]},t.getOffsets=function(){var a=t.props,c=a.direction,f=a.values,b=a.min,k=a.max,I=t.trackRef.current;if(!I)return console.warn("No track element found."),[];var O=I.getBoundingClientRect(),w=(0,l.getPaddingAndBorder)(I);return t.getThumbs().map(function(M,B){var R={x:0,y:0},D=M.getBoundingClientRect(),j=(0,l.getMargin)(M);switch(c){case g.Direction.Right:return R.x=(j.left+w.left)*-1,R.y=((D.height-O.height)/2+w.top)*-1,R.x+=O.width*(0,l.relativeValue)(f[B],b,k)-D.width/2,R;case g.Direction.Left:return R.x=(j.right+w.right)*-1,R.y=((D.height-O.height)/2+w.top)*-1,R.x+=O.width-O.width*(0,l.relativeValue)(f[B],b,k)-D.width/2,R;case g.Direction.Up:return R.x=((D.width-O.width)/2+j.left+w.left)*-1,R.y=-w.left,R.y+=O.height-O.height*(0,l.relativeValue)(f[B],b,k)-D.height/2,R;case g.Direction.Down:return R.x=((D.width-O.width)/2+j.left+w.left)*-1,R.y=-w.left,R.y+=O.height*(0,l.relativeValue)(f[B],b,k)-D.height/2,R;default:return(0,l.assertUnreachable)(c)}})},t.getThumbs=function(){return t.trackRef&&t.trackRef.current?Array.from(t.trackRef.current.children).filter(function(a){return a.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(a){return t.getThumbs().findIndex(function(c){return c===a.target||c.contains(a.target)})},t.addTouchEvents=function(a){document.addEventListener("touchmove",t.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",t.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",t.schdOnEnd,{passive:!1})},t.addMouseEvents=function(a){document.addEventListener("mousemove",t.schdOnMouseMove),document.addEventListener("mouseup",t.schdOnEnd)},t.onMouseDownTrack=function(a){var c;if(!(a.button!==0||(0,l.isIOS)()))if(a.persist(),a.preventDefault(),t.addMouseEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return t.onMove(a.clientX,a.clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.clientX,a.clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.clientX,a.clientY)})}},t.onResize=function(){(0,l.translateThumbs)(t.getThumbs(),t.getOffsets(),t.props.rtl),t.calculateMarkOffsets()},t.onTouchStartTrack=function(a){var c;if(a.persist(),t.addTouchEvents(a.nativeEvent),t.props.values.length>1&&t.props.draggableTrack){if(t.thumbRefs.some(function(b){var k;return(k=b.current)===null||k===void 0?void 0:k.contains(a.target)}))return;t.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var f=(0,l.getClosestThumbIndex)(t.thumbRefs.map(function(b){return b.current}),a.touches[0].clientX,a.touches[0].clientY,t.props.direction);(c=t.thumbRefs[f].current)===null||c===void 0||c.focus(),t.setState({draggedThumbIndex:f},function(){return t.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},t.onMouseOrTouchStart=function(a){if(!t.props.disabled){var c=(0,l.isTouchEvent)(a);if(!(!c&&a.button!==0)){var f=t.getTargetIndex(a);f!==-1&&(c?t.addTouchEvents(a):t.addMouseEvents(a),t.setState({draggedThumbIndex:f,thumbZIndexes:t.state.thumbZIndexes.map(function(b,k){return k===f?Math.max.apply(Math,t.state.thumbZIndexes):b<=t.state.thumbZIndexes[f]?b:b-1})}))}}},t.onMouseMove=function(a){a.preventDefault(),t.onMove(a.clientX,a.clientY)},t.onTouchMove=function(a){a.preventDefault(),t.onMove(a.touches[0].clientX,a.touches[0].clientY)},t.onKeyDown=function(a){var c=t.props,f=c.values,b=c.onChange,k=c.step,I=c.rtl,O=c.direction,w=t.state.isChanged,M=t.getTargetIndex(a.nativeEvent),B=I||O===g.Direction.Left||O===g.Direction.Down?-1:1;M!==-1&&(F.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]+B*(a.key==="PageUp"?k*10:k),M)))):$.includes(a.key)?(a.preventDefault(),t.setState({draggedThumbIndex:M,isChanged:!0}),b((0,l.replaceAt)(f,M,t.normalizeValue(f[M]-B*(a.key==="PageDown"?k*10:k),M)))):a.key==="Tab"?t.setState({draggedThumbIndex:-1},function(){w&&t.fireOnFinalChange()}):w&&t.fireOnFinalChange())},t.onKeyUp=function(a){var c=t.state.isChanged;t.setState({draggedThumbIndex:-1},function(){c&&t.fireOnFinalChange()})},t.onMove=function(a,c){var f=t.state,b=f.draggedThumbIndex,k=f.draggedTrackPos,I=t.props,O=I.direction,w=I.min,M=I.max,B=I.onChange,R=I.values,D=I.step,j=I.rtl;if(b===-1&&k[0]===-1&&k[1]===-1)return null;var i=t.trackRef.current;if(!i)return null;var s=i.getBoundingClientRect(),u=(0,l.isVertical)(O)?s.height:s.width;if(k[0]!==-1&&k[1]!==-1){var h=a-k[0],m=c-k[1],v=0;switch(O){case g.Direction.Right:case g.Direction.Left:v=h/u*(M-w);break;case g.Direction.Down:case g.Direction.Up:v=m/u*(M-w);break;default:(0,l.assertUnreachable)(O)}if(j&&(v*=-1),Math.abs(v)>=D/2){for(var T=0;T<t.thumbRefs.length;T++){if(R[T]===M&&Math.sign(v)===1||R[T]===w&&Math.sign(v)===-1)return;var _=R[T]+v;_>M?v=M-R[T]:_<w&&(v=w-R[T])}for(var P=R.slice(0),T=0;T<t.thumbRefs.length;T++)P=(0,l.replaceAt)(P,T,t.normalizeValue(R[T]+v,T));t.setState({draggedTrackPos:[a,c]}),B(P)}}else{var C=0;switch(O){case g.Direction.Right:C=(a-s.left)/u*(M-w)+w;break;case g.Direction.Left:C=(u-(a-s.left))/u*(M-w)+w;break;case g.Direction.Down:C=(c-s.top)/u*(M-w)+w;break;case g.Direction.Up:C=(u-(c-s.top))/u*(M-w)+w;break;default:(0,l.assertUnreachable)(O)}j&&(C=M+w-C),Math.abs(R[b]-C)>=D/2&&B((0,l.replaceAt)(R,b,t.normalizeValue(C,b)))}},t.normalizeValue=function(a,c){var f=t.props,b=f.min,k=f.max,I=f.step,O=f.allowOverlap,w=f.values;return(0,l.normalizeValue)(a,c,b,k,I,O,w)},t.onEnd=function(a){if(a.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 a=t.props,c=a.onFinalChange,f=a.values;c&&c(f)},t.updateMarkRefs=function(a){if(!a.renderMark){t.numOfMarks=void 0,t.markRefs=void 0;return}t.numOfMarks=(a.max-a.min)/t.props.step,t.markRefs=[];for(var c=0;c<t.numOfMarks+1;c++)t.markRefs[c]=S.createRef()},t.calculateMarkOffsets=function(){if(!(!t.props.renderMark||!t.trackRef||!t.numOfMarks||!t.markRefs||t.trackRef.current===null)){for(var a=window.getComputedStyle(t.trackRef.current),c=parseInt(a.width,10),f=parseInt(a.height,10),b=parseInt(a.paddingLeft,10),k=parseInt(a.paddingTop,10),I=[],O=0;O<t.numOfMarks+1;O++){var w=9999,M=9999;if(t.markRefs[O].current){var B=t.markRefs[O].current.getBoundingClientRect();w=B.height,M=B.width}t.props.direction===g.Direction.Left||t.props.direction===g.Direction.Right?I.push([Math.round(c/t.numOfMarks*O+b-M/2),-Math.round((w-f)/2)]):I.push([Math.round(f/t.numOfMarks*O+k-w/2),-Math.round((M-c)/2)])}t.setState({markOffsets:I})}},d.step===0)throw new Error('"step" property should be a positive number');return t.schdOnMouseMove=(0,l.schd)(t.onMouseMove),t.schdOnTouchMove=(0,l.schd)(t.onTouchMove),t.schdOnEnd=(0,l.schd)(t.onEnd),t.thumbRefs=d.values.map(function(){return S.createRef()}),t.updateMarkRefs(d),t}return y.prototype.componentDidMount=function(){var d=this,t=this.props,a=t.values,c=t.min,f=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,l.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(b){return(0,l.checkBoundaries)(b,d.props.min,d.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(b){(0,l.isStepDivisible)(c,b,f)||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.")})},y.prototype.componentDidUpdate=function(d,t){var a=this.props,c=a.max,f=a.min,b=a.step,k=a.values,I=a.rtl;(d.max!==c||d.min!==f||d.step!==b)&&this.updateMarkRefs(this.props),(0,l.translateThumbs)(this.getThumbs(),this.getOffsets(),I),(d.max!==c||d.min!==f||d.step!==b||t.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),k.forEach(function(O){(0,l.isStepDivisible)(f,O,b)||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.")}))},y.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)},y.prototype.render=function(){var d=this,t=this.props,a=t.label,c=t.labelledBy,f=t.renderTrack,b=t.renderThumb,k=t.renderMark,I=k===void 0?function(){return null}:k,O=t.values,w=t.min,M=t.max,B=t.allowOverlap,R=t.disabled,D=this.state,j=D.draggedThumbIndex,i=D.thumbZIndexes,s=D.markOffsets;return f({props:{style:{transform:"scale(1)",cursor:j>-1?"grabbing":this.props.draggableTrack?(0,l.isVertical)(this.props.direction)?"ns-resize":"ew-resize":O.length===1&&!R?"pointer":"inherit"},onMouseDown:R?l.voidFn:this.onMouseDownTrack,onTouchStart:R?l.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:R,children:p(p([],s.map(function(u,h,m){return I({props:{style:d.props.direction===g.Direction.Left||d.props.direction===g.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),O.map(function(u,h){var m=d.state.draggedThumbIndex===h;return b({index:h,value:u,isDragged:m,props:{style:{position:"absolute",zIndex:i[h],cursor:R?"inherit":m?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:h,tabIndex:R?void 0:0,"aria-valuemax":B?M:O[h+1]||M,"aria-valuemin":B?w:O[h-1]||w,"aria-valuenow":u,draggable:!1,ref:d.thumbRefs[h],"aria-label":a,"aria-labelledby":c,role:"slider",onKeyDown:R?l.voidFn:d.onKeyDown,onKeyUp:R?l.voidFn:d.onKeyUp}})}),!0)})},y.defaultProps={label:"Accessibility label",labelledBy:null,step:1,direction:g.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},y})(S.Component);return H.default=V,H}var We;function It(){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 n=r(xt());e.Range=n.default;var o=Ze();Object.defineProperty(e,"getTrackBackground",{enumerable:!0,get:function(){return o.getTrackBackground}}),Object.defineProperty(e,"useThumbOverlap",{enumerable:!0,get:function(){return o.useThumbOverlap}}),Object.defineProperty(e,"relativeValue",{enumerable:!0,get:function(){return o.relativeValue}}),Object.defineProperty(e,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return o.checkValuesAgainstBoundaries}});var p=Ie();Object.defineProperty(e,"Direction",{enumerable:!0,get:function(){return p.Direction}})})(se)),se}var Ge=It();function qe(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(p){return Object.getOwnPropertyDescriptor(e,p).enumerable})),n.push.apply(n,o)}return n}function ve(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?qe(Object(n),!0).forEach(function(o){Ct(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Ct(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,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,n=e.$value,o=n===void 0?[]:n,p=e.$disabled,S=e.$isDragged,l=r.sizing,g="inherit";return p?g="not-allowed":S?g="grabbing":o.length===1&&(g="pointer"),{paddingTop:l.scale600,paddingBottom:l.scale600,paddingRight:l.scale600,paddingLeft:l.scale600,display:"flex",cursor:g,backgroundColor:r.colors.sliderTrackFill}});ye.displayName="Track";ye.displayName="Track";ye.displayName="StyledTrack";var Te=J("div",function(e){var r=e.$theme,n=e.$value,o=n===void 0?[]:n,p=e.$min,S=e.$max,l=e.$disabled,g=r.colors,F=r.borders,$=r.direction,V=r.borders.useRoundedCorners?F.radius100:0;return{borderTopLeftRadius:V,borderTopRightRadius:V,borderBottomRightRadius:V,borderBottomLeftRadius:V,background:Ge.getTrackBackground({values:o,colors:o.length===1?[l?g.borderOpaque:g.primary,l?g.backgroundSecondary:g.borderOpaque]:[l?g.backgroundSecondary:g.borderOpaque,l?g.borderOpaque:g.primary,l?g.backgroundSecondary:g.borderOpaque],min:p||0,max:S||0,rtl:$==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:l?"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,n=r.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:n.scale600,paddingLeft:n.scale600,paddingBottom:n.scale400}});we.displayName="TickBar";we.displayName="TickBar";we.displayName="StyledTickBar";var Re=J("div",function(e){var r=e.$theme,n=e.$value,o=n===void 0?[]:n,p=e.$thumbIndex,S=e.$disabled,l=o.length===2&&p===0,g=o.length===2&&p===1;return r.direction==="rtl"&&(g||l)&&(l=!l,g=!g),{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,n=e.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill}});Se.displayName="InnerThumb";Se.displayName="InnerThumb";Se.displayName="StyledInnerThumb";var Me=J("div",function(e){var r=e.$disabled,n=e.$theme;return ve(ve({position:"absolute",top:"-".concat(n.sizing.scale1400)},n.typography.font200),{},{backgroundColor:r?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleInnerFill,color:n.colors.contentInversePrimary,paddingLeft:n.sizing.scale600,paddingRight:n.sizing.scale600,paddingTop:n.sizing.scale500,paddingBottom:n.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 n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(p){return Object.getOwnPropertyDescriptor(e,p).enumerable})),n.push.apply(n,o)}return n}function Dt(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Ke(Object(n),!0).forEach(function(o){Pt(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Pt(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},X.apply(this,arguments)}function K(e,r){return jt(e)||Lt(e,r)||At(e,r)||Bt()}function Bt(){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 At(e,r){if(e){if(typeof e=="string")return Xe(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xe(e,r)}}function Xe(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,o=new Array(r);n<r;n++)o[n]=e[n];return o}function Lt(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var o=[],p=!0,S=!1,l,g;try{for(n=n.call(e);!(p=(l=n.next()).done)&&(o.push(l.value),!(r&&o.length===r));p=!0);}catch(F){S=!0,g=F}finally{try{!p&&n.return!=null&&n.return()}finally{if(S)throw g}}return o}}function jt(e){if(Array.isArray(e))return e}var Ft=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 $t(e){var r=e.overrides,n=r===void 0?{}:r,o=e.disabled,p=o===void 0?!1:o,S=e.marks,l=S===void 0?!1:S,g=e.onChange,F=g===void 0?function(){}:g,$=e.onFinalChange,V=$===void 0?function(){}:$,E=e.min,y=E===void 0?0:E,d=e.max,t=d===void 0?100:d,a=e.step,c=a===void 0?1:a,f=e.persistentThumb,b=f===void 0?!1:f,k=e.valueToLabel,I=k===void 0?function(Y){return Y}:k,O=e.value,w=x.useContext(pt),M=x.useState(!1),B=K(M,2),R=B[0],D=B[1],j=x.useState(!1),i=K(j,2),s=i[0],u=i[1],h=x.useState(!1),m=K(h,2),v=m[0],T=m[1],_=x.useState(-1),P=K(_,2),C=P[0],U=P[1],z=x.useCallback(function(Y){vt(Y)&&T(!0);var N=Y.target.parentNode.firstChild===Y.target?0:1;U(N)},[]),W=x.useCallback(function(Y){v!==!1&&T(!1),U(-1)},[]),A=Ft(O),L={$disabled:p,$step:c,$min:y,$max:t,$marks:l,$value:A,$isFocusVisible:v},G=Q(n.Root,be),ne=K(G,2),le=ne[0],ee=ne[1],de=Q(n.Track,ye),fe=K(de,2),he=fe[0],_e=fe[1],te=Q(n.InnerTrack,Te),oe=K(te,2),ge=oe[0],pe=oe[1],Qe=Q(n.Thumb,Re),Ce=K(Qe,2),Je=Ce[0],et=Ce[1],tt=Q(n.InnerThumb,Se),De=K(tt,2),rt=De[0],nt=De[1],at=Q(n.ThumbValue,Me),Pe=K(at,2),it=Pe[0],ot=Pe[1],st=Q(n.Tick,Oe),Be=K(st,2),Ae=Be[0],Le=Be[1],ut=Q(n.TickBar,we),je=K(ut,2),ct=je[0],lt=je[1],dt=Q(n.Mark,ke),Fe=K(dt,2),ft=Fe[0],ht=Fe[1];return x.createElement(le,X({"data-baseweb":"slider"},L,ee,{onFocus:bt(ee,z),onBlur:mt(ee,W)}),x.createElement(Ge.Range,X({step:c,min:y,max:t,values:A,disabled:p,onChange:function(N){return F({value:N})},onFinalChange:function(N){return V({value:N})},rtl:w.direction==="rtl",renderTrack:function(N){var re=N.props,q=N.children,ae=N.isDragged;return x.createElement(he,X({onMouseDown:re.onMouseDown,onTouchStart:re.onTouchStart,$isDragged:ae},L,_e),x.createElement(ge,X({$isDragged:ae,ref:re.ref},L,pe),q))},renderThumb:function(N){var re=N.props,q=N.index,ae=N.isDragged,$e=b||(!!q&&s||!q&&R||ae)&&!p;return x.createElement(Je,X({},re,{onMouseEnter:function(){q===0?D(!0):u(!0)},onMouseLeave:function(){q===0?D(!1):u(!1)},$thumbIndex:q,$isDragged:ae,style:Dt({},re.style)},L,et,{$isFocusVisible:v&&C===q}),$e&&x.createElement(it,X({$thumbIndex:q,$isDragged:ae},L,ot),I(A[q])),$e&&x.createElement(rt,X({$thumbIndex:q,$isDragged:ae},L,nt)))}},l?{renderMark:function(N){var re=N.props,q=N.index;return x.createElement(ft,X({$markIndex:q},re,L,ht))}}:{})),x.createElement(ct,X({},L,lt),x.createElement(Ae,X({},L,Le),I(y)),x.createElement(Ae,X({},L,Le),I(t))))}const Vt=me("div",{target:"ew7r33m3"})({name:"bjn8wh",styles:"position:relative"}),zt=me("div",{target:"ew7r33m2"})(({disabled:e,theme:r,isDragged:n})=>({alignItems:"center",backgroundColor:e?r.colors.gray60:r.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",display:"flex",justifyContent:"center",height:r.sizes.sliderThumb,width:r.sizes.sliderThumb,boxShadow:n?`0 0 0 0.2rem ${Ve(r.colors.primary,.5)}`:"none",":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${Ve(r.colors.primary,.5)}`}}),""),Nt=me("div",{target:"ew7r33m1"})(({disabled:e,theme:r})=>({fontFamily:r.genericFonts.bodyFont,fontSize:r.fontSizes.sm,color:e?r.colors.gray60:r.colors.primary,top:"-1.6em",position:"absolute",whiteSpace:"nowrap",backgroundColor:r.colors.transparent,lineHeight:r.lineHeights.base,fontWeight:r.fontWeights.normal,pointerEvents:"none"}),""),Ut=me("div",{target:"ew7r33m0"})(({theme:e,isHovered:r,isDisabled:n})=>({position:"absolute",left:0,right:0,top:"100%",display:"flex",justifyContent:"space-between",pointerEvents:"none",marginTop:`-${e.spacing.md}`,fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.base,fontWeight:e.fontWeights.normal,color:n?e.colors.fadedText40:e.colors.fadedText60,opacity:r?1:0,transition:"opacity 70ms ease-in-out"}),"");function Ht({minLabel:e,maxLabel:r,isHovered:n,isDisabled:o}){return Z.jsxs(Ut,{"data-testid":"stSliderTickBar",isHovered:n,isDisabled:o,children:[Z.jsx("span",{children:e}),Z.jsx("span",{children:r})]})}function Wt({disabled:e,element:r,widgetMgr:n,fragmentId:o}){const[p,S]=Et({getStateFromWidgetMgr:qt,getDefaultStateFromProto:Kt,getCurrStateFromProto:Xt,updateWidgetMgrState:Yt,element:r,widgetMgr:n,fragmentId:o}),[l,g]=x.useState(p),[F,$]=x.useState(!1),[V,E]=x.useState(!1),y=x.useCallback(()=>$(!0),[]),d=x.useCallback(()=>$(!1),[]),t=x.useRef(null),[a]=x.useState([]),[c]=x.useState([]),f=Tt(),b=l.map(D=>xe(D,r)),k=xe(r.min,r),I=xe(r.max,r),O=r.label;x.useEffect(()=>{g(p)},[p]);const w=x.useCallback(({value:D})=>{S({value:D,fromUi:!0}),E(!1)},[S]),M=x.useCallback(({value:D})=>{g(D),E(!0)},[]),B=x.useCallback(x.forwardRef(function(j,i){const{$thumbIndex:s}=j,u=s||0;a[u]=i,c[u]||=x.createRef();const h=kt(j,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),m=b[u];return Z.jsx(zt,{...h,disabled:j.$disabled===!0,isDragged:j.$isDragged===!0,ref:a[u],"aria-valuetext":m,"aria-label":O,children:Z.jsx(Nt,{"data-testid":"stSliderThumbValue",disabled:j.$disabled===!0,ref:c[u],children:m})})}),[]);x.useEffect(()=>{c.map((h,m)=>{h.current&&(h.current.innerText=b[m])}),a.map((h,m)=>{h.current&&h.current.setAttribute("aria-valuetext",b[m])});const D=t.current??null,j=a[0].current,i=a[1]?.current,s=c[0].current,u=c[1]?.current;Qt(D,j,i,s,u)});const R=x.useCallback(({$disabled:D})=>({height:f.spacing.twoXS,...D?{background:f.colors.darkenedBgMix25}:{}}),[f.colors.darkenedBgMix25,f.spacing.twoXS]);return Z.jsxs(Vt,{ref:t,className:"stSlider","data-testid":"stSlider",onMouseEnter:y,onMouseLeave:d,children:[Z.jsx(Ot,{label:r.label,disabled:e,labelVisibility:wt(r.labelVisibility?.value),children:r.help&&Z.jsx(Rt,{children:Z.jsx(St,{content:r.help,placement:Mt.TOP_RIGHT})})}),Z.jsx($t,{min:r.min,max:r.max,step:r.step,value:Gt(l,r),onChange:M,onFinalChange:w,disabled:e,overrides:{Thumb:B,Track:{style:{backgroundColor:"none !important",paddingLeft:f.spacing.none,paddingRight:f.spacing.none,paddingTop:`calc((${f.sizes.minElementHeight} - ${f.spacing.twoXS}) / 2)`,paddingBottom:`calc((${f.sizes.minElementHeight} - ${f.spacing.twoXS}) / 2)`}},InnerTrack:{style:R},TickBar:{component:Ht,props:{minLabel:k,maxLabel:I,isHovered:F||V,isDisabled:e}}}})]})}function qt(e,r){return e.getDoubleArrayValue(r)}function Kt(e){return e.default}function Xt(e){return e.value}function Yt(e,r,n,o){r.setDoubleArrayValue(e,n.value,{fromUi:n.fromUi},o)}function Zt(e){const{dataType:r}=e;return r===Ee.DataType.DATETIME||r===Ee.DataType.DATE||r===Ee.DataType.TIME}function xe(e,r){const{format:n,options:o}=r;return Zt(r)?_t.utc(e/1e3).format(n):o.length>0?ze.sprintf(n,o[e]):ze.sprintf(n,e)}function Gt(e,r){const{min:n,max:o}=r;let p=e[0],S=e.length>1?e[1]:e[0];return p>S&&(p=S),p<n&&(p=n),p>o&&(p=o),S<n&&(S=n),S>o&&(S=o),e.length>1?[p,S]:[p]}function Qt(e,r,n,o,p){!e||!r||!o||(ie(e,r,o),n&&p&&(ie(e,n,p),Jt(e,r,n,o,p)))}function ie(e,r,n){const o=e.getBoundingClientRect(),p=r.getBoundingClientRect(),S=n.getBoundingClientRect(),l=p.left+p.width/2,g=l-S.width/2<o.left,F=l+S.width/2>o.right;n.style.left=g?"0":"",n.style.right=F?"0":""}function Jt(e,r,n,o,p){const l=e.getBoundingClientRect(),g=r.getBoundingClientRect(),F=n.getBoundingClientRect(),$=o.getBoundingClientRect(),V=p.getBoundingClientRect(),E=l.left+l.width/2,y=g.left+g.width/2,d=F.left+F.width/2,t=y-$.width/2>=l.left,a=d+V.width/2<=l.right,c=g.left-$.width>=l.left,f=F.right+V.width<=l.right,b=t?$.width/2:$.width,k=a?V.width/2:V.width,I=y+b;if(d-k-I>24){ie(e,r,o),ie(e,n,p);return}if(c&&f){o.style.left="",o.style.right=`${Math.round(g.width)}px`,p.style.left=`${Math.round(F.width)}px`,p.style.right="";return}y<E?(ie(e,r,o),p.style.left=`${Math.round(y+b+24-d)}px`,p.style.right=""):(ie(e,n,p),o.style.left="",o.style.right=`${-Math.round(d-k-24-y)}px`)}const ar=yt(x.memo(Wt));export{ar as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,B as s,j as e,a as u,b as d,c,d as B,D as m}from"./index-
|
|
1
|
+
import{r as l,B as s,j as e,a as u,b as d,c,d as B,D as m}from"./index-BwsrXI9O.js";function p(n){const{disabled:i,element:t,widgetMgr:o,fragmentId:r}=n;let a=s.SECONDARY;return t.type==="primary"?a=s.PRIMARY:t.type==="tertiary"&&(a=s.TERTIARY),e.jsx(u,{className:"stButton","data-testid":"stButton",children:e.jsx(d,{help:t.help,containerWidth:!0,children:e.jsx(c,{kind:a,size:B.SMALL,disabled:i,containerWidth:!0,onClick:()=>o.setTriggerValue(t,{fromUi:!0},r),children:e.jsx(m,{icon:t.icon,label:t.label})})})})}const f=l.memo(p);export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,L as A,B as x,ab as R,j as d,b as y,c as C,d as _,D as T}from"./index-
|
|
1
|
+
import{r as u,L as A,B as x,ab as R,j as d,b as y,c as C,d as _,D as T}from"./index-BwsrXI9O.js";import{c as D}from"./createDownloadLinkElement-ZaXNnPK4.js";const B=/%([0-9A-Fa-f]{2})/g,L=/[^\x20-\x7e\xa0-\xff]/g,k=/\\([\u0000-\u007f])/g,E=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,v=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,I=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/,P=o=>String(o).replace(L,"?");class S{constructor(e,t){this.type=e,this.parameters=t}}const U=(o,e)=>String.fromCharCode(Number.parseInt(e,16));function z(o){const e=v.exec(o);if(!e)throw new TypeError("invalid extended field value");const t=e[1].toLowerCase(),a=e[2];let n;switch(t){case"iso-8859-1":n=P(a.replace(B,U));break;case"utf-8":try{n=decodeURIComponent(a)}catch{throw new TypeError("invalid encoded utf-8")}break;default:throw new TypeError("unsupported charset in extended field")}return n}function $(o){let e=I.exec(o);if(!e)throw new TypeError("invalid type format");let t=e[0].length;const a=e[1].toLowerCase();let n;const l=[],i={};let r;for(t=E.lastIndex=e[0].slice(-1)===";"?t-1:t;e=E.exec(o);){if(e.index!==t)throw new TypeError("invalid parameter format");if(t+=e[0].length,n=e[1].toLowerCase(),r=e[2],l.indexOf(n)!==-1)throw new TypeError("invalid duplicate parameter");if(l.push(n),n.indexOf("*")+1===n.length){n=n.slice(0,-1),r=z(r),i[n]=r;continue}typeof i[n]!="string"&&(r[0]==='"'&&(r=r.slice(1,r.length-1).replace(k,"$1")),i[n]=r)}if(t!==-1&&t!==o.length)throw new TypeError("invalid parameter format");return new S(a,i)}function j(o){const e=$(o);if(e.type!=="attachment")return;const t=e.parameters.filename;if(typeof t=="string")return t}function N(o,e){o.sendHttpRequest({method:"GET",path:`${e}?title=${encodeURIComponent(document.title)}`,headers:{},body:""}).then(({statusCode:t,headers:a,body:n})=>{if(t!==200)return;const l=a.get("Content-Disposition"),i=(l&&j(l))??"",r=a.get("Content-Type"),f=new Blob([n],r?{type:r}:void 0),c=URL.createObjectURL(f),s=document.createElement("a");s.setAttribute("href",c),s.setAttribute("target","_blank"),s.setAttribute("download",i),s.click(),URL.revokeObjectURL(c),s.remove()})}function O(o){const{disabled:e,element:t,widgetMgr:a,endpoints:n,fragmentId:l}=o,{help:i,label:r,icon:f,ignoreRerun:c,type:s,url:w}=t,{libConfig:{enforceDownloadInNewTab:h=!1}}=u.useContext(A);let p=x.SECONDARY;s==="primary"?p=x.PRIMARY:s==="tertiary"&&(p=x.TERTIARY);const m=u.useMemo(()=>n.buildDownloadUrl(w),[n,w]);u.useEffect(()=>{n.checkSourceUrlResponse(m,"Download Button")},[m,n]);const g=R(),b=()=>{if(c||a.setTriggerValue(t,{fromUi:!0},l),t.url.startsWith("/media")){N(g,t.url);return}D({filename:"",url:m,enforceDownloadInNewTab:h}).click()};return d.jsx("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:d.jsx(y,{help:i,containerWidth:!0,children:d.jsx(C,{kind:p,size:_.SMALL,disabled:e,onClick:b,containerWidth:!0,children:d.jsx(T,{icon:f,label:r})})})})}const G=u.memo(O);export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,E as O,_ as X,bo as y,bp as _,s as g,j as o,T as ct,P as Y,c as q,B as G,an as E,u as k,am as pt,ah as ut,bq as gt,h as ht,a4 as ft,as as xt,br as mt,k as R,bj as yt,bk as Ct}from"./index-wnKDraWU.js";import{g as bt,C as It,I as wt,F as V,E as J,a as vt,s as jt,u as zt,b as St}from"./FileHelper-BAjDG49X.js";import{I as Ft}from"./InputInstructions-BLplNLW9.js";import{u as Ut,T as Et}from"./useTextInputAutoExpand-Uac3U0I_.js";import{i as Dt}from"./inputUtils-CptNuJwn.js";import{E as Tt}from"./ErrorOutline.esm-CJGMKtXr.js";import{U as Q}from"./UploadFileInfo-C-jY39rj.js";import"./base-input-d4WKPeU6.js";var Z=c.forwardRef(function(t,e){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(O,X({iconAttrs:n,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"}))});Z.displayName="AttachFile";var tt=c.forwardRef(function(t,e){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(O,X({iconAttrs:n,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"}))});tt.displayName="Send";const et=(t,e)=>e===y.Directory?{...t,webkitdirectory:"",multiple:!0}:t,Bt=(t,e)=>{if(!e||e.length===0)return!0;const n=t.name.toLowerCase(),a=n.lastIndexOf(".");if(a===-1||a===n.length-1)return e.some(x=>x===""||x===".");const p=n.substring(a),i=n.substring(a+1);return e.some(x=>{const C=x.toLowerCase();return C.startsWith(".")?p===C:i===C})},Rt=(t,e)=>Bt(t,e)?{isValid:!0}:{isValid:!1,errorMessage:`${t.type||"This type of"} files are not allowed.`},ot=t=>{switch(t){case y.None:return"a file";case y.Single:return"a file";case y.Multiple:return"files";case y.Directory:return"a directory";default:return _(t),"a file"}},Lt=g("div",{target:"e3id6jz12"})(({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}),""),Ht=g("div",{target:"e3id6jz11"})(({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}),""),Vt=g("div",{target:"e3id6jz10"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"}),""),kt=g("div",{target:"e3id6jz9"})(({disabled:t})=>({pointerEvents:t?"none":"auto"}),""),Mt=g("div",{target:"e3id6jz8"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20}),""),Wt=g("div",{target:"e3id6jz7"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"}),""),$t=g("div",{target:"e3id6jz6"})({name:"zjik7",styles:"display:flex"}),Nt=g("div",{target:"e3id6jz5"})({name:"ou8xsw",styles:"flex:0 0 auto"}),At=g("div",{target:"e3id6jz4"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS}),""),Pt=g("div",{target:"e3id6jz3"})(({theme:t})=>({color:t.colors.fadedText60}),""),Kt=g("div",{target:"e3id6jz2"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60}),""),Ot=g("div",{target:"e3id6jz1"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60}),""),Xt=g("small",{target:"e3id6jz0"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}),""),_t=({getRootProps:t,getInputProps:e,acceptFile:n,disabled:a,theme:p})=>{const i=et(e(),n);return o.jsxs(Vt,{disabled:a,children:[o.jsxs(kt,{"data-testid":"stChatInputFileUploadButton",disabled:a,...t(),children:[o.jsx("input",{...i}),o.jsx(ct,{content:`Upload or drag and drop ${ot(n)}`,placement:Y.TOP,onMouseEnterDelay:500,children:o.jsx(q,{kind:G.MINIMAL,disabled:a,children:o.jsx(E,{content:Z,size:"lg",color:a?p.colors.fadedText40:p.colors.fadedText60})})})]}),o.jsx(Mt,{})]})},Yt=c.memo(_t),qt=({getRootProps:t,getInputProps:e,acceptFile:n,inputHeight:a})=>{const p=et(e(),n);return o.jsxs(o.Fragment,{children:[o.jsx(Lt,{height:a,...t(),children:o.jsx("input",{...p})}),o.jsx(Ht,{height:a,children:`Drag and drop ${ot(n)} here`})]})},Gt=c.memo(qt);function Jt({children:t,content:e}){const n=k();return o.jsx(pt,{content:e,placement:Y.TOP,overrides:{Body:{style:{top:`-${n.sizes.minElementHeight}`}}},children:t})}const Qt=({fileInfo:t})=>{const e=k(),{type:n}=t.status;switch(n){case"uploading":return o.jsx(ut,{"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o.jsx(Jt,{content:t.status.errorMessage,children:o.jsx(E,{color:e.colors.redTextColor,content:Tt,size:"lg"})});case"uploaded":return o.jsx(E,{content:wt,size:"lg"});default:return _(n),null}},Zt=({fileInfo:t,onDelete:e})=>o.jsxs(At,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o.jsx(Pt,{children:o.jsx(Qt,{fileInfo:t})}),o.jsx(Kt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o.jsx(Ot,{children:bt(t.size,V.Byte)}),o.jsx(Xt,{"data-testid":"stChatInputDeleteBtn",children:o.jsx(q,{onClick:()=>e(t.id),kind:G.MINIMAL,children:o.jsx(E,{content:It,size:"lg"})})})]}),te=c.memo(Zt),ee=({items:t,onDelete:e})=>o.jsx(Wt,{"data-testid":"stChatUploadedFiles",children:o.jsx($t,{children:t.map(n=>o.jsx(Nt,{children:o.jsx(te,{fileInfo:n,onDelete:e})},n.id))})}),oe=c.memo(ee),ne=(t,e)=>{const n=[],a=[];return t.forEach(p=>{const i=Rt(p,e.fileType);i.isValid?n.push(p):a.push({file:p,errors:[{code:J.FileInvalidType,message:i.errorMessage||"File type not allowed."}]})}),{accepted:n,rejected:a}},re=({acceptMultipleFiles:t,acceptDirectoryFiles:e,maxFileSize:n,uploadClient:a,uploadFile:p,addFiles:i,getNextLocalFileId:x,deleteExistingFiles:C,onUploadComplete:w,element:b})=>(f,h)=>{if(e&&f.length>0){const{accepted:u,rejected:m}=ne(f,b);f=u,h=[...h,...m]}if(!t&&f.length===0&&h.length>1){const u=h.findIndex(m=>m.errors?.[0].code===J.TooManyFiles);u>=0&&(f.push(h[u].file),h.splice(u,1))}if(!t&&f.length>0&&C(),a.fetchFileURLs(f).then(u=>{gt(u,f).forEach(([m,v])=>{p(m,v)})}).catch(u=>{i(f.map(m=>new Q(m.name,m.size,x(),{type:"error",errorMessage:u})))}),h.length>0){const u=h.map(m=>vt(m,x(),n));i(u)}w()},se=({getNextLocalFileId:t,addFiles:e,updateFile:n,uploadClient:a,element:p,onUploadProgress:i,onUploadComplete:x})=>(C,w)=>{const b=w.webkitRelativePath||w.name,f=new AbortController,h=new Q(b,w.size,t(),{type:"uploading",abortController:f,progress:1});e([h]),a.uploadFile({formId:"",...p},C.uploadUrl,w,u=>i(u,h.id),f.signal).then(()=>x(h.id,C)).catch(u=>{u instanceof DOMException&&u.name==="AbortError"||n(h.id,h.setStatus({type:"error",errorMessage:u?u.toString():"Unknown error"}))})},ae=g("div",{target:"e1d2x3se4"})({name:"1nibcdy",styles:"border:none;position:relative;display:flex"}),ie=g("div",{target:"e1d2x3se3"})(({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}}),""),le=g("button",{target:"e1d2x3se2"})(({theme:t,disabled:e,extended:n})=>{const a=ht(t),[p,i]=a?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:n?"0":t.radii.chatInput,borderTopLeftRadius:n?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:i,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:a?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.gray60,cursor:"not-allowed"}}},""),de=g("div",{target:"e1d2x3se1"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"}),""),ce=g("div",{target:"e1d2x3se0"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`}),""),L=(t,e,n)=>n.map(a=>a.id===t?e:a),H=(t,e)=>e.find(n=>n.id===t);function pe({disabled:t,element:e,widgetMgr:n,fragmentId:a,uploadClient:p}){const i=k(),{placeholder:x,maxChars:C}=e,w=c.useRef(0),b=c.useRef(null),{width:f,elementRef:h}=ft(),{innerWidth:u,innerHeight:m}=xt(),[v,D]=c.useState(e.default),[z,S]=c.useState([]),[F,T]=c.useState(!1),j=Ut({textareaRef:b,dependencies:[x]}),B=c.useMemo(()=>z.some(r=>r.status.type==="uploading")?!1:v!==""||z.length>0,[z,v]),I=mt(e.acceptFile),M=jt(e.maxUploadSizeMb,V.Megabyte,V.Byte),W=c.useCallback(r=>S(l=>[...l,...r]),[]),$=c.useCallback(r=>{S(l=>{const d=H(r,l);return R(d)?l:(d.status.type==="uploading"&&d.status.abortController.abort(),d.status.type==="uploaded"&&d.status.fileUrls.deleteUrl&&p.deleteFile(d.status.fileUrls.deleteUrl),l.filter(s=>s.id!==r))})},[p]),nt=()=>{const r=z.filter(l=>l.status.type==="uploaded").map(l=>{const{name:d,size:s,status:U}=l,{fileId:lt,fileUrls:dt}=U;return new yt({fileId:lt,fileUrls:dt,name:d,size:s})});return new Ct({uploadedFileInfo:r})},N=()=>w.current++,rt=re({acceptMultipleFiles:I===y.Multiple||I===y.Directory,acceptDirectoryFiles:I===y.Directory,maxFileSize:M,uploadClient:p,uploadFile:se({getNextLocalFileId:N,addFiles:W,updateFile:(r,l)=>{S(d=>L(r,l,d))},uploadClient:p,element:e,onUploadProgress:(r,l)=>{S(d=>{const s=H(l,d);if(R(s)||s.status.type!=="uploading")return d;const U=Math.round(r.loaded*100/r.total);return s.status.progress===U?d:L(l,s.setStatus({type:"uploading",abortController:s.status.abortController,progress:U}),d)})},onUploadComplete:(r,l)=>{S(d=>{const s=H(r,d);return R(s)||s.status.type!=="uploading"?d:L(s.id,s.setStatus({type:"uploaded",fileId:l.fileId,fileUrls:l}),d)})}}),addFiles:W,getNextLocalFileId:N,deleteExistingFiles:()=>z.forEach(r=>$(r.id)),onUploadComplete:()=>{b.current&&b.current.focus()},element:e}),{getRootProps:A,getInputProps:P}=zt({onDrop:rt,multiple:I===y.Multiple||I===y.Directory,accept:St(e.fileType),maxSize:M}),K=()=>{if(b.current&&b.current.focus(),!B||t)return;const r={data:v,fileUploaderState:nt()};n.setChatInputValue(e,r,{fromUi:!0},a),S([]),D(""),j.clearScrollHeight()},st=r=>{const{metaKey:l,ctrlKey:d,shiftKey:s}=r;Dt(r)&&!s&&!d&&!l&&(r.preventDefault(),K())},at=r=>{const{value:l}=r.target;C!==0&&l.length>C||(D(l),j.updateScrollHeight())};c.useEffect(()=>{if(e.setValue){e.setValue=!1;const r=e.value||"";D(r)}},[e]),c.useEffect(()=>{const r=s=>{s.preventDefault(),s.stopPropagation(),!F&&s.dataTransfer?.types.includes("Files")&&T(!0)},l=s=>{s.preventDefault(),s.stopPropagation(),F&&(s.clientX<=0&&s.clientY<=0||s.clientX>=u&&s.clientY>=m)&&T(!1)},d=s=>{s.preventDefault(),s.stopPropagation(),F&&T(!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)}},[F,u,m]);const it=I!==y.None&&F;return o.jsxs(o.Fragment,{children:[I===y.None?null:o.jsx(oe,{items:[...z],onDelete:$}),o.jsx(ae,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o.jsx(Gt,{getRootProps:A,getInputProps:P,acceptFile:I,inputHeight:j.height}):o.jsxs(ie,{extended:j.isExtended,children:[I===y.None?null:o.jsx(Yt,{getRootProps:A,getInputProps:P,acceptFile:I,disabled:t,theme:i}),o.jsx(Et,{inputRef:b,value:v,placeholder:x,onChange:at,onKeyDown:st,"aria-label":x,disabled:t,rows:1,overrides:{Root:{style:{minHeight:i.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:i.fontWeights.normal,lineHeight:i.lineHeights.inputWidget,"::placeholder":{color:i.colors.fadedText60},height:j.height,maxHeight:j.maxHeight,paddingLeft:i.spacing.none,paddingBottom:i.spacing.sm,paddingTop:i.spacing.sm,paddingRight:`calc(${i.iconSizes.xl} + 2 * ${i.spacing.sm} + ${i.spacing.sm})`}}}}),f>i.breakpoints.hideWidgetDetails&&o.jsx(ce,{children:o.jsx(Ft,{dirty:B,value:v,maxLength:C,type:"chat",inForm:!1})}),o.jsx(de,{children:o.jsx(le,{onClick:K,disabled:!B||t,extended:j.isExtended,"data-testid":"stChatInputSubmitButton",children:o.jsx(E,{content:tt,size:"xl",color:"inherit"})})})]})})]})}const be=c.memo(pe);export{be as default};
|
|
1
|
+
import{r as c,E as O,_ as X,bo as y,bp as _,s as g,j as o,T as ct,P as Y,c as q,B as G,an as E,u as k,am as pt,ah as ut,bq as gt,h as ht,a4 as ft,as as xt,br as mt,k as R,bj as yt,bk as Ct}from"./index-BwsrXI9O.js";import{g as bt,C as It,I as wt,F as V,E as J,a as vt,s as jt,u as zt,b as St}from"./FileHelper-tNTMbDMm.js";import{I as Ft}from"./InputInstructions-Ck_istEY.js";import{u as Ut,T as Et}from"./useTextInputAutoExpand-CJ0SgjFi.js";import{i as Dt}from"./inputUtils-CptNuJwn.js";import{E as Tt}from"./ErrorOutline.esm-BnBxotPi.js";import{U as Q}from"./UploadFileInfo-C-jY39rj.js";import"./base-input-DRJDHdAL.js";var Z=c.forwardRef(function(t,e){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(O,X({iconAttrs:n,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"}))});Z.displayName="AttachFile";var tt=c.forwardRef(function(t,e){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return c.createElement(O,X({iconAttrs:n,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"}))});tt.displayName="Send";const et=(t,e)=>e===y.Directory?{...t,webkitdirectory:"",multiple:!0}:t,Bt=(t,e)=>{if(!e||e.length===0)return!0;const n=t.name.toLowerCase(),a=n.lastIndexOf(".");if(a===-1||a===n.length-1)return e.some(x=>x===""||x===".");const p=n.substring(a),i=n.substring(a+1);return e.some(x=>{const C=x.toLowerCase();return C.startsWith(".")?p===C:i===C})},Rt=(t,e)=>Bt(t,e)?{isValid:!0}:{isValid:!1,errorMessage:`${t.type||"This type of"} files are not allowed.`},ot=t=>{switch(t){case y.None:return"a file";case y.Single:return"a file";case y.Multiple:return"files";case y.Directory:return"a directory";default:return _(t),"a file"}},Lt=g("div",{target:"e3id6jz12"})(({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}),""),Ht=g("div",{target:"e3id6jz11"})(({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}),""),Vt=g("div",{target:"e3id6jz10"})(({theme:t,disabled:e})=>({display:"flex",alignItems:"top",height:"100%",marginTop:`-${t.sizes.borderWidth}`,cursor:e?"not-allowed":"auto"}),""),kt=g("div",{target:"e3id6jz9"})(({disabled:t})=>({pointerEvents:t?"none":"auto"}),""),Mt=g("div",{target:"e3id6jz8"})(({theme:t})=>({marginTop:"0.625em",marginLeft:t.spacing.sm,height:t.spacing.xl,width:t.sizes.borderWidth,backgroundColor:t.colors.fadedText20}),""),Wt=g("div",{target:"e3id6jz7"})(({theme:t})=>({left:0,right:0,lineHeight:t.lineHeights.tight,paddingLeft:t.spacing.sm,paddingRight:t.spacing.sm,overflowX:"auto"}),""),$t=g("div",{target:"e3id6jz6"})({name:"zjik7",styles:"display:flex"}),Nt=g("div",{target:"e3id6jz5"})({name:"ou8xsw",styles:"flex:0 0 auto"}),At=g("div",{target:"e3id6jz4"})(({theme:t})=>({display:"flex",alignItems:"center",padding:t.spacing.sm,gap:t.spacing.twoXS}),""),Pt=g("div",{target:"e3id6jz3"})(({theme:t})=>({color:t.colors.fadedText60}),""),Kt=g("div",{target:"e3id6jz2"})(({theme:t,fileStatus:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:e.type==="uploaded"?t.colors.bodyText:t.colors.fadedText60}),""),Ot=g("div",{target:"e3id6jz1"})(({theme:t})=>({marginRight:t.spacing.md,color:t.colors.fadedText60}),""),Xt=g("small",{target:"e3id6jz0"})(({theme:t})=>({display:"flex",alignItems:"center",maxHeight:t.sizes.smallElementHeight,color:t.colors.fadedText60,"& :hover":{color:t.colors.bodyText}}),""),_t=({getRootProps:t,getInputProps:e,acceptFile:n,disabled:a,theme:p})=>{const i=et(e(),n);return o.jsxs(Vt,{disabled:a,children:[o.jsxs(kt,{"data-testid":"stChatInputFileUploadButton",disabled:a,...t(),children:[o.jsx("input",{...i}),o.jsx(ct,{content:`Upload or drag and drop ${ot(n)}`,placement:Y.TOP,onMouseEnterDelay:500,children:o.jsx(q,{kind:G.MINIMAL,disabled:a,children:o.jsx(E,{content:Z,size:"lg",color:a?p.colors.fadedText40:p.colors.fadedText60})})})]}),o.jsx(Mt,{})]})},Yt=c.memo(_t),qt=({getRootProps:t,getInputProps:e,acceptFile:n,inputHeight:a})=>{const p=et(e(),n);return o.jsxs(o.Fragment,{children:[o.jsx(Lt,{height:a,...t(),children:o.jsx("input",{...p})}),o.jsx(Ht,{height:a,children:`Drag and drop ${ot(n)} here`})]})},Gt=c.memo(qt);function Jt({children:t,content:e}){const n=k();return o.jsx(pt,{content:e,placement:Y.TOP,overrides:{Body:{style:{top:`-${n.sizes.minElementHeight}`}}},children:t})}const Qt=({fileInfo:t})=>{const e=k(),{type:n}=t.status;switch(n){case"uploading":return o.jsx(ut,{"data-testid":"stChatInputFileIconSpinner",size:"lg",margin:"0",padding:"0"});case"error":return o.jsx(Jt,{content:t.status.errorMessage,children:o.jsx(E,{color:e.colors.redTextColor,content:Tt,size:"lg"})});case"uploaded":return o.jsx(E,{content:wt,size:"lg"});default:return _(n),null}},Zt=({fileInfo:t,onDelete:e})=>o.jsxs(At,{className:"stChatInputFile","data-testid":"stChatInputFile",children:[o.jsx(Pt,{children:o.jsx(Qt,{fileInfo:t})}),o.jsx(Kt,{className:"stChatInputFileName","data-testid":"stChatInputFileName",title:t.name,fileStatus:t.status,children:t.name}),o.jsx(Ot,{children:bt(t.size,V.Byte)}),o.jsx(Xt,{"data-testid":"stChatInputDeleteBtn",children:o.jsx(q,{onClick:()=>e(t.id),kind:G.MINIMAL,children:o.jsx(E,{content:It,size:"lg"})})})]}),te=c.memo(Zt),ee=({items:t,onDelete:e})=>o.jsx(Wt,{"data-testid":"stChatUploadedFiles",children:o.jsx($t,{children:t.map(n=>o.jsx(Nt,{children:o.jsx(te,{fileInfo:n,onDelete:e})},n.id))})}),oe=c.memo(ee),ne=(t,e)=>{const n=[],a=[];return t.forEach(p=>{const i=Rt(p,e.fileType);i.isValid?n.push(p):a.push({file:p,errors:[{code:J.FileInvalidType,message:i.errorMessage||"File type not allowed."}]})}),{accepted:n,rejected:a}},re=({acceptMultipleFiles:t,acceptDirectoryFiles:e,maxFileSize:n,uploadClient:a,uploadFile:p,addFiles:i,getNextLocalFileId:x,deleteExistingFiles:C,onUploadComplete:w,element:b})=>(f,h)=>{if(e&&f.length>0){const{accepted:u,rejected:m}=ne(f,b);f=u,h=[...h,...m]}if(!t&&f.length===0&&h.length>1){const u=h.findIndex(m=>m.errors?.[0].code===J.TooManyFiles);u>=0&&(f.push(h[u].file),h.splice(u,1))}if(!t&&f.length>0&&C(),a.fetchFileURLs(f).then(u=>{gt(u,f).forEach(([m,v])=>{p(m,v)})}).catch(u=>{i(f.map(m=>new Q(m.name,m.size,x(),{type:"error",errorMessage:u})))}),h.length>0){const u=h.map(m=>vt(m,x(),n));i(u)}w()},se=({getNextLocalFileId:t,addFiles:e,updateFile:n,uploadClient:a,element:p,onUploadProgress:i,onUploadComplete:x})=>(C,w)=>{const b=w.webkitRelativePath||w.name,f=new AbortController,h=new Q(b,w.size,t(),{type:"uploading",abortController:f,progress:1});e([h]),a.uploadFile({formId:"",...p},C.uploadUrl,w,u=>i(u,h.id),f.signal).then(()=>x(h.id,C)).catch(u=>{u instanceof DOMException&&u.name==="AbortError"||n(h.id,h.setStatus({type:"error",errorMessage:u?u.toString():"Unknown error"}))})},ae=g("div",{target:"e1d2x3se4"})({name:"1nibcdy",styles:"border:none;position:relative;display:flex"}),ie=g("div",{target:"e1d2x3se3"})(({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}}),""),le=g("button",{target:"e1d2x3se2"})(({theme:t,disabled:e,extended:n})=>{const a=ht(t),[p,i]=a?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:n?"0":t.radii.chatInput,borderTopLeftRadius:n?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:i,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:a?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.gray60,cursor:"not-allowed"}}},""),de=g("div",{target:"e1d2x3se1"})(({theme:t})=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,marginBottom:`-${t.sizes.borderWidth}`,pointerEvents:"none"}),""),ce=g("div",{target:"e1d2x3se0"})(({theme:t})=>({position:"absolute",bottom:"0px",right:`calc(${t.iconSizes.xl} + 2 * ${t.spacing.sm} + ${t.spacing.sm})`}),""),L=(t,e,n)=>n.map(a=>a.id===t?e:a),H=(t,e)=>e.find(n=>n.id===t);function pe({disabled:t,element:e,widgetMgr:n,fragmentId:a,uploadClient:p}){const i=k(),{placeholder:x,maxChars:C}=e,w=c.useRef(0),b=c.useRef(null),{width:f,elementRef:h}=ft(),{innerWidth:u,innerHeight:m}=xt(),[v,D]=c.useState(e.default),[z,S]=c.useState([]),[F,T]=c.useState(!1),j=Ut({textareaRef:b,dependencies:[x]}),B=c.useMemo(()=>z.some(r=>r.status.type==="uploading")?!1:v!==""||z.length>0,[z,v]),I=mt(e.acceptFile),M=jt(e.maxUploadSizeMb,V.Megabyte,V.Byte),W=c.useCallback(r=>S(l=>[...l,...r]),[]),$=c.useCallback(r=>{S(l=>{const d=H(r,l);return R(d)?l:(d.status.type==="uploading"&&d.status.abortController.abort(),d.status.type==="uploaded"&&d.status.fileUrls.deleteUrl&&p.deleteFile(d.status.fileUrls.deleteUrl),l.filter(s=>s.id!==r))})},[p]),nt=()=>{const r=z.filter(l=>l.status.type==="uploaded").map(l=>{const{name:d,size:s,status:U}=l,{fileId:lt,fileUrls:dt}=U;return new yt({fileId:lt,fileUrls:dt,name:d,size:s})});return new Ct({uploadedFileInfo:r})},N=()=>w.current++,rt=re({acceptMultipleFiles:I===y.Multiple||I===y.Directory,acceptDirectoryFiles:I===y.Directory,maxFileSize:M,uploadClient:p,uploadFile:se({getNextLocalFileId:N,addFiles:W,updateFile:(r,l)=>{S(d=>L(r,l,d))},uploadClient:p,element:e,onUploadProgress:(r,l)=>{S(d=>{const s=H(l,d);if(R(s)||s.status.type!=="uploading")return d;const U=Math.round(r.loaded*100/r.total);return s.status.progress===U?d:L(l,s.setStatus({type:"uploading",abortController:s.status.abortController,progress:U}),d)})},onUploadComplete:(r,l)=>{S(d=>{const s=H(r,d);return R(s)||s.status.type!=="uploading"?d:L(s.id,s.setStatus({type:"uploaded",fileId:l.fileId,fileUrls:l}),d)})}}),addFiles:W,getNextLocalFileId:N,deleteExistingFiles:()=>z.forEach(r=>$(r.id)),onUploadComplete:()=>{b.current&&b.current.focus()},element:e}),{getRootProps:A,getInputProps:P}=zt({onDrop:rt,multiple:I===y.Multiple||I===y.Directory,accept:St(e.fileType),maxSize:M}),K=()=>{if(b.current&&b.current.focus(),!B||t)return;const r={data:v,fileUploaderState:nt()};n.setChatInputValue(e,r,{fromUi:!0},a),S([]),D(""),j.clearScrollHeight()},st=r=>{const{metaKey:l,ctrlKey:d,shiftKey:s}=r;Dt(r)&&!s&&!d&&!l&&(r.preventDefault(),K())},at=r=>{const{value:l}=r.target;C!==0&&l.length>C||(D(l),j.updateScrollHeight())};c.useEffect(()=>{if(e.setValue){e.setValue=!1;const r=e.value||"";D(r)}},[e]),c.useEffect(()=>{const r=s=>{s.preventDefault(),s.stopPropagation(),!F&&s.dataTransfer?.types.includes("Files")&&T(!0)},l=s=>{s.preventDefault(),s.stopPropagation(),F&&(s.clientX<=0&&s.clientY<=0||s.clientX>=u&&s.clientY>=m)&&T(!1)},d=s=>{s.preventDefault(),s.stopPropagation(),F&&T(!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)}},[F,u,m]);const it=I!==y.None&&F;return o.jsxs(o.Fragment,{children:[I===y.None?null:o.jsx(oe,{items:[...z],onDelete:$}),o.jsx(ae,{className:"stChatInput","data-testid":"stChatInput",ref:h,children:it?o.jsx(Gt,{getRootProps:A,getInputProps:P,acceptFile:I,inputHeight:j.height}):o.jsxs(ie,{extended:j.isExtended,children:[I===y.None?null:o.jsx(Yt,{getRootProps:A,getInputProps:P,acceptFile:I,disabled:t,theme:i}),o.jsx(Et,{inputRef:b,value:v,placeholder:x,onChange:at,onKeyDown:st,"aria-label":x,disabled:t,rows:1,overrides:{Root:{style:{minHeight:i.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:i.fontWeights.normal,lineHeight:i.lineHeights.inputWidget,"::placeholder":{color:i.colors.fadedText60},height:j.height,maxHeight:j.maxHeight,paddingLeft:i.spacing.none,paddingBottom:i.spacing.sm,paddingTop:i.spacing.sm,paddingRight:`calc(${i.iconSizes.xl} + 2 * ${i.spacing.sm} + ${i.spacing.sm})`}}}}),f>i.breakpoints.hideWidgetDetails&&o.jsx(ce,{children:o.jsx(Ft,{dirty:B,value:v,maxLength:C,type:"chat",inForm:!1})}),o.jsx(de,{children:o.jsx(le,{onClick:K,disabled:!B||t,extended:j.isExtended,"data-testid":"stChatInputSubmitButton",children:o.jsx(E,{content:tt,size:"xl",color:"inherit"})})})]})})]})}const be=c.memo(pe);export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as f,r as i,u as w,j as e,y as m,f as v,z as r,h as z,n as R,F as j,K as L}from"./index-
|
|
1
|
+
import{s as f,r as i,u as w,j as e,y as m,f as v,z as r,h as z,n as R,F as j,K as L}from"./index-BwsrXI9O.js";const C=f("button",{target:"elibz2u2"})(({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}}),""),E=f("div",{target:"elibz2u1"})(({theme:o})=>({display:"flex",flexDirection:"row",gap:o.spacing.lg,"> span":{marginTop:o.spacing.twoXS}}),""),k=f("div",{target:"elibz2u0"})(({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 t=z(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:o.colors.bgColor,filter:t?"brightness(0.98)":"brightness(1.2)",color:o.colors.bodyText,boxShadow:t?"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 H(o){if(o.length>104){let s=o.replace(/^(.{104}[^\s]*).*/,"$1");return s.length>104&&(s=s.substring(0,104).split(" ").slice(0,-1).join(" ")),s.trim()}return o}function D({element:o}){const{body:t,icon:s,duration:d}=o,n=w(),l=H(t),c=t!==l,[a,y]=i.useState(!c),[b,S]=i.useState(0),x=i.useCallback(()=>{y(!a)},[a]),g=i.useMemo(()=>B(n),[n]),p=i.useMemo(()=>e.jsxs(E,{expanded:a,children:[s&&e.jsx(m,{iconValue:s,size:"xl",testid:"stToastDynamicIcon"}),e.jsxs(k,{children:[e.jsx(v,{source:a?t:l,allowHTML:!1,isToast:!0}),c&&e.jsx(C,{"data-testid":"stToastViewButton",onClick:x,children:a?"view less":"view more"})]})]}),[c,a,t,s,l,x]);i.useEffect(()=>{if(n.inSidebar)return;const h=R(d)?d===0?0:d*1e3:4e3,u=r.info(p,{overrides:{...g},autoHideDuration:h});return S(u),()=>{r.update(u,{overrides:{Body:{style:{display:"none"}}}}),r.clear(u)}},[]),i.useEffect(()=>{r.update(b,{children:p,overrides:{...g}})},[b,p,g]);const T=e.jsx(j,{kind:L.ERROR,body:"Streamlit API Error: `st.toast` cannot be called directly on the sidebar with `st.sidebar.toast`.\n See our `st.toast` API [docs](https://docs.streamlit.io/develop/api-reference/status/st.toast) for more information."});return e.jsx(e.Fragment,{children:n.inSidebar&&T})}const I=i.memo(D);export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ac as q,o as J,r as s,au as Q,u as Y,av as ee,aw as l,j as g,ax as te,W as re,l as ne,g as oe,T as ie,P as ae,ay as ue,c as le,B as P,d as U,D as se}from"./index-
|
|
1
|
+
import{ac as q,o as J,r as s,au as Q,u as Y,av as ee,aw as l,j as g,ax as te,W as re,l as ne,g as oe,T as ie,P as ae,ay as ue,c as le,B as P,d as U,D as se}from"./index-BwsrXI9O.js";import{u as ce}from"./useBasicWidgetState-CQoPeUHV.js";import"./FormClearHelper-DGQP9oxJ.js";var fe={secondary:"secondary"},N={default:"default"},pe={default:"default"},j=Object.freeze({radio:"radio",checkbox:"checkbox"}),x=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==N.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});x.displayName="StyledRoot";x.displayName="StyledRoot";function M(e){"@babel/helpers - typeof";return M=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},M(e)}function G(){return G=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},G.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 de(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){z(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 ye(e,t){return Se(e)||be(e,t)||me(e,t)||he()}function he(){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 me(e,t){if(e){if(typeof e=="string")return K(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 K(e,t)}}function K(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 be(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,d;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,d=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw d}}return n}}function Se(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 Oe(e,t,r){return t&&ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ee(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 _e(e){var t=Le();return function(){var n=k(e),o;if(t){var i=k(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return we(this,o)}}function we(e,t){if(t&&(M(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 Le(){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 k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},k(e)}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Re(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var H=(function(e){Ee(r,e);var t=_e(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)),z(F(n),"childRefs",{}),n}return Oe(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,d=a===void 0?{}:a,c=i.mode,y=c===void 0?j.checkbox:c,v=i.children,h=i.selected,_=i.disabled,f=i.onClick,m=i.kind,O=i.shape,b=i.size,B=J(d.Root,x),w=ye(B,2),T=w[0],R=w[1],L=this.props["aria-label"]||this.props.ariaLabel,p=y===j.radio,V=s.Children.count(v);return s.createElement(Q.Consumer,null,function(Z){return s.createElement(T,G({"aria-label":L||Z.buttongroup.ariaLabel,"data-baseweb":"button-group",role:p?"radiogroup":"group",$shape:O,$length:v.length},R),s.Children.map(v,function(S,C){if(!s.isValidElement(S))return null;var I=S.props.isSelected?S.props.isSelected:Re(h,C);return p&&(o.childRefs[C]=s.createRef()),s.cloneElement(S,{disabled:_||S.props.disabled,isSelected:I,ref:p?o.childRefs[C]:void 0,tabIndex:!p||I||p&&(!h||h===-1)&&C===0?0:-1,onKeyDown:function(u){if(p){var E=Number(h)?Number(h):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var A=E-1<0?V-1:E-1;f&&f(u,A),o.childRefs[A].current&&o.childRefs[A].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var D=E+1>V-1?0:E+1;f&&f(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}}},kind:m,onClick:function(u){_||(S.props.onClick&&S.props.onClick(u),f&&f(u,C))},shape:O,size:b,overrides:de({BaseButton:{style:function(u){var E=u.$theme;return v.length===1?{}:O!==N.default?{marginLeft:E.sizing.scale100,marginRight:E.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":I,role:p?"radio":"checkbox"}}},S.props.overrides)})}))})}}]),r})(s.Component);z(H,"defaultProps",{disabled:!1,onClick:function(){},shape:N.default,size:pe.default,kind:fe.secondary});function Ce(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Pe(e,t,r){return e==l.ClickMode.MULTI_SELECT?Ce(t,r??[]):r?.includes(t)?[]:[t]}function je(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Be(e,t,r){const n=r===l.Style.PILLS?P.PILLS:r===l.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?U.XSMALL:U.MEDIUM,i=n===P.PILLS||n===P.SEGMENTED_CONTROL,a=r===l.Style.BORDERLESS?"lg":"base";return{element:g.jsx(se,{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!==l.ClickMode.SINGLE_SELECT||e!==l.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function Ie(e,t){return e&&(t=`${t}Active`),t}function Ae(e,t,r){const n={flexWrap:"wrap",maxWidth:"100%",margin:"0 0"},o=r?"100%":"auto",i=r?{}:{content:"''",flex:1e4};switch(e){case l.Style.BORDERLESS:return{...n,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...n,columnGap:t.twoXS,rowGap:t.twoXS,width:o};case l.Style.SEGMENTED_CONTROL:return{...n,columnGap:t.none,rowGap:t.twoXS,"::after":i,width:o};default:return n}}function De(e,t,r,n,o,i,a){const d=Te(r,n,o,t);let c=e.content,y=e.contentIcon;return d&&(c=e.selectedContent?e.selectedContent:c,y=e.selectedContentIcon?e.selectedContentIcon:y),s.forwardRef(function(h,_){const{element:f,kind:m,size:O}=Be(c??"",y??void 0,i),b=Ie(!!(d&&!e.selectedContent&&!e.selectedContentIcon),m);return g.jsx(le,{...h,size:O,kind:b,containerWidth:a,children:f})})}function Me(e,t){return e.getIntArrayValue(t)}function Ge(e){return e.default??null}function $e(e){return e.value??null}function Ne(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o,widthConfig:i}=e,{clickMode:a,options:d,selectionVisualization:c,style:y,label:v,labelVisibility:h,help:_}=r,f=Y(),[m,O]=ce({getStateFromWidgetMgr:Me,getDefaultStateFromProto:Ge,getCurrStateFromProto:$e,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),b=ee(i),B=(R,L)=>{const p=Pe(a,L,m);O({value:p,fromUi:!0})};let w;a===l.ClickMode.SINGLE_SELECT?w=j.radio:a===l.ClickMode.MULTI_SELECT&&(w=j.checkbox);const T=s.useMemo(()=>d.map((R,L)=>{const p=De(R,L,c,a,m,y,b);return g.jsx(p,{},`${R.content}-${L}`)}),[a,d,c,y,m,b]);return g.jsxs(te,{className:"stButtonGroup","data-testid":"stButtonGroup",containerWidth:b,children:[g.jsx(re,{label:v,disabled:t,labelVisibility:ne(h?.value??ue.LabelVisibilityOptions.COLLAPSED),children:_&&g.jsx(oe,{children:g.jsx(ie,{content:_,placement:ae.TOP})})}),g.jsx(H,{disabled:t,mode:w,onClick:B,selected:a===l.ClickMode.MULTI_SELECT?m:je(m),overrides:{Root:{style:s.useCallback(()=>Ae(y,f.spacing,b),[y,f.spacing,b])}},children:T})]})}const We=s.memo(Ne);export{We as default};
|