1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9a00a361-be28-43f7-b10e-fe08543f1d43",e._sentryDebugIdIdentifier="sentry-dbid-9a00a361-be28-43f7-b10e-fe08543f1d43")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5263],{9353:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/hr/[tenant]/performance/cycles/new",function(){return r(88598)}])},79337:function(e,t,r){"use strict";var a=r(52322),n=r(55351),s=r(45847),l=r.n(s),o=r(13980),i=r.n(o);let c=e=>{let{title:t="The leading job board for the modern workforce.",description:r="The #1 job board for the modern workforce.",canonical:s="https://www.elevolt.co.ke/",page:o="",thirdParty:i=!0,children:c}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.PB,{canonical:s+o,description:"".concat(r," | Elevolt"),facebook:{appId:"346824926505117"},openGraph:{type:"website",url:s+o,title:"".concat(t," | Elevolt"),description:"".concat(r," | Elevolt"),images:[{url:"https://www.elevolt.co.ke/elevolt-og.png",width:1600,height:800,alt:"Elevolt"}],site_name:"Elevolt"},title:"".concat(t," | Elevolt"),twitter:{handle:"@ElevoltK",site:"@ElevoltK",cardType:"summary_large_image"}}),!!i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l(),{id:"hs-script-loader",src:"//js-eu1.hs-scripts.com/25842252.js",strategy:"lazyOnload"}),(0,a.jsx)(l(),{dangerouslySetInnerHTML:{__html:"(function(h,o,t,j,a,r){\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n h._hjSettings={hjid:2328489,hjsv:6};\n a=o.getElementsByTagName('head')[0];\n r=o.createElement('script');r.async=1;\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n a.appendChild(r);\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');"},id:"hotjar",strategy:"lazyOnload"}),(0,a.jsx)(l(),{dangerouslySetInnerHTML:{__html:"!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '583365066890254');\n fbq('track', 'PageView');"},id:"meta",strategy:"lazyOnload"}),(0,a.jsx)("noscript",{children:(0,a.jsx)("img",{height:"1",src:"https://www.facebook.com/tr?id=583365066890254&ev=PageView&noscript=1",style:{display:"none"},width:"1"})})]}),c]})};c.propTypes={title:i().string,description:i().string,canonical:i().string,page:i().string,thirdParty:i().bool,children:i().node},t.Z=c},88598:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return eW}});var a=r(52322),n=r(13980),s=r.n(n),l=r(2784),o=r(47023),i=r(77590),c=r(82292),d=r(75588),u=r(84475),p=r(79337),m=r(79147),h=e=>{let t={};t.review_template_id=e.reviewTemplateId,t.name=(e.name||"").trim(),t.type=e.type,t.scope_type=e.scopeType,t.purpose=e.purpose;let r=(e.description||"").trim();if(""!==r&&(t.description=r),[["nomination_opens_at",e.nominationOpensAt],["nomination_closes_at",e.nominationClosesAt],["review_opens_at",e.nominationClosesAt],["review_closes_at",e.reviewClosesAt],["release_target_at",e.releaseTargetAt]].forEach(e=>{let[r,a]=e;if("string"!=typeof a)return;let n=a.trim();""!==n&&(t[r]=n)}),e.scopeType===m.lP.DEPARTMENTS){t.include_sub_departments=!!e.includeSubDepartments;let r=Array.isArray(e.departmentIds)?e.departmentIds:[];r.length>0&&(t.department_ids=[...r])}if(e.scopeType===m.lP.EXPLICIT){let r=Array.isArray(e.userIds)?e.userIds:[];r.length>0&&(t.user_ids=[...r])}if(t.calibration_enabled=!!e.calibrationEnabled,t.moderation_enabled=!!e.moderationEnabled,e.purpose===m.tt.EVALUATION){let r=(0,m.LK)(e.appealWindowDays);null!==r&&(t.appeal_window_days=r)}let a=(0,m.LK)(e.minPeers);null!==a&&(t.min_peers=a);let n=(0,m.LK)(e.maxPeers);return null!==n&&(t.max_peers=n),t};let g={SET_STEP:"SET_STEP",COMPLETE_STEP:"COMPLETE_STEP",GO_TO_STEP:"GO_TO_STEP",SET_NAME:"SET_NAME",SET_DESCRIPTION:"SET_DESCRIPTION",SET_TYPE:"SET_TYPE",SET_PURPOSE:"SET_PURPOSE",SET_DATE:"SET_DATE",SET_REVIEW_TEMPLATE_ID:"SET_REVIEW_TEMPLATE_ID",SET_SCOPE_TYPE:"SET_SCOPE_TYPE",SET_DEPARTMENT_IDS:"SET_DEPARTMENT_IDS",SET_INCLUDE_SUB_DEPARTMENTS:"SET_INCLUDE_SUB_DEPARTMENTS",SET_USER_IDS:"SET_USER_IDS",SET_CALIBRATION_ENABLED:"SET_CALIBRATION_ENABLED",SET_MODERATION_ENABLED:"SET_MODERATION_ENABLED",SET_APPEAL_WINDOW_DAYS:"SET_APPEAL_WINDOW_DAYS",SET_MIN_PEERS:"SET_MIN_PEERS",SET_MAX_PEERS:"SET_MAX_PEERS",SET_ERRORS:"SET_ERRORS",CLEAR_ERROR:"CLEAR_ERROR",RESET:"RESET"},f={currentStep:0,completedSteps:new Set,name:"",description:"",type:m.$l[0].value,purpose:m.tt.DEVELOPMENT,nominationOpensAt:"",nominationClosesAt:"",reviewClosesAt:"",releaseTargetAt:"",reviewTemplateId:"",scopeType:m.lP.COMPANY,departmentIds:[],includeSubDepartments:!0,userIds:[],calibrationEnabled:!1,moderationEnabled:!1,appealWindowDays:"",processTouched:!1,minPeers:"3",maxPeers:"5",errors:{}},y=(e,t)=>{switch(t.type){case g.SET_STEP:return{...e,currentStep:t.payload};case g.COMPLETE_STEP:{let r=new Set(e.completedSteps);return r.add(t.payload),{...e,completedSteps:r}}case g.GO_TO_STEP:{let r=new Set(e.completedSteps);return t.payload>e.currentStep&&r.add(e.currentStep),{...e,currentStep:t.payload,completedSteps:r}}case g.SET_NAME:return{...e,name:t.payload};case g.SET_DESCRIPTION:return{...e,description:t.payload};case g.SET_TYPE:return{...e,type:t.payload};case g.SET_PURPOSE:if(e.processTouched)return{...e,purpose:t.payload};return{...e,purpose:t.payload,...(0,m.X6)(t.payload)};case g.SET_DATE:{let{field:r,value:a}=t.payload;return{...e,[r]:a}}case g.SET_REVIEW_TEMPLATE_ID:return{...e,reviewTemplateId:t.payload};case g.SET_SCOPE_TYPE:return{...e,scopeType:t.payload,departmentIds:t.payload===m.lP.DEPARTMENTS?e.departmentIds:[],userIds:t.payload===m.lP.EXPLICIT?e.userIds:[]};case g.SET_DEPARTMENT_IDS:return{...e,departmentIds:t.payload};case g.SET_INCLUDE_SUB_DEPARTMENTS:return{...e,includeSubDepartments:t.payload};case g.SET_USER_IDS:return{...e,userIds:t.payload};case g.SET_CALIBRATION_ENABLED:return{...e,calibrationEnabled:t.payload,processTouched:!0};case g.SET_MODERATION_ENABLED:return{...e,moderationEnabled:t.payload,processTouched:!0};
1case g.SET_APPEAL_WINDOW_DAYS:return{...e,appealWindowDays:t.payload,processTouched:!0};case g.SET_MIN_PEERS:return{...e,minPeers:t.payload};case g.SET_MAX_PEERS:return{...e,maxPeers:t.payload};case g.SET_ERRORS:return{...e,errors:t.payload};case g.CLEAR_ERROR:{let r={...e.errors};return delete r[t.payload],{...e,errors:r}}case g.RESET:return{...f,completedSteps:new Set};default:return e}},x=(0,l.createContext)(null),b=e=>{let{children:t}=e,[r,n]=(0,l.useReducer)(y,{...f,completedSteps:new Set}),s=r.currentStep,o=(0,l.useMemo)(()=>({setStep:e=>n({type:g.SET_STEP,payload:e}),completeStep:e=>n({type:g.COMPLETE_STEP,payload:e}),goToStep:e=>n({type:g.GO_TO_STEP,payload:e}),nextStep:()=>{let e=Math.min(s+1,m.kx.length-1);n({type:g.COMPLETE_STEP,payload:s}),n({type:g.SET_STEP,payload:e})},prevStep:()=>n({type:g.SET_STEP,payload:Math.max(s-1,0)}),setName:e=>n({type:g.SET_NAME,payload:e}),setDescription:e=>n({type:g.SET_DESCRIPTION,payload:e}),setType:e=>n({type:g.SET_TYPE,payload:e}),setPurpose:e=>n({type:g.SET_PURPOSE,payload:e}),setDate:(e,t)=>n({type:g.SET_DATE,payload:{field:e,value:t}}),setReviewTemplateId:e=>n({type:g.SET_REVIEW_TEMPLATE_ID,payload:e}),setScopeType:e=>n({type:g.SET_SCOPE_TYPE,payload:e}),setDepartmentIds:e=>n({type:g.SET_DEPARTMENT_IDS,payload:e}),setIncludeSubDepartments:e=>n({type:g.SET_INCLUDE_SUB_DEPARTMENTS,payload:e}),setUserIds:e=>n({type:g.SET_USER_IDS,payload:e}),setCalibrationEnabled:e=>n({type:g.SET_CALIBRATION_ENABLED,payload:e}),setModerationEnabled:e=>n({type:g.SET_MODERATION_ENABLED,payload:e}),setAppealWindowDays:e=>n({type:g.SET_APPEAL_WINDOW_DAYS,payload:e}),setMinPeers:e=>n({type:g.SET_MIN_PEERS,payload:e}),setMaxPeers:e=>n({type:g.SET_MAX_PEERS,payload:e}),setErrors:e=>n({type:g.SET_ERRORS,payload:e}),clearError:e=>n({type:g.CLEAR_ERROR,payload:e}),reset:()=>n({type:g.RESET})}),[s]),i=(0,l.useCallback)(()=>h(r),[r]),c=(0,l.useMemo)(()=>({state:r,actions:o,steps:m.kx,buildPayload:i,isFirstStep:0===s,isLastStep:s===m.kx.length-1}),[r,o,i,s]);return(0,a.jsx)(x.Provider,{value:c,children:t})};b.propTypes={children:s().node.isRequired};let v=()=>{let e=(0,l.useContext)(x);if(!e)throw Error("useCycleWizard must be used within a CycleWizardProvider");return e};var E=r(99157),T=r(62202),w=r(30900),j=r(78690),S=r(59820),N=r(60418),_=r(47477),P=r(82036);let C=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(P.JW,"tenant/").concat((0,_.d_)(),"/").concat(e)},I=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return["reviewTemplateList",e]},R=e=>["reviewTemplateDetail",e],A=function(){let{perPage:e=100,enabled:t=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={per_page:e},a=!(0,_.Xu)(),n=(0,S.a)({queryKey:I(r),enabled:!!t&&!a,queryFn:async()=>(await N.Z.get(C("review-templates"),{params:r,headers:(0,u.g0)({realm:"hr"})})).data}),s=(0,l.useMemo)(()=>n.error?(0,c.I6)(n.error,{fallback:"We could not load your question templates. Please try again."}):null,[n.error]);return{...n,isMissingContext:a,templateError:s}},k=function(){let{rtid:e,enabled:t=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=!(0,_.Xu)()||!e,a=(0,S.a)({queryKey:R(e),enabled:!!t&&!r,queryFn:async()=>{var t;return null===(t=(await N.Z.get(C("review-templates/".concat(e)),{headers:(0,u.g0)({realm:"hr"})})).data)||void 0===t?void 0:t.data}}),n=(0,l.useMemo)(()=>a.error?(0,c.I6)(a.error,{fallback:"We could not load this template. Please try again."}):null,[a.error]);return{...a,isMissingContext:r,templateError:n}};var O=r(23627),M=r(12524),q=r.n(M),D=r(76467);let Z=(0,a.jsx)("svg",{"aria-hidden":"true",className:"h-4 w-4",fill:"none",stroke:"currentColor",strokeWidth:"3",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M5 13l4 4L19 7",strokeLinecap:"round",strokeLinejoin:"round"})}),L=(0,a.jsxs)("svg",{"aria-hidden":"true",className:"h-4 w-4",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,a.jsx)("path",{d:"M12 7.5v5m0 3.5h.01",strokeLinecap:"round",strokeLinejoin:"round"})]}),W="Needs attention",B=new Map([["completed",{ring:"border-blue bg-blue text-white",label:"text-gray-700"}],["current",{ring:"border-blue bg-white text-blue",label:"text-blue"}],["upcoming",{ring:"border-gray-300 bg-white text-gray-500",label:"text-gray-500"}
1],["invalid",{ring:"border-red-600 bg-red-50 text-red-700",label:"text-red-700"}]]),F=e=>"string"==typeof e?e:Array.isArray(e)?e.filter(e=>"string"==typeof e).join(" "):"",U=e=>new Map((e instanceof Map?[...e]:Object.entries(e||{})).map(e=>{let[t,r]=e;return[t,F(r)]})),K=(e,t,r)=>e===t?"current":r.has(e)?"completed":"upcoming",H=(e,t)=>"invalid"===e?L:"completed"===e?(0,a.jsxs)(a.Fragment,{children:[Z,(0,a.jsx)(D.Z,{className:"sr-only",variant:"caption",children:"Completed"})]}):(0,a.jsx)(D.Z,{as:"span",color:"text-current",variant:"captionMedium",children:t+1}),V=e=>{let{steps:t,currentStep:r,completedSteps:n=[],stepErrors:s={},onStepSelect:l,ariaLabel:o="Progress",className:i}=e;if(0===t.length)return null;let c=n instanceof Set?n:new Set(n),d=U(s),u=Math.min(Math.max(Number.isFinite(r)?Math.trunc(r):0,0),t.length-1),p=t.map((e,t)=>({id:e.id,index:t,label:e.label})).filter(e=>d.has(e.id));return(0,a.jsxs)("nav",{"aria-label":o,className:q()("w-full",i),children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 md:hidden",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[(0,a.jsx)(D.Z,{as:"span",color:"text-gray-500",variant:"caption",children:"Step ".concat(u+1," of ").concat(t.length)}),(0,a.jsx)(D.Z,{as:"span",color:"text-gray-900",variant:"labelValue",children:t[u].label})]}),(0,a.jsx)("div",{"aria-hidden":"true",className:"h-1.5 w-full overflow-hidden rounded-full bg-gray-200",children:(0,a.jsx)("div",{className:"h-full rounded-full bg-blue",style:{width:"".concat((u+1)/t.length*100,"%")}})}),!!(p.length>0&&l)&&(0,a.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[(0,a.jsx)(D.Z,{as:"span",color:"text-red-700",variant:"caption",children:"".concat(W,":")}),p.map(e=>(0,a.jsx)("button",{className:"rounded underline focus:outline-none focus-visible:ring-2 focus-visible:ring-blue",onClick:()=>l(e.index),type:"button",children:(0,a.jsx)(D.Z,{as:"span",color:"text-red-700",variant:"caption",children:e.label})},e.id))]}),!!(p.length>0&&!l)&&(0,a.jsx)(D.Z,{as:"p",color:"text-red-700",variant:"caption",children:"".concat(W,": ").concat(p.map(e=>e.label).join(", "))})]}),(0,a.jsx)("ol",{className:"hidden md:flex md:items-start",children:t.map((e,t)=>{let r=d.has(e.id),n=d.get(e.id),s=t===u,o=r?"invalid":K(t,u,c),i=B.get(o),p=t<u||c.has(t)||r,m=!!l&&!s,h=m&&!p,g=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:q()("flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2",i.ring),children:H(o,t)}),(0,a.jsxs)("span",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,a.jsx)(D.Z,{as:"span",color:i.label,variant:"labelValue",children:e.label}),!!r&&(0,a.jsx)(D.Z,{as:"span",color:"text-red-700",variant:"caption",children:W}),!!(r&&n)&&(0,a.jsx)(D.Z,{as:"span",color:"text-red-700",variant:"caption",children:n}),!!h&&(0,a.jsx)(D.Z,{as:"span",className:"sr-only",variant:"caption",children:"Finish earlier steps"})]})]}),f="relative flex w-full flex-col items-center gap-2 px-2 py-1 text-center";return(0,a.jsxs)("li",{"aria-current":s?"step":void 0,className:"relative flex flex-1 flex-col items-center",children:[t>0&&(0,a.jsx)("span",{"aria-hidden":"true",className:"absolute right-1/2 top-5 h-0.5 w-full bg-gray-200"}),!!m&&(0,a.jsx)("button",{"aria-disabled":h||void 0,className:q()(f,"rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-blue disabled:cursor-not-allowed"),disabled:h,onClick:()=>l(t),type:"button",children:g}),!m&&(0,a.jsx)("div",{className:f,children:g})]},e.id)})})]})};V.propTypes={steps:s().arrayOf(s().shape({id:s().string.isRequired,label:s().string.isRequired})).isRequired,currentStep:s().number.isRequired,completedSteps:s().oneOfType([s().instanceOf(Set),s().arrayOf(s().number)]),stepErrors:s().oneOfType([s().instanceOf(Map),s().objectOf(s().oneOfType([s().string,s().arrayOf(s().string)]))]),onStepSelect:s().func,ariaLabel:s().string,className:s().string};var z=r(60760),Y=e=>{let{questions:t,subjectCount:r,maxPeers:a}=e;if(!Array.isArray(t)||!Number.isFinite(r)||!Number.isFinite(a))return null;let n=t.filter(e=>Array.isArray(null==e?void 0:e.asked_of)&&e.asked_of.includes("peer")).length,s=Math.min(Math.max(a,0),Math.max(r-1,0)),l=n*s;
1return{peerQuestionCount:n,expectedSubjectsPerRater:s,raterLoad:l,estimatedMinutes:Math.round(l*m.Gz/60)}},Q=r(65232),X=r(95254),G=r(62372),J=r(63798),$=()=>{let{state:e,actions:t}=v();return(0,a.jsxs)("div",{className:"w-full flex flex-col gap-4",children:[(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Basics"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(X.o,{description:"Employees see this name on every review they are asked to write.",error:e.errors.name,label:"Cycle name",name:"name",onChange:e=>t.setName(e.target.value),placeholder:"Q3 2026 review",required:!0,value:e.name}),(0,a.jsx)(G.K,{label:"Description (optional)",name:"description",onChange:e=>t.setDescription(e.target.value),placeholder:"What this round is for, and anything reviewers should know before they start.",rows:3,value:e.description}),(0,a.jsx)(J.P,{error:e.errors.type,label:"How often this cycle runs",name:"type",onChange:e=>t.setType(e.target.value),options:m.$l,required:!0,selected:e.type})]})})]}),(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Purpose"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsxs)("fieldset",{className:"w-full",children:[(0,a.jsx)("legend",{className:"sr-only",children:"Cycle purpose"}),(0,a.jsx)(D.Z,{className:"mb-3",color:"text-gray-600",variant:"bodySmall",children:"This decides what the feedback can be used for. It cannot be changed after the cycle launches."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:m.pY.map(r=>{let n=e.purpose===r.value;return(0,a.jsxs)("label",{className:"flex flex-col gap-2 rounded-md border p-4 cursor-pointer transition-colors ".concat(n?"border-blue bg-blue-50":"border-gray-200 hover:border-gray-300"),htmlFor:"purpose-".concat(r.value),children:[(0,a.jsxs)("span",{className:"flex items-start gap-2",children:[(0,a.jsx)("input",{"aria-label":r.label,checked:n,className:"mt-1",id:"purpose-".concat(r.value),name:"purpose",onChange:()=>t.setPurpose(r.value),type:"radio",value:r.value}),(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)(D.Z,{as:"span",variant:"labelValue",weight:"font-semibold",children:r.label}),(0,a.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:r.summary})]})]}),(0,a.jsx)("ul",{className:"list-disc pl-8 flex flex-col gap-1",children:r.consequences.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:e})},e))})]},r.value)})}),!!e.errors.purpose&&(0,a.jsx)(D.Z,{className:"mt-2",color:"text-red-600",variant:"caption",children:e.errors.purpose})]})})]}),(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Schedule"})}),(0,a.jsxs)(Q.eW,{children:[(0,a.jsx)(D.Z,{className:"mb-3",color:"text-gray-600",variant:"bodySmall",children:"Every date is optional, and two windows may share a date. Reviews open as soon as nominations close."}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:m.ng.map(r=>{let{field:n,label:s}=r;return(0,a.jsx)(X.o,{error:e.errors[n],label:s,name:n,onChange:e=>t.setDate(n,e.target.value),type:"date",value:e[n]},n)})})]})]})]})},ee=r(407),et=r(91516),er=r(1973),ea=r(32128),en=r(36845),es=r(89729),el=r(37903),eo=r(29825);let ei=e=>{let{row:t,isSelected:r,onToggle:n}=e;return(0,a.jsx)("div",{style:{paddingLeft:24*t.depth},children:(0,a.jsx)(ea.J,{checked:r,label:t.name,name:"department-".concat(t.did),onChange:()=>n(t.did),value:t.did})})};ei.propTypes={row:s().shape({did:s().string.isRequired,name:s().string.isRequired,depth:s().number.isRequired}).isRequired,isSelected:s().bool.isRequired,onToggle:s().func.isRequired};let ec=e=>{let{isMissingWorkspace:t,isError:r}=e;return t?{message:"We could not tell which workspace you are in",description:"Check you are signed in to the right workspace, then try again."}:r?{message:"We could not load your departments",description:"Refresh the page, and let an admin know if it keeps happening."}:{message:"No departments yet",description:"Add departments under Organisation before scoping a cycle to them."}},ed=e=>{let{value:t,onChange:r,disabled:n=!1,error:s}=e,{data:o,isPending:i,isFetching:c,error:d}
1=(0,el.Lo)(),u=null==o?void 0:o.data,{rows:p,orphanRows:m}=(0,l.useMemo)(()=>{let e=(0,eo.w8)(u||[]),t=(e.orphans||[]).filter(e=>!e.is_archived).map(e=>({did:e.did,name:e.name,depth:0,isArchived:!1}));return{rows:(0,eo.Z8)(e,{excludeArchived:!0}),orphanRows:t}},[u]),h=(0,l.useMemo)(()=>new Set(t),[t]),g=e=>{n||r(h.has(e)?t.filter(t=>t!==e):[...t,e])},f=p.length>0||m.length>0,y=!(0,_.Xu)()&&i&&!c,x=y||!!d,b=!x&&i,v=ec({isMissingWorkspace:y,isError:!!d});return(0,a.jsxs)("div",{className:"w-full flex flex-col gap-2 fs-exclude","data-hj-suppress":!0,"data-hs-do-not-collect":"true",children:[!!(x||b||!f)&&(0,a.jsx)(er.Z,{description:v.description,design:"wrapped",isError:!!x,isLoading:!!b,message:v.message}),!!(!x&&!b&&f)&&(0,a.jsxs)("div",{className:"max-h-72 overflow-y-auto rounded border border-gray-200 p-3 flex flex-col gap-2",children:[p.map(e=>(0,a.jsx)(ei,{isSelected:h.has(e.did),onToggle:g,row:e},e.did)),m.length>0&&(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-gray-200 flex flex-col gap-2",children:[(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"caption",children:"Not attached to the tree. We could not trace them back to a top-level department, so they would otherwise be impossible to select."}),m.map(e=>(0,a.jsx)(ei,{isSelected:h.has(e.did),onToggle:g,row:e},e.did))]})]}),!!s&&(0,a.jsx)(D.Z,{color:"text-red-600",variant:"caption",children:s})]})};ed.propTypes={value:s().arrayOf(s().string).isRequired,onChange:s().func.isRequired,disabled:s().bool,error:s().string};let eu=[{value:m.lP.COMPANY,label:"Everyone",blurb:"Every active employee in the workspace."},{value:m.lP.DEPARTMENTS,label:"Selected departments",blurb:"Pick departments, optionally including everything beneath them."},{value:m.lP.EXPLICIT,label:"Named employees",blurb:"Pick people one at a time."}],ep=e=>{let{innerProps:t,...r}=e;return(0,a.jsx)(ee.c.MultiValueRemove,{...r,innerProps:{...t,"data-sentry-component":"EmployeeChipRemove"}})};ep.propTypes={innerProps:s().object};let em={MultiValueRemove:ep},eh=e=>{let{subjectCount:t,needsManagerCount:r,departmentsCovered:n,skippedUserCount:s,scopeSizeExceeded:l,isPreviewPending:o,isPreviewError:i,previewErrorMessage:c,userNamesByUid:d,onUserNamesLearned:u}=e,{state:p,actions:h}=v(),{loadOptions:g,searchError:f}=(0,en.Z)({minChars:3}),y=Number.isFinite(n),x=Number.isInteger(s)&&s>0,b=Number.isInteger(r),E=[!0===l?"This scope covers too many employees for us to check manager coverage here.":"We could not check manager coverage for this scope.","We have not counted how many of these employees have no manager, so this is not an all clear.",y?"":"The department count is missing for the same reason.","Check reporting lines under Organisation, or launch knowing this was not checked."].filter(Boolean).join(" "),T=p.userIds.map(e=>({value:e,label:d[e]||e}));return(0,a.jsxs)("div",{className:"w-full flex flex-col gap-4",children:[(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Participants"})}),(0,a.jsxs)(Q.eW,{children:[(0,a.jsxs)("fieldset",{className:"w-full flex flex-col gap-3",children:[(0,a.jsx)("legend",{className:"sr-only",children:"Who this cycle covers"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:eu.map(e=>{let t=p.scopeType===e.value;return(0,a.jsxs)("label",{className:"grid grid-cols-[auto_1fr] gap-x-2 rounded-md border p-3 cursor-pointer transition-colors ".concat(t?"border-blue bg-blue-50":"border-gray-200 hover:border-gray-300"),htmlFor:"scope-".concat(e.value),children:[(0,a.jsx)("input",{"aria-label":e.label,checked:t,className:"mt-1 row-span-2",id:"scope-".concat(e.value),name:"scopeType",onChange:()=>h.setScopeType(e.value),type:"radio",value:e.value}),(0,a.jsx)(D.Z,{as:"span",variant:"labelValue",weight:"font-semibold",children:e.label}),(0,a.jsx)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:e.blurb})]},e.value)})}),!!p.errors.scopeType&&(0,a.jsx)(D.Z,{color:"text-red-600",variant:"caption",children:p.errors.scopeType})]}),p.scopeType===m.lP.DEPARTMENTS&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3",children:[(0,a.jsx)(ea.J,{checked:p.includeSubDepartments,label:"Include every department beneath the ones I pick",name:"includeSubDepartments",onChange:e=>h.setIncludeSubDepartments(e.target.checked)}),(0,a.jsx)(ed,{error:p.errors.departmentIds,onChange:h.setDepartmentIds,value:p.departmentIds})]}),p.scopeType===m.lP.EXPLICIT&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-1 fs-exclude","data-hj-suppress":!0,"data-hs-do-not-collect":"true",children:[(0,a.jsx)(D.Z,{as:"label",htmlFor:"cycle-user-ids",variant:"label",children:"Employees"}),(0,a.jsx)(et.Z,{"aria-label":"Employees",className:"c-react-select",classNamePrefix:"crs",components:em,inputId:"cycle-user-ids",isMulti:!0,loadOptions:g,loadingMessage:()=>"Searching employees...",noOptionsMessage:e=>{let{inputValue:t}=e;return!t||t.length<3?"Type at least ".concat(3," letters of a name"):f?"Employee search is not responding. This does not mean nobody matches; try again in a moment.":'No employees match "'.concat(t,'"')},onChange:e=>{let t=e||[];u(t.reduce((e,t)=>
1({...e,[t.value]:t.label}),{})),h.setUserIds(t.map(e=>e.value))},placeholder:"Search employees by name",value:T}),!!p.errors.userIds&&(0,a.jsx)(D.Z,{color:"text-red-600",variant:"caption",children:p.errors.userIds})]})]})]}),(0,a.jsxs)(Q.ZP,{className:"fs-exclude","data-hj-suppress":!0,"data-hs-do-not-collect":"true",children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Who this covers"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[!!(o||i||null===t)&&(0,a.jsx)(er.Z,{description:i?c||"Change the selection to try again.":"Choose who this cycle covers and the numbers appear here.",design:"wrapped",isError:!!i,isLoading:!!o,message:i?"We could not work out who this covers":"Nothing counted yet"}),!!(!o&&!i&&null!==t)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"rounded-md border border-gray-200 p-3",children:[(0,a.jsx)(D.Z,{variant:"stat",children:t}),(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"caption",children:1===t?"employee reviewed":"employees reviewed"})]}),!!y&&(0,a.jsxs)("div",{className:"rounded-md border border-gray-200 p-3",children:[(0,a.jsx)(D.Z,{variant:"stat",children:n}),(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"caption",children:1===n?"department covered":"departments covered"})]})]}),!!x&&(0,a.jsx)(es.Z,{message:"".concat(s," of the employees you picked ").concat(1===s?"is":"are"," not active in this workspace, so they are not counted above and will not be reviewed.")}),!!(b&&r>0)&&(0,a.jsx)(es.Z,{message:"".concat(r," of these ").concat(1===r?"employees has":"employees have"," no manager assigned, so nobody will be asked for a manager review of them. Assign managers under Organisation to close the gap.")}),!b&&(0,a.jsx)(es.Z,{message:E})]})]})})]})]})};eh.propTypes={subjectCount:s().number,needsManagerCount:s().number,departmentsCovered:s().number,skippedUserCount:s().number,scopeSizeExceeded:s().bool,isPreviewPending:s().bool.isRequired,isPreviewError:s().bool.isRequired,previewErrorMessage:s().string,userNamesByUid:s().objectOf(s().string).isRequired,onUserNamesLearned:s().func.isRequired};var eg=()=>{let{state:e,actions:t}=v(),r=e.purpose===m.tt.EVALUATION;return(0,a.jsxs)("div",{className:"w-full flex flex-col gap-4",children:[(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"How feedback is shown"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:"Peer and upward feedback is grouped, so the employee sees what was said but not who said it. Manager feedback is always attributed to the manager, and self-review answers are the employee's own."}),(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:"Grouping is not a promise of secrecy. A comment naming a specific event can still identify its author, and reviewers are told so before they write."})]})})]}),(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Peer reviewers"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsx)(X.o,{description:"Employees are prompted until they nominate this many.",error:e.errors.minPeers,label:"Minimum peers",min:m.dM,name:"minPeers",onChange:e=>t.setMinPeers(e.target.value),type:"number",value:e.minPeers}),(0,a.jsx)(X.o,{description:"No more than ".concat(m._G,". A higher ceiling means more work for every reviewer."),error:e.errors.maxPeers,label:"Maximum peers",min:m.dM,name:"maxPeers",onChange:e=>t.setMaxPeers(e.target.value),type:"number",value:e.maxPeers})]})})]}),(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Reminders"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:"Reviewers are reminded on the workspace-wide schedule while their reviews are outstanding. That schedule is the same for every cycle and is not set here."})})]}),!!r&&(0,a.jsx)(es.Z,{message:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(D.Z,{as:"span",color:"text-amber-800",variant:"caption",weight:"font-semibold",children:"This is an evaluation cycle, so disclosure rules apply."})," ",(0,a.jsx)(D.Z,{as:"span",color:"text-amber-800",variant:"caption",children:"If feedback from this cycle is used in a decision that affects someone â pay, promotion, discipline or dismissal â you may have to disclose it to them, including feedback shown to them as grouped. That follows from the Data Protection Act 2019, which gives a 7-day access window and no exemption for confidential references, and from Employment Act s.41, which entitles an employee to answer what is said about them. Choose Development on step 1 if the feedback is for growth only."})]})})]})},ef=r(46362),ey=()=>{let{state:e,actions:t}=v(),r=e.purpose===m.tt.EVALUATION;return(0,a.jsx)("div",{className:"w-full flex flex-col gap-4",children:(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Process"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[!r&&(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:"Development cycles never calibrate or moderate, whatever these are set to. Switch the purpose to Evaluation on step 1 if you need either."}),(0,a.jsx)(ef.Z,{checked:e.calibrationEnabled,description:"Managers compare ratings across a group before results are final.",label:"Calibration",name:"calibrationEnabled",onChange:e=>t.setCalibrationEnabled(e.target.checked)}),(0,a.jsx)(ef.Z,{checked:e.moderationEnabled,description:"A second reviewer approves each assessment before it is released.",label:"Moderation",name:"moderationEnabled",onChange:e=>t.setModerationEnabled(e.target.checked)}),!!r&&(0,a.jsx)(X.o,{description:"How long an employee has to appeal after their result is released. Leave blank to use the workspace default. Up to ".concat(m.TT," days."),error:e.errors.appealWindowDays,label:"Appeal window (days)",min:0,name:"appealWindowDays",onChange:e=>t.setAppealWindowDays(e.target.value),placeholder:"14",type:"number",value:e.appealWindowDays}),!r&&(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:"There is no appeal window on a development cycle, because there is no decision to appeal."})]})})]})})};let ex=e=>{if(e<60)return"".concat(e," ").concat(1===e?"minute":"minutes");let t=Math.floor(e/60),r=e%60,a="".concat(t," ").concat(1===t?"hour":"hours");return 0===r?a:"".concat(a," ").concat(r," minutes")},eb=e=>{let{questionCount:t,raterLoad:r}=e;return(0,a.jsxs)("div",{className:"w-full flex flex-col gap-2",children:[!!("number"==typeof t&&t>m.ER)&&(0,a.jsx)(es.Z,{message:"This questionnaire has ".concat(t," questions. Past about ").concat(m.ER,", reviewers start skimming and answer quality drops.")}),null===r&&(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"caption",children:"Pick a questionnaire and a set of participants to see how much work this asks of each reviewer."}),null!==r&&(0,a.jsxs)("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 flex flex-col gap-1",children:[(0,a.jsxs)(D.Z,{as:"span",variant:"labelValue",weight:"font-semibold",children:["About ",ex(r.estimatedMinutes)," of peer reviewing per person"]}),(0,a.jsxs)(D.Z,{color:"text-gray-600",variant:"caption",children:[r.peerQuestionCount," peer"," ",1===r.peerQuestionCount?"question":"questions"," across up to"," ",r.expectedSubjectsPerRater," ",1===r.expectedSubjectsPerRater?"colleague":"colleagues"," is"," ",r.raterLoad," answers, at roughly ",m.Gz," seconds each."]})]})]})};
1eb.propTypes={questionCount:s().number,raterLoad:s().shape({peerQuestionCount:s().number.isRequired,expectedSubjectsPerRater:s().number.isRequired,raterLoad:s().number.isRequired,estimatedMinutes:s().number.isRequired})};let ev=[{value:"self",label:"The employee",blurb:"Their own self-review."},{value:"manager",label:"Their manager",blurb:"Attributed to the manager."},{value:"peer",label:"Their peers",blurb:"Grouped, never attributed."},{value:"upward",label:"Their reports",blurb:"Grouped, never attributed."}],eE=e=>{let{questions:t,isLoading:r,isError:n,errorMessage:s=null}=e,o=(0,l.useMemo)(()=>ev.map(e=>({...e,questions:t.filter(t=>Array.isArray(null==t?void 0:t.asked_of)&&t.asked_of.includes(e.value))})),[t]);return(0,a.jsxs)("div",{className:"w-full flex flex-col gap-3",children:[!!(r||n||0===t.length)&&(0,a.jsx)(er.Z,{description:n?s||"Refresh the page, then pick the questionnaire again.":"Pick a questionnaire to see what each group is asked.",design:"wrapped",isError:!!n,isLoading:!!r,message:n?"We could not load this questionnaire":"Nothing to preview yet"}),!!(!r&&!n&&t.length>0)&&(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-3",children:o.map(e=>(0,a.jsxs)("div",{className:"rounded-md border border-gray-200 p-3 flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(D.Z,{as:"span",variant:"labelValue",weight:"font-semibold",children:e.label}),(0,a.jsxs)(D.Z,{as:"span",color:"text-gray-600",variant:"caption",children:[e.questions.length," ",1===e.questions.length?"question":"questions",". ",e.blurb]})]}),0===e.questions.length&&(0,a.jsx)(D.Z,{color:"text-gray-500",variant:"caption",children:"This group is not asked anything in this questionnaire."}),e.questions.length>0&&(0,a.jsx)("ul",{className:"flex flex-col gap-1.5",children:e.questions.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(D.Z,{as:"span",color:"text-gray-700",variant:"caption",children:e.prompt})},e.rtqid))})]},e.value))})]})};eE.propTypes={questions:s().arrayOf(s().shape({rtqid:s().string,prompt:s().string,asked_of:s().arrayOf(s().string)})).isRequired,isLoading:s().bool.isRequired,isError:s().bool.isRequired,errorMessage:s().string};let eT=e=>{let{templates:t,isTemplatesPending:r,isTemplatesError:n,templatesErrorMessage:s,templateTotal:l,templatePageSize:o,questions:i,isTemplatePending:c,isTemplateError:d,templateErrorMessage:u,questionCount:p,raterLoad:m}=e,{state:h,actions:g}=v(),f=t.map(e=>({value:e.rtid,label:e.name})),y=Number.isInteger(l),x=y?l-t.length:0,b=t.length>=o;return(0,a.jsxs)("div",{className:"w-full flex flex-col gap-4",children:[(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"Questionnaire"})}),(0,a.jsxs)(Q.eW,{children:[!!(r||n||0===t.length)&&(0,a.jsx)(er.Z,{description:n?s||"Refresh the page, and let an admin know if it keeps happening.":"Create a questionnaire before setting up a cycle.",design:"wrapped",isError:!!n,isLoading:r,message:n?"We could not load your questionnaires":"No questionnaires yet"}),!!(!r&&!n&&t.length>0)&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)(J.P,{defaultOption:"Select a questionnaire",description:"The questions freeze onto the cycle when it launches.",error:h.errors.reviewTemplateId,label:"Questionnaire",name:"reviewTemplateId",onChange:e=>g.setReviewTemplateId(e.target.value),options:f,required:!0,selected:h.reviewTemplateId}),!!(y&&x>0)&&(0,a.jsx)(es.Z,{message:"Showing ".concat(t.length," of ").concat(l," questionnaires, in name order. The other ").concat(x," are not listed here.")}),!!(!y&&b)&&(0,a.jsx)(es.Z,{message:"Showing the first ".concat(t.length," questionnaires, in name order. We could not read how many you have, so there may be more that are not listed here.")})]})]})]}),(0,a.jsxs)(Q.ZP,{children:[(0,a.jsx)(Q.Ol,{children:(0,a.jsx)(D.Z,{variant:"sectionHeader",children:"What each group is asked"})}),(0,a.jsx)(Q.eW,{children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(eE,{errorMessage:u,isError:d,isLoading:c,questions:i}),(0,a.jsx)(eb,{questionCount:p,raterLoad:m})]})})]})]})};eT.propTypes={templates:s().arrayOf(s().shape({rtid:s().string,name:s().string})).isRequired,isTemplatesPending:s().bool.isRequired,isTemplatesError:s().bool.isRequired,templatesErrorMessage:s().string,templateTotal:s().number,templatePageSize:s().number.isRequired,questions:s().arrayOf(s().object).isRequired,isTemplatePending:s().bool.isRequired,isTemplateError:s().bool.isRequired,templateErrorMessage:s().string,questionCount:s().number,raterLoad:s().shape({peerQuestionCount:s().number.isRequired,expectedSubjectsPerRater
1:s().number.isRequired,raterLoad:s().number.isRequired,estimatedMinutes:s().number.isRequired})};let ew=m.$l.map(e=>e.value),ej=m.ng.slice(1).map((e,t)=>({earlier:m.ng[t],later:e})),eS=e=>{let t={},r=(e.name||"").trim();return""===r?t.name="Give the cycle a name your team will recognise.":r.length>255&&(t.name="Keep the name to ".concat(255," characters or fewer.")),ew.includes(e.type)||(t.type="Choose how often this cycle runs."),Object.values(m.tt).includes(e.purpose)||(t.purpose="Choose whether this cycle is for development or evaluation."),ej.forEach(r=>{let{earlier:a,later:n}=r,s=e[a.field],l=e[n.field];s&&l&&(l>=s||(t[n.field]="".concat(n.label," cannot be before ").concat(a.label.toLowerCase(),".")))}),t},eN=(e,t)=>{let r={};return e.reviewTemplateId?t.isTemplateResolved&&0===t.questionCount&&(r.reviewTemplateId="This questionnaire has no questions yet. Add some, or pick another one."):r.reviewTemplateId="Choose the questionnaire this cycle will use.",r},e_=(e,t)=>{let r={};return Object.values(m.lP).includes(e.scopeType)?e.scopeType===m.lP.DEPARTMENTS&&0===e.departmentIds.length?r.departmentIds="Select at least one department.":e.scopeType===m.lP.EXPLICIT&&0===e.userIds.length?r.userIds="Select at least one employee.":t.isPreviewResolved&&0===t.subjectCount&&(r.scopeType="This selection covers nobody. Widen it, or assign employees to these departments first."):r.scopeType="Choose who this cycle covers.",r},eP=e=>{let t={};if(e.purpose!==m.tt.EVALUATION)return t;let r=(0,m.LK)(e.appealWindowDays);return""!==e.appealWindowDays&&null===r?t.appealWindowDays="Enter the appeal window as a whole number of days.":null===r||(r<0?t.appealWindowDays="The appeal window cannot be negative.":r>m.TT&&(t.appealWindowDays="Keep the appeal window to ".concat(m.TT," days or fewer."))),t},eC=e=>{let t={},r=(0,m.LK)(e.minPeers),a=(0,m.LK)(e.maxPeers);return null===r?t.minPeers="Enter the minimum number of peer reviewers.":r<m.dM&&(t.minPeers="Ask for at least ".concat(m.dM," peer reviewer.")),null===a?t.maxPeers="Enter the maximum number of peer reviewers.":a<m.dM?t.maxPeers="Allow at least ".concat(m.dM," peer reviewer."):a>m._G&&(t.maxPeers="Allow no more than ".concat(m._G," peer reviewers.")),null!==r&&null!==a&&r>a&&(t.minPeers=m.yL),t},eI=new Map([["name",m.NT.BASICS],["description",m.NT.BASICS],["type",m.NT.BASICS],["purpose",m.NT.BASICS],["nominationOpensAt",m.NT.BASICS],["nominationClosesAt",m.NT.BASICS],["reviewClosesAt",m.NT.BASICS],["releaseTargetAt",m.NT.BASICS],["reviewTemplateId",m.NT.QUESTIONNAIRE],["scopeType",m.NT.PARTICIPANTS],["departmentIds",m.NT.PARTICIPANTS],["userIds",m.NT.PARTICIPANTS],["includeSubDepartments",m.NT.PARTICIPANTS],["calibrationEnabled",m.NT.PROCESS],["moderationEnabled",m.NT.PROCESS],["appealWindowDays",m.NT.PROCESS],["minPeers",m.NT.PRIVACY],["maxPeers",m.NT.PRIVACY]]),eR=(e,t)=>{let r=new Map;return Object.entries(e||{}).forEach(e=>{let[a,n]=e,s=eI.get(a);if(void 0===s||!n)return;let l=t[s];!l||r.has(l.id)||r.set(l.id,n)}),r},eA=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(e){case m.NT.BASICS:return eS(t);case m.NT.QUESTIONNAIRE:return eN(t,r);case m.NT.PARTICIPANTS:return e_(t,r);case m.NT.PROCESS:return eP(t);case m.NT.PRIVACY:return eC(t);default:return{}}},ek=e=>{let{onNext:t,onCreate:r,isSubmitting:n}=e,{actions:s,isFirstStep:l,isLastStep:i}=v();return(0,a.jsxs)("div",{className:"flex justify-between items-center pt-6 border-t border-gray-200 mt-6",children:[(0,a.jsx)("div",{children:!l&&(0,a.jsx)(o.Z,{design:"secondary",disabled:n,onClick:()=>{s.setErrors({}),s.prevStep()},type:"button",children:"Back"})}),(0,a.jsxs)("div",{className:"flex gap-3",children:[!i&&(0,a.jsx)(o.Z,{disabled:n,onClick:t,type:"button",children:"Continue"}),!!i&&(0,a.jsx)(o.Z,{disabled:n,isLoading:n,onClick:r,type:"button",children:"Create draft"})]})]})};ek.propTypes={onNext:s().func.isRequired,onCreate:s().func.isRequired,isSubmitting:s().bool};var eO=(0,l.memo)(ek);let eM=e=>{let{scopeType:t,departmentIds:r,userIds:a}=e;return t===m.lP.COMPANY||t===m.lP.DEPARTMENTS&&r.length>0||t===m.lP.EXPLICIT&&a.length>0},eq=new Map([["name","name"],["description","description"],["type","type"],["purpose","purpose"],["nomination_opens_at","nominationOpensAt"],["nomination_closes_at","nominationClosesAt"],["review_opens_at","nominationClosesAt"],["review_closes_at","reviewClosesAt"],["release_target_at","releaseTargetAt"],["review_template_id","reviewTemplateId"],["scope_type","scopeType"],["department_ids","departmentIds"],["user_ids","userIds"],["include_sub_departments","includeSubDepartments"],["calibration_enabled","calibrationEnabled"],["moderation_enabled","moderationEnabled"],["appeal_window_days","appealWindowDays"],["min_peers","minPeers"],["max_peers","maxPeers"]]),eD=e=>{let t={},r=null;
1return Object.entries(e).forEach(e=>{let[a,n]=e,s=Array.isArray(n)?n[0]:n;if(!s)return;let l=eq.get(a.split(".")[0]);t[l||a]=s;let o=void 0===l?void 0:eI.get(l);void 0!==o&&(null===r||o<r)&&(r=o)}),{errors:t,step:r}},eZ=e=>{var t,r,n;let{onCreated:s}=e,{state:o,actions:i,steps:d,buildPayload:u,isLastStep:p}=v(),{track:h}=(0,O.Ke)({app:"portal"}),[g,f]=(0,l.useState)({}),y=(0,l.useCallback)(e=>{f(t=>({...t,...e}))},[]),x=A({perPage:100}),b=null===(t=x.data)||void 0===t?void 0:t.data,E=(0,l.useMemo)(()=>b||[],[b]),S=null===(n=x.data)||void 0===n?void 0:null===(r=n.meta)||void 0===r?void 0:r.total,N=Number.isInteger(S)?S:null,_=k({rtid:o.reviewTemplateId,enabled:!!o.reviewTemplateId}),P=_.data||null,C=(0,l.useMemo)(()=>(null==P?void 0:P.questions)||[],[P]),I=!!(o.reviewTemplateId&&!_.isMissingContext&&!_.isPending&&!_.templateError),R=I?C.length:null,M=(0,l.useMemo)(()=>({scopeType:o.scopeType,departmentIds:o.departmentIds,includeSubDepartments:o.includeSubDepartments,userIds:o.userIds}),[o.scopeType,o.departmentIds,o.includeSubDepartments,o.userIds]),q=(0,j.Z)(M,300),Z=q!==M,L=eM(q),W=(0,c.tF)({...q,enabled:L}),B=W.data||null,F=!!(L&&!Z&&!W.isMissingContext&&!W.isPending&&!W.cycleError&&B),U=F?B.subject_count:null,K=Z&&eM(M),H=(0,l.useMemo)(()=>Y({questions:I?C:null,subjectCount:U,maxPeers:(0,m.LK)(o.maxPeers)}),[I,C,U,o.maxPeers]),Q=(0,l.useMemo)(()=>({subjectCount:U,isPreviewResolved:F,questionCount:R,isTemplateResolved:I}),[U,F,R,I]),{mutateAsync:X,isPending:G}=(0,c.Py)(),J=(0,l.useRef)(!1);(0,l.useEffect)(()=>{J.current||(J.current=!0,h(w.dW.PERF_CYCLE_BUILDER_VIEWED,{surface:w.S9.PERFORMANCE_REVIEWS}))},[h]);let ee=(0,l.useCallback)(e=>{h(w.dW.PERF_CYCLE_STEP_COMPLETED,{step:e+1,surface:w.S9.PERFORMANCE_REVIEWS})},[h]),et=(0,l.useCallback)(()=>{let e=eA(o.currentStep,o,Q);if(Object.keys(e).length>0){i.setErrors(e);return}i.setErrors({}),ee(o.currentStep),i.nextStep()},[o,i,Q,ee]),er=(0,l.useCallback)(async()=>{var e,t,r;for(let e=m.NT.BASICS;e<=m.NT.PRIVACY;e+=1){let t=eA(e,o,Q);if(0!==Object.keys(t).length){i.setErrors(t),e!==o.currentStep&&i.setStep(e);return}}i.setErrors({});try{let t=await X(u());ee(m.NT.PRIVACY);let r=E.find(e=>e.rtid===o.reviewTemplateId),a=!!(null===(e=r||P)||void 0===e?void 0:e.is_default);h(w.dW.PERF_CYCLE_CREATED,{cycle_type:o.type,purpose:o.purpose,scope_type:o.scopeType,template_source:a?"default":"custom",surface:w.S9.PERFORMANCE_REVIEWS}),T.default.success("Draft cycle created. Nobody has been notified yet."),s(t,{subjectCount:U,needsManagerCount:F?B.needs_manager_count:null,scopeSizeExceeded:F?B.scope_size_exceeded:null})}catch(s){let e=null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.errors;if(!e)return;let{errors:a,step:n}=eD(e);i.setErrors(a),null!==n&&i.setStep(n)}},[o,i,Q,X,u,ee,h,E,P,U,F,B,s]),ea=Object.keys(o.errors).length>0,en=(0,l.useMemo)(()=>{var e;let t=eR(o.errors,d),r=null===(e=d[o.currentStep])||void 0===e?void 0:e.id;return void 0!==r&&t.has(r)&&t.set(r,""),t},[o.errors,d,o.currentStep]),es=(0,l.useCallback)(e=>{i.goToStep(e)},[i]);return(0,a.jsxs)("div",{className:"w-full flex flex-col",children:[(0,a.jsx)("div",{className:"mb-6 w-full",children:(0,a.jsx)(V,{ariaLabel:"Cycle builder progress",completedSteps:o.completedSteps,currentStep:o.currentStep,onStepSelect:es,stepErrors:en,steps:d})}),!!ea&&(0,a.jsx)(z.Z,{errors:o.errors,title:"Please correct the following before continuing:"}),(0,a.jsx)("div",{className:"mb-6 w-full flex flex-col gap-4",children:(()=>{var e,t,r;switch(o.currentStep){case m.NT.BASICS:return(0,a.jsx)($,{});case m.NT.QUESTIONNAIRE:return(0,a.jsx)(eT,{isTemplateError:!!_.templateError,isTemplatePending:!!(o.reviewTemplateId&&!_.isMissingContext&&_.isPending),isTemplatesError:!!(x.templateError||x.isMissingContext),isTemplatesPending:!!(!x.isMissingContext&&x.isPending),questionCount:R,questions:C,raterLoad:H,templateErrorMessage:null===(e=_.templateError)||void 0===e?void 0:e.message,templatePageSize:100,templateTotal:N,templates:E,templatesErrorMessage:null===(t=x.templateError)||void 0===t?void 0:t.message});case m.NT.PARTICIPANTS:return(0,a.jsx)(eh,{departmentsCovered:F?B.departments_covered:null,isPreviewError:!!(!Z&&(W.cycleError||L&&W.isMissingContext)),isPreviewPending:!!(K||L&&!W.isMissingContext&&W.isPending),needsManagerCount:F?B.needs_manager_count:null,onUserNamesLearned:y,previewErrorMessage:null===(r=W.cycleError)||void 0===r?void 0:r.message,scopeSizeExceeded:F?B.scope_size_exceeded:null,skippedUserCount:F?B.skipped_user_count:null,subjectCount:U,userNamesByUid:g});case m.NT.PROCESS:return(0,a.jsx)(ey,{});case m.NT.PRIVACY:return(0,a.jsx)(eg,{});default:return null}})()}),!!p&&(0,a.jsx)(D.Z,{color:"text-gray-600",variant:"bodySmall",children:"Creating the draft does not notify anyone. You launch it separately, once you have checked it over."}),(0,a.jsx)(eO,{isSubmitting:G,onCreate:er,onNext:et})]})};eZ.propTypes={onCreated:s().func.isRequired};let eL=e=>{var t,r,n,s,u,m;let{tenantName:h}=e,g=(0,c.jC)(),[f,y]=(0,l.useState)(null),x=(0,l.useCallback)((e,t)=>{y({cycle:e,previewCounts:t})},[]),v=(0,l.useCallback)(()=>{var e;g({rcid:null==f?void 0:null===(e=f.cycle)||void 0===e?void 0:e.rcid})},[f,g]),T=(0,l.useMemo)(()=>[{href:"/hr/".concat(h,"/performance"),name:"Performance",nodeType:"Link"},{href:"/hr/".concat(h,"/performance/cycles"),name:"Review cycles",nodeType:"Link"},{href:"/hr/".concat(h,"/performance/cycles/new"),name:"New cycle",nodeType:"Link"}],[h]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.Z,{thirdParty:!1,title:"".concat((0,i.kC)((0,i.parseUnderScore)(h))," - New review cycle")}),(0,a.jsxs)("main",{className:"container flex flex-col gap-4 mx-auto px-4 md:px-8 lg:px-12 pb-6",children:[(0,a.jsx)(d.Z,{breadcrumbs:T,description:f?"Your draft is saved. Launch it when you are ready.":"Set up a round of reviews. Nothing is sent until you lau
1nch it.",tenantName:h,title:f?"Review cycle draft":"New review cycle"}),!f&&(0,a.jsx)(b,{children:(0,a.jsx)(eZ,{onCreated:x})}),!!f&&(0,a.jsx)(E.Z,{cycle:f.cycle,needsManagerCount:null!==(s=null===(t=f.previewCounts)||void 0===t?void 0:t.needsManagerCount)&&void 0!==s?s:null,onLaunched:v,scopeSizeExceeded:null!==(u=null===(r=f.previewCounts)||void 0===r?void 0:r.scopeSizeExceeded)&&void 0!==u?u:null,secondaryAction:(0,a.jsx)(o.Z,{design:"secondary",href:"/hr/".concat(h,"/performance/cycles"),type:"button",children:"Back to cycles"}),subjectCount:null!==(m=null===(n=f.previewCounts)||void 0===n?void 0:n.subjectCount)&&void 0!==m?m:null})]})]})};eL.getInitialProps=async e=>{let{tenant:t}=e.query;return{tenantName:t}},eL.propTypes={tenantName:s().string.isRequired};var eW=(0,u.withAuthSync)(eL)},65232:function(e,t,r){"use strict";r.d(t,{Ol:function(){return l},eW:function(){return o}});var a=r(52322),n=r(13980),s=r.n(n);r(2784);let l=e=>{let{heading:t,padding:r={}}=e,{x:n=4,y:s=3}=r;return(0,a.jsxs)("div",{className:"card-header",children:[(0,a.jsxs)("div",{className:"px-".concat(n," py-").concat(s),children:[!!t&&(0,a.jsx)("h3",{className:"text-xl font-semibold",children:t}),e.children]}),(0,a.jsx)("hr",{className:"border-gray-200"})]})};l.propTypes={heading:s().string,children:s().node,padding:s().object};let o=e=>{let{padding:t=4}=e;return(0,a.jsx)("div",{className:"p-".concat(t," w-full relative"),children:e.children})};o.propTypes={padding:s().number,children:s().node};let i=e=>{let{heading:t,footer:r,className:n="",...s}=e;return(0,a.jsxs)("div",{className:"w-full bg-white rounded ".concat(n),...s,children:[t?(0,a.jsx)(l,{heading:t}):null,e.children,r]})};i.propTypes={heading:s().string,className:s().node,children:s().node,footer:s().node},t.ZP=i},1973:function(e,t,r){"use strict";var a=r(52322),n=r(2369),s=r(92942),l=r(13980),o=r.n(l);r(2784);var i=r(42369);let c=e=>{let{items:t,message:r,description:l,icon:o,showIcon:i,action:c}=e;return(0,a.jsxs)("div",{className:"w-full h-full flex justify-center items-center flex-col p-8",children:[!!i&&(0,a.jsx)(s.FontAwesomeIcon,{className:"text-gray-400 mb-2 text-3xl",icon:o||n.wK3,size:"xl"}),!!t&&(0,a.jsxs)("p",{className:"text-gray-500 text-center font-medium",children:["We couldn't load any ",t,"."]}),!!r&&(0,a.jsx)("p",{className:"text-gray-500 text-center font-medium",children:r}),!!l&&(0,a.jsx)("p",{className:"text-gray-400 text-center text-sm mt-1",children:l}),!!c&&(0,a.jsx)("div",{className:"mt-4",children:c})]})};c.propTypes={showIcon:o().bool,items:o().string,message:o().string,description:o().string,icon:o().object,action:o().node};let d=e=>{let{className:t,isLoading:r,action:l,items:o,message:d,description:u,icon:p,showIcon:m,isError:h}=e;return(0,a.jsxs)("div",{className:"w-full bg-transparent text-center flex flex-col items-center ".concat(t),children:[!r&&!h&&(0,a.jsx)(c,{action:l,description:u,icon:p,items:o,message:d,showIcon:m}),!r&&!!h&&(0,a.jsxs)("div",{className:"w-full flex flex-col justify-center items-center text-red-500",children:[(0,a.jsx)(s.FontAwesomeIcon,{className:"mb-2",icon:n.eHv,size:"xl"}),(0,a.jsx)("p",{className:"text-center font-medium",children:d||"An error occurred loading ".concat(null!=o?o:"data","...")}),!!u&&(0,a.jsx)("p",{className:"text-red-400 text-center text-sm mt-1",children:u}),!!l&&(0,a.jsx)("div",{className:"mt-4",children:l})]}),!!r&&(0,a.jsx)("div",{className:"w-full flex justify-center items-center",children:(0,a.jsx)(i.Z,{size:"sm"})})]})};d.propTypes={items:o().string,message:o().string,description:o().string,icon:o().object,action:o().node,className:o().string,showIcon:o().bool,isLoading:o().bool,isError:o().bool};let u=e=>{let{items:t,message:r,description:n,icon:s,action:l,className:o,showIcon:i=!0,design:c,isLoading:u=!1,isError:p=!1}=e;return"wrapped"===c?(0,a.jsx)("div",{className:"w-full bg-blue-50 p-4 rounded border border-dashed",children:(0,a.jsx)(d,{action:l,className:o,description:n,icon:s,isError:p,isLoading:u,items:t,message:r,showIcon:i})}):(0,a.jsx)(d,{action:l,className:o,description:n,icon:s,isError:p,isLoading:u,items:t,message:r,showIcon:i})};u.propTypes={items:o().string,message:o().string,description:o().string,icon:o().object,action:o().node,className:o().string,
1showIcon:o().bool,design:o().oneOf(["wrapped","default"]),isLoading:o().bool,isError:o().bool},t.Z=u},62372:function(e,t,r){"use strict";r.d(t,{K:function(){return i}});var a=r(52322);r(2784);var n=r(13980),s=r.n(n),l=r(12524),o=r.n(l);let i=e=>{let{label:t,placeholder:r,name:n,error:s,rows:l,onChange:i,value:c,defaultValue:d,className:u,onKeyUp:p,onKeyDownHandler:m,onBlur:h,disabled:g,required:f=!1}=e,y=o()("block","text-sm","font-medium","tracking-wide","mb-1",{"text-gray-700":!s,"text-red-400":s}),x=o()("appearance-none","w-full","px-3","py-2","text-gray-700","bg-white","border","rounded-lg","leading-tight","transition-colors","duration-200","focus:outline-none","focus:ring-2","focus:ring-blue-500","focus:border-transparent","disabled:bg-gray-100","disabled:text-gray-500","disabled:cursor-not-allowed",{"border-gray-300":!s,"border-red-400":s,"focus:ring-red-500":s},u);return(0,a.jsxs)(a.Fragment,{children:[!!t&&(0,a.jsxs)("label",{className:y,htmlFor:n,children:[t,!!f&&(0,a.jsx)("span",{className:"text-red-400 text-xs ml-1",children:"*"})]}),(0,a.jsx)("textarea",{className:x,defaultValue:d,disabled:g,id:n,name:n,onBlur:h,onChange:i,onKeyDown:m,onKeyUp:p,placeholder:r,required:f,rows:l,value:c}),!!s&&(0,a.jsx)("span",{className:"text-red-400 text-xs mt-1 block",children:s})]})};i.propTypes={label:s().string,value:s().string,placeholder:s().string,name:s().string.isRequired,rows:s().number,error:s().string,onChange:s().func.isRequired,defaultValue:s().string,className:s().string,onKeyUp:s().func,onKeyDownHandler:s().func,onBlur:s().func,disabled:s().bool,required:s().bool}},46362:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var a=r(52322),n=r(2784),s=r(13980),l=r.n(s),o=r(12524),i=r.n(o);let c=e=>{let{name:t,checked:r=!1,onChange:s,disabled:l=!1,size:o="md",label:c,labelPosition:d="right",description:u,error:p,className:m,inputClassName:h,labelClassName:g,ariaLabel:f,ariaDescribedBy:y,showIcons:x=!1,checkedIcon:b,uncheckedIcon:v}=e,E=(0,n.useId)(),T=u?"".concat(E,"-description"):void 0,w=p?"".concat(E,"-error"):void 0,j=(0,n.useCallback)(e=>{l||s({...e,target:{...e.target,name:t,checked:!r,type:"checkbox"}})},[l,t,r,s]),S=(0,n.useCallback)(e=>{(" "===e.key||"Enter"===e.key)&&(e.preventDefault(),j(e))},[j]),N={xs:{track:"w-7 h-3.5",thumb:"w-3 h-3",thumbTranslate:r?"translate-x-[14px]":"translate-x-0.5",iconSize:"text-[8px]"},sm:{track:"w-9 h-[18px]",thumb:"w-4 h-4",thumbTranslate:r?"translate-x-[18px]":"translate-x-0.5",iconSize:"text-[10px]"},md:{track:"w-11 h-[22px]",thumb:"w-5 h-5",thumbTranslate:r?"translate-x-[22px]":"translate-x-0.5",iconSize:"text-xs"},lg:{track:"w-[52px] h-[26px]",thumb:"w-6 h-6",thumbTranslate:r?"translate-x-[26px]":"translate-x-0.5",iconSize:"text-sm"}},_=N[o]||N.md,P=i()("relative inline-flex items-center rounded-full cursor-pointer","transition-colors duration-200 ease-in-out","focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-300 focus-visible:ring-offset-1",_.track,{"bg-gray-300 hover:bg-gray-400":!r&&!l,"bg-blue hover:bg-blue-dark":r&&!l,"bg-gray-200":!r&&l,"bg-blue-200":r&&l,"cursor-not-allowed opacity-50":l,"ring-1 ring-red-400":p},h),C=i()("absolute bg-white rounded-full shadow-sm border","transition-transform duration-200 ease-in-out",_.thumb,_.thumbTranslate,{"border-gray-200":!r,"border-blue":r&&!l,"border-blue-200":r&&l}),I=i()("text-gray-700 font-medium cursor-pointer select-none",{"text-xs":"xs"===o,"text-sm":"sm"===o||"md"===o,"text-base":"lg"===o,"cursor-not-allowed opacity-50":l},g),R=i()("inline-flex items-center gap-2",{"flex-row-reverse":"left"===d},m);return(0,a.jsxs)("div",{className:"inline-flex flex-col",children:[(0,a.jsxs)("label",{className:R,htmlFor:t,children:[(0,a.jsxs)("button",{"aria-checked":r,"aria-describedby":y||T||w,"aria-disabled":l,"aria-label":f||c,className:P,disabled:l,id:t,name:t,onClick:j,onKeyDown:S,role:"switch",type:"button",children:[!!x&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:i()("absolute left-1 transition-opacity duration-200",_.iconSize,{"opacity-100":r,"opacity-0":!r}
1),children:b||(0,a.jsx)("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 12 12",children:(0,a.jsx)("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4a1 1 0 00-1.414-1.414L5 6.586 3.707 5.293z"})})}),(0,a.jsx)("span",{className:i()("absolute right-1 transition-opacity duration-200",_.iconSize,{"opacity-0":r,"opacity-100":!r}),children:v||(0,a.jsx)("svg",{className:"w-3 h-3 text-gray-400",fill:"currentColor",viewBox:"0 0 12 12",children:(0,a.jsx)("path",{d:"M4 4l4 4m0-4l-4 4",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})})})]}),(0,a.jsx)("span",{className:C})]}),!!c&&(0,a.jsx)("span",{className:I,children:c})]}),!!u&&(0,a.jsx)("span",{className:"text-gray-500 text-sm mt-1",id:T,children:u}),!!p&&(0,a.jsx)("span",{className:"text-red-400 text-xs mt-1",id:w,children:p})]})};c.propTypes={name:l().string.isRequired,checked:l().bool,onChange:l().func.isRequired,disabled:l().bool,size:l().oneOf(["xs","sm","md","lg"]),label:l().string,labelPosition:l().oneOf(["left","right"]),description:l().string,error:l().string,className:l().string,inputClassName:l().string,labelClassName:l().string,ariaLabel:l().string,ariaDescribedBy:l().string,showIcons:l().bool,checkedIcon:l().node,uncheckedIcon:l().node}},78690:function(e,t,r){"use strict";var a=r(2784);t.Z=function(e,t){let[r,n]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let r=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(r)}},[e,t]),r}},37903:function(e,t,r){"use strict";r.d(t,{E3:function(){return f},EQ:function(){return v},Hg:function(){return g},Lo:function(){return m},b2:function(){return h},e1:function(){return x},zh:function(){return y}});var a=r(59820),n=r(14010),s=r(87686),l=r(60418),o=r(47477),i=r(82036),c=r(84475),d=r(29825),u=r(53651);let p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(i.JW,"tenant/").concat((0,o.d_)(),"/").concat(e)},m=function(){let{enabled:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.a)({queryKey:d.Hq.departments,enabled:!!e&&(0,o.Xu)(),staleTime:6e4,queryFn:async()=>(await l.Z.get(p("departments"),{params:{include_archived:(0,d.Yg)(!0)},headers:(0,c.g0)({realm:"hr"})})).data})},h=function(){let{did:e,includeSubDepartments:t=!1,page:r=1,perPage:n=15,enabled:s=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i={include_sub_departments:(0,d.Yg)(t),page:r,per_page:n};return(0,a.a)({queryKey:d.Hq.departmentMembers(e,i),enabled:!!(s&&e)&&(0,o.Xu)(),placeholderData:(0,u.g)(e),queryFn:async()=>(await l.Z.get(p("departments/".concat(e,"/members")),{params:i,headers:(0,c.g0)({realm:"hr"})})).data})},g=function(){let{onSuccess:e,onError:t,onSettled:r,onMutate:a,silenceFieldErrors:o=!1,...i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=(0,n.NL)();return(0,s.D)({mutationFn:async e=>(await l.Z.post(p("departments"),e,{headers:(0,c.g0)({realm:"hr"})})).data,onMutate:a,onSuccess:(t,r,a)=>{u.invalidateQueries({queryKey:d.Hq.departments}),null==e||e(t,r,a)},onError:(e,r,a)=>{(0,d.t_)(e,{fallback:"Failed to create department. Please try again.",context:"useCreateDepartment",silenceFieldErrors:o}),null==t||t(e,r,a)},onSettled:r,...i})},f=function(){let{onSuccess:e,onError:t,onSettled:r,onMutate:a,silenceFieldErrors:o=!1,...i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=(0,n.NL)();return(0,s.D)({mutationFn:async e=>{let{did:t,...r}=e;return(await l.Z.put(p("departments/".concat(t)),r,{headers:(0,c.g0)({realm:"hr"})})).data},onMutate:a,onSuccess:(t,r,a)=>{u.invalidateQueries({queryKey:d.Hq.departments}),null==e||e(t,r,a)},onError:(e,r,a)=>{(0,d.t_)(e,{fallback:"Failed to update department. Please try again.",context:"useUpdateDepartment",silenceFieldErrors:o}),null==t||t(e,r,a)},onSettled:r,...i})},y=function(){let{onSuccess:e,onError:t,onSettled:r,onMutate:a,silenceFieldErrors:o=!1,...i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=(0,n.NL)();return(0,s.D)({mutationFn:async e=>{let{did:t}=e;return(await l.Z.delete(p("departments/".concat(t)),{headers:(0,c.g0)({realm:"hr"})})).data},onMutate:a,onSuccess:(t,r,a)=>
1{u.invalidateQueries({queryKey:d.Hq.departments}),null==e||e(t,r,a)},onError:(e,r,a)=>{(0,d.t_)(e,{fallback:"Failed to delete department. Please try again.",context:"useDeleteDepartment",silenceFieldErrors:o}),null==t||t(e,r,a)},onSettled:r,...i})},x=function(){let{onSuccess:e,onError:t,onSettled:r,onMutate:a,...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=(0,n.NL)();return(0,s.D)({mutationFn:async e=>{let{did:t,archived:r=!0}=e;return(await l.Z.post(p("departments/".concat(t,"/archive")),{archived:r},{headers:(0,c.g0)({realm:"hr"})})).data},onMutate:a,onSuccess:(t,r,a)=>{i.invalidateQueries({queryKey:d.Hq.departments}),i.invalidateQueries({queryKey:d.Hq.orgAssignmentsRoot}),null==e||e(t,r,a)},onError:(e,r,a)=>{(0,d.t_)(e,{fallback:"Failed to update department status. Please try again.",context:"useArchiveDepartment"}),null==t||t(e,r,a)},onSettled:r,...o})},b=(e,t)=>{let{order:r}=t;if(!(null==e?void 0:e.data))return e;let a=new Map(e.data.map(e=>[e.did,e])),n=[];e.data.forEach((e,t)=>{r.includes(e.did)&&n.push(t)});let s=[...e.data];return r.forEach((e,t)=>{let r=n[t],l=a.get(e);void 0!==r&&l&&(s[r]={...l,position:t})}),{...e,data:s}},v=function(){let{onSuccess:e,onError:t,onSettled:r,onMutate:a,...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=(0,n.NL)();return(0,s.D)({mutationFn:async e=>{let{parentDid:t,order:r}=e;return(await l.Z.post(p("departments/reorder"),{parent_did:null!=t?t:null,order:r},{headers:(0,c.g0)({realm:"hr"})})).data},onMutate:async e=>{await i.cancelQueries({queryKey:d.Hq.departments});let t=i.getQueryData(d.Hq.departments);return t&&i.setQueryData(d.Hq.departments,b(t,e)),{previous:t,callerContext:await (null==a?void 0:a(e))}},onSuccess:(t,r,a)=>{null==e||e(t,r,null==a?void 0:a.callerContext)},onError:(e,r,a)=>{(null==a?void 0:a.previous)&&i.setQueryData(d.Hq.departments,a.previous),(0,d.t_)(e,{fallback:"Failed to reorder departments. Please try again.",context:"useReorderDepartments"}),null==t||t(e,r,null==a?void 0:a.callerContext)},onSettled:(e,t,a,n)=>{i.invalidateQueries({queryKey:d.Hq.departments}),null==r||r(e,t,a,null==n?void 0:n.callerContext)},...o})}},36845:function(e,t,r){"use strict";var a=r(2784),n=r(78690),s=r(90269);t.Z=function(){let{debounceMs:e=300,minChars:t=2}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[r,l]=(0,a.useState)(""),o=(0,n.Z)(r,e),{data:i,isFetching:c,error:d}=(0,s.bD)({search:o,enabled:o.length>=t}),u=d||null,p=(0,a.useMemo)(()=>u||!i?[]:i.map(e=>({label:e.name,value:e.uid})),[i,u]),m=(0,a.useRef)(null),h=(0,a.useRef)("");return(0,a.useEffect)(()=>{m.current&&o===h.current&&!c&&(m.current(p),m.current=null,h.current="")},[o,c,p]),{loadOptions:(0,a.useCallback)(e=>new Promise(r=>{if(!e||e.length<t){r([]);return}m.current=r,h.current=e,l(e)}),[t]),userOptions:p,searchError:u}}},60760:function(e,t,r){"use strict";var a=r(52322),n=r(2369),s=r(92942),l=r(13980),o=r.n(l),i=r(2784);let c=e=>{let{errors:t,title:r="Please correct the following:"}=e,l=(0,i.useMemo)(()=>Object.entries(t).filter(e=>{let[,t]=e;return t}),[t]);return 0===l.length?null:(0,a.jsx)("div",{"aria-labelledby":"validation-summary-title",className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-6",role:"alert",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(s.FontAwesomeIcon,{className:"text-red-500 mt-0.5",icon:n.eHv}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-red-800 m-0 mb-2",id:"validation-summary-title",children:r}),(0,a.jsx)("ul",{className:"list-disc list-inside space-y-1 m-0 p-0",children:l.map(e=>{let[t,r]=e;return(0,a.jsx)("li",{className:"text-sm text-red-700",children:r},t)})})]})]})})};c.propTypes={errors:o().object.isRequired,title:o().string},c.defaultProps={title:"Please correct the following:"},t.Z=c},56486:function(){},91516:function(e,t,r){"use strict";r.d(t,{Z:function(){return m}});var a=r(7896),n=r(2784),s=r(26202),l=r(88137),o=r(56666),i=r(33028),c=r(76854),d=r(59740),u=r(407),p=["defaultOptions","cacheOptions","loadOptions","options","isLoading","onInputChange","filterOption"];r(28316),r(84337);var m=(0,n.forwardRef)(function(e,t){var r,m,h,g,f,y,x,b,v,E,T,w,j,S,N,_,P,C,I,R,A,k,O,M,q,D,Z,L,W,B,F,U,K,H,V,z,Y,Q,X,G,J,$,ee,et,er,ea,en,es,el,eo,ei,ec=(m=void 0!==(r=e.defaultOptions)&&r,g=void 0!==(h=e.cacheOptions)&&h,f=e.loadOptions,e.options,y=e.isLoading,x=e.onInputChange,b=e.filterOption,E=(v=(0,d.Z)(e,p)).inputValue,T=(0,n.useRef)(void 0),w=(0,n.useRef)(!1),j=(0,n.use
1State)(Array.isArray(m)?m:void 0),N=(S=(0,c.Z)(j,2))[0],_=S[1],P=(0,n.useState)(void 0!==E?E:""),I=(C=(0,c.Z)(P,2))[0],R=C[1],A=(0,n.useState)(!0===m),O=(k=(0,c.Z)(A,2))[0],M=k[1],q=(0,n.useState)(void 0),Z=(D=(0,c.Z)(q,2))[0],L=D[1],W=(0,n.useState)([]),F=(B=(0,c.Z)(W,2))[0],U=B[1],K=(0,n.useState)(!1),V=(H=(0,c.Z)(K,2))[0],z=H[1],Y=(0,n.useState)({}),X=(Q=(0,c.Z)(Y,2))[0],G=Q[1],J=(0,n.useState)(void 0),ee=($=(0,c.Z)(J,2))[0],et=$[1],er=(0,n.useState)(void 0),en=(ea=(0,c.Z)(er,2))[0],es=ea[1],g!==en&&(G({}),es(g)),m!==ee&&(_(Array.isArray(m)?m:void 0),et(m)),(0,n.useEffect)(function(){return w.current=!0,function(){w.current=!1}},[]),el=(0,n.useCallback)(function(e,t){if(!f)return t();var r=f(e,t);r&&"function"==typeof r.then&&r.then(t,function(){return t()})},[f]),(0,n.useEffect)(function(){!0===m&&el(I,function(e){w.current&&(_(e||[]),M(!!T.current))})},[]),eo=(0,n.useCallback)(function(e,t){var r=(0,u.L)(e,t,x);if(!r){T.current=void 0,R(""),L(""),U([]),M(!1),z(!1);return}if(g&&X[r])R(r),L(r),U(X[r]),M(!1),z(!1);else{var a=T.current={};R(r),M(!0),z(!Z),el(r,function(e){w&&a===T.current&&(T.current=void 0,M(!1),L(r),U(e||[]),z(!1),G(e?(0,i.Z)((0,i.Z)({},X),{},(0,o.Z)({},r,e)):X))})}},[g,el,Z,X,x]),ei=V?[]:I&&Z?F:N||[],(0,i.Z)((0,i.Z)({},v),{},{options:ei,isLoading:O||void 0!==y&&y,onInputChange:eo,filterOption:void 0===b?null:b})),ed=(0,l.u)(ec);return n.createElement(s.S,(0,a.Z)({ref:t},ed))})},94217:function(e,t,r){"use strict";var a,n,s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}();t._1=function(e){var t;document.body.classList.add("react-confirm-alert-body-element"),function(){if(!document.getElementById("react-confirm-alert-firm-svg")){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"feGaussianBlur");t.setAttribute("stdDeviation","0.3");var r=document.createElementNS(e,"filter");r.setAttribute("id","gaussian-blur"),r.appendChild(t);var a=document.createElementNS(e,"svg");a.setAttribute("id","react-confirm-alert-firm-svg"),a.setAttribute("class","react-confirm-alert-svg"),a.appendChild(r),document.body.appendChild(a)}}(),t=document.getElementById(e.targetId||g),e.targetId&&!t&&console.error("React Confirm Alert:","Can not get element id (#"+e.targetId+")"),t||(document.body.children[0].classList.add("react-confirm-alert-blur"),(t=document.createElement("div")).id=g,document.body.appendChild(t)),(h=(0,d.createRoot)(t)).render(i.default.createElement(m,e))};var o=r(2784),i=u(o),c=u(r(13980)),d=r(17029);function u(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}var m=(n=a=function(e){function t(){(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,t);for(var e,r,a,n=arguments.length,s=Array(n),l=0;l<n;l++)s[l]=arguments[l];return r=a=p(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),a.handleClickButton=function(e){e.onClick&&e.onClick(),a.close()},a.handleClickOverlay=function(e){var t=a.props,r=t.closeOnClickOutside,n=t.onClickOutside,s=e.target===a.overlay;r&&s&&(n(),a.close()),e.stopPropagation()},a.close=function(){var e,t,r,n=a.props.afterClose;document.body.classList.remove("react-confirm-alert-body-element"),e=a.props,(t=document.getElementById(e.targetId||g))&&h.unmount(t),(r=document.getElementById("react-confirm-alert-firm-svg"))&&r.parentNode.removeChild(r),document.body.children[0].classList.remove("react-confirm-alert-blur"),n()},a.keyboard=function(e){var t=a.props,r=t.closeOnEscape,n=t.onKeypressEscape,s=t.onkeyPress,l=t.keyCodeForClose,o=e.keyCode,i=27===o;l.includes(o)&&a.close(),r&&i&&(n(e),a.close()),s&&s()},a.componentDidMount=function(){document.addEventListener("keydown",a.keyboard,!1)},a.componentWillUnmount=function(){document.removeEventListener("keydown",a.keyboard,!1),a.props.willUnmount()},a.renderCustomUI=function(){var e=a.props,t=e.title,r=e.message,n=e.buttons;return(0,e.customUI)({title:t,message:r,buttons:n,onClose:a.close})},p(a,r)}return function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),l(t,[{key:"render",value:function(){var e=this,t=this.props,r=t.title,a=t.message,n=t.buttons,l=t.childrenElement,o=t.customUI,c=t.overlayClassName;return i.default.createElement("div",{className:"react-confirm-alert-overlay "+c,ref:function(t){return e.overlay=t},onClick:this.handleClickOverlay},i.default.createElement("div",{className:"react-confirm-alert"},o?this.renderCustomUI():i.default.createElement("div",{className:"react-confirm-alert-body"},r&&i.default.createElement("h1",null,r),a,l(),i.default.createElement("div",{className:"react-confirm-alert-button-group"},n.map(function(t,r){return i.default.createElement("button",s({key:r,className:t.className},t,{onClick:function(r){return e.handleClickButton(t)}}),t.label)})))))}}]),t}(o.Component),a.propTypes={title:c.default.string,message:c.default.string,buttons:c.default.array.isRequired,childrenElement:c.default.func,customUI:c.default.func,closeOnClickOutside:c.default.bool,closeOnEscape:c.default.bool,keyCodeForClose:c.default.arrayOf(c.default.number),willUnmount:c.default.func,afterClose:c.default.func,onClickOutside:c.default.func,onKeypressEscape:c.default.func,onkeyPress:c.default.func,overlayClassName:c.default.string},a.defaultProps={buttons:[{label:"Cancel",onClick:function(){return null},className:null},{label:"Confirm",onClick:function(){return null},className:null}],childrenElement:function(){return null},closeOnClickOutside:!0,closeOnEscape:!0,keyCodeForClose:[],willUnmount:function(){return null},afterClose:function(){return null},onClickOutside:function(){return null},onKeypressEscape:function(){return null}},n),h=null,g="react-confirm-alert"}},function(e){e.O(0,[5351,9436,9400,9277,2292,610,6441,2888,9774,179],function(){return e(e.s=9353)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.