@stlite/desktop 0.76.0 → 0.76.2
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/bin/dump_artifacts.js +35 -35
- package/build/assets/{FileDownload.esm-B0LHj-_3.js → FileDownload.esm-BP72wB_u.js} +1 -1
- package/build/assets/{FormClearHelper-CQJ4hAhl.js → FormClearHelper-BIZNCxvb.js} +1 -1
- package/build/assets/{Hooks-CaWvNnPE.js → Hooks-C30HoPXz.js} +1 -1
- package/build/assets/{InputInstructions-dmd87zjO.js → InputInstructions-B9wXy3U4.js} +1 -1
- package/build/assets/{ProgressBar-DOQ5M8oh.js → ProgressBar-BlPlcnwu.js} +1 -1
- package/build/assets/{RenderInPortalIfExists-CtbwYFE8.js → RenderInPortalIfExists-DSHuT3NO.js} +1 -1
- package/build/assets/{Toolbar-CSZCGrJs.js → Toolbar-B1zMj-jg.js} +1 -1
- package/build/assets/{base-input-DriCPmTX.js → base-input-CMN1_Ew_.js} +1 -1
- package/build/assets/{createSuper-BZXlc4Td.js → createSuper-D4gvBB5j.js} +1 -1
- package/build/assets/{data-grid-overlay-editor-gv8SW6cw.js → data-grid-overlay-editor-CgsMGcDx.js} +1 -1
- package/build/assets/{downloader-B5dbWt3Y.js → downloader-Dv4W7rem.js} +1 -1
- package/build/assets/{es6-yncbwHpI.js → es6-R_bosjbV.js} +2 -2
- package/build/assets/{getPrototypeOf-CbwKLcHO.js → getPrototypeOf-CHt6AZp_.js} +1 -1
- package/build/assets/{iframeResizer.contentWindow-uu2vIiUi.js → iframeResizer.contentWindow-9-Xlr32c.js} +1 -1
- package/build/assets/{index-B02vCrpB.js → index-8qq2hPcx.js} +1 -1
- package/build/assets/{index-C3MTxsAN.js → index-B0CwOTPz.js} +1 -1
- package/build/assets/{index-Do5EoDM5.js → index-B1L1envm.js} +1 -1
- package/build/assets/{index-LOOgUeUX.js → index-B3bELqRU.js} +1 -1
- package/build/assets/{index-DYpupVEb.js → index-B3quCHCi.js} +1 -1
- package/build/assets/{index-e4S25aVD.js → index-BB6FwCEX.js} +1 -1
- package/build/assets/{index-CdMvOMb7.js → index-BDNxxQ4v.js} +1 -1
- package/build/assets/{index-BpYNJC6s.js → index-BEeaeEPl.js} +1 -1
- package/build/assets/{index-D3ZPLnGE.js → index-BKKZmTqZ.js} +1 -1
- package/build/assets/{index-Cnquoj5Q.js → index-BL2qQWaL.js} +1 -1
- package/build/assets/{index-IPja5Suf.js → index-BLvsCvkf.js} +1 -1
- package/build/assets/{index-RheWSraw.js → index-BZMvJ6Yf.js} +1 -1
- package/build/assets/{index-CH7n-Ppq.js → index-Be0wHUx-.js} +1 -1
- package/build/assets/{index-CVNSqCzF.js → index-BkBgJKWs.js} +1 -1
- package/build/assets/{index-C3174axP.js → index-Bu07mO_x.js} +1 -1
- package/build/assets/{index-DDWzHXvN.js → index-C9-3Tvo1.js} +1 -1
- package/build/assets/{index-CH2ZvTfO.js → index-CMQsen11.js} +1 -1
- package/build/assets/{index-BMPhLnQ5.js → index-CRKAbc7H.js} +1 -1
- package/build/assets/{index-BvFTSm46.js → index-Cjn3IAUe.js} +1 -1
- package/build/assets/{index-wvUDp42d.js → index-CoumX680.js} +1 -1
- package/build/assets/{index-BNNuO9xH.js → index-CxiUGvN5.js} +1 -1
- package/build/assets/{index-kDtQE3bj.js → index-D2caMYlF.js} +1 -1
- package/build/assets/{index-CkJQJhep.js → index-D7beHGbk.js} +5 -5
- package/build/assets/{index-XDu91tM_.js → index-DBeV5cvz.js} +1 -1
- package/build/assets/{index-DKDi9zAJ.js → index-DP9siobZ.js} +1 -1
- package/build/assets/{index-BqCUmN8g.js → index-D_ZpMtCx.js} +1 -1
- package/build/assets/{index-B8fuFO6f.js → index-DfPuZgVe.js} +1 -1
- package/build/assets/{index-D6uye6hf.js → index-DgKoCzGM.js} +1 -1
- package/build/assets/{index-BTcFSez7.js → index-DjNlghsG.js} +1 -1
- package/build/assets/{index-BIUCqSQk.js → index-DmCDp6tz.js} +1 -1
- package/build/assets/{index-DI8uuyv8.js → index-DqEaj7EU.js} +1 -1
- package/build/assets/{index-gy-vJk95.js → index-DuoBWGu3.js} +5 -5
- package/build/assets/{index-Cnm_EPJy.js → index-DxHnoro7.js} +1 -1
- package/build/assets/{index-BrGUvTwf.js → index-UQryvozB.js} +1 -1
- package/build/assets/{index-B976k_ae.js → index-W-TZSd1E.js} +1 -1
- package/build/assets/{index-C0PQ0fkc.js → index-bnfkOWdV.js} +1 -1
- package/build/assets/{index-C_hLmnGD.js → index-dkm5JtmN.js} +1 -1
- package/build/assets/{input-BPMs_pbL.js → input-OLwqq6dJ.js} +1 -1
- package/build/assets/{memory-BTS-Apkp.js → memory-K1u1sl9P.js} +1 -1
- package/build/assets/{number-overlay-editor-mb8oKGeo.js → number-overlay-editor-BPRtr2ZH.js} +1 -1
- package/build/assets/{sandbox-CX6LT8_0.js → sandbox-CuSVz6A0.js} +1 -1
- package/build/assets/{slicedToArray-CXJqkkAS.js → slicedToArray-CFP8r_hv.js} +1 -1
- package/build/assets/{textarea-Bt4dlZO-.js → textarea-BgOZDoS8.js} +1 -1
- package/build/assets/{timepicker-CmQYPfbc.js → timepicker-BD9p-9JQ.js} +1 -1
- package/build/assets/{uniqueId-DKCcDw-W.js → uniqueId-D81S8Chc.js} +1 -1
- package/build/assets/{useBasicWidgetState-HYzN-eIJ.js → useBasicWidgetState-DgnZoFWi.js} +1 -1
- package/build/assets/{useOnInputChange-DBbXtTXT.js → useOnInputChange-DTjT_cKQ.js} +1 -1
- package/build/assets/{withFullScreenWrapper-Dibt3YfW.js → withFullScreenWrapper-BzdPuFtI.js} +1 -1
- package/build/electron/main.js +2 -2
- package/build/index.html +1 -1
- package/package.json +5 -5
- package/wheels/streamlit-1.41.0-cp312-none-any.whl +0 -0
|
@@ -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-gy-vJk95.js";import{s as _e}from"./sprintf-C-r3gIuM.js";import{a as Rt}from"./useBasicWidgetState-HYzN-eIJ.js";import"./FormClearHelper-CQJ4hAhl.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-DuoBWGu3.js";import{s as _e}from"./sprintf-C-r3gIuM.js";import{a as Rt}from"./useBasicWidgetState-DgnZoFWi.js";import"./FormClearHelper-BIZNCxvb.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 r,i as a,aV as l,R as d,a6 as c,bA as g,j as o,bB as h,a2 as p}from"./index-
|
|
1
|
+
import{c as r,i as a,aV as l,R as d,a6 as c,bA as g,j as o,bB as h,a2 as p}from"./index-DuoBWGu3.js";const m=r(l,{shouldForwardProp:a,target:"e1se5lgy2"})(({theme:e,usingCustomTheme:t})=>({fontSize:e.fontSizes.sm,width:e.sizes.spinnerSize,height:e.sizes.spinnerSize,borderWidth:e.sizes.spinnerThickness,radius:e.radii.md,justifyContents:"center",padding:e.spacing.none,margin:e.spacing.none,borderColor:e.colors.borderColor,borderTopColor:t?e.colors.primary:e.colors.blue70,flexGrow:0,flexShrink:0}),""),u=r("div",{target:"e1se5lgy1"})(({theme:e,width:t,cache:i})=>({width:t,...i?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null}),""),b=r("div",{target:"e1se5lgy0"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"center",width:"100%"}),"");function x({width:e,element:t}){const{activeTheme:i}=d.useContext(c),n=!g(i),{cache:s}=t;return o.jsx(u,{className:h({stSpinner:!0,stCacheSpinner:s}),"data-testid":"stSpinner",width:e,cache:s,children:o.jsxs(b,{children:[o.jsx(m,{usingCustomTheme:n}),o.jsx(p,{source:t.text,allowHTML:!1})]})})}export{x as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var eO=Object.defineProperty;var iO=(e,t,i)=>t in e?eO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var z=(e,t,i)=>iO(e,typeof t!="symbol"?t+"":t,i);var y5,mw;import{g as jf,r as re,U as Ge,p as Ht,e as JE,ap as fu,_ as YE,Z as rO,j as wr,aq as zy,ar as Uy,as as nO,at as oO,au as $E,a6 as sO,av as aO,aj as lO,c as tC,a5 as eC,aw as Gy,ax as iC,$ as cO,M as uO,ay as rC}from"./index-gy-vJk95.js";import{_ as Gn,C as hO}from"./slicedToArray-CXJqkkAS.js";import{b as du,a as pu,_ as jy,c as Vf,d as Vy}from"./getPrototypeOf-CbwKLcHO.js";import{T as fO,a as dO}from"./Toolbar-CSZCGrJs.js";import{u as nC,E as oC,w as pO}from"./withFullScreenWrapper-Dibt3YfW.js";import{u as AO}from"./useBasicWidgetState-HYzN-eIJ.js";import{c as gO}from"./_commonjs-dynamic-modules-TDtrdbi3.js";import{D as mO,C as _O}from"./threshold-C19zgWBv.js";import"./FormClearHelper-CQJ4hAhl.js";import"./string-Bl9OLDCw.js";function yO(e,t){for(var i=0;i<t.length;i++){const r=t[i];if(typeof r!="string"&&!Array.isArray(r)){for(const n in r)if(n!=="default"&&!(n in e)){const s=Object.getOwnPropertyDescriptor(r,n);s&&Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>r[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}async function Hf(e,t,i,r){return r._parse(e,t,i,r)}function Gr(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const K0=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),sC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);sC&&parseFloat(sC[1]);const Q0=globalThis,Wf=globalThis.process||{},vO=globalThis.navigator||{};function aC(e){var i,r;if(typeof window<"u"&&((i=window.process)==null?void 0:i.type)==="renderer"||typeof process<"u"&&((r=process.versions)!=null&&r.electron))return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function Au(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||aC()}function bO(e){return Au()?aC()?"Electron":(vO.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const lC="4.0.7";function xO(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch{return null}}class wO{constructor(t,i,r="sessionStorage"){this.storage=xO(r),this.id=t,this.config=i,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const i=JSON.stringify(this.config);this.storage.setItem(this.id,i)}}_loadConfiguration(){let t={};if(this.storage){const i=this.storage.getItem(this.id);t=i?JSON.parse(i):{}}return Object.assign(this.config,t),this}}function EO(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function CO(e,t=8){const i=Math.max(t-e.length,0);return`${" ".repeat(i)}${e}`}var J0;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(J0||(J0={}));const SO=10;function cC(e){return typeof e!="string"?e:(e=e.toUpperCase(),J0[e]||J0.WHITE)}function TO(e,t,i){return!Au&&typeof e=="string"&&(t&&(e=`\x1B[${cC(t)}m${e}\x1B[39m`),i&&(e=`\x1B[${cC(i)+SO}m${e}\x1B[49m`)),e}function IO(e,t=["constructor"]){const i=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(i),n=e;for(const s of r){const o=n[s];typeof o=="function"&&(t.find(f=>s===f)||(n[s]=o.bind(e)))}}function Hy(e,t){if(!e)throw new Error("Assertion failed")}function qf(){var t,i,r;let e;if(Au()&&Q0.performance)e=(i=(t=Q0==null?void 0:Q0.performance)==null?void 0:t.now)==null?void 0:i.call(t);else if("hrtime"in Wf){const n=(r=Wf==null?void 0:Wf.hrtime)==null?void 0:r.call(Wf);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}const Zf={debug:Au()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},PO={enabled:!0,level:0};function Xf(){}const uC={},hC={once:!0};class Kf{constructor({id:t}={id:""}){this.VERSION=lC,this._startTs=qf(),this._deltaTs=qf(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new wO(`__probe-${this.id}__`,PO),this.timeStamp(`${this.id} started`),IO(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((qf()-this._startTs).toPrecision(10))}getDelta(){return Number((qf()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,i){this._storage.setConfiguration({[t]:i})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,i){if(!t)throw new Error(i||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Zf.warn,arguments,hC)}error(t){return this._getLogFunction(0,t,Zf.error,arguments)}deprecated(t,i){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${i}\` instead`)}removed(t,i){return this.error(`\`${t}\` has been removed. Use \`${i}\` instead`)}probe(t,i){return this._getLogFunction(t,i,Zf.log,arguments,{time:!0,once:!0})}log(t,i){return this._getLogFunction(t,i,Zf.debug,arguments)}info(t,i){return this._getLogFunction(t,i,console.info,arguments)}once(t,i){return this._getLogFunction(t,i,Zf.debug||Zf.info,arguments,hC)}table(t,i,r){return i?this._getLogFunction(t,i,console.table||Xf,r&&[r],{tag:BO(i)}):Xf}time(t,i){return this._getLogFunction(t,i,console.time?console.time:console.info)}timeEnd(t,i){return this._getLogFunction(t,i,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,i){return this._getLogFunction(t,i,console.timeStamp||Xf)}group(t,i,r={collapsed:!1}){const n=dC({logLevel:t,message:i,opts:r}),{collapsed:s}=r;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,i,r={}){return this.group(t,i,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Xf)}withGroup(t,i,r){this.group(t,i)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=fC(t)}_getLogFunction(t,i,r,n,s){if(this._shouldLog(t)){s=dC({logLevel:t,message:i,args:n,opts:s}),r=r||s.method,Hy(r),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=qf();const o=s.tag||s.message;if(s.once&&o)if(!uC[o])uC[o]=qf();else return Xf;return i=MO(this.id,s.message,s),r.bind(console,i,...s.args)}return Xf}}Kf.VERSION=lC;function fC(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Hy(Number.isFinite(t)&&t>=0),t}function dC(e){const{logLevel:t,message:i}=e;e.logLevel=fC(t);const r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==i;);switch(typeof t){case"string":case"function":i!==void 0&&r.unshift(i),e.message=t;break;case"object":Object.assign(e,t);break}typeof e.message=="function"&&(e.message=e.message());const n=typeof e.message;return Hy(n==="string"||n==="object"),Object.assign(e,{args:r},e.opts)}function MO(e,t,i){if(typeof t=="string"){const r=i.time?CO(EO(i.total)):"";t=i.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=TO(t,i.color,i.background)}return t}function BO(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}globalThis.probe={};const pC=new Kf({id:"@probe.gl/log"}),Wy="4.3.1",RO=Wy[0]>="0"&&Wy[0]<="9"?`v${Wy}`:"";function LO(){const e=new Kf({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=RO,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}const AC=LO();function gC(e,t){return mC(e||{},t)}function mC(e,t,i=0){if(i>3)return t;const r={...e};for(const[n,s]of Object.entries(t))s&&typeof s=="object"&&!Array.isArray(s)?r[n]=mC(r[n]||{},t[n],i+1):r[n]=t[n];return r}function DO(e){var t;globalThis.loaders||(globalThis.loaders={}),(t=globalThis.loaders).modules||(t.modules={}),Object.assign(globalThis.loaders.modules,e)}function OO(e){var t,i;return((i=(t=globalThis.loaders)==null?void 0:t.modules)==null?void 0:i[e])||null}const kO="latest";function FO(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.1"),globalThis._loadersgl_.version}const _C=FO();function Ac(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const va=typeof process!="object"||String(process)!=="[object process]"||process.browser,qy=typeof importScripts=="function",NO=typeof window<"u"&&typeof window.orientation<"u",yC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);yC&&parseFloat(yC[1]);class zO{constructor(t,i){z(this,"name");z(this,"workerThread");z(this,"isRunning",!0);z(this,"result");z(this,"_resolve",()=>{});z(this,"_reject",()=>{});this.name=t,this.workerThread=i,this.result=new Promise((r,n)=>{this._resolve=r,this._reject=n})}postMessage(t,i){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:i})}done(t){Ac(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Ac(this.isRunning),this.isRunning=!1,this._reject(t)}}class Zy{terminate(){}}const Xy=new Map;function UO(e){Ac(e.source&&!e.url||!e.source&&e.url);let t=Xy.get(e.source||e.url);return t||(e.url&&(t=GO(e.url),Xy.set(e.url,t)),e.source&&(t=vC(e.source),Xy.set(e.source,t))),Ac(t),t}function GO(e){if(!e.startsWith("http"))return e;const t=jO(e);return vC(t)}function vC(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function jO(e){return`try {
|
|
1
|
+
var eO=Object.defineProperty;var iO=(e,t,i)=>t in e?eO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var z=(e,t,i)=>iO(e,typeof t!="symbol"?t+"":t,i);var y5,mw;import{g as jf,r as re,U as Ge,p as Ht,e as JE,ap as fu,_ as YE,Z as rO,j as wr,aq as zy,ar as Uy,as as nO,at as oO,au as $E,a6 as sO,av as aO,aj as lO,c as tC,a5 as eC,aw as Gy,ax as iC,$ as cO,M as uO,ay as rC}from"./index-DuoBWGu3.js";import{_ as Gn,C as hO}from"./slicedToArray-CFP8r_hv.js";import{b as du,a as pu,_ as jy,c as Vf,d as Vy}from"./getPrototypeOf-CHt6AZp_.js";import{T as fO,a as dO}from"./Toolbar-B1zMj-jg.js";import{u as nC,E as oC,w as pO}from"./withFullScreenWrapper-BzdPuFtI.js";import{u as AO}from"./useBasicWidgetState-DgnZoFWi.js";import{c as gO}from"./_commonjs-dynamic-modules-TDtrdbi3.js";import{D as mO,C as _O}from"./threshold-C19zgWBv.js";import"./FormClearHelper-BIZNCxvb.js";import"./string-Bl9OLDCw.js";function yO(e,t){for(var i=0;i<t.length;i++){const r=t[i];if(typeof r!="string"&&!Array.isArray(r)){for(const n in r)if(n!=="default"&&!(n in e)){const s=Object.getOwnPropertyDescriptor(r,n);s&&Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>r[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}async function Hf(e,t,i,r){return r._parse(e,t,i,r)}function Gr(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const K0=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),sC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);sC&&parseFloat(sC[1]);const Q0=globalThis,Wf=globalThis.process||{},vO=globalThis.navigator||{};function aC(e){var i,r;if(typeof window<"u"&&((i=window.process)==null?void 0:i.type)==="renderer"||typeof process<"u"&&((r=process.versions)!=null&&r.electron))return!0;const t=typeof navigator<"u"&&navigator.userAgent;return!!(t&&t.indexOf("Electron")>=0)}function Au(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||aC()}function bO(e){return Au()?aC()?"Electron":(vO.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const lC="4.0.7";function xO(e){try{const t=window[e],i="__storage_test__";return t.setItem(i,i),t.removeItem(i),t}catch{return null}}class wO{constructor(t,i,r="sessionStorage"){this.storage=xO(r),this.id=t,this.config=i,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const i=JSON.stringify(this.config);this.storage.setItem(this.id,i)}}_loadConfiguration(){let t={};if(this.storage){const i=this.storage.getItem(this.id);t=i?JSON.parse(i):{}}return Object.assign(this.config,t),this}}function EO(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function CO(e,t=8){const i=Math.max(t-e.length,0);return`${" ".repeat(i)}${e}`}var J0;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(J0||(J0={}));const SO=10;function cC(e){return typeof e!="string"?e:(e=e.toUpperCase(),J0[e]||J0.WHITE)}function TO(e,t,i){return!Au&&typeof e=="string"&&(t&&(e=`\x1B[${cC(t)}m${e}\x1B[39m`),i&&(e=`\x1B[${cC(i)+SO}m${e}\x1B[49m`)),e}function IO(e,t=["constructor"]){const i=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(i),n=e;for(const s of r){const o=n[s];typeof o=="function"&&(t.find(f=>s===f)||(n[s]=o.bind(e)))}}function Hy(e,t){if(!e)throw new Error("Assertion failed")}function qf(){var t,i,r;let e;if(Au()&&Q0.performance)e=(i=(t=Q0==null?void 0:Q0.performance)==null?void 0:t.now)==null?void 0:i.call(t);else if("hrtime"in Wf){const n=(r=Wf==null?void 0:Wf.hrtime)==null?void 0:r.call(Wf);e=n[0]*1e3+n[1]/1e6}else e=Date.now();return e}const Zf={debug:Au()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},PO={enabled:!0,level:0};function Xf(){}const uC={},hC={once:!0};class Kf{constructor({id:t}={id:""}){this.VERSION=lC,this._startTs=qf(),this._deltaTs=qf(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new wO(`__probe-${this.id}__`,PO),this.timeStamp(`${this.id} started`),IO(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((qf()-this._startTs).toPrecision(10))}getDelta(){return Number((qf()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,i){this._storage.setConfiguration({[t]:i})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,i){if(!t)throw new Error(i||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Zf.warn,arguments,hC)}error(t){return this._getLogFunction(0,t,Zf.error,arguments)}deprecated(t,i){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${i}\` instead`)}removed(t,i){return this.error(`\`${t}\` has been removed. Use \`${i}\` instead`)}probe(t,i){return this._getLogFunction(t,i,Zf.log,arguments,{time:!0,once:!0})}log(t,i){return this._getLogFunction(t,i,Zf.debug,arguments)}info(t,i){return this._getLogFunction(t,i,console.info,arguments)}once(t,i){return this._getLogFunction(t,i,Zf.debug||Zf.info,arguments,hC)}table(t,i,r){return i?this._getLogFunction(t,i,console.table||Xf,r&&[r],{tag:BO(i)}):Xf}time(t,i){return this._getLogFunction(t,i,console.time?console.time:console.info)}timeEnd(t,i){return this._getLogFunction(t,i,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,i){return this._getLogFunction(t,i,console.timeStamp||Xf)}group(t,i,r={collapsed:!1}){const n=dC({logLevel:t,message:i,opts:r}),{collapsed:s}=r;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,i,r={}){return this.group(t,i,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Xf)}withGroup(t,i,r){this.group(t,i)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=fC(t)}_getLogFunction(t,i,r,n,s){if(this._shouldLog(t)){s=dC({logLevel:t,message:i,args:n,opts:s}),r=r||s.method,Hy(r),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=qf();const o=s.tag||s.message;if(s.once&&o)if(!uC[o])uC[o]=qf();else return Xf;return i=MO(this.id,s.message,s),r.bind(console,i,...s.args)}return Xf}}Kf.VERSION=lC;function fC(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Hy(Number.isFinite(t)&&t>=0),t}function dC(e){const{logLevel:t,message:i}=e;e.logLevel=fC(t);const r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==i;);switch(typeof t){case"string":case"function":i!==void 0&&r.unshift(i),e.message=t;break;case"object":Object.assign(e,t);break}typeof e.message=="function"&&(e.message=e.message());const n=typeof e.message;return Hy(n==="string"||n==="object"),Object.assign(e,{args:r},e.opts)}function MO(e,t,i){if(typeof t=="string"){const r=i.time?CO(EO(i.total)):"";t=i.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=TO(t,i.color,i.background)}return t}function BO(e){for(const t in e)for(const i in e[t])return i||"untitled";return"empty"}globalThis.probe={};const pC=new Kf({id:"@probe.gl/log"}),Wy="4.3.1",RO=Wy[0]>="0"&&Wy[0]<="9"?`v${Wy}`:"";function LO(){const e=new Kf({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=RO,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}const AC=LO();function gC(e,t){return mC(e||{},t)}function mC(e,t,i=0){if(i>3)return t;const r={...e};for(const[n,s]of Object.entries(t))s&&typeof s=="object"&&!Array.isArray(s)?r[n]=mC(r[n]||{},t[n],i+1):r[n]=t[n];return r}function DO(e){var t;globalThis.loaders||(globalThis.loaders={}),(t=globalThis.loaders).modules||(t.modules={}),Object.assign(globalThis.loaders.modules,e)}function OO(e){var t,i;return((i=(t=globalThis.loaders)==null?void 0:t.modules)==null?void 0:i[e])||null}const kO="latest";function FO(){var e;return(e=globalThis._loadersgl_)!=null&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.1"),globalThis._loadersgl_.version}const _C=FO();function Ac(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const va=typeof process!="object"||String(process)!=="[object process]"||process.browser,qy=typeof importScripts=="function",NO=typeof window<"u"&&typeof window.orientation<"u",yC=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);yC&&parseFloat(yC[1]);class zO{constructor(t,i){z(this,"name");z(this,"workerThread");z(this,"isRunning",!0);z(this,"result");z(this,"_resolve",()=>{});z(this,"_reject",()=>{});this.name=t,this.workerThread=i,this.result=new Promise((r,n)=>{this._resolve=r,this._reject=n})}postMessage(t,i){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:i})}done(t){Ac(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Ac(this.isRunning),this.isRunning=!1,this._reject(t)}}class Zy{terminate(){}}const Xy=new Map;function UO(e){Ac(e.source&&!e.url||!e.source&&e.url);let t=Xy.get(e.source||e.url);return t||(e.url&&(t=GO(e.url),Xy.set(e.url,t)),e.source&&(t=vC(e.source),Xy.set(e.source,t))),Ac(t),t}function GO(e){if(!e.startsWith("http"))return e;const t=jO(e);return vC(t)}function vC(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function jO(e){return`try {
|
|
2
2
|
importScripts('${e}');
|
|
3
3
|
} catch (error) {
|
|
4
4
|
console.error(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,M as k,bZ as W,j as s,a_ as H,a$ as D,bc as E,b0 as M,aK as U}from"./index-
|
|
1
|
+
import{r,M as k,bZ as W,j as s,a_ as H,a$ as D,bc as E,b0 as M,aK as U}from"./index-DuoBWGu3.js";import{u as _}from"./uniqueId-D81S8Chc.js";import{u as A,a as B,b as L}from"./useOnInputChange-DTjT_cKQ.js";import{I as P}from"./InputInstructions-B9wXy3U4.js";import{a as K}from"./useBasicWidgetState-DgnZoFWi.js";import{T as $}from"./textarea-BgOZDoS8.js";import"./inputUtils-CptNuJwn.js";import"./FormClearHelper-BIZNCxvb.js";import"./base-input-CMN1_Ew_.js";const S=(a,e)=>a.getStringValue(e)??e.default??null,G=a=>a.default??null,N=a=>a.value??null,O=(a,e,i,d)=>{e.setStringValue(a,i.value,{fromUi:i.fromUi},d)},Z=({disabled:a,element:e,widgetMgr:i,fragmentId:d,width:h})=>{var x;const b=r.useRef(_("text_area_")).current,[l,m]=r.useState(!1),[I,c]=r.useState(!1),[o,n]=r.useState(S(i,e)??null),y=r.useCallback(()=>{n(e.default??null),m(!0)},[e]),[C,g]=K({getStateFromWidgetMgr:S,getDefaultStateFromProto:G,getCurrStateFromProto:N,updateWidgetMgrState:O,element:e,widgetMgr:i,fragmentId:d,onFormCleared:y});A(C,o,n,l);const t=k(),u=r.useCallback(()=>{m(!1),g({value:o,fromUi:!0})},[o,g]),T=r.useCallback(()=>{l&&u(),c(!1)},[l,u]),v=r.useCallback(()=>{c(!0)},[]),F=B({formId:e.formId,maxChars:e.maxChars,setDirty:m,setUiValue:n,setValueWithSource:g}),j=L(e.formId,u,l,i,d,!0),w={width:h},{height:f,placeholder:z,formId:p}=e,R=W({formId:p})?i.allowFormEnterToSubmit(p):l,V=I&&h>t.breakpoints.hideWidgetDetails;return s.jsxs("div",{className:"stTextArea","data-testid":"stTextArea",style:w,children:[s.jsx(H,{label:e.label,disabled:a,labelVisibility:D((x=e.labelVisibility)==null?void 0:x.value),htmlFor:b,children:e.help&&s.jsx(E,{children:s.jsx(M,{content:e.help,placement:U.TOP_RIGHT})})}),s.jsx($,{value:o??"",placeholder:z,onBlur:T,onFocus:v,onChange:F,onKeyDown:j,"aria-label":e.label,disabled:a,id:b,overrides:{Input:{style:{lineHeight:t.lineHeights.inputWidget,height:f?`${f}px`:"",minHeight:t.sizes.largestElementHeight,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:t.spacing.lg,paddingLeft:t.spacing.lg,paddingBottom:t.spacing.lg,paddingTop:t.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:t.sizes.borderWidth,borderRightWidth:t.sizes.borderWidth,borderTopWidth:t.sizes.borderWidth,borderBottomWidth:t.sizes.borderWidth}}}}),V&&s.jsx(P,{dirty:l,value:o??"",maxLength:e.maxChars,type:"multiline",inForm:W({formId:p}),allowEnterToSubmit:R})]})},q=r.memo(Z);export{q as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b2 as R,bd as be,r as c,b3 as O,M as me,j as g,a_ as ge,b7 as ye,b0 as ve,aK as we,a2 as ne,a$ as Re}from"./index-
|
|
1
|
+
import{b2 as R,bd as be,r as c,b3 as O,M as me,j as g,a_ as ge,b7 as ye,b0 as ve,aK as we,a2 as ne,a$ as Re}from"./index-DuoBWGu3.js";import{a as Oe}from"./useBasicWidgetState-DgnZoFWi.js";import"./FormClearHelper-BIZNCxvb.js";var ie={vertical:"vertical",horizontal:"horizontal"};function ae(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),o.push.apply(o,r)}return o}function C(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(o),!0).forEach(function(r){k(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ae(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function k(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var L=0,I=1,T=2;function B(e){return e.$isActive?T:e.$isHovered?I:L}function ke(e){var t=e.$theme.colors,o=e.$disabled,r=e.$checked,n=e.$isFocusVisible,s=e.$error;if(o)return t.tickFillDisabled;if(r)if(s)switch(B(e)){case L:return t.tickFillErrorSelected;case I:return t.tickFillErrorSelectedHover;case T:return t.tickFillErrorSelectedHoverActive}else switch(B(e)){case L:return t.tickFillSelected;case I:return t.tickFillSelectedHover;case T:return t.tickFillSelectedHoverActive}else return n?t.borderSelected:s?t.tickBorderError:t.tickBorder;return null}function je(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(B(e)){case L:return t.tickFillError;case I:return t.tickFillErrorHover;case T:return t.tickFillErrorHoverActive}else switch(B(e)){case L:return t.tickFill;case I:return t.tickFillHover;case T:return t.tickFillActive}}function $e(e){var t=e.$labelPlacement,o=t===void 0?"":t,r=e.$theme,n;switch(o){case"top":n="Bottom";break;case"bottom":n="Top";break;case"left":n=r.direction==="rtl"?"Left":"Right";break;default:case"right":n=r.direction==="rtl"?"Right":"Left";break}var s=r.sizing,i=s.scale300;return k({},"padding".concat(n),i)}function Se(e){var t=e.$disabled,o=e.$theme,r=o.colors;return t?r.contentSecondary:r.contentPrimary}var U=R("div",function(e){var t=e.$disabled,o=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:o==="horizontal"?"row":"column",alignItems:o==="horizontal"?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}});U.displayName="RadioGroupRoot",U.displayName="RadioGroupRoot";var q=R("label",function(e){var t,o=e.$disabled,r=e.$hasDescription,n=e.$labelPlacement,s=e.$theme,i=e.$align,a=s.sizing,u=i==="horizontal",f=s.direction==="rtl"?"Left":"Right";return t={flexDirection:n==="top"||n==="bottom"?"column":"row",display:"flex",alignItems:"center",cursor:o?"not-allowed":"pointer",marginTop:a.scale200},k(t,"margin".concat(f),u?a.scale200:null),k(t,"marginBottom",r&&!u?null:a.scale200),t});q.displayName="Root",q.displayName="Root";var G=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{backgroundColor:je(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?r.scale200:r.scale550,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve,width:e.$checked?r.scale200:r.scale550}});G.displayName="RadioMarkInner",G.displayName="RadioMarkInner";var W=R("div",function(e){var t=e.$theme,o=t.animation,r=t.sizing;return{alignItems:"center",backgroundColor:ke(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:r.scale700,justifyContent:"center",marginTop:r.scale0,marginRight:r.scale0,marginBottom:r.scale0,marginLeft:r.scale0,outline:"none",verticalAlign:"middle",width:r.scale700,flexShrink:0,transitionDuration:o.timing200,transitionTimingFunction:o.easeOutCurve}});W.displayName="RadioMarkOuter",W.displayName="RadioMarkOuter";var X=R("div",function(e){var t=e.$theme.typography;return C(C({verticalAlign:"middle"},$e(e)),{},{color:Se(e)},t.LabelMedium)});X.displayName="Label",X.displayName="Label";var K=R("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});K.displayName="Input",K.displayName="Input";var J=R("div",function(e){var t,o=e.$theme,r=e.$align,n=r==="horizontal",s=o.direction==="rtl"?"Right":"Left",i=o.direction==="rtl"?"Left":"Right";return C(C({},o.typography.ParagraphSmall),{},(t={color:o.colors.contentSecondary,cursor:"auto"},k(t,"margin".concat(s),r==="horizontal"?null:o.sizing.scale900),k(t,"margin".concat(i),n?o.sizing.scale200:null),k(t,"maxWidth","240px"),t))});J.displayName="Description",J.displayName="Description";function Q(e){"@babel/helpers - typeof";return Q=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},Q(e)}function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},Y.apply(this,arguments)}function Me(e,t){return Ee(e)||xe(e,t)||Pe(e,t)||Fe()}function Fe(){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 Pe(e,t){if(e){if(typeof e=="string")return se(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(e);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return se(e,t)}}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function xe(e,t){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r=[],n=!0,s=!1,i,a;try{for(o=o.call(e);!(n=(i=o.next()).done)&&(r.push(i.value),!(t&&r.length===t));n=!0);}catch(u){s=!0,a=u}finally{try{!n&&o.return!=null&&o.return()}finally{if(s)throw a}}return r}}function Ee(e){if(Array.isArray(e))return e}function Le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ie(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(e,t,o){return Ie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Z(e,t)}function Z(e,t){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},Z(e,t)}function Be(e){var t=De();return function(){var o=D(e),r;if(t){var n=D(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Ae(this,r)}}function Ae(e,t){if(t&&(Q(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return A(e)}function A(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function De(){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 D(e){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},D(e)}function z(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var le=function(e){Ce(o,e);var t=Be(o);function o(){var r;Le(this,o);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),z(A(r),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),z(A(r),"handleFocus",function(a,u){be(a)&&r.setState({isFocusVisible:!0}),r.setState({focusedRadioIndex:u}),r.props.onFocus&&r.props.onFocus(a)}),z(A(r),"handleBlur",function(a,u){r.state.isFocusVisible!==!1&&r.setState({isFocusVisible:!1}),r.setState({focusedRadioIndex:-1}),r.props.onBlur&&r.props.onBlur(a)}),r}return Te(o,[{key:"render",value:function(){var r=this,n=this.props.overrides,s=n===void 0?{}:n,i=O(s.RadioGroupRoot,U),a=Me(i,2),u=a[0],f=a[1];return c.createElement(u,Y({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},f),c.Children.map(this.props.children,function(p,d){if(!c.isValidElement(p))return null;var h=r.props.value===p.props.value;return c.cloneElement(p,{align:r.props.align,autoFocus:r.props.autoFocus,checked:h,disabled:r.props.disabled||p.props.disabled,error:r.props.error,isFocused:r.state.focusedRadioIndex===d,isFocusVisible:r.state.isFocusVisible,tabIndex:d===0&&!r.props.value||h?"0":"-1",labelPlacement:r.props.labelPlacement,name:r.props.name,onBlur:function(l){return r.handleBlur(l,d)},onFocus:function(l){return r.handleFocus(l,d)},onChange:r.props.onChange,onMouseEnter:r.props.onMouseEnter,onMouseLeave:r.props.onMouseLeave})}))}}]),o}(c.Component);z(le,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});function ee(e){"@babel/helpers - typeof";return ee=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},ee(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},w.apply(this,arguments)}function F(e,t){return _e(e)||He(e,t)||Ve(e,t)||ze()}function ze(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ve(e,t){if(e){if(typeof e=="string")return ce(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set")return Array.from(e);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return ce(e,t)}}function ce(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function He(e,t){var o=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(o!=null){var r=[],n=!0,s=!1,i,a;try{for(o=o.call(e);!(n=(i=o.next()).done)&&(r.push(i.value),!(t&&r.length===t));n=!0);}catch(u){s=!0,a=u}finally{try{!n&&o.return!=null&&o.return()}finally{if(s)throw a}}return r}}function _e(e){if(Array.isArray(e))return e}function Ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ue(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qe(e,t,o){return Ue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ge(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&&te(e,t)}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},te(e,t)}function We(e){var t=Ke();return function(){var o=V(e),r;if(t){var n=V(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return Xe(this,r)}}function Xe(e,t){if(t&&(ee(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P(e)}function P(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ke(){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 V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(e)}function x(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function Je(e){return e==="top"||e==="left"}function Qe(e){return e==="bottom"||e==="right"}var Ye=function(e){return e.stopPropagation()},ue=function(e){Ge(o,e);var t=We(o);function o(){var r;Ne(this,o);for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),x(P(r),"state",{isActive:!1,isHovered:!1}),x(P(r),"onMouseEnter",function(a){r.setState({isHovered:!0}),r.props.onMouseEnter&&r.props.onMouseEnter(a)}),x(P(r),"onMouseLeave",function(a){r.setState({isHovered:!1}),r.props.onMouseLeave&&r.props.onMouseLeave(a)}),x(P(r),"onMouseDown",function(a){r.setState({isActive:!0}),r.props.onMouseDown&&r.props.onMouseDown(a)}),x(P(r),"onMouseUp",function(a){r.setState({isActive:!1}),r.props.onMouseUp&&r.props.onMouseUp(a)}),r}return qe(o,[{key:"componentDidMount",value:function(){var r;this.props.autoFocus&&(r=this.props.inputRef)!==null&&r!==void 0&&r.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var r=this.props.overrides,n=r===void 0?{}:r,s=O(n.Root,q),i=F(s,2),a=i[0],u=i[1],f=O(n.Label,X),p=F(f,2),d=p[0],h=p[1],l=O(n.Input,K),b=F(l,2),j=b[0],H=b[1],$=O(n.Description,J),E=F($,2),_=E[0],S=E[1],N=O(n.RadioMarkInner,G),m=F(N,2),y=m[0],v=m[1],pe=O(n.RadioMarkOuter,W),re=F(pe,2),de=re[0],fe=re[1],M={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},oe=c.createElement(d,w({},M,h),this.props.containsInteractiveElement?c.createElement("div",{onClick:function(he){return he.preventDefault()}},this.props.children):this.props.children);return c.createElement(c.Fragment,null,c.createElement(a,w({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},M,u),Je(this.props.labelPlacement)&&oe,c.createElement(de,w({},M,fe),c.createElement(y,w({},M,v))),c.createElement(j,w({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:Ye,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},M,H)),Qe(this.props.labelPlacement)&&oe),!!this.props.description&&c.createElement(_,w({},M,S),this.props.description))}}]),o}(c.Component);x(ue,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:c.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});function Ze({disabled:e,horizontal:t,width:o,value:r,onChange:n,options:s,captions:i,label:a,labelVisibility:u,help:f}){const[p,d]=c.useState(r??null);c.useEffect(()=>{r!==p&&d(r??null)},[r]);const h=c.useCallback(m=>{const y=parseInt(m.target.value,10);d(y),n(y)},[n]),l=me(),{colors:b,radii:j}=l,H={width:o},$=i.length>0,E=s.length>0,_=E?s:["No options to select."],S=e||!E,N=m=>m==""&&t&&$?" ":m;return g.jsxs("div",{className:"stRadio","data-testid":"stRadio",style:H,children:[g.jsx(ge,{label:a,disabled:S,labelVisibility:u,children:f&&g.jsx(ye,{children:g.jsx(ve,{content:f,placement:we.TOP_RIGHT})})}),g.jsx(le,{onChange:h,value:p!==null?p.toString():void 0,disabled:S,align:t?ie.horizontal:ie.vertical,"aria-label":a,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:$?l.spacing.sm:l.spacing.none,minHeight:l.sizes.minElementHeight}}},children:_.map((m,y)=>g.jsxs(ue,{value:y.toString(),overrides:{Root:{style:({$isFocusVisible:v})=>({marginBottom:l.spacing.none,marginTop:l.spacing.none,marginRight:$?l.spacing.sm:l.spacing.lg,paddingLeft:l.spacing.none,alignItems:"start",paddingRight:l.spacing.threeXS,backgroundColor:v?b.darkenedBgMix25:"",borderTopLeftRadius:j.md,borderTopRightRadius:j.md,borderBottomLeftRadius:j.md,borderBottomRightRadius:j.md})},RadioMarkOuter:{style:({$checked:v})=>({width:l.sizes.checkbox,height:l.sizes.checkbox,marginTop:"0.35rem",marginRight:l.spacing.none,marginLeft:l.spacing.none,backgroundColor:v&&!S?b.primary:b.fadedText40})},RadioMarkInner:{style:({$checked:v})=>({height:v?"37.5%":`calc(${l.sizes.checkbox} - ${l.spacing.threeXS})`,width:v?"37.5%":`calc(${l.sizes.checkbox} - ${l.spacing.threeXS})`})},Label:{style:{color:S?b.fadedText40:b.bodyText,position:"relative",top:l.spacing.px}}},children:[g.jsx(ne,{source:m,allowHTML:!1,isLabel:!0,largerLabel:!0}),$&&g.jsx(ne,{source:N(i[y]),allowHTML:!1,isCaption:!0,isLabel:!0})]},y))})]})}const et=c.memo(Ze);function tt({disabled:e,element:t,widgetMgr:o,width:r,fragmentId:n}){const[s,i]=Oe({getStateFromWidgetMgr:rt,getDefaultStateFromProto:ot,getCurrStateFromProto:nt,updateWidgetMgrState:it,element:t,widgetMgr:o,fragmentId:n}),a=c.useCallback(b=>{i({value:b,fromUi:!0})},[i]),{horizontal:u,options:f,captions:p,label:d,labelVisibility:h,help:l}=t;return g.jsx(et,{label:d,onChange:a,options:f,captions:p,width:r,disabled:e,horizontal:u,labelVisibility:Re(h==null?void 0:h.value),value:s??null,help:l})}function rt(e,t){return e.getIntValue(t)}function ot(e){return e.default??null}function nt(e){return e.value??null}function it(e,t,o,r){t.setIntValue(e,o.value??null,{fromUi:o.fromUi},r)}const at=c.memo(tt);export{at as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as W,r,M as C,bw as T,bx as j,j as l,a_ as k,a$ as L,bc as $,b0 as V,aK as A,bv as N,by as B,br as H,ba as O,bz as P}from"./index-
|
|
1
|
+
import{c as W,r,M as C,bw as T,bx as j,j as l,a_ as k,a$ as L,bc as $,b0 as V,aK as A,bv as N,by as B,br as H,ba as O,bz as P}from"./index-DuoBWGu3.js";import{a as E}from"./useBasicWidgetState-DgnZoFWi.js";import"./FormClearHelper-BIZNCxvb.js";const F=W("div",{target:"e6zijwc0"})(({theme:o})=>({"span[aria-disabled='true']":{background:o.colors.fadedText05}}),""),G=(o,t)=>o.getIntArrayValue(t),K=o=>o.default??null,U=o=>o.value??null,D=(o,t,n,p)=>{t.setIntArrayValue(o,n.value,{fromUi:n.fromUi},p)},_=o=>{var S;const{element:t,widgetMgr:n,width:p,fragmentId:f}=o,e=C(),[s,m]=E({getStateFromWidgetMgr:G,getDefaultStateFromProto:K,getCurrStateFromProto:U,updateWidgetMgrState:D,element:t,widgetMgr:n,fragmentId:f}),u=t.maxSelections>0&&s.length>=t.maxSelections,y=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(s.length===t.maxSelections){const i=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${i}. Remove an option first.`}return"No results"},[t.maxSelections,s.length]),v=r.useMemo(()=>s.map(i=>{const a=t.options[i];return{value:i.toString(),label:a}}),[t.options,s]),h=r.useCallback(i=>{const a=()=>{var c;const g=(c=i.option)==null?void 0:c.value;return parseInt(g,10)};switch(i.type){case"remove":return T(s,a());case"clear":return[];case"select":return s.concat([a()]);default:throw new Error(`State transition is unknown: ${i.type}`)}},[s]),x=r.useCallback(i=>{t.maxSelections&&i.type==="select"&&s.length>=t.maxSelections||m({value:h(i),fromUi:!0})},[t.maxSelections,h,m,s.length]),z=r.useCallback((i,a)=>{if(u)return[];const g=i.filter(c=>!s.includes(Number(c.value)));return j(g,a)},[u,s]),w={width:p},{options:d}=t,b=d.length===0?!0:o.disabled,R=d.length===0?"No options to select.":t.placeholder,I=d.map((i,a)=>({label:i,value:a.toString()})),M=d.length>10;return l.jsxs("div",{className:"stMultiSelect","data-testid":"stMultiSelect",style:w,children:[l.jsx(k,{label:t.label,disabled:b,labelVisibility:L((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&l.jsx($,{children:l.jsx(V,{content:t.help,placement:A.TOP_RIGHT})})}),l.jsx(F,{children:l.jsx(N,{options:I,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:R,type:B.select,multi:!0,onChange:x,value:v,disabled:b,size:"compact",noResultsMsg:y,filterOptions:z,closeOnSelect:!1,overrides:{SelectArrow:{component:H,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",opacity:"0.7"})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:O&&M===!1?"readonly":null}},Dropdown:{component:P}}})})]})},q=r.memo(_);export{q 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-DuoBWGu3.js";import{u as U}from"./uniqueId-D81S8Chc.js";import{u as _,a as B,b as L}from"./useOnInputChange-DTjT_cKQ.js";import{a as K}from"./useBasicWidgetState-DgnZoFWi.js";import{I as O}from"./InputInstructions-B9wXy3U4.js";import{I as $}from"./input-OLwqq6dJ.js";import"./inputUtils-CptNuJwn.js";import"./FormClearHelper-BIZNCxvb.js";import"./base-input-CMN1_Ew_.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 as y,E,_ as R,c as C,Q as G,j as u,b1 as X,aK as k,aX as q,aG as Q,aY as O,b9 as z,e as J,g as K,a7 as Y,M as Z,ba as ee,bb as te,R as re,O as ie,$ as se,B as P,as as _,aU as ne,aT as ae,a_ as oe,a$ as le,bc as de,b0 as ce}from"./index-gy-vJk95.js";import{F as he}from"./FormClearHelper-CQJ4hAhl.js";import{U as V}from"./UploadFileInfo-C-jY39rj.js";import{P as ue,S as pe}from"./ProgressBar-DOQ5M8oh.js";var L=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});L.displayName="Video";var D=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});D.displayName="X";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ge(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const W=C("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=C("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),fe=C("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),me=C("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),ve=C("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),Se=C("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),ye=C("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),we=C("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),be=C("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${G(i.colors.primary,.5)}`},...ge("medium",i)}),"");function H({disabled:i,onClick:l,children:t,progress:s}){return u.jsxs(be,{disabled:i||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[t,s&&u.jsx(we,{children:u.jsx(ue,{value:s,size:pe.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Me=({switchFacingMode:i})=>u.jsx(ye,{"data-testid":"stCameraInputSwitchButton",children:u.jsx(X,{content:"Switch camera",placement:k.TOP_RIGHT,children:u.jsx(q,{kind:Q.MINIMAL,onClick:i,children:u.jsx(O,{content:$,size:"twoXL",color:z.white})})})});var A={exports:{}};(function(i,l){(function(t,s){i.exports=s(y)})(J,function(t){return function(s){var n={};function a(o){if(n[o])return n[o].exports;var p=n[o]={i:o,l:!1,exports:{}};return s[o].call(p.exports,p,p.exports,a),p.l=!0,p.exports}return a.m=s,a.c=n,a.d=function(o,p,S){a.o(o,p)||Object.defineProperty(o,p,{enumerable:!0,get:S})},a.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},a.t=function(o,p){if(p&1&&(o=a(o)),p&8||p&4&&typeof o=="object"&&o&&o.__esModule)return o;var S=Object.create(null);if(a.r(S),Object.defineProperty(S,"default",{enumerable:!0,value:o}),p&2&&typeof o!="string")for(var x in o)a.d(S,x,(function(U){return o[U]}).bind(null,x));return S},a.n=function(o){var p=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(p,"a",p),p},a.o=function(o,p){return Object.prototype.hasOwnProperty.call(o,p)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(s,n,a){a.r(n);var o=a("react"),p=function(){var g=function(h,e){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,d){r.__proto__=d}||function(r,d){for(var c in d)d.hasOwnProperty(c)&&(r[c]=d[c])},g(h,e)};return function(h,e){g(h,e);function r(){this.constructor=h}h.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),S=function(){return S=Object.assign||function(g){for(var h,e=1,r=arguments.length;e<r;e++){h=arguments[e];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(g[d]=h[d])}return g},S.apply(this,arguments)},x=function(g,h){var e={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&h.indexOf(r)<0&&(e[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(g);d<r.length;d++)h.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(g,r[d])&&(e[r[d]]=g[r[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var h=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return h?new Promise(function(e,r){h.call(navigator,g,e,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var j=function(g){p(h,g);function h(e){var r=g.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return h.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!U()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},h.prototype.componentDidUpdate=function(e){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(r.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(r.videoConstraints),w=e.minScreenshotWidth!==r.minScreenshotWidth,v=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||v)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},h.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},h.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(r){e.removeTrack(r),r.stop()}),e.getAudioTracks().map(function(r){e.removeTrack(r),r.stop()})):e.stop())},h.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(h.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},h.prototype.getScreenshot=function(e){var r=this,d=r.state,c=r.props;if(!d.hasUserMedia)return null;var w=this.getCanvas(e);return w&&w.toDataURL(c.screenshotFormat,c.screenshotQuality)},h.prototype.getCanvas=function(e){var r=this,d=r.state,c=r.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var f=w/v;w=c.minScreenshotWidth||this.video.clientWidth,v=w/f,c.minScreenshotHeight&&v<c.minScreenshotHeight&&(v=c.minScreenshotHeight,w=v*f)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||w,this.canvas.height=(e==null?void 0:e.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,m=M.canvas;return b&&m&&(m.width=(e==null?void 0:e.width)||m.width,m.height=(e==null?void 0:e.height)||m.height,c.mirrored&&(b.translate(m.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,(e==null?void 0:e.width)||m.width,(e==null?void 0:e.height)||m.height),c.mirrored&&(b.scale(-1,1),b.translate(-m.width,0))),m},h.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(v,f){var M={video:typeof f<"u"?f:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(m){e.unmounted||b!==e.requestUserMediaId?h.stopMediaStream(m):e.handleUserMedia(null,m)}).catch(function(m){e.handleUserMedia(m)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(v){return{optional:[{sourceId:v}]}},w=function(v){var f=v.deviceId;return typeof f=="string"?f:Array.isArray(f)&&f.length>0?f[0]:typeof f=="object"&&f.ideal?f.ideal:null};MediaStreamTrack.getSources(function(v){var f=null,M=null;v.forEach(function(I){I.kind==="audio"?f=I.id:I.kind==="video"&&(M=I.id)});var b=w(r.audioConstraints);b&&(f=b);var m=w(r.videoConstraints);m&&(M=m),d(c(f),c(M))})}},h.prototype.handleUserMedia=function(e,r){var d=this.props;if(e||!r){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}d.onUserMedia(r)},h.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,w=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,f=c.style,M=f===void 0?{}:f,b=c.children,m=x(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),I=v?S(S({},M),{transform:(M.transform||"")+" scaleX(-1)"}):M,N={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",S({autoPlay:!0,src:d.src,muted:!w,playsInline:!0,ref:function(B){e.video=B},style:I},m)),b&&b(N))},h.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},h}(o.Component);n.default=j},react:function(s,n){s.exports=t}}).default})})(A);var Ue=A.exports;const xe=K(Ue),Ce=({width:i})=>u.jsxs(T,{width:i,children:[u.jsx(O,{size:"threeXL",color:z.gray60,content:L}),u.jsxs(fe,{children:["This app would like to use your camera.",u.jsx(ve,{href:te,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),je=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:s,setClearPhotoInProgress:n,facingMode:a,setFacingMode:o,testOverride:p})=>{const[S,x]=y.useState(p||"pending"),U=y.useRef(null),[j,g]=y.useState(l),h=y.useCallback(Y(1e3,g),[]);y.useEffect(()=>{h(l)},[l,h]);function e(){if(U.current!==null){const d=U.current.getScreenshot();i(d)}}const r=Z();return u.jsxs(W,{"data-testid":"stCameraInputWebcamComponent",children:[S!=="success"&&!t&&!s?u.jsx(Ce,{width:j}):ee&&u.jsx(Me,{switchFacingMode:o}),u.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:S!=="success"&&!t&&!s,width:j,children:!t&&u.jsx(xe,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:j,height:j*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{x("error")},onUserMedia:()=>{x("success"),n(!1)},videoConstraints:{width:{ideal:j},facingMode:a}})}),u.jsx(H,{onClick:e,disabled:S!=="success"||t||s,children:"Take Photo"})]})},Ie=150;class Pe extends re.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new he,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const s=n=>new Promise(a=>setTimeout(a,n));return Fe(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(n=>this.props.uploadClient.fetchFileURLs([n]).then(a=>({file:n,fileUrls:a[0]}))).then(({file:n,fileUrls:a})=>this.uploadFile(a,n)).then(()=>s(Ie)).then(()=>{this.setState((n,a)=>({imgSrc:t,shutter:n.shutter,minShutterEffectPassed:!0}))}).catch(n=>{ie(n)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(t=>this.deleteFile(t.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:s,widgetMgr:n,fragmentId:a}=this.props,o=n.getFileUploaderStateValue(s);se(t,o)||n.setFileUploaderStateValue(s,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:s,element:n,fragmentId:a}=this.props;s.setFileUploaderStateValue(n,t,{fromUi:!0},a)})},this.deleteFile=t=>{const s=this.getFile(t);P(s)||(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(s=>({files:[...s.files,t]}))},this.removeFile=t=>{this.setState(s=>({files:s.files.filter(n=>n.id!==t)}))},this.getFile=t=>this.state.files.find(s=>s.id===t),this.updateFile=(t,s)=>{this.setState(n=>({files:n.files.map(a=>a.id===t?s:a)}))},this.onUploadComplete=(t,s)=>{this.setState(()=>({shutter:!1}));const n=this.getFile(t);P(n)||n.status.type!=="uploading"||this.updateFile(n.id,n.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(t,s)=>{const n=this.getFile(s);if(P(n)||n.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);n.status.progress!==a&&this.updateFile(s,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,s)=>{const n=_.CancelToken.source(),a=new V(s.name,s.size,this.nextLocalFileId(),{type:"uploading",cancelToken:n,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,s,o=>this.onUploadProgress(o,a.id),n.token).then(()=>this.onUploadComplete(a.id,t)).catch(o=>{_.isCancel(o)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:o?o.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:t,element:s}=this.props,n=t.getFileUploaderStateValue(s);if(P(n))return l;const{uploadedFileInfo:a}=n;return P(a)||a.length===0?l:{files:a.map(o=>{const p=o.name,S=o.size,x=o.fileId,U=o.fileUrls;return new V(p,S,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:U})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:n}=this.props;s.getFileUploaderStateValue(t)===void 0&&s.setFileUploaderStateValue(t,l,{fromUi:!1},n)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:s,size:n,status:a}=t;return new ne({fileId:a.fileId,fileUrls:a.fileUrls,name:s,size:n})});return new ae({uploadedFileInfo:l})}render(){var a;const{element:l,widgetMgr:t,disabled:s,width:n}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),u.jsxs(W,{className:"stCameraInput","data-testid":"stCameraInput",children:[u.jsx(oe,{label:l.label,disabled:s,labelVisibility:le((a=l.labelVisibility)==null?void 0:a.value),children:l.help&&u.jsx(de,{children:u.jsx(ce,{content:l.help,placement:k.TOP_RIGHT})})}),this.state.imgSrc?u.jsxs(u.Fragment,{children:[u.jsx(T,{width:n,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&u.jsx(me,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:n,height:n*9/16})}),u.jsx(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":u.jsxs(Se,{children:[u.jsx(O,{content:D,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):u.jsx(je,{handleCapture:this.handleCapture,width:n,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Fe(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}export{Pe as default};
|
|
1
|
+
import{r as y,E,_ as R,c as C,Q as G,j as u,b1 as X,aK as k,aX as q,aG as Q,aY as O,b9 as z,e as J,g as K,a7 as Y,M as Z,ba as ee,bb as te,R as re,O as ie,$ as se,B as P,as as _,aU as ne,aT as ae,a_ as oe,a$ as le,bc as de,b0 as ce}from"./index-DuoBWGu3.js";import{F as he}from"./FormClearHelper-BIZNCxvb.js";import{U as V}from"./UploadFileInfo-C-jY39rj.js";import{P as ue,S as pe}from"./ProgressBar-BlPlcnwu.js";var L=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M.5 1c-.28 0-.5.23-.5.5v4c0 .28.23.5.5.5h5c.28 0 .5-.22.5-.5V4l1 1h1V2H7L6 3V1.5c0-.28-.22-.5-.5-.5h-5z"}))});L.displayName="Video";var D=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},i,{ref:l}),y.createElement("path",{d:"M1.41 0L0 1.41l.72.72L2.5 3.94.72 5.72 0 6.41l1.41 1.44.72-.72 1.81-1.81 1.78 1.81.69.72 1.44-1.44-.72-.69-1.81-1.78 1.81-1.81.72-.72L6.41 0l-.69.72L3.94 2.5 2.13.72 1.41 0z"}))});D.displayName="X";var $=y.forwardRef(function(i,l){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return y.createElement(E,R({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},i,{ref:l}),y.createElement("rect",{width:24,height:24,fill:"none"}),y.createElement("path",{d:"M20 5h-3.17l-1.24-1.35A1.99 1.99 0 0014.12 3H9.88c-.56 0-1.1.24-1.48.65L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-1.35 8.35l-2.79 2.79c-.32.32-.86.1-.86-.35v-1.75H9v1.75c0 .45-.54.67-.85.35l-2.79-2.79c-.2-.2-.2-.51 0-.71l2.79-2.79a.5.5 0 01.85.36v1.83h6v-1.83c0-.45.54-.67.85-.35l2.79 2.79c.2.19.2.51.01.7z"}))});$.displayName="SwitchCamera";function ge(i,l){switch(i){case"xsmall":return{padding:`${l.spacing.twoXS} ${l.spacing.sm}`,fontSize:l.fontSizes.sm};case"small":return{padding:`${l.spacing.twoXS} ${l.spacing.md}`};case"large":return{padding:`${l.spacing.md} ${l.spacing.md}`};default:return{padding:`${l.spacing.xs} ${l.spacing.md}`}}}const W=C("div",{target:"etz5kuj9"})({name:"b6gpc",styles:"position:relative;overflow:hidden;width:100%;object-fit:contain"}),T=C("div",{target:"etz5kuj8"})(({theme:i,width:l})=>({backgroundColor:i.colors.secondaryBg,borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,width:"100%",height:l*9/16,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}),""),fe=C("p",{target:"etz5kuj7"})(({theme:i})=>({marginTop:i.spacing.sm,textAlign:"center"}),""),me=C("img",{target:"etz5kuj6"})(({theme:i,opacity:l})=>({borderRadius:`${i.radii.default} ${i.radii.default} 0 0`,objectFit:"contain",opacity:l}),""),ve=C("a",{target:"etz5kuj5"})(({theme:i})=>({color:i.colors.primary,display:"block",textDecoration:"none"}),""),Se=C("span",{target:"etz5kuj4"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),ye=C("div",{target:"etz5kuj3"})(({theme:i})=>({position:"absolute",top:i.spacing.lg,right:i.spacing.lg,zIndex:i.zIndices.priority,color:i.colors.fadedText40,mixBlendMode:"difference",opacity:.6}),""),we=C("div",{target:"etz5kuj1"})({name:"1yoks5w",styles:"height:fit-content;width:100%;position:absolute;bottom:0"}),be=C("button",{target:"etz5kuj0"})(({theme:i})=>({position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:i.colors.lightenedBg05,border:`${i.sizes.borderWidth} solid ${i.colors.borderColor}`,borderRadius:`0 0 ${i.radii.default} ${i.radii.default}`,"&:hover":{borderColor:i.colors.primary,color:i.colors.primary},"&:active":{color:i.colors.white,borderColor:i.colors.primary,backgroundColor:i.colors.primary},"&:focus:not(:active)":{borderColor:i.colors.primary,color:i.colors.primary},"&:disabled, &:disabled:hover, &:disabled:active":{color:i.colors.fadedText40},fontWeight:i.fontWeights.normal,padding:`${i.spacing.xs} ${i.spacing.md}`,margin:i.spacing.none,lineHeight:i.lineHeights.base,color:"inherit",width:"100%",userSelect:"none","&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${G(i.colors.primary,.5)}`},...ge("medium",i)}),"");function H({disabled:i,onClick:l,children:t,progress:s}){return u.jsxs(be,{disabled:i||!1,onClick:l||(()=>{}),progress:s||null,"data-testid":"stCameraInputButton",children:[t,s&&u.jsx(we,{children:u.jsx(ue,{value:s,size:pe.EXTRASMALL,overrides:{Bar:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarProgress:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}},BarContainer:{style:{borderTopLeftRadius:0,borderTopRightRadius:0}}}})})]})}var F=(i=>(i.USER="user",i.ENVIRONMENT="environment",i))(F||{});const Me=({switchFacingMode:i})=>u.jsx(ye,{"data-testid":"stCameraInputSwitchButton",children:u.jsx(X,{content:"Switch camera",placement:k.TOP_RIGHT,children:u.jsx(q,{kind:Q.MINIMAL,onClick:i,children:u.jsx(O,{content:$,size:"twoXL",color:z.white})})})});var A={exports:{}};(function(i,l){(function(t,s){i.exports=s(y)})(J,function(t){return function(s){var n={};function a(o){if(n[o])return n[o].exports;var p=n[o]={i:o,l:!1,exports:{}};return s[o].call(p.exports,p,p.exports,a),p.l=!0,p.exports}return a.m=s,a.c=n,a.d=function(o,p,S){a.o(o,p)||Object.defineProperty(o,p,{enumerable:!0,get:S})},a.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},a.t=function(o,p){if(p&1&&(o=a(o)),p&8||p&4&&typeof o=="object"&&o&&o.__esModule)return o;var S=Object.create(null);if(a.r(S),Object.defineProperty(S,"default",{enumerable:!0,value:o}),p&2&&typeof o!="string")for(var x in o)a.d(S,x,(function(U){return o[U]}).bind(null,x));return S},a.n=function(o){var p=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(p,"a",p),p},a.o=function(o,p){return Object.prototype.hasOwnProperty.call(o,p)},a.p="",a(a.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":function(s,n,a){a.r(n);var o=a("react"),p=function(){var g=function(h,e){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,d){r.__proto__=d}||function(r,d){for(var c in d)d.hasOwnProperty(c)&&(r[c]=d[c])},g(h,e)};return function(h,e){g(h,e);function r(){this.constructor=h}h.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),S=function(){return S=Object.assign||function(g){for(var h,e=1,r=arguments.length;e<r;e++){h=arguments[e];for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(g[d]=h[d])}return g},S.apply(this,arguments)},x=function(g,h){var e={};for(var r in g)Object.prototype.hasOwnProperty.call(g,r)&&h.indexOf(r)<0&&(e[r]=g[r]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,r=Object.getOwnPropertySymbols(g);d<r.length;d++)h.indexOf(r[d])<0&&Object.prototype.propertyIsEnumerable.call(g,r[d])&&(e[r[d]]=g[r[d]]);return e};(function(){typeof window>"u"||(navigator.mediaDevices===void 0&&(navigator.mediaDevices={}),navigator.mediaDevices.getUserMedia===void 0&&(navigator.mediaDevices.getUserMedia=function(g){var h=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return h?new Promise(function(e,r){h.call(navigator,g,e,r)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}))})();function U(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}var j=function(g){p(h,g);function h(e){var r=g.call(this,e)||this;return r.canvas=null,r.ctx=null,r.requestUserMediaId=0,r.unmounted=!1,r.state={hasUserMedia:!1},r}return h.prototype.componentDidMount=function(){var e=this,r=e.state,d=e.props;if(this.unmounted=!1,!U()){d.onUserMediaError("getUserMedia not supported");return}r.hasUserMedia||this.requestUserMedia(),d.children&&typeof d.children!="function"&&console.warn("children must be a function")},h.prototype.componentDidUpdate=function(e){var r=this.props;if(!U()){r.onUserMediaError("getUserMedia not supported");return}var d=JSON.stringify(e.audioConstraints)!==JSON.stringify(r.audioConstraints),c=JSON.stringify(e.videoConstraints)!==JSON.stringify(r.videoConstraints),w=e.minScreenshotWidth!==r.minScreenshotWidth,v=e.minScreenshotHeight!==r.minScreenshotHeight;(c||w||v)&&(this.canvas=null,this.ctx=null),(d||c)&&(this.stopAndCleanup(),this.requestUserMedia())},h.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},h.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(r){e.removeTrack(r),r.stop()}),e.getAudioTracks().map(function(r){e.removeTrack(r),r.stop()})):e.stop())},h.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(h.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},h.prototype.getScreenshot=function(e){var r=this,d=r.state,c=r.props;if(!d.hasUserMedia)return null;var w=this.getCanvas(e);return w&&w.toDataURL(c.screenshotFormat,c.screenshotQuality)},h.prototype.getCanvas=function(e){var r=this,d=r.state,c=r.props;if(!this.video||!d.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var w=this.video.videoWidth,v=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var f=w/v;w=c.minScreenshotWidth||this.video.clientWidth,v=w/f,c.minScreenshotHeight&&v<c.minScreenshotHeight&&(v=c.minScreenshotHeight,w=v*f)}this.canvas=document.createElement("canvas"),this.canvas.width=(e==null?void 0:e.width)||w,this.canvas.height=(e==null?void 0:e.height)||v,this.ctx=this.canvas.getContext("2d")}var M=this,b=M.ctx,m=M.canvas;return b&&m&&(m.width=(e==null?void 0:e.width)||m.width,m.height=(e==null?void 0:e.height)||m.height,c.mirrored&&(b.translate(m.width,0),b.scale(-1,1)),b.imageSmoothingEnabled=c.imageSmoothing,b.drawImage(this.video,0,0,(e==null?void 0:e.width)||m.width,(e==null?void 0:e.height)||m.height),c.mirrored&&(b.scale(-1,1),b.translate(-m.width,0))),m},h.prototype.requestUserMedia=function(){var e=this,r=this.props,d=function(v,f){var M={video:typeof f<"u"?f:!0};r.audio&&(M.audio=typeof v<"u"?v:!0),e.requestUserMediaId++;var b=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(M).then(function(m){e.unmounted||b!==e.requestUserMediaId?h.stopMediaStream(m):e.handleUserMedia(null,m)}).catch(function(m){e.handleUserMedia(m)})};if("mediaDevices"in navigator)d(r.audioConstraints,r.videoConstraints);else{var c=function(v){return{optional:[{sourceId:v}]}},w=function(v){var f=v.deviceId;return typeof f=="string"?f:Array.isArray(f)&&f.length>0?f[0]:typeof f=="object"&&f.ideal?f.ideal:null};MediaStreamTrack.getSources(function(v){var f=null,M=null;v.forEach(function(I){I.kind==="audio"?f=I.id:I.kind==="video"&&(M=I.id)});var b=w(r.audioConstraints);b&&(f=b);var m=w(r.videoConstraints);m&&(M=m),d(c(f),c(M))})}},h.prototype.handleUserMedia=function(e,r){var d=this.props;if(e||!r){this.setState({hasUserMedia:!1}),d.onUserMediaError(e);return}this.stream=r;try{this.video&&(this.video.srcObject=r),this.setState({hasUserMedia:!0})}catch{this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(r)})}d.onUserMedia(r)},h.prototype.render=function(){var e=this,r=this,d=r.state,c=r.props,w=c.audio;c.forceScreenshotSourceSize,c.onUserMedia,c.onUserMediaError,c.screenshotFormat,c.screenshotQuality,c.minScreenshotWidth,c.minScreenshotHeight,c.audioConstraints,c.videoConstraints,c.imageSmoothing;var v=c.mirrored,f=c.style,M=f===void 0?{}:f,b=c.children,m=x(c,["audio","forceScreenshotSourceSize","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),I=v?S(S({},M),{transform:(M.transform||"")+" scaleX(-1)"}):M,N={getScreenshot:this.getScreenshot.bind(this)};return o.createElement(o.Fragment,null,o.createElement("video",S({autoPlay:!0,src:d.src,muted:!w,playsInline:!0,ref:function(B){e.video=B},style:I},m)),b&&b(N))},h.defaultProps={audio:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},h}(o.Component);n.default=j},react:function(s,n){s.exports=t}}).default})})(A);var Ue=A.exports;const xe=K(Ue),Ce=({width:i})=>u.jsxs(T,{width:i,children:[u.jsx(O,{size:"threeXL",color:z.gray60,content:L}),u.jsxs(fe,{children:["This app would like to use your camera.",u.jsx(ve,{href:te,rel:"noopener noreferrer",target:"_blank",children:"Learn how to allow access."})]})]}),je=({handleCapture:i,width:l,disabled:t,clearPhotoInProgress:s,setClearPhotoInProgress:n,facingMode:a,setFacingMode:o,testOverride:p})=>{const[S,x]=y.useState(p||"pending"),U=y.useRef(null),[j,g]=y.useState(l),h=y.useCallback(Y(1e3,g),[]);y.useEffect(()=>{h(l)},[l,h]);function e(){if(U.current!==null){const d=U.current.getScreenshot();i(d)}}const r=Z();return u.jsxs(W,{"data-testid":"stCameraInputWebcamComponent",children:[S!=="success"&&!t&&!s?u.jsx(Ce,{width:j}):ee&&u.jsx(Me,{switchFacingMode:o}),u.jsx(T,{"data-testid":"stCameraInputWebcamStyledBox",hidden:S!=="success"&&!t&&!s,width:j,children:!t&&u.jsx(xe,{audio:!1,ref:U,screenshotFormat:"image/jpeg",screenshotQuality:1,width:j,height:j*9/16,style:{borderRadius:`${r.radii.default} ${r.radii.default} 0 0`},onUserMediaError:()=>{x("error")},onUserMedia:()=>{x("success"),n(!1)},videoConstraints:{width:{ideal:j},facingMode:a}})}),u.jsx(H,{onClick:e,disabled:S!=="success"||t||s,children:"Take Photo"})]})},Ie=150;class Pe extends re.PureComponent{constructor(l){super(l),this.localFileIdCounter=1,this.RESTORED_FROM_WIDGET_STRING="RESTORED_FROM_WIDGET",this.formClearHelper=new he,this.getProgress=()=>{if(this.state.files.length>0&&this.state.files[this.state.files.length-1].status.type==="uploading")return this.state.files[this.state.files.length-1].status.progress},this.setClearPhotoInProgress=t=>{this.setState({clearPhotoInProgress:t})},this.setFacingMode=()=>{this.setState(t=>({facingMode:t.facingMode===F.USER?F.ENVIRONMENT:F.USER}))},this.handleCapture=t=>{if(t===null)return Promise.resolve();this.setState({imgSrc:t,shutter:!0,minShutterEffectPassed:!1});const s=n=>new Promise(a=>setTimeout(a,n));return Fe(t,`camera-input-${new Date().toISOString().replace(/:/g,"_")}.jpg`).then(n=>this.props.uploadClient.fetchFileURLs([n]).then(a=>({file:n,fileUrls:a[0]}))).then(({file:n,fileUrls:a})=>this.uploadFile(a,n)).then(()=>s(Ie)).then(()=>{this.setState((n,a)=>({imgSrc:t,shutter:n.shutter,minShutterEffectPassed:!0}))}).catch(n=>{ie(n)})},this.removeCapture=()=>{this.state.files.length!==0&&(this.state.files.forEach(t=>this.deleteFile(t.id)),this.setState({imgSrc:null,clearPhotoInProgress:!0}))},this.componentDidUpdate=()=>{if(this.status!=="ready")return;const t=this.createWidgetValue(),{element:s,widgetMgr:n,fragmentId:a}=this.props,o=n.getFileUploaderStateValue(s);se(t,o)||n.setFileUploaderStateValue(s,t,{fromUi:!0},a)},this.onFormCleared=()=>{this.setState({files:[]},()=>{const t=this.createWidgetValue();if(P(t))return;this.setState({imgSrc:null});const{widgetMgr:s,element:n,fragmentId:a}=this.props;s.setFileUploaderStateValue(n,t,{fromUi:!0},a)})},this.deleteFile=t=>{const s=this.getFile(t);P(s)||(s.status.type==="uploading"&&s.status.cancelToken.cancel(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&this.props.uploadClient.deleteFile(s.status.fileUrls.deleteUrl),this.removeFile(t))},this.addFile=t=>{this.setState(s=>({files:[...s.files,t]}))},this.removeFile=t=>{this.setState(s=>({files:s.files.filter(n=>n.id!==t)}))},this.getFile=t=>this.state.files.find(s=>s.id===t),this.updateFile=(t,s)=>{this.setState(n=>({files:n.files.map(a=>a.id===t?s:a)}))},this.onUploadComplete=(t,s)=>{this.setState(()=>({shutter:!1}));const n=this.getFile(t);P(n)||n.status.type!=="uploading"||this.updateFile(n.id,n.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},this.onUploadProgress=(t,s)=>{const n=this.getFile(s);if(P(n)||n.status.type!=="uploading")return;const a=Math.round(t.loaded*100/t.total);n.status.progress!==a&&this.updateFile(s,n.setStatus({type:"uploading",cancelToken:n.status.cancelToken,progress:a}))},this.reset=()=>{this.setState({files:[],imgSrc:null})},this.uploadFile=(t,s)=>{const n=_.CancelToken.source(),a=new V(s.name,s.size,this.nextLocalFileId(),{type:"uploading",cancelToken:n,progress:1});this.addFile(a),this.props.uploadClient.uploadFile(this.props.element,t.uploadUrl,s,o=>this.onUploadProgress(o,a.id),n.token).then(()=>this.onUploadComplete(a.id,t)).catch(o=>{_.isCancel(o)||this.updateFile(a.id,a.setStatus({type:"error",errorMessage:o?o.toString():"Unknown error"}))})},this.state=this.initialValue}get initialValue(){const l={files:[],imgSrc:null,shutter:!1,minShutterEffectPassed:!0,clearPhotoInProgress:!1,facingMode:F.USER},{widgetMgr:t,element:s}=this.props,n=t.getFileUploaderStateValue(s);if(P(n))return l;const{uploadedFileInfo:a}=n;return P(a)||a.length===0?l:{files:a.map(o=>{const p=o.name,S=o.size,x=o.fileId,U=o.fileUrls;return new V(p,S,this.nextLocalFileId(),{type:"uploaded",fileId:x,fileUrls:U})}),imgSrc:a.length===0?"":this.RESTORED_FROM_WIDGET_STRING,shutter:!1,minShutterEffectPassed:!1,clearPhotoInProgress:!1,facingMode:F.USER}}componentWillUnmount(){this.formClearHelper.disconnect()}get status(){const l=t=>t.status.type==="uploading";return this.state.files.some(l)?"updating":"ready"}componentDidMount(){const l=this.createWidgetValue(),{element:t,widgetMgr:s,fragmentId:n}=this.props;s.getFileUploaderStateValue(t)===void 0&&s.setFileUploaderStateValue(t,l,{fromUi:!1},n)}createWidgetValue(){const l=this.state.files.filter(t=>t.status.type==="uploaded").map(t=>{const{name:s,size:n,status:a}=t;return new ne({fileId:a.fileId,fileUrls:a.fileUrls,name:s,size:n})});return new ae({uploadedFileInfo:l})}render(){var a;const{element:l,widgetMgr:t,disabled:s,width:n}=this.props;return this.formClearHelper.manageFormClearListener(t,l.formId,this.onFormCleared),u.jsxs(W,{className:"stCameraInput","data-testid":"stCameraInput",children:[u.jsx(oe,{label:l.label,disabled:s,labelVisibility:le((a=l.labelVisibility)==null?void 0:a.value),children:l.help&&u.jsx(de,{children:u.jsx(ce,{content:l.help,placement:k.TOP_RIGHT})})}),this.state.imgSrc?u.jsxs(u.Fragment,{children:[u.jsx(T,{width:n,children:this.state.imgSrc!==this.RESTORED_FROM_WIDGET_STRING&&u.jsx(me,{src:this.state.imgSrc,alt:"Snapshot",opacity:this.state.shutter||!this.state.minShutterEffectPassed?"50%":"100%",width:n,height:n*9/16})}),u.jsx(H,{onClick:this.removeCapture,progress:this.getProgress(),disabled:!!this.getProgress()||s,children:this.getProgress()?"Uploading...":u.jsxs(Se,{children:[u.jsx(O,{content:D,margin:"0 xs 0 0",size:"sm"})," Clear photo"]})})]}):u.jsx(je,{handleCapture:this.handleCapture,width:n,disabled:s,clearPhotoInProgress:this.state.clearPhotoInProgress,setClearPhotoInProgress:this.setClearPhotoInProgress,facingMode:this.state.facingMode,setFacingMode:this.setFacingMode,testOverride:this.props.testOverride})]})}nextLocalFileId(){return this.localFileIdCounter++}}function Fe(i,l){return fetch(i).then(t=>t.arrayBuffer()).then(t=>new File([t],l,{type:"image/jpeg"}))}export{Pe as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{bs as Pe,c0 as Ce,c1 as Ie,c2 as we,c3 as Ee,c4 as Te,bF as De,b2 as xe,bk as Re,c5 as _e,bG as $e,aA as ke,r as P,c6 as Be,c as Me,B as R,M as ze,br as Ne,j as S,a_ as Ae,a$ as Le,bc as Fe,b0 as We,aK as Ze}from"./index-
|
|
1
|
+
import{bs as Pe,c0 as Ce,c1 as Ie,c2 as we,c3 as Ee,c4 as Te,bF as De,b2 as xe,bk as Re,c5 as _e,bG as $e,aA as ke,r as P,c6 as Be,c as Me,B as R,M as ze,br as Ne,j as S,a_ as Ae,a$ as Le,bc as Fe,b0 as We,aK as Ze}from"./index-DuoBWGu3.js";import{a as Ve}from"./useBasicWidgetState-DgnZoFWi.js";import{T as He}from"./timepicker-BD9p-9JQ.js";import"./FormClearHelper-BIZNCxvb.js";import"./getPrototypeOf-CHt6AZp_.js";import"./createSuper-D4gvBB5j.js";var Ue=Pe.Consumer;const Je=Object.freeze(Object.defineProperty({__proto__:null,ThemeConsumer:Ue,ThemeProvider:Ce,createThemedStyled:Ie,createThemedUseStyletron:we,createThemedWithStyle:Ee,expandBorderStyles:Te,hexToRgb:De,styled:xe,useStyletron:Re,withStyle:_e,withWrapper:$e},Symbol.toStringTag,{value:"Module"}));var d={};const _=ke(Je);var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.STATE_CHANGE_TYPE=g.SIZE=g.ENHANCER_POSITION=g.CUSTOM_INPUT_TYPE=g.ADJOINED=void 0;var Ge={change:"change"};g.STATE_CHANGE_TYPE=Ge;var Ye={textarea:"textarea"};g.CUSTOM_INPUT_TYPE=Ye;var qe={none:"none",left:"left",right:"right",both:"both"};g.ADJOINED=qe;var Ke={mini:"mini",default:"default",compact:"compact",large:"large"};g.SIZE=Ke;var Xe={start:"start",end:"end"};g.ENHANCER_POSITION=Xe;var E={},y={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.default=te;function k(e){"@babel/helpers - typeof";return k=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},k(e)}function te(e){e=e||{};for(var t=arguments.length<=1?0:arguments.length-1,r,o,n=0;n<t;n++){r=(n+1<1||arguments.length<=n+1?void 0:arguments[n+1])||{};for(var i in r)k(r[i])!==void 0&&(o=r[i],Qe(o)?e[i]=te(e[i]||Array.isArray(o)&&[]||{},o):e[i]=o)}return e}function Qe(e){return Array.isArray(e)||{}.toString.call(e)=="[object Object]"}Object.defineProperty(y,"__esModule",{value:!0}),y.getOverride=ae,y.getOverrideProps=z,y.getOverrides=le,y.mergeConfigurationOverrides=A,y.mergeOverride=ue,y.mergeOverrides=ot,y.toObjectOverride=N,y.useOverrides=nt;var B=tt(P),re=Be,oe=et($);function et(e){return e.__esModule?e:{default:e}}function ne(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(ne=function(o){return o?r:t})(e)}function tt(e,t){if(e&&e.__esModule)return e;if(e===null||v(e)!=="object"&&typeof e!="function")return{default:e};var r=ne(t);if(r&&r.has(e))return r.get(e);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=e[i]}return o.default=e,r&&r.set(e,o),o}function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},M.apply(this,arguments)}function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,o)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ie(Object(r),!0).forEach(function(o){rt(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function rt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e){"@babel/helpers - typeof";return v=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},v(e)}function ae(e){return(0,re.isValidElementType)(e)?e:e&&v(e)==="object"?e.component:e}function z(e){return e&&v(e)==="object"?v(e.props)==="object"?C(C({},e.props),{},{$style:e.style}):{$style:e.style}:{}}function N(e){return(0,re.isValidElementType)(e)?{component:e}:e||{}}function le(e,t){var r=ae(e)||t;if(e&&v(e)==="object"&&typeof e.props=="function"){var o=B.forwardRef(function(i,a){var c=e.props(i),s=z(C(C({},e),{},{props:c}));return B.createElement(r,M({ref:a},s))});return o.displayName=r.displayName,[o,{}]}var n=z(e);return[r,n]}function ot(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=Object.assign({},e,t),o=Object.keys(r);return o.reduce(function(n,i){return n[i]=ue(N(e[i]),N(t[i])),n},{})}function ue(e,t){var r=C(C({},e),t);return e.props&&t.props&&(r.props=A(e.props,t.props)),e.style&&t.style&&(r.style=A(e.style,t.style)),r}function A(e,t){return v(e)==="object"&&v(t)==="object"?(0,oe.default)({},e,t):function(){return(0,oe.default)({},typeof e=="function"?e.apply(void 0,arguments):e,typeof t=="function"?t.apply(void 0,arguments):t)}}function nt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return B.useMemo(function(){return Object.keys(e).reduce(function(r,o){return r[o]=le(t[o],e[o]),r},{})},[t])}var T={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.Svg=void 0,I.getSvgStyles=se;var it=_;function se(e){var t=e.$theme,r=e.$size,o=e.$color,n=t.sizing.scale600;r&&(t.sizing[r]?n=t.sizing[r]:typeof r=="number"?n="".concat(r,"px"):n=r);var i="currentColor";return o&&(t.colors[o]?i=t.colors[o]:i=o),{display:"inline-block",fill:i,color:i,height:n,width:n}}var L=(0,it.styled)("svg",se);I.Svg=L,L.displayName="Svg",L.displayName="Svg";var F={};Object.defineProperty(F,"__esModule",{value:!0}),F.default=at;function at(e){var t={};for(var r in e)r[0]!=="$"&&(t[r]=e[r]);return t}function W(e){"@babel/helpers - typeof";return W=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},W(e)}Object.defineProperty(T,"__esModule",{value:!0}),T.default=void 0;var Z=dt(P),lt=y,ut=I,ce=ct(F),st=["children","title","size","color","overrides"];function ct(e){return e.__esModule?e:{default:e}}function de(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(de=function(o){return o?r:t})(e)}function dt(e,t){if(e&&e.__esModule)return e;if(e===null||W(e)!=="object"&&typeof e!="function")return{default:e};var r=de(t);if(r&&r.has(e))return r.get(e);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=e[i]}return o.default=e,r&&r.set(e,o),o}function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},V.apply(this,arguments)}function pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,o)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pe(Object(r),!0).forEach(function(o){pt(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pe(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ft(e,t){return mt(e)||yt(e,t)||bt(e,t)||gt()}function gt(){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 bt(e,t){if(e){if(typeof e=="string")return fe(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 fe(e,t)}}function fe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function yt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o=[],n=!0,i=!1,a,c;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(o.push(a.value),!(t&&o.length===t));n=!0);}catch(s){i=!0,c=s}finally{try{!n&&r.return!=null&&r.return()}finally{if(i)throw c}}return o}}function mt(e){if(Array.isArray(e))return e}function vt(e,t){if(e==null)return{};var r=ht(e,t),o,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function ht(e,t){if(e==null)return{};var r={},o=Object.keys(e),n,i;for(i=0;i<o.length;i++)n=o[i],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}var Ot=function(e,t){var r=e.children,o=e.title,n=e.size,i=e.color,a=e.overrides,c=a===void 0?{}:a,s=vt(e,st),l=(0,lt.getOverrides)(c.Svg,ut.Svg),f=ft(l,2),m=f[0],h=f[1],O=m.__STYLETRON__?D(D({title:o,$color:i,$size:n},s),h):D(D({title:o,color:i,size:n},(0,ce.default)(s)),(0,ce.default)(h));return Z.createElement(m,V({"data-baseweb":"icon",ref:t},O),o?Z.createElement("title",null,o):null,r)},St=Z.forwardRef(Ot);T.default=St;function H(e){"@babel/helpers - typeof";return H=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},H(e)}Object.defineProperty(E,"__esModule",{value:!0}),E.default=void 0;var U=wt(P),jt=_,ge=y,Pt=It(T),Ct=["title","size","color","overrides"];function It(e){return e.__esModule?e:{default:e}}function be(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(be=function(o){return o?r:t})(e)}function wt(e,t){if(e&&e.__esModule)return e;if(e===null||H(e)!=="object"&&typeof e!="function")return{default:e};var r=be(t);if(r&&r.has(e))return r.get(e);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var a=n?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=e[i]}return o.default=e,r&&r.set(e,o),o}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},J.apply(this,arguments)}function Et(e,t){if(e==null)return{};var r=Tt(e,t),o,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],!(t.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function Tt(e,t){if(e==null)return{};var r={},o=Object.keys(e),n,i;for(i=0;i<o.length;i++)n=o[i],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}function Dt(e,t){return $t(e)||_t(e,t)||Rt(e,t)||xt()}function xt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rt(e,t){if(e){if(typeof e=="string")return ye(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 ye(e,t)}}function ye(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function _t(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o=[],n=!0,i=!1,a,c;try{for(r=r.call(e);!(n=(a=r.next()).done)&&(o.push(a.value),!(t&&o.length===t));n=!0);}catch(s){i=!0,c=s}finally{try{!n&&r.return!=null&&r.return()}finally{if(i)throw c}}return o}}function $t(e){if(Array.isArray(e))return e}function kt(e,t){var r=(0,jt.useStyletron)(),o=Dt(r,2),n=o[1],i=e.title,a=i===void 0?"Delete Alt":i,c=e.size,s=e.color,l=e.overrides,f=l===void 0?{}:l,m=Et(e,Ct),h=(0,ge.mergeOverride)({component:n.icons&&n.icons.DeleteAlt?n.icons.DeleteAlt:null},f&&f.Svg?(0,ge.toObjectOverride)(f.Svg):{});return U.createElement(Pt.default,J({viewBox:"0 0 24 24",ref:t,title:a,size:c,color:s,overrides:{Svg:h}},m),U.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 20C16.4183 20 20 16.4183 20 12C20 7.58173 16.4183 4 12 4C7.58173 4 4 7.58173 4 12C4 16.4183 7.58173 20 12 20ZM10.0303 8.96967C9.73743 8.67679 9.26257 8.67679 8.96967 8.96967C8.67676 9.26257 8.67676 9.73743 8.96967 10.0303L10.9393 12L8.96967 13.9697C8.67676 14.2626 8.67676 14.7374 8.96967 15.0303C9.26257 15.3232 9.73743 15.3232 10.0303 15.0303L12 13.0607L13.9697 15.0303C14.2626 15.3232 14.7374 15.3232 15.0303 15.0303C15.3232 14.7374 15.3232 14.2626 15.0303 13.9697L13.0607 12L15.0303 10.0303C15.3232 9.73743 15.3232 9.26257 15.0303 8.96967C14.7374 8.67679 14.2626 8.67679 13.9697 8.96967L12 10.9393L10.0303 8.96967Z"}))}var Bt=U.forwardRef(kt);E.default=Bt,Object.defineProperty(d,"__esModule",{value:!0}),d.getRootStyles=d.getInputStyles=d.getInputContainerStyles=d.StyledMaskToggleButton=d.StyledClearIconContainer=ve=d.StyledClearIcon=d.Root=d.InputEnhancer=d.InputContainer=d.Input=void 0;var j=_,u=g,Mt=zt(E);function zt(e){return e.__esModule?e:{default:e}}function me(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,o)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?me(Object(r),!0).forEach(function(o){p(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):me(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var G=(0,j.styled)("button",function(e){var t,r=e.$theme,o=e.$size,n=e.$isFocusVisible,i=(t={},p(t,u.SIZE.mini,r.sizing.scale400),p(t,u.SIZE.compact,r.sizing.scale400),p(t,u.SIZE.default,r.sizing.scale300),p(t,u.SIZE.large,r.sizing.scale200),t)[o];return{display:"flex",alignItems:"center",borderTopStyle:"none",borderBottomStyle:"none",borderLeftStyle:"none",borderRightStyle:"none",background:"none",paddingLeft:i,paddingRight:i,outline:n?"solid 3px ".concat(r.colors.accent):"none",color:r.colors.contentPrimary}});d.StyledMaskToggleButton=G,G.displayName="StyledMaskToggleButton",G.displayName="StyledMaskToggleButton";var Y=(0,j.styled)("div",function(e){var t,r=e.$alignTop,o=r===void 0?!1:r,n=e.$size,i=e.$theme,a=(t={},p(t,u.SIZE.mini,i.sizing.scale200),p(t,u.SIZE.compact,i.sizing.scale200),p(t,u.SIZE.default,i.sizing.scale100),p(t,u.SIZE.large,i.sizing.scale0),t)[n];return{display:"flex",alignItems:o?"flex-start":"center",paddingLeft:a,paddingRight:a,paddingTop:o?i.sizing.scale500:"0px",color:i.colors.contentPrimary}});d.StyledClearIconContainer=Y,Y.displayName="StyledClearIconContainer",Y.displayName="StyledClearIconContainer";var q=(0,j.styled)(Mt.default,function(e){var t=e.$theme,r=e.$isFocusVisible;return{cursor:"pointer",outline:r?"solid 3px ".concat(t.colors.accent):"none"}}),ve=d.StyledClearIcon=q;q.displayName="StyledClearIcon",q.displayName="StyledClearIcon";function Nt(e,t){var r;return(r={},p(r,u.SIZE.mini,{paddingTop:t.scale100,paddingBottom:t.scale100,paddingLeft:t.scale550,paddingRight:t.scale550}),p(r,u.SIZE.compact,{paddingTop:t.scale200,paddingBottom:t.scale200,paddingLeft:t.scale550,paddingRight:t.scale550}),p(r,u.SIZE.default,{paddingTop:t.scale400,paddingBottom:t.scale400,paddingLeft:t.scale550,paddingRight:t.scale550}),p(r,u.SIZE.large,{paddingTop:t.scale550,paddingBottom:t.scale550,paddingLeft:t.scale550,paddingRight:t.scale550}),r)[e]}function At(e,t,r,o,n){var i=e===u.ADJOINED.both||e===u.ADJOINED.left&&o!=="rtl"||e===u.ADJOINED.right&&o==="rtl"||n&&o==="rtl",a=e===u.ADJOINED.both||e===u.ADJOINED.right&&o!=="rtl"||e===u.ADJOINED.left&&o==="rtl"||n&&o!=="rtl";return{paddingLeft:i?r.scale550:"0px",paddingRight:a?r.scale550:"0px"}}function x(e,t){var r;return(r={},p(r,u.SIZE.mini,t.font100),p(r,u.SIZE.compact,t.font200),p(r,u.SIZE.default,t.font300),p(r,u.SIZE.large,t.font400),r)[e]}function Lt(e,t,r){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,n=arguments.length>4?arguments[4]:void 0;return e?{borderLeftColor:n.inputFillDisabled,borderRightColor:n.inputFillDisabled,borderTopColor:n.inputFillDisabled,borderBottomColor:n.inputFillDisabled,backgroundColor:n.inputFillDisabled}:t?{borderLeftColor:n.borderSelected,borderRightColor:n.borderSelected,borderTopColor:n.borderSelected,borderBottomColor:n.borderSelected,backgroundColor:n.inputFillActive}:r?{borderLeftColor:n.inputBorderError,borderRightColor:n.inputBorderError,borderTopColor:n.inputBorderError,borderBottomColor:n.inputBorderError,backgroundColor:n.inputFillError}:o?{borderLeftColor:n.inputBorderPositive,borderRightColor:n.inputBorderPositive,borderTopColor:n.inputBorderPositive,borderBottomColor:n.inputBorderPositive,backgroundColor:n.inputFillPositive}:{borderLeftColor:n.inputBorder,borderRightColor:n.inputBorder,borderTopColor:n.inputBorder,borderBottomColor:n.inputBorder,backgroundColor:n.inputFill}}function Ft(e,t){var r=t.inputBorderRadius;return e===u.SIZE.mini&&(r=t.inputBorderRadiusMini),{borderTopLeftRadius:r,borderBottomLeftRadius:r,borderTopRightRadius:r,borderBottomRightRadius:r}}var he=function(e){var t=e.$isFocused,r=e.$adjoined,o=e.$error,n=e.$disabled,i=e.$positive,a=e.$size,c=e.$theme,s=e.$theme,l=s.borders,f=s.colors,m=s.sizing,h=s.typography,O=s.animation,w=e.$hasIconTrailing;return b(b(b(b({boxSizing:"border-box",display:"flex",overflow:"hidden",width:"100%",borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",transitionProperty:"border",transitionDuration:O.timing200,transitionTimingFunction:O.easeOutCurve},Ft(a,l)),x(a,h)),Lt(n,t,o,i,f)),At(r,a,m,c.direction,w))};d.getRootStyles=he;var K=(0,j.styled)("div",he);d.Root=K,K.displayName="Root",K.displayName="Root";function Wt(e,t){var r;return(r={},p(r,u.SIZE.mini,{paddingRight:t.scale400,paddingLeft:t.scale400}),p(r,u.SIZE.compact,{paddingRight:t.scale400,paddingLeft:t.scale400}),p(r,u.SIZE.default,{paddingRight:t.scale300,paddingLeft:t.scale300}),p(r,u.SIZE.large,{paddingRight:t.scale200,paddingLeft:t.scale200}),r)[e]}function Zt(e,t,r,o,n){return e?{color:n.inputEnhancerTextDisabled,backgroundColor:n.inputFillDisabled}:t?{color:n.contentPrimary,backgroundColor:n.inputFillActive}:r?{color:n.contentPrimary,backgroundColor:n.inputFillError}:o?{color:n.contentPrimary,backgroundColor:n.inputFillPositive}:{color:n.contentPrimary,backgroundColor:n.inputFill}}var X=(0,j.styled)("div",function(e){var t=e.$size,r=e.$disabled,o=e.$isFocused,n=e.$error,i=e.$positive,a=e.$theme,c=a.colors,s=a.sizing,l=a.typography,f=a.animation;return b(b(b({display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"color, background-color",transitionDuration:f.timing200,transitionTimingFunction:f.easeOutCurve},x(t,l)),Wt(t,s)),Zt(r,o,n,i,c))});d.InputEnhancer=X,X.displayName="InputEnhancer",X.displayName="InputEnhancer";function Vt(e,t,r,o,n){return e?{color:n.inputTextDisabled,backgroundColor:n.inputFillDisabled}:t?{color:n.contentPrimary,backgroundColor:n.inputFillActive}:r?{color:n.contentPrimary,backgroundColor:n.inputFillError}:o?{color:n.contentPrimary,backgroundColor:n.inputFillPositive}:{color:n.contentPrimary,backgroundColor:n.inputFill}}var Oe=function(e){var t=e.$isFocused,r=e.$error,o=e.$disabled,n=e.$positive,i=e.$size,a=e.$theme,c=a.colors,s=a.typography,l=a.animation;return b(b({display:"flex",width:"100%",transitionProperty:"background-color",transitionDuration:l.timing200,transitionTimingFunction:l.easeOutCurve},x(i,s)),Vt(o,t,r,n,c))};d.getInputContainerStyles=Oe;var Q=(0,j.styled)("div",Oe);d.InputContainer=Q,Q.displayName="InputContainer",Q.displayName="InputContainer";function Ht(e,t,r,o){return e?{color:o.inputTextDisabled,"-webkit-text-fill-color":o.inputTextDisabled,caretColor:o.contentPrimary,"::placeholder":{color:o.inputPlaceholderDisabled}}:{color:o.contentPrimary,caretColor:o.contentPrimary,"::placeholder":{color:o.inputPlaceholder}}}var Se=function(e){var t=e.$disabled,r=e.$isFocused,o=e.$error,n=e.$size,i=e.$theme,a=i.colors,c=i.sizing,s=i.typography;return b(b(b({boxSizing:"border-box",backgroundColor:"transparent",borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0,borderLeftStyle:"none",borderRightStyle:"none",borderTopStyle:"none",borderBottomStyle:"none",outline:"none",width:"100%",minWidth:0,maxWidth:"100%",cursor:t?"not-allowed":"text",margin:"0",paddingTop:"0",paddingBottom:"0",paddingLeft:"0",paddingRight:"0"},x(n,s)),Nt(n,c)),Ht(t,r,o,a))};d.getInputStyles=Se;var ee=(0,j.styled)("input",Se);d.Input=ee,ee.displayName="Input",ee.displayName="Input";const Ut=Me("div",{target:"e1ipygm10"})({name:"1ucqwki",styles:"position:absolute;top:50%;right:2.05em"});function Jt({disabled:e,element:t,widgetMgr:r,width:o,fragmentId:n}){var O;const[i,a]=Ve({getStateFromWidgetMgr:Gt,getDefaultStateFromProto:Yt,getCurrStateFromProto:qt,updateWidgetMgrState:Kt,element:t,widgetMgr:r,fragmentId:n}),c=R(t.default)&&!e,s={width:o},l=ze(),f={Select:{props:{disabled:e,overrides:{ControlContainer:{style:{height:l.sizes.minElementHeight,borderLeftWidth:l.sizes.borderWidth,borderRightWidth:l.sizes.borderWidth,borderTopWidth:l.sizes.borderWidth,borderBottomWidth:l.sizes.borderWidth}},IconsContainer:{style:()=>({paddingRight:l.spacing.sm})},ValueContainer:{style:()=>({lineHeight:l.lineHeights.inputWidget,paddingRight:l.spacing.sm,paddingLeft:l.spacing.sm,paddingBottom:l.spacing.sm,paddingTop:l.spacing.sm})},SingleValue:{props:{"data-testid":"stTimeInputTimeDisplay"}},Dropdown:{style:()=>({paddingTop:l.spacing.none,paddingBottom:l.spacing.none})},DropdownListItem:{style:()=>({paddingRight:l.spacing.lg,paddingLeft:l.spacing.lg,paddingTop:l.spacing.sm,paddingBottom:l.spacing.sm})},Popover:{props:{overrides:{Body:{style:()=>({marginTop:l.spacing.px})}}}},SelectArrow:{component:Ne,props:{overrides:{Svg:{style:()=>({width:l.iconSizes.xl,height:l.iconSizes.xl})}}}}}}}},m=P.useCallback(w=>{const je=w===null?null:Xt(w);a({value:je,fromUi:!0})},[a]),h=P.useCallback(()=>{m(null)},[m]);return S.jsxs("div",{className:"stTimeInput","data-testid":"stTimeInput",style:s,children:[S.jsx(Ae,{label:t.label,disabled:e,labelVisibility:Le((O=t.labelVisibility)==null?void 0:O.value),children:t.help&&S.jsx(Fe,{children:S.jsx(We,{content:t.help,placement:Ze.TOP_RIGHT})})}),S.jsx(He,{format:"24",step:t.step?Number(t.step):900,value:R(i)?void 0:Qt(i),onChange:m,overrides:f,nullable:c,creatable:!0,"aria-label":t.label}),c&&!R(i)&&S.jsx(Ut,{onClick:h,"data-testid":"stTimeInputClearButton",children:S.jsx(ve,{overrides:{Svg:{style:{color:l.colors.darkGray,padding:l.spacing.threeXS,height:l.sizes.clearIconSize,width:l.sizes.clearIconSize,":hover":{fill:l.colors.bodyText}}}},$isFocusVisible:!1})})]})}function Gt(e,t){return e.getStringValue(t)??null}function Yt(e){return e.default??null}function qt(e){return e.value??null}function Kt(e,t,r,o){t.setStringValue(e,r.value,{fromUi:r.fromUi},o)}function Xt(e){const t=e.getHours().toString().padStart(2,"0"),r=e.getMinutes().toString().padStart(2,"0");return`${t}:${r}`}function Qt(e){if(e===null)return null;const[t,r]=e.split(":").map(Number),o=new Date;return o.setHours(t),o.setMinutes(r),o}const er=P.memo(Jt);export{er as default};
|