@zealicsolutions/web-ui 1.1.89 → 1.1.91

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.
@@ -5,7 +5,9 @@ import { ContainerComponentProps, Molecule } from '../types/types';
5
5
  */
6
6
  export declare const isEmptyStateContainer: (item: ContainerComponentProps | Molecule) => boolean;
7
7
  /**
8
- * Gets the field identifier for empty-state checks (sourceDataPointerId preferred).
8
+ * Gets the field identifier for empty-state / replicator connection.
9
+ * Prefers replicatorFieldId so empty_state and replicator share the same connection;
10
+ * when both have the same replicatorFieldId, empty state is shown when that replicator has no data.
9
11
  */
10
12
  export declare const getReplicatorFieldId: (item: ContainerComponentProps | Molecule) => DmfId | undefined;
11
13
  /**
package/dist/cjs/index.js CHANGED
@@ -1031,7 +1031,7 @@
1031
1031
  `,$ht=e=>{if("menu_item"===e.type){const t=e;if(!t.sx)return!1;const r=e=>!!e&&(Array.isArray(e)?e.some(r):"function"!=typeof e&&("object"==typeof e&&("absolute"===e.position||"fixed"===e.position)));return r(t.sx)}return!1},Hht=({currentWebpageId:t,anchor:r="left",variant:o="persistent",open:n=!1,onClose:a,items:i=[],withButton:s=!0,buttonText:l="",buttonVariant:c="contained",buttonTextColor:u,buttonFontSize:d,buttonFontWeight:p,buttonFontFamily:h,buttonDisabled:f=!1,buttonGap:m=0,buttonStartIcon:y,buttonEndIcon:g,buttonBorderRadius:v="0px",buttonPaddingTop:b="0px",buttonPaddingRight:x="0px",buttonPaddingBottom:w="0px",buttonPaddingLeft:k="0px",buttonMarginTop:_="0px",buttonMarginRight:C="0px",buttonMarginBottom:M="0px",buttonMarginLeft:S="0px",buttonIconOnly:D,buttonElevation:P,buttonFillColor:O,buttonFillColorDisabled:E,buttonFillColorHover:j,buttonFillColorPressed:T,buttonBorderColor:N,buttonBorderColorDisabled:R,buttonBorderColorHover:I,buttonBorderColorPressed:F,buttonTextColorDisabled:A,buttonTextColorHover:z,buttonTextColorPressed:L,buttonColor:B="#1976d2",buttonDisabledColor:V,withCloseIcon:$=!0,closeIconColor:H=so.colors.gray2,closeIconName:q="x",closeIconSize:W=18,closeIconBackgroundColor:U="rgba(255, 255, 255, 0.9)",closeIconVisible:G=!1,closeIconTop:K="16px",closeIconLeft:Y="16px",closeIconBorderRadius:X="50%",closeIconElevation:Z=2,moleculeId:Q,configurationItemInfo:J,sx:ee,contentSx:te,scrollable:re=!1,paddingTop:oe,paddingRight:ne,paddingBottom:ae,paddingLeft:ie,height:se,width:le,mobileWidth:ce,backgroundColor:ue="#fff",gap:de="8px",marginTop:pe="0px",marginRight:he="0px",marginBottom:fe="0px",marginLeft:me="0px"})=>{const ye=Ye(),{isConfigurationMode:ge,selectedConfigurationItemId:ve,onConfigurationItemClicked:be,onInternalNavigation:xe}=KC(),{updateDrawer:we,drawerContainerRef:ke,headerHeight:_e,isMobile:Ce}=$C(),[Me,Se]=e.useState(n),[De]=(()=>{try{return Nht()}catch{return[new URLSearchParams,()=>{}]}})(),Pe=e.useMemo(()=>{if(t)return t;const e=De.get(lM),r=De.get(sM);let o=null,n=null;if("undefined"!=typeof window)try{const e=new URLSearchParams(window.location.search);o=e.get(lM),n=e.get(sM)}catch(y1e){}return e||r||o||n||""},[t,De]);e.useEffect(()=>{Se(n)},[n]);const Oe=Boolean(ge&&(ve===Q||i.some(e=>e.id===ve))),Ee=()=>"permanent"===o||(ge?Oe:s?Me:n);e.useEffect(()=>{const e=Ee(),t="left"===r||"right"===r,n=Ce&&void 0!==ce?ce:le;let a=0;if(void 0!==n)if("number"==typeof n)a=n;else if("string"==typeof n){const e=parseFloat(n);Number.isNaN(e)||(a=e)}let i=0;if(t&&!Ce)switch(o){case"permanent":i=a;break;case"persistent":default:i=e?a:0;break;case"temporary":i=0}return we({isOpen:e,position:r,width:i}),()=>{we({isOpen:!1,width:0})}},[Me,n,Oe,ge,s,r,le,ce,Ce,o,we]);const je=()=>{"permanent"!==o&&Se(!0)},Te=(e,t)=>{"permanent"!==o&&(Se(!1),a?.(e,t))},Ne=e=>{const t=ve===e.id,r={entityId:e.id,entity:"molecule_item",entityType:e.type},o=ge?{onClick:e=>{e.stopPropagation(),be?.(r,!1)},onDoubleClick:e=>{e.stopPropagation(),be?.(r,!0)},"data-organism-id":e.id,css:qrt({theme:ye,selected:t})}:{};switch(e.type){case"menu_item":{const t=e;e.id;const r=(e=>{const t=e?.link;if(!t||!t.internalLink)return!1;const r=G9e(t.internalLink);return!(!r||!Pe)&&r===Pe})(t),n={backgroundColor:t.backgroundColor||"transparent",paddingTop:t.paddingTop||"8px",paddingRight:t.paddingRight||"16px",paddingBottom:t.paddingBottom||"8px",paddingLeft:t.paddingLeft||"16px",opacity:t.disabled?.6:1,pointerEvents:t.disabled?"none":"auto","&:hover":{backgroundColor:t.disabled?t.backgroundColor||"transparent":"rgba(0, 0, 0, 0.08)"}},a=t.sx?[n,t.sx]:n;return it(jb,{sx:a,selected:r,onClick:()=>{if(t?.link){V9e(t.link)?xe?.({link:t.link?.internalLink||""}):L9e(t.link?.externalLink)}},disabled:t.disabled,...o,children:[t.startIcon&&at(tKe,{iconName:t.startIcon,color:t.textColor}),at(Od,{sx:{ml:t.startIcon?1:0,mr:t.endIcon?1:0,color:t.textColor||"inherit",fontSize:t.fontSize||"inherit",fontWeight:t.fontWeight||"normal",fontFamily:t.fontFamily||"inherit",whiteSpace:t.wrap?"normal":"nowrap",width:"100%",textAlign:t.textAlign||"left"},children:t.text}),t.endIcon&&at(tKe,{iconName:t.endIcon,color:t.textColor})]},t.id)}case"divider_item":{const t=e;return at(iht,{moleculeId:t.id,variant:t.variant,lineWeight:t.lineWeight,orientation:t.orientation,borderColor:t.borderColor,borderRadius:t.borderRadius,marginTop:t.marginTop,marginRight:t.marginRight,marginBottom:t.marginBottom,marginLeft:t.marginLeft,configurationItemInfo:o},t.id)}case"text_item":{const t=e;return at(uht,{id:t.id,text:t.text,align:t.align,color:t.color,wrap:t.wrap,variant:"string"==typeof t.variant&&["inherit","body1","body2","caption","button","overline","subtitle1","subtitle2","h1","h2","h3","h4","h5","h6"].includes(t.variant)?t.variant:void 0,fontSize:t.fontSize??"",fontWeight:["normal","bold"].includes(t.fontWeight)?t.fontWeight:void 0,fontFamily:t.fontFamily??"",marginTop:t.marginTop||"",marginRight:t.marginRight||"",marginBottom:t.marginBottom||"",marginLeft:t.marginLeft||"",paddingTop:t.paddingTop||"",paddingRight:t.paddingRight||"",paddingBottom:t.paddingBottom||"",paddingLeft:t.paddingLeft||"",configurationsItemInfo:o},t.id)}case"rich_text_item":{const t=e;return at(cht,{htmlElementId:t.id,text:t.text,isRichText:!0,marginTop:t.marginTop||"",marginRight:t.marginRight||"",marginBottom:t.marginBottom||"",marginLeft:t.marginLeft||"",paddingTop:t.paddingTop||"",paddingRight:t.paddingRight||"",paddingBottom:t.paddingBottom||"",paddingLeft:t.paddingLeft||"",configurationItemInfo:o},t.id)}case"image_item":{const t=e;return at(sht,{src:t.src,alt:t.alt||"Drawer image",height:t.height,width:t.width,raised:t.raised,borderRadius:t.borderRadius||"0",marginTop:t.marginTop||"0",marginRight:t.marginRight||"0",marginBottom:t.marginBottom||"0",marginLeft:t.marginLeft||"0",paddingTop:t.paddingTop||"0",paddingRight:t.paddingRight||"0",paddingBottom:t.paddingBottom||"0",paddingLeft:t.paddingLeft||"0",onClick:()=>{if(t?.link){V9e(t.link)?xe?.({link:t.link?.internalLink||""}):L9e(t.link?.externalLink)}},moleculeId:t.id,configurationItemInfo:o},t.id)}default:return null}},Re=Ce&&void 0!==ce?ce:le,Ie=at(Fht,{anchor:r,variant:o,open:Ee(),onClose:Te,paddingTop:oe,paddingRight:ne,paddingBottom:ae,paddingLeft:ie,height:se,width:Re,backgroundColor:ue,marginTop:`calc(${_e} + ${pe})`,marginRight:he,marginBottom:fe,marginLeft:me,container:ke,sx:ee,children:it(Lht,{scrollable:re,sx:te,...J&&Object.keys(J).length?{...J,"data-testid":"drawer-content-config","aria-label":"drawer-content"}:{},children:[(Ee()||"permanent"===o)&&i.length>0?it(nt,{children:[at(Vht,{gap:de,scrollable:re,children:i.filter(e=>!$ht(e)).map(Ne)}),i.filter(e=>$ht(e)).map(Ne)]}):null,!!$&&(!!G||Ee())&&at(Bht,{top:K,left:Y,borderRadius:X,elevation:Z,backgroundColor:U,onClick:e=>{e.stopPropagation();Ee()?Te(e,"closeIconClicked"):je()},"data-testid":"close-icon",children:at(tKe,{"data-testid":"icon-renderer",iconName:q,size:W,color:H})})]})});return s&&"permanent"!==o?it(nt,{children:[at(GKe,{moleculeId:Q,gap:m,text:l,variant:c,textColor:u,fontSize:d,fontWeight:["normal","bold"].includes(p)?p:void 0,fontFamily:h,disabled:f,startIcon:y,endIcon:g,marginTop:_,marginRight:C,marginBottom:M,marginLeft:S,paddingTop:b,paddingRight:x,paddingBottom:w,paddingLeft:k,borderRadius:v,iconOnly:D,elevation:P,fillColor:O||B,fillColorDisabled:E||V,fillColorHover:j,fillColorPressed:T,borderColor:N,borderColorDisabled:R,borderColorHover:I,borderColorPressed:F,textColorDisabled:A,textColorHover:z,textColorPressed:L,externalOnClick:e=>Me?Te(e,"buttonClicked"):je(),configurationItemInfo:J}),at(zht,{children:Ie})]}):at(zht,{children:Ie})},qht=e.forwardRef((e,t)=>{const{inputRef:r,...o}=e;return at(BYe,{...o,ref:e=>{"function"==typeof r&&r(e?e.inputElement:null)},mask:QYe,guide:!0,placeholderChar:" "})}),Wht=e=>{if(void 0===e)return;if("number"==typeof e)return e;const t=e.match(/^(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):void 0},Uht=({masked:e,errorMsg:t,inputSx:r,labelSx:o,sx:n,variant:a="outlined",...i})=>{const s=e?{inputComponent:qht}:{};return at(vC,{...i,variant:a,error:!!t,helperText:t||null,type:"text",sx:{...n},slotProps:{input:{sx:{...r,...n},...s},inputLabel:{sx:{...o,...n}}}})},Ght=({isDisplayOnly:t=!1,required:r=!1,requiredErrorText:o="Email is required",validationErrorText:n="Invalid email address",text:a,placeholderText:i,masked:s=!1,multiLine:l=!1,backgroundColor:c,borderColor:u,color:d="inherit",fontSize:p="16px",fontFamily:h="inherit",fontWeight:f="normal",textAlign:m="left",marginLeft:y="0",marginTop:g="0",marginRight:v="0",marginBottom:b="0",paddingLeft:x="0",paddingTop:w="0",paddingRight:k="0",paddingBottom:_="0",width:C,height:M,minHeight:S,maxHeight:D,minWidth:P,maxWidth:O,sx:E,name:j,sourceDataModelField:T,configurationItemInfo:N,inputSize:R="medium",labelOffset:I,hideLabel:F=!1,variant:A="outlined"})=>{const z=Kt(),L=z?.control,B=!(!L||!j),V=Jrt({name:j,sourceDataModelField:T,form:z,enabled:B});e.useState("");const[$,H]=e.useState(""),q={required:!!r&&o,pattern:{value:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@(([^<>()[\]\\.,;:\s@"]+\.)+[^<>()[\]\\.,;:\s@"]{2,})$/,message:n}},W=e.useMemo(()=>{if(F)return;if(void 0!==I)return I;const e=Wht(w),t=Wht(_);let r=0;r=void 0!==e&&void 0!==t?e+t:"small"===R?17:33;const o=Wht(M)||Wht(S)||Wht(D);if(!o&&!e&&!t)return;const n="number"==typeof p?1.5*p:23;let a;if(void 0!==o)a=Math.max(0,(o-n)/2);else{const t=("small"===R?40:56)-r;a=Math.max(0,(t-n)/2+(e||0))}return Math.round(a)},[M,S,D,I,R,p,w,_,F]),U=e.useMemo(()=>{if(F)return;const e="small"===R?-6:-9,t=Wht(M)||Wht(S)||Wht(D);return!t||t>=36?e:-6},[M,S,D,R,F]);if(t){let e="";if(void 0!==V)e=String(V??"");else if(B){const t=cKe(z.watch(j),j,"value");e=t?String(t):""}const t=e||i||"-";return it("div",{style:{display:"inline-flex",flexDirection:"column",marginLeft:y,marginTop:g,marginRight:v,marginBottom:b,...C&&{width:C},...M&&{height:M},minHeight:S,maxHeight:D,minWidth:P,maxWidth:O},...N,children:[a&&at(Ng,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,marginLeft:0,marginBottom:"4px",...E},children:a}),at(Od,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,paddingLeft:x,paddingTop:w,paddingRight:k,paddingBottom:_,backgroundColor:c,border:`1px solid ${u||"#ccc"}`,borderRadius:"4px",minWidth:"120px",textAlign:m,...E},children:t})]})}const G={backgroundColor:c,color:d,fontSize:p,fontFamily:h,fontWeight:f,...C&&{width:C},...M&&{height:M},...P&&{minWidth:P},...O&&{maxWidth:O},...S&&{minHeight:S},...D&&{maxHeight:D},"& .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"& .MuiOutlinedInput-root.Mui-disabled .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"& .MuiOutlinedInput-root.Mui-disabled:hover .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"& .MuiOutlinedInput-input":{textAlign:m,paddingLeft:x,paddingTop:w,paddingRight:k,paddingBottom:_}},K={color:d,"&.Mui-focused":{color:d},...F&&{display:"none"},...void 0!==W&&{"&.MuiInputLabel-outlined:not(.MuiInputLabel-shrink)":{transform:`translate(14px, ${W}px) scale(1)`},"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:`translate(14px, ${U}px) scale(0.75)`}}},Y=l?3:1,X={...C&&{width:C},...M&&{height:M},...P&&{minWidth:P},...O&&{maxWidth:O},...S&&{minHeight:S},...D&&{maxHeight:D}};return at("div",B?{style:{marginLeft:y,marginTop:g,marginRight:v,marginBottom:b,...C&&{width:C},...M&&{height:M},minHeight:S,maxHeight:D,minWidth:P,maxWidth:O},sx:{"& .MuiTextField-root":{width:C||"100%",height:M,minHeight:S,maxHeight:D,minWidth:P,maxWidth:O},...E},children:at(tr,{name:j,rules:q,control:L,defaultValue:"",render:({field:e,fieldState:t})=>at(Uht,{masked:s,required:r,errorMsg:t.error?.message,inputSx:G,labelSx:K,sx:{...X,...E},size:R,variant:A,label:F?void 0:a,placeholder:i,multiline:l,minRows:Y,value:cKe(e.value,j,"value")||"",onChange:e=>{uKe(z,j,e.target.value,"value")},...N||{}})})}:{style:{marginLeft:y,marginTop:g,marginRight:v,marginBottom:b,...C&&{width:C},...M&&{height:M},minHeight:S,maxHeight:D,minWidth:P,maxWidth:O},sx:{"& .MuiTextField-root":{width:C||"100%",height:M,minHeight:S,maxHeight:D,minWidth:P,maxWidth:O},...E},children:at(Uht,{masked:s,required:r,errorMsg:void 0,inputSx:G,labelSx:K,sx:{...X,...E},size:R,variant:A,label:F?void 0:a,placeholder:i,multiline:l,minRows:Y,value:$,onChange:e=>H(e.target.value),...N||{}})})},Kht=({sourceDataModelField:t,valueToIconMap:r,iconName:o,defaultIconName:n="circle",hideWhenNoValue:a=!1,color:i,iconColor:s,size:l=40,iconSize:c=20,backgroundColor:u,borderColor:d="transparent",borderWidth:p=0,borderRadius:h="50%",marginLeft:f="0",marginTop:m="0",marginRight:y="0",marginBottom:g="0",paddingLeft:v="0",paddingTop:b="0",paddingRight:x="0",paddingBottom:w="0",width:k,height:_,minHeight:C,maxHeight:M,minWidth:S,maxWidth:D,sx:P,configurationItemInfo:O})=>{const E=t?xKe(t):void 0,j=e.useMemo(()=>(e=>{if(null==e)return null;if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);if("object"!=typeof e||Array.isArray(e))return null;const t=e,r=t.id??t.value??t.code??t.label;return"string"==typeof r||"number"==typeof r||"boolean"==typeof r?String(r):null})(E),[E]),T=((e,t)=>{if(!e||!t)return;const r=e[t];if("string"!=typeof r)return;const o=r.trim();return o.length>0?o:void 0})(r,j),N=T||o||n;return a&&!j?null:N?at(Xf,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:u,borderColor:d,borderWidth:p,borderStyle:p?"solid":"none",borderRadius:h,width:k||l,height:_||l,margin:`${m} ${y} ${g} ${f}`,padding:`${b} ${x} ${w} ${v}`,...C&&{minHeight:C},...M&&{maxHeight:M},...S&&{minWidth:S},...D&&{maxWidth:D},...P},...O,children:at(tKe,{iconName:N,color:s||i,size:c})}):null},Yht=({src:t,text:r,type:o,link:n,sourceDataModelField:a,color:i=so.colors.deepBlue,disabled:s=!1,disabledColor:l,underline:c="hover",variant:u="body2",margin:d="0",padding:p="0",moleculeId:h,configurationItemInfo:f,marginTop:m="0",marginRight:y="0",marginBottom:g="0",marginLeft:v="0",paddingTop:b="0",paddingRight:x="0",paddingBottom:w="0",paddingLeft:k="0",fontFamily:_,fontWeight:C,fontSize:M,align:S,target:D,sx:P,borderColor:O,borderWidth:E,borderStyle:j,borderRadius:T,iconOnly:N,ariaLabel:R,iconName:I,iconSize:F,validationErrorText:A})=>{const{onStateChange:z}=bM(),{onInternalNavigation:L,isConfigurationMode:B,localStateObject:V}=KC();yM();const $=ht(),H=a?xKe(a):r,q=n&&$9e(n),W=e.useMemo(()=>q?H9e(n,$?.rawItemDataByDmfId):null,[n,q,$?.rawItemDataByDmfId]),U=q&&!W,G=e.useMemo(()=>{if(W)return W.destination;const e=n?V9e(n):"internalLink"===o||"internal_link"===o,r=n?e?n.internalLink:n.externalLink:void 0;return t??r??void 0},[W,n,o,t]),K=e.useMemo(()=>W?!W.isExternal:!!n&&V9e(n),[W,n]),Y=e.useMemo(()=>D||(W?W.isExternal?"_blank":"_self":K?"_self":"_blank"),[D,W,K]),X=s||U,Z=X?l||no(i):i,Q=B||X?void 0:G,J=Boolean(I),ee="regular"===C?"normal":C,te=N?at(tKe,{iconName:I||"external-link",size:F??16}):it(nt,{children:[at("span",{children:String(H||"")}),J&&at(tKe,{iconName:I,size:F??16})]}),{onClick:re,onDoubleClick:oe,...ne}=f||{},ae=at(Dv,{href:Q,component:"a",target:Y,onClick:e=>{e.stopPropagation(),z({id:h,type:"clicked"});if(!s&&!U&&!B)return W?(e.preventDefault(),void(W.isExternal?L9e(W.destination):L?.({link:W.destination,webpageAlias:W.webpageAlias,query:W.recordId?{rwoRecordId:W.recordId}:void 0}))):K&&G?(e.preventDefault(),void L?.({link:G})):void(!K&&G&&(e.preventDefault(),L9e(G)));e.preventDefault()},onClickCapture:re||void 0,onDoubleClickCapture:oe||void 0,"aria-label":N?R||String(H||"")||"link":void 0,sx:{color:Z,textDecorationColor:Z,margin:d,padding:p,marginTop:m,marginRight:y,marginBottom:g,marginLeft:v,paddingTop:b,paddingRight:x,paddingBottom:w,paddingLeft:k,fontFamily:_,fontWeight:ee,fontSize:M,textAlign:S,alignItems:"center",cursor:X?"not-allowed":"pointer",borderColor:O,borderWidth:E,borderStyle:j,borderRadius:T,display:N||J?"inline-flex":void 0,gap:J&&!N?"4px":void 0,"& .MuiLink-root":{color:"inherit",textDecorationColor:"inherit"},"&:hover":{color:X?Z:no(Z,.8),textDecorationColor:X?Z:no(Z,.8)},"&:active":{color:X?Z:no(Z,.6),textDecorationColor:X?Z:no(Z,.6)},"&.Mui-disabled":{color:l||no(i),textDecorationColor:l||no(i),cursor:"not-allowed"},...P},align:S,variant:u,underline:c,...ne,children:te});return ae},Xht=e=>({justifyContent:e.textAlign||"flex-start",backgroundColor:e.backgroundColor,paddingTop:e.paddingTop,paddingRight:e.paddingRight,paddingBottom:e.paddingBottom,paddingLeft:e.paddingLeft}),Zht=({popover:t=!0,items:r,marginTop:o="0",marginRight:n="0",marginBottom:a="0",marginLeft:i="0",paddingTop:s="0",paddingRight:l="0",paddingBottom:c="0",paddingLeft:u="0",cornerRadius:d="4px",backgroundColor:p="#fff",width:h="100%",height:f="auto",borderColor:m="#ccc",borderWeight:y="1px",buttonText:g="Open Menu",buttonVariant:v="contained",buttonTextColor:b,buttonFontSize:x,buttonFontWeight:w,buttonFontFamily:k,buttonDisabled:_=!1,buttonGap:C=0,buttonStartIcon:M,buttonEndIcon:S,buttonCornerRadius:D="0",buttonMarginTop:P="0",buttonMarginRight:O="0",buttonMarginBottom:E="0",buttonMarginLeft:j="0",buttonPaddingTop:T="0",buttonPaddingRight:N="0",buttonPaddingBottom:R="0",buttonPaddingLeft:I="0",buttonIconOnly:F,buttonElevation:A,buttonFillColor:z,buttonFillColorDisabled:L,buttonFillColorHover:B,buttonFillColorPressed:V,buttonBorderColor:$,buttonBorderColorDisabled:H,buttonBorderColorHover:q,buttonBorderColorPressed:W,buttonTextColorDisabled:U,buttonTextColorHover:G,buttonTextColorPressed:K,buttonColor:Y="#1976d2",anchorOriginVertical:X="bottom",anchorOriginHorizontal:Z="left",transformOriginVertical:Q="top",transformOriginHorizontal:J="left",elevation:ee=3,sx:te,moleculeId:re,configurationItemInfo:oe})=>{const ne=Ye(),{isConfigurationMode:ae,selectedConfigurationItemId:ie,onConfigurationItemClicked:se,onInternalNavigation:le}=KC(),ce=ht?.(),[ue,de]=e.useState(null),[pe,he]=e.useState(!1),[fe]=(()=>{try{return Nht()}catch{return[new URLSearchParams,()=>{}]}})(),me=e.useMemo(()=>{const e=fe.get(lM),t=fe.get(sM);let r=null,o=null;if("undefined"!=typeof window)try{const e=new URLSearchParams(window.location.search);r=e.get(lM),o=e.get(sM)}catch(y1e){}return e||t||r||o||""},[fe]),ye=e=>{const t=e?.link;if(!t||!t.internalLink)return!1;const r=G9e(t.internalLink);return!(!r||!me)&&r===me},ge=Boolean(ae&&(ie===re||r.some(e=>e.id===ie))),ve=()=>he(!0),be=()=>he(!1),xe={marginTop:o,marginRight:n,marginBottom:a,marginLeft:i,paddingTop:s,paddingRight:l,paddingBottom:c,paddingLeft:u,"& .MuiMenu-paper":{backgroundColor:p,border:`${y} solid ${m}`,borderRadius:d,boxShadow:0===ee?"none":ne?.shadows?.[ee]||ne?.shadows?.[3]},"& .MuiMenu-list":{padding:0,width:h,height:f,overflow:"hidden"},"& .MuiMenuItem-root":{minHeight:"auto",paddingTop:"8px",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"16px"},"& .MuiListItemButton-root":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"16px"},"& .MuiListItemText-primary":{fontSize:"14px",fontFamily:"inherit"},"& .MuiTypography-root":{fontSize:"14px",fontFamily:"inherit"},...t?{display:"inline-block",zIndex:ne?.zIndex?.drawer}:{width:h,height:f,backgroundColor:p,display:"block",overflow:"hidden",border:`${y} solid ${m}`,borderRadius:d},...te};return t?it(Xf,{children:[at(GKe,{ref:de,text:g,variant:v,moleculeId:re,textColor:b,fontSize:x,fontWeight:w,fontFamily:k,disabled:_,gap:C,startIcon:M,endIcon:S,onClick:ve,marginTop:P,marginRight:O,marginBottom:E,marginLeft:j,paddingTop:T,paddingRight:N,paddingBottom:R,paddingLeft:I,borderRadius:D,iconOnly:F,elevation:A,fillColor:z||Y,fillColorDisabled:L,fillColorHover:B,fillColorPressed:V,borderColor:$,borderColorDisabled:H,borderColorHover:q,borderColorPressed:W,textColorDisabled:U,textColorHover:G,textColorPressed:K,configurationItemInfo:oe}),at(Sb,{open:ae?ge:pe,variant:"menu",anchorEl:ue,disablePortal:!0,disableScrollLock:!0,disableRestoreFocus:!0,disableEnforceFocus:!0,onClose:be,anchorOrigin:{vertical:X,horizontal:Z},transformOrigin:{vertical:Q,horizontal:J},elevation:ee,slotProps:{paper:{sx:{backgroundColor:p,border:`${y} solid ${m}`,borderRadius:d,boxShadow:0===ee?"none":ne?.shadows?.[ee]||ne?.shadows?.[3],"& .MuiMenu-list":xe["& .MuiMenu-list"],"& .MuiMenuItem-root":xe["& .MuiMenuItem-root"],"& .MuiListItemText-primary":xe["& .MuiListItemText-primary"],"& .MuiTypography-root":xe["& .MuiTypography-root"]}}},sx:{...xe,"& .MuiMenu-paper":xe["& .MuiMenu-paper"]},children:r.map(e=>{const t=ie===e.id,r=ye(e),o=e.link&&$9e(e.link)?H9e(e.link,ce?.rawItemDataByDmfId):null,n=e.link&&$9e(e.link)&&!o,a={entityId:e.id,entity:"molecule_item",entityType:"menu_item"},i=ae?e=>{e.stopPropagation(),se?.(a,!1)}:void 0,s=ae?e=>{e.stopPropagation(),se?.(a,!0)}:void 0,l=ae?{onClick:i,onDoubleClick:s,"data-organism-id":e.id,css:qrt({theme:ne,selected:t})}:{};return it(jb,{sx:Xht(e),selected:r,disabled:e.disabled||n,onClick:()=>{e?.link&&(o?o.isExternal?L9e(o.destination):le?.({link:o.destination,webpageAlias:o.webpageAlias,query:o.recordId?{rwoRecordId:o.recordId}:void 0}):V9e(e.link)?le?.({link:e.link?.internalLink||""}):L9e(e.link?.externalLink)),be()},...l,children:[e.startIcon&&at(tKe,{iconName:e.startIcon,color:e.textColor}),at(Od,{sx:{ml:e.startIcon?1:0,mr:e.endIcon?1:0,color:e.textColor||"inherit",fontSize:e.fontSize||"inherit",fontWeight:e.fontWeight||"normal",fontFamily:e.fontFamily||"inherit",whiteSpace:e.wrap?"normal":"nowrap",width:"100%",textAlign:e.textAlign||"left"},children:e.text}),e.endIcon&&at(tKe,{iconName:e.endIcon,color:e.textColor})]},e.id)})})]}):at(tu,{id:re,sx:{...xe,backgroundColor:p,border:`${y} solid ${m}`,borderRadius:d,boxShadow:0===ee?"none":ne?.shadows?.[ee]||ne?.shadows?.[3]},elevation:ee,...oe,children:at(Nv,{disablePadding:!0,children:r.map(e=>{const t=ie===e.id,r=ye(e),o=e.link&&$9e(e.link)?H9e(e.link,ce?.rawItemDataByDmfId):null,n=e.link&&$9e(e.link)&&!o,a={entityId:e.id,entity:"molecule_item",entityType:"menu_item"},i=ae?e=>{e.stopPropagation(),se?.(a,!1)}:void 0,s=ae?e=>{e.stopPropagation(),se?.(a,!0)}:void 0,l=ae?{onClick:i,onDoubleClick:s,"data-organism-id":e.id,css:qrt({theme:ne,selected:t})}:{};return it(Lv,{disabled:e.disabled||n,sx:Xht(e),selected:r,onClick:()=>{e?.link&&(o?o.isExternal?L9e(o.destination):le?.({link:o.destination,webpageAlias:o.webpageAlias,query:o.recordId?{rwoRecordId:o.recordId}:void 0}):V9e(e.link)?le?.({link:e.link?.internalLink||""}):L9e(e.link?.externalLink))},...l,children:[e.startIcon&&at(tKe,{iconName:e.startIcon,color:e.textColor}),at(ob,{primary:at(Od,{sx:{ml:e.startIcon?1:0,mr:e.endIcon?1:0,color:e.textColor||"inherit",fontSize:e.fontSize||"inherit",fontWeight:e.fontWeight||"normal",fontFamily:e.fontFamily||"inherit",whiteSpace:e.wrap?"normal":"nowrap",textAlign:e.textAlign||"left"},children:e.text})}),e.endIcon&&at(tKe,{iconName:e.endIcon,color:e.textColor})]},e.id)})})})},Qht=e=>{if(void 0===e)return;if("number"==typeof e)return e;const t=e.match(/^(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):void 0};const Jht=({errorMsg:e,stepValue:t,minValue:r,allowNegative:o,inputSx:n,labelSx:a,variant:i="outlined",...s})=>at(vC,{...s,variant:i,type:"number",error:!!e,helperText:e||null,inputProps:{step:t,min:o?void 0:r},slotProps:{input:{sx:n},inputLabel:{sx:a}}}),eft=({isDisplayOnly:t=!1,required:r=!1,requiredErrorText:o="This field is required",validationErrorText:n="Invalid numeric value",text:a,placeholderText:i,backgroundColor:s,borderColor:l,textColor:c="#000",fontSize:u,fontFamily:d,fontWeight:p,allowNegative:h=!1,numericPrecision:f="1",name:m,sourceDataModelField:y,marginLeft:g="0",marginTop:v="0",marginRight:b="0",marginBottom:x="0",paddingLeft:w="0",paddingTop:k="0",paddingRight:_="0",paddingBottom:C="0",width:M,height:S,configurationItemInfo:D,textAlign:P,minHeight:O,maxHeight:E,minWidth:j,maxWidth:T,sx:N,inputSize:R="medium",labelOffset:I,hideLabel:F=!1,variant:A="outlined"})=>{const z=Kt(),L=z?.control,B=!(!L||!m);KC(),yM();const V=Jrt({name:m,sourceDataModelField:y,form:z,enabled:B}),[$,H]=e.useState(""),q=parseFloat(f),W=h?void 0:0,U={required:!!r&&o,pattern:{value:h?/^-?\d*(\.\d+)?$/:/^\d*(\.\d+)?$/,message:n}};h||(U.min={value:0,message:"Value cannot be less than zero"});const G=e.useMemo(()=>{if(F)return;if(void 0!==I)return I;const e=Qht(k),t=Qht(C);let r=0;r=void 0!==e&&void 0!==t?e+t:"small"===R?17:33;const o=Qht(S)||Qht(O)||Qht(E);if(!o&&!e&&!t)return;const n="number"==typeof u?1.5*u:23;let a;if(void 0!==o)a=Math.max(0,(o-n)/2);else{const t=("small"===R?40:56)-r;a=Math.max(0,(t-n)/2+(e||0))}return Math.round(a)},[S,O,E,I,R,u,k,C,F]),K=e.useMemo(()=>{if(F)return;const e="small"===R?-6:-9,t=Qht(S)||Qht(O)||Qht(E);return!t||t>=36?e:-6},[S,O,E,R,F]);if(t){let e="";if(void 0!==V)e=String(V??"");else if(B){const t=cKe(z.watch(m),m,"value");e=t?String(t):""}const t=e?function(e,t,r){if(!e)return"";const o=parseFloat(e);if(Number.isNaN(o))return e;if(!r&&o<0)return"0";if(t){const e=(t.split(".")[1]||"").length;if(e>0)return o.toFixed(e)}return e}(e,f,h):i||"-";return it("div",{style:{display:"inline-flex",flexDirection:"column",marginLeft:g,marginTop:v,marginRight:b,marginBottom:x,...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...O&&{minHeight:O},...E&&{maxHeight:E}},sx:N,...D,children:[a&&at(Ng,{sx:{fontSize:u,fontFamily:d,fontWeight:p,color:c,marginBottom:"4px"},children:a}),at(Od,{sx:{fontSize:u,fontFamily:d,fontWeight:p,color:c,paddingLeft:w,paddingTop:k,paddingRight:_,paddingBottom:C,backgroundColor:s,border:`1px solid ${l||"#ccc"}`,borderRadius:"4px",minWidth:"60px"},children:t})]})}const Y={backgroundColor:s,color:c,fontSize:u,fontFamily:d,fontWeight:p,...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...O&&{minHeight:O},...E&&{maxHeight:E},"& .MuiOutlinedInput-notchedOutline":{borderColor:l||"inherit"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:l||"inherit"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:l||"inherit"},"& .MuiOutlinedInput-root.Mui-disabled .MuiOutlinedInput-notchedOutline":{borderColor:l||"inherit"},"& .MuiOutlinedInput-root.Mui-disabled:hover .MuiOutlinedInput-notchedOutline":{borderColor:l||"inherit"}},X={color:c,"&.Mui-focused":{color:c},...F&&{display:"none"},...void 0!==G&&{"&.MuiInputLabel-outlined:not(.MuiInputLabel-shrink)":{transform:`translate(14px, ${G}px) scale(1)`},"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:`translate(14px, ${K}px) scale(0.75)`}}},Z={...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...O&&{minHeight:O},...E&&{maxHeight:E}};return at(gg,B?{required:r,sx:{marginLeft:g,marginTop:v,marginRight:b,marginBottom:x,width:"fit-content",...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...O&&{minHeight:O},...E&&{maxHeight:E},...N},...D,children:at(tr,{name:m,rules:U,control:L,defaultValue:"",render:({field:e,fieldState:t})=>at(Jht,{errorMsg:t.error?.message,label:F?void 0:a,placeholder:i,stepValue:q,minValue:W,allowNegative:h,inputSx:Y,labelSx:X,sx:Z,size:R,variant:A,value:cKe(e.value,m,"value")||"",onChange:e=>{uKe(z,m,e.target.value,"value")}})})}:{required:r,sx:{marginLeft:g,marginTop:v,marginRight:b,marginBottom:x,width:"fit-content",...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...O&&{minHeight:O},...E&&{maxHeight:E},...N},...D,children:at(Jht,{errorMsg:void 0,label:F?void 0:a,placeholder:i,stepValue:q,minValue:W,allowNegative:h,inputSx:Y,labelSx:X,sx:Z,size:R,variant:A,value:$,onChange:e=>H(e.target.value)})})},tft=e=>{const t={text:e.label,validate:()=>!0},{rule:r}=e,o=rft(r);if(o||oft(r)){const e=((e,t)=>(r=0)=>e?r<=t:r>=t)(o,o?r.MAX:r.MIN);switch(r.type){case"COUNT":t.validate=t=>e(t?.length);break;case"NUMBER_COUNT":t.validate=t=>e(t?.replace(/\D/g,"").length);break;case"CAPITAL_COUNT":t.validate=t=>e((t?.match(/[A-Z]/g)||[]).length);break;case"SPECIAL_CHARACTERS_COUNT":t.validate=t=>e(t?.replace(/[a-z]|\d|\s/gi,"").length);break;case"LOWER_CASE_COUNT":t.validate=t=>e((t?.match(/[a-z]/g)||[]).length)}}return t},rft=e=>!!e?.MAX,oft=e=>!!e?.MIN,nft=({gap:t="0",inputProps:r,validations:o,htmlElementId:n,validationState:a,overridesProperties:i,configurationItemInfo:s,width:l,height:c,minWidth:u,maxWidth:d,minHeight:p,maxHeight:h,marginLeft:f="0",marginTop:m="0",marginRight:y="0",marginBottom:g="0",sx:v,...b})=>{const{watch:x,formState:w,setError:k}=Kt()||{},{text:_,subText:C,placeholderText:M,subPlaceholderText:S,validationText:D}=i,P=o.map(tft),O="password",E=`reEnter${O}`,j=x?.(O),T=x?.(E);return e.useEffect(()=>{j!==T&&k(E,{type:"manual",message:"Passwords do not match"})},[j,T,k,E]),it(Xf,{id:n,sx:{width:"100%",display:"flex",flexDirection:"column",gap:t,marginLeft:f,marginTop:m,marginRight:y,marginBottom:g,...l&&{width:l},...c&&{height:c},...u&&{minWidth:u},...d&&{maxWidth:d},...p&&{minHeight:p},...h&&{maxHeight:h},...v},...s,...b,children:[at(rot,{...r,inputType:"password",text:_?.text,name:O,placeholderText:M?.text}),at(rot,{...r,inputType:"password",text:C?.text,name:E,placeholderText:S?.text}),at(TYe,{rules:P,value:j,label:D?.text,isSubmitted:w?.isDirty,validationState:a})]})},aft=["+"," ","(",/[0-9]/,/[0-9]/,/[0-9]/,")"," ",/[0-9]/,/[0-9]/,/[0-9]/,"-",/[0-9]/,/[0-9]/,/[0-9]/,/[0-9]/],ift=e.forwardRef((e,t)=>{const{inputRef:r,...o}=e;return at(BYe,{...o,ref:e=>{"function"==typeof r&&r(e?e.inputElement:null)},mask:aft,guide:!0,placeholderChar:" "})}),sft=e=>{if(void 0===e)return;if("number"==typeof e)return e;const t=e.match(/^(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):void 0};function lft(e){const t=(e??"").replace(/\D+/g,"");if(!t)return"";let r="",o=0;return KYe.forEach(e=>{"string"==typeof e?r+=e:o<t.length?(r+=t[o],o+=1):r+="_"}),r}const cft=({masked:e,errorMsg:t,inputSx:r,labelSx:o,variant:n="outlined",...a})=>at(vC,{...a,variant:n,error:!!t,helperText:t||null,slotProps:{input:{sx:r,...e?{inputComponent:ift}:{}},inputLabel:{sx:o}}}),uft=({isDisplayOnly:t=!1,required:r=!1,requiredErrorText:o="Phone is required",validationErrorText:n="Invalid phone number",text:a,placeholderText:i,masked:s=!0,multiLine:l=!1,backgroundColor:c,borderColor:u,textColor:d="#000",fontSize:p,fontFamily:h,fontWeight:f,textAlign:m,marginLeft:y="0",marginTop:g="0",marginRight:v="0",marginBottom:b="0",paddingLeft:x="0",paddingTop:w="0",paddingRight:k="0",paddingBottom:_="0",width:C,height:M,minHeight:S,maxHeight:D,minWidth:P,maxWidth:O,name:E,sourceDataModelField:j,configurationItemInfo:T,sx:N,inputSize:R="medium",labelOffset:I,hideLabel:F=!1,variant:A="outlined"})=>{const z=Kt(),L=z?.control,B=!(!L||!E),V=Jrt({name:E,sourceDataModelField:j,form:z,enabled:B}),[$,H]=e.useState(""),q={required:!!r&&o,pattern:{value:/^\d{10}$/,message:n}},W=e.useMemo(()=>{if(F)return;if(void 0!==I)return I;const e=sft(w),t=sft(_);let r=0;r=void 0!==e&&void 0!==t?e+t:"small"===R?17:33;const o=sft(M)||sft(S)||sft(D);if(!o&&!e&&!t)return;const n="number"==typeof p?1.5*p:23;let a;if(void 0!==o)a=Math.max(0,(o-n)/2);else{const t=("small"===R?40:56)-r;a=Math.max(0,(t-n)/2+(e||0))}return Math.round(a)},[M,S,D,I,R,p,w,_,F]),U=e.useMemo(()=>{if(F)return;const e="small"===R?-6:-9,t=sft(M)||sft(S)||sft(D);return!t||t>=36?e:-6},[M,S,D,R,F]);if(t){let e="";if(void 0!==V)e=String(V??"");else if(B){const t=cKe(z.watch(E),E,"value");e=t?String(t):""}const t=(s?lft(e):e)||i||"-";return it("div",{style:{display:"inline-flex",flexDirection:"column",marginLeft:y,marginTop:g,marginRight:v,marginBottom:b,...C&&{width:C},...M&&{height:M},...P&&{minWidth:P},...O&&{maxWidth:O},...S&&{minHeight:S},...D&&{maxHeight:D}},...T,children:[a&&at(Ng,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,marginLeft:0,marginBottom:"4px",...N},children:a}),at(Od,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,paddingLeft:x,paddingTop:w,paddingRight:k,paddingBottom:_,backgroundColor:c,border:`1px solid ${u||"#ccc"}`,borderRadius:"4px",minWidth:"120px",...N},children:t})]})}const G={backgroundColor:c,color:d,fontSize:p,fontFamily:h,fontWeight:f,...C&&{width:C},...M&&{height:M},...P&&{minWidth:P},...O&&{maxWidth:O},...S&&{minHeight:S},...D&&{maxHeight:D},"& .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"& .MuiOutlinedInput-root.Mui-disabled .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"},"& .MuiOutlinedInput-root.Mui-disabled:hover .MuiOutlinedInput-notchedOutline":{borderColor:u||"inherit"}},K={color:d,"&.Mui-focused":{color:d},...F&&{display:"none"},...void 0!==W&&{"&.MuiInputLabel-outlined:not(.MuiInputLabel-shrink)":{transform:`translate(14px, ${W}px) scale(1)`},"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:`translate(14px, ${U}px) scale(0.75)`}}},Y={marginLeft:y,marginTop:g,marginRight:v,marginBottom:b,width:"fit-content",...C&&{width:C},...M&&{height:M},...P&&{minWidth:P},...O&&{maxWidth:O},...S&&{minHeight:S},...D&&{maxHeight:D}};return at(gg,B?{required:r,sx:{...Y,...C&&{width:C},...M&&{height:M},...P&&{minWidth:P},...O&&{maxWidth:O},...S&&{minHeight:S},...D&&{maxHeight:D},...N},...T,children:at(tr,{name:E,rules:q,control:L,defaultValue:"",render:({field:e,fieldState:t})=>at(cft,{masked:s,errorMsg:t.error?.message,inputSx:G,labelSx:K,size:R,variant:A,label:F?void 0:a,placeholder:i,value:cKe(e.value,E,"value")||"",onChange:e=>{const t=(e?.target?.value??"").toString().replace(/\D+/g,"");uKe(z,E,t,"value")}})})}:{required:r,sx:{...Y,...C&&{width:C},...M&&{height:M},...P&&{minWidth:P},...O&&{maxWidth:O},...S&&{minHeight:S},...D&&{maxHeight:D},...N},...T,children:at(cft,{masked:s,errorMsg:void 0,inputSx:G,labelSx:K,size:R,variant:A,label:F?void 0:a,placeholder:i,value:$,onChange:e=>{const t=(e?.target?.value??"").toString();H(t.replace(/\D+/g,""))}})})},dft=e=>Math.max(0,Math.min(100,e)),pft=e=>"number"!=typeof e||Number.isNaN(e)?"string"==typeof e?(e=>{const t=e.trim();if(!t)return;const r=t.endsWith("%")?t.slice(0,-1).trim():t;if(!r)return;const o=Number(r);return Number.isNaN(o)?void 0:o})(e):void 0:e,hft={showValue:!1,suffix:"%",minWidth:"42px"},fft={trackColor:"#e5e7eb",barColor:"#2563eb",thickness:8,borderRadius:999,textColor:"#1f2937",fontSize:"14px",width:"100%",gap:1},mft=(e,t)=>{if(!t)return;const r=t.strategy||"nearest",o=t.rules||[];if(0===o.length)return t.defaultVariant;const n="range"===r?((e,t)=>{const r=t.find(t=>{const r=pft(t.when?.min),o=pft(t.when?.max);return(void 0===r||e>=r)&&(void 0===o||e<=o)});return r?.variant})(e,o):"exact"===r?((e,t)=>{const r=t.find(t=>{const r=t.when?.equals;if(null==r)return!1;const o=pft(r);return void 0!==o?o===e:String(r)===String(e)});return r?.variant})(e,o):((e,t)=>{const r=t.map(e=>{const t=pft(e.when?.value);return void 0===t?null:{variant:e.variant,referenceValue:t}}).filter(e=>Boolean(e));if(0===r.length)return;return r.slice(1).reduce((t,r)=>{const o=Math.abs(e-r.referenceValue),n=Math.abs(e-t.referenceValue);return o<n||o===n&&r.referenceValue>t.referenceValue?r:t},r[0]).variant})(e,o);return n||t.defaultVariant},yft=(e,t)=>{const r=Math.round(e);return t.format&&t.format.includes("{value}")?t.format.split("{value}").join(String(r)):t.format?t.format:`${r}${t.suffix??hft.suffix}`},gft=({previewValue:e=0,previewValueBuffer:t,label:r,appearance:o,styleRules:n,variant:a="determinate",sx:i,slots:s,moleculeId:l,configurationItemInfo:c,sourceDataModelField:u,...d})=>{const p=u?xKe(u):void 0,h=pft(p)??pft(e)??0,f=dft(h),m=mft(f,n),y=m?n?.variants?.[m]:void 0,g={...fft,...o||{},...y?.appearance||{}},v={...hft,...r||{},...y?.label||{}},b="determinate"===a,x="buffer"===a,w=Boolean(v.showValue&&(b||x)),k=dft(pft(t)??f);return it(Xf,{sx:[{width:g.width,...g.minWidth?{minWidth:g.minWidth}:{},...g.maxWidth?{maxWidth:g.maxWidth}:{}},y?.sx,i,s?.container],...c,children:[v.text?at(Od,{component:"div",sx:[{marginBottom:"6px",color:g.textColor,fontSize:g.fontSize,fontFamily:g.fontFamily,fontWeight:g.fontWeight},y?.slots?.text,s?.text],children:v.text}):null,it(Xf,{sx:[{display:"flex",alignItems:"center",gap:g.gap},y?.slots?.layout,s?.layout],children:[at(xv,{id:l,variant:a,value:b||x?f:void 0,valueBuffer:x?k:void 0,sx:[{flexGrow:1,height:g.thickness,borderRadius:g.borderRadius,backgroundColor:g.trackColor,overflow:"hidden","& .MuiLinearProgress-bar":{backgroundColor:g.barColor,borderRadius:g.borderRadius},"& .MuiLinearProgress-bar1Buffer":{backgroundColor:g.barColor},"& .MuiLinearProgress-bar2Buffer":{backgroundColor:g.trackColor}},y?.slots?.progress,s?.progress],...d}),w?at(Od,{component:"span",sx:[{minWidth:v.minWidth,textAlign:"right",color:g.textColor,fontSize:g.fontSize,fontFamily:g.fontFamily,fontWeight:g.fontWeight},y?.slots?.valueLabel,s?.valueLabel],children:yft(f,v)}):null]})]})},vft=({text:t,name:r,isDisplayOnly:o=!1,required:n=!1,requiredErrorText:a="This field is required",validationErrorText:i="Invalid rating",placeholderText:s="",hoverFeedback:l=!1,sourceDataModelField:c,textAlign:u="left",color:d="black",textColor:p,selectColor:h,fontSize:f=14,fontFamily:m="Arial, sans-serif",fontWeight:y="normal",marginLeft:g="0",marginTop:v="0",marginRight:b="0",marginBottom:x="0",paddingLeft:w="0",paddingTop:k="0",paddingRight:_="0",paddingBottom:C="0",width:M,height:S,minHeight:D,maxHeight:P,minWidth:O,maxWidth:E,placement:j="right",configurationItemInfo:T={},disabled:N=!1,maxValue:R=5,ratingPrecision:I=.5,sx:F,...A})=>{const z=Kt(),L=z?.control,B=!!z&&!!L&&!!r;KC(),yM();const V=Jrt({name:r,sourceDataModelField:c,form:z,enabled:B});!B||z.formState.errors;const[$,H]=e.useState(null),[q,W]=e.useState(-1),U=l&&-1!==q;if(o){let e=null;return void 0!==V&&(e=(e=>"number"!=typeof e||Number.isNaN(e)?"string"!=typeof e||Number.isNaN(Number(e))?null:Number(e):e)(V)),it(gg,{required:n,sx:{marginLeft:g,marginTop:v,marginRight:b,marginBottom:x,paddingLeft:w,paddingTop:k,paddingRight:_,paddingBottom:C,display:"inline-flex",...M&&{width:M},...S&&{height:S},...D&&{minHeight:D},...P&&{maxHeight:P},...O&&{minWidth:O},...E&&{maxWidth:E},...F},...T,children:[t&&at(Od,{variant:"subtitle1",sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,marginBottom:"4px"},children:t}),at(jx,{value:e,max:R,precision:I,readOnly:!0,sx:{"& .MuiRating-iconEmpty":{color:d},"& .MuiRating-iconFilled":{color:h||d},...F},...A})]})}const G={required:!!n&&a,validate:e=>!n||null!==e&&0!==e||a};return it(gg,{required:n,sx:{marginLeft:g,marginTop:v,marginRight:b,marginBottom:x,paddingLeft:w,paddingTop:k,paddingRight:_,paddingBottom:C,display:"inline-flex",...M&&{width:M},...S&&{height:S},...D&&{minHeight:D},...P&&{maxHeight:P},...O&&{minWidth:O},...E&&{maxWidth:E},...F},...T,children:[t&&at(Od,{variant:"subtitle1",sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,marginBottom:"4px"},children:t}),it(Xf,{sx:{display:"flex",alignItems:"center"},children:["left"===j&&at(Od,{sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,minWidth:"2em"},children:U?q:B?cKe(z.getValues(r),r,"value")??V??"":$??V??""}),at(tr,{name:r,control:L,defaultValue:"number"==typeof V?V:null,rules:G,render:({field:e,fieldState:{error:t}})=>{const o=cKe(e.value,r,"value");return it(nt,{children:[at(jx,{value:o??V??0,max:R,precision:I,disabled:N,onChange:(e,t)=>{uKe(z,r,t,"value")},onChangeActive:l?(e,t)=>W(t??-1):void 0,sx:{"& .MuiRating-iconEmpty":{color:d},"& .MuiRating-iconFilled":{color:h||d},marginX:l?1:0,...F},...A}),t&&at(Ng,{error:!0,sx:{marginTop:"4px"},children:"required"===t.type?a:i})]})}}),"right"===j&&at(Od,{sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,minWidth:"2em"},children:U?q:B?cKe(z.getValues(r),r,"value")??V??"":$??V??""})]})]})},bft=["value","label","id","code"],xft=e=>null!=e&&"object"==typeof e&&!Array.isArray(e),wft=e=>{if(null!=e){if("string"==typeof e||"number"==typeof e)return e;if(xft(e))return!("value"in e)||"string"!=typeof e.value&&"number"!=typeof e.value?!("id"in e)||"string"!=typeof e.id&&"number"!=typeof e.id?!("label"in e)||"string"!=typeof e.label&&"number"!=typeof e.label?!("code"in e)||"string"!=typeof e.code&&"number"!=typeof e.code?void 0:e.code:e.label:e.id:e.value}},kft=e=>Array.isArray(e)?e.reduce((e,t)=>{if("string"==typeof t||"number"==typeof t)return e.push({id:t,value:String(t),label:String(t)}),e;if(!xft(t))return e;const r=wft(t.id)??wft(t.value)??wft(t.code)??wft(t.label),o=wft(t.value)??wft(t.label)??wft(t.code)??wft(t.id);if(void 0===r||void 0===o)return e;if("string"==typeof r&&""===r.trim()||"string"==typeof o&&""===o.trim())return e;const n=wft(t.label)??o;return e.push({...t,id:r,value:String(o),label:String(n)}),e},[]):[],_ft=e=>{if("string"==typeof e||"number"==typeof e)return e;if(xft(e)){if("value"in e&&("string"==typeof e.value||"number"==typeof e.value))return e.value;for(const t of bft)if("value"!==t){const r=e[t];if("string"==typeof r||"number"==typeof r)return r}}},Cft=(e,t)=>{if(null==t)return;const r=String(t);return e.find(e=>String(e.id)===r||(void 0!==e.value&&String(e.value)===r||void 0!==e.label&&String(e.label)===r))},Mft=e=>""!==e&&null!=e,Sft=({open:t,text:o,disabled:n,sx:a,placeholderText:i,required:s=!1,requiredErrorText:l="This field is required",isDisplayOnly:c=!1,displayText:u,visible:d=!0,fontSize:p,fontFamily:h,fontWeight:f,textColor:m,textAlign:y,borderColor:g,color:v,backgroundColor:b,marginLeft:x="0",marginTop:w="0",marginRight:k="0",marginBottom:_="0",paddingLeft:C,paddingTop:M,paddingRight:S,paddingBottom:D,width:P,height:O,minHeight:E,maxHeight:j,minWidth:T,maxWidth:N,configurationItemInfo:R={},name:I,sourceDataModelField:F,predefinedValue:A,hideWhenNoValue:z=!1,inputSize:L="medium",hideLabel:B=!1,variant:V="outlined",native:$=!1,options:H,publishToWebpageContext:q=!1,webpageContextKey:W,dataDrivenOptions:U})=>{const G="regular"===f?"normal":f,K=e=>{if(null==e)return!1;if("string"==typeof e&&""===e.trim())return!1;if("object"==typeof e&&null!==e){const t=e;if(0===Object.keys(t).length)return!1;const r="value"in t&&""!==t.value&&null!==t.value&&void 0!==t.value,o="id"in t&&""!==t.id&&null!==t.id&&void 0!==t.id,n=Object.keys(t).some(e=>"value"!==e&&"id"!==e&&""!==t[e]&&null!==t[e]&&void 0!==t[e]);if(!r&&!o&&!n)return!1}return!0},Y=U&&!U.isIgnored&&("variable"===U.nature&&Boolean(U.variableName)||"data_model"===U.nature&&Boolean(U.sourceDataModelFieldId)||!U.nature&&(Boolean(U.variableName)||Boolean(U.sourceDataModelFieldId))),X=e.useMemo(()=>{if(!Y||!U)return;const e=U.nature?.toString().replace(/-/g,"_").toLowerCase()??"";return("variable"===e||!e&&U.variableName)&&U.variableName||U.sourceDataModelFieldId},[Y,U]),Z=X?bKe(X):void 0,Q=e.useMemo(()=>{if(null!=Z&&("string"!=typeof Z||""!==Z.trim())&&!(Array.isArray(Z)&&0===Z.length||"object"==typeof Z&&0===Object.keys(Z).length))return Z},[Z]),J=e.useMemo(()=>{if(Y&&Q)return Array.isArray(Q)?kft(Q):xft(Q)?kft([Q]):void 0},[Y,Q]),ee=Boolean(J&&J.length>0),te=c||Y?void 0:F,{dataModelFieldOptions:re,isLoading:oe}=(e=>{const{pickList:t}=dt(),{data:o=[],refetch:n,isLoading:a}=r.useQuery({queryKey:[_Ke,e],queryFn:()=>t.get(e),select:e=>{const t=e?.data;return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},enabled:Boolean(e),refetchOnWindowFocus:!0,refetchOnMount:!0});return{dataModelFieldOptions:o,refetch:n,isLoading:a}})(te),ne=H&&H.length>0?H:ee?J:re,ae=e.useMemo(()=>kft(ne),[ne]);let ie;ae.length;try{ie=Kt()}catch(He){ie=null}const se=!!ie?.control&&!!I,[le,ce]=e.useState(""),[ue,de]=e.useState(!1),pe=e.useRef(!1),he=e.useRef(!1),fe=e.useRef(void 0),me=e.useRef(void 0);e.useEffect(()=>{fe.current!==F&&(fe.current=F,pe.current=!1,he.current=!1,me.current=void 0)},[F]);let ye={setLocalStateValue:null,isConfigurationMode:!1,selectedConfigurationItemId:null};try{ye=KC()}catch(He){}let ge={stateConfig:null};try{ge=yM()}catch(He){}let ve=null;try{ve=ht()}catch(He){}const be=vM();ye.isConfigurationMode&&ye.selectedConfigurationItemId;const xe=null!=A&&""!==A,we=Boolean(n)||xe,ke=wKe(),_e=se&&ie?ie.watch(I):void 0,Ce=null!=_e?_e:se&&ie?ie.getValues(I):void 0,Me=se&&ie&&I?cKe(Ce,I,"id"):void 0,Se=F?ke(F):void 0,De=e.useMemo(()=>null!=Me&&""!==Me&&K(Me)?Me:void 0!==Se&&K(Se)?Se:void 0,[Se,Me]);e.useEffect(()=>{me.current!==De&&(me.current=De,void 0===De||he.current||(pe.current=!1))},[De]);const Pe=ve?.itemDataByDmfId?.[I],Oe=_ft(Pe),Ee=e.useMemo(()=>{if(De){if(xft(De)){const e=De.id;if("string"==typeof e||"number"==typeof e){const t=ae.length>0?Cft(ae,e):void 0;return t?{...t,...De}:De}for(const t of["value","label","code"]){const e=De[t];if("string"==typeof e||"number"==typeof e){const t=ae.length>0?Cft(ae,e):void 0;return t||De}}return De}if("string"==typeof De||"number"==typeof De){return(ae.length>0?Cft(ae,De):void 0)||{id:De}}}},[De,ae]),je=Jrt({name:I,sourceDataModelField:F,form:ie,fallbackKey:void 0,enabled:!1,mapValue:()=>Ee}),Te=_ft(De)??("string"==typeof je||"number"==typeof je?je:void 0);e.useEffect(()=>{xe&&null!=A&&I&&(se?uKe(ie,I,A,"id",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1}):ce(A))},[xe,A,se,ie,I]),e.useEffect(()=>{if(!se||!ie)return;if(xe)return;if(!F)return;const e=ie.watch(I),t=null!=e?e:ie.getValues(I),r=cKe(t,I,"id");if(K(r))return void(pe.current=!0);const o="object"==typeof r&&null!==r?r.id:r,n=ie.formState?.dirtyFields?.[I],a=ie.formState?.touchedFields?.[I];if(n||a)return he.current=!0,void(pe.current=!0);if(he.current)return;let i=De;if(void 0===i&&null!=Me&&""!==Me&&(i=Me),!K(i))return;const s=xft(i)?i.id:i;if(null!=o&&""!==o&&void 0!==s&&String(o)!==String(s))return he.current=!0,void(pe.current=!0);if(pe.current&&void 0!==s&&void 0!==o&&String(s)===String(o))return;let l;if(Ee)l=Ee;else if(xft(i)){const e=i.id;"string"!=typeof e&&"number"!=typeof e||(l=i)}else"string"==typeof i||"number"==typeof i?l={id:i}:null!=Me&&""!==Me&&("string"==typeof Me||"number"==typeof Me?l={id:Me}:xft(Me)&&(l=Me));if(l){const e="object"==typeof l&&"id"in l?l.id:l,t=null==o||""===o,r=void 0!==o&&String(e)===String(o);(t||r)&&(uKe(ie,I,l,"id",{shouldDirty:!1,shouldTouch:!1,shouldValidate:!1}),pe.current=!0)}},[xe,se,ie,I,F,De,Ee,Me]);const Ne=Te??Pe;if(e.useEffect(()=>{q&&W&&be?.setDynamicContextValue&&void 0!==Ne&&be.setDynamicContextValue(W,Ne)},[q,W,Ne,be]),!d)return null;if(c&&z&&!(Te??Pe))return null;if(c){const e=u??(null!=Te?String(Te):void 0)??(null!=Oe?String(Oe):void 0)??(i||"-"),{css:t,...r}=R||{};return it("div",{css:t,style:{display:"inline-flex",flexDirection:"column",...Mft(w)&&{marginTop:w},...Mft(k)&&{marginRight:k},...Mft(_)&&{marginBottom:_},...Mft(x)&&{marginLeft:x},...Mft(P)?{width:P}:{width:"fit-content"},...Mft(O)&&{height:O},...Mft(E)&&{minHeight:E},...Mft(j)&&{maxHeight:j},...Mft(T)&&{minWidth:T},...Mft(N)&&{maxWidth:N}},...r,children:[o&&at(Ng,{sx:{...Mft(p)&&{fontSize:p},...Mft(h)&&{fontFamily:h},...G&&{fontWeight:G},color:Mft(m)?m:"#000",marginLeft:0,marginBottom:"4px",...Mft(y)&&{textAlign:y}},children:o}),at(Od,{sx:{...Mft(p)&&{fontSize:p},...Mft(h)&&{fontFamily:h},...G&&{fontWeight:G},...Mft(m)&&{color:m},...Mft(y)&&{textAlign:y},...Mft(C)&&{paddingLeft:C},...Mft(M)&&{paddingTop:M},...Mft(S)&&{paddingRight:S},...Mft(D)&&{paddingBottom:D},...Mft(b)&&{backgroundColor:b},border:`1px solid ${Mft(g)?g:"#ccc"}`,borderRadius:"4px"},children:e})]})}const Re="small"===L?40:56,Ie={position:"relative",display:Mft(P)?"block":"inline-block",...Mft(P)&&{width:P},...Mft(T)&&{minWidth:T},...Mft(N)&&{maxWidth:N},...Mft(x)&&{marginLeft:x},...Mft(w)&&{marginTop:w},...Mft(k)&&{marginRight:k},...Mft(_)&&{marginBottom:_}},Fe={width:"100%",...Mft(O)&&{height:O},...Mft(E)&&{minHeight:E},...Mft(j)&&{maxHeight:j},...!Mft(P)&&!Mft(T)&&{minWidth:"240px"},...a},Ae=Mft(m)?m:Mft(v)?v:void 0,ze={..."small"===L&&!O&&{height:`${Re}px`},...Mft(b)&&{backgroundColor:b},...Ae&&{color:Ae},...Mft(p)&&{fontSize:p},...Mft(h)&&{fontFamily:h},...G&&{fontWeight:G},...Mft(g)&&{"& .MuiOutlinedInput-notchedOutline":{borderColor:g},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:g},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:g}},..."filled"===V&&Mft(g)&&{"&:before":{borderColor:g},"&:after":{borderColor:g},"&:hover:not(.Mui-disabled):before":{borderColor:g}},..."standard"===V&&Mft(g)&&{"&:before":{borderColor:g},"&:after":{borderColor:g},"&:hover:not(.Mui-disabled):before":{borderColor:g}},"& .MuiSelect-select":{...Mft(y)&&{textAlign:y},...Mft(p)&&{fontSize:p},...Mft(h)&&{fontFamily:h},...G&&{fontWeight:G},...Mft(M)&&{paddingTop:M},...Mft(D)&&{paddingBottom:D},...Mft(C)&&{paddingLeft:C},...Mft(S)&&{paddingRight:S}}},Le={...Mft(p)&&{fontSize:p},...Mft(h)&&{fontFamily:h},...G&&{fontWeight:G}},Be=e=>{const t=((e,t)=>e.find(e=>String(e.id)===t))(ae,e),r=t??{id:e};he.current=!0,ce(e),se&&uKe(ie,I,r),F&&ye?.setLocalStateValue&&ye.setLocalStateValue(F,r)},Ve=se?cKe((()=>{const e=ie.watch(I);return null!=e?e:ie.getValues(I)})(),I,"id")||"":le,$e=se?ie.formState?.errors?.[I]:void 0;return at("div",{style:Ie,...R,onClick:e=>{ye?.isConfigurationMode&&R&&"onClick"in R&&(e.stopPropagation(),e.preventDefault(),R.onClick())},children:it(gg,{variant:V,size:L,sx:Fe,disabled:we,required:s,error:!!$e,children:[!B&&at(iv,{id:`${I}-label`,shrink:$?ue||!!Ve:void 0,sx:Le,children:o}),at(Gx,{value:Ve,input:void 0,onChange:e=>{ye?.isConfigurationMode||Be(e.target.value)},onFocus:()=>de(!0),onBlur:()=>de(!1),...ye?.isConfigurationMode&&{open:!1},labelId:B?void 0:`${I}-label`,label:B?void 0:o,disabled:we,native:$,sx:ze,children:$?[at("option",{value:""},"__placeholder__"),...oe?[at("option",{disabled:!0,children:"Loading..."},"__loading__")]:ae.map(e=>at("option",{value:e.id,children:e.value},e.id))]:oe?it(jb,{disabled:!0,children:[at(od,{size:20,sx:{mr:1}}),"Loading..."]}):ae.map(e=>at(jb,{value:e.id,children:e.value},e.id))}),$e&&at(Ng,{error:!0,children:$e?.message||l})]})})};const Dft=({text:e,name:t,isDisplayOnly:r=!1,required:o=!1,requiredErrorText:n="This field is required",validationErrorText:a="Invalid value",placeholderText:i="",startIcon:s,endIcon:l,borderColor:c,selectLineColor:u,lineWeight:d=1,orientation:p="horizontal",textColor:h,fontSize:f,fontFamily:m,fontWeight:y,valueFormat:g,valueDisplay:v="auto",iconSize:b,selectColor:x,iconColor:w,minValue:k=0,maxValue:_=100,step:C,labelPlacement:M="top",marginLeft:S="0",marginTop:D="0",marginRight:P="0",marginBottom:O="0",paddingLeft:E="0",paddingTop:j="0",paddingRight:T="0",paddingBottom:N="0",width:R,height:I,minHeight:F,maxHeight:A,minWidth:z,maxWidth:L,sx:B,configurationItemInfo:V,sourceDataModelField:$,disabled:H=!1,...q})=>{const W=Kt(),U=W?.control,G=!!U&&!!t&&!r;KC(),yM(),ht();const K=Jrt({name:t,sourceDataModelField:$,form:W,enabled:G}),Y={required:!!o&&n,validate:e=>!o||null!=e||n},X=e=>function(e,t){if(null==e)return"";switch(t){case"$0.00":return`$${e.toFixed(2)}`;case"$123":return`$${e}`;case"%0.00":return`${e.toFixed(2)}%`;case"%123":return`${e}%`;case"0.0":return e.toFixed(1);case"0.00":return e.toFixed(2);default:return e.toString()}}(e,g),Z={width:"100%","& .MuiSlider-root":{width:"100%"},"& .MuiSlider-rail":{backgroundColor:c||"#ccc",..."vertical"===p?{width:`${d}px`}:{height:`${d}px`}},"& .MuiSlider-track":{backgroundColor:u||"#2196f3",border:`1px solid ${u||"#2196f3"}`,..."vertical"===p?{width:`${d}px`}:{height:`${d}px`}},"& .MuiSlider-thumb":{backgroundColor:x||"#2196f3",width:b||"16px",height:b||"16px",boxShadow:"none","&:focus, &:hover, &.Mui-active, &.Mui-focusVisible":{boxShadow:"none"}},"& .MuiSlider-valueLabel":{backgroundColor:x||"#2196f3",color:"#ffffff",borderRadius:"4px",fontSize:"12px",fontWeight:500},"& .MuiSlider-mark":{backgroundColor:c||"#ccc",width:"2px",height:"2px",borderRadius:"50%"},"& .MuiSlider-markActive":{backgroundColor:x||"#2196f3"},...B};if(r){let t=null;return void 0!==K&&(t=(e=>"number"!=typeof e||Number.isNaN(e)?"string"!=typeof e||Number.isNaN(Number(e))?null:Number(e):e)(K)),it(gg,{required:o,sx:{marginLeft:S,marginTop:D,marginRight:P,marginBottom:O,paddingLeft:E,paddingTop:j,paddingRight:T,paddingBottom:N,display:"inline-flex",...R&&{width:R},...I&&{height:I},...F&&{minHeight:F},...A&&{maxHeight:A},...z&&{minWidth:z},...L&&{maxWidth:L},...B},...V,children:[e&&at(Lg,{children:e}),it(Xf,{display:"flex",flexDirection:"top"===M?"column":"row",alignItems:"center",mt:"top"===M?1:0,children:[s&&at(Xf,{mr:"horizontal"===p?1:0,mb:"vertical"===p?1:0,children:at(tKe,{iconName:s,color:w})}),at(Ow,{value:t??void 0,min:k,max:_,step:C,orientation:p,valueLabelDisplay:v,valueLabelFormat:X,sx:Z,disabled:!0,...q}),l&&at(Xf,{ml:"horizontal"===p?1:0,mt:"vertical"===p?1:0,children:at(tKe,{iconName:l,color:w})}),at(Od,{sx:{ml:1,fontSize:f,fontFamily:m,fontWeight:y,color:h},children:t})]})]})}return it(gg,{required:o,sx:{marginLeft:S,marginTop:D,marginRight:P,marginBottom:O,paddingLeft:E,paddingTop:j,paddingRight:T,paddingBottom:N,display:"inline-flex",...R&&{width:R},...I&&{height:I},...F&&{minHeight:F},...A&&{maxHeight:A},...z&&{minWidth:z},...L&&{maxWidth:L},...B},...V,children:[e&&at(Lg,{children:e}),at(tr,{name:t||"",control:U,defaultValue:"number"==typeof K?K:k,rules:Y,render:({field:e,fieldState:r})=>{const o=cKe(e.value,t,"value");return it(nt,{children:[at(Ow,{...e,value:o??k,min:k,max:_,step:C,orientation:p,valueLabelDisplay:v,valueLabelFormat:X,sx:Z,onChange:(e,r)=>{uKe(W,t,r,"value")},...q}),r.error&&at(Ng,{error:!0,sx:{mt:1},children:"required"===r.error.type?n:a})]})}})]})},Pft=({direction:t="up",size:r="medium",ariaLabel:o="Speed Dial",openIconName:n="plus",closeIconName:a="x",openIconColor:i="#fff",closeIconColor:s="#fff",backgroundColor:l="#1976d2",items:c=[],configurationItemInfo:u={},tooltipOpen:d=!1,tooltipPlacement:p,showBackdrop:h=!1,openOnHover:f=!1,paddingTop:m,paddingRight:y,paddingBottom:g,paddingLeft:v,marginTop:b,marginRight:x,marginBottom:w,marginLeft:k,moleculeId:_,gap:C,sx:M,...S})=>{const D=Ye(),[P,O]=e.useState(!1),{isConfigurationMode:E,onConfigurationItemClicked:j,selectedConfigurationItemId:T,onInternalNavigation:N}=KC();e.useEffect(()=>{if(!P)return;const e=e=>{"Escape"!==e.key||E||O(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[P,E]);const R=()=>O(!0),I=()=>O(!1);let F={};F=f&&!h?{onMouseEnter:R,onMouseLeave:I,onFocus:R,onBlur:I}:{onClick:e=>{O(e=>!e)}};const A={bgcolor:l,paddingTop:m,paddingRight:y,paddingBottom:g,paddingLeft:v,marginTop:b,marginRight:x,marginBottom:w,marginLeft:k},z=P||E&&(T===_||c.some(e=>e.id===T));return it("div",{role:"presentation",children:[h&&at(Lf,{open:P}),at(Bw,{ariaLabel:o,direction:t,icon:at(uk,{icon:at(tKe,{iconName:n,color:i,size:24}),openIcon:at(tKe,{iconName:a,color:s,size:24})}),open:z,onOpen:f&&!h?R:void 0,onClose:f&&!h?I:void 0,FabProps:{color:"primary",sx:A,size:r,gap:C},slotProps:{fab:{"data-testid":"speed-dial-fab","aria-label":o}},sx:{"& .MuiSpeedDial-fab":{backgroundColor:l,...A},"& .MuiSpeedDial-actions":{gap:C||8},"& .MuiSpeedDialIcon-icon":{fontSize:"small"===r?"18px":"large"===r?"24px":"20px",color:"inherit"},"& .MuiSpeedDialIcon-openIcon":{fontSize:"small"===r?"18px":"large"===r?"24px":"20px",color:"inherit"},"& .MuiSpeedDialAction-fab":{backgroundColor:"#fff",color:"#757575","&:hover":{backgroundColor:"#f5f5f5"}},"& .MuiSpeedDialAction-staticTooltip":{backgroundColor:"rgba(97, 97, 97, 0.9)",color:"#fff",fontSize:"12px",padding:"4px 8px",borderRadius:"4px"},"& .MuiSpeedDialAction-staticTooltipLabel":{fontSize:"12px",fontWeight:500},...M},...F,...u,...S,children:c.map(e=>{const{text:t,link:o}=e.properties??{},{iconName:n="plus",disabled:a=!1,iconColor:i="#757575",tooltipText:s,backgroundColor:l="#fff"}=e.config?.props??{},c=String(t?.text||s||"Action"),u=E&&T===e.id,h={entityId:e.id,entity:"molecule_item",entityType:"speed_dial_action_item"},f=E?{onClick:e=>{e.stopPropagation(),j?.(h,!1)},onDoubleClick:e=>{e.stopPropagation(),j?.(h,!0)},"data-organism-id":e.id,css:qrt({theme:D,selected:u})}:{};return at(nk,{icon:at(tKe,{iconName:n,color:i,size:24}),tooltipOpen:d,tooltipTitle:c,tooltipPlacement:p,FabProps:{sx:{color:i,backgroundColor:l},size:r,disabled:a,"aria-label":c,onClick:e=>{e.stopPropagation(),o?(V9e(o)?N?.({link:o.internalLink??""}):L9e(o.externalLink),O(!1)):O(!1)},...f}},e.id)})})]})},Oft=({items:e,gap:t,stepGap:r,isMobile:o=!1,iconSize:n="24px",orientation:a="horizontal",activeStep:i=0,lineColor:s,lineWidth:l,lineRadius:c,marginTop:u="0",marginRight:d="0",marginBottom:p="0",marginLeft:h="0",paddingTop:f="0",paddingRight:m="0",paddingBottom:y="0",paddingLeft:g="0",borderRadius:v="0",configurationItemInfo:b,backgroundColor:x="transparent",sx:w,...k})=>{const _=Ye(),C=o?"vertical":a,{isConfigurationMode:M,onConfigurationItemClicked:S,selectedConfigurationItemId:D}=KC();return at(Jk,{sx:{gap:t,width:"100%",overflow:"hidden",marginTop:u,marginRight:d,marginBottom:p,marginLeft:h,paddingTop:f,paddingRight:m,paddingBottom:y,paddingLeft:g,borderRadius:v,backgroundColor:x,"& .MuiStep-root":{padding:"8px"},"& .MuiStepLabel-root":{gap:r,alignItems:"flex-start"},"& .MuiStepLabel-label":{fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",color:"inherit"},"& .MuiStepConnector-root":{flex:"1 1 auto"},"& .MuiStepConnector-line":{borderColor:s,borderWidth:l,borderRadius:c},"& .MuiStepConnector-vertical":{width:n||"24px",display:"flex",justifyContent:"center",alignItems:"center",marginLeft:"4px"},"& .MuiStepConnector-horizontal":{marginLeft:"8px",marginRight:"8px"},"& .MuiStepContent-root":{margin:0,padding:0,marginTop:"4px",borderLeft:"none"},"& .MuiTypography-root":{fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",color:"inherit"},...w},activeStep:i,orientation:C,connector:at(Hk,{sx:{[`&.${Lk.vertical}`]:{width:n||"24px",display:"flex",justifyContent:"center",alignItems:"center",marginLeft:"4px"},[`&.${Lk.vertical} .${Lk.line}`]:{borderColor:s,borderWidth:l,borderRadius:c},[`&.${Lk.horizontal} .${Lk.line}`]:{borderColor:s,borderWidth:l,borderRadius:c}}}),...b,...k,children:e.map((e,t)=>{const o=D===e.id,a=t===i,s={entityId:e.id,entity:"molecule_item",entityType:"stepper_item"},l=M?{onClick:e=>{M&&(e.stopPropagation(),S?.(s,!1))},onDoubleClick:e=>{M&&(e.stopPropagation(),S?.(s,!0))},"data-organism-id":e.id,css:qrt({theme:_,selected:o})}:{},c=e.color||(a?"#000":"#555");return at(xk,{...l,children:it(Ak,{sx:{gap:r,"& .MuiStepLabel-iconContainer":{marginRight:"8px",display:"flex",alignItems:"center",justifyContent:"center"},"& .MuiStepLabel-labelContainer":{display:"flex",flexDirection:"column",alignItems:"flex-start"}},icon:e?.iconName?at(tKe,{size:n,color:e.iconColor||"#000",iconName:e.iconName,borderRadius:e?.iconBorderRadius||0,backgroundColor:e.iconBackgroundColor||"transparent"}):void 0,children:[at(Od,{variant:"body1",sx:{padding:"4px",fontSize:e.fontSize||"inherit",fontWeight:e.fontWeight||"normal",fontFamily:e.fontFamily||"inherit",color:c,borderRadius:e.borderRadius||"0",display:"inline-block","&.MuiTypography-body1":{fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",color:"inherit"}},children:e.title}),e.subText&&at(Kk,{sx:{margin:0,padding:0,marginTop:"4px",borderLeft:"none","& .MuiStepContent-root":{margin:0,padding:0,marginTop:"4px",borderLeft:"none"}},transitionDuration:{enter:400,exit:400},children:at(Od,{variant:"body2",sx:{padding:"4px",fontSize:e.subTextFontSize||"inherit",fontWeight:e.subTextFontWeight||"normal",fontFamily:e.subTextFontFamily||"inherit",color:e.subTextColor||"#666",borderRadius:e.borderRadius||"0",display:"inline-block",..."horizontal"===C&&{maxWidth:"300px"},"&.MuiTypography-body2":{fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit",color:"inherit"}},children:e.subText})})]})},e.id)})})},Eft=gl(s_)(({thumbColor:e="#ff0000",thumbCheckedColor:t="#00ff00",trackColor:r="#0000ff",disabledThumbColor:o="#9e9e9e",sx:n})=>({"& .MuiSwitch-thumb":{backgroundColor:e,width:20,height:20},"& .MuiSwitch-switchBase.Mui-checked .MuiSwitch-thumb":{backgroundColor:t},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{backgroundColor:r,opacity:1,backgroundImage:"none"},"& .MuiSwitch-track":{backgroundColor:r,opacity:1,backgroundImage:"none"},"&.Mui-disabled .MuiSwitch-thumb":{backgroundColor:o},"&.Mui-disabled .MuiSwitch-track":{backgroundColor:r,opacity:1,backgroundImage:"none"},"& .MuiSwitch-switchBase":{padding:"9px","&.Mui-checked":{transform:"translateX(16px)"}},"& .MuiSwitch-colorPrimary":{"&.Mui-checked":{color:t}},"& .MuiSwitch-colorSecondary":{"&.Mui-checked":{color:t}},...n})),jft=({isDisplayOnly:t=!1,required:r=!1,requiredErrorText:o="This field is required",validationErrorText:n="Invalid value",text:a="",thumbColor:i,thumbCheckedColor:s,trackColor:l,disabledThumbColor:c,labelPlacement:u="top",marginLeft:d="0",marginTop:p="0",marginRight:h="0",marginBottom:f="0",paddingLeft:m="0",paddingTop:y="0",paddingRight:g="0",paddingBottom:v="0",width:b,height:x,minHeight:w,maxHeight:k,minWidth:_,maxWidth:C,name:M,sourceDataModelField:S,disabled:D=!1,sx:P,configurationItemInfo:O,...E})=>{const j=Kt(),T=j?.control,N=!!T&&!!M,R={required:!!r&&o,validate:e=>!(r&&!e)||o};KC(),yM(),ht();const I=Jrt({name:M,sourceDataModelField:S,form:j,enabled:N}),[F,A]=e.useState(!1);if(t){let e=!1;return void 0!==I?e="true"===String(I).toLowerCase()||!0===I:N&&(e=Boolean(cKe(j.watch(M),M,"value"))),it(gg,{required:r,sx:{marginLeft:d,marginTop:p,marginRight:h,marginBottom:f,paddingLeft:m,paddingTop:y,paddingRight:g,paddingBottom:v,display:"inline-flex",...b&&{width:b},...x&&{height:x},...w&&{minHeight:w},...k&&{maxHeight:k},..._&&{minWidth:_},...C&&{maxWidth:C},"& .MuiFormLabel-root":{fontSize:"14px",fontWeight:500,color:"#333",marginBottom:"8px"},"& .MuiSwitch-root":{marginTop:"8px"},"& .MuiSwitch-switchBase":{padding:"9px"},"& .MuiSwitch-thumb":{width:"18px",height:"18px",borderRadius:"9px"},"& .MuiSwitch-track":{borderRadius:"9px",height:"14px"},"& .MuiTypography-root":{marginLeft:"8px",fontSize:"14px",fontWeight:500,color:"#333"},...P},...O,children:[a&&at(Lg,{component:"legend",children:a}),it(Xf,{display:"flex",alignItems:"center",mt:"top"===u?1:0,children:[at(Eft,{disabled:!0,checked:e,thumbColor:i,thumbCheckedColor:s,trackColor:l,disabledThumbColor:c,sx:{"& .MuiSwitch-switchBase":{pointerEvents:"none"}},...E}),at(Od,{sx:{ml:1},children:e?"ON":"OFF"})]})]})}return it(gg,{required:r,sx:{marginLeft:d,marginTop:p,marginRight:h,marginBottom:f,paddingLeft:m,paddingTop:y,paddingRight:g,paddingBottom:v,display:"inline-flex",...b&&{width:b},...x&&{height:x},...w&&{minHeight:w},...k&&{maxHeight:k},..._&&{minWidth:_},...C&&{maxWidth:C},"& .MuiFormLabel-root":{fontSize:"14px",fontWeight:500,color:"#333",marginBottom:"8px"},"& .MuiSwitch-root":{marginTop:"8px"},"& .MuiSwitch-switchBase":{padding:"9px"},"& .MuiSwitch-thumb":{width:"18px",height:"18px",borderRadius:"9px"},"& .MuiSwitch-track":{borderRadius:"9px",height:"14px"},"& .MuiFormHelperText-root":{marginTop:"4px",fontSize:"12px",color:"#d32f2f"},...P},...O,children:[a&&at(Lg,{component:"legend",children:a}),N?at(tr,{name:M,rules:R,control:T,defaultValue:!1,render:({field:e,fieldState:t})=>{const r=Boolean(cKe(e.value,M,"value"));return it(nt,{children:[at(Xf,{display:"flex",alignItems:"center",mt:"top"===u?1:0,children:at(Eft,{checked:r,disabled:D,onChange:(e,t)=>{uKe(j,M,t,"value")},thumbColor:i,thumbCheckedColor:s,trackColor:l,disabledThumbColor:c,sx:{"& .MuiSwitch-switchBase":{"&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)"}}},...E})}),t.error&&at(Ng,{error:!0,sx:{marginTop:"4px"},children:"required"===t.error.type?o:n})]})}}):at(Xf,{display:"flex",alignItems:"center",mt:"top"===u?1:0,children:at(Eft,{checked:F,disabled:D,onChange:(e,t)=>{A(t)},thumbColor:i,thumbCheckedColor:s,trackColor:l,disabledThumbColor:c,sx:{"& .MuiSwitch-switchBase":{"&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)"}}},...E})})]})},Tft=({items:t,onTabChange:r,activeTabKey:o,isMobile:n=!1,marginTop:a,marginRight:i,marginBottom:s,marginLeft:l,paddingTop:c,paddingRight:u,paddingBottom:d,paddingLeft:p,buttonPaddingTop:h,buttonPaddingRight:f,buttonPaddingBottom:m,buttonPaddingLeft:y,width:g,height:v,backgroundColor:b,borderRadius:x,elevation:w=1,gap:k,indicatorVisible:_=!0,indicatorColor:C,lineWidth:M="2px",orientation:S="horizontal",activeTextColor:D="#1976d2",inactiveTextColor:P="#000",fontSize:O,fontWeight:E,fontFamily:j,wrapText:T,textAlign:N,iconName:R,iconColor:I,iconSize:F,iconPlacement:A="left",hoverTextColor:z,itemBorder:L,itemBorderRadius:B,itemBackgroundColor:V,itemSelectedBackgroundColor:$,itemHoverBackgroundColor:H,selectedItemElevation:q=0,itemDisableRipple:W,configurationItemInfo:U,sx:G})=>{const K=Ye(),{isConfigurationMode:Y,onConfigurationItemClicked:X,selectedConfigurationItemId:Z}=KC(),[Q,J]=e.useState(null),ee=e=>J(e.currentTarget),te=()=>J(null),re={marginTop:a,marginRight:i,marginBottom:s,marginLeft:l,paddingTop:c,paddingRight:u,paddingBottom:d,paddingLeft:p,width:g,height:v,backgroundColor:b,borderRadius:x,display:"flex",overflow:"visible !important"},oe=e=>{const t=e?D:P,r=e&&$||V;return{color:t,fontSize:O,fontWeight:E,fontFamily:j,textAlign:N,whiteSpace:T?"normal":"nowrap",border:L,borderRadius:B,backgroundColor:r,boxShadow:e?K.shadows[q]:void 0,paddingTop:h,paddingRight:f,paddingBottom:m,paddingLeft:y,"&:hover":{color:z||t,backgroundColor:H||r}}},ne=e=>{r?.({newTabKey:e.tabKey,link:e.link})},ae=e=>{if(!Y)return{};const t=e.id===Z,r={entityId:e.id,entity:"molecule_item",entityType:"tabs_item"};return{onClick:e=>{e.stopPropagation(),X?.(r,!1)},onDoubleClick:e=>{e.stopPropagation(),X?.(r,!0)},"data-organism-id":e.id,css:qrt({theme:K,selected:t})}},ie=e=>{const t=e.tabKey===o,r=oe(t);return it(jb,{onClick:()=>{ne(e),te()},sx:{...r,display:"flex",alignItems:"center"},...ae(e),children:[e.iconName&&at(tKe,{iconName:e.iconName,sx:{fontSize:O,color:t?D:P,mr:1}}),at(Xf,{component:"span",children:e.label})]},e.id)};if(n)return it(tu,{elevation:w,style:re,sx:G,...U,children:[at(cd,{onClick:ee,children:at(tKe,{size:F,color:I,iconName:R})}),at(Sb,{anchorEl:Q,open:Boolean(Q),onClose:te,children:t.map(ie)})]});const se=t.findIndex(e=>e.tabKey===o);return at(tu,{elevation:w,style:re,sx:G,...U,children:at(hC,{value:se<0?0:se,onChange:(e,r)=>Y?null:ne(t[r]),orientation:S,sx:{overflow:"visible","& .MuiTabs-flexContainer":{gap:k}},TabIndicatorProps:{style:_?{height:M,borderRadius:x,backgroundColor:C||D}:{display:"none"}},children:t.map(e=>{const t=e.tabKey===o,r={...oe(t),"&.Mui-selected":{color:t?D:P}};return at(p_,{label:e.label,disableRipple:W,sx:{...r,textTransform:"none"},onClick:()=>ne(e),iconPosition:"right"===A?"end":"start",icon:e.iconName?at(tKe,{iconName:e.iconName,sx:{fontSize:O,color:t?D:P}}):void 0,...ae(e)},e.id)})})})},Nft=e=>{if(!e)return null;if(e instanceof Date)return pnt(e)?e:null;if("object"==typeof e&&null!==e&&"function"==typeof e.toDate){const t=e.toDate();return t instanceof Date&&pnt(t)?t:null}if("string"==typeof e){const t=e.trim();if(!t)return null;const r=t.match(/(\d{1,2}:\d{2}(?::\d{2})?)/),o=r?r[1]:t,n=new Date,a=["HH:mm:ss","H:mm:ss","HH:mm","H:mm","hh:mm a","h:mm a","hh a","h a","HHmm","Hmm","HH","H"];for(const e of a){const t=vat(o,e,n);if(pnt(t))return t}return null}return null},Rft=e=>{const t=Nft(e);return t?vnt(t,"HH:mm"):null},Ift=({name:t,text:r,isDisplayOnly:o=!1,sourceDataModelField:n,configurationItemInfo:a={},placeholderText:i,displayFormat:s="HH:mm",required:l=!1,requiredErrorText:c="This field is required",validationErrorText:u,sx:d,width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g,...v})=>{const b=Kt(),x=b?.control,w=!!x&&!!t;KC();const k=Jrt({name:t,sourceDataModelField:n,form:b,enabled:w,mapValue:e=>Rft(e),skipIfNull:!0}),_=Nft(k);e.useRef();const[C,M]=e.useState(_);if(o){const e=void 0!==k?k:w?cKe(b.watch(t),t,"value"):void 0,o=Nft(e),n=o&&pnt(o)?vnt(o,s):"";return it(Xf,{...a,sx:{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g,"& .MuiFormHelperText-root":{marginBottom:"4px"},"& .MuiTypography-root":{border:"1px solid #ced4da",borderRadius:"4px",padding:"8px",minWidth:"100px"},...d},children:[r&&at(Ng,{children:r}),at(Od,{children:n||i||"-"})]})}return at(Xf,w?{...a,sx:{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g,"& .MuiTimePicker-root":{width:"100%"},"& .MuiTextField-root":{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g},"& .MuiInputBase-root":{fontSize:"14px"},"& .MuiInputLabel-root":{fontSize:"14px"},"& .MuiFormHelperText-root":{fontSize:"12px"},"& .MuiSvgIcon-root":{fontSize:"20px"},...d},children:at(tr,{name:t,control:x,defaultValue:Rft(k)??null,rules:{required:!!l&&(c||"This field is required"),validate:e=>{if(null==e||""===e)return!0;const t=Nft(e);return t&&pnt(t)||u||"Invalid time"}},render:({field:{value:e},fieldState:o})=>{const n=cKe(e,t,"value");return at(Hpt,{...v,enableAccessibleFieldDOMStructure:!1,value:Nft(n),onChange:e=>{const r=Rft(e);uKe(b,t,r,"value")},slots:{textField:vC},slotProps:{textField:{label:r,placeholder:i,error:!!o.error,helperText:o.error?.message,onMouseDown:e=>e.stopPropagation(),sx:{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g}}}})}})}:{...a,sx:{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g,"& .MuiTimePicker-root":{width:"100%"},"& .MuiTextField-root":{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g},"& .MuiInputBase-root":{fontSize:"14px"},"& .MuiInputLabel-root":{fontSize:"14px"},"& .MuiFormHelperText-root":{fontSize:"12px"},"& .MuiSvgIcon-root":{fontSize:"20px"},...d},children:at(Hpt,{...v,enableAccessibleFieldDOMStructure:!1,value:C,onChange:e=>M(Nft(e)),slots:{textField:vC},slotProps:{textField:{label:r,placeholder:i,onMouseDown:e=>e.stopPropagation(),sx:{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g}}}})})},Fft=({src:t,poster:r,controls:o=!1,loop:n=!1,autoplay:a=!1,raised:i=!1,alt:s="",height:l="100%",width:c="100%",borderRadius:u="0",margin:d=0,padding:p=0,moleculeId:h,enableCoverImage:f,configurationItemInfo:m,marginTop:y="0px",marginRight:g="0px",marginBottom:v="0px",marginLeft:b="0px",paddingTop:x="0px",paddingRight:w="0px",paddingBottom:k="0px",paddingLeft:_="0px",sx:C,sourceDataModelField:M})=>{const[S,D]=e.useState(!1),P=M?xKe(M):void 0,O=("string"==typeof P?P:void 0)||t,{onStateChange:E}=bM(),j=()=>{E({id:h,type:"started"})};return at(Aft,{id:h,raised:i,onClick:j,sx:{borderRadius:`${u}px`,margin:d,padding:p,marginTop:y,marginRight:g,marginBottom:v,marginLeft:b,paddingTop:x,paddingRight:w,paddingBottom:k,paddingLeft:_,"& .MuiCard-root":{display:"inline-block",overflow:"hidden"},"& .MuiCardMedia-root":{height:l,width:c,objectFit:"cover"},"& .MuiCardMedia-media":{height:"100%",width:"100%",objectFit:"cover"},...C},...m,children:S?at(Od,{component:"div",sx:{height:l,width:c,display:"flex",justifyContent:"center",alignItems:"center",fontSize:"16px",color:"gray",textAlign:"center"},children:s||"Video unavailable"}):at(Tm,{component:"video",src:O,poster:f?r:void 0,controls:o,loop:n,autoPlay:a,muted:a,"aria-label":s,sx:{height:l,width:c,objectFit:"cover","& .MuiCardMedia-media":{height:"100%",width:"100%",objectFit:"cover"}},onPlay:j,onEnded:()=>{E({id:h,type:"completed"})},onError:()=>{D(!0)}})})},Aft=To(Sm)`
1032
1032
  display: inline-block;
1033
1033
  overflow: hidden;
1034
- `,zft=({width:e="100%",height:t,fontSize:r="16px",marginLeft:o="0",marginTop:n="0",marginRight:a="0",marginBottom:i="0",sx:s})=>at(tw,{variant:"text",animation:"wave",sx:{width:e,height:t||("number"==typeof r?1.5*r+"px":"24px"),marginLeft:o,marginTop:n,marginRight:a,marginBottom:i,...s}}),Lft=zft,Bft=({text:e,width:t,height:r,fontSize:o="16px",borderColor:n="#ccc",backgroundColor:a,marginLeft:i="0",marginTop:s="0",marginRight:l="0",marginBottom:c="0",paddingLeft:u,paddingTop:d,paddingRight:p,paddingBottom:h,sx:f})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:i,marginTop:s,marginRight:l,marginBottom:c,width:t||"fit-content",...f},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"150px",height:(()=>{if(r)return r;const e="number"==typeof o?o:parseInt(o,10);return Number.isNaN(e)?"32px":`${Math.round(1.2*e+16)}px`})(),borderRadius:"4px",backgroundColor:a,border:`1px solid ${n}`}})]}),Vft=Bft,$ft=Bft,Hft=Bft,qft=Bft,Wft=({text:e,width:t,height:r,borderColor:o="#ccc",backgroundColor:n,marginLeft:a="0",marginTop:i="0",marginRight:s="0",marginBottom:l="0",paddingLeft:c,paddingTop:u,paddingRight:d,paddingBottom:p,sx:h})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:a,marginTop:i,marginRight:s,marginBottom:l,width:t||"fit-content",...h},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"80px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"180px",height:r||"32px",borderRadius:"4px",backgroundColor:n,border:`1px solid ${o}`}})]}),Uft=({text:e,maxValue:t=5,marginLeft:r="0",marginTop:o="0",marginRight:n="0",marginBottom:a="0",sx:i})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:r,marginTop:o,marginRight:n,marginBottom:a,...i},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"80px",height:"20px",marginBottom:"4px"}}),at(Xf,{sx:{display:"flex",gap:"4px"},children:Array.from({length:t}).map((e,t)=>at(tw,{variant:"circular",animation:"wave",sx:{width:"24px",height:"24px"}},t))})]}),Gft=({text:e,marginLeft:t="0",marginTop:r="0",marginRight:o="0",marginBottom:n="0",sx:a})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:t,marginTop:r,marginRight:o,marginBottom:n,...a},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"16px",marginBottom:"8px"}}),it(Xf,{sx:{display:"flex",alignItems:"center",gap:"8px"},children:[at(tw,{variant:"rounded",animation:"wave",sx:{width:"42px",height:"26px",borderRadius:"13px"}}),at(tw,{variant:"text",animation:"wave",sx:{width:"30px",height:"16px"}})]})]}),Kft=({text:e,width:t,orientation:r="horizontal",marginLeft:o="0",marginTop:n="0",marginRight:a="0",marginBottom:i="0",sx:s})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:o,marginTop:n,marginRight:a,marginBottom:i,width:t||"200px",...s},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"16px",marginBottom:"8px"}}),it(Xf,{sx:{display:"flex",alignItems:"center",flexDirection:"vertical"===r?"column":"row",gap:"8px"},children:[at(tw,{variant:"rounded",animation:"wave",sx:{width:"horizontal"===r?"100%":"4px",height:"horizontal"===r?"4px":"100px",borderRadius:"2px"}}),at(tw,{variant:"text",animation:"wave",sx:{width:"24px",height:"16px"}})]})]}),Yft=({text:e,width:t,height:r,borderColor:o="#ced4da",backgroundColor:n,marginLeft:a="0",marginTop:i="0",marginRight:s="0",marginBottom:l="0",sx:c})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:a,marginTop:i,marginRight:s,marginBottom:l,width:t||"fit-content",...c},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"120px",height:r||"32px",borderRadius:"4px",backgroundColor:n,border:`1px solid ${o}`}})]}),Xft=({text:e,width:t,height:r,borderColor:o="#ced4da",marginLeft:n="0",marginTop:a="0",marginRight:i="0",marginBottom:s="0",sx:l})=>it(Xf,{sx:{marginLeft:n,marginTop:a,marginRight:i,marginBottom:s,width:t||"fit-content",...l},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"100px",height:r||"32px",borderRadius:"4px",border:`1px solid ${o}`}})]}),Zft=({width:e,height:t,marginLeft:r="0",marginTop:o="0",marginRight:n="0",marginBottom:a="0",sx:i})=>it(Xf,{sx:{marginLeft:r,marginTop:o,marginRight:n,marginBottom:a,width:e||"320px",...i},children:[at(tw,{variant:"rectangular",animation:"wave",sx:{width:"100%",height:"48px",borderRadius:"8px 8px 0 0",marginBottom:"8px"}}),at(Xf,{sx:{display:"flex",justifyContent:"space-between",marginBottom:"8px"},children:Array.from({length:7}).map((e,t)=>at(tw,{variant:"circular",animation:"wave",sx:{width:"32px",height:"24px"}},t))}),Array.from({length:6}).map((e,t)=>at(Xf,{sx:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:Array.from({length:7}).map((e,t)=>at(tw,{variant:"circular",animation:"wave",sx:{width:"32px",height:"32px"}},t))},t))]}),Qft=({text:e,subText:t,width:r,height:o,backgroundColor:n,marginLeft:a="0",marginTop:i="0",marginRight:s="0",marginBottom:l="0",sx:c})=>at(tw,{variant:"rounded",animation:"wave",sx:{width:r||"100%",height:o||(e&&t?"72px":"48px"),borderRadius:"4px",marginLeft:a,marginTop:i,marginRight:s,marginBottom:l,backgroundColor:n,...c}}),Jft=({size:e=24,marginLeft:t="0",marginTop:r="0",marginRight:o="0",marginBottom:n="0",sx:a})=>it(Xf,{sx:{position:"relative",display:"inline-flex",marginLeft:t,marginTop:r,marginRight:o,marginBottom:n,...a},children:[at(tw,{variant:"circular",animation:"wave",sx:{width:e,height:e}}),at(tw,{variant:"circular",animation:"wave",sx:{position:"absolute",top:-4,right:-4,width:16,height:16}})]}),emt=({size:e="medium",width:t,backgroundColor:r,marginLeft:o="0",marginTop:n="0",marginRight:a="0",marginBottom:i="0",sx:s})=>at(tw,{variant:"rounded",animation:"wave",sx:{width:t||("small"===e?"60px":"80px"),height:"small"===e?"24px":"32px",borderRadius:"16px",marginLeft:o,marginTop:n,marginRight:a,marginBottom:i,backgroundColor:r,...s}}),tmt=({width:e,fontSize:t="14px",marginLeft:r="0",marginTop:o="0",marginRight:n="0",marginBottom:a="0",sx:i})=>at(tw,{variant:"text",animation:"wave",sx:{width:e||"100px",height:"number"==typeof t?1.2*t+"px":"18px",marginLeft:r,marginTop:o,marginRight:n,marginBottom:a,...i}}),rmt=({size:e=40,marginLeft:t="0",marginTop:r="0",marginRight:o="0",marginBottom:n="0",sx:a})=>at(tw,{variant:"circular",animation:"wave",sx:{width:e,height:e,marginLeft:t,marginTop:r,marginRight:o,marginBottom:n,...a}}),omt=["simple_text","text","basic_text_display_field","email_display_field","phone_number_display_field","numeric_display_field","currency_display_field","select_display_field","rating_display_field","switch_display_field","slider_display_field","date_display_field","time_picker_display","date_calendar_display","alert","badge","chip","link","avatar","icon_display_field"],nmt=e=>omt.includes(e),amt=({type:e,props:t={}})=>{const r={width:t.width,height:t.height,marginLeft:t.marginLeft||"0",marginTop:t.marginTop||"0",marginRight:t.marginRight||"0",marginBottom:t.marginBottom||"0",sx:t.sx};switch(e){case"simple_text":case"text":return at(zft,{...r,fontSize:t.fontSize});case"basic_text_display_field":return at(Bft,{...r,text:t.text,fontSize:t.fontSize,borderColor:t.borderColor,backgroundColor:t.backgroundColor,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom});case"email_display_field":return at(Vft,{...r,text:t.text,borderColor:t.borderColor});case"phone_number_display_field":return at($ft,{...r,text:t.text,borderColor:t.borderColor});case"numeric_display_field":return at(Hft,{...r,text:t.text,borderColor:t.borderColor});case"currency_display_field":return at(qft,{...r,text:t.text,borderColor:t.borderColor});case"select_display_field":return at(Wft,{...r,text:t.text,borderColor:t.borderColor});case"rating_display_field":return at(Uft,{...r,text:t.text,maxValue:t.maxValue});case"switch_display_field":return at(Gft,{...r,text:t.text});case"slider_display_field":return at(Kft,{...r,text:t.text,orientation:t.orientation});case"date_display_field":return at(Yft,{...r,text:t.text,borderColor:t.borderColor});case"time_picker_display":return at(Xft,{...r,text:t.text,borderColor:t.borderColor});case"date_calendar_display":return at(Zft,{...r});case"alert":return at(Qft,{...r,text:t.text,subText:t.subText,backgroundColor:t.backgroundColor});case"badge":return at(Jft,{...r,size:t.size});case"chip":return at(emt,{...r,size:t.size,backgroundColor:t.backgroundColor});case"link":return at(tmt,{...r,fontSize:t.fontSize});case"avatar":case"icon_display_field":return at(rmt,{...r,size:t.size});default:return at(tw,{variant:"rounded",animation:"wave",sx:{width:r.width||"100%",height:r.height||"40px",marginLeft:r.marginLeft,marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,...r.sx}})}},imt=({children:e,additionalInfo:t})=>{try{return at(nt,{children:e})}catch(r){return console.error(`Render error in SafeRender - ${t} :`,r),at("div",{style:{color:"red",padding:24},children:"Render Error"})}},smt=e=>Object.entries(e).reduce((e,[t,r])=>(e[t]=(e=>e&&"object"==typeof e&&"value"in e&&!Array.isArray(e)?e.value:e)(r),e),{}),lmt=e=>e?"variable"===e.nature?"variable":e.sourceDataModelFieldId||e.sourceDataPointerId?"data_model":"variable":"data_model",cmt=e=>{if(!e)return"";return"data_model"===lmt(e)?e.sourceDataModelFieldId||e.sourceDataPointerId||"":e.variableName||""},umt=(t,r,o,n)=>Boolean(r?.enabled)||null!==n?e.Children.map(t,t=>e.isValidElement(t)?e.cloneElement(t,{...t.props,parentStyleVariantConfig:r?.enabled?r:void 0,parentContainerWithVariantsId:o,parentContainerActiveVariant:n}):t):t,dmt=(e,t)=>{if(!e?.enabled)return null;const r=cmt(e);if(!r)return null;if(!t)return null;const o=t[r];if(null==o)return null;let n=null;if("string"==typeof o)n=o;else if("object"==typeof o&&null!==o){const e=o;void 0!==e.id&&null!==e.id&&"string"==typeof e.id?n=e.id:void 0!==e.value&&null!==e.value&&(n=String(e.value))}return n},pmt=(e,t,r)=>{if(!e)return{};if(t){const o=e[t];if(o&&"object"==typeof o&&r in o){const e=o[r];if(e&&"object"==typeof e){const{containerStyle:t}=e;return t&&"object"==typeof t?t:e}}}const o=e[r];if(o&&"object"==typeof o){const{containerStyle:e}=o;return e&&"object"==typeof e?e:o}return{}},hmt=e.memo(({containerId:t,sourceDataPointerId:r,replicatorFieldId:o,nestedPathSegments:n=[],children:a,properties:i,config:s,renderWrapper:l})=>{const{formId:c}=KC(),u=vM(),d=ht(),p=QC(),h=wKe(),f=r||o,m=f||d?.sourceDataPointerId,y=r||(f?void 0:d?.sourceDataPointerId),g=m||t||"replicator",v=t||`replicator-${g}`,b=e=>{if(!m)return n;const t={dmfId:m,...void 0!==e?{index:e}:{}};return y&&(t.sourceDataPointerId=y),[...n,t]},x=m&&u?.queryResults?u.queryResults[m]?.isLoading??u.isSingleRecordLoading??!1:u?.isSingleRecordLoading??!1,w=i?.styleVariantConfig||s?.styleVariantConfig,k=e.useMemo(()=>cmt(w),[w]),_=k?bKe(k):void 0;if(Boolean(c&&p)&&p){const{fieldArrayMethods:{fields:e}}=p;return at(nt,{children:e.map((e,r)=>{const o=b(r),n=e;let i=n;"variable"===lmt(w)&&k&&void 0!==_&&(i={...n,[k]:_});const s=dmt(w,i),c=umt(a,w,v,s),u={containerId:t||`replicator-${g}-${r}`,nestedPathSegments:o,itemIndex:r,itemDataByDmfId:n,rawItemDataByDmfId:n,activeVariant:s,isLoading:x,sourceDataPointerId:m},d=l?l(r,c,s):c;return at("div",{"data-replicator-instance":`${g}-${r}`,children:at(ft,{value:u,children:d})},e.id)})})}if(x)return at(nt,{children:Array.from({length:3}).map((e,r)=>{const o=b(r);return at(ft,{value:{containerId:t||`replicator-${g}-${r}`,nestedPathSegments:o,itemIndex:r,itemDataByDmfId:{},rawItemDataByDmfId:{},activeVariant:null,isLoading:x,sourceDataPointerId:m},children:l?l(r,umt(a,w,v,null),null):umt(a,w,v,null)},`${g}-loading-${r}`)})});const C=m?h(m):void 0;let M;if(m&&d?.itemDataByDmfId&&(M=d.itemDataByDmfId[m]),void 0===M&&m&&(M=C),M&&"object"==typeof M&&!Array.isArray(M)&&m&&m in M){const e=M[m];Array.isArray(e)&&(M=e)}if(!M||"object"!=typeof M){const e=b();return at(ft,{value:{containerId:t||`replicator-${g}`,nestedPathSegments:e,itemDataByDmfId:{},activeVariant:null,isLoading:!1,sourceDataPointerId:m},children:l?l(void 0,umt(a,w,v,null),null):umt(a,w,v,null)})}if(Array.isArray(M))return at(nt,{children:M.map((e,r)=>{const o=b(r),n=smt(e);let i=e;"variable"===lmt(w)&&k&&void 0!==_&&(i={...i,[k]:_});const s=dmt(w,i),c=umt(a,w,v,s);return at(ft,{value:{containerId:t||`replicator-${g}-${r}`,nestedPathSegments:o,itemIndex:r,itemDataByDmfId:n,rawItemDataByDmfId:e,activeVariant:s,isLoading:x,sourceDataPointerId:m},children:l?l(r,c,s):c},`${g}-${r}`)})});const S=b(),D=smt(M);let P=M;"variable"===lmt(w)&&k&&void 0!==_&&(P={...P,[k]:_});const O=dmt(w,P),E=umt(a,w,v,O);return at(ft,{value:{containerId:t||`replicator-${g}`,nestedPathSegments:S,itemDataByDmfId:D,rawItemDataByDmfId:M,activeVariant:O,isLoading:x,sourceDataPointerId:m},children:l?l(void 0,E,O):E})}),fmt=e=>!(!e||"object"!=typeof e)&&Object.keys(e).some(e=>"id"!==e),mmt=[],ymt=({sourceDataPointerId:t,nestedPathSegments:r=mmt,minInstances:o=1,maxInstances:n=50,children:a})=>{const i=Kt(),{control:s,getValues:c}=i||{},u=tM(),{prefillData:d}=KC(),p=ht(),h=wKe(),f=e.useRef(!1),m=r.map(e=>{const t=e.sourceDataPointerId||e.dmfId;return void 0!==e.index?`${t}.${e.index}`:t}).filter(Boolean).join(".");const y=m?`${m}.${t}`:t,g=function(e){const t=Kt(),{control:r=t.control,name:o,keyName:n="id",shouldUnregister:a,rules:i}=e,[s,c]=l.default.useState(r._getFieldArray(o)),u=l.default.useRef(r._getFieldArray(o).map(Vr)),d=l.default.useRef(s),p=l.default.useRef(o),h=l.default.useRef(!1);p.current=o,d.current=s,r._names.array.add(o),i&&r.register(o,i),Zt(()=>r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===p.current||!t){const t=Ot(e,p.current);Array.isArray(t)&&(c(t),u.current=t.map(Vr))}}}).unsubscribe,[r]);const f=l.default.useCallback(e=>{h.current=!0,r._setFieldArray(o,e)},[r,o]);return l.default.useEffect(()=>{if(r._state.action=!1,jr(o,r._names)&&r._subjects.state.next({...r._formState}),h.current&&(!Pr(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!Pr(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([o]).then(e=>{const t=Ot(e.errors,o),n=Ot(r._formState.errors,o);(n?!t&&n.type||t&&(n.type!==t.type||n.message!==t.message):t&&t.type)&&(t?jt(r._formState.errors,o,t):fr(r._formState.errors,o),r._subjects.state.next({errors:r._formState.errors}))});else{const e=Ot(r._fields,o);!e||!e._f||Pr(r._options.reValidateMode).isOnSubmit&&Pr(r._options.mode).isOnSubmit||zr(e,r._names.disabled,r._formValues,r._options.criteriaMode===Lt,r._options.shouldUseNativeValidation,!0).then(e=>!sr(e)&&r._subjects.state.next({errors:Rr(r._formState.errors,e,o)}))}r._subjects.state.next({name:o,values:Ct(r._formValues)}),r._names.focus&&Tr(r._fields,(e,t)=>{if(r._names.focus&&t.startsWith(r._names.focus)&&e.focus)return e.focus(),1}),r._names.focus="",r._setValid(),h.current=!1},[s,o,r]),l.default.useEffect(()=>(!Ot(r._formValues,o)&&r._setFieldArray(o),()=>{r._options.shouldUnregister||a?r.unregister(o):((e,t)=>{const o=Ot(r._fields,e);o&&o._f&&(o._f.mount=t)})(o,!1)}),[o,r,n,a]),{swap:l.default.useCallback((e,t)=>{const n=r._getFieldArray(o);Yr(n,e,t),Yr(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,Yr,{argA:e,argB:t},!1)},[f,o,r]),move:l.default.useCallback((e,t)=>{const n=r._getFieldArray(o);Ur(n,e,t),Ur(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,Ur,{argA:e,argB:t},!1)},[f,o,r]),prepend:l.default.useCallback((e,t)=>{const n=or(Ct(e)),a=Gr(r._getFieldArray(o),n);r._names.focus=$r(o,0,t),u.current=Gr(u.current,n.map(Vr)),f(a),c(a),r._setFieldArray(o,a,Gr,{argA:qr(e)})},[f,o,r]),append:l.default.useCallback((e,t)=>{const n=or(Ct(e)),a=Hr(r._getFieldArray(o),n);r._names.focus=$r(o,a.length-1,t),u.current=Hr(u.current,n.map(Vr)),f(a),c(a),r._setFieldArray(o,a,Hr,{argA:qr(e)})},[f,o,r]),remove:l.default.useCallback(e=>{const t=Kr(r._getFieldArray(o),e);u.current=Kr(u.current,e),f(t),c(t),!Array.isArray(Ot(r._fields,o))&&jt(r._fields,o,void 0),r._setFieldArray(o,t,Kr,{argA:e})},[f,o,r]),insert:l.default.useCallback((e,t,n)=>{const a=or(Ct(t)),i=Wr(r._getFieldArray(o),e,a);r._names.focus=$r(o,e,n),u.current=Wr(u.current,e,a.map(Vr)),f(i),c(i),r._setFieldArray(o,i,Wr,{argA:e,argB:qr(t)})},[f,o,r]),update:l.default.useCallback((e,t)=>{const n=Ct(t),a=Xr(r._getFieldArray(o),e,n);u.current=[...a].map((t,r)=>t&&r!==e?u.current[r]:Vr()),f(a),c([...a]),r._setFieldArray(o,a,Xr,{argA:e,argB:n},!0,!1)},[f,o,r]),replace:l.default.useCallback(e=>{const t=or(Ct(e));u.current=t.map(Vr),f([...t]),c([...t]),r._setFieldArray(o,[...t],e=>e,{},!0,!1)},[f,o,r]),fields:l.default.useMemo(()=>s.map((e,t)=>({...e,[n]:u.current[t]||Vr()})),[s,n])}}({control:s,name:y}),{fields:v,append:b,replace:x}=g,w=((e,t)=>{if(e&&t)return t.split(".").reduce((e,t)=>{if(e&&"object"==typeof e)return e[t]},e)})(d,y),k=Array.isArray(w)&&w.length>0,_=t?h(t):void 0;let C;if(t&&p?.itemDataByDmfId&&(C=p.itemDataByDmfId[t]),void 0===C&&t&&(C=_),C&&"object"==typeof C&&!Array.isArray(C)&&t&&t in C){const e=C[t];Array.isArray(e)&&(C=e)}const M=e.useMemo(()=>Array.isArray(C)?C:C&&"object"==typeof C&&!Array.isArray(C)?[C]:void 0,[C]),S=Array.isArray(M)&&M.length>0;return e.useEffect(()=>{if(f.current)return;f.current=!0;const e=c?.(y);Array.isArray(e)&&e.length;const t=!!Array.isArray(e)&&e.some(fmt);if(!(k||t||v.length>0))if(S&&M)x(M);else if(o>0){Array.from({length:o},()=>({})).forEach(e=>{b(e,{shouldFocus:!1})})}},[]),e.useEffect(()=>{if(!S||!M)return;if(k)return;const e=c?.(y);!!Array.isArray(e)&&e.some(fmt)||x(M)},[S,M,k,c,y,x]),e.useEffect(()=>{k&&(console.group("🟡 [ReplicatorFormSetup] Syncing Prefill Array Data"),console.log("📋 Field Array Name:",y),console.log("📦 Prefill Array Value:",JSON.stringify(w,null,2)),console.log("🔢 Current Fields Length:",v.length),console.log("🔢 Prefill Array Length:",w.length),v.length!==w.length?(console.log("🔄 Replacing field array with prefill data"),x(w),console.log("✅ Field array replaced")):console.log("⏭️ Skipping replace - lengths match"),console.groupEnd())},[k,w,v.length,x,y]),e.useEffect(()=>{if(u)return u.register({replicatorId:t,fieldArrayName:y,fieldArrayMethods:g,minInstances:o,maxInstances:n}),()=>{u.unregister(t)}},[u,t,y,g,o,n]),at(JC,{replicatorFieldId:t,fieldArrayName:y,fieldArrayMethods:g,minInstances:o,maxInstances:n,children:a})};function gmt(e,t,r,o){const n={...e};return 0===r.length?{...e,...t}:(t&&o&&r.forEach(e=>{void 0!==t[e]&&(n[e]=t[e])}),n)}function vmt(e,t,r=!1){return t&&r?bn(e,t):e}const bmt=e=>"variable"===String(e||"").trim().toLowerCase().replace(/-/g,"_")?"variable":"data_model",xmt=e=>{if(null==e)return null;const t="object"==typeof e&&e&&"code"in e?e.code:e,r=String(t||"").trim().toLowerCase();return r?"bool"===r?"boolean":"enumerated_list"===r||"enumerated-list"===r||"enumeratedlist"===r||"enumerated"===r||"enum"===r||"picklist"===r||"pick_list"===r?"enumerated_list":r:null},wmt=e=>e?String(e.sourceDataModelFieldId||e.sourceDataPointerId||"").trim():"",kmt=({id:t,type:r,name:o,form:n,config:a,formData:i,isMobile:s,children:l,tabsProps:c,properties:u,moleculeLibraryId:d,organismLibraryMoleculeId:p,parentStyleVariantConfig:h,parentContainerWithVariantsId:f,parentContainerActiveVariant:m})=>{const y=Ye(),g=VC("xs"),v=s||g,{formId:b,isPreview:x=!1,validations:w,submitHandler:k,isConfigurationMode:_,onConfigurationItemClicked:C,selectedConfigurationItemId:M,currentStyleProperties:S,currentContentProperties:D,onInternalNavigation:P,organismMetadata:O,organismInfo:E,localState:j}=KC(),{stateConfig:T}=yM(),N=vM(),R=T,I=ht(),F=u?.dataCapture,A=a?.props?.dataCaptureName||F?.dataCaptureName||F?.variableName||t,z=e.useMemo(()=>{if(!b||!I?.nestedPathSegments?.length)return A;var e,t;return e=I.nestedPathSegments,t=A,e&&0!==e.length?[...e.map(e=>{const t=e.sourceDataPointerId||e.dmfId;return void 0!==e.index?`${t}.${e.index}`:t}),t].filter(Boolean).join("."):t},[b,I?.nestedPathSegments,A]),L=u?.dataCapture,B=bmt(L?.nature),V="variable"===B&&L?.variableName||wmt(L),$=L?.predefinedValue,H=!L?.isIgnored&&("variable"===B&&Boolean(L?.variableName?.trim())||"data_model"===B&&Boolean(wmt(L))),q=e=>{if(!e||e.isIgnored)return;return"variable"===bmt(e.nature)?e.variableName||wmt(e)||void 0:wmt(e)||void 0},W=m??I.activeVariant??null,U=bmt(L?.nature),G=e.useMemo(()=>!L||L.isIgnored?"":"variable"===U?String(L.variableName||"").trim():wmt(L),[L,U]),K=xmt(L?.dataType),Y=!0===L?.useOwnValueForStyleVariant,X="variable"===U||(e=>{const t=xmt(e);return"boolean"===t||"enumerated_list"===t})(K),Z=Y&&X,Q=bKe(G||"__zeal_variant_source_missing__"),J=e.useMemo(()=>{if(!Z||!G)return;if("variable"===U)return{enabled:!0,nature:"variable",variableName:G};const e=String(L?.sourceDataModelFieldId||G).trim()||G;return{enabled:!0,nature:"data_model",sourceDataPointerId:String(L?.sourceDataModelFieldId||L?.sourceDataPointerId||e).trim()||e,sourceDataModelFieldId:e}},[L?.sourceDataModelFieldId,L?.sourceDataPointerId,U,Z,G]),ee=e.useMemo(()=>{if(!J||!G)return null;const e=dmt(J,{[G]:Q});return"string"==typeof e&&e.trim()?e:null},[J,G,Q]),te=e.useMemo(()=>Z?ee||(h?.enabled?W:null):W,[W,ee,Z,h?.enabled]),re=e.useMemo(()=>J?t:f||I.containerId||null,[I.containerId,t,J,f]),oe=J||h,ne=I?.isLoading??N?.isSingleRecordLoading??!1,ae=e.useMemo(()=>((e,t)=>{if(!e)return{};const r=e.props&&"object"==typeof e.props&&!Array.isArray(e.props)?e.props:{};if(t){const o=e[t];if(o&&"object"==typeof o&&"props"in o){const e=o.props;if(e&&"object"==typeof e&&!Array.isArray(e))return bn(r,e)}}return r})(a,te??null),[a,te]),ie=M===t,{isStateDisabled:se,isStateVisible:le}=(({stateListenerId:e})=>{const{localStateObject:t}=KC(),{stateConfig:r}=yM(),o=t||r;let n=!0,a=!1;if(!e)return{isStateDisabled:a,isStateVisible:n};const i=o?.[e]||{},{visible:s=!0,disabled:l=!1}=i||{};return e in o&&(n=Boolean(s),a=Boolean(l)),{isStateDisabled:a,isStateVisible:n,stateValue:i}})({stateListenerId:t}),ce=e.useMemo(()=>({entityType:r,entity:"molecule",entityName:o,entityId:t,organismType:E?.type,organismSubtype:E?.subtype,organismLibraryMoleculeId:p,libraryEntityId:d,activeStyleVariant:te,parentReplicatorWithVariants:re,parentStyleVariantConfig:oe||void 0}),[r,o,t,p,d,te,re,oe]),ue=e.useCallback(e=>{e?.stopPropagation(),C(ce,!1)},[C,ce]),de=e.useCallback(e=>{e?.stopPropagation(),C(ce,!0)},[C,ce]),pe=_?{onClick:ue,onDoubleClick:de,"data-configuration-id":t,css:qrt({theme:y,selected:ie})}:{},he=_||se;if(!le)return null;if(ne&&(nmt(r)||H)){const e={width:ae.width,height:ae.height,marginLeft:ae.marginLeft||"0",marginTop:ae.marginTop||"0",marginRight:ae.marginRight||"0",marginBottom:ae.marginBottom||"0",paddingLeft:ae.paddingLeft,paddingTop:ae.paddingTop,paddingRight:ae.paddingRight,paddingBottom:ae.paddingBottom,fontSize:ae.fontSize,borderColor:ae.borderColor,backgroundColor:ae.backgroundColor,size:ae.size,text:u?.text?.text,subText:u?.subText?.text,maxValue:ae.maxValue,orientation:ae.orientation,sx:ae.sx};return at(amt,{type:r,props:e})}return(()=>{switch(r){case"simple_text":{const e={text:u?.text},r=["text"],{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie);return at(uht,{...n,text:o?.text||"",htmlElementId:t,configurationsItemInfo:pe})}case"text":{const e={text:u?.text},r=Object.keys(e),{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie);return at(cht,{...o,...n,htmlElementId:t,configurationItemInfo:pe})}case"consent":{const e=gmt(u,D,[],ie),r=vmt(ae,S,ie)||{};return at(lot,{...r,htmlElementId:t,properties:e,configurationItemInfo:pe})}case"signup_password_fields":{const e={text:u?.text,subText:u?.subText,placeholderText:u?.placeholderText,subPlaceholderText:u?.subPlaceholderText,validationText:u?.validationText},r=Object.keys(e),o=gmt(e,D,r,ie),{state:n,gap:i,...s}=vmt(a?.props,S,ie);return at(nft,{gap:i,inputProps:s,validations:w||[],htmlElementId:t,validationState:n,overridesProperties:o,configurationItemInfo:pe})}case"stepper":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={title:r?.title,subText:r?.subText},i=Object.keys(a),{title:s,subText:l}=gmt(a,D,i,t);return{...n,...vmt(o?.props,S,t),title:s?.text||"",subText:l?.text||""}});return at(Oft,{...e,items:r||[],isMobile:v,moleculeId:t,configurationItemInfo:pe})}case"checklist":{const e=vmt(ae,S,ie)||{},r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{};switch(e.type){case"checklist_item":{const a={label:r?.label,objectState:r?.objectState},i=Object.keys(a),s=gmt(a,D,i,t),l=vmt(o?.props,S,t)||{},c=s.label?.text||"",u=!!s.objectState?.pmiObjectId;return{...n,...l,type:"checklist_item",label:c,textColor:l.textColor||"#000",fontSize:l.fontSize||"14px",fontFamily:l.fontFamily||"inherit",fontWeight:l.fontWeight||"normal",textAlign:l.textAlign||"left",isSystemDriven:u,disabled:u,interacted:R?.[e.id]?.interacted||"unchecked"}}case"divider_item":{const e=vmt(o?.props,S,t)||{};return{...n,...e,type:"divider_item"}}case"text_item":{const e={text:r?.text},a=Object.keys(e),i=gmt(e,D,a,t),s=vmt(o?.props,S,t)||{},l=i.text?.text||"";return{...n,...s,type:"text_item",text:l}}case"rich_text_item":{const e={text:r?.text},a=Object.keys(e),i=gmt(e,D,a,t),s=vmt(o?.props,S,t)||{},l=i.text?.text||Y5e;return{...n,...s,type:"rich_text_item",text:l}}default:return{...n,type:e.type}}});return at(iot,{...e,items:r||[],moleculeId:t,configurationItemInfo:pe})}case"accordion":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={text:r?.text,subText:r?.subText,bodyText:r?.bodyText},i=Object.keys(a),{text:s,subText:l,bodyText:c}=gmt(a,D,i,t);return{...n,...vmt(o?.props,S,t),text:s?.text||"",subText:l?.text||"",bodyText:c?.text||""}});return at(Urt,{...e,items:r||[],moleculeId:t,configurationItemInfo:pe})}case"menu":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie),i=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={disabled:r&&"disabled"in r?r.disabled:void 0,text:r&&"text"in r?r.text:void 0,link:r&&"link"in r?r.link:void 0},i=Object.keys(a),{text:s,disabled:l,link:c}=gmt(a,D,i,t),u=vmt(o?.props,S,t);return{...n,...u,disabled:R?.[e.id]?R?.[e.id]?.disabled:l?.value||u?.disabled||!1,text:s?.text||"Menu Item",link:c}});return at(Zht,{...a,items:i||[],moleculeId:t,buttonText:o?.text||"Open Menu",configurationItemInfo:pe,buttonDisabled:R?.[t]?R?.[t]?.disabled:n?.value||a?.disabled||!1})}case"tabs":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o}=e||{},n={label:r?.label,link:r?.link},a=Object.keys(n),{label:i,link:s}=gmt(n,D,a,t);return{...vmt(o?.props,S,t),id:e.id,tabKey:V9e(s)?I9e(nM,s?.internalLink):void 0,label:i?.text||"",link:s}}),o=c?.tabs.map(e=>{const{text:t,...r}=e;return{...r,label:t||""}}),n=Boolean(e?.isTabsSystemDerived),a=n?o:r,i=c?.activeTabKey||a?.[0]?.tabKey||"";return at(Tft,{...e,items:a||[],isMobile:v,moleculeId:t,activeTabKey:i,configurationItemInfo:pe,onTabChange:_?void 0:({newTabKey:e,link:t})=>{n?c?.onTabChange?.(e):V9e(t)?P?.({link:t?.internalLink||""}):L9e(t?.externalLink)}})}case"breadcrumbs":{const e={text:u?.text},r=Object.keys(e),{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie),a=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={text:r?.label||r?.text,link:r?.link||r?.link,disabled:r?.disabled},i=Object.keys(a),{text:s,link:l,disabled:c}=gmt(a,D,i,t),u=vmt(o?.props,S,t)||{};return{id:n.id||e.id,text:s?.text||u.text||u.label||n.name||"Breadcrumb item",link:l,disabled:R?.[e.id]?R?.[e.id]?.disabled:c?.value||u.disabled||!1,iconName:u.iconName,sx:u.sx}}),i=Array.isArray(n.items)?n.items.filter(e=>!!e&&"object"==typeof e).map((e,t)=>({id:String(e.id||`breadcrumb-item-${t+1}`),text:String(e.text||e.label||`Item ${t+1}`),link:e.link,disabled:Boolean(e.disabled),iconName:"string"==typeof e.iconName?e.iconName:void 0,sx:e.sx})):[],s=a&&a.length>0?a:i;return at(not,{...n,text:o?.text||n.text||"",moleculeId:t,items:s,configurationItemInfo:pe,onNavigate:e=>{e&&!he&&(V9e(e)?e.internalLink&&P?.({link:e.internalLink}):e.externalLink&&L9e(e.externalLink))}})}case"divider":{const e=vmt(ae,S,ie);return at(iht,{moleculeId:t,configurationItemInfo:pe,...e})}case"progress":{const e={text:u?.text,dataCapture:u?.dataCapture},r=Object.keys(e),{text:o,dataCapture:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie),i=q(n)||V,s=a,l={...s.label&&"object"==typeof s.label?s.label:{},...o?.text?{text:o.text}:{}};return at(gft,{...a,moleculeId:t,label:l,sourceDataModelField:i,configurationItemInfo:pe})}case"link":{const e={text:u?.text,link:u?.link},r=Object.keys(e),{text:o,link:n}=gmt(e,D,r,ie),a=n,i=vmt(ae,S,ie);return at(Yht,{moleculeId:t,...i,link:a,type:a?.type,src:he?void 0:W9e(a,x)||"",text:o?.text||"",disabled:i?.disabled||se,configurationItemInfo:pe})}case"data_driven_link":{const e={text:u?.text},r=Object.keys(e),{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie);return at(Yht,{moleculeId:t,...n,text:o?.text||"",sourceDataModelField:V,disabled:n?.disabled||se,configurationItemInfo:pe})}case"video":{const e={video:u?.video,coverImage:u?.coverImage,dataCapture:u?.dataCapture},r=Object.keys(e),{video:o,coverImage:n,dataCapture:a}=gmt(e,D,r,ie),i=vmt(ae,S,ie),s=q(a);return at(Fft,{...i,moleculeId:t,poster:n?.imageFile?.url,src:o?.videoSource??o?.videoFile?.url??"",sourceDataModelField:s,configurationItemInfo:pe})}case"badge":{const e={text:u?.text,dataCapture:u?.dataCapture},t=Object.keys(e),{dataCapture:r}=gmt(e,D,t,ie),o=vmt(ae,S,ie),n=q(r);return at(Yrt,{sourceDataModelField:n,...o,configurationItemInfo:pe})}case"alert":{const e={text:u?.text,subText:u?.subText},t=Object.keys(e),{text:r,subText:o}=gmt(e,D,t,ie),n=vmt(ae,S,ie);return at(Grt,{text:r?.text||"",subText:o?.text||"",...n,configurationItemInfo:pe})}case"chip":{const e={text:u?.text,dataCapture:u?.dataCapture},t=Object.keys(e),{text:r,dataCapture:o}=gmt(e,D,t,ie),n=vmt(ae,S,ie),a=q(o);return at(sot,{text:r?.text||"",sourceDataModelField:a,...n,configurationItemInfo:pe})}case"email_display_field":case"email_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(Ght,{name:z,text:o?.text||"",placeholderText:n?.text||"",sourceDataModelField:V,required:a?.value,isDisplayOnly:"email_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,...l,configurationItemInfo:pe})}case"phone_number_display_field":case"phone_number_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(uft,{name:z,text:o?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,isDisplayOnly:"phone_number_display_field"===r,...l,configurationItemInfo:pe})}case"numeric_display_field":case"numeric_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(eft,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"numeric_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,...l,configurationItemInfo:pe})}case"currency_display_field":case"currency_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(pot,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"currency_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,...l,configurationItemInfo:pe})}case"basic_text_display_field":case"basic_text_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(rot,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"basic_text_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,...l,configurationItemInfo:pe})}case"rating_display_field":case"rating":{const e={text:u?.text,dataCapture:u?.dataCapture,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,required:n,requiredErrorText:a,validationErrorText:i}=gmt(e,D,t,ie),s=vmt(ae,S,ie);return at(vft,{name:z,text:o?.text||"",required:n?.value,requiredErrorText:a?.text,validationErrorText:i?.text,sourceDataModelField:V,isDisplayOnly:"rating_display_field"===r,...s,configurationItemInfo:pe})}case"switch_display_field":case"switch":{const e={text:u?.text,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{text:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,o,ie),l=vmt(ae,S,ie);return at(jft,{name:z,moleculeId:t,text:n?.text||"",required:a?.value,isDisplayOnly:"switch_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:V,...l,configurationItemInfo:pe})}case"slider_display_field":case"slider":{const e={text:u?.text,required:u?.required,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,required:n,requiredErrorText:a,validationErrorText:i,placeholderText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(Dft,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:"slider_display_field"===r,requiredErrorText:a?.text,validationErrorText:i?.text,placeholderText:s?.text,sourceDataModelField:V,...l,configurationItemInfo:pe})}case"date_display_field":case"date_picker":{const e={text:u?.text,required:u?.required,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{text:n,required:a,placeholderText:i,requiredErrorText:s,validationErrorText:l}=gmt(e,D,o,ie),c=vmt(ae,S,ie);return at(Sit,{dateAdapter:Mat,children:at(aht,{moleculeId:t,name:z,text:n?.text||"",required:a?.value,placeholderText:i?.text||"",isDisplayOnly:"date_display_field"===r,requiredErrorText:s?.text,validationErrorText:l?.text,sourceDataModelField:V,...c,configurationItemInfo:pe})})}case"time_picker_display":case"time_picker":{const e={text:u?.text,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText,required:u?.required},t=Object.keys(e),{text:o,placeholderText:n,requiredErrorText:a,validationErrorText:i,required:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(Sit,{dateAdapter:Mat,children:at(Ift,{...l,name:z,text:o?.text||"",placeholderText:n?.text||"",required:s?.value,requiredErrorText:a?.text,validationErrorText:i?.text,isDisplayOnly:"time_picker_display"===r,sourceDataModelField:V,configurationItemInfo:pe})})}case"select_display_field":case"select":{const e={text:u?.text,required:u?.required,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText,dataDrivenOptions:u?.dataDrivenOptions},t=Object.keys(e),{text:o,required:n,placeholderText:a,requiredErrorText:i,validationErrorText:s,dataDrivenOptions:l}=gmt(e,D,t,ie),c=vmt(ae,S,ie),d="select_display_field"===r;return at(Sft,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:d,predefinedValue:$,placeholderText:a?.text||"",requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:V,dataDrivenOptions:l,...c,configurationItemInfo:pe})}case"image":{const e={image:u?.image,link:u?.link,dataCapture:u?.dataCapture},r=Object.keys(e),{image:o,link:n,dataCapture:a}=gmt(e,D,r,ie),i=vmt(ae,S,ie),s=q(a);return at(sht,{...i,src:o?.imageSource||o?.imageFile?.url||o?.imageFile?.id||"",sourceDataModelField:s,onClick:n?()=>V9e(n)?P?.({link:n?.internalLink||""}):L9e(n?.externalLink):void 0,moleculeId:t,configurationItemInfo:pe,properties:{image:o,link:n}})}case"button":{const e={text:u?.text,action:u?.action},r=Object.keys(e),{text:o,action:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie);return at(GKe,{moleculeId:t,text:o?.text||"",sourceDataModelField:V,...a,disabled:a?.disabled||se,configurationItemInfo:pe,properties:{text:o,action:n}})}case"avatar":{const e=vmt(ae,S,ie);return at(Krt,{...e,sourceDataModelField:V,configurationItemInfo:pe})}case"icon_display_field":{const e={dataCapture:u?.dataCapture},t=Object.keys(e),{dataCapture:r}=gmt(e,D,t,ie),o=vmt(ae,S,ie),n=q(r)||V;return at(Kht,{...o,sourceDataModelField:n,configurationItemInfo:pe})}case"drawer":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie),i=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{};let a={},i=[];switch(e.type){case"menu_item":{const e=r;a={disabled:e?.disabled,text:e?.text,link:e?.link},i=Object.keys(a);break}case"text_item":{const e=r;a={text:e?.text},i=Object.keys(a);break}case"rich_text_item":{const e=r;a={text:e?.text},i=Object.keys(a);break}case"image_item":{const e=r;a={image:e?.image,alt:e?.alt,link:e?.link},i=Object.keys(a);break}default:a={},i=[]}const s=gmt(a,D,i,t),l=vmt(o?.props,S,t),c={...n,...l};switch(e.type){case"menu_item":return{...c,disabled:R?.[e.id]?R?.[e.id]?.disabled:s?.disabled?.value||l?.disabled||!1,text:s?.text?.text||"Menu Item",link:s?.link,sx:l?.sx||c.sx};case"text_item":return{...c,text:s?.text?.text||""};case"rich_text_item":return{...c,text:s?.text?.text||Y5e};case"image_item":{const e=s?.image?.imageSource||s?.image?.imageFile?.url||"";return{...c,src:e,alt:s?.alt?.text||"Drawer image",link:s?.link}}default:return c}});return at(Hht,{...a,items:i||[],moleculeId:t,buttonText:o?.text||a?.buttonText,buttonDisabled:R?.[t]?R?.[t]?.disabled:n?.value||a?.disabled||!1,configurationItemInfo:pe})}case"speed_dial":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={link:r?.link,text:r?.text},i=Object.keys(a),s=gmt(a,D,i,t),l=vmt(o?.props,S,t);return{...n,config:{props:{...o?.props,...l,tooltipText:l?.tooltipText||""}},properties:{link:s?.link||r?.link,text:s?.text||r?.text}}});return at(Pft,{...e,items:r||[],moleculeId:t,configurationItemInfo:pe})}case"checkbox":case"checkbox_display":{const e={label:u?.label,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{label:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,o,ie),l=vmt(ae,S,ie);return at(aot,{name:z,moleculeId:t,label:n?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:V,isDisplayOnly:"checkbox_display"===r,...l,configurationItemInfo:pe})}case"binary_radio_buttons":case"binary_radio_buttons_display":{const e={confirmText:u?.confirmText,rejectText:u?.rejectText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{confirmText:n,rejectText:a,required:i,requiredErrorText:s,validationErrorText:l}=gmt(e,D,o,ie),c=vmt(ae,S,ie);return at(oot,{name:z,moleculeId:t,confirmText:n?.text||"Yes",rejectText:a?.text||"No",required:i?.value,requiredErrorText:s?.text,validationErrorText:l?.text,sourceDataModelField:V,isDisplayOnly:"binary_radio_buttons_display"===r,...c,configurationItemInfo:pe})}case"date_calendar":case"date_calendar_display":{const e={required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{required:o,requiredErrorText:n,validationErrorText:a}=gmt(e,D,t,ie),i=vmt(ae,S,ie);return at(Alt,{...i,name:z,required:o?.value,requiredErrorText:n?.text,validationErrorText:a?.text,isDisplayOnly:"date_calendar_display"===r,sourceDataModelField:V,configurationItemInfo:pe})}default:return at(nt,{children:"There is no such type of molecule yet."})}})()},_mt=({nestedPathSegments:t})=>{const{localStateObject:r}=KC(),o=ht();return e.useMemo(()=>{if(o?.itemDataByDmfId)return o.itemDataByDmfId;const e=(e=>{if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const t=e;if("viewType"in t&&"data"in t){const e=t.data;if(null==e)return;return e}if("data"in t){const e=t.data;if(null==e)return;if("object"==typeof e)return e}}return e}})(r);return void 0!==e?0===t.length||Array.isArray(e)?e:kKe(e,t):void 0},[o?.itemDataByDmfId,r,t])},Cmt=e=>"container"===e.instance&&"empty_state"===e.type,Mmt=e=>{if("container"!==e.instance)return;const t=e;return t.sourceDataPointerId||t.config?.props?.sourceDataPointerId||t.targetRwoId||t.config?.props?.targetRwoId||t.replicatorFieldId},Smt=e=>null==e||Array.isArray(e)&&0===e.length||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length,Dmt=e=>{if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=Object.values(e);return 0===t.length||t.every(e=>Array.isArray(e)&&0===e.length)},Pmt=e=>{if(Smt(e))return!0;if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if("viewType"in t&&"data"in t){const e=t.data;if(Smt(e))return!0;if(Dmt(e))return!0}if("data"in t){const e=t.data;if(Smt(e))return!0;if(Dmt(e))return!0}}return!1},Omt=({containerItems:t,visibleItems:r,nestedPathSegments:o})=>{const{isLoadingData:n,isEmptyDataState:a,forceEmptyStatePreview:i,previewingEmptyStates:s,isConfigurationMode:l}=KC(),c=wKe(),u=vM(),d=_mt({nestedPathSegments:o}),p=e.useMemo(()=>{if(!t||0===t.length)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const e=t.filter(Cmt);if(0===e.length)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const o=s&&s.length>0;if(l&&!i&&!o)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const p=(e=>{const t=e.filter(e=>"container"===e.instance&&"replicator"===e.type);if(1!==t.length)return[];const r=t[0],o=[r.sourceDataPointerId,r.config?.props?.sourceDataPointerId,r.targetRwoId,r.config?.props?.targetRwoId,r.replicatorFieldId].filter(Boolean);return Array.from(new Set(o))})(r),h=Boolean(u?.isSingleRecordLoading)||Boolean(u?.queryResults&&Object.values(u.queryResults).some(e=>e?.isLoading)),f=e.some(e=>{const t=Mmt(e),r=t?[t]:p;return r.length>0?(o=r,!(!u?.queryResults||0===o.length)&&o.some(e=>u.queryResults?.[e]?.isLoading)):h;var o});if((n||f)&&!i&&!o){return{filteredItems:r.filter(e=>!Cmt(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1}}const m=new Set;let y=!1;if(e.forEach(e=>{const t=Mmt(e),r=t?[t]:p;if(i)return void(r.length>0?r.forEach(e=>m.add(e)):y=!0);const o=r.length>0?r.some(e=>s?.includes(e)):s?.includes("__organism__");if(o)r.length>0?r.forEach(e=>m.add(e)):y=!0;else if(!l)if(r.length>0){const e=r.every(e=>{const t=c(e);if(void 0!==t){const r=((e,t)=>{if(!e||"object"!=typeof e||Array.isArray(e))return e;const r=e;if(t in r)return r[t];if("data"in r){const e=r.data;return e&&"object"==typeof e&&!Array.isArray(e)&&t in e?e[t]:e}return e})(t,e);return Pmt(r)}return!!u||((e,t)=>{if(!e)return!0;if(Array.isArray(e))return 0===e.length;if(Object.prototype.hasOwnProperty.call(e,t))return Smt(e[t]);const r=e.data;if(r&&"object"==typeof r&&!Array.isArray(r)){const e=r.data,o=e&&"object"==typeof e&&!Array.isArray(e)?e[t]:r[t];if(void 0!==o)return Smt(o)}const o=e.queryResults;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o.data,r=e&&"object"==typeof e&&!Array.isArray(e)?e[t]:o[t];if(void 0!==r)return Smt(r)}return!0})(d,e)});e&&r.forEach(e=>m.add(e))}else if(u?.queryResults&&Object.keys(u.queryResults).length>0){const e=Object.values(u.queryResults).every(e=>Pmt(e?.data));y=e}else a&&(y=!0)}),!y&&0===m.size){return{filteredItems:r.filter(e=>!Cmt(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1}}const g=r.filter(e=>{if(Cmt(e)){const t=Mmt(e),r=t?[t]:p;return r.length>0?r.some(e=>m.has(e)):y}if(y)return!1;if(m.size>0&&"container"===e.instance&&"replicator"===e.type){const t=Mmt(e);if(t&&m.has(t))return!1}return!0});return{filteredItems:g,showingEmptyStateForFields:m,showOrganismLevelEmptyState:y}},[t,r,o,d,n,a,i,s,l,c,u?.queryResults,u?.isSingleRecordLoading]);return p},Emt=[],jmt=e.memo(({item:t,tabsProps:r,formData:o,setFormData:n,isMobile:a,parentId:i,nestedPathSegments:s=Emt,parentStyleVariantConfig:l,parentContainerWithVariantsId:c,parentContainerActiveVariant:u})=>{const d=Kt(),{organismMetadata:p}=KC(),h="items"in t?t.items:void 0,f=(({items:t})=>{const{stateConfig:r}=yM(),{localStateObject:o}=KC(),n=o||r;return e.useMemo(()=>t&&0!==t.length?t.filter(e=>{const t=e.config?.props?.visible??!0,r=n?.[e.id]?.visible??!0;return t&&r}):[],[t,n])})({items:h}),{filteredItems:m}=Omt({containerItems:h,visibleItems:f,nestedPathSegments:s});if("molecule"===t.instance)return at(imt,{additionalInfo:`molecule: ${t.id}`,children:at(kmt,{...t,form:d,isMobile:a,formData:o,parentId:i,tabsProps:r,setFormData:n,metadata:{...t.metadata,stateListenerId:p?.stateListenerId||t.id},parentStyleVariantConfig:l,parentContainerWithVariantsId:c,parentContainerActiveVariant:u})});const y=!(!h||!h.length),g="form"===t.type&&t.config.props?.activeChildrenIds||[];return y?g.length?at(imt,{additionalInfo:`form: ${t.id}`,children:at(Gmt,{item:t,activeChildrenIds:g,formData:o,setFormData:n,isMobile:a})}):at(imt,{additionalInfo:`container: ${t.id}`,children:at(Wmt,{...t,isMobile:a,nestedPathSegments:s,parentStyleVariantConfig:l,parentContainerWithVariantsId:c,parentContainerActiveVariant:u,config:t.config?{...t.config,props:t.config.props||{},wide:t.config.wide||{},compact:t.config.compact||{}}:{props:{},wide:{},compact:{}},children:m?.map(e=>at(jmt,{item:e,parentId:e.id,formData:o,setFormData:n,isMobile:a,tabsProps:r,nestedPathSegments:s},e.id))})}):null}),Tmt=({order:t=0,id:r,formStepStyles:o,containerProps:n={hasOwnButton:!1}})=>{const a=Kt(),[i,s]=e.useState({}),{formId:l,submitHandler:c,isFormInEditMode:u,organismMetadata:d,organismInfo:p}=KC(),{groupStepItemsByStepContainer:h}=KC();Object.keys(d?.popupPayload??{})[0];const{currentStep:f,canGoToNextStep:m,canGoToPrevStep:y,goToNextStep:g,goToPrevStep:v,reset:b,setStep:x}=eo(),w=h(),{submitForm:k}=SKe(),{forms:_}=dt(),C=t+1,M=w.get(r)||[];return f!==C?null:at("div",{style:o,children:it(nt,{children:[M.map(e=>at(jmt,{item:e,setFormData:s,formData:i},e.id)),(!n?.hasOwnButton||d?.isFormInsidePopUp)&&u&&it("div",{style:{display:"flex",gap:"16px"},children:[at(GKe,{text:y?"Back":"Cancel",variant:"outlined",onClick:()=>{y?v():(b(),x(1))}}),at(GKe,{text:m?"Next":"Submit",variant:"contained",onClick:async()=>{const e=await a.trigger();if(!e)return void O8e({message:"Please fill all required fields",type:"error"});if(m)return void g();const t=a?.getValues?.()||{};if(e&&l){const e={formId:l,data:t,pmiObjectId:p?.pmiObjectId};c?await c(e):_?.submit&&await k(e)}}})]})]})})},Nmt=t=>{const r=(t=>{if(!e.isValidElement(t))return;return t.props.item})(t);if(!r||"container"!==r.instance)return;const o=r.config?.props?.expandableSlot;return"title"===(n=o)||"body"===n?o:void 0;var n},Rmt=({children:t,defaultExpanded:r=!1,unmountOnExit:o=!1,forceExpanded:n=!1,disableToggle:a=!1})=>{const[i,s]=e.useState(r);e.useEffect(()=>{s(r)},[r]);const{titleNode:l,detailNodes:c}=e.useMemo(()=>{const r=e.Children.toArray(t),o=[];let n=null,a=null;r.forEach(e=>{const t=Nmt(e);"title"!==t||n?"body"!==t||a?o.push(e):a=e:n=e}),!n&&o.length>0&&(n=o.shift()??null),!a&&o.length>0&&(a=o.shift()??null);const i=[a,...o].filter(Boolean);return{titleNode:n,detailNodes:i}},[t]);return it(fu,{disableGutters:!0,square:!1,elevation:0,expanded:n||i,onChange:(e,t)=>{n||a||s(t)},slotProps:{transition:{unmountOnExit:o}},sx:{width:"100%",borderRadius:"inherit",backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}},children:[at(Hu,{expandIcon:at(Xf,{component:"span",sx:{fontSize:18,lineHeight:1},children:"▾"}),sx:{px:0,minHeight:0,"& .MuiAccordionSummary-content":{m:0,width:"100%"}},children:at(Xf,{sx:{width:"100%"},children:l||at("span",{children:"Expandable Section"})})}),at(vu,{sx:{px:0,py:0},children:at(Xf,{sx:{width:"100%"},children:c})})]})},Imt=e=>{if(!e)return{};const t={},r={},o={},n={};return void 0!==e.textColor&&(t.color=e.textColor),void 0!==e.backgroundColor&&(t.backgroundColor=e.backgroundColor),void 0!==e.borderColor&&(t.borderColor=e.borderColor),void 0!==e.borderStyle&&(t.borderStyle=e.borderStyle),void 0!==e.borderWidth&&(t.borderWidth=e.borderWidth),void 0!==e.borderRadius&&(t.borderRadius=e.borderRadius),void 0!==e.fontSize&&(t.fontSize=e.fontSize),void 0!==e.fontWeight&&(t.fontWeight=e.fontWeight),void 0!==e.fontFamily&&(t.fontFamily=e.fontFamily),void 0!==e.minHeight&&(t.minHeight=e.minHeight),void 0!==e.minWidth&&(t.minWidth=e.minWidth),void 0!==e.paddingX&&(t.paddingLeft=e.paddingX,t.paddingRight=e.paddingX),void 0!==e.paddingY&&(t.paddingTop=e.paddingY,t.paddingBottom=e.paddingY),void 0!==e.activeTextColor&&(r.color=e.activeTextColor),void 0!==e.activeBackgroundColor&&(r.backgroundColor=e.activeBackgroundColor),void 0!==e.hoverTextColor&&(o.color=e.hoverTextColor),void 0!==e.hoverBackgroundColor&&(o.backgroundColor=e.hoverBackgroundColor),void 0!==e.disabledTextColor&&(n.color=e.disabledTextColor),void 0!==e.disabledBackgroundColor&&(n.backgroundColor=e.disabledBackgroundColor),void 0!==e.disabledOpacity&&(n.opacity=e.disabledOpacity),{base:t,active:r,hover:o,disabled:n}},Fmt=(...e)=>e.reduce((e,t)=>({base:{...e.base||{},...t?.base||{}},active:{...e.active||{},...t?.active||{}},hover:{...e.hover||{},...t?.hover||{}},disabled:{...e.disabled||{},...t?.disabled||{}}}),{}),Amt=(...e)=>Fmt(...e.map(e=>Fmt(Imt(e?.simple),e?.sx))),zmt=({tabs:t,defaultTabKey:r,activeTabKey:o,keepMounted:n=!0,orientation:a="horizontal",variant:i="standard",scrollButtons:s="auto",allowScrollButtonsMobile:l=!0,tabsStyles:c,onTabChange:u,children:d})=>{const p=e.useMemo(()=>e.Children.toArray(d).map((t,r)=>{if(e.isValidElement(t)){const e=t.props?.item,o=`tab-panel-${r+1}`;return{id:e?.id||o,label:e?.name||`Tab ${r+1}`,content:t}}return{id:`tab-panel-${r+1}`,label:`Tab ${r+1}`,content:t}}),[d]),h=e.useMemo(()=>p.map((e,r)=>({key:e.id||`tab-panel-${r+1}`,label:t?.[r]?.label||e.label||`Tab ${r+1}`,iconName:t?.[r]?.iconName,iconColor:t?.[r]?.iconColor,iconSize:t?.[r]?.iconSize,iconPosition:t?.[r]?.iconPosition,disabled:t?.[r]?.disabled,styles:t?.[r]?.styles,content:e.content})),[t,p]),f=h[0]?.key||"",m=o||r||f,y=void 0!==o,[g,v]=e.useState(m),b=y?o||"":g;if(e.useEffect(()=>{if(y)return;if(!h.length)return;if(h.some(e=>e.key===g))return;const e=h.some(e=>e.key===m)?m:h[0].key;e&&e!==g&&v(e)},[y,g,m,h]),!h.length)return null;const x=Math.max(h.findIndex(e=>e.key===b),0),w=h[x]?.key||f;return it(Xf,{"data-testid":"tabs-container-root",sx:{display:"flex",flexDirection:"vertical"===a?"row":"column"},children:[at(Xf,{"data-testid":"tabs-container-header",sx:c?.headerSx||{},children:at(hC,{value:x,onChange:(e,t)=>{const r=h[t];r&&(y||v(r.key),u?.(r.key))},orientation:a,variant:i,scrollButtons:s,allowScrollButtonsMobile:l,sx:{...c?.tabsSx||{},"& .MuiTabs-indicator":{...c?.indicatorSx||{}}},children:h.map(e=>{const t=Amt(c?.tab,e.styles?.tab),r=e.iconName?at(tKe,{iconName:e.iconName,color:e.iconColor,size:e.iconSize||16}):void 0;return at(p_,{disableRipple:!0,disabled:e.disabled,label:e.label,icon:r,iconPosition:r?e.iconPosition||"start":void 0,"data-testid":`tabs-container-tab-${e.key}`,sx:{textTransform:"none",...t.base||{},"&.Mui-selected":{...t.base||{},...t.active||{}},"&:hover":{...t.hover||{}},"&.Mui-disabled":{...t.disabled||{},"&.Mui-selected":{...t.disabled||{}},"&:hover":{...t.disabled||{}}}}},e.key)})})}),at(Xf,{"data-testid":"tabs-container-panels",sx:{flex:1,minWidth:0},children:h.map(e=>{const t=e.key===w;return n||t?at(Xf,{role:"tabpanel",hidden:!t,"data-testid":`tabs-container-panel-${e.key}`,sx:{...c?.panelSx||{},...e.styles?.panelSx||{},...t?{}:{display:"none"}},children:e.content},e.key):null})})]})},Lmt={mapSimpleValueToStateSx:Imt,mergeStateSx:Fmt,mergeTabStyleContracts:Amt},Bmt={dots:!0,infinite:!1,autoplay:!1,autoplaySpeed:5e3,arrows:!0,slidesToShow:1,slidesToScroll:1,adaptiveHeight:!0,swipeToSlide:!0},Vmt=e=>Boolean(e&&"object"==typeof e&&!Array.isArray(e)),$mt=e=>Vmt(e)?e:{},Hmt=(e,t)=>Vmt(e)?Vmt(t)?bn(e,t):e:t??e,qmt=[],Wmt=e.memo(({id:t,type:r,name:o,config:n,children:a,metadata:i,isMobile:s,properties:l,nestedPathSegments:c=qmt,sourceDataPointerId:u,replicatorFieldId:d,parentStyleVariantConfig:p,parentContainerWithVariantsId:h,parentContainerActiveVariant:f})=>{const m=Ye(),{props:y,wide:g,compact:v}=n||{},{isConfigurationMode:b,onConfigurationItemClicked:x,selectedConfigurationItemId:w,currentStyleProperties:k,currentContentProperties:_,formId:C,localState:M,organismInfo:S}=KC(),D=w===t,P=e.useMemo(()=>!(!D||!Vmt(k))&&(Vmt(k.props)||Vmt(k.wide)||Vmt(k.compact)),[D,k]),O=e.useMemo(()=>{const e=$mt(y);if(!P||!Vmt(k))return e;const t=$mt(k.props);return 0===Object.keys(t).length?e:bn(e,t)},[y,P,k]),E=e.useMemo(()=>{const e=$mt(g);if(!P||!Vmt(k))return e;const t=$mt(k.wide);return 0===Object.keys(t).length?e:bn(e,t)},[g,P,k]),j=e.useMemo(()=>{const e=$mt(v);if(!P||!Vmt(k))return e;const t=$mt(k.compact);return 0===Object.keys(t).length?e:bn(e,t)},[v,P,k]),T=u||O?.sourceDataPointerId,N=T||d,R=e.useMemo(()=>{if(!D||!Vmt(k))return null;if(!P)return k;const{props:e,wide:t,compact:r,...o}=k;return Object.keys(o).length>0?o:null},[D,k,P]),I=ht(),{activeVariant:F,containerId:A}=I,z=Kt(),L=Boolean(C&&z),B=p,V=f??F??null,$=h||A||null,H=e.useMemo(()=>{const r=B,o=V,n=h||t;return void 0!==r||null!==o||void 0!==h?e.Children.map(a,t=>e.isValidElement(t)?e.cloneElement(t,{...t.props,parentStyleVariantConfig:r,parentContainerWithVariantsId:n,parentContainerActiveVariant:o,sourceDataPointerId:T,nestedPathSegments:c}):t):a},[a,V,B,t,h,T,c]),q=D?{backgroundImage:_?.backgroundImage??l?.backgroundImage??{imageFile:{url:""}}}:l,{containerProps:W={},containerStyle:U={}}=E||{};let G={...U};const{containerProps:K={},containerStyle:Y={}}=j||{};let X={...Y};R&&D&&(X={...Y,...R},G={...U,...R});const Z=VC("xs"),Q=s??Z;let J=Q?X:G;if(V&&n){const e=pmt(n,V,Q?"compact":"wide");Object.keys(e).length>0&&(J=Hmt(J,e))}const ee=Q?K:W,te={...O,...ee,enableBackgroundImage:J?.enableBackgroundImage},re=e.useMemo(()=>({entityId:t,entityType:r,entityName:o,entity:"container",organismType:S?.type,organismSubtype:S?.subtype,libraryEntityId:i?.containerLibraryId||void 0,activeStyleVariant:V,parentReplicatorWithVariants:$,parentStyleVariantConfig:B}),[r,o,t,i,V,$,B]),oe=b?{onClick:e=>{e&&e.stopPropagation(),x(re,!1)},onDoubleClick:e=>{e?.stopPropagation(),x(re,!0)}}:{},ne=`${t}.${Q?"mobile":"desktop"}`,ae=_o`
1034
+ `,zft=({width:e="100%",height:t,fontSize:r="16px",marginLeft:o="0",marginTop:n="0",marginRight:a="0",marginBottom:i="0",sx:s})=>at(tw,{variant:"text",animation:"wave",sx:{width:e,height:t||("number"==typeof r?1.5*r+"px":"24px"),marginLeft:o,marginTop:n,marginRight:a,marginBottom:i,...s}}),Lft=zft,Bft=({text:e,width:t,height:r,fontSize:o="16px",borderColor:n="#ccc",backgroundColor:a,marginLeft:i="0",marginTop:s="0",marginRight:l="0",marginBottom:c="0",paddingLeft:u,paddingTop:d,paddingRight:p,paddingBottom:h,sx:f})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:i,marginTop:s,marginRight:l,marginBottom:c,width:t||"fit-content",...f},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"150px",height:(()=>{if(r)return r;const e="number"==typeof o?o:parseInt(o,10);return Number.isNaN(e)?"32px":`${Math.round(1.2*e+16)}px`})(),borderRadius:"4px",backgroundColor:a,border:`1px solid ${n}`}})]}),Vft=Bft,$ft=Bft,Hft=Bft,qft=Bft,Wft=({text:e,width:t,height:r,borderColor:o="#ccc",backgroundColor:n,marginLeft:a="0",marginTop:i="0",marginRight:s="0",marginBottom:l="0",paddingLeft:c,paddingTop:u,paddingRight:d,paddingBottom:p,sx:h})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:a,marginTop:i,marginRight:s,marginBottom:l,width:t||"fit-content",...h},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"80px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"180px",height:r||"32px",borderRadius:"4px",backgroundColor:n,border:`1px solid ${o}`}})]}),Uft=({text:e,maxValue:t=5,marginLeft:r="0",marginTop:o="0",marginRight:n="0",marginBottom:a="0",sx:i})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:r,marginTop:o,marginRight:n,marginBottom:a,...i},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"80px",height:"20px",marginBottom:"4px"}}),at(Xf,{sx:{display:"flex",gap:"4px"},children:Array.from({length:t}).map((e,t)=>at(tw,{variant:"circular",animation:"wave",sx:{width:"24px",height:"24px"}},t))})]}),Gft=({text:e,marginLeft:t="0",marginTop:r="0",marginRight:o="0",marginBottom:n="0",sx:a})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:t,marginTop:r,marginRight:o,marginBottom:n,...a},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"16px",marginBottom:"8px"}}),it(Xf,{sx:{display:"flex",alignItems:"center",gap:"8px"},children:[at(tw,{variant:"rounded",animation:"wave",sx:{width:"42px",height:"26px",borderRadius:"13px"}}),at(tw,{variant:"text",animation:"wave",sx:{width:"30px",height:"16px"}})]})]}),Kft=({text:e,width:t,orientation:r="horizontal",marginLeft:o="0",marginTop:n="0",marginRight:a="0",marginBottom:i="0",sx:s})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:o,marginTop:n,marginRight:a,marginBottom:i,width:t||"200px",...s},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"16px",marginBottom:"8px"}}),it(Xf,{sx:{display:"flex",alignItems:"center",flexDirection:"vertical"===r?"column":"row",gap:"8px"},children:[at(tw,{variant:"rounded",animation:"wave",sx:{width:"horizontal"===r?"100%":"4px",height:"horizontal"===r?"4px":"100px",borderRadius:"2px"}}),at(tw,{variant:"text",animation:"wave",sx:{width:"24px",height:"16px"}})]})]}),Yft=({text:e,width:t,height:r,borderColor:o="#ced4da",backgroundColor:n,marginLeft:a="0",marginTop:i="0",marginRight:s="0",marginBottom:l="0",sx:c})=>it(Xf,{sx:{display:"inline-flex",flexDirection:"column",marginLeft:a,marginTop:i,marginRight:s,marginBottom:l,width:t||"fit-content",...c},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"120px",height:r||"32px",borderRadius:"4px",backgroundColor:n,border:`1px solid ${o}`}})]}),Xft=({text:e,width:t,height:r,borderColor:o="#ced4da",marginLeft:n="0",marginTop:a="0",marginRight:i="0",marginBottom:s="0",sx:l})=>it(Xf,{sx:{marginLeft:n,marginTop:a,marginRight:i,marginBottom:s,width:t||"fit-content",...l},children:[e&&at(tw,{variant:"text",animation:"wave",sx:{width:"60px",height:"14px",marginBottom:"4px"}}),at(tw,{variant:"rounded",animation:"wave",sx:{width:t||"100px",height:r||"32px",borderRadius:"4px",border:`1px solid ${o}`}})]}),Zft=({width:e,height:t,marginLeft:r="0",marginTop:o="0",marginRight:n="0",marginBottom:a="0",sx:i})=>it(Xf,{sx:{marginLeft:r,marginTop:o,marginRight:n,marginBottom:a,width:e||"320px",...i},children:[at(tw,{variant:"rectangular",animation:"wave",sx:{width:"100%",height:"48px",borderRadius:"8px 8px 0 0",marginBottom:"8px"}}),at(Xf,{sx:{display:"flex",justifyContent:"space-between",marginBottom:"8px"},children:Array.from({length:7}).map((e,t)=>at(tw,{variant:"circular",animation:"wave",sx:{width:"32px",height:"24px"}},t))}),Array.from({length:6}).map((e,t)=>at(Xf,{sx:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:Array.from({length:7}).map((e,t)=>at(tw,{variant:"circular",animation:"wave",sx:{width:"32px",height:"32px"}},t))},t))]}),Qft=({text:e,subText:t,width:r,height:o,backgroundColor:n,marginLeft:a="0",marginTop:i="0",marginRight:s="0",marginBottom:l="0",sx:c})=>at(tw,{variant:"rounded",animation:"wave",sx:{width:r||"100%",height:o||(e&&t?"72px":"48px"),borderRadius:"4px",marginLeft:a,marginTop:i,marginRight:s,marginBottom:l,backgroundColor:n,...c}}),Jft=({size:e=24,marginLeft:t="0",marginTop:r="0",marginRight:o="0",marginBottom:n="0",sx:a})=>it(Xf,{sx:{position:"relative",display:"inline-flex",marginLeft:t,marginTop:r,marginRight:o,marginBottom:n,...a},children:[at(tw,{variant:"circular",animation:"wave",sx:{width:e,height:e}}),at(tw,{variant:"circular",animation:"wave",sx:{position:"absolute",top:-4,right:-4,width:16,height:16}})]}),emt=({size:e="medium",width:t,backgroundColor:r,marginLeft:o="0",marginTop:n="0",marginRight:a="0",marginBottom:i="0",sx:s})=>at(tw,{variant:"rounded",animation:"wave",sx:{width:t||("small"===e?"60px":"80px"),height:"small"===e?"24px":"32px",borderRadius:"16px",marginLeft:o,marginTop:n,marginRight:a,marginBottom:i,backgroundColor:r,...s}}),tmt=({width:e,fontSize:t="14px",marginLeft:r="0",marginTop:o="0",marginRight:n="0",marginBottom:a="0",sx:i})=>at(tw,{variant:"text",animation:"wave",sx:{width:e||"100px",height:"number"==typeof t?1.2*t+"px":"18px",marginLeft:r,marginTop:o,marginRight:n,marginBottom:a,...i}}),rmt=({size:e=40,marginLeft:t="0",marginTop:r="0",marginRight:o="0",marginBottom:n="0",sx:a})=>at(tw,{variant:"circular",animation:"wave",sx:{width:e,height:e,marginLeft:t,marginTop:r,marginRight:o,marginBottom:n,...a}}),omt=["simple_text","text","basic_text_display_field","email_display_field","phone_number_display_field","numeric_display_field","currency_display_field","select_display_field","rating_display_field","switch_display_field","slider_display_field","date_display_field","time_picker_display","date_calendar_display","alert","badge","chip","link","avatar","icon_display_field"],nmt=e=>omt.includes(e),amt=({type:e,props:t={}})=>{const r={width:t.width,height:t.height,marginLeft:t.marginLeft||"0",marginTop:t.marginTop||"0",marginRight:t.marginRight||"0",marginBottom:t.marginBottom||"0",sx:t.sx};switch(e){case"simple_text":case"text":return at(zft,{...r,fontSize:t.fontSize});case"basic_text_display_field":return at(Bft,{...r,text:t.text,fontSize:t.fontSize,borderColor:t.borderColor,backgroundColor:t.backgroundColor,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom});case"email_display_field":return at(Vft,{...r,text:t.text,borderColor:t.borderColor});case"phone_number_display_field":return at($ft,{...r,text:t.text,borderColor:t.borderColor});case"numeric_display_field":return at(Hft,{...r,text:t.text,borderColor:t.borderColor});case"currency_display_field":return at(qft,{...r,text:t.text,borderColor:t.borderColor});case"select_display_field":return at(Wft,{...r,text:t.text,borderColor:t.borderColor});case"rating_display_field":return at(Uft,{...r,text:t.text,maxValue:t.maxValue});case"switch_display_field":return at(Gft,{...r,text:t.text});case"slider_display_field":return at(Kft,{...r,text:t.text,orientation:t.orientation});case"date_display_field":return at(Yft,{...r,text:t.text,borderColor:t.borderColor});case"time_picker_display":return at(Xft,{...r,text:t.text,borderColor:t.borderColor});case"date_calendar_display":return at(Zft,{...r});case"alert":return at(Qft,{...r,text:t.text,subText:t.subText,backgroundColor:t.backgroundColor});case"badge":return at(Jft,{...r,size:t.size});case"chip":return at(emt,{...r,size:t.size,backgroundColor:t.backgroundColor});case"link":return at(tmt,{...r,fontSize:t.fontSize});case"avatar":case"icon_display_field":return at(rmt,{...r,size:t.size});default:return at(tw,{variant:"rounded",animation:"wave",sx:{width:r.width||"100%",height:r.height||"40px",marginLeft:r.marginLeft,marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,...r.sx}})}},imt=({children:e,additionalInfo:t})=>{try{return at(nt,{children:e})}catch(r){return console.error(`Render error in SafeRender - ${t} :`,r),at("div",{style:{color:"red",padding:24},children:"Render Error"})}},smt=e=>Object.entries(e).reduce((e,[t,r])=>(e[t]=(e=>e&&"object"==typeof e&&"value"in e&&!Array.isArray(e)?e.value:e)(r),e),{}),lmt=e=>e?"variable"===e.nature?"variable":e.sourceDataModelFieldId||e.sourceDataPointerId?"data_model":"variable":"data_model",cmt=e=>{if(!e)return"";return"data_model"===lmt(e)?e.sourceDataModelFieldId||e.sourceDataPointerId||"":e.variableName||""},umt=(t,r,o,n)=>Boolean(r?.enabled)||null!==n?e.Children.map(t,t=>e.isValidElement(t)?e.cloneElement(t,{...t.props,parentStyleVariantConfig:r?.enabled?r:void 0,parentContainerWithVariantsId:o,parentContainerActiveVariant:n}):t):t,dmt=(e,t)=>{if(!e?.enabled)return null;const r=cmt(e);if(!r)return null;if(!t)return null;const o=t[r];if(null==o)return null;let n=null;if("string"==typeof o)n=o;else if("object"==typeof o&&null!==o){const e=o;void 0!==e.id&&null!==e.id&&"string"==typeof e.id?n=e.id:void 0!==e.value&&null!==e.value&&(n=String(e.value))}return n},pmt=(e,t,r)=>{if(!e)return{};if(t){const o=e[t];if(o&&"object"==typeof o&&r in o){const e=o[r];if(e&&"object"==typeof e){const{containerStyle:t}=e;return t&&"object"==typeof t?t:e}}}const o=e[r];if(o&&"object"==typeof o){const{containerStyle:e}=o;return e&&"object"==typeof e?e:o}return{}},hmt=e.memo(({containerId:t,sourceDataPointerId:r,replicatorFieldId:o,nestedPathSegments:n=[],children:a,properties:i,config:s,renderWrapper:l})=>{const{formId:c}=KC(),u=vM(),d=ht(),p=QC(),h=wKe(),f=r||o,m=f||d?.sourceDataPointerId,y=r||(f?void 0:d?.sourceDataPointerId),g=m||t||"replicator",v=t||`replicator-${g}`,b=e=>{if(!m)return n;const t={dmfId:m,...void 0!==e?{index:e}:{}};return y&&(t.sourceDataPointerId=y),[...n,t]},x=m&&u?.queryResults?u.queryResults[m]?.isLoading??u.isSingleRecordLoading??!1:u?.isSingleRecordLoading??!1,w=i?.styleVariantConfig||s?.styleVariantConfig,k=e.useMemo(()=>cmt(w),[w]),_=k?bKe(k):void 0;if(Boolean(c&&p)&&p){const{fieldArrayMethods:{fields:e}}=p;return at(nt,{children:e.map((e,r)=>{const o=b(r),n=e;let i=n;"variable"===lmt(w)&&k&&void 0!==_&&(i={...n,[k]:_});const s=dmt(w,i),c=umt(a,w,v,s),u={containerId:t||`replicator-${g}-${r}`,nestedPathSegments:o,itemIndex:r,itemDataByDmfId:n,rawItemDataByDmfId:n,activeVariant:s,isLoading:x,sourceDataPointerId:m},d=l?l(r,c,s):c;return at("div",{"data-replicator-instance":`${g}-${r}`,children:at(ft,{value:u,children:d})},e.id)})})}if(x)return at(nt,{children:Array.from({length:3}).map((e,r)=>{const o=b(r);return at(ft,{value:{containerId:t||`replicator-${g}-${r}`,nestedPathSegments:o,itemIndex:r,itemDataByDmfId:{},rawItemDataByDmfId:{},activeVariant:null,isLoading:x,sourceDataPointerId:m},children:l?l(r,umt(a,w,v,null),null):umt(a,w,v,null)},`${g}-loading-${r}`)})});const C=m?h(m):void 0;let M;if(m&&d?.itemDataByDmfId&&(M=d.itemDataByDmfId[m]),void 0===M&&m&&(M=C),M&&"object"==typeof M&&!Array.isArray(M)&&m&&m in M){const e=M[m];Array.isArray(e)&&(M=e)}if(!M||"object"!=typeof M){const e=b();return at(ft,{value:{containerId:t||`replicator-${g}`,nestedPathSegments:e,itemDataByDmfId:{},activeVariant:null,isLoading:!1,sourceDataPointerId:m},children:l?l(void 0,umt(a,w,v,null),null):umt(a,w,v,null)})}if(Array.isArray(M))return at(nt,{children:M.map((e,r)=>{const o=b(r),n=smt(e);let i=e;"variable"===lmt(w)&&k&&void 0!==_&&(i={...i,[k]:_});const s=dmt(w,i),c=umt(a,w,v,s);return at(ft,{value:{containerId:t||`replicator-${g}-${r}`,nestedPathSegments:o,itemIndex:r,itemDataByDmfId:n,rawItemDataByDmfId:e,activeVariant:s,isLoading:x,sourceDataPointerId:m},children:l?l(r,c,s):c},`${g}-${r}`)})});const S=b(),D=smt(M);let P=M;"variable"===lmt(w)&&k&&void 0!==_&&(P={...P,[k]:_});const O=dmt(w,P),E=umt(a,w,v,O);return at(ft,{value:{containerId:t||`replicator-${g}`,nestedPathSegments:S,itemDataByDmfId:D,rawItemDataByDmfId:M,activeVariant:O,isLoading:x,sourceDataPointerId:m},children:l?l(void 0,E,O):E})}),fmt=e=>!(!e||"object"!=typeof e)&&Object.keys(e).some(e=>"id"!==e),mmt=[],ymt=({sourceDataPointerId:t,nestedPathSegments:r=mmt,minInstances:o=1,maxInstances:n=50,children:a})=>{const i=Kt(),{control:s,getValues:c}=i||{},u=tM(),{prefillData:d}=KC(),p=ht(),h=wKe(),f=e.useRef(!1),m=r.map(e=>{const t=e.sourceDataPointerId||e.dmfId;return void 0!==e.index?`${t}.${e.index}`:t}).filter(Boolean).join(".");const y=m?`${m}.${t}`:t,g=function(e){const t=Kt(),{control:r=t.control,name:o,keyName:n="id",shouldUnregister:a,rules:i}=e,[s,c]=l.default.useState(r._getFieldArray(o)),u=l.default.useRef(r._getFieldArray(o).map(Vr)),d=l.default.useRef(s),p=l.default.useRef(o),h=l.default.useRef(!1);p.current=o,d.current=s,r._names.array.add(o),i&&r.register(o,i),Zt(()=>r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===p.current||!t){const t=Ot(e,p.current);Array.isArray(t)&&(c(t),u.current=t.map(Vr))}}}).unsubscribe,[r]);const f=l.default.useCallback(e=>{h.current=!0,r._setFieldArray(o,e)},[r,o]);return l.default.useEffect(()=>{if(r._state.action=!1,jr(o,r._names)&&r._subjects.state.next({...r._formState}),h.current&&(!Pr(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!Pr(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([o]).then(e=>{const t=Ot(e.errors,o),n=Ot(r._formState.errors,o);(n?!t&&n.type||t&&(n.type!==t.type||n.message!==t.message):t&&t.type)&&(t?jt(r._formState.errors,o,t):fr(r._formState.errors,o),r._subjects.state.next({errors:r._formState.errors}))});else{const e=Ot(r._fields,o);!e||!e._f||Pr(r._options.reValidateMode).isOnSubmit&&Pr(r._options.mode).isOnSubmit||zr(e,r._names.disabled,r._formValues,r._options.criteriaMode===Lt,r._options.shouldUseNativeValidation,!0).then(e=>!sr(e)&&r._subjects.state.next({errors:Rr(r._formState.errors,e,o)}))}r._subjects.state.next({name:o,values:Ct(r._formValues)}),r._names.focus&&Tr(r._fields,(e,t)=>{if(r._names.focus&&t.startsWith(r._names.focus)&&e.focus)return e.focus(),1}),r._names.focus="",r._setValid(),h.current=!1},[s,o,r]),l.default.useEffect(()=>(!Ot(r._formValues,o)&&r._setFieldArray(o),()=>{r._options.shouldUnregister||a?r.unregister(o):((e,t)=>{const o=Ot(r._fields,e);o&&o._f&&(o._f.mount=t)})(o,!1)}),[o,r,n,a]),{swap:l.default.useCallback((e,t)=>{const n=r._getFieldArray(o);Yr(n,e,t),Yr(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,Yr,{argA:e,argB:t},!1)},[f,o,r]),move:l.default.useCallback((e,t)=>{const n=r._getFieldArray(o);Ur(n,e,t),Ur(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,Ur,{argA:e,argB:t},!1)},[f,o,r]),prepend:l.default.useCallback((e,t)=>{const n=or(Ct(e)),a=Gr(r._getFieldArray(o),n);r._names.focus=$r(o,0,t),u.current=Gr(u.current,n.map(Vr)),f(a),c(a),r._setFieldArray(o,a,Gr,{argA:qr(e)})},[f,o,r]),append:l.default.useCallback((e,t)=>{const n=or(Ct(e)),a=Hr(r._getFieldArray(o),n);r._names.focus=$r(o,a.length-1,t),u.current=Hr(u.current,n.map(Vr)),f(a),c(a),r._setFieldArray(o,a,Hr,{argA:qr(e)})},[f,o,r]),remove:l.default.useCallback(e=>{const t=Kr(r._getFieldArray(o),e);u.current=Kr(u.current,e),f(t),c(t),!Array.isArray(Ot(r._fields,o))&&jt(r._fields,o,void 0),r._setFieldArray(o,t,Kr,{argA:e})},[f,o,r]),insert:l.default.useCallback((e,t,n)=>{const a=or(Ct(t)),i=Wr(r._getFieldArray(o),e,a);r._names.focus=$r(o,e,n),u.current=Wr(u.current,e,a.map(Vr)),f(i),c(i),r._setFieldArray(o,i,Wr,{argA:e,argB:qr(t)})},[f,o,r]),update:l.default.useCallback((e,t)=>{const n=Ct(t),a=Xr(r._getFieldArray(o),e,n);u.current=[...a].map((t,r)=>t&&r!==e?u.current[r]:Vr()),f(a),c([...a]),r._setFieldArray(o,a,Xr,{argA:e,argB:n},!0,!1)},[f,o,r]),replace:l.default.useCallback(e=>{const t=or(Ct(e));u.current=t.map(Vr),f([...t]),c([...t]),r._setFieldArray(o,[...t],e=>e,{},!0,!1)},[f,o,r]),fields:l.default.useMemo(()=>s.map((e,t)=>({...e,[n]:u.current[t]||Vr()})),[s,n])}}({control:s,name:y}),{fields:v,append:b,replace:x}=g,w=((e,t)=>{if(e&&t)return t.split(".").reduce((e,t)=>{if(e&&"object"==typeof e)return e[t]},e)})(d,y),k=Array.isArray(w)&&w.length>0,_=t?h(t):void 0;let C;if(t&&p?.itemDataByDmfId&&(C=p.itemDataByDmfId[t]),void 0===C&&t&&(C=_),C&&"object"==typeof C&&!Array.isArray(C)&&t&&t in C){const e=C[t];Array.isArray(e)&&(C=e)}const M=e.useMemo(()=>Array.isArray(C)?C:C&&"object"==typeof C&&!Array.isArray(C)?[C]:void 0,[C]),S=Array.isArray(M)&&M.length>0;return e.useEffect(()=>{if(f.current)return;f.current=!0;const e=c?.(y);Array.isArray(e)&&e.length;const t=!!Array.isArray(e)&&e.some(fmt);if(!(k||t||v.length>0))if(S&&M)x(M);else if(o>0){Array.from({length:o},()=>({})).forEach(e=>{b(e,{shouldFocus:!1})})}},[]),e.useEffect(()=>{if(!S||!M)return;if(k)return;const e=c?.(y);!!Array.isArray(e)&&e.some(fmt)||x(M)},[S,M,k,c,y,x]),e.useEffect(()=>{k&&(console.group("🟡 [ReplicatorFormSetup] Syncing Prefill Array Data"),console.log("📋 Field Array Name:",y),console.log("📦 Prefill Array Value:",JSON.stringify(w,null,2)),console.log("🔢 Current Fields Length:",v.length),console.log("🔢 Prefill Array Length:",w.length),v.length!==w.length?(console.log("🔄 Replacing field array with prefill data"),x(w),console.log("✅ Field array replaced")):console.log("⏭️ Skipping replace - lengths match"),console.groupEnd())},[k,w,v.length,x,y]),e.useEffect(()=>{if(u)return u.register({replicatorId:t,fieldArrayName:y,fieldArrayMethods:g,minInstances:o,maxInstances:n}),()=>{u.unregister(t)}},[u,t,y,g,o,n]),at(JC,{replicatorFieldId:t,fieldArrayName:y,fieldArrayMethods:g,minInstances:o,maxInstances:n,children:a})};function gmt(e,t,r,o){const n={...e};return 0===r.length?{...e,...t}:(t&&o&&r.forEach(e=>{void 0!==t[e]&&(n[e]=t[e])}),n)}function vmt(e,t,r=!1){return t&&r?bn(e,t):e}const bmt=e=>"variable"===String(e||"").trim().toLowerCase().replace(/-/g,"_")?"variable":"data_model",xmt=e=>{if(null==e)return null;const t="object"==typeof e&&e&&"code"in e?e.code:e,r=String(t||"").trim().toLowerCase();return r?"bool"===r?"boolean":"enumerated_list"===r||"enumerated-list"===r||"enumeratedlist"===r||"enumerated"===r||"enum"===r||"picklist"===r||"pick_list"===r?"enumerated_list":r:null},wmt=e=>e?String(e.sourceDataModelFieldId||e.sourceDataPointerId||"").trim():"",kmt=({id:t,type:r,name:o,form:n,config:a,formData:i,isMobile:s,children:l,tabsProps:c,properties:u,moleculeLibraryId:d,organismLibraryMoleculeId:p,parentStyleVariantConfig:h,parentContainerWithVariantsId:f,parentContainerActiveVariant:m})=>{const y=Ye(),g=VC("xs"),v=s||g,{formId:b,isPreview:x=!1,validations:w,submitHandler:k,isConfigurationMode:_,onConfigurationItemClicked:C,selectedConfigurationItemId:M,currentStyleProperties:S,currentContentProperties:D,onInternalNavigation:P,organismMetadata:O,organismInfo:E,localState:j}=KC(),{stateConfig:T}=yM(),N=vM(),R=T,I=ht(),F=u?.dataCapture,A=a?.props?.dataCaptureName||F?.dataCaptureName||F?.variableName||t,z=e.useMemo(()=>{if(!b||!I?.nestedPathSegments?.length)return A;var e,t;return e=I.nestedPathSegments,t=A,e&&0!==e.length?[...e.map(e=>{const t=e.sourceDataPointerId||e.dmfId;return void 0!==e.index?`${t}.${e.index}`:t}),t].filter(Boolean).join("."):t},[b,I?.nestedPathSegments,A]),L=u?.dataCapture,B=bmt(L?.nature),V="variable"===B&&L?.variableName||wmt(L),$=L?.predefinedValue,H=!L?.isIgnored&&("variable"===B&&Boolean(L?.variableName?.trim())||"data_model"===B&&Boolean(wmt(L))),q=e=>{if(!e||e.isIgnored)return;return"variable"===bmt(e.nature)?e.variableName||wmt(e)||void 0:wmt(e)||void 0},W=m??I.activeVariant??null,U=bmt(L?.nature),G=e.useMemo(()=>!L||L.isIgnored?"":"variable"===U?String(L.variableName||"").trim():wmt(L),[L,U]),K=xmt(L?.dataType),Y=!0===L?.useOwnValueForStyleVariant,X="variable"===U||(e=>{const t=xmt(e);return"boolean"===t||"enumerated_list"===t})(K),Z=Y&&X,Q=bKe(G||"__zeal_variant_source_missing__"),J=e.useMemo(()=>{if(!Z||!G)return;if("variable"===U)return{enabled:!0,nature:"variable",variableName:G};const e=String(L?.sourceDataModelFieldId||G).trim()||G;return{enabled:!0,nature:"data_model",sourceDataPointerId:String(L?.sourceDataModelFieldId||L?.sourceDataPointerId||e).trim()||e,sourceDataModelFieldId:e}},[L?.sourceDataModelFieldId,L?.sourceDataPointerId,U,Z,G]),ee=e.useMemo(()=>{if(!J||!G)return null;const e=dmt(J,{[G]:Q});return"string"==typeof e&&e.trim()?e:null},[J,G,Q]),te=e.useMemo(()=>Z?ee||(h?.enabled?W:null):W,[W,ee,Z,h?.enabled]),re=e.useMemo(()=>J?t:f||I.containerId||null,[I.containerId,t,J,f]),oe=J||h,ne=I?.isLoading??N?.isSingleRecordLoading??!1,ae=e.useMemo(()=>((e,t)=>{if(!e)return{};const r=e.props&&"object"==typeof e.props&&!Array.isArray(e.props)?e.props:{};if(t){const o=e[t];if(o&&"object"==typeof o&&"props"in o){const e=o.props;if(e&&"object"==typeof e&&!Array.isArray(e))return bn(r,e)}}return r})(a,te??null),[a,te]),ie=M===t,{isStateDisabled:se,isStateVisible:le}=(({stateListenerId:e})=>{const{localStateObject:t}=KC(),{stateConfig:r}=yM(),o=t||r;let n=!0,a=!1;if(!e)return{isStateDisabled:a,isStateVisible:n};const i=o?.[e]||{},{visible:s=!0,disabled:l=!1}=i||{};return e in o&&(n=Boolean(s),a=Boolean(l)),{isStateDisabled:a,isStateVisible:n,stateValue:i}})({stateListenerId:t}),ce=e.useMemo(()=>({entityType:r,entity:"molecule",entityName:o,entityId:t,organismType:E?.type,organismSubtype:E?.subtype,organismLibraryMoleculeId:p,libraryEntityId:d,activeStyleVariant:te,parentReplicatorWithVariants:re,parentStyleVariantConfig:oe||void 0}),[r,o,t,p,d,te,re,oe]),ue=e.useCallback(e=>{e?.stopPropagation(),C(ce,!1)},[C,ce]),de=e.useCallback(e=>{e?.stopPropagation(),C(ce,!0)},[C,ce]),pe=_?{onClick:ue,onDoubleClick:de,"data-configuration-id":t,css:qrt({theme:y,selected:ie})}:{},he=_||se;if(!le)return null;if(ne&&(nmt(r)||H)){const e={width:ae.width,height:ae.height,marginLeft:ae.marginLeft||"0",marginTop:ae.marginTop||"0",marginRight:ae.marginRight||"0",marginBottom:ae.marginBottom||"0",paddingLeft:ae.paddingLeft,paddingTop:ae.paddingTop,paddingRight:ae.paddingRight,paddingBottom:ae.paddingBottom,fontSize:ae.fontSize,borderColor:ae.borderColor,backgroundColor:ae.backgroundColor,size:ae.size,text:u?.text?.text,subText:u?.subText?.text,maxValue:ae.maxValue,orientation:ae.orientation,sx:ae.sx};return at(amt,{type:r,props:e})}return(()=>{switch(r){case"simple_text":{const e={text:u?.text},r=["text"],{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie);return at(uht,{...n,text:o?.text||"",htmlElementId:t,configurationsItemInfo:pe})}case"text":{const e={text:u?.text},r=Object.keys(e),{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie);return at(cht,{...o,...n,htmlElementId:t,configurationItemInfo:pe})}case"consent":{const e=gmt(u,D,[],ie),r=vmt(ae,S,ie)||{};return at(lot,{...r,htmlElementId:t,properties:e,configurationItemInfo:pe})}case"signup_password_fields":{const e={text:u?.text,subText:u?.subText,placeholderText:u?.placeholderText,subPlaceholderText:u?.subPlaceholderText,validationText:u?.validationText},r=Object.keys(e),o=gmt(e,D,r,ie),{state:n,gap:i,...s}=vmt(a?.props,S,ie);return at(nft,{gap:i,inputProps:s,validations:w||[],htmlElementId:t,validationState:n,overridesProperties:o,configurationItemInfo:pe})}case"stepper":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={title:r?.title,subText:r?.subText},i=Object.keys(a),{title:s,subText:l}=gmt(a,D,i,t);return{...n,...vmt(o?.props,S,t),title:s?.text||"",subText:l?.text||""}});return at(Oft,{...e,items:r||[],isMobile:v,moleculeId:t,configurationItemInfo:pe})}case"checklist":{const e=vmt(ae,S,ie)||{},r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{};switch(e.type){case"checklist_item":{const a={label:r?.label,objectState:r?.objectState},i=Object.keys(a),s=gmt(a,D,i,t),l=vmt(o?.props,S,t)||{},c=s.label?.text||"",u=!!s.objectState?.pmiObjectId;return{...n,...l,type:"checklist_item",label:c,textColor:l.textColor||"#000",fontSize:l.fontSize||"14px",fontFamily:l.fontFamily||"inherit",fontWeight:l.fontWeight||"normal",textAlign:l.textAlign||"left",isSystemDriven:u,disabled:u,interacted:R?.[e.id]?.interacted||"unchecked"}}case"divider_item":{const e=vmt(o?.props,S,t)||{};return{...n,...e,type:"divider_item"}}case"text_item":{const e={text:r?.text},a=Object.keys(e),i=gmt(e,D,a,t),s=vmt(o?.props,S,t)||{},l=i.text?.text||"";return{...n,...s,type:"text_item",text:l}}case"rich_text_item":{const e={text:r?.text},a=Object.keys(e),i=gmt(e,D,a,t),s=vmt(o?.props,S,t)||{},l=i.text?.text||Y5e;return{...n,...s,type:"rich_text_item",text:l}}default:return{...n,type:e.type}}});return at(iot,{...e,items:r||[],moleculeId:t,configurationItemInfo:pe})}case"accordion":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={text:r?.text,subText:r?.subText,bodyText:r?.bodyText},i=Object.keys(a),{text:s,subText:l,bodyText:c}=gmt(a,D,i,t);return{...n,...vmt(o?.props,S,t),text:s?.text||"",subText:l?.text||"",bodyText:c?.text||""}});return at(Urt,{...e,items:r||[],moleculeId:t,configurationItemInfo:pe})}case"menu":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie),i=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={disabled:r&&"disabled"in r?r.disabled:void 0,text:r&&"text"in r?r.text:void 0,link:r&&"link"in r?r.link:void 0},i=Object.keys(a),{text:s,disabled:l,link:c}=gmt(a,D,i,t),u=vmt(o?.props,S,t);return{...n,...u,disabled:R?.[e.id]?R?.[e.id]?.disabled:l?.value||u?.disabled||!1,text:s?.text||"Menu Item",link:c}});return at(Zht,{...a,items:i||[],moleculeId:t,buttonText:o?.text||"Open Menu",configurationItemInfo:pe,buttonDisabled:R?.[t]?R?.[t]?.disabled:n?.value||a?.disabled||!1})}case"tabs":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o}=e||{},n={label:r?.label,link:r?.link},a=Object.keys(n),{label:i,link:s}=gmt(n,D,a,t);return{...vmt(o?.props,S,t),id:e.id,tabKey:V9e(s)?I9e(nM,s?.internalLink):void 0,label:i?.text||"",link:s}}),o=c?.tabs.map(e=>{const{text:t,...r}=e;return{...r,label:t||""}}),n=Boolean(e?.isTabsSystemDerived),a=n?o:r,i=c?.activeTabKey||a?.[0]?.tabKey||"";return at(Tft,{...e,items:a||[],isMobile:v,moleculeId:t,activeTabKey:i,configurationItemInfo:pe,onTabChange:_?void 0:({newTabKey:e,link:t})=>{n?c?.onTabChange?.(e):V9e(t)?P?.({link:t?.internalLink||""}):L9e(t?.externalLink)}})}case"breadcrumbs":{const e={text:u?.text},r=Object.keys(e),{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie),a=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={text:r?.label||r?.text,link:r?.link||r?.link,disabled:r?.disabled},i=Object.keys(a),{text:s,link:l,disabled:c}=gmt(a,D,i,t),u=vmt(o?.props,S,t)||{};return{id:n.id||e.id,text:s?.text||u.text||u.label||n.name||"Breadcrumb item",link:l,disabled:R?.[e.id]?R?.[e.id]?.disabled:c?.value||u.disabled||!1,iconName:u.iconName,sx:u.sx}}),i=Array.isArray(n.items)?n.items.filter(e=>!!e&&"object"==typeof e).map((e,t)=>({id:String(e.id||`breadcrumb-item-${t+1}`),text:String(e.text||e.label||`Item ${t+1}`),link:e.link,disabled:Boolean(e.disabled),iconName:"string"==typeof e.iconName?e.iconName:void 0,sx:e.sx})):[],s=a&&a.length>0?a:i;return at(not,{...n,text:o?.text||n.text||"",moleculeId:t,items:s,configurationItemInfo:pe,onNavigate:e=>{e&&!he&&(V9e(e)?e.internalLink&&P?.({link:e.internalLink}):e.externalLink&&L9e(e.externalLink))}})}case"divider":{const e=vmt(ae,S,ie);return at(iht,{moleculeId:t,configurationItemInfo:pe,...e})}case"progress":{const e={text:u?.text,dataCapture:u?.dataCapture},r=Object.keys(e),{text:o,dataCapture:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie),i=q(n)||V,s=a,l={...s.label&&"object"==typeof s.label?s.label:{},...o?.text?{text:o.text}:{}};return at(gft,{...a,moleculeId:t,label:l,sourceDataModelField:i,configurationItemInfo:pe})}case"link":{const e={text:u?.text,link:u?.link},r=Object.keys(e),{text:o,link:n}=gmt(e,D,r,ie),a=n,i=vmt(ae,S,ie);return at(Yht,{moleculeId:t,...i,link:a,type:a?.type,src:he?void 0:W9e(a,x)||"",text:o?.text||"",disabled:i?.disabled||se,configurationItemInfo:pe})}case"data_driven_link":{const e={text:u?.text},r=Object.keys(e),{text:o}=gmt(e,D,r,ie),n=vmt(ae,S,ie);return at(Yht,{moleculeId:t,...n,text:o?.text||"",sourceDataModelField:V,disabled:n?.disabled||se,configurationItemInfo:pe})}case"video":{const e={video:u?.video,coverImage:u?.coverImage,dataCapture:u?.dataCapture},r=Object.keys(e),{video:o,coverImage:n,dataCapture:a}=gmt(e,D,r,ie),i=vmt(ae,S,ie),s=q(a);return at(Fft,{...i,moleculeId:t,poster:n?.imageFile?.url,src:o?.videoSource??o?.videoFile?.url??"",sourceDataModelField:s,configurationItemInfo:pe})}case"badge":{const e={text:u?.text,dataCapture:u?.dataCapture},t=Object.keys(e),{dataCapture:r}=gmt(e,D,t,ie),o=vmt(ae,S,ie),n=q(r);return at(Yrt,{sourceDataModelField:n,...o,configurationItemInfo:pe})}case"alert":{const e={text:u?.text,subText:u?.subText},t=Object.keys(e),{text:r,subText:o}=gmt(e,D,t,ie),n=vmt(ae,S,ie);return at(Grt,{text:r?.text||"",subText:o?.text||"",...n,configurationItemInfo:pe})}case"chip":{const e={text:u?.text,dataCapture:u?.dataCapture},t=Object.keys(e),{text:r,dataCapture:o}=gmt(e,D,t,ie),n=vmt(ae,S,ie),a=q(o);return at(sot,{text:r?.text||"",sourceDataModelField:a,...n,configurationItemInfo:pe})}case"email_display_field":case"email_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(Ght,{name:z,text:o?.text||"",placeholderText:n?.text||"",sourceDataModelField:V,required:a?.value,isDisplayOnly:"email_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,...l,configurationItemInfo:pe})}case"phone_number_display_field":case"phone_number_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(uft,{name:z,text:o?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,isDisplayOnly:"phone_number_display_field"===r,...l,configurationItemInfo:pe})}case"numeric_display_field":case"numeric_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(eft,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"numeric_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,...l,configurationItemInfo:pe})}case"currency_display_field":case"currency_input_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(pot,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"currency_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,...l,configurationItemInfo:pe})}case"basic_text_display_field":case"basic_text_field":{const e={text:u?.text,placeholderText:u?.placeholderText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,placeholderText:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(rot,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"basic_text_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:V,...l,configurationItemInfo:pe})}case"rating_display_field":case"rating":{const e={text:u?.text,dataCapture:u?.dataCapture,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,required:n,requiredErrorText:a,validationErrorText:i}=gmt(e,D,t,ie),s=vmt(ae,S,ie);return at(vft,{name:z,text:o?.text||"",required:n?.value,requiredErrorText:a?.text,validationErrorText:i?.text,sourceDataModelField:V,isDisplayOnly:"rating_display_field"===r,...s,configurationItemInfo:pe})}case"switch_display_field":case"switch":{const e={text:u?.text,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{text:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,o,ie),l=vmt(ae,S,ie);return at(jft,{name:z,moleculeId:t,text:n?.text||"",required:a?.value,isDisplayOnly:"switch_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:V,...l,configurationItemInfo:pe})}case"slider_display_field":case"slider":{const e={text:u?.text,required:u?.required,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{text:o,required:n,requiredErrorText:a,validationErrorText:i,placeholderText:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(Dft,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:"slider_display_field"===r,requiredErrorText:a?.text,validationErrorText:i?.text,placeholderText:s?.text,sourceDataModelField:V,...l,configurationItemInfo:pe})}case"date_display_field":case"date_picker":{const e={text:u?.text,required:u?.required,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{text:n,required:a,placeholderText:i,requiredErrorText:s,validationErrorText:l}=gmt(e,D,o,ie),c=vmt(ae,S,ie);return at(Sit,{dateAdapter:Mat,children:at(aht,{moleculeId:t,name:z,text:n?.text||"",required:a?.value,placeholderText:i?.text||"",isDisplayOnly:"date_display_field"===r,requiredErrorText:s?.text,validationErrorText:l?.text,sourceDataModelField:V,...c,configurationItemInfo:pe})})}case"time_picker_display":case"time_picker":{const e={text:u?.text,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText,required:u?.required},t=Object.keys(e),{text:o,placeholderText:n,requiredErrorText:a,validationErrorText:i,required:s}=gmt(e,D,t,ie),l=vmt(ae,S,ie);return at(Sit,{dateAdapter:Mat,children:at(Ift,{...l,name:z,text:o?.text||"",placeholderText:n?.text||"",required:s?.value,requiredErrorText:a?.text,validationErrorText:i?.text,isDisplayOnly:"time_picker_display"===r,sourceDataModelField:V,configurationItemInfo:pe})})}case"select_display_field":case"select":{const e={text:u?.text,required:u?.required,placeholderText:u?.placeholderText,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText,dataDrivenOptions:u?.dataDrivenOptions},t=Object.keys(e),{text:o,required:n,placeholderText:a,requiredErrorText:i,validationErrorText:s,dataDrivenOptions:l}=gmt(e,D,t,ie),c=vmt(ae,S,ie),d="select_display_field"===r;return at(Sft,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:d,predefinedValue:$,placeholderText:a?.text||"",requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:V,dataDrivenOptions:l,...c,configurationItemInfo:pe})}case"image":{const e={image:u?.image,link:u?.link,dataCapture:u?.dataCapture},r=Object.keys(e),{image:o,link:n,dataCapture:a}=gmt(e,D,r,ie),i=vmt(ae,S,ie),s=q(a);return at(sht,{...i,src:o?.imageSource||o?.imageFile?.url||o?.imageFile?.id||"",sourceDataModelField:s,onClick:n?()=>V9e(n)?P?.({link:n?.internalLink||""}):L9e(n?.externalLink):void 0,moleculeId:t,configurationItemInfo:pe,properties:{image:o,link:n}})}case"button":{const e={text:u?.text,action:u?.action},r=Object.keys(e),{text:o,action:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie);return at(GKe,{moleculeId:t,text:o?.text||"",sourceDataModelField:V,...a,disabled:a?.disabled||se,configurationItemInfo:pe,properties:{text:o,action:n}})}case"avatar":{const e=vmt(ae,S,ie);return at(Krt,{...e,sourceDataModelField:V,configurationItemInfo:pe})}case"icon_display_field":{const e={dataCapture:u?.dataCapture},t=Object.keys(e),{dataCapture:r}=gmt(e,D,t,ie),o=vmt(ae,S,ie),n=q(r)||V;return at(Kht,{...o,sourceDataModelField:n,configurationItemInfo:pe})}case"drawer":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=gmt(e,D,r,ie),a=vmt(ae,S,ie),i=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{};let a={},i=[];switch(e.type){case"menu_item":{const e=r;a={disabled:e?.disabled,text:e?.text,link:e?.link},i=Object.keys(a);break}case"text_item":{const e=r;a={text:e?.text},i=Object.keys(a);break}case"rich_text_item":{const e=r;a={text:e?.text},i=Object.keys(a);break}case"image_item":{const e=r;a={image:e?.image,alt:e?.alt,link:e?.link},i=Object.keys(a);break}default:a={},i=[]}const s=gmt(a,D,i,t),l=vmt(o?.props,S,t),c={...n,...l};switch(e.type){case"menu_item":return{...c,disabled:R?.[e.id]?R?.[e.id]?.disabled:s?.disabled?.value||l?.disabled||!1,text:s?.text?.text||"Menu Item",link:s?.link,sx:l?.sx||c.sx};case"text_item":return{...c,text:s?.text?.text||""};case"rich_text_item":return{...c,text:s?.text?.text||Y5e};case"image_item":{const e=s?.image?.imageSource||s?.image?.imageFile?.url||"";return{...c,src:e,alt:s?.alt?.text||"Drawer image",link:s?.link}}default:return c}});return at(Hht,{...a,items:i||[],moleculeId:t,buttonText:o?.text||a?.buttonText,buttonDisabled:R?.[t]?R?.[t]?.disabled:n?.value||a?.disabled||!1,configurationItemInfo:pe})}case"speed_dial":{const e=vmt(ae,S,ie),r=l?.map(e=>{const t=M===e.id,{properties:r,config:o,...n}=e||{},a={link:r?.link,text:r?.text},i=Object.keys(a),s=gmt(a,D,i,t),l=vmt(o?.props,S,t);return{...n,config:{props:{...o?.props,...l,tooltipText:l?.tooltipText||""}},properties:{link:s?.link||r?.link,text:s?.text||r?.text}}});return at(Pft,{...e,items:r||[],moleculeId:t,configurationItemInfo:pe})}case"checkbox":case"checkbox_display":{const e={label:u?.label,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{label:n,required:a,requiredErrorText:i,validationErrorText:s}=gmt(e,D,o,ie),l=vmt(ae,S,ie);return at(aot,{name:z,moleculeId:t,label:n?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:V,isDisplayOnly:"checkbox_display"===r,...l,configurationItemInfo:pe})}case"binary_radio_buttons":case"binary_radio_buttons_display":{const e={confirmText:u?.confirmText,rejectText:u?.rejectText,required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},o=Object.keys(e),{confirmText:n,rejectText:a,required:i,requiredErrorText:s,validationErrorText:l}=gmt(e,D,o,ie),c=vmt(ae,S,ie);return at(oot,{name:z,moleculeId:t,confirmText:n?.text||"Yes",rejectText:a?.text||"No",required:i?.value,requiredErrorText:s?.text,validationErrorText:l?.text,sourceDataModelField:V,isDisplayOnly:"binary_radio_buttons_display"===r,...c,configurationItemInfo:pe})}case"date_calendar":case"date_calendar_display":{const e={required:u?.required,requiredErrorText:u?.requiredErrorText,validationErrorText:u?.validationErrorText},t=Object.keys(e),{required:o,requiredErrorText:n,validationErrorText:a}=gmt(e,D,t,ie),i=vmt(ae,S,ie);return at(Alt,{...i,name:z,required:o?.value,requiredErrorText:n?.text,validationErrorText:a?.text,isDisplayOnly:"date_calendar_display"===r,sourceDataModelField:V,configurationItemInfo:pe})}default:return at(nt,{children:"There is no such type of molecule yet."})}})()},_mt=({nestedPathSegments:t})=>{const{localStateObject:r}=KC(),o=ht();return e.useMemo(()=>{if(o?.itemDataByDmfId)return o.itemDataByDmfId;const e=(e=>{if(null!=e){if("object"==typeof e&&!Array.isArray(e)){const t=e;if("viewType"in t&&"data"in t){const e=t.data;if(null==e)return;return e}if("data"in t){const e=t.data;if(null==e)return;if("object"==typeof e)return e}}return e}})(r);return void 0!==e?0===t.length||Array.isArray(e)?e:kKe(e,t):void 0},[o?.itemDataByDmfId,r,t])},Cmt=e=>"container"===e.instance&&"empty_state"===e.type,Mmt=e=>{if("container"!==e.instance)return;const t=e;return t.replicatorFieldId||t.config?.props?.replicatorFieldId||t.sourceDataPointerId||t.config?.props?.sourceDataPointerId||t.targetRwoId||t.config?.props?.targetRwoId},Smt=e=>null==e||Array.isArray(e)&&0===e.length||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length,Dmt=e=>{if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=Object.values(e);return 0===t.length||t.every(e=>Array.isArray(e)&&0===e.length)},Pmt=e=>{if(Smt(e))return!0;if(e&&"object"==typeof e&&!Array.isArray(e)){const t=e;if("viewType"in t&&"data"in t){const e=t.data;if(Smt(e))return!0;if(Dmt(e))return!0}if("data"in t){const e=t.data;if(Smt(e))return!0;if(Dmt(e))return!0}}return!1},Omt=({containerItems:t,visibleItems:r,nestedPathSegments:o})=>{const{isLoadingData:n,isEmptyDataState:a,forceEmptyStatePreview:i,previewingEmptyStates:s,isConfigurationMode:l}=KC(),c=wKe(),u=vM(),d=_mt({nestedPathSegments:o}),p=e.useMemo(()=>{if(!t||0===t.length)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const e=t.filter(Cmt);if(0===e.length)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const o=s&&s.length>0;if(l&&!i&&!o)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const p=(e=>{const t=e.filter(e=>"container"===e.instance&&"replicator"===e.type);if(1!==t.length)return[];const r=t[0],o=[r.replicatorFieldId,r.config?.props?.replicatorFieldId,r.sourceDataPointerId,r.config?.props?.sourceDataPointerId,r.targetRwoId,r.config?.props?.targetRwoId].filter(Boolean);return Array.from(new Set(o))})(r),h=Boolean(u?.isSingleRecordLoading)||Boolean(u?.queryResults&&Object.values(u.queryResults).some(e=>e?.isLoading)),f=e.some(e=>{const t=Mmt(e),r=t?[t]:p;return r.length>0?(o=r,!(!u?.queryResults||0===o.length)&&o.some(e=>u.queryResults?.[e]?.isLoading)):h;var o});if((n||f)&&!i&&!o){return{filteredItems:r.filter(e=>!Cmt(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1}}const m=new Set;let y=!1;if(e.forEach(e=>{const t=Mmt(e),r=t?[t]:p;if(i)return void(r.length>0?r.forEach(e=>m.add(e)):y=!0);const o=r.length>0?r.some(e=>s?.includes(e)):s?.includes("__organism__");if(o)r.length>0?r.forEach(e=>m.add(e)):y=!0;else if(!l)if(r.length>0){const e=r.every(e=>{const t=c(e);if(void 0!==t){const r=((e,t)=>{if(!e||"object"!=typeof e||Array.isArray(e))return e;const r=e;if(t in r)return r[t];if("data"in r){const e=r.data;return e&&"object"==typeof e&&!Array.isArray(e)&&t in e?e[t]:e}return e})(t,e);return Pmt(r)}return!!u||((e,t)=>{if(!e)return!0;if(Array.isArray(e))return 0===e.length;if(Object.prototype.hasOwnProperty.call(e,t))return Smt(e[t]);const r=e.data;if(r&&"object"==typeof r&&!Array.isArray(r)){const e=r.data,o=e&&"object"==typeof e&&!Array.isArray(e)?e[t]:r[t];if(void 0!==o)return Smt(o)}const o=e.queryResults;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o.data,r=e&&"object"==typeof e&&!Array.isArray(e)?e[t]:o[t];if(void 0!==r)return Smt(r)}return!0})(d,e)});e&&r.forEach(e=>m.add(e))}else if(u?.queryResults&&Object.keys(u.queryResults).length>0){const e=Object.values(u.queryResults).every(e=>Pmt(e?.data));y=e}else a&&(y=!0)}),!y&&0===m.size){return{filteredItems:r.filter(e=>!Cmt(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1}}const g=r.filter(e=>{if(Cmt(e)){const t=Mmt(e),r=t?[t]:p;return r.length>0?r.some(e=>m.has(e)):y}if(y)return!1;if(m.size>0&&"container"===e.instance&&"replicator"===e.type){const t=Mmt(e);if(t&&m.has(t))return!1}return!0});return{filteredItems:g,showingEmptyStateForFields:m,showOrganismLevelEmptyState:y}},[t,r,o,d,n,a,i,s,l,c,u?.queryResults,u?.isSingleRecordLoading]);return p},Emt=[],jmt=e.memo(({item:t,tabsProps:r,formData:o,setFormData:n,isMobile:a,parentId:i,nestedPathSegments:s=Emt,parentStyleVariantConfig:l,parentContainerWithVariantsId:c,parentContainerActiveVariant:u})=>{const d=Kt(),{organismMetadata:p}=KC(),h="items"in t?t.items:void 0,f=(({items:t})=>{const{stateConfig:r}=yM(),{localStateObject:o}=KC(),n=o||r;return e.useMemo(()=>t&&0!==t.length?t.filter(e=>{const t=e.config?.props?.visible??!0,r=n?.[e.id]?.visible??!0;return t&&r}):[],[t,n])})({items:h}),{filteredItems:m}=Omt({containerItems:h,visibleItems:f,nestedPathSegments:s});if("molecule"===t.instance)return at(imt,{additionalInfo:`molecule: ${t.id}`,children:at(kmt,{...t,form:d,isMobile:a,formData:o,parentId:i,tabsProps:r,setFormData:n,metadata:{...t.metadata,stateListenerId:p?.stateListenerId||t.id},parentStyleVariantConfig:l,parentContainerWithVariantsId:c,parentContainerActiveVariant:u})});const y=!(!h||!h.length),g="form"===t.type&&t.config.props?.activeChildrenIds||[];return y?g.length?at(imt,{additionalInfo:`form: ${t.id}`,children:at(Gmt,{item:t,activeChildrenIds:g,formData:o,setFormData:n,isMobile:a})}):at(imt,{additionalInfo:`container: ${t.id}`,children:at(Wmt,{...t,isMobile:a,nestedPathSegments:s,parentStyleVariantConfig:l,parentContainerWithVariantsId:c,parentContainerActiveVariant:u,config:t.config?{...t.config,props:t.config.props||{},wide:t.config.wide||{},compact:t.config.compact||{}}:{props:{},wide:{},compact:{}},children:m?.map(e=>at(jmt,{item:e,parentId:e.id,formData:o,setFormData:n,isMobile:a,tabsProps:r,nestedPathSegments:s},e.id))})}):null}),Tmt=({order:t=0,id:r,formStepStyles:o,containerProps:n={hasOwnButton:!1}})=>{const a=Kt(),[i,s]=e.useState({}),{formId:l,submitHandler:c,isFormInEditMode:u,organismMetadata:d,organismInfo:p}=KC(),{groupStepItemsByStepContainer:h}=KC();Object.keys(d?.popupPayload??{})[0];const{currentStep:f,canGoToNextStep:m,canGoToPrevStep:y,goToNextStep:g,goToPrevStep:v,reset:b,setStep:x}=eo(),w=h(),{submitForm:k}=SKe(),{forms:_}=dt(),C=t+1,M=w.get(r)||[];return f!==C?null:at("div",{style:o,children:it(nt,{children:[M.map(e=>at(jmt,{item:e,setFormData:s,formData:i},e.id)),(!n?.hasOwnButton||d?.isFormInsidePopUp)&&u&&it("div",{style:{display:"flex",gap:"16px"},children:[at(GKe,{text:y?"Back":"Cancel",variant:"outlined",onClick:()=>{y?v():(b(),x(1))}}),at(GKe,{text:m?"Next":"Submit",variant:"contained",onClick:async()=>{const e=await a.trigger();if(!e)return void O8e({message:"Please fill all required fields",type:"error"});if(m)return void g();const t=a?.getValues?.()||{};if(e&&l){const e={formId:l,data:t,pmiObjectId:p?.pmiObjectId};c?await c(e):_?.submit&&await k(e)}}})]})]})})},Nmt=t=>{const r=(t=>{if(!e.isValidElement(t))return;return t.props.item})(t);if(!r||"container"!==r.instance)return;const o=r.config?.props?.expandableSlot;return"title"===(n=o)||"body"===n?o:void 0;var n},Rmt=({children:t,defaultExpanded:r=!1,unmountOnExit:o=!1,forceExpanded:n=!1,disableToggle:a=!1})=>{const[i,s]=e.useState(r);e.useEffect(()=>{s(r)},[r]);const{titleNode:l,detailNodes:c}=e.useMemo(()=>{const r=e.Children.toArray(t),o=[];let n=null,a=null;r.forEach(e=>{const t=Nmt(e);"title"!==t||n?"body"!==t||a?o.push(e):a=e:n=e}),!n&&o.length>0&&(n=o.shift()??null),!a&&o.length>0&&(a=o.shift()??null);const i=[a,...o].filter(Boolean);return{titleNode:n,detailNodes:i}},[t]);return it(fu,{disableGutters:!0,square:!1,elevation:0,expanded:n||i,onChange:(e,t)=>{n||a||s(t)},slotProps:{transition:{unmountOnExit:o}},sx:{width:"100%",borderRadius:"inherit",backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}},children:[at(Hu,{expandIcon:at(Xf,{component:"span",sx:{fontSize:18,lineHeight:1},children:"▾"}),sx:{px:0,minHeight:0,"& .MuiAccordionSummary-content":{m:0,width:"100%"}},children:at(Xf,{sx:{width:"100%"},children:l||at("span",{children:"Expandable Section"})})}),at(vu,{sx:{px:0,py:0},children:at(Xf,{sx:{width:"100%"},children:c})})]})},Imt=e=>{if(!e)return{};const t={},r={},o={},n={};return void 0!==e.textColor&&(t.color=e.textColor),void 0!==e.backgroundColor&&(t.backgroundColor=e.backgroundColor),void 0!==e.borderColor&&(t.borderColor=e.borderColor),void 0!==e.borderStyle&&(t.borderStyle=e.borderStyle),void 0!==e.borderWidth&&(t.borderWidth=e.borderWidth),void 0!==e.borderRadius&&(t.borderRadius=e.borderRadius),void 0!==e.fontSize&&(t.fontSize=e.fontSize),void 0!==e.fontWeight&&(t.fontWeight=e.fontWeight),void 0!==e.fontFamily&&(t.fontFamily=e.fontFamily),void 0!==e.minHeight&&(t.minHeight=e.minHeight),void 0!==e.minWidth&&(t.minWidth=e.minWidth),void 0!==e.paddingX&&(t.paddingLeft=e.paddingX,t.paddingRight=e.paddingX),void 0!==e.paddingY&&(t.paddingTop=e.paddingY,t.paddingBottom=e.paddingY),void 0!==e.activeTextColor&&(r.color=e.activeTextColor),void 0!==e.activeBackgroundColor&&(r.backgroundColor=e.activeBackgroundColor),void 0!==e.hoverTextColor&&(o.color=e.hoverTextColor),void 0!==e.hoverBackgroundColor&&(o.backgroundColor=e.hoverBackgroundColor),void 0!==e.disabledTextColor&&(n.color=e.disabledTextColor),void 0!==e.disabledBackgroundColor&&(n.backgroundColor=e.disabledBackgroundColor),void 0!==e.disabledOpacity&&(n.opacity=e.disabledOpacity),{base:t,active:r,hover:o,disabled:n}},Fmt=(...e)=>e.reduce((e,t)=>({base:{...e.base||{},...t?.base||{}},active:{...e.active||{},...t?.active||{}},hover:{...e.hover||{},...t?.hover||{}},disabled:{...e.disabled||{},...t?.disabled||{}}}),{}),Amt=(...e)=>Fmt(...e.map(e=>Fmt(Imt(e?.simple),e?.sx))),zmt=({tabs:t,defaultTabKey:r,activeTabKey:o,keepMounted:n=!0,orientation:a="horizontal",variant:i="standard",scrollButtons:s="auto",allowScrollButtonsMobile:l=!0,tabsStyles:c,onTabChange:u,children:d})=>{const p=e.useMemo(()=>e.Children.toArray(d).map((t,r)=>{if(e.isValidElement(t)){const e=t.props?.item,o=`tab-panel-${r+1}`;return{id:e?.id||o,label:e?.name||`Tab ${r+1}`,content:t}}return{id:`tab-panel-${r+1}`,label:`Tab ${r+1}`,content:t}}),[d]),h=e.useMemo(()=>p.map((e,r)=>({key:e.id||`tab-panel-${r+1}`,label:t?.[r]?.label||e.label||`Tab ${r+1}`,iconName:t?.[r]?.iconName,iconColor:t?.[r]?.iconColor,iconSize:t?.[r]?.iconSize,iconPosition:t?.[r]?.iconPosition,disabled:t?.[r]?.disabled,styles:t?.[r]?.styles,content:e.content})),[t,p]),f=h[0]?.key||"",m=o||r||f,y=void 0!==o,[g,v]=e.useState(m),b=y?o||"":g;if(e.useEffect(()=>{if(y)return;if(!h.length)return;if(h.some(e=>e.key===g))return;const e=h.some(e=>e.key===m)?m:h[0].key;e&&e!==g&&v(e)},[y,g,m,h]),!h.length)return null;const x=Math.max(h.findIndex(e=>e.key===b),0),w=h[x]?.key||f;return it(Xf,{"data-testid":"tabs-container-root",sx:{display:"flex",flexDirection:"vertical"===a?"row":"column"},children:[at(Xf,{"data-testid":"tabs-container-header",sx:c?.headerSx||{},children:at(hC,{value:x,onChange:(e,t)=>{const r=h[t];r&&(y||v(r.key),u?.(r.key))},orientation:a,variant:i,scrollButtons:s,allowScrollButtonsMobile:l,sx:{...c?.tabsSx||{},"& .MuiTabs-indicator":{...c?.indicatorSx||{}}},children:h.map(e=>{const t=Amt(c?.tab,e.styles?.tab),r=e.iconName?at(tKe,{iconName:e.iconName,color:e.iconColor,size:e.iconSize||16}):void 0;return at(p_,{disableRipple:!0,disabled:e.disabled,label:e.label,icon:r,iconPosition:r?e.iconPosition||"start":void 0,"data-testid":`tabs-container-tab-${e.key}`,sx:{textTransform:"none",...t.base||{},"&.Mui-selected":{...t.base||{},...t.active||{}},"&:hover":{...t.hover||{}},"&.Mui-disabled":{...t.disabled||{},"&.Mui-selected":{...t.disabled||{}},"&:hover":{...t.disabled||{}}}}},e.key)})})}),at(Xf,{"data-testid":"tabs-container-panels",sx:{flex:1,minWidth:0,width:"100%"},children:h.map(e=>{const t=e.key===w;return n||t?at(Xf,{role:"tabpanel",hidden:!t,"data-testid":`tabs-container-panel-${e.key}`,sx:{width:"100%",...c?.panelSx||{},...e.styles?.panelSx||{},...t?{}:{display:"none"}},children:at(If,{in:t,timeout:{enter:220,exit:0},children:at(Xf,{sx:{width:"100%"},children:e.content})})},e.key):null})})]})},Lmt={mapSimpleValueToStateSx:Imt,mergeStateSx:Fmt,mergeTabStyleContracts:Amt},Bmt={dots:!0,infinite:!1,autoplay:!1,autoplaySpeed:5e3,arrows:!0,slidesToShow:1,slidesToScroll:1,adaptiveHeight:!0,swipeToSlide:!0},Vmt=e=>Boolean(e&&"object"==typeof e&&!Array.isArray(e)),$mt=e=>Vmt(e)?e:{},Hmt=(e,t)=>Vmt(e)?Vmt(t)?bn(e,t):e:t??e,qmt=[],Wmt=e.memo(({id:t,type:r,name:o,config:n,children:a,metadata:i,isMobile:s,properties:l,nestedPathSegments:c=qmt,sourceDataPointerId:u,replicatorFieldId:d,parentStyleVariantConfig:p,parentContainerWithVariantsId:h,parentContainerActiveVariant:f})=>{const m=Ye(),{props:y,wide:g,compact:v}=n||{},{isConfigurationMode:b,onConfigurationItemClicked:x,selectedConfigurationItemId:w,currentStyleProperties:k,currentContentProperties:_,formId:C,localState:M,organismInfo:S}=KC(),D=w===t,P=e.useMemo(()=>!(!D||!Vmt(k))&&(Vmt(k.props)||Vmt(k.wide)||Vmt(k.compact)),[D,k]),O=e.useMemo(()=>{const e=$mt(y);if(!P||!Vmt(k))return e;const t=$mt(k.props);return 0===Object.keys(t).length?e:bn(e,t)},[y,P,k]),E=e.useMemo(()=>{const e=$mt(g);if(!P||!Vmt(k))return e;const t=$mt(k.wide);return 0===Object.keys(t).length?e:bn(e,t)},[g,P,k]),j=e.useMemo(()=>{const e=$mt(v);if(!P||!Vmt(k))return e;const t=$mt(k.compact);return 0===Object.keys(t).length?e:bn(e,t)},[v,P,k]),T=u||O?.sourceDataPointerId,N=T||d,R=e.useMemo(()=>{if(!D||!Vmt(k))return null;if(!P)return k;const{props:e,wide:t,compact:r,...o}=k;return Object.keys(o).length>0?o:null},[D,k,P]),I=ht(),{activeVariant:F,containerId:A}=I,z=Kt(),L=Boolean(C&&z),B=p,V=f??F??null,$=h||A||null,H=e.useMemo(()=>{const r=B,o=V,n=h||t;return void 0!==r||null!==o||void 0!==h?e.Children.map(a,t=>e.isValidElement(t)?e.cloneElement(t,{...t.props,parentStyleVariantConfig:r,parentContainerWithVariantsId:n,parentContainerActiveVariant:o,sourceDataPointerId:T,nestedPathSegments:c}):t):a},[a,V,B,t,h,T,c]),q=D?{backgroundImage:_?.backgroundImage??l?.backgroundImage??{imageFile:{url:""}}}:l,{containerProps:W={},containerStyle:U={}}=E||{};let G={...U};const{containerProps:K={},containerStyle:Y={}}=j||{};let X={...Y};R&&D&&(X={...Y,...R},G={...U,...R});const Z=VC("xs"),Q=s??Z;let J=Q?X:G;if(V&&n){const e=pmt(n,V,Q?"compact":"wide");Object.keys(e).length>0&&(J=Hmt(J,e))}const ee=Q?K:W,te={...O,...ee,enableBackgroundImage:J?.enableBackgroundImage},re=e.useMemo(()=>({entityId:t,entityType:r,entityName:o,entity:"container",organismType:S?.type,organismSubtype:S?.subtype,libraryEntityId:i?.containerLibraryId||void 0,activeStyleVariant:V,parentReplicatorWithVariants:$,parentStyleVariantConfig:B}),[r,o,t,i,V,$,B]),oe=b?{onClick:e=>{e&&e.stopPropagation(),x(re,!1)},onDoubleClick:e=>{e?.stopPropagation(),x(re,!0)}}:{},ne=`${t}.${Q?"mobile":"desktop"}`,ae=_o`
1035
1035
  display: flex;
1036
1036
  position: relative; /* default containing block for absolute children */
1037
1037
  overflow: visible; /* allow positioned children to overflow */