@simoncomputing/mui-bueno-v2 0.19.5 → 0.19.7
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,26 @@ 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.19.7] - 2025-10-29
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- `MenuButton`
|
|
19
|
+
- `label` prop type changed from `ReactNode` to `string` and is now optional. Use `icon` for icon-only button.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `MenuButton`
|
|
24
|
+
- icon-only menu button was taller than regular `Button` components, so adjusted to better match the height
|
|
25
|
+
|
|
26
|
+
## [0.19.6] - 2025-10-28
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- `MenuButton`
|
|
31
|
+
- `label` prop type changed from `string` to `ReactNode`
|
|
32
|
+
- added storybook section, under `Buttons/MenuButton`
|
|
33
|
+
|
|
14
34
|
## [0.19.5] - 2025-10-27
|
|
15
35
|
|
|
16
36
|
### Added
|
package/dist/index.cjs.js
CHANGED
|
@@ -399,4 +399,4 @@ img.ProseMirror-separator {
|
|
|
399
399
|
3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function qde(){Wt.scanner=Lde(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Bde(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 $1(t){return Wt.initialized||qde(),zde(Wt.parser.start,t,ZN(Wt.scanner.start,t))}$1.scan=ZN;function QN(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 F1(n),o=$1(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 Ude(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Kde(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=Zre(n.doc,[...e]);if(roe(a).forEach(({newRange:u})=>{const f=Qre(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 b=y[y.length-1],g=p.pos+m.lastIndexOf(b);if(!b)return!1;const S=$1(b).map(C=>C.toObject(t.defaultProtocol));if(!Ude(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:g+C.start+1,to:g+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=>{r1(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 Yde(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=n1(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 Gde(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=QN(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 Jde=/[\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(Jde,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Zde=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"){r2(t);return}r2(t.scheme,t.optionalSlashes)})},onDestroy(){Wde()},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=QN(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(Kde({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(Yde({type:this.type})),this.options.linkOnPaste&&t.push(Gde({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),ej=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 Xde(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Loe(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"),b=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!b)return null;const g=a.pos-b.length,S=Array.from(b.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=g+S.index;let w=T+S[0].length;return l&&f.test(b.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 Qde=new yn("suggestion");function efe({pluginKey:t=Qde,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=Xde}){let b;const g=p==null?void 0:p(),S=new tn({key:t,view(){return{update:async(C,_)=>{var T,w,E,O,N,P,j;const M=(T=this.key)===null||T===void 0?void 0:T.getState(_),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,F=!M.active&&R.active,$=M.active&&!R.active,z=!F&&!$&&M.query!==R.query,L=F||B&&z,W=z||B,q=$||B&&z;if(!L&&!W&&!q)return;const G=q&&!L?M:R,U=C.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);b={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:Z=>u({editor:e,range:G.range,props:Z}),decorationNode:U,clientRect:U?()=>{var Z;const{decorationId:pe}=(Z=this.key)===null||Z===void 0?void 0:Z.getState(e.state),ae=C.dom.querySelector(`[data-decoration-id="${pe}"]`);return(ae==null?void 0:ae.getBoundingClientRect())||null}:null},L&&((E=g==null?void 0:g.onBeforeStart)===null||E===void 0||E.call(g,b)),W&&((O=g==null?void 0:g.onBeforeUpdate)===null||O===void 0||O.call(g,b)),(W||L)&&(b.items=await f({editor:e,query:G.query})),q&&((N=g==null?void 0:g.onExit)===null||N===void 0||N.call(g,b)),W&&((P=g==null?void 0:g.onUpdate)===null||P===void 0||P.call(g,b)),L&&((j=g==null?void 0:g.onStart)===null||j===void 0||j.call(g,b))},destroy:()=>{var C;b&&((C=g==null?void 0:g.onExit)===null||C===void 0||C.call(g,b))}}},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:N}=C,{empty:P,from:j}=N,M={..._};if(M.composing=O,E&&(P||e.view.composing)){(j<_.range.from||j>_.range.to)&&!O&&!_.composing&&(M.active=!1);const R=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:N.$from}),B=`id_${Math.floor(Math.random()*4294967295)}`;R&&m({editor:e,state:w,range:R.range,isActive:_.active})?(M.active=!0,M.decorationId=_.decorationId?_.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,_){var T;const{active:w,range:E}=S.getState(C.state);return w&&((T=g==null?void 0:g.onKeyDown)===null||T===void 0?void 0:T.call(g,{view:C,event:_,range:E}))||!1},decorations(C){const{active:_,range:T,decorationId:w}=S.getState(C);return _?Xt.create(C.doc,[Fn.inline(T.from,T.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const tfe=new yn("mention"),nfe=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:tfe,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[efe({editor:this.editor,...this.options.suggestion})]}}),rfe="listItem",o2="textStyle",i2=/^(\d+)\.\s$/,tj=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(rfe,this.editor.getAttributes(o2)).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:i2,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:i2,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(o2)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),nj=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()}}}),rj=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&&ch(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Fn.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)}}})]}}),ofe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,ife=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,oj=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[Ys({find:ofe,type:this.type})]},addPasteRules(){return[Ji({find:ife,type:this.type})]}}),sfe=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()}}}),afe=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()}}}),lfe=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]}}),cfe=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]}}),ufe=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]}}),dfe=/^\s*(\[([( |x])?\])\s$/,ffe=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:dfe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),pfe=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()}}}),ij=en.create({name:"text",group:"inline"}),hfe=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")}}}),mfe=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()}}}),sj=X.forwardRef((t,e)=>{const[n,r]=X.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 X.useEffect(()=>r(0),[t.items]),X.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(D.Paper,{elevation:5,children:v.jsx(D.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(D.ListItem,{disablePadding:!0,children:v.jsx(D.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});sj.displayName="SuggestionList";const s2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},gfe={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 qP(sj,{props:n,editor:n.editor}),e=bu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??s2},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))??s2}})},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}}}},yfe=Zde.extend({inclusive:!1}),bfe=sfe.extend({excludes:"superscript"}),vfe=afe.extend({excludes:"subscript"});function xfe({placeholder:t}={}){return X.useMemo(()=>[Vue.configure({resizable:!0}),ufe,cfe,lfe,AN,DN,PN,LN,ej,tj,nj,bfe,vfe,ij,RN,ON,IN,WN,mfe,oj,yfe.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),jse,jN,Dce,hfe.configure({types:["heading","paragraph","image"]}),tde,nde,ide,Ace,mde.configure({multicolor:!0}),HN,Bce,NN,pfe,ffe.configure({nested:!0}),nfe.configure({suggestion:gfe}),rj.configure({placeholder:t}),VN],[t])}function a2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Sfe=t=>{const e=xfe({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(cle,{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;X.useEffect(()=>{var C,_,T;(T=(_=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:_.commands)==null||T.setContent(p)},[p]);const m=X.useRef(null),y=X.useCallback((C,_)=>{var w;const T=(w=m.current)==null?void 0:w.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(E=>{Tv({images:E,editor:T,position:_})});else{const E=i(C);Tv({images:E,editor:T,position:_})}},[]),b=X.useCallback((C,_,T,w)=>{var O;if(!(_ instanceof DragEvent)||!_.dataTransfer)return!1;const E=a2(_.dataTransfer.files);if(E.length>0){const N=(O=C.posAtCoords({left:_.clientX,top:_.clientY}))==null?void 0:O.pos;return y(E,N),_.preventDefault(),!0}return!1},[y]),g=X.useCallback((C,_,T)=>{if(!_.clipboardData)return!1;const w=a2(_.clipboardData.files);return w.length>0?(y(w),!0):!1},[y]),S=v.jsx(D.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(ZP,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:b,handlePaste:g},renderControls:s?void 0:()=>v.jsx(Hue,{onUploadFiles:i}),onBlur:()=>{var C,_;return f(((_=(C=m.current)==null?void 0:C.editor)==null?void 0:_.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(OP,{}),v.jsx(XP,{})]})})});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(D.Typography,{...o,children:r}),S]})},$v=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(D.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(D.Box,{className:"text-content",children:[v.jsx(D.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(D.Typography,{"data-testid":"message",children:n})]}),v.jsx(D.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},l2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=X.useState(!1),[u,f]=X.useState(void 0);X.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?v.jsx(D.Collapse,{in:n,children:u}):v.jsx(D.TableRow,{sx:p,children:v.jsx(D.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(D.Collapse,{in:n,children:u})})})},aj=t=>{const{id:e,getRowKey:n=Y=>"id"in Y&&(typeof Y.id=="string"||typeof Y.id=="number")?Y.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(Y)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(Y)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:m=!1,className:y,emptyTableMsg:b="No items to display",errorTableMsg:g,retryCallback:S,isLoading:C=!1,disableMobileCards:_=!1,highlightSelectedRow:T=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,tooltipColor:N,...P}=t,{palette:j}=D.useTheme(),[M,R]=X.useState(void 0),[B,F]=X.useState(void 0);Array.isArray(m)&&(!s&&m.length!==r.length&&console.warn('Table component: Length of "fixedLayout" is not equal to the length of "columns".'),s&&m.length!==r.length+1&&console.warn(`Table component: Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),s&&i&&console.warn("Table component: renderExpand & onRowClick are both defined. Only one should be defined at a time.");const $=Y=>{Y!==l?f&&f(Y,"asc"):f&&f(l,u==="asc"?"desc":"asc")},z=Y=>l===Y?u:null,L=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),W=L&&a?r.filter(Y=>!(a.includes(Y.fieldName)||Y.hideCol)):r.filter(Y=>!Y.hideCol);s&&!L&&W.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:Y=>{const le=M===Y;return v.jsx(D.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>se(Y),children:le?v.jsx(Kd,{"data-testid":"collapse-up"}):v.jsx(sg,{"data-testid":"expand-down"})})}});const q=(Y,le)=>le.split(".").reduce((be,Ce)=>{if(be&&typeof be=="object")return be[Ce]},Y),G=(Y,le)=>{const be=q(le,Y.fieldName);return Y.render?Y.render(be,le,L):be},U=f!==void 0,Z=Y=>U?p?p.includes(Y):!0:!1,pe=v.jsxs(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(u8,{})," ",b]}),ae=v.jsxs(D.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(OR,{color:"error"})," ",g,S&&v.jsx(D.Button,{variant:"text",onClick:S,children:"Retry?"})]}),de=()=>{if(C)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:v.jsx(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx($v,{})})})});if(g)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:ae})});if(o.length===0)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:pe})})},ee=()=>{if(C)return v.jsx($v,{});if(g)return ae;if(o.length===0)return pe},he=Y=>{T&&F(Y)},fe=Y=>{i&&(i(Y),he(Y))},se=Y=>{const le=M===Y?void 0:Y;R(le),he(le)},oe=Y=>{if(!s)return;const le=M===n(Y);return v.jsxs(v.Fragment,{children:[v.jsxs(D.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>se(n(Y)),children:[le?v.jsx(Kd,{}):v.jsx(sg,{})," Show"," ",le?"Less":"More"]}),v.jsx(l2,{colSpan:r.length,isExpanded:n(Y)===M,obj:Y,renderExpand:be=>s(be),asMobileCard:!0})]})},ce=typeof T=="string"?T:j.grey[j.mode=="dark"?600:50],ge=Y=>{const le=B===n(Y)?ce:"inherit";return{cursor:i?"pointer":"default",backgroundColor:le,...s?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===ce?Za(le,.1):ce}}}},J=j.grey[j.mode==="dark"?600:400],te=Y=>Y&&v.jsx(D.Tooltip,{title:Y,children:v.jsx(l8,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:N??J}})});return L&&!_?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(D.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:Y=>$(Y.target.value),fullWidth:!0,children:W.map(Y=>{if(Z(Y.fieldName))return v.jsx(D.MenuItem,{value:Y.sortName??Y.fieldName,children:Y.label??Mn(Y.fieldName)},`${Y.key??"rowHeader"}-${Y.fieldName}`)})}),v.jsx(D.IconButton,{onClick:()=>{l&&$(l)},children:v.jsx(v8,{className:`sort-icon-${u}`})})]}),v.jsx(D.Divider,{sx:{margin:"10px 0"}})]}),ee()??o.map(Y=>v.jsxs(D.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ge(Y)},onClick:()=>fe(n(Y)),"data-testid":`card-${n(Y)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:W.map(le=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${le.fieldName}`,style:{textWrap:"nowrap"},children:[le.label??Mn(le.fieldName),te(le.tooltip)]}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${le.fieldName}`,style:{paddingLeft:"10px"},children:G(le,Y)})]},`${le.key??"row"}-${n(Y)}-${le.fieldName}`))})}),oe(Y)]},n(Y)))]}):v.jsx(D.TableContainer,{component:D.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:y,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(D.Table,{stickyHeader:E!=="undefined",style:{tableLayout:m?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...P,children:[v.jsx(D.TableHead,{className:"MBv2_Table_Head",children:v.jsx(D.TableRow,{className:"MBv2_Table_Head_Row",children:W.map((Y,le)=>{const be=Z(Y.fieldName);return v.jsx(D.TableCell,{width:Array.isArray(m)?m[le]:"auto",sx:Y.tableCellSx??{},children:v.jsx(D.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(D.Box,{sx:[be&&{"&:hover":{cursor:"pointer",backgroundColor:j.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:be?()=>$(Y.sortName??Y.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:Y.label??Mn(Y.fieldName)}),te(Y.tooltip),be&&z(Y.fieldName)==="asc"&&v.jsx(Kd,{style:{marginLeft:"5px"}}),be&&z(Y.fieldName)==="desc"&&v.jsx(sg,{style:{marginLeft:"5px"}}),be&&z(Y.fieldName)!=="asc"&&z(Y.fieldName)!=="desc"&&v.jsx(g8,{style:{marginLeft:"5px"}})]})})},`${Y.key??"rowHeader"}-${Y.fieldName}`)})})}),v.jsx(D.TableBody,{className:"MBv2_Table_Body",children:de()??o.map(Y=>v.jsxs(X.Fragment,{children:[v.jsx(D.TableRow,{"data-testid":`row-${n(Y)}`,className:"MBv2_Table_Body_Row",onClick:()=>fe(n(Y)),sx:ge(Y),children:W.map(le=>v.jsx(D.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${le.fieldName}`,children:G(le,Y)},`${le.key??"row"}-${n(Y)}-${le.fieldName}`))}),s&&v.jsx(l2,{colSpan:W.length,isExpanded:n(Y)===M,obj:Y,renderExpand:le=>s(le),reRenderExpand:O})]},n(Y)))})]})})},lj=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))},b=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return v.jsxs(D.Box,{children:[v.jsx(aj,{sortOrder:p,sortField:f,...s}),!o&&!g&&v.jsx(D.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:b?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>m(C),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},c2=()=>({height:window.innerHeight,width:window.innerWidth}),cj=()=>{const[t,e]=X.useState(c2());return X.useEffect(()=>{const n=()=>{e(c2())};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}=cj(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(D.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...er({...t},a)})},Cfe=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.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(D.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(D.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($R,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},wfe=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(D.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(D.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(Zv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Tfe=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:b=()=>{},condenseTable:g=!1,canSelect:S=!1,canLaunchUrl:C,addlActions:_,readOnly:T=!1,showCloseBtn:w=!1}=t,E=!!t.canCreate&&!T,O=!!t.canEdit&&!T,N=!!t.canDelete&&!T,{palette:P}=D.useTheme(),[j,M]=X.useState([]),[R,B]=X.useState(!1),[F,$]=X.useState(!0),[z,L]=X.useState(null),[W,q]=X.useState(null),[G,U]=X.useState(null),[Z,pe]=X.useState({pageNo:0,pageSize:g?5:10,totalCount:0}),ae=()=>{B(!1),$(!0),p({pageNo:Z.pageNo,pageSize:Z.pageSize}).then(J=>(M(J.data),pe({...Z,totalCount:J.totalCount}),J)).catch(J=>{b(J),B(!0),M([])}).finally(()=>$(!1))};X.useEffect(ae,[Z.pageNo,Z.pageSize,e]);const de=()=>{q(null),U(null),L(null)},ee=v.jsx(qr,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:v.jsx(bf,{}),children:"Add Citation"}),he=v.jsx(qr,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:v.jsx(yT,{}),children:"Add Attachment"}),fe=J=>{if(!(!O&&!T)&&!(T&&!g))return v.jsx(D.Tooltip,{title:T?"View":"Edit",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>J.fileName?a(J):s(J),"data-testid":`citation-table_edit-btn-${J.id}`,children:T?v.jsx(T8,{}):v.jsx(qq,{})})})},se=J=>{if(!(!N||T))return v.jsx(D.Tooltip,{title:"Delete",children:v.jsx(D.IconButton,{color:"error",onClick:te=>{q(J),L(te.currentTarget)},"data-testid":`citation-table_delete-btn-${J.id}`,children:v.jsx(Zv,{})})})},oe=J=>!u&&!C?void 0:J.fileName?v.jsx(D.Tooltip,{title:"Download",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(J),"data-testid":`citation-table_download-btn-${J.id}`,sx:{visibility:u?"visible":"hidden"},children:v.jsx(Wq,{})})}):v.jsx(D.Tooltip,{title:"Open URL",children:v.jsx(D.IconButton,{color:"primary",onClick:Y=>{L(Y.currentTarget),U(J)},"data-testid":`citation-table_launch-link-btn-${J.id}`,sx:{visibility:C!=null&&C(J)?"visible":"hidden"},children:v.jsx($R,{})})}),ge=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(J,te)=>v.jsx(D.Checkbox,{"data-testid":`citation-table_checkbox-${J}`,onChange:()=>{const Y=m.includes(te.id);y(Y?m.filter(le=>le!==te.id):[...m,te.id])},checked:m.includes(J),disabled:T})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(J,te)=>v.jsx(D.Tooltip,{title:J?"Attachment":"URL",children:J?v.jsx(yT,{sx:{color:P.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${te.id}`}):v.jsx(bf,{sx:{color:P.grey[500],marginTop:"6px"},"data-testid":`url-icon-${te.id}`})})},{fieldName:"title",tableCellSx:{width:g?"100%":"auto"}},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:g,render:(J,te)=>v.jsx("span",{style:{wordBreak:"break-all"},children:J||te.url})},{fieldName:"source",hideCol:g},{fieldName:"accessedAt",hideCol:g,render:(J,te)=>{if(!te.fileName)return(J==null?void 0:J.slice(0,10))??""}},{fieldName:"classification",hideCol:g},{fieldName:"id",key:"Action",label:"Action",hideCol:!(T||O||N||C||u||_),render:(J,te)=>v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[oe(te),fe(te),se(te),_==null?void 0:_(te)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(D.Typography,{variant:g?"h6":"h2",children:n}),!S&&E&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:1,children:[ee,he]}),w&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Dp,{})})]}),v.jsx(lj,{"data-testid":"citation-table",size:g?"x-small":"medium",isLoading:F,columns:ge,data:j,paginationState:Z,onPageChange:J=>pe({...Z,pageNo:J}),onRowsPerPageChange:J=>pe({...Z,pageSize:J,pageNo:0}),errorTableMsg:R?"Failed to load citations.":void 0,retryCallback:ae}),S&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(D.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:E&&v.jsxs(v.Fragment,{children:[ee,he]})}),!T&&v.jsxs(D.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(Cfe,{citation:G,anchorEl:z,onClose:de}),v.jsx(wfe,{citation:W,anchorEl:z,onDeleteCitation:l,onClose:de})]})},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(qr,{type:n,disabled:e,size:r,startIcon:e?v.jsx(D.CircularProgress,{size:s,color:"inherit"}):null,...o})},_fe=t=>{const{title:e,onSave:n,onCancel:r,modifyCitation:o,readOnly:i=!1,showCloseBtn:s=!1}=t,a=X.useRef(null),[l,u]=X.useState(!1),[f,p]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});X.useEffect(()=>{o&&p({...o,type:"Url"})},[]);const m=()=>{var b,g,S;const y=(g=(b=a==null?void 0:a.current)==null?void 0:b.values)==null?void 0:g.url;y&&((S=a==null?void 0:a.current)==null||S.setFieldValue("url",EP(y)))};return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),s&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Dp,{})})]}),v.jsx(qt.Formik,{innerRef:a,enableReinitialize:!0,initialValues:f,onSubmit:async y=>{u(!0),n(y).catch(b=>{throw u(!1),b}).finally(()=>u(!1))},children:v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"column",gap:i?1:0,children:[v.jsx(Ps,{name:"source",disabled:l,required:!0,margin:"none",readOnly:i}),v.jsx(Ps,{name:"title",disabled:l,required:!0,margin:"none",readOnly:i}),v.jsx(Ef,{name:"accessedAt",disabled:l,required:!0,margin:"none",isDatePicker:!0,readOnly:i}),v.jsx(Ps,{name:"url",disabled:l,required:!0,onBlur:m,margin:"none",readOnly:i}),v.jsx(LR,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:i})]}),v.jsx(D.DialogActions,{sx:{px:0},children:i?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(B1,{size:"small",loading:l,children:o?"Update Citation":"Add New Citation"})]})})]})})]})};var I0,u2;function kfe(){if(u2)return I0;u2=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);I0={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,N=_.length,P=w;O<N-1;){var j=_[O];if(j==="__proto__"||j==="constructor"||j==="prototype")return w;P=P[_[O++]]}P[_[O]]=E})},getter:function(C,_){var T=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,N=T.length;O<N;)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){m(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 m(C,_,T){var w=C.length,E,O,N,P;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),P=y(E),N=!P&&/^\d+$/.test(E),_.call(T,E,P,N,O,C))}function y(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function b(C){return C.match(r)&&!C.match(n)}function g(C){return o.test(C)}function S(C){return!y(C)&&(b(C)||g(C))}return I0}var zs=kfe(),D0,d2;function Efe(){if(d2)return D0;d2=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 D0={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(" ")},D0}var P0=Efe(),Vd={exports:{}},f2;function Mfe(){if(f2)return Vd.exports;f2=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,b,g){if(g.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[b]){l[b]=!0;var C=f.get(y)||new Set;if(C=Array.from(C),b=C.length){g.add(y);do{var _=C[--b];m(_,p.get(_),g)}while(b);g.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 Ofe=Mfe();const Rfe=or(Ofe),Afe=Object.prototype.toString,Ife=Error.prototype.toString,Dfe=RegExp.prototype.toString,Pfe=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Nfe=/^Symbol\((.*)\)(.*)$/;function jfe(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function p2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return jfe(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Pfe.call(t).replace(Nfe,"Symbol($1)");const r=Afe.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Ife.call(t)+"]":r==="RegExp"?Dfe.call(t):null}function Ui(t,e){let n=p2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=p2(this[r],e);return i!==null?i:o},2)}function uj(t){return t==null?[]:[].concat(t)}let dj,fj,pj,Lfe=/\$\{\s*(\w+)\s*\}/g;dj=Symbol.toStringTag;class h2{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[dj]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],uj(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]}}fj=Symbol.hasInstance;pj=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(Lfe,(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 h2(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[pj]="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[fj](e){return h2[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"},Ffe={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"},Bv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},$fe={isValue:"${path} field must be ${value}"},ff={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Bfe={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"},zfe={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:Ffe,date:Bv,object:ff,array:Bfe,boolean:$fe,tuple:zfe});const z1=t=>t&&t.__isYupSchema__;class yp{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 yp(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(!z1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Hd={context:"$",value:"."};class na{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===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&&zs.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}na.prototype.__isYupRef=!0;const Ds=t=>t==null;function Ia(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:b,context:g,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function _(R){return na.isRef(R)?R.getValue(n,b,g):R}function T(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 $ of Object.keys(B))B[$]=_(B[$]);const F=new fr(fr.formatError(R.message||m,B),n,B.path,R.type||u,B.disableStackTrace);return F.params=B,F}const w=S?a:l;let E={path:r,parent:b,type:u,from:o.from,createError:T,resolve:_,options:o,originalValue:i,schema:s};const O=R=>{fr.isError(R)?w(R):R?l(null):w(T())},N=R=>{fr.isError(R)?w(R):a(R)};if(y&&Ds(n))return O(!0);let j;try{var M;if(j=f.call(E,n,E),typeof((M=j)==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(j).then(O,N)}}catch(R){N(R);return}O(j)}return e.OPTIONS=t,e}function Vfe(t,e,n,r=n){let o,i,s;return e?(zs.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 bp extends Set{describe(){const e=[];for(const n of this.values())e.push(na.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new bp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function za(t,e=new Map){if(z1(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]=za(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,za(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(za(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=za(o,e)}else throw Error(`Unable to clone ${t}`);return n}class jo{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 bp,this._blacklist=new bp,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=za(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=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const S=i[g];S(b,f,function(_){_&&(Array.isArray(_)?y.push(..._):y.push(_)),--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):za(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=Ia({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=Ia({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=Ia(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=uj(e).map(i=>new na(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new yp(o,n):yp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Ia({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=Ia({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=Ia({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)}}}jo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])jo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Vfe(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])jo.prototype[t]=jo.prototype.oneOf;for(const t of["not","nope"])jo.prototype[t]=jo.prototype.notOneOf;const Hfe=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Wfe(t){const e=zv(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 zv(t){var e,n;const r=Hfe.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 qfe=/^[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])?)*$/,Ufe=/^((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,Kfe=/^(?:[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,Yfe="^\\d{4}-\\d{2}-\\d{2}",Gfe="\\d{2}:\\d{2}:\\d{2}",Jfe="(([+-]\\d{2}(:?\\d{2})?)|Z)",Zfe=new RegExp(`${Yfe}T${Gfe}(\\.\\d+)?${Jfe}$`),Xfe=t=>Ds(t)||t===t.trim(),Qfe={}.toString();function Vv(){return new hj}class hj extends jo{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===Qfe?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(qfe,{name:"email",message:e,excludeEmptyString:!0})}url(e=ur.url){return this.matches(Ufe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ur.uuid){return this.matches(Kfe,{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(Zfe,{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=zv(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=zv(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:Xfe})}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()})}}Vv.prototype=hj.prototype;let epe=new Date(""),tpe=t=>Object.prototype.toString.call(t)==="[object Date]";class Ch extends jo{constructor(){super({type:"date",check(e){return tpe(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Wfe(e),isNaN(e)?Ch.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(na.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=Bv.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=Bv.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)}})}}Ch.INVALID_DATE=epe;Ch.prototype;function npe(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=zs.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),na.isRef(a)&&a.isSibling?i(a.path,s):z1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Rfe.array(Array.from(r),n).reverse()}function m2(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 mj(t){return(e,n)=>m2(t,e)-m2(t,n)}const rpe=(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 pf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=pf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=pf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(pf)}):"optional"in t?t.optional():t}const ope=(t,e)=>{const n=[...zs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=zs.getter(zs.join(n),!0)(t);return!!(o&&r in o)};let g2=t=>Object.prototype.toString.call(t)==="[object Object]";function y2(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const ipe=mj([]);function gj(t){return new yj(t)}class yj extends jo{constructor(e){super({type:"object",check(n){return g2(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=ipe,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 b,g=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:g,context:n.context,parent:l});let S=m instanceof jo?m.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}b=!n.__validating||!C?m.cast(o[p],u):o[p],b!==void 0&&(l[p]=b)}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||!g2(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||na.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=npe(e,n),r._sortErrors=mj(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 pf(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=zs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return ope(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(rpe)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||ff.exact,test(n){if(n==null)return!0;const r=y2(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=ff.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=y2(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=ff.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(P0.camelCase)}snakeCase(){return this.transformKeys(P0.snakeCase)}constantCase(){return this.transformKeys(e=>P0.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}}gj.prototype=yj.prototype;const spe=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{i&&m({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Dp,{})})]}),v.jsx(qt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:p,validationSchema:gj().shape({title:Vv().required("Title is required"),fileName:Vv().required("A file is required")}),onSubmit:async y=>{f(!0),n(y).catch(b=>{throw f(!1),b}).finally(()=>f(!1))},children:({values:y,setFieldValue:b})=>{var g;return X.useEffect(()=>{var S,C;(S=y.file)!=null&&S.name&&b("fileName",(C=y.file)==null?void 0:C.name)},[(g=y.file)==null?void 0:g.name]),v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Ps,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsxs(D.Box,{marginTop:o||s?0:1,children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[!o&&!s&&v.jsx(IR,{name:"file",errorMode:"hidden"}),v.jsx(Ps,{readOnly:!0,name:"fileName",label:s||o?"File Name":""})]}),v.jsx(yr,{name:"fileName"})]}),v.jsx(D.DialogActions,{sx:{px:0},children:s?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(B1,{size:"small",loading:u,children:i?"Update Attachment":"Upload 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(D.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},b=()=>{if(i)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(D.Box,{children:y()}),v.jsxs(D.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(D.Box,{children:y()})})};return v.jsxs(D.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(D.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&v.jsx(D.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Dp,{})})]})}):r,o&&(typeof o=="string"?v.jsx(D.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(D.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),b()]})};function ape(t){return Ye("MuiAlert",t)}const b2=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"]),lpe=Le(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"),cpe=Le(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),upe=Le(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"),dpe=Le(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"),fpe=Le(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"),ppe=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,ape,o)},hpe=ve(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),[`& .${b2.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}`,[`& .${b2.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)}}}))]}})),mpe=ve("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),gpe=ve("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ype=ve("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),v2={success:v.jsx(lpe,{fontSize:"inherit"}),warning:v.jsx(cpe,{fontSize:"inherit"}),error:v.jsx(upe,{fontSize:"inherit"}),info:v.jsx(dpe,{fontSize:"inherit"})},bj=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=v2,onClose:y,role:b="alert",severity:g="success",slotProps:S={},slots:C={},variant:_="standard",...T}=r,w={...r,color:l,severity:g,variant:_,colorSeverity:l||g},E=ppe(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[N,P]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(E.root,s),elementType:hpe,externalForwardedProps:{...O,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[j,M]=Bt("icon",{className:E.icon,elementType:mpe,externalForwardedProps:O,ownerState:w}),[R,B]=Bt("message",{className:E.message,elementType:gpe,externalForwardedProps:O,ownerState:w}),[F,$]=Bt("action",{className:E.action,elementType:ype,externalForwardedProps:O,ownerState:w}),[z,L]=Bt("closeButton",{elementType:hl,externalForwardedProps:O,ownerState:w}),[W,q]=Bt("closeIcon",{elementType:fpe,externalForwardedProps:O,ownerState:w});return v.jsxs(N,{...P,children:[p!==!1?v.jsx(j,{...M,children:p||m[g]||v2[g]}):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(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(bj.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}=D.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(bj,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(D.Typography,{variant:"h3",children:s}),n]})},vj=t=>v.jsx(Cu,{severity:"error",...t}),xj=t=>v.jsx(Cu,{severity:"success",...t}),bpe=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(vj,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(xj,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function Sj({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,readOnly:b}){const[g,S]=X.useState("Insert Citation/Attachment(s)"),[C,_]=X.useState(l),[T,w]=X.useState(void 0),[E,O]=X.useState(void 0),N=ae=>{O(void 0),S(ae)},[P,j]=X.useState(0);X.useEffect(()=>{u==null||u()},[g,E,u]);const M=(ae=!1)=>{(!p||ae)&&j(de=>de+1)},R=(ae,de)=>{var se;const ee=typeof((se=de.response)==null?void 0:se.data)=="string"&&de.response.data,he=typeof de.message=="string"&&de.message;O({type:"Error",title:ae,message:ee??he}),f(de)},B=ae=>O({type:"Success",title:"",message:ae}),F=async ae=>{if(g==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(g==="Edit Citation"||g==="Edit Attachment"){if(ae.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ae).then(()=>{N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to update",ee)}))}else await(e==null?void 0:e(ae).then(ee=>{_([...C,ee.id]),N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to create",ee)}))},$=r&&(async ae=>r(ae).then(()=>{M(!0),_(C.filter(de=>de!==ae)),B("Successfully deleted")}).catch(de=>R("Failed to delete",de))),z=(ae,de)=>{o(ae.id).then(ee=>{w(ee),N(de)}).catch(ee=>{R("Failed to load",ee)})},L=i&&(async ae=>i(ae).catch(de=>{R(`Failed to download ${ae.fileName}`,de)})),W=v.jsx(Tfe,{refreshKey:P,getCitationsPaginated:ae=>t(ae).then(de=>(u==null||u(),de)),onCancel:a,onNewCitation:()=>{w(void 0),N("Add Citation")},onNewAttachment:()=>{w(void 0),N("Add Attachment")},onEditCitation:ae=>z(ae,b?"View Citation":"Edit Citation"),onEditAttachment:ae=>z(ae,b?"View Attachment":"Edit Attachment"),onDeleteCitation:$,onDownloadAttachment:L,onSelect:s,setSelectedIds:_,selectedIds:C,onError:f,condenseTable:p,canSelect:p,title:p&&!b?g:"Attachments & Citations",addlActions:m,canCreate:!!e,canEdit:!!n,canDelete:!!$,canLaunchUrl:y,readOnly:b,showCloseBtn:p}),q=v.jsx(_fe,{modifyCitation:T,onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),title:g,readOnly:g==="View Citation",showCloseBtn:p}),G=v.jsx(spe,{onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),modifyCitation:T,disableFileUpload:g==="Edit Attachment",title:g,readOnly:g==="View Attachment",showCloseBtn:p}),U=v.jsx(bpe,{alert:E,setAlert:O}),Z=g==="Add Citation"||g==="Edit Citation"||g==="View Citation",pe=g==="Add Attachment"||g==="Edit Attachment"||g==="View Attachment";if(p){let ae=null;return!p||g==="Insert Citation/Attachment(s)"?ae=W:Z?ae=q:pe&&(ae=G),v.jsxs(D.Box,{width:"500px",children:[U,v.jsx(D.Box,{paddingTop:"8px",children:ae})]})}return v.jsxs(D.Box,{width:"100%",children:[g==="Insert Citation/Attachment(s)"&&U,v.jsx(D.Box,{paddingTop:"8px",children:W}),v.jsx(Su,{open:Z||pe,children:v.jsxs(D.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[U,Z?q:G]})})]})}function Cj({...t}){return v.jsx(Sj,{renderAsSelectablePopup:!0,...t})}const vpe=Yt({name:{CitationBubbleMenuTipTap:wj}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function wj({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,readOnly:a,...l}){const{classes:u}=vpe(),f=vt();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,y=p.selectedIds,b=p.selectedNodePos,g=T=>{f&&(T.length===0?f.commands.deleteCitation(b):y.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},b))},S=T=>{g(T),f==null||f.commands.closeCitationBubbleMenu()},C=()=>{g(y),f==null||f.commands.closeCitationBubbleMenu()},_=X.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?v.jsx(gh,{editor:f,open:m,...p.bubbleMenuOptions,...l,children:v.jsx("div",{className:u.content,children:v.jsx(Cj,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:S,onCancel:C,initialSelectedIds:y,onContentChange:_,canLaunchUrl:s,readOnly:a})})}):null}const xpe=un.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(RN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(ON.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(AN.configure(this.options.bulletList)),this.options.code!==!1&&t.push(IN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(DN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(PN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(NN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(jN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(LN.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(hN.configure(this.options.heading)),this.options.history!==!1&&t.push(VN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(HN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(WN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(ej.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(tj.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(nj.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(oj.configure(this.options.strike)),this.options.text!==!1&&t.push(ij.configure(this.options.text)),t}}),Spe=()=>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 Cpe(t){const e=vt(),n=X.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(D.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx($q,{fontSize:"small"}),v.jsx(D.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const Tj=X.createContext(void 0),_j=()=>{const t=X.useContext(Tj);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},wpe=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=_j(),[u,f]=X.useState(String(s)),[p,m]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const b=a.filter(C=>s.includes(C.id)),g=b.map(C=>yf.truncate(C.title,{length:y,omission:"..."})).join(", ");f(g),m(b);const S=b.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:b.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(x1,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(D.Tooltip,{title:v.jsx(D.Box,{className:"citation-tooltip",children:p.map((b,g)=>{var C;const S=[b.source,b.title,b.fileName,b.url,(C=b.accessedAt)==null?void 0:C.slice(0,10),b.classification];return v.jsxs(D.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),g<p.length-1&&v.jsx(D.Divider,{className:"citation-tooltip-divider"})]},b.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:b=>{b.preventDefault(),b.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Tpe=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 S1(wpe)},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}}}}),kj=t=>v.jsx(AR,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),_pe=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:b=()=>{},placeholder:g="Start typing here...",notApplicableName:S,errorMode:C="normal",canLaunchUrl:_}=t,T=[xpe,rj.configure({placeholder:g}),Spe(),Tpe.configure({citationMaxLength:a})],[w,E,O]=qt.useField({name:e}),{setValue:N}=O,{value:P}=w,{addUpdateCitation:j,deleteCitation:M,batchUpdate:R}=_j();X.useEffect(()=>{var q;const L=(q=B==null?void 0:B.current)==null?void 0:q.editor;if(!L)return;L.getHTML()!==P&&setTimeout(()=>{L.commands.setContent(P)},0)},[P]);const B=X.useRef(null),F={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},$=()=>{var q,G;const L=((G=(q=B.current)==null?void 0:q.editor)==null?void 0:G.getHTML())??"",W=!L.replace(/<\/?p>|<br>/g,"").trim();N(W?"":L)},z=v.jsxs(D.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...F[s],children:[v.jsx(ZP,{ref:B,extensions:T,content:P,editable:!i,renderControls:i?void 0:()=>v.jsx(bh,{children:v.jsx(Cpe,{})}),onBlur:$,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(wj,{getCitationsPaginated:L=>l(L).then(W=>(R(W.data),W)),onCreateCitation:u&&(L=>u(L).then(W=>(j(W),W))),onUpdateCitation:f&&(L=>f(L).then(W=>(j(W),W))),onDeleteCitation:p&&(L=>p(L).then(()=>M(L))),getCitationById:m,onDownloadAttachment:y,onError:b,canLaunchUrl:_,readOnly:i})}),v.jsx(yr,{name:e,id:`${e}-err`,errorMode:C})]});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(D.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(kj,{name:S})]}),z]})},kpe=t=>{const{name:e="submit"}=t;return v.jsx(qr,{name:e,type:"submit",...t})},Epe=t=>{const{label:e="Return to Top",icon:n=Kd,scrollThresholdPx:r=100}=t,o=D.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(D.Zoom,{in:o,children:v.jsx(D.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(D.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Mpe=()=>{const{values:t,errors:e,status:n}=qt.useFormikContext(),{palette:r}=D.useTheme();return v.jsx(D.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(D.List,{children:[v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(D.Divider,{variant:"inset",component:"li"}),v.jsxs(D.ListItem,{id:"testing",children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Ope=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=cj();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(D.Stepper,{...u,children:e.map(f=>v.jsx(D.Step,{children:v.jsx(D.StepLabel,{children:f})},f))})},Rpe=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(y8,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:b=!1,removePosition:g="bottom"}=t,[S]=qt.useField({name:e}),{value:C}=S,_=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(D.FormControl,{fullWidth:!0,children:[v.jsx(D.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(D.Typography,{children:y}):v.jsx(qt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(X.Fragment,{children:v.jsx(Ape,{variant:l,content:v.jsxs(D.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?_(g):{...g},children:[v.jsxs(D.Box,{width:"100%",children:[i(`${e}.${E}`,E),b&&E!==C.length-1&&v.jsx(D.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(E),children:a})]})})},`${e}-${E}`)),!m&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ape=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"elevatedCard":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"none":return e}},Ipe=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(D.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Dpe=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})},Ppe=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(D.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(D.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Npe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=D.useTheme(),a=ao.useNavigate();return v.jsxs(D.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(D.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(D.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(D.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(D.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Zc(l,a),children:l.label},l.label))}),n&&v.jsx(D.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},Ej=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ao.useLocation(),i=ao.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>v.jsx(D.MenuList,{children:m.map(b=>v.jsxs(D.MenuItem,{...Zc(b,i,()=>a(!1)),children:[b.icon&&v.jsx(D.ListItemIcon,{children:b.icon}),v.jsx(D.ListItemText,{primary:b.label})]},`mobile-drawer-group-${y}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,b)=>v.jsxs(X.Fragment,{children:[l(y,b),b<m.length-1&&v.jsx(D.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(D.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(D.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(f8,{})}),v.jsx(D.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(D.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(D.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},Mj=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(D.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(D.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},Oj=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(D.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(D.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(D.MenuItem,{...Zc(f,o),children:[f.icon&&v.jsx(D.ListItemIcon,{children:f.icon}),v.jsx(D.ListItemText,{primary:f.label})]},f.label))})]})},Rj=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(Oj,{label:e,menuOptions:n,icon:v.jsx(h8,{})})},wh=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}=D.useTheme(),a=ao.useNavigate();return v.jsx(D.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(D.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))})},Aj=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(D.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(wh,{menuOptions:e,activeTabIdx:n,sx:r})})},Ij=t=>{const{onToggle:e}=t,{palette:n}=D.useTheme(),r=n.mode==="dark";return v.jsx(D.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(BR,{}):v.jsx(FR,{})})},jpe=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,b=ao.useNavigate(),g=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),{palette:S}=D.useTheme(),{pathname:C}=ao.useLocation(),_=S.mode==="dark",[T,w]=A.useState(void 0);A.useEffect(()=>{const N=o.findIndex(P=>P.path&&C.startsWith(P.path));w(N>=0?N:void 0)},[C,o]);const E=s&&v.jsx(Ij,{onToggle:s}),O=s&&(g||!g&&l)?[{icon:_?v.jsx(BR,{}):v.jsx(FR,{}),label:`Switch to ${_?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(D.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(Mj,{...e}),u,v.jsxs(D.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(D.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(D.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&E,g&&v.jsx(Ej,{menuOptionLists:[o,a,O],anchor:"right"}),!g&&v.jsxs(v.Fragment,{children:[v.jsx(D.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,P)=>v.jsxs(D.Box,{display:"flex",alignItems:"center",children:[P>0&&v.jsx(D.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(D.Button,{variant:"text",sx:{color:"white"},...Zc(N,b),children:v.jsxs(D.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&v.jsx(Rj,{displayName:l,userMenuOptions:O})]})]})]}),!g&&v.jsx(Aj,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Lpe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ao.useLocation(),o=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),[i,s]=X.useState(void 0);return X.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(D.Box,{sx:e,children:v.jsx(D.Card,{sx:{height:"100%",width:200},children:v.jsx(wh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Fpe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=D.useTheme();return e.length>0&&v.jsx(wh,{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}})},$pe=t=>v.jsx(Cu,{severity:"info",...t}),Bpe=t=>v.jsx(Cu,{severity:"warning",...t}),Dj=t=>{const{crumbInfo:e}=t,n=ao.useNavigate();return v.jsx(D.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(p8,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(D.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(D.Typography,{color:"primary",children:r},r))})},zpe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Vpe(r);return v.jsx(D.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:x2(r),warning:x2(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(D.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Vpe=t=>t=="logout"?"info":t=="timeout"?"warning":t,x2=t=>{if(t=="timeout")return v.jsx(jq,{});if(t=="logout")return v.jsx(d8,{})},Hpe=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=D.useMediaQuery(D.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(D.Box,{sx:a,children:[i.length>0&&v.jsx(Dj,{crumbInfo:i}),v.jsxs(D.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(D.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(D.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(qr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(Lq,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(D.Box,{width:l?"100%":"50%",children:s})]})]})},Wpe=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return v.jsxs(D.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(D.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(D.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(D.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function qpe({...t}){return v.jsx(Sj,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Upe=({children:t,getCitations:e})=>{const[n,r]=X.useState([]),[o,i]=X.useState(!1);X.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(b=>b.id));return[...p.filter(b=>!m.has(b.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(b=>{const g=u.find(S=>S.id===b.id);return g||b}),m=new Set(f.map(b=>b.id)),y=u.filter(b=>!m.has(b.id));return[...p,...y]})},[]),a=X.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=X.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(Tj.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Kpe=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(D.Box,{height:n})};exports.AlertModal=Dpe;exports.Autocomplete=RR;exports.Breadcrumbs=Dj;exports.Button=qr;exports.Checkbox=AR;exports.CheckboxGroup=mq;exports.CitationField=_pe;exports.CitationFieldProvider=Upe;exports.CitationManager=qpe;exports.ConfirmationModal=Ipe;exports.DarkModeToggle=Ij;exports.DateField=Ef;exports.DateRangeField=FQ;exports.DecisionModal=Ppe;exports.Drawer=Ej;exports.DynamicAutocomplete=pq;exports.EnvironmentBanner=Mj;exports.ErrorAlert=vj;exports.FileList=yq;exports.FileUpload=IR;exports.FloatingNavBar=Fpe;exports.Footer=Npe;exports.FormDebugger=Mpe;exports.Header=jpe;exports.InfoAlert=$pe;exports.LoadingButton=B1;exports.LoadingIndicator=$v;exports.Location=Iq;exports.MenuButton=Oj;exports.Modal=Su;exports.MultiAutocomplete=hq;exports.NavBar=Aj;exports.NotApplicableCheckbox=kj;exports.PageHeader=Hpe;exports.PaginatedTable=lj;exports.ProfileMenu=Rj;exports.RadioGroup=LR;exports.RangeSlider=Dq;exports.RepeatableFormGroup=Rpe;exports.RichTextField=Sfe;exports.ScrollToTop=Epe;exports.SearchField=_8;exports.Select=Pq;exports.SelectableCitationManager=Cj;exports.Sidebar=Lpe;exports.SingleActionCard=Wpe;exports.Snackbar=zpe;exports.Spacer=Kpe;exports.Stepper=Ope;exports.Submit=kpe;exports.SuccessAlert=xj;exports.Switch=Nq;exports.Table=aj;exports.Tabs=wh;exports.TextField=Ps;exports.ValidationError=yr;exports.WarningAlert=Bpe;exports.commonTheme=Sn;exports.darkTheme=p6;exports.lightTheme=f6;
|
|
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=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const S=i[g];S(b,f,function(_){_&&(Array.isArray(_)?y.push(..._):y.push(_)),--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):za(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=Ia({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=Ia({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=Ia(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=uj(e).map(i=>new na(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new yp(o,n):yp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Ia({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=Ia({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=Ia({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)}}}jo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])jo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Vfe(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])jo.prototype[t]=jo.prototype.oneOf;for(const t of["not","nope"])jo.prototype[t]=jo.prototype.notOneOf;const Hfe=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Wfe(t){const e=zv(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 zv(t){var e,n;const r=Hfe.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 qfe=/^[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])?)*$/,Ufe=/^((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,Kfe=/^(?:[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,Yfe="^\\d{4}-\\d{2}-\\d{2}",Gfe="\\d{2}:\\d{2}:\\d{2}",Jfe="(([+-]\\d{2}(:?\\d{2})?)|Z)",Zfe=new RegExp(`${Yfe}T${Gfe}(\\.\\d+)?${Jfe}$`),Xfe=t=>Ds(t)||t===t.trim(),Qfe={}.toString();function Vv(){return new hj}class hj extends jo{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===Qfe?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(qfe,{name:"email",message:e,excludeEmptyString:!0})}url(e=ur.url){return this.matches(Ufe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ur.uuid){return this.matches(Kfe,{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(Zfe,{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=zv(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=zv(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:Xfe})}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()})}}Vv.prototype=hj.prototype;let epe=new Date(""),tpe=t=>Object.prototype.toString.call(t)==="[object Date]";class Ch extends jo{constructor(){super({type:"date",check(e){return tpe(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Wfe(e),isNaN(e)?Ch.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(na.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=Bv.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=Bv.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)}})}}Ch.INVALID_DATE=epe;Ch.prototype;function npe(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=zs.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),na.isRef(a)&&a.isSibling?i(a.path,s):z1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Rfe.array(Array.from(r),n).reverse()}function m2(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 mj(t){return(e,n)=>m2(t,e)-m2(t,n)}const rpe=(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 pf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=pf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=pf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(pf)}):"optional"in t?t.optional():t}const ope=(t,e)=>{const n=[...zs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=zs.getter(zs.join(n),!0)(t);return!!(o&&r in o)};let g2=t=>Object.prototype.toString.call(t)==="[object Object]";function y2(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const ipe=mj([]);function gj(t){return new yj(t)}class yj extends jo{constructor(e){super({type:"object",check(n){return g2(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=ipe,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 b,g=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:g,context:n.context,parent:l});let S=m instanceof jo?m.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}b=!n.__validating||!C?m.cast(o[p],u):o[p],b!==void 0&&(l[p]=b)}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||!g2(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||na.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=npe(e,n),r._sortErrors=mj(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 pf(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=zs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return ope(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(rpe)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||ff.exact,test(n){if(n==null)return!0;const r=y2(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=ff.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=y2(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=ff.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(P0.camelCase)}snakeCase(){return this.transformKeys(P0.snakeCase)}constantCase(){return this.transformKeys(e=>P0.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}}gj.prototype=yj.prototype;const spe=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{i&&m({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Dp,{})})]}),v.jsx(qt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:p,validationSchema:gj().shape({title:Vv().required("Title is required"),fileName:Vv().required("A file is required")}),onSubmit:async y=>{f(!0),n(y).catch(b=>{throw f(!1),b}).finally(()=>f(!1))},children:({values:y,setFieldValue:b})=>{var g;return X.useEffect(()=>{var S,C;(S=y.file)!=null&&S.name&&b("fileName",(C=y.file)==null?void 0:C.name)},[(g=y.file)==null?void 0:g.name]),v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Ps,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsxs(D.Box,{marginTop:o||s?0:1,children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[!o&&!s&&v.jsx(IR,{name:"file",errorMode:"hidden"}),v.jsx(Ps,{readOnly:!0,name:"fileName",label:s||o?"File Name":""})]}),v.jsx(yr,{name:"fileName"})]}),v.jsx(D.DialogActions,{sx:{px:0},children:s?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(B1,{size:"small",loading:u,children:i?"Update Attachment":"Upload 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(D.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},b=()=>{if(i)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(D.Box,{children:y()}),v.jsxs(D.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(D.Box,{children:y()})})};return v.jsxs(D.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(D.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&v.jsx(D.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Dp,{})})]})}):r,o&&(typeof o=="string"?v.jsx(D.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(D.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),b()]})};function ape(t){return Ye("MuiAlert",t)}const b2=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"]),lpe=Le(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"),cpe=Le(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),upe=Le(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"),dpe=Le(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"),fpe=Le(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"),ppe=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,ape,o)},hpe=ve(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),[`& .${b2.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}`,[`& .${b2.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)}}}))]}})),mpe=ve("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),gpe=ve("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ype=ve("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),v2={success:v.jsx(lpe,{fontSize:"inherit"}),warning:v.jsx(cpe,{fontSize:"inherit"}),error:v.jsx(upe,{fontSize:"inherit"}),info:v.jsx(dpe,{fontSize:"inherit"})},bj=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=v2,onClose:y,role:b="alert",severity:g="success",slotProps:S={},slots:C={},variant:_="standard",...T}=r,w={...r,color:l,severity:g,variant:_,colorSeverity:l||g},E=ppe(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[N,P]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(E.root,s),elementType:hpe,externalForwardedProps:{...O,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[j,M]=Bt("icon",{className:E.icon,elementType:mpe,externalForwardedProps:O,ownerState:w}),[R,B]=Bt("message",{className:E.message,elementType:gpe,externalForwardedProps:O,ownerState:w}),[F,$]=Bt("action",{className:E.action,elementType:ype,externalForwardedProps:O,ownerState:w}),[z,L]=Bt("closeButton",{elementType:hl,externalForwardedProps:O,ownerState:w}),[W,q]=Bt("closeIcon",{elementType:fpe,externalForwardedProps:O,ownerState:w});return v.jsxs(N,{...P,children:[p!==!1?v.jsx(j,{...M,children:p||m[g]||v2[g]}):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(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(bj.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}=D.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(bj,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(D.Typography,{variant:"h3",children:s}),n]})},vj=t=>v.jsx(Cu,{severity:"error",...t}),xj=t=>v.jsx(Cu,{severity:"success",...t}),bpe=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(vj,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(xj,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function Sj({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,readOnly:b}){const[g,S]=X.useState("Insert Citation/Attachment(s)"),[C,_]=X.useState(l),[T,w]=X.useState(void 0),[E,O]=X.useState(void 0),N=ae=>{O(void 0),S(ae)},[P,j]=X.useState(0);X.useEffect(()=>{u==null||u()},[g,E,u]);const M=(ae=!1)=>{(!p||ae)&&j(de=>de+1)},R=(ae,de)=>{var se;const ee=typeof((se=de.response)==null?void 0:se.data)=="string"&&de.response.data,he=typeof de.message=="string"&&de.message;O({type:"Error",title:ae,message:ee??he}),f(de)},B=ae=>O({type:"Success",title:"",message:ae}),F=async ae=>{if(g==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(g==="Edit Citation"||g==="Edit Attachment"){if(ae.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ae).then(()=>{N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to update",ee)}))}else await(e==null?void 0:e(ae).then(ee=>{_([...C,ee.id]),N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to create",ee)}))},$=r&&(async ae=>r(ae).then(()=>{M(!0),_(C.filter(de=>de!==ae)),B("Successfully deleted")}).catch(de=>R("Failed to delete",de))),z=(ae,de)=>{o(ae.id).then(ee=>{w(ee),N(de)}).catch(ee=>{R("Failed to load",ee)})},L=i&&(async ae=>i(ae).catch(de=>{R(`Failed to download ${ae.fileName}`,de)})),W=v.jsx(Tfe,{refreshKey:P,getCitationsPaginated:ae=>t(ae).then(de=>(u==null||u(),de)),onCancel:a,onNewCitation:()=>{w(void 0),N("Add Citation")},onNewAttachment:()=>{w(void 0),N("Add Attachment")},onEditCitation:ae=>z(ae,b?"View Citation":"Edit Citation"),onEditAttachment:ae=>z(ae,b?"View Attachment":"Edit Attachment"),onDeleteCitation:$,onDownloadAttachment:L,onSelect:s,setSelectedIds:_,selectedIds:C,onError:f,condenseTable:p,canSelect:p,title:p&&!b?g:"Attachments & Citations",addlActions:m,canCreate:!!e,canEdit:!!n,canDelete:!!$,canLaunchUrl:y,readOnly:b,showCloseBtn:p}),q=v.jsx(_fe,{modifyCitation:T,onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),title:g,readOnly:g==="View Citation",showCloseBtn:p}),G=v.jsx(spe,{onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),modifyCitation:T,disableFileUpload:g==="Edit Attachment",title:g,readOnly:g==="View Attachment",showCloseBtn:p}),U=v.jsx(bpe,{alert:E,setAlert:O}),Z=g==="Add Citation"||g==="Edit Citation"||g==="View Citation",pe=g==="Add Attachment"||g==="Edit Attachment"||g==="View Attachment";if(p){let ae=null;return!p||g==="Insert Citation/Attachment(s)"?ae=W:Z?ae=q:pe&&(ae=G),v.jsxs(D.Box,{width:"500px",children:[U,v.jsx(D.Box,{paddingTop:"8px",children:ae})]})}return v.jsxs(D.Box,{width:"100%",children:[g==="Insert Citation/Attachment(s)"&&U,v.jsx(D.Box,{paddingTop:"8px",children:W}),v.jsx(Su,{open:Z||pe,children:v.jsxs(D.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[U,Z?q:G]})})]})}function Cj({...t}){return v.jsx(Sj,{renderAsSelectablePopup:!0,...t})}const vpe=Yt({name:{CitationBubbleMenuTipTap:wj}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function wj({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,readOnly:a,...l}){const{classes:u}=vpe(),f=vt();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,y=p.selectedIds,b=p.selectedNodePos,g=T=>{f&&(T.length===0?f.commands.deleteCitation(b):y.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},b))},S=T=>{g(T),f==null||f.commands.closeCitationBubbleMenu()},C=()=>{g(y),f==null||f.commands.closeCitationBubbleMenu()},_=X.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?v.jsx(gh,{editor:f,open:m,...p.bubbleMenuOptions,...l,children:v.jsx("div",{className:u.content,children:v.jsx(Cj,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:S,onCancel:C,initialSelectedIds:y,onContentChange:_,canLaunchUrl:s,readOnly:a})})}):null}const xpe=un.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(RN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(ON.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(AN.configure(this.options.bulletList)),this.options.code!==!1&&t.push(IN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(DN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(PN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(NN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(jN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(LN.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(hN.configure(this.options.heading)),this.options.history!==!1&&t.push(VN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(HN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(WN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(ej.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(tj.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(nj.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(oj.configure(this.options.strike)),this.options.text!==!1&&t.push(ij.configure(this.options.text)),t}}),Spe=()=>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 Cpe(t){const e=vt(),n=X.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(D.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx($q,{fontSize:"small"}),v.jsx(D.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const Tj=X.createContext(void 0),_j=()=>{const t=X.useContext(Tj);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},wpe=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=_j(),[u,f]=X.useState(String(s)),[p,m]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const b=a.filter(C=>s.includes(C.id)),g=b.map(C=>yf.truncate(C.title,{length:y,omission:"..."})).join(", ");f(g),m(b);const S=b.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:b.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(x1,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(D.Tooltip,{title:v.jsx(D.Box,{className:"citation-tooltip",children:p.map((b,g)=>{var C;const S=[b.source,b.title,b.fileName,b.url,(C=b.accessedAt)==null?void 0:C.slice(0,10),b.classification];return v.jsxs(D.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),g<p.length-1&&v.jsx(D.Divider,{className:"citation-tooltip-divider"})]},b.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:b=>{b.preventDefault(),b.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Tpe=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 S1(wpe)},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}}}}),kj=t=>v.jsx(AR,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),_pe=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:b=()=>{},placeholder:g="Start typing here...",notApplicableName:S,errorMode:C="normal",canLaunchUrl:_}=t,T=[xpe,rj.configure({placeholder:g}),Spe(),Tpe.configure({citationMaxLength:a})],[w,E,O]=qt.useField({name:e}),{setValue:N}=O,{value:P}=w,{addUpdateCitation:j,deleteCitation:M,batchUpdate:R}=_j();X.useEffect(()=>{var q;const L=(q=B==null?void 0:B.current)==null?void 0:q.editor;if(!L)return;L.getHTML()!==P&&setTimeout(()=>{L.commands.setContent(P)},0)},[P]);const B=X.useRef(null),F={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},$=()=>{var q,G;const L=((G=(q=B.current)==null?void 0:q.editor)==null?void 0:G.getHTML())??"",W=!L.replace(/<\/?p>|<br>/g,"").trim();N(W?"":L)},z=v.jsxs(D.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...F[s],children:[v.jsx(ZP,{ref:B,extensions:T,content:P,editable:!i,renderControls:i?void 0:()=>v.jsx(bh,{children:v.jsx(Cpe,{})}),onBlur:$,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(wj,{getCitationsPaginated:L=>l(L).then(W=>(R(W.data),W)),onCreateCitation:u&&(L=>u(L).then(W=>(j(W),W))),onUpdateCitation:f&&(L=>f(L).then(W=>(j(W),W))),onDeleteCitation:p&&(L=>p(L).then(()=>M(L))),getCitationById:m,onDownloadAttachment:y,onError:b,canLaunchUrl:_,readOnly:i})}),v.jsx(yr,{name:e,id:`${e}-err`,errorMode:C})]});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(D.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(kj,{name:S})]}),z]})},kpe=t=>{const{name:e="submit"}=t;return v.jsx(qr,{name:e,type:"submit",...t})},Epe=t=>{const{label:e="Return to Top",icon:n=Kd,scrollThresholdPx:r=100}=t,o=D.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(D.Zoom,{in:o,children:v.jsx(D.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(D.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Ej=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ao.useNavigate(),[i,s]=A.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),v.jsx(D.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>v.jsxs(D.MenuItem,{...Zc(p,o),children:[p.icon&&v.jsx(D.ListItemIcon,{children:p.icon}),v.jsx(D.ListItemText,{primary:p.label})]},p.label))})]})},Mpe=()=>{const{values:t,errors:e,status:n}=qt.useFormikContext(),{palette:r}=D.useTheme();return v.jsx(D.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(D.List,{children:[v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(D.Divider,{variant:"inset",component:"li"}),v.jsxs(D.ListItem,{id:"testing",children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Ope=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=cj();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(D.Stepper,{...u,children:e.map(f=>v.jsx(D.Step,{children:v.jsx(D.StepLabel,{children:f})},f))})},Rpe=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(y8,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:b=!1,removePosition:g="bottom"}=t,[S]=qt.useField({name:e}),{value:C}=S,_=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(D.FormControl,{fullWidth:!0,children:[v.jsx(D.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(D.Typography,{children:y}):v.jsx(qt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(X.Fragment,{children:v.jsx(Ape,{variant:l,content:v.jsxs(D.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?_(g):{...g},children:[v.jsxs(D.Box,{width:"100%",children:[i(`${e}.${E}`,E),b&&E!==C.length-1&&v.jsx(D.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(E),children:a})]})})},`${e}-${E}`)),!m&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ape=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"elevatedCard":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"none":return e}},Ipe=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(D.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Dpe=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})},Ppe=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(D.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(D.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Npe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=D.useTheme(),a=ao.useNavigate();return v.jsxs(D.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(D.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(D.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(D.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(D.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Zc(l,a),children:l.label},l.label))}),n&&v.jsx(D.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},Mj=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ao.useLocation(),i=ao.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>v.jsx(D.MenuList,{children:m.map(b=>v.jsxs(D.MenuItem,{...Zc(b,i,()=>a(!1)),children:[b.icon&&v.jsx(D.ListItemIcon,{children:b.icon}),v.jsx(D.ListItemText,{primary:b.label})]},`mobile-drawer-group-${y}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,b)=>v.jsxs(X.Fragment,{children:[l(y,b),b<m.length-1&&v.jsx(D.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(D.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(D.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(f8,{})}),v.jsx(D.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(D.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(D.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},Oj=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(D.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(D.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},Rj=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(Ej,{label:e,menuOptions:n,icon:v.jsx(h8,{})})},wh=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}=D.useTheme(),a=ao.useNavigate();return v.jsx(D.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(D.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))})},Aj=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(D.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(wh,{menuOptions:e,activeTabIdx:n,sx:r})})},Ij=t=>{const{onToggle:e}=t,{palette:n}=D.useTheme(),r=n.mode==="dark";return v.jsx(D.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(BR,{}):v.jsx(FR,{})})},jpe=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,b=ao.useNavigate(),g=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),{palette:S}=D.useTheme(),{pathname:C}=ao.useLocation(),_=S.mode==="dark",[T,w]=A.useState(void 0);A.useEffect(()=>{const N=o.findIndex(P=>P.path&&C.startsWith(P.path));w(N>=0?N:void 0)},[C,o]);const E=s&&v.jsx(Ij,{onToggle:s}),O=s&&(g||!g&&l)?[{icon:_?v.jsx(BR,{}):v.jsx(FR,{}),label:`Switch to ${_?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(D.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(Oj,{...e}),u,v.jsxs(D.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(D.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(D.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&E,g&&v.jsx(Mj,{menuOptionLists:[o,a,O],anchor:"right"}),!g&&v.jsxs(v.Fragment,{children:[v.jsx(D.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,P)=>v.jsxs(D.Box,{display:"flex",alignItems:"center",children:[P>0&&v.jsx(D.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(D.Button,{variant:"text",sx:{color:"white"},...Zc(N,b),children:v.jsxs(D.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&v.jsx(Rj,{displayName:l,userMenuOptions:O})]})]})]}),!g&&v.jsx(Aj,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Lpe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ao.useLocation(),o=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),[i,s]=X.useState(void 0);return X.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(D.Box,{sx:e,children:v.jsx(D.Card,{sx:{height:"100%",width:200},children:v.jsx(wh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Fpe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=D.useTheme();return e.length>0&&v.jsx(wh,{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}})},$pe=t=>v.jsx(Cu,{severity:"info",...t}),Bpe=t=>v.jsx(Cu,{severity:"warning",...t}),Dj=t=>{const{crumbInfo:e}=t,n=ao.useNavigate();return v.jsx(D.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(p8,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(D.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(D.Typography,{color:"primary",children:r},r))})},zpe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Vpe(r);return v.jsx(D.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:x2(r),warning:x2(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(D.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Vpe=t=>t=="logout"?"info":t=="timeout"?"warning":t,x2=t=>{if(t=="timeout")return v.jsx(jq,{});if(t=="logout")return v.jsx(d8,{})},Hpe=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=D.useMediaQuery(D.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(D.Box,{sx:a,children:[i.length>0&&v.jsx(Dj,{crumbInfo:i}),v.jsxs(D.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(D.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(D.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(qr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(Lq,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(D.Box,{width:l?"100%":"50%",children:s})]})]})},Wpe=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return v.jsxs(D.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(D.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(D.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(D.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function qpe({...t}){return v.jsx(Sj,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Upe=({children:t,getCitations:e})=>{const[n,r]=X.useState([]),[o,i]=X.useState(!1);X.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(b=>b.id));return[...p.filter(b=>!m.has(b.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(b=>{const g=u.find(S=>S.id===b.id);return g||b}),m=new Set(f.map(b=>b.id)),y=u.filter(b=>!m.has(b.id));return[...p,...y]})},[]),a=X.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=X.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(Tj.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Kpe=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(D.Box,{height:n})};exports.AlertModal=Dpe;exports.Autocomplete=RR;exports.Breadcrumbs=Dj;exports.Button=qr;exports.Checkbox=AR;exports.CheckboxGroup=mq;exports.CitationField=_pe;exports.CitationFieldProvider=Upe;exports.CitationManager=qpe;exports.ConfirmationModal=Ipe;exports.DarkModeToggle=Ij;exports.DateField=Ef;exports.DateRangeField=FQ;exports.DecisionModal=Ppe;exports.Drawer=Mj;exports.DynamicAutocomplete=pq;exports.EnvironmentBanner=Oj;exports.ErrorAlert=vj;exports.FileList=yq;exports.FileUpload=IR;exports.FloatingNavBar=Fpe;exports.Footer=Npe;exports.FormDebugger=Mpe;exports.Header=jpe;exports.InfoAlert=$pe;exports.LoadingButton=B1;exports.LoadingIndicator=$v;exports.Location=Iq;exports.MenuButton=Ej;exports.Modal=Su;exports.MultiAutocomplete=hq;exports.NavBar=Aj;exports.NotApplicableCheckbox=kj;exports.PageHeader=Hpe;exports.PaginatedTable=lj;exports.ProfileMenu=Rj;exports.RadioGroup=LR;exports.RangeSlider=Dq;exports.RepeatableFormGroup=Rpe;exports.RichTextField=Sfe;exports.ScrollToTop=Epe;exports.SearchField=_8;exports.Select=Pq;exports.SelectableCitationManager=Cj;exports.Sidebar=Lpe;exports.SingleActionCard=Wpe;exports.Snackbar=zpe;exports.Spacer=Kpe;exports.Stepper=Ope;exports.Submit=kpe;exports.SuccessAlert=xj;exports.Switch=Nq;exports.Table=aj;exports.Tabs=wh;exports.TextField=Ps;exports.ValidationError=yr;exports.WarningAlert=Bpe;exports.commonTheme=Sn;exports.darkTheme=p6;exports.lightTheme=f6;
|
package/dist/index.d.ts
CHANGED
|
@@ -43,10 +43,12 @@ export { Button } from './components/Buttons/Button/Button';
|
|
|
43
43
|
export { Submit } from './components/Buttons/Submit/Submit';
|
|
44
44
|
export { ScrollToTop } from './components/Buttons/ScrollToTop/ScrollToTop';
|
|
45
45
|
export { LoadingButton } from './components/Buttons/LoadingButton/LoadingButton';
|
|
46
|
+
export { MenuButton } from './components/Buttons/MenuButton/MenuButton';
|
|
46
47
|
export type { ButtonProps } from './components/Buttons/Button/Button';
|
|
47
48
|
export type { SubmitProps } from './components/Buttons/Submit/Submit';
|
|
48
49
|
export type { ScrollToTopProps } from './components/Buttons/ScrollToTop/ScrollToTop';
|
|
49
50
|
export type { LoadingButtonProps } from './components/Buttons/LoadingButton/LoadingButton';
|
|
51
|
+
export type { MenuButtonProps } from './components/Buttons/MenuButton/MenuButton';
|
|
50
52
|
export { ValidationError } from './components/Form/ValidationError/ValidationError';
|
|
51
53
|
export { FormDebugger } from './components/Form/FormDebugger/FormDebugger';
|
|
52
54
|
export { Stepper } from './components/Form/Stepper/Stepper';
|
|
@@ -72,7 +74,6 @@ export { DarkModeToggle } from './components/Navigation/Header/DarkModeToggle/Da
|
|
|
72
74
|
export { ProfileMenu } from './components/Navigation/Header/ProfileMenu';
|
|
73
75
|
export { EnvironmentBanner } from './components/Navigation/Header/EnvironmentBanner';
|
|
74
76
|
export { Sidebar } from './components/Navigation/Sidebar/Sidebar';
|
|
75
|
-
export { MenuButton } from './components/Navigation/MenuButton/MenuButton';
|
|
76
77
|
export { NavBar } from './components/Navigation/NavBar/NavBar';
|
|
77
78
|
export { FloatingNavBar } from './components/Navigation/NavBar/FloatingNavBar/FloatingNavBar';
|
|
78
79
|
export { Drawer } from './components/Navigation/Header/Drawer';
|
|
@@ -82,7 +83,6 @@ export type { HeaderProps } from './components/Navigation/Header/Header';
|
|
|
82
83
|
export type { DarkModeToggleProps } from './components/Navigation/Header/DarkModeToggle/DarkModeToggle';
|
|
83
84
|
export type { ProfileMenuProps } from './components/Navigation/Header/ProfileMenu';
|
|
84
85
|
export type { SidebarProps } from './components/Navigation/Sidebar/Sidebar';
|
|
85
|
-
export type { MenuButtonProps } from './components/Navigation/MenuButton/MenuButton';
|
|
86
86
|
export type { NavBarProps } from './components/Navigation/NavBar/NavBar';
|
|
87
87
|
export type { FloatingNavBarProps } from './components/Navigation/NavBar/FloatingNavBar/FloatingNavBar';
|
|
88
88
|
export type { DrawerProps } from './components/Navigation/Header/Drawer';
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './index.css';var WV = Object.defineProperty;
|
|
2
2
|
var qV = (t, e, n) => e in t ? WV(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var rc = (t, e, n) => qV(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { createTheme as IA, Typography as qe, Box as Ae, TextField as Ci, FormControl as Yo, Autocomplete as S1, FormControlLabel as Up, Checkbox as C1, FormLabel as DA, Button as qt, Card as na, CardContent as dv, IconButton as cr, Radio as UV, FormHelperText as KV, RadioGroup as YV, Slider as GV, MenuItem as In, ListItemIcon as w1, InputLabel as PA, Select as NA, Switch as JV, InputAdornment as ZV, useMediaQuery as da, useTheme as Fn, darken as Zw, alpha as Vf, lighten as XV, Popper as Kp, Fade as LA, Paper as ms, DialogActions as ml, Link as T1, Collapse as fv, Divider as bi, createSvgIcon as hr, Tooltip as yi, ToggleButton as QV, toggleButtonClasses as eH, rgbToHex as tH, ClickAwayListener as nH, Stack as rH, outlinedInputClasses as Xw, svgIconClasses as Qw, selectClasses as oH, List as $A, ListItem as mf, ListItemButton as iH, CircularProgress as FA, TableRow as Ga, TableCell as Ja, TableContainer as sH, Table as aH, TableHead as lH, TableBody as cH, TablePagination as uH, Dialog as dH, DialogTitle as fH, DialogContent as pH, DialogContentText as hH, useScrollTrigger as mH, Zoom as gH, Fab as yH,
|
|
4
|
+
import { createTheme as IA, Typography as qe, Box as Ae, TextField as Ci, FormControl as Yo, Autocomplete as S1, FormControlLabel as Up, Checkbox as C1, FormLabel as DA, Button as qt, Card as na, CardContent as dv, IconButton as cr, Radio as UV, FormHelperText as KV, RadioGroup as YV, Slider as GV, MenuItem as In, ListItemIcon as w1, InputLabel as PA, Select as NA, Switch as JV, InputAdornment as ZV, useMediaQuery as da, useTheme as Fn, darken as Zw, alpha as Vf, lighten as XV, Popper as Kp, Fade as LA, Paper as ms, DialogActions as ml, Link as T1, Collapse as fv, Divider as bi, createSvgIcon as hr, Tooltip as yi, ToggleButton as QV, toggleButtonClasses as eH, rgbToHex as tH, ClickAwayListener as nH, Stack as rH, outlinedInputClasses as Xw, svgIconClasses as Qw, selectClasses as oH, List as $A, ListItem as mf, ListItemButton as iH, CircularProgress as FA, TableRow as Ga, TableCell as Ja, TableContainer as sH, Table as aH, TableHead as lH, TableBody as cH, TablePagination as uH, Dialog as dH, DialogTitle as fH, DialogContent as pH, DialogContentText as hH, useScrollTrigger as mH, Zoom as gH, Fab as yH, Menu as bH, ListItemText as BA, Stepper as vH, Step as xH, StepLabel as SH, Drawer as CH, MenuList as wH, Tabs as TH, Tab as _H, AppBar as kH, Toolbar as EH, Breadcrumbs as MH, Snackbar as OH, AlertTitle as AH } from "@mui/material";
|
|
5
5
|
import { jsx as S, jsxs as ee, Fragment as mn } from "react/jsx-runtime";
|
|
6
6
|
import * as R from "react";
|
|
7
7
|
import Pe, { useEffect as It, Children as RH, isValidElement as gf, cloneElement as yf, useRef as on, useMemo as Er, createContext as xu, useContext as Yp, forwardRef as Su, createElement as IH, useCallback as zr, useState as xt, useDebugValue as zA, useLayoutEffect as VA, Component as DH, useImperativeHandle as HA } from "react";
|
|
@@ -60463,6 +60463,37 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60463
60463
|
)
|
|
60464
60464
|
}
|
|
60465
60465
|
) });
|
|
60466
|
+
}, tme = (t) => {
|
|
60467
|
+
const { label: e, menuOptions: n = [], icon: r } = t, o = Il(), [i, s] = R.useState(null), a = !!i, l = (p) => {
|
|
60468
|
+
s(p.currentTarget);
|
|
60469
|
+
}, u = () => {
|
|
60470
|
+
s(null);
|
|
60471
|
+
};
|
|
60472
|
+
if (n.length === 0) return null;
|
|
60473
|
+
const f = r && !e;
|
|
60474
|
+
return /* @__PURE__ */ ee(mn, { children: [
|
|
60475
|
+
/* @__PURE__ */ S(
|
|
60476
|
+
qt,
|
|
60477
|
+
{
|
|
60478
|
+
startIcon: f ? void 0 : r,
|
|
60479
|
+
variant: "outlined",
|
|
60480
|
+
color: "inherit",
|
|
60481
|
+
sx: {
|
|
60482
|
+
minWidth: 0,
|
|
60483
|
+
...f && {
|
|
60484
|
+
paddingLeft: "6px",
|
|
60485
|
+
paddingRight: "6px"
|
|
60486
|
+
}
|
|
60487
|
+
},
|
|
60488
|
+
onClick: l,
|
|
60489
|
+
children: f ? r : e
|
|
60490
|
+
}
|
|
60491
|
+
),
|
|
60492
|
+
/* @__PURE__ */ S(bH, { anchorEl: i, open: a, onClick: u, children: n.map((p) => /* @__PURE__ */ ee(In, { ...Cu(p, o), children: [
|
|
60493
|
+
p.icon && /* @__PURE__ */ S(w1, { children: p.icon }),
|
|
60494
|
+
/* @__PURE__ */ S(BA, { primary: p.label })
|
|
60495
|
+
] }, p.label)) })
|
|
60496
|
+
] });
|
|
60466
60497
|
}, Fme = () => {
|
|
60467
60498
|
const { values: t, errors: e, status: n } = jA(), { palette: r } = Fn();
|
|
60468
60499
|
return /* @__PURE__ */ S(ms, { style: { backgroundColor: r.mode === "dark" ? "#303030" : "#f0f0f0", margin: "10px 0" }, children: /* @__PURE__ */ ee($A, { children: [
|
|
@@ -60497,7 +60528,7 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60497
60528
|
orientation: a,
|
|
60498
60529
|
...ur({ ...t }, l)
|
|
60499
60530
|
};
|
|
60500
|
-
return /* @__PURE__ */ S(
|
|
60531
|
+
return /* @__PURE__ */ S(vH, { ...u, children: e.map((f) => /* @__PURE__ */ S(xH, { children: /* @__PURE__ */ S(SH, { children: f }) }, f)) });
|
|
60501
60532
|
}, zme = (t) => {
|
|
60502
60533
|
const {
|
|
60503
60534
|
name: e,
|
|
@@ -60536,7 +60567,7 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60536
60567
|
name: e,
|
|
60537
60568
|
render: (T) => /* @__PURE__ */ ee("div", { children: [
|
|
60538
60569
|
C.map((w, E) => /* @__PURE__ */ S(Pe.Fragment, { children: /* @__PURE__ */ S(
|
|
60539
|
-
|
|
60570
|
+
nme,
|
|
60540
60571
|
{
|
|
60541
60572
|
variant: l,
|
|
60542
60573
|
content: /* @__PURE__ */ ee(
|
|
@@ -60576,7 +60607,7 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60576
60607
|
}
|
|
60577
60608
|
)
|
|
60578
60609
|
] });
|
|
60579
|
-
},
|
|
60610
|
+
}, nme = ({ variant: t, content: e }) => {
|
|
60580
60611
|
switch (t) {
|
|
60581
60612
|
case "card":
|
|
60582
60613
|
return /* @__PURE__ */ S(na, { "data-testid": "repeatable-form-group_card", sx: { padding: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ S(dv, { children: e }) });
|
|
@@ -60750,8 +60781,8 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60750
60781
|
]
|
|
60751
60782
|
}
|
|
60752
60783
|
);
|
|
60753
|
-
},
|
|
60754
|
-
const { menuOptionLists: e, anchor: n = "left", children: r } = t, { pathname: o } = _1(), i = Il(), [s, a] = xt(!1), l = (m, y) => /* @__PURE__ */ S(
|
|
60784
|
+
}, rme = (t) => {
|
|
60785
|
+
const { menuOptionLists: e, anchor: n = "left", children: r } = t, { pathname: o } = _1(), i = Il(), [s, a] = xt(!1), l = (m, y) => /* @__PURE__ */ S(wH, { children: m.map((b) => /* @__PURE__ */ ee(
|
|
60755
60786
|
In,
|
|
60756
60787
|
{
|
|
60757
60788
|
...Cu(b, i, () => a(!1)),
|
|
@@ -60778,9 +60809,9 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60778
60809
|
a(!1);
|
|
60779
60810
|
}, [o]), p && /* @__PURE__ */ ee(mn, { children: [
|
|
60780
60811
|
/* @__PURE__ */ S(cr, { onClick: () => a(!0), color: "inherit", title: "Menu", children: /* @__PURE__ */ S(B7, {}) }),
|
|
60781
|
-
/* @__PURE__ */ S(
|
|
60812
|
+
/* @__PURE__ */ S(CH, { "data-testid": "mobile-drawer", anchor: n, open: s, onClose: () => a(!1), children: /* @__PURE__ */ S(Ae, { sx: { width: 300 }, display: "flex", flexDirection: "column", justifyContent: "space-between", children: /* @__PURE__ */ S(Ae, { display: "flex", justifyContent: "start", flexDirection: "column", children: f }) }) })
|
|
60782
60813
|
] });
|
|
60783
|
-
},
|
|
60814
|
+
}, ome = (t) => {
|
|
60784
60815
|
const { env: e, isProd: n } = t;
|
|
60785
60816
|
return n ? null : /* @__PURE__ */ S(
|
|
60786
60817
|
ms,
|
|
@@ -60797,32 +60828,9 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60797
60828
|
] })
|
|
60798
60829
|
}
|
|
60799
60830
|
);
|
|
60800
|
-
}, ome = (t) => {
|
|
60801
|
-
const { label: e, menuOptions: n = [], icon: r } = t, o = Il(), [i, s] = R.useState(null), a = !!i, l = (f) => {
|
|
60802
|
-
s(f.currentTarget);
|
|
60803
|
-
}, u = () => {
|
|
60804
|
-
s(null);
|
|
60805
|
-
};
|
|
60806
|
-
return n.length === 0 ? null : /* @__PURE__ */ ee(mn, { children: [
|
|
60807
|
-
/* @__PURE__ */ S(
|
|
60808
|
-
qt,
|
|
60809
|
-
{
|
|
60810
|
-
startIcon: r,
|
|
60811
|
-
variant: "outlined",
|
|
60812
|
-
color: "inherit",
|
|
60813
|
-
sx: { minWidth: 0, padding: 1 },
|
|
60814
|
-
onClick: l,
|
|
60815
|
-
children: e
|
|
60816
|
-
}
|
|
60817
|
-
),
|
|
60818
|
-
/* @__PURE__ */ S(wH, { anchorEl: i, open: a, onClick: u, children: n.map((f) => /* @__PURE__ */ ee(In, { ...Cu(f, o), children: [
|
|
60819
|
-
f.icon && /* @__PURE__ */ S(w1, { children: f.icon }),
|
|
60820
|
-
/* @__PURE__ */ S(BA, { primary: f.label })
|
|
60821
|
-
] }, f.label)) })
|
|
60822
|
-
] });
|
|
60823
60831
|
}, ime = (t) => {
|
|
60824
60832
|
const { displayName: e, userMenuOptions: n } = t;
|
|
60825
|
-
return /* @__PURE__ */ S(
|
|
60833
|
+
return /* @__PURE__ */ S(tme, { label: e, menuOptions: n, icon: /* @__PURE__ */ S(V7, {}) });
|
|
60826
60834
|
}, TS = (t) => {
|
|
60827
60835
|
const {
|
|
60828
60836
|
menuOptions: e,
|
|
@@ -60893,7 +60901,7 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60893
60901
|
...i
|
|
60894
60902
|
] : i;
|
|
60895
60903
|
return /* @__PURE__ */ ee(kH, { ref: n, position: f, sx: m, elevation: 4, children: [
|
|
60896
|
-
e && /* @__PURE__ */ S(
|
|
60904
|
+
e && /* @__PURE__ */ S(ome, { ...e }),
|
|
60897
60905
|
u,
|
|
60898
60906
|
/* @__PURE__ */ ee(
|
|
60899
60907
|
EH,
|
|
@@ -60919,7 +60927,7 @@ const b$ = xu(void 0), v$ = () => {
|
|
|
60919
60927
|
) : r }),
|
|
60920
60928
|
/* @__PURE__ */ ee(Ae, { display: "flex", gap: 2, alignItems: "center", children: [
|
|
60921
60929
|
!l && !g && E,
|
|
60922
|
-
g && /* @__PURE__ */ S(
|
|
60930
|
+
g && /* @__PURE__ */ S(rme, { menuOptionLists: [o, a, O], anchor: "right" }),
|
|
60923
60931
|
!g && /* @__PURE__ */ ee(mn, { children: [
|
|
60924
60932
|
/* @__PURE__ */ S(Ae, { display: "flex", gap: 0, children: a == null ? void 0 : a.map((P, D) => /* @__PURE__ */ ee(Ae, { display: "flex", alignItems: "center", children: [
|
|
60925
60933
|
D > 0 && /* @__PURE__ */ S(
|
|
@@ -61223,9 +61231,9 @@ export {
|
|
|
61223
61231
|
Ev as DateField,
|
|
61224
61232
|
Ame as DateRangeField,
|
|
61225
61233
|
jme as DecisionModal,
|
|
61226
|
-
|
|
61234
|
+
rme as Drawer,
|
|
61227
61235
|
Sme as DynamicAutocomplete,
|
|
61228
|
-
|
|
61236
|
+
ome as EnvironmentBanner,
|
|
61229
61237
|
Whe as ErrorAlert,
|
|
61230
61238
|
Tme as FileList,
|
|
61231
61239
|
U8 as FileUpload,
|
|
@@ -61237,7 +61245,7 @@ export {
|
|
|
61237
61245
|
s$ as LoadingButton,
|
|
61238
61246
|
Y2 as LoadingIndicator,
|
|
61239
61247
|
_me as Location,
|
|
61240
|
-
|
|
61248
|
+
tme as MenuButton,
|
|
61241
61249
|
Qh as Modal,
|
|
61242
61250
|
Cme as MultiAutocomplete,
|
|
61243
61251
|
sme as NavBar,
|
package/dist/index.umd.js
CHANGED
|
@@ -400,4 +400,4 @@ img.ProseMirror-separator {
|
|
|
400
400
|
3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function nte(){Kt.scanner=Yee(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=Zee(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 v1(t){return Kt.initialized||nte(),Xee(Kt.parser.start,t,PD(Kt.scanner.start,t))}v1.scan=PD;function zD(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 y1(n),o=v1(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 rte(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function ote(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=xK(n.doc,[...e]);if(kK(a).forEach(({newRange:u})=>{const f=CK(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 b=y[y.length-1],m=p.pos+g.lastIndexOf(b);if(!b)return!1;const S=v1(b).map(C=>C.toObject(t.defaultProtocol));if(!rte(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:m+C.start+1,to:m+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=>{ay(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 ite(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=sy(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 ste(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=zD(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 ate=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function qs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(ate,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const lte=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"){RD(t);return}RD(t.scheme,t.optionalSlashes)})},onDestroy(){tte()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",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=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Vi({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=zD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qs(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(ote({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!qs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(ite({type:this.type})),this.options.linkOnPaste&&t.push(ste({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),VD=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 cte(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=JK(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"),b=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!b)return null;const m=a.pos-b.length,S=Array.from(b.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 _=m+S.index;let w=_+S[0].length;return l&&f.test(b.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 ute=new bn("suggestion");function dte({pluginKey:t=ute,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=cte}){let b;const m=p==null?void 0:p(),S=new en({key:t,view(){return{update:async(C,T)=>{var _,w,E,O,L,N,F;const M=(_=this.key)===null||_===void 0?void 0:_.getState(T),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,$=B||z&&V,W=V||z,q=R||z&&V;if(!$&&!W&&!q)return;const G=q&&!$?M:A,U=C.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);b={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:Z=>u({editor:e,range:G.range,props:Z}),decorationNode:U,clientRect:U?()=>{var Z;const{decorationId:pe}=(Z=this.key)===null||Z===void 0?void 0:Z.getState(e.state),ae=C.dom.querySelector(`[data-decoration-id="${pe}"]`);return(ae==null?void 0:ae.getBoundingClientRect())||null}:null},$&&((E=m==null?void 0:m.onBeforeStart)===null||E===void 0||E.call(m,b)),W&&((O=m==null?void 0:m.onBeforeUpdate)===null||O===void 0||O.call(m,b)),(W||$)&&(b.items=await f({editor:e,query:G.query})),q&&((L=m==null?void 0:m.onExit)===null||L===void 0||L.call(m,b)),W&&((N=m==null?void 0:m.onUpdate)===null||N===void 0||N.call(m,b)),$&&((F=m==null?void 0:m.onStart)===null||F===void 0||F.call(m,b))},destroy:()=>{var C;b&&((C=m==null?void 0:m.onExit)===null||C===void 0||C.call(m,b))}}},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:L}=C,{empty:N,from:F}=L,M={...T};if(M.composing=O,E&&(N||e.view.composing)){(F<T.range.from||F>T.range.to)&&!O&&!T.composing&&(M.active=!1);const A=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:L.$from}),z=`id_${Math.floor(Math.random()*4294967295)}`;A&&g({editor:e,state:w,range:A.range,isActive:T.active})?(M.active=!0,M.decorationId=T.decorationId?T.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,T){var _;const{active:w,range:E}=S.getState(C.state);return w&&((_=m==null?void 0:m.onKeyDown)===null||_===void 0?void 0:_.call(m,{view:C,event:T,range:E}))||!1},decorations(C){const{active:T,range:_,decorationId:w}=S.getState(C);return T?Zt.create(C.doc,[Ln.inline(_.from,_.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const fte=new bn("mention"),pte=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:fte,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[dte({editor:this.editor,...this.options.suggestion})]}}),hte="listItem",HD="textStyle",jD=/^(\d+)\.\s$/,WD=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(hte,this.editor.getAttributes(HD)).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:jD,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:jD,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(HD)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),qD=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()}}}),UD=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&&Cf(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)}}})]}}),gte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,mte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,KD=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[Fs({find:gte,type:this.type})]},addPasteRules(){return[Vi({find:mte,type:this.type})]}}),yte=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()}}}),bte=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()}}}),vte=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]}}),xte=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]}}),Ste=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]}}),Cte=/^\s*(\[([( |x])?\])\s$/,wte=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:Cte,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),_te=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()}}}),YD=tn.create({name:"text",group:"inline"}),Tte=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")}}}),kte=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()}}}),GD=X.forwardRef((t,e)=>{const[n,r]=X.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 X.useEffect(()=>r(0),[t.items]),X.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(I.Paper,{elevation:5,children:v.jsx(I.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(I.ListItem,{disablePadding:!0,children:v.jsx(I.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});GD.displayName="SuggestionList";const JD={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Ete={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 nI(GD,{props:n,editor:n.editor}),e=Hc("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??JD},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))??JD}})},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}}}},Mte=lte.extend({inclusive:!1}),Ote=yte.extend({excludes:"superscript"}),Ate=bte.extend({excludes:"subscript"});function Ite({placeholder:t}={}){return X.useMemo(()=>[QQ.configure({resizable:!0}),Ste,xte,vte,cD,dD,fD,gD,VD,WD,qD,Ote,Ate,YD,sD,iD,uD,_D,kte,KD,Mte.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),GG,hD,qX,Tte.configure({types:["heading","paragraph","image"]}),fee,pee,mee,jX,kee.configure({multicolor:!0}),wD,XX,pD,_te,wte.configure({nested:!0}),pte.configure({suggestion:Ete}),UD.configure({placeholder:t}),CD],[t])}function ZD(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Dte=t=>{const e=Ite({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(SZ,{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;X.useEffect(()=>{var C,T,_;(_=(T=(C=g==null?void 0:g.current)==null?void 0:C.editor)==null?void 0:T.commands)==null||_.setContent(p)},[p]);const g=X.useRef(null),y=X.useCallback((C,T)=>{var w;const _=(w=g.current)==null?void 0:w.editor;if(!(!_||!i))if(i instanceof Promise)i(C).then(E=>{$v({images:E,editor:_,position:T})});else{const E=i(C);$v({images:E,editor:_,position:T})}},[]),b=X.useCallback((C,T,_,w)=>{var O;if(!(T instanceof DragEvent)||!T.dataTransfer)return!1;const E=ZD(T.dataTransfer.files);if(E.length>0){const L=(O=C.posAtCoords({left:T.clientX,top:T.clientY}))==null?void 0:O.pos;return y(E,L),T.preventDefault(),!0}return!1},[y]),m=X.useCallback((C,T,_)=>{if(!T.clipboardData)return!1;const w=ZD(T.clipboardData.files);return w.length>0?(y(w),!0):!1},[y]),S=v.jsx(I.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(lI,{ref:g,extensions:e,content:p,editable:!s,editorProps:{handleDrop:b,handlePaste:m},renderControls:s?void 0:()=>v.jsx(eee,{onUploadFiles:i}),onBlur:()=>{var C,T;return f(((T=(C=g.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(TA,{}),v.jsx(cI,{})]})})});return v.jsxs(I.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(I.Typography,{...o,children:r}),S]})},x1=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(I.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(I.Box,{className:"text-content",children:[v.jsx(I.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(I.Typography,{"data-testid":"message",children:n})]}),v.jsx(I.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},XD=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=X.useState(!1),[u,f]=X.useState(void 0);X.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?v.jsx(I.Collapse,{in:n,children:u}):v.jsx(I.TableRow,{sx:p,children:v.jsx(I.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(I.Collapse,{in:n,children:u})})})},QD=t=>{const{id:e,getRowKey:n=Y=>"id"in Y&&(typeof Y.id=="string"||typeof Y.id=="number")?Y.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(Y)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(Y)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:g=!1,className:y,emptyTableMsg:b="No items to display",errorTableMsg:m,retryCallback:S,isLoading:C=!1,disableMobileCards:T=!1,highlightSelectedRow:_=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,tooltipColor:L,...N}=t,{palette:F}=I.useTheme(),[M,A]=X.useState(void 0),[z,B]=X.useState(void 0);Array.isArray(g)&&(!s&&g.length!==r.length&&console.warn('Table component: Length of "fixedLayout" is not equal to the length of "columns".'),s&&g.length!==r.length+1&&console.warn(`Table component: Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),s&&i&&console.warn("Table component: renderExpand & onRowClick are both defined. Only one should be defined at a time.");const R=Y=>{Y!==l?f&&f(Y,"asc"):f&&f(l,u==="asc"?"desc":"asc")},V=Y=>l===Y?u:null,$=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),W=$&&a?r.filter(Y=>!(a.includes(Y.fieldName)||Y.hideCol)):r.filter(Y=>!Y.hideCol);s&&!$&&W.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:Y=>{const le=M===Y;return v.jsx(I.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>se(Y),children:le?v.jsx(Zu,{"data-testid":"collapse-up"}):v.jsx(cg,{"data-testid":"expand-down"})})}});const q=(Y,le)=>le.split(".").reduce((ve,Ce)=>{if(ve&&typeof ve=="object")return ve[Ce]},Y),G=(Y,le)=>{const ve=q(le,Y.fieldName);return Y.render?Y.render(ve,le,$):ve},U=f!==void 0,Z=Y=>U?p?p.includes(Y):!0:!1,pe=v.jsxs(I.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(PR,{})," ",b]}),ae=v.jsxs(I.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(pC,{color:"error"})," ",m,S&&v.jsx(I.Button,{variant:"text",onClick:S,children:"Retry?"})]}),de=()=>{if(C)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:v.jsx(I.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(x1,{})})})});if(m)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:ae})});if(o.length===0)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:pe})})},ee=()=>{if(C)return v.jsx(x1,{});if(m)return ae;if(o.length===0)return pe},he=Y=>{_&&B(Y)},fe=Y=>{i&&(i(Y),he(Y))},se=Y=>{const le=M===Y?void 0:Y;A(le),he(le)},oe=Y=>{if(!s)return;const le=M===n(Y);return v.jsxs(v.Fragment,{children:[v.jsxs(I.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>se(n(Y)),children:[le?v.jsx(Zu,{}):v.jsx(cg,{})," Show"," ",le?"Less":"More"]}),v.jsx(XD,{colSpan:r.length,isExpanded:n(Y)===M,obj:Y,renderExpand:ve=>s(ve),asMobileCard:!0})]})},ce=typeof _=="string"?_:F.grey[F.mode=="dark"?600:50],me=Y=>{const le=z===n(Y)?ce:"inherit";return{cursor:i?"pointer":"default",backgroundColor:le,...s?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===ce?sa(le,.1):ce}}}},J=F.grey[F.mode==="dark"?600:400],te=Y=>Y&&v.jsx(I.Tooltip,{title:Y,children:v.jsx(IR,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:L??J}})});return $&&!T?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(I.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:Y=>R(Y.target.value),fullWidth:!0,children:W.map(Y=>{if(Z(Y.fieldName))return v.jsx(I.MenuItem,{value:Y.sortName??Y.fieldName,children:Y.label??_n(Y.fieldName)},`${Y.key??"rowHeader"}-${Y.fieldName}`)})}),v.jsx(I.IconButton,{onClick:()=>{l&&R(l)},children:v.jsx(HR,{className:`sort-icon-${u}`})})]}),v.jsx(I.Divider,{sx:{margin:"10px 0"}})]}),ee()??o.map(Y=>v.jsxs(I.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...me(Y)},onClick:()=>fe(n(Y)),"data-testid":`card-${n(Y)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:W.map(le=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${le.fieldName}`,style:{textWrap:"nowrap"},children:[le.label??_n(le.fieldName),te(le.tooltip)]}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${le.fieldName}`,style:{paddingLeft:"10px"},children:G(le,Y)})]},`${le.key??"row"}-${n(Y)}-${le.fieldName}`))})}),oe(Y)]},n(Y)))]}):v.jsx(I.TableContainer,{component:I.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:y,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(I.Table,{stickyHeader:E!=="undefined",style:{tableLayout:g?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...N,children:[v.jsx(I.TableHead,{className:"MBv2_Table_Head",children:v.jsx(I.TableRow,{className:"MBv2_Table_Head_Row",children:W.map((Y,le)=>{const ve=Z(Y.fieldName);return v.jsx(I.TableCell,{width:Array.isArray(g)?g[le]:"auto",sx:Y.tableCellSx??{},children:v.jsx(I.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(I.Box,{sx:[ve&&{"&:hover":{cursor:"pointer",backgroundColor:F.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:ve?()=>R(Y.sortName??Y.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:Y.label??_n(Y.fieldName)}),te(Y.tooltip),ve&&V(Y.fieldName)==="asc"&&v.jsx(Zu,{style:{marginLeft:"5px"}}),ve&&V(Y.fieldName)==="desc"&&v.jsx(cg,{style:{marginLeft:"5px"}}),ve&&V(Y.fieldName)!=="asc"&&V(Y.fieldName)!=="desc"&&v.jsx(RR,{style:{marginLeft:"5px"}})]})})},`${Y.key??"rowHeader"}-${Y.fieldName}`)})})}),v.jsx(I.TableBody,{className:"MBv2_Table_Body",children:de()??o.map(Y=>v.jsxs(X.Fragment,{children:[v.jsx(I.TableRow,{"data-testid":`row-${n(Y)}`,className:"MBv2_Table_Body_Row",onClick:()=>fe(n(Y)),sx:me(Y),children:W.map(le=>v.jsx(I.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${le.fieldName}`,children:G(le,Y)},`${le.key??"row"}-${n(Y)}-${le.fieldName}`))}),s&&v.jsx(XD,{colSpan:W.length,isExpanded:n(Y)===M,obj:Y,renderExpand:le=>s(le),reRenderExpand:O})]},n(Y)))})]})})},eP=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))},b=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),m=!t.data||t.data&&t.data.length===0;return v.jsxs(I.Box,{children:[v.jsx(QD,{sortOrder:p,sortField:f,...s}),!o&&!m&&v.jsx(I.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:b?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>g(C),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},tP=()=>({height:window.innerHeight,width:window.innerWidth}),nP=()=>{const[t,e]=X.useState(tP());return X.useEffect(()=>{const n=()=>{e(tP())};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}=nP(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(I.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...Jn({...t},a)})},Pte=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(I.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(I.Box,{component:I.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(I.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(I.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(HC,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Nte=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(I.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(I.Box,{component:I.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(I.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(I.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(Kh,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Lte=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:b=()=>{},condenseTable:m=!1,canSelect:S=!1,canLaunchUrl:C,addlActions:T,readOnly:_=!1,showCloseBtn:w=!1}=t,E=!!t.canCreate&&!_,O=!!t.canEdit&&!_,L=!!t.canDelete&&!_,{palette:N}=I.useTheme(),[F,M]=X.useState([]),[A,z]=X.useState(!1),[B,R]=X.useState(!0),[V,$]=X.useState(null),[W,q]=X.useState(null),[G,U]=X.useState(null),[Z,pe]=X.useState({pageNo:0,pageSize:m?5:10,totalCount:0}),ae=()=>{z(!1),R(!0),p({pageNo:Z.pageNo,pageSize:Z.pageSize}).then(J=>(M(J.data),pe({...Z,totalCount:J.totalCount}),J)).catch(J=>{b(J),z(!0),M([])}).finally(()=>R(!1))};X.useEffect(ae,[Z.pageNo,Z.pageSize,e]);const de=()=>{q(null),U(null),$(null)},ee=v.jsx(Ur,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:v.jsx(Xu,{}),children:"Add Citation"}),he=v.jsx(Ur,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:v.jsx(VC,{}),children:"Add Attachment"}),fe=J=>{if(!(!O&&!_)&&!(_&&!m))return v.jsx(I.Tooltip,{title:_?"View":"Edit",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>J.fileName?a(J):s(J),"data-testid":`citation-table_edit-btn-${J.id}`,children:_?v.jsx(KR,{}):v.jsx(hR,{})})})},se=J=>{if(!(!L||_))return v.jsx(I.Tooltip,{title:"Delete",children:v.jsx(I.IconButton,{color:"error",onClick:te=>{q(J),$(te.currentTarget)},"data-testid":`citation-table_delete-btn-${J.id}`,children:v.jsx(Kh,{})})})},oe=J=>!u&&!C?void 0:J.fileName?v.jsx(I.Tooltip,{title:"Download",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(J),"data-testid":`citation-table_download-btn-${J.id}`,sx:{visibility:u?"visible":"hidden"},children:v.jsx(pR,{})})}):v.jsx(I.Tooltip,{title:"Open URL",children:v.jsx(I.IconButton,{color:"primary",onClick:Y=>{$(Y.currentTarget),U(J)},"data-testid":`citation-table_launch-link-btn-${J.id}`,sx:{visibility:C!=null&&C(J)?"visible":"hidden"},children:v.jsx(HC,{})})}),me=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(J,te)=>v.jsx(I.Checkbox,{"data-testid":`citation-table_checkbox-${J}`,onChange:()=>{const Y=g.includes(te.id);y(Y?g.filter(le=>le!==te.id):[...g,te.id])},checked:g.includes(J),disabled:_})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(J,te)=>v.jsx(I.Tooltip,{title:J?"Attachment":"URL",children:J?v.jsx(VC,{sx:{color:N.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${te.id}`}):v.jsx(Xu,{sx:{color:N.grey[500],marginTop:"6px"},"data-testid":`url-icon-${te.id}`})})},{fieldName:"title",tableCellSx:{width:m?"100%":"auto"}},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:m,render:(J,te)=>v.jsx("span",{style:{wordBreak:"break-all"},children:J||te.url})},{fieldName:"source",hideCol:m},{fieldName:"accessedAt",hideCol:m,render:(J,te)=>{if(!te.fileName)return(J==null?void 0:J.slice(0,10))??""}},{fieldName:"classification",hideCol:m},{fieldName:"id",key:"Action",label:"Action",hideCol:!(_||O||L||C||u||T),render:(J,te)=>v.jsxs(I.Box,{display:"flex",flexDirection:"row",children:[oe(te),fe(te),se(te),T==null?void 0:T(te)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(I.Typography,{variant:m?"h6":"h2",children:n}),!S&&E&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",gap:1,children:[ee,he]}),w&&v.jsx(I.IconButton,{onClick:r,children:v.jsx(Ju,{})})]}),v.jsx(eP,{"data-testid":"citation-table",size:m?"x-small":"medium",isLoading:B,columns:me,data:F,paginationState:Z,onPageChange:J=>pe({...Z,pageNo:J}),onRowsPerPageChange:J=>pe({...Z,pageSize:J,pageNo:0}),errorTableMsg:A?"Failed to load citations.":void 0,retryCallback:ae}),S&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(I.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:E&&v.jsxs(v.Fragment,{children:[ee,he]})}),!_&&v.jsxs(I.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(Pte,{citation:G,anchorEl:V,onClose:de}),v.jsx(Nte,{citation:W,anchorEl:V,onDeleteCitation:l,onClose:de})]})},S1=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(I.CircularProgress,{size:s,color:"inherit"}):null,...o})},Fte=t=>{const{title:e,onSave:n,onCancel:r,modifyCitation:o,readOnly:i=!1,showCloseBtn:s=!1}=t,a=X.useRef(null),[l,u]=X.useState(!1),[f,p]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});X.useEffect(()=>{o&&p({...o,type:"Url"})},[]);const g=()=>{var b,m,S;const y=(m=(b=a==null?void 0:a.current)==null?void 0:b.values)==null?void 0:m.url;y&&((S=a==null?void 0:a.current)==null||S.setFieldValue("url",cA(y)))};return v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(I.Typography,{variant:"h6",margin:"10px 0",children:e}),s&&v.jsx(I.IconButton,{onClick:r,children:v.jsx(Ju,{})})]}),v.jsx(jt.Formik,{innerRef:a,enableReinitialize:!0,initialValues:f,onSubmit:async y=>{u(!0),n(y).catch(b=>{throw u(!1),b}).finally(()=>u(!1))},children:v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsxs(I.Box,{display:"flex",flexDirection:"column",gap:i?1:0,children:[v.jsx(us,{name:"source",disabled:l,required:!0,margin:"none",readOnly:i}),v.jsx(us,{name:"title",disabled:l,required:!0,margin:"none",readOnly:i}),v.jsx(Bd,{name:"accessedAt",disabled:l,required:!0,margin:"none",isDatePicker:!0,readOnly:i}),v.jsx(us,{name:"url",disabled:l,required:!0,onBlur:g,margin:"none",readOnly:i}),v.jsx(RC,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:i})]}),v.jsx(I.DialogActions,{sx:{px:0},children:i?v.jsx(I.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(S1,{size:"small",loading:l,children:o?"Update Citation":"Add New Citation"})]})})]})})]})};var C1,rP;function $te(){if(rP)return C1;rP=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);C1={Cache:t,split:p,normalizePath:f,setter:function(C){var T=f(C);return l.get(C)||l.set(C,function(w,E){for(var O=0,L=T.length,N=w;O<L-1;){var F=T[O];if(F==="__proto__"||F==="constructor"||F==="prototype")return w;N=N[T[O++]]}N[T[O]]=E})},getter:function(C,T){var _=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,L=_.length;O<L;)if(E!=null||!T)E=E[_[O++]];else return;return E})},join:function(C){return C.reduce(function(T,_){return T+(y(_)||n.test(_)?"["+_+"]":(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(T){return T.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function g(C,T,_){var w=C.length,E,O,L,N;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),N=y(E),L=!N&&/^\d+$/.test(E),T.call(_,E,N,L,O,C))}function y(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function b(C){return C.match(r)&&!C.match(n)}function m(C){return o.test(C)}function S(C){return!y(C)&&(b(C)||m(C))}return C1}var Us=$te(),w1,oP;function Bte(){if(oP)return w1;oP=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 w1={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(" ")},w1}var _1=Bte(),Ep={exports:{}},iP;function Rte(){if(iP)return Ep.exports;iP=1,Ep.exports=function(o){return t(e(o),o)},Ep.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,b,m){if(m.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[b]){l[b]=!0;var C=f.get(y)||new Set;if(C=Array.from(C),b=C.length){m.add(y);do{var T=C[--b];g(T,p.get(T),m)}while(b);m.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 Ep.exports}var zte=Rte();const Vte=Zn(zte),Hte=Object.prototype.toString,jte=Error.prototype.toString,Wte=RegExp.prototype.toString,qte=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ute=/^Symbol\((.*)\)(.*)$/;function Kte(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function sP(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Kte(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return qte.call(t).replace(Ute,"Symbol($1)");const r=Hte.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+jte.call(t)+"]":r==="RegExp"?Wte.call(t):null}function Ji(t,e){let n=sP(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=sP(this[r],e);return i!==null?i:o},2)}function aP(t){return t==null?[]:[].concat(t)}let lP,cP,uP,Yte=/\$\{\s*(\w+)\s*\}/g;lP=Symbol.toStringTag;class dP{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[lP]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],aP(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]}}cP=Symbol.hasInstance,uP=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(Yte,(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 dP(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[uP]="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[cP](e){return dP[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"},Gte={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"},T1={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Jte={isValue:"${path} field must be ${value}"},Mp={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:Lo,string:pr,number:Gte,date:T1,object:Mp,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:Jte,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 k1=t=>t&&t.__isYupSchema__;class Op{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 Op(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(!k1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ap={context:"$",value:"."};class Ks{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]===Ap.context,this.isValue=this.key[0]===Ap.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ap.context:this.isValue?Ap.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Us.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}}Ks.prototype.__isYupRef=!0;const Ys=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:b,context:m,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function T(A){return Ks.isRef(A)?A.getValue(n,b,m):A}function _(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]=T(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:b,type:u,from:o.from,createError:_,resolve:T,options:o,originalValue:i,schema:s};const O=A=>{fr.isError(A)?w(A):A?l(null):w(_())},L=A=>{fr.isError(A)?w(A):a(A)};if(y&&Ys(n))return O(!0);let F;try{var M;if(F=f.call(E,n,E),typeof((M=F)==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(F).then(O,L)}}catch(A){L(A);return}O(F)}return e.OPTIONS=t,e}function Zte(t,e,n,r=n){let o,i,s;return e?(Us.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 Ip extends Set{describe(){const e=[];for(const n of this.values())e.push(Ks.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 Ip(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(k1(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 Ip,this._blacklist=new Ip,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&&Ys(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=m=>{o||(o=!0,n(m,s))},p=m=>{o||(o=!0,r(m,s))},g=i.length,y=[];if(!g)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let m=0;m<i.length;m++){const S=i[m];S(b,f,function(T){T&&(Array.isArray(T)?y.push(...T):y.push(T)),--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=aP(e).map(i=>new Ks(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Op(o,n):Op.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}=Zte(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 Xte=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Qte(t){const e=E1(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 E1(t){var e,n;const r=Xte.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 ene=/^[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])?)*$/,tne=/^((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,nne=/^(?:[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,rne="^\\d{4}-\\d{2}-\\d{2}",one="\\d{2}:\\d{2}:\\d{2}",ine="(([+-]\\d{2}(:?\\d{2})?)|Z)",sne=new RegExp(`${rne}T${one}(\\.\\d+)?${ine}$`),ane=t=>Ys(t)||t===t.trim(),lne={}.toString();function M1(){return new fP}class fP 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===lne?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(ene,{name:"email",message:e,excludeEmptyString:!0})}url(e=pr.url){return this.matches(tne,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=pr.uuid){return this.matches(nne,{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(sne,{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=E1(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=E1(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:ane})}lowercase(e=pr.lowercase){return this.transform(n=>Ys(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ys(n)||n===n.toLowerCase()})}uppercase(e=pr.uppercase){return this.transform(n=>Ys(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ys(n)||n===n.toUpperCase()})}}M1.prototype=fP.prototype;let cne=new Date(""),une=t=>Object.prototype.toString.call(t)==="[object Date]";class Dp extends Fo{constructor(){super({type:"date",check(e){return une(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Qte(e),isNaN(e)?Dp.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ks.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=T1.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=T1.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)}})}}Dp.INVALID_DATE=cne,Dp.prototype;function dne(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Us.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),Ks.isRef(a)&&a.isSibling?i(a.path,s):k1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Vte.array(Array.from(r),n).reverse()}function pP(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 hP(t){return(e,n)=>pP(t,e)-pP(t,n)}const fne=(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 Pp(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Pp(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Pp(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Pp)}):"optional"in t?t.optional():t}const pne=(t,e)=>{const n=[...Us.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Us.getter(Us.join(n),!0)(t);return!!(o&&r in o)};let gP=t=>Object.prototype.toString.call(t)==="[object Object]";function mP(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const hne=hP([]);function yP(t){return new bP(t)}class bP extends Fo{constructor(e){super({type:"object",check(n){return gP(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=hne,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 b,m=o[p];u.path=(n.path?`${n.path}.`:"")+p,g=g.resolve({value:m,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}b=!n.__validating||!C?g.cast(o[p],u):o[p],b!==void 0&&(l[p]=b)}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||!gP(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let g=this.fields[p];!g||Ks.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=dne(e,n),r._sortErrors=hP(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 Pp(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=Us.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return pne(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(fne)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Mp.exact,test(n){if(n==null)return!0;const r=mP(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Mp.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=mP(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Mp.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(_1.camelCase)}snakeCase(){return this.transformKeys(_1.snakeCase)}constantCase(){return this.transformKeys(e=>_1.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}}yP.prototype=bP.prototype;const gne=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{i&&g({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(I.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(I.IconButton,{onClick:r,children:v.jsx(Ju,{})})]}),v.jsx(jt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:p,validationSchema:yP().shape({title:M1().required("Title is required"),fileName:M1().required("A file is required")}),onSubmit:async y=>{f(!0),n(y).catch(b=>{throw f(!1),b}).finally(()=>f(!1))},children:({values:y,setFieldValue:b})=>{var m;return X.useEffect(()=>{var S,C;(S=y.file)!=null&&S.name&&b("fileName",(C=y.file)==null?void 0:C.name)},[(m=y.file)==null?void 0:m.name]),v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsx(us,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsxs(I.Box,{marginTop:o||s?0:1,children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[!o&&!s&&v.jsx(bC,{name:"file",errorMode:"hidden"}),v.jsx(us,{readOnly:!0,name:"fileName",label:s||o?"File Name":""})]}),v.jsx(sr,{name:"fileName"})]}),v.jsx(I.DialogActions,{sx:{px:0},children:s?v.jsx(I.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(S1,{size:"small",loading:u,children:i?"Update Attachment":"Upload 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(I.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},b=()=>{if(i)return v.jsx(I.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(I.Box,{children:y()}),v.jsxs(I.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(I.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(I.Box,{children:y()})})};return v.jsxs(I.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(I.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,g&&v.jsx(I.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Ju,{})})]})}):r,o&&(typeof o=="string"?v.jsx(I.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(I.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),b()]})};function mne(t){return Ke("MuiAlert",t)}const vP=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"]),yne=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"),bne=Fe(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),vne=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"),xne=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"),Sne=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"),Cne=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,mne,o)},wne=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"?sa:Ol,n=t.palette.mode==="light"?Ol:sa;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),[`& .${vP.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}`,[`& .${vP.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)}}}))]}})),_ne=be("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Tne=be("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),kne=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}),xP={success:v.jsx(yne,{fontSize:"inherit"}),warning:v.jsx(bne,{fontSize:"inherit"}),error:v.jsx(vne,{fontSize:"inherit"}),info:v.jsx(xne,{fontSize:"inherit"})},SP=D.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=xP,onClose:y,role:b="alert",severity:m="success",slotProps:S={},slots:C={},variant:T="standard",..._}=r,w={...r,color:l,severity:m,variant:T,colorSeverity:l||m},E=Cne(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[L,N]=zt("root",{ref:n,shouldForwardComponentProp:!0,className:Le(E.root,s),elementType:wne,externalForwardedProps:{...O,..._},ownerState:w,additionalProps:{role:b,elevation:0}}),[F,M]=zt("icon",{className:E.icon,elementType:_ne,externalForwardedProps:O,ownerState:w}),[A,z]=zt("message",{className:E.message,elementType:Tne,externalForwardedProps:O,ownerState:w}),[B,R]=zt("action",{className:E.action,elementType:kne,externalForwardedProps:O,ownerState:w}),[V,$]=zt("closeButton",{elementType:Sa,externalForwardedProps:O,ownerState:w}),[W,q]=zt("closeIcon",{elementType:Sne,externalForwardedProps:O,ownerState:w});return v.jsxs(L,{...N,children:[p!==!1?v.jsx(F,{...M,children:p||g[m]||xP[m]}):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,...$,children:v.jsx(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(SP.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}=I.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(SP,{severity:r,variant:f,sx:p,slotProps:g,...u,...a,children:[s&&v.jsx(I.Typography,{variant:"h3",children:s}),n]})},CP=t=>v.jsx(iu,{severity:"error",...t}),wP=t=>v.jsx(iu,{severity:"success",...t}),Ene=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(CP,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(wP,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function _P({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,readOnly:b}){const[m,S]=X.useState("Insert Citation/Attachment(s)"),[C,T]=X.useState(l),[_,w]=X.useState(void 0),[E,O]=X.useState(void 0),L=ae=>{O(void 0),S(ae)},[N,F]=X.useState(0);X.useEffect(()=>{u==null||u()},[m,E,u]);const M=(ae=!1)=>{(!p||ae)&&F(de=>de+1)},A=(ae,de)=>{var se;const ee=typeof((se=de.response)==null?void 0:se.data)=="string"&&de.response.data,he=typeof de.message=="string"&&de.message;O({type:"Error",title:ae,message:ee??he}),f(de)},z=ae=>O({type:"Success",title:"",message:ae}),B=async ae=>{if(m==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(m==="Edit Citation"||m==="Edit Attachment"){if(ae.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ae).then(()=>{L("Insert Citation/Attachment(s)"),M()}).catch(ee=>{A("Failed to update",ee)}))}else await(e==null?void 0:e(ae).then(ee=>{T([...C,ee.id]),L("Insert Citation/Attachment(s)"),M()}).catch(ee=>{A("Failed to create",ee)}))},R=r&&(async ae=>r(ae).then(()=>{M(!0),T(C.filter(de=>de!==ae)),z("Successfully deleted")}).catch(de=>A("Failed to delete",de))),V=(ae,de)=>{o(ae.id).then(ee=>{w(ee),L(de)}).catch(ee=>{A("Failed to load",ee)})},$=i&&(async ae=>i(ae).catch(de=>{A(`Failed to download ${ae.fileName}`,de)})),W=v.jsx(Lte,{refreshKey:N,getCitationsPaginated:ae=>t(ae).then(de=>(u==null||u(),de)),onCancel:a,onNewCitation:()=>{w(void 0),L("Add Citation")},onNewAttachment:()=>{w(void 0),L("Add Attachment")},onEditCitation:ae=>V(ae,b?"View Citation":"Edit Citation"),onEditAttachment:ae=>V(ae,b?"View Attachment":"Edit Attachment"),onDeleteCitation:R,onDownloadAttachment:$,onSelect:s,setSelectedIds:T,selectedIds:C,onError:f,condenseTable:p,canSelect:p,title:p&&!b?m:"Attachments & Citations",addlActions:g,canCreate:!!e,canEdit:!!n,canDelete:!!R,canLaunchUrl:y,readOnly:b,showCloseBtn:p}),q=v.jsx(Fte,{modifyCitation:_,onSave:B,onCancel:()=>L("Insert Citation/Attachment(s)"),title:m,readOnly:m==="View Citation",showCloseBtn:p}),G=v.jsx(gne,{onSave:B,onCancel:()=>L("Insert Citation/Attachment(s)"),modifyCitation:_,disableFileUpload:m==="Edit Attachment",title:m,readOnly:m==="View Attachment",showCloseBtn:p}),U=v.jsx(Ene,{alert:E,setAlert:O}),Z=m==="Add Citation"||m==="Edit Citation"||m==="View Citation",pe=m==="Add Attachment"||m==="Edit Attachment"||m==="View Attachment";if(p){let ae=null;return!p||m==="Insert Citation/Attachment(s)"?ae=W:Z?ae=q:pe&&(ae=G),v.jsxs(I.Box,{width:"500px",children:[U,v.jsx(I.Box,{paddingTop:"8px",children:ae})]})}return v.jsxs(I.Box,{width:"100%",children:[m==="Insert Citation/Attachment(s)"&&U,v.jsx(I.Box,{paddingTop:"8px",children:W}),v.jsx(ou,{open:Z||pe,children:v.jsxs(I.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[U,Z?q:G]})})]})}function TP({...t}){return v.jsx(_P,{renderAsSelectablePopup:!0,...t})}const Mne=Ut({name:{CitationBubbleMenuTipTap:kP}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function kP({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,readOnly:a,...l}){const{classes:u}=Mne(),f=bt();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,g=p.isOpen,y=p.selectedIds,b=p.selectedNodePos,m=_=>{f&&(_.length===0?f.commands.deleteCitation(b):y.length===0?f.commands.insertCitation({ids:_}):f.commands.updateCitation({ids:_},b))},S=_=>{m(_),f==null||f.commands.closeCitationBubbleMenu()},C=()=>{m(y),f==null||f.commands.closeCitationBubbleMenu()},T=X.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?v.jsx(Df,{editor:f,open:g,...p.bubbleMenuOptions,...l,children:v.jsx("div",{className:u.content,children:v.jsx(TP,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:S,onCancel:C,initialSelectedIds:y,onContentChange:T,canLaunchUrl:s,readOnly:a})})}):null}const One=sn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(sD.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(iD.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(cD.configure(this.options.bulletList)),this.options.code!==!1&&t.push(uD.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(dD.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(fD.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(pD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(hD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(gD.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(II.configure(this.options.heading)),this.options.history!==!1&&t.push(CD.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(wD.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(_D.configure(this.options.italic)),this.options.listItem!==!1&&t.push(VD.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(WD.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(qD.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(KD.configure(this.options.strike)),this.options.text!==!1&&t.push(YD.configure(this.options.text)),t}}),Ane=()=>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 Ine(t){const e=bt(),n=X.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(I.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(lR,{fontSize:"small"}),v.jsx(I.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const EP=X.createContext(void 0),MP=()=>{const t=X.useContext(EP);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Dne=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=MP(),[u,f]=X.useState(String(s)),[p,g]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const b=a.filter(C=>s.includes(C.id)),m=b.map(C=>Ku.truncate(C.title,{length:y,omission:"..."})).join(", ");f(m),g(b);const S=b.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:b.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(xv,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(I.Tooltip,{title:v.jsx(I.Box,{className:"citation-tooltip",children:p.map((b,m)=>{var C;const S=[b.source,b.title,b.fileName,b.url,(C=b.accessedAt)==null?void 0:C.slice(0,10),b.classification];return v.jsxs(I.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),m<p.length-1&&v.jsx(I.Divider,{className:"citation-tooltip-divider"})]},b.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:b=>{b.preventDefault(),b.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Pne=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 Sv(Dne)},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}}}}),OP=t=>v.jsx(mC,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Nne=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:b=()=>{},placeholder:m="Start typing here...",notApplicableName:S,errorMode:C="normal",canLaunchUrl:T}=t,_=[One,UD.configure({placeholder:m}),Ane(),Pne.configure({citationMaxLength:a})],[w,E,O]=jt.useField({name:e}),{setValue:L}=O,{value:N}=w,{addUpdateCitation:F,deleteCitation:M,batchUpdate:A}=MP();X.useEffect(()=>{var q;const $=(q=z==null?void 0:z.current)==null?void 0:q.editor;if(!$)return;$.getHTML()!==N&&setTimeout(()=>{$.commands.setContent(N)},0)},[N]);const z=X.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},R=()=>{var q,G;const $=((G=(q=z.current)==null?void 0:q.editor)==null?void 0:G.getHTML())??"",W=!$.replace(/<\/?p>|<br>/g,"").trim();L(W?"":$)},V=v.jsxs(I.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...B[s],children:[v.jsx(lI,{ref:z,extensions:_,content:N,editable:!i,renderControls:i?void 0:()=>v.jsx(Ff,{children:v.jsx(Ine,{})}),onBlur:R,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(kP,{getCitationsPaginated:$=>l($).then(W=>(A(W.data),W)),onCreateCitation:u&&($=>u($).then(W=>(F(W),W))),onUpdateCitation:f&&($=>f($).then(W=>(F(W),W))),onDeleteCitation:p&&($=>p($).then(()=>M($))),getCitationById:g,onDownloadAttachment:y,onError:b,canLaunchUrl:T,readOnly:i})}),v.jsx(sr,{name:e,id:`${e}-err`,errorMode:C})]});return v.jsxs(I.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(I.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(OP,{name:S})]}),V]})},Lne=t=>{const{name:e="submit"}=t;return v.jsx(Ur,{name:e,type:"submit",...t})},Fne=t=>{const{label:e="Return to Top",icon:n=Zu,scrollThresholdPx:r=100}=t,o=I.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(I.Zoom,{in:o,children:v.jsx(I.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(I.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},$ne=()=>{const{values:t,errors:e,status:n}=jt.useFormikContext(),{palette:r}=I.useTheme();return v.jsx(I.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(I.List,{children:[v.jsxs(I.ListItem,{children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(I.Divider,{variant:"inset",component:"li"}),v.jsxs(I.ListItem,{id:"testing",children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(I.ListItem,{children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Bne=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=nP();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(I.Stepper,{...u,children:e.map(f=>v.jsx(I.Step,{children:v.jsx(I.StepLabel,{children:f})},f))})},Rne=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(zR,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:g=!1,emptyListMsg:y="None",showDivider:b=!1,removePosition:m="bottom"}=t,[S]=jt.useField({name:e}),{value:C}=S,T=_=>({display:"flex",flexDirection:_==="bottom"?"column":"row",alignItems:_==="bottom"?"flex-start":"center"});return v.jsxs(I.FormControl,{fullWidth:!0,children:[v.jsx(I.Typography,{...r,children:n}),g&&S.value.length===0?v.jsx(I.Typography,{children:y}):v.jsx(jt.FieldArray,{name:e,render:_=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(X.Fragment,{children:v.jsx(zne,{variant:l,content:v.jsxs(I.Box,{"data-testid":"form-group-container",sx:typeof m=="string"?T(m):{...m},children:[v.jsxs(I.Box,{width:"100%",children:[i(`${e}.${E}`,E),b&&E!==C.length-1&&v.jsx(I.Divider,{"data-testid":"divider"})]}),!g&&C.length>(p?0:1)&&v.jsx(I.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>_.remove(E),children:a})]})})},`${e}-${E}`)),!g&&v.jsx(I.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>_.push(o),sx:u,children:s})]})})]})},zne=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(I.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(I.CardContent,{children:e})});case"elevatedCard":return v.jsx(I.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(I.CardContent,{children:e})});case"none":return e}},Vne=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(I.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Hne=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})},jne=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(I.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(I.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Wne=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=I.useTheme(),a=to.useNavigate();return v.jsxs(I.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(I.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(I.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(I.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(I.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...vl(l,a),children:l.label},l.label))}),n&&v.jsx(I.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},AP=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=to.useLocation(),i=to.useNavigate(),[s,a]=X.useState(!1),l=(g,y)=>v.jsx(I.MenuList,{children:g.map(b=>v.jsxs(I.MenuItem,{...vl(b,i,()=>a(!1)),children:[b.icon&&v.jsx(I.ListItemIcon,{children:b.icon}),v.jsx(I.ListItemText,{primary:b.label})]},`mobile-drawer-group-${y}-item-${b.path}`))}),f=(()=>{if(e){const g=e.filter(y=>y&&y.length>0);return g.length===0?null:g.map((y,b)=>v.jsxs(X.Fragment,{children:[l(y,b),b<g.length-1&&v.jsx(I.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(I.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(I.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(LR,{})}),v.jsx(I.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(I.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(I.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},IP=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(I.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(I.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},DP=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=to.useNavigate(),[i,s]=D.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(I.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(I.MenuItem,{...vl(f,o),children:[f.icon&&v.jsx(I.ListItemIcon,{children:f.icon}),v.jsx(I.ListItemText,{primary:f.label})]},f.label))})]})},PP=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(DP,{label:e,menuOptions:n,icon:v.jsx($R,{})})},Np=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}=I.useTheme(),a=to.useNavigate();return v.jsx(I.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(I.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))})},NP=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(I.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Np,{menuOptions:e,activeTabIdx:n,sx:r})})},LP=t=>{const{onToggle:e}=t,{palette:n}=I.useTheme(),r=n.mode==="dark";return v.jsx(I.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(jC,{}):v.jsx(zC,{})})},qne=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,b=to.useNavigate(),m=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),{palette:S}=I.useTheme(),{pathname:C}=to.useLocation(),T=S.mode==="dark",[_,w]=D.useState(void 0);D.useEffect(()=>{const L=o.findIndex(N=>N.path&&C.startsWith(N.path));w(L>=0?L:void 0)},[C,o]);const E=s&&v.jsx(LP,{onToggle:s}),O=s&&(m||!m&&l)?[{icon:T?v.jsx(jC,{}):v.jsx(zC,{}),label:`Switch to ${T?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(I.AppBar,{ref:n,position:f,sx:g,elevation:4,children:[e&&v.jsx(IP,{...e}),u,v.jsxs(I.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(I.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(I.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!m&&E,m&&v.jsx(AP,{menuOptionLists:[o,a,O],anchor:"right"}),!m&&v.jsxs(v.Fragment,{children:[v.jsx(I.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((L,N)=>v.jsxs(I.Box,{display:"flex",alignItems:"center",children:[N>0&&v.jsx(I.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(I.Button,{variant:"text",sx:{color:"white"},...vl(L,b),children:v.jsxs(I.Box,{display:"flex",gap:"3px",alignItems:"center",children:[L.icon,L.label]})})]},L.label))}),p,l&&v.jsx(PP,{displayName:l,userMenuOptions:O})]})]})]}),!m&&v.jsx(NP,{featureMenuOptions:o,activeTabIdx:_,sx:y})]})},Une=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=to.useLocation(),o=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),[i,s]=X.useState(void 0);return X.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(I.Box,{sx:e,children:v.jsx(I.Card,{sx:{height:"100%",width:200},children:v.jsx(Np,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Kne=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=I.useTheme();return e.length>0&&v.jsx(Np,{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}})},Yne=t=>v.jsx(iu,{severity:"info",...t}),Gne=t=>v.jsx(iu,{severity:"warning",...t}),FP=t=>{const{crumbInfo:e}=t,n=to.useNavigate();return v.jsx(I.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(FR,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(I.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(I.Typography,{color:"primary",children:r},r))})},Jne=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Zne(r);return v.jsx(I.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:$P(r),warning:$P(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(I.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Zne=t=>t=="logout"?"info":t=="timeout"?"warning":t,$P=t=>{if(t=="timeout")return v.jsx(iR,{});if(t=="logout")return v.jsx(NR,{})},Xne=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=I.useMediaQuery(I.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(I.Box,{sx:a,children:[i.length>0&&v.jsx(FP,{crumbInfo:i}),v.jsxs(I.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(I.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(I.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(Ur,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(sR,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(I.Box,{width:l?"100%":"50%",children:s})]})]})},Qne=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=I.useMediaQuery(I.useTheme().breakpoints.down("sm"));return v.jsxs(I.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(I.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(I.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(I.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function ere({...t}){return v.jsx(_P,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const tre=({children:t,getCitations:e})=>{const[n,r]=X.useState([]),[o,i]=X.useState(!1);X.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const g=new Set(p.map(b=>b.id));return[...p.filter(b=>!g.has(b.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(b=>{const m=u.find(S=>S.id===b.id);return m||b}),g=new Set(f.map(b=>b.id)),y=u.filter(b=>!g.has(b.id));return[...p,...y]})},[]),a=X.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=X.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(EP.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},nre=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(I.Box,{height:n})};Ie.AlertModal=Hne,Ie.Autocomplete=hC,Ie.Breadcrumbs=FP,Ie.Button=Ur,Ie.Checkbox=mC,Ie.CheckboxGroup=BB,Ie.CitationField=Nne,Ie.CitationFieldProvider=tre,Ie.CitationManager=ere,Ie.ConfirmationModal=Vne,Ie.DarkModeToggle=LP,Ie.DateField=Bd,Ie.DateRangeField=aq,Ie.DecisionModal=jne,Ie.Drawer=AP,Ie.DynamicAutocomplete=FB,Ie.EnvironmentBanner=IP,Ie.ErrorAlert=CP,Ie.FileList=zB,Ie.FileUpload=bC,Ie.FloatingNavBar=Kne,Ie.Footer=Wne,Ie.FormDebugger=$ne,Ie.Header=qne,Ie.InfoAlert=Yne,Ie.LoadingButton=S1,Ie.LoadingIndicator=x1,Ie.Location=tR,Ie.MenuButton=DP,Ie.Modal=ou,Ie.MultiAutocomplete=$B,Ie.NavBar=NP,Ie.NotApplicableCheckbox=OP,Ie.PageHeader=Xne,Ie.PaginatedTable=eP,Ie.ProfileMenu=PP,Ie.RadioGroup=RC,Ie.RangeSlider=nR,Ie.RepeatableFormGroup=Rne,Ie.RichTextField=Dte,Ie.ScrollToTop=Fne,Ie.SearchField=YR,Ie.Select=rR,Ie.SelectableCitationManager=TP,Ie.Sidebar=Une,Ie.SingleActionCard=Qne,Ie.Snackbar=Jne,Ie.Spacer=nre,Ie.Stepper=Bne,Ie.Submit=Lne,Ie.SuccessAlert=wP,Ie.Switch=oR,Ie.Table=QD,Ie.Tabs=Np,Ie.TextField=us,Ie.ValidationError=sr,Ie.WarningAlert=Gne,Ie.commonTheme=vn,Ie.darkTheme=RF,Ie.lightTheme=BF,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=m=>{o||(o=!0,n(m,s))},p=m=>{o||(o=!0,r(m,s))},g=i.length,y=[];if(!g)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let m=0;m<i.length;m++){const S=i[m];S(b,f,function(T){T&&(Array.isArray(T)?y.push(...T):y.push(T)),--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=aP(e).map(i=>new Ks(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Op(o,n):Op.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}=Zte(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 Xte=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Qte(t){const e=E1(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 E1(t){var e,n;const r=Xte.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 ene=/^[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])?)*$/,tne=/^((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,nne=/^(?:[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,rne="^\\d{4}-\\d{2}-\\d{2}",one="\\d{2}:\\d{2}:\\d{2}",ine="(([+-]\\d{2}(:?\\d{2})?)|Z)",sne=new RegExp(`${rne}T${one}(\\.\\d+)?${ine}$`),ane=t=>Ys(t)||t===t.trim(),lne={}.toString();function M1(){return new fP}class fP 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===lne?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(ene,{name:"email",message:e,excludeEmptyString:!0})}url(e=pr.url){return this.matches(tne,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=pr.uuid){return this.matches(nne,{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(sne,{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=E1(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=E1(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:ane})}lowercase(e=pr.lowercase){return this.transform(n=>Ys(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ys(n)||n===n.toLowerCase()})}uppercase(e=pr.uppercase){return this.transform(n=>Ys(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ys(n)||n===n.toUpperCase()})}}M1.prototype=fP.prototype;let cne=new Date(""),une=t=>Object.prototype.toString.call(t)==="[object Date]";class Dp extends Fo{constructor(){super({type:"date",check(e){return une(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Qte(e),isNaN(e)?Dp.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ks.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=T1.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=T1.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)}})}}Dp.INVALID_DATE=cne,Dp.prototype;function dne(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Us.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),Ks.isRef(a)&&a.isSibling?i(a.path,s):k1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Vte.array(Array.from(r),n).reverse()}function pP(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 hP(t){return(e,n)=>pP(t,e)-pP(t,n)}const fne=(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 Pp(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Pp(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Pp(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Pp)}):"optional"in t?t.optional():t}const pne=(t,e)=>{const n=[...Us.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Us.getter(Us.join(n),!0)(t);return!!(o&&r in o)};let gP=t=>Object.prototype.toString.call(t)==="[object Object]";function mP(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const hne=hP([]);function yP(t){return new bP(t)}class bP extends Fo{constructor(e){super({type:"object",check(n){return gP(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=hne,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 b,m=o[p];u.path=(n.path?`${n.path}.`:"")+p,g=g.resolve({value:m,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}b=!n.__validating||!C?g.cast(o[p],u):o[p],b!==void 0&&(l[p]=b)}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||!gP(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let g=this.fields[p];!g||Ks.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=dne(e,n),r._sortErrors=hP(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 Pp(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=Us.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return pne(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(fne)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Mp.exact,test(n){if(n==null)return!0;const r=mP(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Mp.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=mP(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Mp.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(_1.camelCase)}snakeCase(){return this.transformKeys(_1.snakeCase)}constantCase(){return this.transformKeys(e=>_1.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}}yP.prototype=bP.prototype;const gne=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{i&&g({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(I.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(I.IconButton,{onClick:r,children:v.jsx(Ju,{})})]}),v.jsx(jt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:p,validationSchema:yP().shape({title:M1().required("Title is required"),fileName:M1().required("A file is required")}),onSubmit:async y=>{f(!0),n(y).catch(b=>{throw f(!1),b}).finally(()=>f(!1))},children:({values:y,setFieldValue:b})=>{var m;return X.useEffect(()=>{var S,C;(S=y.file)!=null&&S.name&&b("fileName",(C=y.file)==null?void 0:C.name)},[(m=y.file)==null?void 0:m.name]),v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsx(us,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsxs(I.Box,{marginTop:o||s?0:1,children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[!o&&!s&&v.jsx(bC,{name:"file",errorMode:"hidden"}),v.jsx(us,{readOnly:!0,name:"fileName",label:s||o?"File Name":""})]}),v.jsx(sr,{name:"fileName"})]}),v.jsx(I.DialogActions,{sx:{px:0},children:s?v.jsx(I.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(S1,{size:"small",loading:u,children:i?"Update Attachment":"Upload 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(I.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},b=()=>{if(i)return v.jsx(I.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(I.Box,{children:y()}),v.jsxs(I.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(I.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(I.Box,{children:y()})})};return v.jsxs(I.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(I.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,g&&v.jsx(I.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Ju,{})})]})}):r,o&&(typeof o=="string"?v.jsx(I.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(I.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),b()]})};function mne(t){return Ke("MuiAlert",t)}const vP=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"]),yne=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"),bne=Fe(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),vne=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"),xne=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"),Sne=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"),Cne=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,mne,o)},wne=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"?sa:Ol,n=t.palette.mode==="light"?Ol:sa;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),[`& .${vP.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}`,[`& .${vP.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)}}}))]}})),_ne=be("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Tne=be("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),kne=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}),xP={success:v.jsx(yne,{fontSize:"inherit"}),warning:v.jsx(bne,{fontSize:"inherit"}),error:v.jsx(vne,{fontSize:"inherit"}),info:v.jsx(xne,{fontSize:"inherit"})},SP=D.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=xP,onClose:y,role:b="alert",severity:m="success",slotProps:S={},slots:C={},variant:T="standard",..._}=r,w={...r,color:l,severity:m,variant:T,colorSeverity:l||m},E=Cne(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[L,N]=zt("root",{ref:n,shouldForwardComponentProp:!0,className:Le(E.root,s),elementType:wne,externalForwardedProps:{...O,..._},ownerState:w,additionalProps:{role:b,elevation:0}}),[F,M]=zt("icon",{className:E.icon,elementType:_ne,externalForwardedProps:O,ownerState:w}),[A,z]=zt("message",{className:E.message,elementType:Tne,externalForwardedProps:O,ownerState:w}),[B,R]=zt("action",{className:E.action,elementType:kne,externalForwardedProps:O,ownerState:w}),[V,$]=zt("closeButton",{elementType:Sa,externalForwardedProps:O,ownerState:w}),[W,q]=zt("closeIcon",{elementType:Sne,externalForwardedProps:O,ownerState:w});return v.jsxs(L,{...N,children:[p!==!1?v.jsx(F,{...M,children:p||g[m]||xP[m]}):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,...$,children:v.jsx(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(SP.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}=I.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(SP,{severity:r,variant:f,sx:p,slotProps:g,...u,...a,children:[s&&v.jsx(I.Typography,{variant:"h3",children:s}),n]})},CP=t=>v.jsx(iu,{severity:"error",...t}),wP=t=>v.jsx(iu,{severity:"success",...t}),Ene=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(CP,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(wP,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function _P({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,readOnly:b}){const[m,S]=X.useState("Insert Citation/Attachment(s)"),[C,T]=X.useState(l),[_,w]=X.useState(void 0),[E,O]=X.useState(void 0),L=ae=>{O(void 0),S(ae)},[N,F]=X.useState(0);X.useEffect(()=>{u==null||u()},[m,E,u]);const M=(ae=!1)=>{(!p||ae)&&F(de=>de+1)},A=(ae,de)=>{var se;const ee=typeof((se=de.response)==null?void 0:se.data)=="string"&&de.response.data,he=typeof de.message=="string"&&de.message;O({type:"Error",title:ae,message:ee??he}),f(de)},z=ae=>O({type:"Success",title:"",message:ae}),B=async ae=>{if(m==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(m==="Edit Citation"||m==="Edit Attachment"){if(ae.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ae).then(()=>{L("Insert Citation/Attachment(s)"),M()}).catch(ee=>{A("Failed to update",ee)}))}else await(e==null?void 0:e(ae).then(ee=>{T([...C,ee.id]),L("Insert Citation/Attachment(s)"),M()}).catch(ee=>{A("Failed to create",ee)}))},R=r&&(async ae=>r(ae).then(()=>{M(!0),T(C.filter(de=>de!==ae)),z("Successfully deleted")}).catch(de=>A("Failed to delete",de))),V=(ae,de)=>{o(ae.id).then(ee=>{w(ee),L(de)}).catch(ee=>{A("Failed to load",ee)})},$=i&&(async ae=>i(ae).catch(de=>{A(`Failed to download ${ae.fileName}`,de)})),W=v.jsx(Lte,{refreshKey:N,getCitationsPaginated:ae=>t(ae).then(de=>(u==null||u(),de)),onCancel:a,onNewCitation:()=>{w(void 0),L("Add Citation")},onNewAttachment:()=>{w(void 0),L("Add Attachment")},onEditCitation:ae=>V(ae,b?"View Citation":"Edit Citation"),onEditAttachment:ae=>V(ae,b?"View Attachment":"Edit Attachment"),onDeleteCitation:R,onDownloadAttachment:$,onSelect:s,setSelectedIds:T,selectedIds:C,onError:f,condenseTable:p,canSelect:p,title:p&&!b?m:"Attachments & Citations",addlActions:g,canCreate:!!e,canEdit:!!n,canDelete:!!R,canLaunchUrl:y,readOnly:b,showCloseBtn:p}),q=v.jsx(Fte,{modifyCitation:_,onSave:B,onCancel:()=>L("Insert Citation/Attachment(s)"),title:m,readOnly:m==="View Citation",showCloseBtn:p}),G=v.jsx(gne,{onSave:B,onCancel:()=>L("Insert Citation/Attachment(s)"),modifyCitation:_,disableFileUpload:m==="Edit Attachment",title:m,readOnly:m==="View Attachment",showCloseBtn:p}),U=v.jsx(Ene,{alert:E,setAlert:O}),Z=m==="Add Citation"||m==="Edit Citation"||m==="View Citation",pe=m==="Add Attachment"||m==="Edit Attachment"||m==="View Attachment";if(p){let ae=null;return!p||m==="Insert Citation/Attachment(s)"?ae=W:Z?ae=q:pe&&(ae=G),v.jsxs(I.Box,{width:"500px",children:[U,v.jsx(I.Box,{paddingTop:"8px",children:ae})]})}return v.jsxs(I.Box,{width:"100%",children:[m==="Insert Citation/Attachment(s)"&&U,v.jsx(I.Box,{paddingTop:"8px",children:W}),v.jsx(ou,{open:Z||pe,children:v.jsxs(I.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[U,Z?q:G]})})]})}function TP({...t}){return v.jsx(_P,{renderAsSelectablePopup:!0,...t})}const Mne=Ut({name:{CitationBubbleMenuTipTap:kP}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function kP({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,readOnly:a,...l}){const{classes:u}=Mne(),f=bt();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,g=p.isOpen,y=p.selectedIds,b=p.selectedNodePos,m=_=>{f&&(_.length===0?f.commands.deleteCitation(b):y.length===0?f.commands.insertCitation({ids:_}):f.commands.updateCitation({ids:_},b))},S=_=>{m(_),f==null||f.commands.closeCitationBubbleMenu()},C=()=>{m(y),f==null||f.commands.closeCitationBubbleMenu()},T=X.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?v.jsx(Df,{editor:f,open:g,...p.bubbleMenuOptions,...l,children:v.jsx("div",{className:u.content,children:v.jsx(TP,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:S,onCancel:C,initialSelectedIds:y,onContentChange:T,canLaunchUrl:s,readOnly:a})})}):null}const One=sn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(sD.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(iD.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(cD.configure(this.options.bulletList)),this.options.code!==!1&&t.push(uD.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(dD.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(fD.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(pD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(hD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(gD.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(II.configure(this.options.heading)),this.options.history!==!1&&t.push(CD.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(wD.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(_D.configure(this.options.italic)),this.options.listItem!==!1&&t.push(VD.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(WD.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(qD.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(KD.configure(this.options.strike)),this.options.text!==!1&&t.push(YD.configure(this.options.text)),t}}),Ane=()=>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 Ine(t){const e=bt(),n=X.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(I.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(lR,{fontSize:"small"}),v.jsx(I.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const EP=X.createContext(void 0),MP=()=>{const t=X.useContext(EP);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Dne=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=MP(),[u,f]=X.useState(String(s)),[p,g]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const b=a.filter(C=>s.includes(C.id)),m=b.map(C=>Ku.truncate(C.title,{length:y,omission:"..."})).join(", ");f(m),g(b);const S=b.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:b.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(xv,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(I.Tooltip,{title:v.jsx(I.Box,{className:"citation-tooltip",children:p.map((b,m)=>{var C;const S=[b.source,b.title,b.fileName,b.url,(C=b.accessedAt)==null?void 0:C.slice(0,10),b.classification];return v.jsxs(I.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),m<p.length-1&&v.jsx(I.Divider,{className:"citation-tooltip-divider"})]},b.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:b=>{b.preventDefault(),b.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Pne=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 Sv(Dne)},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}}}}),OP=t=>v.jsx(mC,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Nne=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:b=()=>{},placeholder:m="Start typing here...",notApplicableName:S,errorMode:C="normal",canLaunchUrl:T}=t,_=[One,UD.configure({placeholder:m}),Ane(),Pne.configure({citationMaxLength:a})],[w,E,O]=jt.useField({name:e}),{setValue:L}=O,{value:N}=w,{addUpdateCitation:F,deleteCitation:M,batchUpdate:A}=MP();X.useEffect(()=>{var q;const $=(q=z==null?void 0:z.current)==null?void 0:q.editor;if(!$)return;$.getHTML()!==N&&setTimeout(()=>{$.commands.setContent(N)},0)},[N]);const z=X.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},R=()=>{var q,G;const $=((G=(q=z.current)==null?void 0:q.editor)==null?void 0:G.getHTML())??"",W=!$.replace(/<\/?p>|<br>/g,"").trim();L(W?"":$)},V=v.jsxs(I.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...B[s],children:[v.jsx(lI,{ref:z,extensions:_,content:N,editable:!i,renderControls:i?void 0:()=>v.jsx(Ff,{children:v.jsx(Ine,{})}),onBlur:R,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(kP,{getCitationsPaginated:$=>l($).then(W=>(A(W.data),W)),onCreateCitation:u&&($=>u($).then(W=>(F(W),W))),onUpdateCitation:f&&($=>f($).then(W=>(F(W),W))),onDeleteCitation:p&&($=>p($).then(()=>M($))),getCitationById:g,onDownloadAttachment:y,onError:b,canLaunchUrl:T,readOnly:i})}),v.jsx(sr,{name:e,id:`${e}-err`,errorMode:C})]});return v.jsxs(I.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(I.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(OP,{name:S})]}),V]})},Lne=t=>{const{name:e="submit"}=t;return v.jsx(Ur,{name:e,type:"submit",...t})},Fne=t=>{const{label:e="Return to Top",icon:n=Zu,scrollThresholdPx:r=100}=t,o=I.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(I.Zoom,{in:o,children:v.jsx(I.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(I.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},AP=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=to.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),v.jsx(I.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>v.jsxs(I.MenuItem,{...vl(p,o),children:[p.icon&&v.jsx(I.ListItemIcon,{children:p.icon}),v.jsx(I.ListItemText,{primary:p.label})]},p.label))})]})},$ne=()=>{const{values:t,errors:e,status:n}=jt.useFormikContext(),{palette:r}=I.useTheme();return v.jsx(I.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(I.List,{children:[v.jsxs(I.ListItem,{children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(I.Divider,{variant:"inset",component:"li"}),v.jsxs(I.ListItem,{id:"testing",children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(I.ListItem,{children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Bne=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=nP();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(I.Stepper,{...u,children:e.map(f=>v.jsx(I.Step,{children:v.jsx(I.StepLabel,{children:f})},f))})},Rne=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(zR,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:g=!1,emptyListMsg:y="None",showDivider:b=!1,removePosition:m="bottom"}=t,[S]=jt.useField({name:e}),{value:C}=S,T=_=>({display:"flex",flexDirection:_==="bottom"?"column":"row",alignItems:_==="bottom"?"flex-start":"center"});return v.jsxs(I.FormControl,{fullWidth:!0,children:[v.jsx(I.Typography,{...r,children:n}),g&&S.value.length===0?v.jsx(I.Typography,{children:y}):v.jsx(jt.FieldArray,{name:e,render:_=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(X.Fragment,{children:v.jsx(zne,{variant:l,content:v.jsxs(I.Box,{"data-testid":"form-group-container",sx:typeof m=="string"?T(m):{...m},children:[v.jsxs(I.Box,{width:"100%",children:[i(`${e}.${E}`,E),b&&E!==C.length-1&&v.jsx(I.Divider,{"data-testid":"divider"})]}),!g&&C.length>(p?0:1)&&v.jsx(I.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>_.remove(E),children:a})]})})},`${e}-${E}`)),!g&&v.jsx(I.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>_.push(o),sx:u,children:s})]})})]})},zne=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(I.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(I.CardContent,{children:e})});case"elevatedCard":return v.jsx(I.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(I.CardContent,{children:e})});case"none":return e}},Vne=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(I.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Hne=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})},jne=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(I.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(I.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Wne=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=I.useTheme(),a=to.useNavigate();return v.jsxs(I.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(I.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(I.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(I.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(I.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...vl(l,a),children:l.label},l.label))}),n&&v.jsx(I.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},IP=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=to.useLocation(),i=to.useNavigate(),[s,a]=X.useState(!1),l=(g,y)=>v.jsx(I.MenuList,{children:g.map(b=>v.jsxs(I.MenuItem,{...vl(b,i,()=>a(!1)),children:[b.icon&&v.jsx(I.ListItemIcon,{children:b.icon}),v.jsx(I.ListItemText,{primary:b.label})]},`mobile-drawer-group-${y}-item-${b.path}`))}),f=(()=>{if(e){const g=e.filter(y=>y&&y.length>0);return g.length===0?null:g.map((y,b)=>v.jsxs(X.Fragment,{children:[l(y,b),b<g.length-1&&v.jsx(I.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(I.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(I.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(LR,{})}),v.jsx(I.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(I.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(I.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},DP=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(I.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(I.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},PP=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(AP,{label:e,menuOptions:n,icon:v.jsx($R,{})})},Np=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}=I.useTheme(),a=to.useNavigate();return v.jsx(I.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(I.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))})},NP=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(I.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Np,{menuOptions:e,activeTabIdx:n,sx:r})})},LP=t=>{const{onToggle:e}=t,{palette:n}=I.useTheme(),r=n.mode==="dark";return v.jsx(I.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(jC,{}):v.jsx(zC,{})})},qne=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,b=to.useNavigate(),m=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),{palette:S}=I.useTheme(),{pathname:C}=to.useLocation(),T=S.mode==="dark",[_,w]=D.useState(void 0);D.useEffect(()=>{const L=o.findIndex(N=>N.path&&C.startsWith(N.path));w(L>=0?L:void 0)},[C,o]);const E=s&&v.jsx(LP,{onToggle:s}),O=s&&(m||!m&&l)?[{icon:T?v.jsx(jC,{}):v.jsx(zC,{}),label:`Switch to ${T?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(I.AppBar,{ref:n,position:f,sx:g,elevation:4,children:[e&&v.jsx(DP,{...e}),u,v.jsxs(I.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(I.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(I.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!m&&E,m&&v.jsx(IP,{menuOptionLists:[o,a,O],anchor:"right"}),!m&&v.jsxs(v.Fragment,{children:[v.jsx(I.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((L,N)=>v.jsxs(I.Box,{display:"flex",alignItems:"center",children:[N>0&&v.jsx(I.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(I.Button,{variant:"text",sx:{color:"white"},...vl(L,b),children:v.jsxs(I.Box,{display:"flex",gap:"3px",alignItems:"center",children:[L.icon,L.label]})})]},L.label))}),p,l&&v.jsx(PP,{displayName:l,userMenuOptions:O})]})]})]}),!m&&v.jsx(NP,{featureMenuOptions:o,activeTabIdx:_,sx:y})]})},Une=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=to.useLocation(),o=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),[i,s]=X.useState(void 0);return X.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(I.Box,{sx:e,children:v.jsx(I.Card,{sx:{height:"100%",width:200},children:v.jsx(Np,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Kne=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=I.useTheme();return e.length>0&&v.jsx(Np,{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}})},Yne=t=>v.jsx(iu,{severity:"info",...t}),Gne=t=>v.jsx(iu,{severity:"warning",...t}),FP=t=>{const{crumbInfo:e}=t,n=to.useNavigate();return v.jsx(I.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(FR,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(I.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(I.Typography,{color:"primary",children:r},r))})},Jne=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Zne(r);return v.jsx(I.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:$P(r),warning:$P(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(I.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Zne=t=>t=="logout"?"info":t=="timeout"?"warning":t,$P=t=>{if(t=="timeout")return v.jsx(iR,{});if(t=="logout")return v.jsx(NR,{})},Xne=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=I.useMediaQuery(I.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(I.Box,{sx:a,children:[i.length>0&&v.jsx(FP,{crumbInfo:i}),v.jsxs(I.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(I.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(I.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(Ur,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(sR,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(I.Box,{width:l?"100%":"50%",children:s})]})]})},Qne=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=I.useMediaQuery(I.useTheme().breakpoints.down("sm"));return v.jsxs(I.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(I.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(I.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(I.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function ere({...t}){return v.jsx(_P,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const tre=({children:t,getCitations:e})=>{const[n,r]=X.useState([]),[o,i]=X.useState(!1);X.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const g=new Set(p.map(b=>b.id));return[...p.filter(b=>!g.has(b.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(b=>{const m=u.find(S=>S.id===b.id);return m||b}),g=new Set(f.map(b=>b.id)),y=u.filter(b=>!g.has(b.id));return[...p,...y]})},[]),a=X.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=X.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(EP.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},nre=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(I.Box,{height:n})};Ie.AlertModal=Hne,Ie.Autocomplete=hC,Ie.Breadcrumbs=FP,Ie.Button=Ur,Ie.Checkbox=mC,Ie.CheckboxGroup=BB,Ie.CitationField=Nne,Ie.CitationFieldProvider=tre,Ie.CitationManager=ere,Ie.ConfirmationModal=Vne,Ie.DarkModeToggle=LP,Ie.DateField=Bd,Ie.DateRangeField=aq,Ie.DecisionModal=jne,Ie.Drawer=IP,Ie.DynamicAutocomplete=FB,Ie.EnvironmentBanner=DP,Ie.ErrorAlert=CP,Ie.FileList=zB,Ie.FileUpload=bC,Ie.FloatingNavBar=Kne,Ie.Footer=Wne,Ie.FormDebugger=$ne,Ie.Header=qne,Ie.InfoAlert=Yne,Ie.LoadingButton=S1,Ie.LoadingIndicator=x1,Ie.Location=tR,Ie.MenuButton=AP,Ie.Modal=ou,Ie.MultiAutocomplete=$B,Ie.NavBar=NP,Ie.NotApplicableCheckbox=OP,Ie.PageHeader=Xne,Ie.PaginatedTable=eP,Ie.ProfileMenu=PP,Ie.RadioGroup=RC,Ie.RangeSlider=nR,Ie.RepeatableFormGroup=Rne,Ie.RichTextField=Dte,Ie.ScrollToTop=Fne,Ie.SearchField=YR,Ie.Select=rR,Ie.SelectableCitationManager=TP,Ie.Sidebar=Une,Ie.SingleActionCard=Qne,Ie.Snackbar=Jne,Ie.Spacer=nre,Ie.Stepper=Bne,Ie.Submit=Lne,Ie.SuccessAlert=wP,Ie.Switch=oR,Ie.Table=QD,Ie.Tabs=Np,Ie.TextField=us,Ie.ValidationError=sr,Ie.WarningAlert=Gne,Ie.commonTheme=vn,Ie.darkTheme=RF,Ie.lightTheme=BF,Object.defineProperty(Ie,Symbol.toStringTag,{value:"Module"})});
|