@simoncomputing/mui-bueno-v2 0.26.2 → 0.26.3
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 +8 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +17 -8
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,7 +11,14 @@ 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.26.
|
|
14
|
+
## [0.26.3] - 2026-03-24
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `CitationManager`, `SelectableCitationManager`, `CitationField`
|
|
19
|
+
- Paste & Prefill button should not be visible when read-only
|
|
20
|
+
|
|
21
|
+
## [0.26.2] - 2026-03-24
|
|
15
22
|
|
|
16
23
|
### Added
|
|
17
24
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -404,4 +404,4 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
404
404
|
3. "-" cannot repeat`);Ut.customSchemes.push([t,e])}function Kce(){Ut.scanner=Bce(Ut.customSchemes);for(let t=0;t<Ut.tokenQueue.length;t++)Ut.tokenQueue[t][1]({scanner:Ut.scanner});Ut.parser=zce(Ut.scanner.tokens);for(let t=0;t<Ut.pluginQueue.length;t++)Ut.pluginQueue[t][1]({scanner:Ut.scanner,parser:Ut.parser});return Ut.initialized=!0,Ut}function Tx(t){return Ut.initialized||Kce(),Hce(Ut.parser.start,t,KD(Ut.scanner.start,t))}Tx.scan=KD;function GD(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 Sx(n),o=Tx(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const kx="[\0- -\u2029 ]",Yce=new RegExp(kx),Gce=new RegExp(`${kx}$`),Jce=new RegExp(kx,"g");function Xce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Zce(t){return new on({key:new On("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=g7(n.doc,[...e]);if(C7(a).forEach(({newRange:u})=>{const f=b7(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," ");else if(f.length){const y=r.doc.textBetween(u.from,u.to," "," ");if(!Gce.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(Yce).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=Tx(v).map(C=>C.toObject(t.defaultProtocol));if(!Xce(x))return!1;x.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=>{av(C.from,C.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function Qce(t){return new on({key:new On("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=sv(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 eue(t){return new on({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=GD(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function qs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Jce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const tue=Mr.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"){UE(t);return}UE(t.scheme,t.optionalSlashes)})},onDestroy(){qce()},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",Ct(this.options.HTMLAttributes,t),0]:["a",Ct(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[Ss({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=GD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qs(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Zce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!qs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Qce({type:this.type})),this.options.linkOnPaste&&t.push(eue({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function nue(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=rU(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"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(y)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const C=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!k)return null;const T=g+x.index;let S=T+x[0].length;return l&&f.test(v.slice(S-1,S+1))&&(x[0]+=" ",S+=1),T<a.pos&&S>=a.pos?{range:{from:T,to:S},query:x[0].slice(n.length),text:x[0]}:null}const rue=new On("suggestion");function oue({pluginKey:t=rue,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=nue}){let x;const C=y==null?void 0:y(),k=new on({key:t,view(){return{update:async(T,S)=>{var O,R,N,$,F,M,j;const V=(O=this.key)===null||O===void 0?void 0:O.getState(S),B=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=V.active&&B.active&&V.range.from!==B.range.from,_=!V.active&&B.active,I=V.active&&!B.active,L=!_&&!I&&V.query!==B.query,W=_||A&&L,K=L||A,U=I||A&&L;if(!W&&!K&&!U)return;const J=U&&!W?V:B,me=T.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);x={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:he=>p({editor:e,range:J.range,props:he}),decorationNode:me,clientRect:me?()=>{var he;const{decorationId:ce}=(he=this.key)===null||he===void 0?void 0:he.getState(e.state),Z=T.dom.querySelector(`[data-decoration-id="${ce}"]`);return(Z==null?void 0:Z.getBoundingClientRect())||null}:null},W&&((N=C==null?void 0:C.onBeforeStart)===null||N===void 0||N.call(C,x)),K&&(($=C==null?void 0:C.onBeforeUpdate)===null||$===void 0||$.call(C,x)),(K||W)&&(x.items=await m({editor:e,query:J.query})),U&&((F=C==null?void 0:C.onExit)===null||F===void 0||F.call(C,x)),K&&((M=C==null?void 0:C.onUpdate)===null||M===void 0||M.call(C,x)),W&&((j=C==null?void 0:C.onStart)===null||j===void 0||j.call(C,x))},destroy:()=>{var T;x&&((T=C==null?void 0:C.onExit)===null||T===void 0||T.call(C,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,S,O,R){const{isEditable:N}=e,{composing:$}=e.view,{selection:F}=T,{empty:M,from:j}=F,V={...S};if(V.composing=$,N&&(M||e.view.composing)){(j<S.range.from||j>S.range.to)&&!$&&!S.composing&&(V.active=!1);const B=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:F.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;B&&v({editor:e,state:R,range:B.range,isActive:S.active})?(V.active=!0,V.decorationId=S.decorationId?S.decorationId:A,V.range=B.range,V.query=B.query,V.text=B.text):V.active=!1}else V.active=!1;return V.active||(V.decorationId=null,V.range={from:0,to:0},V.query=null,V.text=null),V}},props:{handleKeyDown(T,S){var O;const{active:R,range:N}=k.getState(T.state);return R&&((O=C==null?void 0:C.onKeyDown)===null||O===void 0?void 0:O.call(C,{view:T,event:S,range:N}))||!1},decorations(T){const{active:S,range:O,decorationId:R,query:N}=k.getState(T);if(!S)return null;const $=!(N!=null&&N.length),F=[l];return $&&F.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:F.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function iue({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new On;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function JD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>iue({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function qE(t,e){const n=JD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const sue=rn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",Ct(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=qE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ct({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Ct({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",Ct({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:qE(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new Ri,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return JD(this).map(oue)}}),XD=gn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new on({key:new On("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&Ph(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),aue=Mr.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",Ct(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()}}}),lue=rn.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",Ct(this.options.HTMLAttributes,t),0]}}),cue=rn.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",Ct(this.options.HTMLAttributes,t),0]}}),uue=rn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ct(this.options.HTMLAttributes,t),0]}}),due=/^\s*(\[([( |x])?\])\s$/,fue=rn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ct(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const y=n();if(typeof y!="number")return!1;const v=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[Pl({find:due,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),pue=rn.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",Ct(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()}}}),hue=gn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),ZD=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?b.jsx(z.Paper,{elevation:5,children:b.jsx(z.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(z.ListItem,{disablePadding:!0,children:b.jsx(z.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});ZD.displayName="SuggestionList";const KE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},mue={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 tI(ZD,{props:n,editor:n.editor}),e=Ku("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??KE},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))??KE}})},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}}}},gue=tue.extend({inclusive:!1}),yue=aue.extend({excludes:"superscript"}),bue=EI.extend({excludes:"subscript"});function vue({placeholder:t}={}){return X.useMemo(()=>[ste.configure({resizable:!0}),uue,cue,lue,gR,bR,vR,SR,DR,AR,PR,yue,bue,$R,mR,hR,yR,IR,kI,NR,gue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),HQ,CR,VQ,hue.configure({types:["heading","paragraph","image"]}),Mce,_ce,Rce,jZ,LR.configure({multicolor:!0}),RR,oee,xR,pue,fue.configure({nested:!0}),sue.configure({suggestion:mue}),XD.configure({placeholder:t}),_R],[t])}function YE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const xue=t=>{const e=vue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(SI,{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]=Ht.useField({name:n}),{setValue:f}=u,{value:p}=a;X.useEffect(()=>{var C,k,T;(T=(k=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:k.commands)==null||T.setContent(p)},[p]);const m=X.useRef(null),y=X.useCallback((C,k)=>{var S;const T=(S=m.current)==null?void 0:S.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(O=>{t0({images:O,editor:T,position:k})});else{const O=i(C);t0({images:O,editor:T,position:k})}},[]),v=X.useCallback((C,k,T,S)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=YE(k.dataTransfer.files);if(O.length>0){const N=(R=C.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return y(O,N),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((C,k,T)=>{if(!k.clipboardData)return!1;const S=YE(k.clipboardData.files);return S.length>0?(y(S),!0):!1},[y]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(CI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(Ece,{onUploadFiles:i}),onBlur:()=>{var C,k;return f(((k=(C=m.current)==null?void 0:C.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(Ote,{}),b.jsx(Vte,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},GE=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?b.jsx(z.Collapse,{in:n,children:u}):b.jsx(z.TableRow,{sx:p,children:b.jsx(z.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(z.Collapse,{in:n,children:u})})})},QD=({isLoading:t,children:e})=>{const[n,r]=X.useState(!1);return X.useEffect(()=>{let o,i;return t?o=setTimeout(()=>r(!0),300):n?i=setTimeout(()=>r(!1),200):(o&&clearTimeout(o),r(!1)),()=>{o&&clearTimeout(o),i&&clearTimeout(i)}},[t,n]),b.jsxs(z.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,b.jsx(z.Box,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,pointerEvents:n?"auto":"none",opacity:n?1:0,transition:"opacity 0.3s ease"},children:b.jsx(z.CircularProgress,{})})]})},Ea=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Ru=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Ex=t=>{const{id:e,getRowKey:n=ae=>"id"in ae&&(typeof ae.id=="string"||typeof ae.id=="number")?ae.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(ae)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(ae)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,checkedIds:a,setCheckedIds:l,renderExpand:u,sortField:f,sortOrder:p,onSortChange:m,allowSortCols:y,fixedLayout:v=!1,className:g,emptyTableMsg:x="No items to display",errorTableMsg:C,retryCallback:k,isLoading:T=!1,disableMobileCards:S=!1,highlightSelectedRow:O=!1,headerRowStyle:R={},stickyHeader:N,reRenderExpand:$=!1,expandOnRowClick:F=!1,tooltipColor:M,...j}=t,{palette:V}=z.useTheme(),[B,A]=X.useState(void 0),[_,I]=X.useState(void 0);wue(t);const L=ae=>{ae!==f?m&&m(ae,"asc"):m&&m(f,p==="asc"?"desc":"asc")},W=ae=>f===ae?p:null,K=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),U=r.filter(ae=>!ae.hideCol&&(!K||!ae.hideOnMobile));u&&!K&&U.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:ae=>{const _e=B===ae;return b.jsx(z.IconButton,{"data-testid":"expand-collapse-btn","aria-label":_e?"collapse row":"expand row",size:"small",onClick:()=>re(ae),children:_e?b.jsx(Bf,{"data-testid":"collapse-up"}):b.jsx(ib,{"data-testid":"expand-down"})})}}),a&&l&&U.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:ae=>b.jsx(z.Checkbox,{onChange:()=>{const _e=a.includes(ae);l(_e?a.filter($e=>$e!==ae):[...a,ae])},checked:a.includes(ae)})});const J=m!==void 0,me=ae=>J?y?y.includes(ae):!0:!1,he=b.jsxs(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(Bne,{})," ",x]}),ce=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(CM,{color:"error"})," ",C,k&&b.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),Z=()=>{if(C)return b.jsx(z.TableRow,{children:b.jsx(z.TableCell,{colSpan:r.length,align:"center",children:ce})});if(o.length===0)return b.jsx(z.TableRow,{children:b.jsx(z.TableCell,{colSpan:r.length,align:"center",children:he})})},oe=()=>{if(C)return ce;if(o.length===0)return he},ue=ae=>{O&&I(ae)},te=ae=>{const _e=n(ae);if((i||s)&&(i==null||i(_e),s==null||s(ae),ue(_e)),u&&F){const $e=B===_e?void 0:_e;A($e),ue($e)}},re=ae=>{const _e=B===ae?void 0:ae;A(_e),ue(_e)},le=ae=>{if(!u)return;const _e=B===n(ae);return b.jsxs(b.Fragment,{children:[b.jsxs(z.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>re(n(ae)),children:[_e?b.jsx(Bf,{}):b.jsx(ib,{})," Show"," ",_e?"Less":"More"]}),b.jsx(GE,{colSpan:r.length,isExpanded:n(ae)===B,obj:ae,renderExpand:$e=>u($e),asMobileCard:!0})]})},ge=typeof O=="string"?O:V.grey[V.mode=="dark"?600:50],Y=ae=>{const _e=_===n(ae)?ge:"inherit";return{cursor:i||F?"pointer":"default",backgroundColor:_e,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:_e===ge?ise(_e,.1):ge}}}},ee=V.grey[V.mode==="dark"?600:400],fe=ae=>ae&&b.jsx(z.Tooltip,{title:ae,children:b.jsx(Lne,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:M??ee,marginLeft:"2px"}})}),Se=(ae,_e)=>{const $e=ae.find(Me=>Me.key==="MBv2_Checkbox_Column"),Pe=U.filter(Me=>Me.key!=="MBv2_Checkbox_Column");return b.jsxs(Ea,{alignItems:"flex-start",children:[$e&&b.jsx(Ru,{children:kl($e,_e,K)}),b.jsxs(Ru,{width:"100%",children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:Pe.map(Me=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${wn(Me)}`,style:{textWrap:"nowrap"},children:[Me.label??Fn(wn(Me)),fe(Me.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${wn(Me)}`,style:{paddingLeft:"10px"},children:kl(Me,_e,K)})]},`row-${n(_e)}-${wn(Me)}`))})}),le(_e)]})]})},Ce=()=>b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:g,"data-testid":"mui-table-mobile",children:[J&&b.jsxs(b.Fragment,{children:[b.jsxs(z.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(z.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:f??"",label:"Sort By...",onChange:ae=>L(ae.target.value),fullWidth:!0,children:U.map(ae=>{if(me(wn(ae)))return b.jsx(z.MenuItem,{value:wn(ae),children:ae.label??Fn(wn(ae))},`rowHeader-${wn(ae)}`)})}),b.jsx(z.IconButton,{onClick:()=>{f&&L(f)},children:b.jsx(qne,{className:`sort-icon-${p}`})})]}),b.jsx(z.Divider,{sx:{margin:"10px 0"}})]}),oe()??o.map(ae=>b.jsx(z.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...Y(ae)},onClick:()=>te(ae),"data-testid":`card-${n(ae)}`,children:Se(U,ae)},n(ae)))]}),Ie=()=>b.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:N?{maxHeight:N,overflow:"auto"}:{},children:b.jsxs(z.Table,{stickyHeader:N!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:R?{"& .MuiTableCell-head":{...R}}:{},...j,children:[b.jsx(z.TableHead,{className:"MBv2_Table_Head",children:b.jsx(z.TableRow,{className:"MBv2_Table_Head_Row",children:U.map((ae,_e)=>{const $e=me(wn(ae));return b.jsx(z.TableCell,{width:Array.isArray(v)?v[_e]:"auto",sx:ae.tableCellSx??{},children:b.jsx(z.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(z.Box,{sx:[$e&&{"&:hover":{cursor:"pointer",backgroundColor:V.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:$e?()=>L(wn(ae)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ae.label??Fn(wn(ae))}),fe(ae.tooltip),$e&&W(wn(ae))==="asc"&&b.jsx(Bf,{style:{marginLeft:"5px"}}),$e&&W(wn(ae))==="desc"&&b.jsx(ib,{style:{marginLeft:"5px"}}),$e&&W(wn(ae))!=="asc"&&W(wn(ae))!=="desc"&&b.jsx(Wne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${wn(ae)}`)})})}),b.jsx(z.TableBody,{className:"MBv2_Table_Body",children:Z()??o.map(ae=>b.jsxs(X.Fragment,{children:[b.jsx(z.TableRow,{"data-testid":`row-${n(ae)}`,className:"MBv2_Table_Body_Row",onClick:()=>te(ae),sx:Y(ae),children:U.map(_e=>b.jsx(z.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${wn(_e)}`,children:kl(_e,ae,K)},`row-${n(ae)}-${wn(_e)}`))}),u&&b.jsx(GE,{colSpan:U.length,isExpanded:n(ae)===B,obj:ae,renderExpand:_e=>u(_e),reRenderExpand:$})]},n(ae)))})]})});return b.jsx(QD,{isLoading:T,children:K&&!S?Ce():Ie()})},wue=t=>{const{fixedLayout:e,checkedIds:n,setCheckedIds:r,renderExpand:o,columns:i,expandOnRowClick:s,onRowClick:a,onRowClickObj:l}=t,u="Table component:";Array.isArray(e)&&(!o&&e.length!==i.length&&console.warn(`${u} Length of "fixedLayout" is not equal to the length of "columns". Got=${e.length}. Expected=${i.length}`),o&&e.length!==i.length+1&&console.warn(`${u} 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&&!o&&console.warn(`${u} renderExpand should be defined when expandOnRowClick is defined`),a&&l&&console.warn(`${u} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`),(n||r)&&o&&console.warn(`${u} checkedIds/setCheckedIds & renderExpand cannot both be defined`),n&&!r&&console.warn(`${u} if checkedIds is defined, setCheckedIds must also be defined`),!n&&r&&console.warn(`${u} if setCheckedIds is defined, checkedIds must also be defined`);const f=i.map(y=>wn(y)),p=f.filter((y,v)=>f.indexOf(y)!==v),m=[...new Set(p)];m.length>0&&console.warn(`${u} duplicate key/fieldName found in 'columns': ${m.join(", ")}. Make sure to define a unique 'key' if you have multiple column definitions with the same 'fieldName'.`)},wn=t=>t.key??t.fieldName,Cue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),kl=(t,e,n=!1)=>{const r=Cue(e,t.fieldName);return t.render?t.render(r,e,n):r},eA=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},y=x=>{r(parseInt(x.target.value,10))},v=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(z.Box,{children:[b.jsx(Ex,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(z.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,C)=>m(C),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},JE=()=>({height:window.innerHeight,width:window.innerWidth}),tA=()=>{const[t,e]=X.useState(JE());return X.useEffect(()=>{const n=()=>{e(JE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Tr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=tA(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(z.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...hr({...t},a)})},Sue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(z.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(Tr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(Tr,{size:"small",startIcon:b.jsx(m0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Tue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(Tr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(Tr,{size:"small",color:"error",startIcon:b.jsx(Zv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},kue=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onViewCitation:l,onViewAttachment:u,onDeleteCitation:f,onDownloadAttachment:p,onPreviewAttachment:m,onSelect:y,getCitationsPaginated:v,selectedIds:g,setSelectedIds:x,onError:C=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:S,addlActions:O,readOnly:R=!1,showCloseBtn:N=!1,canSearch:$=!1}=t,F=!!t.canCreate&&!R,M=!!a&&!!s&&!R,j=!!u&&!!l&&R&&k,V=!!f&&!R,{palette:B}=z.useTheme(),[A,_]=X.useState([]),[I,L]=X.useState(!1),[W,K]=X.useState(!0),[U,J]=X.useState(null),[me,he]=X.useState(null),[ce,Z]=X.useState(null),[oe,ue]=X.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:$?"":void 0}),te=()=>{L(!1),K(!0),v({pageNo:oe.pageNo,pageSize:oe.pageSize,search:oe.search}).then(Pe=>(_(Pe.data),ue(Me=>({...Me,totalCount:Pe.totalCount})),Pe)).catch(Pe=>{C(Pe),L(!0),_([])}).finally(()=>K(!1))};X.useEffect(te,[oe.pageNo,oe.pageSize,e,oe.search]);const re=()=>{he(null),Z(null),J(null)},le=b.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Kh,{}),children:"Add Citation"}),ge=b.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx(jI,{}),children:"Add Attachment"}),Y=Pe=>{if(!(!M&&!j)){if(M)return b.jsx(z.Tooltip,{title:"Edit",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>Pe.fileName?a(Pe):s(Pe),"data-testid":`citation-table_edit-btn-${Pe.id}`,children:b.jsx(jne,{})})});if(j)return b.jsx(z.Tooltip,{title:"View",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>Pe.fileName?u(Pe):l(Pe),"data-testid":`citation-table_view-btn-${Pe.id}`,children:b.jsx(Kne,{})})})}},ee=Pe=>{if(!(!V||R))return b.jsx(z.Tooltip,{title:"Delete",children:b.jsx(z.IconButton,{color:"error",onClick:Me=>{he(Pe),J(Me.currentTarget)},"data-testid":`citation-table_delete-btn-${Pe.id}`,children:b.jsx(Zv,{})})})},fe=Pe=>{if(!S)return;if(!Pe.fileName)return b.jsx(z.Tooltip,{title:"Open URL",children:b.jsx(z.IconButton,{color:"primary",onClick:kt=>{J(kt.currentTarget),Z(Pe)},"data-testid":`citation-table_launch-link-btn-${Pe.id}`,sx:{visibility:S!=null&&S(Pe)?"visible":"hidden"},children:b.jsx(m0,{})})})},Se=Pe=>{if(!m||!Pe.fileName)return;const Me=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],kt=Pe.fileName.split(".").pop();if(!(!kt||!Me.includes(kt)))return b.jsx(z.Tooltip,{title:"View File",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>m==null?void 0:m(Pe),"data-testid":`citation-table_view-file-btn-${Pe.id}`,children:b.jsx(m0,{})})})},Ce=Pe=>{if(!p)return;if(!!Pe.fileName)return b.jsx(z.Tooltip,{title:"Download",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>p==null?void 0:p(Pe),"data-testid":`citation-table_download-btn-${Pe.id}`,children:b.jsx($ne,{})})})},Ie=j||M||V||S||m||p||O,ae=[...nA(B,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Ie,render:(Pe,Me)=>b.jsxs(z.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(Me),ee(Me),Y(Me),Se(Me),fe(Me),Ce(Me)]})}],_e=X.useCallback(Pe=>{ue(Me=>({...Me,pageNo:0,search:Pe}))},[]),$e=()=>$?b.jsx(FI,{onSearch:_e}):null;return b.jsxs(Ru,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[b.jsx(z.Typography,{variant:k?"h6":"h2",children:n}),!T&&F&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ge]}),N&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(tm,{})})]}),$e(),b.jsx(eA,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:W,columns:ae,data:A,paginationState:oe,onPageChange:Pe=>ue(Me=>({...Me,pageNo:Pe})),onRowsPerPageChange:Pe=>ue(Me=>({...Me,pageSize:Pe,pageNo:0})),errorTableMsg:I?"Failed to load citations.":void 0,retryCallback:te,setCheckedIds:T?x:void 0,checkedIds:T?g:void 0}),T&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:F&&b.jsxs(b.Fragment,{children:[le,ge]})}),!R&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(Tr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(Tr,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(Sue,{citation:ce,anchorEl:U,onClose:re}),b.jsx(Tue,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:re})]})},XE=(t,e)=>{const n=t?Ta.truncate(e,{length:30,omission:"..."}):e,r=n==null?void 0:n.endsWith("...");return b.jsx("span",{style:{wordBreak:"break-all"},children:r?b.jsx(z.Tooltip,{title:e,children:b.jsx("span",{children:n})}):e})},nA=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(jI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Kh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>XE(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>XE(e,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"details",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],Ox=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(Tr,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var hb,ZE;function Eue(){if(ZE)return hb;ZE=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,k){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=k};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);hb={Cache:t,split:p,normalizePath:f,setter:function(C){var k=f(C);return l.get(C)||l.set(C,function(S,O){for(var R=0,N=k.length,$=S;R<N-1;){var F=k[R];if(F==="__proto__"||F==="constructor"||F==="prototype")return S;$=$[k[R++]]}$[k[R]]=O})},getter:function(C,k){var T=f(C);return u.get(C)||u.set(C,function(O){for(var R=0,N=T.length;R<N;)if(O!=null||!k)O=O[T[R++]];else return;return O})},join:function(C){return C.reduce(function(k,T){return k+(y(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(C,k,T){m(Array.isArray(C)?C:p(C),k,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(k){return k.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,k,T){var S=C.length,O,R,N,$;for(R=0;R<S;R++)O=C[R],O&&(x(O)&&(O='"'+O+'"'),$=y(O),N=!$&&/^\d+$/.test(O),k.call(T,O,$,N,R,C))}function y(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function v(C){return C.match(r)&&!C.match(n)}function g(C){return o.test(C)}function x(C){return!y(C)&&(v(C)||g(C))}return hb}var pa=Eue(),mb,QE;function Oue(){if(QE)return mb;QE=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 mb={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(" ")},mb}var gb=Oue(),kf={exports:{}},eO;function Mue(){if(eO)return kf.exports;eO=1,kf.exports=function(o){return t(e(o),o)},kf.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,v,g){if(g.has(y)){var x;try{x=", node was:"+JSON.stringify(y)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[v]){l[v]=!0;var C=f.get(y)||new Set;if(C=Array.from(C),v=C.length){g.add(y);do{var k=C[--v];m(k,p.get(k),g)}while(v);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 kf.exports}var _ue=Mue();const Rue=er(_ue),Iue=Object.prototype.toString,Due=Error.prototype.toString,Aue=RegExp.prototype.toString,Pue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Nue=/^Symbol\((.*)\)(.*)$/;function $ue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function tO(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return $ue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Pue.call(t).replace(Nue,"Symbol($1)");const r=Iue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Due.call(t)+"]":r==="RegExp"?Aue.call(t):null}function ws(t,e){let n=tO(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=tO(this[r],e);return i!==null?i:o},2)}function rA(t){return t==null?[]:[].concat(t)}let oA,iA,sA,jue=/\$\{\s*(\w+)\s*\}/g;oA=Symbol.toStringTag;class nO{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[oA]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],rA(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}iA=Symbol.hasInstance;sA=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(jue,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new nO(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[sA]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[iA](e){return nO[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Lue={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"},k0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Bue={isValue:"${path} field must be ${value}"},Gf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Fue={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"},Vue={notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:Lue,date:k0,object:Gf,array:Fue,boolean:Bue,tuple:Vue});const Mx=t=>t&&t.__isYupSchema__;class ih{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 ih(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(!Mx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ef={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]===Ef.context,this.isValue=this.key[0]===Ef.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ef.context:this.isValue?Ef.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&pa.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Na.prototype.__isYupRef=!0;const sa=t=>t==null;function al(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(j={}){const V=aA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||C},p,j.params),k),B=new pr(pr.formatError(j.message||m,V),n,V.path,j.type||u,V.disableStackTrace);return B.params=V,B}const S=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return lA(j,k)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?S(j):j?l(null):S(T())},N=j=>{pr.isError(j)?S(j):a(j)};if(y&&sa(n))return R(!0);let F;try{var M;if(F=f.call(O,n,O),typeof((M=F)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(F).then(R,N)}}catch(j){N(j);return}R(F)}return e.OPTIONS=t,e}function aA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=lA(t[n],e);return t}function lA(t,e){return Na.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function zue(t,e,n,r=n){let o,i,s;return e?(pa.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 sh 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 sh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function yl(t,e=new Map){if(Mx(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=yl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,yl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(yl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=yl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function Hue(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function Wue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:Hue(n)}))}function cA(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Wue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>cA(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new sh,this._blacklist=new sh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=yl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&sa(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
405
405
|
|
|
406
406
|
attempted value: ${s}
|
|
407
|
-
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(k){k&&(Array.isArray(k)?y.push(...k):y.push(k)),--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)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):yl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=al({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=al({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Vo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Vo.notNull){return this.nullability(!1,e)}required(e=Vo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Vo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=al(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=rA(e).map(i=>new Na(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new ih(o,n):ih.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=al({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Vo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=al({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Vo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=al({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?aA(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:cA(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=zue(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const Uue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function que(t){const e=E0(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 E0(t){var e,n;const r=Uue.exec(t);return r?{year:xi(r[1]),month:xi(r[2],1)-1,day:xi(r[3],1),hour:xi(r[4]),minute:xi(r[5]),second:xi(r[6]),millisecond:r[7]?xi(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:xi(r[10]),minuteOffset:xi(r[11])}:null}function xi(t,e=0){return Number(t)||e}let Kue=/^[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])?)*$/,Yue=/^((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,Gue=/^(?:[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,Jue="^\\d{4}-\\d{2}-\\d{2}",Xue="\\d{2}:\\d{2}:\\d{2}",Zue="(([+-]\\d{2}(:?\\d{2})?)|Z)",Que=new RegExp(`${Jue}T${Xue}(\\.\\d+)?${Zue}$`),ede=t=>sa(t)||t===t.trim(),tde={}.toString();function El(){return new uA}class uA extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===tde?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Vo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=wr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=wr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=wr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||wr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=wr.email){return this.matches(Kue,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(Yue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(Gue,{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(Que,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=E0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=E0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:ede})}lowercase(e=wr.lowercase){return this.transform(n=>sa(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toLowerCase()})}uppercase(e=wr.uppercase){return this.transform(n=>sa(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toUpperCase()})}}El.prototype=uA.prototype;let dA=new Date(""),nde=t=>Object.prototype.toString.call(t)==="[object Date]";function _x(){return new Qu}class Qu extends ti{constructor(){super({type:"date",check(e){return nde(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=que(e),isNaN(e)?Qu.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=k0.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=k0.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)}})}}Qu.INVALID_DATE=dA;_x.prototype=Qu.prototype;_x.INVALID_DATE=dA;function rde(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=pa.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):Mx(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Rue.array(Array.from(r),n).reverse()}function rO(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 fA(t){return(e,n)=>rO(t,e)-rO(t,n)}const ode=(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 Jf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Jf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Jf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Jf)}):"optional"in t?t.optional():t}const ide=(t,e)=>{const n=[...pa.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=pa.getter(pa.join(n),!0)(t);return!!(o&&r in o)};let oO=t=>Object.prototype.toString.call(t)==="[object Object]";function iO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const sde=fA([]);function Rx(t){return new pA(t)}class pA extends ti{constructor(e){super({type:"object",check(n){return oO(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=sde,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,v=o[p];if(m){let g;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,C=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}g=!n.__validating||!C?m.cast(v,u):v,g!==void 0&&(l[p]=g)}else y&&!s&&(l[p]=v);(y!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!oO(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=rde(e,n),r._sortErrors=fA(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 Jf(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=pa.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return ide(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(ode)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Gf.exact,test(n){if(n==null)return!0;const r=iO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Gf.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=iO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Gf.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(gb.camelCase)}snakeCase(){return this.transformKeys(gb.snakeCase)}constantCase(){return this.transformKeys(e=>gb.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}}Rx.prototype=pA.prototype;const ade=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return b.jsx(z.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:b.jsxs(Ru,{component:z.Paper,p:1,boxShadow:9,gap:.25,children:[b.jsx(z.Typography,{variant:"body1",children:"Paste in an pre-formatted citation"}),b.jsx(z.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),b.jsx(Ht.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(lde(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>b.jsxs(Ea,{flexWrap:"wrap",justifyContent:"flex-end",children:[b.jsx(NI,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:b.jsx(z.Tooltip,{title:"Paste from Clipboard",children:b.jsx(z.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:b.jsx(Nne,{})})})}),b.jsxs(Ea,{children:[b.jsx(Tr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),b.jsx(Tr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},lde=t=>{const e=t.split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.toUpperCase().startsWith("HTTPS")),r=e.findIndex(f=>f.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(f=>/\bSOURCE\b/.test(f.toUpperCase()));let s=[n,r,o].find(f=>f!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Of(e,l),title:Of(e,a),url:Of(e,n),accessedAt:cde(e,r),classification:ude(e,o),details:Of(e,o)}},Of=(t,e)=>e<0||e>=t.length?"":t[e],cde=(t,e)=>e<0||e>=t.length?"":Cce(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),ude=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",dde=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState(!1),y=X.useRef(null),[v,g]=X.useState(!1),[x,C]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});X.useEffect(()=>{i&&C({...i,type:"Url"})},[]);const k={disabled:u,margin:"none",readOnly:s};return b.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[b.jsxs(Ea,{justifyContent:"space-between",children:[b.jsxs(Ea,{children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),b.jsx(z.Button,{variant:"text",size:"small",ref:y,onClick:()=>g(!0),children:"Paste & Prefill"})]}),a&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(tm,{})})]}),b.jsx(Ht.Formik,{innerRef:l,enableReinitialize:!0,initialValues:x,onSubmit:async T=>{f(!0),n(T).catch(S=>{throw f(!1),S}).finally(()=>f(!1))},validationSchema:Rx({title:El().required("Title is required"),accessedAt:_x().required("Accessed At is required"),url:El().required("URL is required"),classification:El().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({submitForm:T,setValues:S})=>b.jsxs(Ht.Form,{autoComplete:"off",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[b.jsx(_i,{...k,name:"title",required:!0}),b.jsx(_i,{...k,name:"source"}),b.jsx(_i,{...k,name:"details",label:"Details (e.g. Source Description)"}),b.jsx(Ip,{...k,name:"accessedAt",required:!0,isDatePicker:!0}),b.jsx(_i,{...k,name:"url",label:"URL / Other Identifier",required:!0}),b.jsx(PI,{...k,name:"classification",row:!0,required:!0,radios:fde})]}),b.jsx(z.DialogActions,{sx:{px:0},children:s?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Ox,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),T()},children:i?"Update Citation":"Add New Citation"})]})}),b.jsx(ade,{open:v,onGenerateCitation:O=>{S(O,!0)},anchorEl:y.current,onClose:()=>g(!1)})]})})]})},fde=[{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."}],pde=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=X.useRef(null),[f,p]=X.useState(!1),[m,y]=X.useState(!1),[v,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),b.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(tm,{})})]}),b.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:Rx().shape({title:El().required("Title is required"),fileName:El().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(C=>{throw p(!1),C}).finally(()=>p(!1))},children:({values:x,setFieldValue:C,handleSubmit:k})=>{var T;return X.useEffect(()=>{var S,O;(S=x.file)!=null&&S.name&&C("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),b.jsxs(Ht.Form,{autoComplete:"off",children:[b.jsx(_i,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(z.Box,{marginTop:i||a?0:1,children:[b.jsxs(Ea,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(II,{name:"file",errorMode:"hidden"}),b.jsx(_i,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(_r,{name:"fileName"})]}),b.jsx(z.DialogActions,{sx:{px:0},children:a?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Ox,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},ed=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 b.jsx(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(z.Box,{children:y()}),b.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(z.Box,{children:y()})})};return b.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(tm,{})})]})}):r,o&&(typeof o=="string"?b.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function hde(t){return qe("MuiAlert",t)}const sO=He("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),mde=Ne(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),gde=Ne(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),yde=Ne(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),bde=Ne(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),vde=Ne(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),xde=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,hde,o)},wde=ne(Ms,{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)}`]]}})(yt(({theme:t})=>{const e=t.palette.mode==="light"?ga:_l,n=t.palette.mode==="light"?_l:ga;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Ln(["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),[`& .${sO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["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}`,[`& .${sO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["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)}}}))]}})),Cde=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Sde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),Tde=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),aO={success:b.jsx(mde,{fontSize:"inherit"}),warning:b.jsx(gde,{fontSize:"inherit"}),error:b.jsx(yde,{fontSize:"inherit"}),info:b.jsx(bde,{fontSize:"inherit"})},hA=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=aO,onClose:y,role:v="alert",severity:g="success",slotProps:x={},slots:C={},variant:k="standard",...T}=r,S={...r,color:l,severity:g,variant:k,colorSeverity:l||g},O=xde(S),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...x}},[N,$]=Ot("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:wde,externalForwardedProps:{...R,...T},ownerState:S,additionalProps:{role:v,elevation:0}}),[F,M]=Ot("icon",{className:O.icon,elementType:Cde,externalForwardedProps:R,ownerState:S}),[j,V]=Ot("message",{className:O.message,elementType:Sde,externalForwardedProps:R,ownerState:S}),[B,A]=Ot("action",{className:O.action,elementType:Tde,externalForwardedProps:R,ownerState:S}),[_,I]=Ot("closeButton",{elementType:Zl,externalForwardedProps:R,ownerState:S}),[L,W]=Ot("closeIcon",{elementType:vde,externalForwardedProps:R,ownerState:S});return b.jsxs(N,{...$,children:[p!==!1?b.jsx(F,{...M,children:p||m[g]||aO[g]}):null,b.jsx(j,{...V,children:i}),o!=null?b.jsx(B,{...A,children:o}):null,o==null&&y?b.jsx(B,{...A,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...I,children:b.jsx(L,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(hA.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 td=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return b.jsxs(hA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(z.Typography,{variant:"h3",children:s}),n]})},mA=t=>b.jsx(td,{severity:"error",...t}),gA=t=>b.jsx(td,{severity:"success",...t}),kde=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return b.jsxs(b.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&b.jsx(mA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(gA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function yA({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:y=!1,tableTitle:v="Attachments & Citations",addlActions:g,canLaunchUrl:x,readOnly:C,canSearch:k=!1}){const[T,S]=X.useState("Insert Citation/Attachment(s)"),[O,R]=X.useState(u),[N,$]=X.useState(void 0),[F,M]=X.useState(void 0),j=Y=>{M(void 0),S(Y)},[V,B]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,F,f]);const A=(Y=!1)=>{(!m||Y)&&B(ee=>ee+1)},_=(Y,ee)=>{var Ie;const fe=typeof((Ie=ee.response)==null?void 0:Ie.data)=="string"&&ee.response.data,Se=typeof ee.message=="string"&&ee.message;M({type:"Error",title:Y,message:fe??Se}),p(ee)},I=Y=>M({type:"Success",title:"",message:Y}),L=async Y=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(T==="Edit Citation"||T==="Edit Attachment"){if(Y.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(Y).then(()=>{j("Insert Citation/Attachment(s)"),A()}).catch(fe=>{_("Failed to update",fe)}))}else await(e==null?void 0:e(Y).then(fe=>{R([...O,fe.id]),j("Insert Citation/Attachment(s)"),A()}).catch(fe=>{_("Failed to create",fe)}))},W=r&&(async Y=>r(Y).then(()=>{A(!0),R(O.filter(ee=>ee!==Y)),I("Successfully deleted")}).catch(ee=>_("Failed to delete",ee))),K=o&&((Y,ee)=>{o(Y.id).then(fe=>{$(fe),j(ee)}).catch(fe=>{_("Failed to load",fe)})}),U=K&&(Y=>K(Y,C?"View Citation":"Edit Citation")),J=K&&(Y=>K(Y,C?"View Attachment":"Edit Attachment")),me=n&&U,he=n&&J,ce=i&&(async Y=>i(Y).catch(ee=>{_(`Failed to download ${Y.fileName}`,ee)})),Z=s&&(async Y=>s(Y).catch(ee=>{_(`Failed to view ${Y.fileName}`,ee)})),oe=b.jsx(kue,{refreshKey:V,getCitationsPaginated:Y=>t(Y).then(ee=>(f==null||f(),ee)),onCancel:l,onNewCitation:()=>{$(void 0),j("Add Citation")},onNewAttachment:()=>{$(void 0),j("Add Attachment")},onEditCitation:me,onEditAttachment:he,onViewCitation:U,onViewAttachment:J,onDeleteCitation:W,onDownloadAttachment:ce,onPreviewAttachment:Z,onSelect:a,setSelectedIds:R,selectedIds:O,onError:p,condenseTable:m,canSelect:y,title:v,addlActions:g,canCreate:!!e,canLaunchUrl:x,readOnly:C,showCloseBtn:m,canSearch:k}),ue=b.jsx(dde,{modifyCitation:N,onSave:L,onCancel:()=>j("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=b.jsx(pde,{onSave:L,onCancel:()=>j("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:N,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),re=b.jsx(kde,{alert:F,setAlert:M}),le=T==="Add Citation"||T==="Edit Citation"||T==="View Citation",ge=T==="Add Attachment"||T==="Edit Attachment"||T==="View Attachment";if(m){let Y=null;return!m||T==="Insert Citation/Attachment(s)"?Y=oe:le?Y=ue:ge&&(Y=te),b.jsxs(z.Box,{children:[re,b.jsx(z.Box,{paddingTop:"8px",children:Y})]})}return b.jsxs(z.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&re,b.jsx(z.Box,{paddingTop:"8px",children:oe}),b.jsx(ed,{open:le||ge,children:b.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[re,le?ue:te]})})]})}function bA({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return b.jsx(yA,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const Ede=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function Ode({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:f,...p}){const m=St();if(m&&!("citationBubbleMenuHandler"in(m==null?void 0:m.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const y=m==null?void 0:m.storage.citationBubbleMenuHandler,v=y.isOpen,g=y.selectedIds,x=y.selectedNodePos,C=O=>{m&&(O.length===0?m.commands.deleteCitation(x):g.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{C(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{C(g),m==null||m.commands.closeCitationBubbleMenu()},S=X.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?b.jsx(wv,{editor:m,open:v,...y.bubbleMenuOptions,...p,children:b.jsx(Ede,{children:b.jsx(bA,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,g),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onCancel:T,initialSelectedIds:g,onContentChange:S,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const Mde=()=>gn.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 _de(t){const e=St(),n=X.useRef(null);return b.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(Dne,{fontSize:"small"}),b.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const vA=X.createContext(void 0),xA=()=>{const t=X.useContext(vA);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Rde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=xA(),[u,f]=X.useState(s?String(s):""),[p,m]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const v=a.filter(C=>s.includes(C.id)),g=v.map(C=>Ta.truncate(C.title,{length:y,omission:"..."})).join(", ");f(g),m(v);const x=v.map(C=>C.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return b.jsx(Uv,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(z.Tooltip,{title:b.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,g)=>{var C;const x=[v.source,v.title,v.fileName,v.url,(C=v.accessedAt)==null?void 0:C.slice(0,10),v.classification];return b.jsxs(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&b.jsx(z.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:b.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Ide=rn.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",Ct(t)]},addNodeView(){return qv(Rde)},addProseMirrorPlugins(){return[new on({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}}}}),wA=t=>b.jsx(RI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Dde=t=>{const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x=()=>{},placeholder:C="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:S,canSearch:O=!1}=t,R=[jR,XD.configure({placeholder:C}),Mde(),Ide.configure({citationMaxLength:a})],[N,$,F]=Ht.useField({name:e}),{setValue:M}=F,{value:j}=N,{addUpdateCitation:V,deleteCitation:B,batchUpdate:A,citations:_}=xA();X.useEffect(()=>{var oe;const ce=(oe=I==null?void 0:I.current)==null?void 0:oe.editor;if(!ce)return;ce.getHTML()!==j&&setTimeout(()=>{ce.commands.setContent(j)},0)},[j]);const I=X.useRef(null),L={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},W=(ce=void 0)=>{var ue,te;const Z=((te=(ue=I.current)==null?void 0:ue.editor)==null?void 0:te.getHTML())??"",oe=!Z.replace(/<\/?p>|<br>/g,"").trim();M(oe?"":Z,ce)},K=X.useMemo(()=>Ta.debounce(()=>W(!1),500),[M]),U=_a(),{showDiff:J,getPreviousValue:me}=Ra(),he=i??U;if(J){const ce=me(e)??"",Z=j,oe=/<citation\s+ids="([^"]*)"><\/citation>/g,ue=(le,ge)=>{const Y=ge.split(",").map(Number);return`<sup>${_.filter(ee=>Y.includes(ee.id)).map(ee=>ee.title)}</sup>`},te=ce.replace(oe,ue),re=Z.replace(oe,ue);return b.jsx(Aa,{label:n,value:re,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:he?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...L[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&b.jsx(wA,{name:k})]}),b.jsx(CI,{ref:I,extensions:R,content:j,editable:!he,renderControls:he?void 0:()=>b.jsx(Fv,{children:b.jsx(_de,{})}),onBlur:()=>W(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>b.jsx(Ode,{getCitationsPaginated:ce=>l(ce).then(Z=>(A(Z.data),Z)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(ce=>f(ce).then(Z=>(V(Z),Z))),onUpdateCitation:p&&(ce=>p(ce).then(Z=>(V(Z),Z))),onDeleteCitation:m&&(ce=>m(ce).then(()=>B(ce))),getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:S,readOnly:he,canSearch:O})}),b.jsx(_r,{name:e,id:`${e}-err`,errorMode:T})]})},Ade=t=>{const{name:e="submit"}=t;return b.jsx(Tr,{name:e,type:"submit",...t})},Pde=t=>{const{label:e="Return to Top",icon:n=Bf,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(z.Zoom,{in:o,children:b.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},CA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ko.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(z.MenuItem,{...Iu(p,o),children:[p.icon&&b.jsx(z.ListItemIcon,{children:p.icon}),b.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},Nde=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=z.useTheme();return b.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(z.List,{children:[b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(z.Divider,{variant:"inset",component:"li"}),b.jsxs(z.ListItem,{id:"testing",children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},$de=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=tA();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...hr({...t},l)};return b.jsx(z.Stepper,{...u,children:e.map(f=>b.jsx(z.Step,{children:b.jsx(z.StepLabel,{children:f})},f))})},jde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx(BI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=Ht.useField({name:e}),{value:C}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(z.FormControl,{fullWidth:!0,children:[b.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(z.Typography,{children:y}):b.jsx(Ht.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[C.map((S,O)=>b.jsx(X.Fragment,{children:b.jsx(Lde,{variant:l,content:b.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?k(g):{...g},children:[b.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==C.length-1&&b.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Lde=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"elevatedCard":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"none":return e}},Bde=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(ed,{actions:[b.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Fde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(ed,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Vde=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(ed,{actions:[b.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},zde={added:{icon:Rne,label:"Added",color:"success"},deleted:{icon:BI,label:"Deleted",color:"error"},modified:{icon:Ane,label:"Modified",color:"info"}},Hde=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:kp},children:b.jsx("s",{children:t})}),b.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:Tp},children:b.jsx("u",{children:e})})]}),Wde=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=kl(s,e,r),l=kl(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??_I.isEqual(a,l))||(o[wn(s)]=Hde(a,l))}return o},Ude=(t,e,n,r=!1,o)=>{const i=[];let s=0,a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);s<e.length&&a<n.length;){const u=e[s],f=n[a];if(u.id===f.id){const p=Wde(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?l++:i.push({...f,changeType:"modified",modifiedDiff:p}),s++,a++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),s++):(i.push({...f,changeType:"added"}),a++)}for(;s<e.length;)i.push({...e[s],changeType:"deleted"}),s++;for(;a<n.length;)i.push({...n[a],changeType:"added"}),a++;return{dataDiff:i,unmodifiedCount:l}},SA=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,unmodifiedCount:l}=Ude(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=zde[f];return b.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:b.jsxs(z.Typography,{children:[b.jsx(P0,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var y;return((y=m.modifiedDiff)==null?void 0:y[wn(f)])??kl(f,m,s)}}))];return{unmodifiedCount:l,columns:u,data:a,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return b.jsx(EM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},TA=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>b.jsxs(z.Box,{children:[b.jsx(Ex,{columns:t,data:e,emptyTableMsg:n,renderExpand:r,size:o}),i>0&&b.jsx(z.Box,{children:b.jsxs(z.Typography,{fontStyle:"italic",children:["+",i," unmodified rows"]})})]}),qde=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?SA({...n,isMobileScreen:r}):n;return b.jsx(TA,{...o,size:t.size})},Kde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Iu(l,a),children:l.label},l.label))}),n&&b.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},kA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ko.useLocation(),i=ko.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>b.jsx(z.MenuList,{children:m.map(v=>b.jsxs(z.MenuItem,{...Iu(v,i,()=>a(!1)),children:[v.icon&&b.jsx(z.ListItemIcon,{children:v.icon}),b.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${y}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,v)=>b.jsxs(X.Fragment,{children:[l(y,v),v<m.length-1&&b.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&b.jsxs(b.Fragment,{children:[b.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(Vne,{})}),b.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},EA=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},OA=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(CA,{label:e,menuOptions:n,icon:b.jsx(Hne,{})})},vm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,...Iu(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))})},MA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:r})})},_A=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return b.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx(LI,{}):b.jsx($I,{})})},Yde=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,v=ko.useNavigate(),g=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:C}=ko.useLocation(),k=x.mode==="dark",[T,S]=D.useState(void 0);D.useEffect(()=>{const N=o.findIndex($=>$.path&&C.startsWith($.path));S(N>=0?N:void 0)},[C,o]);const O=s&&b.jsx(_A,{onToggle:s}),R=s&&(g||!g&&l)?[{icon:k?b.jsx(LI,{}):b.jsx($I,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(EA,{...e}),u,b.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(z.Button,{disableRipple:!0,component:ko.Link,to:"/",children:r&&typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&b.jsx(kA,{menuOptionLists:[o,a,R],anchor:"right"}),!g&&b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,$)=>b.jsxs(z.Box,{display:"flex",alignItems:"center",children:[$>0&&b.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(z.Button,{variant:"text",sx:{color:"white"},...Iu(N,v),children:b.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&b.jsx(OA,{displayName:l,userMenuOptions:R})]})]})]}),!g&&b.jsx(MA,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Gde=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ko.useLocation(),o=z.useMediaQuery(z.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&&b.jsx(z.Box,{sx:e,children:b.jsx(z.Card,{sx:{height:"100%",width:200},children:b.jsx(vm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Jde=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&b.jsx(vm,{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}})},Xde=({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(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(v=>{const g=u.find(x=>x.id===v.id);return g||v}),m=new Set(f.map(v=>v.id)),y=u.filter(v=>!m.has(v.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 b.jsx(vA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Zde=t=>b.jsx(td,{severity:"info",...t}),Qde=t=>b.jsx(td,{severity:"warning",...t}),RA=t=>{const{crumbInfo:e}=t,n=ko.useNavigate();return b.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(zne,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(z.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(z.Typography,{color:"primary",children:r},r))})},efe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=tfe(r);return b.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(td,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:lO(r),warning:lO(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},tfe=t=>t=="logout"?"info":t=="timeout"?"warning":t,lO=t=>{if(t=="timeout")return b.jsx(_ne,{});if(t=="logout")return b.jsx(Fne,{})},nfe=t=>{rfe(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(RA,{crumbInfo:i}),b.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(Tr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(Ine,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},rfe=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},ofe=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return b.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),b.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},ife=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(z.Box,{className:"text-content",children:[b.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(z.Typography,{"data-testid":"message",children:n})]}),b.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function sfe({...t}){return b.jsx(yA,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const afe=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return b.jsx(z.Box,{height:n})};exports.AlertModal=Fde;exports.Autocomplete=MI;exports.Breadcrumbs=RA;exports.Button=Tr;exports.Checkbox=RI;exports.CheckboxGroup=ene;exports.CitationField=Dde;exports.CitationFieldProvider=Xde;exports.CitationManager=sfe;exports.Column=Ru;exports.ConfirmationModal=Bde;exports.DarkModeToggle=_A;exports.DateField=Ip;exports.DateRangeField=kce;exports.DecisionModal=Vde;exports.Diff=OI;exports.DiffProvider=EM;exports.DiffTable=qde;exports.DiffTableView=TA;exports.Drawer=kA;exports.DynamicAutocomplete=Zte;exports.EnvironmentBanner=EA;exports.ErrorAlert=mA;exports.FileList=rne;exports.FileUpload=II;exports.FloatingNavBar=Jde;exports.Footer=Kde;exports.FormDebugger=Nde;exports.Header=Yde;exports.InfoAlert=Zde;exports.LoadingButton=Ox;exports.LoadingIndicator=ife;exports.LoadingOverlay=QD;exports.Location=kne;exports.MenuButton=CA;exports.Modal=ed;exports.MultiAutocomplete=Qte;exports.NavBar=MA;exports.NotApplicableCheckbox=wA;exports.PageHeader=nfe;exports.PaginatedTable=eA;exports.ProfileMenu=OA;exports.RadioGroup=PI;exports.RangeSlider=Ene;exports.ReadOnly=Aa;exports.ReadOnlyProvider=TM;exports.RepeatableFormGroup=jde;exports.RichTextField=xue;exports.Row=Ea;exports.ScrollToTop=Pde;exports.SearchField=FI;exports.Select=One;exports.SelectableCitationManager=bA;exports.Sidebar=Gde;exports.SingleActionCard=ofe;exports.Snackbar=efe;exports.Spacer=afe;exports.Stepper=$de;exports.Submit=Ade;exports.SuccessAlert=gA;exports.Switch=Mne;exports.Table=Ex;exports.Tabs=vm;exports.TextArea=NI;exports.TextField=_i;exports.TextIcon=P0;exports.ValidationError=_r;exports.WarningAlert=Qde;exports.baseCitationTableColumns=nA;exports.buildTableDiff=SA;exports.commonTheme=In;exports.darkTheme=lz;exports.lightTheme=az;exports.useDiff=Ra;exports.useReadOnly=_a;
|
|
407
|
+
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(k){k&&(Array.isArray(k)?y.push(...k):y.push(k)),--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)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):yl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=al({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=al({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Vo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Vo.notNull){return this.nullability(!1,e)}required(e=Vo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Vo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=al(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=rA(e).map(i=>new Na(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new ih(o,n):ih.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=al({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Vo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=al({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Vo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=al({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?aA(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:cA(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=zue(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const Uue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function que(t){const e=E0(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 E0(t){var e,n;const r=Uue.exec(t);return r?{year:xi(r[1]),month:xi(r[2],1)-1,day:xi(r[3],1),hour:xi(r[4]),minute:xi(r[5]),second:xi(r[6]),millisecond:r[7]?xi(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:xi(r[10]),minuteOffset:xi(r[11])}:null}function xi(t,e=0){return Number(t)||e}let Kue=/^[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])?)*$/,Yue=/^((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,Gue=/^(?:[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,Jue="^\\d{4}-\\d{2}-\\d{2}",Xue="\\d{2}:\\d{2}:\\d{2}",Zue="(([+-]\\d{2}(:?\\d{2})?)|Z)",Que=new RegExp(`${Jue}T${Xue}(\\.\\d+)?${Zue}$`),ede=t=>sa(t)||t===t.trim(),tde={}.toString();function El(){return new uA}class uA extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===tde?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Vo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=wr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=wr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=wr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||wr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=wr.email){return this.matches(Kue,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(Yue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(Gue,{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(Que,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=E0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=E0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:ede})}lowercase(e=wr.lowercase){return this.transform(n=>sa(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toLowerCase()})}uppercase(e=wr.uppercase){return this.transform(n=>sa(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toUpperCase()})}}El.prototype=uA.prototype;let dA=new Date(""),nde=t=>Object.prototype.toString.call(t)==="[object Date]";function _x(){return new Qu}class Qu extends ti{constructor(){super({type:"date",check(e){return nde(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=que(e),isNaN(e)?Qu.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=k0.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=k0.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)}})}}Qu.INVALID_DATE=dA;_x.prototype=Qu.prototype;_x.INVALID_DATE=dA;function rde(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=pa.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):Mx(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Rue.array(Array.from(r),n).reverse()}function rO(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 fA(t){return(e,n)=>rO(t,e)-rO(t,n)}const ode=(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 Jf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Jf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Jf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Jf)}):"optional"in t?t.optional():t}const ide=(t,e)=>{const n=[...pa.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=pa.getter(pa.join(n),!0)(t);return!!(o&&r in o)};let oO=t=>Object.prototype.toString.call(t)==="[object Object]";function iO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const sde=fA([]);function Rx(t){return new pA(t)}class pA extends ti{constructor(e){super({type:"object",check(n){return oO(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=sde,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,v=o[p];if(m){let g;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,C=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}g=!n.__validating||!C?m.cast(v,u):v,g!==void 0&&(l[p]=g)}else y&&!s&&(l[p]=v);(y!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!oO(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=rde(e,n),r._sortErrors=fA(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 Jf(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=pa.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return ide(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(ode)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Gf.exact,test(n){if(n==null)return!0;const r=iO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Gf.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=iO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Gf.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(gb.camelCase)}snakeCase(){return this.transformKeys(gb.snakeCase)}constantCase(){return this.transformKeys(e=>gb.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}}Rx.prototype=pA.prototype;const ade=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return b.jsx(z.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:b.jsxs(Ru,{component:z.Paper,p:1,boxShadow:9,gap:.25,children:[b.jsx(z.Typography,{variant:"body1",children:"Paste in an pre-formatted citation"}),b.jsx(z.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),b.jsx(Ht.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(lde(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>b.jsxs(Ea,{flexWrap:"wrap",justifyContent:"flex-end",children:[b.jsx(NI,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:b.jsx(z.Tooltip,{title:"Paste from Clipboard",children:b.jsx(z.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:b.jsx(Nne,{})})})}),b.jsxs(Ea,{children:[b.jsx(Tr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),b.jsx(Tr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},lde=t=>{const e=t.split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.toUpperCase().startsWith("HTTPS")),r=e.findIndex(f=>f.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(f=>/\bSOURCE\b/.test(f.toUpperCase()));let s=[n,r,o].find(f=>f!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Of(e,l),title:Of(e,a),url:Of(e,n),accessedAt:cde(e,r),classification:ude(e,o),details:Of(e,o)}},Of=(t,e)=>e<0||e>=t.length?"":t[e],cde=(t,e)=>e<0||e>=t.length?"":Cce(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),ude=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",dde=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState(!1),y=X.useRef(null),[v,g]=X.useState(!1),[x,C]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});X.useEffect(()=>{i&&C({...i,type:"Url"})},[]);const k={disabled:u,margin:"none",readOnly:s},T=!s;return b.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[b.jsxs(Ea,{justifyContent:"space-between",children:[b.jsxs(Ea,{children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),T&&b.jsx(z.Button,{variant:"text",size:"small",ref:y,onClick:()=>g(!0),children:"Paste & Prefill"})]}),a&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(tm,{})})]}),b.jsx(Ht.Formik,{innerRef:l,enableReinitialize:!0,initialValues:x,onSubmit:async S=>{f(!0),n(S).catch(O=>{throw f(!1),O}).finally(()=>f(!1))},validationSchema:Rx({title:El().required("Title is required"),accessedAt:_x().required("Accessed At is required"),url:El().required("URL is required"),classification:El().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({submitForm:S,setValues:O})=>b.jsxs(Ht.Form,{autoComplete:"off",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[b.jsx(_i,{...k,name:"title",required:!0}),b.jsx(_i,{...k,name:"source"}),b.jsx(_i,{...k,name:"details",label:"Details (e.g. Source Description)"}),b.jsx(Ip,{...k,name:"accessedAt",required:!0,isDatePicker:!0}),b.jsx(_i,{...k,name:"url",label:"URL / Other Identifier",required:!0}),b.jsx(PI,{...k,name:"classification",row:!0,required:!0,radios:fde})]}),b.jsx(z.DialogActions,{sx:{px:0},children:s?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Ox,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),S()},children:i?"Update Citation":"Add New Citation"})]})}),b.jsx(ade,{open:v,onGenerateCitation:R=>{O(R,!0)},anchorEl:y.current,onClose:()=>g(!1)})]})})]})},fde=[{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."}],pde=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=X.useRef(null),[f,p]=X.useState(!1),[m,y]=X.useState(!1),[v,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),b.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(tm,{})})]}),b.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:Rx().shape({title:El().required("Title is required"),fileName:El().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(C=>{throw p(!1),C}).finally(()=>p(!1))},children:({values:x,setFieldValue:C,handleSubmit:k})=>{var T;return X.useEffect(()=>{var S,O;(S=x.file)!=null&&S.name&&C("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),b.jsxs(Ht.Form,{autoComplete:"off",children:[b.jsx(_i,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(z.Box,{marginTop:i||a?0:1,children:[b.jsxs(Ea,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(II,{name:"file",errorMode:"hidden"}),b.jsx(_i,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(_r,{name:"fileName"})]}),b.jsx(z.DialogActions,{sx:{px:0},children:a?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Ox,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},ed=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 b.jsx(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(z.Box,{children:y()}),b.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(z.Box,{children:y()})})};return b.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(tm,{})})]})}):r,o&&(typeof o=="string"?b.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function hde(t){return qe("MuiAlert",t)}const sO=He("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),mde=Ne(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),gde=Ne(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),yde=Ne(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),bde=Ne(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),vde=Ne(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),xde=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,hde,o)},wde=ne(Ms,{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)}`]]}})(yt(({theme:t})=>{const e=t.palette.mode==="light"?ga:_l,n=t.palette.mode==="light"?_l:ga;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Ln(["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),[`& .${sO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["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}`,[`& .${sO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["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)}}}))]}})),Cde=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Sde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),Tde=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),aO={success:b.jsx(mde,{fontSize:"inherit"}),warning:b.jsx(gde,{fontSize:"inherit"}),error:b.jsx(yde,{fontSize:"inherit"}),info:b.jsx(bde,{fontSize:"inherit"})},hA=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=aO,onClose:y,role:v="alert",severity:g="success",slotProps:x={},slots:C={},variant:k="standard",...T}=r,S={...r,color:l,severity:g,variant:k,colorSeverity:l||g},O=xde(S),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...x}},[N,$]=Ot("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:wde,externalForwardedProps:{...R,...T},ownerState:S,additionalProps:{role:v,elevation:0}}),[F,M]=Ot("icon",{className:O.icon,elementType:Cde,externalForwardedProps:R,ownerState:S}),[j,V]=Ot("message",{className:O.message,elementType:Sde,externalForwardedProps:R,ownerState:S}),[B,A]=Ot("action",{className:O.action,elementType:Tde,externalForwardedProps:R,ownerState:S}),[_,I]=Ot("closeButton",{elementType:Zl,externalForwardedProps:R,ownerState:S}),[L,W]=Ot("closeIcon",{elementType:vde,externalForwardedProps:R,ownerState:S});return b.jsxs(N,{...$,children:[p!==!1?b.jsx(F,{...M,children:p||m[g]||aO[g]}):null,b.jsx(j,{...V,children:i}),o!=null?b.jsx(B,{...A,children:o}):null,o==null&&y?b.jsx(B,{...A,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...I,children:b.jsx(L,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(hA.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 td=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return b.jsxs(hA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(z.Typography,{variant:"h3",children:s}),n]})},mA=t=>b.jsx(td,{severity:"error",...t}),gA=t=>b.jsx(td,{severity:"success",...t}),kde=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return b.jsxs(b.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&b.jsx(mA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(gA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function yA({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:y=!1,tableTitle:v="Attachments & Citations",addlActions:g,canLaunchUrl:x,readOnly:C,canSearch:k=!1}){const[T,S]=X.useState("Insert Citation/Attachment(s)"),[O,R]=X.useState(u),[N,$]=X.useState(void 0),[F,M]=X.useState(void 0),j=Y=>{M(void 0),S(Y)},[V,B]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,F,f]);const A=(Y=!1)=>{(!m||Y)&&B(ee=>ee+1)},_=(Y,ee)=>{var Ie;const fe=typeof((Ie=ee.response)==null?void 0:Ie.data)=="string"&&ee.response.data,Se=typeof ee.message=="string"&&ee.message;M({type:"Error",title:Y,message:fe??Se}),p(ee)},I=Y=>M({type:"Success",title:"",message:Y}),L=async Y=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(T==="Edit Citation"||T==="Edit Attachment"){if(Y.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(Y).then(()=>{j("Insert Citation/Attachment(s)"),A()}).catch(fe=>{_("Failed to update",fe)}))}else await(e==null?void 0:e(Y).then(fe=>{R([...O,fe.id]),j("Insert Citation/Attachment(s)"),A()}).catch(fe=>{_("Failed to create",fe)}))},W=r&&(async Y=>r(Y).then(()=>{A(!0),R(O.filter(ee=>ee!==Y)),I("Successfully deleted")}).catch(ee=>_("Failed to delete",ee))),K=o&&((Y,ee)=>{o(Y.id).then(fe=>{$(fe),j(ee)}).catch(fe=>{_("Failed to load",fe)})}),U=K&&(Y=>K(Y,C?"View Citation":"Edit Citation")),J=K&&(Y=>K(Y,C?"View Attachment":"Edit Attachment")),me=n&&U,he=n&&J,ce=i&&(async Y=>i(Y).catch(ee=>{_(`Failed to download ${Y.fileName}`,ee)})),Z=s&&(async Y=>s(Y).catch(ee=>{_(`Failed to view ${Y.fileName}`,ee)})),oe=b.jsx(kue,{refreshKey:V,getCitationsPaginated:Y=>t(Y).then(ee=>(f==null||f(),ee)),onCancel:l,onNewCitation:()=>{$(void 0),j("Add Citation")},onNewAttachment:()=>{$(void 0),j("Add Attachment")},onEditCitation:me,onEditAttachment:he,onViewCitation:U,onViewAttachment:J,onDeleteCitation:W,onDownloadAttachment:ce,onPreviewAttachment:Z,onSelect:a,setSelectedIds:R,selectedIds:O,onError:p,condenseTable:m,canSelect:y,title:v,addlActions:g,canCreate:!!e,canLaunchUrl:x,readOnly:C,showCloseBtn:m,canSearch:k}),ue=b.jsx(dde,{modifyCitation:N,onSave:L,onCancel:()=>j("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=b.jsx(pde,{onSave:L,onCancel:()=>j("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:N,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),re=b.jsx(kde,{alert:F,setAlert:M}),le=T==="Add Citation"||T==="Edit Citation"||T==="View Citation",ge=T==="Add Attachment"||T==="Edit Attachment"||T==="View Attachment";if(m){let Y=null;return!m||T==="Insert Citation/Attachment(s)"?Y=oe:le?Y=ue:ge&&(Y=te),b.jsxs(z.Box,{children:[re,b.jsx(z.Box,{paddingTop:"8px",children:Y})]})}return b.jsxs(z.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&re,b.jsx(z.Box,{paddingTop:"8px",children:oe}),b.jsx(ed,{open:le||ge,children:b.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[re,le?ue:te]})})]})}function bA({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return b.jsx(yA,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const Ede=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function Ode({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:f,...p}){const m=St();if(m&&!("citationBubbleMenuHandler"in(m==null?void 0:m.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const y=m==null?void 0:m.storage.citationBubbleMenuHandler,v=y.isOpen,g=y.selectedIds,x=y.selectedNodePos,C=O=>{m&&(O.length===0?m.commands.deleteCitation(x):g.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{C(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{C(g),m==null||m.commands.closeCitationBubbleMenu()},S=X.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?b.jsx(wv,{editor:m,open:v,...y.bubbleMenuOptions,...p,children:b.jsx(Ede,{children:b.jsx(bA,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,g),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onCancel:T,initialSelectedIds:g,onContentChange:S,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const Mde=()=>gn.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 _de(t){const e=St(),n=X.useRef(null);return b.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(Dne,{fontSize:"small"}),b.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const vA=X.createContext(void 0),xA=()=>{const t=X.useContext(vA);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Rde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=xA(),[u,f]=X.useState(s?String(s):""),[p,m]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const v=a.filter(C=>s.includes(C.id)),g=v.map(C=>Ta.truncate(C.title,{length:y,omission:"..."})).join(", ");f(g),m(v);const x=v.map(C=>C.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return b.jsx(Uv,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(z.Tooltip,{title:b.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,g)=>{var C;const x=[v.source,v.title,v.fileName,v.url,(C=v.accessedAt)==null?void 0:C.slice(0,10),v.classification];return b.jsxs(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&b.jsx(z.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:b.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Ide=rn.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",Ct(t)]},addNodeView(){return qv(Rde)},addProseMirrorPlugins(){return[new on({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}}}}),wA=t=>b.jsx(RI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Dde=t=>{const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x=()=>{},placeholder:C="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:S,canSearch:O=!1}=t,R=[jR,XD.configure({placeholder:C}),Mde(),Ide.configure({citationMaxLength:a})],[N,$,F]=Ht.useField({name:e}),{setValue:M}=F,{value:j}=N,{addUpdateCitation:V,deleteCitation:B,batchUpdate:A,citations:_}=xA();X.useEffect(()=>{var oe;const ce=(oe=I==null?void 0:I.current)==null?void 0:oe.editor;if(!ce)return;ce.getHTML()!==j&&setTimeout(()=>{ce.commands.setContent(j)},0)},[j]);const I=X.useRef(null),L={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},W=(ce=void 0)=>{var ue,te;const Z=((te=(ue=I.current)==null?void 0:ue.editor)==null?void 0:te.getHTML())??"",oe=!Z.replace(/<\/?p>|<br>/g,"").trim();M(oe?"":Z,ce)},K=X.useMemo(()=>Ta.debounce(()=>W(!1),500),[M]),U=_a(),{showDiff:J,getPreviousValue:me}=Ra(),he=i??U;if(J){const ce=me(e)??"",Z=j,oe=/<citation\s+ids="([^"]*)"><\/citation>/g,ue=(le,ge)=>{const Y=ge.split(",").map(Number);return`<sup>${_.filter(ee=>Y.includes(ee.id)).map(ee=>ee.title)}</sup>`},te=ce.replace(oe,ue),re=Z.replace(oe,ue);return b.jsx(Aa,{label:n,value:re,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:he?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...L[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&b.jsx(wA,{name:k})]}),b.jsx(CI,{ref:I,extensions:R,content:j,editable:!he,renderControls:he?void 0:()=>b.jsx(Fv,{children:b.jsx(_de,{})}),onBlur:()=>W(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>b.jsx(Ode,{getCitationsPaginated:ce=>l(ce).then(Z=>(A(Z.data),Z)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(ce=>f(ce).then(Z=>(V(Z),Z))),onUpdateCitation:p&&(ce=>p(ce).then(Z=>(V(Z),Z))),onDeleteCitation:m&&(ce=>m(ce).then(()=>B(ce))),getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:S,readOnly:he,canSearch:O})}),b.jsx(_r,{name:e,id:`${e}-err`,errorMode:T})]})},Ade=t=>{const{name:e="submit"}=t;return b.jsx(Tr,{name:e,type:"submit",...t})},Pde=t=>{const{label:e="Return to Top",icon:n=Bf,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(z.Zoom,{in:o,children:b.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},CA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ko.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(z.MenuItem,{...Iu(p,o),children:[p.icon&&b.jsx(z.ListItemIcon,{children:p.icon}),b.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},Nde=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=z.useTheme();return b.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(z.List,{children:[b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(z.Divider,{variant:"inset",component:"li"}),b.jsxs(z.ListItem,{id:"testing",children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},$de=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=tA();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...hr({...t},l)};return b.jsx(z.Stepper,{...u,children:e.map(f=>b.jsx(z.Step,{children:b.jsx(z.StepLabel,{children:f})},f))})},jde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx(BI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=Ht.useField({name:e}),{value:C}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(z.FormControl,{fullWidth:!0,children:[b.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(z.Typography,{children:y}):b.jsx(Ht.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[C.map((S,O)=>b.jsx(X.Fragment,{children:b.jsx(Lde,{variant:l,content:b.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?k(g):{...g},children:[b.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==C.length-1&&b.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Lde=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"elevatedCard":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"none":return e}},Bde=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(ed,{actions:[b.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Fde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(ed,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Vde=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(ed,{actions:[b.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},zde={added:{icon:Rne,label:"Added",color:"success"},deleted:{icon:BI,label:"Deleted",color:"error"},modified:{icon:Ane,label:"Modified",color:"info"}},Hde=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:kp},children:b.jsx("s",{children:t})}),b.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:Tp},children:b.jsx("u",{children:e})})]}),Wde=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=kl(s,e,r),l=kl(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??_I.isEqual(a,l))||(o[wn(s)]=Hde(a,l))}return o},Ude=(t,e,n,r=!1,o)=>{const i=[];let s=0,a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);s<e.length&&a<n.length;){const u=e[s],f=n[a];if(u.id===f.id){const p=Wde(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?l++:i.push({...f,changeType:"modified",modifiedDiff:p}),s++,a++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),s++):(i.push({...f,changeType:"added"}),a++)}for(;s<e.length;)i.push({...e[s],changeType:"deleted"}),s++;for(;a<n.length;)i.push({...n[a],changeType:"added"}),a++;return{dataDiff:i,unmodifiedCount:l}},SA=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,unmodifiedCount:l}=Ude(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=zde[f];return b.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:b.jsxs(z.Typography,{children:[b.jsx(P0,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var y;return((y=m.modifiedDiff)==null?void 0:y[wn(f)])??kl(f,m,s)}}))];return{unmodifiedCount:l,columns:u,data:a,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return b.jsx(EM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},TA=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>b.jsxs(z.Box,{children:[b.jsx(Ex,{columns:t,data:e,emptyTableMsg:n,renderExpand:r,size:o}),i>0&&b.jsx(z.Box,{children:b.jsxs(z.Typography,{fontStyle:"italic",children:["+",i," unmodified rows"]})})]}),qde=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?SA({...n,isMobileScreen:r}):n;return b.jsx(TA,{...o,size:t.size})},Kde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Iu(l,a),children:l.label},l.label))}),n&&b.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},kA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ko.useLocation(),i=ko.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>b.jsx(z.MenuList,{children:m.map(v=>b.jsxs(z.MenuItem,{...Iu(v,i,()=>a(!1)),children:[v.icon&&b.jsx(z.ListItemIcon,{children:v.icon}),b.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${y}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,v)=>b.jsxs(X.Fragment,{children:[l(y,v),v<m.length-1&&b.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&b.jsxs(b.Fragment,{children:[b.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(Vne,{})}),b.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},EA=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},OA=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(CA,{label:e,menuOptions:n,icon:b.jsx(Hne,{})})},vm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,...Iu(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))})},MA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:r})})},_A=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return b.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx(LI,{}):b.jsx($I,{})})},Yde=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,v=ko.useNavigate(),g=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:C}=ko.useLocation(),k=x.mode==="dark",[T,S]=D.useState(void 0);D.useEffect(()=>{const N=o.findIndex($=>$.path&&C.startsWith($.path));S(N>=0?N:void 0)},[C,o]);const O=s&&b.jsx(_A,{onToggle:s}),R=s&&(g||!g&&l)?[{icon:k?b.jsx(LI,{}):b.jsx($I,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(EA,{...e}),u,b.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(z.Button,{disableRipple:!0,component:ko.Link,to:"/",children:r&&typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&b.jsx(kA,{menuOptionLists:[o,a,R],anchor:"right"}),!g&&b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,$)=>b.jsxs(z.Box,{display:"flex",alignItems:"center",children:[$>0&&b.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(z.Button,{variant:"text",sx:{color:"white"},...Iu(N,v),children:b.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&b.jsx(OA,{displayName:l,userMenuOptions:R})]})]})]}),!g&&b.jsx(MA,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Gde=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ko.useLocation(),o=z.useMediaQuery(z.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&&b.jsx(z.Box,{sx:e,children:b.jsx(z.Card,{sx:{height:"100%",width:200},children:b.jsx(vm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Jde=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&b.jsx(vm,{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}})},Xde=({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(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(v=>{const g=u.find(x=>x.id===v.id);return g||v}),m=new Set(f.map(v=>v.id)),y=u.filter(v=>!m.has(v.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 b.jsx(vA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Zde=t=>b.jsx(td,{severity:"info",...t}),Qde=t=>b.jsx(td,{severity:"warning",...t}),RA=t=>{const{crumbInfo:e}=t,n=ko.useNavigate();return b.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(zne,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(z.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(z.Typography,{color:"primary",children:r},r))})},efe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=tfe(r);return b.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(td,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:lO(r),warning:lO(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},tfe=t=>t=="logout"?"info":t=="timeout"?"warning":t,lO=t=>{if(t=="timeout")return b.jsx(_ne,{});if(t=="logout")return b.jsx(Fne,{})},nfe=t=>{rfe(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(RA,{crumbInfo:i}),b.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(Tr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(Ine,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},rfe=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},ofe=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return b.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),b.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},ife=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(z.Box,{className:"text-content",children:[b.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(z.Typography,{"data-testid":"message",children:n})]}),b.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function sfe({...t}){return b.jsx(yA,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const afe=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return b.jsx(z.Box,{height:n})};exports.AlertModal=Fde;exports.Autocomplete=MI;exports.Breadcrumbs=RA;exports.Button=Tr;exports.Checkbox=RI;exports.CheckboxGroup=ene;exports.CitationField=Dde;exports.CitationFieldProvider=Xde;exports.CitationManager=sfe;exports.Column=Ru;exports.ConfirmationModal=Bde;exports.DarkModeToggle=_A;exports.DateField=Ip;exports.DateRangeField=kce;exports.DecisionModal=Vde;exports.Diff=OI;exports.DiffProvider=EM;exports.DiffTable=qde;exports.DiffTableView=TA;exports.Drawer=kA;exports.DynamicAutocomplete=Zte;exports.EnvironmentBanner=EA;exports.ErrorAlert=mA;exports.FileList=rne;exports.FileUpload=II;exports.FloatingNavBar=Jde;exports.Footer=Kde;exports.FormDebugger=Nde;exports.Header=Yde;exports.InfoAlert=Zde;exports.LoadingButton=Ox;exports.LoadingIndicator=ife;exports.LoadingOverlay=QD;exports.Location=kne;exports.MenuButton=CA;exports.Modal=ed;exports.MultiAutocomplete=Qte;exports.NavBar=MA;exports.NotApplicableCheckbox=wA;exports.PageHeader=nfe;exports.PaginatedTable=eA;exports.ProfileMenu=OA;exports.RadioGroup=PI;exports.RangeSlider=Ene;exports.ReadOnly=Aa;exports.ReadOnlyProvider=TM;exports.RepeatableFormGroup=jde;exports.RichTextField=xue;exports.Row=Ea;exports.ScrollToTop=Pde;exports.SearchField=FI;exports.Select=One;exports.SelectableCitationManager=bA;exports.Sidebar=Gde;exports.SingleActionCard=ofe;exports.Snackbar=efe;exports.Spacer=afe;exports.Stepper=$de;exports.Submit=Ade;exports.SuccessAlert=gA;exports.Switch=Mne;exports.Table=Ex;exports.Tabs=vm;exports.TextArea=NI;exports.TextField=_i;exports.TextIcon=P0;exports.ValidationError=_r;exports.WarningAlert=Qde;exports.baseCitationTableColumns=nA;exports.buildTableDiff=SA;exports.commonTheme=In;exports.darkTheme=lz;exports.lightTheme=az;exports.useDiff=Ra;exports.useReadOnly=_a;
|
package/dist/index.es.js
CHANGED
|
@@ -62049,7 +62049,16 @@ const Sfe = (t) => {
|
|
|
62049
62049
|
/* @__PURE__ */ Q(Ql, { justifyContent: "space-between", children: [
|
|
62050
62050
|
/* @__PURE__ */ Q(Ql, { children: [
|
|
62051
62051
|
/* @__PURE__ */ w(Je, { variant: "h6", margin: "10px 0", children: e }),
|
|
62052
|
-
/* @__PURE__ */ w(
|
|
62052
|
+
!s && /* @__PURE__ */ w(
|
|
62053
|
+
Rn,
|
|
62054
|
+
{
|
|
62055
|
+
variant: "text",
|
|
62056
|
+
size: "small",
|
|
62057
|
+
ref: y,
|
|
62058
|
+
onClick: () => g(!0),
|
|
62059
|
+
children: "Paste & Prefill"
|
|
62060
|
+
}
|
|
62061
|
+
)
|
|
62053
62062
|
] }),
|
|
62054
62063
|
a && /* @__PURE__ */ w(Hn, { onClick: o, children: /* @__PURE__ */ w(Mm, {}) })
|
|
62055
62064
|
] }),
|
|
@@ -62059,9 +62068,9 @@ const Sfe = (t) => {
|
|
|
62059
62068
|
innerRef: l,
|
|
62060
62069
|
enableReinitialize: !0,
|
|
62061
62070
|
initialValues: v,
|
|
62062
|
-
onSubmit: async (
|
|
62063
|
-
f(!0), n(
|
|
62064
|
-
throw f(!1),
|
|
62071
|
+
onSubmit: async (S) => {
|
|
62072
|
+
f(!0), n(S).catch((O) => {
|
|
62073
|
+
throw f(!1), O;
|
|
62065
62074
|
}).finally(() => f(!1));
|
|
62066
62075
|
},
|
|
62067
62076
|
validationSchema: ux({
|
|
@@ -62072,7 +62081,7 @@ const Sfe = (t) => {
|
|
|
62072
62081
|
}),
|
|
62073
62082
|
validateOnBlur: p,
|
|
62074
62083
|
validateOnChange: p,
|
|
62075
|
-
children: ({ submitForm:
|
|
62084
|
+
children: ({ submitForm: S, setValues: O }) => /* @__PURE__ */ Q(EM, { autoComplete: "off", children: [
|
|
62076
62085
|
/* @__PURE__ */ Q(Ne, { display: "flex", flexDirection: "column", gap: s ? 1 : 0, alignItems: "flex-start", children: [
|
|
62077
62086
|
/* @__PURE__ */ w(Es, { ...k, name: "title", required: !0 }),
|
|
62078
62087
|
/* @__PURE__ */ w(Es, { ...k, name: "source" }),
|
|
@@ -62106,7 +62115,7 @@ const Sfe = (t) => {
|
|
|
62106
62115
|
loading: u,
|
|
62107
62116
|
type: "button",
|
|
62108
62117
|
onClick: () => {
|
|
62109
|
-
m(!0),
|
|
62118
|
+
m(!0), S();
|
|
62110
62119
|
},
|
|
62111
62120
|
children: i ? "Update Citation" : "Add New Citation"
|
|
62112
62121
|
}
|
|
@@ -62116,8 +62125,8 @@ const Sfe = (t) => {
|
|
|
62116
62125
|
Sfe,
|
|
62117
62126
|
{
|
|
62118
62127
|
open: b,
|
|
62119
|
-
onGenerateCitation: (
|
|
62120
|
-
|
|
62128
|
+
onGenerateCitation: (R) => {
|
|
62129
|
+
O(R, !0);
|
|
62121
62130
|
},
|
|
62122
62131
|
anchorEl: y.current,
|
|
62123
62132
|
onClose: () => g(!1)
|
package/dist/index.umd.js
CHANGED
|
@@ -405,4 +405,4 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
405
405
|
3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function sQ(){Kt.scanner=ZZ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=tQ(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 sv(t){return Kt.initialized||sQ(),nQ(Kt.parser.start,t,_2(Kt.scanner.start,t))}sv.scan=_2;function L2(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 ov(n),o=sv(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const av="[\0- -\u2029 ]",aQ=new RegExp(av),lQ=new RegExp(`${av}$`),cQ=new RegExp(av,"g");function uQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function dQ(t){return new en({key:new On("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=VR(n.doc,[...e]);if(KR(a).forEach(({newRange:u})=>{const f=WR(r.doc,u,b=>b.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const b=r.doc.textBetween(u.from,u.to," "," ");if(!lQ.test(b))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const b=m.split(aQ).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=sv(v).map(S=>S.toObject(t.defaultProtocol));if(!uQ(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:g+S.start+1,to:g+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{Gg(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function fQ(t){return new en({key:new On("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=Yg(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 pQ(t){return new en({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=L2(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function Sa(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(cQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const hQ=xr.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"){$2(t);return}$2(t.scheme,t.optionalSlashes)})},onDestroy(){iQ()},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)=>!!Sa(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=>!!Sa(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=>!!Sa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xt(this.options.HTMLAttributes,t),0]:["a",xt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Sa(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=>!!Sa(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[ls({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=L2(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Sa(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(dQ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Sa(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(fQ({type:this.type})),this.options.linkOnPaste&&t.push(pQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function mQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=b3(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,b=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(b)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!k)return null;const T=g+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const gQ=new On("suggestion");function yQ({pluginKey:t=gQ,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=mQ}){let x;const S=b==null?void 0:b(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,$,L,V,M,B;const H=(O=this.key)===null||O===void 0?void 0:O.getState(C),R=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=H.active&&R.active&&H.range.from!==R.range.from,_=!H.active&&R.active,A=H.active&&!R.active,F=!_&&!A&&H.query!==R.query,j=_||P&&F,K=F||P,U=A||P&&F;if(!j&&!K&&!U)return;const J=U&&!j?H:R,me=T.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);x={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:he=>p({editor:e,range:J.range,props:he}),decorationNode:me,clientRect:me?()=>{var he;const{decorationId:ce}=(he=this.key)===null||he===void 0?void 0:he.getState(e.state),Z=T.dom.querySelector(`[data-decoration-id="${ce}"]`);return(Z==null?void 0:Z.getBoundingClientRect())||null}:null},j&&(($=S==null?void 0:S.onBeforeStart)===null||$===void 0||$.call(S,x)),K&&((L=S==null?void 0:S.onBeforeUpdate)===null||L===void 0||L.call(S,x)),(K||j)&&(x.items=await m({editor:e,query:J.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),j&&((B=S==null?void 0:S.onStart)===null||B===void 0||B.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,I){const{isEditable:$}=e,{composing:L}=e.view,{selection:V}=T,{empty:M,from:B}=V,H={...C};if(H.composing=L,$&&(M||e.view.composing)){(B<C.range.from||B>C.range.to)&&!L&&!C.composing&&(H.active=!1);const R=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;R&&v({editor:e,state:I,range:R.range,isActive:C.active})?(H.active=!0,H.decorationId=C.decorationId?C.decorationId:P,H.range=R.range,H.query=R.query,H.text=R.text):H.active=!1}else H.active=!1;return H.active||(H.decorationId=null,H.range={from:0,to:0},H.query=null,H.text=null),H}},props:{handleKeyDown(T,C){var O;const{active:I,range:$}=k.getState(T.state);return I&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:$}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:$}=k.getState(T);if(!C)return null;const L=!($!=null&&$.length),V=[l];return L&&V.push(f),Jt.create(T.doc,[Yn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function bQ({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new On;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function B2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>bQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function F2(t,e){const n=B2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const vQ=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",xt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=F2(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=xt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:F2(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new fi,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return B2(this).map(yQ)}}),R2=cn.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 On("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&cf(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Yn.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}),Jt.create(t,o)}}})]}}),xQ=xr.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",xt(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()}}}),wQ=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",xt(this.options.HTMLAttributes,t),0]}}),SQ=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",xt(this.options.HTMLAttributes,t),0]}}),CQ=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",xt(this.options.HTMLAttributes,t),0]}}),TQ=/^\s*(\[([( |x])?\])\s$/,kQ=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const b=n();if(typeof b!="number")return!1;const v=m.doc.nodeAt(b);return m.setNodeMarkup(b,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[al({find:TQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),EQ=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",xt(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()}}}),OQ=cn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),z2=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?y.jsx(z.Paper,{elevation:5,children:y.jsx(z.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>y.jsx(z.ListItem,{disablePadding:!0,children:y.jsx(z.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});z2.displayName="SuggestionList";const V2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},MQ={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 gO(z2,{props:n,editor:n.editor}),e=lu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??V2},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))??V2}})},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}}}},_Q=hQ.extend({inclusive:!1}),IQ=xQ.extend({excludes:"superscript"}),AQ=aM.extend({excludes:"subscript"});function DQ({placeholder:t}={}){return X.useMemo(()=>[v7.configure({resizable:!0}),CQ,SQ,wQ,dT,pT,hT,bT,_T,DT,PT,IQ,AQ,$T,lT,aT,fT,MT,sM,NT,_Q.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),r8,yT,t8,OQ.configure({types:["heading","paragraph","image"]}),VZ,HZ,WZ,Zj,HT.configure({multicolor:!0}),OT,b8,mT,EQ,kQ.configure({nested:!0}),vQ.configure({suggestion:MQ}),R2.configure({placeholder:t}),ET],[t])}function H2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const PQ=t=>{const e=DQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return y.jsx(oM,{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]=Ht.useField({name:n}),{setValue:f}=u,{value:p}=a;X.useEffect(()=>{var S,k,T;(T=(k=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:k.commands)==null||T.setContent(p)},[p]);const m=X.useRef(null),b=X.useCallback((S,k)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{ib({images:O,editor:T,position:k})});else{const O=i(S);ib({images:O,editor:T,position:k})}},[]),v=X.useCallback((S,k,T,C)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=H2(k.dataTransfer.files);if(O.length>0){const $=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return b(O,$),k.preventDefault(),!0}return!1},[b]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=H2(k.clipboardData.files);return C.length>0?(b(C),!0):!1},[b]),x=y.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:y.jsx(rM,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>y.jsx(RZ,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>y.jsxs(y.Fragment,{children:[y.jsx(z7,{}),y.jsx(eU,{})]})})});return y.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&y.jsx(z.Typography,{...o,children:r}),x]})},W2=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?y.jsx(z.Collapse,{in:n,children:u}):y.jsx(z.TableRow,{sx:p,children:y.jsx(z.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:y.jsx(z.Collapse,{in:n,children:u})})})},j2=({isLoading:t,children:e})=>{const[n,r]=X.useState(!1);return X.useEffect(()=>{let o,i;return t?o=setTimeout(()=>r(!0),300):n?i=setTimeout(()=>r(!1),200):(o&&clearTimeout(o),r(!1)),()=>{o&&clearTimeout(o),i&&clearTimeout(i)}},[t,n]),y.jsxs(z.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,y.jsx(z.Box,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,pointerEvents:n?"auto":"none",opacity:n?1:0,transition:"opacity 0.3s ease"},children:y.jsx(z.CircularProgress,{})})]})},Ca=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return y.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Bu=t=>{const{gap:e=1,...n}=t;return y.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},lv=t=>{const{id:e,getRowKey:n=ae=>"id"in ae&&(typeof ae.id=="string"||typeof ae.id=="number")?ae.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(ae)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(ae)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,checkedIds:a,setCheckedIds:l,renderExpand:u,sortField:f,sortOrder:p,onSortChange:m,allowSortCols:b,fixedLayout:v=!1,className:g,emptyTableMsg:x="No items to display",errorTableMsg:S,retryCallback:k,isLoading:T=!1,disableMobileCards:C=!1,highlightSelectedRow:O=!1,headerRowStyle:I={},stickyHeader:$,reRenderExpand:L=!1,expandOnRowClick:V=!1,tooltipColor:M,...B}=t,{palette:H}=z.useTheme(),[R,P]=X.useState(void 0),[_,A]=X.useState(void 0);NQ(t);const F=ae=>{ae!==f?m&&m(ae,"asc"):m&&m(f,p==="asc"?"desc":"asc")},j=ae=>f===ae?p:null,K=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),U=r.filter(ae=>!ae.hideCol&&(!K||!ae.hideOnMobile));u&&!K&&U.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:ae=>{const _e=R===ae;return y.jsx(z.IconButton,{"data-testid":"expand-collapse-btn","aria-label":_e?"collapse row":"expand row",size:"small",onClick:()=>re(ae),children:_e?y.jsx(pp,{"data-testid":"collapse-up"}):y.jsx(y0,{"data-testid":"expand-down"})})}}),a&&l&&U.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:ae=>y.jsx(z.Checkbox,{onChange:()=>{const _e=a.includes(ae);l(_e?a.filter(Be=>Be!==ae):[...a,ae])},checked:a.includes(ae)})});const J=m!==void 0,me=ae=>J?b?b.includes(ae):!0:!1,he=y.jsxs(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[y.jsx(ZU,{})," ",x]}),ce=y.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[y.jsx(cw,{color:"error"})," ",S,k&&y.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),Z=()=>{if(S)return y.jsx(z.TableRow,{children:y.jsx(z.TableCell,{colSpan:r.length,align:"center",children:ce})});if(o.length===0)return y.jsx(z.TableRow,{children:y.jsx(z.TableCell,{colSpan:r.length,align:"center",children:he})})},oe=()=>{if(S)return ce;if(o.length===0)return he},ue=ae=>{O&&A(ae)},te=ae=>{const _e=n(ae);if((i||s)&&(i==null||i(_e),s==null||s(ae),ue(_e)),u&&V){const Be=R===_e?void 0:_e;P(Be),ue(Be)}},re=ae=>{const _e=R===ae?void 0:ae;P(_e),ue(_e)},le=ae=>{if(!u)return;const _e=R===n(ae);return y.jsxs(y.Fragment,{children:[y.jsxs(z.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>re(n(ae)),children:[_e?y.jsx(pp,{}):y.jsx(y0,{})," Show"," ",_e?"Less":"More"]}),y.jsx(W2,{colSpan:r.length,isExpanded:n(ae)===R,obj:ae,renderExpand:Be=>u(Be),asMobileCard:!0})]})},ge=typeof O=="string"?O:H.grey[H.mode=="dark"?600:50],Y=ae=>{const _e=_===n(ae)?ge:"inherit";return{cursor:i||V?"pointer":"default",backgroundColor:_e,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:_e===ge?bG(_e,.1):ge}}}},ee=H.grey[H.mode==="dark"?600:400],pe=ae=>ae&&y.jsx(z.Tooltip,{title:ae,children:y.jsx(XU,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:M??ee,marginLeft:"2px"}})}),Ce=(ae,_e)=>{const Be=ae.find(Me=>Me.key==="MBv2_Checkbox_Column"),$e=U.filter(Me=>Me.key!=="MBv2_Checkbox_Column");return y.jsxs(Ca,{alignItems:"flex-start",children:[Be&&y.jsx(Bu,{children:Ll(Be,_e,K)}),y.jsxs(Bu,{width:"100%",children:[y.jsx("table",{className:"MBv2_Table_Stack",children:y.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:$e.map(Me=>y.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[y.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${xn(Me)}`,style:{textWrap:"nowrap"},children:[Me.label??Ln(xn(Me)),pe(Me.tooltip)]}),y.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(Me)}`,style:{paddingLeft:"10px"},children:Ll(Me,_e,K)})]},`row-${n(_e)}-${xn(Me)}`))})}),le(_e)]})]})},Se=()=>y.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:g,"data-testid":"mui-table-mobile",children:[J&&y.jsxs(y.Fragment,{children:[y.jsxs(z.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[y.jsx(z.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:f??"",label:"Sort By...",onChange:ae=>F(ae.target.value),fullWidth:!0,children:U.map(ae=>{if(me(xn(ae)))return y.jsx(z.MenuItem,{value:xn(ae),children:ae.label??Ln(xn(ae))},`rowHeader-${xn(ae)}`)})}),y.jsx(z.IconButton,{onClick:()=>{f&&F(f)},children:y.jsx(iq,{className:`sort-icon-${p}`})})]}),y.jsx(z.Divider,{sx:{margin:"10px 0"}})]}),oe()??o.map(ae=>y.jsx(z.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...Y(ae)},onClick:()=>te(ae),"data-testid":`card-${n(ae)}`,children:Ce(U,ae)},n(ae)))]}),Ae=()=>y.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:$?{maxHeight:$,overflow:"auto"}:{},children:y.jsxs(z.Table,{stickyHeader:$!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:I?{"& .MuiTableCell-head":{...I}}:{},...B,children:[y.jsx(z.TableHead,{className:"MBv2_Table_Head",children:y.jsx(z.TableRow,{className:"MBv2_Table_Head_Row",children:U.map((ae,_e)=>{const Be=me(xn(ae));return y.jsx(z.TableCell,{width:Array.isArray(v)?v[_e]:"auto",sx:ae.tableCellSx??{},children:y.jsx(z.Box,{style:{display:"flex",alignItems:"center"},children:y.jsxs(z.Box,{sx:[Be&&{"&:hover":{cursor:"pointer",backgroundColor:H.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Be?()=>F(xn(ae)):void 0,children:[y.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ae.label??Ln(xn(ae))}),pe(ae.tooltip),Be&&j(xn(ae))==="asc"&&y.jsx(pp,{style:{marginLeft:"5px"}}),Be&&j(xn(ae))==="desc"&&y.jsx(y0,{style:{marginLeft:"5px"}}),Be&&j(xn(ae))!=="asc"&&j(xn(ae))!=="desc"&&y.jsx(rq,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(ae)}`)})})}),y.jsx(z.TableBody,{className:"MBv2_Table_Body",children:Z()??o.map(ae=>y.jsxs(X.Fragment,{children:[y.jsx(z.TableRow,{"data-testid":`row-${n(ae)}`,className:"MBv2_Table_Body_Row",onClick:()=>te(ae),sx:Y(ae),children:U.map(_e=>y.jsx(z.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(_e)}`,children:Ll(_e,ae,K)},`row-${n(ae)}-${xn(_e)}`))}),u&&y.jsx(W2,{colSpan:U.length,isExpanded:n(ae)===R,obj:ae,renderExpand:_e=>u(_e),reRenderExpand:L})]},n(ae)))})]})});return y.jsx(j2,{isLoading:T,children:K&&!C?Se():Ae()})},NQ=t=>{const{fixedLayout:e,checkedIds:n,setCheckedIds:r,renderExpand:o,columns:i,expandOnRowClick:s,onRowClick:a,onRowClickObj:l}=t,u="Table component:";Array.isArray(e)&&(!o&&e.length!==i.length&&console.warn(`${u} Length of "fixedLayout" is not equal to the length of "columns". Got=${e.length}. Expected=${i.length}`),o&&e.length!==i.length+1&&console.warn(`${u} 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&&!o&&console.warn(`${u} renderExpand should be defined when expandOnRowClick is defined`),a&&l&&console.warn(`${u} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`),(n||r)&&o&&console.warn(`${u} checkedIds/setCheckedIds & renderExpand cannot both be defined`),n&&!r&&console.warn(`${u} if checkedIds is defined, setCheckedIds must also be defined`),!n&&r&&console.warn(`${u} if setCheckedIds is defined, checkedIds must also be defined`);const f=i.map(b=>xn(b)),p=f.filter((b,v)=>f.indexOf(b)!==v),m=[...new Set(p)];m.length>0&&console.warn(`${u} duplicate key/fieldName found in 'columns': ${m.join(", ")}. Make sure to define a unique 'key' if you have multiple column definitions with the same 'fieldName'.`)},xn=t=>t.key??t.fieldName,$Q=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Ll=(t,e,n=!1)=>{const r=$Q(e,t.fieldName);return t.render?t.render(r,e,n):r},U2=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},b=x=>{r(parseInt(x.target.value,10))},v=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return y.jsxs(z.Box,{children:[y.jsx(lv,{sortOrder:p,sortField:f,...s}),!o&&!g&&y.jsx(z.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:b,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},q2=()=>({height:window.innerHeight,width:window.innerWidth}),K2=()=>{const[t,e]=X.useState(q2());return X.useEffect(()=>{const n=()=>{e(q2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},kr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=K2(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return y.jsx(z.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...cr({...t},a)})},LQ=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return y.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&y.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[y.jsxs(z.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",y.jsx("br",{}),y.jsx("b",{children:e.url}),"?"]}),y.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[y.jsx(kr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),y.jsx(kr,{size:"small",startIcon:y.jsx(b0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},BQ=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return y.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&y.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[y.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),y.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[y.jsx(kr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),y.jsx(kr,{size:"small",color:"error",startIcon:y.jsx(e0,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},FQ=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onViewCitation:l,onViewAttachment:u,onDeleteCitation:f,onDownloadAttachment:p,onPreviewAttachment:m,onSelect:b,getCitationsPaginated:v,selectedIds:g,setSelectedIds:x,onError:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:I=!1,showCloseBtn:$=!1,canSearch:L=!1}=t,V=!!t.canCreate&&!I,M=!!a&&!!s&&!I,B=!!u&&!!l&&I&&k,H=!!f&&!I,{palette:R}=z.useTheme(),[P,_]=X.useState([]),[A,F]=X.useState(!1),[j,K]=X.useState(!0),[U,J]=X.useState(null),[me,he]=X.useState(null),[ce,Z]=X.useState(null),[oe,ue]=X.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:L?"":void 0}),te=()=>{F(!1),K(!0),v({pageNo:oe.pageNo,pageSize:oe.pageSize,search:oe.search}).then($e=>(_($e.data),ue(Me=>({...Me,totalCount:$e.totalCount})),$e)).catch($e=>{S($e),F(!0),_([])}).finally(()=>K(!1))};X.useEffect(te,[oe.pageNo,oe.pageSize,e,oe.search]);const re=()=>{he(null),Z(null),J(null)},le=y.jsx(kr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:y.jsx(Wf,{}),children:"Add Citation"}),ge=y.jsx(kr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:y.jsx(FM,{}),children:"Add Attachment"}),Y=$e=>{if(!(!M&&!B)){if(M)return y.jsx(z.Tooltip,{title:"Edit",children:y.jsx(z.IconButton,{color:"primary",onClick:()=>$e.fileName?a($e):s($e),"data-testid":`citation-table_edit-btn-${$e.id}`,children:y.jsx(JU,{})})});if(B)return y.jsx(z.Tooltip,{title:"View",children:y.jsx(z.IconButton,{color:"primary",onClick:()=>$e.fileName?u($e):l($e),"data-testid":`citation-table_view-btn-${$e.id}`,children:y.jsx(sq,{})})})}},ee=$e=>{if(!(!H||I))return y.jsx(z.Tooltip,{title:"Delete",children:y.jsx(z.IconButton,{color:"error",onClick:Me=>{he($e),J(Me.currentTarget)},"data-testid":`citation-table_delete-btn-${$e.id}`,children:y.jsx(e0,{})})})},pe=$e=>{if(!C)return;if(!$e.fileName)return y.jsx(z.Tooltip,{title:"Open URL",children:y.jsx(z.IconButton,{color:"primary",onClick:Et=>{J(Et.currentTarget),Z($e)},"data-testid":`citation-table_launch-link-btn-${$e.id}`,sx:{visibility:C!=null&&C($e)?"visible":"hidden"},children:y.jsx(b0,{})})})},Ce=$e=>{if(!m||!$e.fileName)return;const Me=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],Et=$e.fileName.split(".").pop();if(!(!Et||!Me.includes(Et)))return y.jsx(z.Tooltip,{title:"View File",children:y.jsx(z.IconButton,{color:"primary",onClick:()=>m==null?void 0:m($e),"data-testid":`citation-table_view-file-btn-${$e.id}`,children:y.jsx(b0,{})})})},Se=$e=>{if(!p)return;if(!!$e.fileName)return y.jsx(z.Tooltip,{title:"Download",children:y.jsx(z.IconButton,{color:"primary",onClick:()=>p==null?void 0:p($e),"data-testid":`citation-table_download-btn-${$e.id}`,children:y.jsx(GU,{})})})},Ae=B||M||H||C||m||p||O,ae=[...G2(R,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Ae,render:($e,Me)=>y.jsxs(z.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(Me),ee(Me),Y(Me),Ce(Me),pe(Me),Se(Me)]})}],_e=X.useCallback($e=>{ue(Me=>({...Me,pageNo:0,search:$e}))},[]),Be=()=>L?y.jsx(VM,{onSearch:_e}):null;return y.jsxs(Bu,{children:[y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[y.jsx(z.Typography,{variant:k?"h6":"h2",children:n}),!T&&V&&y.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ge]}),$&&y.jsx(z.IconButton,{onClick:r,children:y.jsx(fp,{})})]}),Be(),y.jsx(U2,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:j,columns:ae,data:P,paginationState:oe,onPageChange:$e=>ue(Me=>({...Me,pageNo:$e})),onRowsPerPageChange:$e=>ue(Me=>({...Me,pageSize:$e,pageNo:0})),errorTableMsg:A?"Failed to load citations.":void 0,retryCallback:te,setCheckedIds:T?x:void 0,checkedIds:T?g:void 0}),T&&y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[y.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&y.jsxs(y.Fragment,{children:[le,ge]})}),!I&&y.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[y.jsx(kr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),y.jsxs(kr,{variant:"contained",size:"small",onClick:()=>b(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),y.jsx(LQ,{citation:ce,anchorEl:U,onClose:re}),y.jsx(BQ,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:re})]})},Y2=(t,e)=>{const n=t?ma.truncate(e,{length:30,omission:"..."}):e,r=n==null?void 0:n.endsWith("...");return y.jsx("span",{style:{wordBreak:"break-all"},children:r?y.jsx(z.Tooltip,{title:e,children:y.jsx("span",{children:n})}):e})},G2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>y.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?y.jsx(FM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):y.jsx(Wf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>Y2(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>Y2(e,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"details",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],cv=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return y.jsx(kr,{type:n,disabled:e,size:r,startIcon:e?y.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var uv,J2;function RQ(){if(J2)return uv;J2=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,k){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=k};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);uv={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var I=0,$=k.length,L=C;I<$-1;){var V=k[I];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;L=L[k[I++]]}L[k[I]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var I=0,$=T.length;I<$;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(b(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,I,$,L;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),L=b(O),$=!L&&/^\d+$/.test(O),k.call(T,O,L,$,I,S))}function b(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!b(S)&&(v(S)||g(S))}return uv}var Ta=RQ(),dv,X2;function zQ(){if(X2)return dv;X2=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 dv={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(" ")},dv}var fv=zQ(),Th={exports:{}},Z2;function VQ(){if(Z2)return Th.exports;Z2=1,Th.exports=function(o){return t(e(o),o)},Th.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(b){if(!p.has(b[0])||!p.has(b[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(b,v,g){if(g.has(b)){var x;try{x=", node was:"+JSON.stringify(b)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(b))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(b));if(!l[v]){l[v]=!0;var S=f.get(b)||new Set;if(S=Array.from(S),v=S.length){g.add(b);do{var k=S[--v];m(k,p.get(k),g)}while(v);g.delete(b)}a[--s]=b}}}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 Th.exports}var HQ=VQ();const WQ=Un(HQ),jQ=Object.prototype.toString,UQ=Error.prototype.toString,qQ=RegExp.prototype.toString,KQ=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",YQ=/^Symbol\((.*)\)(.*)$/;function GQ(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function Q2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return GQ(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return KQ.call(t).replace(YQ,"Symbol($1)");const r=jQ.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+UQ.call(t)+"]":r==="RegExp"?qQ.call(t):null}function ws(t,e){let n=Q2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=Q2(this[r],e);return i!==null?i:o},2)}function eI(t){return t==null?[]:[].concat(t)}let tI,nI,rI,JQ=/\$\{\s*(\w+)\s*\}/g;tI=Symbol.toStringTag;class oI{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[tI]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],eI(e).forEach(i=>{if(hr.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]}}nI=Symbol.hasInstance,rI=Symbol.toStringTag;class hr 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(JQ,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new oI(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[rI]="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,hr)}static[nI](e){return oI[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ei={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},Er={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"},XQ={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"},pv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},ZQ={isValue:"${path} field must be ${value}"},kh={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:Er,number:XQ,date:pv,object:kh,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:ZQ,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: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return hr.formatError(ei.notType,t)}}});const hv=t=>t&&t.__isYupSchema__;class Eh{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 Eh(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(!hv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Oh={context:"$",value:"."};class ka{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]===Oh.context,this.isValue=this.key[0]===Oh.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Oh.context:this.isValue?Oh.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Ta.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}}ka.prototype.__isYupRef=!0;const Ea=t=>t==null;function Bl(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:b}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(B={}){const H=iI(Object.assign({value:n,originalValue:i,label:s.spec.label,path:B.path||r,spec:s.spec,disableStackTrace:B.disableStackTrace||S},p,B.params),k),R=new hr(hr.formatError(B.message||m,H),n,H.path,B.type||u,H.disableStackTrace);return R.params=H,R}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(B){return sI(B,k)},options:o,originalValue:i,schema:s};const I=B=>{hr.isError(B)?C(B):B?l(null):C(T())},$=B=>{hr.isError(B)?C(B):a(B)};if(b&&Ea(n))return I(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(I,$)}}catch(B){$(B);return}I(V)}return e.OPTIONS=t,e}function iI(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=sI(t[n],e);return t}function sI(t,e){return ka.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function QQ(t,e,n,r=n){let o,i,s;return e?(Ta.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 Mh extends Set{describe(){const e=[];for(const n of this.values())e.push(ka.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 Mh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Fl(t,e=new Map){if(hv(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]=Fl(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,Fl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Fl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Fl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function eee(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function tee(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:eee(n)}))}function aI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return tee(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>aI(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Mh,this._blacklist=new Mh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ei.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=Fl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ea(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
406
406
|
|
|
407
407
|
attempted value: ${s}
|
|
408
|
-
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,b=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(k){k&&(Array.isArray(k)?b.push(...k):b.push(k)),--m<=0&&p(b)})}}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,b)=>this.resolve(f)._validate(u,f,m,b)}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)=>{hr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new hr(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 hr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new hr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(hr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(hr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Fl(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=Bl({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=Bl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=ei.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ei.notNull){return this.nullability(!1,e)}required(e=ei.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=ei.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Bl(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=eI(e).map(i=>new ka(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Eh(o,n):Eh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Bl({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=ei.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Bl({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=ei.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Bl({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?iI(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof hr)return{issues:aI(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=QQ(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const nee=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function ree(t){const e=mv(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 mv(t){var e,n;const r=nee.exec(t);return r?{year:Ai(r[1]),month:Ai(r[2],1)-1,day:Ai(r[3],1),hour:Ai(r[4]),minute:Ai(r[5]),second:Ai(r[6]),millisecond:r[7]?Ai(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:Ai(r[10]),minuteOffset:Ai(r[11])}:null}function Ai(t,e=0){return Number(t)||e}let oee=/^[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])?)*$/,iee=/^((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,see=/^(?:[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,aee="^\\d{4}-\\d{2}-\\d{2}",lee="\\d{2}:\\d{2}:\\d{2}",cee="(([+-]\\d{2}(:?\\d{2})?)|Z)",uee=new RegExp(`${aee}T${lee}(\\.\\d+)?${cee}$`),dee=t=>Ea(t)||t===t.trim(),fee={}.toString();function Rl(){return new lI}class lI extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===fee?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||ei.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=Er.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=Er.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=Er.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||Er.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=Er.email){return this.matches(oee,{name:"email",message:e,excludeEmptyString:!0})}url(e=Er.url){return this.matches(iee,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=Er.uuid){return this.matches(see,{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(uee,{name:"datetime",message:n||Er.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||Er.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=mv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||Er.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=mv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=Er.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:dee})}lowercase(e=Er.lowercase){return this.transform(n=>Ea(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ea(n)||n===n.toLowerCase()})}uppercase(e=Er.uppercase){return this.transform(n=>Ea(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ea(n)||n===n.toUpperCase()})}}Rl.prototype=lI.prototype;let cI=new Date(""),pee=t=>Object.prototype.toString.call(t)==="[object Date]";function gv(){return new Fu}class Fu extends ti{constructor(){super({type:"date",check(e){return pee(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=ree(e),isNaN(e)?Fu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ka.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=pv.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=pv.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)}})}}Fu.INVALID_DATE=cI,gv.prototype=Fu.prototype,gv.INVALID_DATE=cI;function hee(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Ta.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),ka.isRef(a)&&a.isSibling?i(a.path,s):hv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return WQ.array(Array.from(r),n).reverse()}function uI(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 dI(t){return(e,n)=>uI(t,e)-uI(t,n)}const mee=(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 _h(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=_h(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=_h(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(_h)}):"optional"in t?t.optional():t}const gee=(t,e)=>{const n=[...Ta.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Ta.getter(Ta.join(n),!0)(t);return!!(o&&r in o)};let fI=t=>Object.prototype.toString.call(t)==="[object Object]";function pI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const yee=dI([]);function yv(t){return new hI(t)}class hI extends ti{constructor(e){super({type:"object",check(n){return fI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=yee,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],b=p in o,v=o[p];if(m){let g;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}g=!n.__validating||!S?m.cast(v,u):v,g!==void 0&&(l[p]=g)}else b&&!s&&(l[p]=v);(b!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!fI(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ka.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=hee(e,n),r._sortErrors=dI(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 _h(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=Ta.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return gee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(mee)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||kh.exact,test(n){if(n==null)return!0;const r=pI(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=kh.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=pI(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=kh.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(fv.camelCase)}snakeCase(){return this.transformKeys(fv.snakeCase)}constantCase(){return this.transformKeys(e=>fv.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}}yv.prototype=hI.prototype;const bee=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return y.jsx(z.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:y.jsxs(Bu,{component:z.Paper,p:1,boxShadow:9,gap:.25,children:[y.jsx(z.Typography,{variant:"body1",children:"Paste in an pre-formatted citation"}),y.jsx(z.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),y.jsx(Ht.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(vee(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>y.jsxs(Ca,{flexWrap:"wrap",justifyContent:"flex-end",children:[y.jsx(LM,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:y.jsx(z.Tooltip,{title:"Paste from Clipboard",children:y.jsx(z.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:y.jsx(YU,{})})})}),y.jsxs(Ca,{children:[y.jsx(kr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),y.jsx(kr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},vee=t=>{const e=t.split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.toUpperCase().startsWith("HTTPS")),r=e.findIndex(f=>f.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(f=>/\bSOURCE\b/.test(f.toUpperCase()));let s=[n,r,o].find(f=>f!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Ih(e,l),title:Ih(e,a),url:Ih(e,n),accessedAt:xee(e,r),classification:wee(e,o),details:Ih(e,o)}},Ih=(t,e)=>e<0||e>=t.length?"":t[e],xee=(t,e)=>e<0||e>=t.length?"":$Z(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),wee=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",See=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState(!1),b=X.useRef(null),[v,g]=X.useState(!1),[x,S]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});X.useEffect(()=>{i&&S({...i,type:"Url"})},[]);const k={disabled:u,margin:"none",readOnly:s};return y.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[y.jsxs(Ca,{justifyContent:"space-between",children:[y.jsxs(Ca,{children:[y.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),y.jsx(z.Button,{variant:"text",size:"small",ref:b,onClick:()=>g(!0),children:"Paste & Prefill"})]}),a&&y.jsx(z.IconButton,{onClick:o,children:y.jsx(fp,{})})]}),y.jsx(Ht.Formik,{innerRef:l,enableReinitialize:!0,initialValues:x,onSubmit:async T=>{f(!0),n(T).catch(C=>{throw f(!1),C}).finally(()=>f(!1))},validationSchema:yv({title:Rl().required("Title is required"),accessedAt:gv().required("Accessed At is required"),url:Rl().required("URL is required"),classification:Rl().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({submitForm:T,setValues:C})=>y.jsxs(Ht.Form,{autoComplete:"off",children:[y.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[y.jsx(Ti,{...k,name:"title",required:!0}),y.jsx(Ti,{...k,name:"source"}),y.jsx(Ti,{...k,name:"details",label:"Details (e.g. Source Description)"}),y.jsx(Up,{...k,name:"accessedAt",required:!0,isDatePicker:!0}),y.jsx(Ti,{...k,name:"url",label:"URL / Other Identifier",required:!0}),y.jsx($M,{...k,name:"classification",row:!0,required:!0,radios:Cee})]}),y.jsx(z.DialogActions,{sx:{px:0},children:s?y.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):y.jsxs(y.Fragment,{children:[y.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),y.jsx(cv,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),T()},children:i?"Update Citation":"Add New Citation"})]})}),y.jsx(bee,{open:v,onGenerateCitation:O=>{C(O,!0)},anchorEl:b.current,onClose:()=>g(!1)})]})})]})},Cee=[{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."}],Tee=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=X.useRef(null),[f,p]=X.useState(!1),[m,b]=X.useState(!1),[v,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),y.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[y.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[y.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&y.jsx(z.IconButton,{onClick:o,children:y.jsx(fp,{})})]}),y.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:yv().shape({title:Rl().required("Title is required"),fileName:Rl().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit:k})=>{var T;return X.useEffect(()=>{var C,O;(C=x.file)!=null&&C.name&&S("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),y.jsxs(Ht.Form,{autoComplete:"off",children:[y.jsx(Ti,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),y.jsxs(z.Box,{marginTop:i||a?0:1,children:[y.jsxs(Ca,{alignItems:"flex-start",children:[!i&&!a&&y.jsx(gM,{name:"file",errorMode:"hidden"}),y.jsx(Ti,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),y.jsx(br,{name:"fileName"})]}),y.jsx(z.DialogActions,{sx:{px:0},children:a?y.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):y.jsxs(y.Fragment,{children:[y.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),y.jsx(cv,{size:"small",loading:f,type:"button",onClick:()=>{b(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Ru=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",b=()=>{if(s&&p)return y.jsx(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return y.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[y.jsx(z.Box,{children:b()}),y.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return y.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:y.jsx(z.Box,{children:b()})})};return y.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?y.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&y.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:y.jsx(fp,{})})]})}):r,o&&(typeof o=="string"?y.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:y.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function kee(t){return Ke("MuiAlert",t)}const mI=je("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),Eee=Le(y.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"),Oee=Le(y.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),Mee=Le(y.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"),_ee=Le(y.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"),Iee=Le(y.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"),Aee=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Pe(n||r)}`,`${e}${Pe(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return qe(i,kee,o)},Dee=ne(ds,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Pe(n.color||n.severity)}`]]}})(gt(({theme:t})=>{const e=t.palette.mode==="light"?Rs:Va,n=t.palette.mode==="light"?Va:Rs;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),[`& .${mI.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}`,[`& .${mI.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)}}}))]}})),Pee=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Nee=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),$ee=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),gI={success:y.jsx(Eee,{fontSize:"inherit"}),warning:y.jsx(Oee,{fontSize:"inherit"}),error:y.jsx(Mee,{fontSize:"inherit"}),info:y.jsx(_ee,{fontSize:"inherit"})},yI=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=gI,onClose:b,role:v="alert",severity:g="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:g,variant:k,colorSeverity:l||g},O=Aee(C),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[$,L]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:Dee,externalForwardedProps:{...I,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Mt("icon",{className:O.icon,elementType:Pee,externalForwardedProps:I,ownerState:C}),[B,H]=Mt("message",{className:O.message,elementType:Nee,externalForwardedProps:I,ownerState:C}),[R,P]=Mt("action",{className:O.action,elementType:$ee,externalForwardedProps:I,ownerState:C}),[_,A]=Mt("closeButton",{elementType:_l,externalForwardedProps:I,ownerState:C}),[F,j]=Mt("closeIcon",{elementType:Iee,externalForwardedProps:I,ownerState:C});return y.jsxs($,{...L,children:[p!==!1?y.jsx(V,{...M,children:p||m[g]||gI[g]}):null,y.jsx(B,{...H,children:i}),o!=null?y.jsx(R,{...P,children:o}):null,o==null&&b?y.jsx(R,{...P,children:y.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:b,...A,children:y.jsx(F,{fontSize:"small",...j})})}):null]})});process.env.NODE_ENV!=="production"&&(yI.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 zu=t=>{var b;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(b=l[r])==null?void 0:b.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return y.jsxs(yI,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&y.jsx(z.Typography,{variant:"h3",children:s}),n]})},bI=t=>y.jsx(zu,{severity:"error",...t}),vI=t=>y.jsx(zu,{severity:"success",...t}),Lee=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return y.jsxs(y.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&y.jsx(bI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&y.jsx(vI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function xI({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:b=!1,tableTitle:v="Attachments & Citations",addlActions:g,canLaunchUrl:x,readOnly:S,canSearch:k=!1}){const[T,C]=X.useState("Insert Citation/Attachment(s)"),[O,I]=X.useState(u),[$,L]=X.useState(void 0),[V,M]=X.useState(void 0),B=Y=>{M(void 0),C(Y)},[H,R]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,V,f]);const P=(Y=!1)=>{(!m||Y)&&R(ee=>ee+1)},_=(Y,ee)=>{var Ae;const pe=typeof((Ae=ee.response)==null?void 0:Ae.data)=="string"&&ee.response.data,Ce=typeof ee.message=="string"&&ee.message;M({type:"Error",title:Y,message:pe??Ce}),p(ee)},A=Y=>M({type:"Success",title:"",message:Y}),F=async Y=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(T==="Edit Citation"||T==="Edit Attachment"){if(Y.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(Y).then(()=>{B("Insert Citation/Attachment(s)"),P()}).catch(pe=>{_("Failed to update",pe)}))}else await(e==null?void 0:e(Y).then(pe=>{I([...O,pe.id]),B("Insert Citation/Attachment(s)"),P()}).catch(pe=>{_("Failed to create",pe)}))},j=r&&(async Y=>r(Y).then(()=>{P(!0),I(O.filter(ee=>ee!==Y)),A("Successfully deleted")}).catch(ee=>_("Failed to delete",ee))),K=o&&((Y,ee)=>{o(Y.id).then(pe=>{L(pe),B(ee)}).catch(pe=>{_("Failed to load",pe)})}),U=K&&(Y=>K(Y,S?"View Citation":"Edit Citation")),J=K&&(Y=>K(Y,S?"View Attachment":"Edit Attachment")),me=n&&U,he=n&&J,ce=i&&(async Y=>i(Y).catch(ee=>{_(`Failed to download ${Y.fileName}`,ee)})),Z=s&&(async Y=>s(Y).catch(ee=>{_(`Failed to view ${Y.fileName}`,ee)})),oe=y.jsx(FQ,{refreshKey:H,getCitationsPaginated:Y=>t(Y).then(ee=>(f==null||f(),ee)),onCancel:l,onNewCitation:()=>{L(void 0),B("Add Citation")},onNewAttachment:()=>{L(void 0),B("Add Attachment")},onEditCitation:me,onEditAttachment:he,onViewCitation:U,onViewAttachment:J,onDeleteCitation:j,onDownloadAttachment:ce,onPreviewAttachment:Z,onSelect:a,setSelectedIds:I,selectedIds:O,onError:p,condenseTable:m,canSelect:b,title:v,addlActions:g,canCreate:!!e,canLaunchUrl:x,readOnly:S,showCloseBtn:m,canSearch:k}),ue=y.jsx(See,{modifyCitation:$,onSave:F,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=y.jsx(Tee,{onSave:F,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:$,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),re=y.jsx(Lee,{alert:V,setAlert:M}),le=T==="Add Citation"||T==="Edit Citation"||T==="View Citation",ge=T==="Add Attachment"||T==="Edit Attachment"||T==="View Attachment";if(m){let Y=null;return!m||T==="Insert Citation/Attachment(s)"?Y=oe:le?Y=ue:ge&&(Y=te),y.jsxs(z.Box,{children:[re,y.jsx(z.Box,{paddingTop:"8px",children:Y})]})}return y.jsxs(z.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&re,y.jsx(z.Box,{paddingTop:"8px",children:oe}),y.jsx(Ru,{open:le||ge,children:y.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[re,le?ue:te]})})]})}function wI({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return y.jsx(xI,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const Bee=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function Fee({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:f,...p}){const m=wt();if(m&&!("citationBubbleMenuHandler"in(m==null?void 0:m.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const b=m==null?void 0:m.storage.citationBubbleMenuHandler,v=b.isOpen,g=b.selectedIds,x=b.selectedNodePos,S=O=>{m&&(O.length===0?m.commands.deleteCitation(x):g.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{S(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{S(g),m==null||m.commands.closeCitationBubbleMenu()},C=X.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?y.jsx(Sy,{editor:m,open:v,...b.bubbleMenuOptions,...p,children:y.jsx(Bee,{children:y.jsx(wI,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,g),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onCancel:T,initialSelectedIds:g,onContentChange:C,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const Ree=()=>cn.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 zee(t){const e=wt(),n=X.useRef(null);return y.jsx(St,{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:y.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[y.jsx(UU,{fontSize:"small"}),y.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const SI=X.createContext(void 0),CI=()=>{const t=X.useContext(SI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Vee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=CI(),[u,f]=X.useState(s?String(s):""),[p,m]=X.useState([]),b=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),g=v.map(S=>ma.truncate(S.title,{length:b,omission:"..."})).join(", ");f(g),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return y.jsx(Ib,{as:"span",...e,"data-testid":"citation-node-component",children:y.jsx(z.Tooltip,{title:y.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,g)=>{var S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return y.jsxs(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&y.jsx(z.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:y.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Hee=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",xt(t)]},addNodeView(){return Ab(Vee)},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}}}}),TI=t=>y.jsx(hM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Wee=t=>{const{name:e,label:n=Ln(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:g,onError:x=()=>{},placeholder:S="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:C,canSearch:O=!1}=t,I=[LT,R2.configure({placeholder:S}),Ree(),Hee.configure({citationMaxLength:a})],[$,L,V]=Ht.useField({name:e}),{setValue:M}=V,{value:B}=$,{addUpdateCitation:H,deleteCitation:R,batchUpdate:P,citations:_}=CI();X.useEffect(()=>{var oe;const ce=(oe=A==null?void 0:A.current)==null?void 0:oe.editor;if(!ce)return;ce.getHTML()!==B&&setTimeout(()=>{ce.commands.setContent(B)},0)},[B]);const A=X.useRef(null),F={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},j=(ce=void 0)=>{var ue,te;const Z=((te=(ue=A.current)==null?void 0:ue.editor)==null?void 0:te.getHTML())??"",oe=!Z.replace(/<\/?p>|<br>/g,"").trim();M(oe?"":Z,ce)},K=X.useMemo(()=>ma.debounce(()=>j(!1),500),[M]),U=zs(),{showDiff:J,getPreviousValue:me}=Vs(),he=i??U;if(J){const ce=me(e)??"",Z=B,oe=/<citation\s+ids="([^"]*)"><\/citation>/g,ue=(le,ge)=>{const Y=ge.split(",").map(Number);return`<sup>${_.filter(ee=>Y.includes(ee.id)).map(ee=>ee.title)}</sup>`},te=ce.replace(oe,ue),re=Z.replace(oe,ue);return y.jsx(ha,{label:n,value:re,showDiff:!0,diffSnapshot:te,mode:"html"})}return y.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:he?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...F[s],display:"flex",flexDirection:"column",width:"100%",children:[y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&y.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&y.jsx(TI,{name:k})]}),y.jsx(rM,{ref:A,extensions:I,content:B,editable:!he,renderControls:he?void 0:()=>y.jsx(lb,{children:y.jsx(zee,{})}),onBlur:()=>j(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>y.jsx(Fee,{getCitationsPaginated:ce=>l(ce).then(Z=>(P(Z.data),Z)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(ce=>f(ce).then(Z=>(H(Z),Z))),onUpdateCitation:p&&(ce=>p(ce).then(Z=>(H(Z),Z))),onDeleteCitation:m&&(ce=>m(ce).then(()=>R(ce))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:C,readOnly:he,canSearch:O})}),y.jsx(br,{name:e,id:`${e}-err`,errorMode:T})]})},jee=t=>{const{name:e="submit"}=t;return y.jsx(kr,{name:e,type:"submit",...t})},Uee=t=>{const{label:e="Return to Top",icon:n=pp,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return y.jsx(z.Zoom,{in:o,children:y.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:y.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[y.jsx(n,{fontSize:"medium"}),e]})})})},kI=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=vo.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 y.jsxs(y.Fragment,{children:[y.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),y.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>y.jsxs(z.MenuItem,{...ec(p,o),children:[p.icon&&y.jsx(z.ListItemIcon,{children:p.icon}),y.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},qee=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=z.useTheme();return y.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:y.jsxs(z.List,{children:[y.jsxs(z.ListItem,{children:[y.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),y.jsx("br",{}),y.jsx(z.Divider,{variant:"inset"}),y.jsx("pre",{children:JSON.stringify(t,null,2)})]}),y.jsx(z.Divider,{variant:"inset",component:"li"}),y.jsxs(z.ListItem,{id:"testing",children:[y.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),y.jsx("br",{}),y.jsx(z.Divider,{variant:"inset"}),y.jsx("pre",{children:JSON.stringify(e,null,2)})]}),y.jsxs(z.ListItem,{children:[y.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),y.jsx("br",{}),y.jsx(z.Divider,{variant:"inset"}),y.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Kee=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=K2();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,...cr({...t},l)};return y.jsx(z.Stepper,{...u,children:e.map(f=>y.jsx(z.Step,{children:y.jsx(z.StepLabel,{children:f})},f))})},Yee=t=>{const{name:e,label:n=Ln(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?y.jsx(zM,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=Ht.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return y.jsxs(z.FormControl,{fullWidth:!0,children:[y.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?y.jsx(z.Typography,{children:b}):y.jsx(Ht.FieldArray,{name:e,render:T=>y.jsxs("div",{children:[S.map((C,O)=>y.jsx(X.Fragment,{children:y.jsx(Gee,{variant:l,content:y.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?k(g):{...g},children:[y.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&y.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&y.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&y.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Gee=({variant:t,content:e})=>{switch(t){case"card":return y.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:y.jsx(z.CardContent,{children:e})});case"elevatedCard":return y.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:y.jsx(z.CardContent,{children:e})});case"none":return e}},Jee=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return y.jsx(Ru,{actions:[y.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Xee=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return y.jsx(Ru,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Zee=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 y.jsx(Ru,{actions:[y.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),y.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Qee={added:{icon:WU,label:"Added",color:"success"},deleted:{icon:zM,label:"Deleted",color:"error"},modified:{icon:qU,label:"Modified",color:"info"}},ete=(t,e)=>y.jsxs(y.Fragment,{children:[y.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:up},children:y.jsx("s",{children:t})}),y.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:cp},children:y.jsx("u",{children:e})})]}),tte=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Ll(s,e,r),l=Ll(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??pM.isEqual(a,l))||(o[xn(s)]=ete(a,l))}return o},nte=(t,e,n,r=!1,o)=>{const i=[];let s=0,a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);s<e.length&&a<n.length;){const u=e[s],f=n[a];if(u.id===f.id){const p=tte(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?l++:i.push({...f,changeType:"modified",modifiedDiff:p}),s++,a++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),s++):(i.push({...f,changeType:"added"}),a++)}for(;s<e.length;)i.push({...e[s],changeType:"deleted"}),s++;for(;a<n.length;)i.push({...n[a],changeType:"added"}),a++;return{dataDiff:i,unmodifiedCount:l}},EI=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,unmodifiedCount:l}=nte(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=Qee[f];return y.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:y.jsxs(z.Typography,{children:[y.jsx(Um,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[xn(f)])??Ll(f,m,s)}}))];return{unmodifiedCount:l,columns:u,data:a,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return y.jsx(pw,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},OI=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>y.jsxs(z.Box,{children:[y.jsx(lv,{columns:t,data:e,emptyTableMsg:n,renderExpand:r,size:o}),i>0&&y.jsx(z.Box,{children:y.jsxs(z.Typography,{fontStyle:"italic",children:["+",i," unmodified rows"]})})]}),rte=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?EI({...n,isMobileScreen:r}):n;return y.jsx(OI,{...o,size:t.size})},ote=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=vo.useNavigate();return y.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[y.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?y.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),y.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[y.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>y.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...ec(l,a),children:l.label},l.label))}),n&&y.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},MI=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=vo.useLocation(),i=vo.useNavigate(),[s,a]=X.useState(!1),l=(m,b)=>y.jsx(z.MenuList,{children:m.map(v=>y.jsxs(z.MenuItem,{...ec(v,i,()=>a(!1)),children:[v.icon&&y.jsx(z.ListItemIcon,{children:v.icon}),y.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>y.jsxs(X.Fragment,{children:[l(b,v),v<m.length-1&&y.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?y.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&y.jsxs(y.Fragment,{children:[y.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:y.jsx(eq,{})}),y.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:y.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:y.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},_I=t=>{const{env:e,isProd:n}=t;return n?null:y.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},II=t=>{const{displayName:e,userMenuOptions:n}=t;return y.jsx(kI,{label:e,menuOptions:n,icon:y.jsx(nq,{})})},Ah=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=vo.useNavigate();return y.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>y.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,...ec(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))})},AI=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&y.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:y.jsx(Ah,{menuOptions:e,activeTabIdx:n,sx:r})})},DI=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return y.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?y.jsx(RM,{}):y.jsx(BM,{})})},ite=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:b}=t,v=vo.useNavigate(),g=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=vo.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const $=o.findIndex(L=>L.path&&S.startsWith(L.path));C($>=0?$:void 0)},[S,o]);const O=s&&y.jsx(DI,{onToggle:s}),I=s&&(g||!g&&l)?[{icon:k?y.jsx(RM,{}):y.jsx(BM,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return y.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&y.jsx(_I,{...e}),u,y.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[y.jsx(z.Button,{disableRipple:!0,component:vo.Link,to:"/",children:r&&typeof r=="string"?y.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),y.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&y.jsx(MI,{menuOptionLists:[o,a,I],anchor:"right"}),!g&&y.jsxs(y.Fragment,{children:[y.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map(($,L)=>y.jsxs(z.Box,{display:"flex",alignItems:"center",children:[L>0&&y.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),y.jsx(z.Button,{variant:"text",sx:{color:"white"},...ec($,v),children:y.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[$.icon,$.label]})})]},$.label))}),p,l&&y.jsx(II,{displayName:l,userMenuOptions:I})]})]})]}),!g&&y.jsx(AI,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},ste=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=vo.useLocation(),o=z.useMediaQuery(z.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&&y.jsx(z.Box,{sx:e,children:y.jsx(z.Card,{sx:{height:"100%",width:200},children:y.jsx(Ah,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},ate=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&y.jsx(Ah,{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}})},lte=({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(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(v=>{const g=u.find(x=>x.id===v.id);return g||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),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 y.jsx(SI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},cte=t=>y.jsx(zu,{severity:"info",...t}),ute=t=>y.jsx(zu,{severity:"warning",...t}),PI=t=>{const{crumbInfo:e}=t,n=vo.useNavigate();return y.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:y.jsx(tq,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?y.jsx(z.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):y.jsx(z.Typography,{color:"primary",children:r},r))})},dte=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=fte(r);return y.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:y.jsx(zu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:NI(r),warning:NI(r)},onClose:o,elevation:a,variant:s,children:n?y.jsxs(y.Fragment,{children:[y.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},fte=t=>t=="logout"?"info":t=="timeout"?"warning":t,NI=t=>{if(t=="timeout")return y.jsx(HU,{});if(t=="logout")return y.jsx(QU,{})},pte=t=>{hte(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:y.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&y.jsx(PI,{crumbInfo:i}),y.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[y.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?y.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&y.jsxs(kr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[y.jsx(jU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&y.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},hte=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},mte=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return y.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&y.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),y.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,y.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},gte=t=>{const{title:e="Loading...",message:n}=t;return y.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[y.jsxs(z.Box,{className:"text-content",children:[y.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&y.jsx(z.Typography,{"data-testid":"message",children:n})]}),y.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function yte({...t}){return y.jsx(xI,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const bte=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 y.jsx(z.Box,{height:n})};De.AlertModal=Xee,De.Autocomplete=dM,De.Breadcrumbs=PI,De.Button=kr,De.Checkbox=hM,De.CheckboxGroup=pU,De.CitationField=Wee,De.CitationFieldProvider=lte,De.CitationManager=yte,De.Column=Bu,De.ConfirmationModal=Jee,De.DarkModeToggle=DI,De.DateField=Up,De.DateRangeField=FZ,De.DecisionModal=Zee,De.Diff=cM,De.DiffProvider=pw,De.DiffTable=rte,De.DiffTableView=OI,De.Drawer=MI,De.DynamicAutocomplete=dU,De.EnvironmentBanner=_I,De.ErrorAlert=bI,De.FileList=gU,De.FileUpload=gM,De.FloatingNavBar=ate,De.Footer=ote,De.FormDebugger=qee,De.Header=ite,De.InfoAlert=cte,De.LoadingButton=cv,De.LoadingIndicator=gte,De.LoadingOverlay=j2,De.Location=FU,De.MenuButton=kI,De.Modal=Ru,De.MultiAutocomplete=fU,De.NavBar=AI,De.NotApplicableCheckbox=TI,De.PageHeader=pte,De.PaginatedTable=U2,De.ProfileMenu=II,De.RadioGroup=$M,De.RangeSlider=RU,De.ReadOnly=ha,De.ReadOnlyProvider=dw,De.RepeatableFormGroup=Yee,De.RichTextField=PQ,De.Row=Ca,De.ScrollToTop=Uee,De.SearchField=VM,De.Select=zU,De.SelectableCitationManager=wI,De.Sidebar=ste,De.SingleActionCard=mte,De.Snackbar=dte,De.Spacer=bte,De.Stepper=Kee,De.Submit=jee,De.SuccessAlert=vI,De.Switch=VU,De.Table=lv,De.Tabs=Ah,De.TextArea=LM,De.TextField=Ti,De.TextIcon=Um,De.ValidationError=br,De.WarningAlert=ute,De.baseCitationTableColumns=G2,De.buildTableDiff=EI,De.commonTheme=_n,De.darkTheme=LP,De.lightTheme=$P,De.useDiff=Vs,De.useReadOnly=zs,Object.defineProperty(De,Symbol.toStringTag,{value:"Module"})}));
|
|
408
|
+
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,b=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(k){k&&(Array.isArray(k)?b.push(...k):b.push(k)),--m<=0&&p(b)})}}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,b)=>this.resolve(f)._validate(u,f,m,b)}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)=>{hr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new hr(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 hr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new hr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(hr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(hr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Fl(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=Bl({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=Bl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=ei.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ei.notNull){return this.nullability(!1,e)}required(e=ei.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=ei.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Bl(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=eI(e).map(i=>new ka(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Eh(o,n):Eh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Bl({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=ei.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Bl({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=ei.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Bl({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?iI(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof hr)return{issues:aI(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=QQ(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const nee=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function ree(t){const e=mv(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 mv(t){var e,n;const r=nee.exec(t);return r?{year:Ai(r[1]),month:Ai(r[2],1)-1,day:Ai(r[3],1),hour:Ai(r[4]),minute:Ai(r[5]),second:Ai(r[6]),millisecond:r[7]?Ai(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:Ai(r[10]),minuteOffset:Ai(r[11])}:null}function Ai(t,e=0){return Number(t)||e}let oee=/^[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])?)*$/,iee=/^((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,see=/^(?:[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,aee="^\\d{4}-\\d{2}-\\d{2}",lee="\\d{2}:\\d{2}:\\d{2}",cee="(([+-]\\d{2}(:?\\d{2})?)|Z)",uee=new RegExp(`${aee}T${lee}(\\.\\d+)?${cee}$`),dee=t=>Ea(t)||t===t.trim(),fee={}.toString();function Rl(){return new lI}class lI extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===fee?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||ei.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=Er.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=Er.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=Er.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||Er.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=Er.email){return this.matches(oee,{name:"email",message:e,excludeEmptyString:!0})}url(e=Er.url){return this.matches(iee,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=Er.uuid){return this.matches(see,{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(uee,{name:"datetime",message:n||Er.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||Er.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=mv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||Er.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=mv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=Er.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:dee})}lowercase(e=Er.lowercase){return this.transform(n=>Ea(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ea(n)||n===n.toLowerCase()})}uppercase(e=Er.uppercase){return this.transform(n=>Ea(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ea(n)||n===n.toUpperCase()})}}Rl.prototype=lI.prototype;let cI=new Date(""),pee=t=>Object.prototype.toString.call(t)==="[object Date]";function gv(){return new Fu}class Fu extends ti{constructor(){super({type:"date",check(e){return pee(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=ree(e),isNaN(e)?Fu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ka.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=pv.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=pv.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)}})}}Fu.INVALID_DATE=cI,gv.prototype=Fu.prototype,gv.INVALID_DATE=cI;function hee(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Ta.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),ka.isRef(a)&&a.isSibling?i(a.path,s):hv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return WQ.array(Array.from(r),n).reverse()}function uI(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 dI(t){return(e,n)=>uI(t,e)-uI(t,n)}const mee=(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 _h(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=_h(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=_h(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(_h)}):"optional"in t?t.optional():t}const gee=(t,e)=>{const n=[...Ta.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Ta.getter(Ta.join(n),!0)(t);return!!(o&&r in o)};let fI=t=>Object.prototype.toString.call(t)==="[object Object]";function pI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const yee=dI([]);function yv(t){return new hI(t)}class hI extends ti{constructor(e){super({type:"object",check(n){return fI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=yee,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],b=p in o,v=o[p];if(m){let g;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}g=!n.__validating||!S?m.cast(v,u):v,g!==void 0&&(l[p]=g)}else b&&!s&&(l[p]=v);(b!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!fI(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ka.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=hee(e,n),r._sortErrors=dI(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 _h(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=Ta.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return gee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(mee)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||kh.exact,test(n){if(n==null)return!0;const r=pI(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=kh.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=pI(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=kh.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(fv.camelCase)}snakeCase(){return this.transformKeys(fv.snakeCase)}constantCase(){return this.transformKeys(e=>fv.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}}yv.prototype=hI.prototype;const bee=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return y.jsx(z.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:y.jsxs(Bu,{component:z.Paper,p:1,boxShadow:9,gap:.25,children:[y.jsx(z.Typography,{variant:"body1",children:"Paste in an pre-formatted citation"}),y.jsx(z.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),y.jsx(Ht.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(vee(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>y.jsxs(Ca,{flexWrap:"wrap",justifyContent:"flex-end",children:[y.jsx(LM,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:y.jsx(z.Tooltip,{title:"Paste from Clipboard",children:y.jsx(z.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:y.jsx(YU,{})})})}),y.jsxs(Ca,{children:[y.jsx(kr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),y.jsx(kr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},vee=t=>{const e=t.split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.toUpperCase().startsWith("HTTPS")),r=e.findIndex(f=>f.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(f=>/\bSOURCE\b/.test(f.toUpperCase()));let s=[n,r,o].find(f=>f!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Ih(e,l),title:Ih(e,a),url:Ih(e,n),accessedAt:xee(e,r),classification:wee(e,o),details:Ih(e,o)}},Ih=(t,e)=>e<0||e>=t.length?"":t[e],xee=(t,e)=>e<0||e>=t.length?"":$Z(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),wee=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",See=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState(!1),b=X.useRef(null),[v,g]=X.useState(!1),[x,S]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});X.useEffect(()=>{i&&S({...i,type:"Url"})},[]);const k={disabled:u,margin:"none",readOnly:s},T=!s;return y.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[y.jsxs(Ca,{justifyContent:"space-between",children:[y.jsxs(Ca,{children:[y.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),T&&y.jsx(z.Button,{variant:"text",size:"small",ref:b,onClick:()=>g(!0),children:"Paste & Prefill"})]}),a&&y.jsx(z.IconButton,{onClick:o,children:y.jsx(fp,{})})]}),y.jsx(Ht.Formik,{innerRef:l,enableReinitialize:!0,initialValues:x,onSubmit:async C=>{f(!0),n(C).catch(O=>{throw f(!1),O}).finally(()=>f(!1))},validationSchema:yv({title:Rl().required("Title is required"),accessedAt:gv().required("Accessed At is required"),url:Rl().required("URL is required"),classification:Rl().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({submitForm:C,setValues:O})=>y.jsxs(Ht.Form,{autoComplete:"off",children:[y.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[y.jsx(Ti,{...k,name:"title",required:!0}),y.jsx(Ti,{...k,name:"source"}),y.jsx(Ti,{...k,name:"details",label:"Details (e.g. Source Description)"}),y.jsx(Up,{...k,name:"accessedAt",required:!0,isDatePicker:!0}),y.jsx(Ti,{...k,name:"url",label:"URL / Other Identifier",required:!0}),y.jsx($M,{...k,name:"classification",row:!0,required:!0,radios:Cee})]}),y.jsx(z.DialogActions,{sx:{px:0},children:s?y.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):y.jsxs(y.Fragment,{children:[y.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),y.jsx(cv,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),C()},children:i?"Update Citation":"Add New Citation"})]})}),y.jsx(bee,{open:v,onGenerateCitation:I=>{O(I,!0)},anchorEl:b.current,onClose:()=>g(!1)})]})})]})},Cee=[{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."}],Tee=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=X.useRef(null),[f,p]=X.useState(!1),[m,b]=X.useState(!1),[v,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),y.jsxs(z.Box,{minWidth:"300px",maxWidth:"500px",children:[y.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[y.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&y.jsx(z.IconButton,{onClick:o,children:y.jsx(fp,{})})]}),y.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:yv().shape({title:Rl().required("Title is required"),fileName:Rl().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit:k})=>{var T;return X.useEffect(()=>{var C,O;(C=x.file)!=null&&C.name&&S("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),y.jsxs(Ht.Form,{autoComplete:"off",children:[y.jsx(Ti,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),y.jsxs(z.Box,{marginTop:i||a?0:1,children:[y.jsxs(Ca,{alignItems:"flex-start",children:[!i&&!a&&y.jsx(gM,{name:"file",errorMode:"hidden"}),y.jsx(Ti,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),y.jsx(br,{name:"fileName"})]}),y.jsx(z.DialogActions,{sx:{px:0},children:a?y.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):y.jsxs(y.Fragment,{children:[y.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),y.jsx(cv,{size:"small",loading:f,type:"button",onClick:()=>{b(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Ru=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",b=()=>{if(s&&p)return y.jsx(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return y.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[y.jsx(z.Box,{children:b()}),y.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return y.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:y.jsx(z.Box,{children:b()})})};return y.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?y.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&y.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:y.jsx(fp,{})})]})}):r,o&&(typeof o=="string"?y.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:y.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function kee(t){return Ke("MuiAlert",t)}const mI=je("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),Eee=Le(y.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"),Oee=Le(y.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),Mee=Le(y.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"),_ee=Le(y.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"),Iee=Le(y.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"),Aee=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Pe(n||r)}`,`${e}${Pe(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return qe(i,kee,o)},Dee=ne(ds,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Pe(n.color||n.severity)}`]]}})(gt(({theme:t})=>{const e=t.palette.mode==="light"?Rs:Va,n=t.palette.mode==="light"?Va:Rs;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),[`& .${mI.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}`,[`& .${mI.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)}}}))]}})),Pee=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Nee=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),$ee=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),gI={success:y.jsx(Eee,{fontSize:"inherit"}),warning:y.jsx(Oee,{fontSize:"inherit"}),error:y.jsx(Mee,{fontSize:"inherit"}),info:y.jsx(_ee,{fontSize:"inherit"})},yI=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=gI,onClose:b,role:v="alert",severity:g="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:g,variant:k,colorSeverity:l||g},O=Aee(C),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[$,L]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:Dee,externalForwardedProps:{...I,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Mt("icon",{className:O.icon,elementType:Pee,externalForwardedProps:I,ownerState:C}),[B,H]=Mt("message",{className:O.message,elementType:Nee,externalForwardedProps:I,ownerState:C}),[R,P]=Mt("action",{className:O.action,elementType:$ee,externalForwardedProps:I,ownerState:C}),[_,A]=Mt("closeButton",{elementType:_l,externalForwardedProps:I,ownerState:C}),[F,j]=Mt("closeIcon",{elementType:Iee,externalForwardedProps:I,ownerState:C});return y.jsxs($,{...L,children:[p!==!1?y.jsx(V,{...M,children:p||m[g]||gI[g]}):null,y.jsx(B,{...H,children:i}),o!=null?y.jsx(R,{...P,children:o}):null,o==null&&b?y.jsx(R,{...P,children:y.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:b,...A,children:y.jsx(F,{fontSize:"small",...j})})}):null]})});process.env.NODE_ENV!=="production"&&(yI.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 zu=t=>{var b;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(b=l[r])==null?void 0:b.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return y.jsxs(yI,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&y.jsx(z.Typography,{variant:"h3",children:s}),n]})},bI=t=>y.jsx(zu,{severity:"error",...t}),vI=t=>y.jsx(zu,{severity:"success",...t}),Lee=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return y.jsxs(y.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&y.jsx(bI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&y.jsx(vI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function xI({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:b=!1,tableTitle:v="Attachments & Citations",addlActions:g,canLaunchUrl:x,readOnly:S,canSearch:k=!1}){const[T,C]=X.useState("Insert Citation/Attachment(s)"),[O,I]=X.useState(u),[$,L]=X.useState(void 0),[V,M]=X.useState(void 0),B=Y=>{M(void 0),C(Y)},[H,R]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,V,f]);const P=(Y=!1)=>{(!m||Y)&&R(ee=>ee+1)},_=(Y,ee)=>{var Ae;const pe=typeof((Ae=ee.response)==null?void 0:Ae.data)=="string"&&ee.response.data,Ce=typeof ee.message=="string"&&ee.message;M({type:"Error",title:Y,message:pe??Ce}),p(ee)},A=Y=>M({type:"Success",title:"",message:Y}),F=async Y=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(T==="Edit Citation"||T==="Edit Attachment"){if(Y.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(Y).then(()=>{B("Insert Citation/Attachment(s)"),P()}).catch(pe=>{_("Failed to update",pe)}))}else await(e==null?void 0:e(Y).then(pe=>{I([...O,pe.id]),B("Insert Citation/Attachment(s)"),P()}).catch(pe=>{_("Failed to create",pe)}))},j=r&&(async Y=>r(Y).then(()=>{P(!0),I(O.filter(ee=>ee!==Y)),A("Successfully deleted")}).catch(ee=>_("Failed to delete",ee))),K=o&&((Y,ee)=>{o(Y.id).then(pe=>{L(pe),B(ee)}).catch(pe=>{_("Failed to load",pe)})}),U=K&&(Y=>K(Y,S?"View Citation":"Edit Citation")),J=K&&(Y=>K(Y,S?"View Attachment":"Edit Attachment")),me=n&&U,he=n&&J,ce=i&&(async Y=>i(Y).catch(ee=>{_(`Failed to download ${Y.fileName}`,ee)})),Z=s&&(async Y=>s(Y).catch(ee=>{_(`Failed to view ${Y.fileName}`,ee)})),oe=y.jsx(FQ,{refreshKey:H,getCitationsPaginated:Y=>t(Y).then(ee=>(f==null||f(),ee)),onCancel:l,onNewCitation:()=>{L(void 0),B("Add Citation")},onNewAttachment:()=>{L(void 0),B("Add Attachment")},onEditCitation:me,onEditAttachment:he,onViewCitation:U,onViewAttachment:J,onDeleteCitation:j,onDownloadAttachment:ce,onPreviewAttachment:Z,onSelect:a,setSelectedIds:I,selectedIds:O,onError:p,condenseTable:m,canSelect:b,title:v,addlActions:g,canCreate:!!e,canLaunchUrl:x,readOnly:S,showCloseBtn:m,canSearch:k}),ue=y.jsx(See,{modifyCitation:$,onSave:F,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=y.jsx(Tee,{onSave:F,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:$,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),re=y.jsx(Lee,{alert:V,setAlert:M}),le=T==="Add Citation"||T==="Edit Citation"||T==="View Citation",ge=T==="Add Attachment"||T==="Edit Attachment"||T==="View Attachment";if(m){let Y=null;return!m||T==="Insert Citation/Attachment(s)"?Y=oe:le?Y=ue:ge&&(Y=te),y.jsxs(z.Box,{children:[re,y.jsx(z.Box,{paddingTop:"8px",children:Y})]})}return y.jsxs(z.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&re,y.jsx(z.Box,{paddingTop:"8px",children:oe}),y.jsx(Ru,{open:le||ge,children:y.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[re,le?ue:te]})})]})}function wI({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return y.jsx(xI,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const Bee=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function Fee({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:f,...p}){const m=wt();if(m&&!("citationBubbleMenuHandler"in(m==null?void 0:m.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const b=m==null?void 0:m.storage.citationBubbleMenuHandler,v=b.isOpen,g=b.selectedIds,x=b.selectedNodePos,S=O=>{m&&(O.length===0?m.commands.deleteCitation(x):g.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{S(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{S(g),m==null||m.commands.closeCitationBubbleMenu()},C=X.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?y.jsx(Sy,{editor:m,open:v,...b.bubbleMenuOptions,...p,children:y.jsx(Bee,{children:y.jsx(wI,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,g),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onCancel:T,initialSelectedIds:g,onContentChange:C,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const Ree=()=>cn.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 zee(t){const e=wt(),n=X.useRef(null);return y.jsx(St,{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:y.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[y.jsx(UU,{fontSize:"small"}),y.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const SI=X.createContext(void 0),CI=()=>{const t=X.useContext(SI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Vee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=CI(),[u,f]=X.useState(s?String(s):""),[p,m]=X.useState([]),b=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),g=v.map(S=>ma.truncate(S.title,{length:b,omission:"..."})).join(", ");f(g),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return y.jsx(Ib,{as:"span",...e,"data-testid":"citation-node-component",children:y.jsx(z.Tooltip,{title:y.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,g)=>{var S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return y.jsxs(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&y.jsx(z.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:y.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Hee=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",xt(t)]},addNodeView(){return Ab(Vee)},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}}}}),TI=t=>y.jsx(hM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Wee=t=>{const{name:e,label:n=Ln(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:g,onError:x=()=>{},placeholder:S="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:C,canSearch:O=!1}=t,I=[LT,R2.configure({placeholder:S}),Ree(),Hee.configure({citationMaxLength:a})],[$,L,V]=Ht.useField({name:e}),{setValue:M}=V,{value:B}=$,{addUpdateCitation:H,deleteCitation:R,batchUpdate:P,citations:_}=CI();X.useEffect(()=>{var oe;const ce=(oe=A==null?void 0:A.current)==null?void 0:oe.editor;if(!ce)return;ce.getHTML()!==B&&setTimeout(()=>{ce.commands.setContent(B)},0)},[B]);const A=X.useRef(null),F={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},j=(ce=void 0)=>{var ue,te;const Z=((te=(ue=A.current)==null?void 0:ue.editor)==null?void 0:te.getHTML())??"",oe=!Z.replace(/<\/?p>|<br>/g,"").trim();M(oe?"":Z,ce)},K=X.useMemo(()=>ma.debounce(()=>j(!1),500),[M]),U=zs(),{showDiff:J,getPreviousValue:me}=Vs(),he=i??U;if(J){const ce=me(e)??"",Z=B,oe=/<citation\s+ids="([^"]*)"><\/citation>/g,ue=(le,ge)=>{const Y=ge.split(",").map(Number);return`<sup>${_.filter(ee=>Y.includes(ee.id)).map(ee=>ee.title)}</sup>`},te=ce.replace(oe,ue),re=Z.replace(oe,ue);return y.jsx(ha,{label:n,value:re,showDiff:!0,diffSnapshot:te,mode:"html"})}return y.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:he?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...F[s],display:"flex",flexDirection:"column",width:"100%",children:[y.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&y.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&y.jsx(TI,{name:k})]}),y.jsx(rM,{ref:A,extensions:I,content:B,editable:!he,renderControls:he?void 0:()=>y.jsx(lb,{children:y.jsx(zee,{})}),onBlur:()=>j(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>y.jsx(Fee,{getCitationsPaginated:ce=>l(ce).then(Z=>(P(Z.data),Z)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(ce=>f(ce).then(Z=>(H(Z),Z))),onUpdateCitation:p&&(ce=>p(ce).then(Z=>(H(Z),Z))),onDeleteCitation:m&&(ce=>m(ce).then(()=>R(ce))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:C,readOnly:he,canSearch:O})}),y.jsx(br,{name:e,id:`${e}-err`,errorMode:T})]})},jee=t=>{const{name:e="submit"}=t;return y.jsx(kr,{name:e,type:"submit",...t})},Uee=t=>{const{label:e="Return to Top",icon:n=pp,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return y.jsx(z.Zoom,{in:o,children:y.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:y.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[y.jsx(n,{fontSize:"medium"}),e]})})})},kI=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=vo.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 y.jsxs(y.Fragment,{children:[y.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),y.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>y.jsxs(z.MenuItem,{...ec(p,o),children:[p.icon&&y.jsx(z.ListItemIcon,{children:p.icon}),y.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},qee=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=z.useTheme();return y.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:y.jsxs(z.List,{children:[y.jsxs(z.ListItem,{children:[y.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),y.jsx("br",{}),y.jsx(z.Divider,{variant:"inset"}),y.jsx("pre",{children:JSON.stringify(t,null,2)})]}),y.jsx(z.Divider,{variant:"inset",component:"li"}),y.jsxs(z.ListItem,{id:"testing",children:[y.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),y.jsx("br",{}),y.jsx(z.Divider,{variant:"inset"}),y.jsx("pre",{children:JSON.stringify(e,null,2)})]}),y.jsxs(z.ListItem,{children:[y.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),y.jsx("br",{}),y.jsx(z.Divider,{variant:"inset"}),y.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Kee=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=K2();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,...cr({...t},l)};return y.jsx(z.Stepper,{...u,children:e.map(f=>y.jsx(z.Step,{children:y.jsx(z.StepLabel,{children:f})},f))})},Yee=t=>{const{name:e,label:n=Ln(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?y.jsx(zM,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=Ht.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return y.jsxs(z.FormControl,{fullWidth:!0,children:[y.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?y.jsx(z.Typography,{children:b}):y.jsx(Ht.FieldArray,{name:e,render:T=>y.jsxs("div",{children:[S.map((C,O)=>y.jsx(X.Fragment,{children:y.jsx(Gee,{variant:l,content:y.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?k(g):{...g},children:[y.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&y.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&y.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&y.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Gee=({variant:t,content:e})=>{switch(t){case"card":return y.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:y.jsx(z.CardContent,{children:e})});case"elevatedCard":return y.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:y.jsx(z.CardContent,{children:e})});case"none":return e}},Jee=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return y.jsx(Ru,{actions:[y.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Xee=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return y.jsx(Ru,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Zee=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 y.jsx(Ru,{actions:[y.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),y.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Qee={added:{icon:WU,label:"Added",color:"success"},deleted:{icon:zM,label:"Deleted",color:"error"},modified:{icon:qU,label:"Modified",color:"info"}},ete=(t,e)=>y.jsxs(y.Fragment,{children:[y.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:up},children:y.jsx("s",{children:t})}),y.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:cp},children:y.jsx("u",{children:e})})]}),tte=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Ll(s,e,r),l=Ll(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??pM.isEqual(a,l))||(o[xn(s)]=ete(a,l))}return o},nte=(t,e,n,r=!1,o)=>{const i=[];let s=0,a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);s<e.length&&a<n.length;){const u=e[s],f=n[a];if(u.id===f.id){const p=tte(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?l++:i.push({...f,changeType:"modified",modifiedDiff:p}),s++,a++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),s++):(i.push({...f,changeType:"added"}),a++)}for(;s<e.length;)i.push({...e[s],changeType:"deleted"}),s++;for(;a<n.length;)i.push({...n[a],changeType:"added"}),a++;return{dataDiff:i,unmodifiedCount:l}},EI=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,unmodifiedCount:l}=nte(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=Qee[f];return y.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:y.jsxs(z.Typography,{children:[y.jsx(Um,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[xn(f)])??Ll(f,m,s)}}))];return{unmodifiedCount:l,columns:u,data:a,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return y.jsx(pw,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},OI=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>y.jsxs(z.Box,{children:[y.jsx(lv,{columns:t,data:e,emptyTableMsg:n,renderExpand:r,size:o}),i>0&&y.jsx(z.Box,{children:y.jsxs(z.Typography,{fontStyle:"italic",children:["+",i," unmodified rows"]})})]}),rte=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?EI({...n,isMobileScreen:r}):n;return y.jsx(OI,{...o,size:t.size})},ote=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=vo.useNavigate();return y.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[y.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?y.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),y.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[y.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>y.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...ec(l,a),children:l.label},l.label))}),n&&y.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},MI=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=vo.useLocation(),i=vo.useNavigate(),[s,a]=X.useState(!1),l=(m,b)=>y.jsx(z.MenuList,{children:m.map(v=>y.jsxs(z.MenuItem,{...ec(v,i,()=>a(!1)),children:[v.icon&&y.jsx(z.ListItemIcon,{children:v.icon}),y.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>y.jsxs(X.Fragment,{children:[l(b,v),v<m.length-1&&y.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?y.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&y.jsxs(y.Fragment,{children:[y.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:y.jsx(eq,{})}),y.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:y.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:y.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},_I=t=>{const{env:e,isProd:n}=t;return n?null:y.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},II=t=>{const{displayName:e,userMenuOptions:n}=t;return y.jsx(kI,{label:e,menuOptions:n,icon:y.jsx(nq,{})})},Ah=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=vo.useNavigate();return y.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>y.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,...ec(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))})},AI=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&y.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:y.jsx(Ah,{menuOptions:e,activeTabIdx:n,sx:r})})},DI=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return y.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?y.jsx(RM,{}):y.jsx(BM,{})})},ite=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:b}=t,v=vo.useNavigate(),g=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=vo.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const $=o.findIndex(L=>L.path&&S.startsWith(L.path));C($>=0?$:void 0)},[S,o]);const O=s&&y.jsx(DI,{onToggle:s}),I=s&&(g||!g&&l)?[{icon:k?y.jsx(RM,{}):y.jsx(BM,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return y.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&y.jsx(_I,{...e}),u,y.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[y.jsx(z.Button,{disableRipple:!0,component:vo.Link,to:"/",children:r&&typeof r=="string"?y.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),y.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&y.jsx(MI,{menuOptionLists:[o,a,I],anchor:"right"}),!g&&y.jsxs(y.Fragment,{children:[y.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map(($,L)=>y.jsxs(z.Box,{display:"flex",alignItems:"center",children:[L>0&&y.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),y.jsx(z.Button,{variant:"text",sx:{color:"white"},...ec($,v),children:y.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[$.icon,$.label]})})]},$.label))}),p,l&&y.jsx(II,{displayName:l,userMenuOptions:I})]})]})]}),!g&&y.jsx(AI,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},ste=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=vo.useLocation(),o=z.useMediaQuery(z.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&&y.jsx(z.Box,{sx:e,children:y.jsx(z.Card,{sx:{height:"100%",width:200},children:y.jsx(Ah,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},ate=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&y.jsx(Ah,{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}})},lte=({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(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(v=>{const g=u.find(x=>x.id===v.id);return g||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),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 y.jsx(SI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},cte=t=>y.jsx(zu,{severity:"info",...t}),ute=t=>y.jsx(zu,{severity:"warning",...t}),PI=t=>{const{crumbInfo:e}=t,n=vo.useNavigate();return y.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:y.jsx(tq,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?y.jsx(z.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):y.jsx(z.Typography,{color:"primary",children:r},r))})},dte=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=fte(r);return y.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:y.jsx(zu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:NI(r),warning:NI(r)},onClose:o,elevation:a,variant:s,children:n?y.jsxs(y.Fragment,{children:[y.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},fte=t=>t=="logout"?"info":t=="timeout"?"warning":t,NI=t=>{if(t=="timeout")return y.jsx(HU,{});if(t=="logout")return y.jsx(QU,{})},pte=t=>{hte(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:y.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&y.jsx(PI,{crumbInfo:i}),y.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[y.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?y.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&y.jsxs(kr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[y.jsx(jU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&y.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},hte=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},mte=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return y.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&y.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),y.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,y.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},gte=t=>{const{title:e="Loading...",message:n}=t;return y.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[y.jsxs(z.Box,{className:"text-content",children:[y.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&y.jsx(z.Typography,{"data-testid":"message",children:n})]}),y.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function yte({...t}){return y.jsx(xI,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const bte=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 y.jsx(z.Box,{height:n})};De.AlertModal=Xee,De.Autocomplete=dM,De.Breadcrumbs=PI,De.Button=kr,De.Checkbox=hM,De.CheckboxGroup=pU,De.CitationField=Wee,De.CitationFieldProvider=lte,De.CitationManager=yte,De.Column=Bu,De.ConfirmationModal=Jee,De.DarkModeToggle=DI,De.DateField=Up,De.DateRangeField=FZ,De.DecisionModal=Zee,De.Diff=cM,De.DiffProvider=pw,De.DiffTable=rte,De.DiffTableView=OI,De.Drawer=MI,De.DynamicAutocomplete=dU,De.EnvironmentBanner=_I,De.ErrorAlert=bI,De.FileList=gU,De.FileUpload=gM,De.FloatingNavBar=ate,De.Footer=ote,De.FormDebugger=qee,De.Header=ite,De.InfoAlert=cte,De.LoadingButton=cv,De.LoadingIndicator=gte,De.LoadingOverlay=j2,De.Location=FU,De.MenuButton=kI,De.Modal=Ru,De.MultiAutocomplete=fU,De.NavBar=AI,De.NotApplicableCheckbox=TI,De.PageHeader=pte,De.PaginatedTable=U2,De.ProfileMenu=II,De.RadioGroup=$M,De.RangeSlider=RU,De.ReadOnly=ha,De.ReadOnlyProvider=dw,De.RepeatableFormGroup=Yee,De.RichTextField=PQ,De.Row=Ca,De.ScrollToTop=Uee,De.SearchField=VM,De.Select=zU,De.SelectableCitationManager=wI,De.Sidebar=ste,De.SingleActionCard=mte,De.Snackbar=dte,De.Spacer=bte,De.Stepper=Kee,De.Submit=jee,De.SuccessAlert=vI,De.Switch=VU,De.Table=lv,De.Tabs=Ah,De.TextArea=LM,De.TextField=Ti,De.TextIcon=Um,De.ValidationError=br,De.WarningAlert=ute,De.baseCitationTableColumns=G2,De.buildTableDiff=EI,De.commonTheme=_n,De.darkTheme=LP,De.lightTheme=$P,De.useDiff=Vs,De.useReadOnly=zs,Object.defineProperty(De,Symbol.toStringTag,{value:"Module"})}));
|