PageSourceSearch

https://xyrus.ai/_next/static/chunks/907.3771b1933b6e080f.js

js xyrus.ai collected 2026-10-05 15:09:01 UTC 9,739 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[907],{10907:(e,t,l)=>{l.r(t),l.d(t,{default:()=>x});var i=l(95155),s=l(12115),a=l(97003),r=l(33789),n=l(90235),o=l(67001),d=l(25016),c=l(75358),p=l(18720),m=l(99429),u=l(69048);function x(e){let{data:t}=e,{formData:l,errors:x,isDragOver:f,isUploading:h,fileInputRef:g,handleInputChange:b,handleFileRemove:v,handleDragOver:y,handleDragLeave:j,handleDrop:N,handleFileInputChange:C,handleSubmit:k,handleCancel:E}=(e=>{let[t,l]=(0,s.useState)({title:"",description:"",file:null}),[i,a]=(0,s.useState)(!1),[r,n]=(0,s.useState)({}),[o,d]=(0,s.useState)(!1),x=(0,s.useRef)(null),f=(0,c.L2)({method:"post",url:m.Sn.RST_TEMPLATES.UPLOAD}),h=(0,s.useCallback)(()=>{let e={};if(t.title.trim()||(e.title="Template title is required"),t.file){let l=(0,u.nJ)(t.file,["EXCEL"]);l.isValid||(e.file=l.errorMessage||"Invalid file")}else e.file="Please upload an Excel file";return n(e),0===Object.keys(e).length},[t]),g=e=>{n({});let t=(0,u.nJ)(e,["EXCEL"]);if(!t.isValid){p.oR.error("Invalid File",{description:t.errorMessage}),n({file:t.errorMessage||"Invalid file"});return}l(t=>({...t,file:e})),r.file&&n(e=>({...e,file:void 0}))},b=(0,s.useCallback)(e=>{e.preventDefault(),a(!0)},[]),v=(0,s.useCallback)(e=>{e.preventDefault(),a(!1)},[]),y=(0,s.useCallback)(e=>{e.preventDefault(),a(!1);let t=Array.from(e.dataTransfer.files);if(t.length>0){let e=t[0];e&&g(e)}},[]),j=async l=>{var i,s,a;if(l.preventDefault(),!h())return;if(!t.file)return void p.oR.error("Please upload a file");let r=new FormData;r.append("file",t.file),r.append("template_name",t.title),r.append("description",t.description);try{d(!0),null==e||null==(i=e.showLoading)||i.call(e,!0,"Uploading template..."),await f.mutateAsync({data:r,config:{headers:{"Content-Type":"multipart/form-data",accept:"application/json"}}}),p.oR.success("Template uploaded successfully"),(null==e?void 0:e.onSubmit)&&"function"==typeof e.onSubmit&&e.onSubmit(t),(null==e?void 0:e.onUploadComplete)&&"function"==typeof e.onUploadComplete&&e.onUploadComplete(),null==e||null==(s=e.closeModal)||s.call(e)}catch(t){let e=t instanceof Error?t.message:"Failed to upload template";p.oR.error(e)}finally{d(!1),null==e||null==(a=e.showLoading)||a.call(e,!1)}};return{formData:t,errors:r,isDragOver:i,isUploading:o,fileInputRef:x,handleInputChange:(e,t)=>
1{l(l=>({...l,[e]:t})),r[e]&&n(t=>({...t,[e]:void 0}))},handleFileSelect:g,handleFileRemove:()=>{l(e=>({...e,file:null})),n(e=>({...e,file:void 0})),x.current&&(x.current.value="")},handleDragOver:b,handleDragLeave:v,handleDrop:y,handleFileInputChange:e=>{var t;let l=null==(t=e.target.files)?void 0:t[0];l&&g(l)},handleSubmit:j,handleCancel:()=>{var t;(null==e?void 0:e.onCancel)&&"function"==typeof e.onCancel&&e.onCancel(),null==e||null==(t=e.closeModal)||t.call(e)},validateForm:h}})(t);return(0,i.jsx)("div",{className:"space-y-6",children:(0,i.jsxs)("form",{onSubmit:k,className:"space-y-6",children:[(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(n.Label,{htmlFor:"template-title",className:"text-s font-medium text-text-primary",children:"Template Title *"}),(0,i.jsx)(r.Input,{id:"template-title",name:"template-title",type:"text",value:l.title,onChange:e=>b("title",e.target.value),placeholder:"Enter template title (e.g., Senior Software Engineer)",className:(0,d.cn)("text-body",x.title&&"border-error-solid focus:ring-error"),"data-testid":"template-title-input",disabled:h}),x.title&&(0,i.jsx)("p",{className:"text-xs text-error-solid","data-testid":"title-error",children:x.title})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(n.Label,{htmlFor:"template-description",className:"text-s font-medium text-text-primary",children:"Description"}),(0,i.jsx)(o.T,{id:"template-description",name:"template-description",value:l.description,onChange:e=>b("description",e.target.value),placeholder:"Describe the role, key responsibilities, and what this template will assess.",className:(0,d.cn)("text-body min-h-[100px] resize-y",x.description&&"border-error-solid focus:ring-error"),"data-testid":"template-description-textarea",disabled:h}),x.description&&(0,i.jsx)("p",{className:"text-xs text-error-solid","data-testid":"description-error",children:x.description})]}),(0,i.jsxs)("div",{className:"space-y-2",children:[(0,i.jsx)(n.Label,{className:"text-s font-medium text-text-primary",children:"Upload Template File"}),(0,i.jsx)("div",{className:(0,d.cn)("border-2 border-dashed rounded-lg p-6 text-center transition-colors bg-text-stroke dark:bg-text-stroke cursor-pointer",f?"border-brand-primary bg-brand-primary/5":"border-text-stroke hover:border-brand-primary/50",x.file&&"border-error-solid",h&&"opacity-50 cursor-not-allowed"),onDragOver:y,onDragLeave:j,onDrop:N,onClick:()=>{!h&&g.current&&g.current.click()},"data-testid":"file-drop-zone",role:"button",children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)("div",{className:"flex justify-center",children:(0,i.jsx)("svg",{className:"w-8 h-8 text-text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})})}),!l.file&&(0,i.jsxs)("div",{className:"space-y-1",children:[(0,i.jsx)("p",{className:"text-body font-medium text-text-primary",children:"Drop your Excel file here or click to browse"}),(0,i.jsx)("p",{className:"text-s text-text-secondary",children:"Upload an existing template to get started faster"})]}),!l.file&&(0,i.jsxs)("div",{className:"text-xs text-text-secondary space-y-1",children:[(0,i.jsx)("p",{children:"• File formats: .xlsx, .xls"}),(0,i.jsx)("p",{children:"• Maximum size: 10 MB"}),(0,i.jsx)("p",{children:"• Must contain competency data"})]}),l.file&&(0,i.jsx)("div",{className:"pt-2",children:(0,i.jsxs)("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-success/10 border border-success-solid/20 rounded-md",children:[(0,i.jsx)("svg",{className:"w-4 h-4 text-success-solid",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,i.jsx)("span",{className:"text-s text-success-solid font-medium",children:l.file.name}),(0,i.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),v()},className:"ml-2 text-success-solid hover:text-success-solid/80 transition-colors cursor-pointer","data-testid":"remove-file-button",disabled:h,children:(0,i.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),(0,i.jsxs)("div",{className:"pt-2",children:[(0,i.jsx)("input",{ref:g,type:"file",accept:u.YP.EXCEL,onChange:C,className:"hidden",id:"file-upload","data-testid":"file-input",disabled:h}),(0,i.jsx)(a.Button,{type:"button",variant:"outline",className:"text-s cursor-pointer","data-testid":"browse-button",onClick:e=>{e.stopPropagation(),!h&&g.current&&g.current.click()},disabled:h,children:l.file?"Change File":"Browse Files"})]}),(0,i.jsxs)("p",{className:"text-xs text-gray-400 mt-2",children:["Maximum file size: ",(0,u.E5)()]})]})}),x.file&&(0,i.jsx)("p",{className:"text-xs text-error-solid","data-testid":"file-error",children:x.file})]}),(0,i.jsxs)("div",{className:"flex gap-3 justify-end pt-4",children:[(0,i.jsx)(a.Button,{type:"button",variant:"outline",onClick:E,className:"text-s","data-testid":"cancel-button",disabled:h,children:"Cancel"}),(0,i.jsx)(a.Button,{type:"submit",variant:"primary",className:"text-s text-white","data-testid":"create-template-button",disabled:h,children:"Create Template"})]})]})})}},69048:(e,t,l)=>{l.d(t,{E5:()=>b,Gg:()=>h,YP:()=>f,nJ:()=>g});var i=l(38511);let s=1024*i.F.FILE_UPLOAD.MAX_SIZE_MB*1024,a=["application/pdf","application/x-pdf"],r=["application/msword"],n=["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],o=["image/jpeg","image/jpg","image/pjpeg"],d=["image/png","image/x-png"],c=["application/vnd.ms-excel","application/msexcel","application/x-msexcel","application/x-ms-excel"],p=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],m=["text/plain"],u={DOCUMENTS:{extensions:[".pdf",".doc",".docx"],mimeTypes:[...a,...r,...n],label:"PDF, DOC, DOCX"},IMAGES:{extensions:[".jpg",".jpeg",".png"],mimeTypes:[...o,...d],label:"JPG, JPEG, PNG"}
1,EXCEL:{extensions:[".xlsx",".xls"],mimeTypes:[...p,...c],label:"XLSX, XLS"},TRANSCRIPTS:{extensions:[".pdf",".docx",".txt"],mimeTypes:[...a,...n,...m],label:"PDF, DOCX, TXT"}},x=function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return t.flat().join(",")},f={DOCUMENTS:x(a,r,n),IMAGES:x(o,d),EXCEL:x(p,c),TRANSCRIPTS:x(a,n,m)},h=e=>{if(!e)return{isValid:!1,errorMessage:"No file selected"};let t=e.size/1048576;return e.size>s?{isValid:!1,errorMessage:"File size exceeds the maximum limit of ".concat(i.F.FILE_UPLOAD.MAX_SIZE_MB,"MB. Current size: ").concat(t.toFixed(2),"MB"),fileSizeInMB:t}:{isValid:!0,fileSizeInMB:t}},g=(e,t)=>{if(!e)return{isValid:!1,errorMessage:"No file selected"};let l=((e,t)=>{if(!e)return{isValid:!1,errorMessage:"No file selected"};let l=[],i=[];return(t.forEach(e=>{let t=u[e];l.push(...t.mimeTypes),i.push(t.label)}),l.includes(e.type))?{isValid:!0}:{isValid:!1,errorMessage:"Invalid file format. Only ".concat(i.join(", ")," files are allowed. Selected file type: ").concat(e.type||"unknown")}})(e,t);if(!l.isValid)return l;let i=h(e);return!i.isValid,i},b=()=>"".concat(i.F.FILE_UPLOAD.MAX_SIZE_MB," MB")}}]);

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.