@simoncomputing/mui-bueno-v2 0.18.15 → 0.18.16

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/CHANGELOG.md CHANGED
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
  - Minor increment --> singlular/minor changes. Minimal breaking changes.
12
12
  - Patch increment --> singlular/minor changes. Zero breaking changes.
13
13
 
14
+ ## [0.18.16] - 2025-09-29
15
+
16
+ ### Changed
17
+ - `CitationField`
18
+ - Completely clear out field when empty (including only whitespace characters) instead of resolving to `<p></p>`
19
+
14
20
  ## [0.18.15] - 2025-09-29
15
21
 
16
22
  ### Fixed
package/dist/index.cjs.js CHANGED
@@ -399,4 +399,4 @@ img.ProseMirror-separator {
399
399
  3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Hde(){Wt.scanner=Nde(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=$de(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 L1(t){return Wt.initialized||Hde(),Fde(Wt.parser.start,t,GN(Wt.scanner.start,t))}L1.scan=GN;function ZN(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 N1(n),o=L1(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}function Wde(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function qde(t){return new tn({key:new yn("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=Gre(n.doc,[...e]);if(toe(a).forEach(({newRange:u})=>{const f=Zre(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1?(p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")),p&&m){const y=m.split(" ").filter(C=>C!=="");if(y.length<=0)return!1;const g=y[y.length-1],b=p.pos+m.lastIndexOf(g);if(!g)return!1;const S=L1(g).map(C=>C.toObject(t.defaultProtocol));if(!Wde(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:b+C.start+1,to:b+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{e1(C.from,C.to,r.doc).some(T=>T.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function Ude(t){return new tn({key:new yn("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=Qx(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 Kde(t){return new tn({key:new yn("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=ZN(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const Yde=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Ss(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(Yde,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Gde=gr.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"){eR(t);return}eR(t.scheme,t.optionalSlashes)})},onDestroy(){Vde()},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)=>!!Ss(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=>!!Ss(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=>!!Ss(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ss(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=>!!Ss(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[Ji({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=ZN(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ss(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(qde({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ss(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Ude({type:this.type})),this.options.linkOnPaste&&t.push(Kde({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),XN=en.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",bt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function Jde(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Noe(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),g=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!g)return null;const b=a.pos-g.length,S=Array.from(g.matchAll(y)).pop();if(!S||S.input===void 0||S.index===void 0)return null;const C=S.input.slice(Math.max(0,S.index-1),S.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!T)return null;const _=b+S.index;let w=_+S[0].length;return l&&f.test(g.slice(w-1,w+1))&&(S[0]+=" ",w+=1),_<a.pos&&w>=a.pos?{range:{from:_,to:w},query:S[0].slice(n.length),text:S[0]}:null}const Zde=new yn("suggestion");function Xde({pluginKey:t=Zde,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:y=Jde}){let g;const b=p==null?void 0:p(),S=new tn({key:t,view(){return{update:async(C,T)=>{var _,w,k,O,j,D,N;const M=(_=this.key)===null||_===void 0?void 0:_.getState(T),R=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),B=M.active&&R.active&&M.range.from!==R.range.from,$=!M.active&&R.active,F=M.active&&!R.active,z=!$&&!F&&M.query!==R.query,L=$||B&&z,q=z||B,U=F||B&&z;if(!L&&!q&&!U)return;const G=U&&!L?M:R,K=C.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);g={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:Z=>u({editor:e,range:G.range,props:Z}),decorationNode:K,clientRect:K?()=>{var Z;const{decorationId:ie}=(Z=this.key)===null||Z===void 0?void 0:Z.getState(e.state),ce=C.dom.querySelector(`[data-decoration-id="${ie}"]`);return(ce==null?void 0:ce.getBoundingClientRect())||null}:null},L&&((k=b==null?void 0:b.onBeforeStart)===null||k===void 0||k.call(b,g)),q&&((O=b==null?void 0:b.onBeforeUpdate)===null||O===void 0||O.call(b,g)),(q||L)&&(g.items=await f({editor:e,query:G.query})),U&&((j=b==null?void 0:b.onExit)===null||j===void 0||j.call(b,g)),q&&((D=b==null?void 0:b.onUpdate)===null||D===void 0||D.call(b,g)),L&&((N=b==null?void 0:b.onStart)===null||N===void 0||N.call(b,g))},destroy:()=>{var C;g&&((C=b==null?void 0:b.onExit)===null||C===void 0||C.call(b,g))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,T,_,w){const{isEditable:k}=e,{composing:O}=e.view,{selection:j}=C,{empty:D,from:N}=j,M={...T};if(M.composing=O,k&&(D||e.view.composing)){(N<T.range.from||N>T.range.to)&&!O&&!T.composing&&(M.active=!1);const R=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:j.$from}),B=`id_${Math.floor(Math.random()*4294967295)}`;R&&m({editor:e,state:w,range:R.range,isActive:T.active})?(M.active=!0,M.decorationId=T.decorationId?T.decorationId:B,M.range=R.range,M.query=R.query,M.text=R.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,T){var _;const{active:w,range:k}=S.getState(C.state);return w&&((_=b==null?void 0:b.onKeyDown)===null||_===void 0?void 0:_.call(b,{view:C,event:T,range:k}))||!1},decorations(C){const{active:T,range:_,decorationId:w}=S.getState(C);return T?Xt.create(C.doc,[$n.inline(_.from,_.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const Qde=new yn("mention"),efe=en.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",bt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:Qde,command:({editor:t,range:e,props:n})=>{var r,o,i;const s=t.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(o=t.view.dom.ownerDocument.defaultView)===null||o===void 0?void 0:o.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},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}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=bt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[Xde({editor:this.editor,...this.options.suggestion})]}}),tfe="listItem",tR="textStyle",nR=/^(\d+)\.\s$/,QN=en.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tfe,this.editor.getAttributes(tR)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=cl({find:nR,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=cl({find:nR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(tR)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),eL=en.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),tL=un.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new tn({key:new yn("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&&ah(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=$n.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)}}})]}}),nfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nL=gr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ks({find:nfe,type:this.type})]},addPasteRules(){return[Ji({find:rfe,type:this.type})]}}),ofe=gr.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",bt(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()}}}),ife=gr.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),sfe=en.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",bt(this.options.HTMLAttributes,t),0]}}),afe=en.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",bt(this.options.HTMLAttributes,t),0]}}),lfe=en.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}}),cfe=/^\s*(\[([( |x])?\])\s$/,ufe=en.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},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",bt(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");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const y=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...y==null?void 0:y.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[cl({find:cfe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),dfe=en.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",bt(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()}}}),rL=en.create({name:"text",group:"inline"}),ffe=un.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)}},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")}}}),pfe=gr.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),oL=J.forwardRef((t,e)=>{const[n,r]=J.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 J.useEffect(()=>r(0),[t.items]),J.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?v.jsx(P.Paper,{elevation:5,children:v.jsx(P.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(P.ListItem,{disablePadding:!0,children:v.jsx(P.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});oL.displayName="SuggestionList";const rR={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},hfe={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 HP(oL,{props:n,editor:n.editor}),e=bu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??rR},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))??rR}})},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}}}},mfe=Gde.extend({inclusive:!1}),gfe=ofe.extend({excludes:"superscript"}),yfe=ife.extend({excludes:"subscript"});function bfe({placeholder:t}={}){return J.useMemo(()=>[Bue.configure({resizable:!0}),lfe,afe,sfe,ON,AN,IN,NN,XN,QN,eL,gfe,yfe,rL,MN,kN,RN,VN,pfe,nL,mfe.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Pse,PN,Ace,ffe.configure({types:["heading","paragraph","image"]}),Que,ede,rde,Oce,pde.configure({multicolor:!0}),zN,$ce,DN,dfe,ufe.configure({nested:!0}),efe.configure({suggestion:hfe}),tL.configure({placeholder:t}),BN],[t])}function oR(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const vfe=t=>{const e=bfe({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(ale,{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]=qt.useField({name:n}),{setValue:f}=u,{value:p}=a;J.useEffect(()=>{var C,T,_;(_=(T=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:T.commands)==null||_.setContent(p)},[p]);const m=J.useRef(null),y=J.useCallback((C,T)=>{var w;const _=(w=m.current)==null?void 0:w.editor;if(!(!_||!i))if(i instanceof Promise)i(C).then(k=>{Sv({images:k,editor:_,position:T})});else{const k=i(C);Sv({images:k,editor:_,position:T})}},[]),g=J.useCallback((C,T,_,w)=>{var O;if(!(T instanceof DragEvent)||!T.dataTransfer)return!1;const k=oR(T.dataTransfer.files);if(k.length>0){const j=(O=C.posAtCoords({left:T.clientX,top:T.clientY}))==null?void 0:O.pos;return y(k,j),T.preventDefault(),!0}return!1},[y]),b=J.useCallback((C,T,_)=>{if(!T.clipboardData)return!1;const w=oR(T.clipboardData.files);return w.length>0?(y(w),!0):!1},[y]),S=v.jsx(P.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(GP,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:g,handlePaste:b},renderControls:s?void 0:()=>v.jsx(zue,{onUploadFiles:i}),onBlur:()=>{var C,T;return f(((T=(C=m.current)==null?void 0:C.editor)==null?void 0:T.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(kP,{}),v.jsx(JP,{})]})})});return v.jsxs(P.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(P.Typography,{...o,children:r}),S]})},Lv=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(P.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(P.Box,{className:"text-content",children:[v.jsx(P.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(P.Typography,{"data-testid":"message",children:n})]}),v.jsx(P.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},iR=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);return J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]),i?v.jsx(P.Box,{children:v.jsx(P.Collapse,{in:n,children:u})}):v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(P.Collapse,{in:n,children:u})})})},iL=t=>{const{id:e,getRowKey:n=W=>"id"in W&&(typeof W.id=="string"||typeof W.id=="number")?W.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(W)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(W)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:m=!1,className:y,emptyTableMsg:g="No items to display",errorTableMsg:b,retryCallback:S,isLoading:C=!1,disableMobileCards:T=!1,highlightSelectedRow:_=!1,headerRowStyle:w={},stickyHeader:k,reRenderExpand:O=!1,...j}=t,{palette:D}=P.useTheme(),[N,M]=J.useState(void 0),[R,B]=J.useState(void 0);Array.isArray(m)&&m.length!==r.length&&console.error('Table component: Length of "fixedLayout" is not equal to the length of "columns".');const $=W=>{W!==l?f&&f(W,"asc"):f&&f(l,u==="asc"?"desc":"asc")},F=W=>l===W?u:null,z=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),L=z&&a?r.filter(W=>!(a.includes(W.fieldName)||W.hideCol)):r.filter(W=>!W.hideCol),q=(W,X)=>X.split(".").reduce((de,ee)=>{if(de&&typeof de=="object")return de[ee]},W),U=(W,X)=>{const de=q(X,W.fieldName);return W.render?W.render(de,X,z):de},G=f!==void 0,K=W=>G?p?p.includes(W):!0:!1,Z=v.jsxs(P.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(l8,{})," ",g]}),ie=v.jsxs(P.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(EA,{color:"error"})," ",b,S&&v.jsx(P.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ce=()=>{if(C)return v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{colSpan:r.length,align:"center",children:v.jsx(P.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(Lv,{})})})});if(b)return v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{colSpan:r.length,align:"center",children:ie})});if(o.length===0)return v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{colSpan:r.length,align:"center",children:Z})})},fe=()=>{if(C)return v.jsx(Lv,{});if(b)return ie;if(o.length===0)return Z},te=W=>{_&&B(W)},he=W=>{if(i&&(i(W),te(W)),s){const X=N===W?void 0:W;M(X),te(X)}},ue=typeof _=="string"?_:D.grey[D.mode=="dark"?600:50],ae=W=>{const X=R===n(W)?ue:"inherit";return{cursor:i||s?"pointer":"default",backgroundColor:X,...i&&{"&:hover":{backgroundColor:X===ue?Za(X,.1):ue}}}};return z&&!T?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[G&&v.jsxs(v.Fragment,{children:[v.jsxs(P.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(P.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:W=>$(W.target.value),fullWidth:!0,children:L.map(W=>{if(K(W.fieldName))return v.jsx(P.MenuItem,{value:W.sortName??W.fieldName,children:W.label??Mn(W.fieldName)},`${W.key??"rowHeader"}-${W.fieldName}`)})}),v.jsx(P.IconButton,{onClick:()=>{l&&$(l)},children:v.jsx(b8,{className:`sort-icon-${u}`})})]}),v.jsx(P.Divider,{sx:{margin:"10px 0"}})]}),fe()??o.map(W=>v.jsxs(P.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ae(W)},onClick:()=>he(n(W)),"data-testid":`card-${n(W)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:L.map(X=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsx("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${X.fieldName}`,style:{textWrap:"nowrap"},children:X.label??Mn(X.fieldName)}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${X.fieldName}`,style:{paddingLeft:"10px"},children:U(X,W)})]},`${X.key??"row"}-${n(W)}-${X.fieldName}`))})}),s&&v.jsx(iR,{colSpan:r.length,isExpanded:n(W)===N,obj:W,renderExpand:X=>s(X),asMobileCard:!0})]},n(W)))]}):v.jsx(P.TableContainer,{component:P.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:y,style:k?{maxHeight:k,overflow:"auto"}:{},children:v.jsxs(P.Table,{stickyHeader:k!=="undefined",style:{tableLayout:m?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...j,children:[v.jsx(P.TableHead,{className:"MBv2_Table_Head",children:v.jsx(P.TableRow,{className:"MBv2_Table_Head_Row",children:L.map((W,X)=>{const de=K(W.fieldName);return v.jsx(P.TableCell,{width:Array.isArray(m)?m[X]:"auto",sx:W.tableCellSx??{},children:v.jsx(P.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(P.Box,{sx:[de&&{"&:hover":{cursor:"pointer",backgroundColor:D.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:de?()=>$(W.sortName??W.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:W.label??Mn(W.fieldName)}),de&&F(W.fieldName)==="asc"&&v.jsx(LA,{style:{marginLeft:"5px"}}),de&&F(W.fieldName)==="desc"&&v.jsx(c8,{style:{marginLeft:"5px"}}),de&&F(W.fieldName)!=="asc"&&F(W.fieldName)!=="desc"&&v.jsx(m8,{style:{marginLeft:"5px"}})]})})},`${W.key??"rowHeader"}-${W.fieldName}`)})})}),v.jsx(P.TableBody,{className:"MBv2_Table_Body",children:ce()??o.map(W=>v.jsxs(J.Fragment,{children:[v.jsx(P.TableRow,{"data-testid":`row-${n(W)}`,className:"MBv2_Table_Body_Row",onClick:()=>he(n(W)),sx:ae(W),children:L.map(X=>v.jsx(P.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${X.fieldName}`,children:U(X,W)},`${X.key??"row"}-${n(W)}-${X.fieldName}`))}),s&&v.jsx(iR,{colSpan:r.length,isExpanded:n(W)===N,obj:W,renderExpand:X=>s(X),reRenderExpand:O})]},n(W)))})]})})},sL=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=S=>{n(S)},y=S=>{r(parseInt(S.target.value,10))},g=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),b=!t.data||t.data&&t.data.length===0;return v.jsxs(P.Box,{children:[v.jsx(iL,{sortOrder:p,sortField:f,...s}),!o&&!b&&v.jsx(P.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:g?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>m(C),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},sR=()=>({height:window.innerHeight,width:window.innerWidth}),aL=()=>{const[t,e]=J.useState(sR());return J.useEffect(()=>{const n=()=>{e(sR())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},qr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=aL(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(P.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...er({...t},a)})},xfe=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(P.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(P.Box,{component:P.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[v.jsxs(P.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",v.jsx("br",{}),v.jsx("b",{children:e.url}),"?"]}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",startIcon:v.jsx(jA,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Sfe=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(P.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(P.Box,{component:P.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(P.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",color:"error",startIcon:v.jsx(Yv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Cfe=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onSelect:f,getCitationsPaginated:p,selectedIds:m,setSelectedIds:y,onError:g=()=>{},condenseTable:b=!1,canCreate:S=!1,canEdit:C=!1,canSelect:T=!1,canLaunchUrl:_,addlActions:w}=t,{palette:k}=P.useTheme(),[O,j]=J.useState([]),[D,N]=J.useState(!1),[M,R]=J.useState(!0),[B,$]=J.useState(null),[F,z]=J.useState(null),[L,q]=J.useState(null),[U,G]=J.useState({pageNo:0,pageSize:b?5:10,totalCount:0}),K=()=>{N(!1),R(!0),p({pageNo:U.pageNo,pageSize:U.pageSize}).then(W=>(j(W.data),G({...U,totalCount:W.totalCount}),W)).catch(W=>{g(W),N(!0),j([])}).finally(()=>R(!1))};J.useEffect(K,[U.pageNo,U.pageSize,e]);const Z=()=>{z(null),q(null),$(null)},ie=v.jsx(qr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:v.jsx(yf,{}),children:"Add Citation"}),ce=v.jsx(qr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:v.jsx(hT,{}),children:"Add Attachment"}),fe=W=>{if(C)return v.jsx(P.Tooltip,{title:"Edit",children:v.jsx(P.IconButton,{color:"primary",onClick:()=>W.fileName?a(W):s(W),"data-testid":`citation-table_edit-btn-${W.id}`,children:v.jsx(Wq,{})})})},te=W=>{if(l)return v.jsx(P.Tooltip,{title:"Delete",children:v.jsx(P.IconButton,{color:"error",onClick:X=>{z(W),$(X.currentTarget)},"data-testid":`citation-table_delete-btn-${W.id}`,children:v.jsx(Yv,{})})})},he=W=>!u&&!_?void 0:W.fileName?v.jsx(P.Tooltip,{title:"Download",children:v.jsx(P.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(W),"data-testid":`citation-table_download-btn-${W.id}`,sx:{visibility:u?"visible":"hidden"},children:v.jsx(Hq,{})})}):v.jsx(P.Tooltip,{title:"Open URL",children:v.jsx(P.IconButton,{color:"primary",onClick:de=>{$(de.currentTarget),q(W)},"data-testid":`citation-table_launch-link-btn-${W.id}`,sx:{visibility:_!=null&&_(W)?"visible":"hidden"},children:v.jsx(jA,{})})}),ae=[{fieldName:"id",key:"select",label:"",hideCol:!T,render:(W,X)=>v.jsx(P.Checkbox,{"data-testid":`citation-table_checkbox-${W}`,onChange:()=>{const de=m.includes(X.id);y(de?m.filter(ee=>ee!==X.id):[...m,X.id])},checked:m.includes(W)})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(W,X)=>v.jsx(P.Tooltip,{title:W?"Attachment":"URL",children:W?v.jsx(hT,{sx:{color:k.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${X.id}`}):v.jsx(yf,{sx:{color:k.grey[500],marginTop:"6px"},"data-testid":`url-icon-${X.id}`})})},{fieldName:"title",tableCellSx:{width:b?"100%":"auto"}},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:b,render:(W,X)=>v.jsx("span",{style:{wordBreak:"break-all"},children:W||X.url})},{fieldName:"source",hideCol:b},{fieldName:"accessedAt",hideCol:b,render:(W,X)=>{if(!X.fileName)return(W==null?void 0:W.slice(0,10))??""}},{fieldName:"classification",hideCol:b},{fieldName:"id",key:"Action",label:"Action",hideCol:!(C||_||u||l||w),render:(W,X)=>v.jsxs(P.Box,{display:"flex",flexDirection:"row",children:[he(X),fe(X),te(X),w==null?void 0:w(X)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(P.Typography,{variant:b?"h6":"h2",children:n}),!T&&S&&v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:1,children:[ie,ce]})]}),v.jsx(sL,{"data-testid":"citation-table",title:n,size:b?"x-small":"medium",isLoading:M,columns:ae,data:O,paginationState:U,onPageChange:W=>G({...U,pageNo:W}),onRowsPerPageChange:W=>G({...U,pageSize:W,pageNo:0}),errorTableMsg:D?"Failed to load citations.":void 0,retryCallback:K}),T&&v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(P.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:S&&v.jsxs(v.Fragment,{children:[ie,ce]})}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(qr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),v.jsxs(qr,{variant:"contained",size:"small",onClick:()=>f(m),children:["Select",m.length>0&&` (${m.length})`]})]})]}),v.jsx(xfe,{citation:L,anchorEl:B,onClose:Z}),v.jsx(Sfe,{citation:F,anchorEl:B,onDeleteCitation:l,onClose:Z})]})},j1=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return v.jsx(qr,{type:n,disabled:e,size:r,startIcon:e?v.jsx(P.CircularProgress,{size:s,color:"inherit"}):null,...o})},wfe=t=>{const{title:e,onSave:n,onCancel:r,modifyCitation:o}=t,i=J.useRef(null),[s,a]=J.useState(!1),[l,u]=J.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});J.useEffect(()=>{o&&u({...o,type:"Url"})},[]);const f=()=>{var m,y,g;const p=(y=(m=i==null?void 0:i.current)==null?void 0:m.values)==null?void 0:y.url;p&&((g=i==null?void 0:i.current)==null||g.setFieldValue("url",_P(p)))};return v.jsxs(v.Fragment,{children:[e&&v.jsx(P.Typography,{variant:"h6",margin:"10px 0",children:e}),v.jsx(qt.Formik,{innerRef:i,enableReinitialize:!0,initialValues:l,onSubmit:async p=>{a(!0),n(p).catch(m=>{throw a(!1),m}).finally(()=>a(!1))},children:v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Va,{name:"source",disabled:s,required:!0,margin:"none"}),v.jsx(Va,{name:"title",disabled:s,required:!0,margin:"none"}),v.jsx(Ef,{name:"accessedAt",disabled:s,required:!0,margin:"none",isDatePicker:!0}),v.jsx(Va,{name:"url",disabled:s,required:!0,onBlur:f,margin:"none"}),v.jsx(PA,{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"}),v.jsxs(P.DialogActions,{sx:{px:0},children:[v.jsx(P.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(j1,{size:"small",loading:s,children:o?"Update Citation":"Add New Citation"})]})]})})]})};var O0,aR;function Tfe(){if(aR)return O0;aR=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,T){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=T};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);O0={Cache:t,split:p,normalizePath:f,setter:function(C){var T=f(C);return l.get(C)||l.set(C,function(w,k){for(var O=0,j=T.length,D=w;O<j-1;){var N=T[O];if(N==="__proto__"||N==="constructor"||N==="prototype")return w;D=D[T[O++]]}D[T[O]]=k})},getter:function(C,T){var _=f(C);return u.get(C)||u.set(C,function(k){for(var O=0,j=_.length;O<j;)if(k!=null||!T)k=k[_[O++]];else return;return k})},join:function(C){return C.reduce(function(T,_){return T+(y(_)||n.test(_)?"["+_+"]":(T?".":"")+_)},"")},forEach:function(C,T,_){m(Array.isArray(C)?C:p(C),T,_)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(T){return T.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,T,_){var w=C.length,k,O,j,D;for(O=0;O<w;O++)k=C[O],k&&(S(k)&&(k='"'+k+'"'),D=y(k),j=!D&&/^\d+$/.test(k),T.call(_,k,D,j,O,C))}function y(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function g(C){return C.match(r)&&!C.match(n)}function b(C){return o.test(C)}function S(C){return!y(C)&&(g(C)||b(C))}return O0}var Bs=Tfe(),R0,lR;function _fe(){if(lR)return R0;lR=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 R0={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(" ")},R0}var A0=_fe(),Vd={exports:{}},cR;function Efe(){if(cR)return Vd.exports;cR=1,Vd.exports=function(o){return t(e(o),o)},Vd.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(y){if(!p.has(y[0])||!p.has(y[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(y,g,b){if(b.has(y)){var S;try{S=", node was:"+JSON.stringify(y)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[g]){l[g]=!0;var C=f.get(y)||new Set;if(C=Array.from(C),g=C.length){b.add(y);do{var T=C[--g];m(T,p.get(T),b)}while(g);b.delete(y)}a[--s]=y}}}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 Vd.exports}var kfe=Efe();const Mfe=or(kfe),Ofe=Object.prototype.toString,Rfe=Error.prototype.toString,Afe=RegExp.prototype.toString,Ife=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Dfe=/^Symbol\((.*)\)(.*)$/;function Pfe(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function uR(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Pfe(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Ife.call(t).replace(Dfe,"Symbol($1)");const r=Ofe.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Rfe.call(t)+"]":r==="RegExp"?Afe.call(t):null}function Ui(t,e){let n=uR(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=uR(this[r],e);return i!==null?i:o},2)}function lL(t){return t==null?[]:[].concat(t)}let cL,uL,dL,Nfe=/\$\{\s*(\w+)\s*\}/g;cL=Symbol.toStringTag;class dR{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[cL]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],lL(e).forEach(i=>{if(fr.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]}}uL=Symbol.hasInstance;dL=Symbol.toStringTag;class fr 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(Nfe,(o,i)=>Ui(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 dR(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[dL]="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,fr)}static[uL](e){return dR[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let _o={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 \`${Ui(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ui(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ui(n,!0)}\``+o}},ur={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"},Lfe={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"},jv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},jfe={isValue:"${path} field must be ${value}"},df={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},$fe={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"},Ffe={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: \`${Ui(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: \`${Ui(n,!0)}\``}return fr.formatError(_o.notType,t)}};Object.assign(Object.create(null),{mixed:_o,string:ur,number:Lfe,date:jv,object:df,array:$fe,boolean:jfe,tuple:Ffe});const $1=t=>t&&t.__isYupSchema__;class gp{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 gp(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(!$1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Hd={context:"$",value:"."};class ta{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]===Hd.context,this.isValue=this.key[0]===Hd.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Hd.context:this.isValue?Hd.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Bs.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}}ta.prototype.__isYupRef=!0;const Ds=t=>t==null;function Aa(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:y}=t;let{parent:g,context:b,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function T(R){return ta.isRef(R)?R.getValue(n,g,b):R}function _(R={}){const B=Object.assign({value:n,originalValue:i,label:s.spec.label,path:R.path||r,spec:s.spec,disableStackTrace:R.disableStackTrace||C},p,R.params);for(const F of Object.keys(B))B[F]=T(B[F]);const $=new fr(fr.formatError(R.message||m,B),n,B.path,R.type||u,B.disableStackTrace);return $.params=B,$}const w=S?a:l;let k={path:r,parent:g,type:u,from:o.from,createError:_,resolve:T,options:o,originalValue:i,schema:s};const O=R=>{fr.isError(R)?w(R):R?l(null):w(_())},j=R=>{fr.isError(R)?w(R):a(R)};if(y&&Ds(n))return O(!0);let N;try{var M;if(N=f.call(k,n,k),typeof((M=N)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${k.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(N).then(O,j)}}catch(R){j(R);return}O(N)}return e.OPTIONS=t,e}function Bfe(t,e,n,r=n){let o,i,s;return e?(Bs.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 yp extends Set{describe(){const e=[];for(const n of this.values())e.push(ta.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 yp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Ba(t,e=new Map){if($1(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]=Ba(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,Ba(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Ba(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Ba(o,e)}else throw Error(`Unable to clone ${t}`);return n}class Lo{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 yp,this._blacklist=new yp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_o.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=Ba(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({value:e},n)),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ds(i))return i;let s=Ui(e),a=Ui(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
400
400
 
401
401
  attempted value: ${s}
402
- `+(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),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=b=>{o||(o=!0,n(b,s))},p=b=>{o||(o=!0,r(b,s))},m=i.length,y=[];if(!m)return p([]);let g={value:s,originalValue:a,path:l,options:u,schema:this};for(let b=0;b<i.length;b++){const S=i[b];S(g,f,function(T){T&&(Array.isArray(T)?y.push(...T):y.push(T)),--m<=0&&p(y)})}}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,y)=>this.resolve(f)._validate(u,f,m,y)}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)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(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 fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Ba(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=Aa({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=Aa({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=_o.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=_o.notNull){return this.nullability(!1,e)}required(e=_o.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=_o.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Aa(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=lL(e).map(i=>new ta(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new gp(o,n):gp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Aa({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=_o.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Aa({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=_o.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Aa({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.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}Lo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])Lo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Bfe(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])Lo.prototype[t]=Lo.prototype.oneOf;for(const t of["not","nope"])Lo.prototype[t]=Lo.prototype.notOneOf;const zfe=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Vfe(t){const e=$v(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 $v(t){var e,n;const r=zfe.exec(t);return r?{year:ei(r[1]),month:ei(r[2],1)-1,day:ei(r[3],1),hour:ei(r[4]),minute:ei(r[5]),second:ei(r[6]),millisecond:r[7]?ei(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:ei(r[10]),minuteOffset:ei(r[11])}:null}function ei(t,e=0){return Number(t)||e}let Hfe=/^[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])?)*$/,Wfe=/^((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,qfe=/^(?:[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,Ufe="^\\d{4}-\\d{2}-\\d{2}",Kfe="\\d{2}:\\d{2}:\\d{2}",Yfe="(([+-]\\d{2}(:?\\d{2})?)|Z)",Gfe=new RegExp(`${Ufe}T${Kfe}(\\.\\d+)?${Yfe}$`),Jfe=t=>Ds(t)||t===t.trim(),Zfe={}.toString();function Fv(){return new fL}class fL extends Lo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===Zfe?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||_o.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=ur.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=ur.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=ur.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||ur.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=ur.email){return this.matches(Hfe,{name:"email",message:e,excludeEmptyString:!0})}url(e=ur.url){return this.matches(Wfe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ur.uuid){return this.matches(qfe,{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(Gfe,{name:"datetime",message:n||ur.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||ur.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=$v(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||ur.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=$v(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ur.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Jfe})}lowercase(e=ur.lowercase){return this.transform(n=>Ds(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toLowerCase()})}uppercase(e=ur.uppercase){return this.transform(n=>Ds(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toUpperCase()})}}Fv.prototype=fL.prototype;let Xfe=new Date(""),Qfe=t=>Object.prototype.toString.call(t)==="[object Date]";class xh extends Lo{constructor(){super({type:"date",check(e){return Qfe(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Vfe(e),isNaN(e)?xh.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ta.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=jv.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=jv.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)}})}}xh.INVALID_DATE=Xfe;xh.prototype;function epe(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Bs.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),ta.isRef(a)&&a.isSibling?i(a.path,s):$1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Mfe.array(Array.from(r),n).reverse()}function fR(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 pL(t){return(e,n)=>fR(t,e)-fR(t,n)}const tpe=(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 ff(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=ff(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=ff(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(ff)}):"optional"in t?t.optional():t}const npe=(t,e)=>{const n=[...Bs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Bs.getter(Bs.join(n),!0)(t);return!!(o&&r in o)};let pR=t=>Object.prototype.toString.call(t)==="[object Object]";function hR(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const rpe=pL([]);function hL(t){return new mL(t)}class mL extends Lo{constructor(e){super({type:"object",check(n){return pR(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=rpe,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],y=p in o;if(m){let g,b=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:b,context:n.context,parent:l});let S=m instanceof Lo?m.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}g=!n.__validating||!C?m.cast(o[p],u):o[p],g!==void 0&&(l[p]=g)}else y&&!s&&(l[p]=o[p]);(y!==p in l||l[p]!==o[p])&&(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||!pR(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ta.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=epe(e,n),r._sortErrors=pL(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 ff(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=Bs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return npe(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(tpe)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||df.exact,test(n){if(n==null)return!0;const r=hR(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=df.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=hR(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=df.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(A0.camelCase)}snakeCase(){return this.transformKeys(A0.snakeCase)}constantCase(){return this.transformKeys(e=>A0.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}}hL.prototype=mL.prototype;const ope=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i}=t,s=J.useRef(null),[a,l]=J.useState(!1),[u,f]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{i&&f({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[e&&v.jsx(P.Typography,{variant:"h6",margin:"10px 0",children:e}),v.jsx(qt.Formik,{innerRef:s,enableReinitialize:!0,initialValues:u,validationSchema:hL().shape({title:Fv().required("Title is required"),fileName:Fv().required("A file is required")}),onSubmit:async p=>{l(!0),n(p).catch(m=>{throw l(!1),m}).finally(()=>l(!1))},children:({values:p,setFieldValue:m})=>{var y;return J.useEffect(()=>{var g,b;(g=p.file)!=null&&g.name&&m("fileName",(b=p.file)==null?void 0:b.name)},[(y=p.file)==null?void 0:y.name]),v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Va,{name:"title",disabled:a,required:!0,margin:"none"}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(OA,{name:"file",readOnly:o}),p.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:p.fileName}),v.jsx(yr,{name:"fileName",id:"fileName-err"})]}),v.jsxs(P.DialogActions,{sx:{px:0},children:[v.jsx(P.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(j1,{size:"small",loading:a,children:i?"Update Attachment":"Add New Attachment"})]})]})}})]})},Su=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",y=()=>{if(s&&p)return v.jsx(P.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},g=()=>{if(i)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(P.Box,{children:y()}),v.jsxs(P.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(P.Box,{children:y()})})};return v.jsxs(P.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(P.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&v.jsx(P.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Bq,{})})]})}):r,o&&(typeof o=="string"?v.jsx(P.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(P.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),g()]})};function ipe(t){return Ye("MuiAlert",t)}const mR=We("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),spe=Fe(v.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"),ape=Fe(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),lpe=Fe(v.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"),cpe=Fe(v.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"),upe=Fe(v.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"),dpe=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Re(n||r)}`,`${e}${Re(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ke(i,ipe,o)},fpe=be(pl,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Re(n.color||n.severity)}`]]}})(It(({theme:t})=>{const e=t.palette.mode==="light"?Za:Mc,n=t.palette.mode==="light"?Mc:Za;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["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),[`& .${mR.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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}`,[`& .${mR.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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)}}}))]}})),ppe=be("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),hpe=be("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),mpe=be("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),gR={success:v.jsx(spe,{fontSize:"inherit"}),warning:v.jsx(ape,{fontSize:"inherit"}),error:v.jsx(lpe,{fontSize:"inherit"}),info:v.jsx(cpe,{fontSize:"inherit"})},gL=A.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=gR,onClose:y,role:g="alert",severity:b="success",slotProps:S={},slots:C={},variant:T="standard",..._}=r,w={...r,color:l,severity:b,variant:T,colorSeverity:l||b},k=dpe(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[j,D]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(k.root,s),elementType:fpe,externalForwardedProps:{...O,..._},ownerState:w,additionalProps:{role:g,elevation:0}}),[N,M]=Bt("icon",{className:k.icon,elementType:ppe,externalForwardedProps:O,ownerState:w}),[R,B]=Bt("message",{className:k.message,elementType:hpe,externalForwardedProps:O,ownerState:w}),[$,F]=Bt("action",{className:k.action,elementType:mpe,externalForwardedProps:O,ownerState:w}),[z,L]=Bt("closeButton",{elementType:hl,externalForwardedProps:O,ownerState:w}),[q,U]=Bt("closeIcon",{elementType:upe,externalForwardedProps:O,ownerState:w});return v.jsxs(j,{...D,children:[p!==!1?v.jsx(N,{...M,children:p||m[b]||gR[b]}):null,v.jsx(R,{...B,children:i}),o!=null?v.jsx($,{...F,children:o}):null,o==null&&y?v.jsx($,{...F,children:v.jsx(z,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...L,children:v.jsx(q,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(gL.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 Cu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=P.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(gL,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(P.Typography,{variant:"h3",children:s}),n]})},yL=t=>v.jsx(Cu,{severity:"error",...t}),bL=t=>v.jsx(Cu,{severity:"success",...t}),gpe=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(yL,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(bL,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function vL({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:s,onCancel:a,initialSelectedIds:l=[],onContentChange:u,onError:f=()=>{},renderAsSelectablePopup:p=!1,addlActions:m,canLaunchUrl:y}){const[g,b]=J.useState("Insert Citation/Attachment(s)"),[S,C]=J.useState(l),[T,_]=J.useState(void 0),[w,k]=J.useState(void 0),O=ie=>{k(void 0),b(ie)},[j,D]=J.useState(0);J.useEffect(()=>{u==null||u()},[g,w,u]);const N=(ie=!1)=>{(!p||ie)&&D(ce=>ce+1)},M=(ie,ce)=>{var ue;const fe=typeof((ue=ce.response)==null?void 0:ue.data)=="string"&&ce.response.data,te=typeof ce.message=="string"&&ce.message;k({type:"Error",title:ie,message:fe??te}),f(ce)},R=ie=>k({type:"Success",title:"",message:ie}),B=async ie=>{if(g==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(g==="Edit Citation"||g==="Edit Attachment"){if(ie.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ie).then(()=>{O("Insert Citation/Attachment(s)"),N()}).catch(fe=>{M("Failed to update",fe)}))}else await(e==null?void 0:e(ie).then(fe=>{C([...S,fe.id]),O("Insert Citation/Attachment(s)"),N()}).catch(fe=>{M("Failed to create",fe)}))},$=r&&(async ie=>r(ie).then(()=>{N(!0),C(S.filter(ce=>ce!==ie)),R("Successfully deleted")}).catch(ce=>M("Failed to delete",ce))),F=(ie,ce)=>{o(ie.id).then(fe=>{_(fe),O(ce)}).catch(fe=>{M("Failed to load",fe)})},z=i&&(async ie=>i(ie).catch(ce=>{M(`Failed to download ${ie.fileName}`,ce)})),L=v.jsx(Cfe,{refreshKey:j,getCitationsPaginated:ie=>t(ie).then(ce=>(u==null||u(),ce)),onCancel:a,onNewCitation:()=>{_(void 0),O("Add Citation")},onNewAttachment:()=>{_(void 0),O("Add Attachment")},onEditCitation:ie=>F(ie,"Edit Citation"),onEditAttachment:ie=>F(ie,"Edit Attachment"),onDeleteCitation:$,onDownloadAttachment:z,onSelect:s,setSelectedIds:C,selectedIds:S,onError:f,condenseTable:p,canSelect:p,title:p?g:"Attachments & Citations",addlActions:m,canCreate:!!e,canEdit:!!n,canLaunchUrl:y}),q=v.jsx(wfe,{modifyCitation:T,onSave:B,onCancel:()=>O("Insert Citation/Attachment(s)"),title:g}),U=v.jsx(ope,{onSave:B,onCancel:()=>O("Insert Citation/Attachment(s)"),modifyCitation:T,disableFileUpload:g==="Edit Attachment",title:g}),G=v.jsx(gpe,{alert:w,setAlert:k}),K=g==="Add Citation"||g==="Edit Citation",Z=g==="Add Attachment"||g==="Edit Attachment";if(p){let ie=null;return!p||g==="Insert Citation/Attachment(s)"?ie=L:K?ie=q:Z&&(ie=U),v.jsxs(P.Box,{width:"500px",children:[G,v.jsx(P.Box,{paddingTop:"8px",children:ie})]})}return v.jsxs(P.Box,{width:"100%",children:[g==="Insert Citation/Attachment(s)"&&G,v.jsx(P.Box,{paddingTop:"8px",children:L}),v.jsx(Su,{open:K||Z,children:v.jsxs(P.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[G,K?q:U]})})]})}function xL({...t}){return v.jsx(vL,{renderAsSelectablePopup:!0,...t})}const ype=Yt({name:{CitationBubbleMenuTipTap:SL}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function SL({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,...a}){const{classes:l}=ype(),u=vt();if(!(u!=null&&u.isEditable))return null;if(!("citationBubbleMenuHandler"in u.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const f=u.storage.citationBubbleMenuHandler,p=f.isOpen,m=f.selectedIds,y=f.selectedNodePos,g=T=>{u&&(T.length===0?u.commands.deleteCitation(y):m.length===0?u.commands.insertCitation({ids:T}):u.commands.updateCitation({ids:T},y))},b=T=>{g(T),u.commands.closeCitationBubbleMenu()},S=()=>{g(m),u.commands.closeCitationBubbleMenu()},C=J.useCallback(()=>{requestAnimationFrame(()=>{u!=null&&u.view&&u.view.dispatch(u.view.state.tr)})},[u]);return v.jsx(hh,{editor:u,open:p,...f.bubbleMenuOptions,...a,children:v.jsx("div",{className:l.content,children:v.jsx(xL,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:b,onCancel:S,initialSelectedIds:m,onContentChange:C,canLaunchUrl:s})})})}const bpe=un.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(MN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(kN.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(ON.configure(this.options.bulletList)),this.options.code!==!1&&t.push(RN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(AN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(IN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(DN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(PN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(NN.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(fN.configure(this.options.heading)),this.options.history!==!1&&t.push(BN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(zN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(VN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(XN.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(QN.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(eL.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(nL.configure(this.options.strike)),this.options.text!==!1&&t.push(rL.configure(this.options.text)),t}}),vpe=()=>un.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 xpe(t){const e=vt(),n=J.useRef(null);return v.jsx(mt,{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:v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(jq,{fontSize:"small"}),v.jsx(P.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const CL=J.createContext(void 0),wL=()=>{const t=J.useContext(CL);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Spe=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=wL(),[u,f]=J.useState(String(s)),[p,m]=J.useState([]),y=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const g=a.filter(C=>s.includes(C.id)),b=g.map(C=>gf.truncate(C.title,{length:y,omission:"..."})).join(", ");f(b),m(g);const S=g.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:g.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(y1,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(P.Tooltip,{title:v.jsx(P.Box,{className:"citation-tooltip",children:p.map((g,b)=>{var C;const S=[g.source,g.title,g.fileName,g.url,(C=g.accessedAt)==null?void 0:C.slice(0,10),g.classification];return v.jsxs(P.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),b<p.length-1&&v.jsx(P.Divider,{className:"citation-tooltip-divider"})]},g.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:g=>{g.preventDefault(),g.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Cpe=en.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",bt(t)]},addNodeView(){return b1(Spe)},addProseMirrorPlugins(){return[new tn({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}}}}),TL=t=>v.jsx(MA,{name:t.name,label:"Not Applicable",collapseErrorWhenEmpty:!0}),wpe=t=>{const{name:e,label:n=Mn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:y,onError:g=()=>{},placeholder:b="Start typing here...",notApplicableName:S,collapseErrorWhenEmpty:C,canLaunchUrl:T}=t,_=[bpe,tL.configure({placeholder:b}),vpe(),Cpe.configure({citationMaxLength:a})],[w,k,O]=qt.useField({name:e}),{setValue:j}=O,{value:D}=w,{addUpdateCitation:N,deleteCitation:M,batchUpdate:R}=wL();J.useEffect(()=>{var U;const L=(U=B==null?void 0:B.current)==null?void 0:U.editor;if(!L||!D)return;L.getHTML()!==D&&setTimeout(()=>{L.commands.setContent(D)},0)},[D]);const B=J.useRef(null),$={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},F=()=>{var U,G;const L=((G=(U=B.current)==null?void 0:U.editor)==null?void 0:G.getHTML())??"<p></p>",q=!L.replace(/<\/?p>|<br>/g,"").trim();j(q?"<p></p>":L)},z=v.jsxs(P.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...$[s],children:[v.jsx(GP,{ref:B,extensions:_,content:D,editable:!i,renderControls:i?void 0:()=>v.jsx(gh,{children:v.jsx(xpe,{})}),onBlur:F,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(SL,{getCitationsPaginated:L=>l(L).then(q=>(R(q.data),q)),onCreateCitation:u&&(L=>u(L).then(q=>(N(q),q))),onUpdateCitation:f&&(L=>f(L).then(q=>(N(q),q))),onDeleteCitation:p&&(L=>p(L).then(()=>M(L))),getCitationById:m,onDownloadAttachment:y,onError:g,canLaunchUrl:T})}),v.jsx(yr,{name:e,id:`${e}-err`,collapseWhenEmpty:C})]});return v.jsxs(P.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(P.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(TL,{name:S})]}),z]})},Tpe=t=>{const{name:e="submit"}=t;return v.jsx(qr,{name:e,type:"submit",...t})},_pe=t=>{const{label:e="Return to Top",icon:n=LA,scrollThresholdPx:r=100}=t,o=P.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(P.Zoom,{in:o,children:v.jsx(P.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(P.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Epe=()=>{const{values:t,errors:e,status:n}=qt.useFormikContext(),{palette:r}=P.useTheme();return v.jsx(P.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(P.List,{children:[v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(P.Divider,{variant:"inset",component:"li"}),v.jsxs(P.ListItem,{id:"testing",children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},kpe=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=aL();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,...er({...t},l)};return v.jsx(P.Stepper,{...u,children:e.map(f=>v.jsx(P.Step,{children:v.jsx(P.StepLabel,{children:f})},f))})},Mpe=t=>{const{name:e,label:n=Mn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(g8,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:g=!1,removePosition:b="bottom"}=t,[S]=qt.useField({name:e}),{value:C}=S,T=_=>({display:"flex",flexDirection:_==="bottom"?"column":"row",alignItems:_==="bottom"?"flex-start":"center"});return v.jsxs(P.FormControl,{fullWidth:!0,children:[v.jsx(P.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(P.Typography,{children:y}):v.jsx(qt.FieldArray,{name:e,render:_=>v.jsxs("div",{children:[C.map((w,k)=>v.jsx(J.Fragment,{children:v.jsx(Ope,{variant:l,content:v.jsxs(P.Box,{"data-testid":"form-group-container",sx:typeof b=="string"?T(b):{...b},children:[v.jsxs(P.Box,{width:"100%",children:[i(`${e}.${k}`,k),g&&k!==C.length-1&&v.jsx(P.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>_.remove(k),children:a})]})})},`${e}-${k}`)),!m&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>_.push(o),sx:u,children:s})]})})]})},Ope=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"elevatedCard":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"none":return e}},Rpe=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(Su,{actions:[v.jsx(P.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Ape=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(Su,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Ipe=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 v.jsx(Su,{actions:[v.jsx(P.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(P.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Dpe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=P.useTheme(),a=ao.useNavigate();return v.jsxs(P.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(P.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(P.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=>v.jsx(P.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Zc(l,a),children:l.label},l.label))}),n&&v.jsx(P.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},_L=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ao.useLocation(),i=ao.useNavigate(),[s,a]=J.useState(!1),l=(m,y)=>v.jsx(P.MenuList,{children:m.map(g=>v.jsxs(P.MenuItem,{...Zc(g,i,()=>a(!1)),children:[g.icon&&v.jsx(P.ListItemIcon,{children:g.icon}),v.jsx(P.ListItemText,{primary:g.label})]},`mobile-drawer-group-${y}-item-${g.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,g)=>v.jsxs(J.Fragment,{children:[l(y,g),g<m.length-1&&v.jsx(P.Divider,{})]},`mobile-drawer-group-${g}`))}return r?v.jsx(P.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(P.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(d8,{})}),v.jsx(P.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(P.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(P.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},EL=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(P.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(P.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},kL=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ao.useNavigate(),[i,s]=A.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(P.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(P.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(P.MenuItem,{...Zc(f,o),children:[f.icon&&v.jsx(P.ListItemIcon,{children:f.icon}),v.jsx(P.ListItemText,{primary:f.label})]},f.label))})]})},ML=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(kL,{label:e,menuOptions:n,icon:v.jsx(p8,{})})},Sh=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}=P.useTheme(),a=ao.useNavigate();return v.jsx(P.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(P.Tab,{icon:l.icon,label:l.label,value:u,...Zc(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))})},OL=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(P.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Sh,{menuOptions:e,activeTabIdx:n,sx:r})})},RL=t=>{const{onToggle:e}=t,{palette:n}=P.useTheme(),r=n.mode==="dark";return v.jsx(P.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx($A,{}):v.jsx(NA,{})})},Ppe=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:y}=t,g=ao.useNavigate(),b=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),{palette:S}=P.useTheme(),{pathname:C}=ao.useLocation(),T=S.mode==="dark",[_,w]=A.useState(void 0);A.useEffect(()=>{const j=o.findIndex(D=>D.path&&C.startsWith(D.path));w(j>=0?j:void 0)},[C,o]);const k=s&&v.jsx(RL,{onToggle:s}),O=s&&(b||!b&&l)?[{icon:T?v.jsx($A,{}):v.jsx(NA,{}),label:`Switch to ${T?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(P.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(EL,{...e}),u,v.jsxs(P.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(P.Button,{disableRipple:!0,component:ao.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!b&&k,b&&v.jsx(_L,{menuOptionLists:[o,a,O],anchor:"right"}),!b&&v.jsxs(v.Fragment,{children:[v.jsx(P.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((j,D)=>v.jsxs(P.Box,{display:"flex",alignItems:"center",children:[D>0&&v.jsx(P.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(P.Button,{variant:"text",sx:{color:"white"},...Zc(j,g),children:v.jsxs(P.Box,{display:"flex",gap:"3px",alignItems:"center",children:[j.icon,j.label]})})]},j.label))}),p,l&&v.jsx(ML,{displayName:l,userMenuOptions:O})]})]})]}),!b&&v.jsx(OL,{featureMenuOptions:o,activeTabIdx:_,sx:y})]})},Npe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ao.useLocation(),o=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.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&&v.jsx(P.Box,{sx:e,children:v.jsx(P.Card,{sx:{height:"100%",width:200},children:v.jsx(Sh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Lpe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=P.useTheme();return e.length>0&&v.jsx(Sh,{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}})},jpe=t=>v.jsx(Cu,{severity:"info",...t}),$pe=t=>v.jsx(Cu,{severity:"warning",...t}),AL=t=>{const{crumbInfo:e}=t,n=ao.useNavigate();return v.jsx(P.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(f8,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(P.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(P.Typography,{color:"primary",children:r},r))})},Fpe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Bpe(r);return v.jsx(P.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(Cu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:yR(r),warning:yR(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(P.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Bpe=t=>t=="logout"?"info":t=="timeout"?"warning":t,yR=t=>{if(t=="timeout")return v.jsx(Pq,{});if(t=="logout")return v.jsx(u8,{})},zpe=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(P.Box,{sx:a,children:[i.length>0&&v.jsx(AL,{crumbInfo:i}),v.jsxs(P.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(P.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(P.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(qr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(Nq,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(P.Box,{width:l?"100%":"50%",children:s})]})]})},Vpe=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return v.jsxs(P.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(P.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(P.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(P.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Hpe({...t}){return v.jsx(vL,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Wpe=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(g=>g.id));return[...p.filter(g=>!m.has(g.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(g=>{const b=u.find(S=>S.id===g.id);return b||g}),m=new Set(f.map(g=>g.id)),y=u.filter(g=>!m.has(g.id));return[...p,...y]})},[]),a=J.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=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(CL.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},qpe=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 v.jsx(P.Box,{height:n})};exports.AlertModal=Ape;exports.Autocomplete=kA;exports.Breadcrumbs=AL;exports.Button=qr;exports.Checkbox=MA;exports.CheckboxGroup=pq;exports.CitationField=wpe;exports.CitationFieldProvider=Wpe;exports.CitationManager=Hpe;exports.ConfirmationModal=Rpe;exports.DarkModeToggle=RL;exports.DateField=Ef;exports.DateRangeField=LQ;exports.DecisionModal=Ipe;exports.Drawer=_L;exports.DynamicAutocomplete=dq;exports.EnvironmentBanner=EL;exports.Error=yr;exports.ErrorAlert=yL;exports.FileList=mq;exports.FileUpload=OA;exports.FloatingNavBar=Lpe;exports.Footer=Dpe;exports.FormDebugger=Epe;exports.Header=Ppe;exports.InfoAlert=jpe;exports.LoadingButton=j1;exports.LoadingIndicator=Lv;exports.Location=Rq;exports.MenuButton=kL;exports.Modal=Su;exports.MultiAutocomplete=fq;exports.NavBar=OL;exports.NotApplicableCheckbox=TL;exports.PageHeader=zpe;exports.PaginatedTable=sL;exports.ProfileMenu=ML;exports.RadioGroup=PA;exports.RangeSlider=Aq;exports.RepeatableFormGroup=Mpe;exports.RichTextField=vfe;exports.ScrollToTop=_pe;exports.SearchField=w8;exports.Select=Iq;exports.SelectableCitationManager=xL;exports.Sidebar=Npe;exports.SingleActionCard=Vpe;exports.Snackbar=Fpe;exports.Spacer=qpe;exports.Stepper=kpe;exports.Submit=Tpe;exports.SuccessAlert=bL;exports.Switch=Dq;exports.Table=iL;exports.Tabs=Sh;exports.TextField=Va;exports.WarningAlert=$pe;exports.commonTheme=Sn;exports.darkTheme=d6;exports.lightTheme=u6;
402
+ `+(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),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=b=>{o||(o=!0,n(b,s))},p=b=>{o||(o=!0,r(b,s))},m=i.length,y=[];if(!m)return p([]);let g={value:s,originalValue:a,path:l,options:u,schema:this};for(let b=0;b<i.length;b++){const S=i[b];S(g,f,function(T){T&&(Array.isArray(T)?y.push(...T):y.push(T)),--m<=0&&p(y)})}}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,y)=>this.resolve(f)._validate(u,f,m,y)}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)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(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 fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Ba(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=Aa({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=Aa({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=_o.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=_o.notNull){return this.nullability(!1,e)}required(e=_o.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=_o.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Aa(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=lL(e).map(i=>new ta(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new gp(o,n):gp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Aa({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=_o.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Aa({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=_o.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Aa({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.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}Lo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])Lo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Bfe(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])Lo.prototype[t]=Lo.prototype.oneOf;for(const t of["not","nope"])Lo.prototype[t]=Lo.prototype.notOneOf;const zfe=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Vfe(t){const e=$v(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 $v(t){var e,n;const r=zfe.exec(t);return r?{year:ei(r[1]),month:ei(r[2],1)-1,day:ei(r[3],1),hour:ei(r[4]),minute:ei(r[5]),second:ei(r[6]),millisecond:r[7]?ei(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:ei(r[10]),minuteOffset:ei(r[11])}:null}function ei(t,e=0){return Number(t)||e}let Hfe=/^[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])?)*$/,Wfe=/^((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,qfe=/^(?:[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,Ufe="^\\d{4}-\\d{2}-\\d{2}",Kfe="\\d{2}:\\d{2}:\\d{2}",Yfe="(([+-]\\d{2}(:?\\d{2})?)|Z)",Gfe=new RegExp(`${Ufe}T${Kfe}(\\.\\d+)?${Yfe}$`),Jfe=t=>Ds(t)||t===t.trim(),Zfe={}.toString();function Fv(){return new fL}class fL extends Lo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===Zfe?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||_o.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=ur.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=ur.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=ur.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||ur.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=ur.email){return this.matches(Hfe,{name:"email",message:e,excludeEmptyString:!0})}url(e=ur.url){return this.matches(Wfe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ur.uuid){return this.matches(qfe,{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(Gfe,{name:"datetime",message:n||ur.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||ur.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=$v(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||ur.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=$v(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ur.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Jfe})}lowercase(e=ur.lowercase){return this.transform(n=>Ds(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toLowerCase()})}uppercase(e=ur.uppercase){return this.transform(n=>Ds(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toUpperCase()})}}Fv.prototype=fL.prototype;let Xfe=new Date(""),Qfe=t=>Object.prototype.toString.call(t)==="[object Date]";class xh extends Lo{constructor(){super({type:"date",check(e){return Qfe(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Vfe(e),isNaN(e)?xh.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ta.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=jv.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=jv.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)}})}}xh.INVALID_DATE=Xfe;xh.prototype;function epe(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Bs.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),ta.isRef(a)&&a.isSibling?i(a.path,s):$1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Mfe.array(Array.from(r),n).reverse()}function fR(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 pL(t){return(e,n)=>fR(t,e)-fR(t,n)}const tpe=(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 ff(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=ff(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=ff(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(ff)}):"optional"in t?t.optional():t}const npe=(t,e)=>{const n=[...Bs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Bs.getter(Bs.join(n),!0)(t);return!!(o&&r in o)};let pR=t=>Object.prototype.toString.call(t)==="[object Object]";function hR(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const rpe=pL([]);function hL(t){return new mL(t)}class mL extends Lo{constructor(e){super({type:"object",check(n){return pR(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=rpe,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],y=p in o;if(m){let g,b=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:b,context:n.context,parent:l});let S=m instanceof Lo?m.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}g=!n.__validating||!C?m.cast(o[p],u):o[p],g!==void 0&&(l[p]=g)}else y&&!s&&(l[p]=o[p]);(y!==p in l||l[p]!==o[p])&&(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||!pR(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ta.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=epe(e,n),r._sortErrors=pL(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 ff(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=Bs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return npe(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(tpe)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||df.exact,test(n){if(n==null)return!0;const r=hR(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=df.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=hR(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=df.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(A0.camelCase)}snakeCase(){return this.transformKeys(A0.snakeCase)}constantCase(){return this.transformKeys(e=>A0.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}}hL.prototype=mL.prototype;const ope=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i}=t,s=J.useRef(null),[a,l]=J.useState(!1),[u,f]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{i&&f({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[e&&v.jsx(P.Typography,{variant:"h6",margin:"10px 0",children:e}),v.jsx(qt.Formik,{innerRef:s,enableReinitialize:!0,initialValues:u,validationSchema:hL().shape({title:Fv().required("Title is required"),fileName:Fv().required("A file is required")}),onSubmit:async p=>{l(!0),n(p).catch(m=>{throw l(!1),m}).finally(()=>l(!1))},children:({values:p,setFieldValue:m})=>{var y;return J.useEffect(()=>{var g,b;(g=p.file)!=null&&g.name&&m("fileName",(b=p.file)==null?void 0:b.name)},[(y=p.file)==null?void 0:y.name]),v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Va,{name:"title",disabled:a,required:!0,margin:"none"}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(OA,{name:"file",readOnly:o}),p.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:p.fileName}),v.jsx(yr,{name:"fileName",id:"fileName-err"})]}),v.jsxs(P.DialogActions,{sx:{px:0},children:[v.jsx(P.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(j1,{size:"small",loading:a,children:i?"Update Attachment":"Add New Attachment"})]})]})}})]})},Su=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",y=()=>{if(s&&p)return v.jsx(P.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},g=()=>{if(i)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(P.Box,{children:y()}),v.jsxs(P.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(P.Box,{children:y()})})};return v.jsxs(P.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(P.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&v.jsx(P.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Bq,{})})]})}):r,o&&(typeof o=="string"?v.jsx(P.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(P.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),g()]})};function ipe(t){return Ye("MuiAlert",t)}const mR=We("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),spe=Fe(v.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"),ape=Fe(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),lpe=Fe(v.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"),cpe=Fe(v.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"),upe=Fe(v.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"),dpe=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Re(n||r)}`,`${e}${Re(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ke(i,ipe,o)},fpe=be(pl,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Re(n.color||n.severity)}`]]}})(It(({theme:t})=>{const e=t.palette.mode==="light"?Za:Mc,n=t.palette.mode==="light"?Mc:Za;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["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),[`& .${mR.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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}`,[`& .${mR.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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)}}}))]}})),ppe=be("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),hpe=be("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),mpe=be("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),gR={success:v.jsx(spe,{fontSize:"inherit"}),warning:v.jsx(ape,{fontSize:"inherit"}),error:v.jsx(lpe,{fontSize:"inherit"}),info:v.jsx(cpe,{fontSize:"inherit"})},gL=A.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=gR,onClose:y,role:g="alert",severity:b="success",slotProps:S={},slots:C={},variant:T="standard",..._}=r,w={...r,color:l,severity:b,variant:T,colorSeverity:l||b},k=dpe(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[j,D]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(k.root,s),elementType:fpe,externalForwardedProps:{...O,..._},ownerState:w,additionalProps:{role:g,elevation:0}}),[N,M]=Bt("icon",{className:k.icon,elementType:ppe,externalForwardedProps:O,ownerState:w}),[R,B]=Bt("message",{className:k.message,elementType:hpe,externalForwardedProps:O,ownerState:w}),[$,F]=Bt("action",{className:k.action,elementType:mpe,externalForwardedProps:O,ownerState:w}),[z,L]=Bt("closeButton",{elementType:hl,externalForwardedProps:O,ownerState:w}),[q,U]=Bt("closeIcon",{elementType:upe,externalForwardedProps:O,ownerState:w});return v.jsxs(j,{...D,children:[p!==!1?v.jsx(N,{...M,children:p||m[b]||gR[b]}):null,v.jsx(R,{...B,children:i}),o!=null?v.jsx($,{...F,children:o}):null,o==null&&y?v.jsx($,{...F,children:v.jsx(z,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...L,children:v.jsx(q,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(gL.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 Cu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=P.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(gL,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(P.Typography,{variant:"h3",children:s}),n]})},yL=t=>v.jsx(Cu,{severity:"error",...t}),bL=t=>v.jsx(Cu,{severity:"success",...t}),gpe=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(yL,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(bL,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function vL({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:s,onCancel:a,initialSelectedIds:l=[],onContentChange:u,onError:f=()=>{},renderAsSelectablePopup:p=!1,addlActions:m,canLaunchUrl:y}){const[g,b]=J.useState("Insert Citation/Attachment(s)"),[S,C]=J.useState(l),[T,_]=J.useState(void 0),[w,k]=J.useState(void 0),O=ie=>{k(void 0),b(ie)},[j,D]=J.useState(0);J.useEffect(()=>{u==null||u()},[g,w,u]);const N=(ie=!1)=>{(!p||ie)&&D(ce=>ce+1)},M=(ie,ce)=>{var ue;const fe=typeof((ue=ce.response)==null?void 0:ue.data)=="string"&&ce.response.data,te=typeof ce.message=="string"&&ce.message;k({type:"Error",title:ie,message:fe??te}),f(ce)},R=ie=>k({type:"Success",title:"",message:ie}),B=async ie=>{if(g==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(g==="Edit Citation"||g==="Edit Attachment"){if(ie.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ie).then(()=>{O("Insert Citation/Attachment(s)"),N()}).catch(fe=>{M("Failed to update",fe)}))}else await(e==null?void 0:e(ie).then(fe=>{C([...S,fe.id]),O("Insert Citation/Attachment(s)"),N()}).catch(fe=>{M("Failed to create",fe)}))},$=r&&(async ie=>r(ie).then(()=>{N(!0),C(S.filter(ce=>ce!==ie)),R("Successfully deleted")}).catch(ce=>M("Failed to delete",ce))),F=(ie,ce)=>{o(ie.id).then(fe=>{_(fe),O(ce)}).catch(fe=>{M("Failed to load",fe)})},z=i&&(async ie=>i(ie).catch(ce=>{M(`Failed to download ${ie.fileName}`,ce)})),L=v.jsx(Cfe,{refreshKey:j,getCitationsPaginated:ie=>t(ie).then(ce=>(u==null||u(),ce)),onCancel:a,onNewCitation:()=>{_(void 0),O("Add Citation")},onNewAttachment:()=>{_(void 0),O("Add Attachment")},onEditCitation:ie=>F(ie,"Edit Citation"),onEditAttachment:ie=>F(ie,"Edit Attachment"),onDeleteCitation:$,onDownloadAttachment:z,onSelect:s,setSelectedIds:C,selectedIds:S,onError:f,condenseTable:p,canSelect:p,title:p?g:"Attachments & Citations",addlActions:m,canCreate:!!e,canEdit:!!n,canLaunchUrl:y}),q=v.jsx(wfe,{modifyCitation:T,onSave:B,onCancel:()=>O("Insert Citation/Attachment(s)"),title:g}),U=v.jsx(ope,{onSave:B,onCancel:()=>O("Insert Citation/Attachment(s)"),modifyCitation:T,disableFileUpload:g==="Edit Attachment",title:g}),G=v.jsx(gpe,{alert:w,setAlert:k}),K=g==="Add Citation"||g==="Edit Citation",Z=g==="Add Attachment"||g==="Edit Attachment";if(p){let ie=null;return!p||g==="Insert Citation/Attachment(s)"?ie=L:K?ie=q:Z&&(ie=U),v.jsxs(P.Box,{width:"500px",children:[G,v.jsx(P.Box,{paddingTop:"8px",children:ie})]})}return v.jsxs(P.Box,{width:"100%",children:[g==="Insert Citation/Attachment(s)"&&G,v.jsx(P.Box,{paddingTop:"8px",children:L}),v.jsx(Su,{open:K||Z,children:v.jsxs(P.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[G,K?q:U]})})]})}function xL({...t}){return v.jsx(vL,{renderAsSelectablePopup:!0,...t})}const ype=Yt({name:{CitationBubbleMenuTipTap:SL}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function SL({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,...a}){const{classes:l}=ype(),u=vt();if(!(u!=null&&u.isEditable))return null;if(!("citationBubbleMenuHandler"in u.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const f=u.storage.citationBubbleMenuHandler,p=f.isOpen,m=f.selectedIds,y=f.selectedNodePos,g=T=>{u&&(T.length===0?u.commands.deleteCitation(y):m.length===0?u.commands.insertCitation({ids:T}):u.commands.updateCitation({ids:T},y))},b=T=>{g(T),u.commands.closeCitationBubbleMenu()},S=()=>{g(m),u.commands.closeCitationBubbleMenu()},C=J.useCallback(()=>{requestAnimationFrame(()=>{u!=null&&u.view&&u.view.dispatch(u.view.state.tr)})},[u]);return v.jsx(hh,{editor:u,open:p,...f.bubbleMenuOptions,...a,children:v.jsx("div",{className:l.content,children:v.jsx(xL,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:b,onCancel:S,initialSelectedIds:m,onContentChange:C,canLaunchUrl:s})})})}const bpe=un.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(MN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(kN.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(ON.configure(this.options.bulletList)),this.options.code!==!1&&t.push(RN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(AN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(IN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(DN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(PN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(NN.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(fN.configure(this.options.heading)),this.options.history!==!1&&t.push(BN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(zN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(VN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(XN.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(QN.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(eL.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(nL.configure(this.options.strike)),this.options.text!==!1&&t.push(rL.configure(this.options.text)),t}}),vpe=()=>un.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 xpe(t){const e=vt(),n=J.useRef(null);return v.jsx(mt,{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:v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(jq,{fontSize:"small"}),v.jsx(P.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const CL=J.createContext(void 0),wL=()=>{const t=J.useContext(CL);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Spe=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=wL(),[u,f]=J.useState(String(s)),[p,m]=J.useState([]),y=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const g=a.filter(C=>s.includes(C.id)),b=g.map(C=>gf.truncate(C.title,{length:y,omission:"..."})).join(", ");f(b),m(g);const S=g.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:g.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(y1,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(P.Tooltip,{title:v.jsx(P.Box,{className:"citation-tooltip",children:p.map((g,b)=>{var C;const S=[g.source,g.title,g.fileName,g.url,(C=g.accessedAt)==null?void 0:C.slice(0,10),g.classification];return v.jsxs(P.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),b<p.length-1&&v.jsx(P.Divider,{className:"citation-tooltip-divider"})]},g.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:g=>{g.preventDefault(),g.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Cpe=en.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",bt(t)]},addNodeView(){return b1(Spe)},addProseMirrorPlugins(){return[new tn({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}}}}),TL=t=>v.jsx(MA,{name:t.name,label:"Not Applicable",collapseErrorWhenEmpty:!0}),wpe=t=>{const{name:e,label:n=Mn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:y,onError:g=()=>{},placeholder:b="Start typing here...",notApplicableName:S,collapseErrorWhenEmpty:C,canLaunchUrl:T}=t,_=[bpe,tL.configure({placeholder:b}),vpe(),Cpe.configure({citationMaxLength:a})],[w,k,O]=qt.useField({name:e}),{setValue:j}=O,{value:D}=w,{addUpdateCitation:N,deleteCitation:M,batchUpdate:R}=wL();J.useEffect(()=>{var U;const L=(U=B==null?void 0:B.current)==null?void 0:U.editor;if(!L||!D)return;L.getHTML()!==D&&setTimeout(()=>{L.commands.setContent(D)},0)},[D]);const B=J.useRef(null),$={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},F=()=>{var U,G;const L=((G=(U=B.current)==null?void 0:U.editor)==null?void 0:G.getHTML())??"",q=!L.replace(/<\/?p>|<br>/g,"").trim();j(q?"":L)},z=v.jsxs(P.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...$[s],children:[v.jsx(GP,{ref:B,extensions:_,content:D,editable:!i,renderControls:i?void 0:()=>v.jsx(gh,{children:v.jsx(xpe,{})}),onBlur:F,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(SL,{getCitationsPaginated:L=>l(L).then(q=>(R(q.data),q)),onCreateCitation:u&&(L=>u(L).then(q=>(N(q),q))),onUpdateCitation:f&&(L=>f(L).then(q=>(N(q),q))),onDeleteCitation:p&&(L=>p(L).then(()=>M(L))),getCitationById:m,onDownloadAttachment:y,onError:g,canLaunchUrl:T})}),v.jsx(yr,{name:e,id:`${e}-err`,collapseWhenEmpty:C})]});return v.jsxs(P.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(P.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(TL,{name:S})]}),z]})},Tpe=t=>{const{name:e="submit"}=t;return v.jsx(qr,{name:e,type:"submit",...t})},_pe=t=>{const{label:e="Return to Top",icon:n=LA,scrollThresholdPx:r=100}=t,o=P.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(P.Zoom,{in:o,children:v.jsx(P.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(P.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Epe=()=>{const{values:t,errors:e,status:n}=qt.useFormikContext(),{palette:r}=P.useTheme();return v.jsx(P.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(P.List,{children:[v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(P.Divider,{variant:"inset",component:"li"}),v.jsxs(P.ListItem,{id:"testing",children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},kpe=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=aL();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,...er({...t},l)};return v.jsx(P.Stepper,{...u,children:e.map(f=>v.jsx(P.Step,{children:v.jsx(P.StepLabel,{children:f})},f))})},Mpe=t=>{const{name:e,label:n=Mn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(g8,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:g=!1,removePosition:b="bottom"}=t,[S]=qt.useField({name:e}),{value:C}=S,T=_=>({display:"flex",flexDirection:_==="bottom"?"column":"row",alignItems:_==="bottom"?"flex-start":"center"});return v.jsxs(P.FormControl,{fullWidth:!0,children:[v.jsx(P.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(P.Typography,{children:y}):v.jsx(qt.FieldArray,{name:e,render:_=>v.jsxs("div",{children:[C.map((w,k)=>v.jsx(J.Fragment,{children:v.jsx(Ope,{variant:l,content:v.jsxs(P.Box,{"data-testid":"form-group-container",sx:typeof b=="string"?T(b):{...b},children:[v.jsxs(P.Box,{width:"100%",children:[i(`${e}.${k}`,k),g&&k!==C.length-1&&v.jsx(P.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>_.remove(k),children:a})]})})},`${e}-${k}`)),!m&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>_.push(o),sx:u,children:s})]})})]})},Ope=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"elevatedCard":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"none":return e}},Rpe=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(Su,{actions:[v.jsx(P.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Ape=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(Su,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Ipe=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 v.jsx(Su,{actions:[v.jsx(P.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(P.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Dpe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=P.useTheme(),a=ao.useNavigate();return v.jsxs(P.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(P.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(P.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=>v.jsx(P.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Zc(l,a),children:l.label},l.label))}),n&&v.jsx(P.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},_L=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ao.useLocation(),i=ao.useNavigate(),[s,a]=J.useState(!1),l=(m,y)=>v.jsx(P.MenuList,{children:m.map(g=>v.jsxs(P.MenuItem,{...Zc(g,i,()=>a(!1)),children:[g.icon&&v.jsx(P.ListItemIcon,{children:g.icon}),v.jsx(P.ListItemText,{primary:g.label})]},`mobile-drawer-group-${y}-item-${g.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,g)=>v.jsxs(J.Fragment,{children:[l(y,g),g<m.length-1&&v.jsx(P.Divider,{})]},`mobile-drawer-group-${g}`))}return r?v.jsx(P.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(P.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(d8,{})}),v.jsx(P.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(P.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(P.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},EL=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(P.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(P.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},kL=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ao.useNavigate(),[i,s]=A.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(P.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(P.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(P.MenuItem,{...Zc(f,o),children:[f.icon&&v.jsx(P.ListItemIcon,{children:f.icon}),v.jsx(P.ListItemText,{primary:f.label})]},f.label))})]})},ML=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(kL,{label:e,menuOptions:n,icon:v.jsx(p8,{})})},Sh=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}=P.useTheme(),a=ao.useNavigate();return v.jsx(P.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(P.Tab,{icon:l.icon,label:l.label,value:u,...Zc(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))})},OL=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(P.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Sh,{menuOptions:e,activeTabIdx:n,sx:r})})},RL=t=>{const{onToggle:e}=t,{palette:n}=P.useTheme(),r=n.mode==="dark";return v.jsx(P.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx($A,{}):v.jsx(NA,{})})},Ppe=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:y}=t,g=ao.useNavigate(),b=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),{palette:S}=P.useTheme(),{pathname:C}=ao.useLocation(),T=S.mode==="dark",[_,w]=A.useState(void 0);A.useEffect(()=>{const j=o.findIndex(D=>D.path&&C.startsWith(D.path));w(j>=0?j:void 0)},[C,o]);const k=s&&v.jsx(RL,{onToggle:s}),O=s&&(b||!b&&l)?[{icon:T?v.jsx($A,{}):v.jsx(NA,{}),label:`Switch to ${T?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(P.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(EL,{...e}),u,v.jsxs(P.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(P.Button,{disableRipple:!0,component:ao.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!b&&k,b&&v.jsx(_L,{menuOptionLists:[o,a,O],anchor:"right"}),!b&&v.jsxs(v.Fragment,{children:[v.jsx(P.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((j,D)=>v.jsxs(P.Box,{display:"flex",alignItems:"center",children:[D>0&&v.jsx(P.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(P.Button,{variant:"text",sx:{color:"white"},...Zc(j,g),children:v.jsxs(P.Box,{display:"flex",gap:"3px",alignItems:"center",children:[j.icon,j.label]})})]},j.label))}),p,l&&v.jsx(ML,{displayName:l,userMenuOptions:O})]})]})]}),!b&&v.jsx(OL,{featureMenuOptions:o,activeTabIdx:_,sx:y})]})},Npe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ao.useLocation(),o=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.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&&v.jsx(P.Box,{sx:e,children:v.jsx(P.Card,{sx:{height:"100%",width:200},children:v.jsx(Sh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Lpe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=P.useTheme();return e.length>0&&v.jsx(Sh,{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}})},jpe=t=>v.jsx(Cu,{severity:"info",...t}),$pe=t=>v.jsx(Cu,{severity:"warning",...t}),AL=t=>{const{crumbInfo:e}=t,n=ao.useNavigate();return v.jsx(P.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(f8,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(P.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(P.Typography,{color:"primary",children:r},r))})},Fpe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Bpe(r);return v.jsx(P.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(Cu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:yR(r),warning:yR(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(P.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Bpe=t=>t=="logout"?"info":t=="timeout"?"warning":t,yR=t=>{if(t=="timeout")return v.jsx(Pq,{});if(t=="logout")return v.jsx(u8,{})},zpe=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(P.Box,{sx:a,children:[i.length>0&&v.jsx(AL,{crumbInfo:i}),v.jsxs(P.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(P.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(P.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(qr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(Nq,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(P.Box,{width:l?"100%":"50%",children:s})]})]})},Vpe=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return v.jsxs(P.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(P.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(P.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(P.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Hpe({...t}){return v.jsx(vL,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Wpe=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(g=>g.id));return[...p.filter(g=>!m.has(g.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(g=>{const b=u.find(S=>S.id===g.id);return b||g}),m=new Set(f.map(g=>g.id)),y=u.filter(g=>!m.has(g.id));return[...p,...y]})},[]),a=J.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=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(CL.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},qpe=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 v.jsx(P.Box,{height:n})};exports.AlertModal=Ape;exports.Autocomplete=kA;exports.Breadcrumbs=AL;exports.Button=qr;exports.Checkbox=MA;exports.CheckboxGroup=pq;exports.CitationField=wpe;exports.CitationFieldProvider=Wpe;exports.CitationManager=Hpe;exports.ConfirmationModal=Rpe;exports.DarkModeToggle=RL;exports.DateField=Ef;exports.DateRangeField=LQ;exports.DecisionModal=Ipe;exports.Drawer=_L;exports.DynamicAutocomplete=dq;exports.EnvironmentBanner=EL;exports.Error=yr;exports.ErrorAlert=yL;exports.FileList=mq;exports.FileUpload=OA;exports.FloatingNavBar=Lpe;exports.Footer=Dpe;exports.FormDebugger=Epe;exports.Header=Ppe;exports.InfoAlert=jpe;exports.LoadingButton=j1;exports.LoadingIndicator=Lv;exports.Location=Rq;exports.MenuButton=kL;exports.Modal=Su;exports.MultiAutocomplete=fq;exports.NavBar=OL;exports.NotApplicableCheckbox=TL;exports.PageHeader=zpe;exports.PaginatedTable=sL;exports.ProfileMenu=ML;exports.RadioGroup=PA;exports.RangeSlider=Aq;exports.RepeatableFormGroup=Mpe;exports.RichTextField=vfe;exports.ScrollToTop=_pe;exports.SearchField=w8;exports.Select=Iq;exports.SelectableCitationManager=xL;exports.Sidebar=Npe;exports.SingleActionCard=Vpe;exports.Snackbar=Fpe;exports.Spacer=qpe;exports.Stepper=kpe;exports.Submit=Tpe;exports.SuccessAlert=bL;exports.Switch=Dq;exports.Table=iL;exports.Tabs=Sh;exports.TextField=Va;exports.WarningAlert=$pe;exports.commonTheme=Sn;exports.darkTheme=d6;exports.lightTheme=u6;
package/dist/index.es.js CHANGED
@@ -60223,8 +60223,8 @@ const g$ = xu(void 0), y$ = () => {
60223
60223
  none: { margin: 0 }
60224
60224
  }, F = () => {
60225
60225
  var q, Y;
60226
- const N = ((Y = (q = B.current) == null ? void 0 : q.editor) == null ? void 0 : Y.getHTML()) ?? "<p></p>", W = !N.replace(/<\/?p>|<br>/g, "").trim();
60227
- L(W ? "<p></p>" : N);
60226
+ const N = ((Y = (q = B.current) == null ? void 0 : q.editor) == null ? void 0 : Y.getHTML()) ?? "", W = !N.replace(/<\/?p>|<br>/g, "").trim();
60227
+ L(W ? "" : N);
60228
60228
  }, z = /* @__PURE__ */ ne(
60229
60229
  Re,
60230
60230
  {
package/dist/index.umd.js CHANGED
@@ -400,4 +400,4 @@ img.ProseMirror-separator {
400
400
  3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function ete(){Kt.scanner=Uee(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=Gee(Kt.scanner.tokens);for(let t=0;t<Kt.pluginQueue.length;t++)Kt.pluginQueue[t][1]({scanner:Kt.scanner,parser:Kt.parser});return Kt.initialized=!0,Kt}function m1(t){return Kt.initialized||ete(),Jee(Kt.parser.start,t,ID(Kt.scanner.start,t))}m1.scan=ID;function BD(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 h1(n),o=m1(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}function tte(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function nte(t){return new en({key:new bn("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=bK(n.doc,[...e]);if(_K(a).forEach(({newRange:u})=>{const f=xK(r.doc,u,y=>y.isTextblock);let p,g;if(f.length>1?(p=f[0],g=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=f[0],g=r.doc.textBetween(p.pos,u.to,void 0," ")),p&&g){const y=g.split(" ").filter(C=>C!=="");if(y.length<=0)return!1;const m=y[y.length-1],b=p.pos+g.lastIndexOf(m);if(!m)return!1;const S=m1(m).map(C=>C.toObject(t.defaultProtocol));if(!tte(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:b+C.start+1,to:b+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{oy(C.from,C.to,r.doc).some(_=>_.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function rte(t){return new en({key:new bn("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(g=>g.nodeName==="A"))return!1;const l=ry(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 ote(t){return new en({key:new bn("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=BD(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const ite=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Ws(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(ite,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const ste=ur.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"){$D(t);return}$D(t.scheme,t.optionalSlashes)})},onDestroy(){Qee()},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)=>!!Ws(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=>!!Ws(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=>!!Ws(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",yt(this.options.HTMLAttributes,t),0]:["a",yt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ws(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=>!!Ws(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[Vi({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=BD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ws(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(nte({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ws(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(rte({type:this.type})),this.options.linkOnPaste&&t.push(ote({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),RD=tn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",yt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function ate(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=YK(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",g=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${g}]*`,"gm"),m=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!m)return null;const b=a.pos-m.length,S=Array.from(m.matchAll(y)).pop();if(!S||S.input===void 0||S.index===void 0)return null;const C=S.input.slice(Math.max(0,S.index-1),S.index),_=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!_)return null;const T=b+S.index;let w=T+S[0].length;return l&&f.test(m.slice(w-1,w+1))&&(S[0]+=" ",w+=1),T<a.pos&&w>=a.pos?{range:{from:T,to:w},query:S[0].slice(n.length),text:S[0]}:null}const lte=new bn("suggestion");function cte({pluginKey:t=lte,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:f=()=>[],render:p=()=>({}),allow:g=()=>!0,findSuggestionMatch:y=ate}){let m;const b=p==null?void 0:p(),S=new en({key:t,view(){return{update:async(C,_)=>{var T,w,E,O,$,N,L;const M=(T=this.key)===null||T===void 0?void 0:T.getState(_),A=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),z=M.active&&A.active&&M.range.from!==A.range.from,B=!M.active&&A.active,R=M.active&&!A.active,V=!B&&!R&&M.query!==A.query,F=B||z&&V,q=V||z,U=R||z&&V;if(!F&&!q&&!U)return;const G=U&&!F?M:A,K=C.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);m={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:Z=>u({editor:e,range:G.range,props:Z}),decorationNode:K,clientRect:K?()=>{var Z;const{decorationId:ie}=(Z=this.key)===null||Z===void 0?void 0:Z.getState(e.state),ce=C.dom.querySelector(`[data-decoration-id="${ie}"]`);return(ce==null?void 0:ce.getBoundingClientRect())||null}:null},F&&((E=b==null?void 0:b.onBeforeStart)===null||E===void 0||E.call(b,m)),q&&((O=b==null?void 0:b.onBeforeUpdate)===null||O===void 0||O.call(b,m)),(q||F)&&(m.items=await f({editor:e,query:G.query})),U&&(($=b==null?void 0:b.onExit)===null||$===void 0||$.call(b,m)),q&&((N=b==null?void 0:b.onUpdate)===null||N===void 0||N.call(b,m)),F&&((L=b==null?void 0:b.onStart)===null||L===void 0||L.call(b,m))},destroy:()=>{var C;m&&((C=b==null?void 0:b.onExit)===null||C===void 0||C.call(b,m))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,T,w){const{isEditable:E}=e,{composing:O}=e.view,{selection:$}=C,{empty:N,from:L}=$,M={..._};if(M.composing=O,E&&(N||e.view.composing)){(L<_.range.from||L>_.range.to)&&!O&&!_.composing&&(M.active=!1);const A=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:$.$from}),z=`id_${Math.floor(Math.random()*4294967295)}`;A&&g({editor:e,state:w,range:A.range,isActive:_.active})?(M.active=!0,M.decorationId=_.decorationId?_.decorationId:z,M.range=A.range,M.query=A.query,M.text=A.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,_){var T;const{active:w,range:E}=S.getState(C.state);return w&&((T=b==null?void 0:b.onKeyDown)===null||T===void 0?void 0:T.call(b,{view:C,event:_,range:E}))||!1},decorations(C){const{active:_,range:T,decorationId:w}=S.getState(C);return _?Zt.create(C.doc,[Ln.inline(T.from,T.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const ute=new bn("mention"),dte=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",yt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:ute,command:({editor:t,range:e,props:n})=>{var r,o,i;const s=t.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(o=t.view.dom.ownerDocument.defaultView)===null||o===void 0?void 0:o.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},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}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=yt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[cte({editor:this.editor,...this.options.suggestion})]}}),fte="listItem",zD="textStyle",VD=/^(\d+)\.\s$/,HD=tn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",yt(this.options.HTMLAttributes,n),0]:["ol",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(fte,this.editor.getAttributes(zD)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Wa({find:VD,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wa({find:VD,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(zD)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),jD=tn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),WD=sn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new bn("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&&xf(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Ln.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}),Zt.create(t,o)}}})]}}),pte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,hte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qD=ur.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ls({find:pte,type:this.type})]},addPasteRules(){return[Vi({find:hte,type:this.type})]}}),gte=ur.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",yt(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()}}}),mte=ur.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),yte=tn.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",yt(this.options.HTMLAttributes,t),0]}}),bte=tn.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",yt(this.options.HTMLAttributes,t),0]}}),vte=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}}),xte=/^\s*(\[([( |x])?\])\s$/,Ste=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},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",yt(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");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const g=n();if(typeof g!="number")return!1;const y=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...y==null?void 0:y.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[Wa({find:xte,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Cte=tn.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",yt(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()}}}),UD=tn.create({name:"text",group:"inline"}),wte=sn.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)}},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")}}}),_te=ur.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),KD=J.forwardRef((t,e)=>{const[n,r]=J.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 J.useEffect(()=>r(0),[t.items]),J.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?v.jsx(P.Paper,{elevation:5,children:v.jsx(P.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(P.ListItem,{disablePadding:!0,children:v.jsx(P.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});KD.displayName="SuggestionList";const YD={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Tte={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 eI(KD,{props:n,editor:n.editor}),e=Hc("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??YD},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))??YD}})},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}}}},kte=ste.extend({inclusive:!1}),Ete=gte.extend({excludes:"superscript"}),Mte=mte.extend({excludes:"subscript"});function Ote({placeholder:t}={}){return J.useMemo(()=>[ZQ.configure({resizable:!0}),vte,bte,yte,aD,cD,uD,pD,RD,HD,jD,Ete,Mte,UD,oD,rD,lD,CD,_te,qD,kte.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),KG,fD,jX,wte.configure({types:["heading","paragraph","image"]}),uee,dee,hee,VX,_ee.configure({multicolor:!0}),SD,JX,dD,Cte,Ste.configure({nested:!0}),dte.configure({suggestion:Tte}),WD.configure({placeholder:t}),xD],[t])}function GD(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Ate=t=>{const e=Ote({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(vZ,{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]=jt.useField({name:n}),{setValue:f}=u,{value:p}=a;J.useEffect(()=>{var C,_,T;(T=(_=(C=g==null?void 0:g.current)==null?void 0:C.editor)==null?void 0:_.commands)==null||T.setContent(p)},[p]);const g=J.useRef(null),y=J.useCallback((C,_)=>{var w;const T=(w=g.current)==null?void 0:w.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(E=>{Nv({images:E,editor:T,position:_})});else{const E=i(C);Nv({images:E,editor:T,position:_})}},[]),m=J.useCallback((C,_,T,w)=>{var O;if(!(_ instanceof DragEvent)||!_.dataTransfer)return!1;const E=GD(_.dataTransfer.files);if(E.length>0){const $=(O=C.posAtCoords({left:_.clientX,top:_.clientY}))==null?void 0:O.pos;return y(E,$),_.preventDefault(),!0}return!1},[y]),b=J.useCallback((C,_,T)=>{if(!_.clipboardData)return!1;const w=GD(_.clipboardData.files);return w.length>0?(y(w),!0):!1},[y]),S=v.jsx(P.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(sI,{ref:g,extensions:e,content:p,editable:!s,editorProps:{handleDrop:m,handlePaste:b},renderControls:s?void 0:()=>v.jsx(XQ,{onUploadFiles:i}),onBlur:()=>{var C,_;return f(((_=(C=g.current)==null?void 0:C.editor)==null?void 0:_.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(w2,{}),v.jsx(aI,{})]})})});return v.jsxs(P.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(P.Typography,{...o,children:r}),S]})},y1=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(P.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(P.Box,{className:"text-content",children:[v.jsx(P.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(P.Typography,{"data-testid":"message",children:n})]}),v.jsx(P.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},JD=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);return J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]),i?v.jsx(P.Box,{children:v.jsx(P.Collapse,{in:n,children:u})}):v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(P.Collapse,{in:n,children:u})})})},ZD=t=>{const{id:e,getRowKey:n=W=>"id"in W&&(typeof W.id=="string"||typeof W.id=="number")?W.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(W)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(W)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:g=!1,className:y,emptyTableMsg:m="No items to display",errorTableMsg:b,retryCallback:S,isLoading:C=!1,disableMobileCards:_=!1,highlightSelectedRow:T=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,...$}=t,{palette:N}=P.useTheme(),[L,M]=J.useState(void 0),[A,z]=J.useState(void 0);Array.isArray(g)&&g.length!==r.length&&console.error('Table component: Length of "fixedLayout" is not equal to the length of "columns".');const B=W=>{W!==l?f&&f(W,"asc"):f&&f(l,u==="asc"?"desc":"asc")},R=W=>l===W?u:null,V=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),F=V&&a?r.filter(W=>!(a.includes(W.fieldName)||W.hideCol)):r.filter(W=>!W.hideCol),q=(W,X)=>X.split(".").reduce((de,ee)=>{if(de&&typeof de=="object")return de[ee]},W),U=(W,X)=>{const de=q(X,W.fieldName);return W.render?W.render(de,X,V):de},G=f!==void 0,K=W=>G?p?p.includes(W):!0:!1,Z=v.jsxs(P.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(IR,{})," ",m]}),ie=v.jsxs(P.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(uC,{color:"error"})," ",b,S&&v.jsx(P.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ce=()=>{if(C)return v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{colSpan:r.length,align:"center",children:v.jsx(P.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(y1,{})})})});if(b)return v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{colSpan:r.length,align:"center",children:ie})});if(o.length===0)return v.jsx(P.TableRow,{children:v.jsx(P.TableCell,{colSpan:r.length,align:"center",children:Z})})},fe=()=>{if(C)return v.jsx(y1,{});if(b)return ie;if(o.length===0)return Z},te=W=>{T&&z(W)},he=W=>{if(i&&(i(W),te(W)),s){const X=L===W?void 0:W;M(X),te(X)}},ue=typeof T=="string"?T:N.grey[N.mode=="dark"?600:50],ae=W=>{const X=A===n(W)?ue:"inherit";return{cursor:i||s?"pointer":"default",backgroundColor:X,...i&&{"&:hover":{backgroundColor:X===ue?ia(X,.1):ue}}}};return V&&!_?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[G&&v.jsxs(v.Fragment,{children:[v.jsxs(P.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(P.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:W=>B(W.target.value),fullWidth:!0,children:F.map(W=>{if(K(W.fieldName))return v.jsx(P.MenuItem,{value:W.sortName??W.fieldName,children:W.label??_n(W.fieldName)},`${W.key??"rowHeader"}-${W.fieldName}`)})}),v.jsx(P.IconButton,{onClick:()=>{l&&B(l)},children:v.jsx(VR,{className:`sort-icon-${u}`})})]}),v.jsx(P.Divider,{sx:{margin:"10px 0"}})]}),fe()??o.map(W=>v.jsxs(P.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ae(W)},onClick:()=>he(n(W)),"data-testid":`card-${n(W)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:F.map(X=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsx("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${X.fieldName}`,style:{textWrap:"nowrap"},children:X.label??_n(X.fieldName)}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${X.fieldName}`,style:{paddingLeft:"10px"},children:U(X,W)})]},`${X.key??"row"}-${n(W)}-${X.fieldName}`))})}),s&&v.jsx(JD,{colSpan:r.length,isExpanded:n(W)===L,obj:W,renderExpand:X=>s(X),asMobileCard:!0})]},n(W)))]}):v.jsx(P.TableContainer,{component:P.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:y,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(P.Table,{stickyHeader:E!=="undefined",style:{tableLayout:g?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...$,children:[v.jsx(P.TableHead,{className:"MBv2_Table_Head",children:v.jsx(P.TableRow,{className:"MBv2_Table_Head_Row",children:F.map((W,X)=>{const de=K(W.fieldName);return v.jsx(P.TableCell,{width:Array.isArray(g)?g[X]:"auto",sx:W.tableCellSx??{},children:v.jsx(P.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(P.Box,{sx:[de&&{"&:hover":{cursor:"pointer",backgroundColor:N.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:de?()=>B(W.sortName??W.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:W.label??_n(W.fieldName)}),de&&R(W.fieldName)==="asc"&&v.jsx(RC,{style:{marginLeft:"5px"}}),de&&R(W.fieldName)==="desc"&&v.jsx(DR,{style:{marginLeft:"5px"}}),de&&R(W.fieldName)!=="asc"&&R(W.fieldName)!=="desc"&&v.jsx(BR,{style:{marginLeft:"5px"}})]})})},`${W.key??"rowHeader"}-${W.fieldName}`)})})}),v.jsx(P.TableBody,{className:"MBv2_Table_Body",children:ce()??o.map(W=>v.jsxs(J.Fragment,{children:[v.jsx(P.TableRow,{"data-testid":`row-${n(W)}`,className:"MBv2_Table_Body_Row",onClick:()=>he(n(W)),sx:ae(W),children:F.map(X=>v.jsx(P.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${X.fieldName}`,children:U(X,W)},`${X.key??"row"}-${n(W)}-${X.fieldName}`))}),s&&v.jsx(JD,{colSpan:r.length,isExpanded:n(W)===L,obj:W,renderExpand:X=>s(X),reRenderExpand:O})]},n(W)))})]})})},XD=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,g=S=>{n(S)},y=S=>{r(parseInt(S.target.value,10))},m=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),b=!t.data||t.data&&t.data.length===0;return v.jsxs(P.Box,{children:[v.jsx(ZD,{sortOrder:p,sortField:f,...s}),!o&&!b&&v.jsx(P.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:m?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>g(C),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},QD=()=>({height:window.innerHeight,width:window.innerWidth}),eP=()=>{const[t,e]=J.useState(QD());return J.useEffect(()=>{const n=()=>{e(QD())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Ur=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=eP(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(P.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...Jn({...t},a)})},Ite=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(P.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(P.Box,{component:P.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[v.jsxs(P.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",v.jsx("br",{}),v.jsx("b",{children:e.url}),"?"]}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",children:[v.jsx(Ur,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(Ur,{size:"small",startIcon:v.jsx(zC,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Dte=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(P.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(P.Box,{component:P.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(P.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",children:[v.jsx(Ur,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(Ur,{size:"small",color:"error",startIcon:v.jsx(qh,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Pte=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onSelect:f,getCitationsPaginated:p,selectedIds:g,setSelectedIds:y,onError:m=()=>{},condenseTable:b=!1,canCreate:S=!1,canEdit:C=!1,canSelect:_=!1,canLaunchUrl:T,addlActions:w}=t,{palette:E}=P.useTheme(),[O,$]=J.useState([]),[N,L]=J.useState(!1),[M,A]=J.useState(!0),[z,B]=J.useState(null),[R,V]=J.useState(null),[F,q]=J.useState(null),[U,G]=J.useState({pageNo:0,pageSize:b?5:10,totalCount:0}),K=()=>{L(!1),A(!0),p({pageNo:U.pageNo,pageSize:U.pageSize}).then(W=>($(W.data),G({...U,totalCount:W.totalCount}),W)).catch(W=>{m(W),L(!0),$([])}).finally(()=>A(!1))};J.useEffect(K,[U.pageNo,U.pageSize,e]);const Z=()=>{V(null),q(null),B(null)},ie=v.jsx(Ur,{variant:_?"outlined":"contained",size:_?"small":"medium",onClick:o,startIcon:v.jsx(Ju,{}),children:"Add Citation"}),ce=v.jsx(Ur,{variant:_?"outlined":"contained",size:_?"small":"medium",onClick:i,startIcon:v.jsx(BC,{}),children:"Add Attachment"}),fe=W=>{if(C)return v.jsx(P.Tooltip,{title:"Edit",children:v.jsx(P.IconButton,{color:"primary",onClick:()=>W.fileName?a(W):s(W),"data-testid":`citation-table_edit-btn-${W.id}`,children:v.jsx(pR,{})})})},te=W=>{if(l)return v.jsx(P.Tooltip,{title:"Delete",children:v.jsx(P.IconButton,{color:"error",onClick:X=>{V(W),B(X.currentTarget)},"data-testid":`citation-table_delete-btn-${W.id}`,children:v.jsx(qh,{})})})},he=W=>!u&&!T?void 0:W.fileName?v.jsx(P.Tooltip,{title:"Download",children:v.jsx(P.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(W),"data-testid":`citation-table_download-btn-${W.id}`,sx:{visibility:u?"visible":"hidden"},children:v.jsx(fR,{})})}):v.jsx(P.Tooltip,{title:"Open URL",children:v.jsx(P.IconButton,{color:"primary",onClick:de=>{B(de.currentTarget),q(W)},"data-testid":`citation-table_launch-link-btn-${W.id}`,sx:{visibility:T!=null&&T(W)?"visible":"hidden"},children:v.jsx(zC,{})})}),ae=[{fieldName:"id",key:"select",label:"",hideCol:!_,render:(W,X)=>v.jsx(P.Checkbox,{"data-testid":`citation-table_checkbox-${W}`,onChange:()=>{const de=g.includes(X.id);y(de?g.filter(ee=>ee!==X.id):[...g,X.id])},checked:g.includes(W)})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(W,X)=>v.jsx(P.Tooltip,{title:W?"Attachment":"URL",children:W?v.jsx(BC,{sx:{color:E.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${X.id}`}):v.jsx(Ju,{sx:{color:E.grey[500],marginTop:"6px"},"data-testid":`url-icon-${X.id}`})})},{fieldName:"title",tableCellSx:{width:b?"100%":"auto"}},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:b,render:(W,X)=>v.jsx("span",{style:{wordBreak:"break-all"},children:W||X.url})},{fieldName:"source",hideCol:b},{fieldName:"accessedAt",hideCol:b,render:(W,X)=>{if(!X.fileName)return(W==null?void 0:W.slice(0,10))??""}},{fieldName:"classification",hideCol:b},{fieldName:"id",key:"Action",label:"Action",hideCol:!(C||T||u||l||w),render:(W,X)=>v.jsxs(P.Box,{display:"flex",flexDirection:"row",children:[he(X),fe(X),te(X),w==null?void 0:w(X)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(P.Typography,{variant:b?"h6":"h2",children:n}),!_&&S&&v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:1,children:[ie,ce]})]}),v.jsx(XD,{"data-testid":"citation-table",title:n,size:b?"x-small":"medium",isLoading:M,columns:ae,data:O,paginationState:U,onPageChange:W=>G({...U,pageNo:W}),onRowsPerPageChange:W=>G({...U,pageSize:W,pageNo:0}),errorTableMsg:N?"Failed to load citations.":void 0,retryCallback:K}),_&&v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(P.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:S&&v.jsxs(v.Fragment,{children:[ie,ce]})}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(Ur,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),v.jsxs(Ur,{variant:"contained",size:"small",onClick:()=>f(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),v.jsx(Ite,{citation:F,anchorEl:z,onClose:Z}),v.jsx(Dte,{citation:R,anchorEl:z,onDeleteCitation:l,onClose:Z})]})},b1=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return v.jsx(Ur,{type:n,disabled:e,size:r,startIcon:e?v.jsx(P.CircularProgress,{size:s,color:"inherit"}):null,...o})},Nte=t=>{const{title:e,onSave:n,onCancel:r,modifyCitation:o}=t,i=J.useRef(null),[s,a]=J.useState(!1),[l,u]=J.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});J.useEffect(()=>{o&&u({...o,type:"Url"})},[]);const f=()=>{var g,y,m;const p=(y=(g=i==null?void 0:i.current)==null?void 0:g.values)==null?void 0:y.url;p&&((m=i==null?void 0:i.current)==null||m.setFieldValue("url",a2(p)))};return v.jsxs(v.Fragment,{children:[e&&v.jsx(P.Typography,{variant:"h6",margin:"10px 0",children:e}),v.jsx(jt.Formik,{innerRef:i,enableReinitialize:!0,initialValues:l,onSubmit:async p=>{a(!0),n(p).catch(g=>{throw a(!1),g}).finally(()=>a(!1))},children:v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsx(da,{name:"source",disabled:s,required:!0,margin:"none"}),v.jsx(da,{name:"title",disabled:s,required:!0,margin:"none"}),v.jsx(Fd,{name:"accessedAt",disabled:s,required:!0,margin:"none",isDatePicker:!0}),v.jsx(da,{name:"url",disabled:s,required:!0,onBlur:f,margin:"none"}),v.jsx(FC,{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"}),v.jsxs(P.DialogActions,{sx:{px:0},children:[v.jsx(P.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(b1,{size:"small",loading:s,children:o?"Update Citation":"Add New Citation"})]})]})})]})};var v1,tP;function Lte(){if(tP)return v1;tP=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,_){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=_};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);v1={Cache:t,split:p,normalizePath:f,setter:function(C){var _=f(C);return l.get(C)||l.set(C,function(w,E){for(var O=0,$=_.length,N=w;O<$-1;){var L=_[O];if(L==="__proto__"||L==="constructor"||L==="prototype")return w;N=N[_[O++]]}N[_[O]]=E})},getter:function(C,_){var T=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,$=T.length;O<$;)if(E!=null||!_)E=E[T[O++]];else return;return E})},join:function(C){return C.reduce(function(_,T){return _+(y(T)||n.test(T)?"["+T+"]":(_?".":"")+T)},"")},forEach:function(C,_,T){g(Array.isArray(C)?C:p(C),_,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(_){return _.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function g(C,_,T){var w=C.length,E,O,$,N;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),N=y(E),$=!N&&/^\d+$/.test(E),_.call(T,E,N,$,O,C))}function y(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function m(C){return C.match(r)&&!C.match(n)}function b(C){return o.test(C)}function S(C){return!y(C)&&(m(C)||b(C))}return v1}var qs=Lte(),x1,nP;function Fte(){if(nP)return x1;nP=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,g)=>`${p}${p?g[0].toUpperCase()+g.slice(1).toLowerCase():g.toLowerCase()}`,"");return x1={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(" ")},x1}var S1=Fte(),Tp={exports:{}},rP;function $te(){if(rP)return Tp.exports;rP=1,Tp.exports=function(o){return t(e(o),o)},Tp.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(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||g(o[u],u,new Set);return a;function g(y,m,b){if(b.has(y)){var S;try{S=", node was:"+JSON.stringify(y)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[m]){l[m]=!0;var C=f.get(y)||new Set;if(C=Array.from(C),m=C.length){b.add(y);do{var _=C[--m];g(_,p.get(_),b)}while(m);b.delete(y)}a[--s]=y}}}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 Tp.exports}var Bte=$te();const Rte=Zn(Bte),zte=Object.prototype.toString,Vte=Error.prototype.toString,Hte=RegExp.prototype.toString,jte=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Wte=/^Symbol\((.*)\)(.*)$/;function qte(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function oP(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return qte(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return jte.call(t).replace(Wte,"Symbol($1)");const r=zte.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Vte.call(t)+"]":r==="RegExp"?Hte.call(t):null}function Ji(t,e){let n=oP(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=oP(this[r],e);return i!==null?i:o},2)}function iP(t){return t==null?[]:[].concat(t)}let sP,aP,lP,Ute=/\$\{\s*(\w+)\s*\}/g;sP=Symbol.toStringTag;class cP{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[sP]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],iP(e).forEach(i=>{if(fr.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]}}aP=Symbol.hasInstance,lP=Symbol.toStringTag;class fr 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(Ute,(o,i)=>Ji(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 cP(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[lP]="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,fr)}static[aP](e){return cP[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Lo={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 \`${Ji(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ji(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ji(n,!0)}\``+o}},pr={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"},Kte={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"},C1={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Yte={isValue:"${path} field must be ${value}"},kp={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:Lo,string:pr,number:Kte,date:C1,object:kp,array:{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"},boolean:Yte,tuple:{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: \`${Ji(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: \`${Ji(n,!0)}\``}return fr.formatError(Lo.notType,t)}}});const w1=t=>t&&t.__isYupSchema__;class Ep{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 Ep(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(!w1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Mp={context:"$",value:"."};class Us{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]===Mp.context,this.isValue=this.key[0]===Mp.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Mp.context:this.isValue?Mp.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&qs.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}}Us.prototype.__isYupRef=!0;const Ks=t=>t==null;function tl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:g,skipAbsent:y}=t;let{parent:m,context:b,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function _(A){return Us.isRef(A)?A.getValue(n,m,b):A}function T(A={}){const z=Object.assign({value:n,originalValue:i,label:s.spec.label,path:A.path||r,spec:s.spec,disableStackTrace:A.disableStackTrace||C},p,A.params);for(const R of Object.keys(z))z[R]=_(z[R]);const B=new fr(fr.formatError(A.message||g,z),n,z.path,A.type||u,z.disableStackTrace);return B.params=z,B}const w=S?a:l;let E={path:r,parent:m,type:u,from:o.from,createError:T,resolve:_,options:o,originalValue:i,schema:s};const O=A=>{fr.isError(A)?w(A):A?l(null):w(T())},$=A=>{fr.isError(A)?w(A):a(A)};if(y&&Ks(n))return O(!0);let L;try{var M;if(L=f.call(E,n,E),typeof((M=L)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(L).then(O,$)}}catch(A){$(A);return}O(L)}return e.OPTIONS=t,e}function Gte(t,e,n,r=n){let o,i,s;return e?(qs.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",g=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&&g>=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[g],t=p?t.spec.types[g]: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 Op extends Set{describe(){const e=[];for(const n of this.values())e.push(Us.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 Op(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function nl(t,e=new Map){if(w1(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]=nl(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,nl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(nl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=nl(o,e)}else throw Error(`Unable to clone ${t}`);return n}class Fo{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 Op,this._blacklist=new Op,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Lo.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=nl(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({value:e},n)),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ks(i))return i;let s=Ji(e),a=Ji(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
401
401
 
402
402
  attempted value: ${s}
403
- `+(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),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=b=>{o||(o=!0,n(b,s))},p=b=>{o||(o=!0,r(b,s))},g=i.length,y=[];if(!g)return p([]);let m={value:s,originalValue:a,path:l,options:u,schema:this};for(let b=0;b<i.length;b++){const S=i[b];S(m,f,function(_){_&&(Array.isArray(_)?y.push(..._):y.push(_)),--g<=0&&p(y)})}}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,g,y)=>this.resolve(f)._validate(u,f,g,y)}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)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(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 fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):nl(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=tl({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=tl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Lo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Lo.notNull){return this.nullability(!1,e)}required(e=Lo.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=Lo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=tl(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=iP(e).map(i=>new Us(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Ep(o,n):Ep.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=tl({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=Lo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=tl({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=Lo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=tl({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.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}Fo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])Fo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Gte(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])Fo.prototype[t]=Fo.prototype.oneOf;for(const t of["not","nope"])Fo.prototype[t]=Fo.prototype.notOneOf;const Jte=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Zte(t){const e=_1(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 _1(t){var e,n;const r=Jte.exec(t);return r?{year:ii(r[1]),month:ii(r[2],1)-1,day:ii(r[3],1),hour:ii(r[4]),minute:ii(r[5]),second:ii(r[6]),millisecond:r[7]?ii(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:ii(r[10]),minuteOffset:ii(r[11])}:null}function ii(t,e=0){return Number(t)||e}let Xte=/^[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])?)*$/,Qte=/^((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,ene=/^(?:[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,tne="^\\d{4}-\\d{2}-\\d{2}",nne="\\d{2}:\\d{2}:\\d{2}",rne="(([+-]\\d{2}(:?\\d{2})?)|Z)",one=new RegExp(`${tne}T${nne}(\\.\\d+)?${rne}$`),ine=t=>Ks(t)||t===t.trim(),sne={}.toString();function T1(){return new uP}class uP extends Fo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===sne?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Lo.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=pr.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=pr.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=pr.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||pr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=pr.email){return this.matches(Xte,{name:"email",message:e,excludeEmptyString:!0})}url(e=pr.url){return this.matches(Qte,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=pr.uuid){return this.matches(ene,{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(one,{name:"datetime",message:n||pr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||pr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=_1(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||pr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=_1(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=pr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:ine})}lowercase(e=pr.lowercase){return this.transform(n=>Ks(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ks(n)||n===n.toLowerCase()})}uppercase(e=pr.uppercase){return this.transform(n=>Ks(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ks(n)||n===n.toUpperCase()})}}T1.prototype=uP.prototype;let ane=new Date(""),lne=t=>Object.prototype.toString.call(t)==="[object Date]";class Ap extends Fo{constructor(){super({type:"date",check(e){return lne(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Zte(e),isNaN(e)?Ap.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Us.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=C1.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=C1.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)}})}}Ap.INVALID_DATE=ane,Ap.prototype;function cne(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=qs.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),Us.isRef(a)&&a.isSibling?i(a.path,s):w1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Rte.array(Array.from(r),n).reverse()}function dP(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 fP(t){return(e,n)=>dP(t,e)-dP(t,n)}const une=(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 Ip(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Ip(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Ip(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Ip)}):"optional"in t?t.optional():t}const dne=(t,e)=>{const n=[...qs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=qs.getter(qs.join(n),!0)(t);return!!(o&&r in o)};let pP=t=>Object.prototype.toString.call(t)==="[object Object]";function hP(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const fne=fP([]);function gP(t){return new mP(t)}class mP extends Fo{constructor(e){super({type:"object",check(n){return pP(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=fne,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 g=i[p],y=p in o;if(g){let m,b=o[p];u.path=(n.path?`${n.path}.`:"")+p,g=g.resolve({value:b,context:n.context,parent:l});let S=g instanceof Fo?g.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}m=!n.__validating||!C?g.cast(o[p],u):o[p],m!==void 0&&(l[p]=m)}else y&&!s&&(l[p]=o[p]);(y!==p in l||l[p]!==o[p])&&(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||!pP(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let g=this.fields[p];!g||Us.isRef(g)||f.push(g.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=cne(e,n),r._sortErrors=fP(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 Ip(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=qs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return dne(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(une)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||kp.exact,test(n){if(n==null)return!0;const r=hP(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=kp.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=hP(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=kp.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(S1.camelCase)}snakeCase(){return this.transformKeys(S1.snakeCase)}constantCase(){return this.transformKeys(e=>S1.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}}gP.prototype=mP.prototype;const pne=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i}=t,s=J.useRef(null),[a,l]=J.useState(!1),[u,f]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{i&&f({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[e&&v.jsx(P.Typography,{variant:"h6",margin:"10px 0",children:e}),v.jsx(jt.Formik,{innerRef:s,enableReinitialize:!0,initialValues:u,validationSchema:gP().shape({title:T1().required("Title is required"),fileName:T1().required("A file is required")}),onSubmit:async p=>{l(!0),n(p).catch(g=>{throw l(!1),g}).finally(()=>l(!1))},children:({values:p,setFieldValue:g})=>{var y;return J.useEffect(()=>{var m,b;(m=p.file)!=null&&m.name&&g("fileName",(b=p.file)==null?void 0:b.name)},[(y=p.file)==null?void 0:y.name]),v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsx(da,{name:"title",disabled:a,required:!0,margin:"none"}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(gC,{name:"file",readOnly:o}),p.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:p.fileName}),v.jsx(sr,{name:"fileName",id:"fileName-err"})]}),v.jsxs(P.DialogActions,{sx:{px:0},children:[v.jsx(P.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(b1,{size:"small",loading:a,children:i?"Update Attachment":"Add New Attachment"})]})]})}})]})},ou=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",g=a==="top"||a==="top-and-bottom",y=()=>{if(s&&p)return v.jsx(P.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},m=()=>{if(i)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(P.Box,{children:y()}),v.jsxs(P.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(P.Box,{children:y()})})};return v.jsxs(P.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(P.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,g&&v.jsx(P.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(cR,{})})]})}):r,o&&(typeof o=="string"?v.jsx(P.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(P.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),m()]})};function hne(t){return Ke("MuiAlert",t)}const yP=qe("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),gne=ze(v.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"),mne=ze(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),yne=ze(v.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"),bne=ze(v.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"),vne=ze(v.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"),xne=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ae(n||r)}`,`${e}${Ae(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ue(i,hne,o)},Sne=be(ya,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ae(n.color||n.severity)}`]]}})(Dt(({theme:t})=>{const e=t.palette.mode==="light"?ia:Ol,n=t.palette.mode==="light"?Ol:ia;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["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),[`& .${yP.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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}`,[`& .${yP.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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)}}}))]}})),Cne=be("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),wne=be("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),_ne=be("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),bP={success:v.jsx(gne,{fontSize:"inherit"}),warning:v.jsx(mne,{fontSize:"inherit"}),error:v.jsx(yne,{fontSize:"inherit"}),info:v.jsx(bne,{fontSize:"inherit"})},vP=I.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:g=bP,onClose:y,role:m="alert",severity:b="success",slotProps:S={},slots:C={},variant:_="standard",...T}=r,w={...r,color:l,severity:b,variant:_,colorSeverity:l||b},E=xne(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[$,N]=zt("root",{ref:n,shouldForwardComponentProp:!0,className:Le(E.root,s),elementType:Sne,externalForwardedProps:{...O,...T},ownerState:w,additionalProps:{role:m,elevation:0}}),[L,M]=zt("icon",{className:E.icon,elementType:Cne,externalForwardedProps:O,ownerState:w}),[A,z]=zt("message",{className:E.message,elementType:wne,externalForwardedProps:O,ownerState:w}),[B,R]=zt("action",{className:E.action,elementType:_ne,externalForwardedProps:O,ownerState:w}),[V,F]=zt("closeButton",{elementType:Sa,externalForwardedProps:O,ownerState:w}),[q,U]=zt("closeIcon",{elementType:vne,externalForwardedProps:O,ownerState:w});return v.jsxs($,{...N,children:[p!==!1?v.jsx(L,{...M,children:p||g[b]||bP[b]}):null,v.jsx(A,{...z,children:i}),o!=null?v.jsx(B,{...R,children:o}):null,o==null&&y?v.jsx(B,{...R,children:v.jsx(V,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...F,children:v.jsx(q,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(vP.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 iu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=P.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,g=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(vP,{severity:r,variant:f,sx:p,slotProps:g,...u,...a,children:[s&&v.jsx(P.Typography,{variant:"h3",children:s}),n]})},xP=t=>v.jsx(iu,{severity:"error",...t}),SP=t=>v.jsx(iu,{severity:"success",...t}),Tne=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(xP,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(SP,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function CP({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:s,onCancel:a,initialSelectedIds:l=[],onContentChange:u,onError:f=()=>{},renderAsSelectablePopup:p=!1,addlActions:g,canLaunchUrl:y}){const[m,b]=J.useState("Insert Citation/Attachment(s)"),[S,C]=J.useState(l),[_,T]=J.useState(void 0),[w,E]=J.useState(void 0),O=ie=>{E(void 0),b(ie)},[$,N]=J.useState(0);J.useEffect(()=>{u==null||u()},[m,w,u]);const L=(ie=!1)=>{(!p||ie)&&N(ce=>ce+1)},M=(ie,ce)=>{var ue;const fe=typeof((ue=ce.response)==null?void 0:ue.data)=="string"&&ce.response.data,te=typeof ce.message=="string"&&ce.message;E({type:"Error",title:ie,message:fe??te}),f(ce)},A=ie=>E({type:"Success",title:"",message:ie}),z=async ie=>{if(m==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(m==="Edit Citation"||m==="Edit Attachment"){if(ie.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ie).then(()=>{O("Insert Citation/Attachment(s)"),L()}).catch(fe=>{M("Failed to update",fe)}))}else await(e==null?void 0:e(ie).then(fe=>{C([...S,fe.id]),O("Insert Citation/Attachment(s)"),L()}).catch(fe=>{M("Failed to create",fe)}))},B=r&&(async ie=>r(ie).then(()=>{L(!0),C(S.filter(ce=>ce!==ie)),A("Successfully deleted")}).catch(ce=>M("Failed to delete",ce))),R=(ie,ce)=>{o(ie.id).then(fe=>{T(fe),O(ce)}).catch(fe=>{M("Failed to load",fe)})},V=i&&(async ie=>i(ie).catch(ce=>{M(`Failed to download ${ie.fileName}`,ce)})),F=v.jsx(Pte,{refreshKey:$,getCitationsPaginated:ie=>t(ie).then(ce=>(u==null||u(),ce)),onCancel:a,onNewCitation:()=>{T(void 0),O("Add Citation")},onNewAttachment:()=>{T(void 0),O("Add Attachment")},onEditCitation:ie=>R(ie,"Edit Citation"),onEditAttachment:ie=>R(ie,"Edit Attachment"),onDeleteCitation:B,onDownloadAttachment:V,onSelect:s,setSelectedIds:C,selectedIds:S,onError:f,condenseTable:p,canSelect:p,title:p?m:"Attachments & Citations",addlActions:g,canCreate:!!e,canEdit:!!n,canLaunchUrl:y}),q=v.jsx(Nte,{modifyCitation:_,onSave:z,onCancel:()=>O("Insert Citation/Attachment(s)"),title:m}),U=v.jsx(pne,{onSave:z,onCancel:()=>O("Insert Citation/Attachment(s)"),modifyCitation:_,disableFileUpload:m==="Edit Attachment",title:m}),G=v.jsx(Tne,{alert:w,setAlert:E}),K=m==="Add Citation"||m==="Edit Citation",Z=m==="Add Attachment"||m==="Edit Attachment";if(p){let ie=null;return!p||m==="Insert Citation/Attachment(s)"?ie=F:K?ie=q:Z&&(ie=U),v.jsxs(P.Box,{width:"500px",children:[G,v.jsx(P.Box,{paddingTop:"8px",children:ie})]})}return v.jsxs(P.Box,{width:"100%",children:[m==="Insert Citation/Attachment(s)"&&G,v.jsx(P.Box,{paddingTop:"8px",children:F}),v.jsx(ou,{open:K||Z,children:v.jsxs(P.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[G,K?q:U]})})]})}function wP({...t}){return v.jsx(CP,{renderAsSelectablePopup:!0,...t})}const kne=Ut({name:{CitationBubbleMenuTipTap:_P}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function _P({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,...a}){const{classes:l}=kne(),u=bt();if(!(u!=null&&u.isEditable))return null;if(!("citationBubbleMenuHandler"in u.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const f=u.storage.citationBubbleMenuHandler,p=f.isOpen,g=f.selectedIds,y=f.selectedNodePos,m=_=>{u&&(_.length===0?u.commands.deleteCitation(y):g.length===0?u.commands.insertCitation({ids:_}):u.commands.updateCitation({ids:_},y))},b=_=>{m(_),u.commands.closeCitationBubbleMenu()},S=()=>{m(g),u.commands.closeCitationBubbleMenu()},C=J.useCallback(()=>{requestAnimationFrame(()=>{u!=null&&u.view&&u.view.dispatch(u.view.state.tr)})},[u]);return v.jsx(Af,{editor:u,open:p,...f.bubbleMenuOptions,...a,children:v.jsx("div",{className:l.content,children:v.jsx(wP,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:b,onCancel:S,initialSelectedIds:g,onContentChange:C,canLaunchUrl:s})})})}const Ene=sn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(oD.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(rD.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(aD.configure(this.options.bulletList)),this.options.code!==!1&&t.push(lD.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(cD.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(uD.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(dD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(fD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(pD.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(OI.configure(this.options.heading)),this.options.history!==!1&&t.push(xD.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(SD.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(CD.configure(this.options.italic)),this.options.listItem!==!1&&t.push(RD.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(HD.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(jD.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(qD.configure(this.options.strike)),this.options.text!==!1&&t.push(UD.configure(this.options.text)),t}}),Mne=()=>sn.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 One(t){const e=bt(),n=J.useRef(null);return v.jsx(gt,{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:v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(sR,{fontSize:"small"}),v.jsx(P.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const TP=J.createContext(void 0),kP=()=>{const t=J.useContext(TP);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Ane=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=kP(),[u,f]=J.useState(String(s)),[p,g]=J.useState([]),y=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const m=a.filter(C=>s.includes(C.id)),b=m.map(C=>Ku.truncate(C.title,{length:y,omission:"..."})).join(", ");f(b),g(m);const S=m.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:m.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(yv,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(P.Tooltip,{title:v.jsx(P.Box,{className:"citation-tooltip",children:p.map((m,b)=>{var C;const S=[m.source,m.title,m.fileName,m.url,(C=m.accessedAt)==null?void 0:C.slice(0,10),m.classification];return v.jsxs(P.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),b<p.length-1&&v.jsx(P.Divider,{className:"citation-tooltip-divider"})]},m.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:m=>{m.preventDefault(),m.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Ine=tn.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",yt(t)]},addNodeView(){return bv(Ane)},addProseMirrorPlugins(){return[new en({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}}}}),EP=t=>v.jsx(pC,{name:t.name,label:"Not Applicable",collapseErrorWhenEmpty:!0}),Dne=t=>{const{name:e,label:n=_n(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:g,onDownloadAttachment:y,onError:m=()=>{},placeholder:b="Start typing here...",notApplicableName:S,collapseErrorWhenEmpty:C,canLaunchUrl:_}=t,T=[Ene,WD.configure({placeholder:b}),Mne(),Ine.configure({citationMaxLength:a})],[w,E,O]=jt.useField({name:e}),{setValue:$}=O,{value:N}=w,{addUpdateCitation:L,deleteCitation:M,batchUpdate:A}=kP();J.useEffect(()=>{var U;const F=(U=z==null?void 0:z.current)==null?void 0:U.editor;if(!F||!N)return;F.getHTML()!==N&&setTimeout(()=>{F.commands.setContent(N)},0)},[N]);const z=J.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},R=()=>{var U,G;const F=((G=(U=z.current)==null?void 0:U.editor)==null?void 0:G.getHTML())??"<p></p>",q=!F.replace(/<\/?p>|<br>/g,"").trim();$(q?"<p></p>":F)},V=v.jsxs(P.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...B[s],children:[v.jsx(sI,{ref:z,extensions:T,content:N,editable:!i,renderControls:i?void 0:()=>v.jsx(Nf,{children:v.jsx(One,{})}),onBlur:R,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(_P,{getCitationsPaginated:F=>l(F).then(q=>(A(q.data),q)),onCreateCitation:u&&(F=>u(F).then(q=>(L(q),q))),onUpdateCitation:f&&(F=>f(F).then(q=>(L(q),q))),onDeleteCitation:p&&(F=>p(F).then(()=>M(F))),getCitationById:g,onDownloadAttachment:y,onError:m,canLaunchUrl:_})}),v.jsx(sr,{name:e,id:`${e}-err`,collapseWhenEmpty:C})]});return v.jsxs(P.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(P.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(EP,{name:S})]}),V]})},Pne=t=>{const{name:e="submit"}=t;return v.jsx(Ur,{name:e,type:"submit",...t})},Nne=t=>{const{label:e="Return to Top",icon:n=RC,scrollThresholdPx:r=100}=t,o=P.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(P.Zoom,{in:o,children:v.jsx(P.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(P.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Lne=()=>{const{values:t,errors:e,status:n}=jt.useFormikContext(),{palette:r}=P.useTheme();return v.jsx(P.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(P.List,{children:[v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(P.Divider,{variant:"inset",component:"li"}),v.jsxs(P.ListItem,{id:"testing",children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Fne=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=eP();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,...Jn({...t},l)};return v.jsx(P.Stepper,{...u,children:e.map(f=>v.jsx(P.Step,{children:v.jsx(P.StepLabel,{children:f})},f))})},$ne=t=>{const{name:e,label:n=_n(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(RR,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:g=!1,emptyListMsg:y="None",showDivider:m=!1,removePosition:b="bottom"}=t,[S]=jt.useField({name:e}),{value:C}=S,_=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(P.FormControl,{fullWidth:!0,children:[v.jsx(P.Typography,{...r,children:n}),g&&S.value.length===0?v.jsx(P.Typography,{children:y}):v.jsx(jt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(J.Fragment,{children:v.jsx(Bne,{variant:l,content:v.jsxs(P.Box,{"data-testid":"form-group-container",sx:typeof b=="string"?_(b):{...b},children:[v.jsxs(P.Box,{width:"100%",children:[i(`${e}.${E}`,E),m&&E!==C.length-1&&v.jsx(P.Divider,{"data-testid":"divider"})]}),!g&&C.length>(p?0:1)&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(E),children:a})]})})},`${e}-${E}`)),!g&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Bne=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"elevatedCard":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"none":return e}},Rne=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(ou,{actions:[v.jsx(P.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},zne=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(ou,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Vne=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 v.jsx(ou,{actions:[v.jsx(P.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(P.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Hne=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=P.useTheme(),a=to.useNavigate();return v.jsxs(P.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(P.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(P.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=>v.jsx(P.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...vl(l,a),children:l.label},l.label))}),n&&v.jsx(P.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},MP=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=to.useLocation(),i=to.useNavigate(),[s,a]=J.useState(!1),l=(g,y)=>v.jsx(P.MenuList,{children:g.map(m=>v.jsxs(P.MenuItem,{...vl(m,i,()=>a(!1)),children:[m.icon&&v.jsx(P.ListItemIcon,{children:m.icon}),v.jsx(P.ListItemText,{primary:m.label})]},`mobile-drawer-group-${y}-item-${m.path}`))}),f=(()=>{if(e){const g=e.filter(y=>y&&y.length>0);return g.length===0?null:g.map((y,m)=>v.jsxs(J.Fragment,{children:[l(y,m),m<g.length-1&&v.jsx(P.Divider,{})]},`mobile-drawer-group-${m}`))}return r?v.jsx(P.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(P.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(NR,{})}),v.jsx(P.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(P.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(P.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},OP=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(P.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(P.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},AP=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=to.useNavigate(),[i,s]=I.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(P.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(P.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(P.MenuItem,{...vl(f,o),children:[f.icon&&v.jsx(P.ListItemIcon,{children:f.icon}),v.jsx(P.ListItemText,{primary:f.label})]},f.label))})]})},IP=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(AP,{label:e,menuOptions:n,icon:v.jsx(FR,{})})},Dp=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}=P.useTheme(),a=to.useNavigate();return v.jsx(P.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(P.Tab,{icon:l.icon,label:l.label,value:u,...vl(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))})},DP=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(P.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Dp,{menuOptions:e,activeTabIdx:n,sx:r})})},PP=t=>{const{onToggle:e}=t,{palette:n}=P.useTheme(),r=n.mode==="dark";return v.jsx(P.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(VC,{}):v.jsx($C,{})})},jne=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:g,navBarSx:y}=t,m=to.useNavigate(),b=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),{palette:S}=P.useTheme(),{pathname:C}=to.useLocation(),_=S.mode==="dark",[T,w]=I.useState(void 0);I.useEffect(()=>{const $=o.findIndex(N=>N.path&&C.startsWith(N.path));w($>=0?$:void 0)},[C,o]);const E=s&&v.jsx(PP,{onToggle:s}),O=s&&(b||!b&&l)?[{icon:_?v.jsx(VC,{}):v.jsx($C,{}),label:`Switch to ${_?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(P.AppBar,{ref:n,position:f,sx:g,elevation:4,children:[e&&v.jsx(OP,{...e}),u,v.jsxs(P.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(P.Button,{disableRipple:!0,component:to.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!b&&E,b&&v.jsx(MP,{menuOptionLists:[o,a,O],anchor:"right"}),!b&&v.jsxs(v.Fragment,{children:[v.jsx(P.Box,{display:"flex",gap:0,children:a==null?void 0:a.map(($,N)=>v.jsxs(P.Box,{display:"flex",alignItems:"center",children:[N>0&&v.jsx(P.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(P.Button,{variant:"text",sx:{color:"white"},...vl($,m),children:v.jsxs(P.Box,{display:"flex",gap:"3px",alignItems:"center",children:[$.icon,$.label]})})]},$.label))}),p,l&&v.jsx(IP,{displayName:l,userMenuOptions:O})]})]})]}),!b&&v.jsx(DP,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Wne=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=to.useLocation(),o=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.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&&v.jsx(P.Box,{sx:e,children:v.jsx(P.Card,{sx:{height:"100%",width:200},children:v.jsx(Dp,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},qne=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=P.useTheme();return e.length>0&&v.jsx(Dp,{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}})},Une=t=>v.jsx(iu,{severity:"info",...t}),Kne=t=>v.jsx(iu,{severity:"warning",...t}),NP=t=>{const{crumbInfo:e}=t,n=to.useNavigate();return v.jsx(P.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(LR,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(P.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(P.Typography,{color:"primary",children:r},r))})},Yne=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Gne(r);return v.jsx(P.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(iu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:LP(r),warning:LP(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(P.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Gne=t=>t=="logout"?"info":t=="timeout"?"warning":t,LP=t=>{if(t=="timeout")return v.jsx(rR,{});if(t=="logout")return v.jsx(PR,{})},Jne=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(P.Box,{sx:a,children:[i.length>0&&v.jsx(NP,{crumbInfo:i}),v.jsxs(P.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(P.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(P.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(Ur,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(oR,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(P.Box,{width:l?"100%":"50%",children:s})]})]})},Zne=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return v.jsxs(P.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(P.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(P.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(P.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Xne({...t}){return v.jsx(CP,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Qne=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const g=new Set(p.map(m=>m.id));return[...p.filter(m=>!g.has(m.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(m=>{const b=u.find(S=>S.id===m.id);return b||m}),g=new Set(f.map(m=>m.id)),y=u.filter(m=>!g.has(m.id));return[...p,...y]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const g=[...p];return g[f]=u,g}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(TP.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},ere=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 v.jsx(P.Box,{height:n})};Ie.AlertModal=zne,Ie.Autocomplete=dC,Ie.Breadcrumbs=NP,Ie.Button=Ur,Ie.Checkbox=pC,Ie.CheckboxGroup=FB,Ie.CitationField=Dne,Ie.CitationFieldProvider=Qne,Ie.CitationManager=Xne,Ie.ConfirmationModal=Rne,Ie.DarkModeToggle=PP,Ie.DateField=Fd,Ie.DateRangeField=iq,Ie.DecisionModal=Vne,Ie.Drawer=MP,Ie.DynamicAutocomplete=NB,Ie.EnvironmentBanner=OP,Ie.Error=sr,Ie.ErrorAlert=xP,Ie.FileList=BB,Ie.FileUpload=gC,Ie.FloatingNavBar=qne,Ie.Footer=Hne,Ie.FormDebugger=Lne,Ie.Header=jne,Ie.InfoAlert=Une,Ie.LoadingButton=b1,Ie.LoadingIndicator=y1,Ie.Location=QB,Ie.MenuButton=AP,Ie.Modal=ou,Ie.MultiAutocomplete=LB,Ie.NavBar=DP,Ie.NotApplicableCheckbox=EP,Ie.PageHeader=Jne,Ie.PaginatedTable=XD,Ie.ProfileMenu=IP,Ie.RadioGroup=FC,Ie.RangeSlider=eR,Ie.RepeatableFormGroup=$ne,Ie.RichTextField=Ate,Ie.ScrollToTop=Nne,Ie.SearchField=UR,Ie.Select=tR,Ie.SelectableCitationManager=wP,Ie.Sidebar=Wne,Ie.SingleActionCard=Zne,Ie.Snackbar=Yne,Ie.Spacer=ere,Ie.Stepper=Fne,Ie.Submit=Pne,Ie.SuccessAlert=SP,Ie.Switch=nR,Ie.Table=ZD,Ie.Tabs=Dp,Ie.TextField=da,Ie.WarningAlert=Kne,Ie.commonTheme=vn,Ie.darkTheme=$F,Ie.lightTheme=FF,Object.defineProperty(Ie,Symbol.toStringTag,{value:"Module"})});
403
+ `+(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),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=b=>{o||(o=!0,n(b,s))},p=b=>{o||(o=!0,r(b,s))},g=i.length,y=[];if(!g)return p([]);let m={value:s,originalValue:a,path:l,options:u,schema:this};for(let b=0;b<i.length;b++){const S=i[b];S(m,f,function(_){_&&(Array.isArray(_)?y.push(..._):y.push(_)),--g<=0&&p(y)})}}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,g,y)=>this.resolve(f)._validate(u,f,g,y)}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)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(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 fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):nl(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=tl({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=tl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Lo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Lo.notNull){return this.nullability(!1,e)}required(e=Lo.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=Lo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=tl(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=iP(e).map(i=>new Us(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Ep(o,n):Ep.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=tl({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=Lo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=tl({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=Lo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=tl({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.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}Fo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])Fo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Gte(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])Fo.prototype[t]=Fo.prototype.oneOf;for(const t of["not","nope"])Fo.prototype[t]=Fo.prototype.notOneOf;const Jte=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Zte(t){const e=_1(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 _1(t){var e,n;const r=Jte.exec(t);return r?{year:ii(r[1]),month:ii(r[2],1)-1,day:ii(r[3],1),hour:ii(r[4]),minute:ii(r[5]),second:ii(r[6]),millisecond:r[7]?ii(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:ii(r[10]),minuteOffset:ii(r[11])}:null}function ii(t,e=0){return Number(t)||e}let Xte=/^[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])?)*$/,Qte=/^((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,ene=/^(?:[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,tne="^\\d{4}-\\d{2}-\\d{2}",nne="\\d{2}:\\d{2}:\\d{2}",rne="(([+-]\\d{2}(:?\\d{2})?)|Z)",one=new RegExp(`${tne}T${nne}(\\.\\d+)?${rne}$`),ine=t=>Ks(t)||t===t.trim(),sne={}.toString();function T1(){return new uP}class uP extends Fo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===sne?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Lo.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=pr.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=pr.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=pr.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||pr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=pr.email){return this.matches(Xte,{name:"email",message:e,excludeEmptyString:!0})}url(e=pr.url){return this.matches(Qte,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=pr.uuid){return this.matches(ene,{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(one,{name:"datetime",message:n||pr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||pr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=_1(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||pr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=_1(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=pr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:ine})}lowercase(e=pr.lowercase){return this.transform(n=>Ks(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ks(n)||n===n.toLowerCase()})}uppercase(e=pr.uppercase){return this.transform(n=>Ks(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ks(n)||n===n.toUpperCase()})}}T1.prototype=uP.prototype;let ane=new Date(""),lne=t=>Object.prototype.toString.call(t)==="[object Date]";class Ap extends Fo{constructor(){super({type:"date",check(e){return lne(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Zte(e),isNaN(e)?Ap.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Us.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=C1.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=C1.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)}})}}Ap.INVALID_DATE=ane,Ap.prototype;function cne(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=qs.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),Us.isRef(a)&&a.isSibling?i(a.path,s):w1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Rte.array(Array.from(r),n).reverse()}function dP(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 fP(t){return(e,n)=>dP(t,e)-dP(t,n)}const une=(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 Ip(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Ip(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Ip(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Ip)}):"optional"in t?t.optional():t}const dne=(t,e)=>{const n=[...qs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=qs.getter(qs.join(n),!0)(t);return!!(o&&r in o)};let pP=t=>Object.prototype.toString.call(t)==="[object Object]";function hP(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const fne=fP([]);function gP(t){return new mP(t)}class mP extends Fo{constructor(e){super({type:"object",check(n){return pP(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=fne,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 g=i[p],y=p in o;if(g){let m,b=o[p];u.path=(n.path?`${n.path}.`:"")+p,g=g.resolve({value:b,context:n.context,parent:l});let S=g instanceof Fo?g.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}m=!n.__validating||!C?g.cast(o[p],u):o[p],m!==void 0&&(l[p]=m)}else y&&!s&&(l[p]=o[p]);(y!==p in l||l[p]!==o[p])&&(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||!pP(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let g=this.fields[p];!g||Us.isRef(g)||f.push(g.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=cne(e,n),r._sortErrors=fP(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 Ip(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=qs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return dne(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(une)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||kp.exact,test(n){if(n==null)return!0;const r=hP(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=kp.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=hP(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=kp.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(S1.camelCase)}snakeCase(){return this.transformKeys(S1.snakeCase)}constantCase(){return this.transformKeys(e=>S1.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}}gP.prototype=mP.prototype;const pne=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i}=t,s=J.useRef(null),[a,l]=J.useState(!1),[u,f]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{i&&f({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[e&&v.jsx(P.Typography,{variant:"h6",margin:"10px 0",children:e}),v.jsx(jt.Formik,{innerRef:s,enableReinitialize:!0,initialValues:u,validationSchema:gP().shape({title:T1().required("Title is required"),fileName:T1().required("A file is required")}),onSubmit:async p=>{l(!0),n(p).catch(g=>{throw l(!1),g}).finally(()=>l(!1))},children:({values:p,setFieldValue:g})=>{var y;return J.useEffect(()=>{var m,b;(m=p.file)!=null&&m.name&&g("fileName",(b=p.file)==null?void 0:b.name)},[(y=p.file)==null?void 0:y.name]),v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsx(da,{name:"title",disabled:a,required:!0,margin:"none"}),v.jsxs(P.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(gC,{name:"file",readOnly:o}),p.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:p.fileName}),v.jsx(sr,{name:"fileName",id:"fileName-err"})]}),v.jsxs(P.DialogActions,{sx:{px:0},children:[v.jsx(P.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(b1,{size:"small",loading:a,children:i?"Update Attachment":"Add New Attachment"})]})]})}})]})},ou=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",g=a==="top"||a==="top-and-bottom",y=()=>{if(s&&p)return v.jsx(P.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},m=()=>{if(i)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(P.Box,{children:y()}),v.jsxs(P.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(P.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(P.Box,{children:y()})})};return v.jsxs(P.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(P.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,g&&v.jsx(P.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(cR,{})})]})}):r,o&&(typeof o=="string"?v.jsx(P.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(P.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),m()]})};function hne(t){return Ke("MuiAlert",t)}const yP=qe("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),gne=ze(v.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"),mne=ze(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),yne=ze(v.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"),bne=ze(v.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"),vne=ze(v.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"),xne=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ae(n||r)}`,`${e}${Ae(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ue(i,hne,o)},Sne=be(ya,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ae(n.color||n.severity)}`]]}})(Dt(({theme:t})=>{const e=t.palette.mode==="light"?ia:Ol,n=t.palette.mode==="light"?Ol:ia;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["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),[`& .${yP.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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}`,[`& .${yP.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["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)}}}))]}})),Cne=be("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),wne=be("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),_ne=be("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),bP={success:v.jsx(gne,{fontSize:"inherit"}),warning:v.jsx(mne,{fontSize:"inherit"}),error:v.jsx(yne,{fontSize:"inherit"}),info:v.jsx(bne,{fontSize:"inherit"})},vP=I.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:g=bP,onClose:y,role:m="alert",severity:b="success",slotProps:S={},slots:C={},variant:_="standard",...T}=r,w={...r,color:l,severity:b,variant:_,colorSeverity:l||b},E=xne(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[$,N]=zt("root",{ref:n,shouldForwardComponentProp:!0,className:Le(E.root,s),elementType:Sne,externalForwardedProps:{...O,...T},ownerState:w,additionalProps:{role:m,elevation:0}}),[L,M]=zt("icon",{className:E.icon,elementType:Cne,externalForwardedProps:O,ownerState:w}),[A,z]=zt("message",{className:E.message,elementType:wne,externalForwardedProps:O,ownerState:w}),[B,R]=zt("action",{className:E.action,elementType:_ne,externalForwardedProps:O,ownerState:w}),[V,F]=zt("closeButton",{elementType:Sa,externalForwardedProps:O,ownerState:w}),[q,U]=zt("closeIcon",{elementType:vne,externalForwardedProps:O,ownerState:w});return v.jsxs($,{...N,children:[p!==!1?v.jsx(L,{...M,children:p||g[b]||bP[b]}):null,v.jsx(A,{...z,children:i}),o!=null?v.jsx(B,{...R,children:o}):null,o==null&&y?v.jsx(B,{...R,children:v.jsx(V,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...F,children:v.jsx(q,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(vP.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 iu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=P.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,g=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(vP,{severity:r,variant:f,sx:p,slotProps:g,...u,...a,children:[s&&v.jsx(P.Typography,{variant:"h3",children:s}),n]})},xP=t=>v.jsx(iu,{severity:"error",...t}),SP=t=>v.jsx(iu,{severity:"success",...t}),Tne=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(xP,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(SP,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function CP({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:s,onCancel:a,initialSelectedIds:l=[],onContentChange:u,onError:f=()=>{},renderAsSelectablePopup:p=!1,addlActions:g,canLaunchUrl:y}){const[m,b]=J.useState("Insert Citation/Attachment(s)"),[S,C]=J.useState(l),[_,T]=J.useState(void 0),[w,E]=J.useState(void 0),O=ie=>{E(void 0),b(ie)},[$,N]=J.useState(0);J.useEffect(()=>{u==null||u()},[m,w,u]);const L=(ie=!1)=>{(!p||ie)&&N(ce=>ce+1)},M=(ie,ce)=>{var ue;const fe=typeof((ue=ce.response)==null?void 0:ue.data)=="string"&&ce.response.data,te=typeof ce.message=="string"&&ce.message;E({type:"Error",title:ie,message:fe??te}),f(ce)},A=ie=>E({type:"Success",title:"",message:ie}),z=async ie=>{if(m==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(m==="Edit Citation"||m==="Edit Attachment"){if(ie.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ie).then(()=>{O("Insert Citation/Attachment(s)"),L()}).catch(fe=>{M("Failed to update",fe)}))}else await(e==null?void 0:e(ie).then(fe=>{C([...S,fe.id]),O("Insert Citation/Attachment(s)"),L()}).catch(fe=>{M("Failed to create",fe)}))},B=r&&(async ie=>r(ie).then(()=>{L(!0),C(S.filter(ce=>ce!==ie)),A("Successfully deleted")}).catch(ce=>M("Failed to delete",ce))),R=(ie,ce)=>{o(ie.id).then(fe=>{T(fe),O(ce)}).catch(fe=>{M("Failed to load",fe)})},V=i&&(async ie=>i(ie).catch(ce=>{M(`Failed to download ${ie.fileName}`,ce)})),F=v.jsx(Pte,{refreshKey:$,getCitationsPaginated:ie=>t(ie).then(ce=>(u==null||u(),ce)),onCancel:a,onNewCitation:()=>{T(void 0),O("Add Citation")},onNewAttachment:()=>{T(void 0),O("Add Attachment")},onEditCitation:ie=>R(ie,"Edit Citation"),onEditAttachment:ie=>R(ie,"Edit Attachment"),onDeleteCitation:B,onDownloadAttachment:V,onSelect:s,setSelectedIds:C,selectedIds:S,onError:f,condenseTable:p,canSelect:p,title:p?m:"Attachments & Citations",addlActions:g,canCreate:!!e,canEdit:!!n,canLaunchUrl:y}),q=v.jsx(Nte,{modifyCitation:_,onSave:z,onCancel:()=>O("Insert Citation/Attachment(s)"),title:m}),U=v.jsx(pne,{onSave:z,onCancel:()=>O("Insert Citation/Attachment(s)"),modifyCitation:_,disableFileUpload:m==="Edit Attachment",title:m}),G=v.jsx(Tne,{alert:w,setAlert:E}),K=m==="Add Citation"||m==="Edit Citation",Z=m==="Add Attachment"||m==="Edit Attachment";if(p){let ie=null;return!p||m==="Insert Citation/Attachment(s)"?ie=F:K?ie=q:Z&&(ie=U),v.jsxs(P.Box,{width:"500px",children:[G,v.jsx(P.Box,{paddingTop:"8px",children:ie})]})}return v.jsxs(P.Box,{width:"100%",children:[m==="Insert Citation/Attachment(s)"&&G,v.jsx(P.Box,{paddingTop:"8px",children:F}),v.jsx(ou,{open:K||Z,children:v.jsxs(P.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[G,K?q:U]})})]})}function wP({...t}){return v.jsx(CP,{renderAsSelectablePopup:!0,...t})}const kne=Ut({name:{CitationBubbleMenuTipTap:_P}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function _P({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,...a}){const{classes:l}=kne(),u=bt();if(!(u!=null&&u.isEditable))return null;if(!("citationBubbleMenuHandler"in u.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const f=u.storage.citationBubbleMenuHandler,p=f.isOpen,g=f.selectedIds,y=f.selectedNodePos,m=_=>{u&&(_.length===0?u.commands.deleteCitation(y):g.length===0?u.commands.insertCitation({ids:_}):u.commands.updateCitation({ids:_},y))},b=_=>{m(_),u.commands.closeCitationBubbleMenu()},S=()=>{m(g),u.commands.closeCitationBubbleMenu()},C=J.useCallback(()=>{requestAnimationFrame(()=>{u!=null&&u.view&&u.view.dispatch(u.view.state.tr)})},[u]);return v.jsx(Af,{editor:u,open:p,...f.bubbleMenuOptions,...a,children:v.jsx("div",{className:l.content,children:v.jsx(wP,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:b,onCancel:S,initialSelectedIds:g,onContentChange:C,canLaunchUrl:s})})})}const Ene=sn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(oD.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(rD.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(aD.configure(this.options.bulletList)),this.options.code!==!1&&t.push(lD.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(cD.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(uD.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(dD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(fD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(pD.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(OI.configure(this.options.heading)),this.options.history!==!1&&t.push(xD.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(SD.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(CD.configure(this.options.italic)),this.options.listItem!==!1&&t.push(RD.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(HD.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(jD.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(qD.configure(this.options.strike)),this.options.text!==!1&&t.push(UD.configure(this.options.text)),t}}),Mne=()=>sn.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 One(t){const e=bt(),n=J.useRef(null);return v.jsx(gt,{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:v.jsxs(P.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(sR,{fontSize:"small"}),v.jsx(P.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const TP=J.createContext(void 0),kP=()=>{const t=J.useContext(TP);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Ane=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=kP(),[u,f]=J.useState(String(s)),[p,g]=J.useState([]),y=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const m=a.filter(C=>s.includes(C.id)),b=m.map(C=>Ku.truncate(C.title,{length:y,omission:"..."})).join(", ");f(b),g(m);const S=m.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:m.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(yv,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(P.Tooltip,{title:v.jsx(P.Box,{className:"citation-tooltip",children:p.map((m,b)=>{var C;const S=[m.source,m.title,m.fileName,m.url,(C=m.accessedAt)==null?void 0:C.slice(0,10),m.classification];return v.jsxs(P.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),b<p.length-1&&v.jsx(P.Divider,{className:"citation-tooltip-divider"})]},m.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:m=>{m.preventDefault(),m.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Ine=tn.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",yt(t)]},addNodeView(){return bv(Ane)},addProseMirrorPlugins(){return[new en({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}}}}),EP=t=>v.jsx(pC,{name:t.name,label:"Not Applicable",collapseErrorWhenEmpty:!0}),Dne=t=>{const{name:e,label:n=_n(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:g,onDownloadAttachment:y,onError:m=()=>{},placeholder:b="Start typing here...",notApplicableName:S,collapseErrorWhenEmpty:C,canLaunchUrl:_}=t,T=[Ene,WD.configure({placeholder:b}),Mne(),Ine.configure({citationMaxLength:a})],[w,E,O]=jt.useField({name:e}),{setValue:$}=O,{value:N}=w,{addUpdateCitation:L,deleteCitation:M,batchUpdate:A}=kP();J.useEffect(()=>{var U;const F=(U=z==null?void 0:z.current)==null?void 0:U.editor;if(!F||!N)return;F.getHTML()!==N&&setTimeout(()=>{F.commands.setContent(N)},0)},[N]);const z=J.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},R=()=>{var U,G;const F=((G=(U=z.current)==null?void 0:U.editor)==null?void 0:G.getHTML())??"",q=!F.replace(/<\/?p>|<br>/g,"").trim();$(q?"":F)},V=v.jsxs(P.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...B[s],children:[v.jsx(sI,{ref:z,extensions:T,content:N,editable:!i,renderControls:i?void 0:()=>v.jsx(Nf,{children:v.jsx(One,{})}),onBlur:R,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(_P,{getCitationsPaginated:F=>l(F).then(q=>(A(q.data),q)),onCreateCitation:u&&(F=>u(F).then(q=>(L(q),q))),onUpdateCitation:f&&(F=>f(F).then(q=>(L(q),q))),onDeleteCitation:p&&(F=>p(F).then(()=>M(F))),getCitationById:g,onDownloadAttachment:y,onError:m,canLaunchUrl:_})}),v.jsx(sr,{name:e,id:`${e}-err`,collapseWhenEmpty:C})]});return v.jsxs(P.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(P.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(P.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(EP,{name:S})]}),V]})},Pne=t=>{const{name:e="submit"}=t;return v.jsx(Ur,{name:e,type:"submit",...t})},Nne=t=>{const{label:e="Return to Top",icon:n=RC,scrollThresholdPx:r=100}=t,o=P.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(P.Zoom,{in:o,children:v.jsx(P.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(P.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Lne=()=>{const{values:t,errors:e,status:n}=jt.useFormikContext(),{palette:r}=P.useTheme();return v.jsx(P.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(P.List,{children:[v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(P.Divider,{variant:"inset",component:"li"}),v.jsxs(P.ListItem,{id:"testing",children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(P.ListItem,{children:[v.jsx(P.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(P.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Fne=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=eP();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,...Jn({...t},l)};return v.jsx(P.Stepper,{...u,children:e.map(f=>v.jsx(P.Step,{children:v.jsx(P.StepLabel,{children:f})},f))})},$ne=t=>{const{name:e,label:n=_n(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(RR,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:g=!1,emptyListMsg:y="None",showDivider:m=!1,removePosition:b="bottom"}=t,[S]=jt.useField({name:e}),{value:C}=S,_=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(P.FormControl,{fullWidth:!0,children:[v.jsx(P.Typography,{...r,children:n}),g&&S.value.length===0?v.jsx(P.Typography,{children:y}):v.jsx(jt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(J.Fragment,{children:v.jsx(Bne,{variant:l,content:v.jsxs(P.Box,{"data-testid":"form-group-container",sx:typeof b=="string"?_(b):{...b},children:[v.jsxs(P.Box,{width:"100%",children:[i(`${e}.${E}`,E),m&&E!==C.length-1&&v.jsx(P.Divider,{"data-testid":"divider"})]}),!g&&C.length>(p?0:1)&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(E),children:a})]})})},`${e}-${E}`)),!g&&v.jsx(P.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Bne=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"elevatedCard":return v.jsx(P.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(P.CardContent,{children:e})});case"none":return e}},Rne=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(ou,{actions:[v.jsx(P.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},zne=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(ou,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Vne=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 v.jsx(ou,{actions:[v.jsx(P.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(P.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Hne=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=P.useTheme(),a=to.useNavigate();return v.jsxs(P.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(P.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(P.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=>v.jsx(P.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...vl(l,a),children:l.label},l.label))}),n&&v.jsx(P.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},MP=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=to.useLocation(),i=to.useNavigate(),[s,a]=J.useState(!1),l=(g,y)=>v.jsx(P.MenuList,{children:g.map(m=>v.jsxs(P.MenuItem,{...vl(m,i,()=>a(!1)),children:[m.icon&&v.jsx(P.ListItemIcon,{children:m.icon}),v.jsx(P.ListItemText,{primary:m.label})]},`mobile-drawer-group-${y}-item-${m.path}`))}),f=(()=>{if(e){const g=e.filter(y=>y&&y.length>0);return g.length===0?null:g.map((y,m)=>v.jsxs(J.Fragment,{children:[l(y,m),m<g.length-1&&v.jsx(P.Divider,{})]},`mobile-drawer-group-${m}`))}return r?v.jsx(P.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(P.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(NR,{})}),v.jsx(P.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(P.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(P.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},OP=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(P.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(P.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},AP=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=to.useNavigate(),[i,s]=I.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(P.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(P.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(P.MenuItem,{...vl(f,o),children:[f.icon&&v.jsx(P.ListItemIcon,{children:f.icon}),v.jsx(P.ListItemText,{primary:f.label})]},f.label))})]})},IP=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(AP,{label:e,menuOptions:n,icon:v.jsx(FR,{})})},Dp=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}=P.useTheme(),a=to.useNavigate();return v.jsx(P.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(P.Tab,{icon:l.icon,label:l.label,value:u,...vl(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))})},DP=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(P.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Dp,{menuOptions:e,activeTabIdx:n,sx:r})})},PP=t=>{const{onToggle:e}=t,{palette:n}=P.useTheme(),r=n.mode==="dark";return v.jsx(P.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(VC,{}):v.jsx($C,{})})},jne=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:g,navBarSx:y}=t,m=to.useNavigate(),b=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),{palette:S}=P.useTheme(),{pathname:C}=to.useLocation(),_=S.mode==="dark",[T,w]=I.useState(void 0);I.useEffect(()=>{const $=o.findIndex(N=>N.path&&C.startsWith(N.path));w($>=0?$:void 0)},[C,o]);const E=s&&v.jsx(PP,{onToggle:s}),O=s&&(b||!b&&l)?[{icon:_?v.jsx(VC,{}):v.jsx($C,{}),label:`Switch to ${_?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(P.AppBar,{ref:n,position:f,sx:g,elevation:4,children:[e&&v.jsx(OP,{...e}),u,v.jsxs(P.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(P.Button,{disableRipple:!0,component:to.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(P.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!b&&E,b&&v.jsx(MP,{menuOptionLists:[o,a,O],anchor:"right"}),!b&&v.jsxs(v.Fragment,{children:[v.jsx(P.Box,{display:"flex",gap:0,children:a==null?void 0:a.map(($,N)=>v.jsxs(P.Box,{display:"flex",alignItems:"center",children:[N>0&&v.jsx(P.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(P.Button,{variant:"text",sx:{color:"white"},...vl($,m),children:v.jsxs(P.Box,{display:"flex",gap:"3px",alignItems:"center",children:[$.icon,$.label]})})]},$.label))}),p,l&&v.jsx(IP,{displayName:l,userMenuOptions:O})]})]})]}),!b&&v.jsx(DP,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Wne=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=to.useLocation(),o=P.useMediaQuery(P.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.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&&v.jsx(P.Box,{sx:e,children:v.jsx(P.Card,{sx:{height:"100%",width:200},children:v.jsx(Dp,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},qne=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=P.useTheme();return e.length>0&&v.jsx(Dp,{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}})},Une=t=>v.jsx(iu,{severity:"info",...t}),Kne=t=>v.jsx(iu,{severity:"warning",...t}),NP=t=>{const{crumbInfo:e}=t,n=to.useNavigate();return v.jsx(P.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(LR,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(P.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(P.Typography,{color:"primary",children:r},r))})},Yne=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Gne(r);return v.jsx(P.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(iu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:LP(r),warning:LP(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(P.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Gne=t=>t=="logout"?"info":t=="timeout"?"warning":t,LP=t=>{if(t=="timeout")return v.jsx(rR,{});if(t=="logout")return v.jsx(PR,{})},Jne=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(P.Box,{sx:a,children:[i.length>0&&v.jsx(NP,{crumbInfo:i}),v.jsxs(P.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(P.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(P.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(Ur,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(oR,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(P.Box,{width:l?"100%":"50%",children:s})]})]})},Zne=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=P.useMediaQuery(P.useTheme().breakpoints.down("sm"));return v.jsxs(P.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(P.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(P.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(P.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Xne({...t}){return v.jsx(CP,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Qne=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const g=new Set(p.map(m=>m.id));return[...p.filter(m=>!g.has(m.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(m=>{const b=u.find(S=>S.id===m.id);return b||m}),g=new Set(f.map(m=>m.id)),y=u.filter(m=>!g.has(m.id));return[...p,...y]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const g=[...p];return g[f]=u,g}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(TP.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},ere=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 v.jsx(P.Box,{height:n})};Ie.AlertModal=zne,Ie.Autocomplete=dC,Ie.Breadcrumbs=NP,Ie.Button=Ur,Ie.Checkbox=pC,Ie.CheckboxGroup=FB,Ie.CitationField=Dne,Ie.CitationFieldProvider=Qne,Ie.CitationManager=Xne,Ie.ConfirmationModal=Rne,Ie.DarkModeToggle=PP,Ie.DateField=Fd,Ie.DateRangeField=iq,Ie.DecisionModal=Vne,Ie.Drawer=MP,Ie.DynamicAutocomplete=NB,Ie.EnvironmentBanner=OP,Ie.Error=sr,Ie.ErrorAlert=xP,Ie.FileList=BB,Ie.FileUpload=gC,Ie.FloatingNavBar=qne,Ie.Footer=Hne,Ie.FormDebugger=Lne,Ie.Header=jne,Ie.InfoAlert=Une,Ie.LoadingButton=b1,Ie.LoadingIndicator=y1,Ie.Location=QB,Ie.MenuButton=AP,Ie.Modal=ou,Ie.MultiAutocomplete=LB,Ie.NavBar=DP,Ie.NotApplicableCheckbox=EP,Ie.PageHeader=Jne,Ie.PaginatedTable=XD,Ie.ProfileMenu=IP,Ie.RadioGroup=FC,Ie.RangeSlider=eR,Ie.RepeatableFormGroup=$ne,Ie.RichTextField=Ate,Ie.ScrollToTop=Nne,Ie.SearchField=UR,Ie.Select=tR,Ie.SelectableCitationManager=wP,Ie.Sidebar=Wne,Ie.SingleActionCard=Zne,Ie.Snackbar=Yne,Ie.Spacer=ere,Ie.Stepper=Fne,Ie.Submit=Pne,Ie.SuccessAlert=SP,Ie.Switch=nR,Ie.Table=ZD,Ie.Tabs=Dp,Ie.TextField=da,Ie.WarningAlert=Kne,Ie.commonTheme=vn,Ie.darkTheme=$F,Ie.lightTheme=FF,Object.defineProperty(Ie,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simoncomputing/mui-bueno-v2",
3
3
  "private": false,
4
- "version": "0.18.15",
4
+ "version": "0.18.16",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",