@spscommerce/ds-react 8.26.3 → 8.26.4

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.
@@ -29,7 +29,7 @@ export declare const SimpleDateUtils: Readonly<{
29
29
  nextMonth(date: SimpleDate): SimpleDate;
30
30
  createRangeFromPreset(preset: DatePreset, format?: string): SimpleDateRange;
31
31
  createDateTimeRangeFromPreset(preset: DateTimePreset): SimpleMomentRange;
32
- splitMomentInDateTimeParts(dateMoment?: Moment | null, twentyFourHourFormat?: boolean, dateFormat?: string): [string, string, string | undefined];
32
+ splitMomentInDateTimeParts(dateMoment?: Moment | null, twentyFourHourFormat?: boolean, dateFormat?: string, defaultToEndOfDay?: boolean): [string, string, string | undefined];
33
33
  getCurrentMoment(): Moment;
34
34
  validateTimeString(timeString?: string, twentyFourHourFormat?: boolean): boolean;
35
35
  padIncompleteTimeString(timeString?: string, twentyFourHourFormat?: boolean): string;
package/lib/index.js CHANGED
@@ -251,8 +251,11 @@ const Q = Object.freeze({
251
251
  const n = st().endOf("day");
252
252
  return [t, n];
253
253
  },
254
- splitMomentInDateTimeParts(e, t = !1, n) {
255
- return e && st.isMoment(e) && e.isValid() ? Q.toDateTimeString(e, t, n).split(" ") : ["", t ? "00:00" : "12:00", t ? void 0 : "AM"];
254
+ splitMomentInDateTimeParts(e, t = !1, n, r = !1) {
255
+ let s = "";
256
+ t ? s = r ? "23:59" : "00:00" : s = r ? "11:59" : "12:00";
257
+ const o = r ? "PM" : "AM";
258
+ return e && st.isMoment(e) && e.isValid() ? Q.toDateTimeString(e, t, n).split(" ") : ["", s, t ? void 0 : o];
256
259
  },
257
260
  getCurrentMoment() {
258
261
  return st();
@@ -12893,7 +12896,8 @@ function Ip({
12893
12896
  ), _ = Q.splitMomentInDateTimeParts(
12894
12897
  Array.isArray(u) ? u[1] : void 0,
12895
12898
  f,
12896
- p
12899
+ p,
12900
+ !0
12897
12901
  ), [F, z] = a.useState(
12898
12902
  O[0]
12899
12903
  ), [M, j] = a.useState(_[0]), [P, ee] = a.useState(
@@ -13062,7 +13066,7 @@ function Ip({
13062
13066
  }
13063
13067
  }
13064
13068
  }, []), a.useEffect(() => {
13065
- O[0] ? z(O[0]) : z(""), O[1] ? ee(O[1]) : ee(f ? "00:00" : "12:00"), f || (O[2] ? $(O[2]) : $("AM")), _[0] ? j(_[0]) : j(""), _[1] ? W(_[1]) : W(f ? "00:00" : "12:00"), f || (_[2] ? te(_[2]) : te("AM"));
13069
+ O[0] ? z(O[0]) : z(""), O[1] ? ee(O[1]) : ee(f ? "00:00" : "12:00"), f || (O[2] ? $(O[2]) : $("AM")), _[0] ? j(_[0]) : j(""), _[1] ? W(_[1]) : W(f ? "23:59" : "11:59"), f || (_[2] ? te(_[2]) : te("PM"));
13066
13070
  }, [
13067
13071
  O[0],
13068
13072
  O[1],
@@ -13114,12 +13118,12 @@ function Ip({
13114
13118
  onClick: rt
13115
13119
  }
13116
13120
  ))
13117
- ), !ne && !f ? /* @__PURE__ */ a.createElement(ua, null, /* @__PURE__ */ a.createElement(
13121
+ ), !ne && (f ? /* @__PURE__ */ a.createElement(
13118
13122
  vn,
13119
13123
  {
13120
13124
  className: "sps-time-input",
13121
- placeholder: y,
13122
- suggestions: Oo,
13125
+ placeholder: g,
13126
+ suggestions: Ro,
13123
13127
  zeroState: "Custom time",
13124
13128
  value: P,
13125
13129
  onChange: xe,
@@ -13129,21 +13133,12 @@ function Ip({
13129
13133
  inputNotClearable: !0,
13130
13134
  autoFocusOnSelection: !0
13131
13135
  }
13132
- ), /* @__PURE__ */ a.createElement(
13133
- _r,
13134
- {
13135
- options: vd,
13136
- value: re,
13137
- onChange: ht,
13138
- disabled: t,
13139
- notClearable: !0
13140
- }
13141
- )) : /* @__PURE__ */ a.createElement(
13136
+ ) : /* @__PURE__ */ a.createElement(ua, null, /* @__PURE__ */ a.createElement(
13142
13137
  vn,
13143
13138
  {
13144
13139
  className: "sps-time-input",
13145
- placeholder: g,
13146
- suggestions: Ro,
13140
+ placeholder: y,
13141
+ suggestions: Oo,
13147
13142
  zeroState: "Custom time",
13148
13143
  value: P,
13149
13144
  onChange: xe,
@@ -13153,7 +13148,16 @@ function Ip({
13153
13148
  inputNotClearable: !0,
13154
13149
  autoFocusOnSelection: !0
13155
13150
  }
13156
- )), !ne && /* @__PURE__ */ a.createElement("span", { className: K("sps-datepicker__to") }, "to"), !ne && /* @__PURE__ */ a.createElement("div", { className: K("sps-datetime-range-picker__pair") }, /* @__PURE__ */ a.createElement(
13151
+ ), /* @__PURE__ */ a.createElement(
13152
+ _r,
13153
+ {
13154
+ options: vd,
13155
+ value: re,
13156
+ onChange: ht,
13157
+ disabled: t,
13158
+ notClearable: !0
13159
+ }
13160
+ )))), !ne && /* @__PURE__ */ a.createElement("span", { className: K("sps-datepicker__to") }, "to"), !ne && /* @__PURE__ */ a.createElement("div", { className: K("sps-datetime-range-picker__pair") }, /* @__PURE__ */ a.createElement(
13157
13161
  bt,
13158
13162
  {
13159
13163
  id: N,
@@ -13282,7 +13286,6 @@ function Ip({
13282
13286
  {
13283
13287
  "data-testid": `${h}_calendar`,
13284
13288
  selectedRange: Array.isArray(u) ? [
13285
- // eslint-disable-next-line max-len
13286
13289
  Q.createFrom(u[0], p),
13287
13290
  Q.createFrom(u[1], p)
13288
13291
  ] : void 0,
package/lib/index.umd.cjs CHANGED
@@ -1,4 +1,4 @@
1
- (function(_,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("@spscommerce/utils"),require("moment-timezone"),require("@spscommerce/ds-shared"),require("react-dom"),require("@spscommerce/ds-colors"),require("@sps-woodland/tabs"),require("@react-stately/collections"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@spscommerce/utils","moment-timezone","@spscommerce/ds-shared","react-dom","@spscommerce/ds-colors","@sps-woodland/tabs","@react-stately/collections","@sps-woodland/illustrations"],x):(_=typeof globalThis<"u"?globalThis:_||self,x(_.DSReact={},_.React,_.utils,_.moment$4,_.dsShared,_.ReactDOM,_.dsColors,_.tabs,_.collections,_.illustrations))})(this,function(_,x,v,Je,W,bo,Oa,Ih,or,Wl){"use strict";var Jx=Object.defineProperty;var Nh=_=>{throw TypeError(_)};var Zx=(_,x,v)=>x in _?Jx(_,x,{enumerable:!0,configurable:!0,writable:!0,value:v}):_[x]=v;var Yt=(_,x,v)=>Zx(_,typeof x!="symbol"?x+"":x,v),kh=(_,x,v)=>x.has(_)||Nh("Cannot "+v);var rr=(_,x,v)=>(kh(_,x,"read from private field"),v?v.call(_):x.get(_)),La=(_,x,v)=>x.has(_)?Nh("Cannot add the same private member more than once"):x instanceof WeakSet?x.add(_):x.set(_,v),hn=(_,x,v,Je)=>(kh(_,x,"write to private field"),Je?Je.call(_,v):x.set(_,v),v);var Qn,In,xn;function Gl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=Gl(x),ar=Gl(Je);function Yl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Yl(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function G(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Yl(e))&&(r&&(r+=" "),r+=t);return r}const xh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ft=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=xh[n[e]&63];return t};function Sn(e){return x.useRef(e||ft())}function bt(e,t){const n=Sn(e),r=x.useRef(`${n.current}_ctrl`);return x.useEffect(()=>{t&&(t.id=r.current,t.update())},[t]),{wrapperId:n.current||void 0,controlId:r.current}}var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mh="[object Object]";function _h(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function Lh(e,t){return function(n){return e(t(n))}}var Oh=Function.prototype,Ul=Object.prototype,zl=Oh.toString,Ph=Ul.hasOwnProperty,Rh=zl.call(Object),Bh=Ul.toString,Ah=Lh(Object.getPrototypeOf,Object);function Fh(e){return!!e&&typeof e=="object"}function Vh(e){if(!Fh(e)||Bh.call(e)!=Mh||_h(e))return!1;var t=Ah(e);if(t===null)return!0;var n=Ph.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&zl.call(n)==Rh}var $h=Vh;const jl=Pa($h),Et=new Set,sr=new Set,zt=new Set,vo=new Set;function ql(e){Et.has(e)||zt.has(e)||vo.has(e)||sr.add(e)}function Jl(e){Et.has(e)||zt.has(e)||sr.has(e)||vo.add(e)}const tt=ar.default||ar,ir="MM/DD/YYYY",Kh="MM/DD/YYYY hh:mm A",Hh="MM/DD/YYYY HH:mm",Wh="hh:mm A",Gh="HH:mm",Yh=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,_r=Symbol("Date Parse Error");function lr(e){return tt.isMoment(e)?e.year()*1e4+(e.month()+1)*100+e.date():e.year*1e4+e.month*100+e.date}const te=Object.freeze({createFrom(e,t){if(!e)return null;if(typeof e=="string"){if(t){const n=tt(e,t,!0);if(n.isValid())return Object.freeze({year:n.year(),month:n.month()+1,date:n.date()})}else{const n=Yh.exec(e);if(n){const[,r,a,s]=n;return Object.freeze({year:Number(s),month:Number(r),date:Number(a)})}}return Object.freeze({[_r]:!0,year:void 0,month:void 0,date:void 0})}return Object.freeze({year:e.year(),month:e.month()+1,date:e.date()})},createMomentFrom(e,t){if(!e)return null;let n=null;return typeof e=="string"?t?n=tt(e,t,!0):n=tt(e):tt.isMoment(e)?n=e:n=te.toMoment(e),n!==null&&tt.isMoment(n)&&n.isValid()?n:Object.freeze({[_r]:!0,year:void 0,month:void 0,date:void 0})},getRangeSeparator(e){return e!=null&&e.includes("-")?"/":"-"},createRangeFrom(e,t){if(!e)return null;if(t){const n=te.getRangeSeparator(t),r=new RegExp(`[^\\d]*${n}[^\\d]*`);return e.split(r).slice(0,2).map(a=>te.createFrom(a,t))}else return e.split(/[^\d]*-[^\d]*/).slice(0,2).map(n=>te.createFrom(n))},isValid(e){var t;return e?tt.isMoment(e)?e.isValid():typeof e=="object"&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.date=="number"&&((t=te.toMoment(e))==null?void 0:t.isValid()):!1},nullifyInvalidDate(e){return te.isValid(e)?e:null},toMoment(e){return e?tt.isMoment(e)?e:tt({...e,month:e.month-1}):null},toString(e,t){const n=te.toMoment(e);return n&&n.isValid()?n.format(t||ir):""},toStringRange(e,t){if(!e)return"";const n=te.getRangeSeparator(t);return e.slice(0,2).map(r=>te.toString(r,t)).join(n)},toDateTimeString(e,t=!1,n){return e&&tt.isMoment(e)&&e.isValid()?n?t?e.format(`${n} ${Gh}`):e.format(`${n} ${Wh}`):t?e.format(Hh):e.format(Kh):""},toDateTimeStringRange(e,t=!1,n){if(!e)return"";const r=te.getRangeSeparator(n);return e.map(a=>te.toDateTimeString(a,t,n)).join(r)},create(){const e=new Date;return Object.freeze({year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate()})},isSameDate(e,t){return e&&t&&e.year===t.year&&e.month===t.month&&e.date===t.date},isSameMonth(e,t){return e&&t&&e.year===t.year&&e.month===t.month},isAfter(e,t){return!e||!t?null:lr(e)>lr(t)},isBefore(e,t){return!e||!t?null:lr(e)<lr(t)},isInRange(e,t,n=!0){if(!e||!t||!t[0]||!t[1])return null;const r=lr(e),[a,s]=t.map(lr);return a&&s&&(n&&r>=a&&r<=s||!n&&r>a&&r<s)},prevMonth(e){return Object.freeze({year:e.month===1?e.year-1:e.year,month:e.month-1||12,date:e.date})},nextMonth(e){return Object.freeze({year:e.month===12?e.year+1:e.year,month:e.month+1>12?1:e.month+1,date:e.date})},createRangeFromPreset(e,t){if(typeof e.definition=="function")return e.definition();const n=tt(),r=n.clone().subtract(tt.duration(e.definition));return[te.createFrom(r,t),te.createFrom(n,t)]},createDateTimeRangeFromPreset(e){if(typeof e.definition=="function")return e.definition();let t;e.definition==="P0D"?t=tt().startOf("day"):t=tt().subtract(tt.duration(e.definition));const n=tt().endOf("day");return[t,n]},splitMomentInDateTimeParts(e,t=!1,n){return e&&tt.isMoment(e)&&e.isValid()?te.toDateTimeString(e,t,n).split(" "):["",t?"00:00":"12:00",t?void 0:"AM"]},getCurrentMoment(){return tt()},validateTimeString(e,t=!1){if(!e)return!0;const n=e.split(":"),r=n[0]||"0",a=n[1]||"0",s=Number.isNaN(Number(r))?NaN:parseInt(r,10),l=Number.isNaN(Number(a))?NaN:parseInt(a,10),c=n.length<=2&&r.length<=2&&a.length<=2;return t?c&&s>=0&&s<=23&&l>=0&&l<=59:c&&(!Number.isNaN(s)&&r.length===1||s>=1)&&s<=12&&l>=0&&l<=59},padIncompleteTimeString(e,t=!1){if(!e)return"";const n=e.split(":"),r=parseInt(n[0]||"0",10),a=parseInt(n[1]||"0",10);if(t){const s=r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}else{const s=r===0?"12":r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}}}),Ra=["01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00"],Ba=["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"];let yo=ir;function Zl(e){yo=e}const Lr=function(t){if(Array.isArray(t)){const n=Lr(t[0]),r=Lr(t[1]);return n||r}if(t&&t.hasOwnProperty("year")){if(t[_r])return{dateFormat:yo};if(!te.isValid(t))return{dateValidity:!0}}return null};Et.add("dateFormat"),Et.add("dateValidity");const Xl=function(t){if(Array.isArray(t)){const n=Lr(t);if(n)return n;if(t&&te.isBefore(t[1],t[0]))return{dateRangeOrder:!0}}return null};Et.add("dateRangeOrder");const Ql=function({minDate:t,maxDate:n}){function r(a){const s=te.isBefore(a,t),l=te.isAfter(a,n),c={minExceeded:s?te.toString(t,yo):null,maxExceeded:l?te.toString(n,yo):null};return s||l?{dateConstraint:c}:null}return function(s){if(!s)return null;if(Array.isArray(s)){const l=r(s[0]),c=r(s[1]);return l||c}return s.hasOwnProperty("year")?r(s):null}};Et.add("dateConstraint");const Uh=Object.freeze(Object.defineProperty({__proto__:null,date:Lr,dateConstraint:Ql,dateRange:Xl,setDateFormat:Zl},Symbol.toStringTag,{value:"Module"}));function en(e,t){for(const n of[].concat(e)){const r=t(n);if(r)return r}return null}const zh=function(t){function n(r){return Number(r)>=t?null:{min:t}}return r=>en(r,n)};Et.add("min");const jh=function(t){function n(r){return Number(r)<=t?null:{max:t}}return r=>en(r,n)};sr.add("max");const qh=function(t){return typeof t>"u"||t===null||t===""||Number.isNaN(t)||(t==null?void 0:t.length)===0?{required:!0}:null};sr.add("required");const Jh=function(t){function n(r){return r===void 0||r.toString().length<t?{minLength:t}:null}return r=>en(r,n)};Et.add("minLength");const Zh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<t?{minLengthArray:t}:null}return r=>n(r)};Et.add("minLengthArray");const Xh=function(t){function n(r){return r===void 0||r.toString().length<=t?null:{maxLength:t}}return r=>en(r,n)};zt.add("maxLength");const Qh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<=t?null:{maxLengthArray:t}}return r=>n(r)};Et.add("maxLengthArray");const eS=function(t){const n=t instanceof RegExp?t:new RegExp(t);function r(a){return n.test(a)?null:{pattern:t}}return a=>en(a,r)};Et.add("pattern");const tS=function(e){function t(n){return new RegExp("^\\p{L}*$","u").test(n)?null:{alpha:!0}}return en(e,t)};zt.add("alpha");const nS=function(e){function t(n){return/^[0-9,. ]*$/.test(n)?null:{numeric:!0}}return en(e,t)};zt.add("numeric");const rS=function(e){function t(n){return/^-?[0-9,. ]*$/.test(n)?null:{positiveOrNegativeNumber:!0}}return en(e,t)};zt.add("positiveOrNegativeNumber");const oS=function(e){function t(n){return/^[^0-9]*$/.test(n)?null:{nonNumeric:!0}}return en(e,t)};zt.add("nonNumeric");const To=Object.freeze({...Uh,min:zh,max:jh,required:qh,minLength:Jh,minLengthArray:Zh,maxLength:Xh,maxLengthArray:Qh,pattern:eS,alpha:tS,numeric:nS,nonNumeric:oS,positiveOrNegativeNumber:rS,OnBlurErrorKeys:Et});function Eo(e,t=[]){const n=t.reduce((r,a)=>Object.assign(r,a(e)||{}),{});return Object.keys(n).length?n:null}var jt=(e=>(e[e.ON_CHANGE=0]="ON_CHANGE",e[e.ON_BLUR=1]="ON_BLUR",e[e.ON_SUBMIT=2]="ON_SUBMIT",e))(jt||{});function aS(e,t={},n=[]){for(const[r,a]of Object.entries(t))a===0?ql(r):a===2&&Jl(r);return o.useCallback(e,n)}class Rn{constructor(t,n){Yt(this,"validators",[]);La(this,Qn,null);La(this,In,null);La(this,xn,null);Yt(this,"preventativeErrors",[]);Yt(this,"submitted",!1);this.path=t,this.update=n}get errors(){return rr(this,Qn)===null&&rr(this,In)===null&&rr(this,xn)===null?null:{...rr(this,Qn)??{},...rr(this,In)??{},...rr(this,xn)??{}}}setValidators(t){return this.update(this.path,null,void 0,t),this}validate(t,n,r=!1){if(this.validators&&this.validators.length>0){const a=Eo(t,this.validators);let s={onSubmit:{},onChange:{},onBlur:{}};a&&(s=Object.keys(a).reduce((l,c)=>(vo.has(c)?l.onSubmit[c]=a[c]:sr.has(c)?l.onChange[c]=a[c]:l.onBlur[c]=a[c],l),s)),(typeof n>"u"||n===jt.ON_CHANGE)&&hn(this,In,Object.keys(s.onChange).length===0?null:s.onChange),(typeof n>"u"||n===jt.ON_BLUR)&&hn(this,xn,Object.keys(s.onBlur).length===0?null:s.onBlur),(typeof n>"u"||n===jt.ON_SUBMIT)&&(hn(this,Qn,Object.keys(s.onSubmit).length===0?null:s.onSubmit),hn(this,In,Object.keys(s.onChange).length===0?null:s.onChange),hn(this,xn,Object.keys(s.onBlur).length===0?null:s.onBlur)),r||this.update(),this.isFocused()&&this.onFocus&&this.onFocus()}else this.errors&&(hn(this,Qn,null),hn(this,xn,null),hn(this,In,null),r||this.update());return this}isValid(){return!this.errors||this.isPristine()}hasErrors(){return!!this.errors}isVisibilyInvalid(){return!this.isValid()}hasError(t){return this.errors&&Object.prototype.hasOwnProperty.call(this.errors,t)}hasPreventativeError(t){return this.preventativeErrors.includes(t)}hasPreventativeErrors(){return this.preventativeErrors.length>0}isRequired(){return this.validators&&this.validators.indexOf(To.required)>-1}isSubmitted(){return this.submitted}onFocus(){}onBlur(){}}Qn=new WeakMap,In=new WeakMap,xn=new WeakMap;class Or extends Rn{constructor(){super(...arguments);Yt(this,"id",ft());Yt(this,"focused",!1);Yt(this,"pristine",!0)}setValue(n){if(this.preventativeErrors=[],this.validators&&this.validators.length>0){const r=Eo(n,this.validators);if(r&&Object.keys(r).filter(s=>zt.has(s)).length>0){this.preventativeErrors=Object.keys(r);return}}this.update(this.path,n)}isPristine(){return this.pristine}markAsPristine(){return this.pristine=!0,this.update(),this}markAsDirty(){return this.pristine=!1,this.update(),this}isFocused(){return this.focused}markAsFocused(){return this.focused=!0,this.update(),this.onFocus&&this.onFocus(),this}markAsBlurred(){return this.update(this.path,null,!0),this.onBlur&&this.onBlur(),this.preventativeErrors=[],this}markAsSubmitted(){return this.submitted=!0,this.update(this.path,null,!1,void 0,!0),this}}class Bn extends Or{constructor(n,r,a){super(a?r:n,a||r);Yt(this,"fields");a&&this.inferMembers(n)}isFocused(){return super.isFocused()||this.rollup("isFocused")}isValid(){return super.isValid()&&this.rollup("isValid")}hasErrors(){return super.hasErrors()||Object.keys(this.fields).some(n=>this.fields[n].hasErrors())}contentsAreValid(){return this.rollup("isValid")&&this.rollup("contentsAreValid")}isPristine(){return super.isPristine()&&this.rollup("isPristine")}markAsPristine(){super.markAsPristine();for(const n of Object.keys(this.fields))this.fields[n].markAsPristine();return this}markAsDirty(){super.markAsDirty();for(const n of Object.keys(this.fields))this.fields[n].markAsDirty();return this}markAsBlurred(){super.markAsBlurred();for(const n of Object.keys(this.fields))this.fields[n].markAsBlurred();return this}markAsSubmitted(){super.markAsSubmitted();for(const n of Object.keys(this.fields))this.fields[n].markAsSubmitted();return this}inferSpsControl(n,r){return wo(n,[...this.path,r],this.update)}rollup(n){return Object.keys(this.fields).reduce((r,a)=>r&&(!this.fields[a][n]||this.fields[a][n]()),!0)}}class ec extends Bn{inferMembers(t){this.fields={};for(const n of Object.keys(t))this.fields[n]=this.inferSpsControl(t[n],n)}}class tc extends Bn{inferMembers(t){this.fields=t.map((n,r)=>this.inferSpsControl(n,String(r)))}}function wo(e,t,n){return e instanceof Rn?(e.path=t,e.update=n,e):Array.isArray(e)?new tc(e,t,n):jl(e)?new ec(e,t,n):new Or(t,n)}function Pr(e,t){return t.length===0||!e?e:Pr(e.fields[t[0]],t.slice(1,t.length))}function Aa(e,t){if(t.length===0||!e)return[e];const n=t[0];if(t=t.slice(1,t.length),n==="*"){const r=Array.isArray(e.fields)?e.fields:Object.keys(e.fields).map(a=>e.fields[a]);return t.length===0?r:r.reduce((a,s)=>[...a,...Aa(s,t)],[])}return Aa(e.fields[n],t)}function Fa(e,t,n){for(const r of Object.keys(t)){const a=t[r];for(const s of Aa(e,r.split(".")))s&&a&&n(s,a)}}function Co(e,t,n,r=!1,a=!1){Fa(t,n,(s,l)=>{s.validators=typeof l=="function"?l(e):l,r&&s.validate(v.getPath(e,s.path),void 0,a)})}function Va(e,t){const n=t[0];return t=t.slice(1),Array.isArray(e)?e.map((r,a)=>a===Number(n)?Va(r,t):r):jl(e)?Object.keys(e).reduce((r,a)=>Object.assign(r,{[a]:a===n?Va(e[a],t):e[a]}),{}):e}function sS(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("The initial value of useSpsForm() hook must be an object.")}function nc(e,t={}){sS(e);const[,n]=x.useState({}),r=x.useRef(!1);r.current=!1;const a=x.useRef(t),s=x.useCallback(h=>{var T,C;const S=u.current;let y;if(h)if(h.path)if(h.markAsBlurred){const E=Pr(S.formMeta,h.path);if(E){E.focused=!1;const N=v.getPath(S.formValue,h.path);E.validate(N,jt.ON_BLUR)}}else if(h.newValidators){if(a.current){const E=h.path.join(".");a.current={...a.current,[E]:h.newValidators},Co(S.formValue,S.formMeta,a.current,!0)}}else if(h.markAsSubmitted){const E=Pr(S.formMeta,h.path);if(E){E.submitted=!0;const N=v.getPath(S.formValue,h.path);E.validate(N,jt.ON_SUBMIT)}}else y=Va(S.formValue,h.path),v.setPath(y,h.path,h.value);else y=h.value;if((T=h==null?void 0:h.updateFormOptions)!=null&&T.validators&&(a.current={...a.current,...h.updateFormOptions.validators},Co(S.formValue,S.formMeta,a.current,((C=h.updateFormOptions)==null?void 0:C.runValidators)??!0)),y){S.formMeta.submitted=!1,v.deepFreeze(y);const E=v.diff(S.formValue,y);for(const{type:M,key:I,parentPath:k,objects:[,V]}of E){const R=Pr(S.formMeta,k);if(typeof I!="symbol"&&R){let w;switch(M){case v.DiffChange.ADDITION:R.fields[I]=wo(V[I],[...k,I],c);break;case v.DiffChange.DELETION:Array.isArray(R.fields)?R.fields[I]=void 0:delete R.fields[I];break;case v.DiffChange.ALTERATION:w=wo(V[I],[...k,I],c),(w instanceof Bn&&!(R.fields[I]instanceof Bn)||!(w instanceof Bn)&&R.fields[I]instanceof Bn)&&(w.pristine=!1,R.fields[I]=w);break}}}const N=new Set;if(E.filter(M=>M.type===v.DiffChange.DELETION).reduce((M,I)=>(M.has(I.parentPath)||M.add(I.parentPath),M),N),Array.from(N).forEach(M=>{const I=Pr(S.formMeta,M);Array.isArray(I.fields)&&(I.fields=I.fields.filter(k=>k!==void 0))}),a.current){Co(y,S.formMeta,a.current);const M=new Set;t&&Fa(S.formMeta,t,(I,k)=>{typeof k=="function"&&(I.validate(v.getPath(y,I.path)),M.add(I))});for(const{type:I,key:k,parentPath:V,objects:[,R]}of E)if(typeof k!="symbol"){let w=S.formMeta,P=y;if(w){for(const O of V)w=w.fields[O],P=P[O],M.has(w)||w.validate(P,jt.ON_CHANGE);if(I===v.DiffChange.ADDITION||I===v.DiffChange.ALTERATION){const O=w.fields[k];if(!M.has(O)&&(w.fields[k].validate(R[k],jt.ON_CHANGE),I===v.DiffChange.ADDITION&&O.fields))for(const[$,J]of Object.entries(O.fields))J.validate(R[k][$],jt.ON_CHANGE)}}}}}u.current={...S,formValue:y||S.formValue},r.current||n({})},[]),l=x.useCallback((h,S)=>{h||S?s({value:h,updateFormOptions:S}):s()},[s]),c=x.useCallback((h,S,y=!1,T,C=!1)=>{h?s({path:h,value:S,markAsBlurred:y,newValidators:T,markAsSubmitted:C}):l()},[s,l]),p=x.useMemo(()=>{v.deepFreeze(e);const h=wo(e,[],c);return t&&Co(e,h,t,!1,!0),h},[]),m=x.useCallback(()=>(u.current.formMeta.markAsDirty(),a.current&&Fa(u.current.formMeta,a.current,(h,S)=>{(typeof S=="function"||Array.isArray(S))&&h.validate(v.getPath(u.current.formValue,h.path))}),u.current.formMeta.isValid()),[]),f=x.useCallback(()=>u.current.formValue,[]),u=x.useRef({formValue:e,formMeta:p,updateForm:l,validateForm:m,getCurrentFormValue:f});return u.current}const at=o.forwardRef((e,t)=>{const{className:n,children:r,focusInputOnClick:a,formControl:s,formMeta:l,inputRef:c,onClick:p,...m}=e,f=o.useRef(),h=c||(t||f);function S(){h&&h!==t&&h.current&&h.current.focus()}function y(){h&&h!==t&&h.current&&l&&l instanceof Or&&l.markAsFocused()}function T(){h&&h!==t&&h.current&&l&&l instanceof Or&&l.markAsBlurred()}const C=G("sps-form-group",(s&&s.isRequired()||l&&l.isRequired())&&"sps-form-group--required",(s&&!s.isValid()||l&&l.isVisibilyInvalid())&&"sps-form-group--error",l&&l.hasPreventativeErrors()&&"sps-form-group--preventative-error",n);function E(N){a&&S(),p&&p(N)}return o.useEffect(()=>{function N(M){M.target.classList.contains("sps-form-control__clear-btn")&&M.preventDefault()}return document.addEventListener("mousedown",N),()=>{document.removeEventListener("mousedown",N)}},[]),o.createElement("div",{...m,className:C,ref:t,tabIndex:-1,onClick:E,onFocus:y,onBlur:T},r)});Object.assign(at,{displayName:"SpsFormComponentWrapper"});function rc(e){return typeof e=="object"&&e!=null&&e.nodeType===1}function oc(e,t){return(!t||e!=="hidden")&&e!=="visible"&&e!=="clip"}function $a(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return oc(n.overflowY,t)||oc(n.overflowX,t)||function(r){var a=function(s){if(!s.ownerDocument||!s.ownerDocument.defaultView)return null;try{return s.ownerDocument.defaultView.frameElement}catch{return null}}(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)}(e)}return!1}function Do(e,t,n,r,a,s,l,c){return s<e&&l>t||s>e&&l<t?0:s<=e&&c<=n||l>=t&&c>=n?s-e-r:l>t&&c<n||s<e&&c>n?l-t+a:0}var ac=function(e,t){var n=window,r=t.scrollMode,a=t.block,s=t.inline,l=t.boundary,c=t.skipOverflowHiddenElements,p=typeof l=="function"?l:function(ke){return ke!==l};if(!rc(e))throw new TypeError("Invalid target");for(var m,f,u=document.scrollingElement||document.documentElement,h=[],S=e;rc(S)&&p(S);){if((S=(f=(m=S).parentElement)==null?m.getRootNode().host||null:f)===u){h.push(S);break}S!=null&&S===document.body&&$a(S)&&!$a(document.documentElement)||S!=null&&$a(S,c)&&h.push(S)}for(var y=n.visualViewport?n.visualViewport.width:innerWidth,T=n.visualViewport?n.visualViewport.height:innerHeight,C=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,N=e.getBoundingClientRect(),M=N.height,I=N.width,k=N.top,V=N.right,R=N.bottom,w=N.left,P=a==="start"||a==="nearest"?k:a==="end"?R:k+M/2,O=s==="center"?w+I/2:s==="end"?V:w,$=[],J=0;J<h.length;J++){var L=h[J],Z=L.getBoundingClientRect(),A=Z.height,ne=Z.width,Y=Z.top,U=Z.right,ae=Z.bottom,H=Z.left;if(r==="if-needed"&&k>=0&&w>=0&&R<=T&&V<=y&&k>=Y&&R<=ae&&w>=H&&V<=U)return $;var q=getComputedStyle(L),re=parseInt(q.borderLeftWidth,10),oe=parseInt(q.borderTopWidth,10),j=parseInt(q.borderRightWidth,10),B=parseInt(q.borderBottomWidth,10),z=0,Q=0,ee="offsetWidth"in L?L.offsetWidth-L.clientWidth-re-j:0,de="offsetHeight"in L?L.offsetHeight-L.clientHeight-oe-B:0,ie="offsetWidth"in L?L.offsetWidth===0?0:ne/L.offsetWidth:0,le="offsetHeight"in L?L.offsetHeight===0?0:A/L.offsetHeight:0;if(u===L)z=a==="start"?P:a==="end"?P-T:a==="nearest"?Do(E,E+T,T,oe,B,E+P,E+P+M,M):P-T/2,Q=s==="start"?O:s==="center"?O-y/2:s==="end"?O-y:Do(C,C+y,y,re,j,C+O,C+O+I,I),z=Math.max(0,z+E),Q=Math.max(0,Q+C);else{z=a==="start"?P-Y-oe:a==="end"?P-ae+B+de:a==="nearest"?Do(Y,ae,A,oe,B+de,P,P+M,M):P-(Y+A/2)+de/2,Q=s==="start"?O-H-re:s==="center"?O-(H+ne/2)+ee/2:s==="end"?O-U+j+ee:Do(H,U,ne,re,j+ee,O,O+I,I);var se=L.scrollLeft,Ne=L.scrollTop;P+=Ne-(z=Math.max(0,Math.min(Ne+z/le,L.scrollHeight-A/le+de))),O+=se-(Q=Math.max(0,Math.min(se+Q/ie,L.scrollWidth-ne/ie+ee)))}$.push({el:L,top:z,left:Q})}return $};function sc(e){return e===Object(e)&&Object.keys(e).length!==0}function iS(e,t){t===void 0&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(r){var a=r.el,s=r.top,l=r.left;a.scroll&&n?a.scroll({top:s,left:l,behavior:t}):(a.scrollTop=s,a.scrollLeft=l)})}function lS(e){return e===!1?{block:"end",inline:"nearest"}:sc(e)?e:{block:"start",inline:"nearest"}}function No(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(sc(t)&&typeof t.behavior=="function")return t.behavior(n?ac(e,t):[]);if(n){var r=lS(t);return iS(ac(e,r),r.behavior)}}const Ka=Object.freeze(Object.defineProperty({__proto__:null,default:No},Symbol.toStringTag,{value:"Module"})),He=o.createContext(W.noI18nI18n),cS={alt:"string",size:"SpinnerSize",title:"string"};function Ha(e){const{alt:t,className:n,size:r=W.SpinnerSize.MEDIUM,"data-testid":a,title:s,unsafelyReplaceClassName:l,...c}=e,{t:p}=o.useContext(He),m=t||s||p("design-system:spinner.defaultAltText",{defaultValue:"Loading..."}),f=G(l||"sps-spinner",`sps-spinner--${r}`,n);return o.createElement("i",{className:f,"data-testid":a,title:m,...c})}Object.assign(Ha,{props:cS,displayName:"SpsSpinner"});const dS=60;function ko(e){return typeof e>"u"?"inherit":`${e}px`}function Wa(e){switch(e){case W.Position.TOP_LEFT:return W.Position.BOTTOM_LEFT;case W.Position.TOP_MIDDLE:return W.Position.BOTTOM_MIDDLE;case W.Position.TOP_RIGHT:return W.Position.BOTTOM_RIGHT;case W.Position.RIGHT_TOP:return W.Position.LEFT_TOP;case W.Position.RIGHT_MIDDLE:return W.Position.LEFT_MIDDLE;case W.Position.RIGHT_BOTTOM:return W.Position.LEFT_BOTTOM;case W.Position.BOTTOM_RIGHT:return W.Position.TOP_RIGHT;case W.Position.BOTTOM_MIDDLE:return W.Position.TOP_MIDDLE;case W.Position.BOTTOM_LEFT:return W.Position.TOP_LEFT;case W.Position.LEFT_BOTTOM:return W.Position.RIGHT_BOTTOM;case W.Position.LEFT_MIDDLE:return W.Position.RIGHT_MIDDLE;case W.Position.LEFT_TOP:return W.Position.RIGHT_TOP}}function pS(e,t,n,r,a,s,l,c){const p=l&&l.current,m=p?p.scrollTop:window.pageYOffset,f=c?0:m,u=p?p.scrollLeft:window.pageXOffset,h=c?0:u,[S,y]=e.split(" ");let T,C,E,N;switch(S){case"top":E=t.height-n.top-f-s[0];break;case"left":C=t.width-n.left-h-s[0];break;case"right":N=n.right+h-s[0];break;case"bottom":T=n.bottom+f-s[0];break;default:throw new Error(`Invalid position ${e}`)}switch(y){case"left":N=n.left+h+s[1];break;case"top":T=n.top+f+s[1];break;case"middle":S==="top"||S==="bottom"?N=n.left+h+n.width/2-a/2+s[1]:(S==="left"||S==="right")&&(T=n.top+f+n.height/2-r.height/2+s[1]);break;case"bottom":E=t.height-n.bottom-f+s[1];break;case"right":C=t.width-n.right-h+s[1];break;default:throw new Error(`Invalid position ${e}`)}return[T,C,E,N]}function An(e,t,n,{altPosition:r,setMinWidth:a=!1,setWidth:s=!1,parentElementRef:l,fixed:c=!1,offsets:p=[0,0]}){if(e.current&&t.current){const m=e.current.getBoundingClientRect(),f=t.current.getBoundingClientRect(),u=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=document.documentElement.getBoundingClientRect().width;let y=((l==null?void 0:l.current)??document.documentElement).getBoundingClientRect();c&&(y={x:0,y:0,width:h,height:u,top:0,left:0,bottom:u,right:h,toJSON(){return{width:h,height:u,top:0,left:0,bottom:u,right:h}}});const[T,C]=n.split(" ");let E=n;if(r&&(T==="top"&&f.top-m.height<dS||T==="right"&&f.right+m.width>h||T==="bottom"&&f.bottom+m.height>u||T==="left"&&f.left-m.width<0)&&(E=r),C==="left"&&f.left+m.width+((p==null?void 0:p[1])??0)>document.documentElement.getBoundingClientRect().right)switch(T){case"bottom":E=W.Position.BOTTOM_RIGHT;break;case"top":E=W.Position.TOP_RIGHT;break}const N=a?Math.max(f.width,m.width):m.width,M=s?f.width:N,[I,k,V,R]=pS(E,y,f,m,M,p,l,c),w={top:ko(I),right:ko(k),bottom:ko(V),left:ko(R)};return c&&(w.position="fixed",w.zIndex=W.ZStratum.BAR),a&&(w.minWidth=`${f.width}px`),s&&(w.width=`${f.width}px`),[w,E===r]}return[{},!1]}const kt=x.createContext(null);function cr(e,t=[]){const n=x.useContext(kt);return x.useMemo(()=>r=>{const s=n&&n.parentElementRef&&n.parentElementRef.current||document.body;let l=null,c=s.lastElementChild;for(;c&&c!==s.firstElementChild;){if(c.hasAttribute("data-portalid")&&c.getAttribute("data-portalid")===e){l=c;break}c=c.previousElementSibling}if(l)s.contains(l)||s.appendChild(l);else{l=document.createElement("div"),l.setAttribute("data-portalid",e);for(const p of t)l.classList.add(p);s.appendChild(l)}return bo.createPortal(r,l)},[n])}const Ga=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0"];async function ic(e,t,n,r,a,s){const l=typeof e.options=="function"?e.options(t.value):e.options||[],c=l instanceof Promise,p=u=>u.replace(/([.?*+^$[\]\\(){}|-])/g,"");n({pending:c}),s.current=c?l:null;const m=c?await l||[]:l||[];if(c&&s.current!==l)return;let f=Array.from(m).filter(Boolean).map(u=>new W.SpsOptionListOption(u,typeof u=="function"?{textKey:"label",captionKey:"caption"}:{textKey:e.textKey,captionKey:e.captionKey}));if(e.nullOption&&f.unshift(new W.SpsOptionListOption(null,{text:e.nullOption})),t.value&&!e.disableDefaultOptionsFiltering){const u=p(t.value);n({replacementPattern:new RegExp(`(${u})`,"ig")}),f=f.filter(h=>{const S=new RegExp(u,"i"),y=p(h.text);return e.filterByTextAndCaptionKey?S.test(y)||S.test(p(h.caption)):S.test(y)})}else n({replacementPattern:null});if(e.disabledOptions)for(const u of f)e.disabledOptions.includes(u.value)&&(u.disabled=!0);r(Object.freeze(f)),e.onOptionListChanged&&e.onOptionListChanged(f.length),a(f.some(u=>u.value&&!!u.value.icon)),n({pending:!1})}function uS(e,t,n){const[r,a]=o.useState(Object.freeze([])),[s,l]=o.useState(!1),c=o.useRef(null),p=o.useRef(e.options);(typeof e.options!="function"||e.disableOptionsMemoization)&&(p.current=e.options);const m=o.useMemo(()=>typeof p.current=="function"?v.debounce(ic,typeof e.searchDebounce<"u"?e.searchDebounce:500):ic,[p.current,e.disabledOptions]);return o.useEffect(()=>{m(e,t,n,a,l,c)},[p.current,t.value,e.disabledOptions]),[r,s]}class gn{constructor(t,n){Yt(this,"nativeEvent");Yt(this,"currentTarget");Yt(this,"isPgStoppedInternal",!1);this.target=t,this.currentTarget=t,this.nativeEvent=new CustomEvent("change",n),Object.defineProperty(this.nativeEvent,"target",{value:t,writable:!1,configurable:!1,enumerable:!0})}get bubbles(){return this.nativeEvent.bubbles}get cancelable(){return this.nativeEvent.cancelable}get defaultPrevented(){return this.nativeEvent.defaultPrevented}get eventPhase(){return this.nativeEvent.eventPhase}get isTrusted(){return this.nativeEvent.isTrusted}get timeStamp(){return this.nativeEvent.timeStamp}get type(){return this.nativeEvent.type}preventDefault(){this.nativeEvent.preventDefault()}isDefaultPrevented(){return this.defaultPrevented}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPgStoppedInternal=!0}isPropagationStopped(){return this.isPgStoppedInternal}persist(){throw new Error("This is not a real React ChangeEvent. React does not permit the creation of SyntheticEvents in userland.")}}function mS(e,t){return{...e,...t}}function qt(e){return x.useReducer(mS,e)}function fS({hideInlineSearch:e,options:t,onSearchChange:n,search:r="",searchPlaceholder:a="Search…",searchInputRef:s}){const[l,c]=qt({isAsync:typeof t=="function",pending:!1,value:r,replacementPattern:null}),p=o.useCallback(S=>{c({value:S.target.value}),n&&n(S)},[n]),m=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),S.stopPropagation()},[]),f=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),c({value:""}),s!=null&&s.current&&(n&&n(new gn(s.current)),s.current.focus())},[n]),u=S=>{S&&(["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"].includes(S.key)||S.stopPropagation())};return o.useEffect(()=>{c({value:r})},[r]),[l.isAsync&&!e?o.createElement("div",{className:"sps-option-list__search sps-form-group sps-text-input"},o.createElement("div",{className:"sps-form-control"},!l.value&&o.createElement("i",{className:"sps-icon sps-icon-filter sps-text-input__icon"}),o.createElement("input",{type:"text",className:"sps-text-input__input",placeholder:a,ref:s,value:l.value,onChange:p,onClick:m,onKeyDown:u}),l.value&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:f}))):o.createElement(o.Fragment,null),l,c]}const hS=No||Ka,SS=["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"];function gS(e,t,n){return n?(e&&e[n])===(t&&t[n]):e===t}function lc(e,t,n){return typeof n.value=="function"&&n.disabled?!0:t?!!(e!=null&&e.find(r=>{var a;return r[t]&&r[t]===((a=n==null?void 0:n.value)==null?void 0:a[t])})):!1}const Rr=o.forwardRef((e,t)=>{const{captionKey:n,comparisonKey:r,disabledOptions:a,options:s,tall:l,textKey:c,valueKey:p,zeroState:m,hideInlineSearch:f,onSearchChange:u,search:h,searchDebounce:S,searchPlaceholder:y,onSpecialActionSelect:T,attachTo:C,className:E,conformWidth:N,id:M,ignoreWidthStyles:I,isOpen:k,keepOpen:V,keyDown:R,nullOption:w,onOptionListChanged:P,onOptionSelected:O,onPositionFlip:$,onSelfToggle:J,optionRole:L,positionOverride:Z,selectedOption:A,specialAction:ne,unsafelyReplaceClassName:Y,loading:U,filterByTextAndCaptionKey:ae,maxHeightPx:H,maxHeightRem:q,disableOptionsMemoization:re,disableDefaultOptionsFiltering:oe,"data-testid":j,typeaheadEvent:B,...z}=e,Q=o.useMemo(()=>ne?new W.SpsOptionListOption(ne,{textKey:"label",captionKey:"caption"}):null,[ne]),[ee,de]=o.useState(-1),[ie,le]=o.useState(k),se=t||o.useRef(null),Ne=o.useRef(null),ke=o.useRef(null),it=cr("sps-option-list-portal"),lt=o.useContext(kt),[ut,ct]=Z||[W.Position.BOTTOM_LEFT,W.Position.TOP_LEFT],[[Pt,je],fe]=o.useState([{},!1]),Fe=o.useRef(null),[ve,Le,Qe]=fS({...e,searchInputRef:Fe}),[we,Ht]=uS(e,Le,Qe);o.useEffect(()=>{B&&pt(B)},[B]),o.useEffect(()=>{fe(ie?An(se,C,ut,{altPosition:ct,setMinWidth:!I,setWidth:!I&&N,...lt}):[{},!1])},[ie,ut,ct,we]),o.useEffect(()=>{let be;return ie&&(be=()=>{ie&&fe(An(se,C,ut,{altPosition:ct,setMinWidth:!I,setWidth:!I&&N,...lt}))},document.addEventListener("scroll",be)),()=>{be&&document.removeEventListener("scroll",be)}},[ie]),o.useEffect(()=>{de(-1)},[Le]);const Mn=G(Y||"sps-option-list","z-stratum-dropdown",ie&&"sps-option-list--open",Le.isAsync&&"sps-option-list--searchable",je&&"sps-option-list--opens-upward",ne&&ne.label&&"sps-option-list--has-special-action",E),ue=G(Y||"sps-option-list__options",l&&"sps-option-list__options--tall"),Se=o.useCallback(()=>{ie||(le(!0),Fe.current&&Fe.current.focus(),de(-1),J&&J(!0))},[ie,J]),Oe=o.useCallback(()=>{ie&&(le(!1),de(-1),J&&J(!1))},[ie,J]),Ze=o.useCallback((be,Te)=>{Te||be&&!be.disabled&&(typeof be.value=="function"?(be.value(),T&&T()):typeof O=="function"&&O(be.value),V||Oe())},[O,Oe]),Ie=o.useCallback((be,Te,Xe)=>{be.stopPropagation(),Ze(Te,Xe)},[Ze]),dt=o.useRef(a||[]);dt.current=a||[];const Tt=o.useCallback(be=>{switch(be.key){case"Tab":case"Escape":Oe();break;case"Enter":if(ee>-1){const Te=we[ee]||Q;be.preventDefault();const Xe=!!Te&&lc(dt.current,r||"",Te);!Xe&&Te&&typeof O=="function"&&typeof Te.value=="function"?Te.value():Te&&Ze(Te,Xe)}break;case"Up":case"ArrowUp":{let Te=ee;je?ee<=-1?Te=we.length-1:ee===0?ne&&(Te=we.length):ee<we.length&&(Te=ee-1):ee>-1&&(Te=ee-1),Te!==ee&&(be.preventDefault(),de(Te));break}case"Down":case"ArrowDown":{Se();let Te=ee;je?ee!==-1&&(ee>=we.length?Te=0:ee===we.length-1?Te=-1:Te=ee+1):ee<we.length-1+ +!!ne&&(Te=ee+1),Te!==ee&&(be.preventDefault(),de(Te));break}default:Se()}},[Oe,Se,ee,Ze,O,je,we]),Ae=o.useCallback(be=>{Se();const Te=we.findIndex(Xe=>{if(Xe.textKey){const Rt=Xe.textKey;return Xe.value[Rt].toLowerCase().charAt([0])===be.key.toLocaleLowerCase()}return Xe.value.toString().toLowerCase().charAt([0])===be.key.toLocaleLowerCase()});Te>-1&&de(Te)},[we]),pt=o.useCallback(be=>{be&&(SS.includes(be.key)?Tt(be):Ga.includes(be.key)&&!f&&Ae(be))},[Oe,Se,ee,Ze,O,je,we]);o.useEffect(()=>{if(lt!==null&&document.getElementsByClassName("sps-modal__body").length>0){const be=()=>{J&&J(!1)},Te=document.getElementsByClassName("sps-modal__body")[0];return Te.addEventListener("scroll",be),()=>{Te.removeEventListener("scroll",be)}}},[]),o.useEffect(()=>{ie&&ke.current&&hS(ke.current,{scrollMode:"if-needed",block:"nearest",inline:"nearest"})},[ee,ie]),o.useEffect(()=>{le(k),k?Fe.current&&Fe.current.focus():de(-1)},[k]),o.useEffect(()=>{R&&pt(R)},[R]),o.useEffect(()=>{!ie&&Ne.current&&(Qe({value:""}),Ne.current.scrollTop=0),ie&&$&&$(je)},[ie]);const _n=H?H/16:q,Xt=_n?{maxHeight:`${_n}rem`}:{};function va(be,Te){return Te?o.createElement(o.Fragment,null,be.split(Te).map((Xe,Rt)=>Te.test(Xe)?o.createElement("u",{key:Rt},Xe):o.createElement(o.Fragment,{key:Rt},Xe))):o.createElement(o.Fragment,null,be)}return it(o.createElement("div",{className:Mn,id:M,"aria-activedescendant":ee>-1?`${M}-option-${ee}`:"",tabIndex:-1,ref:se,style:Pt,onMouseLeave:()=>de(-1),"data-testid":j,...z},ve,o.createElement("div",{className:ue,ref:Ne,"data-testid":`${j}-options`,style:Xt},!U&&!Le.pending&&m&&we.length===0&&o.createElement("div",{className:"sps-option-list__zero-state"},m),(U||Le.pending)&&o.createElement("div",{className:"sps-option-list__loading"},o.createElement(Ha,null)),!U&&!Le.pending&&we.map((be,Te)=>{const Xe=`${M}-option-${Te}`,Rt=gS(be.value,A,r),me=lc(dt.current,r||"",be);return o.createElement("a",{key:Xe,id:Xe,role:L,"aria-selected":Rt,href:be.href,className:G("sps-option-list__option",be.caption&&"sps-option-list__option--has-caption",be.disabled&&"sps-option-list__option--disabled",be.bold&&"sps-option-list__option--bold",(Rt||me)&&"sps-option-list__option--selected",ee===Te&&"sps-option-list__option--highlighted"),onClick:wl=>Ie(wl,be,me),onMouseOver:()=>de(Te),tabIndex:-1,ref:ee===Te?ke:null,"data-testid":`${j}-option-${Te}`},be.value&&be.value.icon&&o.createElement("i",{className:G("sps-icon","sps-option-list__option-icon",`sps-icon-${String(be.value.icon)}`)}),(!be.value||!be.value.icon&&Ht)&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,va(be.text,Le.replacementPattern)),be.caption&&o.createElement("div",{className:"sps-option-list__option-caption"},o.createElement("span",null,va(be.caption,Le.replacementPattern))))})),Q&&(ne==null?void 0:ne.label)&&o.createElement("a",{className:G("sps-option-list__option","sps-option-list__special-action",ee===we.length&&"sps-option-list__option--highlighted",ne.disabled&&"sps-option-list__special-action--disabled"),href:Q.href,target:Q.href&&ne.newTab?"_blank":"_self",onClick:be=>Ie(be,Q),onMouseOver:()=>de(we.length),"data-testid":`${j}-special-action`},ne.icon&&o.createElement("i",{className:G("sps-icon","sps-option-list__option-icon",`sps-icon-${String(ne.icon)}`)}),!ne.icon&&Ht&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,ne.label))))});Object.assign(Rr,{displayName:"SpsOptionList"});function bS(e,t,n=[]){return o.useMemo(()=>{function r(a){return o.createElement(e,{...a,...t},a.children)}return r},n)}function vt(e){return typeof e=="function"?e():e}const cc=function({children:e,elements:t}){if(t.length===0)return o.createElement(o.Fragment,null,e);const[n,r]=Array.isArray(t[0])?t[0]:[t[0]];return o.createElement(n,{...r??{}},o.createElement(cc,{elements:t.slice(1)},e))},dc=function({children:e,providers:t=[],...n}){return o.createElement("div",{...n},o.createElement(cc,{elements:t},e))},vS=function({children:e,className:t,...n}){return o.createElement(dc,{className:`sps-app ${t}`,...n},e)};function It(e=[],t=[]){const n=Array.isArray(e)?v.flatten(e):[e],r=t.map(s=>Array.isArray(s)?s:[s]),a=new Array(r.length+1).fill(null).map(()=>[]);for(const s of n){let l=!1;for(let c=0;c<r.length;c+=1)for(const{type:p,props:m={}}of r[c])if(s.type===p&&Object.keys(m).every(u=>m[u]===s.props[u])){l=!0,a[c].push(s);break}l||a[a.length-1].push(s)}return a}function pc(e,t,n){const r=Object.entries(t).filter(([,s])=>typeof s!="string"&&s.deprecated).map(([s])=>s),a=r.map(s=>n[s]);o.useEffect(()=>{a.find(s=>typeof s<"u")&&console.warn(`The following prop(s) of ${e} are deprecated: ${r.join(", ")}`)},a)}function Ya(e,t){const n=x.useRef(!1);x.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function Ua(e,t,n){const r=o.useRef(t(...n));o.useEffect(()=>(document.addEventListener(e,r.current,{capture:!0}),()=>document.removeEventListener(e,r.current)),[]),o.useEffect(()=>{document.removeEventListener(e,r.current),r.current=t(...n),document.addEventListener(e,r.current,{capture:!0})},n)}function uc(e,t,n){return function(a){var s,l;!((s=e.current)!=null&&s.contains(a.target))&&!((l=t.current)!=null&&l.contains(a.target))&&n()}}function dr(e,t,n){const r=o.useRef(!1),[a,s]=o.useState(!1),l=o.useCallback(()=>{r.current?r.current=!1:s(!0)},[]),c=o.useCallback((p=!1)=>{s(!1),r.current=p,n&&n()},[]);return Ua("mousedown",uc,[e,t,c]),Ua("pointerdown",uc,[e,t,c]),{showPopup:a,doShowPopup:l,doHidePopup:c}}const mc=e=>{const t=/(auto|scroll)/,n=(c,p)=>c.parentNode===null?p:n(c.parentNode,p.concat([c])),r=(c,p)=>getComputedStyle(c,null).getPropertyValue(p),a=c=>r(c,"overflow")+r(c,"overflow-y"),s=c=>t.test(a(c));return(c=>{if(!(c instanceof HTMLElement||c instanceof SVGElement))return;const p=n(c.parentNode,[]);for(let m=0;m<p.length;m+=1)if(s(p[m]))return p[m];return null})(e)};let za=0;function Io({isOpen:e,rootRef:t}){o.useLayoutEffect(()=>{let n,r,a;if(e&&t.current){za+=1,n=mc(t.current)||document.body,r=n===document.body?window.innerWidth-document.documentElement.clientWidth:n.offsetWidth-n.clientWidth,n.style.overflow="hidden";const s=window.getComputedStyle(n).paddingRight;if(n.style.paddingRight=s&&s!=="0px"?`calc(${s} + ${r}px)`:`${r}px`,n===document.body)if(a=document.getElementsByClassName("sps-navbar-container").item(0),a&&window.getComputedStyle(a).position==="fixed"){const l=window.getComputedStyle(a).paddingRight;a.style.paddingRight=l&&l!=="0px"?`calc(${l} + ${r}px)`:`${r}px`}else{const l=document.getElementsByTagName("nav").item(0);if(a=l==null?void 0:l.parentElement,a&&window.getComputedStyle(a).position==="fixed"){const c=window.getComputedStyle(a).paddingRight;a.style.paddingRight=c&&c!=="0px"?`calc(${c} + ${r}px)`:`${r}px`}}}return()=>{n&&(za-=1,za===0&&(n.style.overflow=null,n.style.paddingRight=null,a&&(a.style.paddingRight=null)))}},[e])}const yS={debounce:"number",disabled:"boolean",formMeta:"SpsFormFieldMeta<string>",icon:"SpsIcon",onChange:"React.ChangeEventHandler",onSelectionChange:"(newValue: string) => void",placeholder:"string",suggestions:{type:`
1
+ (function(_,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("@spscommerce/utils"),require("moment-timezone"),require("@spscommerce/ds-shared"),require("react-dom"),require("@spscommerce/ds-colors"),require("@sps-woodland/tabs"),require("@react-stately/collections"),require("@sps-woodland/illustrations")):typeof define=="function"&&define.amd?define(["exports","react","@spscommerce/utils","moment-timezone","@spscommerce/ds-shared","react-dom","@spscommerce/ds-colors","@sps-woodland/tabs","@react-stately/collections","@sps-woodland/illustrations"],x):(_=typeof globalThis<"u"?globalThis:_||self,x(_.DSReact={},_.React,_.utils,_.moment$4,_.dsShared,_.ReactDOM,_.dsColors,_.tabs,_.collections,_.illustrations))})(this,function(_,x,v,Je,W,bo,Oa,Ih,or,Wl){"use strict";var Jx=Object.defineProperty;var Nh=_=>{throw TypeError(_)};var Zx=(_,x,v)=>x in _?Jx(_,x,{enumerable:!0,configurable:!0,writable:!0,value:v}):_[x]=v;var Yt=(_,x,v)=>Zx(_,typeof x!="symbol"?x+"":x,v),kh=(_,x,v)=>x.has(_)||Nh("Cannot "+v);var rr=(_,x,v)=>(kh(_,x,"read from private field"),v?v.call(_):x.get(_)),La=(_,x,v)=>x.has(_)?Nh("Cannot add the same private member more than once"):x instanceof WeakSet?x.add(_):x.set(_,v),hn=(_,x,v,Je)=>(kh(_,x,"write to private field"),Je?Je.call(_,v):x.set(_,v),v);var Qn,In,xn;function Gl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=Gl(x),ar=Gl(Je);function Yl(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Yl(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function G(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Yl(e))&&(r&&(r+=" "),r+=t);return r}const xh="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ft=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=xh[n[e]&63];return t};function Sn(e){return x.useRef(e||ft())}function bt(e,t){const n=Sn(e),r=x.useRef(`${n.current}_ctrl`);return x.useEffect(()=>{t&&(t.id=r.current,t.update())},[t]),{wrapperId:n.current||void 0,controlId:r.current}}var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mh="[object Object]";function _h(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function Lh(e,t){return function(n){return e(t(n))}}var Oh=Function.prototype,Ul=Object.prototype,zl=Oh.toString,Ph=Ul.hasOwnProperty,Rh=zl.call(Object),Bh=Ul.toString,Ah=Lh(Object.getPrototypeOf,Object);function Fh(e){return!!e&&typeof e=="object"}function Vh(e){if(!Fh(e)||Bh.call(e)!=Mh||_h(e))return!1;var t=Ah(e);if(t===null)return!0;var n=Ph.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&zl.call(n)==Rh}var $h=Vh;const jl=Pa($h),Et=new Set,sr=new Set,zt=new Set,vo=new Set;function ql(e){Et.has(e)||zt.has(e)||vo.has(e)||sr.add(e)}function Jl(e){Et.has(e)||zt.has(e)||sr.has(e)||vo.add(e)}const tt=ar.default||ar,ir="MM/DD/YYYY",Kh="MM/DD/YYYY hh:mm A",Hh="MM/DD/YYYY HH:mm",Wh="hh:mm A",Gh="HH:mm",Yh=/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,_r=Symbol("Date Parse Error");function lr(e){return tt.isMoment(e)?e.year()*1e4+(e.month()+1)*100+e.date():e.year*1e4+e.month*100+e.date}const te=Object.freeze({createFrom(e,t){if(!e)return null;if(typeof e=="string"){if(t){const n=tt(e,t,!0);if(n.isValid())return Object.freeze({year:n.year(),month:n.month()+1,date:n.date()})}else{const n=Yh.exec(e);if(n){const[,r,a,s]=n;return Object.freeze({year:Number(s),month:Number(r),date:Number(a)})}}return Object.freeze({[_r]:!0,year:void 0,month:void 0,date:void 0})}return Object.freeze({year:e.year(),month:e.month()+1,date:e.date()})},createMomentFrom(e,t){if(!e)return null;let n=null;return typeof e=="string"?t?n=tt(e,t,!0):n=tt(e):tt.isMoment(e)?n=e:n=te.toMoment(e),n!==null&&tt.isMoment(n)&&n.isValid()?n:Object.freeze({[_r]:!0,year:void 0,month:void 0,date:void 0})},getRangeSeparator(e){return e!=null&&e.includes("-")?"/":"-"},createRangeFrom(e,t){if(!e)return null;if(t){const n=te.getRangeSeparator(t),r=new RegExp(`[^\\d]*${n}[^\\d]*`);return e.split(r).slice(0,2).map(a=>te.createFrom(a,t))}else return e.split(/[^\d]*-[^\d]*/).slice(0,2).map(n=>te.createFrom(n))},isValid(e){var t;return e?tt.isMoment(e)?e.isValid():typeof e=="object"&&typeof e.year=="number"&&typeof e.month=="number"&&typeof e.date=="number"&&((t=te.toMoment(e))==null?void 0:t.isValid()):!1},nullifyInvalidDate(e){return te.isValid(e)?e:null},toMoment(e){return e?tt.isMoment(e)?e:tt({...e,month:e.month-1}):null},toString(e,t){const n=te.toMoment(e);return n&&n.isValid()?n.format(t||ir):""},toStringRange(e,t){if(!e)return"";const n=te.getRangeSeparator(t);return e.slice(0,2).map(r=>te.toString(r,t)).join(n)},toDateTimeString(e,t=!1,n){return e&&tt.isMoment(e)&&e.isValid()?n?t?e.format(`${n} ${Gh}`):e.format(`${n} ${Wh}`):t?e.format(Hh):e.format(Kh):""},toDateTimeStringRange(e,t=!1,n){if(!e)return"";const r=te.getRangeSeparator(n);return e.map(a=>te.toDateTimeString(a,t,n)).join(r)},create(){const e=new Date;return Object.freeze({year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate()})},isSameDate(e,t){return e&&t&&e.year===t.year&&e.month===t.month&&e.date===t.date},isSameMonth(e,t){return e&&t&&e.year===t.year&&e.month===t.month},isAfter(e,t){return!e||!t?null:lr(e)>lr(t)},isBefore(e,t){return!e||!t?null:lr(e)<lr(t)},isInRange(e,t,n=!0){if(!e||!t||!t[0]||!t[1])return null;const r=lr(e),[a,s]=t.map(lr);return a&&s&&(n&&r>=a&&r<=s||!n&&r>a&&r<s)},prevMonth(e){return Object.freeze({year:e.month===1?e.year-1:e.year,month:e.month-1||12,date:e.date})},nextMonth(e){return Object.freeze({year:e.month===12?e.year+1:e.year,month:e.month+1>12?1:e.month+1,date:e.date})},createRangeFromPreset(e,t){if(typeof e.definition=="function")return e.definition();const n=tt(),r=n.clone().subtract(tt.duration(e.definition));return[te.createFrom(r,t),te.createFrom(n,t)]},createDateTimeRangeFromPreset(e){if(typeof e.definition=="function")return e.definition();let t;e.definition==="P0D"?t=tt().startOf("day"):t=tt().subtract(tt.duration(e.definition));const n=tt().endOf("day");return[t,n]},splitMomentInDateTimeParts(e,t=!1,n,r=!1){let a="";t?a=r?"23:59":"00:00":a=r?"11:59":"12:00";const s=r?"PM":"AM";return e&&tt.isMoment(e)&&e.isValid()?te.toDateTimeString(e,t,n).split(" "):["",a,t?void 0:s]},getCurrentMoment(){return tt()},validateTimeString(e,t=!1){if(!e)return!0;const n=e.split(":"),r=n[0]||"0",a=n[1]||"0",s=Number.isNaN(Number(r))?NaN:parseInt(r,10),l=Number.isNaN(Number(a))?NaN:parseInt(a,10),c=n.length<=2&&r.length<=2&&a.length<=2;return t?c&&s>=0&&s<=23&&l>=0&&l<=59:c&&(!Number.isNaN(s)&&r.length===1||s>=1)&&s<=12&&l>=0&&l<=59},padIncompleteTimeString(e,t=!1){if(!e)return"";const n=e.split(":"),r=parseInt(n[0]||"0",10),a=parseInt(n[1]||"0",10);if(t){const s=r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}else{const s=r===0?"12":r<10?`0${r}`:`${r}`,l=a<10?`0${a}`:`${a}`;return`${s}:${l}`}}}),Ra=["01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00"],Ba=["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"];let yo=ir;function Zl(e){yo=e}const Lr=function(t){if(Array.isArray(t)){const n=Lr(t[0]),r=Lr(t[1]);return n||r}if(t&&t.hasOwnProperty("year")){if(t[_r])return{dateFormat:yo};if(!te.isValid(t))return{dateValidity:!0}}return null};Et.add("dateFormat"),Et.add("dateValidity");const Xl=function(t){if(Array.isArray(t)){const n=Lr(t);if(n)return n;if(t&&te.isBefore(t[1],t[0]))return{dateRangeOrder:!0}}return null};Et.add("dateRangeOrder");const Ql=function({minDate:t,maxDate:n}){function r(a){const s=te.isBefore(a,t),l=te.isAfter(a,n),c={minExceeded:s?te.toString(t,yo):null,maxExceeded:l?te.toString(n,yo):null};return s||l?{dateConstraint:c}:null}return function(s){if(!s)return null;if(Array.isArray(s)){const l=r(s[0]),c=r(s[1]);return l||c}return s.hasOwnProperty("year")?r(s):null}};Et.add("dateConstraint");const Uh=Object.freeze(Object.defineProperty({__proto__:null,date:Lr,dateConstraint:Ql,dateRange:Xl,setDateFormat:Zl},Symbol.toStringTag,{value:"Module"}));function en(e,t){for(const n of[].concat(e)){const r=t(n);if(r)return r}return null}const zh=function(t){function n(r){return Number(r)>=t?null:{min:t}}return r=>en(r,n)};Et.add("min");const jh=function(t){function n(r){return Number(r)<=t?null:{max:t}}return r=>en(r,n)};sr.add("max");const qh=function(t){return typeof t>"u"||t===null||t===""||Number.isNaN(t)||(t==null?void 0:t.length)===0?{required:!0}:null};sr.add("required");const Jh=function(t){function n(r){return r===void 0||r.toString().length<t?{minLength:t}:null}return r=>en(r,n)};Et.add("minLength");const Zh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<t?{minLengthArray:t}:null}return r=>n(r)};Et.add("minLengthArray");const Xh=function(t){function n(r){return r===void 0||r.toString().length<=t?null:{maxLength:t}}return r=>en(r,n)};zt.add("maxLength");const Qh=function(t){function n(r){return r==null||Array.isArray(r)&&r.length<=t?null:{maxLengthArray:t}}return r=>n(r)};Et.add("maxLengthArray");const eS=function(t){const n=t instanceof RegExp?t:new RegExp(t);function r(a){return n.test(a)?null:{pattern:t}}return a=>en(a,r)};Et.add("pattern");const tS=function(e){function t(n){return new RegExp("^\\p{L}*$","u").test(n)?null:{alpha:!0}}return en(e,t)};zt.add("alpha");const nS=function(e){function t(n){return/^[0-9,. ]*$/.test(n)?null:{numeric:!0}}return en(e,t)};zt.add("numeric");const rS=function(e){function t(n){return/^-?[0-9,. ]*$/.test(n)?null:{positiveOrNegativeNumber:!0}}return en(e,t)};zt.add("positiveOrNegativeNumber");const oS=function(e){function t(n){return/^[^0-9]*$/.test(n)?null:{nonNumeric:!0}}return en(e,t)};zt.add("nonNumeric");const To=Object.freeze({...Uh,min:zh,max:jh,required:qh,minLength:Jh,minLengthArray:Zh,maxLength:Xh,maxLengthArray:Qh,pattern:eS,alpha:tS,numeric:nS,nonNumeric:oS,positiveOrNegativeNumber:rS,OnBlurErrorKeys:Et});function Eo(e,t=[]){const n=t.reduce((r,a)=>Object.assign(r,a(e)||{}),{});return Object.keys(n).length?n:null}var jt=(e=>(e[e.ON_CHANGE=0]="ON_CHANGE",e[e.ON_BLUR=1]="ON_BLUR",e[e.ON_SUBMIT=2]="ON_SUBMIT",e))(jt||{});function aS(e,t={},n=[]){for(const[r,a]of Object.entries(t))a===0?ql(r):a===2&&Jl(r);return o.useCallback(e,n)}class Rn{constructor(t,n){Yt(this,"validators",[]);La(this,Qn,null);La(this,In,null);La(this,xn,null);Yt(this,"preventativeErrors",[]);Yt(this,"submitted",!1);this.path=t,this.update=n}get errors(){return rr(this,Qn)===null&&rr(this,In)===null&&rr(this,xn)===null?null:{...rr(this,Qn)??{},...rr(this,In)??{},...rr(this,xn)??{}}}setValidators(t){return this.update(this.path,null,void 0,t),this}validate(t,n,r=!1){if(this.validators&&this.validators.length>0){const a=Eo(t,this.validators);let s={onSubmit:{},onChange:{},onBlur:{}};a&&(s=Object.keys(a).reduce((l,c)=>(vo.has(c)?l.onSubmit[c]=a[c]:sr.has(c)?l.onChange[c]=a[c]:l.onBlur[c]=a[c],l),s)),(typeof n>"u"||n===jt.ON_CHANGE)&&hn(this,In,Object.keys(s.onChange).length===0?null:s.onChange),(typeof n>"u"||n===jt.ON_BLUR)&&hn(this,xn,Object.keys(s.onBlur).length===0?null:s.onBlur),(typeof n>"u"||n===jt.ON_SUBMIT)&&(hn(this,Qn,Object.keys(s.onSubmit).length===0?null:s.onSubmit),hn(this,In,Object.keys(s.onChange).length===0?null:s.onChange),hn(this,xn,Object.keys(s.onBlur).length===0?null:s.onBlur)),r||this.update(),this.isFocused()&&this.onFocus&&this.onFocus()}else this.errors&&(hn(this,Qn,null),hn(this,xn,null),hn(this,In,null),r||this.update());return this}isValid(){return!this.errors||this.isPristine()}hasErrors(){return!!this.errors}isVisibilyInvalid(){return!this.isValid()}hasError(t){return this.errors&&Object.prototype.hasOwnProperty.call(this.errors,t)}hasPreventativeError(t){return this.preventativeErrors.includes(t)}hasPreventativeErrors(){return this.preventativeErrors.length>0}isRequired(){return this.validators&&this.validators.indexOf(To.required)>-1}isSubmitted(){return this.submitted}onFocus(){}onBlur(){}}Qn=new WeakMap,In=new WeakMap,xn=new WeakMap;class Or extends Rn{constructor(){super(...arguments);Yt(this,"id",ft());Yt(this,"focused",!1);Yt(this,"pristine",!0)}setValue(n){if(this.preventativeErrors=[],this.validators&&this.validators.length>0){const r=Eo(n,this.validators);if(r&&Object.keys(r).filter(s=>zt.has(s)).length>0){this.preventativeErrors=Object.keys(r);return}}this.update(this.path,n)}isPristine(){return this.pristine}markAsPristine(){return this.pristine=!0,this.update(),this}markAsDirty(){return this.pristine=!1,this.update(),this}isFocused(){return this.focused}markAsFocused(){return this.focused=!0,this.update(),this.onFocus&&this.onFocus(),this}markAsBlurred(){return this.update(this.path,null,!0),this.onBlur&&this.onBlur(),this.preventativeErrors=[],this}markAsSubmitted(){return this.submitted=!0,this.update(this.path,null,!1,void 0,!0),this}}class Bn extends Or{constructor(n,r,a){super(a?r:n,a||r);Yt(this,"fields");a&&this.inferMembers(n)}isFocused(){return super.isFocused()||this.rollup("isFocused")}isValid(){return super.isValid()&&this.rollup("isValid")}hasErrors(){return super.hasErrors()||Object.keys(this.fields).some(n=>this.fields[n].hasErrors())}contentsAreValid(){return this.rollup("isValid")&&this.rollup("contentsAreValid")}isPristine(){return super.isPristine()&&this.rollup("isPristine")}markAsPristine(){super.markAsPristine();for(const n of Object.keys(this.fields))this.fields[n].markAsPristine();return this}markAsDirty(){super.markAsDirty();for(const n of Object.keys(this.fields))this.fields[n].markAsDirty();return this}markAsBlurred(){super.markAsBlurred();for(const n of Object.keys(this.fields))this.fields[n].markAsBlurred();return this}markAsSubmitted(){super.markAsSubmitted();for(const n of Object.keys(this.fields))this.fields[n].markAsSubmitted();return this}inferSpsControl(n,r){return wo(n,[...this.path,r],this.update)}rollup(n){return Object.keys(this.fields).reduce((r,a)=>r&&(!this.fields[a][n]||this.fields[a][n]()),!0)}}class ec extends Bn{inferMembers(t){this.fields={};for(const n of Object.keys(t))this.fields[n]=this.inferSpsControl(t[n],n)}}class tc extends Bn{inferMembers(t){this.fields=t.map((n,r)=>this.inferSpsControl(n,String(r)))}}function wo(e,t,n){return e instanceof Rn?(e.path=t,e.update=n,e):Array.isArray(e)?new tc(e,t,n):jl(e)?new ec(e,t,n):new Or(t,n)}function Pr(e,t){return t.length===0||!e?e:Pr(e.fields[t[0]],t.slice(1,t.length))}function Aa(e,t){if(t.length===0||!e)return[e];const n=t[0];if(t=t.slice(1,t.length),n==="*"){const r=Array.isArray(e.fields)?e.fields:Object.keys(e.fields).map(a=>e.fields[a]);return t.length===0?r:r.reduce((a,s)=>[...a,...Aa(s,t)],[])}return Aa(e.fields[n],t)}function Fa(e,t,n){for(const r of Object.keys(t)){const a=t[r];for(const s of Aa(e,r.split(".")))s&&a&&n(s,a)}}function Co(e,t,n,r=!1,a=!1){Fa(t,n,(s,l)=>{s.validators=typeof l=="function"?l(e):l,r&&s.validate(v.getPath(e,s.path),void 0,a)})}function Va(e,t){const n=t[0];return t=t.slice(1),Array.isArray(e)?e.map((r,a)=>a===Number(n)?Va(r,t):r):jl(e)?Object.keys(e).reduce((r,a)=>Object.assign(r,{[a]:a===n?Va(e[a],t):e[a]}),{}):e}function sS(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("The initial value of useSpsForm() hook must be an object.")}function nc(e,t={}){sS(e);const[,n]=x.useState({}),r=x.useRef(!1);r.current=!1;const a=x.useRef(t),s=x.useCallback(h=>{var T,C;const S=u.current;let y;if(h)if(h.path)if(h.markAsBlurred){const E=Pr(S.formMeta,h.path);if(E){E.focused=!1;const N=v.getPath(S.formValue,h.path);E.validate(N,jt.ON_BLUR)}}else if(h.newValidators){if(a.current){const E=h.path.join(".");a.current={...a.current,[E]:h.newValidators},Co(S.formValue,S.formMeta,a.current,!0)}}else if(h.markAsSubmitted){const E=Pr(S.formMeta,h.path);if(E){E.submitted=!0;const N=v.getPath(S.formValue,h.path);E.validate(N,jt.ON_SUBMIT)}}else y=Va(S.formValue,h.path),v.setPath(y,h.path,h.value);else y=h.value;if((T=h==null?void 0:h.updateFormOptions)!=null&&T.validators&&(a.current={...a.current,...h.updateFormOptions.validators},Co(S.formValue,S.formMeta,a.current,((C=h.updateFormOptions)==null?void 0:C.runValidators)??!0)),y){S.formMeta.submitted=!1,v.deepFreeze(y);const E=v.diff(S.formValue,y);for(const{type:M,key:I,parentPath:k,objects:[,V]}of E){const R=Pr(S.formMeta,k);if(typeof I!="symbol"&&R){let w;switch(M){case v.DiffChange.ADDITION:R.fields[I]=wo(V[I],[...k,I],c);break;case v.DiffChange.DELETION:Array.isArray(R.fields)?R.fields[I]=void 0:delete R.fields[I];break;case v.DiffChange.ALTERATION:w=wo(V[I],[...k,I],c),(w instanceof Bn&&!(R.fields[I]instanceof Bn)||!(w instanceof Bn)&&R.fields[I]instanceof Bn)&&(w.pristine=!1,R.fields[I]=w);break}}}const N=new Set;if(E.filter(M=>M.type===v.DiffChange.DELETION).reduce((M,I)=>(M.has(I.parentPath)||M.add(I.parentPath),M),N),Array.from(N).forEach(M=>{const I=Pr(S.formMeta,M);Array.isArray(I.fields)&&(I.fields=I.fields.filter(k=>k!==void 0))}),a.current){Co(y,S.formMeta,a.current);const M=new Set;t&&Fa(S.formMeta,t,(I,k)=>{typeof k=="function"&&(I.validate(v.getPath(y,I.path)),M.add(I))});for(const{type:I,key:k,parentPath:V,objects:[,R]}of E)if(typeof k!="symbol"){let w=S.formMeta,P=y;if(w){for(const O of V)w=w.fields[O],P=P[O],M.has(w)||w.validate(P,jt.ON_CHANGE);if(I===v.DiffChange.ADDITION||I===v.DiffChange.ALTERATION){const O=w.fields[k];if(!M.has(O)&&(w.fields[k].validate(R[k],jt.ON_CHANGE),I===v.DiffChange.ADDITION&&O.fields))for(const[$,J]of Object.entries(O.fields))J.validate(R[k][$],jt.ON_CHANGE)}}}}}u.current={...S,formValue:y||S.formValue},r.current||n({})},[]),l=x.useCallback((h,S)=>{h||S?s({value:h,updateFormOptions:S}):s()},[s]),c=x.useCallback((h,S,y=!1,T,C=!1)=>{h?s({path:h,value:S,markAsBlurred:y,newValidators:T,markAsSubmitted:C}):l()},[s,l]),p=x.useMemo(()=>{v.deepFreeze(e);const h=wo(e,[],c);return t&&Co(e,h,t,!1,!0),h},[]),m=x.useCallback(()=>(u.current.formMeta.markAsDirty(),a.current&&Fa(u.current.formMeta,a.current,(h,S)=>{(typeof S=="function"||Array.isArray(S))&&h.validate(v.getPath(u.current.formValue,h.path))}),u.current.formMeta.isValid()),[]),f=x.useCallback(()=>u.current.formValue,[]),u=x.useRef({formValue:e,formMeta:p,updateForm:l,validateForm:m,getCurrentFormValue:f});return u.current}const at=o.forwardRef((e,t)=>{const{className:n,children:r,focusInputOnClick:a,formControl:s,formMeta:l,inputRef:c,onClick:p,...m}=e,f=o.useRef(),h=c||(t||f);function S(){h&&h!==t&&h.current&&h.current.focus()}function y(){h&&h!==t&&h.current&&l&&l instanceof Or&&l.markAsFocused()}function T(){h&&h!==t&&h.current&&l&&l instanceof Or&&l.markAsBlurred()}const C=G("sps-form-group",(s&&s.isRequired()||l&&l.isRequired())&&"sps-form-group--required",(s&&!s.isValid()||l&&l.isVisibilyInvalid())&&"sps-form-group--error",l&&l.hasPreventativeErrors()&&"sps-form-group--preventative-error",n);function E(N){a&&S(),p&&p(N)}return o.useEffect(()=>{function N(M){M.target.classList.contains("sps-form-control__clear-btn")&&M.preventDefault()}return document.addEventListener("mousedown",N),()=>{document.removeEventListener("mousedown",N)}},[]),o.createElement("div",{...m,className:C,ref:t,tabIndex:-1,onClick:E,onFocus:y,onBlur:T},r)});Object.assign(at,{displayName:"SpsFormComponentWrapper"});function rc(e){return typeof e=="object"&&e!=null&&e.nodeType===1}function oc(e,t){return(!t||e!=="hidden")&&e!=="visible"&&e!=="clip"}function $a(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return oc(n.overflowY,t)||oc(n.overflowX,t)||function(r){var a=function(s){if(!s.ownerDocument||!s.ownerDocument.defaultView)return null;try{return s.ownerDocument.defaultView.frameElement}catch{return null}}(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)}(e)}return!1}function Do(e,t,n,r,a,s,l,c){return s<e&&l>t||s>e&&l<t?0:s<=e&&c<=n||l>=t&&c>=n?s-e-r:l>t&&c<n||s<e&&c>n?l-t+a:0}var ac=function(e,t){var n=window,r=t.scrollMode,a=t.block,s=t.inline,l=t.boundary,c=t.skipOverflowHiddenElements,p=typeof l=="function"?l:function(ke){return ke!==l};if(!rc(e))throw new TypeError("Invalid target");for(var m,f,u=document.scrollingElement||document.documentElement,h=[],S=e;rc(S)&&p(S);){if((S=(f=(m=S).parentElement)==null?m.getRootNode().host||null:f)===u){h.push(S);break}S!=null&&S===document.body&&$a(S)&&!$a(document.documentElement)||S!=null&&$a(S,c)&&h.push(S)}for(var y=n.visualViewport?n.visualViewport.width:innerWidth,T=n.visualViewport?n.visualViewport.height:innerHeight,C=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,N=e.getBoundingClientRect(),M=N.height,I=N.width,k=N.top,V=N.right,R=N.bottom,w=N.left,P=a==="start"||a==="nearest"?k:a==="end"?R:k+M/2,O=s==="center"?w+I/2:s==="end"?V:w,$=[],J=0;J<h.length;J++){var L=h[J],Z=L.getBoundingClientRect(),A=Z.height,ne=Z.width,Y=Z.top,U=Z.right,ae=Z.bottom,H=Z.left;if(r==="if-needed"&&k>=0&&w>=0&&R<=T&&V<=y&&k>=Y&&R<=ae&&w>=H&&V<=U)return $;var q=getComputedStyle(L),re=parseInt(q.borderLeftWidth,10),oe=parseInt(q.borderTopWidth,10),j=parseInt(q.borderRightWidth,10),B=parseInt(q.borderBottomWidth,10),z=0,Q=0,ee="offsetWidth"in L?L.offsetWidth-L.clientWidth-re-j:0,de="offsetHeight"in L?L.offsetHeight-L.clientHeight-oe-B:0,ie="offsetWidth"in L?L.offsetWidth===0?0:ne/L.offsetWidth:0,le="offsetHeight"in L?L.offsetHeight===0?0:A/L.offsetHeight:0;if(u===L)z=a==="start"?P:a==="end"?P-T:a==="nearest"?Do(E,E+T,T,oe,B,E+P,E+P+M,M):P-T/2,Q=s==="start"?O:s==="center"?O-y/2:s==="end"?O-y:Do(C,C+y,y,re,j,C+O,C+O+I,I),z=Math.max(0,z+E),Q=Math.max(0,Q+C);else{z=a==="start"?P-Y-oe:a==="end"?P-ae+B+de:a==="nearest"?Do(Y,ae,A,oe,B+de,P,P+M,M):P-(Y+A/2)+de/2,Q=s==="start"?O-H-re:s==="center"?O-(H+ne/2)+ee/2:s==="end"?O-U+j+ee:Do(H,U,ne,re,j+ee,O,O+I,I);var se=L.scrollLeft,Ne=L.scrollTop;P+=Ne-(z=Math.max(0,Math.min(Ne+z/le,L.scrollHeight-A/le+de))),O+=se-(Q=Math.max(0,Math.min(se+Q/ie,L.scrollWidth-ne/ie+ee)))}$.push({el:L,top:z,left:Q})}return $};function sc(e){return e===Object(e)&&Object.keys(e).length!==0}function iS(e,t){t===void 0&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(r){var a=r.el,s=r.top,l=r.left;a.scroll&&n?a.scroll({top:s,left:l,behavior:t}):(a.scrollTop=s,a.scrollLeft=l)})}function lS(e){return e===!1?{block:"end",inline:"nearest"}:sc(e)?e:{block:"start",inline:"nearest"}}function No(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(sc(t)&&typeof t.behavior=="function")return t.behavior(n?ac(e,t):[]);if(n){var r=lS(t);return iS(ac(e,r),r.behavior)}}const Ka=Object.freeze(Object.defineProperty({__proto__:null,default:No},Symbol.toStringTag,{value:"Module"})),He=o.createContext(W.noI18nI18n),cS={alt:"string",size:"SpinnerSize",title:"string"};function Ha(e){const{alt:t,className:n,size:r=W.SpinnerSize.MEDIUM,"data-testid":a,title:s,unsafelyReplaceClassName:l,...c}=e,{t:p}=o.useContext(He),m=t||s||p("design-system:spinner.defaultAltText",{defaultValue:"Loading..."}),f=G(l||"sps-spinner",`sps-spinner--${r}`,n);return o.createElement("i",{className:f,"data-testid":a,title:m,...c})}Object.assign(Ha,{props:cS,displayName:"SpsSpinner"});const dS=60;function ko(e){return typeof e>"u"?"inherit":`${e}px`}function Wa(e){switch(e){case W.Position.TOP_LEFT:return W.Position.BOTTOM_LEFT;case W.Position.TOP_MIDDLE:return W.Position.BOTTOM_MIDDLE;case W.Position.TOP_RIGHT:return W.Position.BOTTOM_RIGHT;case W.Position.RIGHT_TOP:return W.Position.LEFT_TOP;case W.Position.RIGHT_MIDDLE:return W.Position.LEFT_MIDDLE;case W.Position.RIGHT_BOTTOM:return W.Position.LEFT_BOTTOM;case W.Position.BOTTOM_RIGHT:return W.Position.TOP_RIGHT;case W.Position.BOTTOM_MIDDLE:return W.Position.TOP_MIDDLE;case W.Position.BOTTOM_LEFT:return W.Position.TOP_LEFT;case W.Position.LEFT_BOTTOM:return W.Position.RIGHT_BOTTOM;case W.Position.LEFT_MIDDLE:return W.Position.RIGHT_MIDDLE;case W.Position.LEFT_TOP:return W.Position.RIGHT_TOP}}function pS(e,t,n,r,a,s,l,c){const p=l&&l.current,m=p?p.scrollTop:window.pageYOffset,f=c?0:m,u=p?p.scrollLeft:window.pageXOffset,h=c?0:u,[S,y]=e.split(" ");let T,C,E,N;switch(S){case"top":E=t.height-n.top-f-s[0];break;case"left":C=t.width-n.left-h-s[0];break;case"right":N=n.right+h-s[0];break;case"bottom":T=n.bottom+f-s[0];break;default:throw new Error(`Invalid position ${e}`)}switch(y){case"left":N=n.left+h+s[1];break;case"top":T=n.top+f+s[1];break;case"middle":S==="top"||S==="bottom"?N=n.left+h+n.width/2-a/2+s[1]:(S==="left"||S==="right")&&(T=n.top+f+n.height/2-r.height/2+s[1]);break;case"bottom":E=t.height-n.bottom-f+s[1];break;case"right":C=t.width-n.right-h+s[1];break;default:throw new Error(`Invalid position ${e}`)}return[T,C,E,N]}function An(e,t,n,{altPosition:r,setMinWidth:a=!1,setWidth:s=!1,parentElementRef:l,fixed:c=!1,offsets:p=[0,0]}){if(e.current&&t.current){const m=e.current.getBoundingClientRect(),f=t.current.getBoundingClientRect(),u=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=document.documentElement.getBoundingClientRect().width;let y=((l==null?void 0:l.current)??document.documentElement).getBoundingClientRect();c&&(y={x:0,y:0,width:h,height:u,top:0,left:0,bottom:u,right:h,toJSON(){return{width:h,height:u,top:0,left:0,bottom:u,right:h}}});const[T,C]=n.split(" ");let E=n;if(r&&(T==="top"&&f.top-m.height<dS||T==="right"&&f.right+m.width>h||T==="bottom"&&f.bottom+m.height>u||T==="left"&&f.left-m.width<0)&&(E=r),C==="left"&&f.left+m.width+((p==null?void 0:p[1])??0)>document.documentElement.getBoundingClientRect().right)switch(T){case"bottom":E=W.Position.BOTTOM_RIGHT;break;case"top":E=W.Position.TOP_RIGHT;break}const N=a?Math.max(f.width,m.width):m.width,M=s?f.width:N,[I,k,V,R]=pS(E,y,f,m,M,p,l,c),w={top:ko(I),right:ko(k),bottom:ko(V),left:ko(R)};return c&&(w.position="fixed",w.zIndex=W.ZStratum.BAR),a&&(w.minWidth=`${f.width}px`),s&&(w.width=`${f.width}px`),[w,E===r]}return[{},!1]}const kt=x.createContext(null);function cr(e,t=[]){const n=x.useContext(kt);return x.useMemo(()=>r=>{const s=n&&n.parentElementRef&&n.parentElementRef.current||document.body;let l=null,c=s.lastElementChild;for(;c&&c!==s.firstElementChild;){if(c.hasAttribute("data-portalid")&&c.getAttribute("data-portalid")===e){l=c;break}c=c.previousElementSibling}if(l)s.contains(l)||s.appendChild(l);else{l=document.createElement("div"),l.setAttribute("data-portalid",e);for(const p of t)l.classList.add(p);s.appendChild(l)}return bo.createPortal(r,l)},[n])}const Ga=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0"];async function ic(e,t,n,r,a,s){const l=typeof e.options=="function"?e.options(t.value):e.options||[],c=l instanceof Promise,p=u=>u.replace(/([.?*+^$[\]\\(){}|-])/g,"");n({pending:c}),s.current=c?l:null;const m=c?await l||[]:l||[];if(c&&s.current!==l)return;let f=Array.from(m).filter(Boolean).map(u=>new W.SpsOptionListOption(u,typeof u=="function"?{textKey:"label",captionKey:"caption"}:{textKey:e.textKey,captionKey:e.captionKey}));if(e.nullOption&&f.unshift(new W.SpsOptionListOption(null,{text:e.nullOption})),t.value&&!e.disableDefaultOptionsFiltering){const u=p(t.value);n({replacementPattern:new RegExp(`(${u})`,"ig")}),f=f.filter(h=>{const S=new RegExp(u,"i"),y=p(h.text);return e.filterByTextAndCaptionKey?S.test(y)||S.test(p(h.caption)):S.test(y)})}else n({replacementPattern:null});if(e.disabledOptions)for(const u of f)e.disabledOptions.includes(u.value)&&(u.disabled=!0);r(Object.freeze(f)),e.onOptionListChanged&&e.onOptionListChanged(f.length),a(f.some(u=>u.value&&!!u.value.icon)),n({pending:!1})}function uS(e,t,n){const[r,a]=o.useState(Object.freeze([])),[s,l]=o.useState(!1),c=o.useRef(null),p=o.useRef(e.options);(typeof e.options!="function"||e.disableOptionsMemoization)&&(p.current=e.options);const m=o.useMemo(()=>typeof p.current=="function"?v.debounce(ic,typeof e.searchDebounce<"u"?e.searchDebounce:500):ic,[p.current,e.disabledOptions]);return o.useEffect(()=>{m(e,t,n,a,l,c)},[p.current,t.value,e.disabledOptions]),[r,s]}class gn{constructor(t,n){Yt(this,"nativeEvent");Yt(this,"currentTarget");Yt(this,"isPgStoppedInternal",!1);this.target=t,this.currentTarget=t,this.nativeEvent=new CustomEvent("change",n),Object.defineProperty(this.nativeEvent,"target",{value:t,writable:!1,configurable:!1,enumerable:!0})}get bubbles(){return this.nativeEvent.bubbles}get cancelable(){return this.nativeEvent.cancelable}get defaultPrevented(){return this.nativeEvent.defaultPrevented}get eventPhase(){return this.nativeEvent.eventPhase}get isTrusted(){return this.nativeEvent.isTrusted}get timeStamp(){return this.nativeEvent.timeStamp}get type(){return this.nativeEvent.type}preventDefault(){this.nativeEvent.preventDefault()}isDefaultPrevented(){return this.defaultPrevented}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPgStoppedInternal=!0}isPropagationStopped(){return this.isPgStoppedInternal}persist(){throw new Error("This is not a real React ChangeEvent. React does not permit the creation of SyntheticEvents in userland.")}}function mS(e,t){return{...e,...t}}function qt(e){return x.useReducer(mS,e)}function fS({hideInlineSearch:e,options:t,onSearchChange:n,search:r="",searchPlaceholder:a="Search…",searchInputRef:s}){const[l,c]=qt({isAsync:typeof t=="function",pending:!1,value:r,replacementPattern:null}),p=o.useCallback(S=>{c({value:S.target.value}),n&&n(S)},[n]),m=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),S.stopPropagation()},[]),f=o.useCallback(S=>{S.nativeEvent.stopImmediatePropagation(),c({value:""}),s!=null&&s.current&&(n&&n(new gn(s.current)),s.current.focus())},[n]),u=S=>{S&&(["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"].includes(S.key)||S.stopPropagation())};return o.useEffect(()=>{c({value:r})},[r]),[l.isAsync&&!e?o.createElement("div",{className:"sps-option-list__search sps-form-group sps-text-input"},o.createElement("div",{className:"sps-form-control"},!l.value&&o.createElement("i",{className:"sps-icon sps-icon-filter sps-text-input__icon"}),o.createElement("input",{type:"text",className:"sps-text-input__input",placeholder:a,ref:s,value:l.value,onChange:p,onClick:m,onKeyDown:u}),l.value&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:f}))):o.createElement(o.Fragment,null),l,c]}const hS=No||Ka,SS=["Tab","Escape","Enter","Up","ArrowUp","Down","ArrowDown"];function gS(e,t,n){return n?(e&&e[n])===(t&&t[n]):e===t}function lc(e,t,n){return typeof n.value=="function"&&n.disabled?!0:t?!!(e!=null&&e.find(r=>{var a;return r[t]&&r[t]===((a=n==null?void 0:n.value)==null?void 0:a[t])})):!1}const Rr=o.forwardRef((e,t)=>{const{captionKey:n,comparisonKey:r,disabledOptions:a,options:s,tall:l,textKey:c,valueKey:p,zeroState:m,hideInlineSearch:f,onSearchChange:u,search:h,searchDebounce:S,searchPlaceholder:y,onSpecialActionSelect:T,attachTo:C,className:E,conformWidth:N,id:M,ignoreWidthStyles:I,isOpen:k,keepOpen:V,keyDown:R,nullOption:w,onOptionListChanged:P,onOptionSelected:O,onPositionFlip:$,onSelfToggle:J,optionRole:L,positionOverride:Z,selectedOption:A,specialAction:ne,unsafelyReplaceClassName:Y,loading:U,filterByTextAndCaptionKey:ae,maxHeightPx:H,maxHeightRem:q,disableOptionsMemoization:re,disableDefaultOptionsFiltering:oe,"data-testid":j,typeaheadEvent:B,...z}=e,Q=o.useMemo(()=>ne?new W.SpsOptionListOption(ne,{textKey:"label",captionKey:"caption"}):null,[ne]),[ee,de]=o.useState(-1),[ie,le]=o.useState(k),se=t||o.useRef(null),Ne=o.useRef(null),ke=o.useRef(null),it=cr("sps-option-list-portal"),lt=o.useContext(kt),[ut,ct]=Z||[W.Position.BOTTOM_LEFT,W.Position.TOP_LEFT],[[Pt,je],fe]=o.useState([{},!1]),Fe=o.useRef(null),[ve,Le,Qe]=fS({...e,searchInputRef:Fe}),[we,Ht]=uS(e,Le,Qe);o.useEffect(()=>{B&&pt(B)},[B]),o.useEffect(()=>{fe(ie?An(se,C,ut,{altPosition:ct,setMinWidth:!I,setWidth:!I&&N,...lt}):[{},!1])},[ie,ut,ct,we]),o.useEffect(()=>{let be;return ie&&(be=()=>{ie&&fe(An(se,C,ut,{altPosition:ct,setMinWidth:!I,setWidth:!I&&N,...lt}))},document.addEventListener("scroll",be)),()=>{be&&document.removeEventListener("scroll",be)}},[ie]),o.useEffect(()=>{de(-1)},[Le]);const Mn=G(Y||"sps-option-list","z-stratum-dropdown",ie&&"sps-option-list--open",Le.isAsync&&"sps-option-list--searchable",je&&"sps-option-list--opens-upward",ne&&ne.label&&"sps-option-list--has-special-action",E),ue=G(Y||"sps-option-list__options",l&&"sps-option-list__options--tall"),Se=o.useCallback(()=>{ie||(le(!0),Fe.current&&Fe.current.focus(),de(-1),J&&J(!0))},[ie,J]),Oe=o.useCallback(()=>{ie&&(le(!1),de(-1),J&&J(!1))},[ie,J]),Ze=o.useCallback((be,Te)=>{Te||be&&!be.disabled&&(typeof be.value=="function"?(be.value(),T&&T()):typeof O=="function"&&O(be.value),V||Oe())},[O,Oe]),Ie=o.useCallback((be,Te,Xe)=>{be.stopPropagation(),Ze(Te,Xe)},[Ze]),dt=o.useRef(a||[]);dt.current=a||[];const Tt=o.useCallback(be=>{switch(be.key){case"Tab":case"Escape":Oe();break;case"Enter":if(ee>-1){const Te=we[ee]||Q;be.preventDefault();const Xe=!!Te&&lc(dt.current,r||"",Te);!Xe&&Te&&typeof O=="function"&&typeof Te.value=="function"?Te.value():Te&&Ze(Te,Xe)}break;case"Up":case"ArrowUp":{let Te=ee;je?ee<=-1?Te=we.length-1:ee===0?ne&&(Te=we.length):ee<we.length&&(Te=ee-1):ee>-1&&(Te=ee-1),Te!==ee&&(be.preventDefault(),de(Te));break}case"Down":case"ArrowDown":{Se();let Te=ee;je?ee!==-1&&(ee>=we.length?Te=0:ee===we.length-1?Te=-1:Te=ee+1):ee<we.length-1+ +!!ne&&(Te=ee+1),Te!==ee&&(be.preventDefault(),de(Te));break}default:Se()}},[Oe,Se,ee,Ze,O,je,we]),Ae=o.useCallback(be=>{Se();const Te=we.findIndex(Xe=>{if(Xe.textKey){const Rt=Xe.textKey;return Xe.value[Rt].toLowerCase().charAt([0])===be.key.toLocaleLowerCase()}return Xe.value.toString().toLowerCase().charAt([0])===be.key.toLocaleLowerCase()});Te>-1&&de(Te)},[we]),pt=o.useCallback(be=>{be&&(SS.includes(be.key)?Tt(be):Ga.includes(be.key)&&!f&&Ae(be))},[Oe,Se,ee,Ze,O,je,we]);o.useEffect(()=>{if(lt!==null&&document.getElementsByClassName("sps-modal__body").length>0){const be=()=>{J&&J(!1)},Te=document.getElementsByClassName("sps-modal__body")[0];return Te.addEventListener("scroll",be),()=>{Te.removeEventListener("scroll",be)}}},[]),o.useEffect(()=>{ie&&ke.current&&hS(ke.current,{scrollMode:"if-needed",block:"nearest",inline:"nearest"})},[ee,ie]),o.useEffect(()=>{le(k),k?Fe.current&&Fe.current.focus():de(-1)},[k]),o.useEffect(()=>{R&&pt(R)},[R]),o.useEffect(()=>{!ie&&Ne.current&&(Qe({value:""}),Ne.current.scrollTop=0),ie&&$&&$(je)},[ie]);const _n=H?H/16:q,Xt=_n?{maxHeight:`${_n}rem`}:{};function va(be,Te){return Te?o.createElement(o.Fragment,null,be.split(Te).map((Xe,Rt)=>Te.test(Xe)?o.createElement("u",{key:Rt},Xe):o.createElement(o.Fragment,{key:Rt},Xe))):o.createElement(o.Fragment,null,be)}return it(o.createElement("div",{className:Mn,id:M,"aria-activedescendant":ee>-1?`${M}-option-${ee}`:"",tabIndex:-1,ref:se,style:Pt,onMouseLeave:()=>de(-1),"data-testid":j,...z},ve,o.createElement("div",{className:ue,ref:Ne,"data-testid":`${j}-options`,style:Xt},!U&&!Le.pending&&m&&we.length===0&&o.createElement("div",{className:"sps-option-list__zero-state"},m),(U||Le.pending)&&o.createElement("div",{className:"sps-option-list__loading"},o.createElement(Ha,null)),!U&&!Le.pending&&we.map((be,Te)=>{const Xe=`${M}-option-${Te}`,Rt=gS(be.value,A,r),me=lc(dt.current,r||"",be);return o.createElement("a",{key:Xe,id:Xe,role:L,"aria-selected":Rt,href:be.href,className:G("sps-option-list__option",be.caption&&"sps-option-list__option--has-caption",be.disabled&&"sps-option-list__option--disabled",be.bold&&"sps-option-list__option--bold",(Rt||me)&&"sps-option-list__option--selected",ee===Te&&"sps-option-list__option--highlighted"),onClick:wl=>Ie(wl,be,me),onMouseOver:()=>de(Te),tabIndex:-1,ref:ee===Te?ke:null,"data-testid":`${j}-option-${Te}`},be.value&&be.value.icon&&o.createElement("i",{className:G("sps-icon","sps-option-list__option-icon",`sps-icon-${String(be.value.icon)}`)}),(!be.value||!be.value.icon&&Ht)&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,va(be.text,Le.replacementPattern)),be.caption&&o.createElement("div",{className:"sps-option-list__option-caption"},o.createElement("span",null,va(be.caption,Le.replacementPattern))))})),Q&&(ne==null?void 0:ne.label)&&o.createElement("a",{className:G("sps-option-list__option","sps-option-list__special-action",ee===we.length&&"sps-option-list__option--highlighted",ne.disabled&&"sps-option-list__special-action--disabled"),href:Q.href,target:Q.href&&ne.newTab?"_blank":"_self",onClick:be=>Ie(be,Q),onMouseOver:()=>de(we.length),"data-testid":`${j}-special-action`},ne.icon&&o.createElement("i",{className:G("sps-icon","sps-option-list__option-icon",`sps-icon-${String(ne.icon)}`)}),!ne.icon&&Ht&&o.createElement("span",{className:"sps-option-list__option-icon-spacer"}),o.createElement("span",null,ne.label))))});Object.assign(Rr,{displayName:"SpsOptionList"});function bS(e,t,n=[]){return o.useMemo(()=>{function r(a){return o.createElement(e,{...a,...t},a.children)}return r},n)}function vt(e){return typeof e=="function"?e():e}const cc=function({children:e,elements:t}){if(t.length===0)return o.createElement(o.Fragment,null,e);const[n,r]=Array.isArray(t[0])?t[0]:[t[0]];return o.createElement(n,{...r??{}},o.createElement(cc,{elements:t.slice(1)},e))},dc=function({children:e,providers:t=[],...n}){return o.createElement("div",{...n},o.createElement(cc,{elements:t},e))},vS=function({children:e,className:t,...n}){return o.createElement(dc,{className:`sps-app ${t}`,...n},e)};function It(e=[],t=[]){const n=Array.isArray(e)?v.flatten(e):[e],r=t.map(s=>Array.isArray(s)?s:[s]),a=new Array(r.length+1).fill(null).map(()=>[]);for(const s of n){let l=!1;for(let c=0;c<r.length;c+=1)for(const{type:p,props:m={}}of r[c])if(s.type===p&&Object.keys(m).every(u=>m[u]===s.props[u])){l=!0,a[c].push(s);break}l||a[a.length-1].push(s)}return a}function pc(e,t,n){const r=Object.entries(t).filter(([,s])=>typeof s!="string"&&s.deprecated).map(([s])=>s),a=r.map(s=>n[s]);o.useEffect(()=>{a.find(s=>typeof s<"u")&&console.warn(`The following prop(s) of ${e} are deprecated: ${r.join(", ")}`)},a)}function Ya(e,t){const n=x.useRef(!1);x.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function Ua(e,t,n){const r=o.useRef(t(...n));o.useEffect(()=>(document.addEventListener(e,r.current,{capture:!0}),()=>document.removeEventListener(e,r.current)),[]),o.useEffect(()=>{document.removeEventListener(e,r.current),r.current=t(...n),document.addEventListener(e,r.current,{capture:!0})},n)}function uc(e,t,n){return function(a){var s,l;!((s=e.current)!=null&&s.contains(a.target))&&!((l=t.current)!=null&&l.contains(a.target))&&n()}}function dr(e,t,n){const r=o.useRef(!1),[a,s]=o.useState(!1),l=o.useCallback(()=>{r.current?r.current=!1:s(!0)},[]),c=o.useCallback((p=!1)=>{s(!1),r.current=p,n&&n()},[]);return Ua("mousedown",uc,[e,t,c]),Ua("pointerdown",uc,[e,t,c]),{showPopup:a,doShowPopup:l,doHidePopup:c}}const mc=e=>{const t=/(auto|scroll)/,n=(c,p)=>c.parentNode===null?p:n(c.parentNode,p.concat([c])),r=(c,p)=>getComputedStyle(c,null).getPropertyValue(p),a=c=>r(c,"overflow")+r(c,"overflow-y"),s=c=>t.test(a(c));return(c=>{if(!(c instanceof HTMLElement||c instanceof SVGElement))return;const p=n(c.parentNode,[]);for(let m=0;m<p.length;m+=1)if(s(p[m]))return p[m];return null})(e)};let za=0;function Io({isOpen:e,rootRef:t}){o.useLayoutEffect(()=>{let n,r,a;if(e&&t.current){za+=1,n=mc(t.current)||document.body,r=n===document.body?window.innerWidth-document.documentElement.clientWidth:n.offsetWidth-n.clientWidth,n.style.overflow="hidden";const s=window.getComputedStyle(n).paddingRight;if(n.style.paddingRight=s&&s!=="0px"?`calc(${s} + ${r}px)`:`${r}px`,n===document.body)if(a=document.getElementsByClassName("sps-navbar-container").item(0),a&&window.getComputedStyle(a).position==="fixed"){const l=window.getComputedStyle(a).paddingRight;a.style.paddingRight=l&&l!=="0px"?`calc(${l} + ${r}px)`:`${r}px`}else{const l=document.getElementsByTagName("nav").item(0);if(a=l==null?void 0:l.parentElement,a&&window.getComputedStyle(a).position==="fixed"){const c=window.getComputedStyle(a).paddingRight;a.style.paddingRight=c&&c!=="0px"?`calc(${c} + ${r}px)`:`${r}px`}}}return()=>{n&&(za-=1,za===0&&(n.style.overflow=null,n.style.paddingRight=null,a&&(a.style.paddingRight=null)))}},[e])}const yS={debounce:"number",disabled:"boolean",formMeta:"SpsFormFieldMeta<string>",icon:"SpsIcon",onChange:"React.ChangeEventHandler",onSelectionChange:"(newValue: string) => void",placeholder:"string",suggestions:{type:`
2
2
  Eventually<Iterable<string>>
3
3
  | ((filter?: string) => Eventually<Iterable<string>>)
4
4
  `,required:!0},tallOptionList:"boolean",value:"string",zeroState:"string",loading:"boolean",maxHeightOptionListPx:"number",maxHeightOptionListRem:"number",disableOptionsMemoization:"boolean",inputNotClearable:"boolean",autoFocusOnSelection:"boolean"};function Jt({className:e,debounce:t=0,disabled:n,formControl:r,formMeta:a,onChange:s,onSelectionChange:l,icon:c,id:p,placeholder:m="",suggestions:f,unsafelyReplaceClassName:u,tallOptionList:h,value:S="",zeroState:y,loading:T,maxHeightOptionListPx:C,maxHeightOptionListRem:E,disableOptionsMemoization:N,inputNotClearable:M,autoFocusOnSelection:I,"data-testid":k,...V}){const R=a||r,{wrapperId:w,controlId:P}=bt(p,R),[O,$]=qt({keyDown:null,opensUpward:!1}),J=o.useRef(null),L=o.useRef(null),Z=o.useRef(null),{showPopup:A,doShowPopup:ne,doHidePopup:Y}=dr(J,Z);function U(B,z,Q=!1){R&&(R.setValue(B),R.markAsDirty()),l&&Q?l(B):s&&s(z||new gn({value:B}))}function ae(B){L.current&&(L.current.value="",U("")),B.stopPropagation()}function H(B){U(B.target.value,B)}function q(B){n||(["Up","ArrowUp","Down","ArrowDown","Enter"].indexOf(B.key)>-1&&(B.preventDefault(),B.persist()),B.stopPropagation(),$({keyDown:B})),B.key==="Tab"&&Y()}function re(B){B?ne():Y()}function oe(B){$({opensUpward:B})}const j=G(u||"sps-autocomplete",A&&"sps-autocomplete--open",A&&"z-stratum-dropdown",O.opensUpward&&"sps-autocomplete--opens-upward",n&&"sps-form-control--disabled",e);return o.useEffect(()=>{let B;return A&&(B=()=>{Y()},window.addEventListener("resize",B)),()=>{B&&window.removeEventListener("resize",B)}},[A]),Io({isOpen:A,rootRef:J}),o.createElement(at,{id:w,className:j,formControl:r,formMeta:a,inputRef:L,ref:J,focusInputOnClick:!0,onClick:B=>B.nativeEvent.stopImmediatePropagation(),"data-testid":`${k}`},o.createElement("div",{className:"sps-text-input"},o.createElement("div",{className:"sps-form-control"},c&&o.createElement("i",{className:G("sps-text-input__icon","sps-icon",`sps-icon-${c}`)}),o.createElement("input",{type:"text",ref:L,value:S,className:"sps-text-input__input",placeholder:m,onFocus:ne,onClick:ne,onChange:H,onKeyDown:q,disabled:n,id:P,"data-testid":`${k}__input`,...V}),S&&!n&&!M&&o.createElement("i",{"aria-label":"clear",className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:B=>ae(B)}))),o.createElement(Rr,{id:`${w}_options`,ref:Z,attachTo:J,isOpen:A,options:f,hideInlineSearch:!0,keyDown:O.keyDown,onOptionSelected:B=>{var z;U(B,void 0,!0),I&&((z=L.current)==null||z.focus())},onPositionFlip:oe,onSelfToggle:re,offsets:[1,0],search:S,searchDebounce:t,tall:h,zeroState:y,loading:T,maxHeightPx:C,maxHeightRem:E,disableOptionsMemoization:N}))}Object.assign(Jt,{props:yS,displayName:"SpsAutocomplete"});const fc={basic:{label:"Basic",examples:{basic:{react:v.code`
@@ -1823,7 +1823,7 @@ Valid keys: `+JSON.stringify(Object.keys(H),null," "));var se=le(Q,ie,j,B,z+"."
1823
1823
  </div>
1824
1824
  );
1825
1825
  }
1826
- `}}}},GE={formMeta:"SpsFormSetMeta<any>",stacked:"boolean"};function br({children:e,className:t,formArray:n,formGroup:r,formMeta:a,stacked:s,"data-testid":l,unsafelyReplaceClassName:c,...p}){const m=r||n,f=m||a,[u,h]=o.useState(!1);o.useEffect(()=>{if(f){const y=f.isFocused();!u&&y&&f.onFocus?f.onFocus():u&&!y&&f.onBlur&&f.onBlur(),h(y)}});const S=G(c||"sps-form-group",(m&&m.invalid||a&&(!a.isValid()||!a.contentsAreValid()))&&"sps-form-group--error",t);return o.createElement("div",{className:S,"data-testid":l,...p},o.createElement("div",{className:G("sps-input-group",s&&"sps-input-group--stacked")},e))}Object.assign(br,{props:GE,displayName:"SpsInputGroup"});const YE={disabled:"boolean",formMeta:"SpsFormFieldMeta<SimpleMomentRange>",maxDate:"SimpleDate",minDate:"SimpleDate",onChange:"(newMomentRange: SimpleMomentRange) => void",presets:"Array<DateTimePreset>",value:"SimpleMomentRange",showTwoMonths:"boolean",twentyFourHour:"boolean",format:"string",placeholder12h:"string",placeholder24h:"string"},ru="sps-datepicker",ou=["AM","PM"],au=[{definition:"P0D",label:"design-system:datepicker.preset.today"},{definition:"() => [null, {month: 1, date: 1, year: 3000}]",label:"design-system:datepicker.preset.before"},{definition:"() => [{month: 1, date: 1, year: 1990}, null]",label:"design-system:datepicker.preset.after"},{definition:"P7D",label:"design-system:datepicker.preset.sevenDays"},{definition:"P30D",label:"design-system:datepicker.preset.thirtyDays"},{definition:"P60D",label:"design-system:datepicker.preset.sixtyDays"},{definition:"P90D",label:"design-system:datepicker.preset.ninetyDays"},{definition:"P1Y",label:"design-system:datepicker.preset.oneYear"}];function fi({className:e,disabled:t,formMeta:n,id:r,maxDate:a,minDate:s,onChange:l,presets:c=au,value:p,showTwoMonths:m=!1,twentyFourHour:f=!1,format:u,"data-testid":h,placeholder24h:S="00:00",placeholder12h:y="12:00"}){const{t:T}=o.useContext(He),{wrapperId:C,controlId:E}=bt(r&&`${r}_from`,n),{wrapperId:N,controlId:M}=bt(r&&`${r}_to`,n),I=o.useRef(null),k=o.useRef(null),V=o.useRef(null),R=o.useRef(null),w=o.useRef(null),P=te.splitMomentInDateTimeParts(Array.isArray(p)?p[0]:void 0,f,u),O=te.splitMomentInDateTimeParts(Array.isArray(p)?p[1]:void 0,f,u),[$,J]=o.useState(P[0]),[L,Z]=o.useState(O[0]),[A,ne]=o.useState(P[1]),[Y,U]=o.useState(O[1]),[ae,H]=o.useState(P[2]),[q,re]=o.useState(O[2]),[oe,j]=o.useState(null),{showPopup:B,doShowPopup:z,doHidePopup:Q}=dr(I,w);function ee(ue){n&&(n.setValue(ue),n.markAsDirty()),l&&l(ue)}function de(ue){return ue&&/^design-system:/.test(ue.label)?T(ue.label):ue.label}const ie=oe&&de(oe)==="Before",le=oe&&de(oe)==="After";function se(ue){const Se=p||[],Oe=te.toMoment(ue);let Ze;if(ie)Ze=[null,Oe],Q(!0);else if(le)Ze=[Oe,null],Q(!0);else if(!Se[0]||Se[1]||Oe!=null&&Oe.isBefore(Se[0])){let Ie=parseInt((A==null?void 0:A.split(":")[0])||"0",10);!f&&Ie===12&&(Ie=0);const dt=parseInt((A==null?void 0:A.split(":")[1])||"0",10);Oe==null||Oe.set("hour",ae==="PM"?12+Ie:Ie<12?Ie:0),Oe==null||Oe.set("minute",dt),Ze=[Oe,null],j(null)}else{let Ie=parseInt((Y==null?void 0:Y.split(":")[0])||"0",10);!f&&Ie===12&&(Ie=0);const dt=parseInt((Y==null?void 0:Y.split(":")[1])||"0",10);Oe==null||Oe.set("hour",q==="PM"?12+Ie:Ie),Oe==null||Oe.set("minute",dt),Ze=[Se[0],Oe],Q(!0),j(null)}ee(Ze)}function Ne(ue){J(ue.target.value)}function ke(ue){te.validateTimeString(ue.target.value,f)&&ne(ue.target.value)}function it(ue,Se,Oe){const Ze=$,Ie=Se??A,dt=ae;if(Ze===P[0]&&Ie===P[1]&&dt===P[2])return;const Tt=te.createFrom(Ze,u);if(Tt&&te.isValid(Tt)){const Ae=te.toMoment(Tt);let pt=parseInt((Ie==null?void 0:Ie.split(":")[0])||"0",10);!f&&pt===12&&(pt=0);const _n=parseInt((Ie==null?void 0:Ie.split(":")[1])||"0",10);Ae==null||Ae.set("hour",dt==="PM"?12+pt:pt),Ae==null||Ae.set("minute",_n);const Xt=[Ae,(Ae==null?void 0:Ae.isBefore(p==null?void 0:p[1]))&&(p==null?void 0:p[1])||null];ee(Xt)}}function lt(ue){te.validateTimeString(ue??A,f)&&(ne(te.padIncompleteTimeString(ue??A,f)),setTimeout(()=>it(void 0,ue),0))}function ut(ue){H(ue.target.value)}function ct(ue){te.validateTimeString(ue,f)&&(ne(ue),setTimeout(()=>lt(ue),0))}o.useEffect(()=>{ae!==P[2]&&it()},[ae]);function Pt(ue){Z(ue.target.value)}function je(ue){te.validateTimeString(ue.target.value,f)&&U(ue.target.value)}function fe(ue,Se,Oe){const Ze=L,Ie=Se??Y,dt=q;if(Ze===O[0]&&Ie===O[1]&&dt===O[2])return;const Tt=te.createFrom(Ze,u);if(Tt&&te.isValid(Tt)){const Ae=te.toMoment(Tt);let pt=parseInt((Ie==null?void 0:Ie.split(":")[0])||"0",10);!f&&pt===12&&(pt=0);const _n=parseInt((Ie==null?void 0:Ie.split(":")[1])||"0",10);Ae==null||Ae.set("hour",dt==="PM"?12+pt:pt),Ae==null||Ae.set("minute",_n);const Xt=[(Ae==null?void 0:Ae.isAfter(p==null?void 0:p[0]))&&(p==null?void 0:p[0])||null,Ae];ee(Xt)}}function Fe(ue){te.validateTimeString(ue??Y,f)&&(U(te.padIncompleteTimeString(ue??Y,f)),setTimeout(()=>fe(void 0,ue),0))}function ve(ue){re(ue.target.value)}function Le(ue){te.validateTimeString(ue,f)&&(U(ue),setTimeout(()=>Fe(ue),0))}o.useEffect(()=>{q!==O[2]&&fe()},[q]);function Qe(){ee([null,null]),j(null)}function we(ue){return function(Se){switch(Se.key){case"Tab":Q();break;case"Backspace":Se.target.selectionStart===0&&p&&!Array.isArray(p)&&Qe();break;case"Enter":ue==="from"?it():ue==="to"&&fe();break}}}function Ht(ue){if(!ue){j(null),ee([null,null]);return}j(ue);const Se=te.createDateTimeRangeFromPreset(ue);ue&&de(ue)==="Before"?!p||Array.isArray(p)&&p[0]&&p[1]?ee([null,null]):Array.isArray(p)&&p[0]?ee([null,te.toMoment(te.createFrom(p[0],u))]):Array.isArray(p)&&p[1]&&ee([null,te.toMoment(te.createFrom(p[1],u))]):ue&&de(ue)==="After"?!p||Array.isArray(p)&&p[0]&&p[1]?ee([null,null]):Array.isArray(p)&&p[0]?ee([te.toMoment(te.createFrom(p[0],u)),null]):Array.isArray(p)&&p[1]&&ee([te.toMoment(te.createFrom(p[1],u)),null]):JSON.stringify(p)!==JSON.stringify(Se)&&ee([Se[0],Se[1]])}o.useEffect(()=>{p&&Array.isArray(p)&&!p.length&&Qe()},[p]),o.useEffect(()=>{if(p&&Array.isArray(p)&&Array.isArray(p)){if(p[0]&&!p[1]){const ue=c.find(Se=>de(Se)==="After");ue&&Ht(ue)}else if(!p[0]&&p[1]){const ue=c.find(Se=>de(Se)==="Before");ue&&Ht(ue)}else if(p[0]&&p[1]){const ue=te.toDateTimeStringRange(p,f,u),Se=c.find(Oe=>ue===te.toDateTimeStringRange(te.createDateTimeRangeFromPreset(Oe),f,u));Se&&Ht(Se)}}},[]),o.useEffect(()=>{P[0]?J(P[0]):J(""),P[1]?ne(P[1]):ne(f?"00:00":"12:00"),f||(P[2]?H(P[2]):H("AM")),O[0]?Z(O[0]):Z(""),O[1]?U(O[1]):U(f?"00:00":"12:00"),f||(O[2]?re(O[2]):re("AM"))},[P[0],P[1],P[2],O[0],O[1],O[2],f]);const Mn=G(ru,"sps-text-input",B&&`${ru}--open`,e);return o.createElement(o.Fragment,null,o.createElement("div",{className:G("sps-datetime-range-picker")},o.createElement("div",{className:G("sps-datetime-range-picker__pair")},o.createElement(at,{id:C,className:Mn,formMeta:n,inputRef:k,focusInputOnClick:!0,ref:I},o.createElement("div",{className:G("sps-form-control",t&&"disabled")},o.createElement("i",{className:G("sps-text-input__icon","sps-icon","sps-icon-calendar")}),oe&&o.createElement("div",{"data-testid":`${h}_selected_preset`,className:"sps-datepicker__selected-preset"},o.createElement("span",{className:"sps-tag sps-tag--info"},de(oe))),o.createElement("input",{type:"text",ref:k,className:"sps-text-input__input","data-testid":`${h}_from_date_input`,id:E,placeholder:!$&&!oe?(u==null?void 0:u.toUpperCase())||ir:ie?O[0]:le?P[0]:void 0,onChange:Ne,onClick:z,onFocus:z,onBlur:()=>it(),onKeyDown:we("from"),value:oe?"":$,disabled:t}),p&&!t&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:Qe}))),!oe&&!f?o.createElement(br,null,o.createElement(Jt,{className:"sps-time-input",placeholder:y,suggestions:Ra,zeroState:"Custom time",value:A,onChange:ke,onBlur:()=>lt(),onSelectionChange:ct,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0}),o.createElement(Yn,{options:ou,value:ae,onChange:ut,disabled:t,notClearable:!0})):o.createElement(Jt,{className:"sps-time-input",placeholder:S,suggestions:Ba,zeroState:"Custom time",value:A,onChange:ke,onBlur:()=>lt(),onSelectionChange:ct,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0})),!oe&&o.createElement("span",{className:G("sps-datepicker__to")},"to"),!oe&&o.createElement("div",{className:G("sps-datetime-range-picker__pair")},o.createElement(at,{id:N,className:Mn,formMeta:n,inputRef:R,focusInputOnClick:!0,ref:V},o.createElement("div",{className:G("sps-form-control",t&&"disabled")},o.createElement("i",{className:G("sps-text-input__icon","sps-icon","sps-icon-calendar")}),oe&&o.createElement("div",{"data-testid":`${h}_selected_preset`,className:"sps-datepicker__selected-preset"},o.createElement("span",{className:"sps-tag sps-tag--info"},de(oe))),o.createElement("input",{type:"text",ref:R,className:"sps-text-input__input","data-testid":`${h}_to_date_input`,id:M,placeholder:!L&&!oe?(u==null?void 0:u.toUpperCase())||ir:void 0,onChange:Pt,onClick:z,onFocus:z,onKeyDown:we("to"),onBlur:()=>fe(),value:L,disabled:t}),p&&!t&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:Qe}))),f?o.createElement(Jt,{className:"sps-time-input",placeholder:S,suggestions:Ba,zeroState:"Custom time",value:Y,onChange:je,onBlur:()=>Fe(),onSelectionChange:Le,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0}):o.createElement(br,null,o.createElement(Jt,{className:"sps-time-input",placeholder:y,suggestions:Ra,zeroState:"Custom time",value:Y,onChange:je,onBlur:()=>Fe(),onSelectionChange:Le,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0}),o.createElement(Yn,{options:ou,value:q,onChange:ve,disabled:t,notClearable:!0})))),o.createElement(Jo,{isOpen:B,attachTo:I,ref:w},o.createElement("div",{className:"sps-datepicker__presets"},o.createElement("fieldset",null,o.createElement("legend",{className:"sps-datepicker__presets-label"},T("design-system:datepicker.presetsLabel",{defaultValue:"Ranges"})),o.createElement("div",{className:"sps-custom-control sps-custom-radio sps-custom-control--no-error"},o.createElement("input",{"data-testid":`${h}_presets_custom_input`,type:"radio",id:`sps-date-range-picker-${C}__range-custom`,className:"sps-custom-control__input",checked:!oe,name:`sps-date-range-picker-${C}__range`,onChange:()=>Ht()}),o.createElement("label",{className:"sps-custom-control__label",htmlFor:`sps-date-range-picker-${C}__range-custom`},T("design-system:datepicker.preset.custom",{defaultValue:"Custom"}))),c.map((ue,Se)=>o.createElement("div",{key:de(ue),className:"sps-custom-control sps-custom-radio sps-custom-control--no-error"},o.createElement("input",{type:"radio","data-testid":`${h}_preset_option_${ue.label}`,id:`sps-date-range-picker-${C}__range-${Se}`,name:`sps-date-range-picker-${C}__range`,onChange:()=>Ht(ue),checked:oe!=null&&oe.definition?oe.definition===ue.definition:!1,className:"sps-custom-control__input"}),o.createElement("label",{className:"sps-custom-control__label",htmlFor:`sps-date-range-picker-${C}__range-${Se}`},de(ue)))))),o.createElement(qo,{"data-testid":`${h}_calendar`,selectedRange:Array.isArray(p)?[te.createFrom(p[0],u),te.createFrom(p[1],u)]:void 0,onNewSelection:se,minDate:s,maxDate:a,showTwoMonths:m,selectedPreset:oe&&de(oe)})))}Object.assign(fi,{props:YE,displayName:"SpsDateTimeRangePicker"});const su={basic:{label:"Basic",examples:{basic:{react:v.code`
1826
+ `}}}},GE={formMeta:"SpsFormSetMeta<any>",stacked:"boolean"};function br({children:e,className:t,formArray:n,formGroup:r,formMeta:a,stacked:s,"data-testid":l,unsafelyReplaceClassName:c,...p}){const m=r||n,f=m||a,[u,h]=o.useState(!1);o.useEffect(()=>{if(f){const y=f.isFocused();!u&&y&&f.onFocus?f.onFocus():u&&!y&&f.onBlur&&f.onBlur(),h(y)}});const S=G(c||"sps-form-group",(m&&m.invalid||a&&(!a.isValid()||!a.contentsAreValid()))&&"sps-form-group--error",t);return o.createElement("div",{className:S,"data-testid":l,...p},o.createElement("div",{className:G("sps-input-group",s&&"sps-input-group--stacked")},e))}Object.assign(br,{props:GE,displayName:"SpsInputGroup"});const YE={disabled:"boolean",formMeta:"SpsFormFieldMeta<SimpleMomentRange>",maxDate:"SimpleDate",minDate:"SimpleDate",onChange:"(newMomentRange: SimpleMomentRange) => void",presets:"Array<DateTimePreset>",value:"SimpleMomentRange",showTwoMonths:"boolean",twentyFourHour:"boolean",format:"string",placeholder12h:"string",placeholder24h:"string"},ru="sps-datepicker",ou=["AM","PM"],au=[{definition:"P0D",label:"design-system:datepicker.preset.today"},{definition:"() => [null, {month: 1, date: 1, year: 3000}]",label:"design-system:datepicker.preset.before"},{definition:"() => [{month: 1, date: 1, year: 1990}, null]",label:"design-system:datepicker.preset.after"},{definition:"P7D",label:"design-system:datepicker.preset.sevenDays"},{definition:"P30D",label:"design-system:datepicker.preset.thirtyDays"},{definition:"P60D",label:"design-system:datepicker.preset.sixtyDays"},{definition:"P90D",label:"design-system:datepicker.preset.ninetyDays"},{definition:"P1Y",label:"design-system:datepicker.preset.oneYear"}];function fi({className:e,disabled:t,formMeta:n,id:r,maxDate:a,minDate:s,onChange:l,presets:c=au,value:p,showTwoMonths:m=!1,twentyFourHour:f=!1,format:u,"data-testid":h,placeholder24h:S="00:00",placeholder12h:y="12:00"}){const{t:T}=o.useContext(He),{wrapperId:C,controlId:E}=bt(r&&`${r}_from`,n),{wrapperId:N,controlId:M}=bt(r&&`${r}_to`,n),I=o.useRef(null),k=o.useRef(null),V=o.useRef(null),R=o.useRef(null),w=o.useRef(null),P=te.splitMomentInDateTimeParts(Array.isArray(p)?p[0]:void 0,f,u),O=te.splitMomentInDateTimeParts(Array.isArray(p)?p[1]:void 0,f,u,!0),[$,J]=o.useState(P[0]),[L,Z]=o.useState(O[0]),[A,ne]=o.useState(P[1]),[Y,U]=o.useState(O[1]),[ae,H]=o.useState(P[2]),[q,re]=o.useState(O[2]),[oe,j]=o.useState(null),{showPopup:B,doShowPopup:z,doHidePopup:Q}=dr(I,w);function ee(ue){n&&(n.setValue(ue),n.markAsDirty()),l&&l(ue)}function de(ue){return ue&&/^design-system:/.test(ue.label)?T(ue.label):ue.label}const ie=oe&&de(oe)==="Before",le=oe&&de(oe)==="After";function se(ue){const Se=p||[],Oe=te.toMoment(ue);let Ze;if(ie)Ze=[null,Oe],Q(!0);else if(le)Ze=[Oe,null],Q(!0);else if(!Se[0]||Se[1]||Oe!=null&&Oe.isBefore(Se[0])){let Ie=parseInt((A==null?void 0:A.split(":")[0])||"0",10);!f&&Ie===12&&(Ie=0);const dt=parseInt((A==null?void 0:A.split(":")[1])||"0",10);Oe==null||Oe.set("hour",ae==="PM"?12+Ie:Ie<12?Ie:0),Oe==null||Oe.set("minute",dt),Ze=[Oe,null],j(null)}else{let Ie=parseInt((Y==null?void 0:Y.split(":")[0])||"0",10);!f&&Ie===12&&(Ie=0);const dt=parseInt((Y==null?void 0:Y.split(":")[1])||"0",10);Oe==null||Oe.set("hour",q==="PM"?12+Ie:Ie),Oe==null||Oe.set("minute",dt),Ze=[Se[0],Oe],Q(!0),j(null)}ee(Ze)}function Ne(ue){J(ue.target.value)}function ke(ue){te.validateTimeString(ue.target.value,f)&&ne(ue.target.value)}function it(ue,Se,Oe){const Ze=$,Ie=Se??A,dt=ae;if(Ze===P[0]&&Ie===P[1]&&dt===P[2])return;const Tt=te.createFrom(Ze,u);if(Tt&&te.isValid(Tt)){const Ae=te.toMoment(Tt);let pt=parseInt((Ie==null?void 0:Ie.split(":")[0])||"0",10);!f&&pt===12&&(pt=0);const _n=parseInt((Ie==null?void 0:Ie.split(":")[1])||"0",10);Ae==null||Ae.set("hour",dt==="PM"?12+pt:pt),Ae==null||Ae.set("minute",_n);const Xt=[Ae,(Ae==null?void 0:Ae.isBefore(p==null?void 0:p[1]))&&(p==null?void 0:p[1])||null];ee(Xt)}}function lt(ue){te.validateTimeString(ue??A,f)&&(ne(te.padIncompleteTimeString(ue??A,f)),setTimeout(()=>it(void 0,ue),0))}function ut(ue){H(ue.target.value)}function ct(ue){te.validateTimeString(ue,f)&&(ne(ue),setTimeout(()=>lt(ue),0))}o.useEffect(()=>{ae!==P[2]&&it()},[ae]);function Pt(ue){Z(ue.target.value)}function je(ue){te.validateTimeString(ue.target.value,f)&&U(ue.target.value)}function fe(ue,Se,Oe){const Ze=L,Ie=Se??Y,dt=q;if(Ze===O[0]&&Ie===O[1]&&dt===O[2])return;const Tt=te.createFrom(Ze,u);if(Tt&&te.isValid(Tt)){const Ae=te.toMoment(Tt);let pt=parseInt((Ie==null?void 0:Ie.split(":")[0])||"0",10);!f&&pt===12&&(pt=0);const _n=parseInt((Ie==null?void 0:Ie.split(":")[1])||"0",10);Ae==null||Ae.set("hour",dt==="PM"?12+pt:pt),Ae==null||Ae.set("minute",_n);const Xt=[(Ae==null?void 0:Ae.isAfter(p==null?void 0:p[0]))&&(p==null?void 0:p[0])||null,Ae];ee(Xt)}}function Fe(ue){te.validateTimeString(ue??Y,f)&&(U(te.padIncompleteTimeString(ue??Y,f)),setTimeout(()=>fe(void 0,ue),0))}function ve(ue){re(ue.target.value)}function Le(ue){te.validateTimeString(ue,f)&&(U(ue),setTimeout(()=>Fe(ue),0))}o.useEffect(()=>{q!==O[2]&&fe()},[q]);function Qe(){ee([null,null]),j(null)}function we(ue){return function(Se){switch(Se.key){case"Tab":Q();break;case"Backspace":Se.target.selectionStart===0&&p&&!Array.isArray(p)&&Qe();break;case"Enter":ue==="from"?it():ue==="to"&&fe();break}}}function Ht(ue){if(!ue){j(null),ee([null,null]);return}j(ue);const Se=te.createDateTimeRangeFromPreset(ue);ue&&de(ue)==="Before"?!p||Array.isArray(p)&&p[0]&&p[1]?ee([null,null]):Array.isArray(p)&&p[0]?ee([null,te.toMoment(te.createFrom(p[0],u))]):Array.isArray(p)&&p[1]&&ee([null,te.toMoment(te.createFrom(p[1],u))]):ue&&de(ue)==="After"?!p||Array.isArray(p)&&p[0]&&p[1]?ee([null,null]):Array.isArray(p)&&p[0]?ee([te.toMoment(te.createFrom(p[0],u)),null]):Array.isArray(p)&&p[1]&&ee([te.toMoment(te.createFrom(p[1],u)),null]):JSON.stringify(p)!==JSON.stringify(Se)&&ee([Se[0],Se[1]])}o.useEffect(()=>{p&&Array.isArray(p)&&!p.length&&Qe()},[p]),o.useEffect(()=>{if(p&&Array.isArray(p)&&Array.isArray(p)){if(p[0]&&!p[1]){const ue=c.find(Se=>de(Se)==="After");ue&&Ht(ue)}else if(!p[0]&&p[1]){const ue=c.find(Se=>de(Se)==="Before");ue&&Ht(ue)}else if(p[0]&&p[1]){const ue=te.toDateTimeStringRange(p,f,u),Se=c.find(Oe=>ue===te.toDateTimeStringRange(te.createDateTimeRangeFromPreset(Oe),f,u));Se&&Ht(Se)}}},[]),o.useEffect(()=>{P[0]?J(P[0]):J(""),P[1]?ne(P[1]):ne(f?"00:00":"12:00"),f||(P[2]?H(P[2]):H("AM")),O[0]?Z(O[0]):Z(""),O[1]?U(O[1]):U(f?"23:59":"11:59"),f||(O[2]?re(O[2]):re("PM"))},[P[0],P[1],P[2],O[0],O[1],O[2],f]);const Mn=G(ru,"sps-text-input",B&&`${ru}--open`,e);return o.createElement(o.Fragment,null,o.createElement("div",{className:G("sps-datetime-range-picker")},o.createElement("div",{className:G("sps-datetime-range-picker__pair")},o.createElement(at,{id:C,className:Mn,formMeta:n,inputRef:k,focusInputOnClick:!0,ref:I},o.createElement("div",{className:G("sps-form-control",t&&"disabled")},o.createElement("i",{className:G("sps-text-input__icon","sps-icon","sps-icon-calendar")}),oe&&o.createElement("div",{"data-testid":`${h}_selected_preset`,className:"sps-datepicker__selected-preset"},o.createElement("span",{className:"sps-tag sps-tag--info"},de(oe))),o.createElement("input",{type:"text",ref:k,className:"sps-text-input__input","data-testid":`${h}_from_date_input`,id:E,placeholder:!$&&!oe?(u==null?void 0:u.toUpperCase())||ir:ie?O[0]:le?P[0]:void 0,onChange:Ne,onClick:z,onFocus:z,onBlur:()=>it(),onKeyDown:we("from"),value:oe?"":$,disabled:t}),p&&!t&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:Qe}))),!oe&&(f?o.createElement(Jt,{className:"sps-time-input",placeholder:S,suggestions:Ba,zeroState:"Custom time",value:A,onChange:ke,onBlur:()=>lt(),onSelectionChange:ct,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0}):o.createElement(br,null,o.createElement(Jt,{className:"sps-time-input",placeholder:y,suggestions:Ra,zeroState:"Custom time",value:A,onChange:ke,onBlur:()=>lt(),onSelectionChange:ct,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0}),o.createElement(Yn,{options:ou,value:ae,onChange:ut,disabled:t,notClearable:!0})))),!oe&&o.createElement("span",{className:G("sps-datepicker__to")},"to"),!oe&&o.createElement("div",{className:G("sps-datetime-range-picker__pair")},o.createElement(at,{id:N,className:Mn,formMeta:n,inputRef:R,focusInputOnClick:!0,ref:V},o.createElement("div",{className:G("sps-form-control",t&&"disabled")},o.createElement("i",{className:G("sps-text-input__icon","sps-icon","sps-icon-calendar")}),oe&&o.createElement("div",{"data-testid":`${h}_selected_preset`,className:"sps-datepicker__selected-preset"},o.createElement("span",{className:"sps-tag sps-tag--info"},de(oe))),o.createElement("input",{type:"text",ref:R,className:"sps-text-input__input","data-testid":`${h}_to_date_input`,id:M,placeholder:!L&&!oe?(u==null?void 0:u.toUpperCase())||ir:void 0,onChange:Pt,onClick:z,onFocus:z,onKeyDown:we("to"),onBlur:()=>fe(),value:L,disabled:t}),p&&!t&&o.createElement("i",{className:"sps-icon sps-icon-x-circle sps-form-control__clear-btn",onClick:Qe}))),f?o.createElement(Jt,{className:"sps-time-input",placeholder:S,suggestions:Ba,zeroState:"Custom time",value:Y,onChange:je,onBlur:()=>Fe(),onSelectionChange:Le,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0}):o.createElement(br,null,o.createElement(Jt,{className:"sps-time-input",placeholder:y,suggestions:Ra,zeroState:"Custom time",value:Y,onChange:je,onBlur:()=>Fe(),onSelectionChange:Le,disabled:t,inputNotClearable:!0,autoFocusOnSelection:!0}),o.createElement(Yn,{options:ou,value:q,onChange:ve,disabled:t,notClearable:!0})))),o.createElement(Jo,{isOpen:B,attachTo:I,ref:w},o.createElement("div",{className:"sps-datepicker__presets"},o.createElement("fieldset",null,o.createElement("legend",{className:"sps-datepicker__presets-label"},T("design-system:datepicker.presetsLabel",{defaultValue:"Ranges"})),o.createElement("div",{className:"sps-custom-control sps-custom-radio sps-custom-control--no-error"},o.createElement("input",{"data-testid":`${h}_presets_custom_input`,type:"radio",id:`sps-date-range-picker-${C}__range-custom`,className:"sps-custom-control__input",checked:!oe,name:`sps-date-range-picker-${C}__range`,onChange:()=>Ht()}),o.createElement("label",{className:"sps-custom-control__label",htmlFor:`sps-date-range-picker-${C}__range-custom`},T("design-system:datepicker.preset.custom",{defaultValue:"Custom"}))),c.map((ue,Se)=>o.createElement("div",{key:de(ue),className:"sps-custom-control sps-custom-radio sps-custom-control--no-error"},o.createElement("input",{type:"radio","data-testid":`${h}_preset_option_${ue.label}`,id:`sps-date-range-picker-${C}__range-${Se}`,name:`sps-date-range-picker-${C}__range`,onChange:()=>Ht(ue),checked:oe!=null&&oe.definition?oe.definition===ue.definition:!1,className:"sps-custom-control__input"}),o.createElement("label",{className:"sps-custom-control__label",htmlFor:`sps-date-range-picker-${C}__range-${Se}`},de(ue)))))),o.createElement(qo,{"data-testid":`${h}_calendar`,selectedRange:Array.isArray(p)?[te.createFrom(p[0],u),te.createFrom(p[1],u)]:void 0,onNewSelection:se,minDate:s,maxDate:a,showTwoMonths:m,selectedPreset:oe&&de(oe)})))}Object.assign(fi,{props:YE,displayName:"SpsDateTimeRangePicker"});const su={basic:{label:"Basic",examples:{basic:{react:v.code`
1827
1827
  import {
1828
1828
  useSpsForm,
1829
1829
  SpsLabel,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spscommerce/ds-react",
3
3
  "description": "SPS Design System React components",
4
- "version": "8.26.3",
4
+ "version": "8.26.4",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
@@ -46,11 +46,11 @@
46
46
  "moment-timezone": "^0.5.28",
47
47
  "react": "^16.9.0",
48
48
  "react-dom": "^16.9.0",
49
- "@sps-woodland/illustrations": "8.26.3",
50
- "@sps-woodland/tabs": "8.26.3",
51
- "@spscommerce/ds-colors": "8.26.3",
52
- "@spscommerce/ds-shared": "8.26.3",
53
- "@spscommerce/positioning": "8.26.3"
49
+ "@sps-woodland/illustrations": "8.26.4",
50
+ "@sps-woodland/tabs": "8.26.4",
51
+ "@spscommerce/ds-colors": "8.26.4",
52
+ "@spscommerce/ds-shared": "8.26.4",
53
+ "@spscommerce/positioning": "8.26.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@react-spectrum/provider": "^3.4.1",
@@ -72,12 +72,12 @@
72
72
  "raf-stub": "^2.0.2",
73
73
  "react": "^16.9.0",
74
74
  "react-dom": "^16.9.0",
75
- "@sps-woodland/illustrations": "8.26.3",
76
- "@sps-woodland/tabs": "8.26.3",
77
- "@spscommerce/ds-colors": "8.26.3",
78
- "@spscommerce/ds-shared": "8.26.3",
79
- "@spscommerce/positioning": "8.26.3",
80
- "test": "8.26.3"
75
+ "@sps-woodland/illustrations": "8.26.4",
76
+ "@sps-woodland/tabs": "8.26.4",
77
+ "@spscommerce/ds-colors": "8.26.4",
78
+ "@spscommerce/ds-shared": "8.26.4",
79
+ "@spscommerce/positioning": "8.26.4",
80
+ "test": "8.26.4"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "pnpm run build:js && pnpm run build:types",