(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4451],{95906:function(t,e,n){"use strict";n.d(e,{Z:function(){return s}});var r=n(57437),c=n(2265),a=n(9772),i=n.n(a),s=t=>{let{columnSpec:e,data:n,tableNamespace:a,filterData:s,setFilterData:u}=t,o=void 0!==s&&!!e.filter(t=>{var e;return null==t?void 0:null===(e=t.filter)||void 0===e?void 0:e.length}).length,l=function(t,e,n){var r=this,a=(0,c.useRef)(null),i=(0,c.useRef)(0),s=(0,c.useRef)(null),u=(0,c.useRef)([]),o=(0,c.useRef)(),l=(0,c.useRef)(),f=(0,c.useRef)(t),d=(0,c.useRef)(!0);f.current=t;var p="undefined"!=typeof window,m=!e&&0!==e&&p;if("function"!=typeof t)throw TypeError("Expected a function");e=+e||0;var y=!!(n=n||{}).leading,h=!("trailing"in n)||!!n.trailing,v="maxWait"in n,g="debounceOnServer"in n&&!!n.debounceOnServer,b=v?Math.max(+n.maxWait||0,e):null;return(0,c.useEffect)(function(){return d.current=!0,function(){d.current=!1}},[]),(0,c.useMemo)(function(){var t=function(t){var e=u.current,n=o.current;return u.current=o.current=null,i.current=t,l.current=f.current.apply(n,e)},n=function(t,e){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(t):setTimeout(t,e)},c=function(t){if(!d.current)return!1;var n=t-a.current;return!a.current||n>=e||n<0||v&&t-i.current>=b},x=function(e){return s.current=null,h&&u.current?t(e):(u.current=o.current=null,l.current)},j=function t(){var r=Date.now();if(c(r))return x(r);if(d.current){var s=e-(r-a.current);n(t,v?Math.min(s,b-(r-i.current)):s)}},N=function(){if(p||g){var f=Date.now(),m=c(f);if(u.current=[].slice.call(arguments),o.current=r,a.current=f,m){if(!s.current&&d.current)return i.current=a.current,n(j,e),y?t(a.current):l.current;if(v)return n(j,e),t(a.current)}return s.current||n(j,e),l.current}};return N.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,u.current=a.current=o.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?x(Date.now()):l.current},N},[y,v,e,b,h,m,p,g])}((t,e)=>{u({...s,[t]:e})},500);return(0,r.jsxs)("div",{className:"ded-entity-table ded-entity-table-".concat(a),children:[(0,r.jsxs)("div",{className:"ded-entity-table-head",children:[(0,r.jsx)("div",{className:"ded-entity-table-row",children:e.map(t=>(0,r.jsx)("div",{className:i()({...t.className||{}})+" ded-entity-table-cell ded-entity-table-cell-".concat(t.key),children:t.title},t.key))}),o&&(0,r.jsx)("div",{className:"ded-entity-table-row",children:e.map(t=>{var e;return(0,r.jsx)("div",{className:i()({...t.className||{}})+" ded-entity-table-cell ded-entity-table-cell-".concat(t.key),children:null===(e=t.filter)||void 0===e?void 0:e.map(t=>(0,r.jsx)("div",{className:"ded-entity-table-filter",children:t.select?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("select",{value:s[t.key]||"",onChange:e=>{u({...s,[t.key]:e.target.value})},children:t.select.map((t,e)=>{let[n,c]=t;return(0,r.jsx)("option",{value:n,children:c},n)})})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{placeholder:t.hint,defaultValue:s[t.key]||"",onChange:e=>l(t.key,e.target.value)}),(0,r.jsx)("button",{className:"ded-clear",onClick:()=>l(t.key,null),children:"x"})]})},t.key))},t.key)})})]}),(0,r.jsx)("div",{className:"ded-entity-table-body",children:n.map((t,n)=>(0,r.jsx)("div",{className:"ded-entity-table-row","ded-id":t.id,children:e.map(e=>(0,r.jsxs)("div",{className:i()({...e.className||{}})+" ded-entity-table-cell ded-entity-table-cell-".concat(e.key),children:[(0,r.jsx)("div",{className:"ded-entity-table-cell-title",children:e.title}),(0,r.jsx)("div",{className:"ded-entity-table-cell-value",children:e.value(t)})]},e.key))},n))})]})}},93639:function(t,e,n){"use strict";n.d(e,{Z:function(){return l}});var r=n(57437),c=n(2265),a=n(16463),i=n(67233),s=n(95906),u=n(87138),o=t=>{let{offset:e,limit:n,count:c,offsetHref:a,setOffset:i}=t,s=Math.min(e+n,c),o=n*Math.floor((c-1)/n),l=Math.max(0,n*(Math.ceil(e/n)-1)),f=Math.min(o,n*(Math.floor(e/n)+1)),d=(t,e,n)=>(0,r.jsx)("div",{className:"ded-pagination-segment ded-pagination-segment-".concat(e),children:n?(0,r.jsx)(u.default,{href:a(t),onClick:e=>{i(t)},children:e}):(0,r.jsx)("span",{className:"ded-disabled",children:e})});return(0,r.jsxs)("div",{className:"ded-pagination",children:[d(0,"first",e>0),d(l,"prev",e>l),(0,r.jsxs)("div",{className:"ded-pagination-segment ded-pagination-segment-main",children:[(0,r.jsx)("span",{className:"ded-pagination-first",children:1+e})," - ",(0,r.jsx)("span",{className:"ded-pagination-last",children:s})," of ",(0,r.jsx)("span",{className:"ded-pagination-count",children:c})]}),d(f,"next",e<f),d(o,"last",e<o)]})},l=t=>{let{columnSpec:e,tableNamespace:n,getData:u,getDataDependency:l}=t,f=(0,a.useRouter)(),d=(0,a.usePathname)(),p=(0,a.useSearchParams)(),[m,y]=(0,c.useState)([]),[h,v]=(0,c.useState)(null),[g,b]=(0,c.useState)(null),[x,j]=(0,c.useState)({}),N=(0,c.useMemo)(()=>{var t={};return e.forEach(e=>{var n;null===(n=e.filter)||void 0===n||n.forEach(e=>{t[e.key]=!0})}),t},[e]),k=(0,c.useCallback)((t,e,n)=>{let r=new URLSearchParams(e);n?r.set("offset",n):r.delete("offset"),Object.keys(N).forEach(t=>{x[t]?r.set(t,x[t]):r.delete(t)});let c=r.toString();return c?"".concat(t,"?").concat(c):t},[N,x]);return((0,c.useEffect)(()=>{v(parseInt(p.get("offset"))||0),Object.fromEntries(Object.keys(N).map(t=>[t,p.get(t)]))},[p,N]),(0,c.useEffect)(()=>{f.push(k(d,p,h))},[f,k,d,p,h]),(0,c.useEffect)(()=>{null!==h&&u(l,{offset:h,limit:20,...x}).then(t=>{y(t.data.results),b(t.data.count)}).catch(t=>{console.error(t)})},[u,l,...l,h,20,x]),null===m)?(0,r.jsx)(i.V,{}):(0,r.jsxs)(r.Fragment,{children:[!!g&&(0,r.jsx)(o,{offset:h,limit:20,count:g,offsetHref:t=>k(d,p,t),setOffset:v}),(0,r.jsx)(s.Z,{columnSpec:e,data:m,tableNamespace:n,filterData:x,setFilterData:t=>{JSON.stringify(x)!=JSON.stringify(t)&&v(0),j(t)}}),!!g&&(0,r.jsx)(o,{offset:h,limit:20,count:g,offsetHref:t=>k(d,p,t),setOffset:v})]})}},67233:function(t,e,n){"use strict";n.d(e,{V:function(){return c}});var r=n(57437);let c=()=>(0,r.jsxs)("div",{className:"ded-throbber",children:[(0,r.jsx)("div",{className:"ded-throbber-1"}),(0,r.jsx)("div",{className:"ded-throbber-2"})]})},9772:function(t,e){var n;/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var a=typeof n;if("string"===a||"number"===a)t.push(n);else if(Array.isArray(n)){if(n.length){var i=c.apply(null,n);i&&t.push(i)}}else if("object"===a){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){t.push(n.toString());continue}for(var s in n)r.call(n,s)&&n[s]&&t.push(s)}}}return t.join(" ")}t.exports?(c.default=c,t.exports=c):void 0!==(n=(function(){return c}).apply(e,[]))&&(t.exports=n)}()},16463:function(t,e,n){"use strict";n.r(e);var r=n(71169),c={};for(var a in r)"default"!==a&&(c[a]=(function(t){return r[t]}).bind(0,a));n.d(e,c)},77917:function(t,e,n){"use strict";n.d(e,{$K:function(){return _},Ae:function(){return j},Ai:function(){return f},Bq:function(){return Z},EV:function(){return X},F0:function(){return h},G$:function(){return Q},HW:function(){return b},Hy:function(){return T},Ie:function(){return z},N4:function(){return y},Nk:function(){return U},Rw:function(){return k},U5:function(){return K},UU:function(){return v},Ud:function(){return m},VD:function(){return I},Wl:function(){return H},X7:function(){return S},Xl:function(){return R},Xt:function(){return A},Zw:function(){return D},bJ:function(){return F},bM:function(){return C},bb:function(){return w},fQ:function(){return L},gQ:function(){return E},h0:function(){return O},h4:function(){return d},hb:function(){return l},ii:function(){return B},kB:function(){return M},kS:function(){return s},kh:function(){return W},m8:function(){return G},mA:function(){return x},mP:function(){return P},nB:function(){return tt},nm:function(){return g},pu:function(){return q},rw:function(){return Y},s7:function(){return $},uE:function(){return J},vy:function(){return o},x4:function(){return i},xp:function(){return V},y6:function(){return p},z2:function(){return u},zH:function(){return N}});var r=n(73208),c=n(91449);let a=r.Z.create({headers:{"Content-Type":"application/json"}});a.interceptors.request.use(function(t){if(void 0!=document){let e=c.parse(document.cookie).csrftoken;t.headers["X-CSRFToken"]=e}return t},function(t){return Promise.reject(t)}),a.interceptors.response.use(function(t){return t},function(t){return Promise.reject(t)}),a.defaults.withCredentials=!0;let i=async(t,e)=>a.post("/auth/login/",{username:t,password:e}),s=async()=>a.post("/auth/logout/"),u=async(t,e,n)=>a.post("/auth/sign-up/",{username:t,email:e,password:n,next:"/log-in?activateSuccess=1"}),o=async t=>a.post("/auth/password-reset/",{email:t,next:"/reset-password"}),l=async(t,e,n)=>a.post("/auth/password-reset/confirm/",{email:t,password:e,token:n}),f=async()=>a.get("/profile/"),d=async t=>a.put("/profile/",t),p=async()=>a.get("/profile/research-squad/"),m=async t=>a.get("/staff-member/",{params:t}),y=async t=>a.get("/staff-member/".concat(t,"/")),h=async()=>a.get("/partners"),v=async()=>a.get("/database-definition/"),g=async()=>a.get("/faqs"),b=async t=>a.get("/custom-page/".concat(t)),x=async t=>a.get("/publication/",{params:t}),j=async t=>a.get("/featured-article/",{params:t}),N=async t=>a.get("/universities",{params:t}),k=async t=>a.get("/universities/".concat(t)),E=async()=>a.get("/university-totals"),I=async t=>a.get("/financial-partnerships/",{params:t}),w=async t=>a.get("/financial-partnerships/".concat(t)),S=async()=>a.get("/financial-years/"),_=async t=>a.post("/financial-partnerships/",t,{headers:{"content-type":"multipart/form-data"}}),F=async t=>a.get("/research-partnerships/",{params:t}),O=async t=>a.get("/research-partnerships/".concat(t)),R=async t=>a.post("/research-partnerships/",t,{headers:{"content-type":"multipart/form-data"}}),M=async t=>a.get("/academic-partnerships/",{params:t}),A=async t=>a.get("/academic-partnerships/".concat(t)),C=async t=>a.post("/academic-partnerships/",t,{headers:{"content-type":"multipart/form-data"}}),P=async t=>a.get("/actions/",{params:t}),q=async t=>a.get("/actions/".concat(t)),D=async t=>t.id?a.put("/actions/".concat(t.id,"/"),t):a.post("/actions/",t),T=async t=>a.get("/action-file/".concat(t)),Z=async t=>a.get("/action-file/",{params:{action_id:t}}),H=async(t,e)=>a.post("/action-file/",{action:t,file:e},{headers:{"content-type":"multipart/form-data"}}),U=async t=>a.patch("/action-file/".concat(t.id,"/"),{description:t.description}),V=async t=>a.delete("/action-file/".concat(t,"/")),L=async t=>a.get("/fois/",{params:t}),W=async t=>a.get("/fois/".concat(t)),X=async t=>t.id?a.put("/fois/".concat(t.id,"/"),t):a.post("/fois/",t),B=async t=>a.get("/foi-file/".concat(t)),J=async t=>a.get("/foi-file/",{params:{foi_id:t}}),$=async(t,e)=>a.post("/foi-file/",{foi:t,file:e},{headers:{"content-type":"multipart/form-data"}}),z=async t=>a.patch("/foi-file/".concat(t.id,"/"),{description:t.description}),K=async t=>a.delete("/foi-file/".concat(t,"/")),Q=async t=>a.get("/policies/",{params:t}),G=async t=>a.get("/policies/".concat(t)),Y=async()=>a.get("/policy-types/"),tt=async()=>a.get("/investment-companies/");e.ZP=a},49842:function(t,e,n){"use strict";n.d(e,{I1:function(){return c},Kn:function(){return r},R4:function(){return a},le:function(){return s},yE:function(){return i}});let r=t=>t.replace(/\/api.*$/,"/admin"),c={actionItem:t=>"/data/action/".concat(t),actionItemEdit:t=>"/data/action/".concat(t,"/edit"),actionFileItem:(t,e)=>"/data/action/".concat(t,"/file/").concat(e),actionFileEdit:(t,e)=>"/data/action/".concat(t,"/file/").concat(e,"/edit"),foiItem:t=>"/data/foi/".concat(t),foiItemEdit:t=>"/data/foi/".concat(t,"/edit"),foiFileItem:(t,e)=>"/data/foi/".concat(t,"/file/").concat(e),foiFileEdit:(t,e)=>"/data/foi/".concat(t,"/file/").concat(e,"/edit"),academicItem:t=>"/data/academic/".concat(t),financialItem:t=>"/data/financial/".concat(t),researchItem:t=>"/data/research/".concat(t),researchItemEdit:t=>"/data/research/".concat(t,"/edit"),universityItem:t=>"/data/university/".concat(t),universityActionNew:t=>"".concat(c.universityItem(t),"/action/new"),universityActionList:t=>"".concat(c.universityItem(t),"/action"),universityFoiNew:t=>"".concat(c.universityItem(t),"/foi/new"),universityFoiList:t=>"".concat(c.universityItem(t),"/foi"),universityPolicyList:t=>"".concat(c.universityItem(t),"/policy")},a={universityItemEdit:t=>"/university_db/university/".concat(t,"/change/"),actionItemEdit:t=>"/university_db/actiontracker/".concat(t,"/change/"),foiItemEdit:t=>"/university_db/foi/".concat(t,"/change/"),policyItemEdit:t=>"/university_db/policy/".concat(t,"/change/"),academicItemEdit:t=>"/university_db/academicpartnership/".concat(t,"/change/"),financialItemEdit:t=>"/university_db/financialpartnership/".concat(t,"/change/"),researchItemEdit:t=>"/university_db/researchpartnership/".concat(t,"/change/")},i=(t,e)=>c["".concat(t,"Item")](e),s=Object.assign({},{overview:{title:"overview",segment:""}},Object.fromEntries(Object.entries({policy:{title:"policies",count:"num_policy"},financial:{title:"financial partnerships",count:"num_financial"},research:{title:"research partnerships",count:"num_research"},academic:{title:"academic partnerships",count:"num_academic"},foi:{title:"FOI requests",count:"num_foi"},action:{title:"actions",count:"num_action"}}).map(t=>{let[e,n]=t;return[e,{...n,segment:"/".concat(e),addSegment:"/add-".concat(e),addTitle:"add ".concat(n.title)}]})))}}]);