@simoncomputing/mui-bueno-v2 0.26.0 → 0.26.1
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 +7 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +4 -0
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,13 @@ 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.1] - 2026-03-16
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- `CitationManager`
|
|
19
|
+
- Added Details column
|
|
20
|
+
|
|
14
21
|
## [0.26.0] - 2026-03-16
|
|
15
22
|
|
|
16
23
|
### Changed
|
package/dist/index.cjs.js
CHANGED
|
@@ -401,7 +401,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
401
401
|
`,Ice="️",Dce="",cb="";let xf=null,wf=null;function Ace(t=[]){const e={};Cr.groups=e;const n=new Cr;xf==null&&(xf=LE(kce)),wf==null&&(wf=LE(Ece)),De(n,"'",Hp),De(n,"{",nu),De(n,"}",ru),De(n,"[",Mp),De(n,"]",_p),De(n,"(",Rp),De(n,")",Ip),De(n,"<",Dp),De(n,">",Ap),De(n,"(",Pp),De(n,")",Np),De(n,"「",$p),De(n,"」",jp),De(n,"『",Lp),De(n,"』",Bp),De(n,"<",Fp),De(n,">",Vp),De(n,"&",zp),De(n,"*",Wp),De(n,"@",is),De(n,"`",qp),De(n,"^",Kp),De(n,":",ls),De(n,",",gx),De(n,"$",Yp),De(n,".",Bo),De(n,"=",Gp),De(n,"!",yx),De(n,"-",eo),De(n,"%",ou),De(n,"|",Jp),De(n,"+",Xp),De(n,"#",Zp),De(n,"?",iu),De(n,'"',bx),De(n,"/",Fo),De(n,";",vx),De(n,"~",su),De(n,"_",Qp),De(n,"\\",Up),De(n,"・",BD);const r=an(n,vi,hx,{[h0]:!0});an(r,vi,r);const o=an(r,bi,jD,{[tu]:!0}),i=an(r,_c,LD,{[Bc]:!0}),s=an(n,bi,Si,{[m0]:!0});an(s,vi,o),an(s,bi,s),an(o,vi,o),an(o,bi,o);const a=an(n,_c,b0,{[g0]:!0});an(a,bi),an(a,vi,i),an(a,_c,a),an(i,vi,i),an(i,bi),an(i,_c,i);const l=De(n,lb,mx,{[ib]:!0}),u=De(n,jE,w0,{[ib]:!0}),f=an(n,ab,w0,{[ib]:!0});De(n,cb,f),De(u,lb,l),De(u,cb,f),an(u,ab,f),De(f,jE),De(f,lb),an(f,ab,f),De(f,cb,f);const p=an(n,sb,FD,{[$D]:!0});De(p,"#"),an(p,sb,p),De(p,Ice,p);const m=De(p,Dce);De(m,"#"),an(m,sb,p);const y=[[bi,s],[vi,o]],v=[[bi,null],[_c,a],[vi,i]];for(let g=0;g<xf.length;g++)es(n,xf[g],v0,Si,y);for(let g=0;g<wf.length;g++)es(n,wf[g],x0,b0,v);ia(v0,{tld:!0,ascii:!0},e),ia(x0,{utld:!0,alpha:!0},e),es(n,"file",Wf,Si,y),es(n,"mailto",Wf,Si,y),es(n,"http",fl,Si,y),es(n,"https",fl,Si,y),es(n,"ftp",fl,Si,y),es(n,"ftps",fl,Si,y),ia(Wf,{scheme:!0,ascii:!0},e),ia(fl,{slashscheme:!0,ascii:!0},e),t=t.sort((g,x)=>g[0]>x[0]?1:-1);for(let g=0;g<t.length;g++){const x=t[g][0],k=t[g][1]?{[Oce]:!0}:{[Mce]:!0};x.indexOf("-")>=0?k[y0]=!0:bi.test(x)?vi.test(x)?k[tu]=!0:k[m0]=!0:k[h0]=!0,$E(n,x,x,k)}return $E(n,"localhost",Ou,{ascii:!0}),n.jd=new Cr(eh),{start:n,tokens:Object.assign({groups:e},VD)}}function zD(t,e){const n=Pce(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,l=null,u=0,f=null,p=-1,m=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(p=0,m=0,f=a):p>=0&&(p+=n[s].length,m++),u+=n[s].length,i+=n[s].length,s++;i-=p,s-=m,u-=p,o.push({t:f.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function Pce(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function es(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Cr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Cr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function LE(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Mu={defaultProtocol:"http",events:null,format:BE,formatHref:BE,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function xx(t,e=null){let n=Object.assign({},Mu);t&&(n=Object.assign(n,t instanceof xx?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}xx.prototype={o:Mu,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Mu[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function BE(t){return t}function HD(t,e){this.t="token",this.v=t,this.tk=e}HD.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Mu.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),f=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),f&&Object.assign(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function mm(t,e){class n extends HD{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const FE=mm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),VE=mm("text"),Nce=mm("nl"),Sf=mm("url",{isLink:!0,toHref(t=Mu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Ou&&t[1].t===ls}}),Zr=t=>new Cr(t);function $ce({groups:t}){const e=t.domain.concat([zp,Wp,is,Up,qp,Kp,Yp,Gp,eo,hx,ou,Jp,Xp,Zp,Fo,eh,su,Qp]),n=[Hp,ls,gx,Bo,yx,ou,iu,bx,vx,Dp,Ap,nu,ru,_p,Mp,Rp,Ip,Pp,Np,$p,jp,Lp,Bp,Fp,Vp],r=[zp,Hp,Wp,Up,qp,Kp,Yp,Gp,eo,nu,ru,ou,Jp,Xp,Zp,iu,Fo,eh,su,Qp],o=Zr(),i=De(o,su);dt(i,r,i),dt(i,t.domain,i);const s=Zr(),a=Zr(),l=Zr();dt(o,t.domain,s),dt(o,t.scheme,a),dt(o,t.slashscheme,l),dt(s,r,i),dt(s,t.domain,s);const u=De(s,is);De(i,is,u),De(a,is,u),De(l,is,u);const f=De(i,Bo);dt(f,r,i),dt(f,t.domain,i);const p=Zr();dt(u,t.domain,p),dt(p,t.domain,p);const m=De(p,Bo);dt(m,t.domain,p);const y=Zr(FE);dt(m,t.tld,y),dt(m,t.utld,y),De(u,Ou,y);const v=De(p,eo);De(v,eo,v),dt(v,t.domain,p),dt(y,t.domain,p),De(y,Bo,m),De(y,eo,v);const g=De(y,ls);dt(g,t.numeric,FE);const x=De(s,eo),S=De(s,Bo);De(x,eo,x),dt(x,t.domain,s),dt(S,r,i),dt(S,t.domain,s);const k=Zr(Sf);dt(S,t.tld,k),dt(S,t.utld,k),dt(k,t.domain,s),dt(k,r,i),De(k,Bo,S),De(k,eo,x),De(k,is,u);const T=De(k,ls),C=Zr(Sf);dt(T,t.numeric,C);const O=Zr(Sf),R=Zr();dt(O,e,O),dt(O,n,R),dt(R,e,O),dt(R,n,R),De(k,Fo,O),De(C,Fo,O);const P=De(a,ls),$=De(l,ls),F=De($,Fo),M=De(F,Fo);dt(a,t.domain,s),De(a,Bo,S),De(a,eo,x),dt(l,t.domain,s),De(l,Bo,S),De(l,eo,x),dt(P,t.domain,O),De(P,Fo,O),De(P,iu,O),dt(M,t.domain,O),dt(M,e,O),De(M,Fo,O);const j=[[nu,ru],[Mp,_p],[Rp,Ip],[Dp,Ap],[Pp,Np],[$p,jp],[Lp,Bp],[Fp,Vp]];for(let V=0;V<j.length;V++){const[L,A]=j[V],_=De(O,L);De(R,L,_),De(_,A,O);const I=Zr(Sf);dt(_,e,I);const B=Zr();dt(_,n),dt(I,e,I),dt(I,n,B),dt(B,e,I),dt(B,n,B),De(I,A,O),De(B,A,O)}return De(o,Ou,k),De(o,mx,Nce),{start:o,tokens:VD}}function jce(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,u=null,f=0,p=null,m=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(u=l||a.go(n[o].t));)l=null,a=u,a.accepts()?(m=0,p=a):m>=0&&m++,o++,f++;if(m<0)o-=f,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(ub(VE,e,s)),s=[]),o-=m,f-=m;const y=p.t,v=n.slice(o-f,o);i.push(ub(y,e,v))}}return s.length>0&&i.push(ub(VE,e,s)),i}function ub(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const Lce=typeof console<"u"&&console&&console.warn||(()=>{}),Bce="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Wt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Fce(){return Cr.groups={},Wt.scanner=null,Wt.parser=null,Wt.tokenQueue=[],Wt.pluginQueue=[],Wt.customSchemes=[],Wt.initialized=!1,Wt}function zE(t,e=!1){if(Wt.initialized&&Lce(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Bce}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
402
402
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
403
403
|
2. Cannot start or end with "-"
|
|
404
|
-
3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Vce(){Wt.scanner=Ace(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=$ce(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function wx(t){return Wt.initialized||Vce(),jce(Wt.parser.start,t,zD(Wt.scanner.start,t))}wx.scan=zD;function WD(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new xx(n),o=wx(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const Sx="[\0- -\u2029 ]",zce=new RegExp(Sx),Hce=new RegExp(`${Sx}$`),Wce=new RegExp(Sx,"g");function Uce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function qce(t){return new rn({key:new On("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=d7(n.doc,[...e]);if(y7(a).forEach(({newRange:u})=>{const f=p7(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(!Hce.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(zce).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=wx(v).map(S=>S.toObject(t.defaultProtocol));if(!Uce(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=>{ov(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function Kce(t){return new rn({key:new On("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=rv(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function Yce(t){return new rn({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=WD(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(Wce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Gce=Or.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){zE(t);return}zE(t.scheme,t.optionalSlashes)})},onDestroy(){Fce()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=WD(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(qce({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(Kce({type:this.type})),this.options.linkOnPaste&&t.push(Yce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Jce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Z7(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 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 Xce=new On("suggestion");function Zce({pluginKey:t=Xce,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=Jce}){let x;const S=y==null?void 0:y(),k=new rn({key:t,view(){return{update:async(T,C)=>{var O,R,P,$,F,M,j;const V=(O=this.key)===null||O===void 0?void 0:O.getState(C),L=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=V.active&&L.active&&V.range.from!==L.range.from,_=!V.active&&L.active,I=V.active&&!L.active,B=!_&&!I&&V.query!==L.query,W=_||A&&B,K=B||A,U=I||A&&B;if(!W&&!K&&!U)return;const J=U&&!W?V:L,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&&((P=S==null?void 0:S.onBeforeStart)===null||P===void 0||P.call(S,x)),K&&(($=S==null?void 0:S.onBeforeUpdate)===null||$===void 0||$.call(S,x)),(K||W)&&(x.items=await m({editor:e,query:J.query})),U&&((F=S==null?void 0:S.onExit)===null||F===void 0||F.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),W&&((j=S==null?void 0:S.onStart)===null||j===void 0||j.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,R){const{isEditable:P}=e,{composing:$}=e.view,{selection:F}=T,{empty:M,from:j}=F,V={...C};if(V.composing=$,P&&(M||e.view.composing)){(j<C.range.from||j>C.range.to)&&!$&&!C.composing&&(V.active=!1);const L=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:F.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;L&&v({editor:e,state:R,range:L.range,isActive:C.active})?(V.active=!0,V.decorationId=C.decorationId?C.decorationId:A,V.range=L.range,V.query=L.query,V.text=L.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,C){var O;const{active:R,range:P}=k.getState(T.state);return R&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:P}))||!1},decorations(T){const{active:C,range:O,decorationId:R,query:P}=k.getState(T);if(!C)return null;const $=!(P!=null&&P.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 Qce({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 UD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Qce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function HE(t,e){const n=UD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const eue=nn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=HE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:HE(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 UD(this).map(Zce)}}),qD=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new rn({key:new On("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&Ih(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)}}})]}}),tue=Or.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),nue=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",St(this.options.HTMLAttributes,t),0]}}),rue=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",St(this.options.HTMLAttributes,t),0]}}),oue=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}}),iue=/^\s*(\[([( |x])?\])\s$/,sue=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const 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[Al({find:iue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),aue=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),lue=mn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),KD=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});KD.displayName="SuggestionList";const WE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},cue={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 Z2(KD,{props:n,editor:n.editor}),e=Uu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??WE},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))??WE}})},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}}}},uue=Gce.extend({inclusive:!1}),due=tue.extend({excludes:"superscript"}),fue=CI.extend({excludes:"subscript"});function pue({placeholder:t}={}){return X.useMemo(()=>[tte.configure({resizable:!0}),oue,rue,nue,pR,mR,gR,xR,_R,RR,IR,due,fue,AR,fR,dR,hR,MR,SI,DR,uue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),LQ,vR,$Q,lue.configure({types:["heading","paragraph","image"]}),Sce,Cce,Tce,DZ,NR.configure({multicolor:!0}),OR,QQ,yR,aue,sue.configure({nested:!0}),eue.configure({suggestion:cue}),qD.configure({placeholder:t}),ER],[t])}function UE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const hue=t=>{const e=pue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(xI,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ut.useField({name:n}),{setValue:f}=u,{value:p}=a;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),y=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=>{Zb({images:O,editor:T,position:k})});else{const O=i(S);Zb({images:O,editor:T,position:k})}},[]),v=X.useCallback((S,k,T,C)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=UE(k.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return y(O,P),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=UE(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(vI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(xce,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(Ste,{}),b.jsx($te,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},qE=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})})})},YD=({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,{})})]})},Cx=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},th=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Tx=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:S,retryCallback:k,isLoading:T=!1,disableMobileCards:C=!1,highlightSelectedRow:O=!1,headerRowStyle:R={},stickyHeader:P,reRenderExpand:$=!1,expandOnRowClick:F=!1,tooltipColor:M,...j}=t,{palette:V}=z.useTheme(),[L,A]=X.useState(void 0),[_,I]=X.useState(void 0);mue(t);const B=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=L===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($f,{"data-testid":"collapse-up"}):b.jsx(nb,{"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(Pne,{})," ",x]}),ce=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(vM,{color:"error"})," ",S,k&&b.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),Z=()=>{if(S)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(S)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=L===_e?void 0:_e;A($e),ue($e)}},re=ae=>{const _e=L===ae?void 0:ae;A(_e),ue(_e)},le=ae=>{if(!u)return;const _e=L===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($f,{}):b.jsx(nb,{})," Show"," ",_e?"Less":"More"]}),b.jsx(qE,{colSpan:r.length,isExpanded:n(ae)===L,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?tse(_e,.1):ge}}}},ee=V.grey[V.mode==="dark"?600:400],fe=ae=>ae&&b.jsx(z.Tooltip,{title:ae,children:b.jsx(Ane,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:M??ee,marginLeft:"2px"}})}),Ce=(ae,_e)=>{const $e=ae.find(Me=>Me.key==="MBv2_Checkbox_Column"),Pe=U.filter(Me=>Me.key!=="MBv2_Checkbox_Column");return b.jsxs(Cx,{alignItems:"flex-start",children:[$e&&b.jsx(th,{children:Tl($e,_e,K)}),b.jsxs(th,{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_${xn(Me)}`,style:{textWrap:"nowrap"},children:[Me.label??Fn(xn(Me)),fe(Me.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(Me)}`,style:{paddingLeft:"10px"},children:Tl(Me,_e,K)})]},`row-${n(_e)}-${xn(Me)}`))})}),le(_e)]})]})},Se=()=>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=>B(ae.target.value),fullWidth:!0,children:U.map(ae=>{if(me(xn(ae)))return b.jsx(z.MenuItem,{value:xn(ae),children:ae.label??Fn(xn(ae))},`rowHeader-${xn(ae)}`)})}),b.jsx(z.IconButton,{onClick:()=>{f&&B(f)},children:b.jsx(Vne,{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:Ce(U,ae)},n(ae)))]}),Ie=()=>b.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:P?{maxHeight:P,overflow:"auto"}:{},children:b.jsxs(z.Table,{stickyHeader:P!=="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(xn(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?()=>B(xn(ae)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ae.label??Fn(xn(ae))}),fe(ae.tooltip),$e&&W(xn(ae))==="asc"&&b.jsx($f,{style:{marginLeft:"5px"}}),$e&&W(xn(ae))==="desc"&&b.jsx(nb,{style:{marginLeft:"5px"}}),$e&&W(xn(ae))!=="asc"&&W(xn(ae))!=="desc"&&b.jsx(Bne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(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_${xn(_e)}`,children:Tl(_e,ae,K)},`row-${n(ae)}-${xn(_e)}`))}),u&&b.jsx(qE,{colSpan:U.length,isExpanded:n(ae)===L,obj:ae,renderExpand:_e=>u(_e),reRenderExpand:$})]},n(ae)))})]})});return b.jsx(YD,{isLoading:T,children:K&&!C?Se():Ie()})},mue=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=>xn(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'.`)},xn=t=>t.key??t.fieldName,gue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Tl=(t,e,n=!1)=>{const r=gue(e,t.fieldName);return t.render?t.render(r,e,n):r},GD=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(Tx,{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,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},KE=()=>({height:window.innerHeight,width:window.innerWidth}),JD=()=>{const[t,e]=X.useState(KE());return X.useEffect(()=>{const n=()=>{e(KE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},ao=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=JD(),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)})},yue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(z.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",startIcon:b.jsx(f0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},bue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",color:"error",startIcon:b.jsx(Gv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},vue=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:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:R=!1,showCloseBtn:P=!1,canSearch:$=!1}=t,F=!!t.canCreate&&!R,M=!!a&&!!s&&!R,j=!!u&&!!l&&R&&k,V=!!f&&!R,{palette:L}=z.useTheme(),[A,_]=X.useState([]),[I,B]=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=()=>{B(!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=>{S(Pe),B(!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(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Wh,{}),children:"Add Citation"}),ge=b.jsx(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx(AI,{}),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(Dne,{})})});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(zne,{})})})}},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(Gv,{})})})},fe=Pe=>{if(!C)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:C!=null&&C(Pe)?"visible":"hidden"},children:b.jsx(f0,{})})})},Ce=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(f0,{})})})},Se=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(Ine,{})})})},Ie=j||M||V||C||m||p||O,ae=[...XD(L,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),Ce(Me),fe(Me),Se(Me)]})}],_e=X.useCallback(Pe=>{ue(Me=>({...Me,pageNo:0,search:Pe}))},[]),$e=()=>$?b.jsx($I,{onSearch:_e}):null;return b.jsxs(th,{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]}),P&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(Zh,{})})]}),$e(),b.jsx(GD,{"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(ao,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(ao,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(yue,{citation:ce,anchorEl:U,onClose:re}),b.jsx(bue,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:re})]})},YE=(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})},XD=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(AI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Wh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>YE(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>YE(e,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],kx=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(ao,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var db,GE;function xue(){if(GE)return db;GE=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);db={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var R=0,P=k.length,$=C;R<P-1;){var F=k[R];if(F==="__proto__"||F==="constructor"||F==="prototype")return C;$=$[k[R++]]}$[k[R]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var R=0,P=T.length;R<P;)if(O!=null||!k)O=O[T[R++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,R,P,$;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),$=y(O),P=!$&&/^\d+$/.test(O),k.call(T,O,$,P,R,S))}function y(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!y(S)&&(v(S)||g(S))}return db}var pa=xue(),fb,JE;function wue(){if(JE)return fb;JE=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 fb={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(" ")},fb}var pb=wue(),Cf={exports:{}},XE;function Sue(){if(XE)return Cf.exports;XE=1,Cf.exports=function(o){return t(e(o),o)},Cf.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(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 S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--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 Cf.exports}var Cue=Sue();const Tue=er(Cue),kue=Object.prototype.toString,Eue=Error.prototype.toString,Oue=RegExp.prototype.toString,Mue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",_ue=/^Symbol\((.*)\)(.*)$/;function Rue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function ZE(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Rue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Mue.call(t).replace(_ue,"Symbol($1)");const r=kue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Eue.call(t)+"]":r==="RegExp"?Oue.call(t):null}function ws(t,e){let n=ZE(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=ZE(this[r],e);return i!==null?i:o},2)}function ZD(t){return t==null?[]:[].concat(t)}let QD,eA,tA,Iue=/\$\{\s*(\w+)\s*\}/g;QD=Symbol.toStringTag;class QE{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[QD]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],ZD(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]}}eA=Symbol.hasInstance;tA=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(Iue,(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 QE(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[tA]="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[eA](e){return QE[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"},Due={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},S0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Aue={isValue:"${path} field must be ${value}"},Uf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Pue={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"},Nue={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:Due,date:S0,object:Uf,array:Pue,boolean:Aue,tuple:Nue});const Ex=t=>t&&t.__isYupSchema__;class nh{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 nh(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(!Ex(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Tf={context:"$",value:"."};class Pa{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Tf.context,this.isValue=this.key[0]===Tf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Tf.context:this.isValue?Tf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&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}}Pa.prototype.__isYupRef=!0;const sa=t=>t==null;function sl(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:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(j={}){const V=nA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||S},p,j.params),k),L=new pr(pr.formatError(j.message||m,V),n,V.path,j.type||u,V.disableStackTrace);return L.params=V,L}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return rA(j,k)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?C(j):j?l(null):C(T())},P=j=>{pr.isError(j)?C(j):a(j)};if(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,P)}}catch(j){P(j);return}R(F)}return e.OPTIONS=t,e}function nA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=rA(t[n],e);return t}function rA(t,e){return Pa.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function $ue(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 rh extends Set{describe(){const e=[];for(const n of this.values())e.push(Pa.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 rh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function gl(t,e=new Map){if(Ex(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]=gl(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,gl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(gl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=gl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function jue(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 Lue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:jue(n)}))}function oA(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Lue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>oA(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 rh,this._blacklist=new rh,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=gl(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}".
|
|
404
|
+
3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Vce(){Wt.scanner=Ace(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=$ce(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function wx(t){return Wt.initialized||Vce(),jce(Wt.parser.start,t,zD(Wt.scanner.start,t))}wx.scan=zD;function WD(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new xx(n),o=wx(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const Sx="[\0- -\u2029 ]",zce=new RegExp(Sx),Hce=new RegExp(`${Sx}$`),Wce=new RegExp(Sx,"g");function Uce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function qce(t){return new rn({key:new On("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=d7(n.doc,[...e]);if(y7(a).forEach(({newRange:u})=>{const f=p7(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(!Hce.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(zce).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=wx(v).map(S=>S.toObject(t.defaultProtocol));if(!Uce(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=>{ov(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function Kce(t){return new rn({key:new On("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=rv(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function Yce(t){return new rn({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=WD(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(Wce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Gce=Or.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){zE(t);return}zE(t.scheme,t.optionalSlashes)})},onDestroy(){Fce()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=WD(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(qce({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(Kce({type:this.type})),this.options.linkOnPaste&&t.push(Yce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Jce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Z7(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 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 Xce=new On("suggestion");function Zce({pluginKey:t=Xce,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=Jce}){let x;const S=y==null?void 0:y(),k=new rn({key:t,view(){return{update:async(T,C)=>{var O,R,P,$,F,M,j;const V=(O=this.key)===null||O===void 0?void 0:O.getState(C),L=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=V.active&&L.active&&V.range.from!==L.range.from,_=!V.active&&L.active,I=V.active&&!L.active,B=!_&&!I&&V.query!==L.query,W=_||A&&B,K=B||A,U=I||A&&B;if(!W&&!K&&!U)return;const J=U&&!W?V:L,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&&((P=S==null?void 0:S.onBeforeStart)===null||P===void 0||P.call(S,x)),K&&(($=S==null?void 0:S.onBeforeUpdate)===null||$===void 0||$.call(S,x)),(K||W)&&(x.items=await m({editor:e,query:J.query})),U&&((F=S==null?void 0:S.onExit)===null||F===void 0||F.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),W&&((j=S==null?void 0:S.onStart)===null||j===void 0||j.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,R){const{isEditable:P}=e,{composing:$}=e.view,{selection:F}=T,{empty:M,from:j}=F,V={...C};if(V.composing=$,P&&(M||e.view.composing)){(j<C.range.from||j>C.range.to)&&!$&&!C.composing&&(V.active=!1);const L=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:F.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;L&&v({editor:e,state:R,range:L.range,isActive:C.active})?(V.active=!0,V.decorationId=C.decorationId?C.decorationId:A,V.range=L.range,V.query=L.query,V.text=L.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,C){var O;const{active:R,range:P}=k.getState(T.state);return R&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:P}))||!1},decorations(T){const{active:C,range:O,decorationId:R,query:P}=k.getState(T);if(!C)return null;const $=!(P!=null&&P.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 Qce({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 UD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Qce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function HE(t,e){const n=UD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const eue=nn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=HE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:HE(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 UD(this).map(Zce)}}),qD=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new rn({key:new On("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&Ih(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)}}})]}}),tue=Or.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),nue=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",St(this.options.HTMLAttributes,t),0]}}),rue=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",St(this.options.HTMLAttributes,t),0]}}),oue=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}}),iue=/^\s*(\[([( |x])?\])\s$/,sue=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const 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[Al({find:iue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),aue=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),lue=mn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),KD=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});KD.displayName="SuggestionList";const WE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},cue={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 Z2(KD,{props:n,editor:n.editor}),e=Uu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??WE},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))??WE}})},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}}}},uue=Gce.extend({inclusive:!1}),due=tue.extend({excludes:"superscript"}),fue=CI.extend({excludes:"subscript"});function pue({placeholder:t}={}){return X.useMemo(()=>[tte.configure({resizable:!0}),oue,rue,nue,pR,mR,gR,xR,_R,RR,IR,due,fue,AR,fR,dR,hR,MR,SI,DR,uue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),LQ,vR,$Q,lue.configure({types:["heading","paragraph","image"]}),Sce,Cce,Tce,DZ,NR.configure({multicolor:!0}),OR,QQ,yR,aue,sue.configure({nested:!0}),eue.configure({suggestion:cue}),qD.configure({placeholder:t}),ER],[t])}function UE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const hue=t=>{const e=pue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(xI,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ut.useField({name:n}),{setValue:f}=u,{value:p}=a;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),y=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=>{Zb({images:O,editor:T,position:k})});else{const O=i(S);Zb({images:O,editor:T,position:k})}},[]),v=X.useCallback((S,k,T,C)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=UE(k.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return y(O,P),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=UE(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(vI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(xce,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(Ste,{}),b.jsx($te,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},qE=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})})})},YD=({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,{})})]})},Cx=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},th=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Tx=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:S,retryCallback:k,isLoading:T=!1,disableMobileCards:C=!1,highlightSelectedRow:O=!1,headerRowStyle:R={},stickyHeader:P,reRenderExpand:$=!1,expandOnRowClick:F=!1,tooltipColor:M,...j}=t,{palette:V}=z.useTheme(),[L,A]=X.useState(void 0),[_,I]=X.useState(void 0);mue(t);const B=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=L===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($f,{"data-testid":"collapse-up"}):b.jsx(nb,{"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(Pne,{})," ",x]}),ce=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(vM,{color:"error"})," ",S,k&&b.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),Z=()=>{if(S)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(S)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=L===_e?void 0:_e;A($e),ue($e)}},re=ae=>{const _e=L===ae?void 0:ae;A(_e),ue(_e)},le=ae=>{if(!u)return;const _e=L===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($f,{}):b.jsx(nb,{})," Show"," ",_e?"Less":"More"]}),b.jsx(qE,{colSpan:r.length,isExpanded:n(ae)===L,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?tse(_e,.1):ge}}}},ee=V.grey[V.mode==="dark"?600:400],fe=ae=>ae&&b.jsx(z.Tooltip,{title:ae,children:b.jsx(Ane,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:M??ee,marginLeft:"2px"}})}),Ce=(ae,_e)=>{const $e=ae.find(Me=>Me.key==="MBv2_Checkbox_Column"),Pe=U.filter(Me=>Me.key!=="MBv2_Checkbox_Column");return b.jsxs(Cx,{alignItems:"flex-start",children:[$e&&b.jsx(th,{children:Tl($e,_e,K)}),b.jsxs(th,{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_${xn(Me)}`,style:{textWrap:"nowrap"},children:[Me.label??Fn(xn(Me)),fe(Me.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(Me)}`,style:{paddingLeft:"10px"},children:Tl(Me,_e,K)})]},`row-${n(_e)}-${xn(Me)}`))})}),le(_e)]})]})},Se=()=>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=>B(ae.target.value),fullWidth:!0,children:U.map(ae=>{if(me(xn(ae)))return b.jsx(z.MenuItem,{value:xn(ae),children:ae.label??Fn(xn(ae))},`rowHeader-${xn(ae)}`)})}),b.jsx(z.IconButton,{onClick:()=>{f&&B(f)},children:b.jsx(Vne,{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:Ce(U,ae)},n(ae)))]}),Ie=()=>b.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:P?{maxHeight:P,overflow:"auto"}:{},children:b.jsxs(z.Table,{stickyHeader:P!=="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(xn(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?()=>B(xn(ae)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ae.label??Fn(xn(ae))}),fe(ae.tooltip),$e&&W(xn(ae))==="asc"&&b.jsx($f,{style:{marginLeft:"5px"}}),$e&&W(xn(ae))==="desc"&&b.jsx(nb,{style:{marginLeft:"5px"}}),$e&&W(xn(ae))!=="asc"&&W(xn(ae))!=="desc"&&b.jsx(Bne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(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_${xn(_e)}`,children:Tl(_e,ae,K)},`row-${n(ae)}-${xn(_e)}`))}),u&&b.jsx(qE,{colSpan:U.length,isExpanded:n(ae)===L,obj:ae,renderExpand:_e=>u(_e),reRenderExpand:$})]},n(ae)))})]})});return b.jsx(YD,{isLoading:T,children:K&&!C?Se():Ie()})},mue=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=>xn(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'.`)},xn=t=>t.key??t.fieldName,gue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Tl=(t,e,n=!1)=>{const r=gue(e,t.fieldName);return t.render?t.render(r,e,n):r},GD=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(Tx,{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,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},KE=()=>({height:window.innerHeight,width:window.innerWidth}),JD=()=>{const[t,e]=X.useState(KE());return X.useEffect(()=>{const n=()=>{e(KE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},ao=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=JD(),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)})},yue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(z.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",startIcon:b.jsx(f0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},bue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",color:"error",startIcon:b.jsx(Gv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},vue=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:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:R=!1,showCloseBtn:P=!1,canSearch:$=!1}=t,F=!!t.canCreate&&!R,M=!!a&&!!s&&!R,j=!!u&&!!l&&R&&k,V=!!f&&!R,{palette:L}=z.useTheme(),[A,_]=X.useState([]),[I,B]=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=()=>{B(!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=>{S(Pe),B(!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(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Wh,{}),children:"Add Citation"}),ge=b.jsx(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx(AI,{}),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(Dne,{})})});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(zne,{})})})}},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(Gv,{})})})},fe=Pe=>{if(!C)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:C!=null&&C(Pe)?"visible":"hidden"},children:b.jsx(f0,{})})})},Ce=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(f0,{})})})},Se=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(Ine,{})})})},Ie=j||M||V||C||m||p||O,ae=[...XD(L,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),Ce(Me),fe(Me),Se(Me)]})}],_e=X.useCallback(Pe=>{ue(Me=>({...Me,pageNo:0,search:Pe}))},[]),$e=()=>$?b.jsx($I,{onSearch:_e}):null;return b.jsxs(th,{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]}),P&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(Zh,{})})]}),$e(),b.jsx(GD,{"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(ao,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(ao,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(yue,{citation:ce,anchorEl:U,onClose:re}),b.jsx(bue,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:re})]})},YE=(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})},XD=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(AI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Wh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>YE(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>YE(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}],kx=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(ao,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var db,GE;function xue(){if(GE)return db;GE=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);db={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var R=0,P=k.length,$=C;R<P-1;){var F=k[R];if(F==="__proto__"||F==="constructor"||F==="prototype")return C;$=$[k[R++]]}$[k[R]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var R=0,P=T.length;R<P;)if(O!=null||!k)O=O[T[R++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,R,P,$;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),$=y(O),P=!$&&/^\d+$/.test(O),k.call(T,O,$,P,R,S))}function y(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!y(S)&&(v(S)||g(S))}return db}var pa=xue(),fb,JE;function wue(){if(JE)return fb;JE=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 fb={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(" ")},fb}var pb=wue(),Cf={exports:{}},XE;function Sue(){if(XE)return Cf.exports;XE=1,Cf.exports=function(o){return t(e(o),o)},Cf.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(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 S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--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 Cf.exports}var Cue=Sue();const Tue=er(Cue),kue=Object.prototype.toString,Eue=Error.prototype.toString,Oue=RegExp.prototype.toString,Mue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",_ue=/^Symbol\((.*)\)(.*)$/;function Rue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function ZE(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Rue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Mue.call(t).replace(_ue,"Symbol($1)");const r=kue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Eue.call(t)+"]":r==="RegExp"?Oue.call(t):null}function ws(t,e){let n=ZE(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=ZE(this[r],e);return i!==null?i:o},2)}function ZD(t){return t==null?[]:[].concat(t)}let QD,eA,tA,Iue=/\$\{\s*(\w+)\s*\}/g;QD=Symbol.toStringTag;class QE{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[QD]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],ZD(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]}}eA=Symbol.hasInstance;tA=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(Iue,(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 QE(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[tA]="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[eA](e){return QE[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"},Due={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},S0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Aue={isValue:"${path} field must be ${value}"},Uf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Pue={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"},Nue={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:Due,date:S0,object:Uf,array:Pue,boolean:Aue,tuple:Nue});const Ex=t=>t&&t.__isYupSchema__;class nh{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 nh(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(!Ex(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Tf={context:"$",value:"."};class Pa{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Tf.context,this.isValue=this.key[0]===Tf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Tf.context:this.isValue?Tf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&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}}Pa.prototype.__isYupRef=!0;const sa=t=>t==null;function sl(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:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(j={}){const V=nA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||S},p,j.params),k),L=new pr(pr.formatError(j.message||m,V),n,V.path,j.type||u,V.disableStackTrace);return L.params=V,L}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return rA(j,k)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?C(j):j?l(null):C(T())},P=j=>{pr.isError(j)?C(j):a(j)};if(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,P)}}catch(j){P(j);return}R(F)}return e.OPTIONS=t,e}function nA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=rA(t[n],e);return t}function rA(t,e){return Pa.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function $ue(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 rh extends Set{describe(){const e=[];for(const n of this.values())e.push(Pa.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 rh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function gl(t,e=new Map){if(Ex(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]=gl(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,gl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(gl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=gl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function jue(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 Lue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:jue(n)}))}function oA(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Lue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>oA(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 rh,this._blacklist=new rh,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=gl(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
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):gl(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=sl({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=sl({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=sl(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=ZD(e).map(i=>new Pa(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new nh(o,n):nh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=sl({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=sl({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=sl({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?nA(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:oA(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}=$ue(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 Bue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Fue(t){const e=C0(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let n=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(n=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(n=0-n)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+n,e.second,e.millisecond)}function C0(t){var e,n;const r=Bue.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 Vue=/^[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])?)*$/,zue=/^((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,Hue=/^(?:[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,Wue="^\\d{4}-\\d{2}-\\d{2}",Uue="\\d{2}:\\d{2}:\\d{2}",que="(([+-]\\d{2}(:?\\d{2})?)|Z)",Kue=new RegExp(`${Wue}T${Uue}(\\.\\d+)?${que}$`),Yue=t=>sa(t)||t===t.trim(),Gue={}.toString();function kl(){return new iA}class iA 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===Gue?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(Vue,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(zue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(Hue,{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(Kue,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=C0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=C0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Yue})}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()})}}kl.prototype=iA.prototype;let sA=new Date(""),Jue=t=>Object.prototype.toString.call(t)==="[object Date]";function Ox(){return new Xu}class Xu extends ti{constructor(){super({type:"date",check(e){return Jue(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Fue(e),isNaN(e)?Xu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Pa.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=S0.min){let r=this.prepareParam(e,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(o){return o>=this.resolve(r)}})}max(e,n=S0.max){let r=this.prepareParam(e,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(o){return o<=this.resolve(r)}})}}Xu.INVALID_DATE=sA;Ox.prototype=Xu.prototype;Ox.INVALID_DATE=sA;function Xue(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),Pa.isRef(a)&&a.isSibling?i(a.path,s):Ex(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Tue.array(Array.from(r),n).reverse()}function eO(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 aA(t){return(e,n)=>eO(t,e)-eO(t,n)}const Zue=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function qf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=qf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=qf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(qf)}):"optional"in t?t.optional():t}const Que=(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 tO=t=>Object.prototype.toString.call(t)==="[object Object]";function nO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const ede=aA([]);function Mx(t){return new lA(t)}class lA extends ti{constructor(e){super({type:"object",check(n){return tO(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=ede,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,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 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||!tO(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Pa.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=Xue(e,n),r._sortErrors=aA(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return qf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=pa.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Que(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Zue)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Uf.exact,test(n){if(n==null)return!0;const r=nO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Uf.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=nO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Uf.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(pb.camelCase)}snakeCase(){return this.transformKeys(pb.snakeCase)}constantCase(){return this.transformKeys(e=>pb.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}}Mx.prototype=lA.prototype;const tde=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,v]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});X.useEffect(()=>{i&&v({...i,type:"Url"})},[]);const g={disabled:u,margin:"none",readOnly:s};return 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}),a&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(Zh,{})})]}),b.jsx(Ut.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,onSubmit:async x=>{f(!0),n(x).catch(S=>{throw f(!1),S}).finally(()=>f(!1))},validationSchema:Mx({title:kl().required("Title is required"),accessedAt:Ox().required("Accessed At is required"),url:kl().required("URL is required"),classification:kl().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:x})=>b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(_i,{...g,name:"title",required:!0}),b.jsx(_i,{...g,name:"source"}),b.jsx(_i,{...g,name:"details",label:"Details (e.g. Source Description)"}),b.jsx(Op,{...g,name:"accessedAt",required:!0,isDatePicker:!0}),b.jsx(_i,{...g,name:"url",label:"URL / Other Identifier",required:!0}),b.jsx(II,{...g,name:"classification",row:!0,required:!0,radios:nde})]}),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(kx,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),x()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},nde=[{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."}],rde=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(Zh,{})})]}),b.jsx(Ut.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:Mx().shape({title:kl().required("Title is required"),fileName:kl().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]),b.jsxs(Ut.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(Cx,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(MI,{name:"file",errorMode:"hidden"}),b.jsx(_i,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(Mr,{name:"fileName"})]}),b.jsx(z.DialogActions,{sx:{px:0},children:a?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(kx,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Zu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",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(Zh,{})})]})}):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 ode(t){return qe("MuiAlert",t)}const rO=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"]),ide=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"),sde=Ne(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),ade=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"),lde=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"),cde=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"),ude=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,ode,o)},dde=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:Ml,n=t.palette.mode==="light"?Ml: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),[`& .${rO.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}`,[`& .${rO.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)}}}))]}})),fde=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),pde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),hde=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}),oO={success:b.jsx(ide,{fontSize:"inherit"}),warning:b.jsx(sde,{fontSize:"inherit"}),error:b.jsx(ade,{fontSize:"inherit"}),info:b.jsx(lde,{fontSize:"inherit"})},cA=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=oO,onClose:y,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=ude(C),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[P,$]=Ot("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:dde,externalForwardedProps:{...R,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[F,M]=Ot("icon",{className:O.icon,elementType:fde,externalForwardedProps:R,ownerState:C}),[j,V]=Ot("message",{className:O.message,elementType:pde,externalForwardedProps:R,ownerState:C}),[L,A]=Ot("action",{className:O.action,elementType:hde,externalForwardedProps:R,ownerState:C}),[_,I]=Ot("closeButton",{elementType:Xl,externalForwardedProps:R,ownerState:C}),[B,W]=Ot("closeIcon",{elementType:cde,externalForwardedProps:R,ownerState:C});return b.jsxs(P,{...$,children:[p!==!1?b.jsx(F,{...M,children:p||m[g]||oO[g]}):null,b.jsx(j,{...V,children:i}),o!=null?b.jsx(L,{...A,children:o}):null,o==null&&y?b.jsx(L,{...A,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...I,children:b.jsx(B,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(cA.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Qu=t=>{var 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(cA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(z.Typography,{variant:"h3",children:s}),n]})},uA=t=>b.jsx(Qu,{severity:"error",...t}),dA=t=>b.jsx(Qu,{severity:"success",...t}),mde=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(uA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(dA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function fA({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:S,canSearch:k=!1}){const[T,C]=X.useState("Insert Citation/Attachment(s)"),[O,R]=X.useState(u),[P,$]=X.useState(void 0),[F,M]=X.useState(void 0),j=Y=>{M(void 0),C(Y)},[V,L]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,F,f]);const A=(Y=!1)=>{(!m||Y)&&L(ee=>ee+1)},_=(Y,ee)=>{var Ie;const fe=typeof((Ie=ee.response)==null?void 0:Ie.data)=="string"&&ee.response.data,Ce=typeof ee.message=="string"&&ee.message;M({type:"Error",title:Y,message:fe??Ce}),p(ee)},I=Y=>M({type:"Success",title:"",message:Y}),B=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,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=b.jsx(vue,{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:S,showCloseBtn:m,canSearch:k}),ue=b.jsx(tde,{modifyCitation:P,onSave:B,onCancel:()=>j("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=b.jsx(rde,{onSave:B,onCancel:()=>j("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:P,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),re=b.jsx(mde,{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(Zu,{open:le||ge,children:b.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[re,le?ue:te]})})]})}function pA({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return b.jsx(fA,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const gde=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 yde({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=Ct();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,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?b.jsx(bv,{editor:m,open:v,...y.bubbleMenuOptions,...p,children:b.jsx(gde,{children:b.jsx(pA,{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 bde=()=>mn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function vde(t){const e=Ct(),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(Mne,{fontSize:"small"}),b.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const hA=X.createContext(void 0),mA=()=>{const t=X.useContext(hA);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},xde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=mA(),[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(S=>s.includes(S.id)),g=v.map(S=>Ta.truncate(S.title,{length:y,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 b.jsx(zv,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(z.Tooltip,{title:b.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,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 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})})})},wde=nn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",St(t)]},addNodeView(){return Hv(xde)},addProseMirrorPlugins(){return[new rn({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),gA=t=>b.jsx(OI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Sde=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:S="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:C,canSearch:O=!1}=t,R=[PR,qD.configure({placeholder:S}),bde(),wde.configure({citationMaxLength:a})],[P,$,F]=Ut.useField({name:e}),{setValue:M}=F,{value:j}=P,{addUpdateCitation:V,deleteCitation:L,batchUpdate:A,citations:_}=mA();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),B={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=Ma(),{showDiff:J,getPreviousValue:me}=_a(),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(Da,{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}},...B[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(gA,{name:k})]}),b.jsx(vI,{ref:I,extensions:R,content:j,editable:!he,renderControls:he?void 0:()=>b.jsx(jv,{children:b.jsx(vde,{})}),onBlur:()=>W(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>b.jsx(yde,{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(()=>L(ce))),getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:C,readOnly:he,canSearch:O})}),b.jsx(Mr,{name:e,id:`${e}-err`,errorMode:T})]})},Cde=t=>{const{name:e="submit"}=t;return b.jsx(ao,{name:e,type:"submit",...t})},Tde=t=>{const{label:e="Return to Top",icon:n=$f,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]})})})},yA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ko.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(z.MenuItem,{..._u(p,o),children:[p.icon&&b.jsx(z.ListItemIcon,{children:p.icon}),b.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},kde=()=>{const{values:t,errors:e,status:n}=Ut.useFormikContext(),{palette:r}=z.useTheme();return b.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(z.List,{children:[b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(z.Divider,{variant:"inset",component:"li"}),b.jsxs(z.ListItem,{id:"testing",children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Ede=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=JD();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))})},Ode=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(NI,{}):"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]=Ut.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(z.FormControl,{fullWidth:!0,children:[b.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(z.Typography,{children:y}):b.jsx(Ut.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(X.Fragment,{children:b.jsx(Mde,{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!==S.length-1&&b.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Mde=({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}},_de=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Rde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Zu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Ide=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Dde={added:{icon:Ene,label:"Added",color:"success"},deleted:{icon:NI,label:"Deleted",color:"error"},modified:{icon:_ne,label:"Modified",color:"info"}},Ade=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:wp},children:b.jsx("s",{children:t})}),b.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:xp},children:b.jsx("u",{children:e})})]}),Pde=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Tl(s,e,r),l=Tl(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??EI.isEqual(a,l))||(o[xn(s)]=Ade(a,l))}return o},Nde=(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=Pde(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}},bA=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}=Nde(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=Dde[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(I0,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var y;return((y=m.modifiedDiff)==null?void 0:y[xn(f)])??Tl(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(CM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},vA=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>b.jsxs(z.Box,{children:[b.jsx(Tx,{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"]})})]}),$de=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?bA({...n,isMobileScreen:r}):n;return b.jsx(vA,{...o,size:t.size})},jde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,..._u(l,a),children:l.label},l.label))}),n&&b.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},xA=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,{..._u(v,i,()=>a(!1)),children:[v.icon&&b.jsx(z.ListItemIcon,{children:v.icon}),b.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${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($ne,{})}),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})})})]})},wA=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"]})})},SA=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(yA,{label:e,menuOptions:n,icon:b.jsx(Lne,{})})},gm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,..._u(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},CA=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(gm,{menuOptions:e,activeTabIdx:n,sx:r})})},TA=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(PI,{}):b.jsx(DI,{})})},Lde=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:S}=ko.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const P=o.findIndex($=>$.path&&S.startsWith($.path));C(P>=0?P:void 0)},[S,o]);const O=s&&b.jsx(TA,{onToggle:s}),R=s&&(g||!g&&l)?[{icon:k?b.jsx(PI,{}):b.jsx(DI,{}),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(wA,{...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(xA,{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((P,$)=>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"},..._u(P,v),children:b.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&b.jsx(SA,{displayName:l,userMenuOptions:R})]})]})]}),!g&&b.jsx(CA,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Bde=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(gm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Fde=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&b.jsx(gm,{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}})},Vde=({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(hA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},zde=t=>b.jsx(Qu,{severity:"info",...t}),Hde=t=>b.jsx(Qu,{severity:"warning",...t}),kA=t=>{const{crumbInfo:e}=t,n=ko.useNavigate();return b.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(jne,{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))})},Wde=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Ude(r);return b.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(Qu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:iO(r),warning:iO(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})})},Ude=t=>t=="logout"?"info":t=="timeout"?"warning":t,iO=t=>{if(t=="timeout")return b.jsx(kne,{});if(t=="logout")return b.jsx(Nne,{})},qde=t=>{Kde(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(kA,{crumbInfo:i}),b.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(ao,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(One,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},Kde=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`)},Yde=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})]})},Gde=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 Jde({...t}){return b.jsx(fA,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const Xde=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=Rde;exports.Autocomplete=kI;exports.Breadcrumbs=kA;exports.Button=ao;exports.Checkbox=OI;exports.CheckboxGroup=Gte;exports.CitationField=Sde;exports.CitationFieldProvider=Vde;exports.CitationManager=Jde;exports.Column=th;exports.ConfirmationModal=_de;exports.DarkModeToggle=TA;exports.DateField=Op;exports.DateRangeField=vce;exports.DecisionModal=Ide;exports.Diff=TI;exports.DiffProvider=CM;exports.DiffTable=$de;exports.DiffTableView=vA;exports.Drawer=xA;exports.DynamicAutocomplete=Kte;exports.EnvironmentBanner=wA;exports.ErrorAlert=uA;exports.FileList=Zte;exports.FileUpload=MI;exports.FloatingNavBar=Fde;exports.Footer=jde;exports.FormDebugger=kde;exports.Header=Lde;exports.InfoAlert=zde;exports.LoadingButton=kx;exports.LoadingIndicator=Gde;exports.LoadingOverlay=YD;exports.Location=xne;exports.MenuButton=yA;exports.Modal=Zu;exports.MultiAutocomplete=Yte;exports.NavBar=CA;exports.NotApplicableCheckbox=gA;exports.PageHeader=qde;exports.PaginatedTable=GD;exports.ProfileMenu=SA;exports.RadioGroup=II;exports.RangeSlider=wne;exports.ReadOnly=Da;exports.ReadOnlyProvider=wM;exports.RepeatableFormGroup=Ode;exports.RichTextField=hue;exports.Row=Cx;exports.ScrollToTop=Tde;exports.SearchField=$I;exports.Select=Sne;exports.SelectableCitationManager=pA;exports.Sidebar=Bde;exports.SingleActionCard=Yde;exports.Snackbar=Wde;exports.Spacer=Xde;exports.Stepper=Ede;exports.Submit=Cde;exports.SuccessAlert=dA;exports.Switch=Cne;exports.Table=Tx;exports.Tabs=gm;exports.TextArea=Tne;exports.TextField=_i;exports.TextIcon=I0;exports.ValidationError=Mr;exports.WarningAlert=Hde;exports.baseCitationTableColumns=XD;exports.buildTableDiff=bA;exports.commonTheme=In;exports.darkTheme=rz;exports.lightTheme=nz;exports.useDiff=_a;exports.useReadOnly=Ma;
|
package/dist/index.es.js
CHANGED
|
@@ -60302,6 +60302,10 @@ const Ope = (t) => {
|
|
|
60302
60302
|
fieldName: "source",
|
|
60303
60303
|
hideCol: e
|
|
60304
60304
|
},
|
|
60305
|
+
{
|
|
60306
|
+
fieldName: "details",
|
|
60307
|
+
hideCol: e
|
|
60308
|
+
},
|
|
60305
60309
|
{
|
|
60306
60310
|
fieldName: "accessedAt",
|
|
60307
60311
|
hideCol: e,
|
package/dist/index.umd.js
CHANGED
|
@@ -402,7 +402,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
402
402
|
`,jZ="️",UZ="",ev="";let yh=null,bh=null;function qZ(t=[]){const e={};Tr.groups=e;const n=new Tr;yh==null&&(yh=k2(FZ)),bh==null&&(bh=k2(RZ)),Ne(n,"'",ih),Ne(n,"{",_u),Ne(n,"}",Iu),Ne(n,"[",jp),Ne(n,"]",Up),Ne(n,"(",qp),Ne(n,")",Kp),Ne(n,"<",Yp),Ne(n,">",Gp),Ne(n,"(",Jp),Ne(n,")",Xp),Ne(n,"「",Zp),Ne(n,"」",Qp),Ne(n,"『",eh),Ne(n,"』",th),Ne(n,"<",nh),Ne(n,">",rh),Ne(n,"&",oh),Ne(n,"*",sh),Ne(n,"@",bs),Ne(n,"`",lh),Ne(n,"^",ch),Ne(n,":",vs),Ne(n,",",K0),Ne(n,"$",uh),Ne(n,".",Zo),Ne(n,"=",dh),Ne(n,"!",Y0),Ne(n,"-",ao),Ne(n,"%",Au),Ne(n,"|",fh),Ne(n,"+",ph),Ne(n,"#",hh),Ne(n,"?",Du),Ne(n,'"',G0),Ne(n,"/",Qo),Ne(n,";",J0),Ne(n,"~",Pu),Ne(n,"_",mh),Ne(n,"\\",ah),Ne(n,"・",x2);const r=hn(n,Ii,j0,{[L0]:!0});hn(r,Ii,r);const o=hn(r,_i,b2,{[Eu]:!0}),i=hn(r,Nu,v2,{[Ou]:!0}),s=hn(n,_i,Mi,{[B0]:!0});hn(s,Ii,o),hn(s,_i,s),hn(o,Ii,o),hn(o,_i,o);const a=hn(n,Nu,V0,{[F0]:!0});hn(a,_i),hn(a,Ii,i),hn(a,Nu,a),hn(i,Ii,i),hn(i,_i),hn(i,Nu,i);const l=Ne(n,Q0,q0,{[z0]:!0}),u=Ne(n,C2,U0,{[z0]:!0}),f=hn(n,Z0,U0,{[z0]:!0});Ne(n,ev,f),Ne(u,Q0,l),Ne(u,ev,f),hn(u,Z0,f),Ne(f,C2),Ne(f,Q0),hn(f,Z0,f),Ne(f,ev,f);const p=hn(n,X0,w2,{[g2]:!0});Ne(p,"#"),hn(p,X0,p),Ne(p,jZ,p);const m=Ne(p,UZ);Ne(m,"#"),hn(m,X0,p);const y=[[_i,s],[Ii,o]],v=[[_i,null],[Nu,a],[Ii,i]];for(let g=0;g<yh.length;g++)xs(n,yh[g],H0,Mi,y);for(let g=0;g<bh.length;g++)xs(n,bh[g],W0,V0,v);wa(H0,{tld:!0,ascii:!0},e),wa(W0,{utld:!0,alpha:!0},e),xs(n,"file",Wp,Mi,y),xs(n,"mailto",Wp,Mi,y),xs(n,"http",Nl,Mi,y),xs(n,"https",Nl,Mi,y),xs(n,"ftp",Nl,Mi,y),xs(n,"ftps",Nl,Mi,y),wa(Wp,{scheme:!0,ascii:!0},e),wa(Nl,{slashscheme:!0,ascii:!0},e),t=t.sort((g,x)=>g[0]>x[0]?1:-1);for(let g=0;g<t.length;g++){const x=t[g][0],k=t[g][1]?{[zZ]:!0}:{[VZ]:!0};x.indexOf("-")>=0?k[R0]=!0:_i.test(x)?Ii.test(x)?k[Eu]=!0:k[B0]=!0:k[L0]=!0,y2(n,x,x,k)}return y2(n,"localhost",Mu,{ascii:!0}),n.jd=new Tr(gh),{start:n,tokens:Object.assign({groups:e},S2)}}function T2(t,e){const n=KZ(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,l=null,u=0,f=null,p=-1,m=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(p=0,m=0,f=a):p>=0&&(p+=n[s].length,m++),u+=n[s].length,i+=n[s].length,s++;i-=p,s-=m,u-=p,o.push({t:f.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function KZ(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function xs(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Tr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Tr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function k2(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const $u={defaultProtocol:"http",events:null,format:E2,formatHref:E2,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function tv(t,e=null){let n=Object.assign({},$u);t&&(n=Object.assign(n,t instanceof tv?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}tv.prototype={o:$u,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:$u[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function E2(t){return t}function O2(t,e){this.t="token",this.v=t,this.tk=e}O2.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=$u.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),f=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),f&&Object.assign(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function vh(t,e){class n extends O2{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const M2=vh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),_2=vh("text"),YZ=vh("nl"),xh=vh("url",{isLink:!0,toHref(t=$u.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Mu&&t[1].t===vs}}),lo=t=>new Tr(t);function GZ({groups:t}){const e=t.domain.concat([oh,sh,bs,ah,lh,ch,uh,dh,ao,j0,Au,fh,ph,hh,Qo,gh,Pu,mh]),n=[ih,vs,K0,Zo,Y0,Au,Du,G0,J0,Yp,Gp,_u,Iu,Up,jp,qp,Kp,Jp,Xp,Zp,Qp,eh,th,nh,rh],r=[oh,ih,sh,ah,lh,ch,uh,dh,ao,_u,Iu,Au,fh,ph,hh,Du,Qo,gh,Pu,mh],o=lo(),i=Ne(o,Pu);ft(i,r,i),ft(i,t.domain,i);const s=lo(),a=lo(),l=lo();ft(o,t.domain,s),ft(o,t.scheme,a),ft(o,t.slashscheme,l),ft(s,r,i),ft(s,t.domain,s);const u=Ne(s,bs);Ne(i,bs,u),Ne(a,bs,u),Ne(l,bs,u);const f=Ne(i,Zo);ft(f,r,i),ft(f,t.domain,i);const p=lo();ft(u,t.domain,p),ft(p,t.domain,p);const m=Ne(p,Zo);ft(m,t.domain,p);const y=lo(M2);ft(m,t.tld,y),ft(m,t.utld,y),Ne(u,Mu,y);const v=Ne(p,ao);Ne(v,ao,v),ft(v,t.domain,p),ft(y,t.domain,p),Ne(y,Zo,m),Ne(y,ao,v);const g=Ne(y,vs);ft(g,t.numeric,M2);const x=Ne(s,ao),S=Ne(s,Zo);Ne(x,ao,x),ft(x,t.domain,s),ft(S,r,i),ft(S,t.domain,s);const k=lo(xh);ft(S,t.tld,k),ft(S,t.utld,k),ft(k,t.domain,s),ft(k,r,i),Ne(k,Zo,S),Ne(k,ao,x),Ne(k,bs,u);const T=Ne(k,vs),C=lo(xh);ft(T,t.numeric,C);const O=lo(xh),I=lo();ft(O,e,O),ft(O,n,I),ft(I,e,O),ft(I,n,I),Ne(k,Qo,O),Ne(C,Qo,O);const N=Ne(a,vs),L=Ne(l,vs),V=Ne(L,Qo),M=Ne(V,Qo);ft(a,t.domain,s),Ne(a,Zo,S),Ne(a,ao,x),ft(l,t.domain,s),Ne(l,Zo,S),Ne(l,ao,x),ft(N,t.domain,O),Ne(N,Qo,O),Ne(N,Du,O),ft(M,t.domain,O),ft(M,e,O),Ne(M,Qo,O);const B=[[_u,Iu],[jp,Up],[qp,Kp],[Yp,Gp],[Jp,Xp],[Zp,Qp],[eh,th],[nh,rh]];for(let H=0;H<B.length;H++){const[F,P]=B[H],_=Ne(O,F);Ne(I,F,_),Ne(_,P,O);const A=lo(xh);ft(_,e,A);const R=lo();ft(_,n),ft(A,e,A),ft(A,n,R),ft(R,e,A),ft(R,n,R),Ne(A,P,O),Ne(R,P,O)}return Ne(o,Mu,k),Ne(o,q0,YZ),{start:o,tokens:S2}}function JZ(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,u=null,f=0,p=null,m=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(u=l||a.go(n[o].t));)l=null,a=u,a.accepts()?(m=0,p=a):m>=0&&m++,o++,f++;if(m<0)o-=f,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(nv(_2,e,s)),s=[]),o-=m,f-=m;const y=p.t,v=n.slice(o-f,o);i.push(nv(y,e,v))}}return s.length>0&&i.push(nv(_2,e,s)),i}function nv(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const XZ=typeof console<"u"&&console&&console.warn||(()=>{}),ZZ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Kt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function QZ(){return Tr.groups={},Kt.scanner=null,Kt.parser=null,Kt.tokenQueue=[],Kt.pluginQueue=[],Kt.customSchemes=[],Kt.initialized=!1,Kt}function I2(t,e=!1){if(Kt.initialized&&XZ(`linkifyjs: already initialized - will not register custom scheme "${t}" ${ZZ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
403
403
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
404
404
|
2. Cannot start or end with "-"
|
|
405
|
-
3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function eQ(){Kt.scanner=qZ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=GZ(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 rv(t){return Kt.initialized||eQ(),JZ(Kt.parser.start,t,T2(Kt.scanner.start,t))}rv.scan=T2;function A2(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 tv(n),o=rv(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 ov="[\0- -\u2029 ]",tQ=new RegExp(ov),nQ=new RegExp(`${ov}$`),rQ=new RegExp(ov,"g");function oQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function iQ(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=LR(n.doc,[...e]);if(HR(a).forEach(({newRange:u})=>{const f=FR(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(!nQ.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(tQ).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=rv(v).map(S=>S.toObject(t.defaultProtocol));if(!oQ(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=>{qg(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 sQ(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=Ug(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 aQ(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=A2(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(rQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const lQ=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"){I2(t);return}I2(t.scheme,t.optionalSlashes)})},onDestroy(){QZ()},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=A2(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(iQ({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(sQ({type:this.type})),this.options.linkOnPaste&&t.push(aQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function cQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=p3(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 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 uQ=new On("suggestion");function dQ({pluginKey:t=uQ,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=cQ}){let x;const S=y==null?void 0:y(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,L,V,M,B;const H=(O=this.key)===null||O===void 0?void 0:O.getState(C),F=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=H.active&&F.active&&H.range.from!==F.range.from,_=!H.active&&F.active,A=H.active&&!F.active,R=!_&&!A&&H.query!==F.query,j=_||P&&R,K=R||P,U=A||P&&R;if(!j&&!K&&!U)return;const J=U&&!j?H:F,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&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.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:N}=e,{composing:L}=e.view,{selection:V}=T,{empty:M,from:B}=V,H={...C};if(H.composing=L,N&&(M||e.view.composing)){(B<C.range.from||B>C.range.to)&&!L&&!C.composing&&(H.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;F&&v({editor:e,state:I,range:F.range,isActive:C.active})?(H.active=!0,H.decorationId=C.decorationId?C.decorationId:P,H.range=F.range,H.query=F.query,H.text=F.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:N}=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:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const L=!(N!=null&&N.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 fQ({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 D2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>fQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function P2(t,e){const n=D2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const pQ=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=P2(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:P2(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 D2(this).map(dQ)}}),N2=ln.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&&af(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)}}})]}}),hQ=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()}}}),mQ=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]}}),gQ=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]}}),yQ=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]}}),bQ=/^\s*(\[([( |x])?\])\s$/,vQ=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 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[sl({find:bQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),xQ=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()}}}),wQ=ln.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")}}}),$2=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});$2.displayName="SuggestionList";const L2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},SQ={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 hO($2,{props:n,editor:n.editor}),e=au("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??L2},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))??L2}})},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}}}},CQ=lQ.extend({inclusive:!1}),TQ=hQ.extend({excludes:"superscript"}),kQ=iM.extend({excludes:"subscript"});function EQ({placeholder:t}={}){return X.useMemo(()=>[h7.configure({resizable:!0}),yQ,gQ,mQ,cT,dT,fT,gT,OT,IT,AT,TQ,kQ,PT,sT,iT,uT,ET,oM,DT,CQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Z9,mT,J9,wQ.configure({types:["heading","paragraph","image"]}),$Z,LZ,BZ,Kj,zT.configure({multicolor:!0}),kT,p8,pT,xQ,vQ.configure({nested:!0}),pQ.configure({suggestion:SQ}),N2.configure({placeholder:t}),TT],[t])}function B2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const OQ=t=>{const e=EQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(nM,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=jt.useField({name:n}),{setValue:f}=u,{value:p}=a;X.useEffect(()=>{var 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),y=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=>{nb({images:O,editor:T,position:k})});else{const O=i(S);nb({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=B2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return y(O,N),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=B2(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(tM,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(PZ,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx($7,{}),b.jsx(G7,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},F2=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})})})},R2=({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,{})})]})},iv=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},wh=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},sv=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:S,retryCallback:k,isLoading:T=!1,disableMobileCards:C=!1,highlightSelectedRow:O=!1,headerRowStyle:I={},stickyHeader:N,reRenderExpand:L=!1,expandOnRowClick:V=!1,tooltipColor:M,...B}=t,{palette:H}=z.useTheme(),[F,P]=X.useState(void 0),[_,A]=X.useState(void 0);MQ(t);const R=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=F===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(dp,{"data-testid":"collapse-up"}):b.jsx(h0,{"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(Be=>Be!==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(KU,{})," ",x]}),ce=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(aw,{color:"error"})," ",S,k&&b.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),Z=()=>{if(S)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(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=F===_e?void 0:_e;P(Be),ue(Be)}},re=ae=>{const _e=F===ae?void 0:ae;P(_e),ue(_e)},le=ae=>{if(!u)return;const _e=F===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(dp,{}):b.jsx(h0,{})," Show"," ",_e?"Less":"More"]}),b.jsx(F2,{colSpan:r.length,isExpanded:n(ae)===F,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?hG(_e,.1):ge}}}},ee=H.grey[H.mode==="dark"?600:400],pe=ae=>ae&&b.jsx(z.Tooltip,{title:ae,children:b.jsx(qU,{"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 b.jsxs(iv,{alignItems:"flex-start",children:[Be&&b.jsx(wh,{children:$l(Be,_e,K)}),b.jsxs(wh,{width:"100%",children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:$e.map(Me=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.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)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(Me)}`,style:{paddingLeft:"10px"},children:$l(Me,_e,K)})]},`row-${n(_e)}-${xn(Me)}`))})}),le(_e)]})]})},Se=()=>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=>R(ae.target.value),fullWidth:!0,children:U.map(ae=>{if(me(xn(ae)))return b.jsx(z.MenuItem,{value:xn(ae),children:ae.label??Ln(xn(ae))},`rowHeader-${xn(ae)}`)})}),b.jsx(z.IconButton,{onClick:()=>{f&&R(f)},children:b.jsx(eq,{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:Ce(U,ae)},n(ae)))]}),Ae=()=>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:I?{"& .MuiTableCell-head":{...I}}:{},...B,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 Be=me(xn(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:[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?()=>R(xn(ae)):void 0,children:[b.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"&&b.jsx(dp,{style:{marginLeft:"5px"}}),Be&&j(xn(ae))==="desc"&&b.jsx(h0,{style:{marginLeft:"5px"}}),Be&&j(xn(ae))!=="asc"&&j(xn(ae))!=="desc"&&b.jsx(ZU,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(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_${xn(_e)}`,children:$l(_e,ae,K)},`row-${n(ae)}-${xn(_e)}`))}),u&&b.jsx(F2,{colSpan:U.length,isExpanded:n(ae)===F,obj:ae,renderExpand:_e=>u(_e),reRenderExpand:L})]},n(ae)))})]})});return b.jsx(R2,{isLoading:T,children:K&&!C?Se():Ae()})},MQ=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=>xn(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'.`)},xn=t=>t.key??t.fieldName,_Q=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),$l=(t,e,n=!1)=>{const r=_Q(e,t.fieldName);return t.render?t.render(r,e,n):r},z2=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(sv,{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,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},V2=()=>({height:window.innerHeight,width:window.innerWidth}),H2=()=>{const[t,e]=X.useState(V2());return X.useEffect(()=>{const n=()=>{e(V2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},co=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=H2(),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,...cr({...t},a)})},IQ=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(co,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{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"})]})]})})},AQ=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(co,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",color:"error",startIcon:b.jsx(Xb,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},DQ=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:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:I=!1,showCloseBtn:N=!1,canSearch:L=!1}=t,V=!!t.canCreate&&!I,M=!!a&&!!s&&!I,B=!!u&&!!l&&I&&k,H=!!f&&!I,{palette:F}=z.useTheme(),[P,_]=X.useState([]),[A,R]=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=()=>{R(!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),R(!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(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Vf,{}),children:"Add Citation"}),ge=b.jsx(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx($M,{}),children:"Add Attachment"}),Y=$e=>{if(!(!M&&!B)){if(M)return b.jsx(z.Tooltip,{title:"Edit",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>$e.fileName?a($e):s($e),"data-testid":`citation-table_edit-btn-${$e.id}`,children:b.jsx(UU,{})})});if(B)return b.jsx(z.Tooltip,{title:"View",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>$e.fileName?u($e):l($e),"data-testid":`citation-table_view-btn-${$e.id}`,children:b.jsx(tq,{})})})}},ee=$e=>{if(!(!H||I))return b.jsx(z.Tooltip,{title:"Delete",children:b.jsx(z.IconButton,{color:"error",onClick:Me=>{he($e),J(Me.currentTarget)},"data-testid":`citation-table_delete-btn-${$e.id}`,children:b.jsx(Xb,{})})})},pe=$e=>{if(!C)return;if(!$e.fileName)return b.jsx(z.Tooltip,{title:"Open URL",children:b.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:b.jsx(m0,{})})})},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 b.jsx(z.Tooltip,{title:"View File",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>m==null?void 0:m($e),"data-testid":`citation-table_view-file-btn-${$e.id}`,children:b.jsx(m0,{})})})},Se=$e=>{if(!p)return;if(!!$e.fileName)return b.jsx(z.Tooltip,{title:"Download",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>p==null?void 0:p($e),"data-testid":`citation-table_download-btn-${$e.id}`,children:b.jsx(jU,{})})})},Ae=B||M||H||C||m||p||O,ae=[...j2(F,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Ae,render:($e,Me)=>b.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?b.jsx(FM,{onSearch:_e}):null;return b.jsxs(wh,{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&&V&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ge]}),N&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(up,{})})]}),Be(),b.jsx(z2,{"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&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&b.jsxs(b.Fragment,{children:[le,ge]})}),!I&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(co,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(co,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(IQ,{citation:ce,anchorEl:U,onClose:re}),b.jsx(AQ,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:re})]})},W2=(t,e)=>{const n=t?ma.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})},j2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx($M,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Vf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>W2(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>W2(e,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],av=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(co,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var lv,U2;function PQ(){if(U2)return lv;U2=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);lv={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,N=k.length,L=C;I<N-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,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(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,N,L;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),L=y(O),N=!L&&/^\d+$/.test(O),k.call(T,O,L,N,I,S))}function y(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!y(S)&&(v(S)||g(S))}return lv}var Ca=PQ(),cv,q2;function NQ(){if(q2)return cv;q2=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 cv={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(" ")},cv}var uv=NQ(),Sh={exports:{}},K2;function $Q(){if(K2)return Sh.exports;K2=1,Sh.exports=function(o){return t(e(o),o)},Sh.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 S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--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 Sh.exports}var LQ=$Q();const BQ=Un(LQ),FQ=Object.prototype.toString,RQ=Error.prototype.toString,zQ=RegExp.prototype.toString,VQ=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",HQ=/^Symbol\((.*)\)(.*)$/;function WQ(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function Y2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return WQ(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return VQ.call(t).replace(HQ,"Symbol($1)");const r=FQ.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+RQ.call(t)+"]":r==="RegExp"?zQ.call(t):null}function ws(t,e){let n=Y2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=Y2(this[r],e);return i!==null?i:o},2)}function G2(t){return t==null?[]:[].concat(t)}let J2,X2,Z2,jQ=/\$\{\s*(\w+)\s*\}/g;J2=Symbol.toStringTag;class Q2{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[J2]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],G2(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]}}X2=Symbol.hasInstance,Z2=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 Q2(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[Z2]="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[X2](e){return Q2[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}},kr={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"},UQ={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"},dv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},qQ={isValue:"${path} field must be ${value}"},Ch={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:UQ,date:dv,object:Ch,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:qQ,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 fv=t=>t&&t.__isYupSchema__;class Th{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new Th(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!fv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const kh={context:"$",value:"."};class Ta{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===kh.context,this.isValue=this.key[0]===kh.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?kh.context:this.isValue?kh.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Ca.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Ta.prototype.__isYupRef=!0;const ka=t=>t==null;function Ll(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:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(B={}){const H=eI(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),F=new hr(hr.formatError(B.message||m,H),n,H.path,B.type||u,H.disableStackTrace);return F.params=H,F}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(B){return tI(B,k)},options:o,originalValue:i,schema:s};const I=B=>{hr.isError(B)?C(B):B?l(null):C(T())},N=B=>{hr.isError(B)?C(B):a(B)};if(y&&ka(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,N)}}catch(B){N(B);return}I(V)}return e.OPTIONS=t,e}function eI(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=tI(t[n],e);return t}function tI(t,e){return Ta.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function KQ(t,e,n,r=n){let o,i,s;return e?(Ca.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 Eh extends Set{describe(){const e=[];for(const n of this.values())e.push(Ta.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new Eh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Bl(t,e=new Map){if(fv(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]=Bl(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,Bl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Bl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Bl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function YQ(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 GQ(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:YQ(n)}))}function nI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return GQ(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>nI(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 Eh,this._blacklist=new Eh,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=Bl(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&&ka(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
|
+
3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function eQ(){Kt.scanner=qZ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=GZ(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 rv(t){return Kt.initialized||eQ(),JZ(Kt.parser.start,t,T2(Kt.scanner.start,t))}rv.scan=T2;function A2(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 tv(n),o=rv(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 ov="[\0- -\u2029 ]",tQ=new RegExp(ov),nQ=new RegExp(`${ov}$`),rQ=new RegExp(ov,"g");function oQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function iQ(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=LR(n.doc,[...e]);if(HR(a).forEach(({newRange:u})=>{const f=FR(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(!nQ.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(tQ).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=rv(v).map(S=>S.toObject(t.defaultProtocol));if(!oQ(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=>{qg(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 sQ(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=Ug(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 aQ(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=A2(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(rQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const lQ=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"){I2(t);return}I2(t.scheme,t.optionalSlashes)})},onDestroy(){QZ()},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=A2(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(iQ({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(sQ({type:this.type})),this.options.linkOnPaste&&t.push(aQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function cQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=p3(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 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 uQ=new On("suggestion");function dQ({pluginKey:t=uQ,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=cQ}){let x;const S=y==null?void 0:y(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,L,V,M,B;const H=(O=this.key)===null||O===void 0?void 0:O.getState(C),F=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=H.active&&F.active&&H.range.from!==F.range.from,_=!H.active&&F.active,A=H.active&&!F.active,R=!_&&!A&&H.query!==F.query,j=_||P&&R,K=R||P,U=A||P&&R;if(!j&&!K&&!U)return;const J=U&&!j?H:F,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&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.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:N}=e,{composing:L}=e.view,{selection:V}=T,{empty:M,from:B}=V,H={...C};if(H.composing=L,N&&(M||e.view.composing)){(B<C.range.from||B>C.range.to)&&!L&&!C.composing&&(H.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;F&&v({editor:e,state:I,range:F.range,isActive:C.active})?(H.active=!0,H.decorationId=C.decorationId?C.decorationId:P,H.range=F.range,H.query=F.query,H.text=F.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:N}=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:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const L=!(N!=null&&N.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 fQ({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 D2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>fQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function P2(t,e){const n=D2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const pQ=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=P2(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:P2(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 D2(this).map(dQ)}}),N2=ln.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&&af(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)}}})]}}),hQ=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()}}}),mQ=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]}}),gQ=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]}}),yQ=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]}}),bQ=/^\s*(\[([( |x])?\])\s$/,vQ=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 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[sl({find:bQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),xQ=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()}}}),wQ=ln.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")}}}),$2=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});$2.displayName="SuggestionList";const L2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},SQ={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 hO($2,{props:n,editor:n.editor}),e=au("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??L2},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))??L2}})},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}}}},CQ=lQ.extend({inclusive:!1}),TQ=hQ.extend({excludes:"superscript"}),kQ=iM.extend({excludes:"subscript"});function EQ({placeholder:t}={}){return X.useMemo(()=>[h7.configure({resizable:!0}),yQ,gQ,mQ,cT,dT,fT,gT,OT,IT,AT,TQ,kQ,PT,sT,iT,uT,ET,oM,DT,CQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Z9,mT,J9,wQ.configure({types:["heading","paragraph","image"]}),$Z,LZ,BZ,Kj,zT.configure({multicolor:!0}),kT,p8,pT,xQ,vQ.configure({nested:!0}),pQ.configure({suggestion:SQ}),N2.configure({placeholder:t}),TT],[t])}function B2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const OQ=t=>{const e=EQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(nM,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=jt.useField({name:n}),{setValue:f}=u,{value:p}=a;X.useEffect(()=>{var 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),y=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=>{nb({images:O,editor:T,position:k})});else{const O=i(S);nb({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=B2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return y(O,N),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=B2(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(tM,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(PZ,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx($7,{}),b.jsx(G7,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},F2=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})})})},R2=({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,{})})]})},iv=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},wh=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},sv=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:S,retryCallback:k,isLoading:T=!1,disableMobileCards:C=!1,highlightSelectedRow:O=!1,headerRowStyle:I={},stickyHeader:N,reRenderExpand:L=!1,expandOnRowClick:V=!1,tooltipColor:M,...B}=t,{palette:H}=z.useTheme(),[F,P]=X.useState(void 0),[_,A]=X.useState(void 0);MQ(t);const R=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=F===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(dp,{"data-testid":"collapse-up"}):b.jsx(h0,{"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(Be=>Be!==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(KU,{})," ",x]}),ce=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(aw,{color:"error"})," ",S,k&&b.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),Z=()=>{if(S)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(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=F===_e?void 0:_e;P(Be),ue(Be)}},re=ae=>{const _e=F===ae?void 0:ae;P(_e),ue(_e)},le=ae=>{if(!u)return;const _e=F===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(dp,{}):b.jsx(h0,{})," Show"," ",_e?"Less":"More"]}),b.jsx(F2,{colSpan:r.length,isExpanded:n(ae)===F,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?hG(_e,.1):ge}}}},ee=H.grey[H.mode==="dark"?600:400],pe=ae=>ae&&b.jsx(z.Tooltip,{title:ae,children:b.jsx(qU,{"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 b.jsxs(iv,{alignItems:"flex-start",children:[Be&&b.jsx(wh,{children:$l(Be,_e,K)}),b.jsxs(wh,{width:"100%",children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:$e.map(Me=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.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)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(Me)}`,style:{paddingLeft:"10px"},children:$l(Me,_e,K)})]},`row-${n(_e)}-${xn(Me)}`))})}),le(_e)]})]})},Se=()=>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=>R(ae.target.value),fullWidth:!0,children:U.map(ae=>{if(me(xn(ae)))return b.jsx(z.MenuItem,{value:xn(ae),children:ae.label??Ln(xn(ae))},`rowHeader-${xn(ae)}`)})}),b.jsx(z.IconButton,{onClick:()=>{f&&R(f)},children:b.jsx(eq,{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:Ce(U,ae)},n(ae)))]}),Ae=()=>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:I?{"& .MuiTableCell-head":{...I}}:{},...B,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 Be=me(xn(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:[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?()=>R(xn(ae)):void 0,children:[b.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"&&b.jsx(dp,{style:{marginLeft:"5px"}}),Be&&j(xn(ae))==="desc"&&b.jsx(h0,{style:{marginLeft:"5px"}}),Be&&j(xn(ae))!=="asc"&&j(xn(ae))!=="desc"&&b.jsx(ZU,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(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_${xn(_e)}`,children:$l(_e,ae,K)},`row-${n(ae)}-${xn(_e)}`))}),u&&b.jsx(F2,{colSpan:U.length,isExpanded:n(ae)===F,obj:ae,renderExpand:_e=>u(_e),reRenderExpand:L})]},n(ae)))})]})});return b.jsx(R2,{isLoading:T,children:K&&!C?Se():Ae()})},MQ=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=>xn(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'.`)},xn=t=>t.key??t.fieldName,_Q=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),$l=(t,e,n=!1)=>{const r=_Q(e,t.fieldName);return t.render?t.render(r,e,n):r},z2=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(sv,{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,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},V2=()=>({height:window.innerHeight,width:window.innerWidth}),H2=()=>{const[t,e]=X.useState(V2());return X.useEffect(()=>{const n=()=>{e(V2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},co=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=H2(),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,...cr({...t},a)})},IQ=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(co,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{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"})]})]})})},AQ=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(co,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",color:"error",startIcon:b.jsx(Xb,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},DQ=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:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:I=!1,showCloseBtn:N=!1,canSearch:L=!1}=t,V=!!t.canCreate&&!I,M=!!a&&!!s&&!I,B=!!u&&!!l&&I&&k,H=!!f&&!I,{palette:F}=z.useTheme(),[P,_]=X.useState([]),[A,R]=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=()=>{R(!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),R(!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(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Vf,{}),children:"Add Citation"}),ge=b.jsx(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx($M,{}),children:"Add Attachment"}),Y=$e=>{if(!(!M&&!B)){if(M)return b.jsx(z.Tooltip,{title:"Edit",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>$e.fileName?a($e):s($e),"data-testid":`citation-table_edit-btn-${$e.id}`,children:b.jsx(UU,{})})});if(B)return b.jsx(z.Tooltip,{title:"View",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>$e.fileName?u($e):l($e),"data-testid":`citation-table_view-btn-${$e.id}`,children:b.jsx(tq,{})})})}},ee=$e=>{if(!(!H||I))return b.jsx(z.Tooltip,{title:"Delete",children:b.jsx(z.IconButton,{color:"error",onClick:Me=>{he($e),J(Me.currentTarget)},"data-testid":`citation-table_delete-btn-${$e.id}`,children:b.jsx(Xb,{})})})},pe=$e=>{if(!C)return;if(!$e.fileName)return b.jsx(z.Tooltip,{title:"Open URL",children:b.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:b.jsx(m0,{})})})},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 b.jsx(z.Tooltip,{title:"View File",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>m==null?void 0:m($e),"data-testid":`citation-table_view-file-btn-${$e.id}`,children:b.jsx(m0,{})})})},Se=$e=>{if(!p)return;if(!!$e.fileName)return b.jsx(z.Tooltip,{title:"Download",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>p==null?void 0:p($e),"data-testid":`citation-table_download-btn-${$e.id}`,children:b.jsx(jU,{})})})},Ae=B||M||H||C||m||p||O,ae=[...j2(F,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Ae,render:($e,Me)=>b.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?b.jsx(FM,{onSearch:_e}):null;return b.jsxs(wh,{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&&V&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ge]}),N&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(up,{})})]}),Be(),b.jsx(z2,{"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&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&b.jsxs(b.Fragment,{children:[le,ge]})}),!I&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(co,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(co,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(IQ,{citation:ce,anchorEl:U,onClose:re}),b.jsx(AQ,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:re})]})},W2=(t,e)=>{const n=t?ma.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})},j2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx($M,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Vf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>W2(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>W2(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}],av=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(co,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var lv,U2;function PQ(){if(U2)return lv;U2=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);lv={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,N=k.length,L=C;I<N-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,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(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,N,L;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),L=y(O),N=!L&&/^\d+$/.test(O),k.call(T,O,L,N,I,S))}function y(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!y(S)&&(v(S)||g(S))}return lv}var Ca=PQ(),cv,q2;function NQ(){if(q2)return cv;q2=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 cv={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(" ")},cv}var uv=NQ(),Sh={exports:{}},K2;function $Q(){if(K2)return Sh.exports;K2=1,Sh.exports=function(o){return t(e(o),o)},Sh.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 S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--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 Sh.exports}var LQ=$Q();const BQ=Un(LQ),FQ=Object.prototype.toString,RQ=Error.prototype.toString,zQ=RegExp.prototype.toString,VQ=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",HQ=/^Symbol\((.*)\)(.*)$/;function WQ(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function Y2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return WQ(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return VQ.call(t).replace(HQ,"Symbol($1)");const r=FQ.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+RQ.call(t)+"]":r==="RegExp"?zQ.call(t):null}function ws(t,e){let n=Y2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=Y2(this[r],e);return i!==null?i:o},2)}function G2(t){return t==null?[]:[].concat(t)}let J2,X2,Z2,jQ=/\$\{\s*(\w+)\s*\}/g;J2=Symbol.toStringTag;class Q2{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[J2]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],G2(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]}}X2=Symbol.hasInstance,Z2=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 Q2(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[Z2]="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[X2](e){return Q2[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}},kr={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"},UQ={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"},dv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},qQ={isValue:"${path} field must be ${value}"},Ch={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:UQ,date:dv,object:Ch,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:qQ,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 fv=t=>t&&t.__isYupSchema__;class Th{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new Th(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!fv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const kh={context:"$",value:"."};class Ta{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===kh.context,this.isValue=this.key[0]===kh.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?kh.context:this.isValue?kh.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Ca.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Ta.prototype.__isYupRef=!0;const ka=t=>t==null;function Ll(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:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(B={}){const H=eI(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),F=new hr(hr.formatError(B.message||m,H),n,H.path,B.type||u,H.disableStackTrace);return F.params=H,F}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(B){return tI(B,k)},options:o,originalValue:i,schema:s};const I=B=>{hr.isError(B)?C(B):B?l(null):C(T())},N=B=>{hr.isError(B)?C(B):a(B)};if(y&&ka(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,N)}}catch(B){N(B);return}I(V)}return e.OPTIONS=t,e}function eI(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=tI(t[n],e);return t}function tI(t,e){return Ta.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function KQ(t,e,n,r=n){let o,i,s;return e?(Ca.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 Eh extends Set{describe(){const e=[];for(const n of this.values())e.push(Ta.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new Eh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Bl(t,e=new Map){if(fv(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]=Bl(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,Bl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Bl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Bl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function YQ(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 GQ(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:YQ(n)}))}function nI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return GQ(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>nI(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 Eh,this._blacklist=new Eh,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=Bl(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&&ka(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
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,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)=>{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):Bl(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=Ll({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=Ll({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=Ll(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=G2(e).map(i=>new Ta(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Th(o,n):Th.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Ll({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=Ll({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=Ll({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?eI(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:nI(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}=KQ(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 JQ=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function XQ(t){const e=pv(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 pv(t){var e,n;const r=JQ.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 ZQ=/^[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])?)*$/,QQ=/^((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,eee=/^(?:[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,tee="^\\d{4}-\\d{2}-\\d{2}",nee="\\d{2}:\\d{2}:\\d{2}",ree="(([+-]\\d{2}(:?\\d{2})?)|Z)",oee=new RegExp(`${tee}T${nee}(\\.\\d+)?${ree}$`),iee=t=>ka(t)||t===t.trim(),see={}.toString();function Fl(){return new rI}class rI 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===see?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=kr.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=kr.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=kr.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||kr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=kr.email){return this.matches(ZQ,{name:"email",message:e,excludeEmptyString:!0})}url(e=kr.url){return this.matches(QQ,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=kr.uuid){return this.matches(eee,{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(oee,{name:"datetime",message:n||kr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||kr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=pv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||kr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=pv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=kr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:iee})}lowercase(e=kr.lowercase){return this.transform(n=>ka(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toLowerCase()})}uppercase(e=kr.uppercase){return this.transform(n=>ka(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toUpperCase()})}}Fl.prototype=rI.prototype;let oI=new Date(""),aee=t=>Object.prototype.toString.call(t)==="[object Date]";function hv(){return new Lu}class Lu extends ti{constructor(){super({type:"date",check(e){return aee(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=XQ(e),isNaN(e)?Lu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ta.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=dv.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=dv.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)}})}}Lu.INVALID_DATE=oI,hv.prototype=Lu.prototype,hv.INVALID_DATE=oI;function lee(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Ca.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Ta.isRef(a)&&a.isSibling?i(a.path,s):fv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return BQ.array(Array.from(r),n).reverse()}function iI(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 sI(t){return(e,n)=>iI(t,e)-iI(t,n)}const cee=(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 Oh(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Oh(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Oh(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Oh)}):"optional"in t?t.optional():t}const uee=(t,e)=>{const n=[...Ca.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Ca.getter(Ca.join(n),!0)(t);return!!(o&&r in o)};let aI=t=>Object.prototype.toString.call(t)==="[object Object]";function lI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const dee=sI([]);function mv(t){return new cI(t)}class cI extends ti{constructor(e){super({type:"object",check(n){return aI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=dee,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,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 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||!aI(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Ta.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=lee(e,n),r._sortErrors=sI(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 Oh(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=Ca.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return uee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(cee)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Ch.exact,test(n){if(n==null)return!0;const r=lI(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Ch.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=lI(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Ch.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(uv.camelCase)}snakeCase(){return this.transformKeys(uv.snakeCase)}constantCase(){return this.transformKeys(e=>uv.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}}mv.prototype=cI.prototype;const fee=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,v]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});X.useEffect(()=>{i&&v({...i,type:"Url"})},[]);const g={disabled:u,margin:"none",readOnly:s};return 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}),a&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(up,{})})]}),b.jsx(jt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,onSubmit:async x=>{f(!0),n(x).catch(S=>{throw f(!1),S}).finally(()=>f(!1))},validationSchema:mv({title:Fl().required("Title is required"),accessedAt:hv().required("Accessed At is required"),url:Fl().required("URL is required"),classification:Fl().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:x})=>b.jsxs(jt.Form,{autoComplete:"off",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(Ti,{...g,name:"title",required:!0}),b.jsx(Ti,{...g,name:"source"}),b.jsx(Ti,{...g,name:"details",label:"Details (e.g. Source Description)"}),b.jsx(Hp,{...g,name:"accessedAt",required:!0,isDatePicker:!0}),b.jsx(Ti,{...g,name:"url",label:"URL / Other Identifier",required:!0}),b.jsx(PM,{...g,name:"classification",row:!0,required:!0,radios:pee})]}),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(av,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),x()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},pee=[{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."}],hee=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(up,{})})]}),b.jsx(jt.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:mv().shape({title:Fl().required("Title is required"),fileName:Fl().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]),b.jsxs(jt.Form,{autoComplete:"off",children:[b.jsx(Ti,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(z.Box,{marginTop:i||a?0:1,children:[b.jsxs(iv,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(hM,{name:"file",errorMode:"hidden"}),b.jsx(Ti,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(br,{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(av,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Bu=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(up,{})})]})}):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 mee(t){return Ke("MuiAlert",t)}const uI=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"]),gee=Le(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"),yee=Le(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),bee=Le(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"),vee=Le(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"),xee=Le(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"),wee=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,mee,o)},See=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:za,n=t.palette.mode==="light"?za: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),[`& .${uI.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}`,[`& .${uI.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)}}}))]}})),Cee=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Tee=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),kee=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}),dI={success:b.jsx(gee,{fontSize:"inherit"}),warning:b.jsx(yee,{fontSize:"inherit"}),error:b.jsx(bee,{fontSize:"inherit"}),info:b.jsx(vee,{fontSize:"inherit"})},fI=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=dI,onClose:y,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=wee(C),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[N,L]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:See,externalForwardedProps:{...I,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Mt("icon",{className:O.icon,elementType:Cee,externalForwardedProps:I,ownerState:C}),[B,H]=Mt("message",{className:O.message,elementType:Tee,externalForwardedProps:I,ownerState:C}),[F,P]=Mt("action",{className:O.action,elementType:kee,externalForwardedProps:I,ownerState:C}),[_,A]=Mt("closeButton",{elementType:Ml,externalForwardedProps:I,ownerState:C}),[R,j]=Mt("closeIcon",{elementType:xee,externalForwardedProps:I,ownerState:C});return b.jsxs(N,{...L,children:[p!==!1?b.jsx(V,{...M,children:p||m[g]||dI[g]}):null,b.jsx(B,{...H,children:i}),o!=null?b.jsx(F,{...P,children:o}):null,o==null&&y?b.jsx(F,{...P,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...A,children:b.jsx(R,{fontSize:"small",...j})})}):null]})});process.env.NODE_ENV!=="production"&&(fI.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 Fu=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(fI,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(z.Typography,{variant:"h3",children:s}),n]})},pI=t=>b.jsx(Fu,{severity:"error",...t}),hI=t=>b.jsx(Fu,{severity:"success",...t}),Eee=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(pI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(hI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function mI({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:S,canSearch:k=!1}){const[T,C]=X.useState("Insert Citation/Attachment(s)"),[O,I]=X.useState(u),[N,L]=X.useState(void 0),[V,M]=X.useState(void 0),B=Y=>{M(void 0),C(Y)},[H,F]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,V,f]);const P=(Y=!1)=>{(!m||Y)&&F(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}),R=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=b.jsx(DQ,{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:y,title:v,addlActions:g,canCreate:!!e,canLaunchUrl:x,readOnly:S,showCloseBtn:m,canSearch:k}),ue=b.jsx(fee,{modifyCitation:N,onSave:R,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=b.jsx(hee,{onSave:R,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:N,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),re=b.jsx(Eee,{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),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(Bu,{open:le||ge,children:b.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[re,le?ue:te]})})]})}function gI({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return b.jsx(mI,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const Oee=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 Mee({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 y=m==null?void 0:m.storage.citationBubbleMenuHandler,v=y.isOpen,g=y.selectedIds,x=y.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?b.jsx(vy,{editor:m,open:v,...y.bubbleMenuOptions,...p,children:b.jsx(Oee,{children:b.jsx(gI,{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 _ee=()=>ln.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 Iee(t){const e=wt(),n=X.useRef(null);return b.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:b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(VU,{fontSize:"small"}),b.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const yI=X.createContext(void 0),bI=()=>{const t=X.useContext(yI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Aee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=bI(),[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(S=>s.includes(S.id)),g=v.map(S=>ma.truncate(S.title,{length:y,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 b.jsx(Ob,{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 S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return b.jsxs(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),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})})})},Dee=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 Mb(Aee)},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}}}}),vI=t=>b.jsx(fM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Pee=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:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x=()=>{},placeholder:S="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:C,canSearch:O=!1}=t,I=[NT,N2.configure({placeholder:S}),_ee(),Dee.configure({citationMaxLength:a})],[N,L,V]=jt.useField({name:e}),{setValue:M}=V,{value:B}=N,{addUpdateCitation:H,deleteCitation:F,batchUpdate:P,citations:_}=bI();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),R={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 b.jsx(ha,{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}},...R[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(vI,{name:k})]}),b.jsx(tM,{ref:A,extensions:I,content:B,editable:!he,renderControls:he?void 0:()=>b.jsx(ib,{children:b.jsx(Iee,{})}),onBlur:()=>j(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>b.jsx(Mee,{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(()=>F(ce))),getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:C,readOnly:he,canSearch:O})}),b.jsx(br,{name:e,id:`${e}-err`,errorMode:T})]})},Nee=t=>{const{name:e="submit"}=t;return b.jsx(co,{name:e,type:"submit",...t})},$ee=t=>{const{label:e="Return to Top",icon:n=dp,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]})})})},xI=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 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,{...Ql(p,o),children:[p.icon&&b.jsx(z.ListItemIcon,{children:p.icon}),b.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},Lee=()=>{const{values:t,errors:e,status:n}=jt.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)})]})]})})},Bee=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=H2();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 b.jsx(z.Stepper,{...u,children:e.map(f=>b.jsx(z.Step,{children:b.jsx(z.StepLabel,{children:f})},f))})},Fee=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"?b.jsx(BM,{}):"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]=jt.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(z.FormControl,{fullWidth:!0,children:[b.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(z.Typography,{children:y}):b.jsx(jt.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(X.Fragment,{children:b.jsx(Ree,{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!==S.length-1&&b.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ree=({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}},zee=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Bu,{actions:[b.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Vee=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Bu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Hee=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(Bu,{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})},Wee={added:{icon:RU,label:"Added",color:"success"},deleted:{icon:BM,label:"Deleted",color:"error"},modified:{icon:HU,label:"Modified",color:"info"}},jee=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:lp},children:b.jsx("s",{children:t})}),b.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:ap},children:b.jsx("u",{children:e})})]}),Uee=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=$l(s,e,r),l=$l(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??dM.isEqual(a,l))||(o[xn(s)]=jee(a,l))}return o},qee=(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=Uee(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}},wI=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}=qee(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=Wee[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(Hm,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var y;return((y=m.modifiedDiff)==null?void 0:y[xn(f)])??$l(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(dw,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},SI=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>b.jsxs(z.Box,{children:[b.jsx(sv,{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"]})})]}),Kee=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?wI({...n,isMobileScreen:r}):n;return b.jsx(SI,{...o,size:t.size})},Yee=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=vo.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,...Ql(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})]})]})},CI=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=vo.useLocation(),i=vo.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>b.jsx(z.MenuList,{children:m.map(v=>b.jsxs(z.MenuItem,{...Ql(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(GU,{})}),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})})})]})},TI=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"]})})},kI=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(xI,{label:e,menuOptions:n,icon:b.jsx(XU,{})})},Mh=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 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,...Ql(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))})},EI=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(Mh,{menuOptions:e,activeTabIdx:n,sx:r})})},OI=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(LM,{}):b.jsx(NM,{})})},Gee=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=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 N=o.findIndex(L=>L.path&&S.startsWith(L.path));C(N>=0?N:void 0)},[S,o]);const O=s&&b.jsx(OI,{onToggle:s}),I=s&&(g||!g&&l)?[{icon:k?b.jsx(LM,{}):b.jsx(NM,{}),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(TI,{...e}),u,b.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(z.Button,{disableRipple:!0,component:vo.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(CI,{menuOptionLists:[o,a,I],anchor:"right"}),!g&&b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,L)=>b.jsxs(z.Box,{display:"flex",alignItems:"center",children:[L>0&&b.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(z.Button,{variant:"text",sx:{color:"white"},...Ql(N,v),children:b.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&b.jsx(kI,{displayName:l,userMenuOptions:I})]})]})]}),!g&&b.jsx(EI,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Jee=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&&b.jsx(z.Box,{sx:e,children:b.jsx(z.Card,{sx:{height:"100%",width:200},children:b.jsx(Mh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Xee=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&b.jsx(Mh,{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}})},Zee=({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(yI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Qee=t=>b.jsx(Fu,{severity:"info",...t}),ete=t=>b.jsx(Fu,{severity:"warning",...t}),MI=t=>{const{crumbInfo:e}=t,n=vo.useNavigate();return b.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(JU,{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))})},tte=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=nte(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(Fu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:_I(r),warning:_I(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})})},nte=t=>t=="logout"?"info":t=="timeout"?"warning":t,_I=t=>{if(t=="timeout")return b.jsx(FU,{});if(t=="logout")return b.jsx(YU,{})},rte=t=>{ote(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(MI,{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(co,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(zU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},ote=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`)},ite=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})]})},ste=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 ate({...t}){return b.jsx(mI,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const lte=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})};De.AlertModal=Vee,De.Autocomplete=cM,De.Breadcrumbs=MI,De.Button=co,De.Checkbox=fM,De.CheckboxGroup=lU,De.CitationField=Pee,De.CitationFieldProvider=Zee,De.CitationManager=ate,De.Column=wh,De.ConfirmationModal=zee,De.DarkModeToggle=OI,De.DateField=Hp,De.DateRangeField=DZ,De.DecisionModal=Hee,De.Diff=aM,De.DiffProvider=dw,De.DiffTable=Kee,De.DiffTableView=SI,De.Drawer=CI,De.DynamicAutocomplete=sU,De.EnvironmentBanner=TI,De.ErrorAlert=pI,De.FileList=dU,De.FileUpload=hM,De.FloatingNavBar=Xee,De.Footer=Yee,De.FormDebugger=Lee,De.Header=Gee,De.InfoAlert=Qee,De.LoadingButton=av,De.LoadingIndicator=ste,De.LoadingOverlay=R2,De.Location=PU,De.MenuButton=xI,De.Modal=Bu,De.MultiAutocomplete=aU,De.NavBar=EI,De.NotApplicableCheckbox=vI,De.PageHeader=rte,De.PaginatedTable=z2,De.ProfileMenu=kI,De.RadioGroup=PM,De.RangeSlider=NU,De.ReadOnly=ha,De.ReadOnlyProvider=cw,De.RepeatableFormGroup=Fee,De.RichTextField=OQ,De.Row=iv,De.ScrollToTop=$ee,De.SearchField=FM,De.Select=$U,De.SelectableCitationManager=gI,De.Sidebar=Jee,De.SingleActionCard=ite,De.Snackbar=tte,De.Spacer=lte,De.Stepper=Bee,De.Submit=Nee,De.SuccessAlert=hI,De.Switch=LU,De.Table=sv,De.Tabs=Mh,De.TextArea=BU,De.TextField=Ti,De.TextIcon=Hm,De.ValidationError=br,De.WarningAlert=ete,De.baseCitationTableColumns=j2,De.buildTableDiff=wI,De.commonTheme=_n,De.darkTheme=AP,De.lightTheme=IP,De.useDiff=Vs,De.useReadOnly=zs,Object.defineProperty(De,Symbol.toStringTag,{value:"Module"})}));
|