PageSourceSearch

https://xyrus.ai/_next/static/chunks/7253.2b50e1f9a861b9d1.js

js xyrus.ai collected 2026-10-05 15:10:42 UTC 26,441 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7253],{18514:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(71847).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},40099:(e,t,n)=>{"use strict";n.d(t,{h:()=>u});var r=n(12115),s=n(73977);let o=0;async function l(){let e=Date.now()-o;if(e<1e3){let t=1e3-e;await new Promise(e=>setTimeout(e,t))}o=Date.now()}async function a(e){try{var t;if(!e||"string"!=typeof e||""===e.trim())return(0,s.yG)("warn","Invalid address provided to getLocationData",{address:e}),null;let n=e.trim();await l();let r=new URLSearchParams({q:n,format:"json",addressdetails:"1",limit:"1"});(0,s.yG)("info","Fetching location data from Nominatim API",{address:n});let o=await fetch("".concat("https://nominatim.openstreetmap.org/search","?").concat(r),{headers:{"User-Agent":"XQTIVFrontend/1.0 (Recruitment Platform)"}});if(!o.ok)return(0,s.yG)("error","Nominatim API request failed",{status:o.status,statusText:o.statusText,address:n}),null;let a=await o.json();if(!a||0===a.length)return(0,s.yG)("info","No results found for address",{address:n}),null;let i=a[0];if(!i||!i.address)return(0,s.yG)("warn","No address data in result",{address:n}),null;let u={country:i.address.country||"",countryCode:(null==(t=i.address.country_code)?void 0:t.toLowerCase())||"",city:i.address.city||i.address.town||i.address.village||void 0,state:i.address.state||i.address.county||void 0,displayName:i.display_name};if(!u.countryCode)return(0,s.yG)("warn","No country code found in location data",{address:n,result:i.address}),null;return(0,s.yG)("info","Location data retrieved successfully",{address:n,country:u.country,countryCode:u.countryCode}),u}catch(t){return(0,s.yG)("error","Error fetching location data from Nominatim",{address:e,error:t instanceof Error?t.message:String(t)}),null}}async function i(e){let t=await a(e);return(null==t?void 0:t.countryCode)||null}function u(e){let[t,n]=(0,r.useState)(null),[o,l]=(0,r.useState)(!1),[a,u]=(0,r.useState)(null),c=(0,r.useRef)(null),d=(0,r.useCallback)(async e=>{if(!e||""===e.trim()){n(null),u(null),l(!1);return}l(!0),u(null);try{(0,s.yG)("info","Detecting country from location",{location:e});let t=await i(e);t?(n(t),(0,s.yG)("info","Country detected successfully",{location:e,countryCode:t})):(u("Could not detect country from location"),(0,s.yG)("warn","Failed to detect country from location",{location:e}))}catch(n){let t=n instanceof Error?n.message:"Failed to detect country";u(t),(0,s.yG)("error","Error detecting country from location",{location:e,error:t})}finally{l(!1)}},[]),f=(0,r.useCallback)(e=>{if(c.current&&clearTimeout(c.current),!e||""===e.trim()){n(null),u(null),l(!1);return}l(!0),c.current=setTimeout(()=>{d(e)},800)},[d]),m=(0,r.useCallback)(()=>{c.current&&clearTimeout(c.current),n(null),u(null),l(!1)},[]);return(0,r.useEffect)(()=>{e&&f(e)},[e,f]),(0,r.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]),{countryCode:t,isLoading:o,error:a,detectCountry:f,clearCountry:m}}},47523:function(e,t,n){var r,s,o;!function(l,a){"use strict";e.exports?e.exports=a(n(21001)):(s=[n(21001)],void 0===(o="function"==typeof(r=a)?r.apply(t,s):r)||(e.exports=o))}(0,function(e){"use strict";void 0===e.version&&e.default&&(e=e.default);var t,n,r={},s={},o={},l={},a={};e&&"string"==typeof e.version||_("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");var i=e.version.split("."),u=+i[0],c=+i[1];function d(e){return e>96?e-87:e>64?e-29:e-48}function f(e){var t,n=0,r=e.split("."),s=r[0],o=r[1]||"",l=1,a=0,i=1;for(45===e.charCodeAt(0)&&(n=1,i=-1);n<s.length;n++)a=60*a+(t=d(s.charCodeAt(n)));for(n=0;n<o.length;n++)l/=60,a+=(t=d(o.charCodeAt(n)))*l;return a*i}function m(e){for(var t=0;t<e.length;t++)e[t]=f(e[t])}function p(e,t){var n,r=[];for(n=0;n<t.length;n++)r[n]=e[t[n]];return r}function h(e){var t=e.split("|"),n=t[2].split(" "),r=t[3].split(""),s=t[4].split(" ");m(n),m(r),m(s);for(var o=r.length,l=0;l<o;l++)s[l]=Math.round((s[l-1]||0)+6e4*s[l]);return s[o-1]=1/0,{name:t[0],abbrs:p(t[1].split(" "),r),offsets:p(n,r),untils:s,population:0|t[5]}}function v(e){e&&this._set(h(e))}function x(e,t){this.name=e,this.zones=t}
1function g(e){var t=e.toTimeString(),n=t.match(/\([a-z ]+\)/i);"GMT"===(n=n&&n[0]?(n=n[0].match(/[A-Z]/g))?n.join(""):void 0:(n=t.match(/[A-Z]{3,5}/g))?n[0]:void 0)&&(n=void 0),this.at=+e,this.abbr=n,this.offset=e.getTimezoneOffset()}function y(e){this.zone=e,this.offsetScore=0,this.abbrScore=0}function b(e,t){return e.offsetScore!==t.offsetScore?e.offsetScore-t.offsetScore:e.abbrScore!==t.abbrScore?e.abbrScore-t.abbrScore:e.zone.population!==t.zone.population?t.zone.population-e.zone.population:t.zone.name.localeCompare(e.zone.name)}function w(e){return(e||"").toLowerCase().replace(/\//g,"_")}function j(e){var t,n,s,o;for("string"==typeof e&&(e=[e]),t=0;t<e.length;t++)r[o=w(n=(s=e[t].split("|"))[0])]=e[t],l[o]=n,function(e,t){var n,r;for(m(t),n=0;n<t.length;n++)a[r=t[n]]=a[r]||{},a[r][e]=!0}(o,s[2].split(" "))}function S(e,t){var n,o=r[e=w(e)];return o instanceof v?o:"string"==typeof o?(o=new v(o),r[e]=o,o):s[e]&&t!==S&&(n=S(s[e],S))?((o=r[e]=new v)._set(n),o.name=l[e],o):null}function N(e){var t,n,r,o;for("string"==typeof e&&(e=[e]),t=0;t<e.length;t++)r=w((n=e[t].split("|"))[0]),o=w(n[1]),s[r]=o,l[r]=n[0],s[o]=r,l[o]=n[1]}function z(e){return z.didShowError||(z.didShowError=!0,_("moment.tz.zoneExists('"+e+"') has been deprecated in favor of !moment.tz.zone('"+e+"')")),!!S(e)}function C(e){var t="X"===e._f||"x"===e._f;return!!(e._a&&void 0===e._tzm&&!t)}function _(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}function E(t){var n,r=Array.prototype.slice.call(arguments,0,-1),s=arguments[arguments.length-1],o=e.utc.apply(null,r);return!e.isMoment(t)&&C(o)&&(n=S(s))&&o.add(n.parse(o),"minutes"),o.tz(s),o}(u<2||2===u&&c<6)&&_("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js "+e.version+". See momentjs.com"),v.prototype={_set:function(e){this.name=e.name,this.abbrs=e.abbrs,this.untils=e.untils,this.offsets=e.offsets,this.population=e.population},_index:function(e){var t;if((t=function(e,t){var n,r=t.length;if(e<t[0])return 0;if(r>1&&t[r-1]===1/0&&e>=t[r-2])return r-1;if(e>=t[r-1])return -1;for(var s=0,o=r-1;o-s>1;)t[n=Math.floor((s+o)/2)]<=e?s=n:o=n;return o}(+e,this.untils))>=0)return t},countries:function(){var e=this.name;return Object.keys(o).filter(function(t){return -1!==o[t].zones.indexOf(e)})},parse:function(e){var t,n,r,s,o=+e,l=this.offsets,a=this.untils,i=a.length-1;for(s=0;s<i;s++)if(t=l[s],n=l[s+1],r=l[s?s-1:s],t<n&&E.moveAmbiguousForward?t=n:t>r&&E.moveInvalidForward&&(t=r),o<a[s]-6e4*t)return l[s];return l[i]},abbr:function(e){return this.abbrs[this._index(e)]},offset:function(e){return _("zone.offset has been deprecated in favor of zone.utcOffset"),this.offsets[this._index(e)]},utcOffset:function(e){return this.offsets[this._index(e)]}},y.prototype.scoreOffsetAt=function(e){this.offsetScore+=Math.abs(this.zone.utcOffset(e.at)-e.offset),this.zone.abbr(e.at).replace(/[^A-Z]/g,"")!==e.abbr&&this.abbrScore++},E.version="0.6.0",E.dataVersion="",E._zones=r,E._links=s,E._names=l,E._countries=o,E.add=j,E.link=N,E.load=function(e){j(e.zones),N(e.links),function(e){var t,n,r,s;if(e&&e.length)for(t=0;t<e.length;t++)n=(s=e[t].split("|"))[0].toUpperCase(),r=s[1].split(" "),o[n]=new x(n,r)}(e.countries),E.dataVersion=e.version},E.zone=S,E.zoneExists=z,E.guess=function(e){return(!n||e)&&(n=function(){try{var e=Intl.DateTimeFormat().resolvedOptions().timeZone;if(e&&e.length>3){var t=l[w(e)];if(t)return t;_("Moment Timezone found "+e+" from the Intl api, but did not have that data loaded.")}}catch(e){}var n,r,s,o=function(){var e,t,n,r,s=new Date().getFullYear()-2,o=new g(new Date(s,0,1)),l=o.offset,a=[o];for(r=1;r<48;r++)(n=new Date(s,r,1).getTimezoneOffset())!==l&&(a.push(e=function(e,t){for(var n,r;r=((t.at-e.at)/12e4|0)*6e4;)(n=new g(new Date(e.at+r))).offset===e.offset?e=n:t=n;return e}(o,t=new g(new Date(s,r,1)))),a.push(new g(new Date(e.at+6e4))),o=t,l=n);for(r=0;r<4;r++)a.push(new g(new Date(s+r,0,1))),a.push(new g(new Date(s+r,6,1)));return a}(),i=o.length,u=function(e){var t,n,r,s,o=e.length,i={},u=[],c={};for(t=0;t<o;t++)if(r=e[t].offset,!c.hasOwnProperty(r)){for(n in s=a[r]||{})s.hasOwnProperty(n)&&(i[n]=!0);c[r]=!0}for(t in i)i.hasOwnProperty(t)&&u.push(l[t]);return u}(o),c=[];for(r=0;r<u.length;r++){for(s=0,n=new y(S(u[r]),i);s<i;s++)n.scoreOffsetAt(o[s]);c.push(n)}return c.sort(b),c.length>0?c[0].zone.name:void 0}()),n},E.names=function(){var e,t=[];for(e in l)l.hasOwnProperty(e)&&(r[e]||r[s[e]])&&l[e]&&t.push(l[e]);return t.sort()},E.Zone=v,E.unpack=h,E.unpackBase60=f,E.needsOffset=C,E.moveInvalidForward=!0,E.moveAmbiguousForward=!1,E.countries=function(){return Object.keys(o)},E.zonesForCountry=function(e,t){if(!(e=o[e.toUpperCase()]||null))return null;var n=e.zones.sort();return t?n.map(function(e){var t=S(e);return{name:e,offset:t.utcOffset(new Date)}}):n};var M=e.fn;function k(e){return function(){return this._z?this._z.abbr(this):e.call(this)}}function O(e){return function(){return this._z=null,e.apply(this,arguments)}}e.tz=E,e.defaultZone=null,e.updateOffset=function(t,n){var r,s=e.defaultZone;if(void 0===t._z&&(s&&C(t)&&!t._isUTC&&t.isValid()&&(t._d=e.utc(t._a)._d,t.utc().add(s.parse(t),"minutes")),t._z=s),t._z)if(16>Math.abs(r=t._z.utcOffset(t))&&(r/=60),void 0!==t.utcOffset){var o=t._z;t.utcOffset(-r,n),t._z=o}else t.zone(r,n)},M.tz=function(t,n){if(t){if("string"!=typeof t)throw Error("Time zone name must be a string, got "+t+" ["+typeof t+"]");return this._z=S(t),this._z?e.updateOffset(this,n):_("Moment Timezone has no data for "+t+". See http://momentjs.com/timezone/docs/#/data-loading/."),this}if(this._z)return this._z.name},M.zoneName=k(M.zoneName),M.zoneAbbr=k(M.zoneAbbr),M.utc=O(M.utc),M.local=O(M.local),t=M.utcOffset,M.utcOffset=function(){return arguments.length>0&&(this._z=null),t.apply(this,arguments)},e.tz.setDefault=function(t){return(u<2||2===u&&c<9)&&_("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js "+e.version+"."),e.defaultZone=t?S(t):null,e};var A=e.momentProperties;return"[object Array]"===Object.prototype.toString.call(A)?(A.push("_z"),A.push("_a")):A&&(A._z=null),e})}
1,69048:(e,t,n)=>{"use strict";n.d(t,{E5:()=>g,Gg:()=>v,YP:()=>h,nJ:()=>x});var r=n(38511);let s=1024*r.F.FILE_UPLOAD.MAX_SIZE_MB*1024,o=["application/pdf","application/x-pdf"],l=["application/msword"],a=["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],i=["image/jpeg","image/jpg","image/pjpeg"],u=["image/png","image/x-png"],c=["application/vnd.ms-excel","application/msexcel","application/x-msexcel","application/x-ms-excel"],d=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],f=["text/plain"],m={DOCUMENTS:{extensions:[".pdf",".doc",".docx"],mimeTypes:[...o,...l,...a],label:"PDF, DOC, DOCX"},IMAGES:{extensions:[".jpg",".jpeg",".png"],mimeTypes:[...i,...u],label:"JPG, JPEG, PNG"},EXCEL:{extensions:[".xlsx",".xls"],mimeTypes:[...d,...c],label:"XLSX, XLS"},TRANSCRIPTS:{extensions:[".pdf",".docx",".txt"],mimeTypes:[...o,...a,...f],label:"PDF, DOCX, TXT"}},p=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.flat().join(",")},h={DOCUMENTS:p(o,l,a),IMAGES:p(i,u),EXCEL:p(d,c),TRANSCRIPTS:p(o,a,f)},v=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(r.F.FILE_UPLOAD.MAX_SIZE_MB,"MB. Current size: ").concat(t.toFixed(2),"MB"),fileSizeInMB:t}:{isValid:!0,fileSizeInMB:t}},x=(e,t)=>{if(!e)return{isValid:!1,errorMessage:"No file selected"};let n=((e,t)=>{if(!e)return{isValid:!1,errorMessage:"No file selected"};let n=[],r=[];return(t.forEach(e=>{let t=m[e];n.push(...t.mimeTypes),r.push(t.label)}),n.includes(e.type))?{isValid:!0}:{isValid:!1,errorMessage:"Invalid file format. Only ".concat(r.join(", ")," files are allowed. Selected file type: ").concat(e.type||"unknown")}})(e,t);if(!n.isValid)return n;let r=v(e);return!r.isValid,r},g=()=>"".concat(r.F.FILE_UPLOAD.MAX_SIZE_MB," MB")},80587:(e,t,n)=>{(e.exports=n(47523)).tz.load(n(86644))},83033:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(95155),s=n(12115),o=n(5917),l=n(65229),a=n(25016),i=n(68117);function u(e){let{userId:t,initialEmail:n,onEmailUpdated:u,onEmailEditingStateChange:c,className:d,emailEditFunctions:f}=e,m=(0,i.l)(),{initializeEmailState:p,getEmailState:h,handleEmailUpdateClick:v,handleEmailCancel:x,handleEmailChange:g,handleEmailSave:y,validateEmail:b,updateEmailLoading:w}=f||m,j=(0,s.useRef)({}),S=(0,s.useRef)({});(0,s.useEffect)(()=>{j.current[t]||(p(t,n),j.current[t]=!0,S.current[t]=n)},[t,n]),(0,s.useEffect)(()=>{let e=h(t),r=S.current[t];j.current[t]&&!e.isEditing&&n&&n!==r&&(p(t,n),S.current[t]=n)},[n,t,p,h]);let{isEditing:N,currentEmail:z,editedEmail:C}=h(t),_=b(C);return(0,r.jsxs)("div",{className:(0,a.cn)("space-y-2",d),children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1",children:["Email Address ",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)("div",{className:"relative flex items-center",children:[(0,r.jsx)("input",{type:"email",value:N?C:z,onChange:e=>{let n=e.target.value;g(t,n),null==u||u(n)},disabled:!N,className:(0,a.cn)("w-full px-3 py-2 rounded-md border border-text-stroke focus:outline-none focus:ring-2 focus:ring-brand-primary",!N&&"bg-gray-50 text-gray-500 cursor-not-allowed"),placeholder:"Enter email address",style:{paddingRight:N?"80px":"140px"}}),(0,r.jsx)("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2 flex items-center gap-1 z-10 ",children:N?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:()=>{y(t,e=>{null==u||u(e),null==c||c(!1)})},disabled:!_||w,className:"h-8 w-8  rounded text-green-600 hover:text-green-700 hover:bg-green-50 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",children:w?(0,r.jsx)("div",{className:"w-4 h-4 border-2 border-green-600 border-t-transparent rounded-full animate-spin"}):(0,r.jsx)(o.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{type:"button",onClick:()=>{x(t),null==u||u(z),null==c||c(!1)},disabled:w,className:"h-8 w-8  rounded text-red-600 hover:text-red-700 hover:bg-red-50 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",children:(0,r.jsx)(l.A,{className:"w-4 h-4"})})]}):(0,r.jsx)("div",{onClick:()=>{v(t),null==c||c(!0)},className:" text-xs cursor-pointer ",children:"Update Email"})})]})]})}},84395:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>h});var r=n(95155),s=n(12115),o=n(97003),l=n(25016),a=n(87133),i=n(50618),u=n(83033),c=n(806),d=n(69048),f=n(18720),m=n(18514),p=n(40099);function h(e){let{data:t}=e,n=(0,s.useMemo)(()=>{let e=Array.isArray(null==t?void 0:t.fields)?null==t?void 0:t.fields:[],n=[],r=[];
1if(e.forEach(e=>{"location"===e.name||"city"===e.name||"address"===e.name?n.push(e):"phone"===e.type&&r.push(e)}),n.length>0&&r.length>0){let t=[...e];n.forEach(e=>{let n=t.findIndex(t=>t.name===e.name);-1!==n&&t.splice(n,1)});let r=t.findIndex(e=>"phone"===e.type);return t.splice(r,0,...n),t}return e},[null==t?void 0:t.fields]),[h,v]=(0,s.useState)(()=>{let e={};return n.forEach(t=>{e[t.name]=t.defaultValue||""}),e}),[x]=(0,s.useState)(()=>{let e={};return n.forEach(t=>{e[t.name]=t.defaultValue||""}),e}),[g,y]=(0,s.useState)({}),[b,w]=(0,s.useState)({}),[j,S]=(0,s.useState)(!1),[N,z]=(0,s.useState)(!1),[C,_]=(0,s.useState)(!(null==t?void 0:t.isProfileView)),[E,M]=(0,s.useState)(null),[k,O]=(0,s.useState)(""),A=(0,s.useRef)(null),{countryCode:I,detectCountry:P}=(0,p.h)(),[T,D]=(0,s.useState)("");s.useEffect(()=>{let e=n.find(e=>"location"===e.name||"city"===e.name||"address"===e.name),t=n.find(e=>"phone"===e.type);if(e&&t){let n=h[e.name],r=h[t.name];n&&n.trim()&&(!r||""===r.trim())&&P(n)}},[]),s.useEffect(()=>{I&&!T&&D(I)},[I,T]),s.useEffect(()=>{E&&console.log("Profile picture file ready for upload:",E.name)},[E]);let L=(0,s.useMemo)(()=>{let e={};return Object.keys(h).forEach(t=>{let n=h[t],r=x[t];String(n||"").trim()!==String(r||"").trim()&&(e[t]=n)}),e},[h,x]),V=(0,s.useMemo)(()=>{let e=Object.keys(L).length>0,t=null!==E;return e||t},[L,E]),F=(0,s.useMemo)(()=>{let e={},r=!1,s=!1,o=n.some(e=>e.userId)||(null==t?void 0:t.isProfileView);n.forEach(t=>{let n=h[t.name],l=((e,t)=>{var n,r,s,o,l,a,i,u,d,f,m,p,h,v,x;let g=String(t||"");if(e.required&&!g.trim())return"".concat(e.label||e.name," is required");if(!g.trim()&&!e.required)return null;switch(e.type){case"email":{let e=(0,c.DT)(g);return e.success?null:(null==(r=e.error)||null==(n=r.issues[0])?void 0:n.message)||"Invalid email"}case"password":{let e=(0,c.Oj)(g);return e.success?null:(null==(o=e.error)||null==(s=o.issues[0])?void 0:s.message)||"Invalid password"}case"text":if(e.name.toLowerCase().includes("name")){let e=(0,c.yS)(g);return e.success?null:(null==(a=e.error)||null==(l=a.issues[0])?void 0:l.message)||"Invalid name"}break;case"phone":if(e.required&&!g.trim())return"Phone number is required";break;case"select":if(e.required&&!g)return"Please select a ".concat((null==(i=e.label)?void 0:i.toLowerCase())||e.name);break;case"linkedin":if(g&&""!==g.trim()){let e=(0,c.sg)(g);return e.success?null:(null==(d=e.error)||null==(u=d.issues[0])?void 0:u.message)||"Invalid LinkedIn URL"}break;case"url":if(g&&""!==g.trim()){let e=(0,c.sB)(g);return e.success?null:(null==(m=e.error)||null==(f=m.issues[0])?void 0:f.message)||"Invalid URL"}break;case"bio":if(g){let e=(0,c.xV)(g);return e.success?null:(null==(h=e.error)||null==(p=h.issues[0])?void 0:p.message)||"Bio is too long"}break;case"designation":if(g){let e=(0,c.kY)(g);return e.success?null:(null==(x=e.error)||null==(v=x.issues[0])?void 0:v.message)||"Designation is too long"}}return null})(t,n);l&&(e[t.name]=l,r=!0),t.required&&!String(n||"").trim()&&(!o||b[t.name])&&(s=!0)}),Object.keys(g).forEach(t=>{let n=g[t];n&&"string"==typeof n&&(!o||b[t])&&(e[t]=n,r=!0)});let l=!r&&!s,a=r||s||N;return{errors:e,isValid:l,hasErrors:r,hasEmptyRequired:s,isSubmitDisabled:a}},[h,n,N,g,b,null==t?void 0:t.isProfileView]),q=(e,t)=>{let n=e.target.value;v(e=>({...e,[t]:n})),w(e=>({...e,[t]:!0})),("location"===t||"city"===t||"address"===t)&&n&&n.trim()&&P(n),g[t]&&y(e=>{let n={...e};return delete n[t],n})},G=e=>{var t;let n=null==(t=e.target.files)?void 0:t[0];if(n){let t=(0,d.nJ)(n,["IMAGES"]);if(!t.isValid){e.target&&(e.target.value=""),f.oR.error("Invalid File",{description:t.errorMessage}),y(e=>({...e,profile_picture:t.errorMessage||"Invalid file"}));return}M(n);let r=new FileReader;r.onload=e=>{var t;let n=null==(t=e.target)?void 0:t.result;O(n),v(e=>({...e,profile_picture:n})),w(e=>({...e,profile_picture:!0}))},r.readAsDataURL(n)}},R=!!(null==t?void 0:t.isProfileView),U=n.some(e=>e.userId)||(null==t?void 0:t.isProfileView),B=(0,s.useMemo)(()=>{if(!C&&R)return!0;if(U){if(!V)return!0;let e=Object.keys(L);return(null===E||0!==e.length)&&(e.some(e=>F.errors[e])||N)}return F.isSubmitDisabled},[C,R,F.isSubmitDisabled,F.errors,U,V,L,N,E]);return(0,r.jsxs)("div",{className:"flex flex-col h-full max-h-[80vh]",children:[R?(0,r.jsx)("div",{className:"flex justify-end mb-4",children:(0,r.jsx)(o.Button,{type:"button",variant:C?"outline":"default",onClick:()=>_(!C),className:"px-4 py-2",children:C?"Cancel Edit":"Edit Profile"})}):null,(0,r.jsxs)("form",{onSubmit:e=>{var r,s;e.preventDefault(),S(!0);let o={};
1if(n.forEach(e=>{o[e.name]=!0}),w(o),F.isSubmitDisabled)return void y(F.errors);let l=n.some(e=>e.userId)||(null==t?void 0:t.isProfileView),a=l?L:h;if(l&&0===Object.keys(a).length&&!E){f.oR.info("No changes detected"),null==t||null==(s=t.closeModal)||s.call(t);return}let i=new FormData,u={...a};if(delete u.profile_picture,i.append("profile_data",JSON.stringify(u)),E){let e=(0,d.nJ)(E,["IMAGES"]);if(!e.isValid)return void y(t=>({...t,profile_picture:e.errorMessage||"Invalid file"}));i.append("profile_picture",E)}(null==t?void 0:t.onSubmit)&&"function"==typeof t.onSubmit&&t.onSubmit(i),null==t||null==(r=t.closeModal)||r.call(t)},className:"flex flex-col flex-1 min-h-0",children:[(0,r.jsx)("div",{className:"space-y-4 overflow-y-auto flex-1 p-2",children:n.map(e=>(0,r.jsx)("div",{children:(e=>{var t,n;let s=(e=>{if(b[e]||j)return g[e]||F.errors[e]})(e.name),o=!!s,c=!C||e.disabled;if("file"===e.type&&(null==(t=e.accept)?void 0:t.includes("image")))return(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm text-text-placeholder mb-2",children:[e.label||"Profile Picture",e.required?(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"}):null]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{ref:A,type:"file",accept:e.accept,onChange:G,className:"hidden",disabled:c}),(0,r.jsx)("div",{className:(0,l.cn)("w-20 h-20 rounded-full bg-gray-100 flex items-center justify-center overflow-hidden cursor-pointer border-2 border-dashed border-gray-300 hover:border-brand-primary transition-colors",c&&"cursor-not-allowed opacity-50"),onClick:()=>{var e;c||null==(e=A.current)||e.click()},children:k||h.profile_picture?(0,r.jsx)("img",{src:k||h.profile_picture,alt:"Profile",className:"w-full h-full object-cover"}):(0,r.jsx)("span",{className:"text-gray-400 text-xs text-center px-2",children:"Click to upload"})}),!c&&(k||h.profile_picture_url)?(0,r.jsx)("div",{className:"absolute -bottom-1 -right-1 w-6 h-6 bg-white rounded-full flex items-center justify-center shadow-md",children:(0,r.jsx)(m.A,{className:"w-3 h-3 text-gray-600"})}):null]}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Upload a profile picture (JPG, PNG)"})})]}),s?(0,r.jsx)("p",{className:"text-red-500 text-xs mt-1",children:s}):null]});if("email"===e.type&&e.userId)return(0,r.jsxs)("div",{children:[(0,r.jsx)(u.A,{userId:e.userId,initialEmail:String(e.defaultValue||""),onEmailUpdated:t=>{v(n=>({...n,[e.name]:t})),w(t=>({...t,[e.name]:!0}))},onEmailEditingStateChange:e=>{z(e)},className:(0,l.cn)(e.className,o&&"border-red-500")}),s?(0,r.jsx)("p",{className:"text-red-500 text-xs mt-1",children:s}):null]});let d={id:"form-modal-".concat(e.name),name:e.name,value:null!=(n=h[e.name])?n:"",onChange:t=>q(t,e.name),onBlur:()=>{var t;return t=e.name,void w(e=>({...e,[t]:!0}))},placeholder:e.placeholder||"",className:(0,l.cn)("w-full px-3 py-2 rounded-md border border-text-stroke focus:outline-none focus:ring-1 focus:ring-brand-primary",o&&"border-red-500 focus:ring-red-500",c&&"bg-gray-50 cursor-not-allowed opacity-70",e.className),required:e.required||!1,disabled:c};return(0,r.jsxs)("div",{children:[!("email"===e.type&&e.userId)&&(0,r.jsxs)("label",{className:"block text-sm text-text-placeholder mb-1",htmlFor:"form-modal-".concat(e.name),children:[e.label||e.name,e.required?(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"}):null]}),(()=>{var t,n,s,u,m,p,x;switch(e.type){case"phone":let b=h[e.name]||"";return(0,r.jsx)(a.LR,{...(!b||""===b.trim())&&I?{country:I}:{},value:b,onChangeWithParts:(t,n)=>((e,t,n)=>{let r=e?"".concat(t).concat(e):t||"";v(e=>({...e,[n]:r})),D(t),w(e=>({...e,[n]:!0}))})(t,n,e.name),placeholder:e.placeholder||"Enter phone number",disabled:c||!1,required:e.required||!1,showError:!1,allowEmpty:!0,requireCountrySelection:!I&&(!b||""===b.trim()),onCountrySelectionRequired:t=>{let n=h[e.name];n&&n.trim()&&f.oR.warning("Country Code Required",{description:t})},onValidationChange:(t,n)=>{!t&&n?y(t=>({...t,[e.name]:n})):t&&y(t=>{let n={...t};return delete n[e.name],n})}});case"select":return e.useCombobox?(0,r.jsx)("div",{className:(0,l.cn)(o&&"rounded-md ring-2 ring-red-500/40"),children:(0,r.jsx)(i.Combobox,{options:e.options||[],value:h[e.name]||"",onValueChange:t=>{v(n=>({...n,[e.name]:t})),w(t=>({...t,[e.name]:!0}
1)),g[e.name]&&y(t=>{let n={...t};return delete n[e.name],n})},placeholder:e.placeholder||"Select option",searchPlaceholder:"Search ".concat(e.label||e.name,"..."),emptyText:"No options found.",className:(0,l.cn)(e.className),disabled:c||!1,allowCustomValues:null!=(t=e.allowCustomValues)&&t,isLoading:null!=(n=e.isOptionsLoading)&&n,hasMore:null!=(s=e.hasMoreOptions)&&s,totalCount:null!=(u=e.totalOptionsCount)?u:0,...e.onSearchOptions?{onSearchChange:e.onSearchOptions}:{},...e.onLoadMoreOptions?{onLoadMore:e.onLoadMoreOptions}:{}})}):(0,r.jsxs)("select",{id:"form-modal-".concat(e.name),name:e.name,value:h[e.name]||"",onChange:t=>q(t,e.name),className:(0,l.cn)("w-full px-3 py-2 rounded-md border border-text-stroke focus:outline-none focus:ring-2 focus:ring-brand-primary",o&&"border-red-500 focus:ring-red-500",e.className),required:e.required||!1,children:[(0,r.jsx)("option",{value:"",disabled:!0,children:e.placeholder||"Select option"}),(e.options||[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"}]).map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]});case"textarea":case"bio":let j=String(null!=(m=h[e.name])?m:"").length,S=e.maxLength||500;return(0,r.jsxs)("div",{children:[(0,r.jsx)("textarea",{...d,value:String(null!=(p=h[e.name])?p:""),rows:e.rows||4,maxLength:S}),(e.showCharacterCount||"bio"===e.type)&&(0,r.jsx)("div",{className:"flex justify-end mt-1",children:(0,r.jsxs)("span",{className:(0,l.cn)("text-xs",j>.9*S?"text-orange-500":"text-gray-500"),children:[j,"/",S]})})]});default:return(0,r.jsx)("input",{type:"linkedin"===e.type||"url"===e.type?"url":"designation"===e.type||"location"===e.type?"text":e.type||"text",...d,value:String(null!=(x=h[e.name])?x:"")})}})(),s?(0,r.jsx)("p",{className:"text-red-500 text-xs mt-1",children:s}):null]})})(e)},e.name))}),(0,r.jsxs)("div",{className:"flex gap-2 justify-end pt-4 mt-4 ",children:[(0,r.jsx)(o.Button,{type:"button",variant:"outline",onClick:()=>{var e;(null==t?void 0:t.onCancel)&&"function"==typeof t.onCancel&&t.onCancel(),null==t||null==(e=t.closeModal)||e.call(t)},className:"px-4 py-2",children:String((null==t?void 0:t.cancelText)||"Cancel")}),(0,r.jsx)(o.Button,{type:"submit",className:"px-4 py-2 text-white",disabled:B,children:String((null==t?void 0:t.submitText)||(R&&C?"Save":"Submit"))})]})]})]})}}}]);

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.