@xras/ui 0.20.0 → 0.20.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/dist/xras-ui.cjs CHANGED
@@ -67,4 +67,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
67
67
  */var ze=typeof Symbol=="function"&&Symbol.for,hp=ze?Symbol.for("react.element"):60103,mp=ze?Symbol.for("react.portal"):60106,ql=ze?Symbol.for("react.fragment"):60107,Hl=ze?Symbol.for("react.strict_mode"):60108,Wl=ze?Symbol.for("react.profiler"):60114,Kl=ze?Symbol.for("react.provider"):60109,Gl=ze?Symbol.for("react.context"):60110,gp=ze?Symbol.for("react.async_mode"):60111,Yl=ze?Symbol.for("react.concurrent_mode"):60111,Ql=ze?Symbol.for("react.forward_ref"):60112,Xl=ze?Symbol.for("react.suspense"):60113,VO=ze?Symbol.for("react.suspense_list"):60120,Zl=ze?Symbol.for("react.memo"):60115,Jl=ze?Symbol.for("react.lazy"):60116,BO=ze?Symbol.for("react.block"):60121,zO=ze?Symbol.for("react.fundamental"):60117,qO=ze?Symbol.for("react.responder"):60118,HO=ze?Symbol.for("react.scope"):60119;function Tt(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case hp:switch(e=e.type,e){case gp:case Yl:case ql:case Wl:case Hl:case Xl:return e;default:switch(e=e&&e.$$typeof,e){case Gl:case Ql:case Jl:case Zl:case Kl:return e;default:return t}}case mp:return t}}}function Lb(e){return Tt(e)===Yl}me.AsyncMode=gp;me.ConcurrentMode=Yl;me.ContextConsumer=Gl;me.ContextProvider=Kl;me.Element=hp;me.ForwardRef=Ql;me.Fragment=ql;me.Lazy=Jl;me.Memo=Zl;me.Portal=mp;me.Profiler=Wl;me.StrictMode=Hl;me.Suspense=Xl;me.isAsyncMode=function(e){return Lb(e)||Tt(e)===gp};me.isConcurrentMode=Lb;me.isContextConsumer=function(e){return Tt(e)===Gl};me.isContextProvider=function(e){return Tt(e)===Kl};me.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===hp};me.isForwardRef=function(e){return Tt(e)===Ql};me.isFragment=function(e){return Tt(e)===ql};me.isLazy=function(e){return Tt(e)===Jl};me.isMemo=function(e){return Tt(e)===Zl};me.isPortal=function(e){return Tt(e)===mp};me.isProfiler=function(e){return Tt(e)===Wl};me.isStrictMode=function(e){return Tt(e)===Hl};me.isSuspense=function(e){return Tt(e)===Xl};me.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===ql||e===Yl||e===Wl||e===Hl||e===Xl||e===VO||typeof e=="object"&&e!==null&&(e.$$typeof===Jl||e.$$typeof===Zl||e.$$typeof===Kl||e.$$typeof===Gl||e.$$typeof===Ql||e.$$typeof===zO||e.$$typeof===qO||e.$$typeof===HO||e.$$typeof===BO)};me.typeOf=Tt;Fb.exports=me;var WO=Fb.exports,Ub=WO,KO={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},GO={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Vb={};Vb[Ub.ForwardRef]=KO;Vb[Ub.Memo]=GO;var YO=!0;function QO(e,t,n){var r="";return n.split(" ").forEach(function(o){e[o]!==void 0?t.push(e[o]+";"):r+=o+" "}),r}var Bb=function(t,n,r){var o=t.key+"-"+n.name;(r===!1||YO===!1)&&t.registered[o]===void 0&&(t.registered[o]=n.styles)},XO=function(t,n,r){Bb(t,n,r);var o=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var s=n;do t.insert(n===s?"."+o:"",s,t.sheet,!0),s=s.next;while(s!==void 0)}};function ZO(e){for(var t=0,n,r=0,o=e.length;o>=4;++r,o-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var JO={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},eP=/[A-Z]|^ms/g,tP=/_EMO_([^_]+?)_([^]*?)_EMO_/g,zb=function(t){return t.charCodeAt(1)===45},Qm=function(t){return t!=null&&typeof t!="boolean"},zc=PO(function(e){return zb(e)?e:e.replace(eP,"-$&").toLowerCase()}),Xm=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(tP,function(r,o,s){return an={name:o,styles:s,next:an},o})}return JO[t]!==1&&!zb(t)&&typeof n=="number"&&n!==0?n+"px":n};function Ys(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return an={name:n.name,styles:n.styles,next:an},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)an={name:r.name,styles:r.styles,next:an},r=r.next;var o=n.styles+";";return o}return nP(e,t,n)}case"function":{if(e!==void 0){var s=an,i=n(e);return an=s,Ys(e,t,i)}break}}if(t==null)return n;var l=t[n];return l!==void 0?l:n}function nP(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=Ys(e,t,n[o])+";";else for(var s in n){var i=n[s];if(typeof i!="object")t!=null&&t[i]!==void 0?r+=s+"{"+t[i]+"}":Qm(i)&&(r+=zc(s)+":"+Xm(s,i)+";");else if(Array.isArray(i)&&typeof i[0]=="string"&&(t==null||t[i[0]]===void 0))for(var l=0;l<i.length;l++)Qm(i[l])&&(r+=zc(s)+":"+Xm(s,i[l])+";");else{var c=Ys(e,t,i);switch(s){case"animation":case"animationName":{r+=zc(s)+":"+c+";";break}default:r+=s+"{"+c+"}"}}}return r}var Zm=/label:\s*([^\s;\n{]+)\s*(;|$)/g,an,qb=function(t,n,r){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var o=!0,s="";an=void 0;var i=t[0];i==null||i.raw===void 0?(o=!1,s+=Ys(r,n,i)):s+=i[0];for(var l=1;l<t.length;l++)s+=Ys(r,n,t[l]),o&&(s+=i[l]);Zm.lastIndex=0;for(var c="",u;(u=Zm.exec(s))!==null;)c+="-"+u[1];var d=ZO(s)+c;return{name:d,styles:s,next:an}},rP=function(t){return t()},oP=ma.useInsertionEffect?ma.useInsertionEffect:!1,sP=oP||rP,vp={}.hasOwnProperty,Hb=w.createContext(typeof HTMLElement<"u"?UO({key:"css"}):null);Hb.Provider;var iP=function(t){return w.forwardRef(function(n,r){var o=w.useContext(Hb);return t(n,o,r)})},aP=w.createContext({}),bd="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",lP=function(t,n){var r={};for(var o in n)vp.call(n,o)&&(r[o]=n[o]);return r[bd]=t,r},cP=function(t){var n=t.cache,r=t.serialized,o=t.isStringTag;return Bb(n,r,o),sP(function(){return XO(n,r,o)}),null},uP=iP(function(e,t,n){var r=e.css;typeof r=="string"&&t.registered[r]!==void 0&&(r=t.registered[r]);var o=e[bd],s=[r],i="";typeof e.className=="string"?i=QO(t.registered,s,e.className):e.className!=null&&(i=e.className+" ");var l=qb(s,void 0,w.useContext(aP));i+=t.key+"-"+l.name;var c={};for(var u in e)vp.call(e,u)&&u!=="css"&&u!==bd&&(c[u]=e[u]);return c.ref=n,c.className=i,w.createElement(w.Fragment,null,w.createElement(cP,{cache:t,serialized:l,isStringTag:typeof o=="string"}),w.createElement(o,c))}),dP=uP,K=function(t,n){var r=arguments;if(n==null||!vp.call(n,"css"))return w.createElement.apply(void 0,r);var o=r.length,s=new Array(o);s[0]=dP,s[1]=lP(t,n);for(var i=2;i<o;i++)s[i]=r[i];return w.createElement.apply(null,s)};function yp(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return qb(t)}var fP=function(){var t=yp.apply(void 0,arguments),n="animation-"+t.name;return{name:n,styles:"@keyframes "+n+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}};function pP(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const hP=Math.min,mP=Math.max,sl=Math.round,Fi=Math.floor,il=e=>({x:e,y:e});function gP(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Wb(e){return Gb(e)?(e.nodeName||"").toLowerCase():"#document"}function Xt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kb(e){var t;return(t=(Gb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Gb(e){return e instanceof Node||e instanceof Xt(e).Node}function wd(e){return e instanceof Element||e instanceof Xt(e).Element}function xp(e){return e instanceof HTMLElement||e instanceof Xt(e).HTMLElement}function Jm(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xt(e).ShadowRoot}function Yb(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=bp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function vP(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function yP(e){return["html","body","#document"].includes(Wb(e))}function bp(e){return Xt(e).getComputedStyle(e)}function xP(e){if(Wb(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Jm(e)&&e.host||Kb(e);return Jm(t)?t.host:t}function Qb(e){const t=xP(e);return yP(t)?e.ownerDocument?e.ownerDocument.body:e.body:xp(t)&&Yb(t)?t:Qb(t)}function al(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Qb(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Xt(o);return s?t.concat(i,i.visualViewport||[],Yb(o)?o:[],i.frameElement&&n?al(i.frameElement):[]):t.concat(o,al(o,[],n))}function bP(e){const t=bp(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=xp(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=sl(n)!==s||sl(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function wp(e){return wd(e)?e:e.contextElement}function qc(e){const t=wp(e);if(!xp(t))return il(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=bP(t);let i=(s?sl(n.width):n.width)/r,l=(s?sl(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const wP=il(0);function SP(e){const t=Xt(e);return!vP()||!t.visualViewport?wP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _P(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Xt(e)?!1:t}function eg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wp(e);let i=il(1);t&&(r?wd(r)&&(i=qc(r)):i=qc(e));const l=_P(s,n,r)?SP(s):il(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const p=Xt(s),y=r&&wd(r)?Xt(r):r;let m=p.frameElement;for(;m&&r&&y!==p;){const h=qc(m),x=m.getBoundingClientRect(),v=bp(m),g=x.left+(m.clientLeft+parseFloat(v.paddingLeft))*h.x,b=x.top+(m.clientTop+parseFloat(v.paddingTop))*h.y;c*=h.x,u*=h.y,d*=h.x,f*=h.y,c+=g,u+=b,m=Xt(m).frameElement}}return gP({width:d,height:f,x:c,y:u})}function jP(e,t){let n=null,r;const o=Kb(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const{left:u,top:d,width:f,height:p}=e.getBoundingClientRect();if(l||t(),!f||!p)return;const y=Fi(d),m=Fi(o.clientWidth-(u+f)),h=Fi(o.clientHeight-(d+p)),x=Fi(u),g={rootMargin:-y+"px "+-m+"px "+-h+"px "+-x+"px",threshold:mP(0,hP(1,c))||1};let b=!0;function S(_){const j=_[0].intersectionRatio;if(j!==c){if(!b)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},100)}b=!1}try{n=new IntersectionObserver(S,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,g)}n.observe(e)}return i(!0),s}function CP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=wp(e),d=o||s?[...u?al(u):[],...al(t)]:[];d.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const f=u&&l?jP(u,n):null;let p=-1,y=null;i&&(y=new ResizeObserver(v=>{let[g]=v;g&&g.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=y)==null||b.observe(t)})),n()}),u&&!c&&y.observe(u),y.observe(t));let m,h=c?eg(e):null;c&&x();function x(){const v=eg(e);h&&(v.x!==h.x||v.y!==h.y||v.width!==h.width||v.height!==h.height)&&n(),h=v,m=requestAnimationFrame(x)}return n(),()=>{var v;d.forEach(g=>{o&&g.removeEventListener("scroll",n),s&&g.removeEventListener("resize",n)}),f==null||f(),(v=y)==null||v.disconnect(),y=null,c&&cancelAnimationFrame(m)}}var Sd=w.useLayoutEffect,EP=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],ll=function(){};function RP(e,t){return t?t[0]==="-"?e+t:e+"__"+t:e}function NP(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];var s=[].concat(r);if(t&&e)for(var i in t)t.hasOwnProperty(i)&&t[i]&&s.push("".concat(RP(e,i)));return s.filter(function(l){return l}).map(function(l){return String(l).trim()}).join(" ")}var tg=function(t){return FP(t)?t.filter(Boolean):Fr(t)==="object"&&t!==null?[t]:[]},Xb=function(t){t.className,t.clearValue,t.cx,t.getStyles,t.getClassNames,t.getValue,t.hasValue,t.isMulti,t.isRtl,t.options,t.selectOption,t.selectProps,t.setValue,t.theme;var n=mn(t,EP);return H({},n)},Te=function(t,n,r){var o=t.cx,s=t.getStyles,i=t.getClassNames,l=t.className;return{css:s(n,t),className:o(r??{},i(n,t),l)}};function kP(e,t,n){if(n){var r=n(e,t);if(typeof r=="string")return r}return e}function ec(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function TP(e){return ec(e)?window.innerHeight:e.clientHeight}function Zb(e){return ec(e)?window.pageYOffset:e.scrollTop}function cl(e,t){if(ec(e)){window.scrollTo(0,t);return}e.scrollTop=t}function OP(e){var t=getComputedStyle(e),n=t.position==="absolute",r=/(auto|scroll)/;if(t.position==="fixed")return document.documentElement;for(var o=e;o=o.parentElement;)if(t=getComputedStyle(o),!(n&&t.position==="static")&&r.test(t.overflow+t.overflowY+t.overflowX))return o;return document.documentElement}function PP(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function Li(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:ll,o=Zb(e),s=t-o,i=10,l=0;function c(){l+=i;var u=PP(l,o,s,n);cl(e,u),l<n?window.requestAnimationFrame(c):r(e)}c()}function ng(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=t.offsetHeight/3;r.bottom+o>n.bottom?cl(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+o,e.scrollHeight)):r.top-o<n.top&&cl(e,Math.max(t.offsetTop-o,0))}function $P(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}function rg(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function IP(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var Jb=!1,AP={get passive(){return Jb=!0}},Ui=typeof window<"u"?window:{};Ui.addEventListener&&Ui.removeEventListener&&(Ui.addEventListener("p",ll,AP),Ui.removeEventListener("p",ll,!1));var MP=Jb;function DP(e){return e!=null}function FP(e){return Array.isArray(e)}function Vi(e,t,n){return e?t:n}var LP=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var s=Object.entries(t).filter(function(i){var l=Ue(i,1),c=l[0];return!r.includes(c)});return s.reduce(function(i,l){var c=Ue(l,2),u=c[0],d=c[1];return i[u]=d,i},{})},UP=["children","innerProps"],VP=["children","innerProps"];function BP(e){var t=e.maxHeight,n=e.menuEl,r=e.minHeight,o=e.placement,s=e.shouldScroll,i=e.isFixedPosition,l=e.controlHeight,c=OP(n),u={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return u;var d=c.getBoundingClientRect(),f=d.height,p=n.getBoundingClientRect(),y=p.bottom,m=p.height,h=p.top,x=n.offsetParent.getBoundingClientRect(),v=x.top,g=i?window.innerHeight:TP(c),b=Zb(c),S=parseInt(getComputedStyle(n).marginBottom,10),_=parseInt(getComputedStyle(n).marginTop,10),j=v-_,C=g-h,E=j+b,N=f-b-h,R=y-g+b+S,T=b+h-_,k=160;switch(o){case"auto":case"bottom":if(C>=m)return{placement:"bottom",maxHeight:t};if(N>=m&&!i)return s&&Li(c,R,k),{placement:"bottom",maxHeight:t};if(!i&&N>=r||i&&C>=r){s&&Li(c,R,k);var P=i?C-S:N-S;return{placement:"bottom",maxHeight:P}}if(o==="auto"||i){var D=t,F=i?j:E;return F>=r&&(D=Math.min(F-S-l,t)),{placement:"top",maxHeight:D}}if(o==="bottom")return s&&cl(c,R),{placement:"bottom",maxHeight:t};break;case"top":if(j>=m)return{placement:"top",maxHeight:t};if(E>=m&&!i)return s&&Li(c,T,k),{placement:"top",maxHeight:t};if(!i&&E>=r||i&&j>=r){var V=t;return(!i&&E>=r||i&&j>=r)&&(V=i?j-_:E-_),s&&Li(c,T,k),{placement:"top",maxHeight:V}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(o,'".'))}return u}function zP(e){var t={bottom:"top",top:"bottom"};return e?t[e]:"bottom"}var ew=function(t){return t==="auto"?"bottom":t},qP=function(t,n){var r,o=t.placement,s=t.theme,i=s.borderRadius,l=s.spacing,c=s.colors;return H((r={label:"menu"},io(r,zP(o),"100%"),io(r,"position","absolute"),io(r,"width","100%"),io(r,"zIndex",1),r),n?{}:{backgroundColor:c.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:l.menuGutter,marginTop:l.menuGutter})},tw=w.createContext(null),HP=function(t){var n=t.children,r=t.minMenuHeight,o=t.maxMenuHeight,s=t.menuPlacement,i=t.menuPosition,l=t.menuShouldScrollIntoView,c=t.theme,u=w.useContext(tw)||{},d=u.setPortalPlacement,f=w.useRef(null),p=w.useState(o),y=Ue(p,2),m=y[0],h=y[1],x=w.useState(null),v=Ue(x,2),g=v[0],b=v[1],S=c.spacing.controlHeight;return Sd(function(){var _=f.current;if(_){var j=i==="fixed",C=l&&!j,E=BP({maxHeight:o,menuEl:_,minHeight:r,placement:s,shouldScroll:C,isFixedPosition:j,controlHeight:S});h(E.maxHeight),b(E.placement),d==null||d(E.placement)}},[o,s,i,l,r,d,S]),n({ref:f,placerProps:H(H({},t),{},{placement:g||ew(s),maxHeight:m})})},WP=function(t){var n=t.children,r=t.innerRef,o=t.innerProps;return K("div",G({},Te(t,"menu",{menu:!0}),{ref:r},o),n)},KP=WP,GP=function(t,n){var r=t.maxHeight,o=t.theme.spacing.baseUnit;return H({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:o,paddingTop:o})},YP=function(t){var n=t.children,r=t.innerProps,o=t.innerRef,s=t.isMulti;return K("div",G({},Te(t,"menuList",{"menu-list":!0,"menu-list--is-multi":s}),{ref:o},r),n)},nw=function(t,n){var r=t.theme,o=r.spacing.baseUnit,s=r.colors;return H({textAlign:"center"},n?{}:{color:s.neutral40,padding:"".concat(o*2,"px ").concat(o*3,"px")})},QP=nw,XP=nw,ZP=function(t){var n=t.children,r=n===void 0?"No options":n,o=t.innerProps,s=mn(t,UP);return K("div",G({},Te(H(H({},s),{},{children:r,innerProps:o}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),o),r)},JP=function(t){var n=t.children,r=n===void 0?"Loading...":n,o=t.innerProps,s=mn(t,VP);return K("div",G({},Te(H(H({},s),{},{children:r,innerProps:o}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),o),r)},e$=function(t){var n=t.rect,r=t.offset,o=t.position;return{left:n.left,position:o,top:r,width:n.width,zIndex:1}},t$=function(t){var n=t.appendTo,r=t.children,o=t.controlElement,s=t.innerProps,i=t.menuPlacement,l=t.menuPosition,c=w.useRef(null),u=w.useRef(null),d=w.useState(ew(i)),f=Ue(d,2),p=f[0],y=f[1],m=w.useMemo(function(){return{setPortalPlacement:y}},[]),h=w.useState(null),x=Ue(h,2),v=x[0],g=x[1],b=w.useCallback(function(){if(o){var C=$P(o),E=l==="fixed"?0:window.pageYOffset,N=C[p]+E;(N!==(v==null?void 0:v.offset)||C.left!==(v==null?void 0:v.rect.left)||C.width!==(v==null?void 0:v.rect.width))&&g({offset:N,rect:C})}},[o,l,p,v==null?void 0:v.offset,v==null?void 0:v.rect.left,v==null?void 0:v.rect.width]);Sd(function(){b()},[b]);var S=w.useCallback(function(){typeof u.current=="function"&&(u.current(),u.current=null),o&&c.current&&(u.current=CP(o,c.current,b,{elementResize:"ResizeObserver"in window}))},[o,b]);Sd(function(){S()},[S]);var _=w.useCallback(function(C){c.current=C,S()},[S]);if(!n&&l!=="fixed"||!v)return null;var j=K("div",G({ref:_},Te(H(H({},t),{},{offset:v.offset,position:l,rect:v.rect}),"menuPortal",{"menu-portal":!0}),s),r);return K(tw.Provider,{value:m},n?Ef.createPortal(j,n):j)},n$=function(t){var n=t.isDisabled,r=t.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},r$=function(t){var n=t.children,r=t.innerProps,o=t.isDisabled,s=t.isRtl;return K("div",G({},Te(t,"container",{"--is-disabled":o,"--is-rtl":s}),r),n)},o$=function(t,n){var r=t.theme.spacing,o=t.isMulti,s=t.hasValue,i=t.selectProps.controlShouldRenderValue;return H({alignItems:"center",display:o&&s&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},s$=function(t){var n=t.children,r=t.innerProps,o=t.isMulti,s=t.hasValue;return K("div",G({},Te(t,"valueContainer",{"value-container":!0,"value-container--is-multi":o,"value-container--has-value":s}),r),n)},i$=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},a$=function(t){var n=t.children,r=t.innerProps;return K("div",G({},Te(t,"indicatorsContainer",{indicators:!0}),r),n)},og,l$=["size"],c$=["innerProps","isRtl","size"],u$={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},rw=function(t){var n=t.size,r=mn(t,l$);return K("svg",G({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:u$},r))},Sp=function(t){return K(rw,G({size:20},t),K("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},ow=function(t){return K(rw,G({size:20},t),K("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},sw=function(t,n){var r=t.isFocused,o=t.theme,s=o.spacing.baseUnit,i=o.colors;return H({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:s*2,":hover":{color:r?i.neutral80:i.neutral40}})},d$=sw,f$=function(t){var n=t.children,r=t.innerProps;return K("div",G({},Te(t,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||K(ow,null))},p$=sw,h$=function(t){var n=t.children,r=t.innerProps;return K("div",G({},Te(t,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||K(Sp,null))},m$=function(t,n){var r=t.isDisabled,o=t.theme,s=o.spacing.baseUnit,i=o.colors;return H({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:s*2,marginTop:s*2})},g$=function(t){var n=t.innerProps;return K("span",G({},n,Te(t,"indicatorSeparator",{"indicator-separator":!0})))},v$=fP(og||(og=pP([`
68
68
  0%, 80%, 100% { opacity: 0; }
69
69
  40% { opacity: 1; }
70
- `]))),y$=function(t,n){var r=t.isFocused,o=t.size,s=t.theme,i=s.colors,l=s.spacing.baseUnit;return H({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:o,lineHeight:1,marginRight:o,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:l*2})},Hc=function(t){var n=t.delay,r=t.offset;return K("span",{css:yp({animation:"".concat(v$," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},x$=function(t){var n=t.innerProps,r=t.isRtl,o=t.size,s=o===void 0?4:o,i=mn(t,c$);return K("div",G({},Te(H(H({},i),{},{innerProps:n,isRtl:r,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),K(Hc,{delay:0,offset:r}),K(Hc,{delay:160,offset:!0}),K(Hc,{delay:320,offset:!r}))},b$=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.theme,i=s.colors,l=s.borderRadius,c=s.spacing;return H({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:c.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:o?i.primary:i.neutral20,borderRadius:l,borderStyle:"solid",borderWidth:1,boxShadow:o?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:o?i.primary:i.neutral30}})},w$=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.innerRef,i=t.innerProps,l=t.menuIsOpen;return K("div",G({ref:s},Te(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":o,"control--menu-is-open":l}),i,{"aria-disabled":r||void 0}),n)},S$=w$,_$=["data"],j$=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},C$=function(t){var n=t.children,r=t.cx,o=t.getStyles,s=t.getClassNames,i=t.Heading,l=t.headingProps,c=t.innerProps,u=t.label,d=t.theme,f=t.selectProps;return K("div",G({},Te(t,"group",{group:!0}),c),K(i,G({},l,{selectProps:f,theme:d,getStyles:o,getClassNames:s,cx:r}),u),K("div",null,n))},E$=function(t,n){var r=t.theme,o=r.colors,s=r.spacing;return H({label:"group",cursor:"default",display:"block"},n?{}:{color:o.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},R$=function(t){var n=Xb(t);n.data;var r=mn(n,_$);return K("div",G({},Te(t,"groupHeading",{"group-heading":!0}),r))},N$=C$,k$=["innerRef","isDisabled","isHidden","inputClassName"],T$=function(t,n){var r=t.isDisabled,o=t.value,s=t.theme,i=s.spacing,l=s.colors;return H(H({visibility:r?"hidden":"visible",transform:o?"translateZ(0)":""},O$),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:l.neutral80})},iw={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},O$={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":H({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},iw)},P$=function(t){return H({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},iw)},$$=function(t){var n=t.cx,r=t.value,o=Xb(t),s=o.innerRef,i=o.isDisabled,l=o.isHidden,c=o.inputClassName,u=mn(o,k$);return K("div",G({},Te(t,"input",{"input-container":!0}),{"data-value":r||""}),K("input",G({className:n({input:!0},c),ref:s,style:P$(l),disabled:i},u)))},I$=$$,A$=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors;return H({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:s/2,margin:o.baseUnit/2})},M$=function(t,n){var r=t.theme,o=r.borderRadius,s=r.colors,i=t.cropWithEllipsis;return H({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:o/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},D$=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors,l=t.isFocused;return H({alignItems:"center",display:"flex"},n?{}:{borderRadius:s/2,backgroundColor:l?i.dangerLight:void 0,paddingLeft:o.baseUnit,paddingRight:o.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},aw=function(t){var n=t.children,r=t.innerProps;return K("div",r,n)},F$=aw,L$=aw;function U$(e){var t=e.children,n=e.innerProps;return K("div",G({role:"button"},n),t||K(Sp,{size:14}))}var V$=function(t){var n=t.children,r=t.components,o=t.data,s=t.innerProps,i=t.isDisabled,l=t.removeProps,c=t.selectProps,u=r.Container,d=r.Label,f=r.Remove;return K(u,{data:o,innerProps:H(H({},Te(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),s),selectProps:c},K(d,{data:o,innerProps:H({},Te(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:c},n),K(f,{data:o,innerProps:H(H({},Te(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},l),selectProps:c}))},B$=V$,z$=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.theme,l=i.spacing,c=i.colors;return H({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:s?c.primary:o?c.primary25:"transparent",color:r?c.neutral20:s?c.neutral0:"inherit",padding:"".concat(l.baseUnit*2,"px ").concat(l.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:s?c.primary:c.primary50}})},q$=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.innerRef,l=t.innerProps;return K("div",G({},Te(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":o,"option--is-selected":s}),{ref:i,"aria-disabled":r},l),n)},H$=q$,W$=function(t,n){var r=t.theme,o=r.spacing,s=r.colors;return H({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:s.neutral50,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},K$=function(t){var n=t.children,r=t.innerProps;return K("div",G({},Te(t,"placeholder",{placeholder:!0}),r),n)},G$=K$,Y$=function(t,n){var r=t.isDisabled,o=t.theme,s=o.spacing,i=o.colors;return H({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},Q$=function(t){var n=t.children,r=t.isDisabled,o=t.innerProps;return K("div",G({},Te(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),o),n)},X$=Q$,Z$={ClearIndicator:h$,Control:S$,DropdownIndicator:f$,DownChevron:ow,CrossIcon:Sp,Group:N$,GroupHeading:R$,IndicatorsContainer:a$,IndicatorSeparator:g$,Input:I$,LoadingIndicator:x$,Menu:KP,MenuList:YP,MenuPortal:t$,LoadingMessage:JP,NoOptionsMessage:ZP,MultiValue:B$,MultiValueContainer:F$,MultiValueLabel:L$,MultiValueRemove:U$,Option:H$,Placeholder:G$,SelectContainer:r$,SingleValue:X$,ValueContainer:s$},J$=function(t){return H(H({},Z$),t.components)},sg=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function eI(e,t){return!!(e===t||sg(e)&&sg(t))}function tI(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!eI(e[n],t[n]))return!1;return!0}function nI(e,t){t===void 0&&(t=tI);var n=null;function r(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;var i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}var rI={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},oI=function(t){return K("span",G({css:rI},t))},ig=oI,sI={guidance:function(t){var n=t.isSearchable,r=t.isMulti,o=t.tabSelectsValue,s=t.context,i=t.isInitialFocus;switch(s){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(o?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var n=t.action,r=t.label,o=r===void 0?"":r,s=t.labels,i=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(o,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(s.length>1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return i?"option ".concat(o," is disabled. Select another option."):"option ".concat(o,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,o=t.options,s=t.label,i=s===void 0?"":s,l=t.selectValue,c=t.isDisabled,u=t.isSelected,d=t.isAppleDevice,f=function(h,x){return h&&h.length?"".concat(h.indexOf(x)+1," of ").concat(h.length):""};if(n==="value"&&l)return"value ".concat(i," focused, ").concat(f(l,r),".");if(n==="menu"&&d){var p=c?" disabled":"",y="".concat(u?" selected":"").concat(p);return"".concat(i).concat(y,", ").concat(f(o,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},iI=function(t){var n=t.ariaSelection,r=t.focusedOption,o=t.focusedValue,s=t.focusableOptions,i=t.isFocused,l=t.selectValue,c=t.selectProps,u=t.id,d=t.isAppleDevice,f=c.ariaLiveMessages,p=c.getOptionLabel,y=c.inputValue,m=c.isMulti,h=c.isOptionDisabled,x=c.isSearchable,v=c.menuIsOpen,g=c.options,b=c.screenReaderStatus,S=c.tabSelectsValue,_=c.isLoading,j=c["aria-label"],C=c["aria-live"],E=w.useMemo(function(){return H(H({},sI),f||{})},[f]),N=w.useMemo(function(){var F="";if(n&&E.onChange){var V=n.option,Q=n.options,O=n.removedValue,L=n.removedValues,A=n.value,W=function(pe){return Array.isArray(pe)?null:pe},U=O||V||W(A),Y=U?p(U):"",Z=Q||L||void 0,J=Z?Z.map(p):[],X=H({isDisabled:U&&h(U,l),label:Y,labels:J},n);F=E.onChange(X)}return F},[n,E,h,l,p]),R=w.useMemo(function(){var F="",V=r||o,Q=!!(r&&l&&l.includes(r));if(V&&E.onFocus){var O={focused:V,label:p(V),isDisabled:h(V,l),isSelected:Q,options:s,context:V===r?"menu":"value",selectValue:l,isAppleDevice:d};F=E.onFocus(O)}return F},[r,o,p,h,E,s,l,d]),T=w.useMemo(function(){var F="";if(v&&g.length&&!_&&E.onFilter){var V=b({count:s.length});F=E.onFilter({inputValue:y,resultsMessage:V})}return F},[s,y,v,E,g,b,_]),k=(n==null?void 0:n.action)==="initial-input-focus",P=w.useMemo(function(){var F="";if(E.guidance){var V=o?"value":v?"menu":"input";F=E.guidance({"aria-label":j,context:V,isDisabled:r&&h(r,l),isMulti:m,isSearchable:x,tabSelectsValue:S,isInitialFocus:k})}return F},[j,r,o,m,h,x,v,E,l,S,k]),D=K(w.Fragment,null,K("span",{id:"aria-selection"},N),K("span",{id:"aria-focused"},R),K("span",{id:"aria-results"},T),K("span",{id:"aria-guidance"},P));return K(w.Fragment,null,K(ig,{id:u},k&&D),K(ig,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!k&&D))},aI=iI,_d=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],lI=new RegExp("["+_d.map(function(e){return e.letters}).join("")+"]","g"),lw={};for(var Wc=0;Wc<_d.length;Wc++)for(var Kc=_d[Wc],Gc=0;Gc<Kc.letters.length;Gc++)lw[Kc.letters[Gc]]=Kc.base;var cw=function(t){return t.replace(lI,function(n){return lw[n]})},cI=nI(cw),ag=function(t){return t.replace(/^\s+|\s+$/g,"")},uI=function(t){return"".concat(t.label," ").concat(t.value)},dI=function(t){return function(n,r){if(n.data.__isNew__)return!0;var o=H({ignoreCase:!0,ignoreAccents:!0,stringify:uI,trim:!0,matchFrom:"any"},t),s=o.ignoreCase,i=o.ignoreAccents,l=o.stringify,c=o.trim,u=o.matchFrom,d=c?ag(r):r,f=c?ag(l(n)):l(n);return s&&(d=d.toLowerCase(),f=f.toLowerCase()),i&&(d=cI(d),f=cw(f)),u==="start"?f.substr(0,d.length)===d:f.indexOf(d)>-1}},fI=["innerRef"];function pI(e){var t=e.innerRef,n=mn(e,fI),r=LP(n,"onExited","in","enter","exit","appear");return K("input",G({ref:t},r,{css:yp({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var hI=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function mI(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,o=e.onTopArrive,s=e.onTopLeave,i=w.useRef(!1),l=w.useRef(!1),c=w.useRef(0),u=w.useRef(null),d=w.useCallback(function(x,v){if(u.current!==null){var g=u.current,b=g.scrollTop,S=g.scrollHeight,_=g.clientHeight,j=u.current,C=v>0,E=S-_-b,N=!1;E>v&&i.current&&(r&&r(x),i.current=!1),C&&l.current&&(s&&s(x),l.current=!1),C&&v>E?(n&&!i.current&&n(x),j.scrollTop=S,N=!0,i.current=!0):!C&&-v>b&&(o&&!l.current&&o(x),j.scrollTop=0,N=!0,l.current=!0),N&&hI(x)}},[n,r,o,s]),f=w.useCallback(function(x){d(x,x.deltaY)},[d]),p=w.useCallback(function(x){c.current=x.changedTouches[0].clientY},[]),y=w.useCallback(function(x){var v=c.current-x.changedTouches[0].clientY;d(x,v)},[d]),m=w.useCallback(function(x){if(x){var v=MP?{passive:!1}:!1;x.addEventListener("wheel",f,v),x.addEventListener("touchstart",p,v),x.addEventListener("touchmove",y,v)}},[y,p,f]),h=w.useCallback(function(x){x&&(x.removeEventListener("wheel",f,!1),x.removeEventListener("touchstart",p,!1),x.removeEventListener("touchmove",y,!1))},[y,p,f]);return w.useEffect(function(){if(t){var x=u.current;return m(x),function(){h(x)}}},[t,m,h]),function(x){u.current=x}}var lg=["boxSizing","height","overflow","paddingRight","position"],cg={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function ug(e){e.preventDefault()}function dg(e){e.stopPropagation()}function fg(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function pg(){return"ontouchstart"in window||navigator.maxTouchPoints}var hg=!!(typeof window<"u"&&window.document&&window.document.createElement),rs=0,Kr={capture:!1,passive:!1};function gI(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,o=w.useRef({}),s=w.useRef(null),i=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;if(r&&lg.forEach(function(m){var h=d&&d[m];o.current[m]=h}),r&&rs<1){var f=parseInt(o.current.paddingRight,10)||0,p=document.body?document.body.clientWidth:0,y=window.innerWidth-p+f||0;Object.keys(cg).forEach(function(m){var h=cg[m];d&&(d[m]=h)}),d&&(d.paddingRight="".concat(y,"px"))}u&&pg()&&(u.addEventListener("touchmove",ug,Kr),c&&(c.addEventListener("touchstart",fg,Kr),c.addEventListener("touchmove",dg,Kr))),rs+=1}},[r]),l=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;rs=Math.max(rs-1,0),r&&rs<1&&lg.forEach(function(f){var p=o.current[f];d&&(d[f]=p)}),u&&pg()&&(u.removeEventListener("touchmove",ug,Kr),c&&(c.removeEventListener("touchstart",fg,Kr),c.removeEventListener("touchmove",dg,Kr)))}},[r]);return w.useEffect(function(){if(t){var c=s.current;return i(c),function(){l(c)}}},[t,i,l]),function(c){s.current=c}}var vI=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},yI={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function xI(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,o=r===void 0?!0:r,s=e.onBottomArrive,i=e.onBottomLeave,l=e.onTopArrive,c=e.onTopLeave,u=mI({isEnabled:o,onBottomArrive:s,onBottomLeave:i,onTopArrive:l,onTopLeave:c}),d=gI({isEnabled:n}),f=function(y){u(y),d(y)};return K(w.Fragment,null,n&&K("div",{onClick:vI,css:yI}),t(f))}var bI={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},wI=function(t){var n=t.name,r=t.onFocus;return K("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:bI,value:"",onChange:function(){}})},SI=wI;function _p(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function _I(){return _p(/^iPhone/i)}function uw(){return _p(/^Mac/i)}function jI(){return _p(/^iPad/i)||uw()&&navigator.maxTouchPoints>1}function CI(){return _I()||jI()}function EI(){return uw()||CI()}var RI=function(t){return t.label},NI=function(t){return t.label},kI=function(t){return t.value},TI=function(t){return!!t.isDisabled},OI={clearIndicator:p$,container:n$,control:b$,dropdownIndicator:d$,group:j$,groupHeading:E$,indicatorsContainer:i$,indicatorSeparator:m$,input:T$,loadingIndicator:y$,loadingMessage:XP,menu:qP,menuList:GP,menuPortal:e$,multiValue:A$,multiValueLabel:M$,multiValueRemove:D$,noOptionsMessage:QP,option:z$,placeholder:W$,singleValue:Y$,valueContainer:o$},PI={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},$I=4,dw=4,II=38,AI=dw*2,MI={baseUnit:dw,controlHeight:II,menuGutter:AI},Yc={borderRadius:$I,colors:PI,spacing:MI},DI={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:rg(),captureMenuScroll:!rg(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:dI(),formatGroupLabel:RI,getOptionLabel:NI,getOptionValue:kI,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:TI,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!IP(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function mg(e,t,n,r){var o=hw(e,t,n),s=mw(e,t,n),i=pw(e,t),l=ul(e,t);return{type:"option",data:t,isDisabled:o,isSelected:s,label:i,value:l,index:r}}function fa(e,t){return e.options.map(function(n,r){if("options"in n){var o=n.options.map(function(i,l){return mg(e,i,t,l)}).filter(function(i){return vg(e,i)});return o.length>0?{type:"group",data:n,options:o,index:r}:void 0}var s=mg(e,n,t,r);return vg(e,s)?s:void 0}).filter(DP)}function fw(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,up(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function gg(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,up(r.options.map(function(o){return{data:o.data,id:"".concat(t,"-").concat(r.index,"-").concat(o.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function FI(e,t){return fw(fa(e,t))}function vg(e,t){var n=e.inputValue,r=n===void 0?"":n,o=t.data,s=t.isSelected,i=t.label,l=t.value;return(!vw(e)||!s)&&gw(e,{label:i,value:l,data:o},r)}function LI(e,t){var n=e.focusedValue,r=e.selectValue,o=r.indexOf(n);if(o>-1){var s=t.indexOf(n);if(s>-1)return n;if(o<t.length)return t[o]}return null}function UI(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var Qc=function(t,n){var r,o=(r=t.find(function(s){return s.data===n}))===null||r===void 0?void 0:r.id;return o||null},pw=function(t,n){return t.getOptionLabel(n)},ul=function(t,n){return t.getOptionValue(n)};function hw(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function mw(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=ul(e,t);return n.some(function(o){return ul(e,o)===r})}function gw(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var vw=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},VI=1,jp=function(e){oO(n,e);var t=aO(n);function n(r){var o;if(nO(this,n),o=t.call(this,r),o.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},o.blockOptionHover=!1,o.isComposing=!1,o.commonProps=void 0,o.initialTouchX=0,o.initialTouchY=0,o.openAfterFocus=!1,o.scrollToFocusedOptionOnUpdate=!1,o.userIsDragging=void 0,o.isAppleDevice=EI(),o.controlRef=null,o.getControlRef=function(c){o.controlRef=c},o.focusedOptionRef=null,o.getFocusedOptionRef=function(c){o.focusedOptionRef=c},o.menuListRef=null,o.getMenuListRef=function(c){o.menuListRef=c},o.inputRef=null,o.getInputRef=function(c){o.inputRef=c},o.focus=o.focusInput,o.blur=o.blurInput,o.onChange=function(c,u){var d=o.props,f=d.onChange,p=d.name;u.name=p,o.ariaOnChange(c,u),f(c,u)},o.setValue=function(c,u,d){var f=o.props,p=f.closeMenuOnSelect,y=f.isMulti,m=f.inputValue;o.onInputChange("",{action:"set-value",prevInputValue:m}),p&&(o.setState({inputIsHiddenAfterUpdate:!y}),o.onMenuClose()),o.setState({clearFocusValueOnUpdate:!0}),o.onChange(c,{action:u,option:d})},o.selectOption=function(c){var u=o.props,d=u.blurInputOnSelect,f=u.isMulti,p=u.name,y=o.state.selectValue,m=f&&o.isOptionSelected(c,y),h=o.isOptionDisabled(c,y);if(m){var x=o.getOptionValue(c);o.setValue(y.filter(function(v){return o.getOptionValue(v)!==x}),"deselect-option",c)}else if(!h)f?o.setValue([].concat(up(y),[c]),"select-option",c):o.setValue(c,"select-option");else{o.ariaOnChange(c,{action:"select-option",option:c,name:p});return}d&&o.blurInput()},o.removeValue=function(c){var u=o.props.isMulti,d=o.state.selectValue,f=o.getOptionValue(c),p=d.filter(function(m){return o.getOptionValue(m)!==f}),y=Vi(u,p,p[0]||null);o.onChange(y,{action:"remove-value",removedValue:c}),o.focusInput()},o.clearValue=function(){var c=o.state.selectValue;o.onChange(Vi(o.props.isMulti,[],null),{action:"clear",removedValues:c})},o.popValue=function(){var c=o.props.isMulti,u=o.state.selectValue,d=u[u.length-1],f=u.slice(0,u.length-1),p=Vi(c,f,f[0]||null);o.onChange(p,{action:"pop-value",removedValue:d})},o.getFocusedOptionId=function(c){return Qc(o.state.focusableOptionsWithIds,c)},o.getFocusableOptionsWithIds=function(){return gg(fa(o.props,o.state.selectValue),o.getElementId("option"))},o.getValue=function(){return o.state.selectValue},o.cx=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return NP.apply(void 0,[o.props.classNamePrefix].concat(u))},o.getOptionLabel=function(c){return pw(o.props,c)},o.getOptionValue=function(c){return ul(o.props,c)},o.getStyles=function(c,u){var d=o.props.unstyled,f=OI[c](u,d);f.boxSizing="border-box";var p=o.props.styles[c];return p?p(f,u):f},o.getClassNames=function(c,u){var d,f;return(d=(f=o.props.classNames)[c])===null||d===void 0?void 0:d.call(f,u)},o.getElementId=function(c){return"".concat(o.state.instancePrefix,"-").concat(c)},o.getComponents=function(){return J$(o.props)},o.buildCategorizedOptions=function(){return fa(o.props,o.state.selectValue)},o.getCategorizedOptions=function(){return o.props.menuIsOpen?o.buildCategorizedOptions():[]},o.buildFocusableOptions=function(){return fw(o.buildCategorizedOptions())},o.getFocusableOptions=function(){return o.props.menuIsOpen?o.buildFocusableOptions():[]},o.ariaOnChange=function(c,u){o.setState({ariaSelection:H({value:c},u)})},o.onMenuMouseDown=function(c){c.button===0&&(c.stopPropagation(),c.preventDefault(),o.focusInput())},o.onMenuMouseMove=function(c){o.blockOptionHover=!1},o.onControlMouseDown=function(c){if(!c.defaultPrevented){var u=o.props.openMenuOnClick;o.state.isFocused?o.props.menuIsOpen?c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&o.onMenuClose():u&&o.openMenu("first"):(u&&(o.openAfterFocus=!0),o.focusInput()),c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&c.preventDefault()}},o.onDropdownIndicatorMouseDown=function(c){if(!(c&&c.type==="mousedown"&&c.button!==0)&&!o.props.isDisabled){var u=o.props,d=u.isMulti,f=u.menuIsOpen;o.focusInput(),f?(o.setState({inputIsHiddenAfterUpdate:!d}),o.onMenuClose()):o.openMenu("first"),c.preventDefault()}},o.onClearIndicatorMouseDown=function(c){c&&c.type==="mousedown"&&c.button!==0||(o.clearValue(),c.preventDefault(),o.openAfterFocus=!1,c.type==="touchend"?o.focusInput():setTimeout(function(){return o.focusInput()}))},o.onScroll=function(c){typeof o.props.closeMenuOnScroll=="boolean"?c.target instanceof HTMLElement&&ec(c.target)&&o.props.onMenuClose():typeof o.props.closeMenuOnScroll=="function"&&o.props.closeMenuOnScroll(c)&&o.props.onMenuClose()},o.onCompositionStart=function(){o.isComposing=!0},o.onCompositionEnd=function(){o.isComposing=!1},o.onTouchStart=function(c){var u=c.touches,d=u&&u.item(0);d&&(o.initialTouchX=d.clientX,o.initialTouchY=d.clientY,o.userIsDragging=!1)},o.onTouchMove=function(c){var u=c.touches,d=u&&u.item(0);if(d){var f=Math.abs(d.clientX-o.initialTouchX),p=Math.abs(d.clientY-o.initialTouchY),y=5;o.userIsDragging=f>y||p>y}},o.onTouchEnd=function(c){o.userIsDragging||(o.controlRef&&!o.controlRef.contains(c.target)&&o.menuListRef&&!o.menuListRef.contains(c.target)&&o.blurInput(),o.initialTouchX=0,o.initialTouchY=0)},o.onControlTouchEnd=function(c){o.userIsDragging||o.onControlMouseDown(c)},o.onClearIndicatorTouchEnd=function(c){o.userIsDragging||o.onClearIndicatorMouseDown(c)},o.onDropdownIndicatorTouchEnd=function(c){o.userIsDragging||o.onDropdownIndicatorMouseDown(c)},o.handleInputChange=function(c){var u=o.props.inputValue,d=c.currentTarget.value;o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange(d,{action:"input-change",prevInputValue:u}),o.props.menuIsOpen||o.onMenuOpen()},o.onInputFocus=function(c){o.props.onFocus&&o.props.onFocus(c),o.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(o.openAfterFocus||o.props.openMenuOnFocus)&&o.openMenu("first"),o.openAfterFocus=!1},o.onInputBlur=function(c){var u=o.props.inputValue;if(o.menuListRef&&o.menuListRef.contains(document.activeElement)){o.inputRef.focus();return}o.props.onBlur&&o.props.onBlur(c),o.onInputChange("",{action:"input-blur",prevInputValue:u}),o.onMenuClose(),o.setState({focusedValue:null,isFocused:!1})},o.onOptionHover=function(c){if(!(o.blockOptionHover||o.state.focusedOption===c)){var u=o.getFocusableOptions(),d=u.indexOf(c);o.setState({focusedOption:c,focusedOptionId:d>-1?o.getFocusedOptionId(c):null})}},o.shouldHideSelectedOptions=function(){return vw(o.props)},o.onValueInputFocus=function(c){c.preventDefault(),c.stopPropagation(),o.focus()},o.onKeyDown=function(c){var u=o.props,d=u.isMulti,f=u.backspaceRemovesValue,p=u.escapeClearsValue,y=u.inputValue,m=u.isClearable,h=u.isDisabled,x=u.menuIsOpen,v=u.onKeyDown,g=u.tabSelectsValue,b=u.openMenuOnFocus,S=o.state,_=S.focusedOption,j=S.focusedValue,C=S.selectValue;if(!h&&!(typeof v=="function"&&(v(c),c.defaultPrevented))){switch(o.blockOptionHover=!0,c.key){case"ArrowLeft":if(!d||y)return;o.focusValue("previous");break;case"ArrowRight":if(!d||y)return;o.focusValue("next");break;case"Delete":case"Backspace":if(y)return;if(j)o.removeValue(j);else{if(!f)return;d?o.popValue():m&&o.clearValue()}break;case"Tab":if(o.isComposing||c.shiftKey||!x||!g||!_||b&&o.isOptionSelected(_,C))return;o.selectOption(_);break;case"Enter":if(c.keyCode===229)break;if(x){if(!_||o.isComposing)return;o.selectOption(_);break}return;case"Escape":x?(o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange("",{action:"menu-close",prevInputValue:y}),o.onMenuClose()):m&&p&&o.clearValue();break;case" ":if(y)return;if(!x){o.openMenu("first");break}if(!_)return;o.selectOption(_);break;case"ArrowUp":x?o.focusOption("up"):o.openMenu("last");break;case"ArrowDown":x?o.focusOption("down"):o.openMenu("first");break;case"PageUp":if(!x)return;o.focusOption("pageup");break;case"PageDown":if(!x)return;o.focusOption("pagedown");break;case"Home":if(!x)return;o.focusOption("first");break;case"End":if(!x)return;o.focusOption("last");break;default:return}c.preventDefault()}},o.state.instancePrefix="react-select-"+(o.props.instanceId||++VI),o.state.selectValue=tg(r.value),r.menuIsOpen&&o.state.selectValue.length){var s=o.getFocusableOptionsWithIds(),i=o.buildFocusableOptions(),l=i.indexOf(o.state.selectValue[0]);o.state.focusableOptionsWithIds=s,o.state.focusedOption=i[l],o.state.focusedOptionId=Qc(s,i[l])}return o}return rO(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&ng(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(o){var s=this.props,i=s.isDisabled,l=s.menuIsOpen,c=this.state.isFocused;(c&&!i&&o.isDisabled||c&&l&&!o.menuIsOpen)&&this.focusInput(),c&&i&&!o.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!c&&!i&&o.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ng(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(o,s){this.props.onInputChange(o,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(o){var s=this,i=this.state,l=i.selectValue,c=i.isFocused,u=this.buildFocusableOptions(),d=o==="first"?0:u.length-1;if(!this.props.isMulti){var f=u.indexOf(l[0]);f>-1&&(d=f)}this.scrollToFocusedOptionOnUpdate=!(c&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d],focusedOptionId:this.getFocusedOptionId(u[d])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(o){var s=this.state,i=s.selectValue,l=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var c=i.indexOf(l);l||(c=-1);var u=i.length-1,d=-1;if(i.length){switch(o){case"previous":c===0?d=0:c===-1?d=u:d=c-1;break;case"next":c>-1&&c<u&&(d=c+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:i[d]})}}}},{key:"focusOption",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,i=this.state.focusedOption,l=this.getFocusableOptions();if(l.length){var c=0,u=l.indexOf(i);i||(u=-1),o==="up"?c=u>0?u-1:l.length-1:o==="down"?c=(u+1)%l.length:o==="pageup"?(c=u-s,c<0&&(c=0)):o==="pagedown"?(c=u+s,c>l.length-1&&(c=l.length-1)):o==="last"&&(c=l.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:l[c],focusedValue:null,focusedOptionId:this.getFocusedOptionId(l[c])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Yc):H(H({},Yc),this.props.theme):Yc}},{key:"getCommonProps",value:function(){var o=this.clearValue,s=this.cx,i=this.getStyles,l=this.getClassNames,c=this.getValue,u=this.selectOption,d=this.setValue,f=this.props,p=f.isMulti,y=f.isRtl,m=f.options,h=this.hasValue();return{clearValue:o,cx:s,getStyles:i,getClassNames:l,getValue:c,hasValue:h,isMulti:p,isRtl:y,options:m,selectOption:u,selectProps:f,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var o=this.state.selectValue;return o.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var o=this.props,s=o.isClearable,i=o.isMulti;return s===void 0?i:s}},{key:"isOptionDisabled",value:function(o,s){return hw(this.props,o,s)}},{key:"isOptionSelected",value:function(o,s){return mw(this.props,o,s)}},{key:"filterOption",value:function(o,s){return gw(this.props,o,s)}},{key:"formatOptionLabel",value:function(o,s){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,l=this.state.selectValue;return this.props.formatOptionLabel(o,{context:s,inputValue:i,selectValue:l})}else return this.getOptionLabel(o)}},{key:"formatGroupLabel",value:function(o){return this.props.formatGroupLabel(o)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var o=this.props,s=o.isDisabled,i=o.isSearchable,l=o.inputId,c=o.inputValue,u=o.tabIndex,d=o.form,f=o.menuIsOpen,p=o.required,y=this.getComponents(),m=y.Input,h=this.state,x=h.inputIsHidden,v=h.ariaSelection,g=this.commonProps,b=l||this.getElementId("input"),S=H(H(H({"aria-autocomplete":"list","aria-expanded":f,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":p,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},f&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?(v==null?void 0:v.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?w.createElement(m,G({},g,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:b,innerRef:this.getInputRef,isDisabled:s,isHidden:x,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:c},S)):w.createElement(pI,G({id:b,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:ll,onFocus:this.onInputFocus,disabled:s,tabIndex:u,inputMode:"none",form:d,value:""},S))}},{key:"renderPlaceholderOrValue",value:function(){var o=this,s=this.getComponents(),i=s.MultiValue,l=s.MultiValueContainer,c=s.MultiValueLabel,u=s.MultiValueRemove,d=s.SingleValue,f=s.Placeholder,p=this.commonProps,y=this.props,m=y.controlShouldRenderValue,h=y.isDisabled,x=y.isMulti,v=y.inputValue,g=y.placeholder,b=this.state,S=b.selectValue,_=b.focusedValue,j=b.isFocused;if(!this.hasValue()||!m)return v?null:w.createElement(f,G({},p,{key:"placeholder",isDisabled:h,isFocused:j,innerProps:{id:this.getElementId("placeholder")}}),g);if(x)return S.map(function(E,N){var R=E===_,T="".concat(o.getOptionLabel(E),"-").concat(o.getOptionValue(E));return w.createElement(i,G({},p,{components:{Container:l,Label:c,Remove:u},isFocused:R,isDisabled:h,key:T,index:N,removeProps:{onClick:function(){return o.removeValue(E)},onTouchEnd:function(){return o.removeValue(E)},onMouseDown:function(P){P.preventDefault()}},data:E}),o.formatOptionLabel(E,"value"))});if(v)return null;var C=S[0];return w.createElement(d,G({},p,{data:C,isDisabled:h}),this.formatOptionLabel(C,"value"))}},{key:"renderClearIndicator",value:function(){var o=this.getComponents(),s=o.ClearIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!this.isClearable()||!s||c||!this.hasValue()||u)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,G({},i,{innerProps:f,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var o=this.getComponents(),s=o.LoadingIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!s||!u)return null;var f={"aria-hidden":"true"};return w.createElement(s,G({},i,{innerProps:f,isDisabled:c,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator,i=o.IndicatorSeparator;if(!s||!i)return null;var l=this.commonProps,c=this.props.isDisabled,u=this.state.isFocused;return w.createElement(i,G({},l,{isDisabled:c,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator;if(!s)return null;var i=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,G({},i,{innerProps:u,isDisabled:l,isFocused:c}))}},{key:"renderMenu",value:function(){var o=this,s=this.getComponents(),i=s.Group,l=s.GroupHeading,c=s.Menu,u=s.MenuList,d=s.MenuPortal,f=s.LoadingMessage,p=s.NoOptionsMessage,y=s.Option,m=this.commonProps,h=this.state.focusedOption,x=this.props,v=x.captureMenuScroll,g=x.inputValue,b=x.isLoading,S=x.loadingMessage,_=x.minMenuHeight,j=x.maxMenuHeight,C=x.menuIsOpen,E=x.menuPlacement,N=x.menuPosition,R=x.menuPortalTarget,T=x.menuShouldBlockScroll,k=x.menuShouldScrollIntoView,P=x.noOptionsMessage,D=x.onMenuScrollToTop,F=x.onMenuScrollToBottom;if(!C)return null;var V=function(Y,Z){var J=Y.type,X=Y.data,se=Y.isDisabled,pe=Y.isSelected,M=Y.label,z=Y.value,ve=h===X,ee=se?void 0:function(){return o.onOptionHover(X)},Oe=se?void 0:function(){return o.selectOption(X)},De="".concat(o.getElementId("option"),"-").concat(Z),ie={id:De,onClick:Oe,onMouseMove:ee,onMouseOver:ee,tabIndex:-1,role:"option","aria-selected":o.isAppleDevice?void 0:pe};return w.createElement(y,G({},m,{innerProps:ie,data:X,isDisabled:se,isSelected:pe,key:De,label:M,type:J,value:z,isFocused:ve,innerRef:ve?o.getFocusedOptionRef:void 0}),o.formatOptionLabel(Y.data,"menu"))},Q;if(this.hasOptions())Q=this.getCategorizedOptions().map(function(U){if(U.type==="group"){var Y=U.data,Z=U.options,J=U.index,X="".concat(o.getElementId("group"),"-").concat(J),se="".concat(X,"-heading");return w.createElement(i,G({},m,{key:X,data:Y,options:Z,Heading:l,headingProps:{id:se,data:U.data},label:o.formatGroupLabel(U.data)}),U.options.map(function(pe){return V(pe,"".concat(J,"-").concat(pe.index))}))}else if(U.type==="option")return V(U,"".concat(U.index))});else if(b){var O=S({inputValue:g});if(O===null)return null;Q=w.createElement(f,m,O)}else{var L=P({inputValue:g});if(L===null)return null;Q=w.createElement(p,m,L)}var A={minMenuHeight:_,maxMenuHeight:j,menuPlacement:E,menuPosition:N,menuShouldScrollIntoView:k},W=w.createElement(HP,G({},m,A),function(U){var Y=U.ref,Z=U.placerProps,J=Z.placement,X=Z.maxHeight;return w.createElement(c,G({},m,A,{innerRef:Y,innerProps:{onMouseDown:o.onMenuMouseDown,onMouseMove:o.onMenuMouseMove},isLoading:b,placement:J}),w.createElement(xI,{captureEnabled:v,onTopArrive:D,onBottomArrive:F,lockEnabled:T},function(se){return w.createElement(u,G({},m,{innerRef:function(M){o.getMenuListRef(M),se(M)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:o.getElementId("listbox")},isLoading:b,maxHeight:X,focusedOption:h}),Q)}))});return R||N==="fixed"?w.createElement(d,G({},m,{appendTo:R,controlElement:this.controlRef,menuPlacement:E,menuPosition:N}),W):W}},{key:"renderFormField",value:function(){var o=this,s=this.props,i=s.delimiter,l=s.isDisabled,c=s.isMulti,u=s.name,d=s.required,f=this.state.selectValue;if(d&&!this.hasValue()&&!l)return w.createElement(SI,{name:u,onFocus:this.onValueInputFocus});if(!(!u||l))if(c)if(i){var p=f.map(function(h){return o.getOptionValue(h)}).join(i);return w.createElement("input",{name:u,type:"hidden",value:p})}else{var y=f.length>0?f.map(function(h,x){return w.createElement("input",{key:"i-".concat(x),name:u,type:"hidden",value:o.getOptionValue(h)})}):w.createElement("input",{name:u,type:"hidden",value:""});return w.createElement("div",null,y)}else{var m=f[0]?this.getOptionValue(f[0]):"";return w.createElement("input",{name:u,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var o=this.commonProps,s=this.state,i=s.ariaSelection,l=s.focusedOption,c=s.focusedValue,u=s.isFocused,d=s.selectValue,f=this.getFocusableOptions();return w.createElement(aI,G({},o,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:l,focusedValue:c,isFocused:u,selectValue:d,focusableOptions:f,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var o=this.getComponents(),s=o.Control,i=o.IndicatorsContainer,l=o.SelectContainer,c=o.ValueContainer,u=this.props,d=u.className,f=u.id,p=u.isDisabled,y=u.menuIsOpen,m=this.state.isFocused,h=this.commonProps=this.getCommonProps();return w.createElement(l,G({},h,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:p,isFocused:m}),this.renderLiveRegion(),w.createElement(s,G({},h,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:p,isFocused:m,menuIsOpen:y}),w.createElement(c,G({},h,{isDisabled:p}),this.renderPlaceholderOrValue(),this.renderInput()),w.createElement(i,G({},h,{isDisabled:p}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(o,s){var i=s.prevProps,l=s.clearFocusValueOnUpdate,c=s.inputIsHiddenAfterUpdate,u=s.ariaSelection,d=s.isFocused,f=s.prevWasFocused,p=s.instancePrefix,y=o.options,m=o.value,h=o.menuIsOpen,x=o.inputValue,v=o.isMulti,g=tg(m),b={};if(i&&(m!==i.value||y!==i.options||h!==i.menuIsOpen||x!==i.inputValue)){var S=h?FI(o,g):[],_=h?gg(fa(o,g),"".concat(p,"-option")):[],j=l?LI(s,g):null,C=UI(s,S),E=Qc(_,C);b={selectValue:g,focusedOption:C,focusedOptionId:E,focusableOptionsWithIds:_,focusedValue:j,clearFocusValueOnUpdate:!1}}var N=c!=null&&o!==i?{inputIsHidden:c,inputIsHiddenAfterUpdate:void 0}:{},R=u,T=d&&f;return d&&!T&&(R={value:Vi(v,g,g[0]||null),options:g,action:"initial-input-focus"},T=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(R=null),H(H(H({},b),N),{},{prevProps:o,ariaSelection:R,prevWasFocused:T})}}]),n}(w.Component);jp.defaultProps=DI;var BI=w.forwardRef(function(e,t){var n=kb(e);return w.createElement(jp,G({ref:t},n))}),Cp=BI;const zI=`, ${new Date().getFullYear()}`;function yg({creditResource:e,resource:t,short:n=!1}){const{base:r,current:o}=t.exchangeRates;if(o.unitCost>=r.unitCost)return;const s=o.endDate?"calendar3":"people-fill",i=o.endDate?"primary":"success";let c=`${Math.round(100*(r.unitCost-o.unitCost)/r.unitCost)}% off`,u=c;if(o.endDate){const d=o.endDate?` until ${jr(o.endDate).replace(zI,"")}`:"";n||(c+=d),u+=d}else n||(c+=" for you"),u+=o.institutionType?` for researchers from ${o.institutionType}`:" for you";return u+=`: ${hx(t.unit,o.unitCost,e.name)}`,a.jsxs("span",{className:`badge text-bg-${i} ms-2`,title:u,style:{cursor:"help"},children:[a.jsx("i",{className:`bi bi-${s} me-1`}),c]})}function go({bg:e="dark",children:t,color:n="light",fontWeight:r="bold",icon:o="info-circle-fill",initial:s=!1,maxWidth:i="200px",padding:l="10px",placement:c,target:u,trigger:d="click",visible:f=!0}){const p=typeof s=="string"||s instanceof String,[y,m]=w.useState(p?localStorage.getItem(s)!="true":s),[h,x]=w.useState(!1);w.useEffect(()=>{setTimeout(()=>x(!0),100)},[]);const v=()=>{p&&localStorage.setItem(s,"true")},g=a.jsxs(Ul,{style:{"--bs-tooltip-bg":`var(--bs-${e})`,"--bs-tooltip-color":`var(--bs-${n})`,"--bs-tooltip-max-width":i,"--bs-tooltip-padding-x":l,"--bs-tooltip-padding-y":l,fontWeight:r},children:[a.jsx("button",{"aria-label":"Close",onClick:()=>{v(),m(!1)},style:{background:"transparent",border:"0 none transparent",float:"right"},children:a.jsx("i",{className:"bi bi-x-lg"})}),t]});return u&&u.current?a.jsx(Eb,{target:u.current,placement:c,show:y&&f&&h,children:g}):a.jsx(cp,{placement:c,onToggle:b=>{v(),m(b)},overlay:g,show:y&&f&&h,trigger:d,children:a.jsx("button",{className:"btn bnt-clear border-0",style:{backgroundColor:"transparent"},children:a.jsx("i",{className:`bi bi-${o}`})})})}function qI({resources:e}){const t=e.filter(s=>{const{base:i,current:l}=s.exchangeRates;return l.unitCost<i.unitCost});if(!t.length)return;const n=[],r=[];for(let s of t){let{name:i,favicon:l}=s.resourceProvider;n.includes(i)||(n.push(i),r.push(l))}const o=r.map((s,i)=>a.jsx("span",{className:"d-inline-block border me-1",style:{backgroundColor:"white",backgroundImage:`url(${s})`,backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"16px 16px",borderRadius:"24px",height:"24px",verticalAlign:"middle",width:"24px"},title:n[i]},n[i]));return a.jsx("span",{className:"d-flex justify-content-between align-items-center p-2 border-start border-end bg-secondary-subtle text-decoration-none fw-normal",children:a.jsxs("span",{children:[o,"Browse the list below to see discounts on"," ",Ke(t.length)," ",Wa("resources",t.length)," from"," ",Ke(n.length)," ",Wa("resource providers",n.length),"!"]})})}const HI="_items_c2dbg_1",WI="_item_c2dbg_1",KI="_details_c2dbg_14",GI="_text_c2dbg_20",YI="_number_c2dbg_35",QI="_outer_c2dbg_50",XI="_inner_c2dbg_61",xn={items:HI,item:WI,details:KI,text:GI,number:YI,outer:QI,inner:XI},os=(e,t)=>`${Math.cos(2*Math.PI*e)*t} ${Math.sin(2*Math.PI*e)*t}`;function ZI({requestId:e,grantNumber:t,creditColorClass:n="gray-300",colorClasses:r=Ju}){const{request:o}=at(e,t);if(!o)return;let s=0,i;const l=[];for(let p of o.resources)p.isBoolean||(p.isCredit?i=p:l.push(p),s+=ed(p));const c=[],u=[];let d=-.25;const f=[...l,i].map((p,y)=>{if(!p)return null;const m=y+1,x=ed(p)/s,v=p.requested-p.used,g=Math.max(0,v),b=p.isCredit?s/p.exchangeRates.base.unitCost:p.requested,S=b==0?0:100*g/b,j=`var(--bs-${p.isCredit?n:r[y%r.length]})`;if(x>0){const C=d,E=d+x/2,N=d+=x,R=x>.5?1:0,T=[`M ${os(C,100)}`,`A 100 100 0 ${R} 1 ${os(N,100)}`,`L ${os(N,50)}`,`A 50 50 0 ${R} 0 ${os(C,50)}`].join(" "),[k,P]=os(E,75).split(" ").map(D=>parseFloat(D));c.push(a.jsx("path",{d:T,style:{fill:j}},p.resourceId)),u.push(a.jsx("circle",{cx:k,cy:P,r:"8",fill:"black"},`${p.resourceId}-circle`),a.jsx("text",{x:k-4,y:P+4,fill:"white",className:xn.number,children:m},`${p.resourceId}-text`))}return p.isCredit&&u.push(a.jsx("foreignObject",{x:"-50",y:"-50",width:"100",height:"100",children:a.jsx("div",{className:xn.text,children:a.jsxs("div",{children:[a.jsx("strong",{children:Ke(g,{abbreviate:!0})}),p.unit," available"]})})},"center-text")),a.jsxs("li",{className:xn.item,children:[a.jsx("span",{className:xn.number,children:m}),a.jsx("span",{className:`${xn.outer} ms-2 me-2`,style:{borderColor:j},children:a.jsx("span",{className:xn.inner,style:{backgroundColor:j,width:`${S}%`}})}),a.jsxs("strong",{className:xn.name,children:[a.jsx(Rr,{resource:p,userGuide:!1}),": "]}),a.jsxs("span",{className:xn.details,children:[Ke(v,{abbreviate:!0})," ",p.isCredit?null:a.jsxs(a.Fragment,{children:["of ",Ke(b,{abbreviate:!0})," "]}),p.unit," ",p.isCredit?"available":"remaining"," (",Math.round(S),"%)"]})]},p.resourceId)});return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-lg-3 mb-3 d-flex flex-row align-items-center justify-content-center",children:a.jsxs("svg",{version:"1.1",viewBox:"-100 -100 200 200",width:"200",height:"200",xmlns:"http://www.w3.org/2000/svg",children:[c,u]})}),a.jsx("div",{className:"col-lg-9 mb-3 d-flex flex-column justify-content-center",children:a.jsx("ul",{className:xn.items,children:f})})]})}const xg=e=>e;function JI({classes:e,clean:t=xg,format:n=xg,label:r,setValue:o,style:s,value:i}){const l=n(i),[c,u]=w.useState(l);return w.useEffect(()=>{u(l)},[l]),a.jsx("input",{type:"text","aria-label":r,className:`form-control ${e}`,value:c,style:s,onChange:d=>u(d.target.value),onBlur:d=>{const f=t(d.target.value);u(n(f)),o(f)},onKeyDown:d=>{d.code=="Enter"&&(d.preventDefault(),d.target.blur())}})}function eA({requestId:e,grantNumber:t}){const{request:n,addResource:r,openUsageDetailModal:o,resetResources:s,setResourceRequest:i,setResourcesReason:l,statuses:c,toggleActionsModal:u,toggleConfirmModal:d,toggleResourcesModal:f}=at(e,t),{project:p}=Et(t||n&&n.grantNumber),y=w.useRef(null),m=w.useRef(null);if(!n||!p)return;const h="Exchange"in n.allowedActions,x="Renewal"in n.allowedActions,v="Supplement"in n.allowedActions,g=n.exchangeStatus==c.pending,b=n.exchangeStatus==c.success,S=n.exchangeStatus==c.error,_=n.exchangeErrors,j=n.exchangeActionId!==null,C=n.exchangeActionEditable,E=n.resources,N=n.resourcesReason,R={};for(let M of E)R[M.resourceId]=M;const T=()=>{mx(n)>=.75?u():d()},k=[];for(let M of E){let z=[];if(M.requested>0){for(let ve of M.requires||[]){let ee=R[ve];if(ee){if(ee.requested>0){z=[];break}z.push(ee)}}z.length&&k.push(a.jsxs("span",{children:[a.jsx(Rr,{resource:M,userGuide:!1})," requires"," ",px(z.map(ve=>a.jsx(Rr,{resource:ve,userGuide:!1},ve.resourceId)),"or"),"."]},M.resourceId))}}const P=k.length>0;let D;b?D=a.jsx(be,{color:"info",children:"Your exchange request has been submitted."}):S&&_.length>0&&_[0].includes("PI")&&_[0].includes("person status Unknown")?D=a.jsx(be,{color:"danger",children:p.currentUser.role==="pi"?a.jsxs(a.Fragment,{children:["Please"," ",a.jsx("a",{href:te.routes.profile_path(),children:"update your academic status"})," ","before making an exchange request."]}):a.jsxs(a.Fragment,{children:["The primary investigator for this project has an unknown academic status. Please ask"," ",p.users.filter(M=>M.role==="pi").map(M=>`${M.firstName} ${M.lastName}`)," ","to update the academic status in their profile, and then try again."]})}):S?D=a.jsxs(be,{color:"danger",children:["Sorry, something went wrong: ",_.join(", "),". For assistance, please"," ",a.jsx("a",{href:"https://support.access-ci.org/open-a-ticket",children:"open a help ticket"})," ","and include this message."]}):j?D=a.jsx(be,{color:"warning",children:"You have an exchange request under review. The information below reflects the pending exchange request."}):n.timeStatus=="current"&&!p.isManager?D=a.jsxs(be,{color:"warning",children:["You do not have permission to manage resources for this project. Please contact ",Df(p)," to request a change."]}):P&&(D=a.jsxs(be,{color:"warning",children:[k," Please adjust your balance values."]}));const F=N.length>0;let V=!1,Q=!1;for(let M of E)if(M.isNew&&(V=!0),M.allocated!=M.requested&&(Q=!0),V&&Q)break;const O=E.map(M=>M.resourceId),L={},A=h&&C?n.allowedActions.Exchange.resources.filter(M=>!O.includes(M.resourceId)).map(M=>{L[M.resourceId]=M;const z=Pl(M.name),ve=z.short?`${z.short} (${z.full.replace(/ \([^(]+\)/,"")})`:z.full;return{value:M.resourceId,label:ve}}):[],W=h?n.allowedActions.Exchange.resources.map(M=>M.resourceId):[];let U;const Y=[],Z=[];for(let M of E)M.isCredit?U=M:(Y.push(M),Z.push(C&&(M.isNew||M.allocated!=M.requested)?Cr.edited:W.includes(M.resourceId)?"":Cr.disabled));const J=`Add ${Y.length?"another":"a"} resource to your exchange...`,X=M=>M.requested-M.used,se=(M,z)=>{const ve=z.allocated-z.used,ee=ho(Number(M.replace(/[^0-9-.]/g,"")),z.decimalPlaces),Oe=Math.min(0,ve);if(ee<Oe)return Oe;let De=U.requested*U.exchangeRates.base.unitCost;const ie=(z.allocated-z.requested)*z.exchangeRates.base.unitCost,Ot=Math.min(De,ie);De-=Ot;let lt=z.requested-z.used+Ot/z.exchangeRates.base.unitCost;return De>0&&(lt+=De/z.exchangeRates.current.unitCost),ee>lt?ho(lt,z.decimalPlaces,"floor"):ee},pe=[{key:"name",name:"Resource",format:(M,z)=>a.jsx(Rr,{resource:z}),width:Math.min(350,window.innerWidth*.3)},{key:"isActive",name:"Status",format:(M,z)=>a.jsx(Oo,{status:M?"Active":z.isNew?"New":"Inactive"}),width:100},{key:"unit",name:"Unit",width:150,format:(M,z)=>z.isBoolean?a.jsx(a.Fragment,{children:"—"}):[a.jsx("abbr",{title:hx(M,z.exchangeRates.base.unitCost,U.name),children:M},"base"),a.jsx(yg,{creditResource:U,resource:z,short:!0},"discount")]},{key:"used",name:"Usage",class:"text-end",format:(M,z)=>z.isBoolean?a.jsx(a.Fragment,{children:"—"}):a.jsxs(a.Fragment,{children:[Ke(M),(p.currentUser.resourceIds.includes(z.resourceId)||p.currentUser.resourceAccountInactiveIds.includes(z.resourceId))&&a.jsx(nl,{icon:"table",onClick:()=>o(z.resourceRepositoryKey),target:"_blank",title:`${z.name} Usage Details`})]})}];return h&&pe.push({key:"requested",name:"Balance",class:"text-end",rowClass:M=>C&&W.includes(M.resourceId)?Cr.input:"",format:(M,z)=>{const ve=C&&W.includes(z.resourceId);return z.isBoolean?a.jsx("input",{className:"form-check-input",type:"checkbox",checked:M==1,disabled:!ve,onChange:ee=>i(z.resourceId,ee.target.checked?1:0)}):ve?a.jsx(JI,{classes:"text-end w-100",clean:ee=>se(ee,z),format:Ke,label:`Balance for ${z.name}`,setValue:ee=>{i(z.resourceId,ee+z.used)},style:{padding:"0.1rem 0.5rem"},value:X(z)}):Ke(X(z))},formatHeader:M=>a.jsxs(a.Fragment,{children:[M,C?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.requestedAllocation",placement:"top-end",visible:p.tab=="resources",children:"You can increase or decrease the balance below to change your allocation on a resource. Enter the total amount you would like to have available once the exchange is complete."}):null]})}),a.jsxs("div",{className:"resources",children:[D,E.length?a.jsx(ZI,{requestId:e}):null,U&&(h||x||v)?a.jsxs("h2",{className:"mb-1 mt-2 d-flex justify-content-between",children:[a.jsxs("span",{children:[cr(te.resourceTypeIcons.credit)," ",Ke(U.requested,U)," ",U.unit," available to exchange"]}),x||v?a.jsxs("button",{type:"button",className:"btn btn-sm btn-primary ms-2",onClick:T,children:[cr(te.resourceTypeIcons.credit)," Request More"," ",n.usesCredits?"Credits":"Units"]}):null]}):null,Y.length?a.jsx(Ln,{columns:pe,rows:Y,rowClasses:Z,classes:A.length?"mb-0":"",frozenColumns:2,minWidth:"800px"}):a.jsx("div",{className:"card p-2 text-bg-light p-3",children:"This project does not have any resources."}),A.length?a.jsxs(a.Fragment,{children:[a.jsx(qI,{resources:h&&n.allowedActions.Exchange.resources||[]}),a.jsx("div",{className:"p-2",style:{backgroundColor:"var(--teal-200)",border:"1px solid #cccccc",marginTop:"-1px"},ref:y,children:a.jsx(Cp,{classNames:{control:()=>"react-select mb-1"},options:A,onChange:M=>r(M.value),placeholder:J,value:null,"aria-label":J,formatOptionLabel:({value:M,label:z})=>[z,a.jsx(yg,{creditResource:U,resource:L[M]},"discount")]})}),Y.length?null:a.jsx(go,{bg:"secondary",color:"dark",visible:p.tab=="resources",initial:!0,target:y,children:"Ready to get started? Search for a resource to add it to your project."}),a.jsxs("p",{className:"text-black-50",style:{fontSize:"0.9rem"},children:["Need help choosing a resource? Visit our"," ",a.jsx("a",{href:te.routes.resources_path(),children:"Resource Catalog"}),"."]})]}):null,h&&C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:"resources-reason",className:"form-label required",children:"Please briefly explain how the requested resources and amounts will contribute to your research."}),a.jsx("textarea",{className:"form-control",id:"resources-reason",rows:"2",value:N,onChange:M=>l(M.target.value),style:{minHeight:"3rem"}})]}),a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:g||!Q&&!F&&!V,onClick:s,children:"Reset Form"}),a.jsx("button",{ref:m,type:"button",className:"btn btn-secondary",disabled:g||!Q||!F||P,onClick:f,children:g?"Submitting...":"Submit for Approval"})]}),Q&&!P?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.submitExchange",maxWidth:"390px",placement:"right",target:m,visible:p.tab=="resources",children:"When you are finished adding resources, enter a justification for the requested resources above. Then you can submit your exchange for approval."}):null]}):null]})}function tA({question:e,requestId:t,grantNumber:n}){const{request:r,setResourceQuestionValues:o}=at(t,n),s=w.useId();if(!e||!r||r.error)return;const{attributeSetId:i,attributes:l,fieldType:c,label:u,resourceId:d,values:f}=e,p=l[0],y=p.required?"required":"",m=b=>o(d,i,b.target.value?[b.target.value]:[]),h=b=>{o(d,i,Array.from(b.target.options).filter(({selected:S})=>S).map(({value:S})=>parseInt(S,10)))},x=b=>{const S=parseInt(b.target.value,10),_=b.target.checked?[...f,S]:f.filter(j=>j!=S);o(d,i,_)},v=b=>{const S=parseInt(b.target.value);o(d,i,isNaN(S)?[]:[S])};let g;if(["calendar","integer_only","text"].includes(c)){const b={calendar:"date",integer_only:"number",text:"text"}[c];g=a.jsx("input",{className:"form-control",id:s,type:b,placeholder:p.label,required:p.required,value:f[0]||"",onChange:c=="integer_only"?v:m})}else if(c=="textarea")g=a.jsx("textarea",{className:"form-control",id:s,placeholder:p.label,required:p.required,value:f[0]||"",onChange:m});else if(c=="drop_down"||l.length>=10){const b=c=="multi_sel";g=a.jsxs("select",{id:s,className:"form-select",required:p.required,multiple:b,onChange:b?h:v,value:b?f:f[0]||"",children:[b?null:a.jsx("option",{}),l.map(S=>a.jsx("option",{value:S.resourceAttributeId,children:S.label},S.resourceAttributeId))]})}else g=a.jsx("div",{id:s,children:l.map(b=>{const S=`resource-attribute-${b.resourceAttributeId}`;return a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:c=="single_sel"?"radio":"checkbox",id:S,value:b.resourceAttributeId,checked:f.includes(b.resourceAttributeId),onChange:c=="single_sel"?v:x}),a.jsx("label",{className:"form-check-label",htmlFor:S,children:b.label})]},b.resourceAttributeId)})});return a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:s,className:`form-label ${y}`,children:u}),g]})}function nA({requestId:e,grantNumber:t}){const{request:n,saveResources:r,toggleResourcesModal:o}=at(e,t),{project:s}=Et(t||n.grantNumber);if(!n||!s||n.error||s.error)return;const i=[],l=n.resources.filter(u=>u.allocated!=u.requested).map(u=>{const d=u.requested-u.allocated;return u.questions&&i.push(...u.questions),a.jsxs("li",{className:"list-group-item d-flex justify-content-between align-items-center mb-0",children:[u.name,a.jsx("span",{className:`badge bg-${d>0?"primary":"danger"} rounded-pill`,children:u.isBoolean?Mf(u.requested):a.jsxs(a.Fragment,{children:[d>0?"+":"",Ke(d,u)," ",u.unit]})})]},u.resourceId)}),c=i.some(({attributes:u,values:d})=>d.length==0&&u[0].required);return a.jsxs(ge,{size:"lg",show:n.showResourcesModal,onHide:o,scrollable:!0,children:[a.jsx(ge.Header,{closeButton:!0,children:a.jsx(ge.Title,{children:"Complete Your Exchange"})}),a.jsxs(ge.Body,{children:[a.jsx("p",{children:"Please review your exchange to make sure it includes all the resources you need. Once you submit it, you will not be able to request another exchange until this one has been processed by the resource providers."}),a.jsx("ul",{className:"list-group mb-3",children:l}),i.length?a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:"Resource Questions"}),a.jsx("p",{children:"Some of the resources you selected have associated questions. Please answer the questions below."}),i.map(u=>a.jsx(tA,{question:u,requestId:e,grantNumber:t},u.attributeSetId))]}):null]}),a.jsx(ge.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-primary me-2",onClick:o,children:"Continue Editing"}),a.jsx("button",{type:"button",className:"btn btn-secondary",onClick:r,disabled:c,children:"Submit"})]})})]})}function yw({user:e}){const t=`${e.lastName}, ${e.firstName}`;let n=t,r=[e.organization,e.email].filter(o=>o).join(", ");return r&&(n+=`: ${r}`),a.jsx("abbr",{title:n,children:t})}function rA({requestId:e,grantNumber:t}){const{project:n}=Et(t),{request:r,closeUsageDetailModal:o}=at(e,t);if(!r||r.error||!n||n.error||!r.usageDetailStatus)return;let s,i="Usage";if(r.usageDetailStatus==Le.pending)s=a.jsx(Do,{});else if(r.usageDetailStatus==Le.error)s=a.jsx(be,{color:"danger",children:"An error occurred while loading usage data."});else{const{projectTitle:l,resourceDisplayName:c,resourceRepositoryKey:u,users:d}=r.usageDetail,{full:f,short:p}=Pl(c),y=r.resources.find(v=>v.resourceRepositoryKey==u),m=v=>Ke(v,{decimalPlaces:y?y.decimalPlaces:void 0}),h={};for(let v of n.users)h[v.username]=v;i=a.jsxs(a.Fragment,{children:["Usage: ",p||f," for ",l]});const x=[{key:"name",name:"Name",format:(v,{lastName:g,firstName:b,portalUsername:S})=>{const _=h[S];return _?a.jsx(yw,{user:_}):`${g}, ${b}`}},{key:"portalUsername",name:"Resource Username",format:v=>{const g=h[v],b=g?g.resourceUsernames[y.resourceId]:null;return b||a.jsx(a.Fragment,{children:"—"})}},{key:"role",name:"Role",format:v=>gx[v].name},{key:"lastWeek",name:"Last Week",class:"text-end",format:m},{key:"lastMonth",name:"Last Month",class:"text-end",format:m},{key:"lastQuarter",name:"Last 3 Months",class:"text-end",format:m},{key:"currentRequest",name:"Current Allocation",class:"text-end",format:m},{key:"total",name:"All Time",class:"text-end",format:m}];s=d.length?a.jsx(Ln,{rows:d,columns:x}):a.jsx(be,{color:"info",children:"There is no usage for this resource."})}return a.jsxs(ge,{show:!0,size:"lg",onHide:o,scrollable:!0,children:[a.jsx(ge.Header,{closeButton:!0,children:a.jsx(ge.Title,{children:i})}),a.jsx(ge.Body,{children:s})]})}var oA=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function sA(e){var t=e.defaultOptions,n=t===void 0?!1:t,r=e.cacheOptions,o=r===void 0?!1:r,s=e.loadOptions;e.options;var i=e.isLoading,l=i===void 0?!1:i,c=e.onInputChange,u=e.filterOption,d=u===void 0?null:u,f=mn(e,oA),p=f.inputValue,y=w.useRef(void 0),m=w.useRef(!1),h=w.useState(Array.isArray(n)?n:void 0),x=Ue(h,2),v=x[0],g=x[1],b=w.useState(typeof p<"u"?p:""),S=Ue(b,2),_=S[0],j=S[1],C=w.useState(n===!0),E=Ue(C,2),N=E[0],R=E[1],T=w.useState(void 0),k=Ue(T,2),P=k[0],D=k[1],F=w.useState([]),V=Ue(F,2),Q=V[0],O=V[1],L=w.useState(!1),A=Ue(L,2),W=A[0],U=A[1],Y=w.useState({}),Z=Ue(Y,2),J=Z[0],X=Z[1],se=w.useState(void 0),pe=Ue(se,2),M=pe[0],z=pe[1],ve=w.useState(void 0),ee=Ue(ve,2),Oe=ee[0],De=ee[1];o!==Oe&&(X({}),De(o)),n!==M&&(g(Array.isArray(n)?n:void 0),z(n)),w.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var ie=w.useCallback(function(gn,en){if(!s)return en();var je=s(gn,en);je&&typeof je.then=="function"&&je.then(en,function(){return en()})},[s]);w.useEffect(function(){n===!0&&ie(_,function(gn){m.current&&(g(gn||[]),R(!!y.current))})},[]);var Ot=w.useCallback(function(gn,en){var je=kP(gn,en,c);if(!je){y.current=void 0,j(""),D(""),O([]),R(!1),U(!1);return}if(o&&J[je])j(je),D(je),O(J[je]),R(!1),U(!1);else{var Vn=y.current={};j(je),R(!0),U(!P),ie(je,function(Bn){m&&Vn===y.current&&(y.current=void 0,R(!1),D(je),O(Bn||[]),U(!1),X(Bn?H(H({},J),{},io({},je,Bn)):J))})}},[o,ie,P,J,c]),lt=W?[]:_&&P?Q:v||[];return H(H({},f),{},{options:lt,isLoading:N||l,onInputChange:Ot,filterOption:d})}var iA=w.forwardRef(function(e,t){var n=sA(e),r=kb(n);return w.createElement(jp,G({ref:t},r))}),aA=iA;const bg=({description:e,disabled:t=!1,onChange:n,selectedLength:r,totalLength:o})=>{const s=w.useRef(),i=w.useId();let l=r==o,c=r>0&&!l;return w.useEffect(()=>{s.current&&(s.current.checked=l,s.current.indeterminate=c)},[l,c]),a.jsxs(a.Fragment,{children:[a.jsx("input",{className:"custom-checkbox form-check-input",disabled:t,id:i,onChange:u=>n(u.target.checked),ref:s,type:"checkbox"}),a.jsx("label",{className:"form-check-label",htmlFor:i,"aria-description":`${l?"Deselect":"Select"} ${e}`})]})};function lA({grantNumber:e,requestId:t}){const{project:n,addUser:r,resetUsers:o,saveUsers:s,setTab:i,setUserRole:l,statuses:c,toggleUsersResources:u}=Et(e),{request:d}=n?at(t||n.currentRequestId,e):{request:null};if(!n||!n.currentRequestId||!d||n.error||d.error)return;const f=n.isManager,p="Exchange"in d.allowedActions,y=n.usersStatus==c.pending,m=n.usersStatus==c.success,h=n.usersStatus==c.error,x=n.users,v=d.resources.filter(sd),g=v.length==0,b=x.find(R=>R.hasChanges)!==void 0,S=x.find(R=>R.role!="pi")!==void 0;let _;m&&!b?_=a.jsx(be,{color:"info",children:"Your changes have been saved. Creation of user accounts can take some time. Users can check the status of their accounts on the Overview tab of the My Projects page."}):h?_=a.jsx(be,{color:"danger",children:"Sorry, your changes could not be saved. Please try again later."}):f?v.length?g&&(_=a.jsx(be,{color:"warning",children:"This project does not have any active resources."})):_=a.jsxs(be,{color:"warning",children:["This project does not have any resources."," ",p?a.jsx("a",{href:te.routes.request_action_path(d.requestId,"new?action_type=Exchange"),onClick:R=>{R.preventDefault(),i("resources")},children:"Exchange credits for resources."}):null," ","Additional users can be added after an exchange is approved."]}):_=a.jsxs(be,{color:"warning",children:["You do not have permission to manage users for this project. Please contact ",Df(n)," to request a change."]});const j=(R,T)=>{let k,P,D,F;if(T.key=="all"){k="all resources for all users",P=V=>u(V),D=0;for(let V of x)D+=V.resourceIds.length;F=x.length*v.length}else k=`all users for ${T.name}`,P=V=>u(V,null,T.key),D=x.filter(({resourceIds:V})=>V.includes(T.key)).length,F=x.length;return a.jsxs(a.Fragment,{children:[T.key=="all"?R:a.jsx(Rr,{resource:T,userGuide:!1}),a.jsx("br",{}),a.jsx(bg,{description:k,disabled:T.disabled,onChange:P,selectedLength:D,totalLength:F})]})},C=$l.map(({role:R,name:T})=>a.jsx("option",{value:R,children:T},R)),E=[{key:"name",name:"Name",width:200,format:(R,T)=>a.jsx(yw,{user:T})},{key:"username",name:"ACCESS Username",width:100},{key:"role",name:"Role",width:100,format:(R,T)=>a.jsx("select",{className:"form-select",value:R,onChange:k=>l(T.username,k.target.value),disabled:!f||R=="pi"||R=="co_pi",style:{position:"absolute",left:0,top:0,bottom:0,right:0,borderWidth:0},children:C.filter(k=>k.key==R||!["pi","co_pi"].includes(k.key))})}];v.length&&E.push({key:"all",name:"All Resources",class:`text-center ${Cr.important}`,disabled:!f||g,width:100,format:(R,T)=>a.jsx(bg,{description:`all users for ${T.name}`,disabled:!f||g,onChange:k=>u(k,T.username),selectedLength:T.resourceIds.length,totalLength:v.length}),formatHeader:j});for(let R of v)E.push({key:R.resourceId,name:R.name,class:"text-center",disabled:!f||!R.isActive,icon:R.icon,format:(T,k)=>a.jsx(a.Fragment,{children:a.jsx("input",{className:"form-check-input",disabled:!f||!R.isActive,onChange:P=>u(P.target.checked,k.username,R.resourceId),type:"checkbox",checked:k.resourceIds.includes(R.resourceId)})}),formatHeader:j});const N=x.map(R=>R.hasChanges?Cr.edited:"");return a.jsxs(a.Fragment,{children:[_,a.jsx(Ln,{rows:x,columns:E,frozenColumns:v.length?4:3,classes:"mb-0",minWidth:"800px",rowClasses:N,scrollRowIndex:n.usersNewRowIndex}),f&&v.length&&!g?a.jsx("div",{style:{marginTop:"-1px",position:"relative",zIndex:100},children:a.jsx(aA,{classNames:{control:()=>"react-select"},loadOptions:async R=>(await $E(R)).map(k=>({isDisabled:k.eligibility==="no",label:a.jsxs("span",{className:"d-flex justify-content-between",children:[a.jsxs("span",{className:k.eligibility==="no"?"text-decoration-line-through":"",style:{color:k.eligibility==="no"?"#707070":void 0},children:[k.username," (",k.firstName," ",k.lastName,","," ",k.organization,k.email?`, ${k.email}`:""]}),k.eligibility==="no"&&k.eligibilityReason&&a.jsxs("span",{className:"text-danger ms-2",children:[a.jsx("i",{className:"bi bi-exclamation-octagon"})," ",k.eligibilityReason]})]}),value:k})),onChange:R=>r(R.value),placeholder:"Add another user...",value:null,"aria-label":"Add another user"})}):null,f&&(v.length&&!g||S)?a.jsxs("div",{className:"d-flex mt-3",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:y||!b,onClick:o,children:"Reset Form"}),a.jsx("button",{type:"button",className:"btn btn-secondary",disabled:y||!b,onClick:s,children:y?"Saving...":"Save Changes"})]}):null]})}function cA({requestId:e,grantNumber:t}){const{request:n}=at(e,t),{project:r,setRequest:o,setTab:s}=Et(t||n.grantNumber);if(!n)return;if(n.error)return a.jsx(be,{color:"danger",children:n.error});const i=n.timeStatus||n.actions[0].status.toLowerCase(),l=n.actions.find(({showDeleteModal:d})=>d),c=[];n.resources.length||c.push("resources"),e!=r.currentRequestId&&c.push("users");const u=(r.users||[]).filter(d=>d.eligibility==="no"&&d.role!=="user");return a.jsxs("div",{className:"request",children:[n.returnedForCorrections?a.jsxs(be,{color:"warning",children:[a.jsx("p",{children:"Your request has been returned for corrections. These are the notes from the Allocations Team"}),a.jsx("div",{className:aR.returnedForCorrectionsNotes,children:n.returnedForCorrectionsNotes}),a.jsx("p",{className:"mt-3",children:"Please address these issues by clicking the Edit button to edit your request."})]}):"",n.timeStatus!="current"&&!n.returnedForCorrections?a.jsxs(be,{color:"warning",children:["You are viewing ","aeiou".includes(i[0])?"an":"a"," ",i," request."," ",c.length?`You cannot manage ${c.join(" or ")} for this request.`:""," ",r.currentRequestId?a.jsx("a",{href:te.routes.request_path(r.currentRequestId),onClick:d=>{d.preventDefault(),o(r.currentRequestId)},children:"Go to the current request."}):null]}):null,r.isManager&&e===r.currentRequestId&&u.length>0&&a.jsxs(be,{color:"danger",children:["Some project personnel need to update their profiles. You will be unable to submit exchanges, renewals, and other actions until these issues are resolved:",a.jsx("br",{}),a.jsx("ul",{className:"fs-6 mb-0",children:u.map(d=>a.jsxs("li",{children:[a.jsxs("strong",{children:[d.firstName," ",d.lastName," (",d.username,"):"]})," ",d.eligibilityReason]},d.username))})]}),a.jsxs(vN,{activeKey:r.tab,onSelect:s,className:"mt-3 mb-3",children:[a.jsx($i,{eventKey:"overview",title:"Overview",className:"mb-0",children:a.jsx(QT,{requestId:e,grantNumber:t})}),a.jsx($i,{eventKey:"resources",title:n.usesCredits?"Credits + Resources":"Resources",disabled:c.includes("resources"),children:a.jsx(eA,{requestId:e})}),a.jsx($i,{eventKey:"users",title:"Users + Roles",disabled:c.includes("users"),children:a.jsx(lA,{grantNumber:t})}),a.jsx($i,{eventKey:"history",title:"History",children:a.jsx(CT,{requestId:e})})]}),a.jsx(wT,{grantNumber:t,requestId:e}),a.jsx(ST,{grantNumber:t,requestId:e}),a.jsx(_T,{grantNumber:t,requestId:e,actionId:l?l.actionId:null}),a.jsx(nA,{grantNumber:t,requestId:e}),a.jsx(rA,{grantNumber:t,requestId:e})]})}function uA({requestId:e,grantNumber:t}){const{request:n,toggleActionsModal:r,toggleDeleteModal:o}=at(e,t);if(!n)return;const{actions:s,allowedActions:i}=n,l=[];i&&(("Extension"in i||"Renewal"in i)&&l.push(["Extend End Date",u=>{u.preventDefault(),r()},"calendar-plus"]),"Final Report"in i&&l.push(["Submit Final Report",`${te.routes.request_action_path(e,"new")}?action_type=Final+Report`,"file-earmark-check"]));const c=s.find(u=>u.isRequest);if(c){const u=c.allowedOperations||[];u.includes("Edit")&&l.push(["Edit",te.routes.edit_request_path(n.requestId),"pencil"]),u.includes("Delete")&&l.push(["Delete",d=>{d.preventDefault(),o(c.actionId)},"trash","danger"])}return l.map(([u,d,f,p])=>{const y=a.jsxs(a.Fragment,{children:[" ",f&&a.jsx("i",{className:`bi bi-${f} me-1`}),u]});return typeof d=="function"?a.jsx("button",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,onClick:d,children:y},u):a.jsx("a",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,href:d,children:y},u)})}function dA({open:e=!1,grantNumber:t,title:n,status:r}){const[o,s]=w.useState(e),{project:i,setRequest:l}=Et(t,!o&&n&&r&&!0),c=`project-${t}`;let u=null;if(o&&i)if(i.error)u=a.jsx(be,{color:"danger",children:i.error});else{let d;const f=i.requestsList.map(p=>(p.requestId==i.selectedRequestId&&(d=p),a.jsx("option",{value:p.requestId,children:Af(p)},p.requestId)));u=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"d-flex",children:[a.jsx("select",{className:"form-select","aria-label":"Select a request to display",onChange:p=>l(parseInt(p.target.value,10)),value:i.selectedRequestId,disabled:f.length<2,children:f}),a.jsx(uA,{requestId:i.selectedRequestId,grantNumber:t})]}),d?a.jsx(cA,{...d,grantNumber:t}):null]})}return a.jsxs("div",{className:`${vm.project} card mb-3`,children:[a.jsxs("div",{className:`card-header d-flex justify-content-between ${o?"":"border-bottom-0"}`,children:[a.jsx("button",{"aria-expanded":o,"aria-controls":c,className:vm.expand,onClick:()=>s(!o),children:a.jsxs("h2",{className:"mb-1 mt-1 text-start",children:[a.jsx("i",{className:`bi bi-caret-${o?"down":"right"}-fill`})," ",/^[A-Z]/.test(t)?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"grant-number",children:[t,":"]})," "]}):null,n||i.title]})}),a.jsx(Oo,{status:r||i.status})]}),a.jsx("div",{className:"card-body",id:c,hidden:!o||!i,children:u})]})}function fA({username:e,openFirst:t=1}){const{error:n,loading:r,projects:o}=rR(e);if(r)return a.jsx(Do,{});if(n)return a.jsxs(be,{color:"danger",children:[n," ",a.jsx("a",{href:"#",onClick:i=>{i.preventDefault(),window.location.reload()},children:"Reload the page"})," ","to try again."]});if(!o.length)return a.jsxs("div",{className:"pt-5 pb-5 text-bg-light border border-light-subtle",children:[a.jsx("p",{className:"fs-2 text-center mb-4",children:"You don't have any projects yet."}),a.jsxs("div",{className:"d-flex gap-2 justify-content-center",children:[a.jsxs("a",{className:"btn btn-primary w-25",href:te.routes.project_types_path(),children:[a.jsx("i",{className:"bi bi-boxes fs-1 d-block"})," Learn about Project Types"]}),a.jsxs("a",{className:"btn btn-secondary w-25",href:te.routes.get_your_first_project_path(),children:[a.jsx("i",{className:"bi bi-cpu fs-1 d-block"})," Learn How to Get Your"," ",a.jsx("br",{className:"d-none d-xxl-inline"})," First Project"]}),a.jsxs("a",{className:"btn btn-primary w-25",href:te.routes.how_to_path(),children:[a.jsx("i",{className:"bi bi-person-plus fs-1 d-block"})," Learn How to Join an Existing Project"]})]})]});const s=new URLSearchParams(window.location.hash.slice(1)).get("grantNumber");return o.map((i,l)=>a.jsx(dA,{open:s?s==i.grantNumber:l<t,...i},i.grantNumber))}const xw={apiUrl:null,listIsFiltered:!1,pages:1,projects:[],projectsLoaded:!1,filtersLoaded:!0,showPagination:!1,singleEntry:!1,filters:{org:"",allocationType:"",allFosToggled:!0,resource:"",requestNumber:""},pageData:{current_page:1,last_page:1},typeLists:{orgs:[],fosTypes:[],allocationTypes:[],resources:[]}},pA=Qe("projectsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{const r=window.location.search,o=new URLSearchParams(r);o.has("_requestNumber")&&(n(Ed({name:"requestNumber",value:o.get("_requestNumber")})),n(ww(!0))),await n(jd()),await n(Nr()),n(hA())}),hA=Qe("projectsBrowser/filterCleanup",async(e,{getState:t,dispatch:n})=>{const o=t().projectsBrowser.typeLists;n(bw({...o,orgs:["-- ALL --"].concat(o.orgs)}))}),jd=Qe("projectsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().projectsBrowser.apiUrl}?filters=1`,i=await(await fetch(o)).json();n(bw(i.filters))}),Nr=Qe("projectsBrowser/getProjects",async(e,{getState:t,dispatch:n})=>{const r=t().projectsBrowser,o=r.filters,s=r.typeLists,i=s.fosTypes.filter(d=>d.checked);let l=`${r.apiUrl}?page=${r.pageData.current_page}`;return o.requestNumber!=""?(l+=`&request_number=${o.requestNumber}`,n(wg(!0))):(n(wg(!1)),i.length!=s.fosTypes.length&&(l+=`&fos=${i.map(d=>d.fosTypeId).join(",")}`),o.org!=""&&o.org!="-- ALL --"&&(l+=`&org=${encodeURIComponent(o.org)}`),o.allocationType!=""&&(l+=`&allocation_type=${o.allocationType}`),o.resource!=""&&(l+=`&resources=${o.resource}`)),await(await fetch(l)).json()}),Ep=ri({name:"projectsBrowser",initialState:xw,reducers:{resetFilters:e=>{e.filters={org:"",allocationType:"",allFosToggled:!1,resource:"",requestNumber:""},e.singleEntry=!1,Ep.caseReducers.toggleAllFos(e)},setApiUrl:(e,{payload:t})=>{e.apiUrl=t},setShowPagination:(e,{payload:t})=>{e.showPagination=t},setTypeLists:(e,{payload:t})=>{e.typeLists=t},toggleAllFos:e=>{e.typeLists.fosTypes.forEach(t=>t.checked=!e.filters.allFosToggled),e.filters.allFosToggled=!e.filters.allFosToggled},toggleFos:(e,{payload:t})=>{e.typeLists.fosTypes.forEach(n=>{n.fosTypeId==t.fosTypeId&&(n.checked=!n.checked)}),e.typeLists.fosTypes.filter(n=>n.checked).length!=e.typeLists.fosTypes.length?e.filters.allFosToggled=!1:e.filters.allFosToggled=!0},toggleListFiltered:(e,{payload:t})=>{e.listIsFiltered=t},toggleSingleEntry:(e,{payload:t})=>{e.singleEntry=t},updateFilter:(e,{payload:t})=>{e.filters[t.name]=t.value},updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)}},extraReducers:e=>{e.addCase(Nr.pending,t=>{t.projectsLoaded=!1}).addCase(Nr.fulfilled,(t,n)=>{const r=n.payload;t.projectsLoaded=!0,t.projects=r.projects,r.pages!=t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,t.pageData.last_page=r.pages}).addCase(Nr.rejected,(t,n)=>{console.log(n.error)}).addCase(jd.pending,t=>{t.filtersLoaded=!1}).addCase(jd.fulfilled,t=>{t.filtersLoaded=!0})}}),{resetFilters:mA,setApiUrl:mD,setShowPagination:Cd,setTypeLists:bw,toggleAllFos:gA,toggleFos:vA,toggleListFiltered:ww,toggleSingleEntry:wg,updateFilter:Ed,updatePageData:dl}=Ep.actions,yA=e=>e.projectsBrowser.filters,xA=e=>e.projectsBrowser.filtersLoaded,bA=e=>e.projectsBrowser.listIsFiltered,wA=e=>e.projectsBrowser.singleEntry,SA=e=>e.projectsBrowser.projectsLoaded,_A=e=>e.projectsBrowser.pageData,jA=e=>e.projectsBrowser.projects,CA=e=>e.projectsBrowser.filtersLoaded&&e.projectsBrowser.projectsLoaded&&e.projectsBrowser.pageData.last_page>1,EA=e=>e.projectsBrowser.typeLists,RA=Ep.reducer;const NA=()=>{const e=it(),t=fe(yA),n=fe(EA),r=fe(bA),o=n.orgs.map(h=>({label:h,value:h})),s=w.useRef(),[i,l]=w.useState(null),c={height:"200px",overflowX:"auto",padding:"2px"},u=h=>{e(Ed({name:h.target.name,value:h.target.value}))},d=()=>{window.scrollTo(0,0),p(!0),e(Cd(!1)),e(dl({current_page:1})),e(Nr())},f=()=>{l(null),e(Cd(!1)),e(dl({current_page:1})),e(mA()),r&&(window.scrollTo(0,0),e(Nr()),p(!1))},p=h=>{e(ww(h))},y=h=>{l(h),e(Ed({name:"org",value:h.value}))},m=()=>t.org==""&&t.allocationType==""&&t.allFosToggled&&t.resource==""&&t.requestNumber=="";return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{className:"mb-1",children:"Field of Science"}),a.jsxs("div",{className:"border mb-3",style:c,children:[a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:"",id:"toggle_all",checked:t.allFosToggled,onChange:()=>{e(gA())}}),a.jsx("label",{className:"form-check-label",htmlFor:"toggle_all",children:"(Toggle All)"})]}),n.fosTypes.map(h=>a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:h.fosTypeId,id:`fos_${h.fosTypeId}`,checked:h.checked,onChange:()=>e(vA(h))}),a.jsx("label",{className:"form-check-label",htmlFor:`fos_${h.fosTypeId}`,children:h.fosName})]},`fos_${h.fosTypeId}`))]}),a.jsx("h5",{id:"org_select_label",className:"mb-1",children:"Organization"}),a.jsx("div",{className:"mb-3",children:a.jsx(Cp,{options:o,openMenuOnClick:!0,name:"org",inputId:"orgs_filter",ref:s,closeMenuOnSelect:!0,onChange:y,value:i,"aria-labelledby":"org_select_label"},"org_select")}),a.jsx("h5",{id:"project_type_label",className:"mb-1",children:a.jsx("abbr",{title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"allocationType",id:"project_type_select",value:t.allocationType,className:"form-control","aria-labelledby":"project_type_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.allocationTypes.map((h,x)=>a.jsx("option",{value:h,children:h},`allocation_type_${x}`))]})}),a.jsx("h5",{id:"resource_filter_label",className:"mb-1",children:"Resource"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"resource",id:"resource_select",value:t.resource,className:"form-control","aria-labelledby":"resource_filter_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.resources.map((h,x)=>a.jsx("option",{value:h.resourceId,children:h.resourceName},`resource_${x}`))]})}),a.jsx("h5",{id:"request_number_label",className:"mb-1",children:"Request Number"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:t.requestNumber,name:"requestNumber",id:"requestNumber","aria-labelledby":"request_number_label",onChange:h=>u(h)})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:d,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",disabled:m(),onClick:f,children:"Reset"})]})]})})};const kA=({project:e})=>{const t=e.resources,[n,r]=w.useState(!1),o=fe(wA);let s={flush:!0,className:"mt-3 mb-1",alwaysOpen:!0};const i=g=>{let b=g.units?g.units:g.resourceUnits;const S=g.allocation?g.allocation:g.amount;if(b=="[Yes = 1, No = 0]"||b=="Yes / No")return S=="1.0"?"Yes":"No";{let _="0";return parseInt(S)&&(_=parseInt(S).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")),b=="ACCESS Credits"&&(b=a.jsx("span",{className:"tooltip-underline",title:"universal currency that can be exchanged for resource units",children:"ACCESS Credits"})),b=="Dollars"?`$${_}`:a.jsxs(a.Fragment,{children:[_," ",b]})}},l=()=>{const{origin:g,pathname:b}=window.location,S=`${g}${b}?_requestNumber=${e.requestNumber}`;navigator.clipboard.writeText(S),setTimeout(()=>r(!1),2e3)},c=()=>e.requestNumber&&e.requestNumber!=""?`(${e.requestNumber})`:"",u=a.jsx(Ul,{id:"link-tooltip",children:"Link Copied!"}),d=()=>{if(c()){const g={background:"none",border:"none",color:"#fff",fontSize:"24px"};return a.jsx(cp,{placement:"left",trigger:"click",defaultShow:n,show:n,onToggle:()=>r(!n),overlay:u,children:a.jsx("button",{onClick:l,style:g,children:a.jsx("i",{className:"bi bi-link-45deg",children:a.jsx("div",{className:"d-none",children:"Direct link to project"})})})})}return a.jsx(a.Fragment,{})},f=()=>{const g=e.pi.split(",");return`${g[1]} ${g[0]}`},p=()=>!e.coPis||e.coPis.length<=0?"":a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsxs("small",{className:"fst-italic",children:["CoPI(s): ",e.coPis.map(g=>`${g.name} (${g.organization})`).join(";")]})]}),y=()=>!e.beginDate||!e.endDate?"-":a.jsxs(a.Fragment,{children:[e.beginDate," to ",e.endDate]}),m=()=>e.allocationType==="NAIRR Start-Up"?a.jsxs("span",{className:"fw-bold",children:[c()," Start-Up: ",f(),", ",a.jsxs("em",{children:[" ",e.piInstitution," "]})," "]}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"fw-bold",children:[c()," ",e.requestTitle]})," ",a.jsx("br",{}),a.jsxs("span",{className:"fst-italic",children:[e.pi," ",a.jsxs("small",{children:[" (",e.piInstitution,") "]})]}),p()]}),h=a.jsxs("table",{className:"table table-striped table-bordered mt-2 mb-0",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0",children:"Resource"})}),a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0 d-inline",children:"Allocation"})})]})}),a.jsx("tbody",{children:t.map((g,b)=>a.jsxs("tr",{children:[a.jsx("td",{children:g.resourceName}),a.jsx("td",{style:{whiteSpace:"nowrap"},children:i(g)})]},`resource_${e.requestId}_${b}`))})]}),x=a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Resources"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:h})})]}),v=()=>e.allocationType==="NAIRR Start-Up"?x:o?a.jsxs(a.Fragment,{children:[x,a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Abstract"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})})]}):a.jsxs(Wt,{...s,children:[a.jsxs(Wt.Item,{eventKey:"0",children:[a.jsx(Wt.Header,{children:"Resources"}),a.jsx(Wt.Body,{children:h})]}),a.jsxs(Wt.Item,{eventKey:"1",children:[a.jsx(Wt.Header,{children:"Abstract"}),a.jsx(Wt.Body,{children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})]})]});return a.jsxs("div",{className:"card mb-4",children:[a.jsx("div",{className:"card-header bg-primary text-white",children:a.jsxs("div",{className:"d-flex justify-content-between",children:[a.jsx("div",{children:m()}),a.jsx("div",{children:d()})]})}),a.jsxs("div",{className:"card-body",children:[a.jsxs("div",{className:"row fw-bold border-bottom",children:[a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Field of Science"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0 tooltip-underline",title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Dates"})})]}),a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col",children:e.fos}),a.jsx("div",{className:"col",children:e.allocationType}),a.jsx("div",{className:"col",children:y()})]}),v()]})]})},TA=()=>{const e=fe(jA);return e.length==0?a.jsx("div",{children:"No Projects Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(kA,{project:t},`project_${n}`))})};const Sg=()=>{const e=it(),t=fe(_A),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(dl({current_page:m})),e(Nr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h="";return typeof m=="object"?[m,h]=m:h=m,m=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):m=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:h})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(m),children:h})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(_e.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},OA=({api_url:e})=>{const t=it(),n=fe(SA),r=fe(xA),o=fe(CA),s=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(pA())},[]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(NA,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(Sg,{}):""})}),a.jsx("div",{className:"row",id:"projectListRow",children:a.jsx("div",{className:"col",children:n&&r?a.jsx(TA,{}):s})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(Sg,{scroll:"projects_browser_app"}):""})})]})]})})},PA=e=>e.publications_store.publication,$A=e=>e.publications_store.publication.doi,IA=e=>e.publications_store.publication_types,Sw=e=>e.publications_store.publication.authors,AA=e=>e.publications_store.tag_categories,MA=e=>e.publications_store.projects,DA=e=>e.publications_store.publication.tags,FA=e=>e.publications_store.errors,_w=e=>e.publications_store.data_loaded,jw=e=>e.publications_store.show_saved,Rp=e=>e.publications_store.saving,LA=e=>e.publications_store.modal,Cw=e=>e.publications_store.form_valid,Ew=e=>!Rp(e)&&_w(e)&&Cw(e)&&Rw(e)&&e.publications_store.projects.filter(t=>t.selected).length>0,Rw=e=>{const t=Sw(e);return t.length==0?!1:t.filter(n=>n.first_name==""||n.last_name=="").length==0},Nw=e=>({type:"UPDATE_PUBLICATION",payload:e}),UA=e=>({type:"UPDATE_FIELD",payload:e}),Rd=e=>({type:"CHANGE_PUB_TYPE",payload:e}),VA=e=>({type:"SET_PUBLICATION",payload:e}),BA=()=>({type:"ADD_AUTHOR"}),zA=e=>({type:"UPDATE_AUTHOR",payload:e}),qA=e=>({type:"TOGGLE_REQUEST",payload:e}),Qs=e=>({type:"UPDATE_ERRORS",payload:e}),kw=e=>({type:"HIDE_ERROR",payload:e}),HA=e=>({type:"UPDATE_SELECTED_TAGS",payload:e}),WA=e=>({type:"DELETE_AUTHOR",payload:e}),KA=e=>({type:"DATA_LOADED",payload:e}),Tw=e=>({type:"UPDATE_SHOW_SAVED",payload:e}),GA=()=>({type:"RESET_STATE"}),Xc=e=>({type:"UPDATE_SAVING",payload:e}),YA=e=>({type:"SET_FORM_VALID",payload:e}),Ow=e=>({type:"SET_GRANT_NUMBER",payload:e}),QA=e=>({type:"ADD_PROJECT",payload:e}),XA=(e,t,n)=>{let r=!0;const o=[];for(const i of t)e[i]||(r=!1,o.push(i));const s=e.authors||[];for(const i of s)for(const l of n)i[l]||(r=!1,o.includes(l)||o.push(l));return{formValid:r,missingFields:o}},ZA=e=>e.length>0?a.jsxs("div",{role:"alert",children:[a.jsx("p",{children:"Please provide the following information before submitting:"}),a.jsx("ul",{children:e.map(t=>a.jsx("li",{children:JA(t)},t))})]}):null;function JA(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}const e2=()=>async(e,t)=>{const n=t().publications_store.publication.doi,r=encodeURIComponent(n).replaceAll(".","%2E"),o="Unable to retrieve publication. Double check your DOI, or continue entering information manually.";fetch(`/publications/lookup?doi=${r}`).then(s=>s.json()).then(s=>{if(s.title!=""){let i=t().publications_store.publication_types.find(l=>l.citation_style_type==s.type);e(Rd(i?i.publication_type:"Other")),e(VA(s))}else e(Qs(o))},s=>{e(Qs(o))})},t2=()=>async(e,t)=>{const n=t().publications_store.grant_number,r=te.routes.publications_find_project_path();await fetch(`${r}?grant_number=${n}`).then(o=>o.json()).then(o=>{e(QA(o)),e(Ow(""))},()=>{e(Qs("Unable to find a project with this grant number."))})},Pw=()=>async e=>{const t=/^\/requests/.test(window.location.pathname)?te.routes.publication_path("new.json"):window.location.href+".json";await fetch(t).then(n=>n.json()).then(n=>{e(KA(n))})},$w=()=>async(e,t)=>{const n=t().publications_store,r=n.projects.filter(p=>p.selected),o=Object.keys(n.selected_tags).map(p=>n.selected_tags[p]).flat(),s={...n.publication},i=n.errors,{formValid:l,missingFields:c}=XA(s,["title","publication_year","publication_month"],["first_name","last_name"]);if(!l){i.length>0&&Array.from(i).forEach(y=>{e(kw(y.id))});const p=ZA(c);e(Qs(p));return}const u={authenticity_token:document.getElementsByName("authenticity_token")[0].value,publication:s,authors:s.authors.map(p=>({...p,order:0})),tags:o,projects:r};let d,f;s.publication_id?(d=te.routes.publication_path(s.publication_id),f="PATCH"):(d=te.routes.publications_path(),f="POST"),e(Xc(!0)),await fetch(d,{method:f,headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}).then(p=>{n.redirect?window.location.href=te.routes.publications_path():(s.publication_id||(e(GA()),e(Pw())),e(Tw(!0)),e(Xc(!1)))},()=>{e(Xc(!1)),e(Qs("There was an error saving this publication."))})},n2=({doi:e,updatePublication:t,doiLookup:n})=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"doi",className:"form-label",children:"DOI"}),a.jsxs("div",{className:"input-group",children:[a.jsx("input",{type:"text",className:"form-control",id:"doi",name:"publication[doi]","aria-label":"DOI Input and Search box","aria-describedby":"doi_button",value:e,onChange:r=>t(r.target.value)}),a.jsx("button",{className:"btn btn-primary",type:"button",id:"doi_button",onClick:()=>n(),children:"Lookup Publication"})]})]})}),r2=e=>({doi:$A(e)}),o2=e=>({updatePublication:t=>e(Nw({key:"doi",value:t})),doiLookup:()=>e(e2())}),s2=Jt(r2,o2)(n2),i2=({author:e,authorKey:t,updateAuthor:n,deleteAuthor:r})=>{const o=l=>{n({key:l.target.name,value:l.target.value,idx:t})},s=l=>a.jsx("td",{children:a.jsx("input",{type:"text",className:"form-control",name:l,id:l,value:e[l],onChange:c=>o(c)})},`field_${l}`),i=["first_name","last_name","affiliation"];return a.jsxs("tr",{children:[i.map(l=>s(l)),a.jsx("td",{children:t!==0&&a.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>r(t),children:a.jsx("i",{className:"bi bi-trash"})})})]})},a2=e=>({updateAuthor:t=>e(zA(t)),deleteAuthor:t=>e(WA(t))}),_g=Jt(null,a2)(i2),l2=({authors:e,addAuthor:t,authors_exist:n})=>{const r=e.length===0,o=()=>n?"":a.jsx("div",{className:"alert alert-danger",children:"You must add at least one author and each author must have a first and last name"});return a.jsxs("div",{children:[o(),a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"First Name"}),a.jsx("th",{children:"Last Name"}),a.jsx("th",{children:"Affiliation"}),a.jsx("th",{})]})}),a.jsxs("tbody",{children:[e.map((s,i)=>a.jsx(_g,{author:s,authorKey:i},`author_${i}`)),r&&a.jsx(_g,{author:t()})]})]}),a.jsx("button",{className:"btn btn-primary mt-3",onClick:()=>t(),children:"Add Author"})]})},c2=e=>({authors:Sw(e),authors_exist:Rw(e)}),u2=e=>({addAuthor:()=>e(BA())}),d2=Jt(c2,u2)(l2),f2=({category:e,publication_tags:t,updateSelectedTags:n,index:r})=>{const o=w.useRef(null),s=()=>{const l=t.filter(c=>c.label==e.label)[0];return l?l.options:[]},i=l=>{n({category:e.label,tags:l})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fw-bold mb-1",children:e.label}),a.jsx("div",{className:"mb-3",children:a.jsx(Cp,{classNames:{control:l=>l.isFocused?"custom-select-selected":"border-grey-300"},defaultValue:s(),options:e.options,isMulti:!0,openMenuOnClick:!0,name:`tags_${r}`,inputId:`tags_${r}`,ref:o,closeMenuOnSelect:!1,onChange:i})})]})},p2=e=>({updateSelectedTags:t=>e(HA(t))}),h2=e=>({publication_tags:DA(e)}),m2=Jt(h2,p2)(f2),g2=({projects:e,toggleProject:t})=>{const n=o=>`list-group-item list-group-item-action clickable ${o.selected?"list-group-item-success":""}`,r=()=>e.filter(o=>o.selected).length>0;return a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[r()?"":a.jsx("div",{className:"alert alert-danger",children:"You must select at least one project"}),a.jsx("div",{className:"list-group",children:e.map((o,s)=>a.jsxs("div",{className:n(o),onClick:()=>t(s),children:[o.grant_number,": ",o.title]},`project_${o.grant_number}`))})]})})},v2=e=>({projects:MA(e)}),y2=e=>({toggleProject:t=>e(qA(t))}),x2=Jt(v2,y2)(g2),b2=({grant_number:e,setGrantNumber:t,grantSearch:n})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:["If your project isn't listed above, you can manually add it by entering the grant number below.",a.jsxs("div",{className:"input-group mt-1",children:[a.jsx("input",{type:"text",className:"form-control",value:e,onChange:r=>t(r.target.value),placeholder:"Enter a grant number"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>n(),children:"Find Project"})]})]})}),w2=e=>({setGrantNumber:t=>e(Ow(t)),grantSearch:()=>e(t2())}),S2=e=>({grant_number:e.publications_store.grant_number}),_2=Jt(S2,w2)(b2),j2=({publication:e,updateField:t,publication_types:n,changePubType:r,updatePublication:o,tag_categories:s,savePublication:i,modal:l,save_enabled:c,setFormValid:u,form_valid:d})=>{const f=g=>{g.target.value.trim()==""?u(!1):u(!0),o({key:"title",value:g.target.value})},p=()=>e.fields.map((g,b)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:`field_${g.csl_field_name}`,className:"form-label",children:g.name}),a.jsx("input",{type:"text",className:"form-control",name:`field_${g.csl_field_name}`,id:`field_${g.csl_field_name}`,value:g.field_value,onChange:S=>t({index:b,value:S.target.value})})]})},`field_${g.csl_field_name}`)),y=()=>{const g=new Date().getFullYear()+2;let b=1980;const S=[];for(;b<=g;)S.push(b++);const _=["January","February","March","April","May","June","July","August","September","October","November","December"],j=a.jsx("i",{className:"bi bi-asterisk text-danger"});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("label",{className:"form-label",htmlFor:"publication_title",children:["Title ",j]}),a.jsx("input",{name:"publication_title",id:"publication_title",type:"text",className:`form-control ${d?"":"is-invalid"}`,value:e.title,onChange:C=>f(C)})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_year",children:"Year Published"}),a.jsx("select",{name:"publication_year",id:"publication_year",className:"form-control",value:e.publication_year,onChange:C=>{o({key:"publication_year",value:C.target.value})},children:S.map(C=>a.jsx("option",{value:C,children:C},`year_${C}`))})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_month",children:"Month Published"}),a.jsx("select",{name:"publication_month",id:"publication_month",className:"form-control",value:e.publication_month,onChange:C=>{o({key:"publication_month",value:C.target.value})},children:_.map((C,E)=>a.jsx("option",{value:E+1,children:C},`month_${E}`))})]})})]})},m=a.jsxs("div",{className:"card",children:[a.jsx("div",{className:"card-header",children:a.jsx("h2",{children:"Publication Information"})}),a.jsxs("div",{className:"card-body",children:[a.jsx("p",{className:"mb-2",children:'Enter information about this publication below. If you have a DOI, you may use the "Lookup Publication" button to attempt to find this information automatically.'}),a.jsx(s2,{}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"publication_type",className:"form-label",children:"Publication Type"}),a.jsx("select",{name:"publication[publication_type]",id:"publication_type",className:"form-control",value:e.publication_type,onChange:g=>r(g.target.value),children:n.map(g=>a.jsx("option",{value:g.publication_type,children:g.publication_type},`pub_type_${g.type_id}`))})]})}),y(),p()]})]}),h=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Authors"}),a.jsxs(go,{children:[`Add authors by clicking the "Add Authors" button below and entering the author's details. You may also remove authors by clicking the `,a.jsx("i",{className:"bi bi-trash fw-bold text-danger"})," ","button"]})]}),a.jsx("div",{className:"card-body",children:a.jsx(d2,{})})]}),x=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Tags"}),a.jsx(go,{children:"Add related tags from the lists below. You may choose multiple tags per category."})]}),a.jsx("div",{className:"card-body",children:s.map((g,b)=>a.jsx(m2,{index:b,category:g},`tc_${b}`))})]}),v=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Associated Projects"}),a.jsx(go,{children:"Click/Tap each project that this publication is related to."})]}),a.jsxs("div",{className:"card-body",children:[a.jsx(x2,{}),a.jsx("hr",{}),a.jsx(_2,{})]})]});return a.jsxs(a.Fragment,{children:[m,h,x,v,l?null:a.jsx("p",{className:"mt-3",children:a.jsx("button",{onClick:()=>i(),className:"btn btn-success",disabled:!c,children:"Save Publication"})})]})},C2=e=>({publication:PA(e),publication_types:IA(e),tag_categories:AA(e),saving:Rp(e),modal:LA(e),save_enabled:Ew(e),form_valid:Cw(e)}),E2=e=>({updateField:t=>e(UA(t)),changePubType:t=>e(Rd(t)),updatePublication:t=>e(Nw(t)),savePublication:()=>e($w()),setFormValid:t=>e(YA(t))}),R2=Jt(C2,E2)(j2),N2=({errors:e,hideError:t})=>a.jsx(a.Fragment,{children:e.map(n=>a.jsxs("div",{className:"alert alert-danger alert-dismissible sticky-top",children:[n.message,a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(n.id)})]},`err_${n.id}`))}),k2=e=>({errors:FA(e)}),T2=e=>({hideError:t=>e(kw(t))}),O2=Jt(k2,T2)(N2),P2=({show_saved:e,updateShowSaved:t})=>{const n=a.jsxs("div",{className:"alert alert-success alert-dismissible sticky-top",children:["Publication Saved Successfully!",a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(!1)})]});return e?n:a.jsx(a.Fragment,{})},$2=e=>({show_saved:jw(e)}),I2=e=>({updateShowSaved:t=>e(Tw(t))}),A2=Jt($2,I2)(P2),M2=({getData:e,data_loaded:t})=>(w.useEffect(()=>{e()},[]),a.jsxs(a.Fragment,{children:[a.jsx(A2,{}),a.jsx(O2,{}),t?a.jsx(R2,{}):a.jsx(Do,{})]})),D2=e=>({data_loaded:_w(e)}),F2=e=>({getData:()=>e(Pw())}),Iw=Jt(D2,F2)(M2),L2=({saving:e,savePublication:t,showSaved:n,updatePublications:r,save_enabled:o})=>{const[s,i]=w.useState(!1);return w.useEffect(()=>{!e&&n&&r()},[e,n]),a.jsxs(a.Fragment,{children:[a.jsxs(ge,{size:"xl",show:s,onHide:()=>i(!1),scrollable:!0,children:[a.jsx(ge.Header,{closeButton:!0,children:a.jsx(ge.Title,{children:"Add Publication"})}),a.jsx(ge.Body,{children:a.jsx(Iw,{})}),a.jsx(ge.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>{t(),i(!1)},children:"Save Publication"})]})})]}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>i(!0),children:"Add a New Publication"})]})},U2=e=>({saving:Rp(e),showSaved:jw(e),save_enabled:Ew(e)}),V2=e=>({savePublication:()=>e($w())}),B2=Jt(U2,V2)(L2),z2=({usernames:e=[],publication_ids:t=[]})=>{const[n,r]=w.useState(e),[o,s]=w.useState(t),[i,l]=w.useState([]),c=w.useRef(n),u=h=>{c.current=h,r(h)},d=async()=>{const x=await(await fetch(te.routes.search_publications_path({usernames:n}))).json();l(x)};w.useEffect(()=>{d()},[n]),w.useEffect(()=>{addEventListener("requestAddRole",h=>u([...c.current,h.detail.username])),addEventListener("requestRemoveRole",h=>u(c.current.filter(x=>x!=h.detail.username)))},[]);let f=!1,p=!1;const y=i.map(h=>{const x=o.includes(h.publication_id);f=f||x,p=p||!x;const v=new Date(h.publication_year,h.publication_month-1);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("input",{type:"checkbox",name:"publication_ids[]",value:h.publication_id,checked:x,onChange:()=>s(x?o.filter(g=>g!=h.publication_id):[...o,h.publication_id])})}),a.jsx("td",{children:h.title}),a.jsx("td",{children:h.authors.map(g=>`${g.first_name} ${g.last_name}`).join(", ")}),a.jsx("td",{children:h.publication_type}),a.jsxs("td",{children:[v.toLocaleString("default",{month:"short"})," ",h.publication_year]})]},h.publication_id)}),m=`${p?"Select":"Deselect"} all`;return a.jsxs("div",{className:"publications-select",children:[a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:a.jsx("input",{type:"checkbox",value:"","aria-label":m,title:m,checked:f&&!p,onChange:()=>s(p?i.map(h=>h.publication_id):[]),ref:h=>{h&&(h.indeterminate=f&&p)}})}),a.jsx("th",{children:"Title"}),a.jsx("th",{children:"Authors"}),a.jsx("th",{children:"Type"}),a.jsx("th",{children:"Date"})]})}),a.jsx("tbody",{children:y})]}),a.jsx(B2,{updatePublications:d})]})},q2=()=>`${Math.random().toString(36).slice(2)}`,Nd=document.querySelector("#publications-react"),H2=Nd?Nd.dataset:{},jg={publication_types:[],tag_categories:[],publication:{},projects:[],errors:[],selected_tags:{},data_loaded:!1,saving:!1,show_saved:!1,redirect:H2.redirect||!1,modal:Nd==null,form_valid:!1,grant_number:""},W2=(e=jg,t)=>{const{type:n,payload:r}=t;switch(n){case"UPDATE_FIELD":return Pt(e,s=>(s.publication.fields[r.index].field_value=r.value,s));case"CHANGE_PUB_TYPE":return Pt(e,s=>{let i=s.publication_types.find(l=>l.publication_type==r).fields;return i.forEach(l=>{const c=s.publication.fields.find(u=>u.csl_field_name==l.csl_field_name);c&&(l.value=c.value)}),s.publication.publication_type=r,s.publication.fields=i,s});case"UPDATE_PUBLICATION":return{...e,publication:{...e.publication,[r.key]:r.value}};case"SET_PUBLICATION":return Pt(e,s=>(s.publication.fields.forEach(i=>{i.field_value=r[i.csl_field_name]}),Object.keys(s.publication).forEach(i=>{r[i]&&(s.publication[i]=r[i])}),s.form_valid=r.title.trim()!="",s));case"ADD_AUTHOR":{const o={portal_username:"",first_name:"",middle_name:"",last_name:"",prefix:"",suffix:"",initials:"",affiliation:"",hash:{}};return Pt(e,i=>{i.publication.authors.push(o)})}case"UPDATE_AUTHOR":return Pt(e,s=>{s.publication.authors[r.idx][r.key]=r.value});case"TOGGLE_TAG":return Pt(e,s=>{let i=s.tag_categories.find(l=>l.publication_tags_category_id==r.publication_tags_category_id);i.tags[r.idx].selected=!i.tags[r.idx].selected});case"TOGGLE_REQUEST":return Pt(e,s=>(s.projects[r].selected=!s.projects[r].selected,s));case"UPDATE_ERRORS":{const o={id:q2(),message:r};return{...e,errors:[...e.errors,o]}}case"HIDE_ERROR":{const o=e.errors.filter(s=>s.id!=r);return{...e,errors:o}}case"UPDATE_SELECTED_TAGS":return Pt(e,s=>{const i=r.tags.map(l=>l.value);return s.selected_tags[r.category]=i,s});case"DELETE_AUTHOR":return Pt(e,s=>(s.publication.authors.splice(r,1),s));case"DATA_LOADED":return Pt(e,s=>(s.publication=r.publication,s.form_valid=r.publication.title.trim()!="",s.publication.authors.forEach(i=>{i.affiliation||(i.affiliation="")}),s.publication_types=r.publication_types,s.tag_categories=r.tag_categories,s.projects=r.publication.projects,r.publication.tags.forEach(i=>s.selected_tags[i.label]=i.options.map(l=>l.value)),s.data_loaded=!0,s));case"UPDATE_SHOW_SAVED":return{...e,show_saved:r};case"UPDATE_SAVING":return{...e,saving:r};case"RESET_STATE":return jg;case"SET_FORM_VALID":return{...e,form_valid:r};case"SET_GRANT_NUMBER":return{...e,grant_number:r};case"ADD_PROJECT":return{...e,projects:[...e.projects,r]};default:return e}},K2={catalogs:{},filteredResources:[],filters:[],hasErrors:!1,onRamps:!1,resources:[],resourcesLoaded:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},pa=Qe("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(Cg(!1));let n=[];e.catalogSources?n=e.catalogSources:n.push({...e,catalogLabel:"Default"}),e.onRamps&&n.push({apiUrl:"https://allocations.access-ci.org/resources.json",catalogLabel:"ACCESS",allowedCategories:[],allowedFilters:[],allowedResources:[],excludedCategories:["Resource Category"],excludedFilters:[],excludedResources:["ACCESS Credits"]});const r=await Promise.all(n.map(async o=>{const i=await(await fetch(o.apiUrl)).json();return{...o,data:i}}));t(X2({data:r,params:e})),t(Cg(!0))});Qe("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(J2(e)),t(Mw())});const G2=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},Y2=e=>{const t={},n={};let r={};return e.forEach(s=>{t[s.catalogLabel]={...s,resourceIds:[],selected:!1,catalogId:s.catalogLabel.replace(/[^(A-z)]/,"")},delete t[s.catalogLabel].data,s.data.forEach(i=>{if(kd(s.allowedResources,s.excludedResources,i.resourceName)){const{categories:l,formattedResource:c}=Q2(s,i,r);n[i.resourceId]=c,t[s.catalogLabel].resourceIds.push(i.resourceId),r=l}})}),{resources:Object.keys(n).map(s=>n[s]),catalogs:t,categories:r}},kd=(e,t,n)=>!e&&!t||e&&e.length==0&&t&&t.length==0?!0:e&&e.length>0?e.find(r=>r==n):t&&t.length>0?!t.find(r=>r==n):!0,Q2=(e,t,n)=>{const r=[];let o="";t.featureCategories.filter(l=>l.categoryIsFilter).forEach(l=>{const c=l.categoryId;l.categoryName=="ACCESS Resource Grouping"?o=l.features[0].name:(!n[c]&&kd(e.allowedCategories,e.excludedCategories,l.categoryName)&&(n[c]={categoryId:c,categoryName:l.categoryName,categoryDescription:l.categoryDescription,features:{}}),l.features.forEach(u=>{const d={featureId:u.featureId,name:u.name,description:u.description,categoryId:c,selected:!1},f=kd(e.allowedFilters,e.excludedFilters,d.name);f&&r.push(d),n[c]&&f&&!n[c].features[u.featureId]&&(n[c].features[u.featureId]=d)}))});const s=r.map(l=>l.name).sort((l,c)=>l>c);return{formattedResource:{...t,resourceName:t.resourceName.trim(),features:s,featureIds:r.map(l=>l.featureId),sortCategory:o},categories:n}},Aw=ri({name:"resourceCatalog",initialState:K2,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,{resources:r,catalogs:o,categories:s}=Y2(n);e.catalogs=o,e.onRamps=t.params.onRamps;for(const i in s){const l=s[i],c=[];for(const u in l.features)c.push(l.features[u]);e.filters.push({...l,features:c.sort((u,d)=>u.name>d.name)})}e.filters=e.filters.sort((i,l)=>i.categoryName.localeCompare(l.categoryName)),e.resources=r.sort((i,l)=>i.resourceName.localeCompare(l.resourceName)).sort((i,l)=>e.resourceSorting[i.sortCategory]>e.resourceSorting[l.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},setResourcesLoaded:(e,{payload:t})=>{e.resourcesLoaded=t},toggleCatalog:(e,{payload:t})=>{const{catalog:n,selected:r}=t;e.catalogs[n.catalogLabel].selected=r},toggleFilter:(e,{payload:t})=>{if(t){const i=t,c=e.filters.find(u=>u.categoryId==i.categoryId).features.find(u=>u.featureId==i.featureId);c.selected=!c.selected}const n=G2(e.filters);let r=[];if(n.length>0){const i=n.map(l=>l.features.map(c=>c.featureId));e.resources.forEach(l=>{let c=0;i.forEach(u=>{let d=!1;l.featureIds.forEach(f=>{u.indexOf(f)>=0&&(d=!0)}),d&&(c+=1)}),c>=i.length&&r.push(l)})}else r=e.resources;const o=Object.keys(e.catalogs).map(i=>e.catalogs[i]),s=o.filter(i=>i.selected);if(s.length>0&&s.length<o.length){const i=s.map(l=>l.resourceIds).flat();r=r.filter(l=>i.indexOf(l.resourceId)>=0)}e.filteredResources=r}},extraReducers:e=>{e.addCase(pa.pending,t=>{}).addCase(pa.fulfilled,(t,n)=>{}).addCase(pa.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:X2,processData:gD,resetFilters:Z2,setResourcesLoaded:Cg,toggleCatalog:J2,toggleFilter:Mw}=Aw.actions,Dw=e=>e.resourceCatalog.catalogs,eM=e=>e.resourceCatalog.filters,tM=e=>e.resourceCatalog.hasErrors,nM=e=>e.resourceCatalog.resourcesLoaded,rM=e=>e.resourceCatalog.filteredResources,oM=Aw.reducer,sM="_access_1yrq0_2",iM="_resourceName_1yrq0_6",aM="_description_1yrq0_11",lM="_filterBar_1yrq0_15",cM="_cardBg_1yrq0_20",uM="_active_1yrq0_25",dM="_plainButton_1yrq0_30",fM="_btnSecondary_1yrq0_40",pM="_filtersHidden_1yrq0_51",hM="_filtersVisible_1yrq0_57",At={access:sM,resourceName:iM,description:aM,filterBar:lM,cardBg:cM,active:uM,plainButton:dM,btnSecondary:fM,filtersHidden:pM,filtersVisible:hM},mM=({resource:e})=>{const[t,n]=w.useState(!0),r=u=>{const d={"CPU Compute":"cpu-fill","GPU Compute":"gpu-card",Cloud:"cloud-fill","Commercial Cloud":"cloud-fill",Storage:"database-fill","Service / Other":"journal","Innovative / Novel Compute":"pc"};return d[u]?a.jsx("i",{title:u,className:`bi bi-${d[u]} me-2 `},`${e.resourceId}_${d[u]}`):""},o=()=>a.jsxs("span",{className:"float-end",children:[e.features.map(u=>r(u)),e.resourceType]}),s=u=>u.length==0?"":a.jsx(a.Fragment,{children:u.map((d,f)=>a.jsx("span",{className:"badge text-bg-secondary me-2",children:d},`feature_${e.resourceId}_${f}`))}),i=()=>{let u=e.resourceDescription;return u&&u!=""?(At.plainButton,a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col fw-bold",children:["About ",e.resourceName]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col ",children:[a.jsx("div",{className:At.description,dangerouslySetInnerHTML:{__html:u}}),""]})})]})):""},l=()=>e.recommendedUse&&e.recommendedUse!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:"Recommended Use"})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:a.jsx("div",{className:At.description,dangerouslySetInnerHTML:{__html:e.recommendedUse}})})})]}):"",c=()=>At.cardBg;return a.jsx(a.Fragment,{children:a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"card mb-3",children:[a.jsxs("div",{className:`card-header ${c()}`,children:[a.jsx("span",{className:"",children:e.resourceName}),o()]}),a.jsxs("div",{className:"card-body",children:[a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:s(e.features)})}),l(),i()]}),a.jsx("div",{className:"card-footer",children:a.jsxs("a",{target:"_blank",href:e.userGuideUrl,className:"btn btn-info me-2 fw-bold",children:["System Info ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})})]})})})})},gM=({filter:e})=>{const t=it(),n=()=>{t(Mw(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},vM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(gM,{filter:t},t.featureId))]})}),yM=({onReset:e})=>{const t=it(),n=fe(Dw),r=fe(eM),o=r.filter(s=>s.features.filter(i=>i.selected).length>0);return Object.keys(n).map(s=>n[s]),a.jsxs(a.Fragment,{children:[r.map(s=>a.jsx(vM,{category:s},s.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>t(Z2()),disabled:o.length==0,children:"Reset Filters"}),a.jsx("button",{className:"btn btn-outline-primary ms-3 mt-2 mb-2",onClick:e,children:"Close Menu"})]})},xM=()=>{const[e,t]=w.useState(!1),n=w.useRef(null),r=()=>{const o=n.current;e?(o.style.height="0px",o.classList.remove(At.filtersVisible),o.classList.add(At.filtersHidden)):(o.style.height=o.scrollHeight+"px",o.classList.remove(At.filtersHidden),o.classList.add(At.filtersVisible)),t(!e)};return a.jsx("div",{className:At.filterBar,children:a.jsx("div",{className:"row mb-2",children:a.jsx("div",{className:"col pt-2 pb-2",children:a.jsxs("div",{className:"p-1 pb-0 border-bottom bg-white shadow",children:[a.jsxs("button",{className:"btn btn-outline-primary mb-1 mt-1",type:"button",onClick:r,children:[a.jsx("i",{className:"bi bi-filter"})," Filters"]}),a.jsx("div",{className:`${At.filtersHidden} pe-2 ps-2`,id:"filtersList",ref:n,children:a.jsx(yM,{onReset:r})})]})})})})},bM=()=>{const e=fe(rM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsx("div",{className:"card shadow",children:a.jsxs("div",{className:"card-body",children:[a.jsx(xM,{}),e.map(t=>a.jsx(mM,{resource:t},t.resourceId))]})})},wM=({baseUrl:e})=>a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col d-flex",children:a.jsx("img",{alt:"Access Logo",style:{height:"75px"},src:`${e}/access_logo.png`})})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("h3",{className:"border-bottom",children:"NSF ACCESS Resources"})})}),a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("h4",{children:"Discover the nationwide NSF cyberinfrastructure"}),a.jsx("p",{children:"Need advanced computing and storage options for your research or classroom? The ACCESS program has been established and funded by the U.S. National Science Foundation to help you - the nation's researchers and educators - to use some of the country's most advanced computing systems and services - at no cost to you."}),a.jsx("p",{children:"Thousands of researchers, instructors, and students from institutions large and small use ACCESS-integrated resources every year. With more than 30 resources from more than 15 resource providers, there's bound to be a resource for you, your lab, or your class."}),a.jsx("p",{children:"Explore the resource catalog below - filter the list to discover the resources that have the features or services to accelerate your activities. The System Info button will take you to the resource's documentation for all the details."}),a.jsx("p",{children:'Ready to begin? Click the "Get Your First Project" button and join the ACCESS community!'}),a.jsx("p",{children:a.jsxs("a",{href:"https://allocations.access-ci.org/get-your-first-project",target:"_blank",className:`btn btn-secondary fw-bold ${At.btnSecondary}`,children:["Get Your First Project ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})}),a.jsxs("p",{children:["If you have feedback for ACCESS, please complete our",a.jsx("a",{target:"_blank",href:"https://docs.google.com/forms/d/e/1FAIpQLSdn-SXokNB_5s0r2SA_S9ZIZWZFlVPRD2OHepTH5HY2YND_zw/viewform",children:" Feedback Form"}),".",a.jsx("br",{}),"If you have questions, please",a.jsx("a",{target:"_blank",href:"https://support.access-ci.org/user/login?destination=/open-a-ticket",children:" open a help ticket"}),"."]})]})})]}),SM=({catalogSources:e=[],onRamps:t=!1,baseUrl:n})=>{const r=it(),o=fe(nM),s=fe(tM),i=fe(Dw),l=Object.keys(i).map(u=>i[u]);w.useEffect(()=>{r(pa({catalogSources:e,onRamps:t}))},[]);const c=()=>t&&l.length>1?a.jsx(a.Fragment,{children:l.filter(u=>u.catalogLabel!="ACCESS").map((u,d)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("h4",{className:"border-bottom",children:["About ",u.catalogLabel]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:u.description}})]})},`catalog_${d}`))}):"";return s?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):o?a.jsxs("div",{className:`container mt-3 ${At.access}`,children:[t?a.jsx(wM,{baseUrl:n}):"",c(),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(bM,{})})})]}):a.jsx(Do,{})},_M={filters:[],resources:[],filteredResources:[],resourcesLoaded:!1,hasErrors:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},ha=Qe("resourceCatalog/getResources",async(e,{dispatch:t})=>{const r=await(await fetch(e.apiUrl)).json();t(CM({data:r,params:e}))}),jM=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},Eg=(e,t,n)=>{if(e.length==0&&t.length==0)return!0;if(e.length>0)return e.find(r=>r==n);if(t.length>0)return!t.find(r=>r==n)},Fw=ri({name:"resourceCatalog",initialState:_M,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,r=t.params.excludedCategories,o=t.params.excludedFilters,s=t.params.excludedResources,i=t.params.allowedCategories,l=t.params.allowedFilters,c=[],u={};n.filter(d=>!s.includes(d.resourceName)).forEach(d=>{const f=[];let p="";d.featureCategories.filter(m=>m.categoryIsFilter).forEach(m=>{const h=m.categoryId;m.categoryName=="ACCESS Resource Grouping"?p=m.features[0].name:(!u[h]&&Eg(i,r,m.categoryName)&&(u[h]={categoryId:h,categoryName:m.categoryName,categoryDescription:m.categoryDescription,features:{}}),m.features.forEach(x=>{const v={featureId:x.featureId,name:x.name,description:x.description,categoryId:h,selected:!1},g=Eg(l,o,v.name);g&&f.push(v),u[h]&&g&&!u[h].features[x.featureId]&&(u[h].features[x.featureId]=v)}))});const y={resourceName:d.resourceName,resourceId:d.resourceId,resourceType:d.resourceType,organization:d.organization,units:d.units,userGuideUrl:d.userGuideUrl,resourceDescription:d.resourceDescription,description:d.description,recommendedUse:d.recommendedUse,features:f.map(m=>m.name).sort((m,h)=>m>h),featureIds:f.map(m=>m.featureId),sortCategory:p};c.push(y)});for(const d in u){const f=u[d],p=[];for(const y in f.features)p.push(f.features[y]);e.filters.push({...f,features:p.sort((y,m)=>y.name>m.name)})}i.length>0?e.filters=e.filters.sort((d,f)=>i.indexOf(d.categoryName)>i.indexOf(f.categoryName)):e.filters=e.filters.sort((d,f)=>d.categoryName.localeCompare(f.categoryName)),e.resources=c.sort((d,f)=>d.resourceName.localeCompare(f.resourceName)).sort((d,f)=>e.resourceSorting[d.sortCategory]>e.resourceSorting[f.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},toggleFilter:(e,{payload:t})=>{const n=t,o=e.filters.find(i=>i.categoryId==n.categoryId).features.find(i=>i.featureId==n.featureId);o.selected=!o.selected;const s=jM(e.filters);if(s.length>0){const i=[],l=s.map(c=>c.features.map(u=>u.featureId));e.resources.forEach(c=>{let u=0;l.forEach(d=>{let f=!1;c.featureIds.forEach(p=>{d.indexOf(p)>=0&&(f=!0)}),f&&(u+=1)}),u>=l.length&&i.push(c)}),e.filteredResources=i}else e.filteredResources=[...e.resources]}},extraReducers:e=>{e.addCase(ha.pending,t=>{}).addCase(ha.fulfilled,(t,n)=>{}).addCase(ha.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:CM,processData:vD,resetFilters:EM,toggleFilter:RM}=Fw.actions,NM=e=>e.resourceCatalog.hasErrors,kM=e=>e.resourceCatalog.resourcesLoaded,TM=e=>e.resourceCatalog.filters,OM=e=>e.resourceCatalog.filteredResources,PM=Fw.reducer,$M=({resource:e})=>{const t=r=>r.length==0?"":a.jsx("ul",{children:r.map((o,s)=>a.jsx("li",{children:o},`feature_${e.resourceId}_${s}`))}),n=(r,o)=>o&&o!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:r})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",dangerouslySetInnerHTML:{__html:o}})})]}):"";return a.jsxs(Wt.Item,{eventKey:e.resourceId,children:[a.jsx(Wt.Header,{children:e.resourceName}),a.jsxs(Wt.Body,{children:[a.jsx("table",{className:"table",children:a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Resource Type:"}),a.jsx("td",{children:e.resourceType})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Organization:"}),a.jsx("td",{children:e.organization})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Units:"}),a.jsx("td",{children:e.units})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"User Guide:"}),a.jsx("td",{children:e.userGuideUrl==""?"":a.jsx("a",{href:e.userGuideUrl,target:"_blank",rel:"noreferrer",children:"Link to User Guide"})})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Features Available:"}),a.jsx("td",{children:t(e.features)})]})]})}),n("Resource Description",e.resourceDescription),n("Allocations Description",e.description),n("Recommended Use",e.recommendedUse)]})]})},IM=()=>{const e=fe(OM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Resources"}),a.jsx(Wt,{children:e.map(t=>a.jsx($M,{resource:t},t.resourceId))})]})},AM=({filter:e})=>{const t=it(),n=()=>{t(RM(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},MM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(AM,{filter:t},t.featureId))]})}),DM=()=>{const e=it(),t=fe(TM),n=t.filter(r=>r.features.filter(o=>o.selected).length>0);return a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Filters"}),t.map(r=>a.jsx(MM,{category:r},r.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>e(EM()),disabled:n.length==0,children:"Reset Filters"})]})},FM=({apiUrl:e,excludedCategories:t=[],excludedFilters:n=[],excludedResources:r=[],allowedCategories:o=[],allowedFilters:s=[]})=>{const i=it(),l=fe(kM),c=fe(NM);return w.useEffect(()=>{i(ha({apiUrl:e,excludedCategories:t,excludedFilters:n,excludedResources:r,allowedCategories:o,allowedFilters:s}))},[]),c?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):l?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"row mt-3",children:[a.jsx("div",{className:"col-sm-4",children:a.jsx(DM,{})}),a.jsx("div",{className:"col-sm-8",children:a.jsx(IM,{})})]})}):a.jsx(Do,{})},Lw={apiUrl:null,pages:1,publications:[],publicationsLoaded:!0,showPagination:!1,filterSelections:{allJournalsToggled:!1,doi:"",journal:"",authorName:"",publicationType:""},pageData:{current_page:1,last_page:1},filterOptions:{journals:[],publication_types:[]}},LM=Qe("publicationsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{await n(kr()),await n(Uw())}),kr=Qe("publicationsBrowser/getPublications",async(e,{getState:t})=>{const n=t().publicationsBrowser;let r=`${n.apiUrl}?page=${n.pageData.current_page}`;if(n.filterSelections.doi!==""&&(r+=`&doi=${encodeURIComponent(n.filterSelections.doi)}`),n.filterSelections.authorName!==""&&(r+=`&author_name=${encodeURIComponent(n.filterSelections.authorName)}`),n.filterSelections.journal!==""){const i=n.filterSelections.journal;n.filterOptions.journals.includes(i)&&(r+=`&journal=${encodeURIComponent(n.filterSelections.journal)}`)}return n.filterSelections.publicationType!==""&&(r+=`&publication_type=${encodeURIComponent(n.filterSelections.publicationType)}`),await(await fetch(r)).json()}),Uw=Qe("publicationsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().publicationsBrowser.apiUrl}?filters=1`;return(await(await fetch(o)).json()).filters||[]}),Vw=ri({name:"publicationsBrowser",initialState:Lw,reducers:{updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)},updateFilterSelection:(e,{payload:t})=>{e.filterSelections[t.name]=t.value},resetFilters:e=>{e.filterSelections={doi:"",allJournalsToggled:!1,journal:"",authorName:"",publicationType:""}}},extraReducers:e=>{e.addCase(kr.pending,t=>{t.publicationsLoaded=!1,t.error=null}).addCase(kr.fulfilled,(t,n)=>{t.publicationsLoaded=!0,t.publications=n.payload.publications||[],n.payload.pagination&&n.payload.pagination.last_page!==t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,n.payload.pagination&&(t.pageData.last_page=n.payload.pagination.last_page)}).addCase(kr.rejected,(t,n)=>{t.publicationsLoaded=!0,t.error=n.error.message}).addCase(Uw.fulfilled,(t,n)=>{t.filterOptions=n.payload})}}),{updatePageData:UM,updateFilterSelection:Rg,resetFilters:VM}=Vw.actions,BM=e=>e.publicationsBrowser.filterSelections,zM=e=>e.publicationsBrowser.publicationsLoaded,qM=e=>e.publicationsBrowser.publications,HM=e=>e.publicationsBrowser.filterOptions,WM=e=>e.publicationsBrowser.pageData,KM=Vw.reducer,Td=e=>(e=e.startsWith("https")?e.split("https://doi.org/").join(""):e,e),GM=({publication:e,index:t})=>{const n=e.authors.map(f=>`${f.last_name}, ${f.first_name.substr(0,1)}.`).join(", "),r=e.projects.map(f=>f.grant_number),o=e.publication_type==="Other"?"Publication":e.publication_type,s=e.projects,i=t%2==0?"bg-light":"",l={textIndent:"-50px",marginLeft:"50px"},c=e.publication_datas,u=f=>{switch(f){case"Publication Type":return e.publication_type;case"Publication Year":return e.publication_year?e.publication_year:"N/A";case"DOI":return e.doi?a.jsx("a",{href:`https://doi.org/${Td(e.doi)}`,target:"_blank",className:"fw-normal",children:Td(e.doi)}):!1;case"Journal":return e.journal.title?e.journal.title:!1;case"Volume/Issue":return c["Volume/Issue"]?c["Volume/Issue"]:!1;case"Pages":return c.Pages?c.Pages:!1;case"Publisher":return c.Publisher?c.Publisher:!1}},d=()=>{const f=u("Publication Year");let p=e.title;const y=u("Journal"),m=u("DOI"),h=u("Volume/Issue"),x=u("Pages"),v=u("Publisher");return p[p.length-1]!="."&&(p+="."),e.publication_type==="Journal Paper"||e.publication_type==="Other"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",h?a.jsxs("span",{className:"ms-1",children:[h,","]}):"",x?a.jsxs("span",{className:"ms-1",children:[x,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Conference Paper"||e.publication_type==="Software"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Book"||e.publication_type==="Book Chapter"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),v?a.jsxs("em",{className:"ms-1",children:[v,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dataset"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p})," [Dataset]. ",v||"",".",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dissertation"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),". [Doctoral dissertation",v?", "+v:"","].",m?a.jsx("span",{className:"ms-1",children:m}):""]}):""};return a.jsx("div",{className:"col-12 mb-2 border-bottom",children:a.jsx("div",{className:"card",style:{border:"unset"},children:a.jsxs("div",{className:`card-body pt-2 mb-2 ${i}`,children:[a.jsx("p",{style:l,children:d()}),s.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-decoration-underline mb-2",children:["Projects Supporting this ",o]}),a.jsx("ul",{style:{...l,listStyleType:"none"},children:r.map((f,p)=>a.jsx("li",{id:`project_${p}`,children:a.jsx("a",{href:`https://allocations.access-ci.org/current-projects?_requestNumber=${f}`,id:`grant_link${p}`,target:"_blank",style:{fontWeight:"600"},children:f})},`grant_${p}`))})]})]})})})},YM=()=>{const e=fe(qM);return e.length===0?a.jsx("div",{children:"No Publications Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(GM,{publication:t,index:n},`publication_${n}`))})},QM=()=>{const e=it(),t=fe(HM),n=fe(BM),r=()=>{window.scrollTo(0,0),e(Cd(!1)),e(dl({current_page:1})),e(kr())},o=()=>{e(VM()),window.scrollTo(0,0),e(kr())};if(!t.journals)return a.jsx("p",{children:"Loading filters..."});const s=l=>{e(Rg({name:l.target.name,value:l.target.value}))},i=l=>{e(Rg({name:l.target.name,value:l.target.value}))};return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{id:"journals_filter_label",className:"mb-1",children:"Journals"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("input",{placeholder:"Type to search...",list:"journal_list",name:"journal",id:"journal_select",value:n.journal,className:"form-control","aria-labelledby":"journal_filter_label",onChange:l=>s(l),onInput:l=>i(l)}),a.jsx("datalist",{id:"journal_list",children:t.journals.map((l,c)=>a.jsx("option",{value:l,children:l},`journal_${c}`))})]}),a.jsx("h5",{id:"author_name_label",className:"mb-1",children:"Author Name"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{placeholder:"Last Name, First Initial",type:"text",className:"form-control",value:n.authorName,name:"authorName",id:"authorName","aria-labelledby":"author_name",onChange:s})}),a.jsx("h5",{id:"doi_number_label",className:"mb-1",children:"DOI"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:Td(n.doi),name:"doi",id:"doiNumber","aria-labelledby":"doi_number_label",onChange:s})}),a.jsx("h5",{id:"publication_type_label",className:"mb-1",children:"Publication Type"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"publicationType",id:"publication_type_select",value:n.publicationType,className:"form-control","aria-labelledby":"publication_type_label",onChange:l=>s(l),children:[a.jsx("option",{value:"",children:"-- All --"}),t.publication_types.map((l,c)=>a.jsx("option",{value:l,children:l},`publication_type_${c}`))]})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:r,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",onClick:o,children:"Reset"})]})]})})},Ng=()=>{const e=it(),t=fe(WM),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(UM({current_page:m})),e(kr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h=m,x="";return typeof m=="object"?[h,x]=m:x=m,h=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):h=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:x})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(h),children:x})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(_e.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},XM=({apiUrl:e})=>{const t=it(),n=fe(zM),r=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(LM())},[t]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(QM,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Ng,{})})}),a.jsx("div",{className:"row",id:"publicationListRow",children:a.jsx("div",{className:"col",children:n?a.jsx(YM,{}):r})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Ng,{})})})]})]})})},Bw=({id:e,type:t,checked:n,onChange:r})=>a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:e,className:"checkbox",children:[a.jsx("input",{onChange:()=>r(t.allocation_type_id),type:"checkbox",checked:n,id:e}),t.display_allocation_type]})})}),ZM=({types:e,createData:t})=>{const[n,r]=w.useState(""),[o,s]=w.useState([]),i=async(u,d)=>{t(u,d),r(""),s([])};function l(u){let d=o;d.includes(u)?d=d.filter(f=>f!==u):d=[...d,u],s(d)}function c(){s(o.length===e.length?[]:[...e.map(d=>d.allocation_type_id)])}return a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Type"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:a.jsxs("tr",{children:[a.jsx("td",{style:{width:"150px"},children:a.jsx("input",{type:"text",value:n,className:"form-control",onChange:u=>r(u.target.value)})}),a.jsx("td",{children:a.jsxs("div",{className:"form-inline",children:[a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:"select-all-checkbox",className:"checkbox",children:[a.jsx("input",{onChange:()=>c(),type:"checkbox",checked:o.length===e.length,id:"select-all-checkbox"}),"Select All"]})})}),e.map(u=>a.jsx(Bw,{id:`id_create_alloc_type_${u.allocation_type_id}`,type:u,checked:o.includes(u.allocation_type_id),onChange:l},`create_keyword_alloc_t_${u.allocation_type_id}`))]})}),a.jsx("td",{style:{width:"50px"},children:a.jsx("button",{className:"btn btn-primary",type:"button",onClick:async()=>i(n,o),children:"Add"})})]})})]})},JM=({keyword:e,keywordAllocationTypeIds:t,types:n,saveData:r,deleteData:o})=>{const[s,i]=w.useState(!1),[l,c]=w.useState(e.keyword),[u,d]=w.useState(t),f=()=>{i(!1),r(e.keyword_id,l,u)},p=h=>{let x=u;x.includes(h)?x=x.filter(v=>v!==h):x=[...x,h],d(x)};let y="",m=e.keyword.toString();return s?(m=a.jsx("input",{type:"text",id:e.keyword_id,value:l,onChange:h=>c(h.target.value)}),y=n.map(h=>a.jsx(Bw,{checked:u.includes(h.allocation_type_id),id:`keyword_${e.keyword}_alloc_type_${h.allocation_type_id}`,onChange:p,type:h},`keyword_${e.keyword}_alloc_t_${h.allocation_type_id}`))):y=n.filter(h=>t.includes(h.allocation_type_id)).map(h=>h.display_allocation_type).join(", "),a.jsxs("tr",{children:[a.jsxs("td",{children:[" ",m," "]}),a.jsxs("td",{children:[" ",y," "]}),s?a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-warning btn-sm",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{className:"btn btn-success btn-sm",onClick:async()=>{f()},children:"Save"})]}):a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-primary btn-sm",onClick:()=>i(!0),children:"Edit"}),a.jsx("button",{className:"btn btn-danger btn-sm",onClick:async()=>o(e.keyword_id),children:"Delete"})]})]})};function eD({allocationTypes:e}){const[t,n]=w.useState([]),[r,o]=w.useState([]),[s,i]=w.useState(""),[l,c]=w.useState(!0),u=async h=>{const v=(await h.json()).message??"Error: Changes not saved";h.ok&&await f(),i(v),c(h.ok)},d=async(h,x)=>{const v=await fetch("/keywords",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({value:h,allocation_types:x})});await u(v)},f=async()=>{r.length===0&&o(e);const x=await(await fetch("/keywords",{headers:{"Content-Type":"application/json",Accept:"application/json"}})).json();n(x)},p=async(h,x,v)=>{const g=await fetch(`/keywords/${h}`,{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({id:h,keyword:x,allocation_types:v})});await u(g)},y=async h=>{const x=await fetch(`/keywords/${h}`,{headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},method:"DELETE"});await u(x)};w.useEffect(()=>{f()},[]);let m=null;return s.length!==0&&(m=a.jsx(be,{color:l?"success":"warning",children:s})),a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Type new keywords separated by semicolons, select the desired allocation types, and then submit."}),a.jsx(a.Fragment,{children:m}),a.jsx(ZM,{types:r,createData:d},"add-keywords"),a.jsx("h3",{children:"Current Keywords"}),a.jsxs("table",{className:"table table-bordered",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Types"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:t.map(h=>a.jsx(JM,{keyword:h,keywordAllocationTypeIds:h.allocation_type_keywords.map(x=>x.allocation_type_id),types:r,saveData:p,deleteData:y},h.keyword_id))})]})]})}function tD(e,{bootstrapFonts:t=!0,bootstrapVariables:n=!0,access:r=!1,baseUrl:o=null}={}){const s=e.attachShadow({mode:"open"}),i=document.createElement("div"),l=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div"),d=document.createElement("link"),f=document.createElement("link"),p=document.createElement("link");return o=o??(typeof document>"u"?require("url").pathToFileURL(__filename).href:Np&&Np.src||new URL("xras-ui.cjs",document.baseURI).href).replace(/\/[^/]+$/,""),d.rel="stylesheet",d.href=`${o}/bootstrap.css`,f.rel="stylesheet",f.href=`${o}/xras-ui.css`,p.rel="stylesheet",p.href=`${o}/access.css`,c.appendChild(u),l.appendChild(c),i.appendChild(l),s.appendChild(d),s.appendChild(f),s.appendChild(p),s.appendChild(i),i.classList.add("bootstrap"),n&&l.classList.add("bootstrap-variables"),t&&(c.classList.add("bootstrap-fonts"),c.setAttribute("data-bs-theme","light")),u}function nD({target:e}){St.createRoot(e).render(a.jsx(XC,{}))}function rD({availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r,target:o}){St.createRoot(o).render(a.jsx(gE,{availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r}))}function oD({resourceId:e,target:t,setExternalSubmit:n,relativeUrlRoot:r}){St.createRoot(t).render(a.jsx(Cx,{resourceId:e,setExternalSubmit:n,relativeUrlRoot:r}))}function sD({target:e,username:t,routes:n}){Ff(n);const r=Mo({reducer:{api:nR}});St.createRoot(e).render(a.jsx(Vr,{store:r,children:a.jsx(fA,{username:t})}))}function iD({target:e,apiUrl:t}){const n=Mo({reducer:{projectsBrowser:RA},preloadedState:{projectsBrowser:{...xw,apiUrl:t}}});St.createRoot(e).render(a.jsx(Vr,{store:n,children:a.jsx(OA,{})}))}function aD({target:e,apiUrl:t}){const n=Mo({reducer:{publicationsBrowser:KM},preloadedState:{publicationsBrowser:{...Lw,apiUrl:t}}});St.createRoot(e).render(a.jsx(Vr,{store:n,children:a.jsx(XM,{apiUrl:t})}))}function zw(){return Mo({reducer:{publications_store:W2}})}function lD({target:e,routes:t}){Ff(t),St.createRoot(e).render(a.jsx(Vr,{store:zw(),children:a.jsx(Iw,{})}))}function cD({target:e,routes:t}){Ff(t),St.createRoot(e).render(a.jsx(Vr,{store:zw(),children:a.jsx(z2,{...JSON.parse(e.dataset.publicationsSelectProps)})}))}function uD({target:e,catalogSources:t,onRamps:n,baseUrl:r}){const o=Mo({reducer:{resourceCatalog:oM}});St.createRoot(e).render(a.jsx(Vr,{store:o,children:a.jsx(SM,{catalogSources:t,onRamps:n,baseUrl:r})}))}function dD({target:e,apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i}){const l=Mo({reducer:{resourceCatalog:PM}});St.createRoot(e).render(a.jsx(Vr,{store:l,children:a.jsx(FM,{apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i})}))}function fD({allocationTypes:e,target:t}){St.createRoot(t).render(a.jsx(eD,{allocationTypes:e}))}exports.allocationsMap=nD;exports.editResource=oD;exports.keywords=fD;exports.onRampsResourceCatalog=uD;exports.projects=sD;exports.projectsBrowser=iD;exports.publications=lD;exports.publicationsBrowser=aD;exports.publicationsSelect=cD;exports.resourceCatalog=dD;exports.resources=rD;exports.shadowTarget=tD;
70
+ `]))),y$=function(t,n){var r=t.isFocused,o=t.size,s=t.theme,i=s.colors,l=s.spacing.baseUnit;return H({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:o,lineHeight:1,marginRight:o,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:l*2})},Hc=function(t){var n=t.delay,r=t.offset;return K("span",{css:yp({animation:"".concat(v$," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},x$=function(t){var n=t.innerProps,r=t.isRtl,o=t.size,s=o===void 0?4:o,i=mn(t,c$);return K("div",G({},Te(H(H({},i),{},{innerProps:n,isRtl:r,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),K(Hc,{delay:0,offset:r}),K(Hc,{delay:160,offset:!0}),K(Hc,{delay:320,offset:!r}))},b$=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.theme,i=s.colors,l=s.borderRadius,c=s.spacing;return H({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:c.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:o?i.primary:i.neutral20,borderRadius:l,borderStyle:"solid",borderWidth:1,boxShadow:o?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:o?i.primary:i.neutral30}})},w$=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.innerRef,i=t.innerProps,l=t.menuIsOpen;return K("div",G({ref:s},Te(t,"control",{control:!0,"control--is-disabled":r,"control--is-focused":o,"control--menu-is-open":l}),i,{"aria-disabled":r||void 0}),n)},S$=w$,_$=["data"],j$=function(t,n){var r=t.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},C$=function(t){var n=t.children,r=t.cx,o=t.getStyles,s=t.getClassNames,i=t.Heading,l=t.headingProps,c=t.innerProps,u=t.label,d=t.theme,f=t.selectProps;return K("div",G({},Te(t,"group",{group:!0}),c),K(i,G({},l,{selectProps:f,theme:d,getStyles:o,getClassNames:s,cx:r}),u),K("div",null,n))},E$=function(t,n){var r=t.theme,o=r.colors,s=r.spacing;return H({label:"group",cursor:"default",display:"block"},n?{}:{color:o.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},R$=function(t){var n=Xb(t);n.data;var r=mn(n,_$);return K("div",G({},Te(t,"groupHeading",{"group-heading":!0}),r))},N$=C$,k$=["innerRef","isDisabled","isHidden","inputClassName"],T$=function(t,n){var r=t.isDisabled,o=t.value,s=t.theme,i=s.spacing,l=s.colors;return H(H({visibility:r?"hidden":"visible",transform:o?"translateZ(0)":""},O$),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:l.neutral80})},iw={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},O$={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":H({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},iw)},P$=function(t){return H({label:"input",color:"inherit",background:0,opacity:t?0:1,width:"100%"},iw)},$$=function(t){var n=t.cx,r=t.value,o=Xb(t),s=o.innerRef,i=o.isDisabled,l=o.isHidden,c=o.inputClassName,u=mn(o,k$);return K("div",G({},Te(t,"input",{"input-container":!0}),{"data-value":r||""}),K("input",G({className:n({input:!0},c),ref:s,style:P$(l),disabled:i},u)))},I$=$$,A$=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors;return H({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:s/2,margin:o.baseUnit/2})},M$=function(t,n){var r=t.theme,o=r.borderRadius,s=r.colors,i=t.cropWithEllipsis;return H({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:o/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},D$=function(t,n){var r=t.theme,o=r.spacing,s=r.borderRadius,i=r.colors,l=t.isFocused;return H({alignItems:"center",display:"flex"},n?{}:{borderRadius:s/2,backgroundColor:l?i.dangerLight:void 0,paddingLeft:o.baseUnit,paddingRight:o.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},aw=function(t){var n=t.children,r=t.innerProps;return K("div",r,n)},F$=aw,L$=aw;function U$(e){var t=e.children,n=e.innerProps;return K("div",G({role:"button"},n),t||K(Sp,{size:14}))}var V$=function(t){var n=t.children,r=t.components,o=t.data,s=t.innerProps,i=t.isDisabled,l=t.removeProps,c=t.selectProps,u=r.Container,d=r.Label,f=r.Remove;return K(u,{data:o,innerProps:H(H({},Te(t,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),s),selectProps:c},K(d,{data:o,innerProps:H({},Te(t,"multiValueLabel",{"multi-value__label":!0})),selectProps:c},n),K(f,{data:o,innerProps:H(H({},Te(t,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},l),selectProps:c}))},B$=V$,z$=function(t,n){var r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.theme,l=i.spacing,c=i.colors;return H({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:s?c.primary:o?c.primary25:"transparent",color:r?c.neutral20:s?c.neutral0:"inherit",padding:"".concat(l.baseUnit*2,"px ").concat(l.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:s?c.primary:c.primary50}})},q$=function(t){var n=t.children,r=t.isDisabled,o=t.isFocused,s=t.isSelected,i=t.innerRef,l=t.innerProps;return K("div",G({},Te(t,"option",{option:!0,"option--is-disabled":r,"option--is-focused":o,"option--is-selected":s}),{ref:i,"aria-disabled":r},l),n)},H$=q$,W$=function(t,n){var r=t.theme,o=r.spacing,s=r.colors;return H({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:s.neutral50,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},K$=function(t){var n=t.children,r=t.innerProps;return K("div",G({},Te(t,"placeholder",{placeholder:!0}),r),n)},G$=K$,Y$=function(t,n){var r=t.isDisabled,o=t.theme,s=o.spacing,i=o.colors;return H({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},Q$=function(t){var n=t.children,r=t.isDisabled,o=t.innerProps;return K("div",G({},Te(t,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),o),n)},X$=Q$,Z$={ClearIndicator:h$,Control:S$,DropdownIndicator:f$,DownChevron:ow,CrossIcon:Sp,Group:N$,GroupHeading:R$,IndicatorsContainer:a$,IndicatorSeparator:g$,Input:I$,LoadingIndicator:x$,Menu:KP,MenuList:YP,MenuPortal:t$,LoadingMessage:JP,NoOptionsMessage:ZP,MultiValue:B$,MultiValueContainer:F$,MultiValueLabel:L$,MultiValueRemove:U$,Option:H$,Placeholder:G$,SelectContainer:r$,SingleValue:X$,ValueContainer:s$},J$=function(t){return H(H({},Z$),t.components)},sg=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function eI(e,t){return!!(e===t||sg(e)&&sg(t))}function tI(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!eI(e[n],t[n]))return!1;return!0}function nI(e,t){t===void 0&&(t=tI);var n=null;function r(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;var i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}var rI={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},oI=function(t){return K("span",G({css:rI},t))},ig=oI,sI={guidance:function(t){var n=t.isSearchable,r=t.isMulti,o=t.tabSelectsValue,s=t.context,i=t.isInitialFocus;switch(s){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(o?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(t["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(t){var n=t.action,r=t.label,o=r===void 0?"":r,s=t.labels,i=t.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(o,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(s.length>1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return i?"option ".concat(o," is disabled. Select another option."):"option ".concat(o,", selected.");default:return""}},onFocus:function(t){var n=t.context,r=t.focused,o=t.options,s=t.label,i=s===void 0?"":s,l=t.selectValue,c=t.isDisabled,u=t.isSelected,d=t.isAppleDevice,f=function(h,x){return h&&h.length?"".concat(h.indexOf(x)+1," of ").concat(h.length):""};if(n==="value"&&l)return"value ".concat(i," focused, ").concat(f(l,r),".");if(n==="menu"&&d){var p=c?" disabled":"",y="".concat(u?" selected":"").concat(p);return"".concat(i).concat(y,", ").concat(f(o,r),".")}return""},onFilter:function(t){var n=t.inputValue,r=t.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},iI=function(t){var n=t.ariaSelection,r=t.focusedOption,o=t.focusedValue,s=t.focusableOptions,i=t.isFocused,l=t.selectValue,c=t.selectProps,u=t.id,d=t.isAppleDevice,f=c.ariaLiveMessages,p=c.getOptionLabel,y=c.inputValue,m=c.isMulti,h=c.isOptionDisabled,x=c.isSearchable,v=c.menuIsOpen,g=c.options,b=c.screenReaderStatus,S=c.tabSelectsValue,_=c.isLoading,j=c["aria-label"],C=c["aria-live"],E=w.useMemo(function(){return H(H({},sI),f||{})},[f]),N=w.useMemo(function(){var F="";if(n&&E.onChange){var V=n.option,Q=n.options,O=n.removedValue,L=n.removedValues,A=n.value,W=function(pe){return Array.isArray(pe)?null:pe},U=O||V||W(A),Y=U?p(U):"",Z=Q||L||void 0,J=Z?Z.map(p):[],X=H({isDisabled:U&&h(U,l),label:Y,labels:J},n);F=E.onChange(X)}return F},[n,E,h,l,p]),R=w.useMemo(function(){var F="",V=r||o,Q=!!(r&&l&&l.includes(r));if(V&&E.onFocus){var O={focused:V,label:p(V),isDisabled:h(V,l),isSelected:Q,options:s,context:V===r?"menu":"value",selectValue:l,isAppleDevice:d};F=E.onFocus(O)}return F},[r,o,p,h,E,s,l,d]),T=w.useMemo(function(){var F="";if(v&&g.length&&!_&&E.onFilter){var V=b({count:s.length});F=E.onFilter({inputValue:y,resultsMessage:V})}return F},[s,y,v,E,g,b,_]),k=(n==null?void 0:n.action)==="initial-input-focus",P=w.useMemo(function(){var F="";if(E.guidance){var V=o?"value":v?"menu":"input";F=E.guidance({"aria-label":j,context:V,isDisabled:r&&h(r,l),isMulti:m,isSearchable:x,tabSelectsValue:S,isInitialFocus:k})}return F},[j,r,o,m,h,x,v,E,l,S,k]),D=K(w.Fragment,null,K("span",{id:"aria-selection"},N),K("span",{id:"aria-focused"},R),K("span",{id:"aria-results"},T),K("span",{id:"aria-guidance"},P));return K(w.Fragment,null,K(ig,{id:u},k&&D),K(ig,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!k&&D))},aI=iI,_d=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],lI=new RegExp("["+_d.map(function(e){return e.letters}).join("")+"]","g"),lw={};for(var Wc=0;Wc<_d.length;Wc++)for(var Kc=_d[Wc],Gc=0;Gc<Kc.letters.length;Gc++)lw[Kc.letters[Gc]]=Kc.base;var cw=function(t){return t.replace(lI,function(n){return lw[n]})},cI=nI(cw),ag=function(t){return t.replace(/^\s+|\s+$/g,"")},uI=function(t){return"".concat(t.label," ").concat(t.value)},dI=function(t){return function(n,r){if(n.data.__isNew__)return!0;var o=H({ignoreCase:!0,ignoreAccents:!0,stringify:uI,trim:!0,matchFrom:"any"},t),s=o.ignoreCase,i=o.ignoreAccents,l=o.stringify,c=o.trim,u=o.matchFrom,d=c?ag(r):r,f=c?ag(l(n)):l(n);return s&&(d=d.toLowerCase(),f=f.toLowerCase()),i&&(d=cI(d),f=cw(f)),u==="start"?f.substr(0,d.length)===d:f.indexOf(d)>-1}},fI=["innerRef"];function pI(e){var t=e.innerRef,n=mn(e,fI),r=LP(n,"onExited","in","enter","exit","appear");return K("input",G({ref:t},r,{css:yp({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var hI=function(t){t.cancelable&&t.preventDefault(),t.stopPropagation()};function mI(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,o=e.onTopArrive,s=e.onTopLeave,i=w.useRef(!1),l=w.useRef(!1),c=w.useRef(0),u=w.useRef(null),d=w.useCallback(function(x,v){if(u.current!==null){var g=u.current,b=g.scrollTop,S=g.scrollHeight,_=g.clientHeight,j=u.current,C=v>0,E=S-_-b,N=!1;E>v&&i.current&&(r&&r(x),i.current=!1),C&&l.current&&(s&&s(x),l.current=!1),C&&v>E?(n&&!i.current&&n(x),j.scrollTop=S,N=!0,i.current=!0):!C&&-v>b&&(o&&!l.current&&o(x),j.scrollTop=0,N=!0,l.current=!0),N&&hI(x)}},[n,r,o,s]),f=w.useCallback(function(x){d(x,x.deltaY)},[d]),p=w.useCallback(function(x){c.current=x.changedTouches[0].clientY},[]),y=w.useCallback(function(x){var v=c.current-x.changedTouches[0].clientY;d(x,v)},[d]),m=w.useCallback(function(x){if(x){var v=MP?{passive:!1}:!1;x.addEventListener("wheel",f,v),x.addEventListener("touchstart",p,v),x.addEventListener("touchmove",y,v)}},[y,p,f]),h=w.useCallback(function(x){x&&(x.removeEventListener("wheel",f,!1),x.removeEventListener("touchstart",p,!1),x.removeEventListener("touchmove",y,!1))},[y,p,f]);return w.useEffect(function(){if(t){var x=u.current;return m(x),function(){h(x)}}},[t,m,h]),function(x){u.current=x}}var lg=["boxSizing","height","overflow","paddingRight","position"],cg={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function ug(e){e.preventDefault()}function dg(e){e.stopPropagation()}function fg(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;e===0?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function pg(){return"ontouchstart"in window||navigator.maxTouchPoints}var hg=!!(typeof window<"u"&&window.document&&window.document.createElement),rs=0,Kr={capture:!1,passive:!1};function gI(e){var t=e.isEnabled,n=e.accountForScrollbars,r=n===void 0?!0:n,o=w.useRef({}),s=w.useRef(null),i=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;if(r&&lg.forEach(function(m){var h=d&&d[m];o.current[m]=h}),r&&rs<1){var f=parseInt(o.current.paddingRight,10)||0,p=document.body?document.body.clientWidth:0,y=window.innerWidth-p+f||0;Object.keys(cg).forEach(function(m){var h=cg[m];d&&(d[m]=h)}),d&&(d.paddingRight="".concat(y,"px"))}u&&pg()&&(u.addEventListener("touchmove",ug,Kr),c&&(c.addEventListener("touchstart",fg,Kr),c.addEventListener("touchmove",dg,Kr))),rs+=1}},[r]),l=w.useCallback(function(c){if(hg){var u=document.body,d=u&&u.style;rs=Math.max(rs-1,0),r&&rs<1&&lg.forEach(function(f){var p=o.current[f];d&&(d[f]=p)}),u&&pg()&&(u.removeEventListener("touchmove",ug,Kr),c&&(c.removeEventListener("touchstart",fg,Kr),c.removeEventListener("touchmove",dg,Kr)))}},[r]);return w.useEffect(function(){if(t){var c=s.current;return i(c),function(){l(c)}}},[t,i,l]),function(c){s.current=c}}var vI=function(t){var n=t.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},yI={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function xI(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,o=r===void 0?!0:r,s=e.onBottomArrive,i=e.onBottomLeave,l=e.onTopArrive,c=e.onTopLeave,u=mI({isEnabled:o,onBottomArrive:s,onBottomLeave:i,onTopArrive:l,onTopLeave:c}),d=gI({isEnabled:n}),f=function(y){u(y),d(y)};return K(w.Fragment,null,n&&K("div",{onClick:vI,css:yI}),t(f))}var bI={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},wI=function(t){var n=t.name,r=t.onFocus;return K("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:bI,value:"",onChange:function(){}})},SI=wI;function _p(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function _I(){return _p(/^iPhone/i)}function uw(){return _p(/^Mac/i)}function jI(){return _p(/^iPad/i)||uw()&&navigator.maxTouchPoints>1}function CI(){return _I()||jI()}function EI(){return uw()||CI()}var RI=function(t){return t.label},NI=function(t){return t.label},kI=function(t){return t.value},TI=function(t){return!!t.isDisabled},OI={clearIndicator:p$,container:n$,control:b$,dropdownIndicator:d$,group:j$,groupHeading:E$,indicatorsContainer:i$,indicatorSeparator:m$,input:T$,loadingIndicator:y$,loadingMessage:XP,menu:qP,menuList:GP,menuPortal:e$,multiValue:A$,multiValueLabel:M$,multiValueRemove:D$,noOptionsMessage:QP,option:z$,placeholder:W$,singleValue:Y$,valueContainer:o$},PI={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},$I=4,dw=4,II=38,AI=dw*2,MI={baseUnit:dw,controlHeight:II,menuGutter:AI},Yc={borderRadius:$I,colors:PI,spacing:MI},DI={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:rg(),captureMenuScroll:!rg(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:dI(),formatGroupLabel:RI,getOptionLabel:NI,getOptionValue:kI,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:TI,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!IP(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(t){var n=t.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function mg(e,t,n,r){var o=hw(e,t,n),s=mw(e,t,n),i=pw(e,t),l=ul(e,t);return{type:"option",data:t,isDisabled:o,isSelected:s,label:i,value:l,index:r}}function fa(e,t){return e.options.map(function(n,r){if("options"in n){var o=n.options.map(function(i,l){return mg(e,i,t,l)}).filter(function(i){return vg(e,i)});return o.length>0?{type:"group",data:n,options:o,index:r}:void 0}var s=mg(e,n,t,r);return vg(e,s)?s:void 0}).filter(DP)}function fw(e){return e.reduce(function(t,n){return n.type==="group"?t.push.apply(t,up(n.options.map(function(r){return r.data}))):t.push(n.data),t},[])}function gg(e,t){return e.reduce(function(n,r){return r.type==="group"?n.push.apply(n,up(r.options.map(function(o){return{data:o.data,id:"".concat(t,"-").concat(r.index,"-").concat(o.index)}}))):n.push({data:r.data,id:"".concat(t,"-").concat(r.index)}),n},[])}function FI(e,t){return fw(fa(e,t))}function vg(e,t){var n=e.inputValue,r=n===void 0?"":n,o=t.data,s=t.isSelected,i=t.label,l=t.value;return(!vw(e)||!s)&&gw(e,{label:i,value:l,data:o},r)}function LI(e,t){var n=e.focusedValue,r=e.selectValue,o=r.indexOf(n);if(o>-1){var s=t.indexOf(n);if(s>-1)return n;if(o<t.length)return t[o]}return null}function UI(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}var Qc=function(t,n){var r,o=(r=t.find(function(s){return s.data===n}))===null||r===void 0?void 0:r.id;return o||null},pw=function(t,n){return t.getOptionLabel(n)},ul=function(t,n){return t.getOptionValue(n)};function hw(e,t,n){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(t,n):!1}function mw(e,t,n){if(n.indexOf(t)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(t,n);var r=ul(e,t);return n.some(function(o){return ul(e,o)===r})}function gw(e,t,n){return e.filterOption?e.filterOption(t,n):!0}var vw=function(t){var n=t.hideSelectedOptions,r=t.isMulti;return n===void 0?r:n},VI=1,jp=function(e){oO(n,e);var t=aO(n);function n(r){var o;if(nO(this,n),o=t.call(this,r),o.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},o.blockOptionHover=!1,o.isComposing=!1,o.commonProps=void 0,o.initialTouchX=0,o.initialTouchY=0,o.openAfterFocus=!1,o.scrollToFocusedOptionOnUpdate=!1,o.userIsDragging=void 0,o.isAppleDevice=EI(),o.controlRef=null,o.getControlRef=function(c){o.controlRef=c},o.focusedOptionRef=null,o.getFocusedOptionRef=function(c){o.focusedOptionRef=c},o.menuListRef=null,o.getMenuListRef=function(c){o.menuListRef=c},o.inputRef=null,o.getInputRef=function(c){o.inputRef=c},o.focus=o.focusInput,o.blur=o.blurInput,o.onChange=function(c,u){var d=o.props,f=d.onChange,p=d.name;u.name=p,o.ariaOnChange(c,u),f(c,u)},o.setValue=function(c,u,d){var f=o.props,p=f.closeMenuOnSelect,y=f.isMulti,m=f.inputValue;o.onInputChange("",{action:"set-value",prevInputValue:m}),p&&(o.setState({inputIsHiddenAfterUpdate:!y}),o.onMenuClose()),o.setState({clearFocusValueOnUpdate:!0}),o.onChange(c,{action:u,option:d})},o.selectOption=function(c){var u=o.props,d=u.blurInputOnSelect,f=u.isMulti,p=u.name,y=o.state.selectValue,m=f&&o.isOptionSelected(c,y),h=o.isOptionDisabled(c,y);if(m){var x=o.getOptionValue(c);o.setValue(y.filter(function(v){return o.getOptionValue(v)!==x}),"deselect-option",c)}else if(!h)f?o.setValue([].concat(up(y),[c]),"select-option",c):o.setValue(c,"select-option");else{o.ariaOnChange(c,{action:"select-option",option:c,name:p});return}d&&o.blurInput()},o.removeValue=function(c){var u=o.props.isMulti,d=o.state.selectValue,f=o.getOptionValue(c),p=d.filter(function(m){return o.getOptionValue(m)!==f}),y=Vi(u,p,p[0]||null);o.onChange(y,{action:"remove-value",removedValue:c}),o.focusInput()},o.clearValue=function(){var c=o.state.selectValue;o.onChange(Vi(o.props.isMulti,[],null),{action:"clear",removedValues:c})},o.popValue=function(){var c=o.props.isMulti,u=o.state.selectValue,d=u[u.length-1],f=u.slice(0,u.length-1),p=Vi(c,f,f[0]||null);o.onChange(p,{action:"pop-value",removedValue:d})},o.getFocusedOptionId=function(c){return Qc(o.state.focusableOptionsWithIds,c)},o.getFocusableOptionsWithIds=function(){return gg(fa(o.props,o.state.selectValue),o.getElementId("option"))},o.getValue=function(){return o.state.selectValue},o.cx=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return NP.apply(void 0,[o.props.classNamePrefix].concat(u))},o.getOptionLabel=function(c){return pw(o.props,c)},o.getOptionValue=function(c){return ul(o.props,c)},o.getStyles=function(c,u){var d=o.props.unstyled,f=OI[c](u,d);f.boxSizing="border-box";var p=o.props.styles[c];return p?p(f,u):f},o.getClassNames=function(c,u){var d,f;return(d=(f=o.props.classNames)[c])===null||d===void 0?void 0:d.call(f,u)},o.getElementId=function(c){return"".concat(o.state.instancePrefix,"-").concat(c)},o.getComponents=function(){return J$(o.props)},o.buildCategorizedOptions=function(){return fa(o.props,o.state.selectValue)},o.getCategorizedOptions=function(){return o.props.menuIsOpen?o.buildCategorizedOptions():[]},o.buildFocusableOptions=function(){return fw(o.buildCategorizedOptions())},o.getFocusableOptions=function(){return o.props.menuIsOpen?o.buildFocusableOptions():[]},o.ariaOnChange=function(c,u){o.setState({ariaSelection:H({value:c},u)})},o.onMenuMouseDown=function(c){c.button===0&&(c.stopPropagation(),c.preventDefault(),o.focusInput())},o.onMenuMouseMove=function(c){o.blockOptionHover=!1},o.onControlMouseDown=function(c){if(!c.defaultPrevented){var u=o.props.openMenuOnClick;o.state.isFocused?o.props.menuIsOpen?c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&o.onMenuClose():u&&o.openMenu("first"):(u&&(o.openAfterFocus=!0),o.focusInput()),c.target.tagName!=="INPUT"&&c.target.tagName!=="TEXTAREA"&&c.preventDefault()}},o.onDropdownIndicatorMouseDown=function(c){if(!(c&&c.type==="mousedown"&&c.button!==0)&&!o.props.isDisabled){var u=o.props,d=u.isMulti,f=u.menuIsOpen;o.focusInput(),f?(o.setState({inputIsHiddenAfterUpdate:!d}),o.onMenuClose()):o.openMenu("first"),c.preventDefault()}},o.onClearIndicatorMouseDown=function(c){c&&c.type==="mousedown"&&c.button!==0||(o.clearValue(),c.preventDefault(),o.openAfterFocus=!1,c.type==="touchend"?o.focusInput():setTimeout(function(){return o.focusInput()}))},o.onScroll=function(c){typeof o.props.closeMenuOnScroll=="boolean"?c.target instanceof HTMLElement&&ec(c.target)&&o.props.onMenuClose():typeof o.props.closeMenuOnScroll=="function"&&o.props.closeMenuOnScroll(c)&&o.props.onMenuClose()},o.onCompositionStart=function(){o.isComposing=!0},o.onCompositionEnd=function(){o.isComposing=!1},o.onTouchStart=function(c){var u=c.touches,d=u&&u.item(0);d&&(o.initialTouchX=d.clientX,o.initialTouchY=d.clientY,o.userIsDragging=!1)},o.onTouchMove=function(c){var u=c.touches,d=u&&u.item(0);if(d){var f=Math.abs(d.clientX-o.initialTouchX),p=Math.abs(d.clientY-o.initialTouchY),y=5;o.userIsDragging=f>y||p>y}},o.onTouchEnd=function(c){o.userIsDragging||(o.controlRef&&!o.controlRef.contains(c.target)&&o.menuListRef&&!o.menuListRef.contains(c.target)&&o.blurInput(),o.initialTouchX=0,o.initialTouchY=0)},o.onControlTouchEnd=function(c){o.userIsDragging||o.onControlMouseDown(c)},o.onClearIndicatorTouchEnd=function(c){o.userIsDragging||o.onClearIndicatorMouseDown(c)},o.onDropdownIndicatorTouchEnd=function(c){o.userIsDragging||o.onDropdownIndicatorMouseDown(c)},o.handleInputChange=function(c){var u=o.props.inputValue,d=c.currentTarget.value;o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange(d,{action:"input-change",prevInputValue:u}),o.props.menuIsOpen||o.onMenuOpen()},o.onInputFocus=function(c){o.props.onFocus&&o.props.onFocus(c),o.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(o.openAfterFocus||o.props.openMenuOnFocus)&&o.openMenu("first"),o.openAfterFocus=!1},o.onInputBlur=function(c){var u=o.props.inputValue;if(o.menuListRef&&o.menuListRef.contains(document.activeElement)){o.inputRef.focus();return}o.props.onBlur&&o.props.onBlur(c),o.onInputChange("",{action:"input-blur",prevInputValue:u}),o.onMenuClose(),o.setState({focusedValue:null,isFocused:!1})},o.onOptionHover=function(c){if(!(o.blockOptionHover||o.state.focusedOption===c)){var u=o.getFocusableOptions(),d=u.indexOf(c);o.setState({focusedOption:c,focusedOptionId:d>-1?o.getFocusedOptionId(c):null})}},o.shouldHideSelectedOptions=function(){return vw(o.props)},o.onValueInputFocus=function(c){c.preventDefault(),c.stopPropagation(),o.focus()},o.onKeyDown=function(c){var u=o.props,d=u.isMulti,f=u.backspaceRemovesValue,p=u.escapeClearsValue,y=u.inputValue,m=u.isClearable,h=u.isDisabled,x=u.menuIsOpen,v=u.onKeyDown,g=u.tabSelectsValue,b=u.openMenuOnFocus,S=o.state,_=S.focusedOption,j=S.focusedValue,C=S.selectValue;if(!h&&!(typeof v=="function"&&(v(c),c.defaultPrevented))){switch(o.blockOptionHover=!0,c.key){case"ArrowLeft":if(!d||y)return;o.focusValue("previous");break;case"ArrowRight":if(!d||y)return;o.focusValue("next");break;case"Delete":case"Backspace":if(y)return;if(j)o.removeValue(j);else{if(!f)return;d?o.popValue():m&&o.clearValue()}break;case"Tab":if(o.isComposing||c.shiftKey||!x||!g||!_||b&&o.isOptionSelected(_,C))return;o.selectOption(_);break;case"Enter":if(c.keyCode===229)break;if(x){if(!_||o.isComposing)return;o.selectOption(_);break}return;case"Escape":x?(o.setState({inputIsHiddenAfterUpdate:!1}),o.onInputChange("",{action:"menu-close",prevInputValue:y}),o.onMenuClose()):m&&p&&o.clearValue();break;case" ":if(y)return;if(!x){o.openMenu("first");break}if(!_)return;o.selectOption(_);break;case"ArrowUp":x?o.focusOption("up"):o.openMenu("last");break;case"ArrowDown":x?o.focusOption("down"):o.openMenu("first");break;case"PageUp":if(!x)return;o.focusOption("pageup");break;case"PageDown":if(!x)return;o.focusOption("pagedown");break;case"Home":if(!x)return;o.focusOption("first");break;case"End":if(!x)return;o.focusOption("last");break;default:return}c.preventDefault()}},o.state.instancePrefix="react-select-"+(o.props.instanceId||++VI),o.state.selectValue=tg(r.value),r.menuIsOpen&&o.state.selectValue.length){var s=o.getFocusableOptionsWithIds(),i=o.buildFocusableOptions(),l=i.indexOf(o.state.selectValue[0]);o.state.focusableOptionsWithIds=s,o.state.focusedOption=i[l],o.state.focusedOptionId=Qc(s,i[l])}return o}return rO(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&ng(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(o){var s=this.props,i=s.isDisabled,l=s.menuIsOpen,c=this.state.isFocused;(c&&!i&&o.isDisabled||c&&l&&!o.menuIsOpen)&&this.focusInput(),c&&i&&!o.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!c&&!i&&o.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ng(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(o,s){this.props.onInputChange(o,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(o){var s=this,i=this.state,l=i.selectValue,c=i.isFocused,u=this.buildFocusableOptions(),d=o==="first"?0:u.length-1;if(!this.props.isMulti){var f=u.indexOf(l[0]);f>-1&&(d=f)}this.scrollToFocusedOptionOnUpdate=!(c&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:u[d],focusedOptionId:this.getFocusedOptionId(u[d])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(o){var s=this.state,i=s.selectValue,l=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var c=i.indexOf(l);l||(c=-1);var u=i.length-1,d=-1;if(i.length){switch(o){case"previous":c===0?d=0:c===-1?d=u:d=c-1;break;case"next":c>-1&&c<u&&(d=c+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:i[d]})}}}},{key:"focusOption",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,i=this.state.focusedOption,l=this.getFocusableOptions();if(l.length){var c=0,u=l.indexOf(i);i||(u=-1),o==="up"?c=u>0?u-1:l.length-1:o==="down"?c=(u+1)%l.length:o==="pageup"?(c=u-s,c<0&&(c=0)):o==="pagedown"?(c=u+s,c>l.length-1&&(c=l.length-1)):o==="last"&&(c=l.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:l[c],focusedValue:null,focusedOptionId:this.getFocusedOptionId(l[c])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Yc):H(H({},Yc),this.props.theme):Yc}},{key:"getCommonProps",value:function(){var o=this.clearValue,s=this.cx,i=this.getStyles,l=this.getClassNames,c=this.getValue,u=this.selectOption,d=this.setValue,f=this.props,p=f.isMulti,y=f.isRtl,m=f.options,h=this.hasValue();return{clearValue:o,cx:s,getStyles:i,getClassNames:l,getValue:c,hasValue:h,isMulti:p,isRtl:y,options:m,selectOption:u,selectProps:f,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var o=this.state.selectValue;return o.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var o=this.props,s=o.isClearable,i=o.isMulti;return s===void 0?i:s}},{key:"isOptionDisabled",value:function(o,s){return hw(this.props,o,s)}},{key:"isOptionSelected",value:function(o,s){return mw(this.props,o,s)}},{key:"filterOption",value:function(o,s){return gw(this.props,o,s)}},{key:"formatOptionLabel",value:function(o,s){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,l=this.state.selectValue;return this.props.formatOptionLabel(o,{context:s,inputValue:i,selectValue:l})}else return this.getOptionLabel(o)}},{key:"formatGroupLabel",value:function(o){return this.props.formatGroupLabel(o)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var o=this.props,s=o.isDisabled,i=o.isSearchable,l=o.inputId,c=o.inputValue,u=o.tabIndex,d=o.form,f=o.menuIsOpen,p=o.required,y=this.getComponents(),m=y.Input,h=this.state,x=h.inputIsHidden,v=h.ariaSelection,g=this.commonProps,b=l||this.getElementId("input"),S=H(H(H({"aria-autocomplete":"list","aria-expanded":f,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":p,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},f&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?(v==null?void 0:v.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?w.createElement(m,G({},g,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:b,innerRef:this.getInputRef,isDisabled:s,isHidden:x,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:d,type:"text",value:c},S)):w.createElement(pI,G({id:b,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:ll,onFocus:this.onInputFocus,disabled:s,tabIndex:u,inputMode:"none",form:d,value:""},S))}},{key:"renderPlaceholderOrValue",value:function(){var o=this,s=this.getComponents(),i=s.MultiValue,l=s.MultiValueContainer,c=s.MultiValueLabel,u=s.MultiValueRemove,d=s.SingleValue,f=s.Placeholder,p=this.commonProps,y=this.props,m=y.controlShouldRenderValue,h=y.isDisabled,x=y.isMulti,v=y.inputValue,g=y.placeholder,b=this.state,S=b.selectValue,_=b.focusedValue,j=b.isFocused;if(!this.hasValue()||!m)return v?null:w.createElement(f,G({},p,{key:"placeholder",isDisabled:h,isFocused:j,innerProps:{id:this.getElementId("placeholder")}}),g);if(x)return S.map(function(E,N){var R=E===_,T="".concat(o.getOptionLabel(E),"-").concat(o.getOptionValue(E));return w.createElement(i,G({},p,{components:{Container:l,Label:c,Remove:u},isFocused:R,isDisabled:h,key:T,index:N,removeProps:{onClick:function(){return o.removeValue(E)},onTouchEnd:function(){return o.removeValue(E)},onMouseDown:function(P){P.preventDefault()}},data:E}),o.formatOptionLabel(E,"value"))});if(v)return null;var C=S[0];return w.createElement(d,G({},p,{data:C,isDisabled:h}),this.formatOptionLabel(C,"value"))}},{key:"renderClearIndicator",value:function(){var o=this.getComponents(),s=o.ClearIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!this.isClearable()||!s||c||!this.hasValue()||u)return null;var f={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,G({},i,{innerProps:f,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var o=this.getComponents(),s=o.LoadingIndicator,i=this.commonProps,l=this.props,c=l.isDisabled,u=l.isLoading,d=this.state.isFocused;if(!s||!u)return null;var f={"aria-hidden":"true"};return w.createElement(s,G({},i,{innerProps:f,isDisabled:c,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator,i=o.IndicatorSeparator;if(!s||!i)return null;var l=this.commonProps,c=this.props.isDisabled,u=this.state.isFocused;return w.createElement(i,G({},l,{isDisabled:c,isFocused:u}))}},{key:"renderDropdownIndicator",value:function(){var o=this.getComponents(),s=o.DropdownIndicator;if(!s)return null;var i=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused,u={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return w.createElement(s,G({},i,{innerProps:u,isDisabled:l,isFocused:c}))}},{key:"renderMenu",value:function(){var o=this,s=this.getComponents(),i=s.Group,l=s.GroupHeading,c=s.Menu,u=s.MenuList,d=s.MenuPortal,f=s.LoadingMessage,p=s.NoOptionsMessage,y=s.Option,m=this.commonProps,h=this.state.focusedOption,x=this.props,v=x.captureMenuScroll,g=x.inputValue,b=x.isLoading,S=x.loadingMessage,_=x.minMenuHeight,j=x.maxMenuHeight,C=x.menuIsOpen,E=x.menuPlacement,N=x.menuPosition,R=x.menuPortalTarget,T=x.menuShouldBlockScroll,k=x.menuShouldScrollIntoView,P=x.noOptionsMessage,D=x.onMenuScrollToTop,F=x.onMenuScrollToBottom;if(!C)return null;var V=function(Y,Z){var J=Y.type,X=Y.data,se=Y.isDisabled,pe=Y.isSelected,M=Y.label,z=Y.value,ve=h===X,ee=se?void 0:function(){return o.onOptionHover(X)},Oe=se?void 0:function(){return o.selectOption(X)},De="".concat(o.getElementId("option"),"-").concat(Z),ie={id:De,onClick:Oe,onMouseMove:ee,onMouseOver:ee,tabIndex:-1,role:"option","aria-selected":o.isAppleDevice?void 0:pe};return w.createElement(y,G({},m,{innerProps:ie,data:X,isDisabled:se,isSelected:pe,key:De,label:M,type:J,value:z,isFocused:ve,innerRef:ve?o.getFocusedOptionRef:void 0}),o.formatOptionLabel(Y.data,"menu"))},Q;if(this.hasOptions())Q=this.getCategorizedOptions().map(function(U){if(U.type==="group"){var Y=U.data,Z=U.options,J=U.index,X="".concat(o.getElementId("group"),"-").concat(J),se="".concat(X,"-heading");return w.createElement(i,G({},m,{key:X,data:Y,options:Z,Heading:l,headingProps:{id:se,data:U.data},label:o.formatGroupLabel(U.data)}),U.options.map(function(pe){return V(pe,"".concat(J,"-").concat(pe.index))}))}else if(U.type==="option")return V(U,"".concat(U.index))});else if(b){var O=S({inputValue:g});if(O===null)return null;Q=w.createElement(f,m,O)}else{var L=P({inputValue:g});if(L===null)return null;Q=w.createElement(p,m,L)}var A={minMenuHeight:_,maxMenuHeight:j,menuPlacement:E,menuPosition:N,menuShouldScrollIntoView:k},W=w.createElement(HP,G({},m,A),function(U){var Y=U.ref,Z=U.placerProps,J=Z.placement,X=Z.maxHeight;return w.createElement(c,G({},m,A,{innerRef:Y,innerProps:{onMouseDown:o.onMenuMouseDown,onMouseMove:o.onMenuMouseMove},isLoading:b,placement:J}),w.createElement(xI,{captureEnabled:v,onTopArrive:D,onBottomArrive:F,lockEnabled:T},function(se){return w.createElement(u,G({},m,{innerRef:function(M){o.getMenuListRef(M),se(M)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:o.getElementId("listbox")},isLoading:b,maxHeight:X,focusedOption:h}),Q)}))});return R||N==="fixed"?w.createElement(d,G({},m,{appendTo:R,controlElement:this.controlRef,menuPlacement:E,menuPosition:N}),W):W}},{key:"renderFormField",value:function(){var o=this,s=this.props,i=s.delimiter,l=s.isDisabled,c=s.isMulti,u=s.name,d=s.required,f=this.state.selectValue;if(d&&!this.hasValue()&&!l)return w.createElement(SI,{name:u,onFocus:this.onValueInputFocus});if(!(!u||l))if(c)if(i){var p=f.map(function(h){return o.getOptionValue(h)}).join(i);return w.createElement("input",{name:u,type:"hidden",value:p})}else{var y=f.length>0?f.map(function(h,x){return w.createElement("input",{key:"i-".concat(x),name:u,type:"hidden",value:o.getOptionValue(h)})}):w.createElement("input",{name:u,type:"hidden",value:""});return w.createElement("div",null,y)}else{var m=f[0]?this.getOptionValue(f[0]):"";return w.createElement("input",{name:u,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var o=this.commonProps,s=this.state,i=s.ariaSelection,l=s.focusedOption,c=s.focusedValue,u=s.isFocused,d=s.selectValue,f=this.getFocusableOptions();return w.createElement(aI,G({},o,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:l,focusedValue:c,isFocused:u,selectValue:d,focusableOptions:f,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var o=this.getComponents(),s=o.Control,i=o.IndicatorsContainer,l=o.SelectContainer,c=o.ValueContainer,u=this.props,d=u.className,f=u.id,p=u.isDisabled,y=u.menuIsOpen,m=this.state.isFocused,h=this.commonProps=this.getCommonProps();return w.createElement(l,G({},h,{className:d,innerProps:{id:f,onKeyDown:this.onKeyDown},isDisabled:p,isFocused:m}),this.renderLiveRegion(),w.createElement(s,G({},h,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:p,isFocused:m,menuIsOpen:y}),w.createElement(c,G({},h,{isDisabled:p}),this.renderPlaceholderOrValue(),this.renderInput()),w.createElement(i,G({},h,{isDisabled:p}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(o,s){var i=s.prevProps,l=s.clearFocusValueOnUpdate,c=s.inputIsHiddenAfterUpdate,u=s.ariaSelection,d=s.isFocused,f=s.prevWasFocused,p=s.instancePrefix,y=o.options,m=o.value,h=o.menuIsOpen,x=o.inputValue,v=o.isMulti,g=tg(m),b={};if(i&&(m!==i.value||y!==i.options||h!==i.menuIsOpen||x!==i.inputValue)){var S=h?FI(o,g):[],_=h?gg(fa(o,g),"".concat(p,"-option")):[],j=l?LI(s,g):null,C=UI(s,S),E=Qc(_,C);b={selectValue:g,focusedOption:C,focusedOptionId:E,focusableOptionsWithIds:_,focusedValue:j,clearFocusValueOnUpdate:!1}}var N=c!=null&&o!==i?{inputIsHidden:c,inputIsHiddenAfterUpdate:void 0}:{},R=u,T=d&&f;return d&&!T&&(R={value:Vi(v,g,g[0]||null),options:g,action:"initial-input-focus"},T=!f),(u==null?void 0:u.action)==="initial-input-focus"&&(R=null),H(H(H({},b),N),{},{prevProps:o,ariaSelection:R,prevWasFocused:T})}}]),n}(w.Component);jp.defaultProps=DI;var BI=w.forwardRef(function(e,t){var n=kb(e);return w.createElement(jp,G({ref:t},n))}),Cp=BI;const zI=`, ${new Date().getFullYear()}`;function yg({creditResource:e,resource:t,short:n=!1}){const{base:r,current:o}=t.exchangeRates;if(o.unitCost>=r.unitCost)return;const s=o.endDate?"calendar3":"people-fill",i=o.endDate?"primary":"success";let c=`${Math.round(100*(r.unitCost-o.unitCost)/r.unitCost)}% off`,u=c;if(o.endDate){const d=o.endDate?` until ${jr(o.endDate).replace(zI,"")}`:"";n||(c+=d),u+=d}else n||(c+=" for you"),u+=o.institutionType?` for researchers from ${o.institutionType}`:" for you";return u+=`: ${hx(t.unit,o.unitCost,e.name)}`,a.jsxs("span",{className:`badge text-bg-${i} ms-2`,title:u,style:{cursor:"help"},children:[a.jsx("i",{className:`bi bi-${s} me-1`}),c]})}function go({bg:e="dark",children:t,color:n="light",fontWeight:r="bold",icon:o="info-circle-fill",initial:s=!1,maxWidth:i="200px",padding:l="10px",placement:c,target:u,trigger:d="click",visible:f=!0}){const p=typeof s=="string"||s instanceof String,[y,m]=w.useState(p?localStorage.getItem(s)!="true":s),[h,x]=w.useState(!1);w.useEffect(()=>{setTimeout(()=>x(!0),100)},[]);const v=()=>{p&&localStorage.setItem(s,"true")},g=a.jsxs(Ul,{style:{"--bs-tooltip-bg":`var(--bs-${e})`,"--bs-tooltip-color":`var(--bs-${n})`,"--bs-tooltip-max-width":i,"--bs-tooltip-padding-x":l,"--bs-tooltip-padding-y":l,fontWeight:r},children:[a.jsx("button",{"aria-label":"Close",onClick:()=>{v(),m(!1)},style:{background:"transparent",border:"0 none transparent",float:"right"},children:a.jsx("i",{className:"bi bi-x-lg"})}),t]});return u&&u.current?a.jsx(Eb,{target:u.current,placement:c,show:y&&f&&h,children:g}):a.jsx(cp,{placement:c,onToggle:b=>{v(),m(b)},overlay:g,show:y&&f&&h,trigger:d,children:a.jsx("button",{className:"btn bnt-clear border-0",style:{backgroundColor:"transparent"},children:a.jsx("i",{className:`bi bi-${o}`})})})}function qI({resources:e}){const t=e.filter(s=>{const{base:i,current:l}=s.exchangeRates;return l.unitCost<i.unitCost});if(!t.length)return;const n=[],r=[];for(let s of t){let{name:i,favicon:l}=s.resourceProvider;n.includes(i)||(n.push(i),r.push(l))}const o=r.map((s,i)=>a.jsx("span",{className:"d-inline-block border me-1",style:{backgroundColor:"white",backgroundImage:`url(${s})`,backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"16px 16px",borderRadius:"24px",height:"24px",verticalAlign:"middle",width:"24px"},title:n[i]},n[i]));return a.jsx("span",{className:"d-flex justify-content-between align-items-center p-2 border-start border-end bg-secondary-subtle text-decoration-none fw-normal",children:a.jsxs("span",{children:[o,"Browse the list below to see discounts on"," ",Ke(t.length)," ",Wa("resources",t.length)," from"," ",Ke(n.length)," ",Wa("resource providers",n.length),"!"]})})}const HI="_items_c2dbg_1",WI="_item_c2dbg_1",KI="_details_c2dbg_14",GI="_text_c2dbg_20",YI="_number_c2dbg_35",QI="_outer_c2dbg_50",XI="_inner_c2dbg_61",xn={items:HI,item:WI,details:KI,text:GI,number:YI,outer:QI,inner:XI},os=(e,t)=>`${Math.cos(2*Math.PI*e)*t} ${Math.sin(2*Math.PI*e)*t}`;function ZI({requestId:e,grantNumber:t,creditColorClass:n="gray-300",colorClasses:r=Ju}){const{request:o}=at(e,t);if(!o)return;let s=0,i;const l=[];for(let p of o.resources)p.isBoolean||(p.isCredit?i=p:l.push(p),s+=ed(p));const c=[],u=[];let d=-.25;const f=[...l,i].map((p,y)=>{if(!p)return null;const m=y+1,x=ed(p)/s,v=p.requested-p.used,g=Math.max(0,v),b=p.isCredit?s/p.exchangeRates.base.unitCost:p.requested,S=b==0?0:100*g/b,j=`var(--bs-${p.isCredit?n:r[y%r.length]})`;if(x>0){const C=d,E=d+x/2,N=d+=x,R=x>.5?1:0,T=[`M ${os(C,100)}`,`A 100 100 0 ${R} 1 ${os(N,100)}`,`L ${os(N,50)}`,`A 50 50 0 ${R} 0 ${os(C,50)}`].join(" "),[k,P]=os(E,75).split(" ").map(D=>parseFloat(D));c.push(a.jsx("path",{d:T,style:{fill:j}},p.resourceId)),u.push(a.jsx("circle",{cx:k,cy:P,r:"8",fill:"black"},`${p.resourceId}-circle`),a.jsx("text",{x:k-4,y:P+4,fill:"white",className:xn.number,children:m},`${p.resourceId}-text`))}return p.isCredit&&u.push(a.jsx("foreignObject",{x:"-50",y:"-50",width:"100",height:"100",children:a.jsx("div",{className:xn.text,children:a.jsxs("div",{children:[a.jsx("strong",{children:Ke(g,{abbreviate:!0})}),p.unit," available"]})})},"center-text")),a.jsxs("li",{className:xn.item,children:[a.jsx("span",{className:xn.number,children:m}),a.jsx("span",{className:`${xn.outer} ms-2 me-2`,style:{borderColor:j},children:a.jsx("span",{className:xn.inner,style:{backgroundColor:j,width:`${S}%`}})}),a.jsxs("strong",{className:xn.name,children:[a.jsx(Rr,{resource:p,userGuide:!1}),": "]}),a.jsxs("span",{className:xn.details,children:[Ke(v,{abbreviate:!0})," ",p.isCredit?null:a.jsxs(a.Fragment,{children:["of ",Ke(b,{abbreviate:!0})," "]}),p.unit," ",p.isCredit?"available":"remaining"," (",Math.round(S),"%)"]})]},p.resourceId)});return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-lg-3 mb-3 d-flex flex-row align-items-center justify-content-center",children:a.jsxs("svg",{version:"1.1",viewBox:"-100 -100 200 200",width:"200",height:"200",xmlns:"http://www.w3.org/2000/svg",children:[c,u]})}),a.jsx("div",{className:"col-lg-9 mb-3 d-flex flex-column justify-content-center",children:a.jsx("ul",{className:xn.items,children:f})})]})}const xg=e=>e;function JI({classes:e,clean:t=xg,format:n=xg,label:r,setValue:o,style:s,value:i}){const l=n(i),[c,u]=w.useState(l);return w.useEffect(()=>{u(l)},[l]),a.jsx("input",{type:"text","aria-label":r,className:`form-control ${e}`,value:c,style:s,onChange:d=>u(d.target.value),onBlur:d=>{const f=t(d.target.value);u(n(f)),o(f)},onKeyDown:d=>{d.code=="Enter"&&(d.preventDefault(),d.target.blur())}})}function eA({requestId:e,grantNumber:t}){const{request:n,addResource:r,openUsageDetailModal:o,resetResources:s,setResourceRequest:i,setResourcesReason:l,statuses:c,toggleActionsModal:u,toggleConfirmModal:d,toggleResourcesModal:f}=at(e,t),{project:p}=Et(t||n&&n.grantNumber),y=w.useRef(null),m=w.useRef(null);if(!n||!p)return;const h="Exchange"in n.allowedActions,x="Renewal"in n.allowedActions,v="Supplement"in n.allowedActions,g=n.exchangeStatus==c.pending,b=n.exchangeStatus==c.success,S=n.exchangeStatus==c.error,_=n.exchangeErrors,j=n.exchangeActionId!==null,C=n.exchangeActionEditable,E=n.resources,N=n.resourcesReason,R={};for(let M of E)R[M.resourceId]=M;const T=()=>{mx(n)>=.75?u():d()},k=[];for(let M of E){let z=[];if(M.requested>0){for(let ve of M.requires||[]){let ee=R[ve];if(ee){if(ee.requested>0){z=[];break}z.push(ee)}}z.length&&k.push(a.jsxs("span",{children:[a.jsx(Rr,{resource:M,userGuide:!1})," requires"," ",px(z.map(ve=>a.jsx(Rr,{resource:ve,userGuide:!1},ve.resourceId)),"or"),"."]},M.resourceId))}}const P=k.length>0;let D;b?D=a.jsx(be,{color:"info",children:"Your exchange request has been submitted."}):S&&_.length>0&&_[0].includes("PI")&&_[0].includes("person status Unknown")?D=a.jsx(be,{color:"danger",children:p.currentUser.role==="pi"?a.jsxs(a.Fragment,{children:["Please"," ",a.jsx("a",{href:te.routes.profile_path(),children:"update your academic status"})," ","before making an exchange request."]}):a.jsxs(a.Fragment,{children:["The primary investigator for this project has an unknown academic status. Please ask"," ",p.users.filter(M=>M.role==="pi").map(M=>`${M.firstName} ${M.lastName}`)," ","to update the academic status in their profile, and then try again."]})}):S?D=a.jsxs(be,{color:"danger",children:["Sorry, something went wrong: ",_.join(", "),". For assistance, please"," ",a.jsx("a",{href:"https://support.access-ci.org/open-a-ticket",children:"open a help ticket"})," ","and include this message."]}):j?D=a.jsx(be,{color:"warning",children:"You have an exchange request under review. The information below reflects the pending exchange request."}):n.timeStatus=="current"&&!p.isManager?D=a.jsxs(be,{color:"warning",children:["You do not have permission to manage resources for this project. Please contact ",Df(p)," to request a change."]}):P&&(D=a.jsxs(be,{color:"warning",children:[k," Please adjust your balance values."]}));const F=N.length>0;let V=!1,Q=!1;for(let M of E)if(M.isNew&&(V=!0),M.allocated!=M.requested&&(Q=!0),V&&Q)break;const O=E.map(M=>M.resourceId),L={},A=h&&C?n.allowedActions.Exchange.resources.filter(M=>!O.includes(M.resourceId)).map(M=>{L[M.resourceId]=M;const z=Pl(M.name),ve=z.short?`${z.short} (${z.full.replace(/ \([^(]+\)/,"")})`:z.full;return{value:M.resourceId,label:ve}}):[],W=h?n.allowedActions.Exchange.resources.map(M=>M.resourceId):[];let U;const Y=[],Z=[];for(let M of E)M.isCredit?U=M:(Y.push(M),Z.push(C&&(M.isNew||M.allocated!=M.requested)?Cr.edited:W.includes(M.resourceId)?"":Cr.disabled));const J=`Add ${Y.length?"another":"a"} resource to your exchange...`,X=M=>M.requested-M.used,se=(M,z)=>{const ve=z.allocated-z.used,ee=ho(Number(M.replace(/[^0-9-.]/g,"")),z.decimalPlaces),Oe=Math.min(0,ve);if(ee<Oe)return Oe;let De=U.requested*U.exchangeRates.base.unitCost;const ie=(z.allocated-z.requested)*z.exchangeRates.base.unitCost,Ot=Math.min(De,ie);De-=Ot;let lt=z.requested-z.used+Ot/z.exchangeRates.base.unitCost;return De>0&&(lt+=De/z.exchangeRates.current.unitCost),ee>lt?ho(lt,z.decimalPlaces,"floor"):ee},pe=[{key:"name",name:"Resource",format:(M,z)=>a.jsx(Rr,{resource:z}),width:Math.min(350,window.innerWidth*.3)},{key:"isActive",name:"Status",format:(M,z)=>a.jsx(Oo,{status:M?"Active":z.isNew?"New":"Inactive"}),width:100},{key:"unit",name:"Unit",width:150,format:(M,z)=>z.isBoolean?a.jsx(a.Fragment,{children:"—"}):[a.jsx("abbr",{title:hx(M,z.exchangeRates.base.unitCost,U.name),children:M},"base"),a.jsx(yg,{creditResource:U,resource:z,short:!0},"discount")]},{key:"used",name:"Usage",class:"text-end",format:(M,z)=>z.isBoolean?a.jsx(a.Fragment,{children:"—"}):a.jsxs(a.Fragment,{children:[Ke(M),(p.currentUser.resourceIds.includes(z.resourceId)||p.currentUser.resourceAccountInactiveIds.includes(z.resourceId))&&a.jsx(nl,{icon:"table",onClick:()=>o(z.resourceRepositoryKey),target:"_blank",title:`${z.name} Usage Details`})]})}];return h&&pe.push({key:"requested",name:"Balance",class:"text-end",rowClass:M=>C&&W.includes(M.resourceId)?Cr.input:"",format:(M,z)=>{const ve=C&&W.includes(z.resourceId);return z.isBoolean?a.jsx("input",{className:"form-check-input",type:"checkbox",checked:M==1,disabled:!ve,onChange:ee=>i(z.resourceId,ee.target.checked?1:0)}):ve?a.jsx(JI,{classes:"text-end w-100",clean:ee=>se(ee,z),format:Ke,label:`Balance for ${z.name}`,setValue:ee=>{i(z.resourceId,ee+z.used)},style:{padding:"0.1rem 0.5rem"},value:X(z)}):Ke(X(z))},formatHeader:M=>a.jsxs(a.Fragment,{children:[M,C?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.requestedAllocation",placement:"top-end",visible:p.tab=="resources",children:"You can increase or decrease the balance below to change your allocation on a resource. Enter the total amount you would like to have available once the exchange is complete."}):null]})}),a.jsxs("div",{className:"resources",children:[D,E.length?a.jsx(ZI,{requestId:e}):null,U&&(h||x||v)?a.jsxs("h2",{className:"mb-1 mt-2 d-flex justify-content-between",children:[a.jsxs("span",{children:[cr(te.resourceTypeIcons.credit)," ",Ke(U.requested,U)," ",U.unit," available to exchange"]}),x||v?a.jsxs("button",{type:"button",className:"btn btn-sm btn-primary ms-2",onClick:T,children:[cr(te.resourceTypeIcons.credit)," Request More"," ",n.usesCredits?"Credits":"Units"]}):null]}):null,Y.length?a.jsx(Ln,{columns:pe,rows:Y,rowClasses:Z,classes:A.length?"mb-0":"",frozenColumns:2,minWidth:"800px"}):a.jsx("div",{className:"card p-2 text-bg-light p-3",children:"This project does not have any resources."}),A.length?a.jsxs(a.Fragment,{children:[a.jsx(qI,{resources:h&&n.allowedActions.Exchange.resources||[]}),a.jsx("div",{className:"p-2",style:{backgroundColor:"var(--teal-200)",border:"1px solid #cccccc",marginTop:"-1px"},ref:y,children:a.jsx(Cp,{classNames:{control:()=>"react-select mb-1"},options:A,onChange:M=>r(M.value),placeholder:J,value:null,"aria-label":J,formatOptionLabel:({value:M,label:z})=>[z,a.jsx(yg,{creditResource:U,resource:L[M]},"discount")]})}),Y.length?null:a.jsx(go,{bg:"secondary",color:"dark",visible:p.tab=="resources",initial:!0,target:y,children:"Ready to get started? Search for a resource to add it to your project."}),a.jsxs("p",{className:"text-black-50",style:{fontSize:"0.9rem"},children:["Need help choosing a resource? Visit our"," ",a.jsx("a",{href:te.routes.resources_path(),children:"Resource Catalog"}),"."]})]}):null,h&&C?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:"resources-reason",className:"form-label required",children:"Please briefly explain how the requested resources and amounts will contribute to your research."}),a.jsx("textarea",{className:"form-control",id:"resources-reason",rows:"2",value:N,onChange:M=>l(M.target.value),style:{minHeight:"3rem"}})]}),a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:g||!Q&&!F&&!V,onClick:s,children:"Reset Form"}),a.jsx("button",{ref:m,type:"button",className:"btn btn-secondary",disabled:g||!Q||!F||P,onClick:f,children:g?"Submitting...":"Submit for Approval"})]}),Q&&!P?a.jsx(go,{bg:"secondary",color:"dark",initial:"myprojects.submitExchange",maxWidth:"390px",placement:"right",target:m,visible:p.tab=="resources",children:"When you are finished adding resources, enter a justification for the requested resources above. Then you can submit your exchange for approval."}):null]}):null]})}function tA({question:e,requestId:t,grantNumber:n}){const{request:r,setResourceQuestionValues:o}=at(t,n),s=w.useId();if(!e||!r||r.error)return;const{attributeSetId:i,attributes:l,fieldType:c,label:u,resourceId:d,values:f}=e,p=l[0],y=p.required?"required":"",m=b=>o(d,i,b.target.value?[b.target.value]:[]),h=b=>{o(d,i,Array.from(b.target.options).filter(({selected:S})=>S).map(({value:S})=>parseInt(S,10)))},x=b=>{const S=parseInt(b.target.value,10),_=b.target.checked?[...f,S]:f.filter(j=>j!=S);o(d,i,_)},v=b=>{const S=parseInt(b.target.value);o(d,i,isNaN(S)?[]:[S])};let g;if(["calendar","integer_only","text"].includes(c)){const b={calendar:"date",integer_only:"number",text:"text"}[c];g=a.jsx("input",{className:"form-control",id:s,type:b,placeholder:p.label,required:p.required,value:f[0]||"",onChange:c=="integer_only"?v:m})}else if(c=="textarea")g=a.jsx("textarea",{className:"form-control",id:s,placeholder:p.label,required:p.required,value:f[0]||"",onChange:m});else if(c=="drop_down"||l.length>=10){const b=c=="multi_sel";g=a.jsxs("select",{id:s,className:"form-select",required:p.required,multiple:b,onChange:b?h:v,value:b?f:f[0]||"",children:[b?null:a.jsx("option",{}),l.map(S=>a.jsx("option",{value:S.resourceAttributeId,children:S.label},S.resourceAttributeId))]})}else g=a.jsx("div",{id:s,children:l.map(b=>{const S=`resource-attribute-${b.resourceAttributeId}`;return a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:c=="single_sel"?"radio":"checkbox",id:S,value:b.resourceAttributeId,checked:f.includes(b.resourceAttributeId),onChange:c=="single_sel"?v:x}),a.jsx("label",{className:"form-check-label",htmlFor:S,children:b.label})]},b.resourceAttributeId)})});return a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{htmlFor:s,className:`form-label ${y}`,children:u}),g]})}function nA({requestId:e,grantNumber:t}){const{request:n,saveResources:r,toggleResourcesModal:o}=at(e,t),{project:s}=Et(t||n.grantNumber);if(!n||!s||n.error||s.error)return;const i=[],l=n.resources.filter(u=>u.allocated!=u.requested).map(u=>{const d=u.requested-u.allocated;return u.questions&&i.push(...u.questions),a.jsxs("li",{className:"list-group-item d-flex justify-content-between align-items-center mb-0",children:[u.name,a.jsx("span",{className:`badge bg-${d>0?"primary":"danger"} rounded-pill`,children:u.isBoolean?Mf(u.requested):a.jsxs(a.Fragment,{children:[d>0?"+":"",Ke(d,u)," ",u.unit]})})]},u.resourceId)}),c=i.some(({attributes:u,values:d})=>d.length==0&&u[0].required);return a.jsxs(ge,{size:"lg",show:n.showResourcesModal,onHide:o,scrollable:!0,children:[a.jsx(ge.Header,{closeButton:!0,children:a.jsx(ge.Title,{children:"Complete Your Exchange"})}),a.jsxs(ge.Body,{children:[a.jsx("p",{children:"Please review your exchange to make sure it includes all the resources you need. Once you submit it, you will not be able to request another exchange until this one has been processed by the resource providers."}),a.jsx("ul",{className:"list-group mb-3",children:l}),i.length?a.jsxs(a.Fragment,{children:[a.jsx("h2",{children:"Resource Questions"}),a.jsx("p",{children:"Some of the resources you selected have associated questions. Please answer the questions below."}),i.map(u=>a.jsx(tA,{question:u,requestId:e,grantNumber:t},u.attributeSetId))]}):null]}),a.jsx(ge.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-primary me-2",onClick:o,children:"Continue Editing"}),a.jsx("button",{type:"button",className:"btn btn-secondary",onClick:r,disabled:c,children:"Submit"})]})})]})}function yw({user:e}){const t=`${e.lastName}, ${e.firstName}`;let n=t,r=[e.organization,e.email].filter(o=>o).join(", ");return r&&(n+=`: ${r}`),a.jsx("abbr",{title:n,children:t})}function rA({requestId:e,grantNumber:t}){const{project:n}=Et(t),{request:r,closeUsageDetailModal:o}=at(e,t);if(!r||r.error||!n||n.error||!r.usageDetailStatus)return;let s,i="Usage";if(r.usageDetailStatus==Le.pending)s=a.jsx(Do,{});else if(r.usageDetailStatus==Le.error)s=a.jsx(be,{color:"danger",children:"An error occurred while loading usage data."});else{const{projectTitle:l,resourceDisplayName:c,resourceRepositoryKey:u,users:d}=r.usageDetail,{full:f,short:p}=Pl(c),y=r.resources.find(v=>v.resourceRepositoryKey==u),m=v=>Ke(v,{decimalPlaces:y?y.decimalPlaces:void 0}),h={};for(let v of n.users)h[v.username]=v;i=a.jsxs(a.Fragment,{children:["Usage: ",p||f," for ",l]});const x=[{key:"name",name:"Name",format:(v,{lastName:g,firstName:b,portalUsername:S})=>{const _=h[S];return _?a.jsx(yw,{user:_}):`${g}, ${b}`}},{key:"portalUsername",name:"Resource Username",format:v=>{const g=h[v],b=g?g.resourceUsernames[y.resourceId]:null;return b||a.jsx(a.Fragment,{children:"—"})}},{key:"role",name:"Role",format:v=>gx[v].name},{key:"lastWeek",name:"Last Week",class:"text-end",format:m},{key:"lastMonth",name:"Last Month",class:"text-end",format:m},{key:"lastQuarter",name:"Last 3 Months",class:"text-end",format:m},{key:"currentRequest",name:"Current Allocation",class:"text-end",format:m},{key:"total",name:"All Time",class:"text-end",format:m}];s=d.length?a.jsx(Ln,{rows:d,columns:x}):a.jsx(be,{color:"info",children:"There is no usage for this resource."})}return a.jsxs(ge,{show:!0,size:"lg",onHide:o,scrollable:!0,children:[a.jsx(ge.Header,{closeButton:!0,children:a.jsx(ge.Title,{children:i})}),a.jsx(ge.Body,{children:s})]})}var oA=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];function sA(e){var t=e.defaultOptions,n=t===void 0?!1:t,r=e.cacheOptions,o=r===void 0?!1:r,s=e.loadOptions;e.options;var i=e.isLoading,l=i===void 0?!1:i,c=e.onInputChange,u=e.filterOption,d=u===void 0?null:u,f=mn(e,oA),p=f.inputValue,y=w.useRef(void 0),m=w.useRef(!1),h=w.useState(Array.isArray(n)?n:void 0),x=Ue(h,2),v=x[0],g=x[1],b=w.useState(typeof p<"u"?p:""),S=Ue(b,2),_=S[0],j=S[1],C=w.useState(n===!0),E=Ue(C,2),N=E[0],R=E[1],T=w.useState(void 0),k=Ue(T,2),P=k[0],D=k[1],F=w.useState([]),V=Ue(F,2),Q=V[0],O=V[1],L=w.useState(!1),A=Ue(L,2),W=A[0],U=A[1],Y=w.useState({}),Z=Ue(Y,2),J=Z[0],X=Z[1],se=w.useState(void 0),pe=Ue(se,2),M=pe[0],z=pe[1],ve=w.useState(void 0),ee=Ue(ve,2),Oe=ee[0],De=ee[1];o!==Oe&&(X({}),De(o)),n!==M&&(g(Array.isArray(n)?n:void 0),z(n)),w.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var ie=w.useCallback(function(gn,en){if(!s)return en();var je=s(gn,en);je&&typeof je.then=="function"&&je.then(en,function(){return en()})},[s]);w.useEffect(function(){n===!0&&ie(_,function(gn){m.current&&(g(gn||[]),R(!!y.current))})},[]);var Ot=w.useCallback(function(gn,en){var je=kP(gn,en,c);if(!je){y.current=void 0,j(""),D(""),O([]),R(!1),U(!1);return}if(o&&J[je])j(je),D(je),O(J[je]),R(!1),U(!1);else{var Vn=y.current={};j(je),R(!0),U(!P),ie(je,function(Bn){m&&Vn===y.current&&(y.current=void 0,R(!1),D(je),O(Bn||[]),U(!1),X(Bn?H(H({},J),{},io({},je,Bn)):J))})}},[o,ie,P,J,c]),lt=W?[]:_&&P?Q:v||[];return H(H({},f),{},{options:lt,isLoading:N||l,onInputChange:Ot,filterOption:d})}var iA=w.forwardRef(function(e,t){var n=sA(e),r=kb(n);return w.createElement(jp,G({ref:t},r))}),aA=iA;const bg=({description:e,disabled:t=!1,onChange:n,selectedLength:r,totalLength:o})=>{const s=w.useRef(),i=w.useId();let l=r==o,c=r>0&&!l;return w.useEffect(()=>{s.current&&(s.current.checked=l,s.current.indeterminate=c)},[l,c]),a.jsxs(a.Fragment,{children:[a.jsx("input",{className:"custom-checkbox form-check-input",disabled:t,id:i,onChange:u=>n(u.target.checked),ref:s,type:"checkbox"}),a.jsx("label",{className:"form-check-label",htmlFor:i,"aria-description":`${l?"Deselect":"Select"} ${e}`})]})};function lA({grantNumber:e,requestId:t}){const{project:n,addUser:r,resetUsers:o,saveUsers:s,setTab:i,setUserRole:l,statuses:c,toggleUsersResources:u}=Et(e),{request:d}=n?at(t||n.currentRequestId,e):{request:null};if(!n||!n.currentRequestId||!d||n.error||d.error)return;const f=n.isManager,p="Exchange"in d.allowedActions,y=n.usersStatus==c.pending,m=n.usersStatus==c.success,h=n.usersStatus==c.error,x=n.users,v=d.resources.filter(sd),g=v.length==0,b=x.find(R=>R.hasChanges)!==void 0,S=x.find(R=>R.role!="pi")!==void 0;let _;m&&!b?_=a.jsx(be,{color:"info",children:"Your changes have been saved. Creation of user accounts can take some time. Users can check the status of their accounts on the Overview tab of the My Projects page."}):h?_=a.jsx(be,{color:"danger",children:"Sorry, your changes could not be saved. Please try again later."}):f?v.length?g&&(_=a.jsx(be,{color:"warning",children:"This project does not have any active resources."})):_=a.jsxs(be,{color:"warning",children:["This project does not have any resources."," ",p?a.jsx("a",{href:te.routes.request_action_path(d.requestId,"new?action_type=Exchange"),onClick:R=>{R.preventDefault(),i("resources")},children:"Exchange credits for resources."}):null," ","Additional users can be added after an exchange is approved."]}):_=a.jsxs(be,{color:"warning",children:["You do not have permission to manage users for this project. Please contact ",Df(n)," to request a change."]});const j=(R,T)=>{let k,P,D,F;if(T.key=="all"){k="all resources for all users",P=V=>u(V),D=0;for(let V of x)D+=V.resourceIds.length;F=x.length*v.length}else k=`all users for ${T.name}`,P=V=>u(V,null,T.key),D=x.filter(({resourceIds:V})=>V.includes(T.key)).length,F=x.length;return a.jsxs(a.Fragment,{children:[T.key=="all"?R:a.jsx(Rr,{resource:T,userGuide:!1}),a.jsx("br",{}),a.jsx(bg,{description:k,disabled:T.disabled,onChange:P,selectedLength:D,totalLength:F})]})},C=$l.map(({role:R,name:T})=>a.jsx("option",{value:R,children:T},R)),E=[{key:"name",name:"Name",width:200,format:(R,T)=>a.jsx(yw,{user:T})},{key:"username",name:"ACCESS Username",width:100},{key:"role",name:"Role",width:100,format:(R,T)=>a.jsx("select",{className:"form-select",value:R,onChange:k=>l(T.username,k.target.value),disabled:!f||R=="pi"||R=="co_pi",style:{position:"absolute",left:0,top:0,bottom:0,right:0,borderWidth:0},children:C.filter(k=>k.key==R||!["pi","co_pi"].includes(k.key))})}];v.length&&E.push({key:"all",name:"All Resources",class:`text-center ${Cr.important}`,disabled:!f||g,width:100,format:(R,T)=>a.jsx(bg,{description:`all users for ${T.name}`,disabled:!f||g,onChange:k=>u(k,T.username),selectedLength:T.resourceIds.length,totalLength:v.length}),formatHeader:j});for(let R of v)E.push({key:R.resourceId,name:R.name,class:"text-center",disabled:!f||!R.isActive,icon:R.icon,format:(T,k)=>a.jsx(a.Fragment,{children:a.jsx("input",{className:"form-check-input",disabled:!f||!R.isActive,onChange:P=>u(P.target.checked,k.username,R.resourceId),type:"checkbox",checked:k.resourceIds.includes(R.resourceId)})}),formatHeader:j});const N=x.map(R=>R.hasChanges?Cr.edited:"");return a.jsxs(a.Fragment,{children:[_,a.jsx(Ln,{rows:x,columns:E,frozenColumns:v.length?4:3,classes:"mb-0",minWidth:"800px",rowClasses:N,scrollRowIndex:n.usersNewRowIndex}),f&&v.length&&!g?a.jsx("div",{style:{marginTop:"-1px",position:"relative",zIndex:100},children:a.jsx(aA,{classNames:{control:()=>"react-select"},loadOptions:async R=>(await $E(R)).map(k=>({isDisabled:k.eligibility==="no",label:a.jsxs("span",{className:"d-flex justify-content-between",children:[a.jsxs("span",{className:k.eligibility==="no"?"text-decoration-line-through":"",style:{color:k.eligibility==="no"?"#707070":void 0},children:[k.username," (",k.firstName," ",k.lastName,","," ",k.organization,k.email?`, ${k.email}`:""]}),k.eligibility==="no"&&k.eligibilityReason&&a.jsxs("span",{className:"text-danger ms-2",children:[a.jsx("i",{className:"bi bi-exclamation-octagon"})," ",k.eligibilityReason]})]}),value:k})),onChange:R=>r(R.value),placeholder:"Add another user...",value:null,"aria-label":"Add another user"})}):null,f&&(v.length&&!g||S)?a.jsxs("div",{className:"d-flex mt-3",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",disabled:y||!b,onClick:o,children:"Reset Form"}),a.jsx("button",{type:"button",className:"btn btn-secondary",disabled:y||!b,onClick:s,children:y?"Saving...":"Save Changes"})]}):null]})}function cA({requestId:e,grantNumber:t}){const{request:n}=at(e,t),{project:r,setRequest:o,setTab:s}=Et(t||n.grantNumber);if(!n)return;if(n.error)return a.jsx(be,{color:"danger",children:n.error});const i=n.timeStatus||n.actions[0].status.toLowerCase(),l=n.actions.find(({showDeleteModal:d})=>d),c=[];n.resources.length||c.push("resources"),e!=r.currentRequestId&&c.push("users");const u=(r.users||[]).filter(d=>d.eligibility==="no"&&d.role!=="user");return a.jsxs("div",{className:"request",children:[n.returnedForCorrections?a.jsxs(be,{color:"warning",children:[a.jsx("p",{children:"Your request has been returned for corrections. These are the notes from the Allocations Team"}),a.jsx("div",{className:aR.returnedForCorrectionsNotes,children:n.returnedForCorrectionsNotes}),a.jsx("p",{className:"mt-3",children:"Please address these issues by clicking the Edit button to edit your request."})]}):"",n.timeStatus!="current"&&!n.returnedForCorrections?a.jsxs(be,{color:"warning",children:["You are viewing ","aeiou".includes(i[0])?"an":"a"," ",i," request."," ",c.length?`You cannot manage ${c.join(" or ")} for this request.`:""," ",r.currentRequestId?a.jsx("a",{href:te.routes.request_path(r.currentRequestId),onClick:d=>{d.preventDefault(),o(r.currentRequestId)},children:"Go to the current request."}):null]}):null,r.isManager&&u.length>0&&a.jsxs(be,{color:"danger",children:["Some project personnel need to update their profiles. You will be unable to submit exchanges, renewals, and other actions until these issues are resolved:",a.jsx("br",{}),a.jsx("ul",{className:"fs-6 mb-0",children:u.map(d=>a.jsxs("li",{children:[a.jsxs("strong",{children:[d.firstName," ",d.lastName," (",d.username,"):"]})," ",d.eligibilityReason]},d.username))})]}),a.jsxs(vN,{activeKey:r.tab,onSelect:s,className:"mt-3 mb-3",children:[a.jsx($i,{eventKey:"overview",title:"Overview",className:"mb-0",children:a.jsx(QT,{requestId:e,grantNumber:t})}),a.jsx($i,{eventKey:"resources",title:n.usesCredits?"Credits + Resources":"Resources",disabled:c.includes("resources"),children:a.jsx(eA,{requestId:e})}),a.jsx($i,{eventKey:"users",title:"Users + Roles",disabled:c.includes("users"),children:a.jsx(lA,{grantNumber:t})}),a.jsx($i,{eventKey:"history",title:"History",children:a.jsx(CT,{requestId:e})})]}),a.jsx(wT,{grantNumber:t,requestId:e}),a.jsx(ST,{grantNumber:t,requestId:e}),a.jsx(_T,{grantNumber:t,requestId:e,actionId:l?l.actionId:null}),a.jsx(nA,{grantNumber:t,requestId:e}),a.jsx(rA,{grantNumber:t,requestId:e})]})}function uA({requestId:e,grantNumber:t}){const{request:n,toggleActionsModal:r,toggleDeleteModal:o}=at(e,t);if(!n)return;const{actions:s,allowedActions:i}=n,l=[];i&&(("Extension"in i||"Renewal"in i)&&l.push(["Extend End Date",u=>{u.preventDefault(),r()},"calendar-plus"]),"Final Report"in i&&l.push(["Submit Final Report",`${te.routes.request_action_path(e,"new")}?action_type=Final+Report`,"file-earmark-check"]));const c=s.find(u=>u.isRequest);if(c){const u=c.allowedOperations||[];u.includes("Edit")&&l.push(["Edit",te.routes.edit_request_path(n.requestId),"pencil"]),u.includes("Delete")&&l.push(["Delete",d=>{d.preventDefault(),o(c.actionId)},"trash","danger"])}return l.map(([u,d,f,p])=>{const y=a.jsxs(a.Fragment,{children:[" ",f&&a.jsx("i",{className:`bi bi-${f} me-1`}),u]});return typeof d=="function"?a.jsx("button",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,onClick:d,children:y},u):a.jsx("a",{className:`btn btn-${p||"primary"} ms-2 text-nowrap`,href:d,children:y},u)})}function dA({open:e=!1,grantNumber:t,title:n,status:r}){const[o,s]=w.useState(e),{project:i,setRequest:l}=Et(t,!o&&n&&r&&!0),c=`project-${t}`;let u=null;if(o&&i)if(i.error)u=a.jsx(be,{color:"danger",children:i.error});else{let d;const f=i.requestsList.map(p=>(p.requestId==i.selectedRequestId&&(d=p),a.jsx("option",{value:p.requestId,children:Af(p)},p.requestId)));u=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"d-flex",children:[a.jsx("select",{className:"form-select","aria-label":"Select a request to display",onChange:p=>l(parseInt(p.target.value,10)),value:i.selectedRequestId,disabled:f.length<2,children:f}),a.jsx(uA,{requestId:i.selectedRequestId,grantNumber:t})]}),d?a.jsx(cA,{...d,grantNumber:t}):null]})}return a.jsxs("div",{className:`${vm.project} card mb-3`,children:[a.jsxs("div",{className:`card-header d-flex justify-content-between ${o?"":"border-bottom-0"}`,children:[a.jsx("button",{"aria-expanded":o,"aria-controls":c,className:vm.expand,onClick:()=>s(!o),children:a.jsxs("h2",{className:"mb-1 mt-1 text-start",children:[a.jsx("i",{className:`bi bi-caret-${o?"down":"right"}-fill`})," ",/^[A-Z]/.test(t)?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"grant-number",children:[t,":"]})," "]}):null,n||i.title]})}),a.jsx(Oo,{status:r||i.status})]}),a.jsx("div",{className:"card-body",id:c,hidden:!o||!i,children:u})]})}function fA({username:e,openFirst:t=1}){const{error:n,loading:r,projects:o}=rR(e);if(r)return a.jsx(Do,{});if(n)return a.jsxs(be,{color:"danger",children:[n," ",a.jsx("a",{href:"#",onClick:i=>{i.preventDefault(),window.location.reload()},children:"Reload the page"})," ","to try again."]});if(!o.length)return a.jsxs("div",{className:"pt-5 pb-5 text-bg-light border border-light-subtle",children:[a.jsx("p",{className:"fs-2 text-center mb-4",children:"You don't have any projects yet."}),a.jsxs("div",{className:"d-flex gap-2 justify-content-center",children:[a.jsxs("a",{className:"btn btn-primary w-25",href:te.routes.project_types_path(),children:[a.jsx("i",{className:"bi bi-boxes fs-1 d-block"})," Learn about Project Types"]}),a.jsxs("a",{className:"btn btn-secondary w-25",href:te.routes.get_your_first_project_path(),children:[a.jsx("i",{className:"bi bi-cpu fs-1 d-block"})," Learn How to Get Your"," ",a.jsx("br",{className:"d-none d-xxl-inline"})," First Project"]}),a.jsxs("a",{className:"btn btn-primary w-25",href:te.routes.how_to_path(),children:[a.jsx("i",{className:"bi bi-person-plus fs-1 d-block"})," Learn How to Join an Existing Project"]})]})]});const s=new URLSearchParams(window.location.hash.slice(1)).get("grantNumber");return o.map((i,l)=>a.jsx(dA,{open:s?s==i.grantNumber:l<t,...i},i.grantNumber))}const xw={apiUrl:null,listIsFiltered:!1,pages:1,projects:[],projectsLoaded:!1,filtersLoaded:!0,showPagination:!1,singleEntry:!1,filters:{org:"",allocationType:"",allFosToggled:!0,resource:"",requestNumber:""},pageData:{current_page:1,last_page:1},typeLists:{orgs:[],fosTypes:[],allocationTypes:[],resources:[]}},pA=Qe("projectsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{const r=window.location.search,o=new URLSearchParams(r);o.has("_requestNumber")&&(n(Ed({name:"requestNumber",value:o.get("_requestNumber")})),n(ww(!0))),await n(jd()),await n(Nr()),n(hA())}),hA=Qe("projectsBrowser/filterCleanup",async(e,{getState:t,dispatch:n})=>{const o=t().projectsBrowser.typeLists;n(bw({...o,orgs:["-- ALL --"].concat(o.orgs)}))}),jd=Qe("projectsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().projectsBrowser.apiUrl}?filters=1`,i=await(await fetch(o)).json();n(bw(i.filters))}),Nr=Qe("projectsBrowser/getProjects",async(e,{getState:t,dispatch:n})=>{const r=t().projectsBrowser,o=r.filters,s=r.typeLists,i=s.fosTypes.filter(d=>d.checked);let l=`${r.apiUrl}?page=${r.pageData.current_page}`;return o.requestNumber!=""?(l+=`&request_number=${o.requestNumber}`,n(wg(!0))):(n(wg(!1)),i.length!=s.fosTypes.length&&(l+=`&fos=${i.map(d=>d.fosTypeId).join(",")}`),o.org!=""&&o.org!="-- ALL --"&&(l+=`&org=${encodeURIComponent(o.org)}`),o.allocationType!=""&&(l+=`&allocation_type=${o.allocationType}`),o.resource!=""&&(l+=`&resources=${o.resource}`)),await(await fetch(l)).json()}),Ep=ri({name:"projectsBrowser",initialState:xw,reducers:{resetFilters:e=>{e.filters={org:"",allocationType:"",allFosToggled:!1,resource:"",requestNumber:""},e.singleEntry=!1,Ep.caseReducers.toggleAllFos(e)},setApiUrl:(e,{payload:t})=>{e.apiUrl=t},setShowPagination:(e,{payload:t})=>{e.showPagination=t},setTypeLists:(e,{payload:t})=>{e.typeLists=t},toggleAllFos:e=>{e.typeLists.fosTypes.forEach(t=>t.checked=!e.filters.allFosToggled),e.filters.allFosToggled=!e.filters.allFosToggled},toggleFos:(e,{payload:t})=>{e.typeLists.fosTypes.forEach(n=>{n.fosTypeId==t.fosTypeId&&(n.checked=!n.checked)}),e.typeLists.fosTypes.filter(n=>n.checked).length!=e.typeLists.fosTypes.length?e.filters.allFosToggled=!1:e.filters.allFosToggled=!0},toggleListFiltered:(e,{payload:t})=>{e.listIsFiltered=t},toggleSingleEntry:(e,{payload:t})=>{e.singleEntry=t},updateFilter:(e,{payload:t})=>{e.filters[t.name]=t.value},updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)}},extraReducers:e=>{e.addCase(Nr.pending,t=>{t.projectsLoaded=!1}).addCase(Nr.fulfilled,(t,n)=>{const r=n.payload;t.projectsLoaded=!0,t.projects=r.projects,r.pages!=t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,t.pageData.last_page=r.pages}).addCase(Nr.rejected,(t,n)=>{console.log(n.error)}).addCase(jd.pending,t=>{t.filtersLoaded=!1}).addCase(jd.fulfilled,t=>{t.filtersLoaded=!0})}}),{resetFilters:mA,setApiUrl:mD,setShowPagination:Cd,setTypeLists:bw,toggleAllFos:gA,toggleFos:vA,toggleListFiltered:ww,toggleSingleEntry:wg,updateFilter:Ed,updatePageData:dl}=Ep.actions,yA=e=>e.projectsBrowser.filters,xA=e=>e.projectsBrowser.filtersLoaded,bA=e=>e.projectsBrowser.listIsFiltered,wA=e=>e.projectsBrowser.singleEntry,SA=e=>e.projectsBrowser.projectsLoaded,_A=e=>e.projectsBrowser.pageData,jA=e=>e.projectsBrowser.projects,CA=e=>e.projectsBrowser.filtersLoaded&&e.projectsBrowser.projectsLoaded&&e.projectsBrowser.pageData.last_page>1,EA=e=>e.projectsBrowser.typeLists,RA=Ep.reducer;const NA=()=>{const e=it(),t=fe(yA),n=fe(EA),r=fe(bA),o=n.orgs.map(h=>({label:h,value:h})),s=w.useRef(),[i,l]=w.useState(null),c={height:"200px",overflowX:"auto",padding:"2px"},u=h=>{e(Ed({name:h.target.name,value:h.target.value}))},d=()=>{window.scrollTo(0,0),p(!0),e(Cd(!1)),e(dl({current_page:1})),e(Nr())},f=()=>{l(null),e(Cd(!1)),e(dl({current_page:1})),e(mA()),r&&(window.scrollTo(0,0),e(Nr()),p(!1))},p=h=>{e(ww(h))},y=h=>{l(h),e(Ed({name:"org",value:h.value}))},m=()=>t.org==""&&t.allocationType==""&&t.allFosToggled&&t.resource==""&&t.requestNumber=="";return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{className:"mb-1",children:"Field of Science"}),a.jsxs("div",{className:"border mb-3",style:c,children:[a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:"",id:"toggle_all",checked:t.allFosToggled,onChange:()=>{e(gA())}}),a.jsx("label",{className:"form-check-label",htmlFor:"toggle_all",children:"(Toggle All)"})]}),n.fosTypes.map(h=>a.jsxs("div",{className:"form-check",children:[a.jsx("input",{className:"form-check-input",type:"checkbox",value:h.fosTypeId,id:`fos_${h.fosTypeId}`,checked:h.checked,onChange:()=>e(vA(h))}),a.jsx("label",{className:"form-check-label",htmlFor:`fos_${h.fosTypeId}`,children:h.fosName})]},`fos_${h.fosTypeId}`))]}),a.jsx("h5",{id:"org_select_label",className:"mb-1",children:"Organization"}),a.jsx("div",{className:"mb-3",children:a.jsx(Cp,{options:o,openMenuOnClick:!0,name:"org",inputId:"orgs_filter",ref:s,closeMenuOnSelect:!0,onChange:y,value:i,"aria-labelledby":"org_select_label"},"org_select")}),a.jsx("h5",{id:"project_type_label",className:"mb-1",children:a.jsx("abbr",{title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"allocationType",id:"project_type_select",value:t.allocationType,className:"form-control","aria-labelledby":"project_type_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.allocationTypes.map((h,x)=>a.jsx("option",{value:h,children:h},`allocation_type_${x}`))]})}),a.jsx("h5",{id:"resource_filter_label",className:"mb-1",children:"Resource"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"resource",id:"resource_select",value:t.resource,className:"form-control","aria-labelledby":"resource_filter_label",onChange:h=>u(h),children:[a.jsx("option",{value:"",children:"-- All --"}),n.resources.map((h,x)=>a.jsx("option",{value:h.resourceId,children:h.resourceName},`resource_${x}`))]})}),a.jsx("h5",{id:"request_number_label",className:"mb-1",children:"Request Number"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:t.requestNumber,name:"requestNumber",id:"requestNumber","aria-labelledby":"request_number_label",onChange:h=>u(h)})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:d,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",disabled:m(),onClick:f,children:"Reset"})]})]})})};const kA=({project:e})=>{const t=e.resources,[n,r]=w.useState(!1),o=fe(wA);let s={flush:!0,className:"mt-3 mb-1",alwaysOpen:!0};const i=g=>{let b=g.units?g.units:g.resourceUnits;const S=g.allocation?g.allocation:g.amount;if(b=="[Yes = 1, No = 0]"||b=="Yes / No")return S=="1.0"?"Yes":"No";{let _="0";return parseInt(S)&&(_=parseInt(S).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")),b=="ACCESS Credits"&&(b=a.jsx("span",{className:"tooltip-underline",title:"universal currency that can be exchanged for resource units",children:"ACCESS Credits"})),b=="Dollars"?`$${_}`:a.jsxs(a.Fragment,{children:[_," ",b]})}},l=()=>{const{origin:g,pathname:b}=window.location,S=`${g}${b}?_requestNumber=${e.requestNumber}`;navigator.clipboard.writeText(S),setTimeout(()=>r(!1),2e3)},c=()=>e.requestNumber&&e.requestNumber!=""?`(${e.requestNumber})`:"",u=a.jsx(Ul,{id:"link-tooltip",children:"Link Copied!"}),d=()=>{if(c()){const g={background:"none",border:"none",color:"#fff",fontSize:"24px"};return a.jsx(cp,{placement:"left",trigger:"click",defaultShow:n,show:n,onToggle:()=>r(!n),overlay:u,children:a.jsx("button",{onClick:l,style:g,children:a.jsx("i",{className:"bi bi-link-45deg",children:a.jsx("div",{className:"d-none",children:"Direct link to project"})})})})}return a.jsx(a.Fragment,{})},f=()=>{const g=e.pi.split(",");return`${g[1]} ${g[0]}`},p=()=>!e.coPis||e.coPis.length<=0?"":a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsxs("small",{className:"fst-italic",children:["CoPI(s): ",e.coPis.map(g=>`${g.name} (${g.organization})`).join(";")]})]}),y=()=>!e.beginDate||!e.endDate?"-":a.jsxs(a.Fragment,{children:[e.beginDate," to ",e.endDate]}),m=()=>e.allocationType==="NAIRR Start-Up"?a.jsxs("span",{className:"fw-bold",children:[c()," Start-Up: ",f(),", ",a.jsxs("em",{children:[" ",e.piInstitution," "]})," "]}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"fw-bold",children:[c()," ",e.requestTitle]})," ",a.jsx("br",{}),a.jsxs("span",{className:"fst-italic",children:[e.pi," ",a.jsxs("small",{children:[" (",e.piInstitution,") "]})]}),p()]}),h=a.jsxs("table",{className:"table table-striped table-bordered mt-2 mb-0",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0",children:"Resource"})}),a.jsx("td",{children:a.jsx("span",{className:"m-0 p-0 d-inline",children:"Allocation"})})]})}),a.jsx("tbody",{children:t.map((g,b)=>a.jsxs("tr",{children:[a.jsx("td",{children:g.resourceName}),a.jsx("td",{style:{whiteSpace:"nowrap"},children:i(g)})]},`resource_${e.requestId}_${b}`))})]}),x=a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Resources"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:h})})]}),v=()=>e.allocationType==="NAIRR Start-Up"?x:o?a.jsxs(a.Fragment,{children:[x,a.jsx("div",{className:"row mt-2 fw-bold",children:a.jsx("div",{className:"col-3 border-bottom",children:"Abstract"})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})})]}):a.jsxs(Wt,{...s,children:[a.jsxs(Wt.Item,{eventKey:"0",children:[a.jsx(Wt.Header,{children:"Resources"}),a.jsx(Wt.Body,{children:h})]}),a.jsxs(Wt.Item,{eventKey:"1",children:[a.jsx(Wt.Header,{children:"Abstract"}),a.jsx(Wt.Body,{children:a.jsx("div",{style:{whiteSpace:"pre-wrap",padding:"5px"},children:e.abstract})})]})]});return a.jsxs("div",{className:"card mb-4",children:[a.jsx("div",{className:"card-header bg-primary text-white",children:a.jsxs("div",{className:"d-flex justify-content-between",children:[a.jsx("div",{children:m()}),a.jsx("div",{children:d()})]})}),a.jsxs("div",{className:"card-body",children:[a.jsxs("div",{className:"row fw-bold border-bottom",children:[a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Field of Science"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0 tooltip-underline",title:'A specific level of allocation; also referred to as "Opportunity"',children:"Project Type"})}),a.jsx("div",{className:"col",children:a.jsx("span",{className:"mb-1 pb-0",children:"Dates"})})]}),a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col",children:e.fos}),a.jsx("div",{className:"col",children:e.allocationType}),a.jsx("div",{className:"col",children:y()})]}),v()]})]})},TA=()=>{const e=fe(jA);return e.length==0?a.jsx("div",{children:"No Projects Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(kA,{project:t},`project_${n}`))})};const Sg=()=>{const e=it(),t=fe(_A),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(dl({current_page:m})),e(Nr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h="";return typeof m=="object"?[m,h]=m:h=m,m=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):m=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:h})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(m),children:h})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(_e.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},OA=({api_url:e})=>{const t=it(),n=fe(SA),r=fe(xA),o=fe(CA),s=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(pA())},[]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(NA,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(Sg,{}):""})}),a.jsx("div",{className:"row",id:"projectListRow",children:a.jsx("div",{className:"col",children:n&&r?a.jsx(TA,{}):s})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:o?a.jsx(Sg,{scroll:"projects_browser_app"}):""})})]})]})})},PA=e=>e.publications_store.publication,$A=e=>e.publications_store.publication.doi,IA=e=>e.publications_store.publication_types,Sw=e=>e.publications_store.publication.authors,AA=e=>e.publications_store.tag_categories,MA=e=>e.publications_store.projects,DA=e=>e.publications_store.publication.tags,FA=e=>e.publications_store.errors,_w=e=>e.publications_store.data_loaded,jw=e=>e.publications_store.show_saved,Rp=e=>e.publications_store.saving,LA=e=>e.publications_store.modal,Cw=e=>e.publications_store.form_valid,Ew=e=>!Rp(e)&&_w(e)&&Cw(e)&&Rw(e)&&e.publications_store.projects.filter(t=>t.selected).length>0,Rw=e=>{const t=Sw(e);return t.length==0?!1:t.filter(n=>n.first_name==""||n.last_name=="").length==0},Nw=e=>({type:"UPDATE_PUBLICATION",payload:e}),UA=e=>({type:"UPDATE_FIELD",payload:e}),Rd=e=>({type:"CHANGE_PUB_TYPE",payload:e}),VA=e=>({type:"SET_PUBLICATION",payload:e}),BA=()=>({type:"ADD_AUTHOR"}),zA=e=>({type:"UPDATE_AUTHOR",payload:e}),qA=e=>({type:"TOGGLE_REQUEST",payload:e}),Qs=e=>({type:"UPDATE_ERRORS",payload:e}),kw=e=>({type:"HIDE_ERROR",payload:e}),HA=e=>({type:"UPDATE_SELECTED_TAGS",payload:e}),WA=e=>({type:"DELETE_AUTHOR",payload:e}),KA=e=>({type:"DATA_LOADED",payload:e}),Tw=e=>({type:"UPDATE_SHOW_SAVED",payload:e}),GA=()=>({type:"RESET_STATE"}),Xc=e=>({type:"UPDATE_SAVING",payload:e}),YA=e=>({type:"SET_FORM_VALID",payload:e}),Ow=e=>({type:"SET_GRANT_NUMBER",payload:e}),QA=e=>({type:"ADD_PROJECT",payload:e}),XA=(e,t,n)=>{let r=!0;const o=[];for(const i of t)e[i]||(r=!1,o.push(i));const s=e.authors||[];for(const i of s)for(const l of n)i[l]||(r=!1,o.includes(l)||o.push(l));return{formValid:r,missingFields:o}},ZA=e=>e.length>0?a.jsxs("div",{role:"alert",children:[a.jsx("p",{children:"Please provide the following information before submitting:"}),a.jsx("ul",{children:e.map(t=>a.jsx("li",{children:JA(t)},t))})]}):null;function JA(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}const e2=()=>async(e,t)=>{const n=t().publications_store.publication.doi,r=encodeURIComponent(n).replaceAll(".","%2E"),o="Unable to retrieve publication. Double check your DOI, or continue entering information manually.";fetch(`/publications/lookup?doi=${r}`).then(s=>s.json()).then(s=>{if(s.title!=""){let i=t().publications_store.publication_types.find(l=>l.citation_style_type==s.type);e(Rd(i?i.publication_type:"Other")),e(VA(s))}else e(Qs(o))},s=>{e(Qs(o))})},t2=()=>async(e,t)=>{const n=t().publications_store.grant_number,r=te.routes.publications_find_project_path();await fetch(`${r}?grant_number=${n}`).then(o=>o.json()).then(o=>{e(QA(o)),e(Ow(""))},()=>{e(Qs("Unable to find a project with this grant number."))})},Pw=()=>async e=>{const t=/^\/requests/.test(window.location.pathname)?te.routes.publication_path("new.json"):window.location.href+".json";await fetch(t).then(n=>n.json()).then(n=>{e(KA(n))})},$w=()=>async(e,t)=>{const n=t().publications_store,r=n.projects.filter(p=>p.selected),o=Object.keys(n.selected_tags).map(p=>n.selected_tags[p]).flat(),s={...n.publication},i=n.errors,{formValid:l,missingFields:c}=XA(s,["title","publication_year","publication_month"],["first_name","last_name"]);if(!l){i.length>0&&Array.from(i).forEach(y=>{e(kw(y.id))});const p=ZA(c);e(Qs(p));return}const u={authenticity_token:document.getElementsByName("authenticity_token")[0].value,publication:s,authors:s.authors.map(p=>({...p,order:0})),tags:o,projects:r};let d,f;s.publication_id?(d=te.routes.publication_path(s.publication_id),f="PATCH"):(d=te.routes.publications_path(),f="POST"),e(Xc(!0)),await fetch(d,{method:f,headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}).then(p=>{n.redirect?window.location.href=te.routes.publications_path():(s.publication_id||(e(GA()),e(Pw())),e(Tw(!0)),e(Xc(!1)))},()=>{e(Xc(!1)),e(Qs("There was an error saving this publication."))})},n2=({doi:e,updatePublication:t,doiLookup:n})=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"doi",className:"form-label",children:"DOI"}),a.jsxs("div",{className:"input-group",children:[a.jsx("input",{type:"text",className:"form-control",id:"doi",name:"publication[doi]","aria-label":"DOI Input and Search box","aria-describedby":"doi_button",value:e,onChange:r=>t(r.target.value)}),a.jsx("button",{className:"btn btn-primary",type:"button",id:"doi_button",onClick:()=>n(),children:"Lookup Publication"})]})]})}),r2=e=>({doi:$A(e)}),o2=e=>({updatePublication:t=>e(Nw({key:"doi",value:t})),doiLookup:()=>e(e2())}),s2=Jt(r2,o2)(n2),i2=({author:e,authorKey:t,updateAuthor:n,deleteAuthor:r})=>{const o=l=>{n({key:l.target.name,value:l.target.value,idx:t})},s=l=>a.jsx("td",{children:a.jsx("input",{type:"text",className:"form-control",name:l,id:l,value:e[l],onChange:c=>o(c)})},`field_${l}`),i=["first_name","last_name","affiliation"];return a.jsxs("tr",{children:[i.map(l=>s(l)),a.jsx("td",{children:t!==0&&a.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>r(t),children:a.jsx("i",{className:"bi bi-trash"})})})]})},a2=e=>({updateAuthor:t=>e(zA(t)),deleteAuthor:t=>e(WA(t))}),_g=Jt(null,a2)(i2),l2=({authors:e,addAuthor:t,authors_exist:n})=>{const r=e.length===0,o=()=>n?"":a.jsx("div",{className:"alert alert-danger",children:"You must add at least one author and each author must have a first and last name"});return a.jsxs("div",{children:[o(),a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"First Name"}),a.jsx("th",{children:"Last Name"}),a.jsx("th",{children:"Affiliation"}),a.jsx("th",{})]})}),a.jsxs("tbody",{children:[e.map((s,i)=>a.jsx(_g,{author:s,authorKey:i},`author_${i}`)),r&&a.jsx(_g,{author:t()})]})]}),a.jsx("button",{className:"btn btn-primary mt-3",onClick:()=>t(),children:"Add Author"})]})},c2=e=>({authors:Sw(e),authors_exist:Rw(e)}),u2=e=>({addAuthor:()=>e(BA())}),d2=Jt(c2,u2)(l2),f2=({category:e,publication_tags:t,updateSelectedTags:n,index:r})=>{const o=w.useRef(null),s=()=>{const l=t.filter(c=>c.label==e.label)[0];return l?l.options:[]},i=l=>{n({category:e.label,tags:l})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fw-bold mb-1",children:e.label}),a.jsx("div",{className:"mb-3",children:a.jsx(Cp,{classNames:{control:l=>l.isFocused?"custom-select-selected":"border-grey-300"},defaultValue:s(),options:e.options,isMulti:!0,openMenuOnClick:!0,name:`tags_${r}`,inputId:`tags_${r}`,ref:o,closeMenuOnSelect:!1,onChange:i})})]})},p2=e=>({updateSelectedTags:t=>e(HA(t))}),h2=e=>({publication_tags:DA(e)}),m2=Jt(h2,p2)(f2),g2=({projects:e,toggleProject:t})=>{const n=o=>`list-group-item list-group-item-action clickable ${o.selected?"list-group-item-success":""}`,r=()=>e.filter(o=>o.selected).length>0;return a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[r()?"":a.jsx("div",{className:"alert alert-danger",children:"You must select at least one project"}),a.jsx("div",{className:"list-group",children:e.map((o,s)=>a.jsxs("div",{className:n(o),onClick:()=>t(s),children:[o.grant_number,": ",o.title]},`project_${o.grant_number}`))})]})})},v2=e=>({projects:MA(e)}),y2=e=>({toggleProject:t=>e(qA(t))}),x2=Jt(v2,y2)(g2),b2=({grant_number:e,setGrantNumber:t,grantSearch:n})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:["If your project isn't listed above, you can manually add it by entering the grant number below.",a.jsxs("div",{className:"input-group mt-1",children:[a.jsx("input",{type:"text",className:"form-control",value:e,onChange:r=>t(r.target.value),placeholder:"Enter a grant number"}),a.jsx("button",{className:"btn btn-primary",onClick:()=>n(),children:"Find Project"})]})]})}),w2=e=>({setGrantNumber:t=>e(Ow(t)),grantSearch:()=>e(t2())}),S2=e=>({grant_number:e.publications_store.grant_number}),_2=Jt(S2,w2)(b2),j2=({publication:e,updateField:t,publication_types:n,changePubType:r,updatePublication:o,tag_categories:s,savePublication:i,modal:l,save_enabled:c,setFormValid:u,form_valid:d})=>{const f=g=>{g.target.value.trim()==""?u(!1):u(!0),o({key:"title",value:g.target.value})},p=()=>e.fields.map((g,b)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:`field_${g.csl_field_name}`,className:"form-label",children:g.name}),a.jsx("input",{type:"text",className:"form-control",name:`field_${g.csl_field_name}`,id:`field_${g.csl_field_name}`,value:g.field_value,onChange:S=>t({index:b,value:S.target.value})})]})},`field_${g.csl_field_name}`)),y=()=>{const g=new Date().getFullYear()+2;let b=1980;const S=[];for(;b<=g;)S.push(b++);const _=["January","February","March","April","May","June","July","August","September","October","November","December"],j=a.jsx("i",{className:"bi bi-asterisk text-danger"});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("label",{className:"form-label",htmlFor:"publication_title",children:["Title ",j]}),a.jsx("input",{name:"publication_title",id:"publication_title",type:"text",className:`form-control ${d?"":"is-invalid"}`,value:e.title,onChange:C=>f(C)})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_year",children:"Year Published"}),a.jsx("select",{name:"publication_year",id:"publication_year",className:"form-control",value:e.publication_year,onChange:C=>{o({key:"publication_year",value:C.target.value})},children:S.map(C=>a.jsx("option",{value:C,children:C},`year_${C}`))})]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{className:"form-label",htmlFor:"publication_month",children:"Month Published"}),a.jsx("select",{name:"publication_month",id:"publication_month",className:"form-control",value:e.publication_month,onChange:C=>{o({key:"publication_month",value:C.target.value})},children:_.map((C,E)=>a.jsx("option",{value:E+1,children:C},`month_${E}`))})]})})]})},m=a.jsxs("div",{className:"card",children:[a.jsx("div",{className:"card-header",children:a.jsx("h2",{children:"Publication Information"})}),a.jsxs("div",{className:"card-body",children:[a.jsx("p",{className:"mb-2",children:'Enter information about this publication below. If you have a DOI, you may use the "Lookup Publication" button to attempt to find this information automatically.'}),a.jsx(s2,{}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsx("label",{htmlFor:"publication_type",className:"form-label",children:"Publication Type"}),a.jsx("select",{name:"publication[publication_type]",id:"publication_type",className:"form-control",value:e.publication_type,onChange:g=>r(g.target.value),children:n.map(g=>a.jsx("option",{value:g.publication_type,children:g.publication_type},`pub_type_${g.type_id}`))})]})}),y(),p()]})]}),h=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Authors"}),a.jsxs(go,{children:[`Add authors by clicking the "Add Authors" button below and entering the author's details. You may also remove authors by clicking the `,a.jsx("i",{className:"bi bi-trash fw-bold text-danger"})," ","button"]})]}),a.jsx("div",{className:"card-body",children:a.jsx(d2,{})})]}),x=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Tags"}),a.jsx(go,{children:"Add related tags from the lists below. You may choose multiple tags per category."})]}),a.jsx("div",{className:"card-body",children:s.map((g,b)=>a.jsx(m2,{index:b,category:g},`tc_${b}`))})]}),v=a.jsxs("div",{className:"card mt-3",children:[a.jsxs("div",{className:"card-header d-flex",children:[a.jsx("h2",{children:"Associated Projects"}),a.jsx(go,{children:"Click/Tap each project that this publication is related to."})]}),a.jsxs("div",{className:"card-body",children:[a.jsx(x2,{}),a.jsx("hr",{}),a.jsx(_2,{})]})]});return a.jsxs(a.Fragment,{children:[m,h,x,v,l?null:a.jsx("p",{className:"mt-3",children:a.jsx("button",{onClick:()=>i(),className:"btn btn-success",disabled:!c,children:"Save Publication"})})]})},C2=e=>({publication:PA(e),publication_types:IA(e),tag_categories:AA(e),saving:Rp(e),modal:LA(e),save_enabled:Ew(e),form_valid:Cw(e)}),E2=e=>({updateField:t=>e(UA(t)),changePubType:t=>e(Rd(t)),updatePublication:t=>e(Nw(t)),savePublication:()=>e($w()),setFormValid:t=>e(YA(t))}),R2=Jt(C2,E2)(j2),N2=({errors:e,hideError:t})=>a.jsx(a.Fragment,{children:e.map(n=>a.jsxs("div",{className:"alert alert-danger alert-dismissible sticky-top",children:[n.message,a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(n.id)})]},`err_${n.id}`))}),k2=e=>({errors:FA(e)}),T2=e=>({hideError:t=>e(kw(t))}),O2=Jt(k2,T2)(N2),P2=({show_saved:e,updateShowSaved:t})=>{const n=a.jsxs("div",{className:"alert alert-success alert-dismissible sticky-top",children:["Publication Saved Successfully!",a.jsx("button",{type:"button",className:"btn-close","aria-label":"Close",onClick:()=>t(!1)})]});return e?n:a.jsx(a.Fragment,{})},$2=e=>({show_saved:jw(e)}),I2=e=>({updateShowSaved:t=>e(Tw(t))}),A2=Jt($2,I2)(P2),M2=({getData:e,data_loaded:t})=>(w.useEffect(()=>{e()},[]),a.jsxs(a.Fragment,{children:[a.jsx(A2,{}),a.jsx(O2,{}),t?a.jsx(R2,{}):a.jsx(Do,{})]})),D2=e=>({data_loaded:_w(e)}),F2=e=>({getData:()=>e(Pw())}),Iw=Jt(D2,F2)(M2),L2=({saving:e,savePublication:t,showSaved:n,updatePublications:r,save_enabled:o})=>{const[s,i]=w.useState(!1);return w.useEffect(()=>{!e&&n&&r()},[e,n]),a.jsxs(a.Fragment,{children:[a.jsxs(ge,{size:"xl",show:s,onHide:()=>i(!1),scrollable:!0,children:[a.jsx(ge.Header,{closeButton:!0,children:a.jsx(ge.Title,{children:"Add Publication"})}),a.jsx(ge.Body,{children:a.jsx(Iw,{})}),a.jsx(ge.Footer,{children:a.jsxs("div",{className:"d-flex",children:[a.jsx("button",{type:"button",className:"btn btn-danger me-2",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>{t(),i(!1)},children:"Save Publication"})]})})]}),a.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>i(!0),children:"Add a New Publication"})]})},U2=e=>({saving:Rp(e),showSaved:jw(e),save_enabled:Ew(e)}),V2=e=>({savePublication:()=>e($w())}),B2=Jt(U2,V2)(L2),z2=({usernames:e=[],publication_ids:t=[]})=>{const[n,r]=w.useState(e),[o,s]=w.useState(t),[i,l]=w.useState([]),c=w.useRef(n),u=h=>{c.current=h,r(h)},d=async()=>{const x=await(await fetch(te.routes.search_publications_path({usernames:n}))).json();l(x)};w.useEffect(()=>{d()},[n]),w.useEffect(()=>{addEventListener("requestAddRole",h=>u([...c.current,h.detail.username])),addEventListener("requestRemoveRole",h=>u(c.current.filter(x=>x!=h.detail.username)))},[]);let f=!1,p=!1;const y=i.map(h=>{const x=o.includes(h.publication_id);f=f||x,p=p||!x;const v=new Date(h.publication_year,h.publication_month-1);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("input",{type:"checkbox",name:"publication_ids[]",value:h.publication_id,checked:x,onChange:()=>s(x?o.filter(g=>g!=h.publication_id):[...o,h.publication_id])})}),a.jsx("td",{children:h.title}),a.jsx("td",{children:h.authors.map(g=>`${g.first_name} ${g.last_name}`).join(", ")}),a.jsx("td",{children:h.publication_type}),a.jsxs("td",{children:[v.toLocaleString("default",{month:"short"})," ",h.publication_year]})]},h.publication_id)}),m=`${p?"Select":"Deselect"} all`;return a.jsxs("div",{className:"publications-select",children:[a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:a.jsx("input",{type:"checkbox",value:"","aria-label":m,title:m,checked:f&&!p,onChange:()=>s(p?i.map(h=>h.publication_id):[]),ref:h=>{h&&(h.indeterminate=f&&p)}})}),a.jsx("th",{children:"Title"}),a.jsx("th",{children:"Authors"}),a.jsx("th",{children:"Type"}),a.jsx("th",{children:"Date"})]})}),a.jsx("tbody",{children:y})]}),a.jsx(B2,{updatePublications:d})]})},q2=()=>`${Math.random().toString(36).slice(2)}`,Nd=document.querySelector("#publications-react"),H2=Nd?Nd.dataset:{},jg={publication_types:[],tag_categories:[],publication:{},projects:[],errors:[],selected_tags:{},data_loaded:!1,saving:!1,show_saved:!1,redirect:H2.redirect||!1,modal:Nd==null,form_valid:!1,grant_number:""},W2=(e=jg,t)=>{const{type:n,payload:r}=t;switch(n){case"UPDATE_FIELD":return Pt(e,s=>(s.publication.fields[r.index].field_value=r.value,s));case"CHANGE_PUB_TYPE":return Pt(e,s=>{let i=s.publication_types.find(l=>l.publication_type==r).fields;return i.forEach(l=>{const c=s.publication.fields.find(u=>u.csl_field_name==l.csl_field_name);c&&(l.value=c.value)}),s.publication.publication_type=r,s.publication.fields=i,s});case"UPDATE_PUBLICATION":return{...e,publication:{...e.publication,[r.key]:r.value}};case"SET_PUBLICATION":return Pt(e,s=>(s.publication.fields.forEach(i=>{i.field_value=r[i.csl_field_name]}),Object.keys(s.publication).forEach(i=>{r[i]&&(s.publication[i]=r[i])}),s.form_valid=r.title.trim()!="",s));case"ADD_AUTHOR":{const o={portal_username:"",first_name:"",middle_name:"",last_name:"",prefix:"",suffix:"",initials:"",affiliation:"",hash:{}};return Pt(e,i=>{i.publication.authors.push(o)})}case"UPDATE_AUTHOR":return Pt(e,s=>{s.publication.authors[r.idx][r.key]=r.value});case"TOGGLE_TAG":return Pt(e,s=>{let i=s.tag_categories.find(l=>l.publication_tags_category_id==r.publication_tags_category_id);i.tags[r.idx].selected=!i.tags[r.idx].selected});case"TOGGLE_REQUEST":return Pt(e,s=>(s.projects[r].selected=!s.projects[r].selected,s));case"UPDATE_ERRORS":{const o={id:q2(),message:r};return{...e,errors:[...e.errors,o]}}case"HIDE_ERROR":{const o=e.errors.filter(s=>s.id!=r);return{...e,errors:o}}case"UPDATE_SELECTED_TAGS":return Pt(e,s=>{const i=r.tags.map(l=>l.value);return s.selected_tags[r.category]=i,s});case"DELETE_AUTHOR":return Pt(e,s=>(s.publication.authors.splice(r,1),s));case"DATA_LOADED":return Pt(e,s=>(s.publication=r.publication,s.form_valid=r.publication.title.trim()!="",s.publication.authors.forEach(i=>{i.affiliation||(i.affiliation="")}),s.publication_types=r.publication_types,s.tag_categories=r.tag_categories,s.projects=r.publication.projects,r.publication.tags.forEach(i=>s.selected_tags[i.label]=i.options.map(l=>l.value)),s.data_loaded=!0,s));case"UPDATE_SHOW_SAVED":return{...e,show_saved:r};case"UPDATE_SAVING":return{...e,saving:r};case"RESET_STATE":return jg;case"SET_FORM_VALID":return{...e,form_valid:r};case"SET_GRANT_NUMBER":return{...e,grant_number:r};case"ADD_PROJECT":return{...e,projects:[...e.projects,r]};default:return e}},K2={catalogs:{},filteredResources:[],filters:[],hasErrors:!1,onRamps:!1,resources:[],resourcesLoaded:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},pa=Qe("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(Cg(!1));let n=[];e.catalogSources?n=e.catalogSources:n.push({...e,catalogLabel:"Default"}),e.onRamps&&n.push({apiUrl:"https://allocations.access-ci.org/resources.json",catalogLabel:"ACCESS",allowedCategories:[],allowedFilters:[],allowedResources:[],excludedCategories:["Resource Category"],excludedFilters:[],excludedResources:["ACCESS Credits"]});const r=await Promise.all(n.map(async o=>{const i=await(await fetch(o.apiUrl)).json();return{...o,data:i}}));t(X2({data:r,params:e})),t(Cg(!0))});Qe("resourceCatalog/getResources",async(e,{dispatch:t})=>{t(J2(e)),t(Mw())});const G2=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},Y2=e=>{const t={},n={};let r={};return e.forEach(s=>{t[s.catalogLabel]={...s,resourceIds:[],selected:!1,catalogId:s.catalogLabel.replace(/[^(A-z)]/,"")},delete t[s.catalogLabel].data,s.data.forEach(i=>{if(kd(s.allowedResources,s.excludedResources,i.resourceName)){const{categories:l,formattedResource:c}=Q2(s,i,r);n[i.resourceId]=c,t[s.catalogLabel].resourceIds.push(i.resourceId),r=l}})}),{resources:Object.keys(n).map(s=>n[s]),catalogs:t,categories:r}},kd=(e,t,n)=>!e&&!t||e&&e.length==0&&t&&t.length==0?!0:e&&e.length>0?e.find(r=>r==n):t&&t.length>0?!t.find(r=>r==n):!0,Q2=(e,t,n)=>{const r=[];let o="";t.featureCategories.filter(l=>l.categoryIsFilter).forEach(l=>{const c=l.categoryId;l.categoryName=="ACCESS Resource Grouping"?o=l.features[0].name:(!n[c]&&kd(e.allowedCategories,e.excludedCategories,l.categoryName)&&(n[c]={categoryId:c,categoryName:l.categoryName,categoryDescription:l.categoryDescription,features:{}}),l.features.forEach(u=>{const d={featureId:u.featureId,name:u.name,description:u.description,categoryId:c,selected:!1},f=kd(e.allowedFilters,e.excludedFilters,d.name);f&&r.push(d),n[c]&&f&&!n[c].features[u.featureId]&&(n[c].features[u.featureId]=d)}))});const s=r.map(l=>l.name).sort((l,c)=>l>c);return{formattedResource:{...t,resourceName:t.resourceName.trim(),features:s,featureIds:r.map(l=>l.featureId),sortCategory:o},categories:n}},Aw=ri({name:"resourceCatalog",initialState:K2,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,{resources:r,catalogs:o,categories:s}=Y2(n);e.catalogs=o,e.onRamps=t.params.onRamps;for(const i in s){const l=s[i],c=[];for(const u in l.features)c.push(l.features[u]);e.filters.push({...l,features:c.sort((u,d)=>u.name>d.name)})}e.filters=e.filters.sort((i,l)=>i.categoryName.localeCompare(l.categoryName)),e.resources=r.sort((i,l)=>i.resourceName.localeCompare(l.resourceName)).sort((i,l)=>e.resourceSorting[i.sortCategory]>e.resourceSorting[l.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},setResourcesLoaded:(e,{payload:t})=>{e.resourcesLoaded=t},toggleCatalog:(e,{payload:t})=>{const{catalog:n,selected:r}=t;e.catalogs[n.catalogLabel].selected=r},toggleFilter:(e,{payload:t})=>{if(t){const i=t,c=e.filters.find(u=>u.categoryId==i.categoryId).features.find(u=>u.featureId==i.featureId);c.selected=!c.selected}const n=G2(e.filters);let r=[];if(n.length>0){const i=n.map(l=>l.features.map(c=>c.featureId));e.resources.forEach(l=>{let c=0;i.forEach(u=>{let d=!1;l.featureIds.forEach(f=>{u.indexOf(f)>=0&&(d=!0)}),d&&(c+=1)}),c>=i.length&&r.push(l)})}else r=e.resources;const o=Object.keys(e.catalogs).map(i=>e.catalogs[i]),s=o.filter(i=>i.selected);if(s.length>0&&s.length<o.length){const i=s.map(l=>l.resourceIds).flat();r=r.filter(l=>i.indexOf(l.resourceId)>=0)}e.filteredResources=r}},extraReducers:e=>{e.addCase(pa.pending,t=>{}).addCase(pa.fulfilled,(t,n)=>{}).addCase(pa.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:X2,processData:gD,resetFilters:Z2,setResourcesLoaded:Cg,toggleCatalog:J2,toggleFilter:Mw}=Aw.actions,Dw=e=>e.resourceCatalog.catalogs,eM=e=>e.resourceCatalog.filters,tM=e=>e.resourceCatalog.hasErrors,nM=e=>e.resourceCatalog.resourcesLoaded,rM=e=>e.resourceCatalog.filteredResources,oM=Aw.reducer,sM="_access_1yrq0_2",iM="_resourceName_1yrq0_6",aM="_description_1yrq0_11",lM="_filterBar_1yrq0_15",cM="_cardBg_1yrq0_20",uM="_active_1yrq0_25",dM="_plainButton_1yrq0_30",fM="_btnSecondary_1yrq0_40",pM="_filtersHidden_1yrq0_51",hM="_filtersVisible_1yrq0_57",At={access:sM,resourceName:iM,description:aM,filterBar:lM,cardBg:cM,active:uM,plainButton:dM,btnSecondary:fM,filtersHidden:pM,filtersVisible:hM},mM=({resource:e})=>{const[t,n]=w.useState(!0),r=u=>{const d={"CPU Compute":"cpu-fill","GPU Compute":"gpu-card",Cloud:"cloud-fill","Commercial Cloud":"cloud-fill",Storage:"database-fill","Service / Other":"journal","Innovative / Novel Compute":"pc"};return d[u]?a.jsx("i",{title:u,className:`bi bi-${d[u]} me-2 `},`${e.resourceId}_${d[u]}`):""},o=()=>a.jsxs("span",{className:"float-end",children:[e.features.map(u=>r(u)),e.resourceType]}),s=u=>u.length==0?"":a.jsx(a.Fragment,{children:u.map((d,f)=>a.jsx("span",{className:"badge text-bg-secondary me-2",children:d},`feature_${e.resourceId}_${f}`))}),i=()=>{let u=e.resourceDescription;return u&&u!=""?(At.plainButton,a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col fw-bold",children:["About ",e.resourceName]})}),a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col ",children:[a.jsx("div",{className:At.description,dangerouslySetInnerHTML:{__html:u}}),""]})})]})):""},l=()=>e.recommendedUse&&e.recommendedUse!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:"Recommended Use"})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:a.jsx("div",{className:At.description,dangerouslySetInnerHTML:{__html:e.recommendedUse}})})})]}):"",c=()=>At.cardBg;return a.jsx(a.Fragment,{children:a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"card mb-3",children:[a.jsxs("div",{className:`card-header ${c()}`,children:[a.jsx("span",{className:"",children:e.resourceName}),o()]}),a.jsxs("div",{className:"card-body",children:[a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",children:s(e.features)})}),l(),i()]}),a.jsx("div",{className:"card-footer",children:a.jsxs("a",{target:"_blank",href:e.userGuideUrl,className:"btn btn-info me-2 fw-bold",children:["System Info ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})})]})})})})},gM=({filter:e})=>{const t=it(),n=()=>{t(Mw(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},vM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(gM,{filter:t},t.featureId))]})}),yM=({onReset:e})=>{const t=it(),n=fe(Dw),r=fe(eM),o=r.filter(s=>s.features.filter(i=>i.selected).length>0);return Object.keys(n).map(s=>n[s]),a.jsxs(a.Fragment,{children:[r.map(s=>a.jsx(vM,{category:s},s.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>t(Z2()),disabled:o.length==0,children:"Reset Filters"}),a.jsx("button",{className:"btn btn-outline-primary ms-3 mt-2 mb-2",onClick:e,children:"Close Menu"})]})},xM=()=>{const[e,t]=w.useState(!1),n=w.useRef(null),r=()=>{const o=n.current;e?(o.style.height="0px",o.classList.remove(At.filtersVisible),o.classList.add(At.filtersHidden)):(o.style.height=o.scrollHeight+"px",o.classList.remove(At.filtersHidden),o.classList.add(At.filtersVisible)),t(!e)};return a.jsx("div",{className:At.filterBar,children:a.jsx("div",{className:"row mb-2",children:a.jsx("div",{className:"col pt-2 pb-2",children:a.jsxs("div",{className:"p-1 pb-0 border-bottom bg-white shadow",children:[a.jsxs("button",{className:"btn btn-outline-primary mb-1 mt-1",type:"button",onClick:r,children:[a.jsx("i",{className:"bi bi-filter"})," Filters"]}),a.jsx("div",{className:`${At.filtersHidden} pe-2 ps-2`,id:"filtersList",ref:n,children:a.jsx(yM,{onReset:r})})]})})})})},bM=()=>{const e=fe(rM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsx("div",{className:"card shadow",children:a.jsxs("div",{className:"card-body",children:[a.jsx(xM,{}),e.map(t=>a.jsx(mM,{resource:t},t.resourceId))]})})},wM=({baseUrl:e})=>a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col d-flex",children:a.jsx("img",{alt:"Access Logo",style:{height:"75px"},src:`${e}/access_logo.png`})})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx("h3",{className:"border-bottom",children:"NSF ACCESS Resources"})})}),a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("h4",{children:"Discover the nationwide NSF cyberinfrastructure"}),a.jsx("p",{children:"Need advanced computing and storage options for your research or classroom? The ACCESS program has been established and funded by the U.S. National Science Foundation to help you - the nation's researchers and educators - to use some of the country's most advanced computing systems and services - at no cost to you."}),a.jsx("p",{children:"Thousands of researchers, instructors, and students from institutions large and small use ACCESS-integrated resources every year. With more than 30 resources from more than 15 resource providers, there's bound to be a resource for you, your lab, or your class."}),a.jsx("p",{children:"Explore the resource catalog below - filter the list to discover the resources that have the features or services to accelerate your activities. The System Info button will take you to the resource's documentation for all the details."}),a.jsx("p",{children:'Ready to begin? Click the "Get Your First Project" button and join the ACCESS community!'}),a.jsx("p",{children:a.jsxs("a",{href:"https://allocations.access-ci.org/get-your-first-project",target:"_blank",className:`btn btn-secondary fw-bold ${At.btnSecondary}`,children:["Get Your First Project ",a.jsx("i",{className:"bi bi-box-arrow-up-right"})]})}),a.jsxs("p",{children:["If you have feedback for ACCESS, please complete our",a.jsx("a",{target:"_blank",href:"https://docs.google.com/forms/d/e/1FAIpQLSdn-SXokNB_5s0r2SA_S9ZIZWZFlVPRD2OHepTH5HY2YND_zw/viewform",children:" Feedback Form"}),".",a.jsx("br",{}),"If you have questions, please",a.jsx("a",{target:"_blank",href:"https://support.access-ci.org/user/login?destination=/open-a-ticket",children:" open a help ticket"}),"."]})]})})]}),SM=({catalogSources:e=[],onRamps:t=!1,baseUrl:n})=>{const r=it(),o=fe(nM),s=fe(tM),i=fe(Dw),l=Object.keys(i).map(u=>i[u]);w.useEffect(()=>{r(pa({catalogSources:e,onRamps:t}))},[]);const c=()=>t&&l.length>1?a.jsx(a.Fragment,{children:l.filter(u=>u.catalogLabel!="ACCESS").map((u,d)=>a.jsx("div",{className:"row mb-3",children:a.jsxs("div",{className:"col",children:[a.jsxs("h4",{className:"border-bottom",children:["About ",u.catalogLabel]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:u.description}})]})},`catalog_${d}`))}):"";return s?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):o?a.jsxs("div",{className:`container mt-3 ${At.access}`,children:[t?a.jsx(wM,{baseUrl:n}):"",c(),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(bM,{})})})]}):a.jsx(Do,{})},_M={filters:[],resources:[],filteredResources:[],resourcesLoaded:!1,hasErrors:!1,resourceSorting:{"NSF Capacity Resources":1,"NSF Innovative Testbeds":2,"Other NSF-funded Resources":3,"Services and Support":4}},ha=Qe("resourceCatalog/getResources",async(e,{dispatch:t})=>{const r=await(await fetch(e.apiUrl)).json();t(CM({data:r,params:e}))}),jM=e=>{const t=[],n=e.filter(r=>r.features.filter(o=>o.selected).length>0);return e.forEach(r=>{r.features.forEach(o=>{o.selected&&t.push(o.featureId)})}),n.map(r=>({...r,features:r.features.filter(o=>o.selected)}))},Eg=(e,t,n)=>{if(e.length==0&&t.length==0)return!0;if(e.length>0)return e.find(r=>r==n);if(t.length>0)return!t.find(r=>r==n)},Fw=ri({name:"resourceCatalog",initialState:_M,reducers:{handleResponse:(e,{payload:t})=>{const n=t.data,r=t.params.excludedCategories,o=t.params.excludedFilters,s=t.params.excludedResources,i=t.params.allowedCategories,l=t.params.allowedFilters,c=[],u={};n.filter(d=>!s.includes(d.resourceName)).forEach(d=>{const f=[];let p="";d.featureCategories.filter(m=>m.categoryIsFilter).forEach(m=>{const h=m.categoryId;m.categoryName=="ACCESS Resource Grouping"?p=m.features[0].name:(!u[h]&&Eg(i,r,m.categoryName)&&(u[h]={categoryId:h,categoryName:m.categoryName,categoryDescription:m.categoryDescription,features:{}}),m.features.forEach(x=>{const v={featureId:x.featureId,name:x.name,description:x.description,categoryId:h,selected:!1},g=Eg(l,o,v.name);g&&f.push(v),u[h]&&g&&!u[h].features[x.featureId]&&(u[h].features[x.featureId]=v)}))});const y={resourceName:d.resourceName,resourceId:d.resourceId,resourceType:d.resourceType,organization:d.organization,units:d.units,userGuideUrl:d.userGuideUrl,resourceDescription:d.resourceDescription,description:d.description,recommendedUse:d.recommendedUse,features:f.map(m=>m.name).sort((m,h)=>m>h),featureIds:f.map(m=>m.featureId),sortCategory:p};c.push(y)});for(const d in u){const f=u[d],p=[];for(const y in f.features)p.push(f.features[y]);e.filters.push({...f,features:p.sort((y,m)=>y.name>m.name)})}i.length>0?e.filters=e.filters.sort((d,f)=>i.indexOf(d.categoryName)>i.indexOf(f.categoryName)):e.filters=e.filters.sort((d,f)=>d.categoryName.localeCompare(f.categoryName)),e.resources=c.sort((d,f)=>d.resourceName.localeCompare(f.resourceName)).sort((d,f)=>e.resourceSorting[d.sortCategory]>e.resourceSorting[f.sortCategory]),e.filteredResources=[...e.resources],e.resourcesLoaded=!0},resetFilters:e=>{e.filters.forEach(t=>{t.features.forEach(n=>n.selected=!1)}),e.filteredResources=[...e.resources]},toggleFilter:(e,{payload:t})=>{const n=t,o=e.filters.find(i=>i.categoryId==n.categoryId).features.find(i=>i.featureId==n.featureId);o.selected=!o.selected;const s=jM(e.filters);if(s.length>0){const i=[],l=s.map(c=>c.features.map(u=>u.featureId));e.resources.forEach(c=>{let u=0;l.forEach(d=>{let f=!1;c.featureIds.forEach(p=>{d.indexOf(p)>=0&&(f=!0)}),f&&(u+=1)}),u>=l.length&&i.push(c)}),e.filteredResources=i}else e.filteredResources=[...e.resources]}},extraReducers:e=>{e.addCase(ha.pending,t=>{}).addCase(ha.fulfilled,(t,n)=>{}).addCase(ha.rejected,(t,n)=>{t.hasErrors=!0,console.log(n.error)})}}),{handleResponse:CM,processData:vD,resetFilters:EM,toggleFilter:RM}=Fw.actions,NM=e=>e.resourceCatalog.hasErrors,kM=e=>e.resourceCatalog.resourcesLoaded,TM=e=>e.resourceCatalog.filters,OM=e=>e.resourceCatalog.filteredResources,PM=Fw.reducer,$M=({resource:e})=>{const t=r=>r.length==0?"":a.jsx("ul",{children:r.map((o,s)=>a.jsx("li",{children:o},`feature_${e.resourceId}_${s}`))}),n=(r,o)=>o&&o!=""?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col fw-bold",children:r})}),a.jsx("div",{className:"row mb-3",children:a.jsx("div",{className:"col",dangerouslySetInnerHTML:{__html:o}})})]}):"";return a.jsxs(Wt.Item,{eventKey:e.resourceId,children:[a.jsx(Wt.Header,{children:e.resourceName}),a.jsxs(Wt.Body,{children:[a.jsx("table",{className:"table",children:a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Resource Type:"}),a.jsx("td",{children:e.resourceType})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Organization:"}),a.jsx("td",{children:e.organization})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Units:"}),a.jsx("td",{children:e.units})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"User Guide:"}),a.jsx("td",{children:e.userGuideUrl==""?"":a.jsx("a",{href:e.userGuideUrl,target:"_blank",rel:"noreferrer",children:"Link to User Guide"})})]}),a.jsxs("tr",{children:[a.jsx("td",{className:"fw-bold",children:"Features Available:"}),a.jsx("td",{children:t(e.features)})]})]})}),n("Resource Description",e.resourceDescription),n("Allocations Description",e.description),n("Recommended Use",e.recommendedUse)]})]})},IM=()=>{const e=fe(OM);return e.length==0?a.jsx("div",{className:"fw-bold",children:"No Resources Match Your Filters"}):a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Resources"}),a.jsx(Wt,{children:e.map(t=>a.jsx($M,{resource:t},t.resourceId))})]})},AM=({filter:e})=>{const t=it(),n=()=>{t(RM(e))};return a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsxs("div",{className:"form-check",children:[a.jsx("label",{className:"form-check-label",htmlFor:`filter_${e.featureId}`,children:e.name}),a.jsx("input",{className:"form-check-input",type:"checkbox",value:e.featureId,id:`filter_${e.featureId}`,checked:e.selected,onChange:n})]})})})},MM=({category:e})=>a.jsx("div",{className:"row",children:a.jsxs("div",{className:"col",children:[a.jsx("div",{className:"fw-bold mb-1 mt-1",children:a.jsx("abbr",{title:e.categoryDescription,children:e.categoryName})}),e.features.map(t=>a.jsx(AM,{filter:t},t.featureId))]})}),DM=()=>{const e=it(),t=fe(TM),n=t.filter(r=>r.features.filter(o=>o.selected).length>0);return a.jsxs("div",{children:[a.jsx("h4",{className:"mb-0",children:"Filters"}),t.map(r=>a.jsx(MM,{category:r},r.categoryId)),a.jsx("button",{className:"btn btn-warning mt-2 mb-2",onClick:()=>e(EM()),disabled:n.length==0,children:"Reset Filters"})]})},FM=({apiUrl:e,excludedCategories:t=[],excludedFilters:n=[],excludedResources:r=[],allowedCategories:o=[],allowedFilters:s=[]})=>{const i=it(),l=fe(kM),c=fe(NM);return w.useEffect(()=>{i(ha({apiUrl:e,excludedCategories:t,excludedFilters:n,excludedResources:r,allowedCategories:o,allowedFilters:s}))},[]),c?a.jsx("div",{className:"row",children:a.jsx("div",{className:"col text-center mt-2",children:a.jsx("h4",{children:"Unable to Load Resources"})})}):l?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"row mt-3",children:[a.jsx("div",{className:"col-sm-4",children:a.jsx(DM,{})}),a.jsx("div",{className:"col-sm-8",children:a.jsx(IM,{})})]})}):a.jsx(Do,{})},Lw={apiUrl:null,pages:1,publications:[],publicationsLoaded:!0,showPagination:!1,filterSelections:{allJournalsToggled:!1,doi:"",journal:"",authorName:"",publicationType:""},pageData:{current_page:1,last_page:1},filterOptions:{journals:[],publication_types:[]}},LM=Qe("publicationsBrowser/initApp",async(e,{getState:t,dispatch:n})=>{await n(kr()),await n(Uw())}),kr=Qe("publicationsBrowser/getPublications",async(e,{getState:t})=>{const n=t().publicationsBrowser;let r=`${n.apiUrl}?page=${n.pageData.current_page}`;if(n.filterSelections.doi!==""&&(r+=`&doi=${encodeURIComponent(n.filterSelections.doi)}`),n.filterSelections.authorName!==""&&(r+=`&author_name=${encodeURIComponent(n.filterSelections.authorName)}`),n.filterSelections.journal!==""){const i=n.filterSelections.journal;n.filterOptions.journals.includes(i)&&(r+=`&journal=${encodeURIComponent(n.filterSelections.journal)}`)}return n.filterSelections.publicationType!==""&&(r+=`&publication_type=${encodeURIComponent(n.filterSelections.publicationType)}`),await(await fetch(r)).json()}),Uw=Qe("publicationsBrowser/getFilters",async(e,{getState:t,dispatch:n})=>{const o=`${t().publicationsBrowser.apiUrl}?filters=1`;return(await(await fetch(o)).json()).filters||[]}),Vw=ri({name:"publicationsBrowser",initialState:Lw,reducers:{updatePageData:(e,{payload:t})=>{t.current_page&&(e.pageData.current_page=t.current_page),t.last_page&&(e.pageData.last_page=t.last_page)},updateFilterSelection:(e,{payload:t})=>{e.filterSelections[t.name]=t.value},resetFilters:e=>{e.filterSelections={doi:"",allJournalsToggled:!1,journal:"",authorName:"",publicationType:""}}},extraReducers:e=>{e.addCase(kr.pending,t=>{t.publicationsLoaded=!1,t.error=null}).addCase(kr.fulfilled,(t,n)=>{t.publicationsLoaded=!0,t.publications=n.payload.publications||[],n.payload.pagination&&n.payload.pagination.last_page!==t.pageData.last_page&&(t.pageData.current_page=1),t.showPagination=!0,n.payload.pagination&&(t.pageData.last_page=n.payload.pagination.last_page)}).addCase(kr.rejected,(t,n)=>{t.publicationsLoaded=!0,t.error=n.error.message}).addCase(Uw.fulfilled,(t,n)=>{t.filterOptions=n.payload})}}),{updatePageData:UM,updateFilterSelection:Rg,resetFilters:VM}=Vw.actions,BM=e=>e.publicationsBrowser.filterSelections,zM=e=>e.publicationsBrowser.publicationsLoaded,qM=e=>e.publicationsBrowser.publications,HM=e=>e.publicationsBrowser.filterOptions,WM=e=>e.publicationsBrowser.pageData,KM=Vw.reducer,Td=e=>(e=e.startsWith("https")?e.split("https://doi.org/").join(""):e,e),GM=({publication:e,index:t})=>{const n=e.authors.map(f=>`${f.last_name}, ${f.first_name.substr(0,1)}.`).join(", "),r=e.projects.map(f=>f.grant_number),o=e.publication_type==="Other"?"Publication":e.publication_type,s=e.projects,i=t%2==0?"bg-light":"",l={textIndent:"-50px",marginLeft:"50px"},c=e.publication_datas,u=f=>{switch(f){case"Publication Type":return e.publication_type;case"Publication Year":return e.publication_year?e.publication_year:"N/A";case"DOI":return e.doi?a.jsx("a",{href:`https://doi.org/${Td(e.doi)}`,target:"_blank",className:"fw-normal",children:Td(e.doi)}):!1;case"Journal":return e.journal.title?e.journal.title:!1;case"Volume/Issue":return c["Volume/Issue"]?c["Volume/Issue"]:!1;case"Pages":return c.Pages?c.Pages:!1;case"Publisher":return c.Publisher?c.Publisher:!1}},d=()=>{const f=u("Publication Year");let p=e.title;const y=u("Journal"),m=u("DOI"),h=u("Volume/Issue"),x=u("Pages"),v=u("Publisher");return p[p.length-1]!="."&&(p+="."),e.publication_type==="Journal Paper"||e.publication_type==="Other"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",h?a.jsxs("span",{className:"ms-1",children:[h,","]}):"",x?a.jsxs("span",{className:"ms-1",children:[x,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Conference Paper"||e.publication_type==="Software"?a.jsxs(a.Fragment,{children:[n," (",f,"). ",p,y?a.jsxs("em",{className:"ms-1",children:[y,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Book"||e.publication_type==="Book Chapter"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),v?a.jsxs("em",{className:"ms-1",children:[v,"."]}):"",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dataset"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p})," [Dataset]. ",v||"",".",m?a.jsx("span",{className:"ms-1",children:m}):""]}):e.publication_type==="Dissertation"?a.jsxs(a.Fragment,{children:[n," (",f,").",a.jsx("em",{className:"ms-1",children:p}),". [Doctoral dissertation",v?", "+v:"","].",m?a.jsx("span",{className:"ms-1",children:m}):""]}):""};return a.jsx("div",{className:"col-12 mb-2 border-bottom",children:a.jsx("div",{className:"card",style:{border:"unset"},children:a.jsxs("div",{className:`card-body pt-2 mb-2 ${i}`,children:[a.jsx("p",{style:l,children:d()}),s.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-decoration-underline mb-2",children:["Projects Supporting this ",o]}),a.jsx("ul",{style:{...l,listStyleType:"none"},children:r.map((f,p)=>a.jsx("li",{id:`project_${p}`,children:a.jsx("a",{href:`https://allocations.access-ci.org/current-projects?_requestNumber=${f}`,id:`grant_link${p}`,target:"_blank",style:{fontWeight:"600"},children:f})},`grant_${p}`))})]})]})})})},YM=()=>{const e=fe(qM);return e.length===0?a.jsx("div",{children:"No Publications Found"}):a.jsx("div",{children:e.map((t,n)=>a.jsx(GM,{publication:t,index:n},`publication_${n}`))})},QM=()=>{const e=it(),t=fe(HM),n=fe(BM),r=()=>{window.scrollTo(0,0),e(Cd(!1)),e(dl({current_page:1})),e(kr())},o=()=>{e(VM()),window.scrollTo(0,0),e(kr())};if(!t.journals)return a.jsx("p",{children:"Loading filters..."});const s=l=>{e(Rg({name:l.target.name,value:l.target.value}))},i=l=>{e(Rg({name:l.target.name,value:l.target.value}))};return a.jsx("div",{className:"row sticky-top mb-2",children:a.jsxs("div",{className:"col",children:[a.jsx("h3",{className:"mb-2",children:"Filters"}),a.jsx("h5",{id:"journals_filter_label",className:"mb-1",children:"Journals"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("input",{placeholder:"Type to search...",list:"journal_list",name:"journal",id:"journal_select",value:n.journal,className:"form-control","aria-labelledby":"journal_filter_label",onChange:l=>s(l),onInput:l=>i(l)}),a.jsx("datalist",{id:"journal_list",children:t.journals.map((l,c)=>a.jsx("option",{value:l,children:l},`journal_${c}`))})]}),a.jsx("h5",{id:"author_name_label",className:"mb-1",children:"Author Name"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{placeholder:"Last Name, First Initial",type:"text",className:"form-control",value:n.authorName,name:"authorName",id:"authorName","aria-labelledby":"author_name",onChange:s})}),a.jsx("h5",{id:"doi_number_label",className:"mb-1",children:"DOI"}),a.jsx("div",{className:"mb-3",children:a.jsx("input",{type:"text",className:"form-control",value:Td(n.doi),name:"doi",id:"doiNumber","aria-labelledby":"doi_number_label",onChange:s})}),a.jsx("h5",{id:"publication_type_label",className:"mb-1",children:"Publication Type"}),a.jsx("div",{className:"mb-3",children:a.jsxs("select",{name:"publicationType",id:"publication_type_select",value:n.publicationType,className:"form-control","aria-labelledby":"publication_type_label",onChange:l=>s(l),children:[a.jsx("option",{value:"",children:"-- All --"}),t.publication_types.map((l,c)=>a.jsx("option",{value:l,children:l},`publication_type_${c}`))]})}),a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{className:"btn btn-primary me-2",onClick:r,children:"Submit"}),a.jsx("button",{className:"btn btn-secondary",onClick:o,children:"Reset"})]})]})})},Ng=()=>{const e=it(),t=fe(WM),[n,r]=w.useState([]),[o,s]=w.useState("0"),i=Array.from({length:t.last_page},(m,h)=>h),l=10,c={width:"50px",textAlign:"center"};w.useEffect(()=>{f()},[t]);const u=m=>{const h=parseInt(m);e(UM({current_page:m})),e(kr(h))},d=m=>(event.preventDefault(),s("0"),u(m),!1),f=()=>{const m=[];if(t.last_page>l)if(t.current_page>4){m.push(1),m.push("spacer");for(var h=1;h>0;h--)t.current_page-h>1&&m.push(t.current_page-h);m.push(["current",t.current_page]);for(var h=1;h<2;h++)t.current_page+h<=t.last_page&&m.push(t.current_page+h);t.last_page-t.current_page>1&&(m.push("spacer"),m.push(t.last_page))}else[1,2,3,4,5].forEach(x=>{x==t.current_page?m.push(["current",x]):m.push(x)}),m.push("spacer"),m.push(t.last_page);else for(var h=1;h<=t.last_page;h++)h==t.current_page?m.push(["current",h]):m.push(h);r(m)},p=m=>{let h=m,x="";return typeof m=="object"?[h,x]=m:x=m,h=="spacer"?a.jsx("li",{className:"page-item disabled",children:a.jsx("span",{className:"page-link",style:c,children:". . ."})}):h=="current"?a.jsx("li",{className:"page-item active","aria-current":"page",children:a.jsx("span",{className:"page-link",style:c,children:x})}):a.jsx("li",{className:"page-item",children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(h),children:x})})},y=()=>a.jsx("li",{className:"page-item",children:a.jsxs("select",{className:"page-link",style:{...c,height:"100%"},value:o,onChange:m=>d(m.target.value),children:[a.jsx("option",{value:"0",children:"Go To"}),i.map(m=>a.jsx("option",{value:m+1,children:m+1},`page_option_${m}`))]})});return a.jsx("div",{children:a.jsx("nav",{"aria-label":"Pages for the table",children:a.jsxs("ul",{className:"pagination",children:[a.jsx("li",{className:`page-item ${t.current_page==1?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:{width:"50px",textAlign:"center"},onClick:()=>u(t.current_page-1),disabled:t.current_page==1,"aria-label":"Previous Page Button",children:"<"})}),n.map((m,h)=>a.jsx(_e.Fragment,{children:p(m)},`page_${h}`)),t.last_page>l?y():"",a.jsx("li",{className:`page-item ${t.current_page==t.last_page?"disabled":""}`,children:a.jsx("button",{className:"page-link",style:c,onClick:()=>u(t.current_page+1),disabled:t.current_page==t.last_page,"aria-label":"Next Page Button",children:">"})})]})})})},XM=({apiUrl:e})=>{const t=it(),n=fe(zM),r=a.jsx("div",{className:"loadingDiv",children:"Loading ..."});return w.useEffect(()=>{t(LM())},[t]),a.jsx("div",{className:"container-fluid",children:a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"col-sm-3",children:a.jsx(QM,{})}),a.jsxs("div",{className:"col-sm-9",children:[a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Ng,{})})}),a.jsx("div",{className:"row",id:"publicationListRow",children:a.jsx("div",{className:"col",children:n?a.jsx(YM,{}):r})}),a.jsx("div",{className:"row",children:a.jsx("div",{className:"col",children:a.jsx(Ng,{})})})]})]})})},Bw=({id:e,type:t,checked:n,onChange:r})=>a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:e,className:"checkbox",children:[a.jsx("input",{onChange:()=>r(t.allocation_type_id),type:"checkbox",checked:n,id:e}),t.display_allocation_type]})})}),ZM=({types:e,createData:t})=>{const[n,r]=w.useState(""),[o,s]=w.useState([]),i=async(u,d)=>{t(u,d),r(""),s([])};function l(u){let d=o;d.includes(u)?d=d.filter(f=>f!==u):d=[...d,u],s(d)}function c(){s(o.length===e.length?[]:[...e.map(d=>d.allocation_type_id)])}return a.jsxs("table",{className:"table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Type"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:a.jsxs("tr",{children:[a.jsx("td",{style:{width:"150px"},children:a.jsx("input",{type:"text",value:n,className:"form-control",onChange:u=>r(u.target.value)})}),a.jsx("td",{children:a.jsxs("div",{className:"form-inline",children:[a.jsx("div",{className:"control-group",style:{marginBottom:"0px"},children:a.jsx("div",{className:"controls",children:a.jsxs("label",{htmlFor:"select-all-checkbox",className:"checkbox",children:[a.jsx("input",{onChange:()=>c(),type:"checkbox",checked:o.length===e.length,id:"select-all-checkbox"}),"Select All"]})})}),e.map(u=>a.jsx(Bw,{id:`id_create_alloc_type_${u.allocation_type_id}`,type:u,checked:o.includes(u.allocation_type_id),onChange:l},`create_keyword_alloc_t_${u.allocation_type_id}`))]})}),a.jsx("td",{style:{width:"50px"},children:a.jsx("button",{className:"btn btn-primary",type:"button",onClick:async()=>i(n,o),children:"Add"})})]})})]})},JM=({keyword:e,keywordAllocationTypeIds:t,types:n,saveData:r,deleteData:o})=>{const[s,i]=w.useState(!1),[l,c]=w.useState(e.keyword),[u,d]=w.useState(t),f=()=>{i(!1),r(e.keyword_id,l,u)},p=h=>{let x=u;x.includes(h)?x=x.filter(v=>v!==h):x=[...x,h],d(x)};let y="",m=e.keyword.toString();return s?(m=a.jsx("input",{type:"text",id:e.keyword_id,value:l,onChange:h=>c(h.target.value)}),y=n.map(h=>a.jsx(Bw,{checked:u.includes(h.allocation_type_id),id:`keyword_${e.keyword}_alloc_type_${h.allocation_type_id}`,onChange:p,type:h},`keyword_${e.keyword}_alloc_t_${h.allocation_type_id}`))):y=n.filter(h=>t.includes(h.allocation_type_id)).map(h=>h.display_allocation_type).join(", "),a.jsxs("tr",{children:[a.jsxs("td",{children:[" ",m," "]}),a.jsxs("td",{children:[" ",y," "]}),s?a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-warning btn-sm",onClick:()=>i(!1),children:"Cancel"}),a.jsx("button",{className:"btn btn-success btn-sm",onClick:async()=>{f()},children:"Save"})]}):a.jsxs("td",{style:{width:"150px"},children:[a.jsx("button",{style:{marginRight:"5px"},className:"btn btn-primary btn-sm",onClick:()=>i(!0),children:"Edit"}),a.jsx("button",{className:"btn btn-danger btn-sm",onClick:async()=>o(e.keyword_id),children:"Delete"})]})]})};function eD({allocationTypes:e}){const[t,n]=w.useState([]),[r,o]=w.useState([]),[s,i]=w.useState(""),[l,c]=w.useState(!0),u=async h=>{const v=(await h.json()).message??"Error: Changes not saved";h.ok&&await f(),i(v),c(h.ok)},d=async(h,x)=>{const v=await fetch("/keywords",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({value:h,allocation_types:x})});await u(v)},f=async()=>{r.length===0&&o(e);const x=await(await fetch("/keywords",{headers:{"Content-Type":"application/json",Accept:"application/json"}})).json();n(x)},p=async(h,x,v)=>{const g=await fetch(`/keywords/${h}`,{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:JSON.stringify({id:h,keyword:x,allocation_types:v})});await u(g)},y=async h=>{const x=await fetch(`/keywords/${h}`,{headers:{"Content-Type":"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},method:"DELETE"});await u(x)};w.useEffect(()=>{f()},[]);let m=null;return s.length!==0&&(m=a.jsx(be,{color:l?"success":"warning",children:s})),a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Type new keywords separated by semicolons, select the desired allocation types, and then submit."}),a.jsx(a.Fragment,{children:m}),a.jsx(ZM,{types:r,createData:d},"add-keywords"),a.jsx("h3",{children:"Current Keywords"}),a.jsxs("table",{className:"table table-bordered",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Keyword"}),a.jsx("th",{children:"Allocation Types"}),a.jsx("td",{})]})}),a.jsx("tbody",{children:t.map(h=>a.jsx(JM,{keyword:h,keywordAllocationTypeIds:h.allocation_type_keywords.map(x=>x.allocation_type_id),types:r,saveData:p,deleteData:y},h.keyword_id))})]})]})}function tD(e,{bootstrapFonts:t=!0,bootstrapVariables:n=!0,access:r=!1,baseUrl:o=null}={}){const s=e.attachShadow({mode:"open"}),i=document.createElement("div"),l=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div"),d=document.createElement("link"),f=document.createElement("link"),p=document.createElement("link");return o=o??(typeof document>"u"?require("url").pathToFileURL(__filename).href:Np&&Np.src||new URL("xras-ui.cjs",document.baseURI).href).replace(/\/[^/]+$/,""),d.rel="stylesheet",d.href=`${o}/bootstrap.css`,f.rel="stylesheet",f.href=`${o}/xras-ui.css`,p.rel="stylesheet",p.href=`${o}/access.css`,c.appendChild(u),l.appendChild(c),i.appendChild(l),s.appendChild(d),s.appendChild(f),s.appendChild(p),s.appendChild(i),i.classList.add("bootstrap"),n&&l.classList.add("bootstrap-variables"),t&&(c.classList.add("bootstrap-fonts"),c.setAttribute("data-bs-theme","light")),u}function nD({target:e}){St.createRoot(e).render(a.jsx(XC,{}))}function rD({availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r,target:o}){St.createRoot(o).render(a.jsx(gE,{availableResources:e,unavailableResources:t,canAdd:n,relativeUrlRoot:r}))}function oD({resourceId:e,target:t,setExternalSubmit:n,relativeUrlRoot:r}){St.createRoot(t).render(a.jsx(Cx,{resourceId:e,setExternalSubmit:n,relativeUrlRoot:r}))}function sD({target:e,username:t,routes:n}){Ff(n);const r=Mo({reducer:{api:nR}});St.createRoot(e).render(a.jsx(Vr,{store:r,children:a.jsx(fA,{username:t})}))}function iD({target:e,apiUrl:t}){const n=Mo({reducer:{projectsBrowser:RA},preloadedState:{projectsBrowser:{...xw,apiUrl:t}}});St.createRoot(e).render(a.jsx(Vr,{store:n,children:a.jsx(OA,{})}))}function aD({target:e,apiUrl:t}){const n=Mo({reducer:{publicationsBrowser:KM},preloadedState:{publicationsBrowser:{...Lw,apiUrl:t}}});St.createRoot(e).render(a.jsx(Vr,{store:n,children:a.jsx(XM,{apiUrl:t})}))}function zw(){return Mo({reducer:{publications_store:W2}})}function lD({target:e,routes:t}){Ff(t),St.createRoot(e).render(a.jsx(Vr,{store:zw(),children:a.jsx(Iw,{})}))}function cD({target:e,routes:t}){Ff(t),St.createRoot(e).render(a.jsx(Vr,{store:zw(),children:a.jsx(z2,{...JSON.parse(e.dataset.publicationsSelectProps)})}))}function uD({target:e,catalogSources:t,onRamps:n,baseUrl:r}){const o=Mo({reducer:{resourceCatalog:oM}});St.createRoot(e).render(a.jsx(Vr,{store:o,children:a.jsx(SM,{catalogSources:t,onRamps:n,baseUrl:r})}))}function dD({target:e,apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i}){const l=Mo({reducer:{resourceCatalog:PM}});St.createRoot(e).render(a.jsx(Vr,{store:l,children:a.jsx(FM,{apiUrl:t,excludedCategories:n,excludedFilters:r,excludedResources:o,allowedCategories:s,allowedFilters:i})}))}function fD({allocationTypes:e,target:t}){St.createRoot(t).render(a.jsx(eD,{allocationTypes:e}))}exports.allocationsMap=nD;exports.editResource=oD;exports.keywords=fD;exports.onRampsResourceCatalog=uD;exports.projects=sD;exports.projectsBrowser=iD;exports.publications=lD;exports.publicationsBrowser=aD;exports.publicationsSelect=cD;exports.resourceCatalog=dD;exports.resources=rD;exports.shadowTarget=tD;
package/dist/xras-ui.js CHANGED
@@ -21662,7 +21662,7 @@ function lA({ requestId: e, grantNumber: t }) {
21662
21662
  }
21663
21663
  ) : null
21664
21664
  ] }) : null,
21665
- r.isManager && e === r.currentRequestId && u.length > 0 && /* @__PURE__ */ a.jsxs(be, { color: "danger", children: [
21665
+ r.isManager && u.length > 0 && /* @__PURE__ */ a.jsxs(be, { color: "danger", children: [
21666
21666
  "Some project personnel need to update their profiles. You will be unable to submit exchanges, renewals, and other actions until these issues are resolved:",
21667
21667
  /* @__PURE__ */ a.jsx("br", {}),
21668
21668
  /* @__PURE__ */ a.jsx("ul", { className: "fs-6 mb-0", children: u.map((d) => /* @__PURE__ */ a.jsxs("li", { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xras/ui",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "User interface components for XRAS",
5
5
  "repository": "github:access-ci-org/xras-ui",
6
6
  "license": "Apache-2.0",