@zealicsolutions/web-ui 1.0.140-beta.134 → 1.0.140-beta.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js
CHANGED
|
@@ -1028,7 +1028,7 @@
|
|
|
1028
1028
|
`,Fpt=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},Ipt=({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:x="0px",buttonPaddingRight:b="0px",buttonPaddingBottom:w="0px",buttonPaddingLeft:k="0px",buttonMarginTop:_="0px",buttonMarginRight:C="0px",buttonMarginBottom:M="0px",buttonMarginLeft:S="0px",buttonIconOnly:D,buttonElevation:O,buttonFillColor:P,buttonFillColorDisabled:E,buttonFillColorHover:j,buttonFillColorPressed:T,buttonBorderColor:N,buttonBorderColorDisabled:R,buttonBorderColorHover:F,buttonBorderColorPressed:I,buttonTextColorDisabled:A,buttonTextColorHover:z,buttonTextColorPressed:L,buttonColor:B="#1976d2",buttonDisabledColor:V,withCloseIcon:$=!0,closeIconColor:H=no.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:Z="50%",closeIconElevation:X=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=Ge(),{isConfigurationMode:ge,selectedConfigurationItemId:ve,onConfigurationItemClicked:xe,onInternalNavigation:be}=FC(),{updateDrawer:we,drawerContainerRef:ke,headerHeight:_e,isMobile:Ce}=DC(),[Me,Se]=e.useState(n),[De]=(()=>{try{return Spt()}catch{return[new URLSearchParams,()=>{}]}})(),Oe=e.useMemo(()=>{if(t)return t;const e=De.get(R7e),r=De.get(N7e);let o=null,n=null;if("undefined"!=typeof window)try{const e=new URLSearchParams(window.location.search);o=e.get(R7e),n=e.get(N7e)}catch(dJe){}return e||r||o||n||""},[t,De]);e.useEffect(()=>{Se(n)},[n]);const Pe=Boolean(ge&&(ve===Q||i.some(e=>e.id===ve))),Ee=()=>"permanent"===o||(ge?Pe: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,Pe,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(),xe?.(r,!1)},onDoubleClick:e=>{e.stopPropagation(),xe?.(r,!0)},"data-organism-id":e.id,css:Htt({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=K7e(t.internalLink);return!(!r||!Oe)&&r===Oe})(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 nt(yx,{sx:a,selected:r,onClick:()=>{if(t?.link){V7e(t.link)?be?.({link:t.link?.internalLink||""}):L7e(t.link?.externalLink)}},disabled:t.disabled,...o,children:[t.startIcon&&ot(PGe,{iconName:t.startIcon,color:t.textColor}),ot(Sd,{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&&ot(PGe,{iconName:t.endIcon,color:t.textColor})]},t.id)}case"divider_item":{const t=e;return ot(Jdt,{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 ot(opt,{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 ot(rpt,{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 ot(ept,{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){V7e(t.link)?be?.({link:t.link?.internalLink||""}):L7e(t.link?.externalLink)}},moleculeId:t.id,configurationItemInfo:o},t.id)}default:return null}},Re=Ce&&void 0!==ce?ce:le,Fe=ot(Ppt,{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:nt(Tpt,{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?nt(rt,{children:[ot(Rpt,{gap:de,scrollable:re,children:i.filter(e=>!Fpt(e)).map(Ne)}),i.filter(e=>Fpt(e)).map(Ne)]}):null,!!$&&(!!G||Ee())&&ot(Npt,{top:K,left:Y,borderRadius:Z,elevation:X,backgroundColor:U,onClick:e=>{e.stopPropagation();Ee()?Te(e,"closeIconClicked"):je()},"data-testid":"close-icon",children:ot(PGe,{"data-testid":"icon-renderer",iconName:q,size:W,color:H})})]})});return s&&"permanent"!==o?nt(rt,{children:[ot(HGe,{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:x,paddingRight:b,paddingBottom:w,paddingLeft:k,borderRadius:v,iconOnly:D,elevation:O,fillColor:P||B,fillColorDisabled:E||V,fillColorHover:j,fillColorPressed:T,borderColor:N,borderColorDisabled:R,borderColorHover:F,borderColorPressed:I,textColorDisabled:A,textColorHover:z,textColorPressed:L,externalOnClick:e=>Me?Te(e,"buttonClicked"):je(),configurationItemInfo:J}),ot(jpt,{children:Fe})]}):ot(jpt,{children:Fe})},Apt=e.forwardRef((e,t)=>{const{inputRef:r,...o}=e;return ot(FKe,{...o,ref:e=>{"function"==typeof r&&r(e?e.inputElement:null)},mask:GKe,guide:!0,placeholderChar:" "})}),zpt=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},Lpt=({masked:e,errorMsg:t,inputSx:r,labelSx:o,sx:n,variant:a="outlined",...i})=>{const s=e?{inputComponent:Apt}:{};return ot(oC,{...i,variant:a,error:!!t,helperText:t||null,type:"text",sx:{...n},slotProps:{input:{sx:{...r,...n},...s},inputLabel:{sx:{...o,...n}}}})},Bpt=({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:x="0",paddingLeft:b="0",paddingTop:w="0",paddingRight:k="0",paddingBottom:_="0",width:C,height:M,minHeight:S,maxHeight:D,minWidth:O,maxWidth:P,sx:E,name:j,sourceDataModelField:T,configurationItemInfo:N,inputSize:R="medium",labelOffset:F,hideLabel:I=!1,variant:A="outlined"})=>{const z=Ut(),L=z?.control,B=!(!L||!j),{localStateObject:V}=FC(),{stateConfig:$}=WC(),H=dt(),q=V||$,W=T?q?.[T]?.value:void 0,U=T?H?.getDmfValue(T):void 0;e.useState("");const[G,K]=e.useState(""),Y={required:!!r&&o,pattern:{value:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@(([^<>()[\]\\.,;:\s@"]+\.)+[^<>()[\]\\.,;:\s@"]{2,})$/,message:n}},Z=e.useMemo(()=>{if(I)return;if(void 0!==F)return F;const e=zpt(w),t=zpt(_);let r=0;r=void 0!==e&&void 0!==t?e+t:"small"===R?17:33;const o=zpt(M)||zpt(S)||zpt(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,F,R,p,w,_,I]),X=e.useMemo(()=>{if(I)return;const e="small"===R?-6:-9,t=zpt(M)||zpt(S)||zpt(D);return!t||t>=36?e:-6},[M,S,D,R,I]);if(t){let e="";e=void 0!==U?String(U??""):B?z.watch(j)||"":W||"";const t=e||i||"-";return nt("div",{style:{display:"inline-flex",flexDirection:"column",marginLeft:y,marginTop:g,marginRight:v,marginBottom:x,...C&&{width:C},...M&&{height:M},minHeight:S,maxHeight:D,minWidth:O,maxWidth:P},...N,children:[a&&ot(vg,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,marginLeft:0,marginBottom:"4px",...E},children:a}),ot(Sd,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,paddingLeft:b,paddingTop:w,paddingRight:k,paddingBottom:_,backgroundColor:c,border:`1px solid ${u||"#ccc"}`,borderRadius:"4px",minWidth:"120px",textAlign:m,...E},children:t})]})}const Q={backgroundColor:c,color:d,fontSize:p,fontFamily:h,fontWeight:f,...C&&{width:C},...M&&{height:M},...O&&{minWidth:O},...P&&{maxWidth:P},...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:b,paddingTop:w,paddingRight:k,paddingBottom:_}},J={color:d,"&.Mui-focused":{color:d},...I&&{display:"none"},...void 0!==Z&&{"&.MuiInputLabel-outlined:not(.MuiInputLabel-shrink)":{transform:`translate(14px, ${Z}px) scale(1)`},"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:`translate(14px, ${X}px) scale(0.75)`}}},ee=l?3:1,te={...C&&{width:C},...M&&{height:M},...O&&{minWidth:O},...P&&{maxWidth:P},...S&&{minHeight:S},...D&&{maxHeight:D}};return ot("div",B?{style:{marginLeft:y,marginTop:g,marginRight:v,marginBottom:x,...C&&{width:C},...M&&{height:M},minHeight:S,maxHeight:D,minWidth:O,maxWidth:P},sx:{"& .MuiTextField-root":{width:C||"100%",height:M,minHeight:S,maxHeight:D,minWidth:O,maxWidth:P},...E},children:ot(Jt,{name:j,rules:Y,control:L,defaultValue:"",render:({field:e,fieldState:t})=>ot(Lpt,{masked:s,required:r,errorMsg:t.error?.message,inputSx:Q,labelSx:J,sx:{...te,...E},size:R,variant:A,label:I?void 0:a,placeholder:i,multiline:l,minRows:ee,value:e.value||"",onChange:e.onChange,...N||{}})})}:{style:{marginLeft:y,marginTop:g,marginRight:v,marginBottom:x,...C&&{width:C},...M&&{height:M},minHeight:S,maxHeight:D,minWidth:O,maxWidth:P},sx:{"& .MuiTextField-root":{width:C||"100%",height:M,minHeight:S,maxHeight:D,minWidth:O,maxWidth:P},...E},children:ot(Lpt,{masked:s,required:r,errorMsg:void 0,inputSx:Q,labelSx:J,sx:{...te,...E},size:R,variant:A,label:I?void 0:a,placeholder:i,multiline:l,minRows:ee,value:G,onChange:e=>K(e.target.value),...N||{}})})},Vpt=({src:t,text:r,type:o,link:n,sourceDataModelField:a,color:i=no.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:x="0",paddingRight:b="0",paddingBottom:w="0",paddingLeft:k="0",fontFamily:_,fontWeight:C,fontSize:M,align:S,target:D,sx:O,borderColor:P,borderWidth:E,borderStyle:j,borderRadius:T,iconOnly:N,ariaLabel:R,iconName:F,iconSize:I,validationErrorText:A})=>{const{onStateChange:z}=GC(),{onInternalNavigation:L,isConfigurationMode:B,localStateObject:V}=FC();WC();const $=dt(),H=n&&$7e(n),q=e.useMemo(()=>H?q7e(n,$?.rawItemDataByDmfId):null,[n,H,$?.rawItemDataByDmfId]),W=H&&!q,U=e.useMemo(()=>{if(q)return q.destination;const e=n?V7e(n):"internalLink"===o||"internal_link"===o,r=n?e?n.internalLink:n.externalLink:void 0;return t??r??void 0},[q,n,o,t]),G=e.useMemo(()=>q?!q.isExternal:!!n&&V7e(n),[q,n]),K=e.useMemo(()=>D||(q?q.isExternal?"_blank":"_self":G?"_self":"_blank"),[D,q,G]),Y=s||W,Z=Y?l||to(i):i,X=B||Y?void 0:U,Q=Boolean(F),J="regular"===C?"normal":C,ee=N?ot(PGe,{iconName:F||"external-link",size:I??16}):nt(rt,{children:[ot("span",{children:r}),Q&&ot(PGe,{iconName:F,size:I??16})]}),{onClick:te,onDoubleClick:re,...oe}=f||{},ne=ot(pv,{href:X,component:"a",target:K,onClick:e=>{z({id:h,type:"clicked"});if(!s&&!W&&!B)return q?(e.preventDefault(),void(q.isExternal?L7e(q.destination):L?.({link:q.destination,webpageAlias:q.webpageAlias,query:q.recordId?{rwoRecordId:q.recordId}:void 0}))):G&&U?(e.preventDefault(),void L?.({link:U})):void(!G&&U&&(e.preventDefault(),L7e(U)));e.preventDefault()},onClickCapture:te||void 0,onDoubleClickCapture:re||void 0,"aria-label":N?R||r||"link":void 0,sx:{color:Z,textDecorationColor:Z,margin:d,padding:p,marginTop:m,marginRight:y,marginBottom:g,marginLeft:v,paddingTop:x,paddingRight:b,paddingBottom:w,paddingLeft:k,fontFamily:_,fontWeight:J,fontSize:M,textAlign:S,alignItems:"center",cursor:Y?"not-allowed":"pointer",borderColor:P,borderWidth:E,borderStyle:j,borderRadius:T,display:N||Q?"inline-flex":void 0,gap:Q&&!N?"4px":void 0,"& .MuiLink-root":{color:"inherit",textDecorationColor:"inherit"},"&:hover":{color:Y?Z:to(Z,.8),textDecorationColor:Y?Z:to(Z,.8)},"&:active":{color:Y?Z:to(Z,.6),textDecorationColor:Y?Z:to(Z,.6)},"&.Mui-disabled":{color:l||to(i),textDecorationColor:l||to(i),cursor:"not-allowed"},...O},align:S,variant:u,underline:c,...oe,children:ee});return ne},$pt=e=>({justifyContent:e.textAlign||"flex-start",backgroundColor:e.backgroundColor,paddingTop:e.paddingTop,paddingRight:e.paddingRight,paddingBottom:e.paddingBottom,paddingLeft:e.paddingLeft}),Hpt=({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:x,buttonFontSize:b,buttonFontWeight:w,buttonFontFamily:k,buttonDisabled:_=!1,buttonGap:C=0,buttonStartIcon:M,buttonEndIcon:S,buttonCornerRadius:D="0",buttonMarginTop:O="0",buttonMarginRight:P="0",buttonMarginBottom:E="0",buttonMarginLeft:j="0",buttonPaddingTop:T="0",buttonPaddingRight:N="0",buttonPaddingBottom:R="0",buttonPaddingLeft:F="0",buttonIconOnly:I,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:Z="bottom",anchorOriginHorizontal:X="left",transformOriginVertical:Q="top",transformOriginHorizontal:J="left",elevation:ee=3,sx:te,moleculeId:re,configurationItemInfo:oe})=>{const ne=Ge(),{isConfigurationMode:ae,selectedConfigurationItemId:ie,onConfigurationItemClicked:se,onInternalNavigation:le}=FC(),ce=dt?.(),[ue,de]=e.useState(null),[pe,he]=e.useState(!1),[fe]=(()=>{try{return Spt()}catch{return[new URLSearchParams,()=>{}]}})(),me=e.useMemo(()=>{const e=fe.get(R7e),t=fe.get(N7e);let r=null,o=null;if("undefined"!=typeof window)try{const e=new URLSearchParams(window.location.search);r=e.get(R7e),o=e.get(N7e)}catch(dJe){}return e||t||r||o||""},[fe]),ye=e=>{const t=e?.link;if(!t||!t.internalLink)return!1;const r=K7e(t.internalLink);return!(!r||!me)&&r===me},ge=Boolean(ae&&(ie===re||r.some(e=>e.id===ie))),ve=()=>he(!0),xe=()=>he(!1),be={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?nt(Gf,{children:[ot(HGe,{ref:de,text:g,variant:v,moleculeId:re,textColor:x,fontSize:b,fontWeight:w,fontFamily:k,disabled:_,gap:C,startIcon:M,endIcon:S,onClick:ve,marginTop:O,marginRight:P,marginBottom:E,marginLeft:j,paddingTop:T,paddingRight:N,paddingBottom:R,paddingLeft:F,borderRadius:D,iconOnly:I,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}),ot(dx,{open:ae?ge:pe,variant:"menu",anchorEl:ue,disablePortal:!0,disableScrollLock:!0,disableRestoreFocus:!0,disableEnforceFocus:!0,onClose:xe,anchorOrigin:{vertical:Z,horizontal:X},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":be["& .MuiMenu-list"],"& .MuiMenuItem-root":be["& .MuiMenuItem-root"],"& .MuiListItemText-primary":be["& .MuiListItemText-primary"],"& .MuiTypography-root":be["& .MuiTypography-root"]}}},sx:{...be,"& .MuiMenu-paper":be["& .MuiMenu-paper"]},children:r.map(e=>{const t=ie===e.id,r=ye(e),o=e.link&&$7e(e.link)?q7e(e.link,ce?.rawItemDataByDmfId):null,n=e.link&&$7e(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:Htt({theme:ne,selected:t})}:{};return nt(yx,{sx:$pt(e),selected:r,disabled:e.disabled||n,onClick:()=>{e?.link&&(o?o.isExternal?L7e(o.destination):le?.({link:o.destination,webpageAlias:o.webpageAlias,query:o.recordId?{rwoRecordId:o.recordId}:void 0}):V7e(e.link)?le?.({link:e.link?.internalLink||""}):L7e(e.link?.externalLink)),xe()},...l,children:[e.startIcon&&ot(PGe,{iconName:e.startIcon,color:e.textColor}),ot(Sd,{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&&ot(PGe,{iconName:e.endIcon,color:e.textColor})]},e.id)})})]}):ot(Qc,{id:re,sx:{...be,backgroundColor:p,border:`${y} solid ${m}`,borderRadius:d,boxShadow:0===ee?"none":ne?.shadows?.[ee]||ne?.shadows?.[3]},elevation:ee,...oe,children:ot(vv,{disablePadding:!0,children:r.map(e=>{const t=ie===e.id,r=ye(e),o=e.link&&$7e(e.link)?q7e(e.link,ce?.rawItemDataByDmfId):null,n=e.link&&$7e(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:Htt({theme:ne,selected:t})}:{};return nt(Cv,{disabled:e.disabled||n,sx:$pt(e),selected:r,onClick:()=>{e?.link&&(o?o.isExternal?L7e(o.destination):le?.({link:o.destination,webpageAlias:o.webpageAlias,query:o.recordId?{rwoRecordId:o.recordId}:void 0}):V7e(e.link)?le?.({link:e.link?.internalLink||""}):L7e(e.link?.externalLink))},...l,children:[e.startIcon&&ot(PGe,{iconName:e.startIcon,color:e.textColor}),ot($v,{primary:ot(Sd,{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&&ot(PGe,{iconName:e.endIcon,color:e.textColor})]},e.id)})})})},qpt=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 Wpt=({errorMsg:e,stepValue:t,minValue:r,allowNegative:o,inputSx:n,labelSx:a,variant:i="outlined",...s})=>ot(oC,{...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}}}),Upt=({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:x="0",marginBottom:b="0",paddingLeft:w="0",paddingTop:k="0",paddingRight:_="0",paddingBottom:C="0",width:M,height:S,configurationItemInfo:D,textAlign:O,minHeight:P,maxHeight:E,minWidth:j,maxWidth:T,sx:N,inputSize:R="medium",labelOffset:F,hideLabel:I=!1,variant:A="outlined"})=>{const z=Ut(),L=z?.control,B=!(!L||!m),{localStateObject:V}=FC(),{stateConfig:$}=WC(),H=dt(),q=V||$,W=y?q?.[y]?.value:void 0,U=y?H?.getDmfValue(y):void 0,[G,K]=e.useState(""),Y=parseFloat(f),Z=h?void 0:0,X={required:!!r&&o,pattern:{value:h?/^-?\d*(\.\d+)?$/:/^\d*(\.\d+)?$/,message:n}};h||(X.min={value:0,message:"Value cannot be less than zero"});const Q=e.useMemo(()=>{if(I)return;if(void 0!==F)return F;const e=qpt(k),t=qpt(C);let r=0;r=void 0!==e&&void 0!==t?e+t:"small"===R?17:33;const o=qpt(S)||qpt(P)||qpt(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,P,E,F,R,u,k,C,I]),J=e.useMemo(()=>{if(I)return;const e="small"===R?-6:-9,t=qpt(S)||qpt(P)||qpt(E);return!t||t>=36?e:-6},[S,P,E,R,I]);if(t){let e="";e=void 0!==U?String(U??""):B?z.watch(m)||"":W;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 nt("div",{style:{display:"inline-flex",flexDirection:"column",marginLeft:g,marginTop:v,marginRight:x,marginBottom:b,...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...P&&{minHeight:P},...E&&{maxHeight:E}},sx:N,...D,children:[a&&ot(vg,{sx:{fontSize:u,fontFamily:d,fontWeight:p,color:c,marginBottom:"4px"},children:a}),ot(Sd,{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 ee={backgroundColor:s,color:c,fontSize:u,fontFamily:d,fontWeight:p,...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...P&&{minHeight:P},...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"}},te={color:c,"&.Mui-focused":{color:c},...I&&{display:"none"},...void 0!==Q&&{"&.MuiInputLabel-outlined:not(.MuiInputLabel-shrink)":{transform:`translate(14px, ${Q}px) scale(1)`},"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:`translate(14px, ${J}px) scale(0.75)`}}},re={...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...P&&{minHeight:P},...E&&{maxHeight:E}};return ot(rg,B?{required:r,sx:{marginLeft:g,marginTop:v,marginRight:x,marginBottom:b,width:"fit-content",...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...P&&{minHeight:P},...E&&{maxHeight:E},...N},...D,children:ot(Jt,{name:m,rules:X,control:L,defaultValue:"",render:({field:e,fieldState:t})=>ot(Wpt,{errorMsg:t.error?.message,label:I?void 0:a,placeholder:i,stepValue:Y,minValue:Z,allowNegative:h,inputSx:ee,labelSx:te,sx:re,size:R,variant:A,value:e.value||"",onChange:t=>e.onChange(t.target.value)})})}:{required:r,sx:{marginLeft:g,marginTop:v,marginRight:x,marginBottom:b,width:"fit-content",...M&&{width:M},...S&&{height:S},...j&&{minWidth:j},...T&&{maxWidth:T},...P&&{minHeight:P},...E&&{maxHeight:E},...N},...D,children:ot(Wpt,{errorMsg:void 0,label:I?void 0:a,placeholder:i,stepValue:Y,minValue:Z,allowNegative:h,inputSx:ee,labelSx:te,sx:re,size:R,variant:A,value:G,onChange:e=>K(e.target.value)})})},Gpt=e=>{const t={text:e.label,validate:()=>!0},{rule:r}=e,o=Kpt(r);if(o||Ypt(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},Kpt=e=>!!e?.MAX,Ypt=e=>!!e?.MIN,Zpt=({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,...x})=>{const{watch:b,formState:w,setError:k}=Ut()||{},{text:_,subText:C,placeholderText:M,subPlaceholderText:S,validationText:D}=i,O=o.map(Gpt),P="password",E=`reEnter${P}`,j=b?.(P),T=b?.(E);return e.useEffect(()=>{j!==T&&k(E,{type:"manual",message:"Passwords do not match"})},[j,T,k,E]),nt(Gf,{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,...x,children:[ot(Xtt,{...r,inputType:"password",text:_?.text,name:P,placeholderText:M?.text}),ot(Xtt,{...r,inputType:"password",text:C?.text,name:E,placeholderText:S?.text}),ot(DKe,{rules:O,value:j,label:D?.text,isSubmitted:w?.isDirty,validationState:a})]})},Xpt=["+"," ","(",/[0-9]/,/[0-9]/,/[0-9]/,")"," ",/[0-9]/,/[0-9]/,/[0-9]/,"-",/[0-9]/,/[0-9]/,/[0-9]/,/[0-9]/],Qpt=e.forwardRef((e,t)=>{const{inputRef:r,...o}=e;return ot(FKe,{...o,ref:e=>{"function"==typeof r&&r(e?e.inputElement:null)},mask:Xpt,guide:!0,placeholderChar:" "})}),Jpt=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 eht(e){const t=(e??"").replace(/\D+/g,"");if(!t)return"";let r="",o=0;return HKe.forEach(e=>{"string"==typeof e?r+=e:o<t.length?(r+=t[o],o+=1):r+="_"}),r}const tht=({masked:e,errorMsg:t,inputSx:r,labelSx:o,variant:n="outlined",...a})=>ot(oC,{...a,variant:n,error:!!t,helperText:t||null,slotProps:{input:{sx:r,...e?{inputComponent:Qpt}:{}},inputLabel:{sx:o}}}),rht=({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:x="0",paddingLeft:b="0",paddingTop:w="0",paddingRight:k="0",paddingBottom:_="0",width:C,height:M,minHeight:S,maxHeight:D,minWidth:O,maxWidth:P,name:E,sourceDataModelField:j,configurationItemInfo:T,sx:N,inputSize:R="medium",labelOffset:F,hideLabel:I=!1,variant:A="outlined"})=>{const z=Ut(),L=z?.control,B=!(!L||!E),{localStateObject:V}=FC(),{stateConfig:$}=WC(),H=dt(),q=V||$,W=j?q?.[j]?.value:void 0,U=j?H?.getDmfValue(j):void 0,[G,K]=e.useState(""),Y={required:!!r&&o,pattern:{value:/^\d{10}$/,message:n}},Z=e.useMemo(()=>{if(I)return;if(void 0!==F)return F;const e=Jpt(w),t=Jpt(_);let r=0;r=void 0!==e&&void 0!==t?e+t:"small"===R?17:33;const o=Jpt(M)||Jpt(S)||Jpt(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,F,R,p,w,_,I]),X=e.useMemo(()=>{if(I)return;const e="small"===R?-6:-9,t=Jpt(M)||Jpt(S)||Jpt(D);return!t||t>=36?e:-6},[M,S,D,R,I]);if(t){let e="";e=void 0!==U?String(U??""):B?z.watch(E)||"":String(W??"");const t=(s?eht(e):e)||i||"-";return nt("div",{style:{display:"inline-flex",flexDirection:"column",marginLeft:y,marginTop:g,marginRight:v,marginBottom:x,...C&&{width:C},...M&&{height:M},...O&&{minWidth:O},...P&&{maxWidth:P},...S&&{minHeight:S},...D&&{maxHeight:D}},...T,children:[a&&ot(vg,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,marginLeft:0,marginBottom:"4px",...N},children:a}),ot(Sd,{sx:{fontSize:p,fontFamily:h,fontWeight:f,color:d,paddingLeft:b,paddingTop:w,paddingRight:k,paddingBottom:_,backgroundColor:c,border:`1px solid ${u||"#ccc"}`,borderRadius:"4px",minWidth:"120px",...N},children:t})]})}const Q={backgroundColor:c,color:d,fontSize:p,fontFamily:h,fontWeight:f,...C&&{width:C},...M&&{height:M},...O&&{minWidth:O},...P&&{maxWidth:P},...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"}},J={color:d,"&.Mui-focused":{color:d},...I&&{display:"none"},...void 0!==Z&&{"&.MuiInputLabel-outlined:not(.MuiInputLabel-shrink)":{transform:`translate(14px, ${Z}px) scale(1)`},"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:`translate(14px, ${X}px) scale(0.75)`}}},ee={marginLeft:y,marginTop:g,marginRight:v,marginBottom:x,width:"fit-content",...C&&{width:C},...M&&{height:M},...O&&{minWidth:O},...P&&{maxWidth:P},...S&&{minHeight:S},...D&&{maxHeight:D}};return ot(rg,B?{required:r,sx:{...ee,...C&&{width:C},...M&&{height:M},...O&&{minWidth:O},...P&&{maxWidth:P},...S&&{minHeight:S},...D&&{maxHeight:D},...N},...T,children:ot(Jt,{name:E,rules:Y,control:L,defaultValue:"",render:({field:e,fieldState:t})=>ot(tht,{masked:s,errorMsg:t.error?.message,inputSx:Q,labelSx:J,size:R,variant:A,label:I?void 0:a,placeholder:i,value:e.value||"",onChange:t=>{const r=(t?.target?.value??"").toString().replace(/\D+/g,"");e.onChange(r)}})})}:{required:r,sx:{...ee,...C&&{width:C},...M&&{height:M},...O&&{minWidth:O},...P&&{maxWidth:P},...S&&{minHeight:S},...D&&{maxHeight:D},...N},...T,children:ot(tht,{masked:s,errorMsg:void 0,inputSx:Q,labelSx:J,size:R,variant:A,label:I?void 0:a,placeholder:i,value:G,onChange:e=>{const t=(e?.target?.value??"").toString();K(t.replace(/\D+/g,""))}})})},oht=({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:x="0",marginBottom:b="0",paddingLeft:w="0",paddingTop:k="0",paddingRight:_="0",paddingBottom:C="0",width:M,height:S,minHeight:D,maxHeight:O,minWidth:P,maxWidth:E,placement:j="right",configurationItemInfo:T={},disabled:N=!1,maxValue:R=5,ratingPrecision:F=.5,sx:I,...A})=>{const z=Ut(),L=z?.control,B=!!z&&!!L&&!!r,{localStateObject:V}=FC(),{stateConfig:$}=WC(),H=dt(),q=V||$,W=c?q?.[c]?.value:void 0;!B||z.formState.errors;const[U,G]=e.useState(null),[K,Y]=e.useState(-1),Z=l&&-1!==K;if(o){const e=c?H?.getDmfValue(c):void 0;let r=null;const o=e=>"number"!=typeof e||Number.isNaN(e)?"string"!=typeof e||Number.isNaN(Number(e))?null:Number(e):e;if(void 0!==e)r=o(e);else if(c&&q?.[c]){const e=q?.[c]?.value;r=o(e)}return nt(rg,{required:n,sx:{marginLeft:g,marginTop:v,marginRight:x,marginBottom:b,paddingLeft:w,paddingTop:k,paddingRight:_,paddingBottom:C,display:"inline-flex",...M&&{width:M},...S&&{height:S},...D&&{minHeight:D},...O&&{maxHeight:O},...P&&{minWidth:P},...E&&{maxWidth:E},...I},...T,children:[t&&ot(Sd,{variant:"subtitle1",sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,marginBottom:"4px"},children:t}),ot(yb,{value:r,max:R,precision:F,readOnly:!0,sx:{"& .MuiRating-iconEmpty":{color:d},"& .MuiRating-iconFilled":{color:h||d},...I},...A})]})}const X={required:!!n&&a,validate:e=>!n||null!==e&&0!==e||a};return nt(rg,{required:n,sx:{marginLeft:g,marginTop:v,marginRight:x,marginBottom:b,paddingLeft:w,paddingTop:k,paddingRight:_,paddingBottom:C,display:"inline-flex",...M&&{width:M},...S&&{height:S},...D&&{minHeight:D},...O&&{maxHeight:O},...P&&{minWidth:P},...E&&{maxWidth:E},...I},...T,children:[t&&ot(Sd,{variant:"subtitle1",sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,marginBottom:"4px"},children:t}),nt(Gf,{sx:{display:"flex",alignItems:"center"},children:["left"===j&&ot(Sd,{sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,minWidth:"2em"},children:Z?K:B?z.getValues(r)??W??"":U??W??""}),ot(Jt,{name:r,control:L,defaultValue:"number"==typeof W?W:null,rules:X,render:({field:e,fieldState:{error:t}})=>nt(rt,{children:[ot(yb,{value:e.value??W??0,max:R,precision:F,disabled:N,onChange:(t,r)=>e.onChange(r),onChangeActive:l?(e,t)=>Y(t??-1):void 0,sx:{"& .MuiRating-iconEmpty":{color:d},"& .MuiRating-iconFilled":{color:h||d},marginX:l?1:0,...I},...A}),t&&ot(vg,{error:!0,sx:{marginTop:"4px"},children:"required"===t.type?a:i})]})}),"right"===j&&ot(Sd,{sx:{fontSize:f,fontFamily:m,fontWeight:y,color:p||d,minWidth:"2em"},children:Z?K:B?z.getValues(r)??W??"":U??W??""})]})]})},nht=({open:t,text:o,disabled:n,sx:a,placeholderText:i,required:s=!1,requiredErrorText:l="This field is required",validationErrorText:c="Invalid format",isDisplayOnly:u=!1,displayText:d,visible:p=!0,fontSize:h,fontFamily:f,fontWeight:m,textColor:y,textAlign:g,borderColor:v,color:x,backgroundColor:b,marginLeft:w="0",marginTop:k="0",marginRight:_="0",marginBottom:C="0",paddingLeft:M,paddingTop:S,paddingRight:D,paddingBottom:O,width:P,height:E,minHeight:j,maxHeight:T,minWidth:N,maxWidth:R,configurationItemInfo:F={},name:I,sourceDataModelField:A,predefinedValue:z,inputSize:L="medium",hideLabel:B=!1,variant:V="outlined",native:$=!1,options:H})=>{const q="regular"===m?"normal":m,W=e=>""!==e&&null!=e,U=u?void 0:A,{dataModelFieldOptions:G,isLoading:K}=(e=>{const{pickList:t}=ct(),{data:o=[],refetch:n,isLoading:a}=r.useQuery({queryKey:[EGe,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}})(U),Y=H&&H.length>0?H:G,Z=e.useMemo(()=>(Y||[]).map(e=>"string"==typeof e?{id:e,label:e}:e),[Y]),X=Ut(),Q=!!X?.control&&!!I,[J,ee]=e.useState(""),[te,re]=e.useState(!1),{localStateObject:oe,setLocalStateValue:ne,isConfigurationMode:ae,selectedConfigurationItemId:ie}=FC(),{stateConfig:se}=WC(),le=dt(),ce=oe||se,ue=A?ce?.[A]:void 0,de=ue?.value||("string"==typeof ue||"number"==typeof ue?ue:void 0),pe=A?le?.getDmfValue(A):void 0,he="string"==typeof pe||"number"==typeof pe?pe:pe&&"object"==typeof pe?pe.value??pe.label??pe.id:void 0,fe=null!=z&&""!==z,me=Boolean(n)||fe;if(e.useEffect(()=>{fe&&null!=z&&(Q?X?.setValue(I,z):ee(z))},[fe,z,Q,X,I]),!p)return null;if(u){const e=d??(null!=he?String(he):void 0)??(null!=de?String(de):void 0)??(i||"-");return nt("div",{style:{display:"inline-flex",flexDirection:"column",...W(k)&&{marginTop:k},...W(_)&&{marginRight:_},...W(C)&&{marginBottom:C},...W(w)&&{marginLeft:w},...W(P)?{width:P}:{width:"fit-content"},...W(E)&&{height:E},...W(j)&&{minHeight:j},...W(T)&&{maxHeight:T},...W(N)&&{minWidth:N},...W(R)&&{maxWidth:R}},...F,children:[o&&ot(vg,{sx:{...W(h)&&{fontSize:h},...W(f)&&{fontFamily:f},...q&&{fontWeight:q},color:W(y)?y:"#000",marginLeft:0,marginBottom:"4px",...W(g)&&{textAlign:g}},children:o}),ot(Sd,{sx:{...W(h)&&{fontSize:h},...W(f)&&{fontFamily:f},...q&&{fontWeight:q},...W(y)&&{color:y},...W(g)&&{textAlign:g},...W(M)&&{paddingLeft:M},...W(S)&&{paddingTop:S},...W(D)&&{paddingRight:D},...W(O)&&{paddingBottom:O},...W(b)&&{backgroundColor:b},border:`1px solid ${W(v)?v:"#ccc"}`,borderRadius:"4px"},children:e})]})}const ye="small"===L?40:56,ge={position:"relative",display:W(P)?"block":"inline-block",...W(P)&&{width:P},...W(N)&&{minWidth:N},...W(R)&&{maxWidth:R},...W(w)&&{marginLeft:w},...W(k)&&{marginTop:k},...W(_)&&{marginRight:_},...W(C)&&{marginBottom:C}},ve={width:"100%",...W(E)&&{height:E},...W(j)&&{minHeight:j},...W(T)&&{maxHeight:T},...!W(P)&&!W(N)&&{minWidth:"240px"},...a},xe=W(y)?y:W(x)?x:void 0,be={..."small"===L&&!E&&{height:`${ye}px`},...W(b)&&{backgroundColor:b},...xe&&{color:xe},...W(h)&&{fontSize:h},...W(f)&&{fontFamily:f},...q&&{fontWeight:q},...W(v)&&{"& .MuiOutlinedInput-notchedOutline":{borderColor:v},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:v},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:v}},..."filled"===V&&W(v)&&{"&:before":{borderColor:v},"&:after":{borderColor:v},"&:hover:not(.Mui-disabled):before":{borderColor:v}},..."standard"===V&&W(v)&&{"&:before":{borderColor:v},"&:after":{borderColor:v},"&:hover:not(.Mui-disabled):before":{borderColor:v}},"& .MuiSelect-select":{...W(g)&&{textAlign:g},...W(h)&&{fontSize:h},...W(f)&&{fontFamily:f},...q&&{fontWeight:q},...W(S)&&{paddingTop:S},...W(O)&&{paddingBottom:O},...W(M)&&{paddingLeft:M},...W(D)&&{paddingRight:D}}},we={...W(h)&&{fontSize:h},...W(f)&&{fontFamily:f},...q&&{fontWeight:q}},ke=Q?X.watch(I)||"":J,_e=Q?X.formState?.errors?.[I]:void 0;return ot("div",{style:ge,...F,onClick:e=>{ae&&F&&"onClick"in F&&(e.stopPropagation(),e.preventDefault(),F.onClick())},children:nt(rg,{variant:V,size:L,sx:ve,disabled:me,required:s,error:!!_e,children:[!B&&ot(Wg,{id:`${I}-label`,shrink:$?te||!!ke:void 0,sx:we,children:o}),ot(Tb,{value:ke,onChange:e=>{var t;ae||(t=e.target.value,ee(t),Q&&X.setValue(I,t),A&&ne&&ne(A,{id:t}))},onFocus:()=>re(!0),onBlur:()=>re(!1),...ae&&{open:!1},labelId:B?void 0:`${I}-label`,label:B?void 0:o,disabled:me,native:$,sx:be,children:$?[ot("option",{value:""},"__placeholder__"),...K?[ot("option",{disabled:!0,children:"Loading..."},"__loading__")]:Z.map(e=>ot("option",{value:e.id,children:e.label},e.id))]:K?nt(yx,{disabled:!0,children:[ot(ed,{size:20,sx:{mr:1}}),"Loading..."]}):Z.map(e=>ot(yx,{value:e.id,children:e.label},e.id))}),_e&&ot(vg,{error:!0,children:_e?.message||l})]})})};const aht=({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:x,selectColor:b,iconColor:w,minValue:k=0,maxValue:_=100,step:C,labelPlacement:M="top",marginLeft:S="0",marginTop:D="0",marginRight:O="0",marginBottom:P="0",paddingLeft:E="0",paddingTop:j="0",paddingRight:T="0",paddingBottom:N="0",width:R,height:F,minHeight:I,maxHeight:A,minWidth:z,maxWidth:L,sx:B,configurationItemInfo:V,sourceDataModelField:$,disabled:H=!1,...q})=>{const W=Ut(),U=W?.control,{localStateObject:G}=FC(),{stateConfig:K}=WC(),Y=dt(),Z=G||K,X=$?Z?.[$]?.value:void 0,Q=$?Y?.getDmfValue($):void 0,J={required:!!o&&n,validate:e=>!o||null!=e||n},ee=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),te={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:b||"#2196f3",width:x||"16px",height:x||"16px",boxShadow:"none","&:focus, &:hover, &.Mui-active, &.Mui-focusVisible":{boxShadow:"none"}},"& .MuiSlider-valueLabel":{backgroundColor:b||"#2196f3",color:"#ffffff",borderRadius:"4px",fontSize:"12px",fontWeight:500},"& .MuiSlider-mark":{backgroundColor:c||"#ccc",width:"2px",height:"2px",borderRadius:"50%"},"& .MuiSlider-markActive":{backgroundColor:b||"#2196f3"},...B};if(r){let t=null;const r=e=>"number"!=typeof e||Number.isNaN(e)?"string"!=typeof e||Number.isNaN(Number(e))?null:Number(e):e;if(void 0!==Q)t=r(Q);else if($&&Z?.[$]){const e=Z?.[$]?.value;t=r(e)}return nt(rg,{required:o,sx:{marginLeft:S,marginTop:D,marginRight:O,marginBottom:P,paddingLeft:E,paddingTop:j,paddingRight:T,paddingBottom:N,display:"inline-flex",...R&&{width:R},...F&&{height:F},...I&&{minHeight:I},...A&&{maxHeight:A},...z&&{minWidth:z},...L&&{maxWidth:L},...B},...V,children:[e&&ot(Cg,{children:e}),nt(Gf,{display:"flex",flexDirection:"top"===M?"column":"row",alignItems:"center",mt:"top"===M?1:0,children:[s&&ot(Gf,{mr:"horizontal"===p?1:0,mb:"vertical"===p?1:0,children:ot(PGe,{iconName:s,color:w})}),ot(fw,{value:t??void 0,min:k,max:_,step:C,orientation:p,valueLabelDisplay:v,valueLabelFormat:ee,sx:te,disabled:!0,...q}),l&&ot(Gf,{ml:"horizontal"===p?1:0,mt:"vertical"===p?1:0,children:ot(PGe,{iconName:l,color:w})}),ot(Sd,{sx:{ml:1,fontSize:f,fontFamily:m,fontWeight:y,color:h},children:t})]})]})}return nt(rg,{required:o,sx:{marginLeft:S,marginTop:D,marginRight:O,marginBottom:P,paddingLeft:E,paddingTop:j,paddingRight:T,paddingBottom:N,display:"inline-flex",...R&&{width:R},...F&&{height:F},...I&&{minHeight:I},...A&&{maxHeight:A},...z&&{minWidth:z},...L&&{maxWidth:L},...B},...V,children:[e&&ot(Cg,{children:e}),ot(Jt,{name:t||"",control:U,defaultValue:"number"==typeof X?X:k,rules:J,render:({field:e,fieldState:t})=>nt(rt,{children:[ot(fw,{...e,min:k,max:_,step:C,orientation:p,valueLabelDisplay:v,valueLabelFormat:ee,sx:te,onChange:(t,r)=>e.onChange(r),...q}),t.error&&ot(vg,{error:!0,sx:{mt:1},children:"required"===t.error.type?n:a})]})})]})},iht=({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:x,marginRight:b,marginBottom:w,marginLeft:k,moleculeId:_,gap:C,sx:M,...S})=>{const D=Ge(),[O,P]=e.useState(!1),{isConfigurationMode:E,onConfigurationItemClicked:j,selectedConfigurationItemId:T,onInternalNavigation:N}=FC();e.useEffect(()=>{if(!O)return;const e=e=>{"Escape"!==e.key||E||P(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[O,E]);const R=()=>P(!0),F=()=>P(!1);let I={};I=f&&!h?{onMouseEnter:R,onMouseLeave:F,onFocus:R,onBlur:F}:{onClick:e=>{P(e=>!e)}};const A={bgcolor:l,paddingTop:m,paddingRight:y,paddingBottom:g,paddingLeft:v,marginTop:x,marginRight:b,marginBottom:w,marginLeft:k},z=O||E&&(T===_||c.some(e=>e.id===T));return nt("div",{role:"presentation",children:[h&&ot(If,{open:O}),ot(Mw,{ariaLabel:o,direction:t,icon:ot(Yw,{icon:ot(PGe,{iconName:n,color:i,size:24}),openIcon:ot(PGe,{iconName:a,color:s,size:24})}),open:z,onOpen:f&&!h?R:void 0,onClose:f&&!h?F: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},...I,...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:Htt({theme:D,selected:u})}:{};return ot(Hw,{icon:ot(PGe,{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?(V7e(o)?N?.({link:o.internalLink??""}):L7e(o.externalLink),P(!1)):P(!1)},...f}},e.id)})})]})},sht=({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:x,backgroundColor:b="transparent",sx:w,...k})=>{const _=Ge(),C=o?"vertical":a,{isConfigurationMode:M,onConfigurationItemClicked:S,selectedConfigurationItemId:D}=FC();return ot(zk,{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:b,"& .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:ot(Ok,{sx:{[`&.${Ck.vertical}`]:{width:n||"24px",display:"flex",justifyContent:"center",alignItems:"center",marginLeft:"4px"},[`&.${Ck.vertical} .${Ck.line}`]:{borderColor:s,borderWidth:l,borderRadius:c},[`&.${Ck.horizontal} .${Ck.line}`]:{borderColor:s,borderWidth:l,borderRadius:c}}}),...x,...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:Htt({theme:_,selected:o})}:{},c=e.color||(a?"#000":"#555");return ot(ak,{...l,children:nt(kk,{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?ot(PGe,{size:n,color:e.iconColor||"#000",iconName:e.iconName,borderRadius:e?.iconBorderRadius||0,backgroundColor:e.iconBackgroundColor||"transparent"}):void 0,children:[ot(Sd,{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&&ot(Nk,{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:ot(Sd,{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)})})},lht=fl(Uk)(({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})),cht=({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:x,height:b,minHeight:w,maxHeight:k,minWidth:_,maxWidth:C,name:M,sourceDataModelField:S,disabled:D=!1,sx:O,configurationItemInfo:P,...E})=>{const j=Ut(),T=j?.control,N=!!T&&!!M,R={required:!!r&&o,validate:e=>!(r&&!e)||o},{localStateObject:F}=FC(),{stateConfig:I}=WC(),A=dt(),z=F||I,L=S?z?.[S]?.value:void 0,[B,V]=e.useState(!1);if(t){const e=S?A?.getDmfValue(S):void 0;let t=!1;return t=void 0!==e?"true"===String(e).toLowerCase()||!0===e:N?!!j.watch(M):!!L,nt(rg,{required:r,sx:{marginLeft:d,marginTop:p,marginRight:h,marginBottom:f,paddingLeft:m,paddingTop:y,paddingRight:g,paddingBottom:v,display:"inline-flex",...x&&{width:x},...b&&{height:b},...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"},...O},...P,children:[a&&ot(Cg,{component:"legend",children:a}),nt(Gf,{display:"flex",alignItems:"center",mt:"top"===u?1:0,children:[ot(lht,{disabled:!0,checked:t,thumbColor:i,thumbCheckedColor:s,trackColor:l,disabledThumbColor:c,sx:{"& .MuiSwitch-switchBase":{pointerEvents:"none"}},...E}),ot(Sd,{sx:{ml:1},children:t?"ON":"OFF"})]})]})}return nt(rg,{required:r,sx:{marginLeft:d,marginTop:p,marginRight:h,marginBottom:f,paddingLeft:m,paddingTop:y,paddingRight:g,paddingBottom:v,display:"inline-flex",...x&&{width:x},...b&&{height:b},...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"},...O},...P,children:[a&&ot(Cg,{component:"legend",children:a}),N?ot(Jt,{name:M,rules:R,control:T,defaultValue:!1,render:({field:e,fieldState:t})=>nt(rt,{children:[ot(Gf,{display:"flex",alignItems:"center",mt:"top"===u?1:0,children:ot(lht,{checked:!!e.value,disabled:D,onChange:(t,r)=>e.onChange(r),thumbColor:i,thumbCheckedColor:s,trackColor:l,disabledThumbColor:c,sx:{"& .MuiSwitch-switchBase":{"&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)"}}},...E})}),t.error&&ot(vg,{error:!0,sx:{marginTop:"4px"},children:"required"===t.error.type?o:n})]})}):ot(Gf,{display:"flex",alignItems:"center",mt:"top"===u?1:0,children:ot(lht,{checked:B,disabled:D,onChange:(e,t)=>{V(t)},thumbColor:i,thumbCheckedColor:s,trackColor:l,disabledThumbColor:c,sx:{"& .MuiSwitch-switchBase":{"&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)"}}},...E})})]})},uht=({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:x,borderRadius:b,elevation:w=1,gap:k,indicatorVisible:_=!0,indicatorColor:C,lineWidth:M="2px",orientation:S="horizontal",activeTextColor:D="#1976d2",inactiveTextColor:O="#000",fontSize:P,fontWeight:E,fontFamily:j,wrapText:T,textAlign:N,iconName:R,iconColor:F,iconSize:I,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=Ge(),{isConfigurationMode:Y,onConfigurationItemClicked:Z,selectedConfigurationItemId:X}=FC(),[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:x,borderRadius:b,display:"flex",overflow:"visible !important"},oe=e=>{const t=e?D:O,r=e&&$||V;return{color:t,fontSize:P,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===X,r={entityId:e.id,entity:"molecule_item",entityType:"tabs_item"};return{onClick:e=>{e.stopPropagation(),Z?.(r,!1)},onDoubleClick:e=>{e.stopPropagation(),Z?.(r,!0)},"data-organism-id":e.id,css:Htt({theme:K,selected:t})}},ie=e=>{const t=e.tabKey===o,r=oe(t);return nt(yx,{onClick:()=>{ne(e),te()},sx:{...r,display:"flex",alignItems:"center"},...ae(e),children:[e.iconName&&ot(PGe,{iconName:e.iconName,sx:{fontSize:P,color:t?D:O,mr:1}}),ot(Gf,{component:"span",children:e.label})]},e.id)};if(n)return nt(Qc,{elevation:w,style:re,sx:G,...U,children:[ot(id,{onClick:ee,children:ot(PGe,{size:I,color:F,iconName:R})}),ot(dx,{anchorEl:Q,open:Boolean(Q),onClose:te,children:t.map(ie)})]});const se=t.findIndex(e=>e.tabKey===o);return ot(Qc,{elevation:w,style:re,sx:G,...U,children:ot(Q_,{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:b,backgroundColor:C||D}:{display:"none"}},children:t.map(e=>{const t=e.tabKey===o,r={...oe(t),"&.Mui-selected":{color:t?D:O}};return ot(Xk,{label:e.label,disableRipple:W,sx:{...r,textTransform:"none"},onClick:()=>ne(e),iconPosition:"right"===A?"end":"start",icon:e.iconName?ot(PGe,{iconName:e.iconName,sx:{fontSize:P,color:t?D:O}}):void 0,...ae(e)},e.id)})})})},dht=e=>{if(!e)return null;if(e instanceof Date)return iot(e)?e:null;if("object"==typeof e&&null!==e&&"function"==typeof e.toDate){const t=e.toDate();return t instanceof Date&&iot(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=pnt(o,e,n);if(iot(t))return t}return null}return null},pht=({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 x=Ut(),b=x?.control,w=!!b&&!!t,{localStateObject:k}=FC(),{stateConfig:_}=WC(),C=dt(),M=k||_,S=n?M?.[n]?.value:void 0,D=dht(S);e.useRef();const[O,P]=e.useState(D);if(o){const e=n?C?.getDmfValue(n):void 0,o=void 0!==e?e:w?x.watch(t):S,l=dht(o),c=l&&iot(l)?pot(l,s):"";return nt(Gf,{...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&&ot(vg,{children:r}),ot(Sd,{children:c||i||"-"})]})}return ot(Gf,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:ot(Jt,{name:t,control:b,defaultValue:D??null,rules:{required:!!l&&(c||"This field is required"),validate:e=>{if(null==e||""===e)return!0;const t=dht(e);return t&&iot(t)||u||"Invalid time"}},render:({field:{onChange:e,value:t},fieldState:o})=>ot(Adt,{...v,enableAccessibleFieldDOMStructure:!1,value:dht(t),onChange:t=>{const r=dht(t);e(r?pot(r,"HH:mm"):null)},slots:{textField:oC},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:ot(Adt,{...v,enableAccessibleFieldDOMStructure:!1,value:O,onChange:e=>P(dht(e)),slots:{textField:oC},slotProps:{textField:{label:r,placeholder:i,onMouseDown:e=>e.stopPropagation(),sx:{width:p,height:h,minWidth:f,maxWidth:m,minHeight:y,maxHeight:g}}}})})},hht=({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:x="0px",paddingTop:b="0px",paddingRight:w="0px",paddingBottom:k="0px",paddingLeft:_="0px",sx:C})=>{const[M,S]=e.useState(!1),{onStateChange:D}=GC(),O=()=>{D({id:h,type:"started"})};return ot(fht,{id:h,raised:i,onClick:O,sx:{borderRadius:`${u}px`,margin:d,padding:p,marginTop:y,marginRight:g,marginBottom:v,marginLeft:x,paddingTop:b,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:M?ot(Sd,{component:"div",sx:{height:l,width:c,display:"flex",justifyContent:"center",alignItems:"center",fontSize:"16px",color:"gray",textAlign:"center"},children:s||"Video unavailable"}):ot(gm,{component:"video",src:t,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:O,onEnded:()=>{D({id:h,type:"completed"})},onError:()=>{S(!0)}})})},fht=Po(dm)`
|
|
1029
1029
|
display: inline-block;
|
|
1030
1030
|
overflow: hidden;
|
|
1031
|
-
`,mht=({children:e,additionalInfo:t})=>{try{return ot(rt,{children:e})}catch(r){return console.error(`Render error in SafeRender - ${t} :`,r),ot("div",{style:{color:"red",padding:24},children:"Render Error"})}};function yht(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 ght(e,t,r=!1){return t&&r?yn(e,t):e}const vht=({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=Ge(),g=SC("xs"),v=s||g,{formId:x,isPreview:b=!1,validations:w,submitHandler:k,isConfigurationMode:_,onConfigurationItemClicked:C,selectedConfigurationItemId:M,currentStyleProperties:S,currentContentProperties:D,onInternalNavigation:O,organismMetadata:P,organismInfo:E,localState:j}=FC(),{stateConfig:T}=WC(),N=T,R=dt(),F=m??R.activeVariant,I=e.useMemo(()=>((e,t)=>{if(!e)return{};if(t){const r=e[t];if(r&&"object"==typeof r&&"props"in r){const e=r.props;if(e&&"object"==typeof e)return e}}return e.props||{}})(a,F??null),[a,F]),A=a?.props?.dataCaptureName||u?.dataCapture?.dataCaptureName||t,z=e.useMemo(()=>{return x&&R?.nestedPathSegments?.length?(e=R.nestedPathSegments,t=A,e&&0!==e.length?[...e.map(e=>void 0!==e.index?`${e.dmfId}.${e.index}`:e.dmfId),t].filter(Boolean).join("."):t):A;var e,t},[x,R?.nestedPathSegments,A]),L=u?.dataCapture?.sourceDataModelFieldId,B=u?.dataCapture?.predefinedValue,V=M===t,{isStateDisabled:$,isStateVisible:H}=(({stateListenerId:e})=>{const{localStateObject:t}=FC(),{stateConfig:r}=WC(),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}),q=e.useMemo(()=>({entityType:r,entity:"molecule",entityName:o,entityId:t,organismLibraryMoleculeId:p,libraryEntityId:d,activeStyleVariant:F,parentReplicatorWithVariants:f||R.containerId||null,parentStyleVariantConfig:h||void 0}),[r,o,t,p,d,F,R.containerId,f,h]),W=e.useCallback(e=>{e?.stopPropagation(),C(q,!1)},[C,q]),U=e.useCallback(e=>{e?.stopPropagation(),C(q,!0)},[C,q]),G=_?{onClick:W,onDoubleClick:U,"data-configuration-id":t,css:Htt({theme:y,selected:V})}:{},K=_||$;if(!H)return null;return(()=>{switch(r){case"simple_text":{const e={text:u?.text},r=["text"],{text:o}=yht(e,D,r,V),n=ght(I,S,V);return ot(opt,{...n,text:o?.text||"",htmlElementId:t,configurationsItemInfo:G})}case"text":{const e={text:u?.text},r=Object.keys(e),{text:o}=yht(e,D,r,V),n=ght(I,S,V);return ot(rpt,{...o,...n,htmlElementId:t,configurationItemInfo:G})}case"consent":{const e=yht(u,D,[],V),r=ght(I,S,V)||{};return ot(rrt,{...r,htmlElementId:t,properties:e,configurationItemInfo:G})}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=yht(e,D,r,V),{state:n,gap:i,...s}=ght(a?.props,S,V);return ot(Zpt,{gap:i,inputProps:s,validations:w||[],htmlElementId:t,validationState:n,overridesProperties:o,configurationItemInfo:G})}case"stepper":{const e=ght(I,S,V),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}=yht(a,D,i,t);return{...n,...ght(o?.props,S,t),title:s?.text||"",subText:l?.text||""}});return ot(sht,{...e,items:r||[],isMobile:v,moleculeId:t,configurationItemInfo:G})}case"checklist":{const e=ght(I,S,V)||{},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=yht(a,D,i,t),l=ght(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:N?.[e.id]?.interacted||"unchecked"}}case"divider_item":{const e=ght(o?.props,S,t)||{};return{...n,...e,type:"divider_item"}}case"text_item":{const e={text:r?.text},a=Object.keys(e),i=yht(e,D,a,t),s=ght(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=yht(e,D,a,t),s=ght(o?.props,S,t)||{},l=i.text?.text||q4e;return{...n,...s,type:"rich_text_item",text:l}}default:return{...n,type:e.type}}});return ot(ert,{...e,items:r||[],moleculeId:t,configurationItemInfo:G})}case"accordion":{const e=ght(I,S,V),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}=yht(a,D,i,t);return{...n,...ght(o?.props,S,t),text:s?.text||"",subText:l?.text||"",bodyText:c?.text||""}});return ot(Wtt,{...e,items:r||[],moleculeId:t,configurationItemInfo:G})}case"menu":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=yht(e,D,r,V),a=ght(I,S,V),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}=yht(a,D,i,t),u=ght(o?.props,S,t);return{...n,...u,disabled:N?.[e.id]?N?.[e.id]?.disabled:l?.value||u?.disabled||!1,text:s?.text||"Menu Item",link:c}});return ot(Hpt,{...a,items:i||[],moleculeId:t,buttonText:o?.text||"Open Menu",configurationItemInfo:G,buttonDisabled:N?.[t]?N?.[t]?.disabled:n?.value||a?.disabled||!1})}case"tabs":{const e=ght(I,S,V),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}=yht(n,D,a,t);return{...ght(o?.props,S,t),id:e.id,tabKey:V7e(s)?F7e(E7e,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 ot(uht,{...e,items:a||[],isMobile:v,moleculeId:t,activeTabKey:i,configurationItemInfo:G,onTabChange:_?void 0:({newTabKey:e,link:t})=>{n?c?.onTabChange?.(e):V7e(t)?O?.({link:t?.internalLink||""}):L7e(t?.externalLink)}})}case"divider":{const e=ght(I,S,V);return ot(Jdt,{moleculeId:t,configurationItemInfo:G,...e})}case"link":{const e={text:u?.text,link:u?.link},r=Object.keys(e),{text:o,link:n}=yht(e,D,r,V),a=n,i=ght(I,S,V);return ot(Vpt,{moleculeId:t,...i,link:a,type:a?.type,src:K?void 0:U7e(a,b)||"",text:o?.text||"",disabled:i?.disabled||$,configurationItemInfo:G})}case"data_driven_link":{const e={text:u?.text},r=Object.keys(e),{text:o}=yht(e,D,r,V),n=ght(I,S,V);return ot(Vpt,{moleculeId:t,...n,text:o?.text||"",sourceDataModelField:L,disabled:n?.disabled||$,configurationItemInfo:G})}case"video":{const e={video:u?.video,coverImage:u?.coverImage},r=Object.keys(e),{video:o,coverImage:n}=yht(e,D,r,V),a=ght(I,S,V);return ot(hht,{...a,moleculeId:t,poster:n?.imageFile?.url,src:o?.videoSource??o?.videoFile?.url??"",configurationItemInfo:G})}case"badge":{const e=ght(I,S,V);return ot(Ktt,{...e,configurationItemInfo:G})}case"alert":{const e={text:u?.text,subText:u?.subText},t=Object.keys(e),{text:r,subText:o}=yht(e,D,t,V),n=ght(I,S,V);return ot(Utt,{text:r?.text||"",subText:o?.text||"",...n,configurationItemInfo:G})}case"chip":{const e={text:u?.text},t=Object.keys(e),{text:r}=yht(e,D,t,V),o=ght(I,S,V);return ot(trt,{text:r?.text||"",...o,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(Bpt,{name:z,text:o?.text||"",placeholderText:n?.text||"",sourceDataModelField:L,required:a?.value,isDisplayOnly:"email_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(rht,{name:z,text:o?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,isDisplayOnly:"phone_number_display_field"===r,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(Upt,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"numeric_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(irt,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"currency_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(Xtt,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"basic_text_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),s=ght(I,S,V);return ot(oht,{name:z,text:o?.text||"",required:n?.value,requiredErrorText:a?.text,validationErrorText:i?.text,sourceDataModelField:L,isDisplayOnly:"rating_display_field"===r,...s,configurationItemInfo:G})}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}=yht(e,D,o,V),l=ght(I,S,V);return ot(cht,{name:z,moleculeId:t,text:n?.text||"",required:a?.value,isDisplayOnly:"switch_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(aht,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:"slider_display_field"===r,requiredErrorText:a?.text,validationErrorText:i?.text,placeholderText:s?.text,sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,o,V),c=ght(I,S,V);return ot(bat,{dateAdapter:xnt,children:ot(Qdt,{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:L,...c,configurationItemInfo:G})})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(bat,{dateAdapter:xnt,children:ot(pht,{...l,name:z,text:o?.text||"",placeholderText:n?.text||"",required:s?.value,requiredErrorText:a?.text,validationErrorText:i?.text,isDisplayOnly:"time_picker_display"===r,sourceDataModelField:L,configurationItemInfo:G})})}case"select_display_field":case"select":{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,placeholderText:a,requiredErrorText:i,validationErrorText:s}=yht(e,D,t,V),l=ght(I,S,V),c="select_display_field"===r;return ot(nht,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:c,predefinedValue:B,placeholderText:a?.text||"",requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:L,...l,configurationItemInfo:G})}case"image":{const e={image:u?.image,link:u?.link},r=Object.keys(e),{image:o,link:n}=yht(e,D,r,V),a=ght(I,S,V);return ot(ept,{...a,src:o?.imageSource||o?.imageFile?.url||o?.imageFile?.id||"",onClick:n?()=>V7e(n)?O?.({link:n?.internalLink||""}):L7e(n?.externalLink):void 0,moleculeId:t,configurationItemInfo:G,properties:{image:o,link:n}})}case"button":{const e={text:u?.text,action:u?.action},r=Object.keys(e),{text:o,action:n}=yht(e,D,r,V),a=ght(I,S,V);return ot(HGe,{moleculeId:t,text:o?.text||"",...a,disabled:a?.disabled||$,configurationItemInfo:G,properties:{text:o,action:n}})}case"avatar":{const e=ght(I,S,V);return ot(Gtt,{...e,sourceDataModelField:L,configurationItemInfo:G})}case"drawer":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=yht(e,D,r,V),a=ght(I,S,V),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=yht(a,D,i,t),l=ght(o?.props,S,t),c={...n,...l};switch(e.type){case"menu_item":return{...c,disabled:N?.[e.id]?N?.[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||q4e};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 ot(Ipt,{...a,items:i||[],moleculeId:t,buttonText:o?.text||a?.buttonText,buttonDisabled:N?.[t]?N?.[t]?.disabled:n?.value||a?.disabled||!1,configurationItemInfo:G})}case"speed_dial":{const e=ght(I,S,V),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=yht(a,D,i,t),l=ght(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 ot(iht,{...e,items:r||[],moleculeId:t,configurationItemInfo:G})}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}=yht(e,D,o,V),l=ght(I,S,V);return ot(Jtt,{name:z,moleculeId:t,label:n?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:L,isDisplayOnly:"checkbox_display"===r,...l,configurationItemInfo:G})}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}=yht(e,D,o,V),c=ght(I,S,V);return ot(Qtt,{name:z,moleculeId:t,confirmText:n?.text||"Yes",rejectText:a?.text||"No",required:i?.value,requiredErrorText:s?.text,validationErrorText:l?.text,sourceDataModelField:L,isDisplayOnly:"binary_radio_buttons_display"===r,...c,configurationItemInfo:G})}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}=yht(e,D,t,V),i=ght(I,S,V);return ot(jst,{...i,name:z,required:o?.value,requiredErrorText:n?.text,validationErrorText:a?.text,isDisplayOnly:"date_calendar_display"===r,sourceDataModelField:L,configurationItemInfo:G})}default:return ot(rt,{children:"There is no such type of molecule yet."})}})()},xht=(e,t)=>{if(!e)return null;let r=e;for(const o of t){if(!r||"object"!=typeof r)return null;const{dmfId:e,index:t}=o;if(r=r[e],void 0===r)return null;if(void 0!==t){if(!Array.isArray(r))return null;if(r=r[t],void 0===r)return null}}return r&&"object"==typeof r?r:null},bht=({nestedPathSegments:t})=>{const{localStateObject:r}=FC(),o=dt();return e.useMemo(()=>{if(o?.itemDataByDmfId)return o.itemDataByDmfId;const e=(e=>{if(null!=e){if("object"==typeof e&&!Array.isArray(e)&&"viewType"in e&&"data"in e){const t=e.data;if(null==t)return;return t}return e}})(r);return void 0!==e?0===t.length||Array.isArray(e)?e:xht(e,t):void 0},[o?.itemDataByDmfId,r,t])},wht=e=>"container"===e.instance&&"empty_state"===e.type,kht=e=>{if("container"!==e.instance)return;const t=e;return t.replicatorFieldId||t.config?.props?.replicatorFieldId},_ht=(e,t)=>{if(!e)return!0;if(Array.isArray(e))return 0===e.length;return(e=>null==e||Array.isArray(e)&&0===e.length||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length)(e[t])},Cht=e.memo(({item:t,tabsProps:r,formData:o,setFormData:n,isMobile:a,parentId:i,nestedPathSegments:s=[]})=>{const l=Ut(),{organismMetadata:c}=FC(),u="items"in t?t.items:void 0,d=(({items:t})=>{const{stateConfig:r}=WC(),{localStateObject:o}=FC(),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:u}),{filteredItems:p}=(({containerItems:t,visibleItems:r,nestedPathSegments:o})=>{const{isLoadingData:n,isEmptyDataState:a,forceEmptyStatePreview:i,previewingEmptyStates:s,isConfigurationMode:l}=FC(),c=bht({nestedPathSegments:o});return e.useMemo(()=>{if(!t||0===t.length)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const e=t.filter(wht);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};if(n&&!i&&!o)return{filteredItems:r.filter(e=>!wht(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const u=new Set;let d=!1;return e.forEach(e=>{const t=kht(e);i||(t?s?.includes(t):s?.includes("__organism__"))?t?u.add(t):d=!0:l||(t?_ht(c,t)&&u.add(t):a&&(d=!0))}),d||0!==u.size?{filteredItems:r.filter(e=>{if(wht(e)){const t=kht(e);return t?u.has(t):d}return!1}),showingEmptyStateForFields:u,showOrganismLevelEmptyState:d}:{filteredItems:r.filter(e=>!wht(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1}},[t,r,c,n,a,i,s,l])})({containerItems:u,visibleItems:d,nestedPathSegments:s});if("molecule"===t.instance)return ot(mht,{additionalInfo:`molecule: ${t.id}`,children:ot(vht,{...t,form:l,isMobile:a,formData:o,parentId:i,tabsProps:r,setFormData:n,metadata:{...t.metadata,stateListenerId:c?.stateListenerId||t.id}})});const h=!(!u||!u.length),f="form"===t.type&&t.config.props?.activeChildrenIds||[];return h?f.length?ot(mht,{additionalInfo:`form: ${t.id}`,children:ot(Rht,{item:t,activeChildrenIds:f,formData:o,setFormData:n,isMobile:a})}):ot(mht,{additionalInfo:`container: ${t.id}`,children:ot(Tht,{...t,isMobile:a,nestedPathSegments:s,config:t.config?{...t.config,props:t.config.props||{},wide:t.config.wide||{},compact:t.config.compact||{}}:{props:{},wide:{},compact:{}},children:p?.map(e=>ot(Cht,{item:e,parentId:e.id,formData:o,setFormData:n,isMobile:a,tabsProps:r,nestedPathSegments:s},e.id))})}):null}),Mht=({order:t=0,id:r,formStepStyles:o,containerProps:n={hasOwnButton:!1}})=>{const a=Ut(),[i,s]=e.useState({}),{formId:l,submitHandler:c,isFormInEditMode:u,organismMetadata:d}=FC(),{groupStepItemsByStepContainer:p}=FC();Object.keys(d?.popupPayload??{})[0];const{currentStep:h,canGoToNextStep:f,canGoToPrevStep:m,goToNextStep:y,goToPrevStep:g,reset:v,setStep:x}=Xr(),b=p(),{submitForm:w}=RGe(),{forms:k}=ct(),_=t+1,C=b.get(r)||[];return h!==_?null:ot("div",{style:o,children:nt(rt,{children:[C.map(e=>ot(Cht,{item:e,setFormData:s,formData:i},e.id)),(!n?.hasOwnButton||d?.isFormInsidePopUp)&&u&&nt("div",{style:{display:"flex",gap:"16px"},children:[ot(HGe,{text:m?"Back":"Cancel",variant:"outlined",onClick:()=>{m?g():(v(),x(1))}}),ot(HGe,{text:f?"Next":"Submit",variant:"contained",onClick:async()=>{const e=await a.trigger();if(!e)return void C6e({message:"Please fill all required fields",type:"error"});if(f)return void y();const t=a.getValues();e&&l&&(c?await c({formId:l,data:t}):k?.submit&&await w({formId:l,data:t}))}})]})]})})},Sht=e=>e&&"object"==typeof e&&"value"in e&&!Array.isArray(e)?e.value:e,Dht=e=>{const t={};for(const[r,o]of Object.entries(e))t[r]=Sht(o);return t},Oht=(e,t)=>{if(!e?.enabled||!e.sourceDataModelFieldId)return null;if(!t)return null;const r=t[e.sourceDataModelFieldId];if(null==r)return null;let o=null;if("string"==typeof r)o=r;else if("object"==typeof r)if("id"in r&&"string"==typeof r.id)o=r.id;else if("value"in r){const e=r.value;"string"==typeof e?o=e:"object"==typeof e&&e&&"id"in e&&(o=e.id)}return o},Pht=e.memo(({containerId:t,replicatorFieldId:r,nestedPathSegments:o=[],children:n,properties:a,config:i,renderWrapper:s})=>{const{localStateObject:l,formId:c}=FC(),u=dt(),d=LC(),p=e.useRef(!1),h=a?.styleVariantConfig||i?.styleVariantConfig;!p.current&&h&&(console.log("[StyleVariant] ReplicatorContainer init:",{replicatorFieldId:r,hasLocalState:!!l&&Object.keys(l).length>0,hasStyleVariantConfig:!0}),p.current=!0);if(Boolean(c&&d)&&d){const{fieldArrayMethods:{fields:e}}=d;return ot(rt,{children:e.map((e,a)=>{const i=[...o,{dmfId:r||"default",index:a}],l=e,c=Oht(h,l),u={containerId:t||`replicator-${r||"default"}-${a}`,nestedPathSegments:i,itemIndex:a,itemDataByDmfId:l,rawItemDataByDmfId:l,activeVariant:c},d=s?s(a,n,c):n;return ot("div",{"data-replicator-instance":`${r||"default"}-${a}`,children:ot(pt,{value:u,children:d})},e.id)})})}const f=l||{},m=u?.itemDataByDmfId?u.itemDataByDmfId:xht(f,o),y=r?m?.[r]:m;if(!y||"object"!=typeof y){const e=r?[...o,{dmfId:r}]:o;return ot(pt,{value:{containerId:t||`replicator-${r||"default"}`,nestedPathSegments:e,itemDataByDmfId:{},activeVariant:null},children:s?s(void 0,n,null):n})}if(Array.isArray(y))return ot(rt,{children:y.map((e,a)=>{const i=[...o,{dmfId:r||"default",index:a}],l=Dht(e),c=Oht(h,e);return ot(pt,{value:{containerId:t||`replicator-${r||"default"}-${a}`,nestedPathSegments:i,itemIndex:a,itemDataByDmfId:l,rawItemDataByDmfId:e,activeVariant:c},children:s?s(a,n,c):n},`${r||"default"}-${a}`)})});const g=r?[...o,{dmfId:r}]:o,v=Dht(y),x=Oht(h,y);return ot(pt,{value:{containerId:t||`replicator-${r||"default"}`,nestedPathSegments:g,itemDataByDmfId:v,rawItemDataByDmfId:y,activeVariant:x},children:s?s(void 0,n,x):n})}),Eht=({replicatorFieldId:t,nestedPathSegments:r=[],minInstances:o=1,maxInstances:n=50,children:a})=>{const{control:i}=Ut(),s=$C(),c=e.useRef(!1),u=r.map(e=>void 0!==e.index?`${e.dmfId}.${e.index}`:e.dmfId).filter(Boolean).join(".");const d=u?`${u}.${t}`:t,p=function(e){const t=Ut(),{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(Lr)),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),Yt(()=>r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===p.current||!t){const t=Dt(e,p.current);Array.isArray(t)&&(c(t),u.current=t.map(Lr))}}}).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,Pr(o,r._names)&&r._subjects.state.next({...r._formState}),h.current&&(!Sr(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!Sr(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([o]).then(e=>{const t=Dt(e.errors,o),n=Dt(r._formState.errors,o);(n?!t&&n.type||t&&(n.type!==t.type||n.message!==t.message):t&&t.type)&&(t?Pt(r._formState.errors,o,t):pr(r._formState.errors,o),r._subjects.state.next({errors:r._formState.errors}))});else{const e=Dt(r._fields,o);!e||!e._f||Sr(r._options.reValidateMode).isOnSubmit&&Sr(r._options.mode).isOnSubmit||Ir(e,r._names.disabled,r._formValues,r._options.criteriaMode===At,r._options.shouldUseNativeValidation,!0).then(e=>!ar(e)&&r._subjects.state.next({errors:Tr(r._formState.errors,e,o)}))}r._subjects.state.next({name:o,values:kt(r._formValues)}),r._names.focus&&Er(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(()=>(!Dt(r._formValues,o)&&r._setFieldArray(o),()=>{r._options.shouldUnregister||a?r.unregister(o):((e,t)=>{const o=Dt(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);Gr(n,e,t),Gr(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,Gr,{argA:e,argB:t},!1)},[f,o,r]),move:l.default.useCallback((e,t)=>{const n=r._getFieldArray(o);qr(n,e,t),qr(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,qr,{argA:e,argB:t},!1)},[f,o,r]),prepend:l.default.useCallback((e,t)=>{const n=tr(kt(e)),a=Wr(r._getFieldArray(o),n);r._names.focus=Br(o,0,t),u.current=Wr(u.current,n.map(Lr)),f(a),c(a),r._setFieldArray(o,a,Wr,{argA:$r(e)})},[f,o,r]),append:l.default.useCallback((e,t)=>{const n=tr(kt(e)),a=Vr(r._getFieldArray(o),n);r._names.focus=Br(o,a.length-1,t),u.current=Vr(u.current,n.map(Lr)),f(a),c(a),r._setFieldArray(o,a,Vr,{argA:$r(e)})},[f,o,r]),remove:l.default.useCallback(e=>{const t=Ur(r._getFieldArray(o),e);u.current=Ur(u.current,e),f(t),c(t),!Array.isArray(Dt(r._fields,o))&&Pt(r._fields,o,void 0),r._setFieldArray(o,t,Ur,{argA:e})},[f,o,r]),insert:l.default.useCallback((e,t,n)=>{const a=tr(kt(t)),i=Hr(r._getFieldArray(o),e,a);r._names.focus=Br(o,e,n),u.current=Hr(u.current,e,a.map(Lr)),f(i),c(i),r._setFieldArray(o,i,Hr,{argA:e,argB:$r(t)})},[f,o,r]),update:l.default.useCallback((e,t)=>{const n=kt(t),a=Kr(r._getFieldArray(o),e,n);u.current=[...a].map((t,r)=>t&&r!==e?u.current[r]:Lr()),f(a),c([...a]),r._setFieldArray(o,a,Kr,{argA:e,argB:n},!0,!1)},[f,o,r]),replace:l.default.useCallback(e=>{const t=tr(kt(e));u.current=t.map(Lr),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]||Lr()})),[s,n])}}({control:i,name:d}),{fields:h,append:f}=p;return e.useEffect(()=>{if(!c.current&&(c.current=!0,0===h.length&&o>0)){Array.from({length:o},()=>({})).forEach(e=>{f(e,{shouldFocus:!1})})}},[]),e.useEffect(()=>{if(s)return s.register({replicatorFieldId:t,fieldArrayName:d,fieldArrayMethods:p,minInstances:o,maxInstances:n}),()=>{s.unregister(t)}},[s,t,d,p,o,n]),ot(BC,{replicatorFieldId:t,fieldArrayName:d,fieldArrayMethods:p,minInstances:o,maxInstances:n,children:a})},jht={dots:!0,infinite:!1,autoplay:!1,autoplaySpeed:5e3,arrows:!0,slidesToShow:1,slidesToScroll:1,adaptiveHeight:!0,swipeToSlide:!0},Tht=e.memo(({id:t,type:r,name:o,config:n,children:a,metadata:i,isMobile:s,properties:l,nestedPathSegments:c=[],replicatorFieldId:u,parentStyleVariantConfig:d,parentContainerWithVariantsId:p,parentContainerActiveVariant:h})=>{const f=Ge(),{props:m,wide:y,compact:g}=n||{},v=u||m?.replicatorFieldId,{isConfigurationMode:x,onConfigurationItemClicked:b,selectedConfigurationItemId:w,currentStyleProperties:k,currentContentProperties:_,formId:C,localState:M}=FC(),S=dt(),{activeVariant:D,containerId:O}=S,P=Ut(),E=Boolean(C&&P),j=e.useMemo(()=>{if("replicator"===r)return;const e=l?.styleVariantConfig,t=e&&"object"==typeof e&&"data"in e?e.data:e;return t?.enabled?t:void 0},[r,l]),T=e.useMemo(()=>{if(!j?.sourceDataModelFieldId)return null;if(E&&P){const r=(e=S.nestedPathSegments||c,t=j.sourceDataModelFieldId,e&&0!==e.length?[...e.map(e=>void 0!==e.index?`${e.dmfId}.${e.index}`:e.dmfId),t].filter(Boolean).join("."):t),o=P.getValues?.(r)??P.getValues?.(`${r}.id`)??P.getValues?.(`${r}.value`);if(void 0!==o){const e="string"==typeof o||"number"==typeof o?{id:String(o),value:o}:o,t={[j.sourceDataModelFieldId]:e},r=Oht(j,t);if(r)return r}}var e,t;const r=M?.[j.sourceDataModelFieldId]??M?.[`${j.sourceDataModelFieldId}`];if(void 0!==r){const e={[j.sourceDataModelFieldId]:r},t=Oht(j,e);if(t)return t}const o=S.getDmfValue(j.sourceDataModelFieldId),n=S.rawItemDataByDmfId?.[j.sourceDataModelFieldId],a={[j.sourceDataModelFieldId]:n??o};return Oht(j,a)},[j,S,P,E,M,c]),N=d,R=h??D??null,F=T??R,I=(j&&j.enabled?t:p)||O||null,A=e.useMemo(()=>{if(!(j&&j.enabled||!!N||null!==R))return a;const r=j&&j.enabled?j:N,o=j&&j.enabled?T:R,n=(j&&j.enabled?t:p)||t;return e.Children.map(a,t=>e.isValidElement(t)?e.cloneElement(t,{...t.props,parentStyleVariantConfig:r,parentContainerWithVariantsId:n,parentContainerActiveVariant:o}):t)},[a,j,T,N,R,t,p]),z=w===t,L=z?{backgroundImage:_?.backgroundImage??l?.backgroundImage??{imageFile:{url:""}}}:l,{containerProps:B={},containerStyle:V={}}=y||{};let $={...V};const{containerProps:H={},containerStyle:q={}}=g||{};let W={...q};k&&z&&(W={...q,...k},$={...V,...k});const U=SC("xs"),G=s??U,K=G?W:$,Y=G?H:B,Z={...m,...Y,enableBackgroundImage:K?.enableBackgroundImage},X=e.useMemo(()=>({entityId:t,entityType:r,entityName:o,entity:"container",libraryEntityId:i?.containerLibraryId||void 0,activeStyleVariant:F,parentReplicatorWithVariants:I,parentStyleVariantConfig:j&&j.enabled?j:N}),[r,o,t,i,F,I,j,N]),Q=x?{onClick:e=>{e&&e.stopPropagation(),b(X,!1)},onDoubleClick:e=>{e?.stopPropagation(),b(X,!0)}}:{},J=`${t}.${G?"mobile":"desktop"}`,ee=bo`
|
|
1031
|
+
`,mht=({children:e,additionalInfo:t})=>{try{return ot(rt,{children:e})}catch(r){return console.error(`Render error in SafeRender - ${t} :`,r),ot("div",{style:{color:"red",padding:24},children:"Render Error"})}};function yht(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 ght(e,t,r=!1){return t&&r?yn(e,t):e}const vht=({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=Ge(),g=SC("xs"),v=s||g,{formId:x,isPreview:b=!1,validations:w,submitHandler:k,isConfigurationMode:_,onConfigurationItemClicked:C,selectedConfigurationItemId:M,currentStyleProperties:S,currentContentProperties:D,onInternalNavigation:O,organismMetadata:P,organismInfo:E,localState:j}=FC(),{stateConfig:T}=WC(),N=T,R=dt(),F=m??R.activeVariant,I=e.useMemo(()=>((e,t)=>{if(!e)return{};if(t){const r=e[t];if(r&&"object"==typeof r&&"props"in r){const e=r.props;if(e&&"object"==typeof e)return e}}return e.props||{}})(a,F??null),[a,F]),A=a?.props?.dataCaptureName||u?.dataCapture?.dataCaptureName||t,z=e.useMemo(()=>{return x&&R?.nestedPathSegments?.length?(e=R.nestedPathSegments,t=A,e&&0!==e.length?[...e.map(e=>void 0!==e.index?`${e.dmfId}.${e.index}`:e.dmfId),t].filter(Boolean).join("."):t):A;var e,t},[x,R?.nestedPathSegments,A]),L=u?.dataCapture?.sourceDataModelFieldId,B=u?.dataCapture?.predefinedValue,V=M===t,{isStateDisabled:$,isStateVisible:H}=(({stateListenerId:e})=>{const{localStateObject:t}=FC(),{stateConfig:r}=WC(),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}),q=e.useMemo(()=>({entityType:r,entity:"molecule",entityName:o,entityId:t,organismLibraryMoleculeId:p,libraryEntityId:d,activeStyleVariant:F,parentReplicatorWithVariants:f||R.containerId||null,parentStyleVariantConfig:h||void 0}),[r,o,t,p,d,F,R.containerId,f,h]),W=e.useCallback(e=>{e?.stopPropagation(),C(q,!1)},[C,q]),U=e.useCallback(e=>{e?.stopPropagation(),C(q,!0)},[C,q]),G=_?{onClick:W,onDoubleClick:U,"data-configuration-id":t,css:Htt({theme:y,selected:V})}:{},K=_||$;if(!H)return null;return(()=>{switch(r){case"simple_text":{const e={text:u?.text},r=["text"],{text:o}=yht(e,D,r,V),n=ght(I,S,V);return ot(opt,{...n,text:o?.text||"",htmlElementId:t,configurationsItemInfo:G})}case"text":{const e={text:u?.text},r=Object.keys(e),{text:o}=yht(e,D,r,V),n=ght(I,S,V);return ot(rpt,{...o,...n,htmlElementId:t,configurationItemInfo:G})}case"consent":{const e=yht(u,D,[],V),r=ght(I,S,V)||{};return ot(rrt,{...r,htmlElementId:t,properties:e,configurationItemInfo:G})}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=yht(e,D,r,V),{state:n,gap:i,...s}=ght(a?.props,S,V);return ot(Zpt,{gap:i,inputProps:s,validations:w||[],htmlElementId:t,validationState:n,overridesProperties:o,configurationItemInfo:G})}case"stepper":{const e=ght(I,S,V),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}=yht(a,D,i,t);return{...n,...ght(o?.props,S,t),title:s?.text||"",subText:l?.text||""}});return ot(sht,{...e,items:r||[],isMobile:v,moleculeId:t,configurationItemInfo:G})}case"checklist":{const e=ght(I,S,V)||{},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=yht(a,D,i,t),l=ght(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:N?.[e.id]?.interacted||"unchecked"}}case"divider_item":{const e=ght(o?.props,S,t)||{};return{...n,...e,type:"divider_item"}}case"text_item":{const e={text:r?.text},a=Object.keys(e),i=yht(e,D,a,t),s=ght(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=yht(e,D,a,t),s=ght(o?.props,S,t)||{},l=i.text?.text||q4e;return{...n,...s,type:"rich_text_item",text:l}}default:return{...n,type:e.type}}});return ot(ert,{...e,items:r||[],moleculeId:t,configurationItemInfo:G})}case"accordion":{const e=ght(I,S,V),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}=yht(a,D,i,t);return{...n,...ght(o?.props,S,t),text:s?.text||"",subText:l?.text||"",bodyText:c?.text||""}});return ot(Wtt,{...e,items:r||[],moleculeId:t,configurationItemInfo:G})}case"menu":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=yht(e,D,r,V),a=ght(I,S,V),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}=yht(a,D,i,t),u=ght(o?.props,S,t);return{...n,...u,disabled:N?.[e.id]?N?.[e.id]?.disabled:l?.value||u?.disabled||!1,text:s?.text||"Menu Item",link:c}});return ot(Hpt,{...a,items:i||[],moleculeId:t,buttonText:o?.text||"Open Menu",configurationItemInfo:G,buttonDisabled:N?.[t]?N?.[t]?.disabled:n?.value||a?.disabled||!1})}case"tabs":{const e=ght(I,S,V),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}=yht(n,D,a,t);return{...ght(o?.props,S,t),id:e.id,tabKey:V7e(s)?F7e(E7e,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 ot(uht,{...e,items:a||[],isMobile:v,moleculeId:t,activeTabKey:i,configurationItemInfo:G,onTabChange:_?void 0:({newTabKey:e,link:t})=>{n?c?.onTabChange?.(e):V7e(t)?O?.({link:t?.internalLink||""}):L7e(t?.externalLink)}})}case"divider":{const e=ght(I,S,V);return ot(Jdt,{moleculeId:t,configurationItemInfo:G,...e})}case"link":{const e={text:u?.text,link:u?.link},r=Object.keys(e),{text:o,link:n}=yht(e,D,r,V),a=n,i=ght(I,S,V);return ot(Vpt,{moleculeId:t,...i,link:a,type:a?.type,src:K?void 0:U7e(a,b)||"",text:o?.text||"",disabled:i?.disabled||$,configurationItemInfo:G})}case"data_driven_link":{const e={text:u?.text},r=Object.keys(e),{text:o}=yht(e,D,r,V),n=ght(I,S,V);return ot(Vpt,{moleculeId:t,...n,text:o?.text||"",sourceDataModelField:L,disabled:n?.disabled||$,configurationItemInfo:G})}case"video":{const e={video:u?.video,coverImage:u?.coverImage},r=Object.keys(e),{video:o,coverImage:n}=yht(e,D,r,V),a=ght(I,S,V);return ot(hht,{...a,moleculeId:t,poster:n?.imageFile?.url,src:o?.videoSource??o?.videoFile?.url??"",configurationItemInfo:G})}case"badge":{const e=ght(I,S,V);return ot(Ktt,{...e,configurationItemInfo:G})}case"alert":{const e={text:u?.text,subText:u?.subText},t=Object.keys(e),{text:r,subText:o}=yht(e,D,t,V),n=ght(I,S,V);return ot(Utt,{text:r?.text||"",subText:o?.text||"",...n,configurationItemInfo:G})}case"chip":{const e={text:u?.text},t=Object.keys(e),{text:r}=yht(e,D,t,V),o=ght(I,S,V);return ot(trt,{text:r?.text||"",...o,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(Bpt,{name:z,text:o?.text||"",placeholderText:n?.text||"",sourceDataModelField:L,required:a?.value,isDisplayOnly:"email_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(rht,{name:z,text:o?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,isDisplayOnly:"phone_number_display_field"===r,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(Upt,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"numeric_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(irt,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"currency_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(Xtt,{name:z,text:o?.text||"",required:a?.value,isDisplayOnly:"basic_text_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,placeholderText:n?.text||"",sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),s=ght(I,S,V);return ot(oht,{name:z,text:o?.text||"",required:n?.value,requiredErrorText:a?.text,validationErrorText:i?.text,sourceDataModelField:L,isDisplayOnly:"rating_display_field"===r,...s,configurationItemInfo:G})}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}=yht(e,D,o,V),l=ght(I,S,V);return ot(cht,{name:z,moleculeId:t,text:n?.text||"",required:a?.value,isDisplayOnly:"switch_display_field"===r,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(aht,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:"slider_display_field"===r,requiredErrorText:a?.text,validationErrorText:i?.text,placeholderText:s?.text,sourceDataModelField:L,...l,configurationItemInfo:G})}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}=yht(e,D,o,V),c=ght(I,S,V);return ot(bat,{dateAdapter:xnt,children:ot(Qdt,{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:L,...c,configurationItemInfo:G})})}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}=yht(e,D,t,V),l=ght(I,S,V);return ot(bat,{dateAdapter:xnt,children:ot(pht,{...l,name:z,text:o?.text||"",placeholderText:n?.text||"",required:s?.value,requiredErrorText:a?.text,validationErrorText:i?.text,isDisplayOnly:"time_picker_display"===r,sourceDataModelField:L,configurationItemInfo:G})})}case"select_display_field":case"select":{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,placeholderText:a,requiredErrorText:i,validationErrorText:s}=yht(e,D,t,V),l=ght(I,S,V),c="select_display_field"===r;return ot(nht,{name:z,text:o?.text||"",required:n?.value,isDisplayOnly:c,predefinedValue:B,placeholderText:a?.text||"",requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:L,...l,configurationItemInfo:G})}case"image":{const e={image:u?.image,link:u?.link},r=Object.keys(e),{image:o,link:n}=yht(e,D,r,V),a=ght(I,S,V);return ot(ept,{...a,src:o?.imageSource||o?.imageFile?.url||o?.imageFile?.id||"",onClick:n?()=>V7e(n)?O?.({link:n?.internalLink||""}):L7e(n?.externalLink):void 0,moleculeId:t,configurationItemInfo:G,properties:{image:o,link:n}})}case"button":{const e={text:u?.text,action:u?.action},r=Object.keys(e),{text:o,action:n}=yht(e,D,r,V),a=ght(I,S,V);return ot(HGe,{moleculeId:t,text:o?.text||"",...a,disabled:a?.disabled||$,configurationItemInfo:G,properties:{text:o,action:n}})}case"avatar":{const e=ght(I,S,V);return ot(Gtt,{...e,sourceDataModelField:L,configurationItemInfo:G})}case"drawer":{const e={text:u?.text,disabled:u?.disabled},r=Object.keys(e),{text:o,disabled:n}=yht(e,D,r,V),a=ght(I,S,V),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=yht(a,D,i,t),l=ght(o?.props,S,t),c={...n,...l};switch(e.type){case"menu_item":return{...c,disabled:N?.[e.id]?N?.[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||q4e};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 ot(Ipt,{...a,items:i||[],moleculeId:t,buttonText:o?.text||a?.buttonText,buttonDisabled:N?.[t]?N?.[t]?.disabled:n?.value||a?.disabled||!1,configurationItemInfo:G})}case"speed_dial":{const e=ght(I,S,V),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=yht(a,D,i,t),l=ght(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 ot(iht,{...e,items:r||[],moleculeId:t,configurationItemInfo:G})}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}=yht(e,D,o,V),l=ght(I,S,V);return ot(Jtt,{name:z,moleculeId:t,label:n?.text||"",required:a?.value,requiredErrorText:i?.text,validationErrorText:s?.text,sourceDataModelField:L,isDisplayOnly:"checkbox_display"===r,...l,configurationItemInfo:G})}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}=yht(e,D,o,V),c=ght(I,S,V);return ot(Qtt,{name:z,moleculeId:t,confirmText:n?.text||"Yes",rejectText:a?.text||"No",required:i?.value,requiredErrorText:s?.text,validationErrorText:l?.text,sourceDataModelField:L,isDisplayOnly:"binary_radio_buttons_display"===r,...c,configurationItemInfo:G})}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}=yht(e,D,t,V),i=ght(I,S,V);return ot(jst,{...i,name:z,required:o?.value,requiredErrorText:n?.text,validationErrorText:a?.text,isDisplayOnly:"date_calendar_display"===r,sourceDataModelField:L,configurationItemInfo:G})}default:return ot(rt,{children:"There is no such type of molecule yet."})}})()},xht=(e,t)=>{if(!e)return null;let r=e;for(const o of t){if(!r||"object"!=typeof r)return null;const{dmfId:e,index:t}=o;if(r=r[e],void 0===r)return null;if(void 0!==t){if(!Array.isArray(r))return null;if(r=r[t],void 0===r)return null}}return r&&"object"==typeof r?r:null},bht=({nestedPathSegments:t})=>{const{localStateObject:r}=FC(),o=dt();return e.useMemo(()=>{if(o?.itemDataByDmfId)return o.itemDataByDmfId;const e=(e=>{if(null!=e){if("object"==typeof e&&!Array.isArray(e)&&"viewType"in e&&"data"in e){const t=e.data;if(null==t)return;return t}return e}})(r);return void 0!==e?0===t.length||Array.isArray(e)?e:xht(e,t):void 0},[o?.itemDataByDmfId,r,t])},wht=e=>"container"===e.instance&&"empty_state"===e.type,kht=e=>{if("container"!==e.instance)return;const t=e;return t.replicatorFieldId||t.config?.props?.replicatorFieldId},_ht=(e,t)=>{if(!e)return!0;if(Array.isArray(e))return 0===e.length;return(e=>null==e||Array.isArray(e)&&0===e.length||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length)(e[t])},Cht=e.memo(({item:t,tabsProps:r,formData:o,setFormData:n,isMobile:a,parentId:i,nestedPathSegments:s=[]})=>{const l=Ut(),{organismMetadata:c}=FC(),u="items"in t?t.items:void 0,d=(({items:t})=>{const{stateConfig:r}=WC(),{localStateObject:o}=FC(),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:u}),{filteredItems:p}=(({containerItems:t,visibleItems:r,nestedPathSegments:o})=>{const{isLoadingData:n,isEmptyDataState:a,forceEmptyStatePreview:i,previewingEmptyStates:s,isConfigurationMode:l}=FC(),c=bht({nestedPathSegments:o});return e.useMemo(()=>{if(!t||0===t.length)return{filteredItems:r,showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const e=t.filter(wht);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};if(n&&!i&&!o)return{filteredItems:r.filter(e=>!wht(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1};const u=new Set;let d=!1;return e.forEach(e=>{const t=kht(e);i||(t?s?.includes(t):s?.includes("__organism__"))?t?u.add(t):d=!0:l||(t?_ht(c,t)&&u.add(t):a&&(d=!0))}),d||0!==u.size?{filteredItems:r.filter(e=>{if(wht(e)){const t=kht(e);return t?u.has(t):d}return!1}),showingEmptyStateForFields:u,showOrganismLevelEmptyState:d}:{filteredItems:r.filter(e=>!wht(e)),showingEmptyStateForFields:new Set,showOrganismLevelEmptyState:!1}},[t,r,c,n,a,i,s,l])})({containerItems:u,visibleItems:d,nestedPathSegments:s});if("molecule"===t.instance)return ot(mht,{additionalInfo:`molecule: ${t.id}`,children:ot(vht,{...t,form:l,isMobile:a,formData:o,parentId:i,tabsProps:r,setFormData:n,metadata:{...t.metadata,stateListenerId:c?.stateListenerId||t.id}})});const h=!(!u||!u.length),f="form"===t.type&&t.config.props?.activeChildrenIds||[];return h?f.length?ot(mht,{additionalInfo:`form: ${t.id}`,children:ot(Rht,{item:t,activeChildrenIds:f,formData:o,setFormData:n,isMobile:a})}):ot(mht,{additionalInfo:`container: ${t.id}`,children:ot(Tht,{...t,isMobile:a,nestedPathSegments:s,config:t.config?{...t.config,props:t.config.props||{},wide:t.config.wide||{},compact:t.config.compact||{}}:{props:{},wide:{},compact:{}},children:p?.map(e=>ot(Cht,{item:e,parentId:e.id,formData:o,setFormData:n,isMobile:a,tabsProps:r,nestedPathSegments:s},e.id))})}):null}),Mht=({order:t=0,id:r,formStepStyles:o,containerProps:n={hasOwnButton:!1}})=>{const a=Ut(),[i,s]=e.useState({}),{formId:l,submitHandler:c,isFormInEditMode:u,organismMetadata:d}=FC(),{groupStepItemsByStepContainer:p}=FC();Object.keys(d?.popupPayload??{})[0];const{currentStep:h,canGoToNextStep:f,canGoToPrevStep:m,goToNextStep:y,goToPrevStep:g,reset:v,setStep:x}=Xr(),b=p(),{submitForm:w}=RGe(),{forms:k}=ct(),_=t+1,C=b.get(r)||[];return h!==_?null:ot("div",{style:o,children:nt(rt,{children:[C.map(e=>ot(Cht,{item:e,setFormData:s,formData:i},e.id)),(!n?.hasOwnButton||d?.isFormInsidePopUp)&&u&&nt("div",{style:{display:"flex",gap:"16px"},children:[ot(HGe,{text:m?"Back":"Cancel",variant:"outlined",onClick:()=>{m?g():(v(),x(1))}}),ot(HGe,{text:f?"Next":"Submit",variant:"contained",onClick:async()=>{const e=await a.trigger();if(!e)return void C6e({message:"Please fill all required fields",type:"error"});if(f)return void y();const t=a.getValues();e&&l&&(c?await c({formId:l,data:t}):k?.submit&&await w({formId:l,data:t}))}})]})]})})},Sht=e=>e&&"object"==typeof e&&"value"in e&&!Array.isArray(e)?e.value:e,Dht=e=>{const t={};for(const[r,o]of Object.entries(e))t[r]=Sht(o);return t},Oht=(e,t)=>{if(!e?.enabled||!e.sourceDataModelFieldId)return null;if(!t)return null;const r=t[e.sourceDataModelFieldId];if(null==r)return null;let o=null;if("string"==typeof r)o=r;else if("object"==typeof r)if("id"in r&&"string"==typeof r.id)o=r.id;else if("value"in r){const e=r.value;"string"==typeof e?o=e:"object"==typeof e&&e&&"id"in e&&(o=e.id)}return o},Pht=e.memo(({containerId:t,replicatorFieldId:r,nestedPathSegments:o=[],children:n,properties:a,config:i,renderWrapper:s})=>{const{localStateObject:l,formId:c}=FC(),u=dt(),d=LC(),p=e.useRef(!1),h=a?.styleVariantConfig||i?.styleVariantConfig;!p.current&&h&&(console.log("[StyleVariant] ReplicatorContainer init:",{replicatorFieldId:r,hasLocalState:!!l&&Object.keys(l).length>0,hasStyleVariantConfig:!0}),p.current=!0);if(Boolean(c&&d)&&d){const{fieldArrayMethods:{fields:e}}=d;return ot(rt,{children:e.map((e,a)=>{const i=[...o,{dmfId:r||"default",index:a}],l=e,c=Oht(h,l),u={containerId:t||`replicator-${r||"default"}-${a}`,nestedPathSegments:i,itemIndex:a,itemDataByDmfId:l,rawItemDataByDmfId:l,activeVariant:c},d=s?s(a,n,c):n;return ot("div",{"data-replicator-instance":`${r||"default"}-${a}`,children:ot(pt,{value:u,children:d})},e.id)})})}const f=l||{},m=u?.itemDataByDmfId?u.itemDataByDmfId:xht(f,o),y=r?m?.[r]:m;if(!y||"object"!=typeof y){const e=r?[...o,{dmfId:r}]:o;return ot(pt,{value:{containerId:t||`replicator-${r||"default"}`,nestedPathSegments:e,itemDataByDmfId:{},activeVariant:null},children:s?s(void 0,n,null):n})}if(Array.isArray(y))return ot(rt,{children:y.map((e,a)=>{const i=[...o,{dmfId:r||"default",index:a}],l=Dht(e),c=Oht(h,e);return ot(pt,{value:{containerId:t||`replicator-${r||"default"}-${a}`,nestedPathSegments:i,itemIndex:a,itemDataByDmfId:l,rawItemDataByDmfId:e,activeVariant:c},children:s?s(a,n,c):n},`${r||"default"}-${a}`)})});const g=r?[...o,{dmfId:r}]:o,v=Dht(y),x=Oht(h,y);return ot(pt,{value:{containerId:t||`replicator-${r||"default"}`,nestedPathSegments:g,itemDataByDmfId:v,rawItemDataByDmfId:y,activeVariant:x},children:s?s(void 0,n,x):n})}),Eht=({replicatorFieldId:t,nestedPathSegments:r=[],minInstances:o=1,maxInstances:n=50,children:a})=>{const{control:i}=Ut(),s=$C(),c=e.useRef(!1),u=r.map(e=>void 0!==e.index?`${e.dmfId}.${e.index}`:e.dmfId).filter(Boolean).join(".");const d=u?`${u}.${t}`:t,p=function(e){const t=Ut(),{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(Lr)),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),Yt(()=>r._subjects.array.subscribe({next:({values:e,name:t})=>{if(t===p.current||!t){const t=Dt(e,p.current);Array.isArray(t)&&(c(t),u.current=t.map(Lr))}}}).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,Pr(o,r._names)&&r._subjects.state.next({...r._formState}),h.current&&(!Sr(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!Sr(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([o]).then(e=>{const t=Dt(e.errors,o),n=Dt(r._formState.errors,o);(n?!t&&n.type||t&&(n.type!==t.type||n.message!==t.message):t&&t.type)&&(t?Pt(r._formState.errors,o,t):pr(r._formState.errors,o),r._subjects.state.next({errors:r._formState.errors}))});else{const e=Dt(r._fields,o);!e||!e._f||Sr(r._options.reValidateMode).isOnSubmit&&Sr(r._options.mode).isOnSubmit||Ir(e,r._names.disabled,r._formValues,r._options.criteriaMode===At,r._options.shouldUseNativeValidation,!0).then(e=>!ar(e)&&r._subjects.state.next({errors:Tr(r._formState.errors,e,o)}))}r._subjects.state.next({name:o,values:kt(r._formValues)}),r._names.focus&&Er(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(()=>(!Dt(r._formValues,o)&&r._setFieldArray(o),()=>{r._options.shouldUnregister||a?r.unregister(o):((e,t)=>{const o=Dt(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);Gr(n,e,t),Gr(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,Gr,{argA:e,argB:t},!1)},[f,o,r]),move:l.default.useCallback((e,t)=>{const n=r._getFieldArray(o);qr(n,e,t),qr(u.current,e,t),f(n),c(n),r._setFieldArray(o,n,qr,{argA:e,argB:t},!1)},[f,o,r]),prepend:l.default.useCallback((e,t)=>{const n=tr(kt(e)),a=Wr(r._getFieldArray(o),n);r._names.focus=Br(o,0,t),u.current=Wr(u.current,n.map(Lr)),f(a),c(a),r._setFieldArray(o,a,Wr,{argA:$r(e)})},[f,o,r]),append:l.default.useCallback((e,t)=>{const n=tr(kt(e)),a=Vr(r._getFieldArray(o),n);r._names.focus=Br(o,a.length-1,t),u.current=Vr(u.current,n.map(Lr)),f(a),c(a),r._setFieldArray(o,a,Vr,{argA:$r(e)})},[f,o,r]),remove:l.default.useCallback(e=>{const t=Ur(r._getFieldArray(o),e);u.current=Ur(u.current,e),f(t),c(t),!Array.isArray(Dt(r._fields,o))&&Pt(r._fields,o,void 0),r._setFieldArray(o,t,Ur,{argA:e})},[f,o,r]),insert:l.default.useCallback((e,t,n)=>{const a=tr(kt(t)),i=Hr(r._getFieldArray(o),e,a);r._names.focus=Br(o,e,n),u.current=Hr(u.current,e,a.map(Lr)),f(i),c(i),r._setFieldArray(o,i,Hr,{argA:e,argB:$r(t)})},[f,o,r]),update:l.default.useCallback((e,t)=>{const n=kt(t),a=Kr(r._getFieldArray(o),e,n);u.current=[...a].map((t,r)=>t&&r!==e?u.current[r]:Lr()),f(a),c([...a]),r._setFieldArray(o,a,Kr,{argA:e,argB:n},!0,!1)},[f,o,r]),replace:l.default.useCallback(e=>{const t=tr(kt(e));u.current=t.map(Lr),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]||Lr()})),[s,n])}}({control:i,name:d}),{fields:h,append:f}=p;return e.useEffect(()=>{if(!c.current&&(c.current=!0,0===h.length&&o>0)){Array.from({length:o},()=>({})).forEach(e=>{f(e,{shouldFocus:!1})})}},[]),e.useEffect(()=>{if(s)return s.register({replicatorFieldId:t,fieldArrayName:d,fieldArrayMethods:p,minInstances:o,maxInstances:n}),()=>{s.unregister(t)}},[s,t,d,p,o,n]),ot(BC,{replicatorFieldId:t,fieldArrayName:d,fieldArrayMethods:p,minInstances:o,maxInstances:n,children:a})},jht={dots:!0,infinite:!1,autoplay:!1,autoplaySpeed:5e3,arrows:!0,slidesToShow:1,slidesToScroll:1,adaptiveHeight:!0,swipeToSlide:!0},Tht=e.memo(({id:t,type:r,name:o,config:n,children:a,metadata:i,isMobile:s,properties:l,nestedPathSegments:c=[],replicatorFieldId:u,parentStyleVariantConfig:d,parentContainerWithVariantsId:p,parentContainerActiveVariant:h})=>{const f=Ge(),{props:m,wide:y,compact:g}=n||{},v=u||m?.replicatorFieldId,{isConfigurationMode:x,onConfigurationItemClicked:b,selectedConfigurationItemId:w,currentStyleProperties:k,currentContentProperties:_,formId:C,localState:M}=FC(),S=dt(),{activeVariant:D,containerId:O}=S,P=Ut(),E=Boolean(C&&P),j=e.useMemo(()=>{if("replicator"===r)return;const e=l?.styleVariantConfig,n=e&&"object"==typeof e&&"data"in e?e.data:e,a=n?.enabled?n:void 0;return a&&x&&console.log("[StyleVariant] Container has styleVariantConfig:",{containerId:t,containerName:o,containerType:r,sourceDataModelFieldId:a.sourceDataModelFieldId,enabled:a.enabled}),a},[r,l,t,o,x]),T=e.useMemo(()=>{if(!j?.sourceDataModelFieldId)return null;const e=j.sourceDataModelFieldId;if(x&&console.log("[StyleVariant] Container resolving variant:",{containerId:t,containerName:o,sourceDataModelFieldId:e,isFormMode:E,localStateKeys:M?Object.keys(M):[],localStateValue:M?.[e]}),E&&P){const t=(r=S.nestedPathSegments||c,n=e,r&&0!==r.length?[...r.map(e=>void 0!==e.index?`${e.dmfId}.${e.index}`:e.dmfId),n].filter(Boolean).join("."):n),o=P.getValues?.(t)??P.getValues?.(`${t}.id`)??P.getValues?.(`${t}.value`);if(x&&console.log("[StyleVariant] Container form context lookup:",{path:t,formValue:o}),void 0!==o){const t="string"==typeof o||"number"==typeof o?{id:String(o),value:o}:o,r=Oht(j,{[e]:t});if(x&&console.log("[StyleVariant] Container resolved from form:",r),r)return r}}var r,n;const a=M?.[e];if(x&&console.log("[StyleVariant] Container localState lookup:",{sourceField:e,stateVal:a,localState:M}),void 0!==a){const t=Oht(j,{[e]:a});if(x&&console.log("[StyleVariant] Container resolved from localState:",t),t)return t}const i=S.getDmfValue(e),s=S.rawItemDataByDmfId?.[e];x&&console.log("[StyleVariant] Container runtime lookup:",{fieldValue:i,rawValue:s});const l=Oht(j,{[e]:s??i});return x&&console.log("[StyleVariant] Container resolved from runtime:",l),l},[j,S,P,E,M,c,t,o]),N=d,R=h??D??null,F=T??R,I=(j&&j.enabled?t:p)||O||null,A=e.useMemo(()=>{if(!(j&&j.enabled||!!N||null!==R))return a;const r=j&&j.enabled?j:N,o=j&&j.enabled?T:R,n=(j&&j.enabled?t:p)||t;return e.Children.map(a,t=>e.isValidElement(t)?e.cloneElement(t,{...t.props,parentStyleVariantConfig:r,parentContainerWithVariantsId:n,parentContainerActiveVariant:o}):t)},[a,j,T,N,R,t,p]),z=w===t,L=z?{backgroundImage:_?.backgroundImage??l?.backgroundImage??{imageFile:{url:""}}}:l,{containerProps:B={},containerStyle:V={}}=y||{};let $={...V};const{containerProps:H={},containerStyle:q={}}=g||{};let W={...q};k&&z&&(W={...q,...k},$={...V,...k});const U=SC("xs"),G=s??U,K=G?W:$,Y=G?H:B,Z={...m,...Y,enableBackgroundImage:K?.enableBackgroundImage},X=e.useMemo(()=>({entityId:t,entityType:r,entityName:o,entity:"container",libraryEntityId:i?.containerLibraryId||void 0,activeStyleVariant:F,parentReplicatorWithVariants:I,parentStyleVariantConfig:j&&j.enabled?j:N}),[r,o,t,i,F,I,j,N]),Q=x?{onClick:e=>{e&&e.stopPropagation(),b(X,!1)},onDoubleClick:e=>{e?.stopPropagation(),b(X,!0)}}:{},J=`${t}.${G?"mobile":"desktop"}`,ee=bo`
|
|
1032
1032
|
display: flex;
|
|
1033
1033
|
position: relative; /* default containing block for absolute children */
|
|
1034
1034
|
overflow: visible; /* allow positioned children to overflow */
|