@stlite/desktop 0.77.0 → 0.78.0
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/build/assets/{FileDownload.esm-DJiSKkNf.js → FileDownload.esm-D2QqHv2c.js} +1 -1
- package/build/assets/{FormClearHelper-Dhc_r76k.js → FormClearHelper-DliGOSkq.js} +1 -1
- package/build/assets/{Hooks-DrFfRfR6.js → Hooks-Daeq69Zu.js} +1 -1
- package/build/assets/{InputInstructions-DBmZV4qq.js → InputInstructions-BQD8A2_u.js} +1 -1
- package/build/assets/{ProgressBar-D8toyv14.js → ProgressBar-DuGylkeS.js} +1 -1
- package/build/assets/{RenderInPortalIfExists-BgiI3__B.js → RenderInPortalIfExists-HKy5CC9C.js} +1 -1
- package/build/assets/{Toolbar-BTpOoeAP.js → Toolbar-B9grKd8p.js} +1 -1
- package/build/assets/{base-input-BNFPjj94.js → base-input-DJ1o9wy-.js} +1 -1
- package/build/assets/{createSuper-D-IHZlzE.js → createSuper-BCtrEkDw.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-3T3wOgR5.js → data-grid-overlay-editor-SiNLnLoA.js} +1 -1
- package/build/assets/{downloader-BRNWhhPt.js → downloader-y7WtJrbZ.js} +1 -1
- package/build/assets/{es6-BGfGTfFo.js → es6-ChzZtMws.js} +2 -2
- package/build/assets/{getPrototypeOf-Bfvf6jYJ.js → getPrototypeOf-jxUzvEiF.js} +1 -1
- package/build/assets/{iframeResizer.contentWindow-CAd9E7Yv.js → iframeResizer.contentWindow-VeTSZzxi.js} +1 -1
- package/build/assets/{index-DtCnxC7q.js → index-B2k4Ofkz.js} +1 -1
- package/build/assets/{index-BkQMwfmi.js → index-B7GLWddS.js} +1 -1
- package/build/assets/{index-CCQ8WBbz.js → index-BCDKFsnk.js} +1 -1
- package/build/assets/{index-DXhp4_Bh.js → index-BYdd9282.js} +1 -1
- package/build/assets/{index-DvDmgZ7F.js → index-Bh9EjD0o.js} +1 -1
- package/build/assets/{index-hfjIuaWS.js → index-Bia2Aiul.js} +1 -1
- package/build/assets/{index-uFJhQ6op.js → index-BqYxHJ94.js} +1 -1
- package/build/assets/{index-Bf8NyENV.js → index-Bsw1C-zM.js} +1 -1
- package/build/assets/{index-D20xuISa.js → index-ByZKQf5p.js} +1 -1
- package/build/assets/{index-DSp2Cc2a.js → index-C-G07XIn.js} +1 -1
- package/build/assets/{index-R99zJVpL.js → index-C5VxAqHf.js} +1 -1
- package/build/assets/{index-CSeZQPbV.js → index-C9Os1Tio.js} +1 -1
- package/build/assets/{index-C1nS5RIf.js → index-CFVMKjCp.js} +1 -1
- package/build/assets/{index-DS1KzaKA.js → index-CGRaMNW7.js} +1 -1
- package/build/assets/{index-DEAAmCoL.js → index-CQ8B9Pyu.js} +1 -1
- package/build/assets/{index-BgM3jrky.js → index-CS3mWYPw.js} +1 -1
- package/build/assets/{index-DlrQfTa3.js → index-CSRB3KZi.js} +1 -1
- package/build/assets/{index-BzdmnoFw.js → index-C_q5O89K.js} +1 -1
- package/build/assets/{index-c-P5wgpW.js → index-CnPYErGb.js} +1 -1
- package/build/assets/{index-2GihT9MS.js → index-CpzAXWaZ.js} +1 -1
- package/build/assets/{index-CeMslFeR.js → index-CvKkwQxq.js} +1 -1
- package/build/assets/{index-IG3UXYla.js → index-CxF9whAo.js} +1 -1
- package/build/assets/{index-14giYAR7.js → index-Cxp-1GAt.js} +1 -1
- package/build/assets/{index-DVBTaPM3.js → index-DMBd-bc-.js} +5 -5
- package/build/assets/{index-CzMG-04F.js → index-DXHAdPWu.js} +1 -1
- package/build/assets/{index-DwF2Kd5G.js → index-DYrQR0Ux.js} +1 -1
- package/build/assets/{index-DpQaX_zS.js → index-Dh5Ef2Om.js} +1 -1
- package/build/assets/{index-CWQIbxk6.js → index-Di0b5deS.js} +1 -1
- package/build/assets/{index-Dd4zWSqM.js → index-Dkd6yjmr.js} +1 -1
- package/build/assets/{index-BbkQg7FB.js → index-Do74AQgb.js} +1 -1
- package/build/assets/{index-DLzppoKu.js → index-GTNwQsph.js} +1 -1
- package/build/assets/{index-BCXIPEnn.js → index-JLaGWCy4.js} +1 -1
- package/build/assets/{index-DGyUD6Fc.js → index-NW5mgelH.js} +1 -1
- package/build/assets/{index-CRU3QRmk.js → index-UrV00MOE.js} +1 -1
- package/build/assets/{index-DWl7GYN1.js → index-j3NobT-r.js} +1 -1
- package/build/assets/{index-CqPAWIlG.js → index-lR3NBV82.js} +1 -1
- package/build/assets/{index-lyJc68Dt.js → index-z2lXC7XI.js} +4 -4
- package/build/assets/{input-B0OfG1Hd.js → input-Dhep7xP0.js} +1 -1
- package/build/assets/{memory-Db7tbqiS.js → memory-BqTZFgXm.js} +1 -1
- package/build/assets/{number-overlay-editor-DNvGPhC6.js → number-overlay-editor-BywJqzaW.js} +1 -1
- package/build/assets/{sandbox-0hHf-j9y.js → sandbox-DmnKum9A.js} +1 -1
- package/build/assets/{slicedToArray-C3Kk8BEP.js → slicedToArray-DkF8JK54.js} +1 -1
- package/build/assets/{textarea-DjoYY0dF.js → textarea-CCmBHfjM.js} +1 -1
- package/build/assets/{timepicker-Cn0ZGw9I.js → timepicker-DWOLsPBU.js} +1 -1
- package/build/assets/{uniqueId-K4UOiJl2.js → uniqueId-C3qA3EXY.js} +1 -1
- package/build/assets/{useBasicWidgetState-BzSjsdCt.js → useBasicWidgetState-CDQNZkN8.js} +1 -1
- package/build/assets/{useOnInputChange-VVCu-n8v.js → useOnInputChange-FEZNS9DP.js} +1 -1
- package/build/assets/{withFullScreenWrapper-BggmGF09.js → withFullScreenWrapper-dTVQmtO5.js} +1 -1
- package/build/assets/worker-CLbVOjel.js +117 -0
- package/build/electron/worker.js +9 -9
- package/build/index.html +1 -1
- package/package.json +5 -5
- package/wheels/streamlit-1.41.0-cp312-none-any.whl +0 -0
- package/build/assets/worker-DddKT6_v.js +0 -117
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e as N,r as k,b2 as Q,bs as dt,bd as ht,b3 as J,bt as ft,bu as pt,c as he,Q as gt,M as mt,a7 as vt,j as Y,R as Ne,bQ as bt,a_ as yt,a$ as wt,bc as Tt,b0 as xt,aK as kt,G as Ot,bR as Se}from"./index-lyJc68Dt.js";import{s as _e}from"./sprintf-C-r3gIuM.js";import{a as Rt}from"./useBasicWidgetState-BzSjsdCt.js";import"./FormClearHelper-Dhc_r76k.js";var De={},Ee={},Ie={},fe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Direction=void 0,function(n){n.Right="to right",n.Left="to left",n.Down="to bottom",n.Up="to top"}(t.Direction||(t.Direction={}))})(fe),function(t){var n=N&&N.__spreadArray||function(o,c,l){if(l||arguments.length===2)for(var g=0,v=c.length,m;g<v;g++)(m||!(g in c))&&(m||(m=Array.prototype.slice.call(c,0,g)),m[g]=c[g]);return o.concat(m||Array.prototype.slice.call(c))};Object.defineProperty(t,"__esModule",{value:!0}),t.useThumbOverlap=t.assertUnreachable=t.voidFn=t.getTrackBackground=t.replaceAt=t.schd=t.translate=t.getClosestThumbIndex=t.translateThumbs=t.getPaddingAndBorder=t.getMargin=t.checkInitialOverlap=t.checkValuesAgainstBoundaries=t.checkBoundaries=t.isVertical=t.relativeValue=t.normalizeValue=t.isStepDivisible=t.isTouchEvent=t.getStepDecimals=void 0;var r=k,e=fe,a=function(o){var c=o.toString().split(".")[1];return c?c.length:0};t.getStepDecimals=a;function i(o){return o.touches&&o.touches.length||o.changedTouches&&o.changedTouches.length}t.isTouchEvent=i;function s(o,c,l){var g=(c-o)/l,v=8,m=Number(g.toFixed(v));return parseInt(m.toString(),10)===m}t.isStepDivisible=s;function u(o,c,l,g,v,m,T){var b=1e11;if(o=Math.round(o*b)/b,!m){var E=T[c-1],S=T[c+1];if(E&&E>o)return E;if(S&&S<o)return S}if(o>g)return g;if(o<l)return l;var _=Math.floor(o*b-l*b)%Math.floor(v*b),F=Math.floor(o*b-Math.abs(_)),U=_===0?o:F/b,j=Math.abs(_/b)<v/2?U:U+v,V=(0,t.getStepDecimals)(v);return parseFloat(j.toFixed(V))}t.normalizeValue=u;function d(o,c,l){return(o-c)/(l-c)}t.relativeValue=d;function y(o){return o===e.Direction.Up||o===e.Direction.Down}t.isVertical=y;function f(o,c,l){if(c>=l)throw new RangeError("min (".concat(c,") is equal/bigger than max (").concat(l,")"));if(o<c)throw new RangeError("value (".concat(o,") is smaller than min (").concat(c,")"));if(o>l)throw new RangeError("value (".concat(o,") is bigger than max (").concat(l,")"))}t.checkBoundaries=f;function h(o,c,l){return o<c?c:o>l?l:o}t.checkValuesAgainstBoundaries=h;function p(o){if(!(o.length<2)&&!o.slice(1).every(function(c,l){return o[l]<=c}))throw new RangeError("values={[".concat(o,"]} needs to be sorted when allowOverlap={false}"))}t.checkInitialOverlap=p;function R(o){var c=window.getComputedStyle(o);return{top:parseInt(c["margin-top"],10),bottom:parseInt(c["margin-bottom"],10),left:parseInt(c["margin-left"],10),right:parseInt(c["margin-right"],10)}}t.getMargin=R;function w(o){var c=window.getComputedStyle(o);return{top:parseInt(c["padding-top"],10)+parseInt(c["border-top-width"],10),bottom:parseInt(c["padding-bottom"],10)+parseInt(c["border-bottom-width"],10),left:parseInt(c["padding-left"],10)+parseInt(c["border-left-width"],10),right:parseInt(c["padding-right"],10)+parseInt(c["border-right-width"],10)}}t.getPaddingAndBorder=w;function M(o,c,l){var g=l?-1:1;o.forEach(function(v,m){return D(v,g*c[m].x,c[m].y)})}t.translateThumbs=M;function L(o,c,l,g){for(var v=0,m=$(o[0],c,l,g),T=1;T<o.length;T++){var b=$(o[T],c,l,g);b<m&&(m=b,v=T)}return v}t.getClosestThumbIndex=L;function D(o,c,l){o.style.transform="translate(".concat(c,"px, ").concat(l,"px)")}t.translate=D;var O=function(o){var c=[],l=null,g=function(){for(var v=[],m=0;m<arguments.length;m++)v[m]=arguments[m];c=v,!l&&(l=requestAnimationFrame(function(){l=null,o.apply(void 0,c)}))};return g};t.schd=O;function I(o,c,l){var g=o.slice(0);return g[c]=l,g}t.replaceAt=I;function q(o){var c=o.values,l=o.colors,g=o.min,v=o.max,m=o.direction,T=m===void 0?e.Direction.Right:m,b=o.rtl,E=b===void 0?!1:b;E&&T===e.Direction.Right?T=e.Direction.Left:E&&e.Direction.Left&&(T=e.Direction.Right);var S=c.slice(0).sort(function(F,U){return F-U}).map(function(F){return(F-g)/(v-g)*100}),_=S.reduce(function(F,U,j){return"".concat(F,", ").concat(l[j]," ").concat(U,"%, ").concat(l[j+1]," ").concat(U,"%")},"");return"linear-gradient(".concat(T,", ").concat(l[0]," 0%").concat(_,", ").concat(l[l.length-1]," 100%)")}t.getTrackBackground=q;function ee(){}t.voidFn=ee;function z(o){throw new Error("Didn't expect to get here")}t.assertUnreachable=z;var P=function(o,c,l,g,v){v===void 0&&(v=function(T){return T});var m=Math.ceil(n([o],Array.from(o.children),!0).reduce(function(T,b){var E=Math.ceil(b.getBoundingClientRect().width);if(b.innerText&&b.innerText.includes(l)&&b.childElementCount===0){var S=b.cloneNode(!0);S.innerHTML=v(c.toFixed(g)),S.style.visibility="hidden",document.body.appendChild(S),E=Math.ceil(S.getBoundingClientRect().width),document.body.removeChild(S)}return E>T?E:T},o.getBoundingClientRect().width));return m},Z=function(o,c,l,g,v,m,T){T===void 0&&(T=function(S){return S});var b=[],E=function(S){var _=P(l[S],g[S],v,m,T),F=c[S].x;c.forEach(function(U,j){var V=U.x,A=P(l[j],g[j],v,m,T);S!==j&&(F>=V&&F<=V+A||F+_>=V&&F+_<=V+A)&&(b.includes(j)||(b.push(S),b.push(j),b=n(n([],b,!0),[S,j],!1),E(j)))})};return E(o),Array.from(new Set(b.sort()))},G=function(o,c,l,g,v,m){g===void 0&&(g=.1),v===void 0&&(v=" - "),m===void 0&&(m=function(j){return j});var T=(0,t.getStepDecimals)(g),b=(0,r.useState)({}),E=b[0],S=b[1],_=(0,r.useState)(m(c[l].toFixed(T))),F=_[0],U=_[1];return(0,r.useEffect)(function(){if(o){var j=o.getThumbs();if(j.length<1)return;var V={},A=o.getOffsets(),re=Z(l,A,j,c,v,T,m),se=m(c[l].toFixed(T));if(re.length){var ae=re.reduce(function(te,le,ce,de){return te.length?n(n([],te,!0),[A[de[ce]].x],!1):[A[de[ce]].x]},[]);if(Math.min.apply(Math,ae)===A[l].x){var ie=[];re.forEach(function(te){ie.push(c[te].toFixed(T))}),se=Array.from(new Set(ie.sort(function(te,le){return parseFloat(te)-parseFloat(le)}))).map(m).join(v);var Re=Math.min.apply(Math,ae),ue=Math.max.apply(Math,ae),Me=j[re[ae.indexOf(ue)]].getBoundingClientRect().width;V.left="".concat(Math.abs(Re-(ue+Me))/2,"px"),V.transform="translate(-50%, 0)"}else V.visibility="hidden"}U(se),S(V)}},[o,c]),[F,E]};t.useThumbOverlap=G;function $(o,c,l,g){var v=o.getBoundingClientRect(),m=v.left,T=v.top,b=v.width,E=v.height;return y(g)?Math.abs(l-(T+E/2)):Math.abs(c-(m+b/2))}}(Ie);var Mt=N&&N.__extends||function(){var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])},t(n,r)};return function(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(n,r);function e(){this.constructor=n}n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}}(),St=N&&N.__createBinding||(Object.create?function(t,n,r,e){e===void 0&&(e=r);var a=Object.getOwnPropertyDescriptor(n,r);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,e,a)}:function(t,n,r,e){e===void 0&&(e=r),t[e]=n[r]}),Dt=N&&N.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),Et=N&&N.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&St(n,t,r);return Dt(n,t),n},Ue=N&&N.__spreadArray||function(t,n,r){if(r||arguments.length===2)for(var e=0,a=n.length,i;e<a;e++)(i||!(e in n))&&(i||(i=Array.prototype.slice.call(n,0,e)),i[e]=n[e]);return t.concat(i||Array.prototype.slice.call(n))};Object.defineProperty(Ee,"__esModule",{value:!0});var pe=Et(k),x=Ie,B=fe,It=["ArrowRight","ArrowUp","k","PageUp"],Ct=["ArrowLeft","ArrowDown","j","PageDown"],Pt=function(t){Mt(n,t);function n(r){var e=t.call(this,r)||this;if(e.trackRef=pe.createRef(),e.thumbRefs=[],e.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(e.props.values.length).fill(0).map(function(a,i){return i}),isChanged:!1,markOffsets:[]},e.getOffsets=function(){var a=e.props,i=a.direction,s=a.values,u=a.min,d=a.max,y=e.trackRef.current,f=y.getBoundingClientRect(),h=(0,x.getPaddingAndBorder)(y);return e.getThumbs().map(function(p,R){var w={x:0,y:0},M=p.getBoundingClientRect(),L=(0,x.getMargin)(p);switch(i){case B.Direction.Right:return w.x=(L.left+h.left)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Left:return w.x=(L.right+h.right)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width-f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Up:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height-f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;case B.Direction.Down:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;default:return(0,x.assertUnreachable)(i)}})},e.getThumbs=function(){return e.trackRef&&e.trackRef.current?Array.from(e.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?"),[])},e.getTargetIndex=function(a){return e.getThumbs().findIndex(function(i){return i===a.target||i.contains(a.target)})},e.addTouchEvents=function(a){document.addEventListener("touchmove",e.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",e.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",e.schdOnEnd,{passive:!1})},e.addMouseEvents=function(a){document.addEventListener("mousemove",e.schdOnMouseMove),document.addEventListener("mouseup",e.schdOnEnd)},e.onMouseDownTrack=function(a){var i;if(a.button===0)if(a.persist(),a.preventDefault(),e.addMouseEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return e.onMove(a.clientX,a.clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.clientX,a.clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.clientX,a.clientY)})}},e.onResize=function(){(0,x.translateThumbs)(e.getThumbs(),e.getOffsets(),e.props.rtl),e.calculateMarkOffsets()},e.onTouchStartTrack=function(a){var i;if(a.persist(),e.addTouchEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.touches[0].clientX,a.touches[0].clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},e.onMouseOrTouchStart=function(a){if(!e.props.disabled){var i=(0,x.isTouchEvent)(a);if(!(!i&&a.button!==0)){var s=e.getTargetIndex(a);s!==-1&&(i?e.addTouchEvents(a):e.addMouseEvents(a),e.setState({draggedThumbIndex:s,thumbZIndexes:e.state.thumbZIndexes.map(function(u,d){return d===s?Math.max.apply(Math,e.state.thumbZIndexes):u<=e.state.thumbZIndexes[s]?u:u-1})}))}}},e.onMouseMove=function(a){a.preventDefault(),e.onMove(a.clientX,a.clientY)},e.onTouchMove=function(a){a.preventDefault(),e.onMove(a.touches[0].clientX,a.touches[0].clientY)},e.onKeyDown=function(a){var i=e.props,s=i.values,u=i.onChange,d=i.step,y=i.rtl,f=i.direction,h=e.state.isChanged,p=e.getTargetIndex(a.nativeEvent),R=y||f===B.Direction.Left||f===B.Direction.Down?-1:1;p!==-1&&(It.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]+R*(a.key==="PageUp"?d*10:d),p)))):Ct.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]-R*(a.key==="PageDown"?d*10:d),p)))):a.key==="Tab"?e.setState({draggedThumbIndex:-1},function(){h&&e.fireOnFinalChange()}):h&&e.fireOnFinalChange())},e.onKeyUp=function(a){var i=e.state.isChanged;e.setState({draggedThumbIndex:-1},function(){i&&e.fireOnFinalChange()})},e.onMove=function(a,i){var s=e.state,u=s.draggedThumbIndex,d=s.draggedTrackPos,y=e.props,f=y.direction,h=y.min,p=y.max,R=y.onChange,w=y.values,M=y.step,L=y.rtl;if(u===-1&&d[0]===-1&&d[1]===-1)return null;var D=e.trackRef.current;if(!D)return null;var O=D.getBoundingClientRect(),I=(0,x.isVertical)(f)?O.height:O.width;if(d[0]!==-1&&d[1]!==-1){var q=a-d[0],ee=i-d[1],z=0;switch(f){case B.Direction.Right:case B.Direction.Left:z=q/I*(p-h);break;case B.Direction.Down:case B.Direction.Up:z=ee/I*(p-h);break;default:(0,x.assertUnreachable)(f)}if(L&&(z*=-1),Math.abs(z)>=M/2){for(var P=0;P<e.thumbRefs.length;P++){if(w[P]===p&&Math.sign(z)===1||w[P]===h&&Math.sign(z)===-1)return;var Z=w[P]+z;Z>p?z=p-w[P]:Z<h&&(z=h-w[P])}for(var G=w.slice(0),P=0;P<e.thumbRefs.length;P++)G=(0,x.replaceAt)(G,P,e.normalizeValue(w[P]+z,P));e.setState({draggedTrackPos:[a,i]}),R(G)}}else{var $=0;switch(f){case B.Direction.Right:$=(a-O.left)/I*(p-h)+h;break;case B.Direction.Left:$=(I-(a-O.left))/I*(p-h)+h;break;case B.Direction.Down:$=(i-O.top)/I*(p-h)+h;break;case B.Direction.Up:$=(I-(i-O.top))/I*(p-h)+h;break;default:(0,x.assertUnreachable)(f)}L&&($=p+h-$),Math.abs(w[u]-$)>=M/2&&R((0,x.replaceAt)(w,u,e.normalizeValue($,u)))}},e.normalizeValue=function(a,i){var s=e.props,u=s.min,d=s.max,y=s.step,f=s.allowOverlap,h=s.values;return(0,x.normalizeValue)(a,i,u,d,y,f,h)},e.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",e.schdOnMouseMove),document.removeEventListener("touchmove",e.schdOnTouchMove),document.removeEventListener("mouseup",e.schdOnEnd),document.removeEventListener("touchend",e.schdOnEnd),document.removeEventListener("touchcancel",e.schdOnEnd),e.state.draggedThumbIndex===-1&&e.state.draggedTrackPos[0]===-1&&e.state.draggedTrackPos[1]===-1)return null;e.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){e.fireOnFinalChange()})},e.fireOnFinalChange=function(){e.setState({isChanged:!1});var a=e.props,i=a.onFinalChange,s=a.values;i&&i(s)},e.updateMarkRefs=function(a){if(!a.renderMark){e.numOfMarks=void 0,e.markRefs=void 0;return}e.numOfMarks=(a.max-a.min)/e.props.step,e.markRefs=[];for(var i=0;i<e.numOfMarks+1;i++)e.markRefs[i]=pe.createRef()},e.calculateMarkOffsets=function(){if(!(!e.props.renderMark||!e.trackRef||!e.numOfMarks||!e.markRefs||e.trackRef.current===null)){for(var a=window.getComputedStyle(e.trackRef.current),i=parseInt(a.width,10),s=parseInt(a.height,10),u=parseInt(a.paddingLeft,10),d=parseInt(a.paddingTop,10),y=[],f=0;f<e.numOfMarks+1;f++){var h=9999,p=9999;if(e.markRefs[f].current){var R=e.markRefs[f].current.getBoundingClientRect();h=R.height,p=R.width}e.props.direction===B.Direction.Left||e.props.direction===B.Direction.Right?y.push([Math.round(i/e.numOfMarks*f+u-p/2),-Math.round((h-s)/2)]):y.push([Math.round(s/e.numOfMarks*f+d-h/2),-Math.round((p-i)/2)])}e.setState({markOffsets:y})}},r.step===0)throw new Error('"step" property should be a positive number');return e.schdOnMouseMove=(0,x.schd)(e.onMouseMove),e.schdOnTouchMove=(0,x.schd)(e.onTouchMove),e.schdOnEnd=(0,x.schd)(e.onEnd),e.thumbRefs=r.values.map(function(){return pe.createRef()}),e.updateMarkRefs(r),e}return n.prototype.componentDidMount=function(){var r=this,e=this.props,a=e.values,i=e.min,s=e.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",r.onResize)},unobserve:function(){return window.removeEventListener("resize",r.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,x.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(u){return(0,x.checkBoundaries)(u,r.props.min,r.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(u){(0,x.isStepDivisible)(i,u,s)||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.")})},n.prototype.componentDidUpdate=function(r,e){var a=this.props,i=a.max,s=a.min,u=a.step,d=a.values,y=a.rtl;(r.max!==i||r.min!==s||r.step!==u)&&this.updateMarkRefs(this.props),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),y),(r.max!==i||r.min!==s||r.step!==u||e.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),d.forEach(function(f){(0,x.isStepDivisible)(s,f,u)||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.")}))},n.prototype.componentWillUnmount=function(){var r={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,r),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)},n.prototype.render=function(){var r=this,e=this.props,a=e.renderTrack,i=e.renderThumb,s=e.renderMark,u=s===void 0?function(){return null}:s,d=e.values,y=e.min,f=e.max,h=e.allowOverlap,p=e.disabled,R=this.state,w=R.draggedThumbIndex,M=R.thumbZIndexes,L=R.markOffsets;return a({props:{style:{transform:"scale(1)",cursor:w>-1?"grabbing":this.props.draggableTrack?(0,x.isVertical)(this.props.direction)?"ns-resize":"ew-resize":d.length===1&&!p?"pointer":"inherit"},onMouseDown:p?x.voidFn:this.onMouseDownTrack,onTouchStart:p?x.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:p,children:Ue(Ue([],L.map(function(D,O,I){return u({props:{style:r.props.direction===B.Direction.Left||r.props.direction===B.Direction.Right?{position:"absolute",left:"".concat(D[0],"px"),marginTop:"".concat(D[1],"px")}:{position:"absolute",top:"".concat(D[0],"px"),marginLeft:"".concat(D[1],"px")},key:"mark".concat(O),ref:r.markRefs[O]},index:O})}),!0),d.map(function(D,O){var I=r.state.draggedThumbIndex===O;return i({index:O,value:D,isDragged:I,props:{style:{position:"absolute",zIndex:M[O],cursor:p?"inherit":I?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:O,tabIndex:p?void 0:0,"aria-valuemax":h?f:d[O+1]||f,"aria-valuemin":h?y:d[O-1]||y,"aria-valuenow":D,draggable:!1,ref:r.thumbRefs[O],role:"slider",onKeyDown:p?x.voidFn:r.onKeyDown,onKeyUp:p?x.voidFn:r.onKeyUp}})}),!0)})},n.defaultProps={step:1,direction:B.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},n}(pe.Component);Ee.default=Pt,function(t){var n=N&&N.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.checkValuesAgainstBoundaries=t.relativeValue=t.useThumbOverlap=t.Direction=t.getTrackBackground=t.Range=void 0;var r=n(Ee);t.Range=r.default;var e=Ie;Object.defineProperty(t,"getTrackBackground",{enumerable:!0,get:function(){return e.getTrackBackground}}),Object.defineProperty(t,"useThumbOverlap",{enumerable:!0,get:function(){return e.useThumbOverlap}}),Object.defineProperty(t,"relativeValue",{enumerable:!0,get:function(){return e.relativeValue}}),Object.defineProperty(t,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return e.checkValuesAgainstBoundaries}});var a=fe;Object.defineProperty(t,"Direction",{enumerable:!0,get:function(){return a.Direction}})}(De);function He(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function ge(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?He(Object(r),!0).forEach(function(e){jt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function jt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var me=Q("div",{position:"relative",width:"100%"});me.displayName="Root",me.displayName="Root",me.displayName="StyledRoot";var ve=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$disabled,i=t.$isDragged,s=n.sizing,u="inherit";return a?u="not-allowed":i?u="grabbing":e.length===1&&(u="pointer"),{paddingTop:s.scale600,paddingBottom:s.scale600,paddingRight:s.scale600,paddingLeft:s.scale600,display:"flex",cursor:u,backgroundColor:n.colors.sliderTrackFill}});ve.displayName="Track",ve.displayName="Track",ve.displayName="StyledTrack";var be=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$min,i=t.$max,s=t.$disabled,u=n.colors,d=n.borders,y=n.direction,f=n.borders.useRoundedCorners?d.radius100:0;return{borderTopLeftRadius:f,borderTopRightRadius:f,borderBottomRightRadius:f,borderBottomLeftRadius:f,background:De.getTrackBackground({values:e,colors:e.length===1?[s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque]:[s?u.backgroundSecondary:u.borderOpaque,s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque],min:a||0,max:i||0,rtl:y==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:s?"not-allowed":"inherit"}});be.displayName="InnerTrack",be.displayName="InnerTrack",be.displayName="StyledInnerTrack";var ye=Q("div",function(t){return{width:"4px",height:"2px",backgroundColor:t.$theme.colors.backgroundPrimary,marginLeft:"16px"}});ye.displayName="Mark",ye.displayName="Mark",ye.displayName="StyledMark";var we=Q("div",function(t){return ge(ge({},t.$theme.typography.font200),{},{color:t.$theme.colors.contentPrimary})});we.displayName="Tick",we.displayName="Tick",we.displayName="StyledTick";var Te=Q("div",function(t){var n=t.$theme,r=n.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:r.scale600,paddingLeft:r.scale600,paddingBottom:r.scale400}});Te.displayName="TickBar",Te.displayName="TickBar",Te.displayName="StyledTickBar";var xe=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$thumbIndex,i=t.$disabled,s=e.length===2&&a===0,u=e.length===2&&a===1;return n.direction==="rtl"&&(u||s)&&(s=!s,u=!u),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:i?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleFill,outline:"none",boxShadow:t.$isFocusVisible?"0 0 0 3px ".concat(n.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:i?"not-allowed":"inherit"}});xe.displayName="Thumb",xe.displayName="Thumb",xe.displayName="StyledThumb";var ke=Q("div",function(t){var n=t.$disabled,r=t.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill}});ke.displayName="InnerThumb",ke.displayName="InnerThumb",ke.displayName="StyledInnerThumb";var Oe=Q("div",function(t){var n=t.$disabled,r=t.$theme;return ge(ge({position:"absolute",top:"-".concat(r.sizing.scale1400)},r.typography.font200),{},{backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill,color:r.colors.contentInversePrimary,paddingLeft:r.sizing.scale600,paddingRight:r.sizing.scale600,paddingTop:r.sizing.scale500,paddingBottom:r.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Oe.displayName="ThumbValue",Oe.displayName="ThumbValue",Oe.displayName="StyledThumbValue";function Xe(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function Bt(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Xe(Object(r),!0).forEach(function(e){Lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Lt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function X(){return X=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},X.apply(this,arguments)}function K(t,n){return zt(t)||Ft(t,n)||$t(t,n)||At()}function At(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{e as N,r as k,b2 as Q,bs as dt,bd as ht,b3 as J,bt as ft,bu as pt,c as he,Q as gt,M as mt,a7 as vt,j as Y,R as Ne,bQ as bt,a_ as yt,a$ as wt,bc as Tt,b0 as xt,aK as kt,G as Ot,bR as Se}from"./index-z2lXC7XI.js";import{s as _e}from"./sprintf-C-r3gIuM.js";import{a as Rt}from"./useBasicWidgetState-CDQNZkN8.js";import"./FormClearHelper-DliGOSkq.js";var De={},Ee={},Ie={},fe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Direction=void 0,function(n){n.Right="to right",n.Left="to left",n.Down="to bottom",n.Up="to top"}(t.Direction||(t.Direction={}))})(fe),function(t){var n=N&&N.__spreadArray||function(o,c,l){if(l||arguments.length===2)for(var g=0,v=c.length,m;g<v;g++)(m||!(g in c))&&(m||(m=Array.prototype.slice.call(c,0,g)),m[g]=c[g]);return o.concat(m||Array.prototype.slice.call(c))};Object.defineProperty(t,"__esModule",{value:!0}),t.useThumbOverlap=t.assertUnreachable=t.voidFn=t.getTrackBackground=t.replaceAt=t.schd=t.translate=t.getClosestThumbIndex=t.translateThumbs=t.getPaddingAndBorder=t.getMargin=t.checkInitialOverlap=t.checkValuesAgainstBoundaries=t.checkBoundaries=t.isVertical=t.relativeValue=t.normalizeValue=t.isStepDivisible=t.isTouchEvent=t.getStepDecimals=void 0;var r=k,e=fe,a=function(o){var c=o.toString().split(".")[1];return c?c.length:0};t.getStepDecimals=a;function i(o){return o.touches&&o.touches.length||o.changedTouches&&o.changedTouches.length}t.isTouchEvent=i;function s(o,c,l){var g=(c-o)/l,v=8,m=Number(g.toFixed(v));return parseInt(m.toString(),10)===m}t.isStepDivisible=s;function u(o,c,l,g,v,m,T){var b=1e11;if(o=Math.round(o*b)/b,!m){var E=T[c-1],S=T[c+1];if(E&&E>o)return E;if(S&&S<o)return S}if(o>g)return g;if(o<l)return l;var _=Math.floor(o*b-l*b)%Math.floor(v*b),F=Math.floor(o*b-Math.abs(_)),U=_===0?o:F/b,j=Math.abs(_/b)<v/2?U:U+v,V=(0,t.getStepDecimals)(v);return parseFloat(j.toFixed(V))}t.normalizeValue=u;function d(o,c,l){return(o-c)/(l-c)}t.relativeValue=d;function y(o){return o===e.Direction.Up||o===e.Direction.Down}t.isVertical=y;function f(o,c,l){if(c>=l)throw new RangeError("min (".concat(c,") is equal/bigger than max (").concat(l,")"));if(o<c)throw new RangeError("value (".concat(o,") is smaller than min (").concat(c,")"));if(o>l)throw new RangeError("value (".concat(o,") is bigger than max (").concat(l,")"))}t.checkBoundaries=f;function h(o,c,l){return o<c?c:o>l?l:o}t.checkValuesAgainstBoundaries=h;function p(o){if(!(o.length<2)&&!o.slice(1).every(function(c,l){return o[l]<=c}))throw new RangeError("values={[".concat(o,"]} needs to be sorted when allowOverlap={false}"))}t.checkInitialOverlap=p;function R(o){var c=window.getComputedStyle(o);return{top:parseInt(c["margin-top"],10),bottom:parseInt(c["margin-bottom"],10),left:parseInt(c["margin-left"],10),right:parseInt(c["margin-right"],10)}}t.getMargin=R;function w(o){var c=window.getComputedStyle(o);return{top:parseInt(c["padding-top"],10)+parseInt(c["border-top-width"],10),bottom:parseInt(c["padding-bottom"],10)+parseInt(c["border-bottom-width"],10),left:parseInt(c["padding-left"],10)+parseInt(c["border-left-width"],10),right:parseInt(c["padding-right"],10)+parseInt(c["border-right-width"],10)}}t.getPaddingAndBorder=w;function M(o,c,l){var g=l?-1:1;o.forEach(function(v,m){return D(v,g*c[m].x,c[m].y)})}t.translateThumbs=M;function L(o,c,l,g){for(var v=0,m=$(o[0],c,l,g),T=1;T<o.length;T++){var b=$(o[T],c,l,g);b<m&&(m=b,v=T)}return v}t.getClosestThumbIndex=L;function D(o,c,l){o.style.transform="translate(".concat(c,"px, ").concat(l,"px)")}t.translate=D;var O=function(o){var c=[],l=null,g=function(){for(var v=[],m=0;m<arguments.length;m++)v[m]=arguments[m];c=v,!l&&(l=requestAnimationFrame(function(){l=null,o.apply(void 0,c)}))};return g};t.schd=O;function I(o,c,l){var g=o.slice(0);return g[c]=l,g}t.replaceAt=I;function q(o){var c=o.values,l=o.colors,g=o.min,v=o.max,m=o.direction,T=m===void 0?e.Direction.Right:m,b=o.rtl,E=b===void 0?!1:b;E&&T===e.Direction.Right?T=e.Direction.Left:E&&e.Direction.Left&&(T=e.Direction.Right);var S=c.slice(0).sort(function(F,U){return F-U}).map(function(F){return(F-g)/(v-g)*100}),_=S.reduce(function(F,U,j){return"".concat(F,", ").concat(l[j]," ").concat(U,"%, ").concat(l[j+1]," ").concat(U,"%")},"");return"linear-gradient(".concat(T,", ").concat(l[0]," 0%").concat(_,", ").concat(l[l.length-1]," 100%)")}t.getTrackBackground=q;function ee(){}t.voidFn=ee;function z(o){throw new Error("Didn't expect to get here")}t.assertUnreachable=z;var P=function(o,c,l,g,v){v===void 0&&(v=function(T){return T});var m=Math.ceil(n([o],Array.from(o.children),!0).reduce(function(T,b){var E=Math.ceil(b.getBoundingClientRect().width);if(b.innerText&&b.innerText.includes(l)&&b.childElementCount===0){var S=b.cloneNode(!0);S.innerHTML=v(c.toFixed(g)),S.style.visibility="hidden",document.body.appendChild(S),E=Math.ceil(S.getBoundingClientRect().width),document.body.removeChild(S)}return E>T?E:T},o.getBoundingClientRect().width));return m},Z=function(o,c,l,g,v,m,T){T===void 0&&(T=function(S){return S});var b=[],E=function(S){var _=P(l[S],g[S],v,m,T),F=c[S].x;c.forEach(function(U,j){var V=U.x,A=P(l[j],g[j],v,m,T);S!==j&&(F>=V&&F<=V+A||F+_>=V&&F+_<=V+A)&&(b.includes(j)||(b.push(S),b.push(j),b=n(n([],b,!0),[S,j],!1),E(j)))})};return E(o),Array.from(new Set(b.sort()))},G=function(o,c,l,g,v,m){g===void 0&&(g=.1),v===void 0&&(v=" - "),m===void 0&&(m=function(j){return j});var T=(0,t.getStepDecimals)(g),b=(0,r.useState)({}),E=b[0],S=b[1],_=(0,r.useState)(m(c[l].toFixed(T))),F=_[0],U=_[1];return(0,r.useEffect)(function(){if(o){var j=o.getThumbs();if(j.length<1)return;var V={},A=o.getOffsets(),re=Z(l,A,j,c,v,T,m),se=m(c[l].toFixed(T));if(re.length){var ae=re.reduce(function(te,le,ce,de){return te.length?n(n([],te,!0),[A[de[ce]].x],!1):[A[de[ce]].x]},[]);if(Math.min.apply(Math,ae)===A[l].x){var ie=[];re.forEach(function(te){ie.push(c[te].toFixed(T))}),se=Array.from(new Set(ie.sort(function(te,le){return parseFloat(te)-parseFloat(le)}))).map(m).join(v);var Re=Math.min.apply(Math,ae),ue=Math.max.apply(Math,ae),Me=j[re[ae.indexOf(ue)]].getBoundingClientRect().width;V.left="".concat(Math.abs(Re-(ue+Me))/2,"px"),V.transform="translate(-50%, 0)"}else V.visibility="hidden"}U(se),S(V)}},[o,c]),[F,E]};t.useThumbOverlap=G;function $(o,c,l,g){var v=o.getBoundingClientRect(),m=v.left,T=v.top,b=v.width,E=v.height;return y(g)?Math.abs(l-(T+E/2)):Math.abs(c-(m+b/2))}}(Ie);var Mt=N&&N.__extends||function(){var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])},t(n,r)};return function(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(n,r);function e(){this.constructor=n}n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}}(),St=N&&N.__createBinding||(Object.create?function(t,n,r,e){e===void 0&&(e=r);var a=Object.getOwnPropertyDescriptor(n,r);(!a||("get"in a?!n.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,e,a)}:function(t,n,r,e){e===void 0&&(e=r),t[e]=n[r]}),Dt=N&&N.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),Et=N&&N.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&St(n,t,r);return Dt(n,t),n},Ue=N&&N.__spreadArray||function(t,n,r){if(r||arguments.length===2)for(var e=0,a=n.length,i;e<a;e++)(i||!(e in n))&&(i||(i=Array.prototype.slice.call(n,0,e)),i[e]=n[e]);return t.concat(i||Array.prototype.slice.call(n))};Object.defineProperty(Ee,"__esModule",{value:!0});var pe=Et(k),x=Ie,B=fe,It=["ArrowRight","ArrowUp","k","PageUp"],Ct=["ArrowLeft","ArrowDown","j","PageDown"],Pt=function(t){Mt(n,t);function n(r){var e=t.call(this,r)||this;if(e.trackRef=pe.createRef(),e.thumbRefs=[],e.state={draggedTrackPos:[-1,-1],draggedThumbIndex:-1,thumbZIndexes:new Array(e.props.values.length).fill(0).map(function(a,i){return i}),isChanged:!1,markOffsets:[]},e.getOffsets=function(){var a=e.props,i=a.direction,s=a.values,u=a.min,d=a.max,y=e.trackRef.current,f=y.getBoundingClientRect(),h=(0,x.getPaddingAndBorder)(y);return e.getThumbs().map(function(p,R){var w={x:0,y:0},M=p.getBoundingClientRect(),L=(0,x.getMargin)(p);switch(i){case B.Direction.Right:return w.x=(L.left+h.left)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Left:return w.x=(L.right+h.right)*-1,w.y=((M.height-f.height)/2+h.top)*-1,w.x+=f.width-f.width*(0,x.relativeValue)(s[R],u,d)-M.width/2,w;case B.Direction.Up:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height-f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;case B.Direction.Down:return w.x=((M.width-f.width)/2+L.left+h.left)*-1,w.y=-h.left,w.y+=f.height*(0,x.relativeValue)(s[R],u,d)-M.height/2,w;default:return(0,x.assertUnreachable)(i)}})},e.getThumbs=function(){return e.trackRef&&e.trackRef.current?Array.from(e.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?"),[])},e.getTargetIndex=function(a){return e.getThumbs().findIndex(function(i){return i===a.target||i.contains(a.target)})},e.addTouchEvents=function(a){document.addEventListener("touchmove",e.schdOnTouchMove,{passive:!1}),document.addEventListener("touchend",e.schdOnEnd,{passive:!1}),document.addEventListener("touchcancel",e.schdOnEnd,{passive:!1})},e.addMouseEvents=function(a){document.addEventListener("mousemove",e.schdOnMouseMove),document.addEventListener("mouseup",e.schdOnEnd)},e.onMouseDownTrack=function(a){var i;if(a.button===0)if(a.persist(),a.preventDefault(),e.addMouseEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.clientX,a.clientY]},function(){return e.onMove(a.clientX,a.clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.clientX,a.clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.clientX,a.clientY)})}},e.onResize=function(){(0,x.translateThumbs)(e.getThumbs(),e.getOffsets(),e.props.rtl),e.calculateMarkOffsets()},e.onTouchStartTrack=function(a){var i;if(a.persist(),e.addTouchEvents(a.nativeEvent),e.props.values.length>1&&e.props.draggableTrack){if(e.thumbRefs.some(function(u){var d;return(d=u.current)===null||d===void 0?void 0:d.contains(a.target)}))return;e.setState({draggedTrackPos:[a.touches[0].clientX,a.touches[0].clientY]},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}else{var s=(0,x.getClosestThumbIndex)(e.thumbRefs.map(function(u){return u.current}),a.touches[0].clientX,a.touches[0].clientY,e.props.direction);(i=e.thumbRefs[s].current)===null||i===void 0||i.focus(),e.setState({draggedThumbIndex:s},function(){return e.onMove(a.touches[0].clientX,a.touches[0].clientY)})}},e.onMouseOrTouchStart=function(a){if(!e.props.disabled){var i=(0,x.isTouchEvent)(a);if(!(!i&&a.button!==0)){var s=e.getTargetIndex(a);s!==-1&&(i?e.addTouchEvents(a):e.addMouseEvents(a),e.setState({draggedThumbIndex:s,thumbZIndexes:e.state.thumbZIndexes.map(function(u,d){return d===s?Math.max.apply(Math,e.state.thumbZIndexes):u<=e.state.thumbZIndexes[s]?u:u-1})}))}}},e.onMouseMove=function(a){a.preventDefault(),e.onMove(a.clientX,a.clientY)},e.onTouchMove=function(a){a.preventDefault(),e.onMove(a.touches[0].clientX,a.touches[0].clientY)},e.onKeyDown=function(a){var i=e.props,s=i.values,u=i.onChange,d=i.step,y=i.rtl,f=i.direction,h=e.state.isChanged,p=e.getTargetIndex(a.nativeEvent),R=y||f===B.Direction.Left||f===B.Direction.Down?-1:1;p!==-1&&(It.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]+R*(a.key==="PageUp"?d*10:d),p)))):Ct.includes(a.key)?(a.preventDefault(),e.setState({draggedThumbIndex:p,isChanged:!0}),u((0,x.replaceAt)(s,p,e.normalizeValue(s[p]-R*(a.key==="PageDown"?d*10:d),p)))):a.key==="Tab"?e.setState({draggedThumbIndex:-1},function(){h&&e.fireOnFinalChange()}):h&&e.fireOnFinalChange())},e.onKeyUp=function(a){var i=e.state.isChanged;e.setState({draggedThumbIndex:-1},function(){i&&e.fireOnFinalChange()})},e.onMove=function(a,i){var s=e.state,u=s.draggedThumbIndex,d=s.draggedTrackPos,y=e.props,f=y.direction,h=y.min,p=y.max,R=y.onChange,w=y.values,M=y.step,L=y.rtl;if(u===-1&&d[0]===-1&&d[1]===-1)return null;var D=e.trackRef.current;if(!D)return null;var O=D.getBoundingClientRect(),I=(0,x.isVertical)(f)?O.height:O.width;if(d[0]!==-1&&d[1]!==-1){var q=a-d[0],ee=i-d[1],z=0;switch(f){case B.Direction.Right:case B.Direction.Left:z=q/I*(p-h);break;case B.Direction.Down:case B.Direction.Up:z=ee/I*(p-h);break;default:(0,x.assertUnreachable)(f)}if(L&&(z*=-1),Math.abs(z)>=M/2){for(var P=0;P<e.thumbRefs.length;P++){if(w[P]===p&&Math.sign(z)===1||w[P]===h&&Math.sign(z)===-1)return;var Z=w[P]+z;Z>p?z=p-w[P]:Z<h&&(z=h-w[P])}for(var G=w.slice(0),P=0;P<e.thumbRefs.length;P++)G=(0,x.replaceAt)(G,P,e.normalizeValue(w[P]+z,P));e.setState({draggedTrackPos:[a,i]}),R(G)}}else{var $=0;switch(f){case B.Direction.Right:$=(a-O.left)/I*(p-h)+h;break;case B.Direction.Left:$=(I-(a-O.left))/I*(p-h)+h;break;case B.Direction.Down:$=(i-O.top)/I*(p-h)+h;break;case B.Direction.Up:$=(I-(i-O.top))/I*(p-h)+h;break;default:(0,x.assertUnreachable)(f)}L&&($=p+h-$),Math.abs(w[u]-$)>=M/2&&R((0,x.replaceAt)(w,u,e.normalizeValue($,u)))}},e.normalizeValue=function(a,i){var s=e.props,u=s.min,d=s.max,y=s.step,f=s.allowOverlap,h=s.values;return(0,x.normalizeValue)(a,i,u,d,y,f,h)},e.onEnd=function(a){if(a.preventDefault(),document.removeEventListener("mousemove",e.schdOnMouseMove),document.removeEventListener("touchmove",e.schdOnTouchMove),document.removeEventListener("mouseup",e.schdOnEnd),document.removeEventListener("touchend",e.schdOnEnd),document.removeEventListener("touchcancel",e.schdOnEnd),e.state.draggedThumbIndex===-1&&e.state.draggedTrackPos[0]===-1&&e.state.draggedTrackPos[1]===-1)return null;e.setState({draggedThumbIndex:-1,draggedTrackPos:[-1,-1]},function(){e.fireOnFinalChange()})},e.fireOnFinalChange=function(){e.setState({isChanged:!1});var a=e.props,i=a.onFinalChange,s=a.values;i&&i(s)},e.updateMarkRefs=function(a){if(!a.renderMark){e.numOfMarks=void 0,e.markRefs=void 0;return}e.numOfMarks=(a.max-a.min)/e.props.step,e.markRefs=[];for(var i=0;i<e.numOfMarks+1;i++)e.markRefs[i]=pe.createRef()},e.calculateMarkOffsets=function(){if(!(!e.props.renderMark||!e.trackRef||!e.numOfMarks||!e.markRefs||e.trackRef.current===null)){for(var a=window.getComputedStyle(e.trackRef.current),i=parseInt(a.width,10),s=parseInt(a.height,10),u=parseInt(a.paddingLeft,10),d=parseInt(a.paddingTop,10),y=[],f=0;f<e.numOfMarks+1;f++){var h=9999,p=9999;if(e.markRefs[f].current){var R=e.markRefs[f].current.getBoundingClientRect();h=R.height,p=R.width}e.props.direction===B.Direction.Left||e.props.direction===B.Direction.Right?y.push([Math.round(i/e.numOfMarks*f+u-p/2),-Math.round((h-s)/2)]):y.push([Math.round(s/e.numOfMarks*f+d-h/2),-Math.round((p-i)/2)])}e.setState({markOffsets:y})}},r.step===0)throw new Error('"step" property should be a positive number');return e.schdOnMouseMove=(0,x.schd)(e.onMouseMove),e.schdOnTouchMove=(0,x.schd)(e.onTouchMove),e.schdOnEnd=(0,x.schd)(e.onEnd),e.thumbRefs=r.values.map(function(){return pe.createRef()}),e.updateMarkRefs(r),e}return n.prototype.componentDidMount=function(){var r=this,e=this.props,a=e.values,i=e.min,s=e.step;this.resizeObserver=window.ResizeObserver?new window.ResizeObserver(this.onResize):{observe:function(){return window.addEventListener("resize",r.onResize)},unobserve:function(){return window.removeEventListener("resize",r.onResize)}},document.addEventListener("touchstart",this.onMouseOrTouchStart,{passive:!1}),document.addEventListener("mousedown",this.onMouseOrTouchStart,{passive:!1}),!this.props.allowOverlap&&(0,x.checkInitialOverlap)(this.props.values),this.props.values.forEach(function(u){return(0,x.checkBoundaries)(u,r.props.min,r.props.max)}),this.resizeObserver.observe(this.trackRef.current),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),this.props.rtl),this.calculateMarkOffsets(),a.forEach(function(u){(0,x.isStepDivisible)(i,u,s)||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.")})},n.prototype.componentDidUpdate=function(r,e){var a=this.props,i=a.max,s=a.min,u=a.step,d=a.values,y=a.rtl;(r.max!==i||r.min!==s||r.step!==u)&&this.updateMarkRefs(this.props),(0,x.translateThumbs)(this.getThumbs(),this.getOffsets(),y),(r.max!==i||r.min!==s||r.step!==u||e.markOffsets.length!==this.state.markOffsets.length)&&(this.calculateMarkOffsets(),d.forEach(function(f){(0,x.isStepDivisible)(s,f,u)||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.")}))},n.prototype.componentWillUnmount=function(){var r={passive:!1};document.removeEventListener("mousedown",this.onMouseOrTouchStart,r),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)},n.prototype.render=function(){var r=this,e=this.props,a=e.renderTrack,i=e.renderThumb,s=e.renderMark,u=s===void 0?function(){return null}:s,d=e.values,y=e.min,f=e.max,h=e.allowOverlap,p=e.disabled,R=this.state,w=R.draggedThumbIndex,M=R.thumbZIndexes,L=R.markOffsets;return a({props:{style:{transform:"scale(1)",cursor:w>-1?"grabbing":this.props.draggableTrack?(0,x.isVertical)(this.props.direction)?"ns-resize":"ew-resize":d.length===1&&!p?"pointer":"inherit"},onMouseDown:p?x.voidFn:this.onMouseDownTrack,onTouchStart:p?x.voidFn:this.onTouchStartTrack,ref:this.trackRef},isDragged:this.state.draggedThumbIndex>-1,disabled:p,children:Ue(Ue([],L.map(function(D,O,I){return u({props:{style:r.props.direction===B.Direction.Left||r.props.direction===B.Direction.Right?{position:"absolute",left:"".concat(D[0],"px"),marginTop:"".concat(D[1],"px")}:{position:"absolute",top:"".concat(D[0],"px"),marginLeft:"".concat(D[1],"px")},key:"mark".concat(O),ref:r.markRefs[O]},index:O})}),!0),d.map(function(D,O){var I=r.state.draggedThumbIndex===O;return i({index:O,value:D,isDragged:I,props:{style:{position:"absolute",zIndex:M[O],cursor:p?"inherit":I?"grabbing":"grab",userSelect:"none",touchAction:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},key:O,tabIndex:p?void 0:0,"aria-valuemax":h?f:d[O+1]||f,"aria-valuemin":h?y:d[O-1]||y,"aria-valuenow":D,draggable:!1,ref:r.thumbRefs[O],role:"slider",onKeyDown:p?x.voidFn:r.onKeyDown,onKeyUp:p?x.voidFn:r.onKeyUp}})}),!0)})},n.defaultProps={step:1,direction:B.Direction.Right,rtl:!1,disabled:!1,allowOverlap:!1,draggableTrack:!1,min:0,max:100},n}(pe.Component);Ee.default=Pt,function(t){var n=N&&N.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.checkValuesAgainstBoundaries=t.relativeValue=t.useThumbOverlap=t.Direction=t.getTrackBackground=t.Range=void 0;var r=n(Ee);t.Range=r.default;var e=Ie;Object.defineProperty(t,"getTrackBackground",{enumerable:!0,get:function(){return e.getTrackBackground}}),Object.defineProperty(t,"useThumbOverlap",{enumerable:!0,get:function(){return e.useThumbOverlap}}),Object.defineProperty(t,"relativeValue",{enumerable:!0,get:function(){return e.relativeValue}}),Object.defineProperty(t,"checkValuesAgainstBoundaries",{enumerable:!0,get:function(){return e.checkValuesAgainstBoundaries}});var a=fe;Object.defineProperty(t,"Direction",{enumerable:!0,get:function(){return a.Direction}})}(De);function He(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function ge(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?He(Object(r),!0).forEach(function(e){jt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function jt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var me=Q("div",{position:"relative",width:"100%"});me.displayName="Root",me.displayName="Root",me.displayName="StyledRoot";var ve=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$disabled,i=t.$isDragged,s=n.sizing,u="inherit";return a?u="not-allowed":i?u="grabbing":e.length===1&&(u="pointer"),{paddingTop:s.scale600,paddingBottom:s.scale600,paddingRight:s.scale600,paddingLeft:s.scale600,display:"flex",cursor:u,backgroundColor:n.colors.sliderTrackFill}});ve.displayName="Track",ve.displayName="Track",ve.displayName="StyledTrack";var be=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$min,i=t.$max,s=t.$disabled,u=n.colors,d=n.borders,y=n.direction,f=n.borders.useRoundedCorners?d.radius100:0;return{borderTopLeftRadius:f,borderTopRightRadius:f,borderBottomRightRadius:f,borderBottomLeftRadius:f,background:De.getTrackBackground({values:e,colors:e.length===1?[s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque]:[s?u.backgroundSecondary:u.borderOpaque,s?u.borderOpaque:u.primary,s?u.backgroundSecondary:u.borderOpaque],min:a||0,max:i||0,rtl:y==="rtl"}),height:"2px",width:"100%",alignSelf:"center",cursor:s?"not-allowed":"inherit"}});be.displayName="InnerTrack",be.displayName="InnerTrack",be.displayName="StyledInnerTrack";var ye=Q("div",function(t){return{width:"4px",height:"2px",backgroundColor:t.$theme.colors.backgroundPrimary,marginLeft:"16px"}});ye.displayName="Mark",ye.displayName="Mark",ye.displayName="StyledMark";var we=Q("div",function(t){return ge(ge({},t.$theme.typography.font200),{},{color:t.$theme.colors.contentPrimary})});we.displayName="Tick",we.displayName="Tick",we.displayName="StyledTick";var Te=Q("div",function(t){var n=t.$theme,r=n.sizing;return{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:r.scale600,paddingLeft:r.scale600,paddingBottom:r.scale400}});Te.displayName="TickBar",Te.displayName="TickBar",Te.displayName="StyledTickBar";var xe=Q("div",function(t){var n=t.$theme,r=t.$value,e=r===void 0?[]:r,a=t.$thumbIndex,i=t.$disabled,s=e.length===2&&a===0,u=e.length===2&&a===1;return n.direction==="rtl"&&(u||s)&&(s=!s,u=!u),{height:"24px",width:"24px",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:i?n.colors.sliderHandleFillDisabled:n.colors.sliderHandleFill,outline:"none",boxShadow:t.$isFocusVisible?"0 0 0 3px ".concat(n.colors.accent):"0 1px 4px rgba(0, 0, 0, 0.12)",cursor:i?"not-allowed":"inherit"}});xe.displayName="Thumb",xe.displayName="Thumb",xe.displayName="StyledThumb";var ke=Q("div",function(t){var n=t.$disabled,r=t.$theme;return{position:"absolute",top:"-16px",width:"4px",height:"20px",backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill}});ke.displayName="InnerThumb",ke.displayName="InnerThumb",ke.displayName="StyledInnerThumb";var Oe=Q("div",function(t){var n=t.$disabled,r=t.$theme;return ge(ge({position:"absolute",top:"-".concat(r.sizing.scale1400)},r.typography.font200),{},{backgroundColor:n?r.colors.sliderHandleFillDisabled:r.colors.sliderHandleInnerFill,color:r.colors.contentInversePrimary,paddingLeft:r.sizing.scale600,paddingRight:r.sizing.scale600,paddingTop:r.sizing.scale500,paddingBottom:r.sizing.scale500,borderBottomLeftRadius:"48px",borderBottomRightRadius:"48px",borderTopLeftRadius:"48px",borderTopRightRadius:"48px",whiteSpace:"nowrap"})});Oe.displayName="ThumbValue",Oe.displayName="ThumbValue",Oe.displayName="StyledThumbValue";function Xe(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,e)}return r}function Bt(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Xe(Object(r),!0).forEach(function(e){Lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Lt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function X(){return X=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},X.apply(this,arguments)}function K(t,n){return zt(t)||Ft(t,n)||$t(t,n)||At()}function At(){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 $t(t,n){if(t){if(typeof t=="string")return Ke(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ke(t,n)}}function Ke(t,n){(n==null||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}function Ft(t,n){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var e=[],a=!0,i=!1,s,u;try{for(r=r.call(t);!(a=(s=r.next()).done)&&(e.push(s.value),!(n&&e.length===n));a=!0);}catch(d){i=!0,u=d}finally{try{!a&&r.return!=null&&r.return()}finally{if(i)throw u}}return e}}function zt(t){if(Array.isArray(t))return t}var Vt=function(t){if(t.length>2||t.length===0)throw new Error("the value prop represents positions of thumbs, so its length can be only one or two");return t};function Nt(t){var n=t.overrides,r=n===void 0?{}:n,e=t.disabled,a=e===void 0?!1:e,i=t.marks,s=i===void 0?!1:i,u=t.onChange,d=u===void 0?function(){}:u,y=t.onFinalChange,f=y===void 0?function(){}:y,h=t.min,p=h===void 0?0:h,R=t.max,w=R===void 0?100:R,M=t.step,L=M===void 0?1:M,D=t.persistentThumb,O=D===void 0?!1:D,I=t.valueToLabel,q=I===void 0?function(C){return C}:I,ee=t.value,z=k.useContext(dt),P=k.useState(!1),Z=K(P,2),G=Z[0],$=Z[1],o=k.useState(!1),c=K(o,2),l=c[0],g=c[1],v=k.useState(!1),m=K(v,2),T=m[0],b=m[1],E=k.useState(-1),S=K(E,2),_=S[0],F=S[1],U=k.useCallback(function(C){ht(C)&&b(!0);var W=C.target.parentNode.firstChild===C.target?0:1;F(W)},[]),j=k.useCallback(function(C){T!==!1&&b(!1),F(-1)},[]),V=Vt(ee),A={$disabled:a,$step:L,$min:p,$max:w,$marks:s,$value:V,$isFocusVisible:T},re=J(r.Root,me),se=K(re,2),ae=se[0],ie=se[1],Re=J(r.Track,ve),ue=K(Re,2),Me=ue[0],te=ue[1],le=J(r.InnerTrack,be),ce=K(le,2),de=ce[0],Ye=ce[1],qe=J(r.Thumb,xe),Pe=K(qe,2),Ze=Pe[0],Ge=Pe[1],Qe=J(r.InnerThumb,ke),je=K(Qe,2),Je=je[0],et=je[1],tt=J(r.ThumbValue,Oe),Be=K(tt,2),nt=Be[0],rt=Be[1],at=J(r.Tick,we),Le=K(at,2),Ae=Le[0],$e=Le[1],it=J(r.TickBar,Te),Fe=K(it,2),ot=Fe[0],st=Fe[1],ut=J(r.Mark,ye),ze=K(ut,2),ct=ze[0],lt=ze[1];return k.createElement(ae,X({"data-baseweb":"slider"},A,ie,{onFocus:ft(ie,U),onBlur:pt(ie,j)}),k.createElement(De.Range,X({step:L,min:p,max:w,values:V,disabled:a,onChange:function(C){return d({value:C})},onFinalChange:function(C){return f({value:C})},rtl:z.direction==="rtl",renderTrack:function(C){var W=C.props,H=C.children,ne=C.isDragged;return k.createElement(Me,X({onMouseDown:W.onMouseDown,onTouchStart:W.onTouchStart,$isDragged:ne},A,te),k.createElement(de,X({$isDragged:ne,ref:W.ref},A,Ye),H))},renderThumb:function(C){var W=C.props,H=C.index,ne=C.isDragged,Ve=O||(!!H&&l||!H&&G||ne)&&!a;return k.createElement(Ze,X({},W,{onMouseEnter:function(){H===0?$(!0):g(!0)},onMouseLeave:function(){H===0?$(!1):g(!1)},$thumbIndex:H,$isDragged:ne,style:Bt({},W.style)},A,Ge,{$isFocusVisible:T&&_===H}),Ve&&k.createElement(nt,X({$thumbIndex:H,$isDragged:ne},A,rt),q(V[H])),Ve&&k.createElement(Je,X({$thumbIndex:H,$isDragged:ne},A,et)))}},s?{renderMark:function(C){var W=C.props,H=C.index;return k.createElement(ct,X({$markIndex:H},W,A,lt))}}:{})),k.createElement(ot,X({},A,st),k.createElement(Ae,X({},A,$e),q(p)),k.createElement(Ae,X({},A,$e),q(w))))}const _t=he("div",{target:"ew7r33m3"})(({disabled:t,theme:n})=>({alignItems:"center",backgroundColor:t?n.colors.gray:n.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",justifyContent:"center",height:n.sizes.sliderThumb,width:n.sizes.sliderThumb,":focus":{outline:"none"},":focus-visible":{boxShadow:`0 0 0 0.2rem ${gt(n.colors.primary,.5)}`}}),""),Ut=he("div",{target:"ew7r33m2"})(({disabled:t,theme:n})=>({fontFamily:n.genericFonts.codeFont,fontSize:n.fontSizes.sm,color:t?n.colors.gray:n.colors.primary,top:"-1.6em",position:"absolute",whiteSpace:"nowrap",backgroundColor:n.colors.transparent,lineHeight:n.lineHeights.base,fontWeight:n.fontWeights.normal,pointerEvents:"none"}),""),Ht=he("div",{target:"ew7r33m1"})(({theme:t})=>({fontSize:t.fontSizes.sm,paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:"0.65em",justifyContent:"space-between",alignItems:"center",display:"flex"}),""),We=he("div",{target:"ew7r33m0"})(({disabled:t,theme:n})=>({lineHeight:n.lineHeights.base,fontWeight:n.fontWeights.normal,fontFamily:n.genericFonts.codeFont,color:t?n.colors.fadedText40:"inherit"}),""),Xt=200;function Kt({disabled:t,element:n,widgetMgr:r,width:e,fragmentId:a}){var $;const[i,s]=Rt({getStateFromWidgetMgr:Wt,getDefaultStateFromProto:Yt,getCurrStateFromProto:qt,updateWidgetMgrState:Zt,element:n,widgetMgr:r,fragmentId:a}),[u,d]=k.useState(i),y=k.useRef(null),[f]=k.useState([]),[h]=k.useState([]),{colors:p,fonts:R,fontSizes:w,spacing:M}=mt(),L={width:e},D=u.map(o=>Ce(o,n)),O=Ce(n.min,n),I=Ce(n.max,n),q=n.label;k.useEffect(()=>{d(i)},[i]);const ee=k.useCallback(vt(Xt,o=>{s({value:o,fromUi:!0})}),[]),z=k.useCallback(({value:o})=>{d(o),ee(o)},[ee]),P=k.useCallback(()=>Y.jsxs(Ht,{"data-testid":"stSliderTickBar",children:[Y.jsx(We,{disabled:t,"data-testid":"stSliderTickBarMin",children:O}),Y.jsx(We,{disabled:t,"data-testid":"stSliderTickBarMax",children:I})]}),[O,I,t]),Z=k.useCallback(Ne.forwardRef(function(o,c){const{$thumbIndex:l}=o,g=l||0;f[g]=c,h[g]||(h[g]=Ne.createRef());const v=bt(o,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]),m=D[g];return Y.jsx(_t,{...v,disabled:o.$disabled===!0,ref:f[g],"aria-valuetext":m,"aria-label":q,children:Y.jsx(Ut,{"data-testid":"stSliderThumbValue",disabled:o.$disabled===!0,ref:h[g],children:m})})}),[]);k.useEffect(()=>{var m,T;h.map((b,E)=>{b.current&&(b.current.innerText=D[E])}),f.map((b,E)=>{b.current&&b.current.setAttribute("aria-valuetext",D[E])});const o=y.current??null,c=f[0].current,l=(m=f[1])==null?void 0:m.current,g=h[0].current,v=(T=h[1])==null?void 0:T.current;Jt(o,c,l,g,v)});const G=k.useCallback(({$disabled:o})=>({height:M.twoXS,...o?{background:p.darkenedBgMix25}:{}}),[p,M]);return Y.jsxs("div",{ref:y,className:"stSlider","data-testid":"stSlider",style:L,children:[Y.jsx(yt,{label:n.label,disabled:t,labelVisibility:wt(($=n.labelVisibility)==null?void 0:$.value),children:n.help&&Y.jsx(Tt,{children:Y.jsx(xt,{content:n.help,placement:kt.TOP_RIGHT})})}),Y.jsx(Nt,{min:n.min,max:n.max,step:n.step,value:Qt(u,n),onChange:z,disabled:t,overrides:{Thumb:Z,Tick:{style:{fontFamily:R.monospace}},Track:{style:{backgroundColor:"none !important",paddingBottom:M.none,paddingLeft:M.none,paddingRight:M.none,paddingTop:`calc(${w.sm} * 1.35)`}},InnerTrack:{style:G},TickBar:P}})]})}function Wt(t,n){return t.getDoubleArrayValue(n)}function Yt(t){return t.default}function qt(t){return t.value}function Zt(t,n,r,e){n.setDoubleArrayValue(t,r.value,{fromUi:r.fromUi},e)}function Gt(t){const{dataType:n}=t;return n===Se.DataType.DATETIME||n===Se.DataType.DATE||n===Se.DataType.TIME}function Ce(t,n){const{format:r,options:e}=n;return Gt(n)?Ot.utc(t/1e3).format(r):e.length>0?_e.sprintf(r,e[t]):_e.sprintf(r,t)}function Qt(t,n){const{min:r,max:e}=n;let a=t[0],i=t.length>1?t[1]:t[0];return a>i&&(a=i),a<r&&(a=r),a>e&&(a=e),i<r&&(i=r),i>e&&(i=e),t.length>1?[a,i]:[a]}function Jt(t,n,r,e,a){!t||!n||!e||(oe(t,n,e),r&&a&&(oe(t,r,a),en(t,n,r,e,a)))}function oe(t,n,r){const e=t.getBoundingClientRect(),a=n.getBoundingClientRect(),i=r.getBoundingClientRect(),s=a.left+a.width/2,u=s-i.width/2<e.left,d=s+i.width/2>e.right;r.style.left=u?"0":"",r.style.right=d?"0":""}function en(t,n,r,e,a){const i=t.getBoundingClientRect(),s=n.getBoundingClientRect(),u=r.getBoundingClientRect(),d=e.getBoundingClientRect(),y=a.getBoundingClientRect(),f=i.left+i.width/2,h=s.left+s.width/2,p=u.left+u.width/2,R=h-d.width/2>=i.left,w=p+y.width/2<=i.right,M=s.left-d.width>=i.left,L=u.right+y.width<=i.right,D=R?d.width/2:d.width,O=w?y.width/2:y.width,I=h+D;if(p-O-I>24){oe(t,n,e),oe(t,r,a);return}if(M&&L){e.style.left="",e.style.right=`${Math.round(s.width)}px`,a.style.left=`${Math.round(u.width)}px`,a.style.right="";return}h<f?(oe(t,n,e),a.style.left=`${Math.round(h+D+24-p)}px`,a.style.right=""):(oe(t,r,a),e.style.left="",e.style.right=`${-Math.round(p-O-24-h)}px`)}const tn=k.memo(Kt);export{tn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,ak as y,r as s,j as i,al as w,a2 as S,am as t,an as T,ao as v,a5 as z}from"./index-
|
|
1
|
+
import{c as p,ak as y,r as s,j as i,al as w,a2 as S,am as t,an as T,ao as v,a5 as z}from"./index-z2lXC7XI.js";const R=p("button",{target:"elibz2u3"})(({theme:e})=>({fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.base,color:e.colors.fadedText60,backgroundColor:e.colors.transparent,fontFamily:"inherit",margin:e.spacing.none,border:"none",boxShadow:"none",padding:e.spacing.none,"&:hover, &:active, &:focus":{border:"none",outline:"none",boxShadow:"none"},"&:hover":{color:e.colors.primary}}),""),j=p("div",{target:"elibz2u2"})(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing.lg,"> span":{marginTop:e.spacing.twoXS}}),""),k=p("div",{target:"elibz2u0"})(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing.sm,alignItems:"start",justifyContent:"center",overflow:"hidden",minHeight:"100%",fontSize:e.fontSizes.sm,lineHeight:e.lineHeights.base,div:{display:"inline-flex"}}),"");function B(e){const o=z(e);return{Body:{props:{"data-testid":"stToast",className:"stToast"},style:{display:"flex",flexDirection:"row",gap:e.spacing.md,width:e.sizes.toastWidth,marginTop:e.spacing.sm,borderTopLeftRadius:e.radii.default,borderTopRightRadius:e.radii.default,borderBottomLeftRadius:e.radii.default,borderBottomRightRadius:e.radii.default,paddingTop:e.spacing.lg,paddingBottom:e.spacing.lg,paddingLeft:e.spacing.twoXL,paddingRight:e.spacing.twoXL,backgroundColor:o?e.colors.gray10:e.colors.gray90,color:e.colors.bodyText,boxShadow:o?"0px 4px 16px rgba(0, 0, 0, 0.16)":"0px 4px 16px rgba(0, 0, 0, 0.7)"}},CloseIcon:{style:{color:e.colors.fadedText40,width:e.fontSizes.lg,height:e.fontSizes.lg,marginRight:`calc(-1 * ${e.spacing.lg} / 2)`,":hover":{color:e.colors.bodyText}}}}}function C(e){if(e.length>104){let o=e.replace(/^(.{104}[^\s]*).*/,"$1");return o.length>104&&(o=o.substring(0,104).split(" ").slice(0,-1).join(" ")),o.trim()}return e}function L({theme:e,body:o,icon:n,width:h}){const r=C(o),d=o!==r,[a,m]=s.useState(!d),[u,b]=s.useState(0),f=s.useCallback(()=>{m(!a)},[a]),l=s.useMemo(()=>B(e),[e]),c=s.useMemo(()=>i.jsxs(j,{expanded:a,children:[n&&i.jsx(w,{iconValue:n,size:"xl",testid:"stToastDynamicIcon"}),i.jsxs(k,{children:[i.jsx(S,{source:a?o:r,allowHTML:!1,isToast:!0}),d&&i.jsx(R,{"data-testid":"stToastViewButton",onClick:f,children:a?"view less":"view more"})]})]}),[d,a,o,n,r,f]);s.useEffect(()=>{if(e.inSidebar)return;const g=t.info(c,{overrides:{...l}});return b(g),()=>{t.update(g,{overrides:{Body:{style:{transitionDuration:0}}}}),t.clear(g)}},[]),s.useEffect(()=>{t.update(u,{children:c,overrides:{...l}})},[u,c,l]);const x=i.jsx(T,{kind:v.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.",width:h});return i.jsx(i.Fragment,{children:e.inSidebar&&x})}const D=y(L);export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as V,r as i,M as k,bZ as x,j as s,a_ as z,a$ as P,bc as D,b0 as E,aK as H,b$ as M}from"./index-
|
|
1
|
+
import{c as V,r as i,M as k,bZ as x,j as s,a_ as z,a$ as P,bc as D,b0 as E,aK as H,b$ as M}from"./index-z2lXC7XI.js";import{u as U}from"./uniqueId-C3qA3EXY.js";import{u as _,a as B,b as L}from"./useOnInputChange-FEZNS9DP.js";import{a as K}from"./useBasicWidgetState-CDQNZkN8.js";import{I as O}from"./InputInstructions-BQD8A2_u.js";import{I as $}from"./input-Dhep7xP0.js";import"./inputUtils-CptNuJwn.js";import"./FormClearHelper-DliGOSkq.js";import"./base-input-DJ1o9wy-.js";const A=V("div",{target:"e11y4ecf0"})(({width:t})=>({position:"relative",width:t}),"");function G({disabled:t,element:e,widgetMgr:r,width:d,fragmentId:h}){var b;const[l,n]=i.useState(I(r,e)??null),[o,u]=i.useState(!1),S=i.useCallback(()=>{n(e.default??null),u(!0)},[e.default]),[W,m]=K({getStateFromWidgetMgr:I,getDefaultStateFromProto:N,getCurrStateFromProto:Z,updateWidgetMgrState:q,element:e,widgetMgr:r,fragmentId:h,onFormCleared:S});_(W,l,n,o);const[y,g]=i.useState(!1),a=k(),[c]=i.useState(()=>U("text_input_")),{placeholder:C,formId:f}=e,p=i.useCallback(()=>{u(!1),m({value:l,fromUi:!0})},[l,m]),T=x({formId:f})?r.allowFormEnterToSubmit(f):o,v=y&&d>a.breakpoints.hideWidgetDetails,w=i.useCallback(()=>{o&&p(),g(!1)},[o,p]),F=i.useCallback(()=>{g(!0)},[]),j=B({formId:e.formId,maxChars:e.maxChars,setDirty:u,setUiValue:n,setValueWithSource:m}),R=L(e.formId,p,o,r,h);return s.jsxs(A,{className:"stTextInput","data-testid":"stTextInput",width:d,children:[s.jsx(z,{label:e.label,disabled:t,labelVisibility:P((b=e.labelVisibility)==null?void 0:b.value),htmlFor:c,children:e.help&&s.jsx(D,{children:s.jsx(E,{content:e.help,placement:H.TOP_RIGHT})})}),s.jsx($,{value:l??"",placeholder:C,onBlur:w,onFocus:F,onChange:j,onKeyPress:R,"aria-label":e.label,disabled:t,id:c,type:J(e),autoComplete:e.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:a.lineHeights.inputWidget,paddingRight:a.spacing.sm,paddingLeft:a.spacing.sm,paddingBottom:a.spacing.sm,paddingTop:a.spacing.sm}},Root:{props:{"data-testid":"stTextInputRootElement"},style:{height:a.sizes.minElementHeight,borderLeftWidth:a.sizes.borderWidth,borderRightWidth:a.sizes.borderWidth,borderTopWidth:a.sizes.borderWidth,borderBottomWidth:a.sizes.borderWidth}}}}),v&&s.jsx(O,{dirty:o,value:l??"",maxLength:e.maxChars,inForm:x({formId:e.formId}),allowEnterToSubmit:T})]})}function I(t,e){return t.getStringValue(e)??null}function N(t){return t.default??null}function Z(t){return t.value??null}function q(t,e,r,d){e.setStringValue(t,r.value,{fromUi:r.fromUi},d)}function J(t){return t.type===M.Type.PASSWORD?"password":"text"}export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,E as P,_ as $,c as R,ak as se,bZ as ne,F as K,c7 as y,B as m,j as l,a_ as de,a$ as ue,bc as ce,b0 as pe,aK as me,aY as G}from"./index-
|
|
1
|
+
import{r,E as P,_ as $,c as R,ak as se,bZ as ne,F as K,c7 as y,B as m,j as l,a_ as de,a$ as ue,bc as ce,b0 as pe,aK as me,aY as G}from"./index-z2lXC7XI.js";import{s as be}from"./sprintf-C-r3gIuM.js";import{u as ge}from"./uniqueId-C3qA3EXY.js";import{u as fe}from"./FormClearHelper-DliGOSkq.js";import{I as he}from"./InputInstructions-BQD8A2_u.js";import{I as ye}from"./input-Dhep7xP0.js";import"./base-input-DJ1o9wy-.js";var X=r.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(P,$({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),r.createElement("path",{d:"M0 3v2h8V3H0z"}))});X.displayName="Minus";var Y=r.forwardRef(function(e,t){var a={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return r.createElement(P,$({iconAttrs:a,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),r.createElement("path",{d:"M3 0v3H0v2h3v3h2V5h3V3H5V0H3z"}))});Y.displayName="Plus";const we=R("div",{target:"e116k4er3"})(({theme:e})=>({display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:e.sizes.minElementHeight,borderWidth:e.sizes.borderWidth,borderStyle:"solid",borderColor:e.colors.widgetBorderColor||e.colors.widgetBackgroundColor||e.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:e.radii.default,overflow:"hidden","&.focused":{borderColor:e.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:e.spacing.none}}}),""),ve=R("div",{target:"e116k4er2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),Z=R("button",{target:"e116k4er1"})(({theme:e})=>({margin:e.spacing.none,border:"none",height:e.sizes.full,display:"flex",alignItems:"center",width:e.sizes.numberInputControlsWidth,justifyContent:"center",color:e.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:e.colors.widgetBackgroundColor||e.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:e.colors.white,backgroundColor:e.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:e.radii.default,borderBottomRightRadius:e.radii.default},"&:disabled":{cursor:"not-allowed",color:e.colors.fadedText40}}),""),xe=R("div",{target:"e116k4er0"})(({theme:e,clearable:t})=>({position:"absolute",marginRight:e.spacing.twoXS,left:0,right:`calc(${e.sizes.numberInputControlsWidth} * 2 + ${t?"1em":"0em"})`}),"");function Ie(e){return m(e)||e===""?void 0:e}const Te=e=>(e.element.dataType===y.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element))??e.element.default??null,q=({step:e,dataType:t})=>e||(t===y.DataType.INT?1:.01),N=({value:e,format:t,step:a,dataType:w})=>{if(m(e))return null;let i=Ie(t);if(m(i)&&K(a)){const c=a.toString();w===y.DataType.FLOAT&&a!==0&&c.includes(".")&&(i=`%0.${c.split(".")[1].length}f`)}if(m(i))return e.toString();try{return be.sprintf(i,e)}catch{return String(e)}},ke=(e,t,a)=>m(e)?!1:e-t>=a,Ce=(e,t,a)=>m(e)?!1:e+t<=a,Re=({disabled:e,element:t,widgetMgr:a,width:w,theme:i,fragmentId:c})=>{var O;const{dataType:S,id:V,formId:p,default:B,format:F}=t,b=t.hasMin?t.min:-1/0,g=t.hasMax?t.max:1/0,[s,J]=r.useState(q(t)),M=Te({element:t,widgetMgr:a}),[f,v]=r.useState(!1),[n,x]=r.useState(M),[W,I]=r.useState(N({value:M,...t,step:s})),[A,U]=r.useState(!1),j=r.useRef(null),H=r.useRef(ge("number_input_")),T=ke(n,s,b),k=Ce(n,s,g),_=ne({formId:p}),Q=_?a.allowFormEnterToSubmit(p):f,ee=A&&w>i.breakpoints.hideWidgetDetails;r.useEffect(()=>{J(q({step:t.step,dataType:t.dataType}))},[t.dataType,t.step]);const d=r.useCallback(({value:o,source:u})=>{var h;if(K(o)&&(b>o||o>g))(h=j.current)==null||h.reportValidity();else{const C=o??B??null;switch(S){case y.DataType.INT:a.setIntValue({id:V,formId:p},C,u,c);break;case y.DataType.FLOAT:a.setDoubleValue({id:V,formId:p},C,u,c);break;default:throw new Error("Invalid data type")}v(!1),x(C),I(N({value:C,dataType:S,format:F,step:s}))}},[b,g,j,a,c,s,S,V,p,B,F]),te=r.useCallback(()=>{f&&d({value:n,source:{fromUi:!0}}),U(!1)},[f,n,d]),re=r.useCallback(()=>{U(!0)},[]),L=r.useCallback(()=>{const{value:o}=t;t.setValue=!1,x(o??null),I(N({value:o??null,...t,step:s})),d({value:o??null,source:{fromUi:!1}})},[t,s,d]);r.useEffect(()=>{t.setValue?L():d({value:n,source:{fromUi:!1}})},[]),t.setValue&&L();const z=m(t.default)&&!e,ae=r.useCallback(()=>{const o=t.default??null;x(o),d({value:o,source:{fromUi:!0}})},[t]);fe({element:t,widgetMgr:a,onFormCleared:ae});const oe=o=>{const{value:u}=o.target;if(u==="")v(!0),x(null),I(null);else{let h;t.dataType===y.DataType.INT?h=parseInt(u,10):h=parseFloat(u),v(!0),x(h),I(u)}},D=r.useCallback(()=>{k&&(v(!0),d({value:(n??b)+s,source:{fromUi:!0}}))},[n,b,s,k]),E=r.useCallback(()=>{T&&(v(!0),d({value:(n??g)-s,source:{fromUi:!0}}))},[n,g,s,T]),ie=r.useCallback(o=>{const{key:u}=o;switch(u){case"ArrowUp":o.preventDefault(),D();break;case"ArrowDown":o.preventDefault(),E();break}},[D,E]),le=r.useCallback(o=>{o.key==="Enter"&&(f&&d({value:n,source:{fromUi:!0}}),a.allowFormEnterToSubmit(p)&&a.submitForm(p,c))},[f,n,d,a,p,c]);return l.jsxs("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:w},children:[l.jsx(de,{label:t.label,disabled:e,labelVisibility:ue((O=t.labelVisibility)==null?void 0:O.value),htmlFor:H.current,children:t.help&&l.jsx(ce,{children:l.jsx(pe,{content:t.help,placement:me.TOP_RIGHT})})}),l.jsxs(we,{className:A?"focused":"","data-testid":"stNumberInputContainer",children:[l.jsx(ye,{type:"number",inputRef:j,value:W??"",placeholder:t.placeholder,onBlur:te,onFocus:re,onChange:oe,onKeyPress:le,onKeyDown:ie,clearable:z,clearOnEscape:z,disabled:e,"aria-label":t.label,id:H.current,overrides:{ClearIconContainer:{style:{padding:0}},ClearIcon:{props:{overrides:{Svg:{style:{color:i.colors.darkGray,padding:i.spacing.threeXS,height:i.sizes.clearIconSize,width:i.sizes.clearIconSize,":hover":{fill:i.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:s,min:b,max:g,type:"number",inputMode:""},style:{lineHeight:i.lineHeights.inputWidget,paddingRight:i.spacing.sm,paddingLeft:i.spacing.sm,paddingBottom:i.spacing.sm,paddingTop:i.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:{borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,paddingRight:0}}}}),w>i.breakpoints.hideNumberInputControls&&l.jsxs(ve,{children:[l.jsx(Z,{"data-testid":"stNumberInputStepDown",onClick:E,disabled:!T||e,tabIndex:-1,children:l.jsx(G,{content:X,size:"xs",color:T?"inherit":"disabled"})}),l.jsx(Z,{"data-testid":"stNumberInputStepUp",onClick:D,disabled:!k||e,tabIndex:-1,children:l.jsx(G,{content:Y,size:"xs",color:k?"inherit":"disabled"})})]})]}),ee&&l.jsx(xe,{clearable:z,children:l.jsx(he,{dirty:f,value:W??"",inForm:_,allowEnterToSubmit:Q})})]})},Se=se(Re);export{Se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as N,r as d,u as M,aD as U,aR as j,j as p}from"./index-
|
|
1
|
+
import{c as N,r as d,u as M,aD as U,aR as j,j as p}from"./index-z2lXC7XI.js";const x=N("iframe",{target:"evvcert0"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"}),""),V=528;function A({element:r,width:m,endpoints:f,elementMgr:l}){const n=d.useRef(null),{type:y,url:E,startTime:s,subtitles:g,endTime:o,loop:u,autoplay:T,muted:L}=r,c=M(E),v=U(g),P=d.useMemo(()=>{if(!r.id)return!0;const e=l.getElementState(r.id,"preventAutoplay");return e||l.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,l]);d.useEffect(()=>{n.current&&(n.current.currentTime=s)},[s]),d.useEffect(()=>{const e=n.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),d.useEffect(()=>{const e=n.current;if(!e)return;let t=!1;const i=()=>{o>0&&e.currentTime>=o&&(u?(e.currentTime=s||0,e.play()):t||(t=!0,e.pause()))};return o>0&&e.addEventListener("timeupdate",i),()=>{e&&o>0&&e.removeEventListener("timeupdate",i)}},[o,u,s]),d.useEffect(()=>{const e=n.current;if(!e)return;const t=()=>{u&&(e.currentTime=s||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[u,s]);const R=e=>{const{startTime:t,endTime:i,loop:S,autoplay:b,muted:w}=r,a=new URL(e);if(t&&!isNaN(t)&&a.searchParams.append("start",t.toString()),i&&!isNaN(i)&&a.searchParams.append("end",i.toString()),S){a.searchParams.append("loop","1");const h=a.pathname.split("/").pop();h&&a.searchParams.append("playlist",h)}return b&&a.searchParams.append("autoplay","1"),w&&a.searchParams.append("mute","1"),a.toString()};return y===j.Type.YOUTUBE_IFRAME?p.jsx(x,{className:"stVideo","data-testid":"stVideo",title:c,src:R(c),allow:"autoplay; encrypted-media",allowFullScreen:!0}):p.jsx("video",{className:"stVideo","data-testid":"stVideo",ref:n,controls:!0,muted:L,autoPlay:T&&!P,src:f.buildMediaURL(c),style:{width:m,height:m===0?V:void 0},crossOrigin:void 0,children:v&&v.map((e,t)=>p.jsx("track",{kind:"captions",src:f.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0},t))})}export{A as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var rN;import{g as vw,a9 as Zl,B as yg,J as bw,aa as oN,ab as aN,ac as ms,ad as Af,S as na,ae as sN,af as lN,ag as xw,ah as uN,C as cN,Q as fN,c as dN,M as hN,j as tu,r as pN,F as _w,a7 as mN,$ as vg,ai as gN,aj as ww}from"./index-
|
|
1
|
+
var rN;import{g as vw,a9 as Zl,B as yg,J as bw,aa as oN,ab as aN,ac as ms,ad as Af,S as na,ae as sN,af as lN,ag as xw,ah as uN,C as cN,Q as fN,c as dN,M as hN,j as tu,r as pN,F as _w,a7 as mN,$ as vg,ai as gN,aj as ww}from"./index-z2lXC7XI.js";import{a as eu,n as yN,b as vN,c as Cf,t as ia,f as bN,d as bg,p as xN,e as _N,g as wN,h as kw,i as kN,j as no,k as nu,l as EN,m as $N,o as SN,q as DN,r as Ff,s as Ew,u as gs,v as xg,w as Mf,x as $w,y as io,z as ys,A as AN,B as ro,C as CN,D as FN,E as MN,F as TN}from"./threshold-C19zgWBv.js";import{d as _g,e as wg,R as Tf,C as kg,r as Sw,b as Dw,a as Aw,h as Of,c as Eg,n as Me,f as ON,g as NN,i as zN,j as RN,k as LN,l as PN,m as BN,o as Nf}from"./string-Bl9OLDCw.js";import{i as jN,a as IN,n as UN,T as qN,t as WN}from"./timer-C68DGyYc.js";import{F as HN}from"./FormClearHelper-DliGOSkq.js";import{S as Cw,T as VN}from"./Toolbar-B9grKd8p.js";import{w as GN,u as YN,E as XN}from"./withFullScreenWrapper-dTVQmtO5.js";/*!
|
|
2
2
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
3
3
|
* (c) 2017-2022 Joachim Wester
|
|
4
4
|
* MIT licensed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,B as h,j as v,bP as c,a$ as I}from"./index-
|
|
1
|
+
import{r as o,B as h,j as v,bP as c,a$ as I}from"./index-z2lXC7XI.js";import{a as S}from"./useBasicWidgetState-CDQNZkN8.js";import"./FormClearHelper-DliGOSkq.js";const V=(e,t)=>e.getIntValue(t),w=e=>e.default??null,M=e=>e.value??null,P=(e,t,l,a)=>{t.setIntValue(e,l.value,{fromUi:l.fromUi},a)},U=({disabled:e,element:t,widgetMgr:l,width:a,fragmentId:d})=>{const{options:m,help:u,label:s,labelVisibility:r,placeholder:g}=t,[n,i]=S({getStateFromWidgetMgr:V,getDefaultStateFromProto:w,getCurrStateFromProto:M,updateWidgetMgrState:P,element:t,widgetMgr:l,fragmentId:d}),b=o.useCallback(p=>{i({value:p,fromUi:!0})},[i]),f=h(t.default)&&!e;return v.jsx(c,{label:s,labelVisibility:I(r==null?void 0:r.value),options:m,disabled:e,width:a,onChange:b,value:n,help:u,placeholder:g,clearable:f})},j=o.memo(U);export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aG as i,j as t,aH as h,aX as u,aF as m,aI as p}from"./index-
|
|
1
|
+
import{aG as i,j as t,aH as h,aX as u,aF as m,aI as p}from"./index-z2lXC7XI.js";function f(l){const{disabled:d,element:e,widgetMgr:r,width:s,fragmentId:n}=l,o={width:s};let a=i.SECONDARY;e.type==="primary"?a=i.PRIMARY:e.type==="tertiary"&&(a=i.TERTIARY);const c=e.help?s:!0;return t.jsx("div",{className:"stButton","data-testid":"stButton",style:o,children:t.jsx(h,{help:e.help,children:t.jsx(u,{kind:a,size:m.SMALL,disabled:d,fluidWidth:e.useContainerWidth?c:!1,onClick:()=>r.setTriggerValue(e,{fromUi:!0},n),children:t.jsx(p,{icon:e.icon,label:e.label})})})})}export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b2 as q,r as f,b3 as H,b4 as J,M as Q,b5 as l,j as d,a_ as Y,a$ as Z,b6 as ee,b7 as te,b0 as re,aK as ne,aX as oe,aG as _,aF as U,al as ie,a2 as ae}from"./index-
|
|
1
|
+
import{b2 as q,r as f,b3 as H,b4 as J,M as Q,b5 as l,j as d,a_ as Y,a$ as Z,b6 as ee,b7 as te,b0 as re,aK as ne,aX as oe,aG as _,aF as U,al as ie,a2 as ae}from"./index-z2lXC7XI.js";import{a as ce}from"./useBasicWidgetState-CDQNZkN8.js";import"./FormClearHelper-DliGOSkq.js";var le={primary:"primary",secondary:"secondary",tertiary:"tertiary"},A={default:"default",pill:"pill",round:"round",circle:"circle",square:"square"},ue={mini:"mini",default:"default",compact:"compact",large:"large"},R=Object.freeze({radio:"radio",checkbox:"checkbox"}),T=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==A.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});T.displayName="StyledRoot",T.displayName="StyledRoot";function G(e){"@babel/helpers - typeof";return G=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},G(e)}function z(){return z=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},z.apply(this,arguments)}function V(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 se(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?V(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fe(e,t){return be(e)||ye(e,t)||de(e,t)||pe()}function pe(){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 de(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,u;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(s){i=!0,u=s}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw u}}return n}}function be(e){if(Array.isArray(e))return e}function me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(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 ge(e,t,r){return he(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Se(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&&B(e,t)}function B(e,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},B(e,t)}function ve(e){var t=Ee();return function(){var r=P(e),n;if(t){var o=P(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){if(t&&(G(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 Ee(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},P(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function we(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var W=function(e){Se(r,e);var t=ve(r);function r(){var n;me(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(F(n),"childRefs",{}),n}return ge(r,[{key:"render",value:function(){var n=this,o=this.props,i=o.overrides,a=i===void 0?{}:i,u=o.mode,s=u===void 0?R.checkbox:u,m=o.children,y=o.selected,g=o.disabled,p=o.onClick,b=o.kind,S=o.shape,x=o.size,w=H(a.Root,T),k=fe(w,2),j=k[0],E=k[1],L=this.props["aria-label"]||this.props.ariaLabel,v=s===R.radio,$=f.Children.count(m);return f.createElement(J.Consumer,null,function(K){return f.createElement(j,z({"aria-label":L||K.buttongroup.ariaLabel,"data-baseweb":"button-group",role:v?"radiogroup":"group",$shape:S,$length:m.length},E),f.Children.map(m,function(h,C){if(!f.isValidElement(h))return null;var D=h.props.isSelected?h.props.isSelected:we(y,C);return v&&(n.childRefs[C]=f.createRef()),f.cloneElement(h,{disabled:g||h.props.disabled,isSelected:D,ref:v?n.childRefs[C]:void 0,tabIndex:!v||D||v&&(!y||y===-1)&&C===0?0:-1,onKeyDown:function(c){if(v){var O=Number(y)?Number(y):0;if(c.key==="ArrowUp"||c.key==="ArrowLeft"){c.preventDefault&&c.preventDefault();var I=O-1<0?$-1:O-1;p&&p(c,I),n.childRefs[I].current&&n.childRefs[I].current.focus()}if(c.key==="ArrowDown"||c.key==="ArrowRight"){c.preventDefault&&c.preventDefault();var M=O+1>$-1?0:O+1;p&&p(c,M),n.childRefs[M].current&&n.childRefs[M].current.focus()}}},kind:b,onClick:function(c){g||(h.props.onClick&&h.props.onClick(c),p&&p(c,C))},shape:S,size:x,overrides:se({BaseButton:{style:function(c){var O=c.$theme;return m.length===1?{}:S!==A.default?{marginLeft:O.sizing.scale100,marginRight:O.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":D,role:v?"radio":"checkbox"}}},h.props.overrides)})}))})}}]),r}(f.Component);N(W,"defaultProps",{disabled:!1,onClick:function(){},shape:A.default,size:ue.default,kind:le.secondary});function je(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Le(e,t,r){return e==l.ClickMode.MULTI_SELECT?je(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Ce(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Re(e,t,r){const n=r===l.Style.PILLS?_.PILLS:r===l.Style.BORDERLESS?_.BORDERLESS_ICON:_.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?U.XSMALL:U.MEDIUM,i=r===l.Style.BORDERLESS?"lg":"base";return{element:d.jsxs(d.Fragment,{children:[t&&d.jsx(ie,{size:i,iconValue:t}),e&&d.jsx(ae,{source:e,allowHTML:!1})]}),kind:n,size:o}}function Pe(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 xe(e,t){return e&&(t=`${t}Active`),t}function De(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case l.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case l.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function Ie(e,t,r,n,o,i){const a=Pe(r,n,o,t);let u=e.content,s=e.contentIcon;return a&&(u=e.selectedContent?e.selectedContent:u,s=e.selectedContentIcon?e.selectedContentIcon:s),f.forwardRef(function(m,y){const{element:g,kind:p,size:b}=Re(u??"",s??void 0,i),S=xe(!!(a&&!e.selectedContent&&!e.selectedContentIcon),p);return d.jsx(oe,{...m,size:b,kind:S,children:g})})}function Me(e,t){return e.getIntArrayValue(t)}function _e(e){return e.default??null}function Ae(e){return e.value??null}function Te(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:u,style:s,label:m,labelVisibility:y,help:g}=r,p=Q(),[b,S]=ce({getStateFromWidgetMgr:Me,getDefaultStateFromProto:_e,getCurrStateFromProto:Ae,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),x=(j,E)=>{const L=Le(i,E,b);S({value:L,fromUi:!0})};let w;i===l.ClickMode.SINGLE_SELECT?w=R.radio:i===l.ClickMode.MULTI_SELECT&&(w=R.checkbox);const k=f.useMemo(()=>a.map((j,E)=>{const L=Ie(j,E,u,i,b,s);return d.jsx(L,{},`${j.content}-${E}`)}),[i,a,u,s,b]);return d.jsxs("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[d.jsx(Y,{label:m,disabled:t,labelVisibility:Z((y==null?void 0:y.value)??ee.LabelVisibilityOptions.COLLAPSED),children:g&&d.jsx(te,{children:d.jsx(re,{content:g,placement:ne.TOP})})}),d.jsx(W,{disabled:t,mode:w,onClick:x,selected:i===l.ClickMode.MULTI_SELECT?b:Ce(b),overrides:{Root:{style:f.useCallback(()=>De(s,p.spacing),[s,p.spacing])}},children:k})]})}const Ge=f.memo(Te);export{Ge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as m,a6 as w,aG as u,b8 as b,j as c,aH as g,aX as y,aF as A,aI as C}from"./index-
|
|
1
|
+
import{R as m,a6 as w,aG as u,b8 as b,j as c,aH as g,aX as y,aF as A,aI as C}from"./index-z2lXC7XI.js";import{c as R}from"./createDownloadLinkElement-DZMwyjvU.js";const T=/%([0-9A-Fa-f]{2})/g,v=/[^\x20-\x7e\xa0-\xff]/g,E=/\\([\u0000-\u007f])/g,p=/;[\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,I=/^([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!#$&+.^_`|~-])+)$/,L=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/,z=n=>String(n).replace(v,"?");class ${constructor(t,e){this.type=t,this.parameters=e}}const k=(n,t)=>String.fromCharCode(Number.parseInt(t,16));function U(n){const t=I.exec(n);if(!t)throw new TypeError("invalid extended field value");const e=t[1].toLowerCase(),o=t[2];let r;switch(e){case"iso-8859-1":r=z(o.replace(T,k));break;case"utf-8":try{r=decodeURIComponent(o)}catch{throw new TypeError("invalid encoded utf-8")}break;default:throw new TypeError("unsupported charset in extended field")}return r}function Z(n){let t=L.exec(n);if(!t)throw new TypeError("invalid type format");let e=t[0].length;const o=t[1].toLowerCase();let r;const s=[],i={};let a;for(e=p.lastIndex=t[0].slice(-1)===";"?e-1:e;t=p.exec(n);){if(t.index!==e)throw new TypeError("invalid parameter format");if(e+=t[0].length,r=t[1].toLowerCase(),a=t[2],s.indexOf(r)!==-1)throw new TypeError("invalid duplicate parameter");if(s.push(r),r.indexOf("*")+1===r.length){r=r.slice(0,-1),a=U(a),i[r]=a;continue}typeof i[r]!="string"&&(a[0]==='"'&&(a=a.slice(1,a.length-1).replace(E,"$1")),i[r]=a)}if(e!==-1&&e!==n.length)throw new TypeError("invalid parameter format");return new $(o,i)}function j(n){const t=Z(n);if(t.type!=="attachment")return;const e=t.parameters.filename;if(typeof e=="string")return e}function D(n,t){n.sendHttpRequest({method:"GET",path:`${t}?title=${encodeURIComponent(document.title)}`,headers:{},body:""}).then(({statusCode:e,headers:o,body:r})=>{if(e!==200)return;const s=o.get("Content-Disposition"),i=(s&&j(s))??"",a=o.get("Content-Type"),f=new Blob([r],a?{type:a}:void 0),d=URL.createObjectURL(f),l=document.createElement("a");l.setAttribute("href",d),l.setAttribute("target","_blank"),l.setAttribute("download",i),l.click(),URL.revokeObjectURL(d),l.remove()})}function _(n,t,e){return R({enforceDownloadInNewTab:e,url:n.buildMediaURL(t),filename:""})}function N(n){const{disabled:t,element:e,widgetMgr:o,width:r,endpoints:s,fragmentId:i}=n,a={width:r},{libConfig:{enforceDownloadInNewTab:f=!1}}=m.useContext(w);let d=u.SECONDARY;e.type==="primary"?d=u.PRIMARY:e.type==="tertiary"&&(d=u.TERTIARY);const l=b(),x=()=>{if(o.setTriggerValue(e,{fromUi:!0},i),e.url.startsWith("/media")){D(l,e.url);return}_(s,e.url,f).click()},h=e.help?r:!0;return c.jsx("div",{className:"stDownloadButton","data-testid":"stDownloadButton",style:a,children:c.jsx(g,{help:e.help,children:c.jsx(y,{kind:d,size:A.SMALL,disabled:t,onClick:x,fluidWidth:e.useContainerWidth?h:!1,children:c.jsx(C,{icon:e.icon,label:e.label})})})})}export{N as default};
|