@simoncomputing/mui-bueno-v2 0.25.9 → 0.25.11

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/index.cjs.js CHANGED
@@ -76,7 +76,7 @@ theme.transitions = createTransitions(theme.transitions || {});
76
76
 
77
77
  export default theme;`}function gb(t={},...e){const{breakpoints:n,mixins:r={},spacing:o,palette:i={},transitions:s={},typography:a={},shape:l,...u}=t;if(t.vars&&t.generateThemeVars===void 0)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.":Yo(20));const f=R0(i),p=hh(t);let m=Vn(p,{mixins:kH(p.breakpoints,r),palette:f,shadows:IH.slice(),typography:OH(f,a),transitions:PH(s),zIndex:{...NH}});if(m=Vn(m,u),m=e.reduce((g,v)=>Vn(g,v),m),process.env.NODE_ENV!=="production"){const g=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],v=(y,x)=>{let S;for(S in y){const k=y[S];if(g.includes(S)&&Object.keys(k).length>0){if(process.env.NODE_ENV!=="production"){const T=We("",S);console.error([`MUI: The \`${x}\` component increases the CSS specificity of the \`${S}\` internal state.`,"You can not override it like this: ",JSON.stringify(y,null,2),"",`Instead, you need to use the '&.${T}' syntax:`,JSON.stringify({root:{[`&.${T}`]:k}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
78
78
  `))}y[S]={}}}};Object.keys(m.components).forEach(y=>{const x=m.components[y].styleOverrides;x&&y.startsWith("Mui")&&v(x,y)})}return m.unstable_sxConfig={...Iu,...u==null?void 0:u.unstable_sxConfig},m.unstable_sx=function(v){return ga({sx:v,theme:this})},m.toRuntimeSource=dM,m}function yb(t){let e;return t<1?e=5.11916*t**2:e=4.5*Math.log(t+1)+2,Math.round(e*10)/1e3}const LH=[...Array(25)].map((t,e)=>{if(e===0)return"none";const n=yb(e);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function fM(t){return{inputPlaceholder:t==="dark"?.5:.42,inputUnderline:t==="dark"?.7:.42,switchTrackDisabled:t==="dark"?.2:.12,switchTrack:t==="dark"?.3:.38}}function pM(t){return t==="dark"?LH:[]}function jH(t){const{palette:e={mode:"light"},opacity:n,overlays:r,...o}=t,i=R0(e);return{palette:i,opacity:{...fM(i.mode),...n},overlays:r||pM(i.mode),...o}}function BH(t){var e;return!!t[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!t[0].match(/sxConfig$/)||t[0]==="palette"&&!!((e=t[1])!=null&&e.match(/(mode|contrastThreshold|tonalOffset)/))}const FH=t=>[...[...Array(25)].map((e,n)=>`--${t?`${t}-`:""}overlays-${n}`),`--${t?`${t}-`:""}palette-AppBar-darkBg`,`--${t?`${t}-`:""}palette-AppBar-darkColor`],VH=t=>(e,n)=>{const r=t.rootSelector||":root",o=t.colorSchemeSelector;let i=o;if(o==="class"&&(i=".%s"),o==="data"&&(i="[data-%s]"),o!=null&&o.startsWith("data-")&&!o.includes("%s")&&(i=`[${o}="%s"]`),t.defaultColorScheme===e){if(e==="dark"){const s={};return FH(t.cssVarPrefix).forEach(a=>{s[a]=n[a],delete n[a]}),i==="media"?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:s}}:i?{[i.replace("%s",e)]:s,[`${r}, ${i.replace("%s",e)}`]:n}:{[r]:{...n,...s}}}if(i&&i!=="media")return`${r}, ${i.replace("%s",String(e))}`}else if(e){if(i==="media")return{[`@media (prefers-color-scheme: ${String(e)})`]:{[r]:n}};if(i)return i.replace("%s",String(e))}return r};function zH(t,e){e.forEach(n=>{t[n]||(t[n]={})})}function we(t,e,n){!t[e]&&n&&(t[e]=n)}function Rc(t){return typeof t!="string"||!t.startsWith("hsl")?t:aM(t)}function mi(t,e){`${e}Channel`in t||(t[`${e}Channel`]=_c(Rc(t[e]),`MUI: Can't create \`palette.${e}Channel\` because \`palette.${e}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
79
- To suppress this warning, you need to explicitly provide the \`palette.${e}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function HH(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const Lo=t=>{try{return t()}catch{}},WH=(t="mui")=>oH(t);function Bg(t,e,n,r){if(!e)return;e=e===!0?{}:e;const o=r==="dark"?"dark":"light";if(!n){t[r]=jH({...e,palette:{mode:o,...e==null?void 0:e.palette}});return}const{palette:i,...s}=gb({...n,palette:{mode:o,...e==null?void 0:e.palette}});return t[r]={...e,palette:i,opacity:{...fM(o),...e==null?void 0:e.opacity},overlays:(e==null?void 0:e.overlays)||pM(o)},s}function UH(t={},...e){const{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:o=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:s=BH,colorSchemeSelector:a=n.light&&n.dark?"media":void 0,rootSelector:l=":root",...u}=t,f=Object.keys(n)[0],p=r||(n.light&&f!=="light"?"light":f),m=WH(i),{[p]:g,light:v,dark:y,...x}=n,S={...x};let k=g;if((p==="dark"&&!("dark"in n)||p==="light"&&!("light"in n))&&(k=!0),!k)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${p}\` option is either missing or invalid.`:Yo(21,p));const T=Bg(S,k,u,p);v&&!S.light&&Bg(S,v,void 0,"light"),y&&!S.dark&&Bg(S,y,void 0,"dark");let C={defaultColorScheme:p,...T,cssVarPrefix:i,colorSchemeSelector:a,rootSelector:l,getCssVar:m,colorSchemes:S,font:{...TH(T.typography),...T.font},spacing:HH(u.spacing)};Object.keys(C.colorSchemes).forEach(V=>{const M=C.colorSchemes[V].palette,j=F=>{const L=F.split("-"),A=L[1],_=L[2];return m(F,M[A][_])};if(M.mode==="light"&&(we(M.common,"background","#fff"),we(M.common,"onBackground","#000")),M.mode==="dark"&&(we(M.common,"background","#000"),we(M.common,"onBackground","#fff")),zH(M,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),M.mode==="light"){we(M.Alert,"errorColor",jt(M.error.light,.6)),we(M.Alert,"infoColor",jt(M.info.light,.6)),we(M.Alert,"successColor",jt(M.success.light,.6)),we(M.Alert,"warningColor",jt(M.warning.light,.6)),we(M.Alert,"errorFilledBg",j("palette-error-main")),we(M.Alert,"infoFilledBg",j("palette-info-main")),we(M.Alert,"successFilledBg",j("palette-success-main")),we(M.Alert,"warningFilledBg",j("palette-warning-main")),we(M.Alert,"errorFilledColor",Lo(()=>M.getContrastText(M.error.main))),we(M.Alert,"infoFilledColor",Lo(()=>M.getContrastText(M.info.main))),we(M.Alert,"successFilledColor",Lo(()=>M.getContrastText(M.success.main))),we(M.Alert,"warningFilledColor",Lo(()=>M.getContrastText(M.warning.main))),we(M.Alert,"errorStandardBg",Bt(M.error.light,.9)),we(M.Alert,"infoStandardBg",Bt(M.info.light,.9)),we(M.Alert,"successStandardBg",Bt(M.success.light,.9)),we(M.Alert,"warningStandardBg",Bt(M.warning.light,.9)),we(M.Alert,"errorIconColor",j("palette-error-main")),we(M.Alert,"infoIconColor",j("palette-info-main")),we(M.Alert,"successIconColor",j("palette-success-main")),we(M.Alert,"warningIconColor",j("palette-warning-main")),we(M.AppBar,"defaultBg",j("palette-grey-100")),we(M.Avatar,"defaultBg",j("palette-grey-400")),we(M.Button,"inheritContainedBg",j("palette-grey-300")),we(M.Button,"inheritContainedHoverBg",j("palette-grey-A100")),we(M.Chip,"defaultBorder",j("palette-grey-400")),we(M.Chip,"defaultAvatarColor",j("palette-grey-700")),we(M.Chip,"defaultIconColor",j("palette-grey-700")),we(M.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),we(M.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),we(M.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),we(M.LinearProgress,"primaryBg",Bt(M.primary.main,.62)),we(M.LinearProgress,"secondaryBg",Bt(M.secondary.main,.62)),we(M.LinearProgress,"errorBg",Bt(M.error.main,.62)),we(M.LinearProgress,"infoBg",Bt(M.info.main,.62)),we(M.LinearProgress,"successBg",Bt(M.success.main,.62)),we(M.LinearProgress,"warningBg",Bt(M.warning.main,.62)),we(M.Skeleton,"bg",`rgba(${j("palette-text-primaryChannel")} / 0.11)`),we(M.Slider,"primaryTrack",Bt(M.primary.main,.62)),we(M.Slider,"secondaryTrack",Bt(M.secondary.main,.62)),we(M.Slider,"errorTrack",Bt(M.error.main,.62)),we(M.Slider,"infoTrack",Bt(M.info.main,.62)),we(M.Slider,"successTrack",Bt(M.success.main,.62)),we(M.Slider,"warningTrack",Bt(M.warning.main,.62));const F=qd(M.background.default,.8);we(M.SnackbarContent,"bg",F),we(M.SnackbarContent,"color",Lo(()=>M.getContrastText(F))),we(M.SpeedDialAction,"fabHoverBg",qd(M.background.paper,.15)),we(M.StepConnector,"border",j("palette-grey-400")),we(M.StepContent,"border",j("palette-grey-400")),we(M.Switch,"defaultColor",j("palette-common-white")),we(M.Switch,"defaultDisabledColor",j("palette-grey-100")),we(M.Switch,"primaryDisabledColor",Bt(M.primary.main,.62)),we(M.Switch,"secondaryDisabledColor",Bt(M.secondary.main,.62)),we(M.Switch,"errorDisabledColor",Bt(M.error.main,.62)),we(M.Switch,"infoDisabledColor",Bt(M.info.main,.62)),we(M.Switch,"successDisabledColor",Bt(M.success.main,.62)),we(M.Switch,"warningDisabledColor",Bt(M.warning.main,.62)),we(M.TableCell,"border",Bt(Ud(M.divider,1),.88)),we(M.Tooltip,"bg",Ud(M.grey[700],.92))}if(M.mode==="dark"){we(M.Alert,"errorColor",Bt(M.error.light,.6)),we(M.Alert,"infoColor",Bt(M.info.light,.6)),we(M.Alert,"successColor",Bt(M.success.light,.6)),we(M.Alert,"warningColor",Bt(M.warning.light,.6)),we(M.Alert,"errorFilledBg",j("palette-error-dark")),we(M.Alert,"infoFilledBg",j("palette-info-dark")),we(M.Alert,"successFilledBg",j("palette-success-dark")),we(M.Alert,"warningFilledBg",j("palette-warning-dark")),we(M.Alert,"errorFilledColor",Lo(()=>M.getContrastText(M.error.dark))),we(M.Alert,"infoFilledColor",Lo(()=>M.getContrastText(M.info.dark))),we(M.Alert,"successFilledColor",Lo(()=>M.getContrastText(M.success.dark))),we(M.Alert,"warningFilledColor",Lo(()=>M.getContrastText(M.warning.dark))),we(M.Alert,"errorStandardBg",jt(M.error.light,.9)),we(M.Alert,"infoStandardBg",jt(M.info.light,.9)),we(M.Alert,"successStandardBg",jt(M.success.light,.9)),we(M.Alert,"warningStandardBg",jt(M.warning.light,.9)),we(M.Alert,"errorIconColor",j("palette-error-main")),we(M.Alert,"infoIconColor",j("palette-info-main")),we(M.Alert,"successIconColor",j("palette-success-main")),we(M.Alert,"warningIconColor",j("palette-warning-main")),we(M.AppBar,"defaultBg",j("palette-grey-900")),we(M.AppBar,"darkBg",j("palette-background-paper")),we(M.AppBar,"darkColor",j("palette-text-primary")),we(M.Avatar,"defaultBg",j("palette-grey-600")),we(M.Button,"inheritContainedBg",j("palette-grey-800")),we(M.Button,"inheritContainedHoverBg",j("palette-grey-700")),we(M.Chip,"defaultBorder",j("palette-grey-700")),we(M.Chip,"defaultAvatarColor",j("palette-grey-300")),we(M.Chip,"defaultIconColor",j("palette-grey-300")),we(M.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),we(M.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),we(M.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),we(M.LinearProgress,"primaryBg",jt(M.primary.main,.5)),we(M.LinearProgress,"secondaryBg",jt(M.secondary.main,.5)),we(M.LinearProgress,"errorBg",jt(M.error.main,.5)),we(M.LinearProgress,"infoBg",jt(M.info.main,.5)),we(M.LinearProgress,"successBg",jt(M.success.main,.5)),we(M.LinearProgress,"warningBg",jt(M.warning.main,.5)),we(M.Skeleton,"bg",`rgba(${j("palette-text-primaryChannel")} / 0.13)`),we(M.Slider,"primaryTrack",jt(M.primary.main,.5)),we(M.Slider,"secondaryTrack",jt(M.secondary.main,.5)),we(M.Slider,"errorTrack",jt(M.error.main,.5)),we(M.Slider,"infoTrack",jt(M.info.main,.5)),we(M.Slider,"successTrack",jt(M.success.main,.5)),we(M.Slider,"warningTrack",jt(M.warning.main,.5));const F=qd(M.background.default,.98);we(M.SnackbarContent,"bg",F),we(M.SnackbarContent,"color",Lo(()=>M.getContrastText(F))),we(M.SpeedDialAction,"fabHoverBg",qd(M.background.paper,.15)),we(M.StepConnector,"border",j("palette-grey-600")),we(M.StepContent,"border",j("palette-grey-600")),we(M.Switch,"defaultColor",j("palette-grey-300")),we(M.Switch,"defaultDisabledColor",j("palette-grey-600")),we(M.Switch,"primaryDisabledColor",jt(M.primary.main,.55)),we(M.Switch,"secondaryDisabledColor",jt(M.secondary.main,.55)),we(M.Switch,"errorDisabledColor",jt(M.error.main,.55)),we(M.Switch,"infoDisabledColor",jt(M.info.main,.55)),we(M.Switch,"successDisabledColor",jt(M.success.main,.55)),we(M.Switch,"warningDisabledColor",jt(M.warning.main,.55)),we(M.TableCell,"border",jt(Ud(M.divider,1),.68)),we(M.Tooltip,"bg",Ud(M.grey[700],.92))}mi(M.background,"default"),mi(M.background,"paper"),mi(M.common,"background"),mi(M.common,"onBackground"),mi(M,"divider"),Object.keys(M).forEach(F=>{const L=M[F];F!=="tonalOffset"&&L&&typeof L=="object"&&(L.main&&we(M[F],"mainChannel",_c(Rc(L.main))),L.light&&we(M[F],"lightChannel",_c(Rc(L.light))),L.dark&&we(M[F],"darkChannel",_c(Rc(L.dark))),L.contrastText&&we(M[F],"contrastTextChannel",_c(Rc(L.contrastText))),F==="text"&&(mi(M[F],"primary"),mi(M[F],"secondary")),F==="action"&&(L.active&&mi(M[F],"active"),L.selected&&mi(M[F],"selected")))})}),C=e.reduce((V,M)=>Vn(V,M),C);const O={prefix:i,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:VH(C)},{vars:R,generateThemeVars:P,generateStyleSheets:N}=aH(C,O);return C.vars=R,Object.entries(C.colorSchemes[C.defaultColorScheme]).forEach(([V,M])=>{C[V]=M}),C.generateThemeVars=P,C.generateStyleSheets=N,C.generateSpacing=function(){return JO(u.spacing,lh(this))},C.getColorSchemeSelector=lH(a),C.spacing=C.generateSpacing(),C.shouldSkipGeneratingVar=s,C.unstable_sxConfig={...Iu,...u==null?void 0:u.unstable_sxConfig},C.unstable_sx=function(M){return ga({sx:M,theme:this})},C.toRuntimeSource=dM,C}function BS(t,e,n){t.colorSchemes&&n&&(t.colorSchemes[e]={...n!==!0&&n,palette:R0({...n===!0?{}:n.palette,mode:e})})}function hM(t={},...e){const{palette:n,cssVariables:r=!1,colorSchemes:o=n?void 0:{light:!0},defaultColorScheme:i=n==null?void 0:n.mode,...s}=t,a=i||"light",l=o==null?void 0:o[a],u={...o,...n?{[a]:{...typeof l!="boolean"&&l,palette:n}}:void 0};if(r===!1){if(!("colorSchemes"in t))return gb(t,...e);let f=n;"palette"in t||u[a]&&(u[a]!==!0?f=u[a].palette:a==="dark"&&(f={mode:"dark"}));const p=gb({...t,palette:f},...e);return p.defaultColorScheme=a,p.colorSchemes=u,p.palette.mode==="light"&&(p.colorSchemes.light={...u.light!==!0&&u.light,palette:p.palette},BS(p,"dark",u.dark)),p.palette.mode==="dark"&&(p.colorSchemes.dark={...u.dark!==!0&&u.dark,palette:p.palette},BS(p,"light",u.light)),p}return!n&&!("light"in u)&&a==="light"&&(u.light=!0),UH({...s,colorSchemes:u,defaultColorScheme:a,...typeof r!="boolean"&&r},...e)}const yh=hM(),zl="$$material";function Mo(){const t=mh(yh);return process.env.NODE_ENV!=="production"&&D.useDebugValue(t),t[zl]||t}function mM(t){return b.jsx(ZO,{...t,defaultTheme:yh,themeId:zl})}process.env.NODE_ENV!=="production"&&(mM.propTypes={styles:c.oneOfType([c.array,c.func,c.number,c.object,c.string,c.bool])});function gM(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const go=t=>gM(t)&&t!=="classes",ne=tM({themeId:zl,defaultTheme:yh,rootShouldForwardProp:go});function qH(t){return function(n){return b.jsx(mM,{styles:typeof t=="function"?r=>t({theme:r,...n}):t})}}function KH(){return O0}const yt=rH;process.env.NODE_ENV!=="production"&&(c.node,c.object.isRequired);function ht(t){return nH(t)}function YH(t){return We("MuiSvgIcon",t)}const FS=Ve("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]),GH=t=>{const{color:e,fontSize:n,classes:r}=t,o={root:["root",e!=="inherit"&&`color${Ie(e)}`,`fontSize${Ie(n)}`]};return He(o,YH,r)},JH=ne("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color!=="inherit"&&e[`color${Ie(n.color)}`],e[`fontSize${Ie(n.fontSize)}`]]}})(yt(({theme:t})=>{var e,n,r,o,i,s,a,l,u,f,p,m,g,v;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(o=(e=t.transitions)==null?void 0:e.create)==null?void 0:o.call(e,"fill",{duration:(r=(n=(t.vars??t).transitions)==null?void 0:n.duration)==null?void 0:r.shorter}),variants:[{props:y=>!y.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((s=(i=t.typography)==null?void 0:i.pxToRem)==null?void 0:s.call(i,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((l=(a=t.typography)==null?void 0:a.pxToRem)==null?void 0:l.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((f=(u=t.typography)==null?void 0:u.pxToRem)==null?void 0:f.call(u,35))||"2.1875rem"}},...Object.entries((t.vars??t).palette).filter(([,y])=>y&&y.main).map(([y])=>{var x,S;return{props:{color:y},style:{color:(S=(x=(t.vars??t).palette)==null?void 0:x[y])==null?void 0:S.main}}}),{props:{color:"action"},style:{color:(m=(p=(t.vars??t).palette)==null?void 0:p.action)==null?void 0:m.active}},{props:{color:"disabled"},style:{color:(v=(g=(t.vars??t).palette)==null?void 0:g.action)==null?void 0:v.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),Gf=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiSvgIcon"}),{children:o,className:i,color:s="inherit",component:a="svg",fontSize:l="medium",htmlColor:u,inheritViewBox:f=!1,titleAccess:p,viewBox:m="0 0 24 24",...g}=r,v=D.isValidElement(o)&&o.type==="svg",y={...r,color:s,component:a,fontSize:l,instanceFontSize:e.fontSize,inheritViewBox:f,viewBox:m,hasSvgAsChild:v},x={};f||(x.viewBox=m);const S=GH(y);return b.jsxs(JH,{as:a,className:ge(S.root,i),focusable:"false",color:u,"aria-hidden":p?void 0:!0,role:p?"img":void 0,ref:n,...x,...g,...v&&o.props,ownerState:y,children:[v?o.props.children:o,p?b.jsx("title",{children:p}):null]})});process.env.NODE_ENV!=="production"&&(Gf.propTypes={children:c.node,classes:c.object,className:c.string,color:c.oneOfType([c.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),c.string]),component:c.elementType,fontSize:c.oneOfType([c.oneOf(["inherit","large","medium","small"]),c.string]),htmlColor:c.string,inheritViewBox:c.bool,shapeRendering:c.string,sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),titleAccess:c.string,viewBox:c.string});Gf.muiName="SvgIcon";function De(t,e){function n(r,o){return b.jsx(Gf,{"data-testid":`${e}Icon`,ref:o,...r,children:t})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${e}Icon`),n.muiName=Gf.muiName,D.memo(D.forwardRef(n))}function XH(t,e){if(!t)return e;if(typeof t=="function"||typeof e=="function")return o=>{const i=typeof e=="function"?e(o):e,s=typeof t=="function"?t({...o,...i}):t,a=ge(o==null?void 0:o.className,i==null?void 0:i.className,s==null?void 0:s.className);return{...i,...s,...!!a&&{className:a},...(i==null?void 0:i.style)&&(s==null?void 0:s.style)&&{style:{...i.style,...s.style}},...(i==null?void 0:i.sx)&&(s==null?void 0:s.sx)&&{sx:[...Array.isArray(i.sx)?i.sx:[i.sx],...Array.isArray(s.sx)?s.sx:[s.sx]]}}};const n=e,r=ge(n==null?void 0:n.className,t==null?void 0:t.className);return{...e,...t,...!!r&&{className:r},...(n==null?void 0:n.style)&&(t==null?void 0:t.style)&&{style:{...n.style,...t.style}},...(n==null?void 0:n.sx)&&(t==null?void 0:t.sx)&&{sx:[...Array.isArray(n.sx)?n.sx:[n.sx],...Array.isArray(t.sx)?t.sx:[t.sx]]}}}const yM=De(b.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),I0=({icon:t,offset:e=".2rem",...n})=>b.jsx(z.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",position:"relative",mr:.5,top:e},children:b.jsx(t,{fontSize:"inherit",...n})}),Mr=t=>{const{name:e,id:n,className:r,errorMode:o="normal"}=t,[i,s,a]=Ut.useField(e),{error:l}=s;if(o!=="hidden"&&!(o==="collapse"&&!l))return b.jsxs(z.Typography,{id:n,"data-testid":`test-${n}`,variant:"caption",display:"block",color:"error",style:{visibility:l?"visible":"hidden"},className:r,fontSize:".9rem",children:[b.jsx(I0,{icon:yM,offset:".15rem"}),l]})},bM=Z.createContext(!1),vM=({readOnly:t=!0,children:e})=>b.jsx(bM.Provider,{value:t,children:e}),_a=()=>Z.useContext(bM),xM=Z.createContext({showDiff:!1,getPreviousValue:()=>{},getCurrentValue:()=>{}}),wM=({showDiff:t=!0,previousSnapshot:e=null,currentSnapshot:n=null,children:r})=>{const o=(s,a)=>VS(e,s,a),i=(s,a)=>VS(n,s,a);return b.jsx(xM.Provider,{value:{showDiff:t,getPreviousValue:o,getCurrentValue:i},children:r})},VS=(t,e,n)=>(e?e.replace(/\[(\d+)\]/g,".$1").split(".").reduce((r,o)=>r==null?void 0:r[o],t):t)??n,Ra=()=>Z.useContext(xM);function Jn(t){this.content=t}Jn.prototype={constructor:Jn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Jn(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Jn(n)},addToStart:function(t,e){return new Jn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Jn(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Jn(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Jn.from(t),t.size?new Jn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Jn.from(t),t.size?new Jn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Jn.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Jn.from=function(t){if(t instanceof Jn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Jn(e)};function SM(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=SM(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function CM(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,f=Math.min(s.text.length,a.text.length);for(;u<f&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let u=CM(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class Ee{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&r(l,o+a,i||null,s)!==!1&&l.content.size){let f=a+1;l.nodesBetween(Math.max(0,e-f),Math.min(l.content.size,n-f),r,o+f)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new Ee(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new Ee(r,o)}cutByIndex(e,n){return e==n?Ee.empty:e==0&&n==this.content.length?this:new Ee(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new Ee(o,i)}addToStart(e){return new Ee([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ee(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return SM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return CM(this,e,n,r)}findIndex(e){if(e==0)return Kd(0,e);if(e==this.size)return Kd(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Kd(n+1,i):Kd(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ee.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ee(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ee.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new Ee(n||e,r)}static from(e){if(!e)return Ee.empty;if(e instanceof Ee)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ee([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ee.empty=new Ee([],0);const Fg={index:0,offset:0};function Kd(t,e){return Fg.index=t,Fg.offset=e,Fg}function Jf(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Jf(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Jf(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ft=class bb{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Jf(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return bb.none;if(e instanceof bb)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ft.none=[];class Xf extends Error{}class Ae{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=kM(this.content,e+this.openStart,n);return r&&new Ae(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ae(TM(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ae.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ae(Ee.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Ae(e,r,o)}}Ae.empty=new Ae(Ee.empty,0,0);function TM(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(TM(i.content,e-o-1,n-o-1)))}function kM(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=kM(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function ZH(t,e,n){if(n.openStart>t.depth)throw new Xf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xf("Inconsistent open depths");return EM(t,e,n,0)}function EM(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=EM(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return ca(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=QH(n,t);return ca(i,MM(t,s,a,e,r))}else return ca(i,Zf(t,e,r))}function OM(t,e){if(!e.type.compatibleContent(t.type))throw new Xf("Cannot join "+e.type.name+" onto "+t.type.name)}function vb(t,e,n){let r=t.node(n);return OM(r,e.node(n)),r}function la(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Vc(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(la(t.nodeAfter,r),i++));for(let a=i;a<s;a++)la(o.child(a),r);e&&e.depth==n&&e.textOffset&&la(e.nodeBefore,r)}function ca(t,e){return t.type.checkContent(e),t.copy(e)}function MM(t,e,n,r,o){let i=t.depth>o&&vb(t,e,o+1),s=r.depth>o&&vb(n,r,o+1),a=[];return Vc(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(OM(i,s),la(ca(i,MM(t,e,n,r,o+1)),a)):(i&&la(ca(i,Zf(t,e,o+1)),a),Vc(e,n,o,a),s&&la(ca(s,Zf(n,r,o+1)),a)),Vc(r,null,o,a),new Ee(a)}function Zf(t,e,n){let r=[];if(Vc(null,t,n,r),t.depth>n){let o=vb(t,e,n+1);la(ca(o,Zf(t,e,n+1)),r)}return Vc(e,null,n,r),new Ee(r)}function QH(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(Ee.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class au{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ft.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Qf(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),u=i-l;if(r.push(s,a,o+l),!u||(s=s.child(a),s.isText))break;i=u-1,o+=l+1}return new au(n,r,i)}static resolveCached(e,n){let r=zS.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else zS.set(e,r=new eW);let o=r.elts[r.i]=au.resolve(e,n);return r.i=(r.i+1)%tW,o}}class eW{constructor(){this.elts=[],this.i=0}}const tW=12,zS=new WeakMap;class Qf{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const nW=Object.create(null);let _i=class xb{constructor(e,n,r,o=Ft.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||Ee.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Jf(this.attrs,n||e.defaultAttrs||nW)&&Ft.sameSet(this.marks,r||Ft.none)}copy(e=null){return e==this.content?this:new xb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xb(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Ae.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),u=o.node(s).content.cut(o.pos-a,i.pos-a);return new Ae(u,o.depth-s,i.depth-s)}replace(e,n,r){return ZH(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return au.resolveCached(this,e)}resolveNoCache(e){return au.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),_M(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ee.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ft.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ft.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=Ee.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};_i.prototype.text=void 0;class ep extends _i{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):_M(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ep(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ep(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function _M(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ba{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new rW(e,n);if(r.next==null)return ba.empty;let o=RM(r);r.next&&r.err("Unexpected trailing text");let i=uW(cW(o));return dW(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return Ee.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:f,next:p}=s.next[u];if(!(f.isText||f.hasRequiredAttrs())&&o.indexOf(p)==-1){o.push(p);let m=i(p,a.concat(f));if(m)return m}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
79
+ To suppress this warning, you need to explicitly provide the \`palette.${e}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function HH(t){return typeof t=="number"?`${t}px`:typeof t=="string"||typeof t=="function"||Array.isArray(t)?t:"8px"}const Lo=t=>{try{return t()}catch{}},WH=(t="mui")=>oH(t);function Bg(t,e,n,r){if(!e)return;e=e===!0?{}:e;const o=r==="dark"?"dark":"light";if(!n){t[r]=jH({...e,palette:{mode:o,...e==null?void 0:e.palette}});return}const{palette:i,...s}=gb({...n,palette:{mode:o,...e==null?void 0:e.palette}});return t[r]={...e,palette:i,opacity:{...fM(o),...e==null?void 0:e.opacity},overlays:(e==null?void 0:e.overlays)||pM(o)},s}function UH(t={},...e){const{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:o=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:s=BH,colorSchemeSelector:a=n.light&&n.dark?"media":void 0,rootSelector:l=":root",...u}=t,f=Object.keys(n)[0],p=r||(n.light&&f!=="light"?"light":f),m=WH(i),{[p]:g,light:v,dark:y,...x}=n,S={...x};let k=g;if((p==="dark"&&!("dark"in n)||p==="light"&&!("light"in n))&&(k=!0),!k)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${p}\` option is either missing or invalid.`:Yo(21,p));const T=Bg(S,k,u,p);v&&!S.light&&Bg(S,v,void 0,"light"),y&&!S.dark&&Bg(S,y,void 0,"dark");let C={defaultColorScheme:p,...T,cssVarPrefix:i,colorSchemeSelector:a,rootSelector:l,getCssVar:m,colorSchemes:S,font:{...TH(T.typography),...T.font},spacing:HH(u.spacing)};Object.keys(C.colorSchemes).forEach(V=>{const M=C.colorSchemes[V].palette,j=F=>{const L=F.split("-"),A=L[1],_=L[2];return m(F,M[A][_])};if(M.mode==="light"&&(we(M.common,"background","#fff"),we(M.common,"onBackground","#000")),M.mode==="dark"&&(we(M.common,"background","#000"),we(M.common,"onBackground","#fff")),zH(M,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),M.mode==="light"){we(M.Alert,"errorColor",jt(M.error.light,.6)),we(M.Alert,"infoColor",jt(M.info.light,.6)),we(M.Alert,"successColor",jt(M.success.light,.6)),we(M.Alert,"warningColor",jt(M.warning.light,.6)),we(M.Alert,"errorFilledBg",j("palette-error-main")),we(M.Alert,"infoFilledBg",j("palette-info-main")),we(M.Alert,"successFilledBg",j("palette-success-main")),we(M.Alert,"warningFilledBg",j("palette-warning-main")),we(M.Alert,"errorFilledColor",Lo(()=>M.getContrastText(M.error.main))),we(M.Alert,"infoFilledColor",Lo(()=>M.getContrastText(M.info.main))),we(M.Alert,"successFilledColor",Lo(()=>M.getContrastText(M.success.main))),we(M.Alert,"warningFilledColor",Lo(()=>M.getContrastText(M.warning.main))),we(M.Alert,"errorStandardBg",Bt(M.error.light,.9)),we(M.Alert,"infoStandardBg",Bt(M.info.light,.9)),we(M.Alert,"successStandardBg",Bt(M.success.light,.9)),we(M.Alert,"warningStandardBg",Bt(M.warning.light,.9)),we(M.Alert,"errorIconColor",j("palette-error-main")),we(M.Alert,"infoIconColor",j("palette-info-main")),we(M.Alert,"successIconColor",j("palette-success-main")),we(M.Alert,"warningIconColor",j("palette-warning-main")),we(M.AppBar,"defaultBg",j("palette-grey-100")),we(M.Avatar,"defaultBg",j("palette-grey-400")),we(M.Button,"inheritContainedBg",j("palette-grey-300")),we(M.Button,"inheritContainedHoverBg",j("palette-grey-A100")),we(M.Chip,"defaultBorder",j("palette-grey-400")),we(M.Chip,"defaultAvatarColor",j("palette-grey-700")),we(M.Chip,"defaultIconColor",j("palette-grey-700")),we(M.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),we(M.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),we(M.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),we(M.LinearProgress,"primaryBg",Bt(M.primary.main,.62)),we(M.LinearProgress,"secondaryBg",Bt(M.secondary.main,.62)),we(M.LinearProgress,"errorBg",Bt(M.error.main,.62)),we(M.LinearProgress,"infoBg",Bt(M.info.main,.62)),we(M.LinearProgress,"successBg",Bt(M.success.main,.62)),we(M.LinearProgress,"warningBg",Bt(M.warning.main,.62)),we(M.Skeleton,"bg",`rgba(${j("palette-text-primaryChannel")} / 0.11)`),we(M.Slider,"primaryTrack",Bt(M.primary.main,.62)),we(M.Slider,"secondaryTrack",Bt(M.secondary.main,.62)),we(M.Slider,"errorTrack",Bt(M.error.main,.62)),we(M.Slider,"infoTrack",Bt(M.info.main,.62)),we(M.Slider,"successTrack",Bt(M.success.main,.62)),we(M.Slider,"warningTrack",Bt(M.warning.main,.62));const F=qd(M.background.default,.8);we(M.SnackbarContent,"bg",F),we(M.SnackbarContent,"color",Lo(()=>M.getContrastText(F))),we(M.SpeedDialAction,"fabHoverBg",qd(M.background.paper,.15)),we(M.StepConnector,"border",j("palette-grey-400")),we(M.StepContent,"border",j("palette-grey-400")),we(M.Switch,"defaultColor",j("palette-common-white")),we(M.Switch,"defaultDisabledColor",j("palette-grey-100")),we(M.Switch,"primaryDisabledColor",Bt(M.primary.main,.62)),we(M.Switch,"secondaryDisabledColor",Bt(M.secondary.main,.62)),we(M.Switch,"errorDisabledColor",Bt(M.error.main,.62)),we(M.Switch,"infoDisabledColor",Bt(M.info.main,.62)),we(M.Switch,"successDisabledColor",Bt(M.success.main,.62)),we(M.Switch,"warningDisabledColor",Bt(M.warning.main,.62)),we(M.TableCell,"border",Bt(Ud(M.divider,1),.88)),we(M.Tooltip,"bg",Ud(M.grey[700],.92))}if(M.mode==="dark"){we(M.Alert,"errorColor",Bt(M.error.light,.6)),we(M.Alert,"infoColor",Bt(M.info.light,.6)),we(M.Alert,"successColor",Bt(M.success.light,.6)),we(M.Alert,"warningColor",Bt(M.warning.light,.6)),we(M.Alert,"errorFilledBg",j("palette-error-dark")),we(M.Alert,"infoFilledBg",j("palette-info-dark")),we(M.Alert,"successFilledBg",j("palette-success-dark")),we(M.Alert,"warningFilledBg",j("palette-warning-dark")),we(M.Alert,"errorFilledColor",Lo(()=>M.getContrastText(M.error.dark))),we(M.Alert,"infoFilledColor",Lo(()=>M.getContrastText(M.info.dark))),we(M.Alert,"successFilledColor",Lo(()=>M.getContrastText(M.success.dark))),we(M.Alert,"warningFilledColor",Lo(()=>M.getContrastText(M.warning.dark))),we(M.Alert,"errorStandardBg",jt(M.error.light,.9)),we(M.Alert,"infoStandardBg",jt(M.info.light,.9)),we(M.Alert,"successStandardBg",jt(M.success.light,.9)),we(M.Alert,"warningStandardBg",jt(M.warning.light,.9)),we(M.Alert,"errorIconColor",j("palette-error-main")),we(M.Alert,"infoIconColor",j("palette-info-main")),we(M.Alert,"successIconColor",j("palette-success-main")),we(M.Alert,"warningIconColor",j("palette-warning-main")),we(M.AppBar,"defaultBg",j("palette-grey-900")),we(M.AppBar,"darkBg",j("palette-background-paper")),we(M.AppBar,"darkColor",j("palette-text-primary")),we(M.Avatar,"defaultBg",j("palette-grey-600")),we(M.Button,"inheritContainedBg",j("palette-grey-800")),we(M.Button,"inheritContainedHoverBg",j("palette-grey-700")),we(M.Chip,"defaultBorder",j("palette-grey-700")),we(M.Chip,"defaultAvatarColor",j("palette-grey-300")),we(M.Chip,"defaultIconColor",j("palette-grey-300")),we(M.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),we(M.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),we(M.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),we(M.LinearProgress,"primaryBg",jt(M.primary.main,.5)),we(M.LinearProgress,"secondaryBg",jt(M.secondary.main,.5)),we(M.LinearProgress,"errorBg",jt(M.error.main,.5)),we(M.LinearProgress,"infoBg",jt(M.info.main,.5)),we(M.LinearProgress,"successBg",jt(M.success.main,.5)),we(M.LinearProgress,"warningBg",jt(M.warning.main,.5)),we(M.Skeleton,"bg",`rgba(${j("palette-text-primaryChannel")} / 0.13)`),we(M.Slider,"primaryTrack",jt(M.primary.main,.5)),we(M.Slider,"secondaryTrack",jt(M.secondary.main,.5)),we(M.Slider,"errorTrack",jt(M.error.main,.5)),we(M.Slider,"infoTrack",jt(M.info.main,.5)),we(M.Slider,"successTrack",jt(M.success.main,.5)),we(M.Slider,"warningTrack",jt(M.warning.main,.5));const F=qd(M.background.default,.98);we(M.SnackbarContent,"bg",F),we(M.SnackbarContent,"color",Lo(()=>M.getContrastText(F))),we(M.SpeedDialAction,"fabHoverBg",qd(M.background.paper,.15)),we(M.StepConnector,"border",j("palette-grey-600")),we(M.StepContent,"border",j("palette-grey-600")),we(M.Switch,"defaultColor",j("palette-grey-300")),we(M.Switch,"defaultDisabledColor",j("palette-grey-600")),we(M.Switch,"primaryDisabledColor",jt(M.primary.main,.55)),we(M.Switch,"secondaryDisabledColor",jt(M.secondary.main,.55)),we(M.Switch,"errorDisabledColor",jt(M.error.main,.55)),we(M.Switch,"infoDisabledColor",jt(M.info.main,.55)),we(M.Switch,"successDisabledColor",jt(M.success.main,.55)),we(M.Switch,"warningDisabledColor",jt(M.warning.main,.55)),we(M.TableCell,"border",jt(Ud(M.divider,1),.68)),we(M.Tooltip,"bg",Ud(M.grey[700],.92))}mi(M.background,"default"),mi(M.background,"paper"),mi(M.common,"background"),mi(M.common,"onBackground"),mi(M,"divider"),Object.keys(M).forEach(F=>{const L=M[F];F!=="tonalOffset"&&L&&typeof L=="object"&&(L.main&&we(M[F],"mainChannel",_c(Rc(L.main))),L.light&&we(M[F],"lightChannel",_c(Rc(L.light))),L.dark&&we(M[F],"darkChannel",_c(Rc(L.dark))),L.contrastText&&we(M[F],"contrastTextChannel",_c(Rc(L.contrastText))),F==="text"&&(mi(M[F],"primary"),mi(M[F],"secondary")),F==="action"&&(L.active&&mi(M[F],"active"),L.selected&&mi(M[F],"selected")))})}),C=e.reduce((V,M)=>Vn(V,M),C);const O={prefix:i,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:VH(C)},{vars:R,generateThemeVars:P,generateStyleSheets:N}=aH(C,O);return C.vars=R,Object.entries(C.colorSchemes[C.defaultColorScheme]).forEach(([V,M])=>{C[V]=M}),C.generateThemeVars=P,C.generateStyleSheets=N,C.generateSpacing=function(){return JO(u.spacing,lh(this))},C.getColorSchemeSelector=lH(a),C.spacing=C.generateSpacing(),C.shouldSkipGeneratingVar=s,C.unstable_sxConfig={...Iu,...u==null?void 0:u.unstable_sxConfig},C.unstable_sx=function(M){return ga({sx:M,theme:this})},C.toRuntimeSource=dM,C}function BS(t,e,n){t.colorSchemes&&n&&(t.colorSchemes[e]={...n!==!0&&n,palette:R0({...n===!0?{}:n.palette,mode:e})})}function hM(t={},...e){const{palette:n,cssVariables:r=!1,colorSchemes:o=n?void 0:{light:!0},defaultColorScheme:i=n==null?void 0:n.mode,...s}=t,a=i||"light",l=o==null?void 0:o[a],u={...o,...n?{[a]:{...typeof l!="boolean"&&l,palette:n}}:void 0};if(r===!1){if(!("colorSchemes"in t))return gb(t,...e);let f=n;"palette"in t||u[a]&&(u[a]!==!0?f=u[a].palette:a==="dark"&&(f={mode:"dark"}));const p=gb({...t,palette:f},...e);return p.defaultColorScheme=a,p.colorSchemes=u,p.palette.mode==="light"&&(p.colorSchemes.light={...u.light!==!0&&u.light,palette:p.palette},BS(p,"dark",u.dark)),p.palette.mode==="dark"&&(p.colorSchemes.dark={...u.dark!==!0&&u.dark,palette:p.palette},BS(p,"light",u.light)),p}return!n&&!("light"in u)&&a==="light"&&(u.light=!0),UH({...s,colorSchemes:u,defaultColorScheme:a,...typeof r!="boolean"&&r},...e)}const yh=hM(),zl="$$material";function Mo(){const t=mh(yh);return process.env.NODE_ENV!=="production"&&D.useDebugValue(t),t[zl]||t}function mM(t){return b.jsx(ZO,{...t,defaultTheme:yh,themeId:zl})}process.env.NODE_ENV!=="production"&&(mM.propTypes={styles:c.oneOfType([c.array,c.func,c.number,c.object,c.string,c.bool])});function gM(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const go=t=>gM(t)&&t!=="classes",ne=tM({themeId:zl,defaultTheme:yh,rootShouldForwardProp:go});function qH(t){return function(n){return b.jsx(mM,{styles:typeof t=="function"?r=>t({theme:r,...n}):t})}}function KH(){return O0}const yt=rH;process.env.NODE_ENV!=="production"&&(c.node,c.object.isRequired);function ht(t){return nH(t)}function YH(t){return We("MuiSvgIcon",t)}const FS=Ve("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]),GH=t=>{const{color:e,fontSize:n,classes:r}=t,o={root:["root",e!=="inherit"&&`color${Ie(e)}`,`fontSize${Ie(n)}`]};return He(o,YH,r)},JH=ne("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.color!=="inherit"&&e[`color${Ie(n.color)}`],e[`fontSize${Ie(n.fontSize)}`]]}})(yt(({theme:t})=>{var e,n,r,o,i,s,a,l,u,f,p,m,g,v;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(o=(e=t.transitions)==null?void 0:e.create)==null?void 0:o.call(e,"fill",{duration:(r=(n=(t.vars??t).transitions)==null?void 0:n.duration)==null?void 0:r.shorter}),variants:[{props:y=>!y.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((s=(i=t.typography)==null?void 0:i.pxToRem)==null?void 0:s.call(i,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((l=(a=t.typography)==null?void 0:a.pxToRem)==null?void 0:l.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((f=(u=t.typography)==null?void 0:u.pxToRem)==null?void 0:f.call(u,35))||"2.1875rem"}},...Object.entries((t.vars??t).palette).filter(([,y])=>y&&y.main).map(([y])=>{var x,S;return{props:{color:y},style:{color:(S=(x=(t.vars??t).palette)==null?void 0:x[y])==null?void 0:S.main}}}),{props:{color:"action"},style:{color:(m=(p=(t.vars??t).palette)==null?void 0:p.action)==null?void 0:m.active}},{props:{color:"disabled"},style:{color:(v=(g=(t.vars??t).palette)==null?void 0:g.action)==null?void 0:v.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),Gf=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiSvgIcon"}),{children:o,className:i,color:s="inherit",component:a="svg",fontSize:l="medium",htmlColor:u,inheritViewBox:f=!1,titleAccess:p,viewBox:m="0 0 24 24",...g}=r,v=D.isValidElement(o)&&o.type==="svg",y={...r,color:s,component:a,fontSize:l,instanceFontSize:e.fontSize,inheritViewBox:f,viewBox:m,hasSvgAsChild:v},x={};f||(x.viewBox=m);const S=GH(y);return b.jsxs(JH,{as:a,className:ge(S.root,i),focusable:"false",color:u,"aria-hidden":p?void 0:!0,role:p?"img":void 0,ref:n,...x,...g,...v&&o.props,ownerState:y,children:[v?o.props.children:o,p?b.jsx("title",{children:p}):null]})});process.env.NODE_ENV!=="production"&&(Gf.propTypes={children:c.node,classes:c.object,className:c.string,color:c.oneOfType([c.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),c.string]),component:c.elementType,fontSize:c.oneOfType([c.oneOf(["inherit","large","medium","small"]),c.string]),htmlColor:c.string,inheritViewBox:c.bool,shapeRendering:c.string,sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),titleAccess:c.string,viewBox:c.string});Gf.muiName="SvgIcon";function De(t,e){function n(r,o){return b.jsx(Gf,{"data-testid":`${e}Icon`,ref:o,...r,children:t})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${e}Icon`),n.muiName=Gf.muiName,D.memo(D.forwardRef(n))}function XH(t,e){if(!t)return e;if(typeof t=="function"||typeof e=="function")return o=>{const i=typeof e=="function"?e(o):e,s=typeof t=="function"?t({...o,...i}):t,a=ge(o==null?void 0:o.className,i==null?void 0:i.className,s==null?void 0:s.className);return{...i,...s,...!!a&&{className:a},...(i==null?void 0:i.style)&&(s==null?void 0:s.style)&&{style:{...i.style,...s.style}},...(i==null?void 0:i.sx)&&(s==null?void 0:s.sx)&&{sx:[...Array.isArray(i.sx)?i.sx:[i.sx],...Array.isArray(s.sx)?s.sx:[s.sx]]}}};const n=e,r=ge(n==null?void 0:n.className,t==null?void 0:t.className);return{...e,...t,...!!r&&{className:r},...(n==null?void 0:n.style)&&(t==null?void 0:t.style)&&{style:{...n.style,...t.style}},...(n==null?void 0:n.sx)&&(t==null?void 0:t.sx)&&{sx:[...Array.isArray(n.sx)?n.sx:[n.sx],...Array.isArray(t.sx)?t.sx:[t.sx]]}}}const yM=De(b.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),I0=({icon:t,offset:e=".2rem",...n})=>b.jsx(z.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",position:"relative",mr:.5,top:e},children:b.jsx(t,{fontSize:"inherit",...n})}),Mr=t=>{const{name:e,id:n,className:r,errorMode:o="normal"}=t,[i,s,a]=Ut.useField(e),{error:l}=s;if(o!=="hidden"&&!(o==="collapse"&&!l))return b.jsxs(z.Typography,{id:n,"data-testid":`test-${n}`,variant:"caption",display:"block",color:"error",style:{visibility:l?"visible":"hidden"},className:r,fontSize:".9rem",children:[b.jsx(I0,{icon:yM,offset:".15rem"}),l]})},bM=Z.createContext(!1),vM=({readOnly:t=!0,children:e})=>b.jsx(bM.Provider,{value:t,children:e}),_a=()=>Z.useContext(bM),xM=Z.createContext({showDiff:!1,getPreviousValue:()=>{},getCurrentValue:()=>{}}),wM=({showDiff:t=!0,previousSnapshot:e=null,currentSnapshot:n=null,children:r})=>{const o=(s,a)=>VS(e,s,a),i=(s,a)=>VS(n,s,a);return b.jsx(xM.Provider,{value:{showDiff:t,getPreviousValue:o,getCurrentValue:i},children:b.jsx(vM,{children:r})})},VS=(t,e,n)=>(e?e.replace(/\[(\d+)\]/g,".$1").split(".").reduce((r,o)=>r==null?void 0:r[o],t):t)??n,Ra=()=>Z.useContext(xM);function Jn(t){this.content=t}Jn.prototype={constructor:Jn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Jn(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Jn(n)},addToStart:function(t,e){return new Jn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Jn(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Jn(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Jn.from(t),t.size?new Jn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Jn.from(t),t.size?new Jn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Jn.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Jn.from=function(t){if(t instanceof Jn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Jn(e)};function SM(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=SM(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function CM(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,f=Math.min(s.text.length,a.text.length);for(;u<f&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let u=CM(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class Ee{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&r(l,o+a,i||null,s)!==!1&&l.content.size){let f=a+1;l.nodesBetween(Math.max(0,e-f),Math.min(l.content.size,n-f),r,o+f)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new Ee(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new Ee(r,o)}cutByIndex(e,n){return e==n?Ee.empty:e==0&&n==this.content.length?this:new Ee(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new Ee(o,i)}addToStart(e){return new Ee([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ee(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return SM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return CM(this,e,n,r)}findIndex(e){if(e==0)return Kd(0,e);if(e==this.size)return Kd(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Kd(n+1,i):Kd(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ee.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ee(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ee.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new Ee(n||e,r)}static from(e){if(!e)return Ee.empty;if(e instanceof Ee)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ee([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ee.empty=new Ee([],0);const Fg={index:0,offset:0};function Kd(t,e){return Fg.index=t,Fg.offset=e,Fg}function Jf(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Jf(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Jf(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ft=class bb{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Jf(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return bb.none;if(e instanceof bb)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Ft.none=[];class Xf extends Error{}class Ae{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=kM(this.content,e+this.openStart,n);return r&&new Ae(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Ae(TM(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ae.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ae(Ee.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new Ae(e,r,o)}}Ae.empty=new Ae(Ee.empty,0,0);function TM(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(TM(i.content,e-o-1,n-o-1)))}function kM(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=kM(s.content,e-i-1,n,s);return a&&t.replaceChild(o,s.copy(a))}function ZH(t,e,n){if(n.openStart>t.depth)throw new Xf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xf("Inconsistent open depths");return EM(t,e,n,0)}function EM(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=EM(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return ca(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=QH(n,t);return ca(i,MM(t,s,a,e,r))}else return ca(i,Zf(t,e,r))}function OM(t,e){if(!e.type.compatibleContent(t.type))throw new Xf("Cannot join "+e.type.name+" onto "+t.type.name)}function vb(t,e,n){let r=t.node(n);return OM(r,e.node(n)),r}function la(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Vc(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(la(t.nodeAfter,r),i++));for(let a=i;a<s;a++)la(o.child(a),r);e&&e.depth==n&&e.textOffset&&la(e.nodeBefore,r)}function ca(t,e){return t.type.checkContent(e),t.copy(e)}function MM(t,e,n,r,o){let i=t.depth>o&&vb(t,e,o+1),s=r.depth>o&&vb(n,r,o+1),a=[];return Vc(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(OM(i,s),la(ca(i,MM(t,e,n,r,o+1)),a)):(i&&la(ca(i,Zf(t,e,o+1)),a),Vc(e,n,o,a),s&&la(ca(s,Zf(n,r,o+1)),a)),Vc(r,null,o,a),new Ee(a)}function Zf(t,e,n){let r=[];if(Vc(null,t,n,r),t.depth>n){let o=vb(t,e,n+1);la(ca(o,Zf(t,e,n+1)),r)}return Vc(e,null,n,r),new Ee(r)}function QH(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(Ee.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class au{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ft.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Qf(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),u=i-l;if(r.push(s,a,o+l),!u||(s=s.child(a),s.isText))break;i=u-1,o+=l+1}return new au(n,r,i)}static resolveCached(e,n){let r=zS.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else zS.set(e,r=new eW);let o=r.elts[r.i]=au.resolve(e,n);return r.i=(r.i+1)%tW,o}}class eW{constructor(){this.elts=[],this.i=0}}const tW=12,zS=new WeakMap;class Qf{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const nW=Object.create(null);let _i=class xb{constructor(e,n,r,o=Ft.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||Ee.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Jf(this.attrs,n||e.defaultAttrs||nW)&&Ft.sameSet(this.marks,r||Ft.none)}copy(e=null){return e==this.content?this:new xb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xb(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Ae.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),u=o.node(s).content.cut(o.pos-a,i.pos-a);return new Ae(u,o.depth-s,i.depth-s)}replace(e,n,r){return ZH(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return au.resolveCached(this,e)}resolveNoCache(e){return au.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),_M(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ee.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ft.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ft.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=Ee.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};_i.prototype.text=void 0;class ep extends _i{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):_M(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ep(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ep(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function _M(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ba{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new rW(e,n);if(r.next==null)return ba.empty;let o=RM(r);r.next&&r.err("Unexpected trailing text");let i=uW(cW(o));return dW(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return Ee.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:f,next:p}=s.next[u];if(!(f.isText||f.hasRequiredAttrs())&&o.indexOf(p)==-1){o.push(p);let m=i(p,a.concat(f));if(m)return m}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
80
80
  `)}}ba.empty=new ba(!0);class rW{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function RM(t){let e=[];do e.push(oW(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function oW(t){let e=[];do e.push(iW(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function iW(t){let e=lW(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=sW(t,e);else break;return e}function HS(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function sW(t,e){let n=HS(t),r=n;return t.eat(",")&&(t.next!="}"?r=HS(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function aW(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function lW(t){if(t.eat("(")){let e=RM(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=aW(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function cW(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(i(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=i(s.exprs[l],a);if(l==s.exprs.length-1)return u;o(u,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u<s.min;u++){let f=n();o(i(s.expr,l),f),l=f}if(s.max==-1)o(i(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let f=n();r(l,f),o(i(s.expr,l),f),l=f}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function IM(t,e){return e-t}function WS(t,e){let n=[];return r(e),n.sort(IM);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function uW(t){let e=Object.create(null);return n(WS(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let f=0;f<o.length;f++)o[f][0]==a&&(u=o[f][1]);WS(t,l).forEach(f=>{u||o.push([a,u=[]]),u.indexOf(f)==-1&&u.push(f)})})});let i=e[r.join(",")]=new ba(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(IM);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function dW(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:u}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function DM(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function AM(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function PM(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function NM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new pW(t,r,e[r]);return n}let US=class $M{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=NM(e,r.attrs),this.defaultAttrs=DM(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ba.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:AM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _i(this,this.computeAttrs(e),Ee.from(n),Ft.setFrom(r))}createChecked(e=null,n,r){return n=Ee.from(n),this.checkContent(n),new _i(this,this.computeAttrs(e),n,Ft.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ee.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(Ee.empty,!0);return i?new _i(this,e,n.append(i),Ft.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){PM(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ft.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new $M(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function fW(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class pW{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?fW(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bh{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=NM(e,o.attrs),this.excluded=null;let i=DM(this.attrs);this.instance=i?new Ft(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ft(this,AM(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new bh(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){PM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let LM=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Jn.from(e.nodes),n.marks=Jn.from(e.marks||{}),this.nodes=US.compile(this.spec.nodes,this),this.marks=bh.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=ba.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?qS(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:qS(this,s.split(" "))}this.nodeFromJSON=o=>_i.fromJSON(this,o),this.markFromJSON=o=>Ft.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof US){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new ep(r,r.defaultAttrs,e,Ft.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function qS(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function hW(t){return t.tag!=null}function mW(t){return t.style!=null}class ms{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(hW(o))this.tags.push(o);else if(mW(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new YS(this,n,!1);return r.addAll(e,Ft.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new YS(this,n,!0);return r.addAll(e,Ft.none,n.from,n.to),Ae.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(bW(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=GS(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=GS(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ms(e,ms.schemaRules(e)))}}const jM={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},gW={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},BM={ol:!0,ul:!0},lu=1,wb=2,zc=4;function KS(t,e,n){return e!=null?(e?lu:0)|(e==="full"?wb:0):t&&t.whitespace=="pre"?lu|wb:n&~zc}class Yd{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ft.none,this.match=i||(s&zc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ee.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&lu)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=Ee.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ee.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!jM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class YS{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=KS(null,n.preserveWhitespace,0)|(r?zc:0);o?i=new Yd(o.type,o.attrs,Ft.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Yd(null,null,Ft.none,!0,null,s):i=new Yd(e.schema.topNodeType,null,Ft.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&wb?"full":this.localPreserveWS||(o.options&lu)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
81
81
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;BM.hasOwnProperty(s)&&this.parser.normalizeLists&&yW(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:gW.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,f=this.needsBlock;if(jM.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let p=l&&l.skip?n:this.readStyles(e,n);p&&this.addAll(e,p),u&&this.sync(i),this.needsBlock=f}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
82
82
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!o||o.length>u.length+a)&&(o=u,i=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Ft.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):JS(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=KS(e,i,s.options);s.options&zc&&s.content.length==0&&(a|=zc);let l=Ft.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):JS(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Yd(e,n,l,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=lu)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let f=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!f||f.name!=u&&!f.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function yW(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&BM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function bW(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function GS(t){let e={};for(let n in t)e[n]=t[n];return e}function JS(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:f}=a.edge(l);if(u==e||i.indexOf(f)<0&&s(f))return!0}};if(s(o.contentMatch))return!0}}class Ia{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Vg(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(i[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],f=this.serializeMark(u,s.isInline,n);f&&(i.push([u,o]),o.appendChild(f.dom),o=f.contentDOM||f.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Ef(Vg(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Ef(Vg(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Ef(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ia(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=XS(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return XS(e.marks)}}function XS(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Vg(t){return t.document||window.document}const ZS=new WeakMap;function vW(t){let e=ZS.get(t);return e===void 0&&ZS.set(t,e=xW(t)),e}function xW(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Ef(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=vW(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),u=e[1],f=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){f=2;for(let p in u)if(u[p]!=null){let m=p.indexOf(" ");m>0?l.setAttributeNS(p.slice(0,m),p.slice(m+1),u[p]):p=="style"&&l.style?l.style.cssText=u[p]:l.setAttribute(p,u[p])}}for(let p=f;p<e.length;p++){let m=e[p];if(m===0){if(p<e.length-1||p>f)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:g,contentDOM:v}=Ef(t,m,n,r);if(l.appendChild(g),v){if(a)throw new RangeError("Multiple content holes");a=v}}}return{dom:l,contentDOM:a}}const FM=65535,VM=Math.pow(2,16);function wW(t,e){return t+e*VM}function QS(t){return t&FM}function SW(t){return(t-(t&FM))/VM}const zM=1,HM=2,Of=4,WM=8;class Sb{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&WM)>0}get deletedBefore(){return(this.delInfo&(zM|Of))>0}get deletedAfter(){return(this.delInfo&(HM|Of))>0}get deletedAcross(){return(this.delInfo&Of)>0}}class $r{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&$r.empty)return $r.empty}recover(e){let n=0,r=QS(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+SW(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let u=this.ranges[a+i],f=this.ranges[a+s],p=l+u;if(e<=p){let m=u?e==l?-1:e==p?1:n:n,g=l+o+(m<0?0:f);if(r)return g;let v=e==(n<0?l:p)?null:wW(a/3,e-l),y=e==l?HM:e==p?zM:Of;return(n<0?e!=l:e!=p)&&(y|=WM),new Sb(g,y,v)}o+=f-u}return r?e+o:new Sb(e+o,0,null)}touches(e,n){let r=0,o=QS(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+i],f=l+u;if(e<=f&&a==o*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),u=this.ranges[o+n],f=this.ranges[o+r];e(a,a+u,l,l+f),i+=f-u}}invert(){return new $r(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?$r.empty:new $r(e<0?[0,-e,0]:[0,0,e])}}$r.empty=new $r([]);class cu{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new cu(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new cu;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new Sb(e,o,null)}}const zg=Object.create(null);class ar{getMap(){return $r.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zg[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in zg)throw new RangeError("Duplicate use of step JSON ID "+e);return zg[e]=n,n.prototype.jsonID=e,n}}class kn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new kn(e,null)}static fail(e){return new kn(null,e)}static fromReplace(e,n,r,o){try{return kn.ok(e.replace(n,r,o))}catch(i){if(i instanceof Xf)return kn.fail(i.message);throw i}}}function D0(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(D0(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return Ee.fromArray(r)}class ds extends ar{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new Ae(D0(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return kn.fromReplace(e,this.from,this.to,i)}invert(){return new qo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ds(n.pos,r.pos,this.mark)}merge(e){return e instanceof ds&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ds(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ds(n.from,n.to,e.markFromJSON(n.mark))}}ar.jsonID("addMark",ds);class qo extends ar{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Ae(D0(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return kn.fromReplace(e,this.from,this.to,r)}invert(){return new ds(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qo(n.pos,r.pos,this.mark)}merge(e){return e instanceof qo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qo(n.from,n.to,e.markFromJSON(n.mark))}}ar.jsonID("removeMark",qo);class fs extends ar{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return kn.fromReplace(e,this.pos,this.pos+1,new Ae(Ee.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new fs(this.pos,n.marks[o]);return new fs(this.pos,this.mark)}}return new va(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new fs(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fs(n.pos,e.markFromJSON(n.mark))}}ar.jsonID("addNodeMark",fs);class va extends ar{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return kn.fromReplace(e,this.pos,this.pos+1,new Ae(Ee.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new fs(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new va(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new va(n.pos,e.markFromJSON(n.mark))}}ar.jsonID("removeNodeMark",va);class $n extends ar{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Cb(e,this.from,this.to)?kn.fail("Structure replace would overwrite content"):kn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new $r([this.from,this.to-this.from,this.slice.size])}invert(e){return new $n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new $n(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof $n)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Ae.empty:new Ae(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new $n(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Ae.empty:new Ae(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new $n(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new $n(n.from,n.to,Ae.fromJSON(e,n.slice),!!n.structure)}}ar.jsonID("replace",$n);class zn extends ar{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Cb(e,this.from,this.gapFrom)||Cb(e,this.gapTo,this.to)))return kn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return kn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?kn.fromReplace(e,this.from,this.to,r):kn.fail("Content does not fit in gap")}getMap(){return new $r([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new zn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new zn(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new zn(n.from,n.to,n.gapFrom,n.gapTo,Ae.fromJSON(e,n.slice),n.insert,!!n.structure)}}ar.jsonID("replaceAround",zn);function Cb(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function CW(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,n,(l,u,f)=>{if(!l.isInline)return;let p=l.marks;if(!r.isInSet(p)&&f.type.allowsMarkType(r.type)){let m=Math.max(u,e),g=Math.min(u+l.nodeSize,n),v=r.addToSet(p);for(let y=0;y<p.length;y++)p[y].isInSet(v)||(s&&s.to==m&&s.mark.eq(p[y])?s.to=g:o.push(s=new qo(m,g,p[y])));a&&a.to==m?a.to=g:i.push(a=new ds(m,g,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function TW(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof bh){let u=s.marks,f;for(;f=r.isInSet(u);)(l||(l=[])).push(f),u=f.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let f=0;f<l.length;f++){let p=l[f],m;for(let g=0;g<o.length;g++){let v=o[g];v.step==i-1&&p.eq(o[g].style)&&(m=v)}m?(m.to=u,m.step=i):o.push({style:p,from:Math.max(a,e),to:u,step:i})}}}),o.forEach(s=>t.step(new qo(s.from,s.to,s.style)))}function A0(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let u=i.child(l),f=a+u.nodeSize,p=r.matchType(u.type);if(!p)s.push(new $n(a,f,Ae.empty));else{r=p;for(let m=0;m<u.marks.length;m++)n.allowsMarkType(u.marks[m].type)||t.step(new qo(a,f,u.marks[m]));if(o&&u.isText&&n.whitespace!="pre"){let m,g=/\r?\n|\r/g,v;for(;m=g.exec(u.text);)v||(v=new Ae(Ee.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new $n(a+m.index,a+m.index+m[0].length,v))}}a=f}if(!r.validEnd){let l=r.fillBefore(Ee.empty,!0);t.replace(a,a,new Ae(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function kW(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Hl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),a=t.$from.index(r)+o,l=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(a,l,n))return r;if(r==0||s.type.spec.isolating||!kW(s,a,l))break;a&&(o=1),l<s.childCount&&(i=1)}return null}function EW(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,u=a,f=Ee.empty,p=0;for(let v=i,y=!1;v>n;v--)y||r.index(v)>0?(y=!0,f=Ee.from(r.node(v).copy(f)),p++):l--;let m=Ee.empty,g=0;for(let v=i,y=!1;v>n;v--)y||o.after(v+1)<o.end(v)?(y=!0,m=Ee.from(o.node(v).copy(m)),g++):u++;t.step(new zn(l,u,s,a,new Ae(f.append(m),p,g),f.size-p,!0))}function P0(t,e,n=null,r=t){let o=OW(t,e),i=o&&MW(r,e);return i?o.map(eC).concat({type:e,attrs:n}).concat(i.map(eC)):null}function eC(t){return{type:t,attrs:null}}function OW(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function MW(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let u=r;l&&u<o;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:s}function _W(t,e,n){let r=Ee.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ee.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new zn(o,i,o,i,new Ae(r,0,0),n.length,!0))}function RW(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&IW(t.doc,t.mapping.slice(i).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let g=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);g&&!v?u=!1:!g&&v&&(u=!0)}u===!1&&qM(t,s,a,i),A0(t,t.mapping.slice(i).map(a,1),r,void 0,u===null);let f=t.mapping.slice(i),p=f.map(a,1),m=f.map(a+s.nodeSize,1);return t.step(new zn(p,m,p+1,m-1,new Ae(Ee.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&UM(t,s,a,i),!1}})}function UM(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function qM(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
@@ -404,4 +404,4 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
404
404
  3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Lce(){Wt.scanner=_ce(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Dce(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function wx(t){return Wt.initialized||Lce(),Ace(Wt.parser.start,t,jD(Wt.scanner.start,t))}wx.scan=jD;function FD(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new xx(n),o=wx(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const Sx="[\0-   ᠎ -\u2029  ]",jce=new RegExp(Sx),Bce=new RegExp(`${Sx}$`),Fce=new RegExp(Sx,"g");function Vce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function zce(t){return new rn({key:new On("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=s7(n.doc,[...e]);if(f7(a).forEach(({newRange:u})=>{const f=l7(r.doc,u,g=>g.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const g=r.doc.textBetween(u.from,u.to," "," ");if(!Bce.test(g))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const g=m.split(jce).filter(Boolean);if(g.length<=0)return!1;const v=g[g.length-1],y=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=wx(v).map(S=>S.toObject(t.defaultProtocol));if(!Vce(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:y+S.start+1,to:y+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{ov(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function Hce(t){return new rn({key:new On("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=rv(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function Wce(t){return new rn({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=FD(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function qs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Fce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Uce=Or.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){VE(t);return}VE(t.scheme,t.optionalSlashes)})},onDestroy(){$ce()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=FD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qs(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(zce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!qs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Hce({type:this.type})),this.options.linkOnPaste&&t.push(Wce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function qce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=K7(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,g=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const y=a.pos-v.length,x=Array.from(v.matchAll(g)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!k)return null;const T=y+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const Kce=new On("suggestion");function Yce({pluginKey:t=Kce,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:g=()=>({}),allow:v=()=>!0,findSuggestionMatch:y=qce}){let x;const S=g==null?void 0:g(),k=new rn({key:t,view(){return{update:async(T,C)=>{var O,R,P,N,V,M,j;const F=(O=this.key)===null||O===void 0?void 0:O.getState(C),L=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=F.active&&L.active&&F.range.from!==L.range.from,_=!F.active&&L.active,I=F.active&&!L.active,B=!_&&!I&&F.query!==L.query,W=_||A&&B,K=B||A,U=I||A&&B;if(!W&&!K&&!U)return;const Y=U&&!W?F:L,oe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:fe=>p({editor:e,range:Y.range,props:fe}),decorationNode:oe,clientRect:oe?()=>{var fe;const{decorationId:he}=(fe=this.key)===null||fe===void 0?void 0:fe.getState(e.state),G=T.dom.querySelector(`[data-decoration-id="${he}"]`);return(G==null?void 0:G.getBoundingClientRect())||null}:null},W&&((P=S==null?void 0:S.onBeforeStart)===null||P===void 0||P.call(S,x)),K&&((N=S==null?void 0:S.onBeforeUpdate)===null||N===void 0||N.call(S,x)),(K||W)&&(x.items=await m({editor:e,query:Y.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),W&&((j=S==null?void 0:S.onStart)===null||j===void 0||j.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,R){const{isEditable:P}=e,{composing:N}=e.view,{selection:V}=T,{empty:M,from:j}=V,F={...C};if(F.composing=N,P&&(M||e.view.composing)){(j<C.range.from||j>C.range.to)&&!N&&!C.composing&&(F.active=!1);const L=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;L&&v({editor:e,state:R,range:L.range,isActive:C.active})?(F.active=!0,F.decorationId=C.decorationId?C.decorationId:A,F.range=L.range,F.query=L.query,F.text=L.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(T,C){var O;const{active:R,range:P}=k.getState(T.state);return R&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:P}))||!1},decorations(T){const{active:C,range:O,decorationId:R,query:P}=k.getState(T);if(!C)return null;const N=!(P!=null&&P.length),V=[l];return N&&V.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function Gce({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new On;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function VD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Gce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function zE(t,e){const n=VD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const Jce=nn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=zE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:zE(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new _i,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return VD(this).map(Yce)}}),zD=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new rn({key:new On("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&Rh(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),Xce=Or.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Zce=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",St(this.options.HTMLAttributes,t),0]}}),Qce=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",St(this.options.HTMLAttributes,t),0]}}),eue=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}}),tue=/^\s*(\[([( |x])?\])\s$/,nue=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const g=n();if(typeof g!="number")return!1;const v=m.doc.nodeAt(g);return m.setNodeMarkup(g,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[Dl({find:tue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),rue=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),oue=mn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),HD=Z.forwardRef((t,e)=>{const[n,r]=Z.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return Z.useEffect(()=>r(0),[t.items]),Z.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?b.jsx(z.Paper,{elevation:5,children:b.jsx(z.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(z.ListItem,{disablePadding:!0,children:b.jsx(z.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});HD.displayName="SuggestionList";const HE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},iue={items:async({query:t})=>Promise.resolve(["Lea Thompson","Cyndi Lauper","Tom Cruise","Madonna","Jerry Hall","Joan Collins","Winona Ryder","Christina Applegate","Alyssa Milano","Molly Ringwald","Ally Sheedy","Debbie Harry","Olivia Newton-John","Elton John","Michael J. Fox","Axl Rose","Emilio Estevez","Ralph Macchio","Rob Lowe","Jennifer Grey","Mickey Rourke","John Cusack","Matthew Broderick","Justine Bateman","Lisa Bonet","Benicio Monserrate Rafael del Toro Sánchez"].map((e,n)=>({mentionLabel:e,id:n.toString()})).filter(e=>e.mentionLabel.toLowerCase().startsWith(t.toLowerCase())).slice(0,5)),render:()=>{let t,e;return{onStart:n=>{t=new J2(HD,{props:n,editor:n.editor}),e=Uu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??HE},appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})[0]},onUpdate(n){t==null||t.updateProps(n),e==null||e.setProps({getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??HE}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},sue=Uce.extend({inclusive:!1}),aue=Xce.extend({excludes:"superscript"}),lue=wI.extend({excludes:"subscript"});function cue({placeholder:t}={}){return Z.useMemo(()=>[Jee.configure({resizable:!0}),eue,Qce,Zce,dR,pR,hR,bR,OR,MR,_R,aue,lue,IR,uR,cR,fR,ER,xI,RR,sue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),AQ,yR,IQ,oue.configure({types:["heading","paragraph","image"]}),bce,vce,xce,OZ,AR.configure({multicolor:!0}),kR,YQ,mR,rue,nue.configure({nested:!0}),Jce.configure({suggestion:iue}),zD.configure({placeholder:t}),TR],[t])}function WE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const uue=t=>{const e=cue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(bI,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ut.useField({name:n}),{setValue:f}=u,{value:p}=a;Z.useEffect(()=>{var S,k,T;(T=(k=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:k.commands)==null||T.setContent(p)},[p]);const m=Z.useRef(null),g=Z.useCallback((S,k)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{Xb({images:O,editor:T,position:k})});else{const O=i(S);Xb({images:O,editor:T,position:k})}},[]),v=Z.useCallback((S,k,T,C)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=WE(k.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return g(O,P),k.preventDefault(),!0}return!1},[g]),y=Z.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=WE(k.clipboardData.files);return C.length>0?(g(C),!0):!1},[g]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(yI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>b.jsx(gce,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(yte,{}),b.jsx(Ite,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},w0=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(z.Box,{className:"text-content",children:[b.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(z.Typography,{"data-testid":"message",children:n})]}),b.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},UE=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=Z.useState(!1),[u,f]=Z.useState(void 0);Z.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?b.jsx(z.Collapse,{in:n,children:u}):b.jsx(z.TableRow,{sx:p,children:b.jsx(z.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(z.Collapse,{in:n,children:u})})})},Cx=t=>{const{id:e,getRowKey:n=X=>"id"in X&&(typeof X.id=="string"||typeof X.id=="number")?X.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(X)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(X)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,renderExpand:a,hideColumnsOnMobile:l=[],sortField:u,sortOrder:f,onSortChange:p,allowSortCols:m,fixedLayout:g=!1,className:v,emptyTableMsg:y="No items to display",errorTableMsg:x,retryCallback:S,isLoading:k=!1,disableMobileCards:T=!1,highlightSelectedRow:C=!1,headerRowStyle:O={},stickyHeader:R,reRenderExpand:P=!1,expandOnRowClick:N=!1,tooltipColor:V,...M}=t,{palette:j}=z.useTheme(),[F,L]=Z.useState(void 0),[A,_]=Z.useState(void 0);due(t);const I=X=>{X!==u?p&&p(X,"asc"):p&&p(u,f==="asc"?"desc":"asc")},B=X=>u===X?f:null,W=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),K=W&&l?r.filter(X=>!(l.includes(xn(X))||X.hideCol)):r.filter(X=>!X.hideCol);a&&!W&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:X=>{const le=F===X;return b.jsx(z.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>re(X),children:le?b.jsx($f,{"data-testid":"collapse-up"}):b.jsx(tb,{"data-testid":"expand-down"})})}});const U=p!==void 0,Y=X=>U?m?m.includes(X):!0:!1,oe=b.jsxs(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(_ne,{})," ",y]}),fe=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(yM,{color:"error"})," ",x,S&&b.jsx(z.Button,{variant:"text",onClick:S,children:"Retry?"})]}),he=()=>{if(k)return b.jsx(z.TableRow,{children:b.jsx(z.TableCell,{colSpan:r.length,align:"center",children:b.jsx(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:b.jsx(w0,{})})})});if(x)return b.jsx(z.TableRow,{children:b.jsx(z.TableCell,{colSpan:r.length,align:"center",children:fe})});if(o.length===0)return b.jsx(z.TableRow,{children:b.jsx(z.TableCell,{colSpan:r.length,align:"center",children:oe})})},G=()=>{if(k)return b.jsx(w0,{});if(x)return fe;if(o.length===0)return oe},te=X=>{C&&_(X)},ue=X=>{const le=n(X);if((i||s)&&(i==null||i(le),s==null||s(X),te(le)),a&&N){const xe=F===le?void 0:le;L(xe),te(xe)}},re=X=>{const le=F===X?void 0:X;L(le),te(le)},ie=X=>{if(!a)return;const le=F===n(X);return b.jsxs(b.Fragment,{children:[b.jsxs(z.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>re(n(X)),children:[le?b.jsx($f,{}):b.jsx(tb,{})," Show"," ",le?"Less":"More"]}),b.jsx(UE,{colSpan:r.length,isExpanded:n(X)===F,obj:X,renderExpand:xe=>a(xe),asMobileCard:!0})]})},de=typeof C=="string"?C:j.grey[j.mode=="dark"?600:50],ye=X=>{const le=A===n(X)?de:"inherit";return{cursor:i||N?"pointer":"default",backgroundColor:le,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===de?Xie(le,.1):de}}}},ee=j.grey[j.mode==="dark"?600:400],ce=X=>X&&b.jsx(z.Tooltip,{title:X,children:b.jsx(Mne,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:V??ee,marginLeft:"2px"}})});return W&&!T?b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:v,"data-testid":"mui-table-mobile",children:[U&&b.jsxs(b.Fragment,{children:[b.jsxs(z.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(z.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:X=>I(X.target.value),fullWidth:!0,children:K.map(X=>{if(Y(xn(X)))return b.jsx(z.MenuItem,{value:xn(X),children:X.label??Fn(xn(X))},`rowHeader-${xn(X)}`)})}),b.jsx(z.IconButton,{onClick:()=>{u&&I(u)},children:b.jsx($ne,{className:`sort-icon-${f}`})})]}),b.jsx(z.Divider,{sx:{margin:"10px 0"}})]}),G()??o.map(X=>b.jsxs(z.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(X)},onClick:()=>ue(X),"data-testid":`card-${n(X)}`,children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:K.map(le=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${xn(le)}`,style:{textWrap:"nowrap"},children:[le.label??Fn(xn(le)),ce(le.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(le)}`,style:{paddingLeft:"10px"},children:Mu(le,X,W)})]},`row-${n(X)}-${xn(le)}`))})}),ie(X)]},n(X)))]}):b.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:R?{maxHeight:R,overflow:"auto"}:{},children:b.jsxs(z.Table,{stickyHeader:R!=="undefined",style:{tableLayout:g?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(z.TableHead,{className:"MBv2_Table_Head",children:b.jsx(z.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((X,le)=>{const xe=Y(xn(X));return b.jsx(z.TableCell,{width:Array.isArray(g)?g[le]:"auto",sx:X.tableCellSx??{},children:b.jsx(z.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(z.Box,{sx:[xe&&{"&:hover":{cursor:"pointer",backgroundColor:j.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:xe?()=>I(xn(X)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:X.label??Fn(xn(X))}),ce(X.tooltip),xe&&B(xn(X))==="asc"&&b.jsx($f,{style:{marginLeft:"5px"}}),xe&&B(xn(X))==="desc"&&b.jsx(tb,{style:{marginLeft:"5px"}}),xe&&B(xn(X))!=="asc"&&B(xn(X))!=="desc"&&b.jsx(Pne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(X)}`)})})}),b.jsx(z.TableBody,{className:"MBv2_Table_Body",children:he()??o.map(X=>b.jsxs(Z.Fragment,{children:[b.jsx(z.TableRow,{"data-testid":`row-${n(X)}`,className:"MBv2_Table_Body_Row",onClick:()=>ue(X),sx:ye(X),children:K.map(le=>b.jsx(z.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(le)}`,children:Mu(le,X,W)},`row-${n(X)}-${xn(le)}`))}),a&&b.jsx(UE,{colSpan:K.length,isExpanded:n(X)===F,obj:X,renderExpand:le=>a(le),reRenderExpand:P})]},n(X)))})]})})},due=t=>{const{fixedLayout:e,renderExpand:n,columns:r,expandOnRowClick:o,onRowClick:i,onRowClickObj:s}=t,a="Table component:";Array.isArray(e)&&(!n&&e.length!==r.length&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns".`),n&&e.length!==r.length+1&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),o&&!n&&console.warn(`${a} renderExpand should be defined when expandOnRowClick is defined`),i&&s&&console.warn(`${a} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`)},xn=t=>t.key??t.fieldName,fue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Mu=(t,e,n=!1)=>{const r=fue(e,t.fieldName);return t.render?t.render(r,e,n):r},WD=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},g=x=>{r(parseInt(x.target.value,10))},v=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return b.jsxs(z.Box,{children:[b.jsx(Cx,{sortOrder:p,sortField:f,...s}),!o&&!y&&b.jsx(z.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:g,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},qE=()=>({height:window.innerHeight,width:window.innerWidth}),UD=()=>{const[t,e]=Z.useState(qE());return Z.useEffect(()=>{const n=()=>{e(qE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},ao=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=UD(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(z.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...hr({...t},a)})},pue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(z.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",startIcon:b.jsx(d0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},hue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",color:"error",startIcon:b.jsx(Gv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},mue=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onViewAttachment:f,onSelect:p,getCitationsPaginated:m,selectedIds:g,setSelectedIds:v,onError:y=()=>{},condenseTable:x=!1,canSelect:S=!1,canLaunchUrl:k,addlActions:T,readOnly:C=!1,showCloseBtn:O=!1}=t,R=!!t.canCreate&&!C,P=!!t.canEdit&&!C,N=!!t.canDelete&&!C,{palette:V}=z.useTheme(),[M,j]=Z.useState([]),[F,L]=Z.useState(!1),[A,_]=Z.useState(!0),[I,B]=Z.useState(null),[W,K]=Z.useState(null),[U,Y]=Z.useState(null),[oe,fe]=Z.useState({pageNo:0,pageSize:x?5:10,totalCount:0}),he=()=>{L(!1),_(!0),m({pageNo:oe.pageNo,pageSize:oe.pageSize}).then(le=>(j(le.data),fe({...oe,totalCount:le.totalCount}),le)).catch(le=>{y(le),L(!0),j([])}).finally(()=>_(!1))};Z.useEffect(he,[oe.pageNo,oe.pageSize,e]);const G=()=>{K(null),Y(null),B(null)},te=b.jsx(ao,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:b.jsx(Hh,{}),children:"Add Citation"}),ue=b.jsx(ao,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:b.jsx(RI,{}),children:"Add Attachment"}),re=le=>{if(!(!P&&!C)&&!(C&&!x))return b.jsx(z.Tooltip,{title:C?"View":"Edit",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>le.fileName?a(le):s(le),"data-testid":`citation-table_edit-btn-${le.id}`,children:C?b.jsx(Lne,{}):b.jsx(One,{})})})},ie=le=>{if(!(!N||C))return b.jsx(z.Tooltip,{title:"Delete",children:b.jsx(z.IconButton,{color:"error",onClick:xe=>{K(le),B(xe.currentTarget)},"data-testid":`citation-table_delete-btn-${le.id}`,children:b.jsx(Gv,{})})})},de=le=>{if(!k)return;if(!le.fileName)return b.jsx(z.Tooltip,{title:"Open URL",children:b.jsx(z.IconButton,{color:"primary",onClick:_e=>{B(_e.currentTarget),Y(le)},"data-testid":`citation-table_launch-link-btn-${le.id}`,sx:{visibility:k!=null&&k(le)?"visible":"hidden"},children:b.jsx(d0,{})})})},ye=le=>{if(!f||!le.fileName)return;const xe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],_e=le.fileName.split(".").pop();if(!(!_e||!xe.includes(_e)))return b.jsx(z.Tooltip,{title:"View File",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(le),"data-testid":`citation-table_view-file-btn-${le.id}`,children:b.jsx(d0,{})})})},ee=le=>{if(!u)return;if(!!le.fileName)return b.jsx(z.Tooltip,{title:"Download",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(le),"data-testid":`citation-table_download-btn-${le.id}`,children:b.jsx(Ene,{})})})},ce=C||P||N||k||f||u||T,X=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(le,xe)=>b.jsx(z.Checkbox,{"data-testid":`citation-table_checkbox-${le}`,onChange:()=>{const _e=g.includes(xe.id);v(_e?g.filter(Me=>Me!==xe.id):[...g,xe.id])},checked:g.includes(le),disabled:C})},...qD(V,x),{fieldName:"id",key:"Action",label:"Action",hideCol:!ce,render:(le,xe)=>b.jsxs(z.Box,{display:"flex",flexDirection:"row-reverse",children:[T==null?void 0:T(xe),ie(xe),re(xe),ye(xe),de(xe),ee(xe)]})}];return b.jsxs(b.Fragment,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[b.jsx(z.Typography,{variant:x?"h6":"h2",children:n}),!S&&R&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[te,ue]}),O&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(Xh,{})})]}),b.jsx(WD,{"data-testid":"citation-table",size:x?"x-small":"medium",isLoading:A,columns:X,data:M,paginationState:oe,onPageChange:le=>fe({...oe,pageNo:le}),onRowsPerPageChange:le=>fe({...oe,pageSize:le,pageNo:0}),errorTableMsg:F?"Failed to load citations.":void 0,retryCallback:he}),S&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:R&&b.jsxs(b.Fragment,{children:[te,ue]})}),!C&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(ao,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(ao,{variant:"contained",size:"small",onClick:()=>p(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(pue,{citation:U,anchorEl:I,onClose:G}),b.jsx(hue,{citation:W,anchorEl:I,onDeleteCitation:l,onClose:G})]})},qD=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(RI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Hh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",tableCellSx:{width:e?"100%":"auto"},render:n=>e?ka.truncate(n,{length:40,omission:"..."}):n},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:e,render:(n,r)=>b.jsx("span",{style:{wordBreak:"break-all"},children:n||r.url}),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],Tx=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(ao,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var ub,KE;function gue(){if(KE)return ub;KE=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,k){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=k};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);ub={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var R=0,P=k.length,N=C;R<P-1;){var V=k[R];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;N=N[k[R++]]}N[k[R]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var R=0,P=T.length;R<P;)if(O!=null||!k)O=O[T[R++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(g(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,R,P,N;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),N=g(O),P=!N&&/^\d+$/.test(O),k.call(T,O,N,P,R,S))}function g(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function y(S){return o.test(S)}function x(S){return!g(S)&&(v(S)||y(S))}return ub}var ha=gue(),db,YE;function yue(){if(YE)return db;YE=1;const t=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(t)||[],n=f=>f[0].toUpperCase()+f.slice(1),r=(f,p)=>e(f).join(p).toLowerCase(),o=f=>e(f).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return db={words:e,upperFirst:n,camelCase:o,pascalCase:f=>n(o(f)),snakeCase:f=>r(f,"_"),kebabCase:f=>r(f,"-"),sentenceCase:f=>n(r(f," ")),titleCase:f=>e(f).map(n).join(" ")},db}var fb=yue(),Cf={exports:{}},GE;function bue(){if(GE)return Cf.exports;GE=1,Cf.exports=function(o){return t(e(o),o)},Cf.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(g){if(!p.has(g[0])||!p.has(g[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(g,v,y){if(y.has(g)){var x;try{x=", node was:"+JSON.stringify(g)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(g))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(g));if(!l[v]){l[v]=!0;var S=f.get(g)||new Set;if(S=Array.from(S),v=S.length){y.add(g);do{var k=S[--v];m(k,p.get(k),y)}while(v);y.delete(g)}a[--s]=g}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return Cf.exports}var vue=bue();const xue=sr(vue),wue=Object.prototype.toString,Sue=Error.prototype.toString,Cue=RegExp.prototype.toString,Tue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",kue=/^Symbol\((.*)\)(.*)$/;function Eue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function JE(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Eue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Tue.call(t).replace(kue,"Symbol($1)");const r=wue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Sue.call(t)+"]":r==="RegExp"?Cue.call(t):null}function ws(t,e){let n=JE(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=JE(this[r],e);return i!==null?i:o},2)}function KD(t){return t==null?[]:[].concat(t)}let YD,GD,JD,Oue=/\$\{\s*(\w+)\s*\}/g;YD=Symbol.toStringTag;class XE{constructor(e,n,r,o){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[YD]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],KD(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}GD=Symbol.hasInstance;JD=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Oue,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new XE(e,n,r,o);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[JD]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[GD](e){return XE[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Mue={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},S0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},_ue={isValue:"${path} field must be ${value}"},Uf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Rue={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Iue={notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:Mue,date:S0,object:Uf,array:Rue,boolean:_ue,tuple:Iue});const kx=t=>t&&t.__isYupSchema__;class th{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new th(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!kx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Tf={context:"$",value:"."};class Na{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Tf.context,this.isValue=this.key[0]===Tf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Tf.context:this.isValue?Tf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ha.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Na.prototype.__isYupRef=!0;const sa=t=>t==null;function al(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:g}=t;let{parent:v,context:y,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:y};function T(j={}){const F=XD(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||S},p,j.params),k),L=new pr(pr.formatError(j.message||m,F),n,F.path,j.type||u,F.disableStackTrace);return L.params=F,L}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return ZD(j,k)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?C(j):j?l(null):C(T())},P=j=>{pr.isError(j)?C(j):a(j)};if(g&&sa(n))return R(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(R,P)}}catch(j){P(j);return}R(V)}return e.OPTIONS=t,e}function XD(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=ZD(t[n],e);return t}function ZD(t,e){return Na.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Due(t,e,n,r=n){let o,i,s;return e?(ha.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class nh extends Set{describe(){const e=[];for(const n of this.values())e.push(Na.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new nh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function yl(t,e=new Map){if(kx(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=yl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,yl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(yl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=yl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function Aue(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function Pue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:Aue(n)}))}function QD(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Pue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>QD(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new nh,this._blacklist=new nh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=yl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&sa(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
405
405
 
406
406
  attempted value: ${s}
407
- `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,g=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const x=i[y];x(v,f,function(k){k&&(Array.isArray(k)?g.push(...k):g.push(k)),--m<=0&&p(g)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,g)=>this.resolve(f)._validate(u,f,m,g)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):yl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=al({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=al({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Vo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Vo.notNull){return this.nullability(!1,e)}required(e=Vo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Vo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=al(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=KD(e).map(i=>new Na(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new th(o,n):th.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=al({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Vo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=al({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Vo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=al({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?XD(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:QD(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Due(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const Nue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function $ue(t){const e=C0(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let n=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(n=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(n=0-n)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+n,e.second,e.millisecond)}function C0(t){var e,n;const r=Nue.exec(t);return r?{year:xi(r[1]),month:xi(r[2],1)-1,day:xi(r[3],1),hour:xi(r[4]),minute:xi(r[5]),second:xi(r[6]),millisecond:r[7]?xi(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:xi(r[10]),minuteOffset:xi(r[11])}:null}function xi(t,e=0){return Number(t)||e}let Lue=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jue=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Bue=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Fue="^\\d{4}-\\d{2}-\\d{2}",Vue="\\d{2}:\\d{2}:\\d{2}",zue="(([+-]\\d{2}(:?\\d{2})?)|Z)",Hue=new RegExp(`${Fue}T${Vue}(\\.\\d+)?${zue}$`),Wue=t=>sa(t)||t===t.trim(),Uue={}.toString();function aa(){return new eA}class eA extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===Uue?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Vo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=wr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=wr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=wr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||wr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=wr.email){return this.matches(Lue,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(jue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(Bue,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let n="",r,o;return e&&(typeof e=="object"?{message:n="",allowOffset:r=!1,precision:o=void 0}=e:n=e),this.matches(Hue,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=C0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=C0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Wue})}lowercase(e=wr.lowercase){return this.transform(n=>sa(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toLowerCase()})}uppercase(e=wr.uppercase){return this.transform(n=>sa(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toUpperCase()})}}aa.prototype=eA.prototype;let tA=new Date(""),que=t=>Object.prototype.toString.call(t)==="[object Date]";function Ex(){return new Xu}class Xu extends ti{constructor(){super({type:"date",check(e){return que(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=$ue(e),isNaN(e)?Xu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Na.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=S0.min){let r=this.prepareParam(e,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(o){return o>=this.resolve(r)}})}max(e,n=S0.max){let r=this.prepareParam(e,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(o){return o<=this.resolve(r)}})}}Xu.INVALID_DATE=tA;Ex.prototype=Xu.prototype;Ex.INVALID_DATE=tA;function Kue(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=ha.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Na.isRef(a)&&a.isSibling?i(a.path,s):kx(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return xue.array(Array.from(r),n).reverse()}function ZE(t,e){let n=1/0;return t.some((r,o)=>{var i;if((i=e.path)!=null&&i.includes(r))return n=o,!0}),n}function nA(t){return(e,n)=>ZE(t,e)-ZE(t,n)}const Yue=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function qf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=qf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=qf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(qf)}):"optional"in t?t.optional():t}const Gue=(t,e)=>{const n=[...ha.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=ha.getter(ha.join(n),!0)(t);return!!(o&&r in o)};let QE=t=>Object.prototype.toString.call(t)==="[object Object]";function eO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Jue=nA([]);function Ox(t){return new rA(t)}class rA extends ti{constructor(e){super({type:"object",check(n){return QE(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Jue,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],g=p in o,v=o[p];if(m){let y;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}y=!n.__validating||!S?m.cast(v,u):v,y!==void 0&&(l[p]=y)}else g&&!s&&(l[p]=v);(g!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!QE(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Na.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=Kue(e,n),r._sortErrors=nA(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return qf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=ha.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Gue(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Yue)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Uf.exact,test(n){if(n==null)return!0;const r=eO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Uf.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=eO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Uf.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(fb.camelCase)}snakeCase(){return this.transformKeys(fb.snakeCase)}constantCase(){return this.transformKeys(e=>fb.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}Ox.prototype=rA.prototype;const Xue=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=Z.useRef(null),[u,f]=Z.useState(!1),[p,m]=Z.useState(!1),[g,v]=Z.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});return Z.useEffect(()=>{i&&v({...i,type:"Url"})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(Xh,{})})]}),b.jsx(Ut.Formik,{innerRef:l,enableReinitialize:!0,initialValues:g,onSubmit:async y=>{f(!0),n(y).catch(x=>{throw f(!1),x}).finally(()=>f(!1))},validationSchema:Ox({source:aa().required("Source is required"),title:aa().required("Title is required"),accessedAt:Ex().required("Accessed At is required"),url:aa().required("URL is required"),classification:aa().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:y})=>b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(xs,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(xs,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(Op,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),b.jsx(xs,{name:"url",label:"URL",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(MI,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:s})]}),b.jsx(z.DialogActions,{sx:{px:0},children:s?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Tx,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),y()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},oA=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Zue=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=Z.useRef(null),[f,p]=Z.useState(!1),[m,g]=Z.useState(!1),[v,y]=Z.useState({type:"Attachment",title:"",file:void 0,fileName:""});return Z.useEffect(()=>{s&&y({...s,type:"Attachment",file:void 0})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(Xh,{})})]}),b.jsx(Ut.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:Ox().shape({title:aa().required("Title is required"),fileName:aa().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit:k})=>{var T;return Z.useEffect(()=>{var C,O;(C=x.file)!=null&&C.name&&S("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsx(xs,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(z.Box,{marginTop:i||a?0:1,children:[b.jsxs(oA,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(kI,{name:"file",errorMode:"hidden"}),b.jsx(xs,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(Mr,{name:"fileName"})]}),b.jsx(z.DialogActions,{sx:{px:0},children:a?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Tx,{size:"small",loading:f,type:"button",onClick:()=>{g(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Zu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",g=()=>{if(s&&p)return b.jsx(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(z.Box,{children:g()}),b.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(z.Box,{children:g()})})};return b.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(Xh,{})})]})}):r,o&&(typeof o=="string"?b.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function Que(t){return We("MuiAlert",t)}const tO=Ve("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),ede=De(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),tde=De(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),nde=De(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),rde=De(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),ode=De(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),ide=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ie(n||r)}`,`${e}${Ie(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return He(i,Que,o)},sde=ne(Ms,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ie(n.color||n.severity)}`]]}})(yt(({theme:t})=>{const e=t.palette.mode==="light"?ya:Ol,n=t.palette.mode==="light"?Ol:ya;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${tO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${tO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),ade=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),lde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),cde=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),nO={success:b.jsx(ede,{fontSize:"inherit"}),warning:b.jsx(tde,{fontSize:"inherit"}),error:b.jsx(nde,{fontSize:"inherit"}),info:b.jsx(rde,{fontSize:"inherit"})},iA=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=nO,onClose:g,role:v="alert",severity:y="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:y,variant:k,colorSeverity:l||y},O=ide(C),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[P,N]=Et("root",{ref:n,shouldForwardComponentProp:!0,className:ge(O.root,s),elementType:sde,externalForwardedProps:{...R,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Et("icon",{className:O.icon,elementType:ade,externalForwardedProps:R,ownerState:C}),[j,F]=Et("message",{className:O.message,elementType:lde,externalForwardedProps:R,ownerState:C}),[L,A]=Et("action",{className:O.action,elementType:cde,externalForwardedProps:R,ownerState:C}),[_,I]=Et("closeButton",{elementType:Jl,externalForwardedProps:R,ownerState:C}),[B,W]=Et("closeIcon",{elementType:ode,externalForwardedProps:R,ownerState:C});return b.jsxs(P,{...N,children:[p!==!1?b.jsx(V,{...M,children:p||m[y]||nO[y]}):null,b.jsx(j,{...F,children:i}),o!=null?b.jsx(L,{...A,children:o}):null,o==null&&g?b.jsx(L,{...A,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:g,...I,children:b.jsx(B,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(iA.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Qu=t=>{var g;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(g=l[r])==null?void 0:g.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return b.jsxs(iA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(z.Typography,{variant:"h3",children:s}),n]})},sA=t=>b.jsx(Qu,{severity:"error",...t}),aA=t=>b.jsx(Qu,{severity:"success",...t}),ude=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return b.jsxs(b.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&b.jsx(sA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(aA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function lA({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsSelectablePopup:m=!1,addlActions:g,canLaunchUrl:v,readOnly:y}){const[x,S]=Z.useState("Insert Citation/Attachment(s)"),[k,T]=Z.useState(u),[C,O]=Z.useState(void 0),[R,P]=Z.useState(void 0),N=G=>{P(void 0),S(G)},[V,M]=Z.useState(0);Z.useEffect(()=>{f==null||f()},[x,R,f]);const j=(G=!1)=>{(!m||G)&&M(te=>te+1)},F=(G,te)=>{var de;const ue=typeof((de=te.response)==null?void 0:de.data)=="string"&&te.response.data,re=typeof te.message=="string"&&te.message;P({type:"Error",title:G,message:ue??re}),p(te)},L=G=>P({type:"Success",title:"",message:G}),A=async G=>{if(x==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(x==="Edit Citation"||x==="Edit Attachment"){if(G.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(G).then(()=>{N("Insert Citation/Attachment(s)"),j()}).catch(ue=>{F("Failed to update",ue)}))}else await(e==null?void 0:e(G).then(ue=>{T([...k,ue.id]),N("Insert Citation/Attachment(s)"),j()}).catch(ue=>{F("Failed to create",ue)}))},_=r&&(async G=>r(G).then(()=>{j(!0),T(k.filter(te=>te!==G)),L("Successfully deleted")}).catch(te=>F("Failed to delete",te))),I=(G,te)=>{o(G.id).then(ue=>{O(ue),N(te)}).catch(ue=>{F("Failed to load",ue)})},B=i&&(async G=>i(G).catch(te=>{F(`Failed to download ${G.fileName}`,te)})),W=s&&(async G=>s(G).catch(te=>{F(`Failed to view ${G.fileName}`,te)})),K=b.jsx(mue,{refreshKey:V,getCitationsPaginated:G=>t(G).then(te=>(f==null||f(),te)),onCancel:l,onNewCitation:()=>{O(void 0),N("Add Citation")},onNewAttachment:()=>{O(void 0),N("Add Attachment")},onEditCitation:G=>I(G,y?"View Citation":"Edit Citation"),onEditAttachment:G=>I(G,y?"View Attachment":"Edit Attachment"),onDeleteCitation:_,onDownloadAttachment:B,onViewAttachment:W,onSelect:a,setSelectedIds:T,selectedIds:k,onError:p,condenseTable:m,canSelect:m,title:m&&!y?x:"Attachments & Citations",addlActions:g,canCreate:!!e,canEdit:!!n,canDelete:!!_,canLaunchUrl:v,readOnly:y,showCloseBtn:m}),U=b.jsx(Xue,{modifyCitation:C,onSave:A,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,title:x,readOnly:x==="View Citation",showCloseBtn:m}),Y=b.jsx(Zue,{onSave:A,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:C,disableFileUpload:x==="Edit Attachment",title:x,readOnly:x==="View Attachment",showCloseBtn:m}),oe=b.jsx(ude,{alert:R,setAlert:P}),fe=x==="Add Citation"||x==="Edit Citation"||x==="View Citation",he=x==="Add Attachment"||x==="Edit Attachment"||x==="View Attachment";if(m){let G=null;return!m||x==="Insert Citation/Attachment(s)"?G=K:fe?G=U:he&&(G=Y),b.jsxs(z.Box,{width:"500px",children:[oe,b.jsx(z.Box,{paddingTop:"8px",children:G})]})}return b.jsxs(z.Box,{width:"100%",children:[x==="Insert Citation/Attachment(s)"&&oe,b.jsx(z.Box,{paddingTop:"8px",children:K}),b.jsx(Zu,{open:fe||he,children:b.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[oe,fe?U:Y]})})]})}function cA({...t}){return b.jsx(lA,{renderAsSelectablePopup:!0,...t})}const dde=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function fde({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,canLaunchUrl:a,readOnly:l,...u}){const f=Ct();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,g=p.selectedIds,v=p.selectedNodePos,y=T=>{f&&(T.length===0?f.commands.deleteCitation(v):g.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},v))},x=T=>{y(T),f==null||f.commands.closeCitationBubbleMenu()},S=()=>{y(g),f==null||f.commands.closeCitationBubbleMenu()},k=Z.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?b.jsx(bv,{editor:f,open:m,...p.bubbleMenuOptions,...u,children:b.jsx(dde,{children:b.jsx(cA,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:x,onCancel:S,initialSelectedIds:g,onContentChange:k,canLaunchUrl:a,readOnly:l})})}):null}const pde=()=>mn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function hde(t){const e=Ct(),n=Z.useRef(null);return b.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(Cne,{fontSize:"small"}),b.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const uA=Z.createContext(void 0),dA=()=>{const t=Z.useContext(uA);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},mde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=dA(),[u,f]=Z.useState(s?String(s):""),[p,m]=Z.useState([]),g=r.options.citationMaxLength;if(Z.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),y=v.map(S=>ka.truncate(S.title,{length:g,omission:"..."})).join(", ");f(y),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return b.jsx(zv,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(z.Tooltip,{title:b.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,y)=>{var S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return b.jsxs(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),y<p.length-1&&b.jsx(z.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:b.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},gde=nn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",St(t)]},addNodeView(){return Hv(mde)},addProseMirrorPlugins(){return[new rn({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),fA=t=>b.jsx(TI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),yde=t=>{const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:g,onViewAttachment:v,onError:y=()=>{},placeholder:x="Start typing here...",notApplicableName:S,errorMode:k="normal",canLaunchUrl:T}=t,C=[DR,zD.configure({placeholder:x}),pde(),gde.configure({citationMaxLength:a})],[O,R,P]=Ut.useField({name:e}),{setValue:N}=P,{value:V}=O,{addUpdateCitation:M,deleteCitation:j,batchUpdate:F,citations:L}=dA();Z.useEffect(()=>{var he;const oe=(he=A==null?void 0:A.current)==null?void 0:he.editor;if(!oe)return;oe.getHTML()!==V&&setTimeout(()=>{oe.commands.setContent(V)},0)},[V]);const A=Z.useRef(null),_={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},I=(oe=void 0)=>{var G,te;const fe=((te=(G=A.current)==null?void 0:G.editor)==null?void 0:te.getHTML())??"",he=!fe.replace(/<\/?p>|<br>/g,"").trim();N(he?"":fe,oe)},B=Z.useMemo(()=>ka.debounce(()=>I(!1),500),[N]),W=_a(),{showDiff:K,getPreviousValue:U}=Ra(),Y=i??W;if(K){const oe=U(e)??"",fe=V,he=/<citation\s+ids="([^"]*)"><\/citation>/g,G=(re,ie)=>{const de=ie.split(",").map(Number);return`<sup>${L.filter(ye=>de.includes(ye.id)).map(ye=>ye.title)}</sup>`},te=oe.replace(he,G),ue=fe.replace(he,G);return b.jsx(Aa,{label:n,value:ue,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:Y?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},..._[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&b.jsx(fA,{name:S})]}),b.jsx(yI,{ref:A,extensions:C,content:V,editable:!Y,renderControls:Y?void 0:()=>b.jsx(Lv,{children:b.jsx(hde,{})}),onBlur:()=>I(),onUpdate:B,RichTextFieldProps:{variant:Y?"standard":"outlined",MenuBarProps:{hide:Y}},children:()=>b.jsx(fde,{getCitationsPaginated:oe=>l(oe).then(fe=>(F(fe.data),fe)),onCreateCitation:u&&(oe=>u(oe).then(fe=>(M(fe),fe))),onUpdateCitation:f&&(oe=>f(oe).then(fe=>(M(fe),fe))),onDeleteCitation:p&&(oe=>p(oe).then(()=>j(oe))),getCitationById:m,onDownloadAttachment:g,onViewAttachment:v,onError:y,canLaunchUrl:T,readOnly:Y})}),b.jsx(Mr,{name:e,id:`${e}-err`,errorMode:k})]})},bde=t=>{const{name:e="submit"}=t;return b.jsx(ao,{name:e,type:"submit",...t})},vde=t=>{const{label:e="Return to Top",icon:n=$f,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=Z.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(z.Zoom,{in:o,children:b.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},pA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ko.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(z.MenuItem,{..._u(p,o),children:[p.icon&&b.jsx(z.ListItemIcon,{children:p.icon}),b.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},xde=()=>{const{values:t,errors:e,status:n}=Ut.useFormikContext(),{palette:r}=z.useTheme();return b.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(z.List,{children:[b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(z.Divider,{variant:"inset",component:"li"}),b.jsxs(z.ListItem,{id:"testing",children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},wde=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=UD();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...hr({...t},l)};return b.jsx(z.Stepper,{...u,children:e.map(f=>b.jsx(z.Step,{children:b.jsx(z.StepLabel,{children:f})},f))})},Sde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx(DI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:g="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ut.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(z.FormControl,{fullWidth:!0,children:[b.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(z.Typography,{children:g}):b.jsx(Ut.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(Z.Fragment,{children:b.jsx(Cde,{variant:l,content:b.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[b.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&b.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Cde=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"elevatedCard":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"none":return e}},Tde=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},kde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Zu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Ede=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Ode={added:{icon:wne,label:"Added",color:"success"},deleted:{icon:DI,label:"Deleted",color:"error"},modified:{icon:Tne,label:"Modified",color:"info"}},hA=t=>{const{beforeData:e,afterData:n,emptyTableMsg:r="No changes to display",columns:o}=t,i=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{dataDiff:s,unmodifiedCount:a}=Z.useMemo(()=>Rde(o,e,n,i),[e,n,o,i]),l=o.map(f=>({...f,render:(p,m)=>{var g;return((g=m.modifiedDiff)==null?void 0:g[xn(f)])??Mu(f,m,i)}})),u=t.renderExpand?{renderExpand:f=>{if(f.changeType==="modified"){const p=e.find(m=>m.id===f.id);return b.jsx(wM,{previousSnapshot:p,currentSnapshot:f,children:t.renderExpand(f)})}else return b.jsx(vM,{children:t.renderExpand(f)})}}:{};return b.jsxs(z.Box,{children:[b.jsx(Cx,{columns:[{fieldName:"changeType",render:f=>{const p=Ode[f];return b.jsx(z.Chip,{color:p.color,label:b.jsxs(z.Typography,{children:[b.jsx(I0,{icon:p.icon}),p.label]})})}},...l],data:s,emptyTableMsg:r,...u}),a>0&&b.jsx(z.Box,{children:b.jsxs(z.Typography,{fontStyle:"italic",children:["+",a," unmodified rows"]})})]})},Mde=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:wp},children:b.jsx("s",{children:t})}),b.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:xp},children:b.jsx("u",{children:e})})]}),_de=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Mu(s,e,r),l=Mu(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??ka.isEqual(a,l))||(o[xn(s)]=Mde(a,l))}return o},Rde=(t,e,n,r=!1)=>{const o=[];let i=0,s=0,a=0;for(e.sort((l,u)=>l.id-u.id),n.sort((l,u)=>l.id-u.id);i<e.length&&s<n.length;){const l=e[i],u=n[s];if(l.id===u.id){const f=_de(t,l,u,r);Object.keys(f).length===0?a++:o.push({...u,changeType:"modified",modifiedDiff:f}),i++,s++}else l.id<u.id?(o.push({...l,changeType:"deleted"}),i++):(o.push({...u,changeType:"added"}),s++)}for(;i<e.length;)o.push({...e[i],changeType:"added"}),i++;for(;s<n.length;)o.push({...n[s],changeType:"added"}),s++;return{dataDiff:o,unmodifiedCount:a}},Ide=t=>{const{beforeCitations:e,afterCitations:n}=t,{palette:r}=z.useTheme(),o=qD(r);return b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:b.jsx(z.Typography,{variant:"h2",children:"Attachments & Citations"})}),b.jsx(hA,{columns:o,beforeData:e,afterData:n})]})},Dde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,..._u(l,a),children:l.label},l.label))}),n&&b.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},mA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ko.useLocation(),i=ko.useNavigate(),[s,a]=Z.useState(!1),l=(m,g)=>b.jsx(z.MenuList,{children:m.map(v=>b.jsxs(z.MenuItem,{..._u(v,i,()=>a(!1)),children:[v.icon&&b.jsx(z.ListItemIcon,{children:v.icon}),b.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${g}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(g=>g&&g.length>0);return m.length===0?null:m.map((g,v)=>b.jsxs(Z.Fragment,{children:[l(g,v),v<m.length-1&&b.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return Z.useEffect(()=>{a(!1)},[o]),p&&b.jsxs(b.Fragment,{children:[b.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(Ine,{})}),b.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},gA=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},yA=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(pA,{label:e,menuOptions:n,icon:b.jsx(Ane,{})})},mm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,..._u(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},bA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(mm,{menuOptions:e,activeTabIdx:n,sx:r})})},vA=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return b.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx(II,{}):b.jsx(_I,{})})},Ade=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:g}=t,v=ko.useNavigate(),y=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=ko.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const P=o.findIndex(N=>N.path&&S.startsWith(N.path));C(P>=0?P:void 0)},[S,o]);const O=s&&b.jsx(vA,{onToggle:s}),R=s&&(y||!y&&l)?[{icon:k?b.jsx(II,{}):b.jsx(_I,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(gA,{...e}),u,b.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(z.Button,{disableRipple:!0,component:ko.Link,to:"/",children:r&&typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&b.jsx(mA,{menuOptionLists:[o,a,R],anchor:"right"}),!y&&b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((P,N)=>b.jsxs(z.Box,{display:"flex",alignItems:"center",children:[N>0&&b.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(z.Button,{variant:"text",sx:{color:"white"},..._u(P,v),children:b.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&b.jsx(yA,{displayName:l,userMenuOptions:R})]})]})]}),!y&&b.jsx(bA,{featureMenuOptions:o,activeTabIdx:T,sx:g})]})},Pde=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ko.useLocation(),o=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),[i,s]=Z.useState(void 0);return Z.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&b.jsx(z.Box,{sx:e,children:b.jsx(z.Card,{sx:{height:"100%",width:200},children:b.jsx(mm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Nde=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&b.jsx(mm,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},$de=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Lde=({children:t,getCitations:e})=>{const[n,r]=Z.useState([]),[o,i]=Z.useState(!1);Z.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=Z.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),g=u.filter(v=>!m.has(v.id));return[...p,...g]})},[]),a=Z.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=Z.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return b.jsx(uA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},jde=t=>b.jsx(Qu,{severity:"info",...t}),Bde=t=>b.jsx(Qu,{severity:"warning",...t}),xA=t=>{const{crumbInfo:e}=t,n=ko.useNavigate();return b.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(Dne,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(z.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(z.Typography,{color:"primary",children:r},r))})},Fde=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Vde(r);return b.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(Qu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:rO(r),warning:rO(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Vde=t=>t=="logout"?"info":t=="timeout"?"warning":t,rO=t=>{if(t=="timeout")return b.jsx(xne,{});if(t=="logout")return b.jsx(Rne,{})},zde=t=>{Hde(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(xA,{crumbInfo:i}),b.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(ao,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(Sne,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},Hde=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},Wde=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return b.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),b.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Ude({...t}){return b.jsx(lA,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const qde=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return b.jsx(z.Box,{height:n})};exports.AlertModal=kde;exports.Autocomplete=CI;exports.Breadcrumbs=xA;exports.Button=ao;exports.Checkbox=TI;exports.CheckboxGroup=Wte;exports.CitationField=yde;exports.CitationFieldProvider=Lde;exports.CitationManager=Ude;exports.Column=$de;exports.ConfirmationModal=Tde;exports.DarkModeToggle=vA;exports.DateField=Op;exports.DateRangeField=mce;exports.DecisionModal=Ede;exports.Diff=SI;exports.DiffCitationTable=Ide;exports.DiffProvider=wM;exports.DiffTable=hA;exports.Drawer=mA;exports.DynamicAutocomplete=zte;exports.EnvironmentBanner=gA;exports.ErrorAlert=sA;exports.FileList=Kte;exports.FileUpload=kI;exports.FloatingNavBar=Nde;exports.Footer=Dde;exports.FormDebugger=xde;exports.Header=Ade;exports.InfoAlert=jde;exports.LoadingButton=Tx;exports.LoadingIndicator=w0;exports.Location=mne;exports.MenuButton=pA;exports.Modal=Zu;exports.MultiAutocomplete=Hte;exports.NavBar=bA;exports.NotApplicableCheckbox=fA;exports.PageHeader=zde;exports.PaginatedTable=WD;exports.ProfileMenu=yA;exports.RadioGroup=MI;exports.RangeSlider=gne;exports.ReadOnly=Aa;exports.ReadOnlyProvider=vM;exports.RepeatableFormGroup=Sde;exports.RichTextField=uue;exports.Row=oA;exports.ScrollToTop=vde;exports.SearchField=jne;exports.Select=yne;exports.SelectableCitationManager=cA;exports.Sidebar=Pde;exports.SingleActionCard=Wde;exports.Snackbar=Fde;exports.Spacer=qde;exports.Stepper=wde;exports.Submit=bde;exports.SuccessAlert=aA;exports.Switch=bne;exports.Table=Cx;exports.Tabs=mm;exports.TextArea=vne;exports.TextField=xs;exports.TextIcon=I0;exports.ValidationError=Mr;exports.WarningAlert=Bde;exports.commonTheme=In;exports.darkTheme=ZV;exports.lightTheme=XV;exports.useDiff=Ra;exports.useReadOnly=_a;
407
+ `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,g=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const x=i[y];x(v,f,function(k){k&&(Array.isArray(k)?g.push(...k):g.push(k)),--m<=0&&p(g)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,g)=>this.resolve(f)._validate(u,f,m,g)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):yl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=al({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=al({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Vo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Vo.notNull){return this.nullability(!1,e)}required(e=Vo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Vo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=al(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=KD(e).map(i=>new Na(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new th(o,n):th.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=al({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Vo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=al({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Vo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=al({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?XD(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:QD(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Due(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const Nue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function $ue(t){const e=C0(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let n=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(n=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(n=0-n)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+n,e.second,e.millisecond)}function C0(t){var e,n;const r=Nue.exec(t);return r?{year:xi(r[1]),month:xi(r[2],1)-1,day:xi(r[3],1),hour:xi(r[4]),minute:xi(r[5]),second:xi(r[6]),millisecond:r[7]?xi(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:xi(r[10]),minuteOffset:xi(r[11])}:null}function xi(t,e=0){return Number(t)||e}let Lue=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jue=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Bue=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Fue="^\\d{4}-\\d{2}-\\d{2}",Vue="\\d{2}:\\d{2}:\\d{2}",zue="(([+-]\\d{2}(:?\\d{2})?)|Z)",Hue=new RegExp(`${Fue}T${Vue}(\\.\\d+)?${zue}$`),Wue=t=>sa(t)||t===t.trim(),Uue={}.toString();function aa(){return new eA}class eA extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===Uue?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Vo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=wr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=wr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=wr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||wr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=wr.email){return this.matches(Lue,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(jue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(Bue,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let n="",r,o;return e&&(typeof e=="object"?{message:n="",allowOffset:r=!1,precision:o=void 0}=e:n=e),this.matches(Hue,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=C0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=C0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Wue})}lowercase(e=wr.lowercase){return this.transform(n=>sa(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toLowerCase()})}uppercase(e=wr.uppercase){return this.transform(n=>sa(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toUpperCase()})}}aa.prototype=eA.prototype;let tA=new Date(""),que=t=>Object.prototype.toString.call(t)==="[object Date]";function Ex(){return new Xu}class Xu extends ti{constructor(){super({type:"date",check(e){return que(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=$ue(e),isNaN(e)?Xu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Na.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=S0.min){let r=this.prepareParam(e,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(o){return o>=this.resolve(r)}})}max(e,n=S0.max){let r=this.prepareParam(e,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(o){return o<=this.resolve(r)}})}}Xu.INVALID_DATE=tA;Ex.prototype=Xu.prototype;Ex.INVALID_DATE=tA;function Kue(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=ha.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Na.isRef(a)&&a.isSibling?i(a.path,s):kx(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return xue.array(Array.from(r),n).reverse()}function ZE(t,e){let n=1/0;return t.some((r,o)=>{var i;if((i=e.path)!=null&&i.includes(r))return n=o,!0}),n}function nA(t){return(e,n)=>ZE(t,e)-ZE(t,n)}const Yue=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function qf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=qf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=qf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(qf)}):"optional"in t?t.optional():t}const Gue=(t,e)=>{const n=[...ha.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=ha.getter(ha.join(n),!0)(t);return!!(o&&r in o)};let QE=t=>Object.prototype.toString.call(t)==="[object Object]";function eO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Jue=nA([]);function Ox(t){return new rA(t)}class rA extends ti{constructor(e){super({type:"object",check(n){return QE(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Jue,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],g=p in o,v=o[p];if(m){let y;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}y=!n.__validating||!S?m.cast(v,u):v,y!==void 0&&(l[p]=y)}else g&&!s&&(l[p]=v);(g!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!QE(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Na.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=Kue(e,n),r._sortErrors=nA(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return qf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=ha.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Gue(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Yue)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Uf.exact,test(n){if(n==null)return!0;const r=eO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Uf.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=eO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Uf.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(fb.camelCase)}snakeCase(){return this.transformKeys(fb.snakeCase)}constantCase(){return this.transformKeys(e=>fb.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}Ox.prototype=rA.prototype;const Xue=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=Z.useRef(null),[u,f]=Z.useState(!1),[p,m]=Z.useState(!1),[g,v]=Z.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});return Z.useEffect(()=>{i&&v({...i,type:"Url"})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(Xh,{})})]}),b.jsx(Ut.Formik,{innerRef:l,enableReinitialize:!0,initialValues:g,onSubmit:async y=>{f(!0),n(y).catch(x=>{throw f(!1),x}).finally(()=>f(!1))},validationSchema:Ox({source:aa().required("Source is required"),title:aa().required("Title is required"),accessedAt:Ex().required("Accessed At is required"),url:aa().required("URL is required"),classification:aa().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:y})=>b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(xs,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(xs,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(Op,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),b.jsx(xs,{name:"url",label:"URL",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(MI,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:s})]}),b.jsx(z.DialogActions,{sx:{px:0},children:s?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Tx,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),y()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},oA=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Zue=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=Z.useRef(null),[f,p]=Z.useState(!1),[m,g]=Z.useState(!1),[v,y]=Z.useState({type:"Attachment",title:"",file:void 0,fileName:""});return Z.useEffect(()=>{s&&y({...s,type:"Attachment",file:void 0})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(Xh,{})})]}),b.jsx(Ut.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:Ox().shape({title:aa().required("Title is required"),fileName:aa().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit:k})=>{var T;return Z.useEffect(()=>{var C,O;(C=x.file)!=null&&C.name&&S("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsx(xs,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(z.Box,{marginTop:i||a?0:1,children:[b.jsxs(oA,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(kI,{name:"file",errorMode:"hidden"}),b.jsx(xs,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(Mr,{name:"fileName"})]}),b.jsx(z.DialogActions,{sx:{px:0},children:a?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Tx,{size:"small",loading:f,type:"button",onClick:()=>{g(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Zu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",g=()=>{if(s&&p)return b.jsx(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(z.Box,{children:g()}),b.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(z.Box,{children:g()})})};return b.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(Xh,{})})]})}):r,o&&(typeof o=="string"?b.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function Que(t){return We("MuiAlert",t)}const tO=Ve("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),ede=De(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),tde=De(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),nde=De(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),rde=De(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),ode=De(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),ide=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ie(n||r)}`,`${e}${Ie(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return He(i,Que,o)},sde=ne(Ms,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ie(n.color||n.severity)}`]]}})(yt(({theme:t})=>{const e=t.palette.mode==="light"?ya:Ol,n=t.palette.mode==="light"?Ol:ya;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${tO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${tO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),ade=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),lde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),cde=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),nO={success:b.jsx(ede,{fontSize:"inherit"}),warning:b.jsx(tde,{fontSize:"inherit"}),error:b.jsx(nde,{fontSize:"inherit"}),info:b.jsx(rde,{fontSize:"inherit"})},iA=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=nO,onClose:g,role:v="alert",severity:y="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:y,variant:k,colorSeverity:l||y},O=ide(C),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[P,N]=Et("root",{ref:n,shouldForwardComponentProp:!0,className:ge(O.root,s),elementType:sde,externalForwardedProps:{...R,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Et("icon",{className:O.icon,elementType:ade,externalForwardedProps:R,ownerState:C}),[j,F]=Et("message",{className:O.message,elementType:lde,externalForwardedProps:R,ownerState:C}),[L,A]=Et("action",{className:O.action,elementType:cde,externalForwardedProps:R,ownerState:C}),[_,I]=Et("closeButton",{elementType:Jl,externalForwardedProps:R,ownerState:C}),[B,W]=Et("closeIcon",{elementType:ode,externalForwardedProps:R,ownerState:C});return b.jsxs(P,{...N,children:[p!==!1?b.jsx(V,{...M,children:p||m[y]||nO[y]}):null,b.jsx(j,{...F,children:i}),o!=null?b.jsx(L,{...A,children:o}):null,o==null&&g?b.jsx(L,{...A,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:g,...I,children:b.jsx(B,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(iA.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Qu=t=>{var g;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(g=l[r])==null?void 0:g.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return b.jsxs(iA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(z.Typography,{variant:"h3",children:s}),n]})},sA=t=>b.jsx(Qu,{severity:"error",...t}),aA=t=>b.jsx(Qu,{severity:"success",...t}),ude=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return b.jsxs(b.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&b.jsx(sA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(aA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function lA({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsSelectablePopup:m=!1,addlActions:g,canLaunchUrl:v,readOnly:y}){const[x,S]=Z.useState("Insert Citation/Attachment(s)"),[k,T]=Z.useState(u),[C,O]=Z.useState(void 0),[R,P]=Z.useState(void 0),N=G=>{P(void 0),S(G)},[V,M]=Z.useState(0);Z.useEffect(()=>{f==null||f()},[x,R,f]);const j=(G=!1)=>{(!m||G)&&M(te=>te+1)},F=(G,te)=>{var de;const ue=typeof((de=te.response)==null?void 0:de.data)=="string"&&te.response.data,re=typeof te.message=="string"&&te.message;P({type:"Error",title:G,message:ue??re}),p(te)},L=G=>P({type:"Success",title:"",message:G}),A=async G=>{if(x==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(x==="Edit Citation"||x==="Edit Attachment"){if(G.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(G).then(()=>{N("Insert Citation/Attachment(s)"),j()}).catch(ue=>{F("Failed to update",ue)}))}else await(e==null?void 0:e(G).then(ue=>{T([...k,ue.id]),N("Insert Citation/Attachment(s)"),j()}).catch(ue=>{F("Failed to create",ue)}))},_=r&&(async G=>r(G).then(()=>{j(!0),T(k.filter(te=>te!==G)),L("Successfully deleted")}).catch(te=>F("Failed to delete",te))),I=(G,te)=>{o(G.id).then(ue=>{O(ue),N(te)}).catch(ue=>{F("Failed to load",ue)})},B=i&&(async G=>i(G).catch(te=>{F(`Failed to download ${G.fileName}`,te)})),W=s&&(async G=>s(G).catch(te=>{F(`Failed to view ${G.fileName}`,te)})),K=b.jsx(mue,{refreshKey:V,getCitationsPaginated:G=>t(G).then(te=>(f==null||f(),te)),onCancel:l,onNewCitation:()=>{O(void 0),N("Add Citation")},onNewAttachment:()=>{O(void 0),N("Add Attachment")},onEditCitation:G=>I(G,y?"View Citation":"Edit Citation"),onEditAttachment:G=>I(G,y?"View Attachment":"Edit Attachment"),onDeleteCitation:_,onDownloadAttachment:B,onViewAttachment:W,onSelect:a,setSelectedIds:T,selectedIds:k,onError:p,condenseTable:m,canSelect:m,title:m&&!y?x:"Attachments & Citations",addlActions:g,canCreate:!!e,canEdit:!!n,canDelete:!!_,canLaunchUrl:v,readOnly:y,showCloseBtn:m}),U=b.jsx(Xue,{modifyCitation:C,onSave:A,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,title:x,readOnly:x==="View Citation",showCloseBtn:m}),Y=b.jsx(Zue,{onSave:A,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:C,disableFileUpload:x==="Edit Attachment",title:x,readOnly:x==="View Attachment",showCloseBtn:m}),oe=b.jsx(ude,{alert:R,setAlert:P}),fe=x==="Add Citation"||x==="Edit Citation"||x==="View Citation",he=x==="Add Attachment"||x==="Edit Attachment"||x==="View Attachment";if(m){let G=null;return!m||x==="Insert Citation/Attachment(s)"?G=K:fe?G=U:he&&(G=Y),b.jsxs(z.Box,{width:"500px",children:[oe,b.jsx(z.Box,{paddingTop:"8px",children:G})]})}return b.jsxs(z.Box,{width:"100%",children:[x==="Insert Citation/Attachment(s)"&&oe,b.jsx(z.Box,{paddingTop:"8px",children:K}),b.jsx(Zu,{open:fe||he,children:b.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[oe,fe?U:Y]})})]})}function cA({...t}){return b.jsx(lA,{renderAsSelectablePopup:!0,...t})}const dde=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function fde({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,canLaunchUrl:a,readOnly:l,...u}){const f=Ct();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,g=p.selectedIds,v=p.selectedNodePos,y=T=>{f&&(T.length===0?f.commands.deleteCitation(v):g.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},v))},x=T=>{y(T),f==null||f.commands.closeCitationBubbleMenu()},S=()=>{y(g),f==null||f.commands.closeCitationBubbleMenu()},k=Z.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?b.jsx(bv,{editor:f,open:m,...p.bubbleMenuOptions,...u,children:b.jsx(dde,{children:b.jsx(cA,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:x,onCancel:S,initialSelectedIds:g,onContentChange:k,canLaunchUrl:a,readOnly:l})})}):null}const pde=()=>mn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function hde(t){const e=Ct(),n=Z.useRef(null);return b.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(Cne,{fontSize:"small"}),b.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const uA=Z.createContext(void 0),dA=()=>{const t=Z.useContext(uA);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},mde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=dA(),[u,f]=Z.useState(s?String(s):""),[p,m]=Z.useState([]),g=r.options.citationMaxLength;if(Z.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),y=v.map(S=>ka.truncate(S.title,{length:g,omission:"..."})).join(", ");f(y),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return b.jsx(zv,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(z.Tooltip,{title:b.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,y)=>{var S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return b.jsxs(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),y<p.length-1&&b.jsx(z.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:b.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},gde=nn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",St(t)]},addNodeView(){return Hv(mde)},addProseMirrorPlugins(){return[new rn({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),fA=t=>b.jsx(TI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),yde=t=>{const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:g,onViewAttachment:v,onError:y=()=>{},placeholder:x="Start typing here...",notApplicableName:S,errorMode:k="normal",canLaunchUrl:T}=t,C=[DR,zD.configure({placeholder:x}),pde(),gde.configure({citationMaxLength:a})],[O,R,P]=Ut.useField({name:e}),{setValue:N}=P,{value:V}=O,{addUpdateCitation:M,deleteCitation:j,batchUpdate:F,citations:L}=dA();Z.useEffect(()=>{var he;const oe=(he=A==null?void 0:A.current)==null?void 0:he.editor;if(!oe)return;oe.getHTML()!==V&&setTimeout(()=>{oe.commands.setContent(V)},0)},[V]);const A=Z.useRef(null),_={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},I=(oe=void 0)=>{var G,te;const fe=((te=(G=A.current)==null?void 0:G.editor)==null?void 0:te.getHTML())??"",he=!fe.replace(/<\/?p>|<br>/g,"").trim();N(he?"":fe,oe)},B=Z.useMemo(()=>ka.debounce(()=>I(!1),500),[N]),W=_a(),{showDiff:K,getPreviousValue:U}=Ra(),Y=i??W;if(K){const oe=U(e)??"",fe=V,he=/<citation\s+ids="([^"]*)"><\/citation>/g,G=(re,ie)=>{const de=ie.split(",").map(Number);return`<sup>${L.filter(ye=>de.includes(ye.id)).map(ye=>ye.title)}</sup>`},te=oe.replace(he,G),ue=fe.replace(he,G);return b.jsx(Aa,{label:n,value:ue,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:Y?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},..._[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&b.jsx(fA,{name:S})]}),b.jsx(yI,{ref:A,extensions:C,content:V,editable:!Y,renderControls:Y?void 0:()=>b.jsx(Lv,{children:b.jsx(hde,{})}),onBlur:()=>I(),onUpdate:B,RichTextFieldProps:{variant:Y?"standard":"outlined",MenuBarProps:{hide:Y}},children:()=>b.jsx(fde,{getCitationsPaginated:oe=>l(oe).then(fe=>(F(fe.data),fe)),onCreateCitation:u&&(oe=>u(oe).then(fe=>(M(fe),fe))),onUpdateCitation:f&&(oe=>f(oe).then(fe=>(M(fe),fe))),onDeleteCitation:p&&(oe=>p(oe).then(()=>j(oe))),getCitationById:m,onDownloadAttachment:g,onViewAttachment:v,onError:y,canLaunchUrl:T,readOnly:Y})}),b.jsx(Mr,{name:e,id:`${e}-err`,errorMode:k})]})},bde=t=>{const{name:e="submit"}=t;return b.jsx(ao,{name:e,type:"submit",...t})},vde=t=>{const{label:e="Return to Top",icon:n=$f,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=Z.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(z.Zoom,{in:o,children:b.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},pA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ko.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(z.MenuItem,{..._u(p,o),children:[p.icon&&b.jsx(z.ListItemIcon,{children:p.icon}),b.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},xde=()=>{const{values:t,errors:e,status:n}=Ut.useFormikContext(),{palette:r}=z.useTheme();return b.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(z.List,{children:[b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(z.Divider,{variant:"inset",component:"li"}),b.jsxs(z.ListItem,{id:"testing",children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},wde=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=UD();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...hr({...t},l)};return b.jsx(z.Stepper,{...u,children:e.map(f=>b.jsx(z.Step,{children:b.jsx(z.StepLabel,{children:f})},f))})},Sde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx(DI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:g="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ut.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(z.FormControl,{fullWidth:!0,children:[b.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(z.Typography,{children:g}):b.jsx(Ut.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(Z.Fragment,{children:b.jsx(Cde,{variant:l,content:b.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[b.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&b.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Cde=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"elevatedCard":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"none":return e}},Tde=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},kde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Zu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Ede=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Ode={added:{icon:wne,label:"Added",color:"success"},deleted:{icon:DI,label:"Deleted",color:"error"},modified:{icon:Tne,label:"Modified",color:"info"}},hA=t=>{const{beforeData:e,afterData:n,emptyTableMsg:r="No changes to display",columns:o,isEqual:i}=t;t.renderExpand!=null&&t.isEqual==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const s=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{dataDiff:a,unmodifiedCount:l}=Z.useMemo(()=>Rde(o,e,n,s,i),[e,n,o,s,i]),u=o.map(f=>({...f,render:(p,m)=>{var g;return((g=m.modifiedDiff)==null?void 0:g[xn(f)])??Mu(f,m,s)}}));return b.jsxs(z.Box,{children:[b.jsx(Cx,{columns:[{fieldName:"changeType",render:f=>{const p=Ode[f];return b.jsx(z.Chip,{color:p.color,label:b.jsxs(z.Typography,{children:[b.jsx(I0,{icon:p.icon}),p.label]})})}},...u],data:a,emptyTableMsg:r,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return b.jsx(wM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}),l>0&&b.jsx(z.Box,{children:b.jsxs(z.Typography,{fontStyle:"italic",children:["+",l," unmodified rows"]})})]})},Mde=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:wp},children:b.jsx("s",{children:t})}),b.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:xp},children:b.jsx("u",{children:e})})]}),_de=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Mu(s,e,r),l=Mu(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??ka.isEqual(a,l))||(o[xn(s)]=Mde(a,l))}return o},Rde=(t,e,n,r=!1,o)=>{const i=[];let s=0,a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);s<e.length&&a<n.length;){const u=e[s],f=n[a];if(u.id===f.id){const p=_de(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?l++:i.push({...f,changeType:"modified",modifiedDiff:p}),s++,a++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),s++):(i.push({...f,changeType:"added"}),a++)}for(;s<e.length;)i.push({...e[s],changeType:"added"}),s++;for(;a<n.length;)i.push({...n[a],changeType:"added"}),a++;return{dataDiff:i,unmodifiedCount:l}},Ide=t=>{const{beforeCitations:e,afterCitations:n}=t,{palette:r}=z.useTheme(),o=qD(r);return b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:b.jsx(z.Typography,{variant:"h2",children:"Attachments & Citations"})}),b.jsx(hA,{columns:o,beforeData:e,afterData:n})]})},Dde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,..._u(l,a),children:l.label},l.label))}),n&&b.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},mA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ko.useLocation(),i=ko.useNavigate(),[s,a]=Z.useState(!1),l=(m,g)=>b.jsx(z.MenuList,{children:m.map(v=>b.jsxs(z.MenuItem,{..._u(v,i,()=>a(!1)),children:[v.icon&&b.jsx(z.ListItemIcon,{children:v.icon}),b.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${g}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(g=>g&&g.length>0);return m.length===0?null:m.map((g,v)=>b.jsxs(Z.Fragment,{children:[l(g,v),v<m.length-1&&b.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return Z.useEffect(()=>{a(!1)},[o]),p&&b.jsxs(b.Fragment,{children:[b.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(Ine,{})}),b.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},gA=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},yA=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(pA,{label:e,menuOptions:n,icon:b.jsx(Ane,{})})},mm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,..._u(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},bA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(mm,{menuOptions:e,activeTabIdx:n,sx:r})})},vA=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return b.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx(II,{}):b.jsx(_I,{})})},Ade=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:g}=t,v=ko.useNavigate(),y=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=ko.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const P=o.findIndex(N=>N.path&&S.startsWith(N.path));C(P>=0?P:void 0)},[S,o]);const O=s&&b.jsx(vA,{onToggle:s}),R=s&&(y||!y&&l)?[{icon:k?b.jsx(II,{}):b.jsx(_I,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(gA,{...e}),u,b.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(z.Button,{disableRipple:!0,component:ko.Link,to:"/",children:r&&typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&b.jsx(mA,{menuOptionLists:[o,a,R],anchor:"right"}),!y&&b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((P,N)=>b.jsxs(z.Box,{display:"flex",alignItems:"center",children:[N>0&&b.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(z.Button,{variant:"text",sx:{color:"white"},..._u(P,v),children:b.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&b.jsx(yA,{displayName:l,userMenuOptions:R})]})]})]}),!y&&b.jsx(bA,{featureMenuOptions:o,activeTabIdx:T,sx:g})]})},Pde=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ko.useLocation(),o=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),[i,s]=Z.useState(void 0);return Z.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&b.jsx(z.Box,{sx:e,children:b.jsx(z.Card,{sx:{height:"100%",width:200},children:b.jsx(mm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Nde=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&b.jsx(mm,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},$de=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Lde=({children:t,getCitations:e})=>{const[n,r]=Z.useState([]),[o,i]=Z.useState(!1);Z.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=Z.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),g=u.filter(v=>!m.has(v.id));return[...p,...g]})},[]),a=Z.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=Z.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return b.jsx(uA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},jde=t=>b.jsx(Qu,{severity:"info",...t}),Bde=t=>b.jsx(Qu,{severity:"warning",...t}),xA=t=>{const{crumbInfo:e}=t,n=ko.useNavigate();return b.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(Dne,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(z.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(z.Typography,{color:"primary",children:r},r))})},Fde=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Vde(r);return b.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(Qu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:rO(r),warning:rO(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Vde=t=>t=="logout"?"info":t=="timeout"?"warning":t,rO=t=>{if(t=="timeout")return b.jsx(xne,{});if(t=="logout")return b.jsx(Rne,{})},zde=t=>{Hde(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(xA,{crumbInfo:i}),b.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(ao,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(Sne,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},Hde=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},Wde=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return b.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),b.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Ude({...t}){return b.jsx(lA,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const qde=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return b.jsx(z.Box,{height:n})};exports.AlertModal=kde;exports.Autocomplete=CI;exports.Breadcrumbs=xA;exports.Button=ao;exports.Checkbox=TI;exports.CheckboxGroup=Wte;exports.CitationField=yde;exports.CitationFieldProvider=Lde;exports.CitationManager=Ude;exports.Column=$de;exports.ConfirmationModal=Tde;exports.DarkModeToggle=vA;exports.DateField=Op;exports.DateRangeField=mce;exports.DecisionModal=Ede;exports.Diff=SI;exports.DiffCitationTable=Ide;exports.DiffProvider=wM;exports.DiffTable=hA;exports.Drawer=mA;exports.DynamicAutocomplete=zte;exports.EnvironmentBanner=gA;exports.ErrorAlert=sA;exports.FileList=Kte;exports.FileUpload=kI;exports.FloatingNavBar=Nde;exports.Footer=Dde;exports.FormDebugger=xde;exports.Header=Ade;exports.InfoAlert=jde;exports.LoadingButton=Tx;exports.LoadingIndicator=w0;exports.Location=mne;exports.MenuButton=pA;exports.Modal=Zu;exports.MultiAutocomplete=Hte;exports.NavBar=bA;exports.NotApplicableCheckbox=fA;exports.PageHeader=zde;exports.PaginatedTable=WD;exports.ProfileMenu=yA;exports.RadioGroup=MI;exports.RangeSlider=gne;exports.ReadOnly=Aa;exports.ReadOnlyProvider=vM;exports.RepeatableFormGroup=Sde;exports.RichTextField=uue;exports.Row=oA;exports.ScrollToTop=vde;exports.SearchField=jne;exports.Select=yne;exports.SelectableCitationManager=cA;exports.Sidebar=Pde;exports.SingleActionCard=Wde;exports.Snackbar=Fde;exports.Spacer=qde;exports.Stepper=wde;exports.Submit=bde;exports.SuccessAlert=aA;exports.Switch=bne;exports.Table=Cx;exports.Tabs=mm;exports.TextArea=vne;exports.TextField=xs;exports.TextIcon=I0;exports.ValidationError=Mr;exports.WarningAlert=Bde;exports.commonTheme=In;exports.darkTheme=ZV;exports.lightTheme=XV;exports.useDiff=Ra;exports.useReadOnly=_a;