@mseva/digit-ui-module-engagement 1.1.27 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var e,t=require("@mseva/digit-ui-react-components"),n=require("react"),l=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-router-dom"),i=require("react-hook-form"),r=require("react-query"),u=require("react-redux"),s=require("recharts");require("react-time-picker");var c=require("redux");function d(){return(d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function m(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}function v(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function p(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}function E(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function g(e){E(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function f(e){E(1,arguments);var t=g(e);return t.setHours(0,0,0,0),t}function h(e,t){E(2,arguments);var n=f(e),l=f(t);return n.getTime()===l.getTime()}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const y=(e,t)=>e.name.toUpperCase()<t.name.toUpperCase()?-1:e.name.toUpperCase()>t.name.toUpperCase()?1:0,S=(e,t)=>{var n,l;return!(!e||!t)&&(null==e||null===(n=e.trim())||void 0===n?void 0:n.toLowerCase())===(null==t||null===(l=t.trim())||void 0===l?void 0:l.toLowerCase())},C=function(e){return Promise.resolve(v(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId())).then(function(e){var t,n;if((null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n?void 0:n.length)>0){var l,a;const t=null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url;if(t.includes(".jpg")||t.includes(".png")){const e=t.split(","),[n,l,a,o]=e;return n}return null===(a=e.data.fileStoreIds[0])||void 0===a?void 0:a.url}})},function(){}))},b=function(e,t){try{if(!e||!e.length)return alert("No Document exists!"),Promise.resolve();const n=window.open("","_blank");return Promise.resolve(C(e)).then(function(e){window.mSewaApp&&window.mSewaApp.isMsewaApp()?(window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3)):(n.location=e,n.document.title=t)})}catch(e){return Promise.reject(e)}},T=(e,t)=>{if(e&&e.length)if(window.mSewaApp&&window.mSewaApp.isMsewaApp())window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3);else{const n=window.open("","_blank");n.location=e,n.document.title=t}else alert("No Document Link exists!")},D=function(e,t){try{return e&&e.length?Promise.resolve(C(e)).then(function(e){e&&Digit.Utils.downloadPDFFromLink(e)}):(alert("No Document exists!"),Promise.resolve())}catch(e){return Promise.reject(e)}},N=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB"][t]},A=(e,t,n)=>{var l;return t?n?null!=t&&null!==(l=t.fileStoreId)&&void 0!==l&&l.length?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):t?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED")},w=e=>{let t=new Date(e);if(function(e){return E(1,arguments),h(e,Date.now())}(t)){const e=new Date;t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59)}return t.getTime()},x=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59),I=[{head:"",body:[{type:"form",withoutLabel:!0,component:"EventForm",nextStep:"",route:"",key:"eventData"},{type:"text",label:"EVENTS_DESCRIPTION_LABEL",isMandatory:!0,description:"EVENTS_DESCRIPTION_TEXT",populators:{name:"description",className:"fullWidth",validation:{required:!0,maxLength:500},error:"EVENTS_DESCRIPTION_ERROR_REQUIRED"}},{type:"date",label:"EVENTS_FROM_DATE_LABEL",isMandatory:!0,populators:{name:"fromDate",className:"fullWidth",validation:{required:!0},shouldUpdate:!0,error:"EVENTS_FROM_DATE_ERROR_INVALID"}},{type:"form",key:"SelectToDate",withoutLabel:!0,component:"SelectToDate",key:"toDate"},{type:"time",label:"EVENTS_FROM_TIME_LABEL",isMandatory:!0,populators:{name:"fromTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_FROM_TIME_ERROR_REQUIRED"}},{type:"time",label:"EVENTS_TO_TIME_LABEL",isMandatory:!0,populators:{name:"toTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_TO_TIME_ERROR_REQUIRED"}},{type:"text",label:"EVENTS_ADDRESS_LABEL",isMandatory:!0,populators:{name:"address",className:"fullWidth",validation:{required:!0},error:"EVENTS_ADDRESS_ERROR_REQUIRED"}},{type:"component",component:"SelectEventGeolocation",withoutLabel:!0,key:"geoLocation"},{type:"text",label:"EVENTS_ORGANIZER_NAME_LABEL",populators:{name:"organizer",className:"fullWidth",validation:{pattern:/^[A-Za-z ]*$/},error:"EVENTS_ORGANIZER_ERROR"}},{type:"number",label:"EVENTS_ENTRY_FEE_INR_LABEL",populators:{name:"fees",className:"fullWidth",error:"EVENTS_ENTRY_ERROR_REQUIRED"}}]}],L=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[c,m,v]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[p,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),g(),v()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ES_TITLE_NEW_EVENTS")),l.createElement(t.FormComposer,{config:I,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:r,address:u,organizer:s,fees:c,geoLocation:m={}}=e,v={events:[{source:"WEBAPP",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:d({fromDate:new Date(l+" "+o).getTime(),toDate:new Date(a+" "+r).getTime(),fromTime:o,toTime:r,address:u,organizer:s,fees:c},m)}]};i.push("/digit-ui/employee/engagement/event/response",v)},label:e("EVENTS_CREATE_EVENT")}))};function O(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function R(e,t){E(2,arguments);var n=g(e).getTime(),l=O(t);return new Date(n+l)}function P(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function M(e,t){E(2,arguments);var n=g(e),l=g(t),a=n.getTime()-l.getTime();return a<0?-1:a>0?1:a}function F(e){return E(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function k(e){if(E(1,arguments),!F(e)&&"number"!=typeof e)return!1;var t=g(e);return!isNaN(Number(t))}function B(e,t){E(2,arguments);var n=g(e),l=g(t),a=n.getFullYear()-l.getFullYear(),o=n.getMonth()-l.getMonth();return 12*a+o}function U(e,t){return E(2,arguments),g(e).getTime()-g(t).getTime()}var H={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function V(e){return e?H[e]:H.trunc}function W(e){E(1,arguments);var t=g(e);return t.setHours(23,59,59,999),t}function q(e){E(1,arguments);var t=g(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function j(e){E(1,arguments);var t=g(e);return W(t).getTime()===q(t).getTime()}function z(e,t){E(2,arguments);var n,l=g(e),a=g(t),o=M(l,a),i=Math.abs(B(l,a));if(i<1)n=0;else{1===l.getMonth()&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-o*i);var r=M(l,a)===-o;j(g(e))&&1===i&&1===M(e,a)&&(r=!1),n=o*(i-Number(r))}return 0===n?0:n}function Y(e,t,n){E(2,arguments);var l=U(e,t)/1e3;return V(null==n?void 0:n.roundingMethod)(l)}var G={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function K(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,l=e.formats[n]||e.formats[e.defaultWidth];return l}}var Q={date:K({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:K({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:K({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},X={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Z(e){return function(t,n){var l,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):o;l=e.formattingValues[i]||e.formattingValues[o]}else{var r=e.defaultWidth,u=a.width?String(a.width):e.defaultWidth;l=e.values[u]||e.values[r]}return l[e.argumentCallback?e.argumentCallback(t):t]}}function $(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.width,a=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var i,r=o[0],u=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(u)?ee(u,function(e){return e.test(r)}):J(u,function(e){return e.test(r)});i=e.valueCallback?e.valueCallback(s):s,i=n.valueCallback?n.valueCallback(i):i;var c=t.slice(r.length);return{value:i,rest:c}}}function J(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function ee(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var te,ne={code:"en-US",formatDistance:function(e,t,n){var l,a=G[e];return l="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+l:l+" ago":l},formatLong:Q,formatRelative:function(e,t,n,l){return X[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),l=n%100;if(l>20||l<10)switch(l%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Z({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Z({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Z({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Z({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Z({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(te={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(te.matchPattern);if(!n)return null;var l=n[0],a=e.match(te.parsePattern);if(!a)return null;var o=te.valueCallback?te.valueCallback(a[0]):a[0];o=t.valueCallback?t.valueCallback(o):o;var i=e.slice(l.length);return{value:o,rest:i}}),era:$({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:$({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:$({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:$({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:$({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function le(e,t){E(2,arguments);var n=O(t);return R(e,-n)}function ae(e){E(1,arguments);var t=1,n=g(e),l=n.getUTCDay(),a=(l<t?7:0)+l-t;return n.setUTCDate(n.getUTCDate()-a),n.setUTCHours(0,0,0,0),n}function oe(e){E(1,arguments);var t=g(e),n=t.getUTCFullYear(),l=new Date(0);l.setUTCFullYear(n+1,0,4),l.setUTCHours(0,0,0,0);var a=ae(l),o=new Date(0);o.setUTCFullYear(n,0,4),o.setUTCHours(0,0,0,0);var i=ae(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function ie(e){E(1,arguments);var t=oe(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var l=ae(n);return l}function re(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.weekStartsOn,o=null==a?0:O(a),i=null==n.weekStartsOn?o:O(n.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var r=g(e),u=r.getUTCDay(),s=(u<i?7:0)+u-i;return r.setUTCDate(r.getUTCDate()-s),r.setUTCHours(0,0,0,0),r}function ue(e,t){E(1,arguments);var n=g(e),l=n.getUTCFullYear(),a=t||{},o=a.locale,i=o&&o.options&&o.options.firstWeekContainsDate,r=null==i?1:O(i),u=null==a.firstWeekContainsDate?r:O(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=new Date(0);s.setUTCFullYear(l+1,0,u),s.setUTCHours(0,0,0,0);var c=re(s,t),d=new Date(0);d.setUTCFullYear(l,0,u),d.setUTCHours(0,0,0,0);var m=re(d,t);return n.getTime()>=c.getTime()?l+1:n.getTime()>=m.getTime()?l:l-1}function se(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.firstWeekContainsDate,o=null==a?1:O(a),i=null==n.firstWeekContainsDate?o:O(n.firstWeekContainsDate),r=ue(e,t),u=new Date(0);u.setUTCFullYear(r,0,i),u.setUTCHours(0,0,0,0);var s=re(u,t);return s}function ce(e,t){for(var n=e<0?"-":"",l=Math.abs(e).toString();l.length<t;)l="0"+l;return n+l}var de={G:function(e,t,n){var l=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(l,{width:"abbreviated"});case"GGGGG":return n.era(l,{width:"narrow"});case"GGGG":default:return n.era(l,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var l=e.getUTCFullYear();return n.ordinalNumber(l>0?l:1-l,{unit:"year"})}return function(e,t){var n=e.getUTCFullYear(),l=n>0?n:1-n;return ce("yy"===t?l%100:l,t.length)}(e,t)},Y:function(e,t,n,l){var a=ue(e,l),o=a>0?a:1-a;return"YY"===t?ce(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):ce(o,t.length)},R:function(e,t){return ce(oe(e),t.length)},u:function(e,t){return ce(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(l);case"QQ":return ce(l,2);case"Qo":return n.ordinalNumber(l,{unit:"quarter"});case"QQQ":return n.quarter(l,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(l,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(l,{width:"wide",context:"formatting"})}},q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(l);case"qq":return ce(l,2);case"qo":return n.ordinalNumber(l,{unit:"quarter"});case"qqq":return n.quarter(l,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(l,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(l,{width:"wide",context:"standalone"})}},M:function(e,t,n){var l=e.getUTCMonth();switch(t){case"M":case"MM":return function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):ce(n+1,2)}(e,t);case"Mo":return n.ordinalNumber(l+1,{unit:"month"});case"MMM":return n.month(l,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(l,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(l,{width:"wide",context:"formatting"})}},L:function(e,t,n){var l=e.getUTCMonth();switch(t){case"L":return String(l+1);case"LL":return ce(l+1,2);case"Lo":return n.ordinalNumber(l+1,{unit:"month"});case"LLL":return n.month(l,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(l,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(l,{width:"wide",context:"standalone"})}},w:function(e,t,n,l){var a=function(e,t){E(1,arguments);var n=g(e),l=re(n,t).getTime()-se(n,t).getTime();return Math.round(l/6048e5)+1}(e,l);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):ce(a,t.length)},I:function(e,t,n){var l=function(e){E(1,arguments);var t=g(e),n=ae(t).getTime()-ie(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(l,{unit:"week"}):ce(l,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return ce(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,n){var l=function(e){E(1,arguments);var t=g(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var l=t.getTime(),a=n-l;return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(l,{unit:"dayOfYear"}):ce(l,t.length)},E:function(e,t,n){var l=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(l,{width:"short",context:"formatting"});case"EEEE":default:return n.day(l,{width:"wide",context:"formatting"})}},e:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ce(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ce(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var l=e.getUTCDay(),a=0===l?7:l;switch(t){case"i":return String(a);case"ii":return ce(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(l,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(l,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(l,{width:"short",context:"formatting"});case"iiii":default:return n.day(l,{width:"wide",context:"formatting"})}},a:function(e,t,n){var l=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){var l,a=e.getUTCHours();switch(l=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){var l,a=e.getUTCHours();switch(l=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var l=e.getUTCHours()%12;return 0===l&&(l=12),n.ordinalNumber(l,{unit:"hour"})}return function(e,t){return ce(e.getUTCHours()%12||12,t.length)}(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):function(e,t){return ce(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,n){var l=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):ce(l,t.length)},k:function(e,t,n){var l=e.getUTCHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):ce(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return ce(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return ce(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var n=t.length,l=e.getUTCMilliseconds();return ce(Math.floor(l*Math.pow(10,n-3)),t.length)}(e,t)},X:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return ve(a);case"XXXX":case"XX":return pe(a);case"XXXXX":case"XXX":default:return pe(a,":")}},x:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"x":return ve(a);case"xxxx":case"xx":return pe(a);case"xxxxx":case"xxx":default:return pe(a,":")}},O:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+me(a,":");case"OOOO":default:return"GMT"+pe(a,":")}},z:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+me(a,":");case"zzzz":default:return"GMT"+pe(a,":")}},t:function(e,t,n,l){return ce(Math.floor((l._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,l){return ce((l._originalDate||e).getTime(),t.length)}};function me(e,t){var n=e>0?"-":"+",l=Math.abs(e),a=Math.floor(l/60),o=l%60;if(0===o)return n+String(a);var i=t||"";return n+String(a)+i+ce(o,2)}function ve(e,t){return e%60==0?(e>0?"-":"+")+ce(Math.abs(e)/60,2):pe(e,t)}function pe(e,t){var n=t||"",l=e>0?"-":"+",a=Math.abs(e);return l+ce(Math.floor(a/60),2)+n+ce(a%60,2)}function Ee(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function ge(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var fe={p:ge,P:function(e,t){var n,l=e.match(/(P+)(p+)?/)||[],a=l[1],o=l[2];if(!o)return Ee(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Ee(a,t)).replace("{{time}}",ge(o,t))}},he=["D","DD"],ye=["YY","YYYY"];function Se(e){return-1!==he.indexOf(e)}function _e(e){return-1!==ye.indexOf(e)}function Ce(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}var be=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Te=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,De=/^'([^]*?)'?$/,Ne=/''/g,Ae=/[a-zA-Z]/;function we(e,t,n){E(2,arguments);var l=String(t),a=n||{},o=a.locale||ne,i=o.options&&o.options.firstWeekContainsDate,r=null==i?1:O(i),u=null==a.firstWeekContainsDate?r:O(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=o.options&&o.options.weekStartsOn,c=null==s?0:O(s),d=null==a.weekStartsOn?c:O(a.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!o.localize)throw new RangeError("locale must contain localize property");if(!o.formatLong)throw new RangeError("locale must contain formatLong property");var m=g(e);if(!k(m))throw new RangeError("Invalid time value");var v=P(m),p=le(m,v),f={firstWeekContainsDate:u,weekStartsOn:d,locale:o,_originalDate:m},h=l.match(Te).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,fe[t])(e,o.formatLong,f):e}).join("").match(be).map(function(n){if("''"===n)return"'";var l=n[0];if("'"===l)return xe(n);var i=de[l];if(i)return!a.useAdditionalWeekYearTokens&&_e(n)&&Ce(n,t,e),!a.useAdditionalDayOfYearTokens&&Se(n)&&Ce(n,t,e),i(p,n,o.localize,f);if(l.match(Ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return n}).join("");return h}function xe(e){return e.match(De)[1].replace(Ne,"'")}function Ie(e){return function(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}({},e)}function Le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};E(2,arguments);var l=n.locale||ne;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=M(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var o,i,r=Ie(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=a,a>0?(o=g(t),i=g(e)):(o=g(e),i=g(t));var u,s=Y(i,o),c=(P(i)-P(o))/1e3,d=Math.round((s-c)/60);if(d<2)return n.includeSeconds?s<5?l.formatDistance("lessThanXSeconds",5,r):s<10?l.formatDistance("lessThanXSeconds",10,r):s<20?l.formatDistance("lessThanXSeconds",20,r):s<40?l.formatDistance("halfAMinute",null,r):l.formatDistance(s<60?"lessThanXMinutes":"xMinutes",1,r):0===d?l.formatDistance("lessThanXMinutes",1,r):l.formatDistance("xMinutes",d,r);if(d<45)return l.formatDistance("xMinutes",d,r);if(d<90)return l.formatDistance("aboutXHours",1,r);if(d<1440){var m=Math.round(d/60);return l.formatDistance("aboutXHours",m,r)}if(d<2520)return l.formatDistance("xDays",1,r);if(d<43200){var v=Math.round(d/1440);return l.formatDistance("xDays",v,r)}if(d<86400)return u=Math.round(d/43200),l.formatDistance("aboutXMonths",u,r);if((u=z(i,o))<12){var p=Math.round(d/43200);return l.formatDistance("xMonths",p,r)}var f=u%12,h=Math.floor(u/12);return f<3?l.formatDistance("aboutXYears",h,r):f<9?l.formatDistance("overXYears",h,r):l.formatDistance("almostXYears",h+1,r)}const Oe=()=>{var e,i,r,u,s,c,m,v,p;const{t:E}=a.useTranslation(),g=o.useHistory(),{id:f}=o.useParams(),h=Digit.ULBService.getCurrentTenantId(),{isLoading:y,data:S}=Digit.Hooks.events.useInbox(h,{},{eventTypes:"EVENTSONGROUND",ids:f},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[_,C,b]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[T,D,N]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[A,w,x]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);if(n.useEffect(()=>{C(!1),x(),N()},[]),y)return l.createElement(t.Loader,null);const L={defaultTenantId:null==S?void 0:S.tenantId,name:null==S?void 0:S.name,fromDate:we(new Date(null==S||null===(e=S.eventDetails)||void 0===e?void 0:e.fromDate),"yyyy-MM-dd"),toDate:we(new Date(null==S||null===(i=S.eventDetails)||void 0===i?void 0:i.toDate),"yyyy-MM-dd"),organizer:null==S||null===(r=S.eventDetails)||void 0===r?void 0:r.organizer,fees:null==S||null===(u=S.eventDetails)||void 0===u?void 0:u.fees,description:null==S?void 0:S.description,address:null==S||null===(s=S.eventDetails)||void 0===s?void 0:s.address,category:null==S?void 0:S.eventCategory,fromTime:we(new Date(null==S||null===(c=S.eventDetails)||void 0===c?void 0:c.fromDate),"HH:mm"),toTime:we(new Date(null==S||null===(m=S.eventDetails)||void 0===m?void 0:m.toDate),"HH:mm"),geoLocation:{latitude:null==S||null===(v=S.eventDetails)||void 0===v?void 0:v.latitude,longitude:null==S||null===(p=S.eventDetails)||void 0===p?void 0:p.longitude}};return l.createElement(n.Fragment,null,l.createElement(t.Header,null,E("ES_TITLE_EDIT_EVENTS")),l.createElement(t.FormComposer,{defaultValues:L,config:I,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:i,address:r,organizer:u,fees:s,geoLocation:c}=e,m={events:[d({},S,{source:"WEBAPP",status:"ACTIVE",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:d({},null==S?void 0:S.eventDetails,{fromDate:new Date(l+" "+o).getTime(),toDate:new Date(a+" "+i).getTime(),fromTime:o,toTime:i,address:r,organizer:u,fees:s,latitude:null==c?void 0:c.latitude,longitude:null==c?void 0:c.longitude})})]};g.push("/digit-ui/employee/engagement/event/response?update=true",m)},label:E("EVENTS_SAVE_CHANGES")}))},Re=e=>{var n,o,i;const{t:r}=a.useTranslation();return l.createElement(t.Banner,{message:r(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,info:r("ENGAGEMENT_EVENT_NAME"),successful:e.isSuccess})},Pe=e=>{var i,u,s,c,d,m,v;const p=r.useQueryClient(),{t:E}=a.useTranslation(),g=Digit.Hooks.useQueryParams(),f=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),h=Digit.Hooks.events.useUpdateEvent(),[y,S]=n.useState(!1),{state:_}=e.location,[C,b,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[D,N,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1),[w,x,I]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),L=(e,t)=>{var n,l,a;x((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),b(!0)};if(n.useEffect(()=>{f.data&&N(f.data)},[f.data]),n.useEffect(()=>{h.data&&N(h.data)},[h.data]),n.useEffect(()=>{const e=()=>{b(!0),p.clear()};return C?()=>{p.clear()}:Boolean(null==g?void 0:g.delete)||Boolean(null==g?void 0:g.update)?void h.mutate(_,{onError:L,onSuccess:e}):void f.mutate(_,{onError:L,onSuccess:e})},[]),null!=g&&g.delete||null!=g&&g.update)return h.isLoading||h.isIdle&&!C?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Re,{t:E,message:null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED",data:h.data||D,isSuccess:(null==h?void 0:h.isSuccess)||D,isLoading:h.isIdle&&!C||h.isLoading}),l.createElement(t.CardText,null,E(null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))));if(f.isLoading||f.isIdle&&!C)return l.createElement(t.Loader,null);const O=(null==f||null===(i=f.data)||void 0===i||null===(u=i.events)||void 0===u?void 0:u[0])||(null==D||null===(s=D.events)||void 0===s?void 0:s[0])||{};return l.createElement(t.Card,null,l.createElement(Re,{t:E,message:f.isSuccess||D?"ENGAGEMENT_EVENT_CREATED_MESSAGE":"ENGAGEMENT_EVENT_FAILED_MESSAGES",data:f.data||D,isSuccess:f.isSuccess||D,isLoading:f.isIdle&&!C||f.isLoading}),l.createElement(t.CardText,null,f.isSuccess||D?E("ENGAGEMENT_EVENT_CREATED_MESSAGES",{eventName:null==O?void 0:O.name,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==O||null===(c=O.eventDetails)||void 0===c?void 0:c.fromDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==O||null===(d=O.eventDetails)||void 0===d?void 0:d.toDate),fromTime:f.isSuccess?we(new Date(null==O||null===(m=O.eventDetails)||void 0===m?void 0:m.fromDate),"HH:mm"):null,toTime:f.isSuccess?we(new Date(null==O||null===(v=O.eventDetails)||void 0===v?void 0:v.toDate),"HH:mm"):null}):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))))},Me=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p})},Fe=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:i}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:i})},ke=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:m,formState:v,reset:p,control:E}=i.useForm({defaultValues:a}),g=innerWidth<=640,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=(Digit.ULBService.getCurrentTenantId(),Digit.UserService.getUser().info),S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),_=()=>{p({ulb:null,eventName:""}),n({ulb:null,eventName:""})},C=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:_},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(e=>{n(e),"mobile"===r&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(Fe,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,C()))))),("mobile"===r||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},C(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Be=e=>{let{title:n="EVENTS_EVENTS_HEADER",links:i,icon:r="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},"calender"===r?l.createElement(t.EventCalendar,null):"survey"===r?"surveyIcon":l.createElement(t.DocumentIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},i.map((e,t)=>{let{link:n,text:a,hyperlink:i=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Ue=e=>{var n,o;let{status:i,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:s(i),pageType:"employee"})},He=["ACTIVE","INACTIVE"],Ve=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==He?void 0:He.map((e,a)=>l.createElement(Ue,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},We=e=>{var o;let{type:i="desktop",onClose:r,onFilterChange:u,searchParams:s}=e;const{t:c}=a.useTranslation(),[m,v]=n.useState(()=>d({},s)),p=Digit.ULBService.getCurrentTenantId(),E=null==p?void 0:p.split(".")[0],{isLoading:g,data:f}=Digit.Hooks.useCommonMDMS(E,"mseva",["EventCategories"]),h=()=>{v({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),u({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==r||r()},y=e=>{v(d({},m,e))};return g?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},c("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:h},c("ES_COMMON_CLEAR_ALL")),"desktop"===i&&l.createElement("span",{className:"clear-search",onClick:h},l.createElement(t.RefreshIcon,null)),"mobile"===i&&l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+c("EVENTS_CATEGORY_LABEL")),l.createElement(t.Dropdown,{option:null==f||null===(o=f.mseva)||void 0===o?void 0:o.EventCategories,optionKey:"code",t:c,selected:null==m?void 0:m.eventCategory,select:e=>y({eventCategory:e})}),l.createElement(t.DateRange,{t:c,values:null==m?void 0:m.range,onFilterChange:y,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(Ve,{onAssignmentChange:(e,t)=>{var n;y(e.target.checked?{eventStatus:[...(null==m?void 0:m.eventStatus)||[],t]}:{eventStatus:null==m||null===(n=m.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:m})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(u(m),void(null==r||r())),label:c("ES_COMMON_APPLY")}))))},qe=e=>l.createElement("span",{className:""},e),je=e=>{let{isLoading:n,data:a,t:i,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:p,onFilterChange:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_}=e;const C=l.useMemo(()=>[{Header:i("EVENTS_EVENT_NAME_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:u+"/event/inbox/event-details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_EVENT_CATEGORY_LABEL"),accessor:e=>qe(null!=e&&e.eventCategory?i("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)):"")},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?qe(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?qe(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return qe((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let b;return n?b=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(b=l.createElement(Me,{t:i,data:a,columns:C,globalSearch:m,onSearch:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(We,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(ke,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},ze=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,serviceRequestIdKey:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i);Digit.ULBService.getCurrentTenantId(),o.useHistory(),n.useEffect(()=>{m&&E(!0)},[m]);const h=()=>{E(!1),f(i)};let y;return 0===(null==c?void 0:c.length)?y=l.createElement(t.Card,{style:{marginTop:20}},s("ES_NO_EVENTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(y=l.createElement(t.DetailsCard,{data:c,linkPrefix:"/digit-ui/employee/engagement/event/inbox/event-details/",serviceRequestIdKey:d})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),y,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(We,{onFilterChange:r,onClose:h,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(ke,{t:s,type:"mobile",onClose:h,onSearch:u,searchParams:i,searchFields:a}))))},Ye=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),Ge=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:a,icon:o,links:i}),l.createElement(ze,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s,c,d,m,v,p;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(i=u.ulb)||void 0===i?void 0:i.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!k(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(p=u.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a;return{applicationNo:null==e?void 0:e.id,[n("EVENTS_EVENT_NAME_LABEL")]:null==e?void 0:e.name,[n("EVENTS_EVENT_CATEGORY_LABEL")]:n("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)),[n("EVENTS_START_DATE_LABEL")]:we(new Date(null==e||null===(t=e.eventDetails)||void 0===t?void 0:t.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:we(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(a=e.user)||void 0===a?void 0:a.name,[n("EVENTS_STATUS_LABEL")]:Ye(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,serviceRequestIdKey:"applicationNo"}))))},Ke=e=>{var o;let{tenants:i,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const s=Digit.ULBService.getCurrentTenantId(),[c,m]=n.useState(10),[v,p]=n.useState(0),[E,g]=n.useState({eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const h=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_NAME_LABEL"),name:"eventName"}],y=[{text:u("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox/new-event"}],{data:S,isLoading:_}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{eventTypes:"EVENTSONGROUND",limit:c,offset:v},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),C=e=>{let t=d({},e);null!=e&&e.ulb||(t=d({},e,{ulb:{code:s}})),g(d({},E,t))},b=e=>{g(d({},E,e))},T=n.useCallback(()=>{p(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{p(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(Ge,{data:null==S?void 0:S.events,searchParams:E,searchFields:h(),t:u,onFilterChange:b,onSearch:C,isLoading:_,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:y}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_EVENTS_HEADER"),Number(null==S?void 0:S.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==S?void 0:S.totalCount)):null),l.createElement(je,{t:u,data:null==S?void 0:S.events,links:y,parentRoute:r,searchParams:E,onSearch:C,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.eventName||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.eventName.toUpperCase())))&&(null==E||null===(i=E.ulb)||void 0===i||!i.code||e.original.tenantId===(null==E||null===(r=E.ulb)||void 0===r?void 0:r.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!k(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:h(),onFilterChange:b,pageSizeLimit:c,totalRecords:null==S?void 0:S.totalCount,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:y,currentPage:parseInt(v/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{m(t=>e.target.value)}}))},Qe=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p})},Xe=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:i}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:i})},Ze=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:m,formState:v,reset:p,control:E}=i.useForm({defaultValues:a}),g=innerWidth<=640,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),_=()=>{p({ulb:null,name:""}),n({ulb:null,name:""})},C=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:_},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(e=>{n(e),"mobile"===r&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(Xe,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});case"range":return l.createElement(i.Controller,{render:e=>{let{value:n,onChange:a}=e;return l.createElement(t.DateRange,{t:c,values:n,onFilterChange:e=>a(e.range),labelClass:"filter-label"})},name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,C()))))),("mobile"===r||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},C(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},$e=e=>{let{title:n="CS_HEADER_PUBLIC_BRDCST",links:i,icon:r="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},l.createElement(t.PMBIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},i.map((e,t)=>{let{link:n,text:a,hyperlink:i=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Je=e=>{var n,o;let{status:i,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:s(i),pageType:"employee"})},et=["ACTIVE","INACTIVE"],tt=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==et?void 0:et.map((e,a)=>l.createElement(Je,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},nt=e=>{let{type:o="desktop",onClose:i,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,m]=n.useState(()=>d({},u)),v=Digit.ULBService.getCurrentTenantId(),p=null==v?void 0:v.split(".")[0],{isLoading:E}=Digit.Hooks.useCommonMDMS(p,"mseva",["EventCategories"]),g=()=>{m({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),r({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==i||i()},f=n.useCallback(e=>{m(t=>d({},t,e))},[]);return E?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:g},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:g},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:i},l.createElement(t.CloseSvg,null))),l.createElement(t.DateRange,{t:s,values:null==c?void 0:c.range,onFilterChange:f,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(tt,{onAssignmentChange:(e,t)=>{var n;f(e.target.checked?{eventStatus:[...(null==c?void 0:c.eventStatus)||[],t]}:{eventStatus:null==c||null===(n=c.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:c})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(r(c),void(null==i||i())),label:s("ES_COMMON_APPLY")}))))},lt=e=>l.createElement("span",{className:""},e),at=e=>{let{isLoading:n,data:a,t:i,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:p,onFilterChange:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_}=e;const C=l.useMemo(()=>[{Header:i("EVENTS_MESSAGE_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:u+"/messages/inbox/details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_POSTING_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?lt(we(new Date(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime),"dd/MM/yyyy")):""}},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?lt(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?lt(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return lt((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let b;return n?b=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(b=l.createElement(Qe,{t:i,data:a,columns:C,globalSearch:m,onSearch:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement($e,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(nt,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(Ze,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},ot=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i),h=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&E(!0)},[m]);const y=()=>{E(!1),f(i)};let _;return 0===(null==c?void 0:c.length)?_=l.createElement(t.Card,{style:{marginTop:20}},s("ES_NO_PUBLIC_MESSAGES").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(_=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>{var n;return S(null==t||null===(n=t.user)||void 0===n?void 0:n.name,e["Posted By"])&&S(t.name,e.Title)});t&&h.push("/digit-ui/employee/engagement/messages/inbox/details/"+(null==t?void 0:t.id))}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),_,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(nt,{onFilterChange:r,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Ze,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:i,searchFields:a}))))},it=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),rt=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement($e,{title:a,icon:o,links:i}),l.createElement(ot,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s,c,d,m,v,p;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(i=u.ulb)||void 0===i?void 0:i.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!k(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(p=u.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a,o;return{[n("PUBLIC_BRDCST_TITLE_LABEL")]:null==e?void 0:e.name,[n("EVENTS_POSTING_DATE_LABEL")]:we(new Date(null==e||null===(t=e.auditDetails)||void 0===t?void 0:t.createdTime),"dd/MM/yyyy"),[n("EVENTS_START_DATE_LABEL")]:we(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:we(new Date(null==e||null===(a=e.eventDetails)||void 0===a?void 0:a.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(o=e.user)||void 0===o?void 0:o.name,[n("EVENTS_STATUS_LABEL")]:it(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,responseData:t}))))},ut=e=>{var o;let{tenants:i,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const s=Digit.ULBService.getCurrentTenantId(),[c,m]=n.useState(10),[v,p]=n.useState(0),[E,g]=n.useState({eventStatus:[],name:"",range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const{data:h,isLoading:y}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST",limit:c,offset:v},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),S=e=>{let t=d({},e);null!=e&&e.ulb||(t=d({},e,{ulb:{code:s}})),g(e=>d({},e,t))},_=e=>{g(t=>d({},t,e))},C=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_MESSAGE_LABEL"),name:"name"}],b=[{text:u("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/inbox/create"}],T=n.useCallback(()=>{p(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{p(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(rt,{data:null==h?void 0:h.events,searchParams:E,searchFields:C(),t:u,onFilterChange:_,onSearch:S,isLoading:y,title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",iconName:"calender",links:b}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER"),Number(null==h?void 0:h.length)?l.createElement("p",{className:"inbox-count"},Number(null==h?void 0:h.length)):null),l.createElement(at,{t:u,data:null==h?void 0:h.events,links:b,parentRoute:r,searchParams:E,onSearch:S,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.name||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.name.toUpperCase())))&&(null==E||null===(i=E.ulb)||void 0===i||!i.code||e.original.tenantId===(null==E||null===(r=E.ulb)||void 0===r?void 0:r.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!k(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:C(),onFilterChange:_,pageSizeLimit:c,totalRecords:null==h?void 0:h.totalCount,currentPage:parseInt(v/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{m(t=>e.target.value)},title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",links:b,isLoading:y}))},st=[{head:"",body:[{type:"form",withoutLabel:!0,component:"MessageForm",nextStep:"",route:"",key:"messageData"}]}],ct=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[v,p,E]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),E(),m()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ADD_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{config:st,onSubmit:e=>{var t,n,l;const{fromDate:a,toDate:o,description:r,name:u,documents:s}=e,c={events:[{recepient:null,source:"WEBAPP",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:r,name:u,eventDetails:{documents:s,fromDate:null===(n=x(new Date(""+a)))||void 0===n?void 0:n.getTime(),toDate:null===(l=x(new Date(""+o)))||void 0===l?void 0:l.getTime()}}]};i.push("/digit-ui/employee/engagement/messages/response",c)},label:e("ACTION_ADD_NEW_MESSAGE")}))},dt=e=>{var n,o,i;const{t:r}=a.useTranslation();return l.createElement(t.Banner,{message:r(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,successful:e.isSuccess})},mt=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=Digit.Hooks.useQueryParams(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),d=Digit.Hooks.events.useUpdateEvent(),{state:m}=e.location,[v,p,E]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1),[y,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1);n.useEffect(()=>{d.data&&f(d.data)},[d.data]),n.useEffect(()=>{c.data&&f(c.data)},[c.data]);const C=(e,t)=>{var n,l,a;S((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),p(!0)};return n.useEffect(()=>{const e=()=>{p(!0),i.clear()};if(!v){if(Boolean(null==s?void 0:s.delete)||Boolean(null==s?void 0:s.update))return void d.mutate(m,{onError:C,onSuccess:e});c.mutate(m,{onError:C,onSuccess:e})}},[]),null!=s&&s.delete||null!=s&&s.update?d.isLoading||d.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(dt,{t:u,message:null!=s&&s.update?d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_UPDATED":"ENG_PUBLIC_BRDCST_UPDATION_FAILED":d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_DELETED":"ENGAGEMENT_PUBLIC_BRDCST_DELETION_FAILED",data:d.data||g,isSuccess:(null==d?void 0:d.isSuccess)||g,isLoading:d.isIdle&&!v||d.isLoading}),l.createElement(t.CardText,null,u("ENGAGEMENT_PUBLIC_BRDCST_MESSAGES")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")})))):c.isLoading||c.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(dt,{t:u,message:c.isSuccess||g?"ENGAGEMENT_BROADCAST_MESSAGE_CREATED":"ENGAGEMENT_BROADCAST_MESSAGE_FAILED",data:c.data||g,isSuccess:c.isSuccess||g,isLoading:c.isIdle&&!v||c.isLoading}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},vt=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),{id:r}=o.useParams(),u=Digit.ULBService.getCurrentTenantId(),{isLoading:s,data:c}=Digit.Hooks.events.useInbox(u,{},{eventTypes:"BROADCAST",ids:r},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[m,v,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[E,g,f]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[h,y,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{v(!1),S(),f()},[]);const _=n.useMemo(()=>{var e,t,n;const l=null==c||null===(e=c.eventDetails)||void 0===e?void 0:e.documents;return{name:null==c?void 0:c.name,description:null==c?void 0:c.description,documents:null==l?void 0:l.map(e=>[e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:u}}]),fromDate:c?we(new Date(null==c||null===(t=c.eventDetails)||void 0===t?void 0:t.fromDate),"yyyy-MM-dd"):null,toDate:c?we(new Date(null==c||null===(n=c.eventDetails)||void 0===n?void 0:n.toDate),"yyyy-MM-dd"):null}},[c]);return s?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("EDIT_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{defaultValues:_,config:st,onSubmit:e=>{var t;const{fromDate:n,toDate:l,description:a,name:o,documents:r}=e,u=(e=>!(!e||!e.length||!(Array.isArray(e)&&e.length&&Array.isArray(e[0]))))(r)?(s=r)&&s.length?s.reduce((e,t)=>{let n={};const[l,{file:a,fileStoreId:o}]=t;return n.fileName=null==a?void 0:a.name,n.documentType=null==a?void 0:a.type,n.fileStoreId=null==o?void 0:o.fileStoreId,e.push(n),e},[]):[]:r;var s;const m={events:[d({},c,{source:"WEBAPP",status:"ACTIVE",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:a,name:o,eventDetails:{documents:u,fromDate:w(""+n),toDate:w(""+l)}})]};i.push("/digit-ui/employee/engagement/messages/response?update=true",m)},label:e("ACTION_EDIT_MESSAGE")}))},pt=e=>l.createElement("h1",{className:"heading-m"},e.label),Et=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),gt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Et,null)),ft=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;const{data:g,isLoading:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:h,data:y}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[S,_]=n.useState({}),[C,b]=n.useState({}),[T,D]=n.useState([]),[N,A]=n.useState(null),[w,x]=n.useState(null),[I,L]=n.useState(null),[O,R]=n.useState(null),[P,M]=n.useState([]),[F,k]=n.useState(null),[B,U]=n.useState(!1);function H(e){x(e.target.files[0])}return n.useEffect(()=>{var e;y&&y["egf-master"]&&M(null===(e=y["egf-master"])||void 0===e?void 0:e.FinancialYear)},[y]),n.useEffect(()=>{var e;D(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(w){const e=function(){if(w.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",w,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[w]),n.useEffect(()=>{r&&_(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:o,selectedFinancialYear:i,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+a.action+"_APPLICATION",submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:i})}]}]}})({t:i,action:r,financialYears:P,selectedFinancialYear:F,setSelectedFinancialYear:k}):(e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v}=e;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==o?void 0:o.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:T,selectedApprover:N,setSelectedApprover:A,selectFile:H,uploadedFile:I,setUploadedFile:L,businessService:p}))},[r,T,P,F,I]),r&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(pt,{label:i(S.label.heading)}),headerBarEnd:l.createElement(gt,{onClick:s}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!I,formId:"modal-action"},h?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};m.creationReason="STATUS",c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:d({},m,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==F?void 0:F.name,propertyId:null==m?void 0:m.propertyId,tenantId:u,source:null==m?void 0:m.source,channel:null==m?void 0:m.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!N?[]:[N],I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==w?void 0:w.name,fileStoreId:I}]),c({Property:d({},m,{workflow:t})})}},defaultValues:C,formId:"modal-action"})):l.createElement(t.Loader,null)},ht=e=>l.createElement("h1",{className:"heading-m"},e.label),yt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),St=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yt,null)),_t=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:f}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[h,y]=n.useState({}),[S,_]=n.useState({}),[C,b]=n.useState([]),[T,D]=n.useState({}),[N,A]=n.useState(null),[w,x]=n.useState(null),[I,L]=n.useState(null),[O,R]=n.useState([]),[P,M]=n.useState(null);n.useEffect(()=>{var e;f&&f["egf-master"]&&R(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]);const{data:F}=Digit.Hooks.useCustomMDMS(u,"common-masters",[{name:"Department"}]);function k(e){A(e.target.files[0])}return n.useEffect(()=>{if(E&&F){var e;const t=F["common-masters"].Department;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const o=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,i=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===o);return console.log("matchedDept===",i),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==i?void 0:i.name)}}))}},[E]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",N,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?x(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),n.useEffect(()=>{r&&y((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:T,setSelectedApprover:D,selectFile:k,uploadedFile:w,setUploadedFile:x,businessService:p}))},[r,C,O,P,w]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ht,{label:i(h.label.heading)}),headerBarEnd:l.createElement(St,{onClick:s}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:h.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){m=d({},m,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,wfDocuments:w?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:w}]:null}),c({Licenses:[m]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Ct=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),bt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Tt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(bt,null)),Dt=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;const{data:E,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState({}),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),L=!!Digit.Utils.browser.isMobile();function O(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))I(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",D,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(){I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(v=!1),a.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:O,uploadedFile:A,setUploadedFile:w,businessService:p,error:x}))},[r,_,A,x]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ct,{label:i(f.label.heading)}),headerBarEnd:l.createElement(Tt,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:L?{width:"720px"}:{},style:L?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:L?{paddingLeft:"5px"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){m=d({},m,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null}),c({Licenses:[m]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Nt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),At=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),wt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(At,null)),xt=e=>{var a,o,i,u,s,c,m,p,E,g,f,h;let{t:y,action:S,tenantId:_,closeModal:C,submitAction:b,applicationDetails:T,applicationData:D,businessService:N,workflowDetails:A,blockReason:w}=e;console.log("applicationData",D),console.log("workflowDetails",A),Digit.Hooks.obps.useObpsAPI(null!==(a=D)&&void 0!==a&&null!==(o=a.landInfo)&&void 0!==o&&null!==(i=o.address)&&void 0!==i&&i.city?null===(u=D)||void 0===u||null===(s=u.landInfo)||void 0===s||null===(c=s.address)||void 0===c?void 0:c.city:_,!1);const{data:x,isLoading:I}=Digit.Hooks.useEmployeeSearch(_,{roles:null==A||null===(m=A.data)||void 0===m||null===(p=m.initialActionState)||void 0===p||null===(E=p.nextActions)||void 0===E||null===(g=E.filter(e=>(null==e?void 0:e.action)==(null==S?void 0:S.action)))||void 0===g||null===(f=g[0])||void 0===f||null===(h=f.assigneeRoles)||void 0===h?void 0:h.map(e=>({code:e})),isActive:!0},{enabled:!(null!=S&&S.isTerminateState)}),[L,O]=(r.useQueryClient(),n.useState({})),[R,P]=n.useState({}),[M,F]=n.useState([]),[k,B]=n.useState([]),[U,H]=n.useState({}),[V,W]=n.useState({}),[q,j]=n.useState(null),[z,Y]=n.useState(null),[G,K]=n.useState(null),[Q,X]=n.useState(null),Z=!!Digit.Utils.browser.isMobile();function $(e){j(e.target.files[0])}n.useEffect(()=>{var e;F(null==x||null===(e=x.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[x]),n.useEffect(()=>{!function(){try{K(null);const e=function(){if(q){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(q.size>=5242880)K(y("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=q&&q.type&&!e.test(null==q?void 0:q.type))K(y("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",q,Digit.ULBService.getStateId()||(null==_?void 0:_.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):K(y("CS_FILE_UPLOAD_ERROR"))})},function(){K(y("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[q]);const J=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},ee=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},te=e=>{var t,n;let l=[],a=[];var o,i;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(i=l)||void 0===i?void 0:i.length)>0&&l.map((e,t)=>{a.push({docs:J(e.Documents),date:e.InspectionDate,questions:ee(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},ne=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,o,i,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(o=e.uploadedDocuments)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},le=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{B(null==w?void 0:w.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),S&&O((e=>{var n,a,o,i,r,u,s;let{t:c,action:d,approvers:m,selectedApprover:v,setSelectedApprover:p,selectedBlockReason:E,setBlockReason:g,selectFile:f,uploadedFile:h,setUploadedFile:y,assigneeLabel:S,businessService:_,error:C,blockReasonFiltered:b}=e,T=!1;return"REVOCATE"!=(null==d?void 0:d.action)&&"REJECT"!=(null==d?void 0:d.action)&&"SKIP_PAYMENT"!=d.action&&"SEND_BACK_TO_CITIZEN"!=(null==d?void 0:d.action)&&"APPROVE"!=(null==d?void 0:d.action)||(T=!0),{label:{heading:"WF_"+(null==d?void 0:d.action)+"_APPLICATION",submit:"WF_"+_+"_"+(null==d?void 0:d.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(n=d.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(a=d.state)||void 0===a?void 0:a.state)?null:c(S||"WF_ROLE_"+(null===(o=d.assigneeRoles)||void 0===o?void 0:o[0])),type:"dropdown",populators:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(i=d.state)||void 0===i?void 0:i.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(r=d.state)||void 0===r?void 0:r.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:p,selected:v})},{label:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(u=d.state)||void 0===u?void 0:u.state)?c("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(s=d.state)||void 0===s?void 0:s.state)?l.createElement(t.Dropdown,{option:b,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:g,selected:E,isMandatory:!0}):null},{label:c("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+c("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:f,onDelete:()=>{y(null)},message:h?"1 "+c("ES_PT_ACTION_FILEUPLOADED"):c("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:C})}]}]}})({t:y,action:S,approvers:M,selectedApprover:U,setSelectedApprover:H,selectedBlockReason:V,setBlockReason:W,selectFile:$,uploadedFile:z,setUploadedFile:Y,businessService:N,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:G,blockReasonFiltered:k}))},[S,M,Q,z,G]),S&&L.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Nt,{label:y(L.label.heading)}),headerBarEnd:l.createElement(wt,{onClick:C}),actionCancelLabel:y(L.label.cancel),actionCancelOnSubmit:C,actionSaveLabel:y(L.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Z?{width:"720px"}:{},style:Z?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Z?{paddingLeft:"5px"}:{}},I?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:L.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,o,i,r,u,s,c,m,v,p,E,g,f,h,N,w,x,I,L,O,R,P,M,F;D=d({},D,{documents:ne(),additionalDetails:d({},null===(t=D)||void 0===t?void 0:t.additionalDetails,{fieldinspection_pending:te(D),pendingapproval:le(),blockingReason:null==V?void 0:V.name}),workflow:{action:null==S?void 0:S.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==A||null===(a=A.data)||void 0===a||null===(o=a.processInstances)||void 0===o||null===(i=o[0])||void 0===i||null===(r=i.state)||void 0===r?void 0:r.applicationStatus)?[null==A||null===(u=A.data)||void 0===u||null===(s=u.processInstances)||void 0===s||null===(c=s[0])||void 0===c||null===(m=c.assigner)||void 0===m?void 0:m.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==A||null===(v=A.data)||void 0===v||null===(p=v.processInstances)||void 0===p||null===(E=p[0])||void 0===E||null===(g=E.state)||void 0===g?void 0:g.applicationStatus)?[null==A||null===(f=A.data)||void 0===f||null===(h=f.processInstances)||void 0===h||null===(N=h[0])||void 0===N||null===(w=N.assigner)||void 0===w?void 0:w.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,varificationDocuments:z?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==q?void 0:q.name,fileStoreId:z}]:null},action:null==S?void 0:S.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==A||null===(x=A.data)||void 0===x||null===(I=x.processInstances)||void 0===I||null===(L=I[0])||void 0===L||null===(O=L.state)||void 0===O?void 0:O.applicationStatus)?[null==A||null===(R=A.data)||void 0===R||null===(P=R.processInstances)||void 0===P||null===(M=P[0])||void 0===M||null===(F=M.assigner)||void 0===F?void 0:F.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,wfDocuments:z?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==q?void 0:q.name,fileStoreId:z}]:null});const k=function(e,t,n,l,a,o,i,r,u,s,c,m){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=D)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null===(l=D)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null===(i=D)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(u=r.selfCertificationCharges)||void 0===u?void 0:u.BPA_WATER_CHARGES)+parseInt(null===(s=D)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(m=c.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS))){var v,p,E;D.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",D.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",D.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",D.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),D.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==T||null===(v=T.nocData)||void 0===v?void 0:v.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:d({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}});let t={sourceRefId:null==e||null===(p=e[0])||void 0===p||null===(E=p.Noc)||void 0===E?void 0:E.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(_,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,o,i,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let o=[];if(e&&e.map(e=>{var t,n,i,r,u,s,c,d,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(i=e.Noc)||void 0===i||null===(r=i.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(s=u.applicationStatus)||void 0===s?void 0:s.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&l||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&a)&&o.push(e)}),"FIELDINSPECTION_INPROGRESS"==D.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?b({BPA:D},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0}):(C(),alert(y("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else b({BPA:D},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})})}C(),alert(y("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(k&&k.then?k.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:R,formId:"modal-action"})):l.createElement(t.Loader,null)},It=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Lt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ot=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Lt,null)),Rt=e=>{var a,i;let{t:u,action:s,tenantId:c,closeModal:m,submitAction:p,applicationData:E,businessService:g}=e;const{data:f,isLoading:h}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[y,S]=(r.useQueryClient(),n.useState({})),[_,C]=n.useState({}),[b,T]=n.useState([]),[D,N]=n.useState({}),[A,w]=n.useState(null),[x,I]=n.useState(null),[L,O]=n.useState(null),R=!!Digit.Utils.browser.isMobile();function P(e){w(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(A){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(A.size>=5242880)O(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=A&&A.type&&!e.test(null==A?void 0:A.type))O(u("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",A,Digit.ULBService.getStateId()||(null==c?void 0:c.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(u("CS_FILE_UPLOAD_ERROR"))})},function(){O(u("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),n.useEffect(()=>{s&&S((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(E=!0);let g=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(g=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==o?void 0:o.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||g?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||g?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:u,action:s,approvers:b,selectedApprover:D,setSelectedApprover:N,selectFile:P,uploadedFile:x,setUploadedFile:I,businessService:g,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:L}))},[s,b,x,L]),s&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(It,{label:u(y.label.heading)}),headerBarEnd:l.createElement(Ot,{onClick:m}),actionCancelLabel:u(y.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:u(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:R?{width:"720px"}:{},style:R?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:R?{paddingLeft:"5px"}:{}},h?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:y.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=E)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=E)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{o.push(e)}),E=d({},E,{workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,documents:x?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:x}]:null},documents:o}),p({Noc:E},!1,{isNoc:!0})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)};var Pt=function(e,t){return e===t||e!=e&&t!=t},Mt=function(e,t){for(var n=e.length;n--;)if(Pt(e[n][0],t))return n;return-1},Ft=Array.prototype.splice;function kt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}kt.prototype.clear=function(){this.__data__=[],this.size=0},kt.prototype.delete=function(e){var t=this.__data__,n=Mt(t,e);return!(n<0||(n==t.length-1?t.pop():Ft.call(t,n,1),--this.size,0))},kt.prototype.get=function(e){var t=this.__data__,n=Mt(t,e);return n<0?void 0:t[n][1]},kt.prototype.has=function(e){return Mt(this.__data__,e)>-1},kt.prototype.set=function(e,t){var n=this.__data__,l=Mt(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var Bt=kt,Ut="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ht(e,t){return e(t={exports:{}},t.exports),t.exports}var Vt,Wt="object"==typeof Ut&&Ut&&Ut.Object===Object&&Ut,qt="object"==typeof self&&self&&self.Object===Object&&self,jt=Wt||qt||Function("return this")(),zt=jt.Symbol,Yt=Object.prototype,Gt=Yt.hasOwnProperty,Kt=Yt.toString,Qt=zt?zt.toStringTag:void 0,Xt=Object.prototype.toString,Zt=zt?zt.toStringTag:void 0,$t=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Zt&&Zt in Object(e)?function(e){var t=Gt.call(e,Qt),n=e[Qt];try{e[Qt]=void 0;var l=!0}catch(e){}var a=Kt.call(e);return l&&(t?e[Qt]=n:delete e[Qt]),a}(e):function(e){return Xt.call(e)}(e)},Jt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},en=function(e){if(!Jt(e))return!1;var t=$t(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},tn=jt["__core-js_shared__"],nn=(Vt=/[^.]+$/.exec(tn&&tn.keys&&tn.keys.IE_PROTO||""))?"Symbol(src)_1."+Vt:"",ln=Function.prototype.toString,an=function(e){if(null!=e){try{return ln.call(e)}catch(e){}try{return e+""}catch(e){}}return""},on=/^\[object .+?Constructor\]$/,rn=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),un=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Jt(e)||(t=e,nn&&nn in t))&&(en(e)?rn:on).test(an(e));var t}(n)?n:void 0},sn=un(jt,"Map"),cn=un(Object,"create"),dn=Object.prototype.hasOwnProperty,mn=Object.prototype.hasOwnProperty;function vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}vn.prototype.clear=function(){this.__data__=cn?cn(null):{},this.size=0},vn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},vn.prototype.get=function(e){var t=this.__data__;if(cn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return dn.call(t,e)?t[e]:void 0},vn.prototype.has=function(e){var t=this.__data__;return cn?void 0!==t[e]:mn.call(t,e)},vn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=cn&&void 0===t?"__lodash_hash_undefined__":t,this};var pn=vn,En=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}gn.prototype.clear=function(){this.size=0,this.__data__={hash:new pn,map:new(sn||Bt),string:new pn}},gn.prototype.delete=function(e){var t=En(this,e).delete(e);return this.size-=t?1:0,t},gn.prototype.get=function(e){return En(this,e).get(e)},gn.prototype.has=function(e){return En(this,e).has(e)},gn.prototype.set=function(e,t){var n=En(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var fn=gn;function hn(e){var t=this.__data__=new Bt(e);this.size=t.size}hn.prototype.clear=function(){this.__data__=new Bt,this.size=0},hn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},hn.prototype.get=function(e){return this.__data__.get(e)},hn.prototype.has=function(e){return this.__data__.has(e)},hn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Bt){var l=n.__data__;if(!sn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new fn(l)}return n.set(e,t),this.size=n.size,this};var yn=hn,Sn=function(){try{var e=un(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_n=function(e,t,n){"__proto__"==t&&Sn?Sn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Cn=Object.prototype.hasOwnProperty,bn=function(e,t,n){var l=e[t];Cn.call(e,t)&&Pt(l,n)&&(void 0!==n||t in e)||_n(e,t,n)},Tn=function(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?_n(n,r,u):bn(n,r,u)}return n},Dn=function(e){return null!=e&&"object"==typeof e},Nn=function(e){return Dn(e)&&"[object Arguments]"==$t(e)},An=Object.prototype,wn=An.hasOwnProperty,xn=An.propertyIsEnumerable,In=Nn(function(){return arguments}())?Nn:function(e){return Dn(e)&&wn.call(e,"callee")&&!xn.call(e,"callee")},Ln=Array.isArray,On=function(){return!1},Rn=Ht(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?jt.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||On}),Pn=/^(?:0|[1-9]\d*)$/,Mn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Pn.test(e))&&e>-1&&e%1==0&&e<t},Fn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},kn={};kn["[object Float32Array]"]=kn["[object Float64Array]"]=kn["[object Int8Array]"]=kn["[object Int16Array]"]=kn["[object Int32Array]"]=kn["[object Uint8Array]"]=kn["[object Uint8ClampedArray]"]=kn["[object Uint16Array]"]=kn["[object Uint32Array]"]=!0,kn["[object Arguments]"]=kn["[object Array]"]=kn["[object ArrayBuffer]"]=kn["[object Boolean]"]=kn["[object DataView]"]=kn["[object Date]"]=kn["[object Error]"]=kn["[object Function]"]=kn["[object Map]"]=kn["[object Number]"]=kn["[object Object]"]=kn["[object RegExp]"]=kn["[object Set]"]=kn["[object String]"]=kn["[object WeakMap]"]=!1;var Bn=function(e){return function(t){return e(t)}},Un=Ht(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&Wt.process,o=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=o}),Hn=Un&&Un.isTypedArray,Vn=Hn?Bn(Hn):function(e){return Dn(e)&&Fn(e.length)&&!!kn[$t(e)]},Wn=Object.prototype.hasOwnProperty,qn=function(e,t){var n=Ln(e),l=!n&&In(e),a=!n&&!l&&Rn(e),o=!n&&!l&&!a&&Vn(e),i=n||l||a||o,r=i?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],u=r.length;for(var s in e)!t&&!Wn.call(e,s)||i&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Mn(s,u))||r.push(s);return r},jn=Object.prototype,zn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||jn)},Yn=function(e,t){return function(n){return e(t(n))}},Gn=Yn(Object.keys,Object),Kn=Object.prototype.hasOwnProperty,Qn=function(e){return null!=e&&Fn(e.length)&&!en(e)},Xn=function(e){return Qn(e)?qn(e):function(e){if(!zn(e))return Gn(e);var t=[];for(var n in Object(e))Kn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Zn=Object.prototype.hasOwnProperty,$n=function(e){return Qn(e)?qn(e,!0):function(e){if(!Jt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=zn(e),n=[];for(var l in e)("constructor"!=l||!t&&Zn.call(e,l))&&n.push(l);return n}(e)},Jn=Ht(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?jt.Buffer:void 0,o=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),el=function(){return[]},tl=Object.prototype.propertyIsEnumerable,nl=Object.getOwnPropertySymbols,ll=nl?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,o=0,i=[];++l<a;){var r=t[l];tl.call(e,r)&&(i[o++]=r)}return i}(nl(e)))}:el,al=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},ol=Yn(Object.getPrototypeOf,Object),il=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)al(t,ll(e)),e=ol(e);return t}:el,rl=function(e,t,n){var l=t(e);return Ln(e)?l:al(l,n(e))},ul=function(e){return rl(e,Xn,ll)},sl=function(e){return rl(e,$n,il)},cl=un(jt,"DataView"),dl=un(jt,"Promise"),ml=un(jt,"Set"),vl=un(jt,"WeakMap"),pl=an(cl),El=an(sn),gl=an(dl),fl=an(ml),hl=an(vl),yl=$t;(cl&&"[object DataView]"!=yl(new cl(new ArrayBuffer(1)))||sn&&"[object Map]"!=yl(new sn)||dl&&"[object Promise]"!=yl(dl.resolve())||ml&&"[object Set]"!=yl(new ml)||vl&&"[object WeakMap]"!=yl(new vl))&&(yl=function(e){var t=$t(e),n="[object Object]"==t?e.constructor:void 0,l=n?an(n):"";if(l)switch(l){case pl:return"[object DataView]";case El:return"[object Map]";case gl:return"[object Promise]";case fl:return"[object Set]";case hl:return"[object WeakMap]"}return t});var Sl=yl,_l=Object.prototype.hasOwnProperty,Cl=jt.Uint8Array,bl=function(e){var t=new e.constructor(e.byteLength);return new Cl(t).set(new Cl(e)),t},Tl=/\w*$/,Dl=zt?zt.prototype:void 0,Nl=Dl?Dl.valueOf:void 0,Al=Object.create,wl=function(){function e(){}return function(t){if(!Jt(t))return{};if(Al)return Al(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),xl=Un&&Un.isMap,Il=xl?Bn(xl):function(e){return Dn(e)&&"[object Map]"==Sl(e)},Ll=Un&&Un.isSet,Ol=Ll?Bn(Ll):function(e){return Dn(e)&&"[object Set]"==Sl(e)},Rl={};Rl["[object Arguments]"]=Rl["[object Array]"]=Rl["[object ArrayBuffer]"]=Rl["[object DataView]"]=Rl["[object Boolean]"]=Rl["[object Date]"]=Rl["[object Float32Array]"]=Rl["[object Float64Array]"]=Rl["[object Int8Array]"]=Rl["[object Int16Array]"]=Rl["[object Int32Array]"]=Rl["[object Map]"]=Rl["[object Number]"]=Rl["[object Object]"]=Rl["[object RegExp]"]=Rl["[object Set]"]=Rl["[object String]"]=Rl["[object Symbol]"]=Rl["[object Uint8Array]"]=Rl["[object Uint8ClampedArray]"]=Rl["[object Uint16Array]"]=Rl["[object Uint32Array]"]=!0,Rl["[object Error]"]=Rl["[object Function]"]=Rl["[object WeakMap]"]=!1;var Pl=function e(t,n,l,a,o,i){var r,u=1&n,s=2&n,c=4&n;if(l&&(r=o?l(t,a,o,i):l(t)),void 0!==r)return r;if(!Jt(t))return t;var d=Ln(t);if(d){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&_l.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!u)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=Sl(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(Rn(t))return Jn(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(r=s||v?{}:function(e){return"function"!=typeof e.constructor||zn(e)?{}:wl(ol(e))}(t),!u)return s?function(e,t){return Tn(e,il(e),t)}(t,function(e,t){return e&&Tn(t,$n(t),e)}(r,t)):function(e,t){return Tn(e,ll(e),t)}(t,function(e,t){return e&&Tn(t,Xn(t),e)}(r,t))}else{if(!Rl[m])return o?t:{};r=function(e,t,n){var l,a,o=e.constructor;switch(t){case"[object ArrayBuffer]":return bl(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?bl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?bl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Tl.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new o;case"[object Symbol]":return Nl?Object(Nl.call(e)):{}}}(t,m,u)}}i||(i=new yn);var p=i.get(t);if(p)return p;i.set(t,r),Ol(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,i))}):Il(t)&&t.forEach(function(a,o){r.set(o,e(a,n,l,o,t,i))});var E=d?void 0:(c?s?sl:ul:s?$n:Xn)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,o){E&&(a=t[o=a]),bn(r,o,e(a,n,l,o,t,i))}),r},Ml=function(e){return Pl(e,5)};const Fl=e=>l.createElement("h1",{className:"heading-m"},e.label),kl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Bl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kl,null)),Ul=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},Hl=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;const{data:E,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState({}),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),L=window.Digit.Utils.browser.isMobile(),O=window.location.href.includes("/employee");function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))I(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",D,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{var e,n,a,o;"DisconnectWSConnection"==(null===(e=m)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=m)||void 0===a||null===(o=a.processInstance)||void 0===o?void 0:o.businessService)?r&&h((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:m,businessService:v,error:p}=e,E=!0,g=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(g=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},g&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!g,type:"custom",populators:g?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,d({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{m(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p,error:x})):r&&h((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,businessService:m,error:v}=e,p=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p,error:x}))},[r,_,A,x]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Fl,{label:i(f.label.heading)}),headerBarEnd:l.createElement(Bl,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:L&&O?{width:"100%",height:"auto"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o,i,s,v,p,E;if(null!==(t=m)&&void 0!==t&&t.isBillAmend){var g,f,h,y,S,_,C,T,N;const t=d({},null===(g=m)||void 0===g||null===(f=g.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=d({},null===(h=m)||void 0===h?void 0:h.billAmendmentDetails,{workflow:{businessId:null===(y=m)||void 0===y||null===(S=y.billAmendmentDetails)||void 0===S?void 0:S.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(_=m)&&void 0!==_&&null!==(C=_.applicationType)&&void 0!==C&&C.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(T=m)&&void 0!==T&&null!==(N=T.applicationType)&&void 0!==N&&N.includes("WATER")?"WS":"SW",assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]}});c({AmendmentUpdate:n})}else{if(m=d({},m,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:[],assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:d({},null===(n=m)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]})}),null!=e&&e.date&&null!==(l=m)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=Ml(null==e?void 0:e.date);m.disconnectionExecutionDate=Ul(t)}else if(null!=e&&e.date){const t=Ml(null==e?void 0:e.date);m.connectionExecutionDate=Ul(t)}var w;if("DisconnectWSConnection"==(null===(o=m)||void 0===o||null===(i=o.processInstance)||void 0===i?void 0:i.businessService)||"DisconnectSWConnection"==(null===(s=m)||void 0===s||null===(v=s.processInstance)||void 0===v?void 0:v.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(w=m)||void 0===w?void 0:w.serviceType)?c({WaterConnection:m,disconnectRequest:!0}):c({SewerageConnection:m,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(p=m)||void 0===p?void 0:p.applicationType))c({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=m)||void 0===E?void 0:E.applicationType))c({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!0});else{var x,I,L,O,R,P,M,F,k,B,U,H,V;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocPenalty&&(m.additionalDetails.adhocPenalty=parseInt(null==t||null===(I=t.value)||void 0===I?void 0:I.adhocPenalty)||""),null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenaltyComment&&(m.additionalDetails.adhocPenaltyComment=(null==t||null===(O=t.value)||void 0===O?void 0:O.adhocPenaltyComment)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyReason&&(m.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(m.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateComment&&(m.additionalDetails.adhocRebateComment=(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(m.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(V=m)||void 0===V?void 0:V.serviceType)?c({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Vl=e=>l.createElement("h1",{className:"heading-m"},e.label),Wl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ql=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Wl,null)),jl=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;console.log("applicationData",m);const{data:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState(null),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),[L,O]=n.useState(!1);function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(){I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p}))},[r,_,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Vl,{label:i(f.label.heading)}),headerBarEnd:l.createElement(ql,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};m.creationReason="CREATE",c({PetRegistrationApplications:[d({},m,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!b?[]:[b],A&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]),c({PetRegistrationApplications:[d({},m,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},zl=e=>l.createElement("h1",{className:"heading-m"},e.label),Yl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Gl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Yl,null)),Kl=e=>{var a,o,i;let{t:r,action:u,closeModal:s,submitAction:c,applicationData:m,businessService:v}=e;const p=Digit.ULBService.getStateId(),{data:E,isLoading:g}=Digit.Hooks.tl.useTradeLicenseMDMS(p,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==E||null===(a=E.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",m);const[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState(""),[D,N]=n.useState([]),[A,w]=n.useState(null),x=null===(o=m)||void 0===o||null===(i=o.tradeLicenseDetail)||void 0===i?void 0:i.tradeUnits;console.log("tradeUnits",x);const I=n.useMemo(()=>{var e;if(g||!E||!x.length)return[];const t=new Set(x.map(e=>e.tradeType)),n=(null===(e=E.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[g,E,x]);return console.log("years",I),n.useEffect(()=>{u&&h((e=>{let{t:n,action:a,years:o,selectedApprover:i,setSelectedApprover:r,businessService:u}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==u?void 0:u.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:o,autoComplete:"off",select:r,selected:i})}]}]}})({t:r,action:u,years:I,selectedApprover:b,setSelectedApprover:T,businessService:v}))},[u,I,D,A]),u&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(zl,{label:r(f.label.heading)}),headerBarEnd:l.createElement(Gl,{onClick:s}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=m)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a="20"+Number(l)+"-"+(Number(l)+1);m=d({},m,{financialYear:a,action:"INITIATE",additionalDetail:d({},m.additionalDetail,{validityYears:b.length>0?parseInt(b):""})}),c({Licenses:[m]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Ql=e=>l.createElement("h1",{className:"heading-m"},e.label),Xl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Zl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Xl,null)),$l=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:E,moduleCode:g}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[h,y]=n.useState({}),[S,_]=n.useState({}),[C,b]=n.useState([]),[T,D]=n.useState(null),[N,A]=n.useState(null),[w,x]=n.useState(null),[I,L]=n.useState(null),[O,R]=n.useState(!1);function P(e){R(!0),A(e.target.files[0])}return n.useEffect(()=>{var e;b(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",N,u)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?x(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(R(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),console.log("actyhdesh,jhfsefsef",r,m),n.useEffect(()=>{y((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,approvers:u,selectedApprover:s,setSelectedApprover:c,isUploading:d}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",d),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:u,t:n,optionKey:"name",select:c,selected:s})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{r(null)},message:d?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):i?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:T,setSelectedApprover:D,selectFile:P,uploadedFile:w,setUploadedFile:x,businessService:E,isUploading:O}))},[r,C,w]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ql,{label:i(h.label.heading)}),headerBarEnd:l.createElement(Zl,{onClick:s}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:h.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:E,moduleName:g,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==m||null===(t=m.auditDetails)||void 0===t?void 0:t.createdBy]:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null};w&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:w}]),c({streetVendingDetail:d({},m,{workflow:n})})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Jl=e=>l.createElement("h1",{className:"heading-m"},e.label),ea=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ta=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ea,null)),na=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;console.log("applicationData",m);const{data:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState(null),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),[L,O]=n.useState(!1);function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(){I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:u}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+u+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p}))},[r,_,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Jl,{label:i(f.label.heading)}),headerBarEnd:l.createElement(ta,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:E};A&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,filestoreId:A}]),c({hallsBookingApplication:[d({},m,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},la=e=>l.createElement("h1",{className:"heading-m"},e.label),aa=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),oa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(aa,null)),ia=e=>{var a,i,r;let{t:u,action:s,tenantId:c,closeModal:m,submitAction:v,applicationData:p,businessService:E,moduleCode:g}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(a=s.roles)||void 0===a||null===(i=a[0])||void 0===i||null===(r=i.map)||void 0===r?void 0:r.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),h=o.useHistory(),[y,S]=n.useState({}),[_,C]=n.useState({}),[b,T]=n.useState([]),[D,N]=n.useState(null),[A,w]=n.useState(null);return n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{"INITIATED"===(null==s?void 0:s.state)?h.push("/digit-ui/employee/asset/assetservice/edit/"+(null==p?void 0:p.applicationNo)):S((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:u,action:s,approvers:b,selectedApprover:D,setSelectedApprover:N,uploadedFile:A,setUploadedFile:w,businessService:E}))},[s,b,A]),s&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(la,{label:u(y.label.heading)}),headerBarEnd:l.createElement(oa,{onClick:m}),actionCancelLabel:u(y.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:u(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==s?void 0:s.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:g};A&&(t.documents=[]),v({Asset:d({},p,{workflow:t})})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},ra=e=>null!=e&&e.businessService.includes("PT")?l.createElement(ft,e):null!=e&&e.businessService.includes("ptr")?l.createElement(jl,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(_t,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(Kl,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(Dt,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(xt,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(Rt,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(Hl,e):null!=e&&e.businessService.includes("street-vending")?l.createElement($l,e):null!=e&&e.businessService.includes("chb")?l.createElement(na,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(ia,e):void 0;var ua=Ht(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",i="[object Array]",r="[object Boolean]",u="[object Date]",s="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",g="[object Set]",f="[object String]",h="[object Symbol]",y="[object WeakMap]",S="[object ArrayBuffer]",_="[object DataView]",C="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",D="[object Int16Array]",N="[object Int32Array]",A="[object Uint8Array]",w="[object Uint16Array]",x="[object Uint32Array]",I=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,O=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(R.source),F=RegExp(P.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q=/[\\^$.*+?()[\]{}|]/g,j=RegExp(q.source),z=/^\s+/,Y=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,K=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Z=/[()=,{}\[\]\/\s]/,$=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,ie=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,re=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",de="["+ce+"]",me="["+se+"]",ve="\\d+",pe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",fe="[^\\ud800-\\udfff]",he="(?:\\ud83c[\\udde6-\\uddff]){2}",ye="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",_e="(?:"+pe+"|"+Ee+")",Ce="(?:"+Se+"|"+Ee+")",be="(?:"+me+"|"+ge+")?",Te="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[fe,he,ye].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",De="(?:"+["[\\u2700-\\u27bf]",he,ye].join("|")+")"+Te,Ne="(?:"+[fe+me+"?",me,he,ye,"[\\ud800-\\udfff]"].join("|")+")",Ae=RegExp("['’]","g"),we=RegExp(me,"g"),xe=RegExp(ge+"(?="+ge+")|"+Ne+Te,"g"),Ie=RegExp([Se+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[de,Se,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[de,Se+_e,"$"].join("|")+")",Se+"?"+_e+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Se+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,De].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),Oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Pe=-1,Me={};Me[C]=Me[b]=Me[T]=Me[D]=Me[N]=Me[A]=Me["[object Uint8ClampedArray]"]=Me[w]=Me[x]=!0,Me[o]=Me[i]=Me[S]=Me[r]=Me[_]=Me[u]=Me[s]=Me[c]=Me[m]=Me[v]=Me[p]=Me[E]=Me[g]=Me[f]=Me[y]=!1;var Fe={};Fe[o]=Fe[i]=Fe[S]=Fe[_]=Fe[r]=Fe[u]=Fe[C]=Fe[b]=Fe[T]=Fe[D]=Fe[N]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[g]=Fe[f]=Fe[h]=Fe[A]=Fe["[object Uint8ClampedArray]"]=Fe[w]=Fe[x]=!0,Fe[s]=Fe[c]=Fe[y]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,Ue=parseInt,He="object"==typeof Ut&&Ut&&Ut.Object===Object&&Ut,Ve="object"==typeof self&&self&&self.Object===Object&&self,We=He||Ve||Function("return this")(),qe=t&&!t.nodeType&&t,je=qe&&e&&!e.nodeType&&e,ze=je&&je.exports===qe,Ye=ze&&He.process,Ge=function(){try{return je&&je.require&&je.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),Ke=Ge&&Ge.isArrayBuffer,Qe=Ge&&Ge.isDate,Xe=Ge&&Ge.isMap,Ze=Ge&&Ge.isRegExp,$e=Ge&&Ge.isSet,Je=Ge&&Ge.isTypedArray;function et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function tt(e,t,n,l){for(var a=-1,o=null==e?0:e.length;++a<o;){var i=e[a];t(l,i,n(i),e)}return l}function nt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,o=[];++n<l;){var i=e[n];t(i,n,e)&&(o[a++]=i)}return o}function it(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function rt(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function st(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}function dt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function mt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=St("length");function pt(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function Et(e,t,n,l){for(var a=e.length,o=n+(l?1:-1);l?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):Et(e,ht,n)}function ft(e,t,n,l){for(var a=n-1,o=e.length;++a<o;)if(l(e[a],t))return a;return-1}function ht(e){return e!=e}function yt(e,t){var n=null==e?0:e.length;return n?bt(e,t)/n:NaN}function St(e){return function(t){return null==t?void 0:t[e]}}function _t(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,o){n=l?(l=!1,e):t(n,e,a,o)}),n}function bt(e,t){for(var n,l=-1,a=e.length;++l<a;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Tt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Dt(e){return e?e.slice(0,jt(e)+1).replace(z,""):e}function Nt(e){return function(t){return e(t)}}function At(e,t){return ut(t,function(t){return e[t]})}function wt(e,t){return e.has(t)}function xt(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function It(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Ot=_t({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Rt=_t({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Pt(e){return"\\"+ke[e]}function Mt(e){return Le.test(e)}function Ft(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function kt(e,t){return function(n){return e(t(n))}}function Bt(e,t){for(var n=-1,a=e.length,o=0,i=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,i[o++]=n)}return i}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Vt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Mt(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):vt(e)}function qt(e){return Mt(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function jt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var zt=_t({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Yt=function e(t){var Y=(t=null==t?We:Yt.defaults(We.Object(),t,Yt.pick(We,Re))).Array,se=t.Date,ce=t.Error,de=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,Ee=t.String,ge=t.TypeError,fe=Y.prototype,he=ve.prototype,ye=t["__core-js_shared__"],Se=de.prototype.toString,_e=he.hasOwnProperty,Ce=0,be=function(){var e=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Te=he.toString,De=Se.call(ve),Ne=We._,xe=pe("^"+Se.call(_e).replace(q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=ze?t.Buffer:void 0,ke=t.Symbol,He=t.Uint8Array,Ve=Le?Le.allocUnsafe:void 0,qe=kt(ve.getPrototypeOf,ve),je=ve.create,Ye=he.propertyIsEnumerable,Ge=fe.splice,vt=ke?ke.isConcatSpreadable:void 0,_t=ke?ke.iterator:void 0,Ut=ke?ke.toStringTag:void 0,Gt=function(){try{var e=Za(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kt=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,Qt=se&&se.now!==We.Date.now&&se.now,Xt=t.setTimeout!==We.setTimeout&&t.setTimeout,Zt=me.ceil,$t=me.floor,Jt=ve.getOwnPropertySymbols,en=Le?Le.isBuffer:void 0,tn=t.isFinite,nn=fe.join,ln=kt(ve.keys,ve),an=me.max,on=me.min,rn=se.now,un=t.parseInt,sn=me.random,cn=fe.reverse,dn=Za(t,"DataView"),mn=Za(t,"Map"),vn=Za(t,"Promise"),pn=Za(t,"Set"),En=Za(t,"WeakMap"),gn=Za(ve,"create"),fn=En&&new En,hn={},yn=Ao(dn),Sn=Ao(mn),_n=Ao(vn),Cn=Ao(pn),bn=Ao(En),Tn=ke?ke.prototype:void 0,Dn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function An(e){if(ji(e)&&!Ri(e)&&!(e instanceof Ln)){if(e instanceof In)return e;if(_e.call(e,"__wrapped__"))return wo(e)}return new In(e)}var wn=function(){function e(){}return function(t){if(!qi(t))return{};if(je)return je(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function In(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function On(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function Fn(e){var t=this.__data__=new Rn(e);this.size=t.size}function kn(e,t){var n=Ri(e),l=!n&&Oi(e),a=!n&&!l&&ki(e),o=!n&&!l&&!a&&$i(e),i=n||l||a||o,r=i?Tt(e.length,Ee):[],u=r.length;for(var s in e)!t&&!_e.call(e,s)||i&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ao(s,u))||r.push(s);return r}function Bn(e){var t=e.length;return t?e[Pl(0,t-1)]:void 0}function Un(e,t){return Co(Ea(e),Kn(t,0,e.length))}function Hn(e){return Co(Ea(e))}function Vn(e,t,n){(void 0!==n&&!xi(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Wn(e,t,n){var l=e[t];_e.call(e,t)&&xi(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function qn(e,t){for(var n=e.length;n--;)if(xi(e[n][0],t))return n;return-1}function jn(e,t,n,l){return Jn(e,function(e,a,o){t(l,e,n(e),o)}),l}function zn(e,t){return e&&ga(t,Sr(t),e)}function Yn(e,t,n){"__proto__"==t&&Gt?Gt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Gn(e,t){for(var n=-1,l=t.length,a=Y(l),o=null==e;++n<l;)a[n]=o?void 0:Er(e,t[n]);return a}function Kn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Qn(e,t,n,l,a,i){var s,y=1&t,I=2&t,L=4&t;if(n&&(s=a?n(e,l,a,i):n(e)),void 0!==s)return s;if(!qi(e))return e;var O=Ri(e);if(O){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&_e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!y)return Ea(e,s)}else{var R=eo(e),P=R==c||R==d;if(ki(e))return sa(e,y);if(R==p||R==o||P&&!a){if(s=I||P?{}:no(e),!y)return I?function(e,t){return ga(e,Ja(e),t)}(e,function(e,t){return e&&ga(t,_r(t),e)}(s,e)):function(e,t){return ga(e,$a(e),t)}(e,zn(s,e))}else{if(!Fe[R])return a?e:{};s=function(e,t,n){var l=e.constructor;switch(t){case S:return ca(e);case r:case u:return new l(+e);case _:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case C:case b:case T:case D:case N:case A:case"[object Uint8ClampedArray]":case w:case x:return da(e,n);case m:return new l;case v:case f:return new l(e);case E:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case g:return new l;case h:return Dn?ve(Dn.call(e)):{}}}(e,R,y)}}i||(i=new Fn);var M=i.get(e);if(M)return M;i.set(e,s),Qi(e)?e.forEach(function(l){s.add(Qn(l,t,n,l,e,i))}):zi(e)&&e.forEach(function(l,a){s.set(a,Qn(l,t,n,a,e,i))});var F=O?void 0:(L?I?ja:qa:I?_r:Sr)(e);return nt(F||e,function(l,a){F&&(l=e[a=l]),Wn(s,a,Qn(l,t,n,a,e,i))}),s}function Xn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],o=e[a];if(void 0===o&&!(a in e)||!(0,t[a])(o))return!1}return!0}function Zn(e,t,l){if("function"!=typeof e)throw new ge(n);return ho(function(){e.apply(void 0,l)},t)}function $n(e,t,n,l){var a=-1,o=it,i=!0,r=e.length,u=[],s=t.length;if(!r)return u;n&&(t=ut(t,Nt(n))),l?(o=rt,i=!1):t.length>=200&&(o=wt,i=!1,t=new Mn(t));e:for(;++a<r;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,i&&d==d){for(var m=s;m--;)if(t[m]===d)continue e;u.push(c)}else o(t,d,l)||u.push(c)}return u}An.templateSettings={escape:k,evaluate:B,interpolate:U,variable:"",imports:{_:An}},(An.prototype=xn.prototype).constructor=An,(In.prototype=wn(xn.prototype)).constructor=In,(Ln.prototype=wn(xn.prototype)).constructor=Ln,On.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},On.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},On.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return _e.call(t,e)?t[e]:void 0},On.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:_e.call(t,e)},On.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=qn(t,e);return!(n<0||(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,0))},Rn.prototype.get=function(e){var t=this.__data__,n=qn(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return qn(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,l=qn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new On,map:new(mn||Rn),string:new On}},Pn.prototype.delete=function(e){var t=Qa(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return Qa(this,e).get(e)},Pn.prototype.has=function(e){return Qa(this,e).has(e)},Pn.prototype.set=function(e,t){var n=Qa(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Mn.prototype.add=Mn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Mn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new Rn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(l)}return n.set(e,t),this.size=n.size,this};var Jn=ya(rl),el=ya(ul,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,a){return n=!!t(e,l,a)}),n}function nl(e,t,n){for(var l=-1,a=e.length;++l<a;){var o=e[l],i=t(o);if(null!=i&&(void 0===r?i==i&&!Zi(i):n(i,r)))var r=i,u=o}return u}function ll(e,t){var n=[];return Jn(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function al(e,t,n,l,a){var o=-1,i=e.length;for(n||(n=lo),a||(a=[]);++o<i;){var r=e[o];t>0&&n(r)?t>1?al(r,t-1,n,l,a):st(a,r):l||(a[a.length]=r)}return a}var ol=Sa(),il=Sa(!0);function rl(e,t){return e&&ol(e,t,Sr)}function ul(e,t){return e&&il(e,t,Sr)}function sl(e,t){return ot(t,function(t){return Hi(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return Ri(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ut&&Ut in ve(e)?function(e){var t=_e.call(e,Ut),n=e[Ut];try{e[Ut]=void 0;var l=!0}catch(e){}var a=Te.call(e);return l&&(t?e[Ut]=n:delete e[Ut]),a}(e):function(e){return Te.call(e)}(e)}function vl(e,t){return e>t}function pl(e,t){return null!=e&&_e.call(e,t)}function El(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?rt:it,a=e[0].length,o=e.length,i=o,r=Y(o),u=Infinity,s=[];i--;){var c=e[i];i&&t&&(c=ut(c,Nt(t))),u=on(c.length,u),r[i]=!n&&(t||a>=120&&c.length>=120)?new Mn(i&&c):void 0}c=e[0];var d=-1,m=r[0];e:for(;++d<a&&s.length<u;){var v=c[d],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?wt(m,p):l(s,p,n))){for(i=o;--i;){var E=r[i];if(!(E?wt(E,p):l(e[i],p,n)))continue e}m&&m.push(p),s.push(v)}}return s}function fl(e,t,n){var l=null==(e=po(e,t=oa(t,e)))?e:e[No(Uo(t))];return null==l?void 0:et(l,e,n)}function hl(e){return ji(e)&&ml(e)==o}function yl(e,t,n,l,a){return e===t||(null==e||null==t||!ji(e)&&!ji(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Ri(e),y=Ri(t),C=d?i:eo(e),b=y?i:eo(t),T=(C=C==o?p:C)==p,D=(b=b==o?p:b)==p,N=C==b;if(N&&ki(e)){if(!ki(t))return!1;d=!0,T=!1}if(N&&!T)return c||(c=new Fn),d||$i(e)?Va(e,t,n,l,a,c):function(e,t,n,l,a,o,i){switch(n){case _:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case r:case u:case v:return xi(+e,+t);case s:return e.name==t.name&&e.message==t.message;case E:case f:return e==t+"";case m:var c=Ft;case g:if(c||(c=Ht),e.size!=t.size&&!(1&l))return!1;var d=i.get(e);if(d)return d==t;l|=2,i.set(e,t);var p=Va(c(e),c(t),l,a,o,i);return i.delete(e),p;case h:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,C,n,l,a,c);if(!(1&n)){var A=T&&_e.call(e,"__wrapped__"),w=D&&_e.call(t,"__wrapped__");if(A||w){var x=A?e.value():e,I=w?t.value():t;return c||(c=new Fn),a(x,I,n,l,c)}}return!!N&&(c||(c=new Fn),function(e,t,n,l,a,o){var i=1&n,r=qa(e),u=r.length;if(u!=qa(t).length&&!i)return!1;for(var s=u;s--;){var c=r[s];if(!(i?c in t:_e.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var p=i;++s<u;){var E=e[c=r[s]],g=t[c];if(l)var f=i?l(g,E,c,t,e,o):l(E,g,c,e,t,o);if(!(void 0===f?E===g||a(E,g,n,l,o):f)){v=!1;break}p||(p="constructor"==c)}if(v&&!p){var h=e.constructor,y=t.constructor;h==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof y&&y instanceof y||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,a,c))}(e,t,n,l,yl,a))}function Sl(e,t,n,l){var a=n.length,o=a,i=!l;if(null==e)return!o;for(e=ve(e);a--;){var r=n[a];if(i&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<o;){var u=(r=n[a])[0],s=e[u],c=r[1];if(i&&r[2]){if(void 0===s&&!(u in e))return!1}else{var d=new Fn;if(l)var m=l(s,c,u,e,t,d);if(!(void 0===m?yl(c,s,3,l,d):m))return!1}}return!0}function _l(e){return!(!qi(e)||(t=e,be&&be in t))&&(Hi(e)?xe:le).test(Ao(e));var t}function Cl(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?Ri(e)?Al(e[0],e[1]):Nl(e):tu(e)}function bl(e){if(!so(e))return ln(e);var t=[];for(var n in ve(e))_e.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Tl(e,t){return e<t}function Dl(e,t){var n=-1,l=Mi(e)?Y(e.length):[];return Jn(e,function(e,a,o){l[++n]=t(e,a,o)}),l}function Nl(e){var t=Xa(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||Sl(n,e,t)}}function Al(e,t){return io(e)&&co(t)?mo(No(e),t):function(n){var l=Er(n,e);return void 0===l&&l===t?gr(n,e):yl(t,l,3)}}function wl(e,t,n,l,a){e!==t&&ol(t,function(o,i){if(a||(a=new Fn),qi(o))!function(e,t,n,l,a,o,i){var r=go(e,n),u=go(t,n),s=i.get(u);if(s)Vn(e,n,s);else{var c=o?o(r,u,n+"",e,t,i):void 0,d=void 0===c;if(d){var m=Ri(u),v=!m&&ki(u),p=!m&&!v&&$i(u);c=u,m||v||p?Ri(r)?c=r:Fi(r)?c=Ea(r):v?(d=!1,c=sa(u,!0)):p?(d=!1,c=da(u,!0)):c=[]:Gi(u)||Oi(u)?(c=r,Oi(r)?c=ir(r):qi(r)&&!Hi(r)||(c=no(u))):d=!1}d&&(i.set(u,c),a(c,u,l,o,i),i.delete(u)),Vn(e,n,c)}}(e,t,i,n,wl,l,a);else{var r=l?l(go(e,i),o,i+"",e,t,a):void 0;void 0===r&&(r=o),Vn(e,i,r)}},_r)}function xl(e,t){var n=e.length;if(n)return ao(t+=t<0?n:0,n)?e[t]:void 0}function Il(e,t,n){t=t.length?ut(t,function(e){return Ri(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yr];var l=-1;return t=ut(t,Nt(Ka())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,o=t.criteria,i=a.length,r=n.length;++l<i;){var u=ma(a[l],o[l]);if(u)return l>=r?u:u*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Dl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,o={};++l<a;){var i=t[l],r=cl(e,i);n(r,i)&&Ul(o,oa(i,e),r)}return o}function Ol(e,t,n,l){var a=l?ft:gt,o=-1,i=t.length,r=e;for(e===t&&(t=Ea(t)),n&&(r=ut(e,Nt(n)));++o<i;)for(var u=0,s=t[o],c=n?n(s):s;(u=a(r,c,u,l))>-1;)r!==e&&Ge.call(r,u,1),Ge.call(e,u,1);return e}function Rl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==o){var o=a;ao(a)?Ge.call(e,a,1):Zl(e,a)}}return e}function Pl(e,t){return e+$t(sn()*(t-e+1))}function Ml(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=$t(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return yo(vo(e,t,Yr),e+"")}function kl(e){return Bn(xr(e))}function Bl(e,t){var n=xr(e);return Co(n,Kn(t,0,n.length))}function Ul(e,t,n,l){if(!qi(e))return e;for(var a=-1,o=(t=oa(t,e)).length,i=o-1,r=e;null!=r&&++a<o;){var u=No(t[a]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=i){var c=r[u];void 0===(s=l?l(c,u,r):void 0)&&(s=qi(c)?c:ao(t[a+1])?[]:{})}Wn(r,u,s),r=r[u]}return e}var Hl=fn?function(e,t){return fn.set(e,t),e}:Yr,Vl=Gt?function(e,t){return Gt(e,"toString",{configurable:!0,enumerable:!1,value:qr(t),writable:!0})}:Yr;function Wl(e){return Co(xr(e))}function ql(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Y(a);++l<a;)o[l]=e[l+t];return o}function jl(e,t){var n;return Jn(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function zl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var o=l+a>>>1,i=e[o];null!==i&&!Zi(i)&&(n?i<=t:i<t)?l=o+1:a=o}return a}return Yl(e,t,Yr,n)}function Yl(e,t,n,l){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var i=(t=n(t))!=t,r=null===t,u=Zi(t),s=void 0===t;a<o;){var c=$t((a+o)/2),d=n(e[c]),m=void 0!==d,v=null===d,p=d==d,E=Zi(d);if(i)var g=l||p;else g=s?p&&(l||m):r?p&&m&&(l||!v):u?p&&m&&!v&&(l||!E):!v&&!E&&(l?d<=t:d<t);g?a=c+1:o=c}return on(o,4294967294)}function Gl(e,t){for(var n=-1,l=e.length,a=0,o=[];++n<l;){var i=e[n],r=t?t(i):i;if(!n||!xi(r,u)){var u=r;o[a++]=0===i?0:i}}return o}function Kl(e){return"number"==typeof e?e:Zi(e)?NaN:+e}function Ql(e){if("string"==typeof e)return e;if(Ri(e))return ut(e,Ql)+"";if(Zi(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xl(e,t,n){var l=-1,a=it,o=e.length,i=!0,r=[],u=r;if(n)i=!1,a=rt;else if(o>=200){var s=t?null:Ma(e);if(s)return Ht(s);i=!1,a=wt,u=new Mn}else u=t?[]:r;e:for(;++l<o;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,i&&d==d){for(var m=u.length;m--;)if(u[m]===d)continue e;t&&u.push(d),r.push(c)}else a(u,d,n)||(u!==r&&u.push(d),r.push(c))}return r}function Zl(e,t){return null==(e=po(e,t=oa(t,e)))||delete e[No(Uo(t))]}function $l(e,t,n,l){return Ul(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,o=l?a:-1;(l?o--:++o<a)&&t(e[o],o,e););return n?ql(e,l?0:o,l?o+1:a):ql(e,l?o+1:0,l?a:o)}function ea(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},n)}function ta(e,t,n){var l=e.length;if(l<2)return l?Xl(e[0]):[];for(var a=-1,o=Y(l);++a<l;)for(var i=e[a],r=-1;++r<l;)r!=a&&(o[a]=$n(o[a]||i,e[r],t,n));return Xl(al(o,1),t,n)}function na(e,t,n){for(var l=-1,a=e.length,o=t.length,i={};++l<a;)n(i,e[l],l<o?t[l]:void 0);return i}function la(e){return Fi(e)?e:[]}function aa(e){return"function"==typeof e?e:Yr}function oa(e,t){return Ri(e)?e:io(e,t)?[e]:Do(rr(e))}var ia=Fl;function ra(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:ql(e,t,n)}var ua=Kt||function(e){return We.clearTimeout(e)};function sa(e,t){if(t)return e.slice();var n=e.length,l=Ve?Ve(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function da(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ma(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,o=Zi(e),i=void 0!==t,r=null===t,u=t==t,s=Zi(t);if(!r&&!s&&!o&&e>t||o&&i&&u&&!r&&!s||l&&i&&u||!n&&u||!a)return 1;if(!l&&!o&&!s&&e<t||s&&n&&a&&!l&&!o||r&&n&&a||!i&&a||!u)return-1}return 0}function va(e,t,n,l){for(var a=-1,o=e.length,i=n.length,r=-1,u=t.length,s=an(o-i,0),c=Y(u+s),d=!l;++r<u;)c[r]=t[r];for(;++a<i;)(d||a<o)&&(c[n[a]]=e[a]);for(;s--;)c[r++]=e[a++];return c}function pa(e,t,n,l){for(var a=-1,o=e.length,i=-1,r=n.length,u=-1,s=t.length,c=an(o-r,0),d=Y(c+s),m=!l;++a<c;)d[a]=e[a];for(var v=a;++u<s;)d[v+u]=t[u];for(;++i<r;)(m||a<o)&&(d[v+n[i]]=e[a++]);return d}function Ea(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?Yn(n,r,u):Wn(n,r,u)}return n}function fa(e,t){return function(n,l){var a=Ri(n)?tt:jn,o=t?t():{};return a(n,e,Ka(l,2),o)}}function ha(e){return Fl(function(t,n){var l=-1,a=n.length,o=a>1?n[a-1]:void 0,i=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&oo(n[0],n[1],i)&&(o=a<3?void 0:o,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,o)}return t})}function ya(e,t){return function(n,l){if(null==n)return n;if(!Mi(n))return e(n,l);for(var a=n.length,o=t?a:-1,i=ve(n);(t?o--:++o<a)&&!1!==l(i[o],o,i););return n}}function Sa(e){return function(t,n,l){for(var a=-1,o=ve(t),i=l(t),r=i.length;r--;){var u=i[e?r:++a];if(!1===n(o[u],u,o))break}return t}}function _a(e){return function(t){var n=Mt(t=rr(t))?qt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ra(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(Hr(Or(t).replace(Ae,"")),e,"")}}function ba(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=wn(e.prototype),l=e.apply(n,t);return qi(l)?l:n}}function Ta(e){return function(t,n,l){var a=ve(t);if(!Mi(t)){var o=Ka(n,3);t=Sr(t),n=function(e){return o(a[e],e,a)}}var i=e(t,n,l);return i>-1?a[o?t[i]:i]:void 0}}function Da(e){return Wa(function(t){var l=t.length,a=l,o=In.prototype.thru;for(e&&t.reverse();a--;){var i=t[a];if("function"!=typeof i)throw new ge(n);if(o&&!r&&"wrapper"==Ya(i))var r=new In([],!0)}for(a=r?a:l;++a<l;){var u=Ya(i=t[a]),s="wrapper"==u?za(i):void 0;r=s&&ro(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?r[Ya(s[0])].apply(r,s[3]):1==i.length&&ro(i)?r[u]():r.thru(i)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&Ri(n))return r.plant(n).value();for(var a=0,o=l?t[a].apply(this,e):n;++a<l;)o=t[a].call(this,o);return o}})}function Na(e,t,n,l,a,o,i,r,u,s){var c=128&t,d=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:ba(e);return function g(){for(var f=arguments.length,h=Y(f),y=f;y--;)h[y]=arguments[y];if(v)var S=Ga(g),_=Lt(h,S);if(l&&(h=va(h,l,a,v)),o&&(h=pa(h,o,i,v)),f-=_,v&&f<s){var C=Bt(h,S);return Ra(e,t,Na,g.placeholder,n,h,C,r,u,s-f)}var b=d?n:this,T=m?b[e]:e;return f=h.length,r?h=Eo(h,r):p&&f>1&&h.reverse(),c&&u<f&&(h.length=u),this&&this!==We&&this instanceof g&&(T=E||ba(T)),T.apply(b,h)}}function Aa(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,a,o){t(l,n(e),a,o)}),l}(n,e,t(l),{})}}function wa(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Ql(n),l=Ql(l)):(n=Kl(n),l=Kl(l)),a=e(n,l)}return a}}function xa(e){return Wa(function(t){return t=ut(t,Nt(Ka())),Fl(function(n){var l=this;return e(t,function(e){return et(e,l,n)})})})}function Ia(e,t){var n=(t=void 0===t?" ":Ql(t)).length;if(n<2)return n?Ml(t,e):t;var l=Ml(t,Zt(e/Wt(t)));return Mt(t)?ra(qt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n,l){for(var a=-1,o=an(Zt((t-e)/(n||1)),0),i=Y(o);o--;)i[l?o:++a]=e,e+=n;return i}(t,n,l=void 0===l?t<n?1:-1:nr(l),e)}}function Oa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function Ra(e,t,n,l,a,o,i,r,u,s){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?o:void 0,c?i:void 0,c?void 0:o,c?void 0:i,r,u,s],m=n.apply(void 0,d);return ro(e)&&fo(m,d),m.placeholder=l,So(m,e,t)}function Pa(e){var t=me[e];return function(e,n){if(e=or(e),(n=null==n?0:on(lr(n),292))&&tn(e)){var l=(rr(e)+"e").split("e");return+((l=(rr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Ma=pn&&1/Ht(new pn([,-0]))[1]==1/0?function(e){return new pn(e)}:Zr;function Fa(e){return function(t){var n=eo(t);return n==m?Ft(t):n==g?Vt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,o,i,r,u,s){var c=2&t;if(!c&&"function"!=typeof e)throw new ge(n);var d=o?o.length:0;if(d||(t&=-97,o=i=void 0),u=void 0===u?u:an(lr(u),0),s=void 0===s?s:lr(s),d-=i?i.length:0,64&t){var m=o,v=i;o=i=void 0}var p=c?void 0:za(e),E=[e,t,a,o,i,m,v,r,u,s];if(p&&function(e,t){var n=e[1],a=t[1],o=n|a;if(!(o<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],o|=1&n?0:4);var i=t[3];if(i){var r=e[3];e[3]=r?va(r,i,t[4]):i,e[4]=r?Bt(e[3],l):t[4]}(i=t[5])&&(e[5]=(r=e[5])?pa(r,i,t[6]):i,e[6]=r?Bt(e[5],l):t[6]),(i=t[7])&&(e[7]=i),128&a&&(e[8]=null==e[8]?t[8]:on(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(E,p),e=E[0],t=E[1],a=E[2],o=E[3],i=E[4],!(s=E[9]=void 0===E[9]?c?0:e.length:an(E[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)g=8==t||16==t?function(e,t,n){var l=ba(e);return function a(){for(var o=arguments.length,i=Y(o),r=o,u=Ga(a);r--;)i[r]=arguments[r];var s=o<3&&i[0]!==u&&i[o-1]!==u?[]:Bt(i,u);if((o-=s.length)<n)return Ra(e,t,Na,a.placeholder,void 0,i,s,void 0,void 0,n-o);var c=this&&this!==We&&this instanceof a?l:e;return et(c,this,i)}}(e,t,s):32!=t&&33!=t||i.length?Na.apply(void 0,E):function(e,t,n,l){var a=1&t,o=ba(e);return function t(){for(var i=-1,r=arguments.length,u=-1,s=l.length,c=Y(s+r),d=this&&this!==We&&this instanceof t?o:e;++u<s;)c[u]=l[u];for(;r--;)c[u++]=arguments[++i];return et(d,a?n:this,c)}}(e,t,a,o);else var g=function(e,t,n){var l=1&t,a=ba(e);return function t(){var o=this&&this!==We&&this instanceof t?a:e;return o.apply(l?n:this,arguments)}}(e,t,a);return So((p?Hl:fo)(g,E),e,t)}function Ba(e,t,n,l){return void 0===e||xi(e,he[n])&&!_e.call(l,n)?t:e}function Ua(e,t,n,l,a,o){return qi(e)&&qi(t)&&(o.set(t,e),wl(e,t,void 0,Ua,o),o.delete(t)),e}function Ha(e){return Gi(e)?void 0:e}function Va(e,t,n,l,a,o){var i=1&n,r=e.length,u=t.length;if(r!=u&&!(i&&u>r))return!1;var s=o.get(e),c=o.get(t);if(s&&c)return s==t&&c==e;var d=-1,m=!0,v=2&n?new Mn:void 0;for(o.set(e,t),o.set(t,e);++d<r;){var p=e[d],E=t[d];if(l)var g=i?l(E,p,d,t,e,o):l(p,E,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(v){if(!mt(t,function(e,t){if(!wt(v,t)&&(p===e||a(p,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(p!==E&&!a(p,E,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function Wa(e){return yo(vo(e,void 0,Po),e+"")}function qa(e){return dl(e,Sr,$a)}function ja(e){return dl(e,_r,Ja)}var za=fn?function(e){return fn.get(e)}:Zr;function Ya(e){for(var t=e.name+"",n=hn[t],l=_e.call(hn,t)?n.length:0;l--;){var a=n[l],o=a.func;if(null==o||o==e)return a.name}return t}function Ga(e){return(_e.call(An,"placeholder")?An:e).placeholder}function Ka(){var e=An.iteratee||Gr;return e=e===Gr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Qa(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Xa(e){for(var t=Sr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,co(a)]}return t}function Za(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return _l(n)?n:void 0}var $a=Jt?function(e){return null==e?[]:(e=ve(e),ot(Jt(e),function(t){return Ye.call(e,t)}))}:au,Ja=Jt?function(e){for(var t=[];e;)st(t,$a(e)),e=qe(e);return t}:au,eo=ml;function to(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,o=!1;++l<a;){var i=No(t[l]);if(!(o=null!=e&&n(e,i)))break;e=e[i]}return o||++l!=a?o:!!(a=null==e?0:e.length)&&Wi(a)&&ao(i,a)&&(Ri(e)||Oi(e))}function no(e){return"function"!=typeof e.constructor||so(e)?{}:wn(qe(e))}function lo(e){return Ri(e)||Oi(e)||!!(vt&&e&&e[vt])}function ao(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oo(e,t,n){if(!qi(n))return!1;var l=typeof t;return!!("number"==l?Mi(n)&&ao(t,n.length):"string"==l&&t in n)&&xi(n[t],e)}function io(e,t){if(Ri(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Zi(e))||V.test(e)||!H.test(e)||null!=t&&e in ve(t)}function ro(e){var t=Ya(e),n=An[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=za(n);return!!l&&e===l[0]}(dn&&eo(new dn(new ArrayBuffer(1)))!=_||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||pn&&eo(new pn)!=g||En&&eo(new En)!=y)&&(eo=function(e){var t=ml(e),n=t==p?e.constructor:void 0,l=n?Ao(n):"";if(l)switch(l){case yn:return _;case Sn:return m;case _n:return"[object Promise]";case Cn:return g;case bn:return y}return t});var uo=ye?Hi:ou;function so(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function co(e){return e==e&&!qi(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,o=an(l.length-t,0),i=Y(o);++a<o;)i[a]=l[t+a];a=-1;for(var r=Y(t+1);++a<t;)r[a]=l[a];return r[t]=n(i),et(e,this,r)}}function po(e,t){return t.length<2?e:cl(e,ql(t,0,-1))}function Eo(e,t){for(var n=e.length,l=on(t.length,n),a=Ea(e);l--;){var o=t[l];e[l]=ao(o,n)?a[o]:void 0}return e}function go(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fo=_o(Hl),ho=Xt||function(e,t){return We.setTimeout(e,t)},yo=_o(Vl);function So(e,t,n){var l=t+"";return yo(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(G,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return nt(a,function(n){var l="_."+n[0];t&n[1]&&!it(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match(K);return t?t[1].split(Q):[]}(l),n)))}function _o(e){var t=0,n=0;return function(){var l=rn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Co(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var o=Pl(n,a),i=e[o];e[o]=e[n],e[n]=i}return e.length=t,e}var bo,To,Do=(bo=bi(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,n,l,a){t.push(l?a.replace($,"$1"):n||e)}),t},function(e){return 500===To.size&&To.clear(),e}),To=bo.cache,bo);function No(e){if("string"==typeof e||Zi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ao(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function wo(e){if(e instanceof Ln)return e.clone();var t=new In(e.__wrapped__,e.__chain__);return t.__actions__=Ea(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var xo=Fl(function(e,t){return Fi(e)?$n(e,al(t,1,Fi,!0)):[]}),Io=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),Ka(n,2)):[]}),Lo=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),void 0,n):[]});function Oo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),Et(e,Ka(t,3),a)}function Ro(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=lr(n),a=n<0?an(l+a,0):on(a,l-1)),Et(e,Ka(t,3),a,!0)}function Po(e){return null!=e&&e.length?al(e,1):[]}function Mo(e){return e&&e.length?e[0]:void 0}var Fo=Fl(function(e){var t=ut(e,la);return t.length&&t[0]===e[0]?gl(t):[]}),ko=Fl(function(e){var t=Uo(e),n=ut(e,la);return t===Uo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,Ka(t,2)):[]}),Bo=Fl(function(e){var t=Uo(e),n=ut(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Uo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ho=Fl(Vo);function Vo(e,t){return e&&e.length&&t&&t.length?Ol(e,t):e}var Wo=Wa(function(e,t){var n=null==e?0:e.length,l=Gn(e,t);return Rl(e,ut(t,function(e){return ao(e,n)?+e:e}).sort(ma)),l});function qo(e){return null==e?e:cn.call(e)}var jo=Fl(function(e){return Xl(al(e,1,Fi,!0))}),zo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),Xl(al(e,1,Fi,!0),Ka(t,2))}),Yo=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,Xl(al(e,1,Fi,!0),void 0,t)});function Go(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Fi(e))return t=an(e.length,t),!0}),Tt(t,function(t){return ut(e,St(t))})}function Ko(e,t){if(!e||!e.length)return[];var n=Go(e);return null==t?n:ut(n,function(e){return et(t,void 0,e)})}var Qo=Fl(function(e,t){return Fi(e)?$n(e,t):[]}),Xo=Fl(function(e){return ta(ot(e,Fi))}),Zo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),ta(ot(e,Fi),Ka(t,2))}),$o=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,ta(ot(e,Fi),void 0,t)}),Jo=Fl(Go),ei=Fl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Ko(e,n)});function ti(e){var t=An(e);return t.__chain__=!0,t}function ni(e,t){return t(e)}var li=Wa(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return Gn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&ao(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:ni,args:[a],thisArg:void 0}),new In(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ai=fa(function(e,t,n){_e.call(e,n)?++e[n]:Yn(e,n,1)}),oi=Ta(Oo),ii=Ta(Ro);function ri(e,t){return(Ri(e)?nt:Jn)(e,Ka(t,3))}function ui(e,t){return(Ri(e)?lt:el)(e,Ka(t,3))}var si=fa(function(e,t,n){_e.call(e,n)?e[n].push(t):Yn(e,n,[t])}),ci=Fl(function(e,t,n){var l=-1,a="function"==typeof t,o=Mi(e)?Y(e.length):[];return Jn(e,function(e){o[++l]=a?et(t,e,n):fl(e,t,n)}),o}),di=fa(function(e,t,n){Yn(e,n,t)});function mi(e,t){return(Ri(e)?ut:Dl)(e,Ka(t,3))}var vi=fa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),pi=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),Il(e,al(t,1),[])}),Ei=Qt||function(){return We.Date.now()};function gi(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function fi(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=lr(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var hi=Fl(function(e,t,n){var l=1;if(n.length){var a=Bt(n,Ga(hi));l|=32}return ka(e,l,t,n,a)}),yi=Fl(function(e,t,n){var l=3;if(n.length){var a=Bt(n,Ga(yi));l|=32}return ka(t,l,e,n,a)});function Si(e,t,l){var a,o,i,r,u,s,c=0,d=!1,m=!1,v=!0;if("function"!=typeof e)throw new ge(n);function p(t){var n=a,l=o;return a=o=void 0,c=t,r=e.apply(l,n)}function E(e){return c=e,u=ho(f,t),d?p(e):r}function g(e){var n=e-s;return void 0===s||n>=t||n<0||m&&e-c>=i}function f(){var e=Ei();if(g(e))return h(e);u=ho(f,function(e){var n=t-(e-s);return m?on(n,i-(e-c)):n}(e))}function h(e){return u=void 0,v&&a?p(e):(a=o=void 0,r)}function y(){var e=Ei(),n=g(e);if(a=arguments,o=this,s=e,n){if(void 0===u)return E(s);if(m)return ua(u),u=ho(f,t),p(s)}return void 0===u&&(u=ho(f,t)),r}return t=or(t)||0,qi(l)&&(d=!!l.leading,i=(m="maxWait"in l)?an(or(l.maxWait)||0,t):i,v="trailing"in l?!!l.trailing:v),y.cancel=function(){void 0!==u&&ua(u),c=0,a=s=o=u=void 0},y.flush=function(){return void 0===u?r:h(Ei())},y}var _i=Fl(function(e,t){return Zn(e,1,t)}),Ci=Fl(function(e,t,n){return Zn(e,or(t)||0,n)});function bi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=l.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return l.cache=o.set(a,i)||o,i};return l.cache=new(bi.Cache||Pn),l}function Ti(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}bi.Cache=Pn;var Di=ia(function(e,t){var n=(t=1==t.length&&Ri(t[0])?ut(t[0],Nt(Ka())):ut(al(t,1),Nt(Ka()))).length;return Fl(function(l){for(var a=-1,o=on(l.length,n);++a<o;)l[a]=t[a].call(this,l[a]);return et(e,this,l)})}),Ni=Fl(function(e,t){return ka(e,32,void 0,t,Bt(t,Ga(Ni)))}),Ai=Fl(function(e,t){return ka(e,64,void 0,t,Bt(t,Ga(Ai)))}),wi=Wa(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function xi(e,t){return e===t||e!=e&&t!=t}var Ii=Oa(vl),Li=Oa(function(e,t){return e>=t}),Oi=hl(function(){return arguments}())?hl:function(e){return ji(e)&&_e.call(e,"callee")&&!Ye.call(e,"callee")},Ri=Y.isArray,Pi=Ke?Nt(Ke):function(e){return ji(e)&&ml(e)==S};function Mi(e){return null!=e&&Wi(e.length)&&!Hi(e)}function Fi(e){return ji(e)&&Mi(e)}var ki=en||ou,Bi=Qe?Nt(Qe):function(e){return ji(e)&&ml(e)==u};function Ui(e){if(!ji(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Gi(e)}function Hi(e){if(!qi(e))return!1;var t=ml(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Vi(e){return"number"==typeof e&&e==lr(e)}function Wi(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function qi(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ji(e){return null!=e&&"object"==typeof e}var zi=Xe?Nt(Xe):function(e){return ji(e)&&eo(e)==m};function Yi(e){return"number"==typeof e||ji(e)&&ml(e)==v}function Gi(e){if(!ji(e)||ml(e)!=p)return!1;var t=qe(e);if(null===t)return!0;var n=_e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==De}var Ki=Ze?Nt(Ze):function(e){return ji(e)&&ml(e)==E},Qi=$e?Nt($e):function(e){return ji(e)&&eo(e)==g};function Xi(e){return"string"==typeof e||!Ri(e)&&ji(e)&&ml(e)==f}function Zi(e){return"symbol"==typeof e||ji(e)&&ml(e)==h}var $i=Je?Nt(Je):function(e){return ji(e)&&Wi(e.length)&&!!Me[ml(e)]},Ji=Oa(Tl),er=Oa(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Mi(e))return Xi(e)?qt(e):Ea(e);if(_t&&e[_t])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[_t]());var t=eo(e);return(t==m?Ft:t==g?Ht:xr)(e)}function nr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function lr(e){var t=nr(e),n=t%1;return t==t?n?t-n:t:0}function ar(e){return e?Kn(lr(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Zi(e))return NaN;if(qi(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=qi(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Dt(e);var n=ne.test(e);return n||ae.test(e)?Ue(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ir(e){return ga(e,_r(e))}function rr(e){return null==e?"":Ql(e)}var ur=ha(function(e,t){if(so(t)||Mi(t))ga(t,Sr(t),e);else for(var n in t)_e.call(t,n)&&Wn(e,n,t[n])}),sr=ha(function(e,t){ga(t,_r(t),e)}),cr=ha(function(e,t,n,l){ga(t,_r(t),e,l)}),dr=ha(function(e,t,n,l){ga(t,Sr(t),e,l)}),mr=Wa(Gn),vr=Fl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oo(t[0],t[1],a)&&(l=1);++n<l;)for(var o=t[n],i=_r(o),r=-1,u=i.length;++r<u;){var s=i[r],c=e[s];(void 0===c||xi(c,he[s])&&!_e.call(e,s))&&(e[s]=o[s])}return e}),pr=Fl(function(e){return e.push(void 0,Ua),et(br,void 0,e)});function Er(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&to(e,t,El)}var fr=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n},qr(Yr)),hr=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),_e.call(e,t)?e[t].push(n):e[t]=[n]},Ka),yr=Fl(fl);function Sr(e){return Mi(e)?kn(e):bl(e)}function _r(e){return Mi(e)?kn(e,!0):function(e){if(!qi(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=so(e),n=[];for(var l in e)("constructor"!=l||!t&&_e.call(e,l))&&n.push(l);return n}(e)}var Cr=ha(function(e,t,n){wl(e,t,n)}),br=ha(function(e,t,n,l){wl(e,t,n,l)}),Tr=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,ja(e),n),l&&(n=Qn(n,7,Ha));for(var a=t.length;a--;)Zl(n,t[a]);return n}),Dr=Wa(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(ja(e),function(e){return[e]});return t=Ka(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Ar=Fa(Sr),wr=Fa(_r);function xr(e){return null==e?[]:At(e,Sr(e))}var Ir=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Ur(rr(e).toLowerCase())}function Or(e){return(e=rr(e))&&e.replace(ie,Ot).replace(we,"")}var Rr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Pr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Mr=_a("toLowerCase"),Fr=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Ca(function(e,t,n){return e+(n?" ":"")+Ur(t)}),Br=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ur=_a("toUpperCase");function Hr(e,t,n){return e=rr(e),void 0===(t=n?void 0:t)?function(e){return Oe.test(e)}(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Vr=Fl(function(e,t){try{return et(e,void 0,t)}catch(e){return Ui(e)?e:new ce(e)}}),Wr=Wa(function(e,t){return nt(t,function(t){t=No(t),Yn(e,t,hi(e[t],e))}),e});function qr(e){return function(){return e}}var jr=Da(),zr=Da(!0);function Yr(e){return e}function Gr(e){return Cl("function"==typeof e?e:Qn(e,1))}var Kr=Fl(function(e,t){return function(n){return fl(n,e,t)}}),Qr=Fl(function(e,t){return function(n){return fl(e,n,t)}});function Xr(e,t,n){var l=Sr(t),a=sl(t,l);null!=n||qi(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=sl(t,Sr(t)));var o=!(qi(n)&&"chain"in n&&!n.chain),i=Hi(e);return nt(a,function(n){var l=t[n];e[n]=l,i&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),a=n.__actions__=Ea(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,st([this.value()],arguments))})}),e}function Zr(){}var $r=xa(ut),Jr=xa(at),eu=xa(mt);function tu(e){return io(e)?St(No(e)):function(e){return function(t){return cl(t,e)}}(e)}var nu=La(),lu=La(!0);function au(){return[]}function ou(){return!1}var iu,ru=wa(function(e,t){return e+t},0),uu=Pa("ceil"),su=wa(function(e,t){return e/t},1),cu=Pa("floor"),du=wa(function(e,t){return e*t},1),mu=Pa("round"),vu=wa(function(e,t){return e-t},0);return An.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=lr(e),function(){if(--e<1)return t.apply(this,arguments)}},An.ary=gi,An.assign=ur,An.assignIn=sr,An.assignInWith=cr,An.assignWith=dr,An.at=mr,An.before=fi,An.bind=hi,An.bindAll=Wr,An.bindKey=yi,An.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ri(e)?e:[e]},An.chain=ti,An.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:an(lr(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,o=0,i=Y(Zt(l/t));a<l;)i[o++]=ql(e,a,a+=t);return i},An.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var o=e[t];o&&(a[l++]=o)}return a},An.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(Ri(n)?Ea(n):[n],al(t,1))},An.cond=function(e){var t=null==e?0:e.length,l=Ka();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Fl(function(n){for(var l=-1;++l<t;){var a=e[l];if(et(a[0],this,n))return et(a[1],this,n)}})},An.conforms=function(e){return function(e){var t=Sr(e);return function(n){return Xn(n,e,t)}}(Qn(e,1))},An.constant=qr,An.countBy=ai,An.create=function(e,t){var n=wn(e);return null==t?n:zn(n,t)},An.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.debounce=Si,An.defaults=vr,An.defaultsDeep=pr,An.defer=_i,An.delay=Ci,An.difference=xo,An.differenceBy=Io,An.differenceWith=Lo,An.drop=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,(t=n||void 0===t?1:lr(t))<0?0:t,l):[]},An.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,0,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t):[]},An.dropRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0,!0):[]},An.dropWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0):[]},An.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=lr(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:lr(l))<0&&(l+=a),l=n>l?0:ar(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},An.filter=function(e,t){return(Ri(e)?ot:ll)(e,Ka(t,3))},An.flatMap=function(e,t){return al(mi(e,t),1)},An.flatMapDeep=function(e,t){return al(mi(e,t),1/0)},An.flatMapDepth=function(e,t,n){return n=void 0===n?1:lr(n),al(mi(e,t),n)},An.flatten=Po,An.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},An.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:lr(t)):[]},An.flip=function(e){return ka(e,512)},An.flow=jr,An.flowRight=zr,An.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},An.functions=function(e){return null==e?[]:sl(e,Sr(e))},An.functionsIn=function(e){return null==e?[]:sl(e,_r(e))},An.groupBy=si,An.initial=function(e){return null!=e&&e.length?ql(e,0,-1):[]},An.intersection=Fo,An.intersectionBy=ko,An.intersectionWith=Bo,An.invert=fr,An.invertBy=hr,An.invokeMap=ci,An.iteratee=Gr,An.keyBy=di,An.keys=Sr,An.keysIn=_r,An.map=mi,An.mapKeys=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},An.mapValues=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},An.matches=function(e){return Nl(Qn(e,1))},An.matchesProperty=function(e,t){return Al(e,Qn(t,1))},An.memoize=bi,An.merge=Cr,An.mergeWith=br,An.method=Kr,An.methodOf=Qr,An.mixin=Xr,An.negate=Ti,An.nthArg=function(e){return e=lr(e),Fl(function(t){return xl(t,e)})},An.omit=Tr,An.omitBy=function(e,t){return Nr(e,Ti(Ka(t)))},An.once=function(e){return fi(2,e)},An.orderBy=function(e,t,n,l){return null==e?[]:(Ri(t)||(t=null==t?[]:[t]),Ri(n=l?void 0:n)||(n=null==n?[]:[n]),Il(e,t,n))},An.over=$r,An.overArgs=Di,An.overEvery=Jr,An.overSome=eu,An.partial=Ni,An.partialRight=Ai,An.partition=vi,An.pick=Dr,An.pickBy=Nr,An.property=tu,An.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},An.pull=Ho,An.pullAll=Vo,An.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ol(e,t,Ka(n,2)):e},An.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ol(e,t,void 0,n):e},An.pullAt=Wo,An.range=nu,An.rangeRight=lu,An.rearg=wi,An.reject=function(e,t){return(Ri(e)?ot:ll)(e,Ti(Ka(t,3)))},An.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],o=e.length;for(t=Ka(t,3);++l<o;){var i=e[l];t(i,l,e)&&(n.push(i),a.push(l))}return Rl(e,a),n},An.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Fl(e,t=void 0===t?t:lr(t))},An.reverse=qo,An.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),(Ri(e)?Un:Bl)(e,t)},An.set=function(e,t,n){return null==e?e:Ul(e,t,n)},An.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},An.shuffle=function(e){return(Ri(e)?Hn:Wl)(e)},An.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:lr(t),n=void 0===n?l:lr(n)),ql(e,t,n)):[]},An.sortBy=pi,An.sortedUniq=function(e){return e&&e.length?Gl(e):[]},An.sortedUniqBy=function(e,t){return e&&e.length?Gl(e,Ka(t,2)):[]},An.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!Ki(t))&&!(t=Ql(t))&&Mt(e)?ra(qt(e),0,n):e.split(t,n):[]},An.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:an(lr(t),0),Fl(function(n){var l=n[t],a=ra(n,0,t);return l&&st(a,l),et(e,this,a)})},An.tail=function(e){var t=null==e?0:e.length;return t?ql(e,1,t):[]},An.take=function(e,t,n){return e&&e.length?ql(e,0,(t=n||void 0===t?1:lr(t))<0?0:t):[]},An.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t,l):[]},An.takeRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!1,!0):[]},An.takeWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3)):[]},An.tap=function(e,t){return t(e),e},An.throttle=function(e,t,l){var a=!0,o=!0;if("function"!=typeof e)throw new ge(n);return qi(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),Si(e,t,{leading:a,maxWait:t,trailing:o})},An.thru=ni,An.toArray=tr,An.toPairs=Ar,An.toPairsIn=wr,An.toPath=function(e){return Ri(e)?ut(e,No):Zi(e)?[e]:Ea(Do(rr(e)))},An.toPlainObject=ir,An.transform=function(e,t,n){var l=Ri(e),a=l||ki(e)||$i(e);if(t=Ka(t,4),null==n){var o=e&&e.constructor;n=a?l?new o:[]:qi(e)&&Hi(o)?wn(qe(e)):{}}return(a?nt:rl)(e,function(e,l,a){return t(n,e,l,a)}),n},An.unary=function(e){return gi(e,1)},An.union=jo,An.unionBy=zo,An.unionWith=Yo,An.uniq=function(e){return e&&e.length?Xl(e):[]},An.uniqBy=function(e,t){return e&&e.length?Xl(e,Ka(t,2)):[]},An.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xl(e,void 0,t):[]},An.unset=function(e,t){return null==e||Zl(e,t)},An.unzip=Go,An.unzipWith=Ko,An.update=function(e,t,n){return null==e?e:$l(e,t,aa(n))},An.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:$l(e,t,aa(n),l)},An.values=xr,An.valuesIn=function(e){return null==e?[]:At(e,_r(e))},An.without=Qo,An.words=Hr,An.wrap=function(e,t){return Ni(aa(t),e)},An.xor=Xo,An.xorBy=Zo,An.xorWith=$o,An.zip=Jo,An.zipObject=function(e,t){return na(e||[],t||[],Wn)},An.zipObjectDeep=function(e,t){return na(e||[],t||[],Ul)},An.zipWith=ei,An.entries=Ar,An.entriesIn=wr,An.extend=sr,An.extendWith=cr,Xr(An,An),An.add=ru,An.attempt=Vr,An.camelCase=Ir,An.capitalize=Lr,An.ceil=uu,An.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),Kn(or(e),t,n)},An.clone=function(e){return Qn(e,4)},An.cloneDeep=function(e){return Qn(e,5)},An.cloneDeepWith=function(e,t){return Qn(e,5,t="function"==typeof t?t:void 0)},An.cloneWith=function(e,t){return Qn(e,4,t="function"==typeof t?t:void 0)},An.conformsTo=function(e,t){return null==t||Xn(e,t,Sr(t))},An.deburr=Or,An.defaultTo=function(e,t){return null==e||e!=e?t:e},An.divide=su,An.endsWith=function(e,t,n){e=rr(e),t=Ql(t);var l=e.length,a=n=void 0===n?l:Kn(lr(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},An.eq=xi,An.escape=function(e){return(e=rr(e))&&F.test(e)?e.replace(P,Rt):e},An.escapeRegExp=function(e){return(e=rr(e))&&j.test(e)?e.replace(q,"\\$&"):e},An.every=function(e,t,n){var l=Ri(e)?at:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},An.find=oi,An.findIndex=Oo,An.findKey=function(e,t){return pt(e,Ka(t,3),rl)},An.findLast=ii,An.findLastIndex=Ro,An.findLastKey=function(e,t){return pt(e,Ka(t,3),ul)},An.floor=cu,An.forEach=ri,An.forEachRight=ui,An.forIn=function(e,t){return null==e?e:ol(e,Ka(t,3),_r)},An.forInRight=function(e,t){return null==e?e:il(e,Ka(t,3),_r)},An.forOwn=function(e,t){return e&&rl(e,Ka(t,3))},An.forOwnRight=function(e,t){return e&&ul(e,Ka(t,3))},An.get=Er,An.gt=Ii,An.gte=Li,An.has=function(e,t){return null!=e&&to(e,t,pl)},An.hasIn=gr,An.head=Mo,An.identity=Yr,An.includes=function(e,t,n,l){e=Mi(e)?e:xr(e),n=n&&!l?lr(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Xi(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&gt(e,t,n)>-1},An.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),gt(e,t,a)},An.inRange=function(e,t,n){return t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n){return e>=on(t,n)&&e<an(t,n)}(e=or(e),t,n)},An.invoke=yr,An.isArguments=Oi,An.isArray=Ri,An.isArrayBuffer=Pi,An.isArrayLike=Mi,An.isArrayLikeObject=Fi,An.isBoolean=function(e){return!0===e||!1===e||ji(e)&&ml(e)==r},An.isBuffer=ki,An.isDate=Bi,An.isElement=function(e){return ji(e)&&1===e.nodeType&&!Gi(e)},An.isEmpty=function(e){if(null==e)return!0;if(Mi(e)&&(Ri(e)||"string"==typeof e||"function"==typeof e.splice||ki(e)||$i(e)||Oi(e)))return!e.length;var t=eo(e);if(t==m||t==g)return!e.size;if(so(e))return!bl(e).length;for(var n in e)if(_e.call(e,n))return!1;return!0},An.isEqual=function(e,t){return yl(e,t)},An.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?yl(e,t,void 0,n):!!l},An.isError=Ui,An.isFinite=function(e){return"number"==typeof e&&tn(e)},An.isFunction=Hi,An.isInteger=Vi,An.isLength=Wi,An.isMap=zi,An.isMatch=function(e,t){return e===t||Sl(e,t,Xa(t))},An.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sl(e,t,Xa(t),n)},An.isNaN=function(e){return Yi(e)&&e!=+e},An.isNative=function(e){if(uo(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return _l(e)},An.isNil=function(e){return null==e},An.isNull=function(e){return null===e},An.isNumber=Yi,An.isObject=qi,An.isObjectLike=ji,An.isPlainObject=Gi,An.isRegExp=Ki,An.isSafeInteger=function(e){return Vi(e)&&e>=-9007199254740991&&e<=9007199254740991},An.isSet=Qi,An.isString=Xi,An.isSymbol=Zi,An.isTypedArray=$i,An.isUndefined=function(e){return void 0===e},An.isWeakMap=function(e){return ji(e)&&eo(e)==y},An.isWeakSet=function(e){return ji(e)&&"[object WeakSet]"==ml(e)},An.join=function(e,t){return null==e?"":nn.call(e,t)},An.kebabCase=Rr,An.last=Uo,An.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=lr(n))<0?an(l+a,0):on(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):Et(e,ht,a,!0)},An.lowerCase=Pr,An.lowerFirst=Mr,An.lt=Ji,An.lte=er,An.max=function(e){return e&&e.length?nl(e,Yr,vl):void 0},An.maxBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),vl):void 0},An.mean=function(e){return yt(e,Yr)},An.meanBy=function(e,t){return yt(e,Ka(t,2))},An.min=function(e){return e&&e.length?nl(e,Yr,Tl):void 0},An.minBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),Tl):void 0},An.stubArray=au,An.stubFalse=ou,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=du,An.nth=function(e,t){return e&&e.length?xl(e,lr(t)):void 0},An.noConflict=function(){return We._===this&&(We._=Ne),this},An.noop=Zr,An.now=Ei,An.pad=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return Ia($t(a),n)+e+Ia(Zt(a),n)},An.padEnd=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?e+Ia(t-l,n):e},An.padStart=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?Ia(t-l,n)+e:e},An.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(rr(e).replace(z,""),t||0)},An.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=nr(e),void 0===t?(t=e,e=0):t=nr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=sn();return on(e+a*(t-e+Be("1e-"+((a+"").length-1))),t)}return Pl(e,t)},An.reduce=function(e,t,n){var l=Ri(e)?ct:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,Jn)},An.reduceRight=function(e,t,n){var l=Ri(e)?dt:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,el)},An.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),Ml(rr(e),t)},An.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},An.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=a,o=n),e=Hi(o)?o.call(e):o}return e},An.round=mu,An.runInContext=e,An.sample=function(e){return(Ri(e)?Bn:kl)(e)},An.size=function(e){if(null==e)return 0;if(Mi(e))return Xi(e)?Wt(e):e.length;var t=eo(e);return t==m||t==g?e.size:bl(e).length},An.snakeCase=Fr,An.some=function(e,t,n){var l=Ri(e)?mt:jl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},An.sortedIndex=function(e,t){return zl(e,t)},An.sortedIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2))},An.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=zl(e,t);if(l<n&&xi(e[l],t))return l}return-1},An.sortedLastIndex=function(e,t){return zl(e,t,!0)},An.sortedLastIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2),!0)},An.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=zl(e,t,!0)-1;if(xi(e[n],t))return n}return-1},An.startCase=kr,An.startsWith=function(e,t,n){return e=rr(e),n=null==n?0:Kn(lr(n),0,e.length),t=Ql(t),e.slice(n,n+t.length)==t},An.subtract=vu,An.sum=function(e){return e&&e.length?bt(e,Yr):0},An.sumBy=function(e,t){return e&&e.length?bt(e,Ka(t,2)):0},An.template=function(e,t,n){var l=An.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=rr(e),t=cr({},t,l,Ba);var a,o,i=cr({},t.imports,l.imports,Ba),r=Sr(i),u=At(i,r),s=0,c=t.interpolate||re,d="__p += '",m=pe((t.escape||re).source+"|"+c.source+"|"+(c===U?J:re).source+"|"+(t.evaluate||re).source+"|$","g"),v="//# sourceURL="+(_e.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Pe+"]")+"\n";e.replace(m,function(t,n,l,i,r,u){return l||(l=i),d+=e.slice(s,u).replace(ue,Pt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(o=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),d+="';\n";var p=_e.call(t,"variable")&&t.variable;if(p){if(Z.test(p))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(I,""):d).replace(L,"$1").replace(O,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var E=Vr(function(){return de(r,v+"return "+d).apply(void 0,u)});if(E.source=d,Ui(E))throw E;return E},An.times=function(e,t){if((e=lr(e))<1||e>9007199254740991)return[];var n=4294967295,l=on(e,4294967295);e-=4294967295;for(var a=Tt(l,t=Ka(t));++n<e;)t(n);return a},An.toFinite=nr,An.toInteger=lr,An.toLength=ar,An.toLower=function(e){return rr(e).toLowerCase()},An.toNumber=or,An.toSafeInteger=function(e){return e?Kn(lr(e),-9007199254740991,9007199254740991):0===e?e:0},An.toString=rr,An.toUpper=function(e){return rr(e).toUpperCase()},An.trim=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return Dt(e);if(!e||!(t=Ql(t)))return e;var l=qt(e),a=qt(t);return ra(l,xt(l,a),It(l,a)+1).join("")},An.trimEnd=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.slice(0,jt(e)+1);if(!e||!(t=Ql(t)))return e;var l=qt(e);return ra(l,0,It(l,qt(t))+1).join("")},An.trimStart=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.replace(z,"");if(!e||!(t=Ql(t)))return e;var l=qt(e);return ra(l,xt(l,qt(t))).join("")},An.truncate=function(e,t){var n=30,l="...";if(qi(t)){var a="separator"in t?t.separator:a;n="length"in t?lr(t.length):n,l="omission"in t?Ql(t.omission):l}var o=(e=rr(e)).length;if(Mt(e)){var i=qt(e);o=i.length}if(n>=o)return e;var r=n-Wt(l);if(r<1)return l;var u=i?ra(i,0,r).join(""):e.slice(0,r);if(void 0===a)return u+l;if(i&&(r+=u.length-r),Ki(a)){if(e.slice(r).search(a)){var s,c=u;for(a.global||(a=pe(a.source,rr(ee.exec(a))+"g")),a.lastIndex=0;s=a.exec(c);)var d=s.index;u=u.slice(0,void 0===d?r:d)}}else if(e.indexOf(Ql(a),r)!=r){var m=u.lastIndexOf(a);m>-1&&(u=u.slice(0,m))}return u+l},An.unescape=function(e){return(e=rr(e))&&M.test(e)?e.replace(R,zt):e},An.uniqueId=function(e){var t=++Ce;return rr(e)+t},An.upperCase=Br,An.upperFirst=Ur,An.each=ri,An.eachRight=ui,An.first=Mo,Xr(An,(iu={},rl(An,function(e,t){_e.call(An.prototype,t)||(iu[t]=e)}),iu),{chain:!1}),An.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){An[e].placeholder=An}),nt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:an(lr(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=on(n,l.__takeCount__):l.__views__.push({size:on(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),nt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ka(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),nt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(Yr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return fl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Ti(Ka(e)))},Ln.prototype.slice=function(e,t){e=lr(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=lr(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},rl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=An[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);a&&(An.prototype[t]=function(){var t=this.__wrapped__,i=l?[1]:arguments,r=t instanceof Ln,u=i[0],s=r||Ri(t),c=function(e){var t=a.apply(An,st([e],i));return l&&d?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(r=s=!1);var d=this.__chain__,m=!!this.__actions__.length,v=o&&!d,p=r&&!m;if(!o&&s){t=p?t:new Ln(this);var E=e.apply(t,i);return E.__actions__.push({func:ni,args:[c],thisArg:void 0}),new In(E,d)}return v&&p?e.apply(this,i):(E=this.thru(c),v?l?E.value()[0]:E.value():E)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=fe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);An.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(Ri(a)?a:[],e)}return this[n](function(n){return t.apply(Ri(n)?n:[],e)})}}),rl(Ln.prototype,function(e,t){var n=An[t];if(n){var l=n.name+"";_e.call(hn,l)||(hn[l]=[]),hn[l].push({name:t,func:n})}}),hn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=Ea(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ea(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ea(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ri(e),l=t<0,a=n?e.length:0,o=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var o=n[l],i=o.size;switch(o.type){case"drop":e+=i;break;case"dropRight":t-=i;break;case"take":t=on(t,e+i);break;case"takeRight":e=an(e,t-i)}}return{start:e,end:t}}(0,a,this.__views__),i=o.start,r=o.end,u=r-i,s=l?r:i-1,c=this.__iteratees__,d=c.length,m=0,v=on(u,this.__takeCount__);if(!n||!l&&a==u&&v==u)return ea(e,this.__actions__);var p=[];e:for(;u--&&m<v;){for(var E=-1,g=e[s+=t];++E<d;){var f=c[E],h=f.type,y=(0,f.iteratee)(g);if(2==h)g=y;else if(!y){if(1==h)continue e;break e}}p[m++]=g}return p},An.prototype.at=li,An.prototype.chain=function(){return ti(this)},An.prototype.commit=function(){return new In(this.value(),this.__chain__)},An.prototype.next=function(){void 0===this.__values__&&(this.__values__=tr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=wo(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},An.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:ni,args:[qo],thisArg:void 0}),new In(t,this.__chain__)}return this.thru(qo)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,_t&&(An.prototype[_t]=function(){return this}),An}();je?((je.exports=Yt)._=Yt,qe._=Yt):We._=Yt}).call(Ut)});function sa(e){let{documents:n,svgStyles:o={},isSendBackFlow:i=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:s}=a.useTranslation(),c=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!c&&(null==n?void 0:n.map((e,a)=>{var o,c,d;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},s(null==n?void 0:n.title)),i?null!=n&&null!==(o=n.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),i?(null!==(c=value)&&void 0!==c&&null!==(d=c.documentType)&&void 0!==d&&d.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),c&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+s(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const ca=e=>{var t,a;let{t:o,formData:i,applicationData:r,docs:u,bpaActionsDetails:s}=e;const c=(null==r?void 0:r.status)||"",d=(null==s||null===(t=s.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,p]=n.useState((null==i||null===(a=i.documents)||void 0===a?void 0:a.documents)||[]),[E,g]=n.useState(null),[f,h]=n.useState([]),[y,S]=n.useState(!0),[_,C]=n.useState(!1),[b,T]=n.useState(!1),{isLoading:D,data:N}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:A,data:w}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var o,i;null!=N&&null!==(e=N.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==N||null===(o=N.BPA)||void 0===o||null===(i=o.DocTypeMapping)||void 0===i?void 0:i.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let s=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==w||null===(t=w["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;o===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),s.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(s)),h(s)},[!D,!A]),n.useEffect(()=>{let e=0;f.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),S("0"!=e&&0!=e||!(v.length>0))},[v,_]),n.useEffect(()=>{T("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[r,s]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==f?void 0:f.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(da,{key:t,index:t,document:e,t:o,error:E,setError:g,setDocuments:p,documents:v,setCheckRequiredFields:C,applicationStatus:c,actions:d,bpaTaxDocuments:f,checkEnablingDocs:b}))))};function da(e){var a,o;let{t:i,document:r,setDocuments:u,documents:s,index:c,bpaTaxDocuments:m,checkEnablingDocs:v}=e;const p=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[g,f]=n.useState(p?d({},p,{active:!0,code:null==p?void 0:p.documentType,i18nKey:null==p?void 0:p.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[h,y]=n.useState(null),[S,_]=n.useState(()=>(null==p?void 0:p.fileStoreId)||null),[C,b]=n.useState([]);return n.useEffect(()=>{null!=g&&g.code&&u(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==g?void 0:g.code));return 0===(null==S?void 0:S.length)||null===S?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==g?void 0:g.code,fileStoreId:S,documentUid:S,fileName:(null==h?void 0:h.name)||"",id:s?null===(t=s.find(e=>e.documentType===(null==g?void 0:g.code)))||void 0===t?void 0:t.id:void 0}]})},[S,g]),n.useEffect(()=>{try{C.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],C.map(e=>{var t,n,l;null!=g&&g.code&&r.newUploadedDocs.push({documentType:null==g?void 0:g.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),m[c]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(m)))}catch(e){Promise.reject(e)}},[C,g]),n.useEffect(()=>{},[h]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+i(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(sa,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),v?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?i(null==r?void 0:r.code)+"* ":""+i(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:i,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:g,optionKey:"i18nKey",select:e=>f(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);0!==Object.keys(n).length&&b(l),function(e){e&&y(e.file)}(l[l.length-1])})(0,e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function ma(e){let{fiReport:n,isCitizen:o=!1}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+i("BPA_FI_REPORT")),n.map((e,a)=>{var o,r,u,s,c,d;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+i("BPA_FI_REPORT"):i("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(o=e.date)||void 0===o?void 0:o.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(u=e.date)||void 0===u?void 0:u.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(s=e.questions)||void 0===s?void 0:s.length)&&(null==e||null===(c=e.questions)||void 0===c?void 0:c.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+i(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(sa,{documents:(d=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==d?void 0:d.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function va(e){let{t:a,document:o,setNocDocuments:i,setError:r,nocDocuments:u}=e;const s=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],c=Digit.ULBService.getStateId(),[d,m]=n.useState(),[p,E]=n.useState(null),[g,f]=n.useState(()=>(null==s?void 0:s.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&i(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==g?void 0:g.length)||null===g?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==g),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:g,documentUid:g,fileName:(null==p?void 0:p.name)||""}]})},[g]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[p]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);!function(e){e&&E(e.file)}(n[n.length-1])})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const pa=e=>{var a;let{t:o,noc:i,docs:r,isNoc:u,applicationData:s,NOCdata:c,bpaActionsDetails:d}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==s?void 0:s.status)||"",p=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[h,y]=n.useState([]),[S,_]=n.useState([]),[C,b]=n.useState(!1),[T,D]=Digit.Hooks.useSessionStorage(null==i?void 0:i.nocType,[]),[N,A]=n.useState(null),w=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;y(null==f||null===(e=f["common-masters"])||void 0===e?void 0:e.DocumentType)},[f]),n.useEffect(()=>{var e,t,n;let l,a=[];var o,r,c,d;l=u?null==E||null===(o=E.NOC)||void 0===o||null===(r=o.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==i?void 0:i.applicationType)&&(null==e?void 0:e.nocType)===(null==i?void 0:i.nocType)):null==g||null===(c=g.BPA)||void 0===c||null===(d=c.DocTypeMapping)||void 0===d?void 0:d.filter(e=>{var t,n;return e.WFState==(null==s?void 0:s.status)&&e.RiskType==(null==s?void 0:s.riskType)&&e.ServiceType==(null==s||null===(t=s.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==s||null===(n=s.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==i?void 0:i.additionalDetails,applicationStatus:null==i?void 0:i.applicationStatus,appNumberLink:null==i?void 0:i.applicationNo,nocNo:null==i?void 0:i.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==h||h.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),_(m))},[E,h]),n.useEffect(()=>{b("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[s,d]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:w?""+o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"):o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),c&&c.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:w?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:w?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(sa,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),C&&(null==S?void 0:S.map((e,t)=>l.createElement(va,{key:t,document:e,t:o,error:N,setError:A,setNocDocuments:D,nocDocuments:T,checkEnablingDocs:C}))))},Ea=e=>{let{permissions:a,t:o}=e;const[i,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[s,c,m]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const v=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==i?void 0:i.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:v?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==i?void 0:i.map((e,t)=>n===t?d({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==s?void 0:s.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{c(()=>null==s?void 0:s.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:v?"96%":"830px",width:v?"96%":"830px"},style:v?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:v?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...s];t.splice(e,1),c([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:v?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{c([...s,{label:""}])}}))};function ga(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:o}=n,{t:i}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:i("ES_PT_TITLE_TAX_HEADS"),text:i("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:i(e.taxHeadCode),label:i(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:i("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function fa(e){let{floors:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function ha(e){let{owners:n}=e,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:i}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},s={position:"relative",padding:"8px"},c={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},s={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u=d({},u,{maxWidth:"950px"}),u=d({},u,{maxWidth:"950px"}),c={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},o.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:u,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?i(null==e?void 0:e.title)+" "+(n+1):i(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:s},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:i(e.title),label:""+i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const ya=e=>{var o,i,r,u,s,c,d,m,p,E,g,f,h,y,S,_,C,b,T,D,N,A,w;let{scrutinyDetails:x,paymentsList:I=[],additionalDetails:L,applicationData:O}=e;const R=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==O?void 0:O.status))&&window.location.href.includes("bpa"),[P,M]=n.useState(),[F,k]=n.useState(),[B,U]=n.useState(),H=Digit.ULBService.getStateId(),[V,W]=n.useState(),[q,j]=n.useState(),[z,Y]=n.useState([]),[G,K]=n.useState(),[Q,X]=n.useState(""),[Z,$]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,oe]=n.useState(!1);n.useEffect(()=>{!function(){try{$(null);const e=function(){if(G&&null!=G&&G.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==G||null===(t=G.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(G.size>=2e6)$(ie("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",G,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y([...z,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):$(ie("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else $(ie("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[G]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(z))},[z]),n.useEffect(()=>{var e,t,n,l,a,o,i;if(null!=L&&null!==(e=L.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==L?void 0:L.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==L||null===(n=L.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==L||null===(l=L.lessAdjustmentFeeFiles[(null==L||null===(a=L.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),k(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==L||null===(o=L.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==L||null===(i=L.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),W(null==L?void 0:L.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==L?void 0:L.otherFeesDiscription),Y(null==L?void 0:L.lessAdjustmentFeeFiles)},[L]);const{t:ie}=a.useTranslation(),re=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},ie(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?ie(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void ie("NA");return l.createElement(n.Fragment,null,!(null!=x&&x.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==x||null===(o=x.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+ie(""+e.title),text:null!=e&&e.value?re(e)+" "+ie(null==e?void 0:e.isUnit):ie("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+ie(""+e.title),text:re(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},ie(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},ie(null==e?void 0:e.title))),null==x||null===(i=x.permit)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==x||null===(r=x.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!0)}},ie("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!1)}},ie("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,ie("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:ie("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==L?void 0:L.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:ie("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==L?void 0:L.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==x||null===(u=x.values[0])||void 0===u?void 0:u.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},ie("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},ie("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,ie("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==L||null===(s=L.selfCertificationCharges)||void 0===s?void 0:s.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==L||null===(c=L.selfCertificationCharges)||void 0===c?void 0:c.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==L||null===(d=L.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==L||null===(m=L.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,ie("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,ie("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==L||null===(p=L.selfCertificationCharges)||void 0===p?void 0:p.BPA_DEVELOPMENT_CHARGES)||0,value:P,disabled:!R,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,ie("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==L||null===(E=L.selfCertificationCharges)||void 0===E?void 0:E.BPA_OTHER_CHARGES)||0,value:F,disabled:!R,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(k(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:ie,type:"text",name:"otherChargesDiscription",defaultValue:null==L||null===(g=L.selfCertificationCharges)||void 0===g?void 0:g.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:V,disabled:!R,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==L||null===(f=L.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:B,disabled:!R,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(B)>0&&R?l.createElement("div",null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){j(e.target.files[0]),K(e.target.files[0])},disabled:!R,onDelete:()=>{j(null),K("")},message:q?"1 "+ie("FILEUPLOADED"):ie("ES_NO_FILE_SELECTED_LABEL"),error:Z,uploadMessage:Q})):null,(null==J||null===(h=J.fileStoreIds)||void 0===h?void 0:h.length)&&parseInt(null==L||null===(y=L.selfCertificationCharges)||void 0===y?void 0:y.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},ie("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(S=J.fileStoreIds)||void 0===S?void 0:S.length)&&parseInt(null==L||null===(_=L.selfCertificationCharges)||void 0===_?void 0:_.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(C=J.fileStoreIds[(null==J||null===(b=J.fileStoreIds)||void 0===b?void 0:b.length)-1])||void 0===C?void 0:C.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(T=L.selfCertificationCharges)||void 0===T?void 0:T.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(D=L.selfCertificationCharges)||void 0===D?void 0:D.BPA_LABOUR_CESS)+parseFloat(null==L||null===(N=L.selfCertificationCharges)||void 0===N?void 0:N.BPA_WATER_CHARGES)+parseFloat(null==L||null===(A=L.selfCertificationCharges)||void 0===A?void 0:A.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(B)?parseFloat(B):0))}))),l.createElement("div",null,null==x||null===(w=x.scruntinyDetails)||void 0===w?void 0:w.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+ie(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},ie(null==e?void 0:e.text))))))))},Sa=e=>{var o,i,r,u,s;let{edcrDetails:c,applicationData:d}=e;const{t:m}=a.useTranslation(),v=window.Digit.Utils.browser.isMobile(),p=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},g=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function f(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,o,i,r,u,s;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.builtUpArea,FloorArea:(null===(i=e.occupancies)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(u=e.occupancies)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function h(e){var t;let n=null==d||null===(t=d.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,o;let t=null===(a=n[e])||void 0===a||null===(o=a.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==c||null===(o=c.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==c||null===(i=c.subOccupancyTableDetails)||void 0===i||null===(r=i[0])||void 0===r||null===(u=r.value)||void 0===u||null===(s=u.planDetail)||void 0===s?void 0:s.blocks.map((e,n)=>{var a,o,i,r,u;return l.createElement("div",{key:n,style:(null==c||null===(a=c.subOccupancyTableDetails)||void 0===a||null===(o=a[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.planDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:f(e),columns:g,getCellProps:e=>({style:{}})})))})))},_a=e=>{let{headComment:t,otherComment:n}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,t),l.createElement("p",null,n))},Ca=e=>{var o,i,r;let{data:u,OpenImage:s,privacy:c={}}=e;const[d,m]=n.useState(!1),{t:v}=a.useTranslation();return l.createElement("div",null,u.date&&l.createElement("p",null,u.date),l.createElement("p",null,u.name),u.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:u.mobileNumber,privacy:c}),l.createElement("p",null,"    ")),u.source&&l.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+u.source.toUpperCase())),u.comment&&l.createElement(_a,{otherComment:null==u?void 0:u.otherComment,headComment:null==u?void 0:u.comment}),null!=u&&u.wfComment?l.createElement("div",null,null==u||null===(o=u.wfComment)||void 0===o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("WF_COMMON_COMMENTS")),!d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==u||null===(i=u.thumbnailsToShow)||void 0===i||null===(r=i.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==u?void 0:u.thumbnailsToShow.thumbs,onClick:(e,t)=>{s(e,t,null==u?void 0:u.thumbnailsToShow)}})):null)};function ba(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function Ta(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const Da=e=>{var o,i,r,u,s;let{wsAdditionalDetails:c}=e;const{t:d}=a.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:g,roadCuttingDetails:f,roadCuttingAddlDetails:h,activationDetails:y}=(null==c?void 0:c.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==c||null===(o=c.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(i=c.additionalDetails)||void 0===i?void 0:i.plumberDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==g?void 0:g.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==c||null===(r=c.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==f?void 0:f.map(e=>{var n;return l.createElement("div",{style:(null==f?void 0:f.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==c||null===(u=c.additionalDetails)||void 0===u?void 0:u.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==h?void 0:h.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(s=c.additionalDetails)||void 0===s?void 0:s.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==y?void 0:y.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},Na=[{title:"PT_PENDING_DUES_FROM_EARLIER",value:"Pending dues from earlier"},{title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT",value:"Miscalculation of earlier Assessment"},{title:"PT_ONE_TIME_PENALITY",value:"One time penality"},{title:"PT_OTHERS",value:"Others"}],Aa=[{title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER",value:"Advanced Paid By Citizen Earlier"},{title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO",value:"Rebate provided by commissioner/EO"},{title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN",value:"Additional amount charged from the citizen"},{title:"PT_OTHERS",value:"Others"}],wa=e=>{var o,i,r,u;let{wsAdditionalDetails:s}=e;const{t:c}=a.useTranslation(),[m,v,p]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,g,f]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==s||null===(o=s.additionalDetails)||void 0===o||!o.isPaid),[y,S]=n.useState(!1),[C,b]=n.useState(m||{}),[T,D]=n.useState(null),[N,A]=n.useState(s.additionalDetails.data?s.additionalDetails.data:{}),[w,x]=n.useState(s.additionalDetails.values?s.additionalDetails.values:[]),I=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(I,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=d({},null==s||null===(e=s.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==m||null===(n=m.billDetails)||void 0===n?void 0:n.length)>0){var o,i,r,u,c,p,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(o=m.billDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(r=m.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==m||null===(c=m.billDetails)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.taxAmount)}];x(e),A(null==m||null===(E=m.billDetails)||void 0===E?void 0:E[0])}else v(a),b(a)},[]);let L={};const O=e=>l.createElement("h1",{className:"heading-m"},e.label),R=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(R,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=d({},C);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,o;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}b(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},w&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==w?void 0:w.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+c("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==N?void 0:N.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=s&&null!==(i=s.additionalDetails)&&void 0!==i&&i.isAdhocRebate?l.createElement("div",{onClick:e=>{S(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,y&&l.createElement(t.Modal,{headerBarMain:l.createElement(O,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{b(m),S(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{b(m),S(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=C&&C.adhocPenalty?Number(null==C?void 0:C.adhocPenalty):0,n=null!=C&&C.adhocRebate?Number(null==C?void 0:C.adhocRebate):0;var l,a;if(t||n)if(n>(null==s||null===(l=s.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))D({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,i,r,u,m,p,E,f,h,y;const e=null==s||null===(o=s.additionalDetails)||void 0===o||null===(i=o.appDetails)||void 0===i?void 0:i.applicationNo,t=null==s||null===(r=s.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,n=d({},null==s||null===(m=s.additionalDetails)||void 0===m||null===(p=m.appDetails)||void 0===p?void 0:p.additionalDetails,C);s.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==s||null===(E=s.additionalDetails)||void 0===E||null===(f=E.appDetails)||void 0===f?void 0:f.service)?[{applicationNo:e,tenantId:t,waterConnection:s.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:s.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==s||null===(h=s.additionalDetails)||void 0===h||null===(y=h.appDetails)||void 0===y?void 0:y.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,o,i,r,u,s,c,d,m,p,E,f,h;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(f=E[0])||void 0===f||null===(h=f.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.taxHeadEstimates,"category");const y=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(s=e.Calculation)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.charge},{title:"WS_TAX_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.taxAmount}];g(Ml(e.Calculation[0])),A(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),x(y),C.billDetails=null==e?void 0:e.Calculation,v(C),S(!1)}).catch(e=>{var t,n,l,a,o,i;D({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?c(""+(null==e||null===(a=e.response)||void 0===a||null===(o=a.data)||void 0===o||null===(i=o.Errors[0])||void 0===i?void 0:i.code)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:c("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Na,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==C?void 0:C.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==C||null===(r=C.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==C?void 0:C.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==C?void 0:C.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_REBATE")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Aa,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==C?void 0:C.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==C||null===(u=C.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==C?void 0:C.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==C?void 0:C.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),T&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==T?void 0:T.isWarning,error:null==T||!T.isWarning,label:c(null==T?void 0:T.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},xa=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:d({},t),display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},Ia=e=>{let{t:n,userType:a=!1,infoBannerLabel:o="",infoClickLable:i="",infoClickInfoLabel:r="",infoClickInfoLabel1:u=""}=e;a=a||Digit.SessionStorage.get("userType");const s=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:s?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(o))),n(i)+" ",l.createElement(xa,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(u)))))},La=e=>{var o,i,r,u,s,c,d;let{wsAdditionalDetails:m}=e;const{t:v}=a.useTranslation(),[p,E]=n.useState(!1),[g,f]=n.useState({}),h=e=>l.createElement("h1",{className:"heading-m"},e.label),y=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),S=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(y,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),f(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&l.createElement(t.Modal,{headerBarMain:l.createElement(h,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(S,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==g||null===(i=g.billSlabData)||void 0===i||null===(r=i.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==g||null===(u=g.billSlabData)||void 0===u||null===(s=u.CHARGES)||void 0===s?void 0:s.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==g||null===(c=g.billSlabData)||void 0===c||null===(d=c.TAX)||void 0===d?void 0:d.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},Oa={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},Ra=e=>{let{className:t="table",headers:n=[],values:o=[],arrears:i=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:Oa.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:Oa.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:d({},Oa.cell,Oa.cellLeft,Oa.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:d({},Oa.cell,n.length==t+1?Oa.cellRight:{},Oa.cellHeader),key:t},r(e))))),l.createElement("tbody",null,Object.values(o).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:d({},Oa.cell,Oa.cellLeft),component:"th",scope:"row"},Object.keys(o)[t]),n.map((t,a)=>l.createElement("td",{style:d({},Oa.cell,{textAlign:"left"},n.length==a+1?Oa.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:d({},Oa.cell,Oa.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:d({},Oa.cell,Oa.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},i):t==n.length-2?l.createElement("td",{style:d({},Oa.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:Oa.cell,key:t,numeric:!0})))))))},Pa={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},Ma=e=>{var t,o,i;let{bill:r={}}=e;const{t:u}=a.useTranslation();let s={},c=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];c=[...c];const d=(null===(o=c)||void 0===o?void 0:o.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==d||null===(i=d.toFixed)||void 0===i?void 0:i.call(d,0))||Number(0).toFixed(0));c.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:o=[]}=e;return o.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);s[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?"FY"+(n.getYear()+1900)+"-"+(l.getYear()-100):n.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=t});let v={};!s||Object.keys(s).map((e,t)=>{Object.keys(s[e]).map(t=>{v[t]=s[e]&&s[e][t]&&s[e][t].order||0})});let p=[];p=Object.keys(v),p.sort((e,t)=>v[e]-v[t]);const[E,g]=n.useState(!1);return 0==d||d<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:Pa.headerStyle},u("CS_ARREARS_DETAILS")),E&&l.createElement(Ra,{headers:[...p],values:s,arrears:m}),!E&&l.createElement("div",{style:Pa.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{g(!0)}},u("CS_SHOW_CARD"))),E&&l.createElement("div",{style:Pa.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{g(!1)}},u("CS_HIDE_CARD"))))},Fa=e=>{let{assessmentData:t}=e;const[a,o]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{o(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,n)=>l.createElement("div",{key:n,className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),l.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),l.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},l.createElement("div",{style:{display:"flex",gap:"75px"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),l.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}},"          ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess"),"          ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel"),"        ")),n!==t.length-1&&l.createElement("hr",null)))))},ka=e=>{var t;let{applicationData:a}=e;const[i,r]=n.useState(!1);return o.useHistory(),l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{r(!i)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),l.createElement("span",{style:{fontSize:"1.2em"}},i?"<":">"))),i&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},l.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),l.createElement("span",{style:{flex:"1",color:"black"}},a.acknowldgementNumber)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.propertyId)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(u=null===(t=a.auditDetails)||void 0===t?void 0:t.createdTime,new Date(u).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.status)),l.createElement("div",null,l.createElement(o.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+a.acknowldgementNumber,state:{propertyId:a.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var u},Ba=e=>{let{payments:t}=e;const[a,o]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{o(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&l.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payemnts found")))};function Ua(e){var i,r,u,s,c,m,v,p,E,g,f,h,y,S,C,b;let{applicationDetails:T,demandData:D,workflowDetails:N,isDataLoading:A,applicationData:w,timelineStatusPrefix:x,showTimeLine:I=!0,statusAttribute:L="status",paymentsList:O,oldValue:R,isInfoLabel:P=!1,propertyId:M}=e;const{t:F}=a.useTranslation(),k=o.useHistory(),B=Digit.ULBService.getCurrentTenantId(),[U,H]=n.useState(null),[V,W]=n.useState([]);let q=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function j(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",T);const[z,Y]=n.useState({}),[G,K]=n.useState(),[Q,X]=n.useState([]),[Z,$]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==w?void 0:w.status)||Z.loading||Z.loaded||Z.canLoad||$({loading:!1,loaded:!1,canLoad:!0}),null==Z||!Z.canLoad||Z.loading||Z.loaded||($({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function o(){n(i),l({loading:!1,loaded:!0,canLoad:!0})}let i={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0){const n=a.Assessments.filter(e=>"ACTIVE"===e.status),l=new Map;n.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,n=l.get(t);(!n||e.createdDate>n.createdDate)&&l.set(t,e)}),console.log("grouped",l);const o=Array.from(l.values());return X(o),console.log(o),K(null==a?void 0:a.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){i=e})}}();return r&&r.then?r.then(o):o()})}catch(e){return Promise.reject(e)}}((null==w?void 0:w.tenantId)||B,null==w?void 0:w.propertyId,Y,$));const J=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+t.getFullYear()},ee=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:J(null==w||null===(a=w.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==w?void 0:w.channel)||""};return l.createElement(Ca,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,i,r,u,s,c,d,m,v,p,E,g,f,h,y,S,C,b;const a={uuid:null==e||null===(o=e.assignes)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==T?void 0:T.tenantId,businessIds:null==T?void 0:T.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber"),n}}},D=n[t-1],N={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.name,mobileNumber:(null==w||null===(c=w.processInstance)||void 0===c||null===(d=c.assignes)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.uuid)===(null==e||null===(v=e.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)&&null!=w&&null!==(E=w.processInstance)&&void 0!==E&&null!==(g=E.assignes)&&void 0!==g&&null!==(f=g[0])&&void 0!==f&&f.mobileNumber?null==w||null===(h=w.processInstance)||void 0===h||null===(y=h.assignes)||void 0===y||null===(S=y[0])||void 0===S?void 0:S.mobileNumber:null==e||null===(C=e.assignes)||void 0===C||null===(b=C[0])||void 0===b?void 0:b.mobileNumber,comment:F(null==e?void 0:e.comment),wfComment:D?D.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(Ca,{data:N,OpenImage:j,privacy:a})}{var D,N,A,x,I;const t={date:J(null==w||null===(D=w.auditDetails)||void 0===D?void 0:D.lastModifiedTime),name:null==e||null===(N=e.assignes)||void 0===N||null===(A=N[0])||void 0===A?void 0:A.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(x=e.assignes)||void 0===x||null===(I=x[0])||void 0===I?void 0:I.mobileNumber};return l.createElement(Ca,{data:t})}},te=(e,t)=>e?t?e:F(e):F("NA"),ne=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),le=window.location.href.includes("employee/noc"),ae=window.location.href.includes("employee/obps"),oe=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ne?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),ie=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?te(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+F(null==e?void 0:e.isUnit):F("N/A"):null!=e&&e.value?te(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):F("N/A"),[re,ue]=n.useState(!1);console.log("demand Data arr",D),null==D||D.reduce((e,t)=>e+t.demandInterest,0),null==D||D.reduce((e,t)=>e+t.demandPenality,0),null==D||D.reduce((e,t)=>e+t.collectionTax,0),null==D||D.reduce((e,t)=>e+t.collectionInterest,0),null==D||D.reduce((e,t)=>e+t.collectionPenality,0),null==D||D.reduce((e,t)=>e+t.balanceTax,0),null==D||D.reduce((e,t)=>e+t.balanceInterest,0),null==D||D.reduce((e,t)=>e+t.balancePenality,0);const se=function(e,t,n){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const l=d({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:d({},e.additionalDetails,{propertytobestatus:t}),workflow:d({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:d({},l)},B,n)).then(function(e){console.log("response from inactive/active",e)})}catch(e){return Promise.reject(e)}},ce=null==T?void 0:T.applicationData,de=(null==T||null===(i=T.applicationData)||void 0===i?void 0:i.propertyId)||"",me=null==T||null===(r=T.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return console.log("applicationDetails?.applicationDetails",T),console.log("infolabel",P),console.log("assessment details",G),n.useEffect(()=>{try{Digit.PTService.paymentsearch({tenantId:B,filters:{consumerCodes:M},auth:!0}).then(e=>{W(null==e?void 0:e.Payments),console.log(e)})}catch(e){console.log(e)}},[]),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},P?l.createElement(Ia,{t:F,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==T||null===(u=T.applicationDetails)||void 0===u?void 0:u.map((e,a)=>{var i,r,u,s,c,d,m,v,p,E,g,f,h,y,S,_,C,b,D,A,w,x,I,L,P,M,k,B,U,H,V,W,j,Y,G,K,Q,X;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:ne?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&ne?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},le?""+F(e.title):F(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},F(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},F(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},F(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},F(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ne?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i,r,u;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:F(n.title),label:F(n.title),text:l.createElement("img",{src:F(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:F(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},F(null==n?void 0:n.title)))):le||ae?""+F(n.title):F(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:oe(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+F(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:F(n.title),label:F(n.title),text:ie(n),last:a===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:oe(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(Ma,{bill:null===(r=z.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(ya,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:O,additionalDetails:null==T||null===(u=T.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==T?void 0:T.applicationData}),(null==T||null===(s=T.applicationData)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(d=c.fieldinspection_pending)||void 0===d?void 0:d.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(ma,{fiReport:null==T||null===(v=T.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(fa,{floors:null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&l.createElement(ha,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units)&&l.createElement(Ta,{units:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.units}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.accessories)&&l.createElement(ba,{units:null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.accessories}),!q&&(null==e||null===(b=e.additionalDetails)||void 0===b?void 0:b.permissions)&&(null==N||null===(D=N.data)||void 0===D||null===(A=D.nextActions)||void 0===A?void 0:A.length)>0&&l.createElement(Ea,{applicationData:null==T?void 0:T.applicationData,t:F,permissions:null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.permissions}),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(ca,{t:F,applicationData:null==T?void 0:T.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:N})),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.noc)&&l.createElement(pa,{t:F,isNoc:!0,NOCdata:e.values,applicationData:null==T?void 0:T.applicationData,docs:e.additionalDetails.noc,noc:null===(L=e.additionalDetails)||void 0===L?void 0:L.data,bpaActionsDetails:N}),(null==e||null===(P=e.additionalDetails)||void 0===P?void 0:P.scruntinyDetails)&&l.createElement(ya,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.buildingExtractionDetails)&&l.createElement(ya,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.subOccupancyTableDetails)&&l.createElement(Sa,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==T?void 0:T.applicationData}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.documentsWithUrl)&&l.createElement(sa,{documents:null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.documentsWithUrl}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.taxHeadEstimatesCalculation)&&l.createElement(ga,{taxHeadEstimatesCalculation:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(Da,{wsAdditionalDetails:e,oldValue:R}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(o.Link,{to:null==e||null===(j=e.additionalDetails)||void 0===j||null===(Y=j.redirectUrl)||void 0===Y?void 0:Y.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(G=e.additionalDetails)||void 0===G||null===(K=G.redirectUrl)||void 0===K?void 0:K.title))),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.estimationDetails)&&l.createElement(wa,{wsAdditionalDetails:e,workflowDetails:N}),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.estimationDetails)&&l.createElement(La,{wsAdditionalDetails:e,workflowDetails:N}))}),(null==G?void 0:G.length)>0&&l.createElement(Fa,{assessmentData:Q}),l.createElement(Ba,{payments:V}),l.createElement(ka,{applicationData:null==T?void 0:T.applicationData}),I&&(null==N||null===(s=N.data)||void 0===s||null===(c=s.timeline)||void 0===c?void 0:c.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==N?void 0:N.isLoading)||A)&&l.createElement(t.Loader,null),!(null!=N&&N.isLoading)&&!A&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},F("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=N&&null!==(m=N.data)&&void 0!==m&&m.timeline&&1===(null==N||null===(v=N.data)||void 0===v||null===(p=v.timeline)||void 0===p?void 0:p.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:F(""+x+(null==N||null===(E=N.data)||void 0===E||null===(g=E.timeline[0])||void 0===g?void 0:g.state)),customChild:ee(null==N||null===(f=N.data)||void 0===f?void 0:f.timeline[0],null==N||null===(h=N.data)||void 0===h?void 0:h.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==N||null===(y=N.data)||void 0===y?void 0:y.timeline)&&(null==N||null===(S=N.data)||void 0===S?void 0:S.timeline.slice(0,re?null==N?void 0:N.data.timeline.length:2).map((e,n,a)=>{var o;let i="";var r,u,s,c,d,m;return window.location.href.includes("/obps/")&&(i=null!=N&&null!==(r=N.data)&&void 0!==r&&null!==(u=r.timeline[n-1])&&void 0!==u&&null!==(s=u.state)&&void 0!==s&&s.includes("BACK_FROM")||null!=N&&null!==(c=N.data)&&void 0!==c&&null!==(d=c.timeline[n-1])&&void 0!==d&&null!==(m=d.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:F(""+x+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[L])+i),customChild:ee(e,n,null==N||null===(o=N.data)||void 0===o?void 0:o.timeline)}))}))),(null==N||null===(C=N.data)||void 0===C||null===(b=C.timeline)||void 0===b?void 0:b.length)>2&&l.createElement(t.LinkButton,{label:F(re?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ue(e=>!e)}})))),window.location.href.includes("/pt/")?l.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},l.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==me?se(ce,"ACTIVE",de):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==me?se(ce,"INACTIVE",de):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==T||null===(e=T.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var n,l,a;if("INACTIVE"===(null==T||null===(n=T.applicationData)||void 0===n?void 0:n.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==T||null===(l=T.applicationData)||void 0===l?void 0:l.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==T||null===(a=T.applicationData)||void 0===a?void 0:a.status)&&k.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var o,i,r;if("INACTIVE"===(null==T||null===(o=T.applicationData)||void 0===o?void 0:o.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==T||null===(i=T.applicationData)||void 0===i?void 0:i.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==T||null===(r=T.applicationData)||void 0===r?void 0:r.status)&&k.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),l.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):l.createElement("div",null),U&&l.createElement(t.Toast,{error:U.isError,label:F(U.label),onClose:()=>{H(null)},isDleteBtn:"false"}))}function Ha(e){var n,a,o,i,r,u,s,c,d,m,v,p,E,g,f,h,y,S;let{t:_,showToast:C,closeToast:b,businessService:T}=e;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var D;let e="";switch(null==C||null===(D=C.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==C?void 0:C.key)?null==C||null===(n=C.error)||void 0===n?void 0:n.message:_("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==C?void 0:C.key)?null==C||null===(a=C.error)||void 0===a?void 0:a.message:_("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==C?void 0:C.key)?null==C||null===(o=C.error)||void 0===o?void 0:o.message:_("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==C?void 0:C.key)?null==C||null===(i=C.error)||void 0===i?void 0:i.message:_("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==C?void 0:C.key)?null==C||null===(r=C.error)||void 0===r?void 0:r.message:_("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==C?void 0:C.key)?null==C||null===(u=C.error)||void 0===u?void 0:u.message:_("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==C?void 0:C.key)?null==C||null===(s=C.error)||void 0===s?void 0:s.message:_("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==C?void 0:C.key)?null==C||null===(c=C.error)||void 0===c?void 0:c.message:_("ES_"+T+"_"+(null==C||null===(d=C.action)||void 0===d?void 0:d.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:e,onClose:b}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var N;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=T&&T.includes("BPA_OC")?_(e[1]):_(e[0]),n};let n="";switch(null==C||null===(N=C.action)||void 0===N?void 0:N.action){case"REVOCATE":n="error"===(null==C?void 0:C.key)?null==C||null===(m=C.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==C?void 0:C.key)?null==C||null===(v=C.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==C?void 0:C.key)?null==C||null===(p=C.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==C?void 0:C.key)?null==C||null===(E=C.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==C?void 0:C.key)?null==C||null===(g=C.error)||void 0===g?void 0:g.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==C?void 0:C.key)?null==C||null===(f=C.error)||void 0===f?void 0:f.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==C?void 0:C.key)?null==C||null===(h=C.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==C?void 0:C.key)?null==C||null===(y=C.error)||void 0===y?void 0:y.message:_("ES_"+T+"_"+(null==C||null===(S=C.action)||void 0===S?void 0:S.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:n,onClose:b}))}{var A,w;const e="error"===(null==C?void 0:C.key)?null==C||null===(A=C.error)||void 0===A?void 0:A.message:"ES_"+T+"_"+(null==C||null===(w=C.action)||void 0===w?void 0:w.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:_(e),onClose:b}))}}function Va(e){var o,i,r,u,s,c,m,v,p,E,g,f,h,y,S,_;let{workflowDetails:C,displayMenu:b,onActionSelect:T,setDisplayMenu:D,businessService:N,forcedActionPrefix:A,ActionBarStyle:w={},MenuStyle:x={}}=e;const{t:I}=a.useTranslation();let L=Digit.UserService.getUser();const O=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};L=null==t?void 0:t.value}const R=null===(o=L)||void 0===o||null===(i=o.info)||void 0===i||null===(r=i.roles)||void 0===r?void 0:r.map(e=>e.code);let P=!1,M=!1,F=(null==C||null===(u=C.data)||void 0===u||null===(s=u.actionState)||void 0===s||null===(c=s.nextActions)||void 0===c?void 0:c.filter(e=>(null==R?void 0:R.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==C||null===(m=C.data)||void 0===m||null===(v=m.nextActions)||void 0===v?void 0:v.filter(e=>(null==R?void 0:R.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return Digit.Hooks.useClickOutside(O,()=>{D(!1)},b),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(p=F[0])&&void 0!==p&&null!==(E=p.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(M=!1,P=!0):(null==F?void 0:F.length)>0&&(M=!0,P=!1),l.createElement(l.Fragment,null,!(null!=C&&C.isLoading)&&M&&!P&&l.createElement(t.ActionBar,{style:d({},w)},b&&(null!=C&&null!==(g=C.data)&&void 0!==g&&null!==(f=g.actionState)&&void 0!==f&&f.nextActions||null!=C&&null!==(h=C.data)&&void 0!==h&&h.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:A||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()),options:F,optionKey:"action",t:I,onSelect:T,style:x}):null,l.createElement(t.SubmitBar,{ref:O,label:I("WF_TAKE_ACTION"),onSubmit:()=>D(!b)})),!(null!=C&&C.isLoading)&&!M&&P&&l.createElement(t.ActionBar,{style:d({},w)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(y=F[0])||void 0===y?void 0:y.action,value:null==F||null===(S=F[0])||void 0===S?void 0:S.action,onClick:e=>{T((null==F?void 0:F[0])||{})}},I((A||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()))+"_"+(null==F||null===(_=F[0])||void 0===_?void 0:_.action)))))}const Wa=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),qa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Wa,null));function ja(e){let{action:n,closeWarningPopup:o}=e;const{t:i}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},i("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(qa,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,i("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",i("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+i("PT_AMOUNT_DUE"),text:"₹"+i(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:i("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:i("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const za=e=>{var i,u;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const c=Digit.ULBService.getCurrentTenantId(),m=Digit.ULBService.getStateId(),{data:p}=Digit.Hooks.obps.useMDMS(m,"BPA",["BlockReason"]),{t:E}=a.useTranslation(),g=o.useHistory();let{id:f}=o.useParams();const[h,y]=n.useState(!1),[S,_]=n.useState(null),[C,b]=n.useState(!1),[T,D]=n.useState(!1),[N,A]=n.useState(!1),{data:w}=Digit.Hooks.obps.useMDMS(m,"BPA",["RiskTypeComputation"]),{applicationDetails:x,demandData:I,totalDemandTax:L,totalBalanceTax:O,showToast:R,setShowToast:P,isLoading:M,isDataLoading:F,applicationData:k,mutate:B,nocMutation:U,workflowDetails:H,id:V,businessService:W,closeToast:q,moduleCode:j,timelineStatusPrefix:z,forcedActionPrefix:Y,statusAttribute:G,ActionBarStyle:K,MenuStyle:Q,paymentsList:X,showTimeLine:Z=!0,oldValue:$,isInfoLabel:J=!1,clearDataDetails:ee,propertyId:te}=e;n.useEffect(()=>{R&&H.revalidate()},[R]);const ne=r.useQueryClient(),le=()=>{_(null),b(!1)};return M||T?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,M?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(Ua,{applicationDetails:x,demandData:I,id:V,workflowDetails:H,isDataLoading:F,applicationData:k,totalDemandTax:L,totalBalanceTax:O,businessService:W,timelineStatusPrefix:z,statusAttribute:G,paymentsList:X,showTimeLine:Z,oldValue:$,isInfoLabel:J,propertyId:te}),C?l.createElement(ra,{t:E,action:S,tenantId:c,state:m,id:f,applicationDetails:x,applicationData:null==x?void 0:x.applicationData,closeModal:le,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,o,i,r,u,s,c,m,p,f,h,y,_,C,b,T,N,A){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(o=a.workflow)||void 0===o||null===(i=o.comment)||void 0===i?void 0:i.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.action)?0==(null==e||null===(s=e.Licenses)||void 0===s||null===(c=s[0])||void 0===c||null===(m=c.additionalDetail)||void 0===m||null===(p=m.validityYears)||void 0===p?void 0:p.length):0==(null==e||null===(f=e.Licenses)||void 0===f||null===(h=f[0])||void 0===h||null===(y=h.comment)||void 0===y?void 0:y.length))||0==(null==e||null===(_=e.WaterConnection)||void 0===_||null===(C=_.comment)||void 0===C?void 0:C.length)||0==(null==e||null===(b=e.SewerageConnection)||void 0===b||null===(T=b.comment)||void 0===T?void 0:T.length)||0==(null==e||null===(N=e.BPA)||void 0===N||null===(A=N.comment)||void 0===A?void 0:A.length)){var w,x;"INITIATE"===(null==e||null===(w=e.Licenses)||void 0===w||null===(x=w[0])||void 0===x?void 0:x.action)?alert(E("Please fill in the validity before submitting")):alert(E("Please fill in the comments before submitting"))}else{const a=function(a,o,i,r,u){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(o=e.BPA)&&void 0!==o&&null!==(i=o.additionalDetails)&&void 0!==i&&i.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(u=r.workflow)||void 0===u?void 0:u.action)){function s(t){if(l)return t;B&&(D(!0),B(e,{onError:(e,t)=>{D(!1),P({key:"error",error:e}),setTimeout(q,5e3)},onSuccess:(e,t)=>{var l,a,o,i,r,u;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),D(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=S,g.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=S,g.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&g.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(i=e.Amendments)||void 0===i?void 0:i.length)>0){var s,c,d,m,v,p,f,h;null!=t&&null!==(s=t.AmendmentUpdate)&&void 0!==s&&null!==(c=s.workflow)&&void 0!==c&&c.action.includes("SEND_BACK")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(p=v.workflow)&&void 0!==p&&p.action.includes("APPROVE")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(f=t.AmendmentUpdate)&&void 0!==f&&null!==(h=f.workflow)&&void 0!==h&&h.action.includes("REJECT")&&P({key:"success",label:E("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var y;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(u=e.Licenses[0])&&void 0!==u&&u.applicationNumber)return P({key:"success",action:S}),void g.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(y=e.Licenses[0])||void 0===y?void 0:y.applicationNumber));P({key:"success",action:S}),ee&&setTimeout(ee,3e3),setTimeout(q,5e3),ne.clear(),ne.refetchQueries("APPLICATION_SEARCH")}}})),le()}D(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(d({},e)));const a=function(){if(!1!==t&&U){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==U?void 0:U.mutateAsync(e)),a=v(function(){return D(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,o,i,r,u,s,c,d,m,v;D(!1);let p=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&o.code?E(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.code):(null==e||null===(c=e.response)||void 0===c||null===(d=c.data)||void 0===d||null===(m=d.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;le(),P({key:"error",error:{message:p}}),setTimeout(q,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(s):s(a)}alert(E("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==H||null===(i=H.data)||void 0===i?void 0:i.timeline,businessService:W,workflowDetails:H,moduleCode:j,blockReason:null==p||null===(u=p.BPA)||void 0===u?void 0:u.BlockReason}):null,N?l.createElement(ja,{action:S,workflowDetails:H,businessService:W,isWarningPop:N,closeWarningPopup:()=>{A(!1)}}):null,l.createElement(Ha,{t:E,showToast:R,closeToast:q,businessService:W}),l.createElement("div",null,s?l.createElement(t.SubmitBar,{style:{marginRight:20},label:E("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(c,{applicationNo:null==k?void 0:k.applicationNo})).then(function(e){var t,n,l,a,o,i;const r=Digit.Utils.obps.calculateRiskType(null==w||null===(t=w.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==x||null===(n=x.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==x||null===(o=x.edcrDetails)||void 0===o||null===(i=o.planDetail)||void 0===i?void 0:i.blocks),u={BPA:e.BPA[0]};u.BPA.riskType=r,u.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null},u.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",u.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),u.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const s=function(e,t,n,l,a,o,i,r,s,d,m,v){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==u||null===(e=u.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==u||null===(l=u.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null==u||null===(i=u.BPA)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null==u||null===(d=u.BPA)||void 0===d||null===(m=d.additionalDetails)||void 0===m||null===(v=m.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(u,c)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(E("Enterd Less Adjustment amount is invalid"))}();if(s&&s.then)return s.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&l.createElement(Va,{workflowDetails:H,displayMenu:h,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa"))window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]);else if(null!=e&&e.isWarningPopUp)A(!0);else if(null!=e&&e.redirectionUrll){var a,o,i,r,u;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))g.push(""+(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(u=location)||void 0===u?void 0:u.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.action)){var s,c;g.push(""+(null==e||null===(s=e.redirectionUrll)||void 0===s?void 0:s.pathname),{data:null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.state})}else{var m;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(m=e.redirectionUrll)||void 0===m?void 0:m.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))console.log("Got Inside Direct"),b(!0);else{var v,p;g.push({pathname:null===(v=e.redirectionUrl)||void 0===v?void 0:v.pathname,state:d({},null===(p=e.redirectionUrl)||void 0===p?void 0:p.state)})}else b(!0);_(e),y(!1)},setDisplayMenu:y,businessService:W,forcedActionPrefix:Y,ActionBarStyle:K,MenuStyle:Q}))))},Ya=e=>{let{t:t,heading:n}=e;return l.createElement("h1",{className:"heading-m"},""+t(n))},Ga=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ka=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ga,null)),Qa=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null," ",t("CONFIRM_DELETE_MSG")+" "," ",l.createElement("b",null," "+n)," "))},Xa=e=>{let{t:n,heading:a,docName:o,closeModal:i,actionCancelLabel:r,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return l.createElement(t.Modal,{headerBarMain:l.createElement(Ya,{t:n,heading:a}),headerBarEnd:l.createElement(Ka,{onClick:i}),actionCancelLabel:n(r),actionCancelOnSubmit:u,actionSaveLabel:n(s),actionSaveOnSubmit:c,formId:"modal-action"},l.createElement(Qa,{t:n,title:o}))},Za=["uploadedFilesData"],$a=["EDIT","DELETE"],Ja=()=>{var e,i,r,u,s,c,v,p,E,g,f,h,y,S,_,C,T,D;let N=window.Digit.Utils.browser.isMobile();const{id:A}=o.useParams(),{t:w}=a.useTranslation(),x=o.useHistory(),[I,L]=n.useState(!1),[O,R]=n.useState(!1),P=Digit.ULBService.getCurrentTenantId(),{isLoading:M,data:F}=Digit.Hooks.events.useEventDetails(P,{ids:A},{}),[k,B,U]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[H,V,W]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[q,j,z]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{B(!1),z(),W()},[]),M?l.createElement(t.Loader,null):l.createElement("div",null,I?l.createElement(Xa,{t:w,heading:"CONFIRM_DELETE_PUB_BRCST",docName:null==F||null===(e=F.applicationData)||void 0===e?void 0:e.name,closeModal:()=>L(!I),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){L(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:()=>{const e={events:[d({},m(null==F?void 0:F.applicationData,Za),{status:"CANCELLED"})]};x.push("/digit-ui/employee/engagement/messages/response?delete=true",e)}}):null,l.createElement(t.Header,null,w("CS_HEADER_PUBLIC_BRDCST")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_ULB_LABEL")+":")," ",l.createElement("p",null,(e=>{var t,n,l;let a=null==e?void 0:e.split(".")[1];return a=""+(null===(t=a)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.toUpperCase())+(null===(l=a)||void 0===l?void 0:l.slice(1))+" ",a})(null==F?void 0:F.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("PUBLIC_BRDCST_TITLE_LABEL")+":")," ",l.createElement("p",null,null==F||null===(i=F.applicationData)||void 0===i?void 0:i.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_COMMENTS_LABEL")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=F&&null!==(r=F.applicationData)&&void 0!==r&&null!==(u=r.description)&&void 0!==u&&u.length?null==F||null===(s=F.applicationData)||void 0===s?void 0:s.description:"NA")," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_FROM_DATE_LABEL")+":")," ",l.createElement("p",null,null!=F&&null!==(c=F.applicationData)&&void 0!==c&&null!==(v=c.eventDetails)&&void 0!==v&&v.fromDate?we(new Date(null==F||null===(p=F.applicationData)||void 0===p||null===(E=p.eventDetails)||void 0===E?void 0:E.fromDate),"dd/MM/yyyy"):null)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_TO_DATE_LABEL")+":")," ",l.createElement("p",null,null!=F&&null!==(g=F.applicationData)&&void 0!==g&&null!==(f=g.eventDetails)&&void 0!==f&&f.toDate?we(new Date(null==F||null===(h=F.applicationData)||void 0===h||null===(y=h.eventDetails)||void 0===y?void 0:y.toDate),"dd/MM/yyyy"):null)," "),l.createElement("span",{className:"documentDetails_subheader"},""+w("CS_COMMON_DOCUMENTS")),null!=F&&null!==(S=F.applicationData)&&void 0!==S&&null!==(_=S.eventDetails)&&void 0!==_&&null!==(C=_.documents)&&void 0!==C&&C.length?(e=>{let n=window.Digit.Utils.browser.isMobile();return e||e.length?l.createElement("div",{style:{display:"flex",flexDirection:n?"column":"row",gap:n?"40px":"100px"}},e.map(e=>{let{fileStoreId:n,fileName:a}=e;return l.createElement("div",{className:"documentDetails_pdf"},l.createElement("div",{style:{width:"100px"},onClick:()=>b(n,a)},l.createElement(t.GenericFileIcon,null),l.createElement("span",{className:"cell-text"},null==a?void 0:a.split(10))))})):null})(null==F||null===(T=F.applicationData)||void 0===T||null===(D=T.eventDetails)||void 0===D?void 0:D.documents):"NA")),l.createElement(t.ActionBar,null,O?l.createElement(t.Menu,{style:{width:N?"full":"240px"},localeKeyPrefix:"ES_CE",options:$a,t:w,onSelect:function(e){"EDIT"===e&&x.push("/digit-ui/employee/engagement/messages/inbox/edit/"+A),"DELETE"===e&&L(!0),R(!1)}}):null,l.createElement(t.SubmitBar,{label:w("ES_COMMON_TAKE_ACTION"),onSubmit:()=>R(!O)})))},eo=e=>{let{match:{path:n}={},tenants:a,parentRoute:i}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/create",component:e=>l.createElement(ct,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/create",component:e=>l.createElement(ct,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/details/:id",component:e=>l.createElement(Ja,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/edit/:id",component:e=>l.createElement(vt,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(ut,d({},e,{tenants:a,parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/response",component:e=>l.createElement(mt,e)}))},to=/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats-officedocument)$/i,no=["header","actions","eventNotificationText","timePastAfterEventCreation","timeApproxiamationInUnits"],lo=e=>{let{header:t,actions:n,eventNotificationText:o,timePastAfterEventCreation:i,timeApproxiamationInUnits:r}=e,u=m(e,no);const{t:s}=a.useTranslation(),c=u.eventDetails.documents;return l.createElement("div",{className:"WhatsNewCard"},l.createElement("h2",null,s(t)),l.createElement("p",null,o),null==n?void 0:n.map(e=>{return l.createElement("a",{href:null==e?void 0:e.actionUrl},""+s("CS_COMMON_"+("number"==typeof(t=null==e?void 0:e.code)?t:t&&t.toUpperCase().replace(/[.:-\s\/]/g,"_"))));var t}),(null==c?void 0:c.length)>1?((e,t)=>t.length?l.createElement("div",{className:"broadcastnotifications_actionswrapper-multi"},t.map((t,n)=>{let{fileName:a,fileStoreId:o}=t;return l.createElement("div",{className:"display-flex-gap-2"},a.length?l.createElement("p",null,a," : "):null,o.length?l.createElement("span",{className:"link",onClick:()=>b(o,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,o.length?l.createElement("span",{className:"link",onClick:()=>D(o)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})):null)(s,c):((e,t)=>{if(null==t||!t.length)return null;const{fileStoreId:n,fileName:a}=null==t?void 0:t[0];return l.createElement("div",{className:"display-flex-gap-2"},n&&n.length?l.createElement("span",{className:"link",onClick:()=>b(n,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,n&&n.length?l.createElement("span",{className:"link",onClick:()=>D(n)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})(s,c),l.createElement("p",null,i+" "+s(r)))},ao=e=>l.createElement("h1",{className:"heading-m"},e.label),oo=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),io=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(oo,null)),ro=()=>{const{id:e}=o.useParams(),{t:i}=a.useTranslation(),r=o.useHistory(),[u,s]=n.useState(!1),[c,m]=n.useState(!1),v=Digit.ULBService.getCurrentTenantId(),{isLoading:p,data:E}=Digit.Hooks.events.useEventDetails(v,{ids:e}),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[y,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[C,b,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{f(!1),T(),_()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,i("ES_TITLE_APPLICATION_DETAILS")),l.createElement(za,{applicationData:null==E?void 0:E.applicationData,applicationDetails:E,isLoading:p,isDataLoading:p}),l.createElement(t.ActionBar,null,c?l.createElement(t.Menu,{localeKeyPrefix:"ES_EVENT",options:["EDIT","DELETE"],t:i,onSelect:function(t){"EDIT"===t&&r.push("/digit-ui/employee/engagement/event/edit-event/"+e),"DELETE"===t&&s(!0),m(!1)}}):null,l.createElement(t.SubmitBar,{label:i("ES_COMMON_TAKE_ACTION"),onSubmit:()=>m(!c)})),u&&l.createElement(t.Modal,{headerBarMain:l.createElement(ao,{label:i("ES_EVENT_DELETE_POPUP_HEADER")}),headerBarEnd:l.createElement(io,{onClick:()=>s(!1)}),actionCancelLabel:i("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>s(!1),actionSaveLabel:i("ES_EVENT_DELETE"),actionSaveOnSubmit:()=>{const e={events:[d({},null==E?void 0:E.applicationData,{status:"CANCELLED"})]};r.push("/digit-ui/employee/engagement/event/response?delete=true",e)}},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement(t.CardText,null,i("ES_EVENT_DELETE_TEXT")))))},uo=e=>{let{searchValue:n,onChange:a,handleKeyPress:o,handleSearch:i,t:r}=e;return l.createElement("div",null,l.createElement(t.TextInput,{textInputStyle:{maxWidth:"960px"},className:"searchInput",placeholder:r("CE_SERACH_DOCUMENTS"),value:n,onChange:e=>a(e.target.value),signature:!0,signatureImg:l.createElement(t.SearchIconSvg,{className:"signature-img",onClick:()=>i()}),onKeyPress:o}))},so=(e,t)=>{const[l,a]=n.useState(e);return n.useEffect(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),l},co=e=>{let{documentTitle:n,documentSize:a=2.3,lastModifiedData:o,description:i,filestoreId:r,documentLink:u,t:s}=e,c=window.Digit.Utils.browser.isMobile();return l.createElement("div",{className:"notice_and_circular_main"},l.createElement("div",{className:"notice_and_circular_image"},l.createElement(t.GenericFileIcon,{height:""+(c?66:100),width:""+(c?53:100)})),l.createElement("div",{className:"notice_and_circular_content"},l.createElement("div",{className:"notice_and_circular_heading_mb"},l.createElement(t.CardHeader,null,n),a?l.createElement(t.CardCaption,null,N(a)):null),l.createElement("div",{className:"notice_and_circular_caption"},l.createElement(t.CardCaption,null,s("CE_DCOUMENT_UPLOADED_ON")+" "+(o?we(new Date(o),"do MMMM yyyy"):"-"))),l.createElement("div",{className:"notice_and_circular_text"},l.createElement(t.CardText,null,null!=i&&i.length?i:"NA")),l.createElement("div",{className:"view_download_main"},r&&r.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>b(r||null,n)},l.createElement(t.ViewsIcon,null),l.createElement("p",null,s("CE_DOCUMENT_VIEW_LINK")))}):null,u&&u.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>T(u,n)},l.createElement(t.ExternalLinkIcon,null),l.createElement("p",null,s("CE_DOCUMENT_OPEN_LINK")))}):null,r&&r.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views download_views_padding"},l.createElement(t.DownloadImgIcon,null),l.createElement("p",null,s("CE_DOCUMENT_DOWNLOAD_LINK"))),onClick:()=>D(r||null)}):null)))},mo=(e,t)=>e.map((e,n)=>{let{name:a,createdTime:o,description:i,documentLink:r,fileSize:u,filestoreId:s}=e;return l.createElement(co,{key:n,documentTitle:a,documentSize:u,lastModifiedData:o,description:i,documentLink:r,filestoreId:s,t:t})}),vo=e=>{let{t:n,title:a,count:o,onClick:i,children:r}=e;const[u,s]=l.useState(!1);return l.createElement("div",{className:"accordion-wrapper",onClick:()=>i(a,o)},l.createElement("div",{className:"accordion-title "+(u?"open":""),onClick:()=>s(!u)},n(a)+" ("+o+")",l.createElement(t.PrevIcon,null)),l.createElement("div",{className:"accordion-item "+(u?"":"collapsed")},l.createElement("div",{className:"accordion-content"},r)))},po=e=>{var a,i,r,u,s;let{t:c}=e;const d=o.useHistory(),[m,v]=n.useState(""),p=Digit.ULBService.getCitizenCurrentTenant(),E=so(m,700),{data:g,isLoading:f}=Digit.Hooks.engagement.useDocSearch({name:E,tenantIds:p},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}});if(null===(a=Digit.UserService)||void 0===a||null===(i=a.getUser())||void 0===i||!i.access_token)return l.createElement(Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:location.pathname+location.search}}});const h=(e,t)=>{d.push("documents/list/"+e+"/"+t)};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,c("DOCUMENTS_DOCUMENT_HEADER")),l.createElement("div",{className:"Docs_CardWrapper"},l.createElement(uo,{searchValue:m,handleKeyPress:e=>{"Enter"===e.key&&v("")},handleSearch:e=>{v("")},onChange:v,t:c}),l.createElement("hr",{style:{color:"#ccc"}}),f?l.createElement(t.Loader,null):l.createElement("div",{className:"wrapper"},m.length&&null!=g&&null!==(r=g.documentList)&&void 0!==r&&r.length?mo(g.documentList,c):null!=g&&g.statusCount&&null!=g&&null!==(u=g.statusCount)&&void 0!==u&&u.length?null==g||null===(s=g.statusCount)||void 0===s?void 0:s.map((e,t)=>{let{category:n,count:a}=e;return l.createElement(vo,{t:c,title:n,count:a,key:t,onClick:h})}):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))))},Eo=e=>{const{t:n}=a.useTranslation(),{applicationNumber:o,tenantId:i}=Digit.Hooks.useQueryParams(),{data:r,isLoading:u}=Digit.Hooks.engagement.useDocSearch({uuid:o,tenantId:i},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}}),{documentList:s=[]}=r||{},{name:c=!1,createdTime:d,description:m,documentLink:v,fileSize:p,filestoreId:E}=(null==s?void 0:s[0])||{};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,""+n("COMMON_VIEW_DOC")),u&&l.createElement(t.Loader,null),c&&l.createElement(co,{key:1,documentTitle:c,documentSize:p,lastModifiedData:d,description:m,documentLink:v,filestoreId:E,t:n}),!c&&!u&&l.createElement(t.Card,null,l.createElement(t.CardCaption,null,n("COMMON_DOC_DATA_NOT_FOUND"))))},go=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.mutation.isSuccess?"SURVEY_RESPONSE_SUBMITED":"SURVEY_RESPONSE_FAILED"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Surveys)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.mutation.isSuccess?e.surveyTitle:"",successful:e.mutation.isSuccess,whichSvg:"tick"});var o,i,r,u},fo=e=>{var i;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useSubmitResponse()),{state:d}=e.location,m=null==d||null===(i=d.AnswerEntity)||void 0===i?void 0:i.surveyTitle;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading&&!c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(go,{t:s,mutation:c,surveyTitle:m}),l.createElement(t.CardText,null,c.isSuccess?s("SURVEY_FORM_RESPONSE_MESSAGE"):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen/engagement/surveys/list"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ho=e=>{var r,u,s;const{userType:c}=e,m=o.useHistory(),{t:v}=a.useTranslation(),p=Digit.UserService.getUser().info;console.log("userinfo",p);const E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS");let g=E.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});const f="employee"===c.toLowerCase()?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY");if(0===(null===(r=g)||void 0===r?void 0:r.length)||"pb.punjab"===f){let e={i18nKey:"TENANT_TENANTS_"+f.replace(".","_").toUpperCase(),code:""+f};g="pb.punjab"===f?[e,...E]:[e]}const[h,y]=n.useState(!1),[S,_]=n.useState(null),[C,b]=n.useState([]),T={city:null===(u=g)||void 0===u?void 0:u[0],offset:0,limit:10,sortOrder:"DESC"},{register:D,control:N,handleSubmit:A,formState:{},watch:w}=i.useForm({defaultValues:T}),x=w(),I=e=>l.createElement("span",{className:"cell-text styled-cell"},e),L=n.useMemo(()=>[{Header:v("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",null,t.original.surveyTitle))}},{Header:v("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?I(we(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:v("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?I(we(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:v("Fill Survey"),accessor:"fillSurvey",Cell:e=>{let{row:n}=e;return l.createElement(t.SubmitBar,{label:v("Start Survey"),onSubmit:()=>{R(n.original)}})}}]);function O(){var e;y(!0);const t={tenantId:null==x||null===(e=x.city)||void 0===e?void 0:e.code,active:!0,openSurveyFlag:!0};Digit.Surveys.searchSurvey(t).then(e=>{let t=e.Surveys.filter(e=>e.active);t=t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),b(t),_(t.length),y(!1)}).catch(e=>{y(!1),console.error("Failed to fetch surveys",e)})}n.useEffect(()=>{O()},[]),console.log("userinfo",p);const R=e=>{console.log("Survey Details: ",e);const t={employee:"/digit-ui/employee/engagement/surveys/fill-citizen-details-survey",citizen:"/digit-ui/citizen/engagement/surveys/fill-survey"}[c.toLowerCase()]||"";m.push({pathname:t,state:{surveyDetails:e,userInfo:p,userType:c}})};return l.createElement("div",null,"pb.punjab"===f&&window.location.href.includes("/employee")?l.createElement(t.Card,{style:{marginTop:"16px",marginBottom:"16px",backgroundColor:"white",maxWidth:"99%"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{fontSize:"20px"}}," Search Surveys ")),l.createElement("hr",{style:{marginTop:"10px"}}),l.createElement("form",{className:"search-form-wrapper rm-mb form-field-flex-one",onSubmit:A(O)},l.createElement(t.SearchField,null,l.createElement("label",null,v("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,d({rules:{required:v("REQUIRED_FIELD")}},D("city"),{render:e=>l.createElement(t.Dropdown,{option:g,optionKey:"i18nKey",selected:null==x?void 0:x.city,select:t=>{e.onChange(t)},t:v}),name:"city",control:N,defaultValue:null===(s=g)||void 0===s?void 0:s[0]}))),l.createElement("div",{className:"form-field",style:{marginTop:"40px"}}," ",l.createElement(t.SubmitBar,{label:"Search",submit:"submit",onSubmit:O})))):null,l.createElement(t.Table,{t:v,data:C,totalRecords:S,columns:L,getCellProps:e=>({style:{minWidth:"300px",padding:"20px 18px",fontSize:"16px"}}),noResultsMessage:"No Questions found",inboxStyles:{overflowX:"scroll",overflowY:"hidden"}}),h&&l.createElement(t.Loader,null))},yo=e=>l.createElement("h1",{className:"heading-m"},e.label),So=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_o=e=>l.createElement("div",{onClick:null==e?void 0:e.onClick,style:null!=e&&e.isMobileView?{padding:5,cursor:"pointer"}:{cursor:"pointer"}},null!=e&&e.isMobileView?l.createElement(t.CloseSvg,null):l.createElement("div",{className:"icon-bg-secondary",style:{backgroundColor:"#505A5F"}}," ",l.createElement(So,null)," ")),Co=e=>{let{onSelect:n,onCancel:o,onDismiss:i,heading:r,actionCancel:u,content:s,hideSubmit:c}=e;const{t:d}=a.useTranslation(),[m,v]=l.useState(window.innerWidth<=780),p=()=>{window.innerWidth<=780?m||v(!0):m&&v(!1)};return l.useEffect(()=>(window.addEventListener("resize",()=>{p()}),()=>{window.addEventListener("resize",()=>{p()})})),m?l.createElement(t.Modal,{popupStyles:{height:"174px",maxHeight:"174px",width:"324px",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},popupModuleActionBarStyles:{display:"flex",flex:1,justifyContent:"flex-start",width:"100%",position:"absolute",left:0,bottom:0,padding:"18px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},popupModuleMianStyles:{padding:"18px"},headerBarMain:l.createElement(yo,{label:d(r)}),headerBarEnd:l.createElement(_o,{onClick:i,isMobileView:m}),actionCancelLabel:!!u&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{margin:0}}," ",s))):l.createElement(t.Modal,{popupModuleMianStyles:{paddingTop:"30px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},headerBarMain:l.createElement(yo,{label:d(r)}),headerBarEnd:l.createElement(_o,{onClick:i,isMobileView:!1}),actionCancelLabel:!!u&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{marginBottom:"54px",marginLeft:"8px",marginRight:"8px"}},s)))},bo=e=>{const{t:r}=a.useTranslation(),[u,s]=n.useState({}),{data:c}=Digit.Hooks.useTenants(),[m,v]=n.useState(null),[p,E]=n.useState(!1),[g,f]=n.useState(!1),[h,y]=n.useState(null),[S,_]=n.useState(!1),[C,b]=n.useState({latitude:null,longitude:null}),[T,D]=n.useState(),[N,A]=n.useState(""),[w,x]=n.useState(!1),I=(Digit.ULBService.getCurrentTenantId(),e.location.state),[L,O]=n.useState(null);console.log("city",localStorage.getItem("CITIZEN.CITY")),n.useEffect(()=>{try{return E(!0),Promise.resolve(Digit.LocationService.getLocalities(m)).then(function(e){E(!1);let t=[];e&&e.TenantBoundary.length>0&&(E(!0),t=Digit.LocalityService.get(e.TenantBoundary[0]),E(!1)),y(t)})}catch(e){Promise.reject(e)}},[m]),n.useEffect(()=>{!function(){try{const e=function(){var e;if("EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase())return E(!0),Promise.resolve(Digit.LocationService.getLocalities(null===(e=I.citizenData.city)||void 0===e?void 0:e.code)).then(function(e){E(!1);let t=[];e&&e.TenantBoundary.length>0&&(E(!0),t=Digit.LocalityService.get(e.TenantBoundary[0]),E(!1)),y(t)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]);const{register:R,formState:{}}=i.useForm({defaultValues:u}),[P,M]=n.useState(null),[F,k]=n.useState(null),B=e.userType,U=o.useHistory(),[H,V]=n.useState(!1),W=n.useRef({});let q=I.surveyDetails;console.log("data",q),q=d({},q,{sections:q.sections.sort((e,t)=>e.sectionOrder-t.sectionOrder).map(e=>d({},e,{questions:e.questions.sort((e,t)=>e.qorder-t.qorder).map(e=>d({},e,{question:d({},e.question,{options:e.question.options.sort((e,t)=>(null==e?void 0:e.optionOrder)-(null==t?void 0:t.optionOrder))})}))}))});const j=function(e){try{var t,n;E(!0);let l={surveyUuid:q.uuid,citizenId:I.userInfo.uuid,tenantId:null===m&&window.location.href.includes("/employee")?null==I||null===(t=I.citizenData)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code:m};try{Digit.Surveys.getAnswers(l).then(t=>{if(E(!1),(null==t?void 0:t.sectionResponses.length)>0){let n={};return t.sectionResponses.forEach(e=>{let t={};e.questionResponses.forEach(n=>{t[n.questionUuid]=d({},u[e.sectionUuid][n.questionUuid],{answerUuid:n.answerUuid})}),n[e.sectionUuid]=t}),s(n),void("draft"===e?Z():$())}"draft"===e?Z():$()})}catch(e){return E(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}};n.useEffect(()=>{!function(){try{var e,t;E(!0);let n={surveyUuid:q.uuid,citizenId:I.userInfo.uuid,tenantId:null==m?window.location.href.includes("/employee")?null==I||null===(e=I.citizenData)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code:localStorage.getItem("CITIZEN.CITY"):m};try{Digit.Surveys.getAnswers(n).then(e=>{if(D(e),E(!1),(null==e?void 0:e.sectionResponses.length)>0){if("Draft"==e.status&&(f(!1),"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()?Y():z()),"Submit"===e.status)return f(!0),_(!0),void V(l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"This Survey is already submitted. Cannot be reSubmitted"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to go back"),l.createElement("button",{onClick:()=>"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()?U.push("/digit-ui/citizen/engagement/surveys/active-open-surveys"):U.push("/digit-ui/employee/engagement/surveys/active-open-surveys"),style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Go Back")));let t={};return e.sectionResponses.forEach(e=>{let n={};e.questionResponses.forEach(e=>{n[e.questionUuid]={answer:e.answerResponse.answerDetails[0].answerContent,answerUuid:e.answerUuid,comments:e.comments,weightage:e.answerResponse.answerDetails[0].weightage}}),t[e.sectionUuid]=n}),void s(t)}"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()?Y():z()})}catch(e){return E(!1),Promise.resolve(e)}Promise.resolve()}catch(e){return Promise.reject(e)}}()},[q.uuid,I.userInfo.uuid]);const z=function(){try{return navigator.geolocation.getCurrentPosition(e=>{x(!0),b({latitude:e.coords.latitude,longitude:e.coords.longitude})},e=>{if(1===e.code)return x(!1),void alert("Location access is mandatory. Without it, we cannot proceed.");x(!1)}),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{var e,t,n;E(!0);const l={uuid:[null==I||null===(e=I.userInfo)||void 0===e?void 0:e.uuid],tenantId:null==I||null===(t=I.userInfo)||void 0===t?void 0:t.tenantId},a={tenantId:null==I||null===(n=I.userInfo)||void 0===n?void 0:n.tenantId};return Digit.Surveys.userSearch(l,a).then(e=>{var t,n,l,a,o,i,r,u;if(E(!1),("200"===(null==e||null===(t=e.responseInfo)||void 0===t?void 0:t.status)||"201"===(null==e||null===(n=e.responseInfo)||void 0===n?void 0:n.status))&&(null==e?void 0:e.user.length)>0)if(null===(null==e||null===(l=e.user[0])||void 0===l?void 0:l.gender)||null===(null==e||null===(a=e.user[0])||void 0===a?void 0:a.emailId)||null===(null==e||null===(o=e.user[0])||void 0===o?void 0:o.dob)||""===(null==e||null===(i=e.user[0])||void 0===i?void 0:i.gender)||""===(null==e||null===(r=e.user[0])||void 0===r?void 0:r.emailId)||""===(null==e||null===(u=e.user[0])||void 0===u?void 0:u.dob))O(!1);else{var s;const t=new Date,n=new Date(null==e||null===(s=e.user[0])||void 0===s?void 0:s.dob);let l=t.getFullYear()-n.getFullYear();const a=t.getMonth()-n.getMonth();if((a<0||0===a&&t.getDate()<n.getDate())&&l--,l<15||l>100)return O(!1),void alert("Citizen age must be between 15 and 100 years.");O(!0),z()}else M({key:!0,isError:!0,label:"ERROR FILE FETCHING CITIZEN DETAILS"})}).catch(e=>(E(!1),e)),Promise.resolve()}catch(e){return Promise.reject(e)}},G=(e,t,n,l,a,o)=>{s(i=>{var r;return d({},i,{[e]:d({},i[e],{[t]:d({},null==i||null===(r=i[e])||void 0===r?void 0:r[t],{answer:a,answerUuid:o,answerType:n,weightage:"MULTIPLE_ANSWER_TYPE"===n||"CHECKBOX_ANSWER_TYPE"===n||"DROP_DOWN_MENU_ANSWER_TYPE"===n?l:null})})})})},K=(e,t,n)=>{s(l=>{var a;return d({},l,{[e]:d({},l[e],{[t]:d({},null==l||null===(a=l[e])||void 0===a?void 0:a[t],{comments:n})})})})},[Q,X]=n.useState({});n.useEffect(()=>{const e=setInterval(()=>{JSON.stringify(W.current)!==JSON.stringify(u)&&(I.citizenFill&&"employee"===B.toLowerCase()||"citizen"===B.toLowerCase())&&(W.current=u,F&&j("draft"))},1e4);return()=>clearInterval(e)},[u]);const Z=function(){try{var e,t,n,l,a,o,i,r,s;E(!0);let d=[];for(const e in u)for(const t in u[e]){var c;d.push({uuid:u[e][t].answerUuid,surveyUuid:q.uuid,questionUuid:t,sectionUuid:e,comments:(null===(c=u[e][t])||void 0===c?void 0:c.comments)||"",answerDetails:[{answerType:u[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===u[e][t].answerType?u[e][t].answer.join(","):u[e][t].answer,weightage:u[e][t].weightage}]})}let v={User:{type:I.userInfo.type,uuid:I.userInfo.uuid,gender:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(e=I.citizenData)||void 0===e?void 0:e.gender:I.userInfo.gender,emailId:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(t=I.citizenData)||void 0===t?void 0:t.email:I.userInfo.emailId,dob:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(n=I.citizenData)||void 0===n?void 0:n.dob:I.userInfo.dob},SurveyResponse:{surveyUuid:q.uuid,tenantId:null===m?window.location.href.includes("/employee")?null==I||null===(l=I.citizenData)||void 0===l||null===(a=l.city)||void 0===a?void 0:a.code:localStorage.getItem("CITIZEN.CITY"):m,city:null===m?window.location.href.includes("/employee")?null==I||null===(o=I.citizenData)||void 0===o||null===(i=o.city)||void 0===i?void 0:i.code:localStorage.getItem("CITIZEN.CITY"):m,locality:F,tenantId:null===m?window.location.href.includes("/employee")?null==I||null===(r=I.citizenData)||void 0===r||null===(s=r.city)||void 0===s?void 0:s.code:localStorage.getItem("CITIZEN.CITY"):m,status:"Draft",coordinates:C.latitude+","+C.longitude,answers:d}};try{Digit.Surveys.submitSurvey(v).then(e=>{var t;E(!1),void 0!==(null==e?void 0:e.SubmitResponse)||M({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)})})}catch(e){return E(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}},$=()=>{var e,t,n,l,a,o,i;E(!0);let r=[];for(const e in u)for(const t in u[e]){var s,c,d;r.push({uuid:u[e][t].answerUuid,surveyUuid:q.uuid,questionUuid:t,sectionUuid:e,comments:(null===(s=u[e][t])||void 0===s?void 0:s.comments)||"",tenantId:window.location.href.includes("/employee")?null==I||null===(c=I.citizenData)||void 0===c||null===(d=c.city)||void 0===d?void 0:d.code:localStorage.getItem("CITIZEN.CITY"),answerDetails:[{answerType:u[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===u[e][t].answerType?u[e][t].answer.join(","):u[e][t].answer,weightage:u[e][t].weightage}]})}let v={User:{type:I.userInfo.type,uuid:I.userInfo.uuid,gender:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(e=I.citizenData)||void 0===e?void 0:e.gender:I.userInfo.gender,emailId:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(t=I.citizenData)||void 0===t?void 0:t.email:I.userInfo.emailId,dob:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(n=I.citizenData)||void 0===n?void 0:n.dob:I.userInfo.dob},SurveyResponse:{surveyUuid:q.uuid,status:"Submit",locality:F,coordinates:C.latitude+","+C.longitude,tenantId:null===m?window.location.href.includes("/employee")?null==I||null===(l=I.citizenData)||void 0===l||null===(a=l.city)||void 0===a?void 0:a.code:localStorage.getItem("CITIZEN.CITY"):m,city:null===m?window.location.href.includes("/employee")?null==I||null===(o=I.citizenData)||void 0===o||null===(i=o.city)||void 0===i?void 0:i.code:localStorage.getItem("CITIZEN.CITY"):m,answers:r}};try{Digit.Surveys.submitSurvey(v).then(e=>{var t;E(!1),void 0===(null==e?void 0:e.SubmitResponse)?M({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)}):"EMPLOYEE"===B.toUpperCase()?U.push("/digit-ui/employee/engagement/surveys/submit-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0}):U.push("/digit-ui/citizen/engagement/surveys/submit-survey-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0})})}catch(e){return E(!1),e}},[J,ee]=n.useState({latitude:null,longitude:null});n.useEffect(()=>{if(T){const e=null!=T&&T.tenantId?null==T?void 0:T.tenantId:localStorage.getItem("CITIZEN.CITY");e&&v(e)}},[T]),console.log("city",m);const te=e=>{k(e.target.value)};function ne(){_(!1)}return n.useEffect(()=>{T&&k(null==T?void 0:T.locality)},[T]),!0===g&&S?l.createElement(Co,{onSelect:function(){_(!1)},onCancel:ne,onDismiss:ne,heading:"Survey already Submitted!",actionCancel:!1,content:H,hideSubmit:!0}):("EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()||null!=I&&I.citizenFill)&&!0===w||"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()&&!0===L&&!0===w?l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},q.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},q.surveyDescription))),"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?l.createElement(n.Fragment,null,l.createElement(t.CardLabel,null,""+r("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:F,onChange:e=>{te(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==h&&l.createElement(n.Fragment,null,h.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),Q&&Q.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.locality.answerRequired)):l.createElement(n.Fragment,null,l.createElement(t.CardLabel,null,""+r("CITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:m,onChange:e=>{(e=>{v(e.target.value)})(e)},disabled:"pb.punjab"!==localStorage.getItem("CITIZEN.CITY")},l.createElement("option",{value:""},"--Please choose a city--"),c.map((e,t)=>l.createElement("option",{key:t,value:e.code},null==e?void 0:e.name))),Q&&Q.city&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.city.answerRequired),l.createElement(t.CardLabel,null,""+r("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:F,onChange:e=>{te(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==m&&null!==h&&l.createElement(n.Fragment,null,h.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),Q&&Q.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.locality.answerRequired)),l.createElement("form",{onSubmit:e=>{e.preventDefault(),I.citizenFill&&"employee"===(null==I?void 0:I.userType).toLowerCase()||"citizen"===(null==I?void 0:I.userType).toLowerCase()?(()=>{const e={};return q.sections.forEach(t=>{t.questions.forEach(n=>{var l,a,o,i;const r=null===(l=u[t.uuid])||void 0===l?void 0:l[n.question.uuid||""];var s,c,m;!0===n.required&&0===(null==r||null===(a=r.answer)||void 0===a?void 0:a.length)&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(s=e[t.uuid])||void 0===s?void 0:s[n.question.uuid],{answerRequired:n.question.questionStatement+" is required*"})})),(null==r||null===(o=r.answer)||void 0===o?void 0:o.length)>500&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(c=e[t.uuid])||void 0===c?void 0:c[n.question.uuid],{answerLength:"Answer length allowed only to 500 characters*"})})),(null==r||null===(i=r.comments)||void 0===i?void 0:i.length)>500&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(m=e[t.uuid])||void 0===m?void 0:m[n.question.uuid],{commentsLength:"Comments length allowed only to 500 characters*"})}))})}),null===F&&(e.locality={answerRequired:"Please select your locality"}),"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()&&null===m&&(e.city={answerRequired:"Please select your city"}),X(e),0===Object.keys(e).length})()&&j("submit"):M({key:!0,isError:!0,label:"PLEASE FILL CITIZEN DETAILS"})}},q.sections.length>0?q.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((a,o)=>l.createElement("div",null,l.createElement("h3",null,a.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},o+1,". ",a.question.questionStatement," ",(null==a?void 0:a.required)&&l.createElement("span",{style:{color:"red"}},"*")),((e,a,o)=>{var i,c,m,v,p,E,g,f,h,y,S,_,C,b,T,D,N,A,w,x,I,L,O,P,M,F,k,B,U,H,V,W,q,j,z,Y,X,Z,$,J,ee,te,ne,le,ae,oe,ie,re,ue,se,ce,de,me,ve,pe,Ee,ge,fe,he,ye,Se,_e,Ce,be,Te,De,Ne,Ae,we,xe,Ie,Le,Oe,Re,Pe,Me,Fe,ke,Be,Ue,He,Ve,We,qe,je,ze,Ye,Ge,Ke,Qe,Xe,Ze,$e,Je,et,tt,nt,lt,at,ot,it,rt,ut,st,ct,dt,mt,vt;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,textInputStyle:{maxWidth:"none"},value:null===(i=u[o.uuid])||void 0===i||null===(c=i[a.uuid])||void 0===c?void 0:c.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},type:"text",inputRef:R({maxLength:{value:200,message:r("EXCEEDS_200_CHAR_LIMIT")},required:a.required})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(m=Q[o.uuid])||void 0===m||null===(v=m[a.uuid])||void 0===v?void 0:v.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(p=Q[o.uuid])||void 0===p||null===(E=p[a.uuid])||void 0===E?void 0:E.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(g=Q[o.uuid])||void 0===g||null===(f=g[a.uuid])||void 0===f?void 0:f.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(h=Q[o.uuid])||void 0===h||null===(y=h[a.uuid])||void 0===y?void 0:y.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(S=u[o.uuid])||void 0===S||null===(_=S[a.uuid])||void 0===_?void 0:_.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(C=Q[o.uuid])||void 0===C||null===(b=C[a.uuid])||void 0===b?void 0:b.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(T=Q[o.uuid])||void 0===T||null===(D=T[a.uuid])||void 0===D?void 0:D.commentsLength));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},value:null===(N=u[o.uuid])||void 0===N||null===(A=N[a.uuid])||void 0===A?void 0:A.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")},required:a.required})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(w=Q[o.uuid])||void 0===w||null===(x=w[a.uuid])||void 0===x?void 0:x.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(I=Q[o.uuid])||void 0===I||null===(L=I[a.uuid])||void 0===L?void 0:L.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(O=Q[o.uuid])||void 0===O||null===(P=O[a.uuid])||void 0===P?void 0:P.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(M=Q[o.uuid])||void 0===M||null===(F=M[a.uuid])||void 0===F?void 0:F.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(k=u[o.uuid])||void 0===k||null===(B=k[a.uuid])||void 0===B?void 0:B.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(U=Q[o.uuid])||void 0===U||null===(H=U[a.uuid])||void 0===H?void 0:H.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(V=Q[o.uuid])||void 0===V||null===(W=V[a.uuid])||void 0===W?void 0:W.commentsLength));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:null===(q=u[o.uuid])||void 0===q||null===(j=q[a.uuid])||void 0===j?void 0:j.answer,onChange:e=>{var t,n;const l=a.options.find(t=>t.optionText===e.target.value);G(o.uuid,a.uuid,a.type,(null==l?void 0:l.weightage)||0,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(z=Q[o.uuid])||void 0===z||null===(Y=z[a.uuid])||void 0===Y?void 0:Y.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(X=Q[o.uuid])||void 0===X||null===(Z=X[a.uuid])||void 0===Z?void 0:Z.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===($=Q[o.uuid])||void 0===$||null===(J=$[a.uuid])||void 0===J?void 0:J.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ee=Q[o.uuid])||void 0===ee||null===(te=ee[a.uuid])||void 0===te?void 0:te.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ne=u[o.uuid])||void 0===ne||null===(le=ne[a.uuid])||void 0===le?void 0:le.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ae=Q[o.uuid])||void 0===ae||null===(oe=ae[a.uuid])||void 0===oe?void 0:oe.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ie=Q[o.uuid])||void 0===ie||null===(re=ie[a.uuid])||void 0===re?void 0:re.commentsLength));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,checked:(null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer)===e.optionText,onChange:t=>{var n,l;return G(o.uuid,a.uuid,a.type,e.weightage,t.target.value,null===(n=u[o.uuid])||void 0===n||null===(l=n[a.uuid])||void 0===l?void 0:l.answerUuid)},required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText)})),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ue=Q[o.uuid])||void 0===ue||null===(se=ue[a.uuid])||void 0===se?void 0:se.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ce=Q[o.uuid])||void 0===ce||null===(de=ce[a.uuid])||void 0===de?void 0:de.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(me=Q[o.uuid])||void 0===me||null===(ve=me[a.uuid])||void 0===ve?void 0:ve.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(pe=Q[o.uuid])||void 0===pe||null===(Ee=pe[a.uuid])||void 0===Ee?void 0:Ee.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ge=u[o.uuid])||void 0===ge||null===(fe=ge[a.uuid])||void 0===fe?void 0:fe.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(he=Q[o.uuid])||void 0===he||null===(ye=he[a.uuid])||void 0===ye?void 0:ye.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Se=Q[o.uuid])||void 0===Se||null===(_e=Se[a.uuid])||void 0===_e?void 0:_e.commentsLength));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,checked:(null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer.includes(e.optionText))||!1,onChange:t=>{const n=t.target.value,l=t.target.checked;s(t=>{var i,r,s,c,m,v;const p=l?[...(null===(i=t[o.uuid])||void 0===i||null===(r=i[a.uuid])||void 0===r?void 0:r.answer)||"",n]:((null===(s=t[o.uuid])||void 0===s||null===(c=s[a.uuid])||void 0===c?void 0:c.answer)||"").filter(e=>e!==n);return d({},t,{[o.uuid]:d({},t[o.uuid],{[a.uuid]:{answer:p,answerUuid:null===(m=u[o.uuid])||void 0===m||null===(v=m[a.uuid])||void 0===v?void 0:v.answerUuid,answerType:a.type,weightage:e.weightage}})})})}}),e.optionText)})),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ce=Q[o.uuid])||void 0===Ce||null===(be=Ce[a.uuid])||void 0===be?void 0:be.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Te=Q[o.uuid])||void 0===Te||null===(De=Te[a.uuid])||void 0===De?void 0:De.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ne=Q[o.uuid])||void 0===Ne||null===(Ae=Ne[a.uuid])||void 0===Ae?void 0:Ae.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(we=Q[o.uuid])||void 0===we||null===(xe=we[a.uuid])||void 0===xe?void 0:xe.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(Ie=u[o.uuid])||void 0===Ie||null===(Le=Ie[a.uuid])||void 0===Le?void 0:Le.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Oe=Q[o.uuid])||void 0===Oe||null===(Re=Oe[a.uuid])||void 0===Re?void 0:Re.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Pe=Q[o.uuid])||void 0===Pe||null===(Me=Pe[a.uuid])||void 0===Me?void 0:Me.commentsLength));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},value:null===(Fe=u[o.uuid])||void 0===Fe||null===(ke=Fe[a.uuid])||void 0===ke?void 0:ke.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Be=Q[o.uuid])||void 0===Be||null===(Ue=Be[a.uuid])||void 0===Ue?void 0:Ue.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(He=Q[o.uuid])||void 0===He||null===(Ve=He[a.uuid])||void 0===Ve?void 0:Ve.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(We=Q[o.uuid])||void 0===We||null===(qe=We[a.uuid])||void 0===qe?void 0:qe.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(je=Q[o.uuid])||void 0===je||null===(ze=je[a.uuid])||void 0===ze?void 0:ze.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(Ye=u[o.uuid])||void 0===Ye||null===(Ge=Ye[a.uuid])||void 0===Ge?void 0:Ge.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ke=Q[o.uuid])||void 0===Ke||null===(Qe=Ke[a.uuid])||void 0===Qe?void 0:Qe.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Xe=Q[o.uuid])||void 0===Xe||null===(Ze=Xe[a.uuid])||void 0===Ze?void 0:Ze.commentsLength));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},value:null===($e=u[o.uuid])||void 0===$e||null===(Je=$e[a.uuid])||void 0===Je?void 0:Je.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(et=Q[o.uuid])||void 0===et||null===(tt=et[a.uuid])||void 0===tt?void 0:tt.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(nt=Q[o.uuid])||void 0===nt||null===(lt=nt[a.uuid])||void 0===lt?void 0:lt.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(at=Q[o.uuid])||void 0===at||null===(ot=at[a.uuid])||void 0===ot?void 0:ot.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(it=Q[o.uuid])||void 0===it||null===(rt=it[a.uuid])||void 0===rt?void 0:rt.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ut=u[o.uuid])||void 0===ut||null===(st=ut[a.uuid])||void 0===st?void 0:st.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ct=Q[o.uuid])||void 0===ct||null===(dt=ct[a.uuid])||void 0===dt?void 0:dt.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(mt=Q[o.uuid])||void 0===mt||null===(vt=mt[a.uuid])||void 0===vt?void 0:vt.commentsLength));default:return l.createElement(t.TextInput,{name:a.uuid,onChange:e=>G(o.uuid,a.uuid,e.target.value),type:"text",inputRef:R({maxLength:{value:200,message:r("EXCEEDS_200_CHAR_LIMIT")},required:a.required})})}})(a.question.type,a.question,e),Q[a.uuid]&&l.createElement("span",{className:"error"},Q[a.uuid]),l.createElement("div",null)))))):null,l.createElement("button",{type:"submit",style:{marginLeft:"10px"}},"Submit"))),P&&l.createElement(t.Toast,{error:P.isError,label:r(P.label),onClose:()=>{M(null)},isDleteBtn:"false"})):"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()&&!1===L?l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"Please fill in your basic details to proceed with the survey"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to fill in your details"),l.createElement("button",{onClick:()=>U.push("/digit-ui/citizen/user/profile"),style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Fill your details : Name, Gender, DOB and Email are required"),p&&l.createElement(t.Loader,null)):null},To=e=>{var n,o;const{t:i}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Do=e=>{const{t:n}=a.useTranslation();return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(To,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},No=e=>{let{path:n,userType:i}=e;const r=o.useLocation(),{t:u}=a.useTranslation(),s=Digit.ComponentRegistryService.getComponent("NotificationsAndWhatsNew"),c=Digit.ComponentRegistryService.getComponent("EventsListOnGround"),m=Digit.ComponentRegistryService.getComponent("EventDetails"),v=Digit.ComponentRegistryService.getComponent("DocumentList"),p=Digit.ComponentRegistryService.getComponent("SurveyList"),E=(Digit.ComponentRegistryService.getComponent("FillSurvey"),Digit.ComponentRegistryService.getComponent("ShowSurvey"));return l.createElement(l.Fragment,null,l.createElement("div",{className:"engagement-citizen-wrapper"},!r.pathname.includes("response")&&l.createElement(t.BackButton,null,u("CS_COMMON_BACK")),l.createElement(o.Switch,null,l.createElement(o.Route,{path:n+"/notifications",component:()=>l.createElement(s,{variant:"notifications",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/whats-new",component:()=>l.createElement(s,{variant:"whats-new",parentRoute:n})}),l.createElement(t.PrivateRoute,{exact:!0,path:n+"/events",component:()=>l.createElement(c,{variant:"events",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/events/details/:id",component:()=>l.createElement(m,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/docs",component:()=>l.createElement(po,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/viewDocument",component:()=>l.createElement(Eo,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/list/:category/:count",component:e=>l.createElement(v,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/list",component:e=>l.createElement(p,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-response",component:e=>l.createElement(fo,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/show-survey",component:e=>l.createElement(E,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/active-open-surveys",component:e=>l.createElement(ho,d({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/fill-survey",component:e=>l.createElement(bo,d({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-survey-response",component:e=>l.createElement(Do,e)}))))},Ao=[{body:[{type:"form",key:"ULB",component:"EngagementDocSelectULB",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],wo=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u]=n.useState(!1);return l.createElement("div",null,l.createElement(t.Header,null,e("ES_ENGAGEMENT_DOCUMENTS")),l.createElement(t.FormComposer,{label:e("ES_COMMON_APPLICATION_SUBMIT"),config:Ao,onSubmit:e=>{var t,n,l,a,o,r,u,s;const c={name:e.documentName,description:null!=e&&e.description.length?e.description:"",category:null===(t=e.docCategory)||void 0===t?void 0:t.name,documentLink:null===(n=e.document)||void 0===n?void 0:n.documentLink,filestoreId:null===(l=e.document)||void 0===l||null===(a=l.filestoreId)||void 0===a?void 0:a.fileStoreId,fileSize:null===(o=e.document)||void 0===o||null===(r=o.filestoreId)||void 0===r?void 0:r.fileSize,fileType:null===(u=e.document)||void 0===u||null===(s=u.filestoreId)||void 0===s?void 0:s.fileType,tenantIds:e.ULB.map(e=>e.code)};i.push("/digit-ui/employee/engagement/documents/response",{DocumentEntity:c})},fieldStyle:{},onFormValueChange:(e,t,n)=>{var l;null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&null!==(l=t.ULB)&&void 0!==l&&l.length?u(!0):u(!1)},isDisabled:!r}))},xo=[{body:[{type:"form",key:"ULB",component:"EngagementULBDropdown",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],Io=e=>{var i;const{t:r}=a.useTranslation(),u=o.useHistory(),[s,c]=n.useState(!1),m=n.useCallback((e,t,n)=>{null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&t.ULB&&Object.keys(null==t?void 0:t.ULB).length?c(!0):c(!1)},[]);return l.createElement(l.Fragment,null,l.createElement(t.Header,null,r("ES_ENGAGEMENT_EDIT_DOC")),l.createElement(t.FormComposer,{label:r("ES_COMMON_UPDATE"),config:xo,onSubmit:t=>{(t=>{var n,l,a,o,i,r,s,c,m,v,p,E,g,f,h,y,S,_,C;const b=null!==(n=t.document)&&void 0!==n&&null!==(l=n.filestoreId)&&void 0!==l&&l.fileSize?null===(a=t.document)||void 0===a||null===(o=a.filestoreId)||void 0===o?void 0:o.fileSize:null===(i=e.location.state)||void 0===i||null===(r=i.DocumentEntity)||void 0===r?void 0:r.fileSize,T=null!==(s=t.document)&&void 0!==s&&null!==(c=s.filestoreId)&&void 0!==c&&c.fileType?null===(m=t.document)||void 0===m||null===(v=m.filestoreId)||void 0===v?void 0:v.fileType:null===(p=e.location.state)||void 0===p||null===(E=p.DocumentEntity)||void 0===E?void 0:E.fileType,D=d({},null===(g=e.location)||void 0===g||null===(f=g.state)||void 0===f?void 0:f.DocumentEntity,{name:t.documentName,description:null!=t&&t.description.length?t.description:"",category:null===(h=t.docCategory)||void 0===h?void 0:h.name,filestoreId:null===(y=t.document)||void 0===y||null===(S=y.filestoreId)||void 0===S?void 0:S.fileStoreId,fileSize:b,fileType:T,documentLink:null===(_=t.document)||void 0===_?void 0:_.documentLink,tenantId:null==t||null===(C=t.ULB)||void 0===C?void 0:C.code});delete D.ULB,delete D.docCategory,delete D.documentName,u.push("/digit-ui/employee/engagement/documents/update-response",{DocumentEntity:D})})(t)},fieldStyle:{},onFormValueChange:m,defaultValues:null===(i=e.location.state)||void 0===i?void 0:i.DocumentEntity,isDisabled:!s}))},Lo=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_CREATED":"ENGAGEMENT_DOC_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,u},Oo=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocCreate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{i.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Lo,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Ro=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_UPDATED":"ENGAGEMENT_DOC_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,u},Po=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocUpdate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{i.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Ro,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Mo=e=>{var n;const{t:o}=a.useTranslation();return l.createElement(t.Banner,{message:o(e.isSuccess?"ENGAGEMENT_DOC_DELETED":"ENGAGEMENT_DOC_DELETE_FAILURE"),applicationNumber:null!==(n=e.mutation)&&void 0!==n&&n.isSuccess?e.uuid:"",info:e.isSuccess?o("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess})},Fo=e=>{var i;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocDelete()),{state:d}=e.location;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Mo,{t:s,data:c.data,mutation:c,uuid:null==d||null===(i=d.DocumentEntity)||void 0===i?void 0:i.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ko=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p,onSort:E,sortParams:g}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,currentPage:d,onNextPage:m,onPrevPage:v,pageSizeLimit:s,onPageSizeChange:p,getCellProps:u,totalRecords:c,onSort:E,sortParams:g})},Bo=e=>{let{onSearch:a,searchParams:o,searchFields:r,type:u,onClose:s,isInboxPage:c,t:m}=e;const{handleSubmit:v,formState:p,reset:E,control:g}=i.useForm({defaultValues:o}),f=innerWidth<=640,h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),_=Digit.UserService.getUser().info,C=h.filter(e=>{var t;return null==_||null===(t=_.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),b=n.useMemo(()=>h.filter(e=>e.code===S),[S,h]),T=()=>{E({name:"",ulbs:{code:S.code},postedBy:""}),a({name:"",ulbs:{code:S.code},postedBy:""})},D=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:T},m("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:v(e=>{a(e),"mobile"===u&&s()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===u||f)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,m("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==r?void 0:r.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,m(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},defaultValue:null==b?void 0:b[0],render:e=>l.createElement(t.Dropdown,{option:C,optionKey:"i18nKey",selected:e.value,select:e.onChange,t:m}),name:e.name,control:g});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:g,defaultValue:null})}})(e)),null!=p&&null!==(a=p.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==p||null===(o=p.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===u&&!f&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:m("ES_COMMON_SEARCH"),submit:!0})),"desktop"===u&&!f&&l.createElement("div",{className:"document-clear-all"},D())))),("mobile"===u||f)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},D(f)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(p.errors).length,label:m("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Uo=e=>{let{type:o="desktop",onClose:i,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,m]=n.useState(()=>d({},u)),v=Digit.ULBService.getCurrentTenantId(),p=null==v?void 0:v.split(".")[0],E=Digit.ULBService.getCurrentUlb(),{data:g,isLoading:f}=Digit.Hooks.engagement.useMDMS(p,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===E.code))[0].categoryList.map(e=>({category:e}))}}),h=()=>{m({category:null,name:null,postedBy:null}),r({category:null,name:null,postedBy:null}),null==i||i()};return f?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:h},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:h},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:i},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+s("DOCUMENTS_CATEGORY_CARD_LABEL")),l.createElement(t.Dropdown,{option:g,optionKey:"category",selected:c,select:e=>{m(d({},c,e))},t:s}),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(r(c),void(null==i||i())),label:s("ES_COMMON_APPLY")}))))},Ho=e=>l.createElement("span",{className:"cell-text styled-cell"},e),Vo=e=>{let{isLoading:n,data:a,t:i,onSearch:r,title:u,iconName:s,links:c,onSort:d,sortParams:m,globalSearch:v,searchFields:p,searchParams:E,onFilterChange:g,pageSizeLimit:f,totalRecords:h,currentPage:y,onNextPage:S,onPrevPage:_,onPageSizeChange:C}=e;const D=l.useMemo(()=>[{Header:i("CE_TABLE_DOCUMENT_NAME"),accessor:e=>{return function(e,t,n){return void 0===e&&(e=""),l.createElement("span",{className:"document-table-docs-columns"},l.createElement(o.Link,{className:"link",to:t},e.length?e:n("CE_DOCUMENT_TITLE")))}(null==e?void 0:e.name,{pathname:"inbox/details/"+(t=e).name,state:{details:t}},i);var t}},{Header:i("DOCUMENTS_CATEGORY_CARD_LABEL"),accessor:e=>Ho(null!=e&&e.category?i(""+(null==e?void 0:e.category)):"")},{Header:i("CE_TABLE_DOCUMENT_LINK"),accessor:e=>function(e,t,n,a){return void 0===e&&(e="mSeva"),l.createElement("span",{className:"document-table-docs-columns"},null!=t&&t.length?l.createElement("span",{className:"link",onClick:()=>b(t,e)}," ",a("CE_DOCUMENT_VIEW_LINK")," "):null,n.length?l.createElement("span",{className:"link",onClick:()=>T(n,e)}," ",a("CE_DOCUMENT_OPEN_LINK")," "):null)}(null==e?void 0:e.name,e.filestoreId,e.documentLink||"",i)},{Header:i("CE_TABLE_DOCUMENT_POSTED_BY"),accessor:e=>Ho(e.postedBy)}],[]);let N;return n?N=l.createElement(t.Loader,null):a&&0!==(null==a?void 0:a.length)?(null==a?void 0:a.length)>0&&(N=l.createElement(ko,{t:i,data:a,columns:D,onSort:d,sortParams:m,globalSearch:v,onSearch:E,pageSizeLimit:f,totalRecords:h,currentPage:y,onNextPage:S,onPrevPage:_,onPageSizeChange:C,getCellProps:e=>({style:{minWidth:e.column.Header===i("CE_TABLE_DOCUMENT_NAME")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})):N=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},i("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},i("NEW_DOCUMENT_TEXT"))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:u,icon:s,links:c}),l.createElement("div",null,l.createElement(Uo,{onFilterChange:g,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(Bo,{t:i,onSearch:r,type:"desktop",searchFields:p,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},N)))},Wo=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i),h=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&E(!0)},[m]);const y=()=>{E(!1),f(i)};let _;return 0===(null==c?void 0:c.length)?_=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},s("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},s("NEW_DOCUMENT_TEXT"))):c&&(null==c?void 0:c.length)>0&&(_=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>S(t.postedBy,e["Posted By"])&&S(t.name,e["Document Name"]));t&&h.push("/digit-ui/employee/engagement/documents/inbox/details/"+(null==t?void 0:t.name),{details:t})}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),_,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Uo,{onFilterChange:r,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Bo,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:i,searchFields:a}))))},qo=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:a,icon:o,links:i}),l.createElement(Wo,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s;return(!((null==u||null===(t=u.tenantIds)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.tenantIds)||void 0===n?void 0:n.includes(e.tenantId)))&&(null==u||!u.name||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.name)||void 0===a?void 0:a.toUpperCase())))&&(null==u||!u.postedBy||(null===(o=e.postedBy)||void 0===o||null===(i=o.trim())||void 0===i?void 0:i.toLowerCase())===(null==u||null===(r=u.postedBy)||void 0===r||null===(s=r.trim())||void 0===s?void 0:s.toLowerCase()))&&(null==u||!u.category||e.category===(null==u?void 0:u.category))}).map(e=>({[n("CE_TABLE_DOCUMENT_NAME")]:null==e?void 0:e.name,[n("DOCUMENTS_CATEGORY_CARD_LABEL")]:n(""+(null==e?void 0:e.category)),[n("CE_TABLE_DOCUMENT_LINK")]:l.createElement("div",{className:"mobileInbox_attachments"},null!=e&&e.filestoreId?l.createElement("div",{className:"link",onClick:t=>{b(e.filestoreId,e.name)}},n("CE_DOCUMENT_VIEW_LINK")):null,null!=e&&e.documentLink?l.createElement("div",{className:"link",onClick:t=>{T(e.documentLink,e.name)}},n("CE_DOCUMENT_OPEN_LINK")):null),[n("CE_TABLE_DOCUMENT_POSTED_BY")]:null==e?void 0:e.postedBy})),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,responseData:t}))))},jo=e=>{let{tenants:o}=e;const{t:i}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o);const r=Digit.ULBService.getCurrentTenantId(),[u,s]=n.useState({tenantIds:r,offset:0,limit:10});let c=window.Digit.Utils.browser.isMobile();const{data:m,isLoading:v}=Digit.Hooks.engagement.useDocSearch(u,{select:e=>{let{Documents:t,totalCount:n}=e;return{documentsList:t,totalCount:n}}}),p=e=>{var t,n,l;const a=null!=e&&null!==(t=e.ulbs)&&void 0!==t&&null!==(n=t.code)&&void 0!==n&&n.length?null==e||null===(l=e.ulbs)||void 0===l?void 0:l.code:r,{name:o,postedBy:i}=e;s(e=>d({},e,{name:o,postedBy:i,tenantIds:a}))},E=e=>{s(t=>d({},t,e))},g=n.useCallback(()=>{s(e=>d({},e,{offset:parseInt(null==e?void 0:e.offset)+parseInt(null==e?void 0:e.limit)}))},[]);n.useEffect(()=>{s(e=>d({},e,{tenantIds:r}))},[r]);const f=()=>[{label:i("LABEL_FOR_ULB"),name:"ulbs",type:"ulb"},{label:i("DOCUMENTS_DOCUMENT_HEADER"),name:"name"},{label:i("CE_TABLE_DOCUMENT_POSTED_BY"),name:"postedBy"}],h=[{text:i("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/inbox/new-doc"}];return c?l.createElement(qo,{data:null==m?void 0:m.documentsList,searchParams:u,searchFields:f(),t:i,onFilterChange:E,onSearch:p,isLoading:v,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:h}):l.createElement("div",null,l.createElement(t.Header,null,i("DOCUMENTS_DOCUMENT_HEADER"),Number(null==m?void 0:m.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==m?void 0:m.totalCount)):null),l.createElement(Vo,{t:i,isLoading:v,data:null==m?void 0:m.documentsList,links:h,searchParams:u,onSearch:p,searchFields:f(),onFilterChange:E,pageSizeLimit:null==u?void 0:u.limit,totalRecords:null==m?void 0:m.totalCount,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:h,currentPage:parseInt(u.offset/u.limit),onNextPage:g,onPrevPage:()=>{s(e=>d({},e,{offset:parseInt(null==e?void 0:e.offset)-parseInt(null==e?void 0:e.limit)}))},onPageSizeChange:e=>{s(t=>d({},t,{limit:e.target.value}))}}))},zo=e=>{let{header:n,about:o,activeTime:i,postedAt:r,responseStatus:u,onCardClick:s}=e;const{t:c}=a.useTranslation();return l.createElement("div",{className:"WhatsNewCard",onClick:s},l.createElement("h2",null,n),l.createElement("p",null,o),l.createElement("div",{className:"surveyListclockDiv"},l.createElement(t.Clock,null)," ",l.createElement("span",null,"Active till "+we(new Date(i),"do MMM HH:mm"))),l.createElement("div",{className:"surveyListstatus"},l.createElement("p",null,function(e,t){return E(1,arguments),Le(e,Date.now(),t)}(new Date(r),{addSuffix:!0})),l.createElement("span",{className:"CS_SURVEY_RESPONDED"===u?"surveyLisResponded":"surveyLisNotResponded"},c(u))))},Yo=(e,t)=>{const n=(new Date).getTime();return e<n&&n<=t},Go=["EDIT_DOCUMENT","DELETE"],Ko=e=>{var o;let{location:i,history:r}=e,u=window.Digit.Utils.browser.isMobile();const{t:s}=a.useTranslation(),{details:c}=null==i?void 0:i.state,[m,v]=l.useState(!1),[p,E]=n.useState(!1),g=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentUlb()),f=Digit.ULBService.getStateId(),{data:h}=Digit.Hooks.engagement.useMDMS(f,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===g.code))[0].categoryList.map(e=>({name:e}))}});return l.createElement("div",null,p?l.createElement(Xa,{t:s,heading:"CONFIRM_DELETE_DOC",docName:null==c?void 0:c.name,closeModal:()=>E(!p),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){E(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:function(){E(!1);const e=d({},c);r.push({pathname:"/digit-ui/employee/engagement/documents/delete-response",state:{DocumentEntity:e}})}}):null,l.createElement(t.Header,null,s("CE_DOCUMENT_DETAILS")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("ULB")+":")," ",l.createElement("p",null,(e=>{var t,n;let l=null==e?void 0:e.split(".")[1];return l=""+(null===(t=l[0])||void 0===t?void 0:t.toUpperCase())+(null===(n=l)||void 0===n?void 0:n.slice(1))+" ",l})(null==c?void 0:c.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_NAME")+":")," ",l.createElement("p",null,null==c?void 0:c.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_CATEGORY")+":")," ",l.createElement("p",null,s(null==c?void 0:c.category))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DCOUMENT_DESCRIPTION")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=c&&null!==(o=c.description)&&void 0!==o&&o.length?null==c?void 0:c.description:"NA")," "),null!=c&&c.filestoreId?l.createElement("div",{className:"documentDetails_pdf"},l.createElement("span",{className:"documentDetails_subheader"},""+s("Document")),l.createElement("div",{style:{width:"100px"},onClick:()=>b(null==c?void 0:c.filestoreId,null==c?void 0:c.name)},l.createElement(t.GenericFileIcon,null))):null)),l.createElement(t.ActionBar,null,m?l.createElement(t.Menu,{style:{width:u?"full":"240px"},localeKeyPrefix:"ES_CE",options:Go,t:s,onSelect:function(e){if(v(!1),null!=e&&e.includes("EDIT")){var t;const e=d({tenantIds:null==c?void 0:c.tenantId,documentName:null==c?void 0:c.name,docCategory:null==h||null===(t=h.filter(e=>e.name===(null==c?void 0:c.category)))||void 0===t?void 0:t[0],document:{filestoreId:{fileStoreId:null==c?void 0:c.filestoreId},documentLink:null==c?void 0:c.documentLink},ULB:{code:null==c?void 0:c.tenantId}},c);r.push({pathname:"/digit-ui/employee/engagement/documents/inbox/update",state:{DocumentEntity:e}})}null!=e&&e.includes("DELETE")&&E(!0)}}):null,l.createElement(t.SubmitBar,{label:s("ES_COMMON_TAKE_ACTION"),onSubmit:()=>v(!m)})))},Qo=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},Xo=e=>{var o,r,u,s,c;let{registerRef:d,controlSearchForm:m,searchFormState:v}=e;const{t:p}=a.useTranslation(),E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),g=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentTenantId()),f=Digit.UserService.getUser().info;let h=!0,S=E.filter(e=>{var t,n;return null==f||null===(t=f.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);if(0===(null===(o=S)||void 0===o?void 0:o.length)||"pb.punjab"===g){h=!1;let e={i18nKey:"TENANT_TENANTS_"+(null==f?void 0:f.tenantId.replace(".","_").toUpperCase()),code:""+(null==f?void 0:f.tenantId)};S="pb.punjab"===g?[e,...E]:[e]}const _=n.useMemo(()=>{var e;return(null===(e=S)||void 0===e?void 0:e.length)>0&&!0===h?E.filter(e=>e.code===g):S.filter(e=>e.code===g)},[E]);return l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,p("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:p("REQUIRED_FIELD")},defaultValue:null==_?void 0:_[0],render:e=>l.createElement(t.Dropdown,{option:S,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:p}),name:"tenantIds",control:m}),l.createElement(t.CardLabelError,null,null==v||null===(r=v.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,p("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",inputRef:d({maxLength:{value:60,message:p("Survey Name should be less than 60 characters")}})}),l.createElement(t.CardLabelError,null,null==v||null===(s=v.errors)||void 0===s||null===(c=s.title)||void 0===c?void 0:c.message)))},Zo=e=>{let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),g=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],f={tenantIds:E[0],title:""},h={status:g[0]},y={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEY.INBOX"),_=n.useMemo(()=>S||{filterForm:h,searchForm:f,tableForm:y},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[C,b]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},_);let{data:{Surveys:T=[],TotalCount:D}={},isLoading:N}=Digit.Hooks.survey.useSurveyInbox(C);const[A,w]=n.useState([]);n.useEffect(()=>{if(T.length>0){const e=[...T].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);T=e,w(e)}},[T]);const x={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},I=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(Xo,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(Qo,{statuses:g,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==C?void 0:C.filterForm,getFilterFormValue:o})},[g]),O={SearchFormFields:I,onSearchFormSubmit:e=>{b({action:"mutateTableForm",data:d({},C.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==C?void 0:C.searchForm,resetSearchFormDefaultValues:f,onSearchFormReset:e=>{e("title",""),e("tenantIds",m),b({action:"mutateSearchForm",data:f})}},R={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==C?void 0:C.filterForm,resetFilterFormDefaultValues:h,onFilterFormReset:e=>{e("status",g[0]),b({action:"mutateFilterForm",data:h})}},P=(e=>{var i,r,u,s;let{onPageSizeChange:c,formState:m,totalCount:v,table:p,dispatch:E,inboxStyles:g={},setShowToast:f}=e;const h=o.useHistory(),y=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:S}=a.useTranslation(),_=Digit.UserService.getUser(),C=n.useMemo(()=>[{Header:S("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link",onClick:()=>{h.push({pathname:"/digit-ui/employee/engagement/surveys/previewQuestions",state:{data:t.original}})}},t.original.surveyTitle))}},{Header:S("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?y(we(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:S("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?y(we(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:l.createElement("div",null,S("EVENTS_STATUS_LABEL")),accessor:"status",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null===(t=n.original)||void 0===t?void 0:t.active)}},{Header:S("EVENTS_POSTEDBY_LABEL"),accessor:"postedBy",Cell:e=>{var t;let{row:n}=e;return y(null===(t=n.original)||void 0===t?void 0:t.postedBy)}},{Header:S("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:S("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:S("Update Survey Status"),accessor:"updateSurvey",Cell:e=>{var n,a;let{row:o}=e;return(null==o||null===(n=o.original)||void 0===n?void 0:n.tenantId)===(null==_||null===(a=_.info)||void 0===a?void 0:a.tenantId)?l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;console.log("Current row: ",e);const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.active?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.active?"Inactive":"Active";f({label:'Are you sure you want to change the survey status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.surveyTitle)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(o)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},S("Click here to update the survey status")))):l.createElement("div",{style:{color:"red"}},"No access")}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"endDate",onPageSizeChange:c,currentPage:parseInt((null===(i=m.tableForm)||void 0===i?void 0:i.offset)/(null===(r=m.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=m.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=m.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(u=m.tableForm)||void 0===u?void 0:u.limit,totalRecords:v,onSearch:null==m||null===(s=m.searchForm)||void 0===s?void 0:s.message,onLastPage:()=>{var e;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:10*Math.ceil(v/10)-parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>E({action:"mutateTableForm",data:d({},m.tableForm,{offset:0})}),data:p,columns:C,noResultsMessage:"CS_NO_SURVEYS_FOUND",inboxStyles:d({},g)}})(d({},{parentRoute:r,onPageSizeChange:e=>{b({action:"mutateTableForm",data:d({},C.tableForm,{limit:e.target.value})})},formState:C,totalCount:D,table:A,noResultsMessage:"CS_SURVEYS_NOT_FOUND",dispatch:b,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:n}]=e,l=n?"DESC":"ASC";C.tableForm.sortBy===t&&C.tableForm.sortOrder===l||b({action:"mutateTableForm",data:d({},C.tableForm,{sortBy:t,sortOrder:n?"DESC":"ASC"})})}}})),M=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const{surveyTitle:n,startDate:a,endDate:i,active:s,postedBy:c,auditDetails:d}=e;return{[r("Survey Name")]:n,[r("EVENTS_START_DATE_LABEL")]:a?we(new Date(a),"dd/MM/yyyy"):"",[r("EVENTS_END_DATE_LABEL")]:i?we(new Date(i),"dd/MM/yyyy"):"",[r("EVENTS_STATUS_LABEL")]:u(s),[r("EVENTS_POSTEDBY_LABEL")]:c,[r("Created On")]:null!=d&&d.createdTime?we(new Date(null==d?void 0:d.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=d&&d.lastModifiedTime?we(new Date(null==d?void 0:d.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Survey Status")]:l.createElement("label",{onClick:()=>{return t=e,console.log("Current row: ",t),void o({label:'Are you sure you want to change the survey status of "'+(null==t?void 0:t.surveyTitle)+'" from '+(null!=t&&t.active?"Active":"Inactive")+" to "+(null!=t&&t.active?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t});var t}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:A,setShowToast:c});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Inbox"),D?l.createElement("p",{className:"inbox-count"},D):null),l.createElement(t.InboxComposer,d({isInboxLoading:N,PropsForInboxLinks:x},O,R,{propsForInboxMobileCards:M,propsForInboxTable:P,formState:C})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData;Digit.Surveys.updateSurvey({uuid:null==e?void 0:e.uuid,active:!(null!=e&&e.active)}).then(e=>{c({label:null==e?void 0:e.message,isDleteBtn:"true"})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,isWarningButtons:s.isWarningButtons,style:{padding:"16px"}}))},$o=()=>{const{t:e}=a.useTranslation(),r=o.useHistory(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[d,m]=n.useState(null),p=i.useForm({defaultValues:{categoryName:""}}),{register:E,handleSubmit:g,reset:f,formState:{errors:h}}=p,[y,S]=n.useState(!1);function _(){S(!1)}return l.createElement("div",{className:"pageCard"},l.createElement(t.Header,null,e("Create Category")),l.createElement(i.FormProvider,p,l.createElement("form",{onSubmit:g(function(e){try{s(!0);const t={Categories:[{tenantId:c,label:e.categoryName.trim()}]},n=v(function(){return Promise.resolve(Digit.Surveys.createCategory(t)).then(function(e){var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?(s(!1),m({isError:!1,label:"Category created successfully"}),f(),setTimeout(()=>{r.push("/digit-ui/employee/engagement/surveys/search-categories")},2e3)):(s(!1),m({isError:!0,label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong"}))})},function(e){var t,n,l,a;console.log("Error in Digit.Surveys.createCategory:",null==e?void 0:e.response),s(!1),m({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,e("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",null,l.createElement(t.TextInput,{errorStyle:!!h.categoryName,name:"categoryName",type:"text",placeholder:"Enter Category",inputRef:E({required:e("REQUIRED_FIELD"),maxLength:{value:500,message:e("Category length should be less than or equal to 500 characters")}})}),h.categoryName&&l.createElement("p",{style:{color:"red"}},h.categoryName.message)),l.createElement("label",{onClick:function(){S(!0)},style:{width:"24px",display:"flex",justifyContent:"center",alignItems:"center",outline:"none",cursor:"pointer"}},l.createElement(t.InfoIcon,null)))),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:e("Create Category"),submit:"submit"})))),y&&l.createElement(Co,{onSelect:function(){S(!1)},onCancel:_,onDismiss:_,heading:"About category creation",content:l.createElement("p",{style:{fontWeight:"bold"}},e("Organize your survey by category to steamline feedback on municipal services.")),hideSubmit:!0}),d&&l.createElement(t.Toast,{error:d.isError,label:e(d.label),onClose:function(){m(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},Jo=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},ei=e=>{var o,r,u;let{controlSearchForm:s,searchFormState:c}=e;const{t:d}=a.useTranslation(),m=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.ULBService.getCurrentTenantId(),p=Digit.SessionStorage.get("citizen.userRequestObject");let E=!0,g=m.filter(e=>{var t,n;return null==p||null===(t=p.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);var f;0===(null===(o=g)||void 0===o?void 0:o.length)&&(E=!1,g=[{i18nKey:"TENANT_TENANTS_"+(null==p||null===(f=p.info)||void 0===f?void 0:f.tenantId.replace(".","_").toUpperCase()),code:""+(null==p?void 0:p.info.tenantId)}]);const h=n.useMemo(()=>{var e;return(null===(e=g)||void 0===e?void 0:e.length)>0&&!0===E?m.filter(e=>e.code===v):g.filter(e=>e.code===v)},[m]),[S,_]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:v}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:d(e.label),i18Key:e.label,value:e.id}}):[];_(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[v]),console.log("controlSearchForm: ",s),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,d("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:d("REQUIRED_FIELD")},defaultValue:null==h?void 0:h[0],render:e=>l.createElement(t.Dropdown,{option:g,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:d}),name:"tenantIds",control:s}),l.createElement(t.CardLabelError,null,null==c||null===(r=c.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,d("Category")),l.createElement(i.Controller,{rules:{required:!1},render:e=>l.createElement(t.Dropdown,{option:S,optionKey:"i18Key",selected:e.value,select:t=>e.onChange(t),t:d}),name:"categoryName",control:s})))},ti=e=>{var o;let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),g=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],f={tenantIds:E[0],categoryName:""},h={status:g[0]},y={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEYCATEGORY.INBOX"),_=n.useMemo(()=>S||{filterForm:h,searchForm:f,tableForm:y},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[C,b]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},_);let{data:{Categories:T=[]}={},isLoading:D}=Digit.Hooks.survey.useSurveyCategoryInbox(C);const N=null===(o=T)||void 0===o?void 0:o.length,[A,w]=n.useState([]);n.useEffect(()=>{if(T.length>0){const e=[...T].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);T=e,w(e)}},[T]);const x={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},I=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(ei,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(Jo,{statuses:g,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==C?void 0:C.filterForm,getFilterFormValue:o})},[g]),O={SearchFormFields:I,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit: ",e),b({action:"mutateTableForm",data:d({},C.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==C?void 0:C.searchForm,resetSearchFormDefaultValues:f,onSearchFormReset:e=>{e("tenantIds",m),e("categoryName",""),b({action:"mutateSearchForm",data:f})}},R={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==C?void 0:C.filterForm,resetFilterFormDefaultValues:h,onFilterFormReset:e=>{e("status",g[0]),b({action:"mutateFilterForm",data:h})}},P=(e=>{var o,i,r,u;let{onPageSizeChange:s,formState:c,totalCount:m,table:v,dispatch:p,inboxStyles:E={},setShowToast:g}=e;const f=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:h}=a.useTranslation(),y=n.useMemo(()=>[{Header:h("Category"),accessor:"category",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.label))}},{Header:h("Status"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null===(t=n.original)||void 0===t?void 0:t.isActive)}},{Header:h("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?f(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:h("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?f(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:h("Update Category Status"),accessor:"updateCategory",Cell:e=>{let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;console.log("Current row: ",e);const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.isActive?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.isActive?"Inactive":"Active";g({label:'Are you sure you want to change the category status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.label)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},h("Click here to update the category status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(m),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:v,columns:y,noResultsMessage:"No Category found",inboxStyles:d({},E)}})(d({},{parentRoute:r,onPageSizeChange:e=>{b({action:"mutateTableForm",data:d({},C.tableForm,{limit:e.target.value})})},formState:C,totalCount:N,table:A,noResultsMessage:"No Categories found",dispatch:b,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c})),M=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const{label:n,isActive:a,auditDetails:i}=e;return{[r("Category")]:n,[r("Status")]:u(a),[r("Created On")]:null!=i&&i.createdTime?we(new Date(null==i?void 0:i.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=i&&i.lastModifiedTime?we(new Date(null==i?void 0:i.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Category Status")]:l.createElement("label",{onClick:()=>{var t;o({label:'Are you sure you want to change the category status of "'+(null==(t=e)?void 0:t.label)+'" from '+(null!=t&&t.isActive?"Active":"Inactive")+" to "+(null!=t&&t.isActive?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t})}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:A,setShowToast:c});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Search Categories"),N?l.createElement("p",{className:"inbox-count"},N):null),l.createElement(t.InboxComposer,d({isInboxLoading:D,PropsForInboxLinks:x},O,R,{propsForInboxMobileCards:M,propsForInboxTable:P,formState:C})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData,t={Categories:[d({id:null==e?void 0:e.id},"boolean"==typeof(null==e?void 0:e.isActive)&&{isActive:!(null!=e&&e.isActive)})]};Digit.Surveys.updateCategory(t).then(e=>{var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?c({label:"Category status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,style:{padding:"16px"},isWarningButtons:s.isWarningButtons}))},ni=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,isPartiallyEnabled:r,createNewSurvey:u,formDisabled:s,maxLength:c,titleHover:d,weightHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isInputDisabled:f}=e;return l.createElement("div",{className:"options_checkboxes"},n.map(e=>l.createElement("div",{key:e.id},l.createElement(li,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,maxLength:c,titleHover:d,weightageHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isPartiallyEnabled:r,isInputDisabled:f,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!u&&s||(r?!r:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},li=e=>{let{index:a,title:o,weightage:i,updateOption:r,removeOption:u,maxLength:s,titleHover:c,weightHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isPartiallyEnabled:f,isInputDisabled:h,formDisabled:y,optionsLength:S}=e;const[_,C]=n.useState(o),[b,T]=n.useState(i),[D,N]=n.useState(!1),[A,w]=n.useState("");return n.useEffect(()=>{r({value:_,id:a,weightage:b})},[_,b]),l.createElement("div",{className:"optioncheckboxwrapper",style:{alignItems:"flex-start"}},l.createElement(t.CheckBox,{disable:h}),l.createElement("input",{ref:E,type:"text",value:_,onChange:e=>C(e.target.value),onBlur:()=>N(!1),onFocus:()=>N(!0),className:D?"simple_editable-input":"simple_readonly-input",maxLength:s,title:c,style:d({},g),disabled:f?!f:y}),S>1&&l.createElement("div",{className:"pointer",onClick:()=>u(a)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:b,required:!0,placeholder:"Option Weightage",min:v,max:p,title:m,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(w(""),T(e.target.value)):w("Please enter a number between 0 and 10.")}}),A&&l.createElement("span",{style:{color:"red"}},A)))},ai=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,createNewSurvey:r,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isInputDisabled:g}=e;return l.createElement("div",{className:"options_checkboxes"},n.map(e=>l.createElement("div",{key:e.id},l.createElement(oi,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,inputRef:c,maxLength:d,titleHover:m,weightageHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!r&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},oi=e=>{let{index:a,title:o,weightage:i,updateOption:r,removeOption:u,inputRef:s,maxLength:c,titleHover:d,weightHover:m,minWeight:v,maxWeight:p,isPartiallyEnabled:E,isInputDisabled:g,formDisabled:f,optionsLength:h}=e;const[y,S]=n.useState(o),[_,C]=n.useState(i),[b,T]=n.useState(!1),[D,N]=n.useState("");return n.useEffect(()=>{r({value:y,id:a,weightage:_})},[y,_]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"flex-start"}},l.createElement("input",{type:"radio",className:"customradiobutton",disabled:g}),l.createElement("input",{type:"text",ref:s,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:b?"simple_editable-input":"simple_readonly-input",maxLength:c,title:d,disabled:E?!E:f}),h>1&&l.createElement("div",{className:"pointer",onClick:()=>u(a)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:_,required:!0,placeholder:"Option Weightage",min:v,max:p,title:m,className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(N(""),C(e.target.value)):N("Please enter a number between 0 and 10.")},onWheel:e=>e.target.blur()}),D&&l.createElement("span",{style:{color:"red"}},D)))},ii=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,createNewSurvey:r,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isInputDisabled:g}=e;return l.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>l.createElement("div",{key:e.id},l.createElement(ri,{indexNumber:t,index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,inputRef:c,maxLength:d,titleHover:m,weightageHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!r&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},ri=e=>{let{indexNumber:a,index:o,title:i,weightage:r,updateOption:u,removeOption:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:g,formDisabled:f,optionsLength:h}=e;const[y,S]=n.useState(i),[_,C]=n.useState(r),[b,T]=n.useState(!1),[D,N]=n.useState("");return n.useEffect(()=>{u({value:y,id:o,weightage:_})},[y,_]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"flex-start"}},l.createElement("span",null,a+1,"."),l.createElement("input",{type:"text",ref:c,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:b?"simple_editable-input":"simple_readonly-input",maxLength:d,title:m,disabled:g?!g:f}),h>1&&l.createElement("div",{className:"pointer",onClick:()=>s(o)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:_,required:!0,placeholder:"Option Weightage",min:p,max:E,title:v,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(N(""),C(e.target.value)):N("Please enter a number between 0 and 10.")}}),D&&l.createElement("span",{style:{color:"red"}},D)))},ui=e=>{var a,o,r,u,s,c;let{t:m,index:v,category:p,questionStatement:E,type:g,options:f,required:h,uuid:y,qorder:S,disableInputs:_,dispatch:C,isPartiallyEnabled:b,addOption:T,formDisabled:D,controlSurveyForm:N,mainFormState:A,noOfQuestions:w,defaultQuestionValues:x}=e;const I=Digit.ULBService.getCurrentTenantId(),{data:L={}}=Digit.Hooks.engagement.useMDMS(I,"common-masters","questionType")||{};var O=L&&L["common-masters"]&&L["common-masters"].questionType?L["common-masters"].questionType.filter(function(e){return e.active}).map(function(e){return{title:m(e.title),i18Key:e.code,value:e.code}}):[];const[R,P]=n.useState([]);n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:I}).then(e=>{var t,n;const l=null==e||null===(t=e.Categories)||void 0===t||null===(n=t.filter(e=>e.isActive))||void 0===n?void 0:n.map(e=>({title:m(e.label),i18Key:e.label,value:e.id}));P(l)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[I]);const M=window.location.href.includes("/employee/engagement/surveys/create-questions"),[F,k]=n.useState({category:p||x.category,questionStatement:E||x.questionStatement,type:g||x.type,options:(null==f?void 0:f.length)>0?f:x.options,required:h||x.required,uuid:y||x.uuid,qorder:S||x.qorder}),{errors:B}=A,U=()=>{const e=[...F.options,{id:Date.now(),title:m("CMN_OPTION")+" "+(F.options.length+1),optionWeightage:0}];return k(t=>d({},t,{options:e})),e},H=e=>{let{value:t,id:n,weightage:l}=e;const a=F.options.map(e=>e.id===n?d({},e,{title:t,optionWeightage:l}):e);return k(e=>d({},e,{options:a})),a},V=e=>{if(1===F.options.length||(b?!b:D))return F.options;const t=F.options.filter(t=>t.id!==e);return k(e=>d({},e,{options:t})),t};return n.useEffect(()=>{C({type:"updateForm",payload:{index:v,formConfig:F}})},[F]),console.log("surveyQuestionConfig",F.options[0].optionWeightage),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},m("CS_COMMON_QUESTION")+" "+(v+1)+" "),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD")},defaultValue:x.category,name:"questions["+v+"].category",control:N,render:e=>l.createElement(t.Dropdown,{t:m,option:R,placeholder:"Select Category *",optionKey:"i18Key",selected:F.category,select:t=>{var n;e.onChange(t),n=t,k(e=>d({},e,{category:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:_})}),(null===(a=B.questions)||void 0===a||null===(o=a[v])||void 0===o?void 0:o.category)&&l.createElement(t.CardLabelError,null,B.questions[v].category.message),l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD"),maxLength:{value:500,message:"Question length should be less than or equal to 500 characters"},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:"Input should not start with a number"}},defaultValue:x.questionStatement,name:"questions["+v+"].questionStatement",control:N,render:e=>l.createElement(t.TextInput,{placeholder:m("CS_COMMON_TYPE_QUESTION")+" *",value:F.questionStatement,onChange:t=>{var n;n=t,k(e=>d({},e,{questionStatement:n.target.value})),e.onChange(t)},textInputStyle:{width:"100%"},disable:_})}),(null===(r=B.questions)||void 0===r||null===(u=r[v])||void 0===u?void 0:u.questionStatement)&&l.createElement(t.CardLabelError,null,B.questions[v].questionStatement.message),l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD")},defaultValue:x.type,name:"questions["+v+"].type",control:N,render:e=>l.createElement(t.Dropdown,{t:m,option:O,placeholder:"Select Question Type *",optionKey:"i18Key",selected:F.type,select:t=>{var n;e.onChange(t),n=t,k(e=>d({},e,{type:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:_})}),(null===(s=B.questions)||void 0===s||null===(c=s[v])||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,B.questions[v].type.message),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,a,o,r,u,s;switch(null==e?void 0:e.value){case"MULTIPLE_ANSWER_TYPE":return l.createElement("div",null,(null===(n=B.questions)||void 0===n||null===(a=n[v])||void 0===a?void 0:a.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(ai,{updateOption:t=>{const n=H(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=V(t);e.onChange(n)},options:null==F?void 0:F.options,createNewSurvey:T,isInputDisabled:M,isPartiallyEnabled:b,formDisabled:D,maxLength:500,minWeight:0,maxWeight:10,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),t:m})}));case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,(null===(o=B.questions)||void 0===o||null===(r=o[v])||void 0===r?void 0:r.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(ni,{updateOption:t=>{const n=H(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=V(t);e.onChange(n)},options:null==F?void 0:F.options,isInputDisabled:M,isPartiallyEnabled:b,createNewSurvey:T,formDisabled:D,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:m})}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement("div",null,(null===(u=B.questions)||void 0===u||null===(s=u[v])||void 0===s?void 0:s.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(ii,{updateOption:t=>{const n=H(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=V(t);e.onChange(n)},options:null==F?void 0:F.options,isInputDisabled:M,isPartiallyEnabled:b,createNewSurvey:T,formDisabled:D,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:m})}));default:return null}})(null==F?void 0:F.type)),l.createElement("div",{className:"newSurveyForm_actions"},w>1&&l.createElement("div",{className:"newSurveyForm_seprator"}),w>1&&l.createElement("div",{className:"pointer "+(_?"disabled-btn":""),onClick:()=>C({type:"removeForm",payload:{uuid:y}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},m("CS_INFO_DELETE"))))))))},si=e=>{let{t:t,formsConfig:a,setSurveyConfig:o,disableInputs:i,isPartiallyEnabled:r,addOption:u,formDisabled:s,controlSurveyForm:c,formState:m,defaultQuestionValuesFromFile1:v}=e;const p=v(),E=[p],[g,f]=n.useReducer((e,t)=>{let{type:n,payload:l}=t;switch(n){case"addNewForm":const t=[...e,p];return l.setSurveyConfig("questions",t),t;case"updateForm":const n=[...e];return n.splice(l.index,1,l),l.setSurveyConfig("questions",n),n;case"removeForm":if(1===e.length)return e;const a=e.filter(e=>e.formConfig.uuid!==l.uuid);return l.setSurveyConfig("questions",a),a}},a||E),h=e=>{let{type:t,payload:n}=e;f({type:t,payload:d({},n,{setSurveyConfig:o})})};return l.createElement("div",{className:"surveyformslist_wrapper"},g.length?g.map((e,n)=>l.createElement("div",{key:e.formConfig?e.formConfig.uuid:e.uuid},l.createElement(ui,d({},e.formConfig?null==e?void 0:e.formConfig:e,{addOption:u,t:t,index:n,disableInputs:i,dispatch:h,isPartiallyEnabled:r,formDisabled:s,controlSurveyForm:c,mainFormState:m,noOfQuestions:null==g?void 0:g.length,defaultQuestionValues:p})))):null,l.createElement("div",{className:"pointer"},g.length<100&&l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},onClick:()=>h({type:"addNewForm"}),disabled:g.length>=100},t("CS_COMMON_ADD_QUESTION"))))},ci=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors","watch"],di=()=>{const e=o.useHistory(),{t:r}=a.useTranslation(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[p,E]=n.useState(null),g=()=>({category:null,questionStatement:"",type:{title:r("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},options:[{id:Date.now(),title:r("CMN_OPTION")+" 1",optionWeightage:0}],required:!1,uuid:Date.now()+Math.random().toString(36).substring(2,11),qorder:null}),f=i.useForm({defaultValues:{questions:[g()]}}),{register:h,control:y,handleSubmit:S,setValue:_,getValues:C,reset:b,formState:T,clearErrors:D}=f,N=m(f,ci);function A(e){console.log("data",e);const t=e.questions.map(e=>{let t={};return t="MULTIPLE_ANSWER_TYPE"===e.type.value||"CHECKBOX_ANSWER_TYPE"===e.type.value||"DROP_DOWN_MENU_ANSWER_TYPE"===e.type.value?{tenantId:c,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value,options:e.options.map(e=>({optionText:e.title.trim(),weightage:parseInt(e.optionWeightage)}))}:{tenantId:c,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value},t});return console.log("qus payload",t),t}return l.createElement("div",{className:"pageCard"},l.createElement(t.Header,null,r("Create Questions")),l.createElement(i.FormProvider,d({register:h,handleSubmit:S,setValue:_,getValues:C,reset:b,formState:T,clearErrors:D},N),l.createElement("form",{onSubmit:S(function(t){try{s(!0);const n={Questions:A(t)},l=v(function(){return Promise.resolve(Digit.Surveys.createQuestions(n)).then(function(t){var n;(null==t||null===(n=t.Questions)||void 0===n?void 0:n.length)>0?(s(!1),E({isError:!1,label:"Questions created successfully"}),setTimeout(()=>{e.push("/digit-ui/employee/engagement/surveys/search-questions")},2e3)):(s(!1),E({isError:!0,label:"Something went wrong"}))})},function(e){console.log("Error in Digit.Surveys.createQuestions:",null==e?void 0:e.response),s(!1),E({isError:!0,label:"Something went wrong"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement(t.Card,null,l.createElement(si,{t:r,setSurveyConfig:_,addOption:!0,controlSurveyForm:y,formState:T,defaultQuestionValuesFromFile1:g})),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:r("Create Questions"),submit:"submit"})))),p&&l.createElement(t.Toast,{error:p.isError,label:r(p.label),onClose:()=>{E(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},mi=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},vi=e=>{var o,r,u,s,c,d,m;let{controlSearchForm:v,searchFormState:p}=e;const{t:E}=a.useTranslation(),g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),f=Digit.ULBService.getCurrentTenantId(),h=Digit.SessionStorage.get("citizen.userRequestObject");let S=!0,_=g.filter(e=>{var t,n;return null==h||null===(t=h.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);var C;0===(null===(o=_)||void 0===o?void 0:o.length)&&(S=!1,_=[{i18nKey:"TENANT_TENANTS_"+(null==h||null===(C=h.info)||void 0===C?void 0:C.tenantId.replace(".","_").toUpperCase()),code:""+(null==h?void 0:h.info.tenantId)}]);const b=n.useMemo(()=>{var e;return(null===(e=_)||void 0===e?void 0:e.length)>0&&!0===S?g.filter(e=>e.code===f):_.filter(e=>e.code===f)},[g]),[T,D]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:f}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:E(e.label),i18Key:e.label,value:e.id}}):[];D(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[f]),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,E("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},defaultValue:null==b?void 0:b[0],render:e=>l.createElement(t.Dropdown,{option:_,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:E}),name:"tenantIds",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(r=p.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},render:e=>l.createElement(t.Dropdown,{option:T,optionKey:"name",selected:e.value,select:t=>e.onChange(t),t:E}),name:"categoryName",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(s=p.errors)||void 0===s||null===(c=s.categoryName)||void 0===c?void 0:c.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Question")),l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{name:"questionStatement",type:"text",value:e.value,onChange:t=>e.onChange(t)}),name:"questionStatement",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(d=p.errors)||void 0===d||null===(m=d.questionStatement)||void 0===m?void 0:m.message)))},pi=e=>{var o;let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),[g,f]=n.useState(!1),[h,y]=n.useState(!1),S=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],_={tenantIds:E[0],categoryName:"",questionStatement:""},C={status:S[0]},b={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},T=Digit.SessionStorage.get("CITIZENSURVEYQUESTION.INBOX"),D=n.useMemo(()=>T||{filterForm:C,searchForm:_,tableForm:b},[Object.values((null==T?void 0:T.filterForm)||{}),Object.values((null==T?void 0:T.searchForm)||{}),Object.values((null==T?void 0:T.tableForm)||{})]),[N,A]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},D);let{data:{Questions:w=[],Errors:x=[]}={},isLoading:I}=Digit.Hooks.survey.useSurveyQuestionInbox(N);const L=null===(o=w)||void 0===o?void 0:o.length,[O,R]=n.useState([]);n.useEffect(()=>{if(w.length>0){const e=[...w].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);w=e,R(e)}},[w]);const P={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},M=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(vi,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),F=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(mi,{statuses:S,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==N?void 0:N.filterForm,getFilterFormValue:o})},[S]),k={SearchFormFields:M,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit:",e),A({action:"mutateTableForm",data:d({},N.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),A({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==N?void 0:N.searchForm,resetSearchFormDefaultValues:_,onSearchFormReset:e=>{e("tenantIds",m),e("categoryName",""),e("questionStatement",""),A({action:"mutateSearchForm",data:_})}},B={FilterFormFields:F,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),A({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==N?void 0:N.filterForm,resetFilterFormDefaultValues:C,onFilterFormReset:e=>{e("status",S[0]),A({action:"mutateFilterForm",data:C})}},U=(e=>{var o,i,r,u;let{onPageSizeChange:s,formState:c,totalCount:m,table:v,dispatch:p,inboxStyles:E={},setShowToast:g,setOpenQuesDetailsDialog:f,setQuestionDetailsContent:h}=e;const y=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:S}=a.useTranslation(),_=n.useMemo(()=>[{Header:S("Question"),accessor:"questionStatement",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;console.log("question: ",e),f(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,S(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));h(n)}(null==n?void 0:n.original)},null==n||null===(t=n.original)||void 0===t?void 0:t.questionStatement),l.createElement("span",{className:"tooltiptext",style:{top:"40%",bottom:"auto",left:"50%",marginLeft:"-10px",fontSize:"medium",position:"absolute"}},S("Click here to view the question details"))))}},{Header:S("Is Question Active"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return(e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e))(null===(t=n.original)||void 0===t?void 0:t.status)}},{Header:S("Question Type"),accessor:"questionType",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,S(null===(t=n.original)||void 0===t?void 0:t.type)))}},{Header:S("Is Question Required"),accessor:"isQuestionRequired",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,S(null===(t=n.original)||void 0===t?void 0:t.required)))}},{Header:S("Category"),accessor:"category",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=a.original)||void 0===t||null===(n=t.category)||void 0===n?void 0:n.label))}},{Header:S("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:S("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:S("Update Question Status"),accessor:"updateQuestion",Cell:e=>{let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t;const n=null==e||null===(t=e.original)||void 0===t?void 0:t.status,l="ACTIVE"===n?"INACTIVE":"INACTIVE"===n?"ACTIVE":"";g({label:"Are you sure you want to change the question status from "+n+" to "+l+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original,updatedStatus:l})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},S("Click here to update the question status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(m),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:v,columns:_,noResultsMessage:"No Question found",inboxStyles:d({},E)}})(d({},{parentRoute:r,onPageSizeChange:e=>{A({action:"mutateTableForm",data:d({},N.tableForm,{limit:e.target.value})})},formState:N,totalCount:L,table:O,noResultsMessage:"No Questions found",dispatch:A,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c,openQuesDetailsDialog:g,questionDetailsContent:h,setOpenQuesDetailsDialog:f,setQuestionDetailsContent:y})),H=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e);return{data:null==n?void 0:n.map(e=>({[r("Question")]:e.questionStatement,[r("Status")]:u(e.status),[r("Question Type")]:e.type,[r("Category")]:e.category.label,[r("Created On")]:e.auditDetails.createdTime?we(new Date(e.auditDetails.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:e.auditDetails.lastModifiedTime?we(new Date(e.auditDetails.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Question Status")]:l.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.status,n="ACTIVE"===t?"INACTIVE":"INACTIVE"===t?"ACTIVE":"";o({label:"Are you sure you want to change the question status from "+t+" to "+n+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e,updatedStatus:n})})(e)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))})),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:O,setShowToast:c});function V(){f(!1)}return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Search Questions"),L?l.createElement("p",{className:"inbox-count"},L):null),l.createElement(t.InboxComposer,d({isInboxLoading:I,PropsForInboxLinks:P},k,B,{propsForInboxMobileCards:H,propsForInboxTable:U,formState:N})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData;Digit.Surveys.updateQuestions({Questions:[{uuid:null==e?void 0:e.uuid,status:s.updatedStatus}]}).then(e=>{var t,n,l;(null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0?c({label:"Question status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,style:{padding:"16px"},isWarningButtons:s.isWarningButtons}),g&&l.createElement(Co,{onSelect:function(){f(!1)},onCancel:V,onDismiss:V,heading:"Question Details",actionCancel:!0,content:h,hideSubmit:!0}))},Ei=e=>{let{children:t,currentStep:n=1,stepsList:o=[]}=e;const{t:i}=a.useTranslation(),r=e=>({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,color:e?"#3f51b5":"#ccc",padding:"10px 10px",width:"260px"}),u=e=>{let t;return t=e<=n?"#0D43A7":"#FFFFFF",{width:"60px",height:"60px",borderRadius:"50%",backgroundColor:t,color:e<=n?"white":"black",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"10px",fontWeight:"normal",fontSize:"18px",border:e>n?"1px solid black":"",position:"relative"}},s={fontSize:"18px",color:"#1E1E1E",fontWeight:"500",fontFamily:"Noto Sans,sans-serif",marginRight:"6px"},c={fontSize:"18px",color:"#263238",fontWeight:"400",fontFamily:"Noto Sans,sans-serif",margin:"0px 6px 0px 0px"},d={position:"absolute",width:"2px",height:"50px",backgroundColor:"grey",left:"50%",top:"100%",transform:"translateX(-50%)"},m=(window.Digit.Utils.browser.isMobile(),o.length);return l.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"top",justifyContent:"flex-start"}},l.createElement("div",{className:"stepper-navigation-bar",style:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"50%",marginBottom:"20px"}},[...Array(m)].map((e,t)=>l.createElement("div",{className:"step-content",key:t,style:r(t+1<=n)},l.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",margin:"10px"}},t+1===m?null:l.createElement("div",{className:"step-number",style:c}),l.createElement("div",{className:"step-label",style:s},i(o[t].stepLabel))),l.createElement("div",{className:"step-circle",style:u(t+1)},t+1,t<m-1&&l.createElement("div",{style:d}))))),l.createElement("div",{className:"stepper-body",style:{width:"100%",marginBottom:"20px"}},t))},gi=e=>{let{stepsList:t=[],onSubmit:n,step:o,setStep:i}=e;const r=t.filter(e=>e.isStepEnabled),{t:u}=a.useTranslation();function s(){o<r.length?d():o===r.length&&n()}function c(){o>1&&m()}const d=()=>i(o+1),m=()=>i(o-1);return l.createElement(Ei,{currentStep:o,nextStep:d,prevStep:m,stepsList:r},(()=>{var e,t;const n=r[o-1],{component:a,key:i,texts:d,currStepConfig:m}=n,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(a);return l.createElement(l.Fragment,null,l.createElement(v,{config:{key:i,texts:d,component:a,currStepNumber:o,currStepConfig:m},onGoNext:s,onBackClick:c,t:u}))})())},fi=[{head:"Survey Details",stepNumber:1,body:[{type:"component",component:"NewSurveys",key:"NewSurveys",withoutLabel:!0}]},{head:"Survey Sections",stepNumber:2,body:[{type:"component",component:"SurveyCreationPage",key:"SurveyCreationPage",withoutLabel:!0}]},{head:"Summary",stepNumber:3,body:[{type:"component",component:"SurveySummary",key:"SurveySummary",withoutLabel:!0}]}],hi=(e,t)=>({type:"UPDATE_SURVEY_FORM",payload:{key:e,value:t}}),yi=(e,t)=>({type:"FIELD_CHANGE",surveyId:e,data:t}),Si=e=>({type:"ADD_CATEGORY",id:e}),_i=(e,t)=>({type:"ADD_QUESTIONS",categoryId:e,questions:t}),Ci=(e,t)=>({type:"UPDATE_CATEGORY",categoryId:e,data:t}),bi=(e,t,n)=>({type:"UPDATE_MANDATORY_QUESTION_SELECTION",categoryId:e,questionId:t,mandatory:n}),Ti=(e,t)=>({type:"SET_QUESTIONS",categoryId:e,questions:t}),Di=e=>({type:"DELETE_CATEGORY",categoryId:e}),Ni=[{head:"SURVEY_DETAILS",stepLabel:"Survey Details",stepNumber:1,isStepEnabled:!0,type:"component",component:"SurveyFormDetails",key:"surveyFormDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_CATEGORIES",stepLabel:"Survey Sections",stepNumber:2,isStepEnabled:!0,type:"component",component:"SurveyFormCategoryDetails",key:"surveyFormCategoryDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_SUMMARY",stepLabel:"Summary",stepNumber:3,isStepEnabled:!0,type:"component",component:"SurveryFormSummary",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"Submit"}}].map(e=>d({},e,{currStepConfig:fi.filter(t=>t.stepNumber===e.stepNumber)})),Ai=()=>{o.useHistory();const{t:e}=a.useTranslation(),i=u.useDispatch(),[r,s]=n.useState(null),c=u.useSelector(e=>e.engagement.surveyForm),d=c.step;return Digit.ULBService.getCurrentTenantId(),console.log("formState: ",c),l.createElement("div",{class:"pageCard"},l.createElement("h1",{style:{color:"black",fontFamily:"Noto Sans,sans-serif",fontSize:"28px",fontWeight:"500"}},e("CREATE_NEW_SURVEY")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"50px"}}),l.createElement(gi,{stepsList:Ni,onSubmit:()=>{},step:d,setStep:e=>{i((e=>({type:"SET_SURVEY_STEP",payload:e}))(e))}}),r&&l.createElement(t.Toast,{error:r.key,label:e(r.label),onClose:()=>{s(null)},isDleteBtn:"true"}))},wi=e=>{let{formData:o,setFormData:i,errors:r,setErrors:u,stateCode:s,Otp:c,setGetOtp:m,setUser:v}=e;const{data:p}=Digit.Hooks.useTenants(),[E,g]=n.useState(null),{t:f}=a.useTranslation(),h=Digit.ULBService.getCurrentTenantId(),y=n.useMemo(()=>null==p?void 0:p.filter(e=>h===(null==e?void 0:e.code)),[p,h]);n.useEffect(()=>{y&&y.length>0&&i(e=>d({},e,{city:y[0]}))},[y]);const{data:S}=Digit.Hooks.pt.useGenderMDMS(s,"common-masters","GenderType"),_=n.useMemo(()=>(null==S?void 0:S.map(e=>({i18nKey:"PT_COMMON_GENDER_"+e.code,code:e.code,value:e.code})))||[],[S]),C=e=>{const{name:t,value:n}=e.target;i(e=>d({},e,{[t]:n}))};return n.useEffect(()=>{console.log("UPDATED formData",o)},[o]),l.createElement("div",{style:{border:"2px solid #ccc",padding:"15px",borderRadius:"4px"}},l.createElement("h2",null,"Citizen Details"),l.createElement("div",{style:{border:"1px solid #ccc"}}),l.createElement("h3",null,"Mobile Number ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"mobile",value:o.mobile,onChange:C,placeholder:"Enter Mobile Number",required:!0,maxLength:10}),r.mobile&&l.createElement("span",{className:"error"},r.mobile),l.createElement("h3",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"city",name:"city",option:p,className:"cityCss",select:e=>{return t=e,void i(e=>d({},e,{city:t}));var t},placeholder:"Select City",optionKey:"i18nKey",t:f,disable:"pb.punjab"!==h,selected:"pb.punjab"===h?null==o?void 0:o.city:null==y?void 0:y[0]}),r.city&&l.createElement("span",{className:"error"},r.city),l.createElement("label",{onClick:()=>{const e=(()=>{const e={};return o.mobile?/^\d{10}$/.test(o.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",o.city||(e.city="City is required"),e})();if(u(e),0===Object.keys(e).length){var t,n;const e={userName:null==o?void 0:o.mobile,tenantId:(null==o||null===(t=o.city)||void 0===t?void 0:t.code).split(".")[0]},l={tenantId:(null==o||null===(n=o.city)||void 0===n?void 0:n.code).split(".")[0]};Digit.Surveys.userSearch(e,l).then(e=>{var t,n,l,a,o;v(null==e||null===(t=e.user)||void 0===t?void 0:t[0]),console.log("response=====",null==e||null===(n=e.user)||void 0===n?void 0:n[0]),console.log("response",null===(l=e.user[0])||void 0===l?void 0:l.emailId),("200"===(null==e||null===(a=e.responseInfo)||void 0===a?void 0:a.status)||"201"===(null==e||null===(o=e.responseInfo)||void 0===o?void 0:o.status))&&(null==e?void 0:e.user.length)>0?(console.log("coming here na"),i(t=>{var n,l,a,o;return d({},t,{citizenFound:!0,name:null===(n=e.user[0])||void 0===n?void 0:n.name,email:null===(l=e.user[0])||void 0===l?void 0:l.emailId,gender:null===(a=e.user[0])||void 0===a?void 0:a.gender,dob:null===(o=e.user[0])||void 0===o?void 0:o.dob,register:!1,user:e.user[0]})})):(console.log("not here"),i(e=>d({},e,{citizenFound:!1})),g({key:!0,isError:!0,label:"CITIZEN NOT FOUND FOR THE GIVEN DETAILS"}))}).catch(e=>{console.log(e)})}}},"Fetch Details"),!1===o.citizenFound&&l.createElement("div",{style:{display:"flex",flexDirection:"row",columnGap:"10px"}},l.createElement("h3",null,"Do you want to register?"),l.createElement("label",{style:{backgroundColor:"green"},onClick:()=>{i(e=>d({},e,{register:!0}))}},"Yes"),l.createElement("label",{style:{backgroundColor:"red"},onClick:()=>{i(e=>d({},e,{register:!1}))}},"No")),(!0===o.register||!0===o.citizenFound)&&l.createElement(n.Fragment,null,l.createElement("h3",null,"Citizen Name"),l.createElement("input",{type:"text",name:"name",value:o.name,onChange:C,placeholder:"Citizen Name",readOnly:o.citizenFound,maxLength:100}),r.name&&l.createElement("span",{className:"error"},r.name),l.createElement("h3",null,"Citizen Gender"),l.createElement("select",{id:"dropdown",value:null==o?void 0:o.gender,onChange:e=>{return t=e,void i(e=>d({},e,{gender:t.target.value}));var t}},l.createElement("option",{value:""},"--Please choose an option--"),_.map((e,t)=>l.createElement("option",{key:t,value:e.value},e.value))),r.gender&&l.createElement("span",{className:"error"},r.gender),l.createElement("h3",null,"Citizen Email"),l.createElement("input",{type:"email",id:"emailInput",name:"email",value:o.email,onChange:C,placeholder:"Citizen Email",defaultValue:o.email}),r.email&&l.createElement("span",{className:"error"},r.email),l.createElement("h3",null,"Citizen Date of Birth"),l.createElement("input",{name:"dob",type:"date",onChange:e=>{const{name:t,value:n}=e.target;i(e=>d({},e,{[t]:n}))},defaultValue:o.dob,value:o.dob}),r.dob&&l.createElement("span",{className:"error"},r.dob),!0===o.register&&l.createElement("label",{onClick:()=>(()=>{const e={otp:{name:o.name,permanentCity:o.city.code,tenantId:""+s,mobileNumber:o.mobile,type:"register"}};try{Digit.UserService.sendOtp(e,s).then(e=>{!0===(null==e?void 0:e.isSuccessful)?m(!0):(g({key:!0,isError:!0,label:""+e}),m(!1))})}catch(e){m(!1)}})()},"Get OTP")),!0===c?l.createElement(n.Fragment,null,l.createElement("h3",{style:{marginTop:"20px"}},"OTP"),l.createElement("input",{type:"text",name:"otp",value:o.otp,onChange:C,placeholder:"Enter Otp"}),r.otp&&l.createElement("span",{className:"error"},r.otp)):null,E&&l.createElement(t.Toast,{error:E.isError,label:f(E.label),onClose:()=>{g(null)},isDleteBtn:"true"}))},xi=e=>{var i;let{stateCode:r}=e;const u=o.useHistory(),{t:s}=a.useTranslation(),c=o.useLocation(),[m,p]=n.useState();console.log("loca",c.state.surveyDetails);const E=(null===(i=c.state)||void 0===i?void 0:i.surveyDetails)||{};console.log("surv det",E),Digit.UserService.getUser(),Digit.ULBService.getCurrentTenantId();const[g,f]=n.useState(null),[h,y]=n.useState(null),[S,_]=n.useState(!1),[C,b]=n.useState({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null});console.log("formData",C);const[T,D]=n.useState({});function N(e){const t=new Date(e),n=new Date;let l=n.getFullYear()-t.getFullYear();const a=n.getMonth()-t.getMonth();return(a<0||0===a&&n.getDate()<t.getDate())&&l--,l}return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},E.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},E.surveyDescription))),l.createElement("form",{onSubmit:function(e){try{let t=!1;if(e.preventDefault(),null===C.citizenFound)return f({key:!0,isError:!0,label:"PLEASE CLICK ON FETCH DETAILS BUTTON"}),Promise.resolve();const n=!0===C.register?(()=>{const e={};C.name?/^[A-Za-z\s]+$/.test(C.name)||(e.name="Name can only contain alphabets and spaces"):e.name="Name is required",C.email?/\S+@\S+\.\S+/.test(C.email)||(e.email="Invlid Email"):e.email="Email is required",C.gender||(e.gender="Gender is required");const t=N(C.dob);return C.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",C.mobile?/^\d{10}$/.test(C.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",C.city||(e.city="City is required"),C.otp||(e.otp="Otp is required"),D(e),0===Object.keys(e).length})():!0===C.citizenFound?(()=>{const e={};C.mobile?/^\d{10}$/.test(C.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",C.city||(e.city="City is required"),C.email?/\S+@\S+\.\S+/.test(C.email)||(e.email="Invlid Email"):e.email="Email is required",C.gender||(e.gender="Gender is required");const t=N(C.dob);return C.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",D(e),0===Object.keys(e).length})():null,l=function(){if(n){console.log("Form submitted:",C),console.log("reg",C.register,C.citizenFound),console.log("getUser",m);const e=C.user,n=function(){if((!1===C.register||null===C.register)&&!0===C.citizenFound){function n(e){var n;if(t)return e;console.log("formData",C),u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:C,userInfo:C.user,surveyDetails:E,userType:null===(n=c.state)||void 0===n?void 0:n.userType})}const l=C.email&&C.email!==(null==e?void 0:e.emailId),a=C.gender&&C.gender!==(null==e?void 0:e.gender),o=C.dob&&C.dob!==(null==e?void 0:e.dob),i=function(){if(l||a||o){const e=d({},m,l&&{emailId:C.email},a&&{gender:C.gender},o&&{dob:C.dob}),n=v(function(){return Promise.resolve(Digit.UserService.updateUser(e,null==m?void 0:m.tenantId)).then(function(e){let{user:t}=e;console.log("User updated:",t)})},function(e){console.error("Error updating user:",e),f({key:!0,isError:!0,label:"FAILED TO UPDATE USER INFORMATION"}),t=!0});if(n&&n.then)return n.then(function(){})}else console.log("No user info changed. Skipping API call.")}();return i&&i.then?i.then(n):n(i)}(()=>{let e={name:C.name,username:C.mobile,otpReference:C.otp,tenantId:""+r,permanentCity:C.city.code};try{Digit.UserService.registerUser(e,r).then(e=>{null===(null==e?void 0:e.UserRequest)&&void 0===(null==e?void 0:e.UserRequest)||u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:C,userInfo:e.UserRequest,surveyDetails:E}),console.log("res",e)})}catch(e){console.log(e)}})()}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},l.createElement(wi,{formData:C,setFormData:b,errors:T,setErrors:D,stateCode:r,Otp:S,setGetOtp:_,city:null==C?void 0:C.city,getUser:m,setUser:p}),l.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"10px",flexDirection:"row",marginTop:"10px"}},l.createElement("button",{type:"submit"},"Next"),l.createElement("button",{style:{backgroundColor:"none"},onClick:()=>b({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null})},"Reset")))),g&&l.createElement(t.Toast,{error:g.isError,label:s(g.label),onClose:()=>{f(null)},isDleteBtn:"true"}))},Ii=e=>{var n;const{t:o}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response[0])||void 0===n?void 0:n.uuid,info:e.props.isSuccess?o("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Li=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),o.useHistory()),[c,d]=n.useState(!1);return n.useEffect(()=>{i.clear(),window.history.replaceState(null,"CREATE_SURVEY_STATE")},[]),l.createElement(t.Card,null,l.createElement(Ii,{props:e.location.state}),l.createElement(t.CardText,null,u("SURVEY_FORM_CREATION_MESSAGE",{surveyName:null==e?void 0:e.title,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.startDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.endDate)})),l.createElement(t.ActionBar,null,l.createElement("button",{onClick:()=>{d(e=>!e)}},l.createElement(t.SubmitBar,{label:"Action"}),c&&l.createElement(t.Menu,{options:[u("GO_BACK_TO_HOME"),u("CREATE_ANOTHER_SURVEY")],onSelect:e=>{e===u("GO_BACK_TO_HOME")?s.replace("/digit-ui/employee"):e===u("CREATE_ANOTHER_SURVEY")&&s.replace("/digit-ui/employee/engagement/surveys/create-survey-step-form")}}))))},Oi=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_SURVEY_UPDATED":"ENGAGEMENT_SURVEY_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess&&null!=o&&null!==(i=o.data)&&void 0!==i&&null!==(r=i.Surveys)&&void 0!==r&&null!==(u=r[0])&&void 0!==u&&u.uuid?null==o||null===(m=o.data)||void 0===m||null===(v=m.Surveys)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid:o.isSuccess?null===(s=o.data)||void 0===s||null===(c=s.Documents)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.uuid:""),info:e.isSuccess?n("SURVEY_FORM_ID"):"",successful:e.isSuccess});var o,i,r,u,s,c,d,m,v,p},Ri=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useUpdate()),{state:c}=e.location;return n.useEffect(()=>{c&&s.mutate(c,{onSuccess:()=>{i.clear(),window.history.replaceState(null,"UPDATE_SURVEY_STATE")}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Oi,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Pi=e=>{let{t:a,question:o,control:r,register:u,formState:s,formDisabled:c,index:d}=e;const m=null==s?void 0:s.errors;if(o)return l.createElement(t.Card,null,l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("span",{className:"question-title"},d+1,". ",o.questionStatement," ",null!=o&&o.required?"*":""),l.createElement("span",null,(e=>{var s,d,v,p,E,g,f,h;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:200,message:a("EXCEEDS_200_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(s=m[o.uuid])||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(d=m[o.uuid])||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_200_CHAR_LIMIT")));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:o.uuid,disabled:c,inputRef:u({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(v=m[o.uuid])||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(p=m[o.uuid])||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_500_CHAR_LIMIT")));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.RadioButtons,{disabled:c,onSelect:n,selectedOption:a,optionsKey:"",options:[...o.options]})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(E=m[o.uuid])||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement("div",{className:"align-columns"},o.options.map(e=>{var o;return l.createElement(t.CheckBox,{disable:c,key:e,onChange:t=>{t.target.checked?n([e,...a||[]]):a&&n(null==a?void 0:a.filter(t=>t!==e))},checked:"string"==typeof a?!(null===(o=[a])||void 0===o||!o.find(t=>t===e)):!(null==a||!a.find(t=>t===e)),label:e,checkboxWidth:{width:"34px",height:"34px"},style:{marginTop:"5px",overflowWrap:"break-word"}})}))}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(g=m[o.uuid])||void 0===g?void 0:g.type)&&l.createElement(t.CardLabelError,{style:{marginTop:"20px"}},a("CS_COMMON_REQUIRED")));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{disabled:c,type:"date",onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(f=m[o.uuid])||void 0===f?void 0:f.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",disabled:c,onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(h=m[o.uuid])||void 0===h?void 0:h.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));default:return l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:60,message:a("EXCEEDS_60_CHAR_LIMIT")},required:o.required})})}})(o.type))))},Mi=e=>{var n,o;let{surveyData:r,onFormSubmit:u,submitDisabled:s,formDisabled:c,formDefaultValues:d,isLoading:m,showToast:v,isSubmitDisabled:p}=e;const{register:E,control:g,handleSubmit:f,getValues:h,formState:y}=i.useForm({defaultValues:d}),{t:S}=a.useTranslation();return m?l.createElement(t.Loader,null):l.createElement("div",{className:"citizenSurvey-wrapper"},l.createElement(t.Header,null,null==r||null===(n=r.title)||void 0===n?void 0:n.toUpperCase()),l.createElement("form",{onSubmit:f(u)},null!=r&&null!==(o=r.questions)&&void 0!==o&&o.length?r.questions.map((e,t)=>l.createElement(Pi,{key:t,t:S,question:e,control:g,register:E,values:h,formState:y,formDisabled:c,index:t})):null,v&&l.createElement(t.Toast,{error:v.key,label:S(v.label)}),l.createElement(t.ActionBar,null,!s&&l.createElement(t.SubmitBar,{disabled:p,label:S("CS_SUBMIT_SURVEY"),submit:"submit"}))))},Fi=(e,t)=>{let n=[];return e.map(e=>{let l={};"Check Boxes"===e.type?(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,l.answers=[],t.map(t=>{var n,a;e.uuid===t.questionId&&(l.timeStamp=Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)+" "+Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime),l.answers=[...l.answers,t.answer])})):(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,t.map(t=>{if(e.uuid===t.questionId){var n,a;l.timeStamp=Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)+" "+Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime);const e=l.answers;e&&e.push(t.answer[0]),l.answers=e||[t.answer[0]]}})),n.push(l)}),n},ki=e=>{let{t:t,userInfo:n}=e;const a=Object.entries(n);return l.createElement("div",{style:{margin:"30px"}},l.createElement("header",{style:{fontSize:"30px",fontWeight:"bold"}},t("WHO_RESPONDED")),l.createElement("div",{style:{display:"flex",padding:"8px 4px","background-color":"#FAFAFA",border:"1px solid #D6D5D4",boxSizing:"borderBox",borderRadius:"4px",marginTop:"20px",marginBottom:"20px"}},l.createElement("div",{style:{flex:"50%",padding:"10px"}},l.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_EMAIL")),a.map(e=>l.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[1]))),l.createElement("div",{style:{flex:"50%",padding:"10px"}},l.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_PHONE_NUMBER")),a.map(e=>l.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[0])))))},Bi=e=>{let{surveyTitle:a,surveyDesc:i,t:r,surveyId:u}=e;const s=o.useHistory(),c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser().info,v=c.filter(e=>{var t;return null==m||null===(t=m.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=n.useMemo(()=>c.filter(e=>e.code===d),[c]);return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("LABEL_FOR_ULB")+" * :"),l.createElement("div",{style:{display:"grid",gridAutoFlow:"row"}},l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:v,selected:p,keepNull:!0,disable:!0,t:r}),l.createElement(t.RemoveableTag,{key:"tag",text:r(v[0].i18nKey),extraStyles:{tagStyles:{display:"flex"}}})),l.createElement(t.LinkLabel,{onClick:()=>s.push("/digit-ui/employee/engagement/surveys/inbox/details/"+u)},r("VIEW_SURVEY_QUESTIONS"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",disable:!0,value:a})),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",disable:!0,value:i})))},Ui=["#8E29BF","#FBC02D","#048BD0","#EA8A3B","#0BABDE","#800080","#ee82ee","#616161","#3cb371","#6a5acd"],Hi=Math.PI/180,Vi=e=>{let{cx:t,cy:n,midAngle:a,innerRadius:o,outerRadius:i,percent:r}=e;const u=o+.5*(i-o),s=t+u*Math.cos(-a*Hi),c=n+u*Math.sin(-a*Hi);return l.createElement("text",{x:s,y:c,fill:"white",textAnchor:s>t?"start":"end",dominantBaseline:"central"},(100*r).toFixed(0)+"%")},Wi=e=>{const{payload:t}=e;return l.createElement("div",{style:{display:"flex",flexDirection:"column",height:"300px"}},l.createElement("div",{style:{overflow:"auto",flex:"1"}},l.createElement("ul",{style:{listStyle:"disc"}},null==t?void 0:t.map((e,t)=>l.createElement("li",{key:"item-"+t,style:{display:"list-item",color:e.color,fontSize:"19px"}},e.value)))))},qi=e=>{const t=(e=>{const t=e.options,n=e.answers,l=[];return null==t||t.map(e=>l.push({name:e,value:0})),null==n||n.map((e,t)=>{null==l||l.map((t,n)=>{t.name===e&&(l[n].value=l[n].value+1)})}),l})(e.data);return l.createElement(s.PieChart,{width:400,height:400},l.createElement(s.Pie,{data:t,cx:200,cy:200,labelLine:!1,label:Vi,outerRadius:120,fill:"#8884d8",dataKey:"value"},null==t?void 0:t.map((e,t)=>l.createElement(s.Cell,{key:"cell-"+t,fill:Ui[t%Ui.length]}))),l.createElement(s.Tooltip,null),l.createElement(s.Legend,{content:Wi,width:100,align:"right",wrapperStyle:{top:40,right:20,left:500,backgroundColor:"#FAFAFA",borderRadius:3,lineHeight:"40px"}}))},ji=e=>{const t=(e=>{const t=[],n=e.answers;return e.options.map(e=>{const l={};l.name=e,l.value=0,n.map(t=>{t.map(t=>{t===e&&(l.value=l.value+1)})}),t.push(l)}),t})(e.data);return l.createElement("div",{style:{padding:"10px",width:"700px",height:"260px",backgroundColor:"#fafafa"}},l.createElement(s.ResponsiveContainer,null,l.createElement(s.BarChart,{data:t,layout:"vertical",margin:{top:0,right:50,left:0,bottom:0},barCategoryGap:8},l.createElement(s.CartesianGrid,{strokeDasharray:"3 3"}),l.createElement(s.XAxis,{type:"number"}),l.createElement(s.YAxis,{type:"category",width:150,padding:{left:20},dataKey:"name"}),l.createElement(s.Bar,{dataKey:"value",fill:"#048BD0"}),l.createElement(s.Tooltip,null))))},zi=e=>{const t=e.split("-");return{day:t[2],date:["January","February","March","April","May","June","July","August","September","October","November","December"][t[1]-1]+" "+t[0]}},Yi=e=>{let{surveyInfo:o,responsesInfoMutation:i}=e;const{t:r}=a.useTranslation(),[u,s]=n.useState(null),[c,d]=n.useState({}),m=Digit.ULBService.getCurrentTenantId();return n.useEffect(function(){try{const e=function(){if(i.isSuccess){const e=Fi(null==o?void 0:o.questions,i.data.answers);return s(e),Promise.resolve(function(e,t){try{let n={},l=[];return l=null==e?void 0:e.map(e=>Digit.UserService.userSearch(t,{uuid:[null==e?void 0:e.citizenId]},{}).then(e=>e)),Promise.resolve(Promise.all(l)).then(function(e){var t;return l=e,l&&(null===(t=l)||void 0===t?void 0:t.length)>0&&l.map(e=>{var t,l,a,o;n["+91 "+(null==e||null===(t=e.user)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.mobileNumber)]=null==e||null===(a=e.user)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.emailId}),n})}catch(e){return Promise.reject(e)}}(i.data.answers,m.split(".")[0])).then(function(e){d(e)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[i]),u?l.createElement("div",{className:"custom-group-merge-container"},l.createElement(t.Header,null,r("CS_COMMON_SURVEYS")),l.createElement(t.MultiLink,{style:{marginTop:"-45px"},onHeadClick:()=>(()=>{const e=((e,t)=>{const n=parseInt(t.length/e.length),l=Fi(null==o?void 0:o.questions,i.data.answers),a=[];for(let t=0;t<n;t++){const n={TimeStamp:""};null==e||e.map(e=>{n[e.questionStatement]=""});const o=null==e?void 0:e.map(e=>e.questionStatement);null==o||o.map(e=>{var a,o,i,r,u,s,c,d,m,v,p,E,g,f,h,y;const S=null==l?void 0:l.filter(t=>(null==t?void 0:t.questionStatement)===e),_="object"==typeof(null==S||null===(a=S[0])||void 0===a||null===(o=a.answers)||void 0===o?void 0:o[t])?null!=S&&null!==(i=S[0])&&void 0!==i&&null!==(r=i.answers)&&void 0!==r&&null!==(u=r[t])&&void 0!==u&&null!==(s=u.join())&&void 0!==s&&s.includes("ul")?"NA":null==S||null===(c=S[0])||void 0===c||null===(d=c.answers)||void 0===d||null===(m=d[t])||void 0===m?void 0:m.join():"ul"===(null==S||null===(v=S[0])||void 0===v||null===(p=v.answers)||void 0===p?void 0:p[t])||""===(null==S||null===(E=S[0])||void 0===E||null===(g=E.answers)||void 0===g?void 0:g[t])?"NA":null==S||null===(f=S[0])||void 0===f||null===(h=f.answers)||void 0===h?void 0:h[t];n[e]=_,n.TimeStamp=null==S||null===(y=S[0])||void 0===y?void 0:y.timeStamp}),a.push(n)}return a})(null==o?void 0:o.questions,i.data.answers);return Digit.Download.Excel(e,i.data.title)})(),downloadBtnClassName:"employee-download-btn-className",label:r("SURVEY_REPORT")}),l.createElement(t.Card,null,l.createElement("div",{style:{margin:"30px"}},l.createElement(Bi,{surveyTitle:o.title,surveyDesc:o.description,t:r,surveyId:o.uuid})),l.createElement(ki,{t:r,userInfo:c}),null==u?void 0:u.map(e=>{var n;return function(e,n,a,o,i){switch(void 0===o&&(o=0),a){case"Short Answer":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Date":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"date-response"},l.createElement("div",null,zi(e).date),l.createElement("div",{className:"divide"}),l.createElement("div",null,zi(e).day)))));case"Time":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>{return l.createElement("div",{className:"date-response"},l.createElement("div",null,e),l.createElement("div",{className:"divide"}),l.createElement("div",null,((t=(t=e).toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[t]).length>1&&((t=t.slice(1))[5]=+t[0]<12?" AM":" PM",t[0]=+t[0]%12||12),t.join(""))));var t})));case"Paragraph":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Check Boxes":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{padding:"30px"}},l.createElement(ji,{data:e})));case"Multiple Choice":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{overflow:"-moz-hidden-unscrollable"}},l.createElement(qi,{data:e})))}}(e,null==e?void 0:e.answers,null==e?void 0:e.type,null==e||null===(n=e.answers)||void 0===n?void 0:n.length,r)}))):l.createElement(t.Loader,null)},Gi={SHORT_ANSWER_TYPE:"Short Answer",LONG_ANSWER_TYPE:"Paragraph",MULTIPLE_ANSWER_TYPE:"Multiple Choice",CHECKBOX_ANSWER_TYPE:"Check Boxes",DATE_ANSWER_TYPE:"Date",TIME_ANSWER_TYPE:"Time"},Ki=()=>{const e=Digit.ULBService.getCurrentTenantId(),a=o.useParams(),i=Digit.Hooks.survey.useShowResults(),u=r.useQueryClient();n.useEffect(()=>{i.mutate({surveyId:a.id},{onSuccess:()=>{u.clear()}})},[]);const{isLoading:s,data:c}=Digit.Hooks.survey.useSearch({tenantIds:e,uuid:a.id},{select:e=>{var t;const n=null==e||null===(t=e.Surveys)||void 0===t?void 0:t[0];return{uuid:n.uuid,title:n.title,description:n.description,fromDate:we(new Date(n.startDate),"yyyy-MM-dd"),toDate:we(new Date(n.endDate),"yyyy-MM-dd"),fromTime:we(new Date(n.startDate),"hh:mm"),toTime:we(new Date(n.endDate),"hh:mm"),questions:n.questions.map(e=>{let{questionStatement:t,type:n,required:l,options:a,uuid:o,surveyId:i}=e;return{questionStatement:t,type:Gi[n],required:l,options:a,uuid:o,surveyId:i}}),status:n.status,answersCount:n.answersCount}}});return s?l.createElement(t.Loader,null):l.createElement(Yi,{surveyInfo:c,responsesInfoMutation:i})},Qi=e=>{var n,o;const{t:i}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Xi=e=>{r.useQueryClient();const{t:n}=a.useTranslation();return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Qi,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},Zi=e=>{const a=e.location.state.data;console.log("questions data",a);const[o,i]=n.useState(""),r=e=>{i("")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("form",null,a.sections.length>0?a.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((e,a)=>l.createElement("div",null,l.createElement("h3",null,e.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},a+1,". ",e.question.questionStatement," ",(null==e?void 0:e.required)&&l.createElement("span",{style:{color:"red"}},"*")),((e,a,i)=>{switch(console.log("answer type",e,a),e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,disable:!0,textInputStyle:{maxWidth:"none"},type:"text"}));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},disable:!0,disabled:!0}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:o,onChange:r},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,disabled:!0,required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText))));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,disabled:!0}),e.optionText))));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},disable:!0}));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},disable:!0}));default:return l.createElement(t.TextInput,{name:a.uuid,disable:!0,type:"text"})}})(e.question.type,e.question),l.createElement("div",null)))))):null)))},$i=e=>{var a,o,i,r,s,c,d;let{t:m,registerRef:v,controlSurveyForm:p,surveyFormState:E,surveyFormData:g,readOnly:f}=e;const h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),{data:_,isLoading:C}=Digit.Hooks.useTenants();console.log("cities",_),n.useEffect(()=>{if(!C&&null!=_&&_.length&&(null==D||!D.ulb)){const e=null==_?void 0:_.find(e=>e.code===S);e&&T(yi(D.id,{ulb:e}))}},[_,C,S]);const b=Digit.UserService.getUser().info,T=u.useDispatch(),D=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);console.log("surveyDetails====",D);const N=h.filter(e=>{var t;return null==b||null===(t=b.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);console.log("userulbs",N),n.useMemo(()=>h.filter(e=>e.code===S),[h]);const A=e=>{const{name:t,value:n}=e.target;T(yi(D.id,{[t]:n}))};return console.log("survey deta",D),console.log("bb",g,E,v,p),l.createElement("div",{className:"create-survey-card"},l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"ulb",name:"ulb",option:_,className:"cityCss",select:e=>{T(yi(D.id,{ulb:e}))},placeholder:"Select City",optionKey:"i18nKey",t:m,selected:D.ulb}),(null==E||null===(a=E.errors)||void 0===a?void 0:a.tenantIds)&&l.createElement(t.CardLabelError,null,m("ES_ERROR_REQUIRED"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,m("CS_SURVEY_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,{name:"name",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED"),maxLength:{value:500,message:m("Survey Name length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:D.name,onChange:A,placeholder:"Enter Survey Name",disable:f||!1}),(null==E||null===(o=E.errors)||void 0===o?void 0:o.title)&&l.createElement(t.CardLabelError,null,null==E||null===(i=E.errors)||void 0===i||null===(r=i.title)||void 0===r?void 0:r.message))),l.createElement("div",{className:"survey-column",style:{width:"100%"}},l.createElement("label",null,m("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",inputRef:v({maxLength:{value:500,message:m("Survey Description length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:D.description,onChange:A,placeholder:"Enter Survey Description",disable:f||!1}),(null==E||null===(s=E.errors)||void 0===s?void 0:s.description)&&l.createElement(t.CardLabelError,null,null==E||null===(c=E.errors)||void 0===c||null===(d=c.description)||void 0===d?void 0:d.message)))},Ji=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,t.getFullYear()+"-"+n+"-"+l},er=e=>{var n,a,o,r,s,c,d,m;let{t:v,controlSurveyForm:p,surveyFormState:E,enableEndDateTimeOnly:g,readOnly:f}=e;const h=null==E?void 0:E.errors,y=u.useDispatch(),{getValues:S}=i.useFormContext(),_=(new Date).getTime(),C=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),b=e=>{const{name:t,value:n}=e.target;y(yi(C.id,{[t]:n}))};return l.createElement("div",{className:"create-survey-card"},l.createElement("div",null,l.createElement(t.CardSectionHeader,null,v("Survey Publish Period")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"20px"}})),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromDate",defaultValue:C.fromDate,onChange:b,rules:{required:!0,validate:g?null:{isValidFromDate:e=>{const t=new Date(e).getTime(),n=S("toDate")?new Date(S("toDate")).getTime():(new Date).getTime();return e===S("toDate")&&e>=Ji(_)||n>=t&&e>=Ji(_)}}},render:e=>l.createElement(t.TextInput,{name:"fromDate",type:"date",onChange:b,defaultValue:C.fromDate,disable:f||!1})}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(n=h.fromDate)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(a=h.fromDate)||void 0===a?void 0:a.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_FROM_DATE_ERROR_INVALID"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromTime",defaultValue:C.fromTime,rules:{required:!0,validate:{isValidFromTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"fromTime",type:"time",onChange:b,defaultValue:C.fromTime,disable:f||!1})}),h&&(null==h?void 0:h.fromTime)&&"required"===(null==h||null===(o=h.fromTime)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromTime)&&"isValidFromDate"===(null==h||null===(r=h.fromTime)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toDate",defaultValue:C.toDate,rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>=(S("fromDate")?new Date(S("fromDate")).getTime():(new Date).getTime())}},render:e=>l.createElement(t.TextInput,{name:"toDate",type:"date",onChange:b,defaultValue:C.toDate,disable:f||!1})}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(s=h.toDate)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(c=h.toDate)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))," "),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toTime",defaultValue:null==C?void 0:C.toTime,rules:{required:!0,validate:{isValidToTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"toTime",type:"time",onChange:b,defaultValue:C.toTime,disable:f||!1})}),h&&(null==h?void 0:h.toTime)&&"required"===(null==h||null===(d=h.toTime)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toTime)&&"isValidToDate"===(null==h||null===(m=h.toTime)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))))},tr=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],nr=e=>{let{t:t,initialFormValues:a,onSubmit:o,isFormDisabled:r=!1,readOnly:u}=e;const s=i.useForm({defaultValues:a}),{register:c,control:v,handleSubmit:p,setValue:E,getValues:g,reset:f,formState:h,clearErrors:y}=s,S=m(s,tr);return console.log("surveyformValue",g,v,h),n.useEffect(()=>{c("questions")},[]),l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,d({register:c,control:v,handleSubmit:p,setValue:E,getValues:g,reset:f,formState:h,clearErrors:y},S),l.createElement("form",{onSubmit:p(o),style:{marginRight:"10px"}},l.createElement($i,{t:t,registerRef:c,controlSurveyForm:v,surveyFormState:h,surveyFormData:g,readOnly:u}),l.createElement(er,{t:t,controlSurveyForm:v,surveyFormState:h,readOnly:u}))))},lr=e=>{let{readOnly:t}=e;const{t:n}=a.useTranslation(),o=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),i=Digit.UserService.getUser().info,r=o.filter(e=>{var t;return null==i||null===(t=i.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});return l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement(nr,{t:n,initialFormValues:{fromDate:"",fromTime:"",toDate:"",toTime:"",questions:{},tenantIds:r},readOnly:t}))},ar=e=>l.createElement("div",null,l.createElement("h4",null,"Question"),l.createElement("select",null,l.createElement("option",{value:""},"Select Answer Type"),l.createElement("option",{value:"text"},"Text"),l.createElement("option",{value:"number"},"Number"),l.createElement("option",{value:"date"},"Date")),l.createElement("input",{type:"text",placeholder:"Answer"})),or=e=>{let{category:t,sectionId:n}=e;const a=u.useDispatch();return l.createElement("div",null,l.createElement("h3",null,"Category"),l.createElement("input",{type:"number",value:t.weightage,onChange:e=>{a(((e,t,n)=>({type:"UPDATE_CATEGORY_WEIGHTAGE",sectionId:e,categoryId:t,weightage:n}))(n,t.id,e.target.value))},placeholder:"Category Weightage"}),l.createElement("button",{onClick:()=>{a(((e,t)=>({type:"ADD_QUESTION",sectionId:e,categoryId:t}))(n,t.id))}},"Add Question"),t.questions.map(e=>l.createElement(ar,{key:e.id,question:e})))},ir=e=>{var n;let{section:a}=e;const o=u.useDispatch();return console.log("section in section js",a.categories),l.createElement("div",null,l.createElement("h2",null,"Section"),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},"CS_COMMON_QUESTION"),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(t.TextInput,{value:null==a?void 0:a.weightage,onChange:e=>{o({type:"UPDATE_SECTION_WEIGHTAGE",sectionId:a.id,weightage:e.target.value})},placeholder:"Section Weightage",name:"weightage"}),l.createElement("button",{onClick:()=>{o({type:"ADD_CATEGORY",sectionId:a.id})}},"Add Category"),null!=a&&null!==(n=a.categories)&&void 0!==n&&n.length?a.categories.map(e=>l.createElement(or,{key:e.id,category:e,sectionId:null==a?void 0:a.id})):null,".")))},rr=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],ur=e=>{let{match:{path:n}={},tenants:a,parentRoute:i,userType:r,stateCode:u}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(Zo,d({},e,{tenants:a,parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/create-category",component:e=>l.createElement($o,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-categories",component:e=>l.createElement(ti,d({},e,{parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/create-questions",component:e=>l.createElement(di,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-questions",component:e=>l.createElement(pi,e)}),l.createElement(t.PrivateRoute,{path:n+"/create-survey-step-form",component:e=>l.createElement(Ai,e)}),l.createElement(t.PrivateRoute,{path:n+"/fill-citizen-details-survey",component:e=>l.createElement(xi,d({},e,{stateCode:u}))}),l.createElement(t.PrivateRoute,{path:n+"/fill-survey",component:e=>l.createElement(bo,d({},e,{userType:r}))}),l.createElement(t.PrivateRoute,{path:n+"/active-open-surveys",component:e=>l.createElement(ho,d({},e,{userType:r}))}),l.createElement(t.PrivateRoute,{path:n+"/create-response",component:e=>l.createElement(Li,e)}),l.createElement(t.PrivateRoute,{path:n+"/update-response",component:e=>l.createElement(Ri,e)}),l.createElement(t.PrivateRoute,{path:n+"/submit-response",component:e=>l.createElement(Xi,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/results/:id",component:e=>l.createElement(Ki,e)}),l.createElement(t.PrivateRoute,{path:n+"/previewQuestions",component:e=>l.createElement(Zi,e)}))},sr=e=>{let{t:n}=e;return l.createElement(l.Fragment,null,l.createElement("div",{style:{textAlign:"-webkit-center",marginTop:"30%",marginRight:"10%"}},l.createElement("svg",{width:"255",height:"245",viewBox:"0 0 255 245",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("g",{"clip-path":"url(#clip0_47664_105169)"},l.createElement("path",{d:"M214.607 58.0692H213.267V21.2879C213.267 15.642 211.027 10.2273 207.039 6.23508C203.051 2.24282 197.641 2.77689e-09 192.001 2.77689e-09H114.153C111.36 -4.51493e-05 108.595 0.550538 106.015 1.62031C103.435 2.69009 101.09 4.2581 99.1157 6.23483C97.1409 8.21157 95.5744 10.5583 94.5056 13.141C93.4369 15.7238 92.8868 18.492 92.8867 21.2875V223.073C92.8867 228.719 95.1273 234.133 99.1154 238.125C103.104 242.118 108.513 244.36 114.153 244.36H192C197.64 244.36 203.049 242.118 207.038 238.125C211.026 234.133 213.266 228.719 213.266 223.073V84.2507H214.606L214.607 58.0692Z",fill:"#3F3D56"}),l.createElement("path",{d:"M208.905 19.8617V224.497C208.904 228.778 207.206 232.883 204.182 235.91C201.159 238.938 197.058 240.639 192.782 240.641H113.337C109.059 240.641 104.956 238.941 101.93 235.914C98.9044 232.886 97.2039 228.78 97.2026 224.497V19.8617C97.2039 15.5795 98.9043 11.4732 101.93 8.44588C104.955 5.41857 109.058 3.7182 113.336 3.71875H122.973C122.5 4.88362 122.32 6.14702 122.449 7.39789C122.577 8.64876 123.011 9.84881 123.712 10.8926C124.412 11.9363 125.358 12.7918 126.467 13.3838C127.575 13.9759 128.812 14.2863 130.068 14.2879H175.361C176.617 14.2863 177.854 13.9759 178.962 13.3838C180.07 12.7918 181.016 11.9363 181.717 10.8926C182.418 9.84881 182.851 8.64876 182.98 7.39789C183.109 6.14702 182.929 4.88362 182.456 3.71875H192.779C197.055 3.71948 201.156 5.42005 204.18 8.44661C207.204 11.4732 208.904 15.578 208.905 19.8586V19.8617Z",fill:"white"}),l.createElement("path",{d:"M153.04 102.01C171.357 102.01 186.207 87.1455 186.207 68.8088C186.207 50.4722 171.357 35.6074 153.04 35.6074C134.722 35.6074 119.872 50.4722 119.872 68.8088C119.872 87.1455 134.722 102.01 153.04 102.01Z",fill:"#a82227"}),l.createElement("path",{d:"M189.213 137.735H118.616C118.27 137.734 117.937 137.596 117.692 137.351C117.447 137.106 117.309 136.773 117.309 136.426V118.896C117.31 118.55 117.447 118.217 117.692 117.972C117.938 117.726 118.27 117.588 118.616 117.588H189.213C189.559 117.588 189.891 117.726 190.137 117.972C190.382 118.217 190.519 118.55 190.52 118.896V136.426C190.519 136.773 190.382 137.106 190.137 137.351C189.891 137.596 189.559 137.735 189.213 137.735V137.735ZM118.616 118.111C118.408 118.111 118.209 118.194 118.062 118.341C117.915 118.489 117.832 118.688 117.832 118.896V136.426C117.832 136.635 117.915 136.834 118.062 136.981C118.209 137.129 118.408 137.211 118.616 137.212H189.213C189.421 137.211 189.62 137.129 189.767 136.981C189.914 136.834 189.997 136.635 189.997 136.426V118.896C189.997 118.688 189.914 118.489 189.767 118.341C189.62 118.194 189.421 118.111 189.213 118.111H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 123.901C140.206 123.901 139.973 123.998 139.802 124.17C139.63 124.341 139.534 124.575 139.534 124.817C139.534 125.06 139.63 125.293 139.802 125.465C139.973 125.637 140.206 125.734 140.449 125.734H183.591C183.833 125.743 184.07 125.655 184.248 125.49C184.426 125.325 184.531 125.096 184.541 124.853C184.55 124.61 184.462 124.374 184.297 124.195C184.132 124.017 183.903 123.912 183.661 123.902C183.647 123.902 183.634 123.902 183.621 123.902L140.449 123.901Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 129.396C140.206 129.396 139.973 129.493 139.802 129.665C139.63 129.837 139.534 130.07 139.534 130.313C139.534 130.556 139.63 130.789 139.802 130.96C139.973 131.132 140.206 131.229 140.449 131.229H183.591C183.833 131.238 184.07 131.15 184.248 130.985C184.426 130.82 184.531 130.591 184.541 130.348C184.55 130.105 184.462 129.869 184.297 129.69C184.132 129.512 183.903 129.407 183.661 129.397C183.647 129.397 183.634 129.397 183.621 129.397L140.449 129.396Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 166.953H118.616C118.27 166.953 117.937 166.815 117.692 166.57C117.447 166.324 117.309 165.992 117.309 165.645V148.115C117.31 147.768 117.447 147.436 117.692 147.19C117.938 146.945 118.27 146.807 118.616 146.807H189.213C189.559 146.807 189.891 146.945 190.137 147.19C190.382 147.436 190.519 147.768 190.52 148.115V165.645C190.519 165.992 190.381 166.324 190.136 166.57C189.891 166.815 189.559 166.953 189.213 166.953ZM118.616 147.33C118.408 147.33 118.209 147.413 118.062 147.56C117.915 147.707 117.832 147.907 117.832 148.115V165.645C117.832 165.853 117.915 166.053 118.062 166.2C118.209 166.347 118.408 166.43 118.616 166.43H189.213C189.421 166.43 189.62 166.347 189.767 166.2C189.914 166.053 189.997 165.853 189.997 165.645V148.115C189.997 147.907 189.914 147.707 189.767 147.56C189.62 147.413 189.421 147.33 189.213 147.33H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 153.214C140.206 153.214 139.973 153.31 139.802 153.482C139.63 153.654 139.534 153.887 139.534 154.13C139.534 154.373 139.63 154.606 139.802 154.778C139.973 154.95 140.206 155.046 140.449 155.046H183.591C183.83 155.045 184.059 154.95 184.229 154.781C184.399 154.613 184.497 154.384 184.501 154.145C184.505 153.905 184.415 153.674 184.25 153.5C184.086 153.326 183.86 153.223 183.621 153.214H140.449V153.214Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 158.711C140.206 158.711 139.973 158.807 139.802 158.979C139.63 159.151 139.534 159.384 139.534 159.627C139.534 159.87 139.63 160.103 139.802 160.275C139.973 160.447 140.206 160.543 140.449 160.543H183.591C183.83 160.542 184.059 160.447 184.229 160.278C184.399 160.11 184.497 159.881 184.501 159.642C184.505 159.402 184.415 159.171 184.25 158.997C184.086 158.823 183.86 158.72 183.621 158.711H140.449V158.711Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 196.267H118.616C118.27 196.266 117.937 196.129 117.692 195.883C117.447 195.638 117.309 195.305 117.309 194.958V177.429C117.31 177.082 117.447 176.749 117.692 176.504C117.938 176.259 118.27 176.121 118.616 176.12H189.213C189.559 176.121 189.891 176.259 190.137 176.504C190.382 176.749 190.519 177.082 190.52 177.429V194.959C190.519 195.306 190.382 195.638 190.137 195.883C189.891 196.129 189.559 196.267 189.213 196.267V196.267ZM118.616 176.643C118.408 176.644 118.209 176.726 118.062 176.874C117.915 177.021 117.832 177.221 117.832 177.429V194.959C117.832 195.167 117.915 195.366 118.062 195.514C118.209 195.661 118.408 195.744 118.616 195.744H189.213C189.421 195.744 189.62 195.661 189.767 195.514C189.914 195.366 189.997 195.167 189.997 194.959V177.429C189.997 177.221 189.914 177.021 189.767 176.874C189.62 176.726 189.421 176.644 189.213 176.643H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 182.529C140.206 182.529 139.973 182.626 139.802 182.798C139.63 182.969 139.534 183.202 139.534 183.445C139.534 183.688 139.63 183.921 139.802 184.093C139.973 184.265 140.206 184.362 140.449 184.362H183.591C183.711 184.366 183.831 184.347 183.943 184.305C184.056 184.264 184.16 184.2 184.248 184.118C184.336 184.036 184.407 183.938 184.457 183.829C184.508 183.719 184.536 183.601 184.541 183.481C184.545 183.361 184.526 183.241 184.484 183.128C184.443 183.015 184.379 182.912 184.297 182.823C184.216 182.735 184.117 182.664 184.008 182.613C183.899 182.563 183.781 182.535 183.661 182.53C183.647 182.53 183.634 182.53 183.621 182.53L140.449 182.529Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 188.025C140.206 188.025 139.973 188.122 139.802 188.294C139.63 188.466 139.534 188.699 139.534 188.942C139.534 189.184 139.63 189.418 139.802 189.589C139.973 189.761 140.206 189.858 140.449 189.858H183.591C183.711 189.862 183.831 189.843 183.943 189.801C184.056 189.76 184.16 189.696 184.248 189.614C184.336 189.533 184.407 189.434 184.457 189.325C184.508 189.216 184.536 189.097 184.541 188.977C184.545 188.857 184.526 188.737 184.484 188.624C184.443 188.511 184.379 188.408 184.297 188.319C184.216 188.231 184.117 188.16 184.008 188.11C183.899 188.059 183.781 188.031 183.661 188.026C183.647 188.026 183.634 188.026 183.621 188.026H140.449L140.449 188.025Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M254.334 245H0.665646C0.297787 245 0 244.839 0 244.641C0 244.442 0.29813 244.281 0.665646 244.281H254.334C254.702 244.281 255 244.442 255 244.641C255 244.839 254.702 245 254.334 245Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.591 230.984C242.507 231.365 241.344 231.461 240.212 231.261C239.081 231.062 238.02 230.574 237.132 229.845C234.869 227.944 234.16 224.812 233.583 221.913L231.876 213.336L235.45 215.799C238.02 217.571 240.648 219.399 242.428 221.965C244.208 224.531 244.984 228.034 243.554 230.81",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.039 241.965C243.489 238.684 243.952 235.361 243.636 232.046C243.356 229.101 242.458 226.225 240.631 223.866C239.661 222.617 238.481 221.547 237.144 220.703C236.795 220.483 236.474 221.036 236.821 221.255C239.135 222.719 240.925 224.881 241.932 227.429C243.045 230.263 243.224 233.351 243.032 236.361C242.915 238.181 242.67 239.989 242.422 241.795C242.403 241.877 242.415 241.963 242.456 242.036C242.498 242.109 242.565 242.163 242.646 242.188C242.727 242.21 242.814 242.199 242.888 242.157C242.961 242.115 243.016 242.046 243.038 241.965H243.039Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M239.801 236.7C239.337 237.408 238.698 237.983 237.946 238.371C237.195 238.759 236.356 238.947 235.511 238.917C233.339 238.814 231.529 237.297 229.899 235.857L225.078 231.595L228.269 231.443C230.563 231.333 232.917 231.23 235.104 231.938C237.291 232.647 239.305 234.351 239.704 236.614",fill:"#E6E6E6"}),l.createElement("path",{d:"M244.311 243.85C242.147 240.015 239.633 235.752 235.145 234.389C233.897 234.011 232.589 233.876 231.29 233.991C230.88 234.025 230.983 234.658 231.393 234.622C233.57 234.441 235.742 235.017 237.545 236.252C239.28 237.434 240.631 239.077 241.774 240.82C242.474 241.885 243.101 243 243.728 244.111C243.928 244.466 244.514 244.21 244.311 243.85Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M127.423 133.05C130.456 133.05 132.914 130.59 132.914 127.554C132.914 124.518 130.456 122.058 127.423 122.058C124.391 122.058 121.933 124.518 121.933 127.554C121.933 130.59 124.391 133.05 127.423 133.05Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 126.527C124.731 126.527 124.68 126.938 124.68 127.443C124.68 127.949 124.731 128.36 124.795 128.36H130.194C130.257 128.368 130.309 127.965 130.31 127.459C130.345 127.144 130.307 126.825 130.197 126.528H124.795V126.527Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 162.376C130.456 162.376 132.914 159.915 132.914 156.879C132.914 153.844 130.456 151.383 127.423 151.383C124.391 151.383 121.933 153.844 121.933 156.879C121.933 159.915 124.391 162.376 127.423 162.376Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 155.853C124.731 155.853 124.68 156.263 124.68 156.768C124.68 157.274 124.731 157.685 124.795 157.685H130.194C130.257 157.693 130.309 157.29 130.31 156.784C130.345 156.469 130.307 156.15 130.197 155.853L124.795 155.853Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 191.69C130.456 191.69 132.914 189.229 132.914 186.194C132.914 183.158 130.456 180.697 127.423 180.697C124.391 180.697 121.933 183.158 121.933 186.194C121.933 189.229 124.391 191.69 127.423 191.69Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 185.167C124.731 185.167 124.68 185.577 124.68 186.083C124.68 186.589 124.731 186.999 124.795 186.999H130.194C130.257 187.007 130.309 186.604 130.31 186.098C130.345 185.784 130.307 185.465 130.197 185.167L124.795 185.167Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M145.875 59.6918L143.932 61.6367L160.204 77.9258L162.147 75.9808L145.875 59.6918Z",fill:"white"}),l.createElement("path",{d:"M162.147 61.6373L160.204 59.6924L143.932 75.9815L145.875 77.9264L162.147 61.6373Z",fill:"white"}),l.createElement("path",{d:"M71.002 156.83C71.478 156.662 71.9113 156.391 72.2713 156.036C72.6314 155.682 72.9094 155.253 73.0858 154.779C73.2622 154.305 73.3328 153.799 73.2925 153.295C73.2522 152.791 73.102 152.302 72.8526 151.863L80.9466 142.626L74.6282 141.754L67.9107 150.659C67.201 151.127 66.6875 151.84 66.4677 152.662C66.2479 153.484 66.3369 154.358 66.718 155.119C67.099 155.88 67.7456 156.474 68.5352 156.789C69.3248 157.105 70.2025 157.119 71.002 156.83Z",fill:"#9F616A"}),l.createElement("path",{d:"M80.7632 238.688L75.1182 238.688L72.4326 216.892L80.7642 216.892L80.7632 238.688Z",fill:"#9F616A"}),l.createElement("path",{d:"M82.2023 244.166L64 244.165V243.935C64.0001 242.054 64.7466 240.25 66.0752 238.92C67.4039 237.59 69.2058 236.843 71.0848 236.843H71.0853L82.2026 236.843L82.2023 244.166Z",fill:"#2F2E41"}),l.createElement("path",{d:"M110.313 233.959L104.922 235.634L95.9004 215.615L103.857 213.143L110.313 233.959Z",fill:"#9F616A"}),l.createElement("path",{d:"M113.311 238.763L95.9269 244.166L95.8586 243.945C95.3015 242.149 95.4801 240.205 96.3549 238.54C97.2298 236.876 98.7294 235.627 100.524 235.069L100.524 235.069L111.142 231.77L113.311 238.763Z",fill:"#2F2E41"}),l.createElement("path",{d:"M76.4396 138.198L68.0791 147.783L74.6244 148.373L76.4396 138.198Z",fill:"#a82227"}),l.createElement("path",{d:"M73.173 150.552C73.173 150.552 70.269 152.006 69.9059 158.546C69.5429 165.087 70.9951 182.167 70.9951 182.167C70.9951 182.167 69.5432 189.798 70.9951 196.702C72.4469 203.606 69.5432 228.678 71.3581 228.678C73.173 228.678 82.611 229.768 82.974 228.678C83.3371 227.587 83.7001 211.236 83.7001 211.236C83.7001 211.236 86.6042 202.878 83.7001 197.792C83.7001 197.792 93.8397 215.516 100.398 229.042C101.833 232.002 112.74 228.679 110.925 225.408C109.11 222.138 104.754 207.24 104.754 207.24C104.754 207.24 101.487 196.338 95.6794 191.614L98.5835 168.359C98.5835 168.359 104.755 152.733 101.125 150.553C97.4957 148.373 73.173 150.552 73.173 150.552Z",fill:"#2F2E41"}),l.createElement("path",{d:"M84.0629 91.322C89.2754 91.322 93.5009 87.0921 93.5009 81.8744C93.5009 76.6566 89.2754 72.4268 84.0629 72.4268C78.8505 72.4268 74.625 76.6566 74.625 81.8744C74.625 87.0921 78.8505 91.322 84.0629 91.322Z",fill:"#A0616A"}),l.createElement("path",{d:"M94.5899 92.0488L82.8568 98.9528C82.8568 98.9528 78.3642 101.485 76.686 105.857C74.8972 110.516 75.9369 117.075 76.686 118.575C78.1379 121.482 76.077 128.749 76.077 128.749L74.2621 145.464C74.2621 145.464 67.7282 151.642 72.8103 152.368C77.8923 153.095 86.9672 152.005 92.4123 152.368C97.8573 152.732 104.028 153.459 102.213 149.824C100.398 146.189 98.2204 143.647 100.398 136.381C102.103 130.694 102.029 109.431 101.916 100.451C101.901 99.2177 101.57 98.0091 100.956 96.9398C100.342 95.8706 99.4655 94.9763 98.4089 94.3421L94.5899 92.0488Z",fill:"#a82227"}),l.createElement("path",{opacity:"0.1",d:"M89.3278 103.496L90.4166 125.662L79.8631 147.056L78.0732 146.374L88.9634 126.388L89.3278 103.496Z",fill:"black"}),l.createElement("path",{opacity:"0.1",d:"M101.305 130.385V127.841L88.9648 148.19L101.305 130.385Z",fill:"black"}),l.createElement("path",{d:"M77.3647 73.1222L75.8057 72.4978C75.8057 72.4978 79.0687 68.9025 83.607 69.215L82.3303 67.8081C82.3303 67.8081 85.4508 66.5576 88.2879 69.8401C89.7792 71.5657 91.5045 73.5943 92.5813 75.879H94.2523L93.555 77.4162L95.9957 78.9535L93.4904 78.6784C93.7277 80.0055 93.6465 81.3701 93.2534 82.6596L93.3221 83.8746C93.3221 83.8746 90.4167 79.3743 90.4167 78.7499V80.3133C90.4167 80.3133 88.8563 78.9064 88.8563 77.9684L88.0052 79.0628L87.5796 77.3437L82.3314 79.0628L83.1818 77.6552L79.9188 78.1242L81.1955 76.405C81.1955 76.405 77.5076 78.4371 77.3658 80.1569C77.2239 81.8767 75.3802 84.0648 75.3802 84.0648L74.529 82.5014C74.529 82.5014 73.2527 75.4671 77.3647 73.1222Z",fill:"#2F2E41"}),l.createElement("path",{d:"M83.4712 157.858C83.9097 157.608 84.2881 157.264 84.5795 156.851C84.871 156.439 85.0685 155.967 85.1582 155.47C85.2478 154.972 85.2274 154.461 85.0984 153.972C84.9694 153.484 84.735 153.029 84.4116 152.641L90.7392 142.113L84.3665 142.377L79.3346 152.334C78.7192 152.921 78.3404 153.714 78.2698 154.562C78.1992 155.41 78.4419 156.255 78.9518 156.936C79.4617 157.617 80.2033 158.087 81.0363 158.257C81.8693 158.427 82.7356 158.285 83.4712 157.858Z",fill:"#9F616A"}),l.createElement("path",{d:"M97.8577 96.7735L100.58 96.2285C100.58 96.2285 108.748 102.224 106.206 114.215C103.665 126.207 92.4126 144.375 92.4126 144.375C92.4126 144.375 89.8709 147.646 89.1455 148.372C88.4201 149.099 86.9676 148.372 87.6937 149.463C88.4198 150.553 86.6045 151.279 86.6045 151.279C86.6045 151.279 78.6184 151.279 79.3445 148.372C80.0706 145.465 92.4126 124.752 92.4126 124.752L90.5977 105.493C90.5977 105.493 89.1452 96.0466 97.8577 96.7735Z",fill:"#a82227"})),l.createElement("defs",null)),l.createElement("h",{style:{color:"#505A5F",fontWeight:"400",fontFamily:"Roboto",marginLeft:"10%",lineHeight:"3"}},n("SURVEY_ENDED_MESSAGE"))),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},cr=e=>{if(!e)return;const t=[];for(const n in e)t.push({questionId:n,answer:[e[n]]});return t},dr={surveyDetails:[{id:1,ulb:"",tenantIds:"",name:"",description:"",fromDate:"",fromTime:"",toDate:"",toTime:""}],categories:[{id:1,title:"",weightage:100,selectCategory:"",questionStatement:"",questions:[],selectedQuestions:[]}],autoCalculateCategoriesWeight:!0,goPrev:!1,goNext:!1,stepData:{},step:1,isValid:!1,formData:{}},mr=function(e,t){switch(void 0===e&&(e=dr),t.type){case"GO_PREV":return d({},e,{goPrev:!0});case"GO_NEXT":return d({},e,{goNext:!0});case"AUTO_CALCULATE_CATEGORY":return d({},e,{autoCalculateCategoriesWeight:t.categoryWeight});case"ADD_CATEGORY":const n=[...e.categories,{id:t.id,title:"",weightage:"",selectCategory:"",questions:[],selectedQuestions:[]}];return d({},e,{categories:n});case"RECALCULATE_WEIGHTAGE":const l=e.categories.map(t=>d({},t,{weightage:Math.floor(100/e.categories.length*100)/100}));return d({},e,{categories:l});case"DELETE_CATEGORY":const a=e.categories.filter(e=>e.id!==t.categoryId);return d({},e,{categories:a});case"ADD_QUESTIONS_LIST":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:questionsList}):e)});case"ADD_QUESTIONS":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{selectedQuestions:t.questions}):e)});case"UPDATE_QUESTION_WEIGHTAGE":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{selectedQuestions:e.selectedQuestions.map(e=>e.uuid===t.questionId?d({},e,{weightage:t.weightage}):e)}):e)});case"UPDATE_CATEGORY":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,t.data):e)});case"UPDATE_QUESTION_SELECTION":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?d({},e,{selected:t.selected}):e)}):e)});case"UPDATE_MANDATORY_QUESTION_SELECTION":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?d({},e,{mandatory:t.mandatory}):e)}):e)});case"SET_QUESTIONS":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:t.questions}):e)});case"NEXT_STEP":return d({},e,{step:e.step+1});case"PREVIOUS_STEP":return d({},e,{step:e.step-1});case"SET_STEP_DATA":return d({},e,{stepData:d({},e.stepData,{[t.step]:t.data})});case"UPDATE_SURVEY_FORM":return d({},e,{formData:d({},e.formData,{[t.payload.key]:t.payload.value})});case"SET_SURVEY_STEP":return d({},e,{step:t.payload});case"FIELD_CHANGE":return d({},e,{surveyDetails:e.surveyDetails.map(e=>e.id===t.surveyId?d({},e,t.data):e)});case"RESET_FORM":return dr;default:return e}},vr=e=>{let{style:t={}}=e;return l.createElement("hr",{color:"#d6d5d4",className:"break-line",style:t})},pr=["onClick","style","children","className","ReactRef"],Er=e=>{var t;let{onClick:n,style:a,children:i,className:r,ReactRef:u}=e,s=m(e,pr);const{pathname:c}=o.useLocation(),v=Digit.Hooks.fsm.useRouteSubscription(c),p=null===(t=Digit.UserService.getUser())||void 0===t?void 0:t.info;return l.createElement("div",d({className:("employee"===v||"EMPLOYEE"===(null==p?void 0:p.type)?"employeeCard":"card")+" "+(r||""),onClick:n,style:a},s,{ref:u}),i)},gr=e=>l.createElement("h2",{className:"card-label "+e.className,style:e.style},e.children),fr=e=>l.createElement("p",{className:"card-text "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),hr=e=>{const t="employee"===Digit.SessionStorage.get("user_type");return l.createElement("header",{className:(t?"employee-card-sub-header":"card-sub-header")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children)},yr=e=>l.createElement("header",{id:e.id,className:"card-section-header",style:e.style},e.children),Sr=e=>{let{children:t,style:n,className:a}=e;return l.createElement("h2",{className:"card-label-desc "+(a||""),style:n},t)},_r=e=>l.createElement("h2",{className:"card-label-error "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children);var Cr="function"==typeof Symbol&&Symbol.for,br=Cr?Symbol.for("react.element"):60103,Tr=Cr?Symbol.for("react.portal"):60106,Dr=Cr?Symbol.for("react.fragment"):60107,Nr=Cr?Symbol.for("react.strict_mode"):60108,Ar=Cr?Symbol.for("react.profiler"):60114,wr=Cr?Symbol.for("react.provider"):60109,xr=Cr?Symbol.for("react.context"):60110,Ir=Cr?Symbol.for("react.async_mode"):60111,Lr=Cr?Symbol.for("react.concurrent_mode"):60111,Or=Cr?Symbol.for("react.forward_ref"):60112,Rr=Cr?Symbol.for("react.suspense"):60113,Pr=Cr?Symbol.for("react.suspense_list"):60120,Mr=Cr?Symbol.for("react.memo"):60115,Fr=Cr?Symbol.for("react.lazy"):60116,kr=Cr?Symbol.for("react.block"):60121,Br=Cr?Symbol.for("react.fundamental"):60117,Ur=Cr?Symbol.for("react.responder"):60118,Hr=Cr?Symbol.for("react.scope"):60119;function Vr(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case br:switch(e=e.type){case Ir:case Lr:case Dr:case Ar:case Nr:case Rr:return e;default:switch(e=e&&e.$$typeof){case xr:case Or:case Fr:case Mr:case wr:return e;default:return t}}case Tr:return t}}}function Wr(e){return Vr(e)===Lr}var qr={AsyncMode:Ir,ConcurrentMode:Lr,ContextConsumer:xr,ContextProvider:wr,Element:br,ForwardRef:Or,Fragment:Dr,Lazy:Fr,Memo:Mr,Portal:Tr,Profiler:Ar,StrictMode:Nr,Suspense:Rr,isAsyncMode:function(e){return Wr(e)||Vr(e)===Ir},isConcurrentMode:Wr,isContextConsumer:function(e){return Vr(e)===xr},isContextProvider:function(e){return Vr(e)===wr},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===br},isForwardRef:function(e){return Vr(e)===Or},isFragment:function(e){return Vr(e)===Dr},isLazy:function(e){return Vr(e)===Fr},isMemo:function(e){return Vr(e)===Mr},isPortal:function(e){return Vr(e)===Tr},isProfiler:function(e){return Vr(e)===Ar},isStrictMode:function(e){return Vr(e)===Nr},isSuspense:function(e){return Vr(e)===Rr},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Dr||e===Lr||e===Ar||e===Nr||e===Rr||e===Pr||"object"==typeof e&&null!==e&&(e.$$typeof===Fr||e.$$typeof===Mr||e.$$typeof===wr||e.$$typeof===xr||e.$$typeof===Or||e.$$typeof===Br||e.$$typeof===Ur||e.$$typeof===Hr||e.$$typeof===kr)},typeOf:Vr},jr=Ht(function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,r=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,f=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var v=e.type;switch(v){case s:case c:case a:case i:case o:case m:return v;default:var g=v&&v.$$typeof;switch(g){case u:case d:case E:case p:case r:return g;default:return t}}case l:return t}}}var _=c,C=u,b=r,T=n,D=d,N=a,A=E,w=p,x=l,I=i,L=o,O=m,R=!1;function P(e){return S(e)===c}t.AsyncMode=s,t.ConcurrentMode=_,t.ContextConsumer=C,t.ContextProvider=b,t.Element=T,t.ForwardRef=D,t.Fragment=N,t.Lazy=A,t.Memo=w,t.Portal=x,t.Profiler=I,t.StrictMode=L,t.Suspense=O,t.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(e)||S(e)===s},t.isConcurrentMode=P,t.isContextConsumer=function(e){return S(e)===u},t.isContextProvider=function(e){return S(e)===r},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return S(e)===d},t.isFragment=function(e){return S(e)===a},t.isLazy=function(e){return S(e)===E},t.isMemo=function(e){return S(e)===p},t.isPortal=function(e){return S(e)===l},t.isProfiler=function(e){return S(e)===i},t.isStrictMode=function(e){return S(e)===o},t.isSuspense=function(e){return S(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===c||e===i||e===o||e===m||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===p||e.$$typeof===r||e.$$typeof===u||e.$$typeof===d||e.$$typeof===f||e.$$typeof===h||e.$$typeof===y||e.$$typeof===g)},t.typeOf=S}()}),zr=Ht(function(e){e.exports="production"===process.env.NODE_ENV?qr:jr}),Yr=Object.getOwnPropertySymbols,Gr=Object.prototype.hasOwnProperty,Kr=Object.prototype.propertyIsEnumerable;function Qr(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var Xr=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,a=Qr(e),o=1;o<arguments.length;o++){for(var i in n=Object(arguments[o]))Gr.call(n,i)&&(a[i]=n[i]);if(Yr){l=Yr(n);for(var r=0;r<l.length;r++)Kr.call(n,l[r])&&(a[l[r]]=n[l[r]])}}return a},Zr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",$r=Function.call.bind(Object.prototype.hasOwnProperty),Jr=function(){};if("production"!==process.env.NODE_ENV){var eu=Zr,tu={},nu=$r;Jr=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function lu(e,t,n,l,a){if("production"!==process.env.NODE_ENV)for(var o in e)if(nu(e,o)){var i;try{if("function"!=typeof e[o]){var r=Error((l||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}i=e[o](t,o,l,n,null,eu)}catch(e){i=e}if(!i||i instanceof Error||Jr((l||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in tu)){tu[i.message]=!0;var u=a?a():"";Jr("Failed "+n+" type: "+i.message+(null!=u?u:""))}}}lu.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(tu={})};var au=lu,ou=function(){};function iu(){return null}function ru(){}function uu(){}"production"!==process.env.NODE_ENV&&(ou=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),uu.resetWarningCache=ru;var su=Ht(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,l={array:r("array"),bigint:r("bigint"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),symbol:r("symbol"),any:i(iu),arrayOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=t[n];if(!Array.isArray(r))return new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected an array.");for(var u=0;u<r.length;u++){var s=e(r,u,l,a,i+"["+u+"]",Zr);if(s instanceof Error)return s}return null})},element:i(function(t,n,l,a,i){var r=t[n];return e(r)?null:new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:i(function(e,t,n,l,a){var i=e[t];return zr.isValidElementType(i)?null:new o("Invalid "+l+" `"+a+"` of type `"+c(i)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return i(function(t,n,l,a,i){var r;return t[n]instanceof e?null:new o("Invalid "+a+" `"+i+"` of type `"+((r=t[n]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:i(function(e,t,n,l,a){return s(e[t])?null:new o("Invalid "+l+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=t[n],u=c(r);if("object"!==u)return new o("Invalid "+a+" `"+i+"` of type `"+u+"` supplied to `"+l+"`, expected an object.");for(var s in r)if($r(r,s)){var d=e(r,s,l,a,i+"."+s,Zr);if(d instanceof Error)return d}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&ou(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),iu;function t(t,n,l,i,r){for(var u=t[n],s=0;s<e.length;s++)if(a(u,e[s]))return null;var c=JSON.stringify(e,function(e,t){return"symbol"===d(t)?String(t):t});return new o("Invalid "+i+" `"+r+"` of value `"+String(u)+"` supplied to `"+l+"`, expected one of "+c+".")}return i(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&ou("Invalid argument supplied to oneOfType, expected an instance of array."),iu;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return ou("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+m(n)+" at index "+t+"."),iu}return i(function(t,n,l,a,i){for(var r=[],u=0;u<e.length;u++){var s=(0,e[u])(t,n,l,a,i,Zr);if(null==s)return null;s.data&&$r(s.data,"expectedType")&&r.push(s.data.expectedType)}return new o("Invalid "+a+" `"+i+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return i(function(t,n,l,a,i){var r=t[n],s=c(r);if("object"!==s)return new o("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");for(var m in e){var v=e[m];if("function"!=typeof v)return u(l,a,i,m,d(v));var p=v(r,m,l,a,i+"."+m,Zr);if(p)return p}return null})},exact:function(e){return i(function(t,n,l,a,i){var r=t[n],s=c(r);if("object"!==s)return new o("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");var m=Xr({},t[n],e);for(var v in m){var p=e[v];if($r(e,v)&&"function"!=typeof p)return u(l,a,i,v,d(p));if(!p)return new o("Invalid "+a+" `"+i+"` key `"+v+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=p(r,v,l,a,i+"."+v,Zr);if(E)return E}return null})}};function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function o(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function i(e){function t(t,n,l,a,i,r,u){if(a=a||"<<anonymous>>",r=r||l,u!==Zr){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}return null==n[l]?t?new o(null===n[l]?"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `null`.":"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `undefined`."):null:e(n,l,a,i,r)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){return i(function(t,n,l,a,i,r){var u=t[n];return c(u)!==e?new o("Invalid "+a+" `"+i+"` of type `"+d(u)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function u(e,t,n,l,a){return new o((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+a+"`.")}function s(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(s);if(null===t||e(t))return!0;var l=function(e){var t=e&&(n&&e[n]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!l)return!1;var a,o=l.call(t);if(l!==t.entries){for(;!(a=o.next()).done;)if(!s(a.value))return!1}else for(;!(a=o.next()).done;){var i=a.value;if(i&&!s(i[1]))return!1}return!0;default:return!1}}function c(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function d(e){if(null==e)return""+e;var t=c(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function m(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return o.prototype=Error.prototype,l.checkPropTypes=au,l.resetWarningCache=au.resetWarningCache,l.PropTypes=l,l}(zr.isElement):function(){function e(e,t,n,l,a,o){if(o!==Zr){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:uu,resetWarningCache:ru};return n.PropTypes=n,n}()});const cu=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("textarea",{placeholder:e.placeholder,name:e.name,ref:e.inputRef,style:e.style,id:e.id,value:e.value,onChange:e.onChange,className:("citizen"!==t?"employee-card-textarea":"card-textarea")+" "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),minLength:e.minLength,maxLength:e.maxLength,autoComplete:"off",disabled:e.disabled}),l.createElement("p",{className:"cell-text"},e.hintText))};cu.propTypes={userType:su.string,name:su.string.isRequired,ref:su.func,value:su.string,onChange:su.func,id:su.string},cu.defaultProps={ref:void 0,onChange:void 0};const du=e=>{var t,a,o,i,r,u,s;const c=Digit.SessionStorage.get("userType"),[m,v]=n.useState(),p=null!=e&&e.watch?{fromDate:null==e?void 0:e.watch("fromDate"),toDate:null==e?void 0:e.watch("toDate")}:{},E=e=>{const{value:t}=e.target;v(function(e){return e?new Date(e).toLocaleString("en-In").split(",")[0]:""}(t))};return l.createElement(l.Fragment,null,l.createElement("div",{className:"text-input "+("employee"===c?"":"text-input-width")+" "+e.className,style:null!=e&&e.textInputStyle?d({},e.textInputStyle):{}},l.createElement("input",e.isMandatory?{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(t=e.validation)||void 0===t?void 0:t.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input-error":"card-input-error")+" "+(e.disable&&"disabled"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&E(t)},ref:e.inputRef,value:e.value,style:d({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(a=e.validation)||void 0===a?void 0:a.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(o=e.validation)||void 0===o?void 0:o.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off",disabled:e.disabled}:{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(i=e.validation)||void 0===i?void 0:i.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&E(t)},ref:e.inputRef,value:e.value,style:d({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,required:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(r=e.validation)||void 0===r?void 0:r.isRequired:e.isRequired||"date"===e.type&&("fromDate"===e.name?p.toDate:p.fromDate),pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(u=e.validation)||void 0===u?void 0:u.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(s=e.validation)||void 0===s?void 0:s.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,onKeyPress:e.onKeyPress,autoComplete:"off",disabled:e.disabled}),e.signature?e.signatureImg:null))};du.propTypes={userType:su.string,isMandatory:su.bool,name:su.string,placeholder:su.string,onChange:su.func,ref:su.func,value:su.any},du.defaultProps={isMandatory:!1};const mu=e=>l.createElement("div",{className:"action-bar-wrap "+e.className,style:e.style},e.children),vu=n.forwardRef((e,t)=>l.createElement("button",d({ref:t,disabled:!!e.disabled,className:(e.disabled?"submit-bar-disabled":"submit-bar")+" "+(e.className?e.className:""),type:e.submit?"submit":"button",style:d({},e.style),onClick:e.onSubmit},e.form?{form:e.form}:{}),e.label));vu.propTypes={submit:su.any,style:su.object,label:su.string,onSubmit:su.func},vu.defaultProps={};const pu=e=>l.createElement("div",{style:d({},e.style),className:"label-field-pair"},e.children),Eu=e=>l.createElement("button",{className:"card-link cp "+e.className,onClick:e.onClick,style:d({},e.style,Eu.defaultProps.style)},e.label);Eu.propTypes={label:su.any,onClick:su.func,style:su.object},Eu.defaultProps={style:{color:"#FFFFFF",backgroundColor:"#2947A3",border:"none",borderRadius:"8px",cursor:"pointer",padding:"8px 16px",display:"inline-block",height:"35px",fontSize:"18px"}};const gu=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("div",{className:"field-container"},e.hideSpan?null:l.createElement("span",{style:d({maxWidth:"50px",marginTop:"unset"},e.labelStyle),className:"citizen-card-input citizen-card-input--front"},"+91"),l.createElement("div",{className:"text-input "+("employee"===t?"":"text-mobile-input-width")+" "+e.className},l.createElement("input",{type:"text",name:e.name,id:e.id,className:(t?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error"),placeholder:e.placeholder,onChange:t=>{var n;let l=t.target.value;(isNaN(l)||[" ","e","E"].some(e=>l.includes(e))||l.length>(e.maxLength||10))&&(l=l.slice(0,-1)),null==e||null===(n=e.onChange)||void 0===n||n.call(e,l)},ref:e.inputRef,value:e.value,style:d({},e.style),minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:e.pattern,min:e.min,readOnly:e.disable,title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off"}))))};gu.propTypes={userType:su.string,isMandatory:su.bool,name:su.string,placeholder:su.string,onChange:su.func,ref:su.func,value:su.any},gu.defaultProps={isMandatory:!1};const fu=e=>{var t;const{register:o,handleSubmit:r,setValue:u,getValues:s,reset:c,watch:m,control:v,formState:p,errors:E,setError:g,clearErrors:f,setApi:h}=i.useForm({defaultValues:e.defaultValues}),{t:y}=a.useTranslation(),S=m();n.useEffect(()=>{var t,n,l,a,o,i,r;const u=sessionStorage.getItem("eyeIconClicked");null!=e&&e.appData&&(null==e||null===(t=e.appData)||void 0===t||null===(n=t.ConnectionHolderDetails)||void 0===n||null===(l=n[0])||void 0===l||!l.sameAsOwnerDetails)&&u&&(null===(a=Object.keys(null==e?void 0:e.appData))||void 0===a?void 0:a.length)>0&&!ua.isEqual(null==e||null===(o=e.appData)||void 0===o||null===(i=o.ConnectionHolderDetails)||void 0===i?void 0:i[0],null==S||null===(r=S.ConnectionHolderDetails)||void 0===r?void 0:r[0])&&c(d({},null==e?void 0:e.appData))},[null==e?void 0:e.appData,S,null==e||null===(t=e.appData)||void 0===t?void 0:t.ConnectionHolderDetails]),n.useEffect(()=>{e.getFormAccessors&&e.getFormAccessors({setValue:u,getValues:s})},[]),n.useEffect(()=>{e.onFormValueChange&&e.onFormValueChange(u,S,p)},[S]);const _=function(e,t,n,a,r,s){void 0===a&&(a=!1);const c="string"==typeof r?Digit.ComponentRegistryService.getComponent(r):r;switch(e){case"text":case"date":case"number":case"password":case"time":return l.createElement("div",{className:"field-container"},null!=t&&t.componentInFront?l.createElement("span",{className:"component-in-front "+(a&&"disabled")},t.componentInFront):null,l.createElement(du,d({className:"fieldNew"},t,{inputRef:o(t.validation),isRequired:n,type:e,disable:a,watch:m})));case"textarea":return l.createElement(cu,d({className:"field",name:(null==t?void 0:t.name)||""},t,{inputRef:o(t.validation),disable:a}));case"mobileNumber":return l.createElement(i.Controller,{render:e=>l.createElement(gu,{className:"field",onChange:e.onChange,value:e.value,disable:a}),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:v});case"custom":return l.createElement(i.Controller,{render:e=>t.component(d({},e,{setValue:u}),t.customProps),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:v});case"component":return l.createElement(i.Controller,{render:e=>l.createElement(c,{userType:"employee",t:y,setValue:u,onSelect:u,config:s,data:S,formData:S,register:o,errors:E,props:e,setError:g,clearErrors:f,formState:p,onBlur:e.onBlur,setApi:h}),name:s.key,control:v});case"form":return l.createElement("form",null,l.createElement(c,{userType:"employee",t:y,setValue:u,onSelect:u,config:s,data:S,formData:S,register:o,errors:E,setError:g,clearErrors:f,formState:p,control:v}));default:return!1!==(null==t?void 0:t.dependency)?t:null}},C=e=>{switch(e){case 0:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"};case 1:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",borderTop:"0px",borderBottom:"0px"};case 2:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px",borderTop:"0px"}}},b={color:"#505A5F",fontWeight:"700",fontSize:"16px"},T=n.useMemo(()=>{var t;return null===(t=e.config)||void 0===t?void 0:t.map((t,a,o)=>l.createElement(l.Fragment,{key:a},t&&(t=>t.head&&t.subHead?l.createElement(n.Fragment,null,l.createElement(yr,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{margin:"5px 0px"},id:t.headId},y(t.head)),l.createElement(yr,{style:b,id:t.headId+"_DES"},y(t.subHead))):t.head?l.createElement(n.Fragment,null,l.createElement(yr,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{},id:t.headId},y(t.head)),l.createElement("div",{style:null!=e&&e.lineStyle?null==e?void 0:e.lineStyle:{}})):l.createElement("div",null))(t),t.body.map((t,a)=>{var o,i,r,u,s,c,m,v;return e.inline?l.createElement(l.Fragment,{key:a},l.createElement("div",{style:t.isInsideBox?C(null==t?void 0:t.placementinbox):{}},!t.withoutLabel&&l.createElement(gr,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"},className:null!=t&&t.disable?"disabled":""},y(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),E&&E[null===(o=t.populators)||void 0===o?void 0:o.name]&&Object.keys(E[null===(i=t.populators)||void 0===i?void 0:i.name]).length?l.createElement(_r,null,y(t.populators.error||(null===(r=E[null===(u=t.populators)||void 0===u?void 0:u.name])||void 0===r?void 0:r.message))):null,l.createElement("div",{style:t.withoutLabel?{width:"100%"}:{},className:"field"},_(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(gr,{style:d({marginTop:"-24px",fontSize:"16px",fontWeight:"bold",color:"#505A5F"},null==t?void 0:t.descriptionStyles)},y(t.description))))):l.createElement(n.Fragment,null,l.createElement(pu,{key:a},!t.withoutLabel&&l.createElement(gr,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"}},y(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),l.createElement("div",{style:t.withoutLabel?d({width:"100%"},null==e?void 0:e.fieldStyle):{},className:"field"},_(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(fr,{style:{fontSize:"14px",marginTop:"-24px"}},y(null==t?void 0:t.description)))),null!=t&&null!==(s=t.populators)&&void 0!==s&&s.name&&E&&E[null==t||null===(c=t.populators)||void 0===c?void 0:c.name]&&Object.keys(E[null==t||null===(m=t.populators)||void 0===m?void 0:m.name]).length?l.createElement(_r,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},y(null==t||null===(v=t.populators)||void 0===v?void 0:v.error)):null)}),!e.noBreakLine&&(o.length-1===a?null:l.createElement(vr,{style:null!=e&&e.breaklineStyle?null==e?void 0:e.breaklineStyle:{}}))))},[e.config,S]),D=e.isDisabled||!1;return console.log(e),l.createElement("form",{onSubmit:r(function(t){e.onSubmit(t)}),onKeyDown:e=>(e=>{13===(e.keyCode?e.keyCode:e.key?e.key:e.which)&&e.preventDefault()})(e),id:e.formId,className:e.className},l.createElement(Er,{style:!0===(null==e?void 0:e.box)?{boxShadow:"none",padding:"20px 48px 48px"}:null},!e.childrenAtTheBottom&&e.children,e.heading&&l.createElement(hr,{className:"headerStyle"}," ",e.heading," "),e.description&&l.createElement(Sr,{className:"descStyle"}," ",e.description," "),e.text&&l.createElement(fr,{className:"labelStyle"},e.text),T,e.childrenAtTheBottom&&e.children,e.secondaryActionLabel&&l.createElement("div",{className:"primary-label-btn text-align-right",style:{margin:"20px auto 0 auto"},onClick:function(t){e.onSecondayActionClick()}},e.secondaryActionLabel),e.submitInForm&&l.createElement(vu,{label:y(e.label),style:d({},null==e?void 0:e.buttonStyle),submit:"submit",disabled:D,className:"submitButtonNew"}),!e.submitInForm&&e.label&&l.createElement(mu,null,e.currentStep>1&&l.createElement("button",{style:{backgroundColor:"transparent",color:"#3f51b5",border:"1px solid #3f51b5",padding:"10px 10px",margin:"10px",cursor:"pointer"},onClick:()=>{e.onBackClick&&e.onBackClick(S)},className:"submit-bar"},y("COMMON_BACK")),l.createElement(vu,{label:y(e.label),submit:"submit",disabled:D}),e.onSkip&&e.showSkip&&l.createElement(Eu,{style:null==e?void 0:e.skipStyle,label:y("CS_SKIP_CONTINUE"),onClick:e.onSkip}))))},hu=e=>{let{category:o,checked:i,readOnly:r,onDelete:s,hideQuestionLabel:c}=e;const m=u.useDispatch(),{t:v}=a.useTranslation(),p=Digit.ULBService.getCurrentTenantId(),[E,g]=n.useState(r),[f,h]=n.useState(r),[y,S]=n.useState(""),[_,C]=n.useState({}),[b,T]=n.useState([]),[D,N]=n.useState([]),[A,w]=n.useState(null),x=u.useSelector(e=>e.engagement.surveyForm);n.useEffect(()=>{let e={tenantId:p,id:null};try{Digit.Surveys.searchCategory(e).then(e=>{var t;if((null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0){const t=e.Categories.filter(e=>e.isActive).map(e=>({title:v(e.label),i18Key:e.label,value:e.id}));T(t)}})}catch(e){return e}},[]);const I=e=>{const{name:t,value:n}=e.target;m(Ci(o.id,{[t]:n}))},[L,O]=n.useState(!1),[R,P]=n.useState(!1);function M(){O(!1)}return l.createElement("div",{className:"category-card"},l.createElement("h3",null,"Section Title ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"title",value:o.title,readOnly:r,onChange:I,placeholder:"Section Title",required:!0}),l.createElement("h3",null,"Section Weightage"),l.createElement("input",{type:"number",name:"weightage",value:o.weightage,onChange:I,onWheel:e=>e.target.blur(),readOnly:i,placeholder:"Section Weightage",required:!0}),(!1===r||void 0===r)&&l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",marginBottom:"5px"}},l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},onClick:()=>g(!E)},"Add Questions"),l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"red",color:"white",cursor:"pointer"},onClick:()=>{s(o.id)}},"Delete Section")),(E||!0===x.goPrev)&&l.createElement("div",null,l.createElement("h3",null,"Select Category"),l.createElement(t.Dropdown,{required:!0,t:v,id:"selectCategory",name:"selectCategory",option:b,select:e=>{m(Ci(o.id,{selectCategory:e})),m(Ti(o.id,[])),h(!1)},placeholder:"Select Category",optionKey:"i18Key",selected:o.selectCategory||null}),(!1===r||void 0===r)&&l.createElement("h3",null,"Search Question"),(!1===r||void 0===r)&&l.createElement("input",{type:"text",name:"questionStatement",value:o.questionStatement,onChange:I,placeholder:"Search Question",readOnly:r}),(!1===r||void 0===r)&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:r,onClick:()=>{var e;""===o.selectCategory?w({key:!0,isError:!0,label:"PLEASE SELECT A CATEGORY"}):((e,t)=>{let n={categoryId:e,tenantId:p,questionStatement:t,status:"ACTIVE"};try{Digit.Surveys.searchQuestions(n).then(e=>{var t;if((null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0){let t=[];e.Questions.map(e=>{let n=d({},e,{selected:!1});t.push(n)}),t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),console.log("arr",t),m(Ti(o.id,t)),N(t),h(!0),w({key:!0,isError:!1,label:"QUESTIONS RETRIEVED"})}else m(Ti(o.id,[])),N([]),h(!1),w({key:!0,isError:!0,label:"NO QUESTIONS FOUND"})})}catch(e){m(Ti(o.id,[])),N([]),h(!1)}})(null===(e=o.selectCategory)||void 0===e?void 0:e.value,o.questionStatement)}},"Go"),f&&1!=c&&o.questions.length>0&&l.createElement("div",null,l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Question Label"),l.createElement("th",null,"Select"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.questions.map(e=>l.createElement("tr",{key:null==e?void 0:e.uuid},l.createElement("td",null,l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;console.log("question: ",e),O(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,v(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));P(n)}(e)},null==e?void 0:e.questionStatement),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},v("Click here to view the question details"))))),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{m(((e,t,n)=>({type:"UPDATE_QUESTION_SELECTION",categoryId:e,questionId:t,selected:n}))(o.id,e.uuid,t.target.checked))},checked:e.selected})),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{m(bi(o.id,e.uuid,t.target.checked))}}))))))),(!1===r||void 0===r)&&f&&o.questions.length>0&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginTop:"10px"},disable:r,onClick:()=>{const e=o.questions.filter(e=>e.selected);if(o.questions.some(e=>e.mandatory&&!e.selected))return void w({key:!0,isError:!0,label:"MANDATORY QUESTIONS MUST BE SELECTED"});if(0===e.length)return void w({key:!0,isError:!0,label:"PLEASE SELECT ATLEAST ONE QUESTION"});const t=e.filter(e=>!o.selectedQuestions.some(t=>t.uuid===e.uuid)),n=e.filter(e=>o.selectedQuestions.some(t=>t.uuid===e.uuid));let l=null;n.length>0&&n.map(e=>{l=o.selectedQuestions.findIndex(t=>t.uuid===e.uuid),o.selectedQuestions.map(t=>{t.uuid===e.uuid&&m(bi(o.id,e.uuid,e.mandatory))}),o.selectedQuestions[l].mandatory=e.mandatory});const a=o.selectCategory.title,i=[...o.selectedQuestions,...t.map(e=>d({},e,{selectedCategory:a}))],r=i.map(e=>d({},e,{weightage:Math.floor(100/i.length*100)/100}));m(_i(o.id,r))}},"Add These Questions"),l.createElement("div",null,o.selectedQuestions.length>0||!0===r?l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Selected Category"),l.createElement("th",null,"Question Statement"),l.createElement("th",null,"Weightage"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.selectedQuestions.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.uuid},l.createElement("td",null,e.selectedCategory),l.createElement("td",null,e.questionStatement),l.createElement("td",null,l.createElement("input",{type:"text",defaultValue:e.weightage,value:e.weightage,required:!0,onChange:n=>((e,t,n)=>{let l={};/^\d*(\.\d{0,2})?$/.test(n)?(m(((e,t,n)=>({type:"UPDATE_QUESTION_WEIGHTAGE",categoryId:e,questionId:t,weightage:n}))(o.id,t,n)),l={},C(l)):(l[e]={weightage:"Invalid weightage value. Please enter a number or decimal upto 2 decimal points"},C(l))})(t,e.uuid,n.target.value)}),"undefined"!=(null===(n=_[t])||void 0===n?void 0:n.weightage)&&l.createElement("span",{className:"error"},null===(a=_[t])||void 0===a?void 0:a.weightage)),l.createElement("td",null,!0===(null==e?void 0:e.mandatory)?"True":"False"),l.createElement("td",null,l.createElement("label",{onClick:()=>(e=>{const t=o.selectedQuestions.filter(t=>t.uuid!==e.uuid),n=t.length,l=t.map(e=>d({},e,{weightage:Math.floor(100/n*100)/100}));m(_i(o.id,l))})(e)},"Delete")))}))):null)),L&&l.createElement(Co,{onSelect:function(){O(!1)},onCancel:M,onDismiss:M,heading:"Question Details",actionCancel:!0,content:R,hideSubmit:!0}),A&&l.createElement(t.Toast,{error:A.isError,label:v(A.label),onClose:()=>{w(null)},isDleteBtn:"false",labelstyle:{color:"white",width:"100%"}}))},yu=e=>{let{readOnly:t,hideQuestionLabel:a}=e;const o=u.useSelector(e=>e.engagement.surveyForm.categories),i=u.useSelector(e=>e.engagement.surveyForm.autoCalculateCategoriesWeight),r=u.useDispatch(),[s,c]=n.useState(i);console.log("categories",o);const[d,m]=n.useState(2),v=e=>{console.log("checked",s),1!==o.length?i?(r(Di(e)),r({type:"RECALCULATE_WEIGHTAGE"})):r(Di(e)):alert("Atleast one category must be there")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},o.map(e=>l.createElement(hu,{key:e.id,category:e,checked:i,readOnly:t,onDelete:v,hideQuestionLabel:a})),!0!==t&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginBottom:"10px"},onClick:()=>{console.log("checked",i),!0===i?(r(Si(d)),r({type:"RECALCULATE_WEIGHTAGE"}),m(d+1)):(r(Si(d)),m(d+1))}},"Add Section"),l.createElement("div",{style:{marginTop:"20px"}},l.createElement("div",{style:{display:"flex",columnGap:"20px"}},l.createElement("input",{style:{height:"20px",width:"20px"},type:"checkbox",checked:i,disabled:t,onChange:e=>{console.log("e checked",e.target.checked),r((e=>({type:"AUTO_CALCULATE_CATEGORY",categoryWeight:e}))(e.target.checked)),c(e.target.checked),!0===e.target.checked&&r({type:"RECALCULATE_WEIGHTAGE"})}}),"Auto Calculate Category Weightage")))},Su=()=>{const[e,t]=n.useState({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}}),a=(i.useForm({defaultValues:e}),(e,n)=>{const{value:l,checked:a}=n.target;t(t=>{const n=a?[...t[e].checkboxes,l]:t[e].checkboxes.filter(e=>e!==l);return d({},t,{[e]:d({},t[e],{checkboxes:n})})})}),o=(e,n)=>{const{name:l,value:a}=n.target;t(t=>d({},t,{[e]:d({},t[e],{[l]:a})}))};console.log("formData",e);const[r,u]=n.useState({});return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Title : Citizen Survey"),l.createElement("div",null,l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Description : This is a sample citizen survey")),l.createElement("form",{onSubmit:t=>{t.preventDefault(),(()=>{const t={};return e.name?/^[A-Za-z\s]+$/.test(e.name)||(t.name="Name can only contain alphabets and spaces"):t.name="Name is required",e.relationName?/^[A-Za-z\s]+$/.test(e.relationName)||(t.relationName="Relation Name can only contain alphabets and spaces"):t.relationName="Father/Husband Name is required",e.email?/\S+@\S+\.\S+/.test(e.email)||(t.email="Email is invalid"):t.email="Email is required",e.mobile?/^\d{10}$/.test(e.mobile)||(t.mobile="Mobile number is invalid"):t.mobile="Mobile number is required",e.relation||(t.relation="Relation is required"),e.address||(t.address="Address is required"),e.dob||(t.dob="Date of Birth is required"),!e.section1.checkboxes.length>0&&(t.checkboxes="This question is required to answer"),e.section1.shortText||(t.shortText="This question is required to answer"),e.section2.multipleChoice||(t.multipleChoice="This question is required to answer"),u(t),0===Object.keys(t).length})()&&console.log("Form submitted:",e)}},l.createElement(wi,{formData:e,setFormData:t,errors:r,relationList:[{label:"Father",value:"Father"},{label:"Husband",value:"Husband"}]}),l.createElement("div",null,l.createElement("h2",null,"Section 1"),l.createElement("div",null,l.createElement("h3",null,"What is your feedback?"),l.createElement("div",null,l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option1",style:{width:"20px",height:"20px",marginRight:"10px"},checked:e.section1.checkboxes.includes("option1"),onChange:e=>a("section1",e)}),"Option 1"),l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option2",style:{width:"20px",height:"20px",marginRight:"10px",color:"#0d43a7"},checked:e.section1.checkboxes.includes("option2"),onChange:e=>a("section1",e)}),"Option 2"),r.checkboxes&&l.createElement("span",{className:"error"},r.checkboxes))),l.createElement("div",null,l.createElement("h3",null,"Tell us more about your product quality?"),l.createElement("div",null,l.createElement("input",{type:"text",name:"shortText",placeholder:"enter here",value:e.section1.shortText,onChange:e=>o("section1",e)}),r.shortText&&l.createElement("span",{className:"error"},r.shortText)))),l.createElement("div",null,l.createElement("h2",null,"Section 2"),l.createElement("div",null,l.createElement("h3",null,"Give your rating?"),l.createElement("div",null,l.createElement("select",{name:"multipleChoice",value:e.section2.multipleChoice,onChange:e=>o("section2",e)},l.createElement("option",{value:""},"Select an option"),l.createElement("option",{value:"choice1"},"Choice 1"),l.createElement("option",{value:"choice2"},"Choice 2"))),r.multipleChoice&&l.createElement("span",{className:"error"},r.multipleChoice))),l.createElement("button",{type:"submit"},"Submit"),l.createElement("button",{style:{backgroundColor:"none",marginLeft:"10px"},onClick:()=>t({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}})},"Reset"))))},_u=e=>{let{location:n}=e;const{t:i}=a.useTranslation(),r=o.useHistory(),u=o.useLocation().search,s=new URLSearchParams(u).get("from")||null,c=[{path:"/digit-ui/employee",content:i("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/engagement/event/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("event/inbox")},{path:"/digit-ui/employee/event/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/new-event")},{path:"/digit-ui/employee/event/inbox/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/inbox/new-event")},{path:"/digit-ui/employee/event/inbox/event-details",content:i("ES_EVENT_EVENT_DETAILS"),show:!!n.pathname.includes("event-details")},{path:"/digit-ui/employee/engagement/event/edit-event",content:i("ES_EVENT_EDIT_EVENT"),show:!!n.pathname.includes("event/edit-event")},{path:"/digit-ui/employee/event/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("event/response")},{path:"/digit-ui/employee/engagement/documents/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/documents/inbox")},{path:"/digit-ui/employee/engagement/documents/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/new-doc")},{path:"/digit-ui/employee/engagement/documents/inbox/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/inbox/new-doc")},{path:"/digit-ui/employee/engagement/documents/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/response")},{path:"/digit-ui/employee/engagement/documents/delete-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/delete-response")},{path:"/digit-ui/employee/engagement/documents/update-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/update-response")},{path:"/digit-ui/employee/engagement/documents/inbox/details/:id",content:i("CE_DOCUMENT_DETAILS"),show:!!n.pathname.includes("/documents/inbox/details")},{path:"/digit-ui/employee/engagement/documents/inbox/update",content:i("DOCUMENTS_EDIT_HEADER"),show:!!n.pathname.includes("/documents/inbox/update")},{path:"/digit-ui/employee/engagement/messages/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/messages/inbox")},{path:"/digit-ui/employee/engagement/messages/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/create")},{path:"/digit-ui/employee/engagement/messages/inbox/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/create")},{path:"/digit-ui/employee/engagement/messages/inbox/details/:id",content:i("CS_HEADER_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/details")},{path:"/digit-ui/employee/engagement/messages/inbox/edit/:id",content:i("EDIT_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/edit")},{path:"/digit-ui/employee/engagement/messages/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response")},{path:"/digit-ui/employee/engagement/messages/response?update=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?update=true")},{path:"/digit-ui/employee/engagement/messages/response?delete=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?delete=true")},{path:"/digit-ui/employee/engagement/surveys/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/surveys/inbox")},{path:"/digit-ui/employee/engagement/surveys/create-survey-step-form",content:s?i(s)+" / "+i("CS_COMMON_SURVEYS"):i("CS_COMMON_SURVEYS"),show:!!n.pathname.includes("/surveys/create-survey-step-form"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-category",content:s?i(s)+" / "+i("Create Category"):i("Create Category"),show:!!n.pathname.includes("/surveys/create-category"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-categories",content:s?i(s)+" / "+i("Search Categories"):i("Search Categories"),show:!!n.pathname.includes("/surveys/search-categories"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-questions",content:s?i(s)+" / "+i("Create Questions"):i("Create Questions"),show:!!n.pathname.includes("/surveys/create-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-questions",content:s?i(s)+" / "+i("Search Questions"):i("Search Questions"),show:!!n.pathname.includes("/surveys/search-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-response",content:s?i(s)+" / "+i("ES_EVENT_NEW_EVENT_RESPONSE"):i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/surveys/create-response"),isBack:s&&!0}];return l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"}},l.createElement(t.BreadCrumb,{crumbs:c}),l.createElement("p",{className:"breadcrumb"},l.createElement("button",{onClick:()=>{r.goBack()},style:{cursor:"pointer",color:"#666"}},"<"," ",i("CS_COMMON_BACK"))))},Cu=e=>{let{path:t,userType:a,tenants:i,stateCode:r}=e;const u=o.useLocation();return l.createElement(n.Fragment,null,l.createElement(_u,{location:u}),l.createElement(o.Switch,null,l.createElement(o.Route,{path:t+"/event/inbox",exact:!0},l.createElement(Ke,{tenants:i,parentRoute:t})),l.createElement(o.Route,{path:t+"/event/response",component:e=>l.createElement(Pe,e)}),l.createElement(o.Route,{path:t+"/event/inbox/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/edit-event/:id"},l.createElement(Oe,null)),l.createElement(o.Route,{path:t+"/event/inbox/event-details/:id"},l.createElement(ro,null)),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/update",component:e=>l.createElement(Io,e)}),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/new-doc",component:()=>l.createElement(wo,{path:t})}),l.createElement(o.Route,{exact:!0,path:t+"/documents/new-doc",component:()=>l.createElement(wo,{path:t})}),l.createElement(o.Route,{path:t+"/documents/inbox/details/:id",component:e=>l.createElement(Ko,e)}),l.createElement(o.Route,{path:t+"/documents/response",component:e=>l.createElement(Oo,e)}),l.createElement(o.Route,{path:t+"/documents/update-response",component:e=>l.createElement(Po,e)}),l.createElement(o.Route,{path:t+"/documents/delete-response",component:e=>l.createElement(Fo,e)}),l.createElement(o.Route,{path:t+"/documents/inbox",component:e=>l.createElement(jo,{tenants:i})}),l.createElement(o.Route,{path:t+"/messages",component:e=>l.createElement(eo,d({},e,{tenants:i,parentRoute:t}))}),l.createElement(o.Route,{path:t+"/surveys",component:e=>l.createElement(ur,d({},e,{tenants:i,parentRoute:t,userType:a,stateCode:r}))})))},bu={EngagementModule:e=>{let{stateCode:n,userType:a,tenants:i}=e;const{path:r,url:u}=o.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:c}=Digit.Services.useStore({stateCode:n,moduleCode:"Engagement",language:s});return c?l.createElement(t.Loader,null):(Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i),"citizen"===a?l.createElement(No,{path:r,url:u,userType:a,tenants:i}):l.createElement(Cu,{path:r,url:u,userType:a,tenants:i,stateCode:n}))},EngagementCard:()=>{var e,o;const i=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(o=e.info)||void 0===o?void 0:o.roles).find(e=>"EMPLOYEE"===e.code);if(n.useEffect(()=>{Digit.SessionStorage.set("CITIZENSURVEY.INBOX",null)},[]),!i)return null;const r=Digit.ULBService.getCurrentTenantId(),{data:u,isLoading:s}=Digit.Hooks.engagement.useDocSearch({tenantIds:r},{select:e=>null==e?void 0:e.totalCount}),{data:c,isLoading:m}=Digit.Hooks.events.useInbox(r,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST"},{select:e=>null==e?void 0:e.totalCount}),{data:v,isLoading:p}=Digit.Hooks.events.useInbox(r,{},{eventTypes:"EVENTSONGROUND"},{select:e=>null==e?void 0:e.totalCount}),{data:E,isLoading:g}=Digit.Hooks.survey.useSearch({tenantIds:r},{select:e=>null==e?void 0:e.TotalCount}),f=n.useMemo(()=>s?"-":u,[s,u]),h=n.useMemo(()=>p?"-":v,[p,v]),y=n.useMemo(()=>m?"-":c,[m,c]),S=n.useMemo(()=>g?"-":E,[g,E]),{t:_}=a.useTranslation();let C=null;const b={Icon:l.createElement(t.SurveyIconSolid,null),moduleName:_("CS_COMMON_SURVEYS"),kpis:[{count:S,label:_("TOTAL_SURVEYS"),link:"/digit-ui/employee/engagement/surveys/inbox"}],links:[{count:S,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/surveys/inbox"},{label:_("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{label:_("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{label:_("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{label:_("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{label:_("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"},{label:_("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"}]},T={Icon:l.createElement(t.PMBIconSolid,null),moduleName:_("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"),kpis:[{count:y,label:_("TOTAL_MESSAGES"),link:"/digit-ui/employee/engagement/messages/inbox"}],links:[{count:y,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/messages/inbox"},{label:_("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/create"}]},D={Icon:l.createElement(t.EventsIconSolid,null),moduleName:_("TOTAL_EVENTS"),kpis:[{count:h,label:_("TOTAL_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox"}],links:[{count:h,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/event/inbox"},{label:_("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/new-event"}]},N={Icon:l.createElement(t.DocumentIconSolid,null),moduleName:_("ES_TITLE_DOCS"),kpis:[{count:f,label:_("TOTAL_DOCUMENTS"),link:"/digit-ui/employee/engagement/documents/inbox"}],links:[{count:f,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/documents/inbox"},{label:_("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/new-doc"}]};return i&&(C=l.createElement(n.Fragment,null,[N,D,T,b].map((e,n)=>l.createElement(t.EmployeeModuleCard,d({key:n,longModuleName:!0},e))))),C},EngagementDocSelectULB:e=>{var a,o;let{t:r,setValue:u,config:s,formData:c,errors:d,control:m}=e;const v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.ULBService.getCurrentTenantId(),E=n.useMemo(()=>null!=c&&c.defaultTenantId?null==v?void 0:v.find(e=>(null==e?void 0:e.code)===(null==c?void 0:c.defaultTenantId)):p&&v?null==v?void 0:v.filter(e=>e.code===p):1===(null==f?void 0:f.length)?null==f?void 0:f[0]:null,[p,v]),g=Digit.SessionStorage.get("citizen.userRequestObject"),f=v.filter(e=>{var t,n;return null==g||null===(t=g.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),h=Digit.ULBService.getUserUlbs("SUPERUSER").sort(y);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},r("ES_COMMON_ULB")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:s.key,control:m,defaultValue:null==E?void 0:E[0],rules:{required:!0},render:e=>l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:h,select:t=>{var n,l;e.onChange([...(null==c||null===(n=c[null==s?void 0:s.key])||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>t.code!=(null==e?void 0:e.code)))||[],t])},keepNull:!0,selected:e.value,disable:1===(null==v?void 0:v.length),t:r})}),l.createElement("div",{className:"tag-container"},c&&(null===(a=c[null==s?void 0:s.key])||void 0===a?void 0:a.length)>0&&(null==c||null===(o=c[s.key])||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:r(null==e?void 0:e.i18nKey),onClick:()=>{var t;u(s.key,null==c||null===(t=c[s.key])||void 0===t?void 0:t.filter(t=>t.i18nKey!=e.i18nKey))}})))),d&&d[s.key]&&l.createElement(CardLabelError,null,r("EVENTS_TENANT_ERROR_REQUIRED")))))},EngagementULBDropdown:e=>{let{t:n,config:a,errors:o,control:r}=e;const u=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),s=Digit.UserService.getUser().info,c=u.filter(e=>{var t;return null==s||null===(t=s.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_ULB")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:a.key,control:r,rules:{required:!0},render:e=>{let{onChange:a,value:o}=e;return l.createElement(t.Dropdown,{option:c,selected:o,disable:1===(null==c?void 0:c.length),optionKey:"code",t:n,select:a})}}),o&&o[null==a?void 0:a.key]&&l.createElement(CardLabelError,null,n("EVENTS_TENANT_ERROR_REQUIRED")))))},EnagementDocName:e=>{let{t:n,config:a,register:o}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_DOC_NAME")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{name:a.key,inputRef:o()}))))},EngagementDocCategory:e=>{let{t:a,config:o,formData:r,control:u}=e;const s=Digit.ULBService.getStateId(),[c,d]=n.useState(()=>[]),m=Digit.ULBService.getCurrentUlb()||"pb.amritsar",{data:v}=Digit.Hooks.engagement.useMDMS(s,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===m.code))[0].categoryList.map(e=>({name:e}))}});return n.useEffect(()=>{var e,t;null!=r&&null!==(e=r.ULB)&&void 0!==e&&e.length&&d(null==r||null===(t=r.ULB)||void 0===t?void 0:t.map(e=>null==e?void 0:e.code))},[null==r?void 0:r.ULB]),l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_CATEGORY")+"*"),l.createElement(i.Controller,{name:o.key,control:u,render:e=>l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{option:v,select:e.onChange,selected:e.value,t:a,optionKey:"name"}))})))},EngagementDocDescription:e=>{var n,a,o;let{t:i,config:r,register:u,errors:s}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},i("ES_COMMON_DOC_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(t.TextArea,{name:r.key,inputRef:u({maxLength:140})}),(null==s||null===(n=s.description)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,i("ERROR_"+(null==s||null===(a=s.description)||void 0===a||null===(o=a.type)||void 0===o?void 0:o.toUpperCase())+"_140")))))},EngagementDocUploadDocument:e=>{let{t:a,config:r,formData:u,setError:s,control:c}=e;const[d,m]=n.useState(()=>{var e;return null==u||null===(e=u[r.key])||void 0===e?void 0:e.filestoreId}),[E,g]=n.useState(),[f,h]=n.useState(""),[y,S]=n.useState(),[_,C]=n.useState(!1),[b,T]=(Digit.ULBService.getCurrentTenantId(),n.useState({})),[D,w]=n.useState(!1),[x,I]=n.useState("");n.useEffect(()=>{y&&L()},[y]),n.useEffect(()=>{var e;d||C(!1),null==b||null===(e=b.onChange)||void 0===e||e.call(b,{fileStoreId:d,fileSize:E,fileType:f})},[d,b]);const L=function(){try{const e=p(function(){return v(function(){return w(!0),Promise.resolve(Digit.UploadServices.Filestorage("engagement",y,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?m(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):s(a("CS_FILE_UPLOAD_ERROR"))})},function(){})},function(e,t){if(w(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O=o.useLocation(),R=n.useMemo(()=>!!O.pathname.includes("/documents/inbox/update"),[O.pathname]);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_DOCUMENT")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:r.key+".filestoreId",control:c,render:e=>l.createElement(t.UploadFile,{id:"city-engagement-doc",onUpload:t=>((e,t)=>{var n,l,a,o,i,r;if(S(),g(),h(),I(""),null===(n=e.target)||void 0===n||null===(l=n.files)||void 0===l||!l.length)return;const u=null==e||null===(a=e.target)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.size,s=null==e||null===(i=e.target)||void 0===i||null===(r=i.files[0])||void 0===r?void 0:r.type;if(!(u&&u/1024/1024>5))return s&&(e=>!!e&&!!/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats)$/i.test(e))(s)?(g(u),h(s),T(t),void S(e.target.files[0])):void I("NOT_SUPPORTED_FILE_TYPE");I("FILE_SIZE_EXCEEDED")})(t,e),onDelete:()=>{m(null),g(100)},accept:"image/*, .pdf, .png, .jpeg, .doc",showHintBelow:!0,hintText:a("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE"),message:D?l.createElement(t.Loader,null):A(a,d,R),textStyles:{width:"100%"},inputStyles:{width:"280px"}})}),E?""+N(E):null,x?l.createElement(t.CardLabelError,null,a(x)):null)))},NotificationsAndWhatsNew:e=>{var i,r;let{variant:u,parentRoute:s}=e;const{t:c}=a.useTranslation(),m=o.useLocation(),v=o.useHistory(),p=Digit.ULBService.getCitizenCurrentTenant(),{data:{unreadCount:E}={},refetch:g}=Digit.Hooks.useNotificationCount({tenantId:p,config:{enabled:!(null===(i=Digit.UserService)||void 0===i||null===(r=i.getUser())||void 0===r||!r.access_token)}}),{mutate:f,isSuccess:h}=Digit.Hooks.useClearNotifications();n.useEffect(()=>{h&&g()},[h]),n.useEffect(()=>E&&p?f({tenantId:p}):null,[p,E]);const{data:y,isLoading:S}=Digit.Hooks.useEvents({tenantId:p,variant:u});if(S)return l.createElement(t.Loader,null);if(0===(null==y?void 0:y.length))return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,""+c("CS_HEADER_NOTIFICATIONS")),l.createElement("h1",null,"Nothing to show"));function _(e){v.push(s+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(()=>{switch(u){case"notifications":return l.createElement(t.Header,null,c("CS_HEADER_NOTIFICATIONS")+" "+(E?"("+E+")":""));case"whats-new":return l.createElement(t.Header,null,c("CS_HEADER_WHATSNEW"));default:return l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen",state:{from:m.pathname+m.search}}})}},null),null!=y&&y.length?y.map(e=>"EVENTSONGROUND"===(null==e?void 0:e.eventType)?l.createElement(t.OnGroundEventCard,d({onClick:_},e)):l.createElement("BROADCAST"===(null==e?void 0:e.eventType)?lo:t.WhatsNewCard,e)):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))},EventsListOnGround:e=>{var n,i,r,u;let{variant:s,parentRoute:c}=e;const{t:m}=a.useTranslation(),v=o.useLocation(),p=o.useHistory(),E=Digit.ULBService.getCitizenCurrentTenant(),{data:{}={},isSuccess:g}=Digit.Hooks.useNotificationCount({tenantId:E,config:{enabled:!(null===(n=Digit.UserService)||void 0===n||null===(i=n.getUser())||void 0===i||!i.access_token)}}),{data:f,isLoading:h}=Digit.Hooks.useEvents({tenantId:E,variant:s});if(null===(r=Digit.UserService)||void 0===r||null===(u=r.getUser())||void 0===u||!u.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});if(h||!g)return l.createElement(t.Loader,null);function y(e){p.push(c+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,m("EVENTS_EVENTS_HEADER")+"("+(null==f?void 0:f.length)+")"),f.length?f.map(e=>l.createElement(t.OnGroundEventCard,d({onClick:y},e))):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,m("COMMON_INBOX_NO_DATA"))))},EventDetails:()=>{var e,i,r,u,s,c,d;const{t:m}=a.useTranslation(),v=o.useLocation(),{id:p}=(o.useHistory(),o.useParams()),E=Digit.ULBService.getCitizenCurrentTenant(),{data:g,isLoading:f}=Digit.Hooks.useEvents({tenantId:E,variant:"events"});if(null===(e=Digit.UserService)||void 0===e||null===(i=e.getUser())||void 0===i||!i.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});const h=n.useMemo(()=>f?null:null==g?void 0:g.filter(e=>e.id===p)[0],[f,g]);return f?l.createElement(t.Loader,null):l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,m("ES_TITLE_APPLICATION_DETAILS")),l.createElement(t.OnGroundEventCard,function(e){const{eventCategory:t,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}=e;return{eventCategory:m(t),showEventCatergory:!0,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}}(h)),l.createElement("div",{className:"OnGroundEventDetailsCard"},l.createElement("p",{className:"cardCaptionBodyS"},null==h?void 0:h.description),l.createElement("div",{className:"eventAddressAndDirection"},l.createElement("span",null,l.createElement(t.MapMarker,null),l.createElement("div",null,l.createElement("p",null,null==h||null===(r=h.eventDetails)||void 0===r?void 0:r.address),null!=h&&null!==(u=h.eventDetails)&&void 0!==u&&u.latitude&&null!=h&&null!==(s=h.eventDetails)&&void 0!==s&&s.longitude?l.createElement("a",{className:"direction",target:"_blank",href:"https://www.google.com/maps/search/?api=1&query="+(null==h||null===(c=h.eventDetails)||void 0===c?void 0:c.latitude)+"%2C"+(null==h||null===(d=h.eventDetails)||void 0===d?void 0:d.longitude)},m("CS_COMMON_GET_DIRECTIONS")):null))),l.createElement("div",{className:"eventTimeRange"},l.createElement(t.Clock,null),l.createElement("p",null,null==h?void 0:h.onGroundEventTimeRange))))},EventForm:e=>{var r,u,s,c;let{formData:d,control:m,errors:v}=e;const{t:p}=a.useTranslation(),E=Digit.ULBService.getCurrentTenantId(),g=null==E?void 0:E.split(".")[0],f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),{isLoading:_,data:C}=Digit.Hooks.useCommonMDMS(g,"mseva",["EventCategories"]),b=o.useLocation(),T=n.useMemo(()=>!!b.pathname.includes("/engagement/event/edit-event"),[b.pathname]);return _?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:m,defaultValue:null!=d&&d.defaultTenantId?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===(null==d?void 0:d.defaultTenantId)):E?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===E):1===(null==S?void 0:S.length)?null==S?void 0:S[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:S,selected:a,disable:!!T||1===(null==S?void 0:S.length),optionKey:"code",t:p,select:n})}}),v&&v.tenantId&&l.createElement(t.CardLabelError,null,p("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_NAME_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==d?void 0:d.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:m}),v&&(null==v?void 0:v.name)&&"required"===(null==v||null===(r=v.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_COMMENTS_ERROR_REQUIRED")),v&&(null==v?void 0:v.name)&&"maxLength"===(null==v||null===(u=v.name)||void 0===u?void 0:u.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_CATEGORY_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"eventCategory",control:m,defaultValue:null!=d&&d.category?null==C||null===(s=C.mseva)||void 0===s||null===(c=s.EventCategories.filter(e=>e.code===(null==d?void 0:d.category)))||void 0===c?void 0:c[0]:null,rules:{required:!0},render:e=>{var n;let{onChange:a,ref:o,value:i}=e;return l.createElement(t.Dropdown,{inputRef:o,option:null==C||null===(n=C.mseva)||void 0===n?void 0:n.EventCategories,optionKey:"code",t:p,select:a,selected:i})}}),v&&v.eventCategory&&l.createElement(t.CardLabelError,null,p("EVENTS_CATEGORY_ERROR_REQUIRED")))))},MessageForm:e=>{var o,r,u,s,c,d,m,v,p,E;let{formData:g,control:f,errors:h,setError:y}=e;const{t:S}=a.useTranslation(),_=Digit.ULBService.getCurrentTenantId(),C=null==_?void 0:_.split(".")[0],b=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),{isLoading:T,data:D}=Digit.Hooks.useCommonMDMS(C,"mseva",["EventCategories"]),N=Digit.ULBService.getStateId(),A=b.filter(e=>(null==e?void 0:e.code)===_);return T?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,defaultValue:1===(null==A?void 0:A.length)?null==A?void 0:A[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:A,selected:a,disable:1===(null==A?void 0:A.length),optionKey:"code",t:S,select:n})}}),h&&h.tenantId&&l.createElement(t.CardLabelError,null,S("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TITLE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==g?void 0:g.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:f}),h&&(null==h?void 0:h.name)&&"required"===(null==h||null===(o=h.name)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.name)&&"maxLength"===(null==h||null===(r=h.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},S("EVENTS_COMMENTS_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"description",control:f,defaultValue:null!=g&&g.category?null==D||null===(u=D.mseva)||void 0===u||null===(s=u.EventCategories.filter(e=>e.code===(null==g?void 0:g.category)))||void 0===s?void 0:s[0]:null,rules:{required:!0,maxLength:500},render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextArea,{inputRef:a,value:o,name:"description",onChange:n,hintText:S("PUBLIC_BRDCST_MSG_LENGTH")})}}),h&&(null==h?void 0:h.description)&&"required"===(null==h||null===(c=h.description)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.description)&&"maxLength"===(null==h||null===(d=h.description)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},""+S("EVENTS_ATTACHMENT_LABEL")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"documents",control:f,rules:{required:!1},render:e=>{let{onChange:n,value:a=[]}=e;return l.createElement(t.MultiUploadWrapper,{t:S,module:"engagement",tenantId:N,getFormState:function(e){let t=[];e.length>0&&e.forEach(e=>{var n,l,a,o;t.push({fileName:null==e?void 0:e[0],fileStoreId:null==e||null===(n=e[1])||void 0===n||null===(l=n.fileStoreId)||void 0===l?void 0:l.fileStoreId,documentType:null==e||null===(a=e[1])||void 0===a||null===(o=a.file)||void 0===o?void 0:o.type})}),n(t)},showHintBelow:!0,setuploadedstate:a,allowedFileTypesRegex:to,allowedMaxSizeInMB:5,hintText:S("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE")})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_FROM_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,name:"fromDate",defaultValue:null==g?void 0:g.fromDate,rules:{required:!0,validate:{isValidFromDate:e=>{const t=x(new Date(""+(null==g?void 0:g.fromDate))),n=new Date;return!(!k(t)||t.getTime()<n.getTime()&&(y("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(m=h.fromDate)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(v=h.fromDate)||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_INVALID")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,name:"toDate",defaultValue:null==g?void 0:g.toDate,rules:{required:!0,validate:{isValidToDate:e=>{const t=x(new Date(""+(null==g?void 0:g.fromDate))),n=x(new Date(""+(null==g?void 0:g.toDate))),l=new Date;return!(!k(n)||(n.getTime()<l.getTime()||n.getTime()<t.getTime())&&(y("toDate",{type:"isValidToDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(p=h.toDate)||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(E=h.toDate)||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_INVALID")))))},DocumentList:e=>{let{match:o}=e;const{t:i}=a.useTranslation(),{category:r,count:u}=o.params,s=Digit.ULBService.getCitizenCurrentTenant(),[c,d]=n.useState(20),[m,v]=n.useState(0),[p,E]=n.useState(),g=so(p,700),{data:f,isLoading:h}=Digit.Hooks.engagement.useDocSearch({name:g,category:r,tenantIds:s,limit:c},{select:e=>{var t;return null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}})}});return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,i(""+r)+" ("+(u||"-")+")"),l.createElement("div",{className:"documentContainerPadding"},l.createElement("div",null,l.createElement(uo,{searchValue:p,handleKeyPress:function(e){try{return"Enter"===e.key&&p.length&&E(""),Promise.resolve()}catch(e){return Promise.reject(e)}},handleSearch:function(e){try{return p.length&&E(""),Promise.resolve()}catch(e){return Promise.reject(e)}},onChange:E,t:i})),h?l.createElement(t.Loader,null):f&&f.length?mo(f,i):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,i("COMMON_INBOX_NO_DATA")))))},SelectEventGeolocation:e=>{var o,i;let{onSelect:r,config:u,formData:s}=e;const{t:c}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},""+c("EVENTS_GEOLOCATION_LABEL")),l.createElement("div",{className:"field"},l.createElement(t.LocationSearch,{position:{latitude:null==s||null===(o=s.geoLocation)||void 0===o?void 0:o.latitude,longitude:null==s||null===(i=s.geoLocation)||void 0===i?void 0:i.longitude},onChange:(e,t)=>{r(null==u?void 0:u.key,t)}}))))},SelectToDate:e=>{var o,r;let{formData:u,control:s,errors:c,setError:d}=e;const{t:m}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},m("EVENTS_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:s,name:"toDate",defaultValue:null==u?void 0:u.toDate,rules:{required:!0,validate:{isValidDate:e=>!(!k(new Date(null==u?void 0:u.fromDate))||!k(new Date(e))||(new Date((null==u?void 0:u.fromDate)+" "+(null==u?void 0:u.fromTime))<new Date?(d("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1):new Date(e+" "+(null==u?void 0:u.toTime))<new Date||!(new Date((null==u?void 0:u.fromDate)+" "+(null==u?void 0:u.fromTime))<=new Date(e+" "+(null==u?void 0:u.toTime)))))}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),c&&(null==c?void 0:c.toDate)&&"required"===(null==c||null===(o=c.toDate)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),c&&(null==c?void 0:c.toDate)&&"isValidDate"===(null==c||null===(r=c.toDate)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID")))))},SurveyList:()=>{const{t:e}=a.useTranslation(),n=o.useHistory(),i=Digit.ULBService.getCitizenCurrentTenant(),{data:r,isLoading:u}=Digit.Hooks.survey.useSearch({tenantIds:i},{select:e=>{let{Surveys:t}=e;const n=t.map(e=>{const t=Yo(e.startDate,e.endDate);let n="";return n=t&&e.hasResponded?"CS_SURVEY_RESPONDED":t?"CS_SURVEY_YT_TO_RESPOND":"CANNOT_RESPOND_MSG",d({hasResponded:!1,responseStatus:n},e)}),l=[],a=[];for(let e of n)"ACTIVE"===e.status&&Yo(e.startDate,e.endDate)?l.push(e):a.push(e);return{activeSurveysList:l,inactiveSurveysList:a}}});return u?l.createElement(t.Loader,null):l.createElement("div",{className:"survey-list-container"},l.createElement(t.Header,null,e("CS_COMMON_SURVEYS")+" ("+(null==r?void 0:r.activeSurveysList.length)+")"),null!=r&&r.activeSurveysList&&r.activeSurveysList.length?r.activeSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(zo,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t,onCardClick:()=>{var t;n.push((t=e).hasResponded?"/digit-ui/citizen/engagement/surveys/show-survey":"/digit-ui/citizen/engagement/surveys/fill-survey?applicationNumber="+(null==t?void 0:t.uuid)+"&tenantId="+(null==t?void 0:t.tenantId),t)}}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_ACTIVE_SURVEYS"))),l.createElement(t.Header,null,e("CS_COMMON_INACTIVE_SURVEYS")+" ("+r.inactiveSurveysList.length+")"),null!=r&&r.inactiveSurveysList&&r.inactiveSurveysList.length?r.inactiveSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(zo,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_INACTIVE_SURVEYS"))))},FillSurvey:e=>{var t,i,r,u,s,c,d,m;const{applicationNumber:v,tenantId:p}=Digit.Hooks.useQueryParams(),{data:E,isLoading:g}=Digit.Hooks.survey.useSearch({uuid:v,tenantId:p},{}),f=null!=E&&null!==(t=E.Surveys)&&void 0!==t&&t[0]?null==E||null===(i=E.Surveys)||void 0===i?void 0:i[0]:{},{t:h}=a.useTranslation();let y=E;const[S,_]=n.useState(null);null==f||null===(r=f.questions)||void 0===r||r.sort((e,t)=>e.qorder-t.qorder);const C=o.useHistory();return n.useEffect(()=>{var e,t,n,l,a,o;E&&1==(null==y||null===(e=y.Surveys)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.hasResponded)||"true"===(null==y||null===(n=y.Surveys)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.hasResponded)?_({key:!0,label:"SURVEY_FORM_IS_ALREADY_SUBMITTED"}):E&&"INACTIVE"==(null==y||null===(a=y.Surveys)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.status)&&_({key:!0,label:"SURVEY_FORM_IS_ALREADY_INACTIVE"})},[null==E||null===(u=E.Surveys)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.hasResponded,null==y||null===(c=y.Surveys)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.hasResponded]),(null===(m=Object.keys(f))||void 0===m?void 0:m.length)>0||g?l.createElement(Mi,{surveyData:f,isSubmitDisabled:!!S,isLoading:g,onFormSubmit:e=>{const t={AnswerEntity:{surveyId:f.uuid,answers:cr(e),surveyTitle:f.title,hasResponded:f.hasResponded}};C.push("/digit-ui/citizen/engagement/surveys/submit-response",t)},formDisabled:!!S,showToast:S}):l.createElement(sr,{t:h})},CitizenSurveyForm:Mi,ShowSurvey:e=>{var a;let{location:o}=e;const i=null==o?void 0:o.state,u=(Digit.ULBService.getCitizenCurrentTenant(),Digit.Hooks.survey.useShowResults()),s=r.useQueryClient();if(n.useEffect(()=>{u.mutate({surveyId:i.uuid},{onSuccess:()=>{s.clear()}})},[]),u.isLoading&&!u.isIdle)return l.createElement(t.Loader,null);if(u.isError)return l.createElement("div",null,"An error occured...");const c=null==u||null===(a=u.data)||void 0===a?void 0:a.answers,d={};return null==c||c.map(e=>{d[null==e?void 0:e.questionId]=1===(null==e?void 0:e.answer.length)?null==e?void 0:e.answer[0]:null==e?void 0:e.answer}),l.createElement(Mi,{surveyData:i,submitDisabled:!0,formDisabled:!0,formDefaultValues:d})},SurveyResults:Ki,CreateSurveyCategory:$o,SearchCategories:ti,SurveyForm:e=>{let{t:a,index:o,questionStatement:r,type:u,uuid:s,qorder:c,required:m,options:v,disableInputs:p,dispatch:E,isPartiallyEnabled:g,addOption:f,formDisabled:h}=e;const y=[{title:a("Surveys_Short_Answer"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},{title:a("Surveys_Multiple_Choice"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},{title:a("Surveys_Check_Boxes"),i18Key:"CHECKBOX_ANSWER_TYPE",value:"CHECKBOX_ANSWER_TYPE"},{title:a("Surveys_Paragraph"),i18Key:"LONG_ANSWER_TYPE",value:"LONG_ANSWER_TYPE"},{title:a("Surveys_Date"),i18Key:"DATE_ANSWER_TYPE",value:"DATE_ANSWER_TYPE"},{title:a("Surveys_Time"),i18Key:"TIME_ANSWER_TYPE",value:"TIME_ANSWER_TYPE"}],S=[{title:a("Product Quality"),i18Key:"Product_Quality",value:"Product_Quality"}],_=[{title:a("What is your feedback for this product?"),i18Key:"Product_Quality",value:"Product_Quality"}],C=y.filter(e=>(null==e?void 0:e.value)===("object"==typeof u?u.value:u)),b=window.location.href.includes("/employee/engagement/"),[T,D]=n.useState({questionStatement:r,type:u?null==C?void 0:C[0]:{title:a("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:m,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c}),{register:N,formState:A}=i.useFormContext(),[w,x]=n.useState(0);n.useEffect(()=>{D({questionStatement:r,type:u?null==C?void 0:C[0]:{title:a(""),i18Key:"",value:""},required:m,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c})},[r]);const I=()=>D(e=>{const t=d({},e);return t.options.push(a("CMN_OPTION")+" "+(t.options.length+1)),t}),L=e=>{let{value:t,id:n}=e;D(e=>{const l=d({},e);return l.options.splice(n,1,t),l})},O=e=>{1===T.options.length||!g&&h||D(t=>{const n=d({},t);return n.options.splice(e,1),n})};return n.useEffect(()=>{E({type:"updateForm",payload:{index:o,formConfig:T}})},[T]),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},l.createElement(t.TextInput,{value:T.categoryName,onChange:e=>{D(t=>d({},t,{categoryName:e.target.value}))},name:"category",placeholder:"Category Title"}),l.createElement(t.TextInput,{placeholder:a("Weightage"),value:T.weightage,onChange:e=>{D(t=>d({},t,{weightage:e.target.value}))},textInputStyle:{width:"100%"},name:"Weightage_"+o,disable:p,inputRef:N({required:a("ES_ERROR_REQUIRED"),maxLength:{value:100,message:a("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:a("ES_SURVEY_DONT_START_WITH_NUMBER")}})})),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement("div",null,l.createElement(t.Dropdown,{t:a,option:S,select:e=>{D(t=>d({},t,{Categorytype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Category",optionKey:"i18Key",disable:p,selected:""}),l.createElement(t.TextInput,{placeholder:a("Category Weightage"),name:"QusWeight",disabled:b,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})})),l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:_,select:e=>{D(t=>d({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:T.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{D(t=>d({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},optionKey:"i18Key",disable:p,selected:null==T?void 0:T.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:b,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,o;switch(null==e?void 0:e.value){case"LONG_ANSWER_TYPE":return l.createElement("div",null,l.createElement(t.TextArea,{placeholder:a("LONG_ANSWER_TYPE"),disabled:b,name:"longAnsDescription",inputRef:N({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")}})}),(null==A?void 0:A.errors)&&l.createElement(t.CardLabelError,null,null==A||null===(n=A.errors)||void 0===n||null===(o=n.longAnsDescription)||void 0===o?void 0:o.message));case"DATE_ANSWER_TYPE":return l.createElement(t.DatePicker,{stylesForInput:{width:"calc(100% - 290px)"},style:{width:"202px"},disabled:b});case"TIME_ANSWER_TYPE":return l.createElement(t.TextInput,{type:"time",textInputStyle:{width:"202px"},disable:b});case"MULTIPLE_ANSWER_TYPE":return l.createElement(ai,{maxLength:60,titleHover:a("MAX_LENGTH_60"),t:a,addOption:I,updateOption:L,removeOption:O,options:null==T?void 0:T.options,createNewSurvey:f,isInputDisabled:b,isPartiallyEnabled:g,formDisabled:h});case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,l.createElement(ni,{t:a,addOption:I,updateOption:L,removeOption:O,options:null==T?void 0:T.options,isInputDisabled:b,isPartiallyEnabled:g,createNewSurvey:f,formDisabled:h,maxLength:60,titleHover:a("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}}));default:return null}})(null==T?void 0:T.Answertype)),(void 0!==T.Questype&&console.log("hi"),void 0!==T.Questype?l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:_,select:e=>{D(t=>d({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:T.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{D(t=>d({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},name:"Answertype"+(null==T||null===(R=T.Questype)||void 0===R?void 0:R.index),optionKey:"i18Key",disable:p,selected:null==T?void 0:T.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:b,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))):null),l.createElement("div",{className:"newSurveyForm_actions"},l.createElement("div",null,"Add more questions?"),l.createElement("div",{className:"newSurveyForm_seprator"}),l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>{D(e=>d({},e,{Questype:{value:"ADD_QUESTION",index:w+1}})),x(w+1)}},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("Add more question")))))),l.createElement("div",{className:"newSurveyForm_actions"},0!==o&&l.createElement("div",{className:"newSurveyForm_seprator"}),0!==o&&l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>E({type:"removeForm",payload:{index:o}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("CS_INFO_DELETE"))))))));var R},CreateSurveyForm:e=>{let{disableInputs:t,isPartiallyEnabled:a,formDisabled:o}=e;const r=i.useForm({defaultValues:{sections:[]}}),{register:u,control:s,setValue:c,getValues:v,reset:p,formState:E,clearErrors:g}=r,f=m(r,rr);console.log("setSurveyConfig",c),console.log("disable Inputs",t),console.log("partially enabled",a),console.log("forms disable",o);const[h,y]=n.useReducer((e,t)=>{let{type:n}=t;switch(console.log("type im reducer",n),n){case"ADD_SECTION":return d({},e,{sections:[e.sections,{id:2,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}],weightage:0}]});case"ADD_CATEGORY":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:[...e.categories,{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}):e)});case"ADD_QUESTION":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:e.categories.map(e=>e.id===action.categoryId?d({},e,{questions:[...e.questions,{id:Date.now(),type:"",answer:""}]}):e)}):e)});case"UPDATE_SECTION_WEIGHTAGE":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{weightage:action.weightage}):e)});case"UPDATE_CATEGORY_WEIGHTAGE":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:e.categories.map(e=>e.id===action.categoryId?d({},e,{weightage:action.weightage}):e)}):e)});default:return e}},{sections:[{id:1,weightage:20,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}]});return l.createElement(n.Fragment,null,l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,d({register:u,control:s,setValue:c,getValues:v,reset:p,formState:E,clearErrors:g},f),l.createElement("div",null,l.createElement("h1",null,"Survey Creation"),l.createElement("button",{onClick:()=>{(e=>{let{type:t,payload:n}={type:"ADD_SECTION"};console.log("type",t),y({type:t,payload:d({},n,{setSurveyFormValue:c})})})()}},"Add Section"),(console.log("render",h),h.sections.length?h.sections.map((e,t)=>(console.log("section",e),console.log("index",t),l.createElement(ir,{key:t,section:e}))):null))))))},SurveyFormDetails:e=>{let{config:t,onGoNext:n,onBackClick:a,t:o}=e;const i=u.useDispatch(),r=u.useSelector(e=>e.engagement.surveyForm.surveyDetails),s=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[t.key]?e.engagement.surveyForm.formData[t.key]:{}});return l.createElement(l.Fragment,null,l.createElement(fu,{defaultValues:s,box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},config:t.currStepConfig,onSubmit:function(e){console.log("Data in step "+t.currStepNumber+" is: \n",e);let l=0,a="";r.map(e=>{""===e.name&&(l=1,a+="Please enter Survey Name\n"),e.name.length>500&&(l=1,a+="Please enter a Survey Name that is 500 characters or fewer\n"),e.description.length>500&&(l=1,a+="Please enter a Survey Description that is 500 characters or fewer\n"),""===e.fromDate&&(l=1,a+="Please enter Survey Start Date\n"),""===e.fromTime&&(l=1,a+="Please enter Survey Start Time\n"),""===e.toDate&&(l=1,a+="Please enter Survey End Date\n"),""===e.toTime&&(l=1,a+="Please enter Survey End Time\n"),e.description.length>140&&(l=1,a+="Please enter description less than 140 characters\n"),new Date(e.fromDate+"T"+e.fromTime)>new Date(e.toDate+"T"+e.toTime)&&(l=1,a+="Start date and time must be before end date and time.\n")}),1!==l?n():alert(a)},onFormValueChange:function(e,n){console.log("d",n),console.log("onFormValueChange data in SurveyFormDetails: ",n,"\n Bool: ",!_.isEqual(n,s)),_.isEqual(n,s)||i(hi(t.key,n))},label:o(""+t.texts.submitBarLabel),currentStep:t.currStepNumber,onBackClick:function(e){a(t.key,e)}}))},SurveyFormCategoryDetails:e=>{let{config:n,onGoNext:a,onBackClick:o,t:i}=e;const r=u.useDispatch(),s=u.useSelector(e=>e.engagement.surveyForm.categories),c=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[n.key]?e.engagement.surveyForm.formData[n.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},defaultValues:c,config:n.currStepConfig,onSubmit:function(e){console.log("data in go next",s);let t=0,l="";s.map((e,n)=>{e.title.length>500&&(l+="-> Please enter a Section Title that is 500 characters or fewer for section "+(n+1)+" card\n",t=1),0===e.selectedQuestions.length&&(l+="-> Please select at least one question for section "+(n+1)+" card\n",t=1)});const o=s.reduce((e,t)=>e+parseFloat(t.weightage),0);console.log("tot weight",Math.round(o)),Math.round(o)>100&&(l+="The total weightage of sections should not exceed 100.\n",t=1),Math.round(o)<100&&(l+="The total weightage of sections should not be less than 100.\n",t=1),s.map((e,n)=>{const a=e.selectedQuestions.reduce((e,t)=>e+parseFloat(t.weightage),0);Math.round(a)>100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1),Math.round(a)<100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1)}),1!==t?(console.log("Data in step "+n.currStepNumber+" is: \n",e),a()):alert(l)},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveyFormCategoryDetails: ",t,"\n Bool: ",!_.isEqual(t,c)),_.isEqual(t,c)||r(hi(n.key,t))},label:i(""+n.texts.submitBarLabel),currentStep:n.currStepNumber,onBackClick:function(e){o(n.key,e),r({type:"GO_PREV"})}}))},SurveryFormSummary:e=>{let{config:a,onGoNext:i,onBackClick:r,t:s}=e;const[c,d]=n.useState(null),m=o.useHistory(),v=u.useDispatch(),p=u.useSelector(e=>e.engagement.surveyForm.categories),E=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);Digit.ULBService.getCurrentTenantId();const g=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[a.key]?e.engagement.surveyForm.formData[a.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{defaultValues:g,config:a.currStepConfig,onSubmit:function(e){let t=[];p.map(e=>{let n=[];e.selectedQuestions.map(e=>{let t={questionUuid:e.uuid,weightage:parseFloat(e.weightage),required:e.mandatory};n.push(t)});let l={title:e.title,weightage:parseFloat(e.weightage),questions:n};t.push(l)}),console.log("survey det",E);let n={SurveyEntity:{startDate:new Date(E.fromDate+" "+E.fromTime).getTime(),endDate:new Date(E.toDate+" "+E.toTime).getTime(),tenantId:E.ulb.code,surveyTitle:E.name,surveyCategory:E.name,surveyDescription:E.description,sections:t}};try{Digit.Surveys.createSurvey(n).then(e=>{var t,n;v({type:"RESET_FORM"}),(null==e||null===(t=e.Surveys)||void 0===t?void 0:t.length)>0?m.push("/digit-ui/employee/engagement/surveys/create-response",{message:"SURVEY_FORM_CREATED",response:null==e?void 0:e.Surveys,isSuccess:!0}):d({key:!0,label:""+(null==e||null===(n=e.Errors)||void 0===n?void 0:n.message)})})}catch(e){console.log(e)}console.log("Data in step "+a.currStepNumber+" is: \n",e),i()},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveryFormSummary: ",t,"\n Bool: ",!_.isEqual(t,g)),_.isEqual(t,g)||v(hi(a.key,t))},label:s(""+a.texts.submitBarLabel),currentStep:a.currStepNumber,onBackClick:function(e){r(a.key,e),v({type:"GO_PREV"})}}),c&&l.createElement(Toast,{error:c.key,label:s(c.label),onClose:()=>{d(null)}}))},NewSurveys:lr,SurveyCreationPage:yu,SurveySummary:()=>l.createElement("div",{style:{backgroundColor:"white"}},l.createElement(lr,{readOnly:!0}),l.createElement(yu,{readOnly:!0,hideQuestionLabel:!0})),FillSurveyNew:()=>(console.log("fill survey form new"),l.createElement(Su,null)),FillSurveyEmp:xi,FillQuestions:bo};exports.SurveyReducers=()=>c.combineReducers({surveyForm:mr}),exports.initEngagementComponents=()=>{Object.entries(bu).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
1
+ var e,t=require("@mseva/digit-ui-react-components"),n=require("react"),l=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-router-dom"),i=require("react-hook-form"),r=require("react-query"),u=require("react-redux"),s=require("recharts");require("react-time-picker");var c=require("redux");function d(){return(d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function m(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}function v(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function p(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}function E(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function g(e){E(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function f(e){E(1,arguments);var t=g(e);return t.setHours(0,0,0,0),t}function h(e,t){E(2,arguments);var n=f(e),l=f(t);return n.getTime()===l.getTime()}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const y=(e,t)=>e.name.toUpperCase()<t.name.toUpperCase()?-1:e.name.toUpperCase()>t.name.toUpperCase()?1:0,S=(e,t)=>{var n,l;return!(!e||!t)&&(null==e||null===(n=e.trim())||void 0===n?void 0:n.toLowerCase())===(null==t||null===(l=t.trim())||void 0===l?void 0:l.toLowerCase())},C=function(e){return Promise.resolve(v(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId())).then(function(e){var t,n;if((null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n?void 0:n.length)>0){var l,a;const t=null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url;if(t.includes(".jpg")||t.includes(".png")){const e=t.split(","),[n,l,a,o]=e;return n}return null===(a=e.data.fileStoreIds[0])||void 0===a?void 0:a.url}})},function(){}))},b=function(e,t){try{if(!e||!e.length)return alert("No Document exists!"),Promise.resolve();const n=window.open("","_blank");return Promise.resolve(C(e)).then(function(e){window.mSewaApp&&window.mSewaApp.isMsewaApp()?(window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3)):(n.location=e,n.document.title=t)})}catch(e){return Promise.reject(e)}},T=(e,t)=>{if(e&&e.length)if(window.mSewaApp&&window.mSewaApp.isMsewaApp())window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3);else{const n=window.open("","_blank");n.location=e,n.document.title=t}else alert("No Document Link exists!")},D=function(e,t){try{return e&&e.length?Promise.resolve(C(e)).then(function(e){e&&Digit.Utils.downloadPDFFromLink(e)}):(alert("No Document exists!"),Promise.resolve())}catch(e){return Promise.reject(e)}},N=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB"][t]},A=(e,t,n)=>{var l;return t?n?null!=t&&null!==(l=t.fileStoreId)&&void 0!==l&&l.length?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):t?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED")},w=e=>{let t=new Date(e);if(function(e){return E(1,arguments),h(e,Date.now())}(t)){const e=new Date;t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59)}return t.getTime()},I=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59),x=[{head:"",body:[{type:"form",withoutLabel:!0,component:"EventForm",nextStep:"",route:"",key:"eventData"},{type:"text",label:"EVENTS_DESCRIPTION_LABEL",isMandatory:!0,description:"EVENTS_DESCRIPTION_TEXT",populators:{name:"description",className:"fullWidth",validation:{required:!0,maxLength:500},error:"EVENTS_DESCRIPTION_ERROR_REQUIRED"}},{type:"date",label:"EVENTS_FROM_DATE_LABEL",isMandatory:!0,populators:{name:"fromDate",className:"fullWidth",validation:{required:!0},shouldUpdate:!0,error:"EVENTS_FROM_DATE_ERROR_INVALID"}},{type:"form",key:"SelectToDate",withoutLabel:!0,component:"SelectToDate",key:"toDate"},{type:"time",label:"EVENTS_FROM_TIME_LABEL",isMandatory:!0,populators:{name:"fromTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_FROM_TIME_ERROR_REQUIRED"}},{type:"time",label:"EVENTS_TO_TIME_LABEL",isMandatory:!0,populators:{name:"toTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_TO_TIME_ERROR_REQUIRED"}},{type:"text",label:"EVENTS_ADDRESS_LABEL",isMandatory:!0,populators:{name:"address",className:"fullWidth",validation:{required:!0},error:"EVENTS_ADDRESS_ERROR_REQUIRED"}},{type:"component",component:"SelectEventGeolocation",withoutLabel:!0,key:"geoLocation"},{type:"text",label:"EVENTS_ORGANIZER_NAME_LABEL",populators:{name:"organizer",className:"fullWidth",validation:{pattern:/^[A-Za-z ]*$/},error:"EVENTS_ORGANIZER_ERROR"}},{type:"number",label:"EVENTS_ENTRY_FEE_INR_LABEL",populators:{name:"fees",className:"fullWidth",error:"EVENTS_ENTRY_ERROR_REQUIRED"}}]}],L=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[c,m,v]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[p,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),g(),v()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ES_TITLE_NEW_EVENTS")),l.createElement(t.FormComposer,{config:x,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:r,address:u,organizer:s,fees:c,geoLocation:m={}}=e,v={events:[{source:"WEBAPP",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:d({fromDate:new Date(l+" "+o).getTime(),toDate:new Date(a+" "+r).getTime(),fromTime:o,toTime:r,address:u,organizer:s,fees:c},m)}]};i.push("/digit-ui/employee/engagement/event/response",v)},label:e("EVENTS_CREATE_EVENT")}))};function O(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function R(e,t){E(2,arguments);var n=g(e).getTime(),l=O(t);return new Date(n+l)}function P(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function M(e,t){E(2,arguments);var n=g(e),l=g(t),a=n.getTime()-l.getTime();return a<0?-1:a>0?1:a}function F(e){return E(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function k(e){if(E(1,arguments),!F(e)&&"number"!=typeof e)return!1;var t=g(e);return!isNaN(Number(t))}function B(e,t){E(2,arguments);var n=g(e),l=g(t),a=n.getFullYear()-l.getFullYear(),o=n.getMonth()-l.getMonth();return 12*a+o}function U(e,t){return E(2,arguments),g(e).getTime()-g(t).getTime()}var H={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function V(e){return e?H[e]:H.trunc}function W(e){E(1,arguments);var t=g(e);return t.setHours(23,59,59,999),t}function q(e){E(1,arguments);var t=g(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function j(e){E(1,arguments);var t=g(e);return W(t).getTime()===q(t).getTime()}function z(e,t){E(2,arguments);var n,l=g(e),a=g(t),o=M(l,a),i=Math.abs(B(l,a));if(i<1)n=0;else{1===l.getMonth()&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-o*i);var r=M(l,a)===-o;j(g(e))&&1===i&&1===M(e,a)&&(r=!1),n=o*(i-Number(r))}return 0===n?0:n}function Y(e,t,n){E(2,arguments);var l=U(e,t)/1e3;return V(null==n?void 0:n.roundingMethod)(l)}var G={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function K(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,l=e.formats[n]||e.formats[e.defaultWidth];return l}}var Q={date:K({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:K({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:K({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},X={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Z(e){return function(t,n){var l,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):o;l=e.formattingValues[i]||e.formattingValues[o]}else{var r=e.defaultWidth,u=a.width?String(a.width):e.defaultWidth;l=e.values[u]||e.values[r]}return l[e.argumentCallback?e.argumentCallback(t):t]}}function $(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.width,a=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var i,r=o[0],u=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(u)?ee(u,function(e){return e.test(r)}):J(u,function(e){return e.test(r)});i=e.valueCallback?e.valueCallback(s):s,i=n.valueCallback?n.valueCallback(i):i;var c=t.slice(r.length);return{value:i,rest:c}}}function J(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function ee(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var te,ne={code:"en-US",formatDistance:function(e,t,n){var l,a=G[e];return l="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+l:l+" ago":l},formatLong:Q,formatRelative:function(e,t,n,l){return X[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),l=n%100;if(l>20||l<10)switch(l%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Z({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Z({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Z({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Z({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Z({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(te={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(te.matchPattern);if(!n)return null;var l=n[0],a=e.match(te.parsePattern);if(!a)return null;var o=te.valueCallback?te.valueCallback(a[0]):a[0];o=t.valueCallback?t.valueCallback(o):o;var i=e.slice(l.length);return{value:o,rest:i}}),era:$({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:$({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:$({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:$({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:$({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function le(e,t){E(2,arguments);var n=O(t);return R(e,-n)}function ae(e){E(1,arguments);var t=1,n=g(e),l=n.getUTCDay(),a=(l<t?7:0)+l-t;return n.setUTCDate(n.getUTCDate()-a),n.setUTCHours(0,0,0,0),n}function oe(e){E(1,arguments);var t=g(e),n=t.getUTCFullYear(),l=new Date(0);l.setUTCFullYear(n+1,0,4),l.setUTCHours(0,0,0,0);var a=ae(l),o=new Date(0);o.setUTCFullYear(n,0,4),o.setUTCHours(0,0,0,0);var i=ae(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function ie(e){E(1,arguments);var t=oe(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var l=ae(n);return l}function re(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.weekStartsOn,o=null==a?0:O(a),i=null==n.weekStartsOn?o:O(n.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var r=g(e),u=r.getUTCDay(),s=(u<i?7:0)+u-i;return r.setUTCDate(r.getUTCDate()-s),r.setUTCHours(0,0,0,0),r}function ue(e,t){E(1,arguments);var n=g(e),l=n.getUTCFullYear(),a=t||{},o=a.locale,i=o&&o.options&&o.options.firstWeekContainsDate,r=null==i?1:O(i),u=null==a.firstWeekContainsDate?r:O(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=new Date(0);s.setUTCFullYear(l+1,0,u),s.setUTCHours(0,0,0,0);var c=re(s,t),d=new Date(0);d.setUTCFullYear(l,0,u),d.setUTCHours(0,0,0,0);var m=re(d,t);return n.getTime()>=c.getTime()?l+1:n.getTime()>=m.getTime()?l:l-1}function se(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.firstWeekContainsDate,o=null==a?1:O(a),i=null==n.firstWeekContainsDate?o:O(n.firstWeekContainsDate),r=ue(e,t),u=new Date(0);u.setUTCFullYear(r,0,i),u.setUTCHours(0,0,0,0);var s=re(u,t);return s}function ce(e,t){for(var n=e<0?"-":"",l=Math.abs(e).toString();l.length<t;)l="0"+l;return n+l}var de={G:function(e,t,n){var l=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(l,{width:"abbreviated"});case"GGGGG":return n.era(l,{width:"narrow"});case"GGGG":default:return n.era(l,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var l=e.getUTCFullYear();return n.ordinalNumber(l>0?l:1-l,{unit:"year"})}return function(e,t){var n=e.getUTCFullYear(),l=n>0?n:1-n;return ce("yy"===t?l%100:l,t.length)}(e,t)},Y:function(e,t,n,l){var a=ue(e,l),o=a>0?a:1-a;return"YY"===t?ce(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):ce(o,t.length)},R:function(e,t){return ce(oe(e),t.length)},u:function(e,t){return ce(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(l);case"QQ":return ce(l,2);case"Qo":return n.ordinalNumber(l,{unit:"quarter"});case"QQQ":return n.quarter(l,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(l,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(l,{width:"wide",context:"formatting"})}},q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(l);case"qq":return ce(l,2);case"qo":return n.ordinalNumber(l,{unit:"quarter"});case"qqq":return n.quarter(l,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(l,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(l,{width:"wide",context:"standalone"})}},M:function(e,t,n){var l=e.getUTCMonth();switch(t){case"M":case"MM":return function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):ce(n+1,2)}(e,t);case"Mo":return n.ordinalNumber(l+1,{unit:"month"});case"MMM":return n.month(l,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(l,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(l,{width:"wide",context:"formatting"})}},L:function(e,t,n){var l=e.getUTCMonth();switch(t){case"L":return String(l+1);case"LL":return ce(l+1,2);case"Lo":return n.ordinalNumber(l+1,{unit:"month"});case"LLL":return n.month(l,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(l,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(l,{width:"wide",context:"standalone"})}},w:function(e,t,n,l){var a=function(e,t){E(1,arguments);var n=g(e),l=re(n,t).getTime()-se(n,t).getTime();return Math.round(l/6048e5)+1}(e,l);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):ce(a,t.length)},I:function(e,t,n){var l=function(e){E(1,arguments);var t=g(e),n=ae(t).getTime()-ie(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(l,{unit:"week"}):ce(l,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return ce(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,n){var l=function(e){E(1,arguments);var t=g(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var l=t.getTime(),a=n-l;return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(l,{unit:"dayOfYear"}):ce(l,t.length)},E:function(e,t,n){var l=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(l,{width:"short",context:"formatting"});case"EEEE":default:return n.day(l,{width:"wide",context:"formatting"})}},e:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ce(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ce(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var l=e.getUTCDay(),a=0===l?7:l;switch(t){case"i":return String(a);case"ii":return ce(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(l,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(l,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(l,{width:"short",context:"formatting"});case"iiii":default:return n.day(l,{width:"wide",context:"formatting"})}},a:function(e,t,n){var l=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){var l,a=e.getUTCHours();switch(l=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){var l,a=e.getUTCHours();switch(l=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var l=e.getUTCHours()%12;return 0===l&&(l=12),n.ordinalNumber(l,{unit:"hour"})}return function(e,t){return ce(e.getUTCHours()%12||12,t.length)}(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):function(e,t){return ce(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,n){var l=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):ce(l,t.length)},k:function(e,t,n){var l=e.getUTCHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):ce(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return ce(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return ce(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var n=t.length,l=e.getUTCMilliseconds();return ce(Math.floor(l*Math.pow(10,n-3)),t.length)}(e,t)},X:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return ve(a);case"XXXX":case"XX":return pe(a);case"XXXXX":case"XXX":default:return pe(a,":")}},x:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"x":return ve(a);case"xxxx":case"xx":return pe(a);case"xxxxx":case"xxx":default:return pe(a,":")}},O:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+me(a,":");case"OOOO":default:return"GMT"+pe(a,":")}},z:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+me(a,":");case"zzzz":default:return"GMT"+pe(a,":")}},t:function(e,t,n,l){return ce(Math.floor((l._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,l){return ce((l._originalDate||e).getTime(),t.length)}};function me(e,t){var n=e>0?"-":"+",l=Math.abs(e),a=Math.floor(l/60),o=l%60;if(0===o)return n+String(a);var i=t||"";return n+String(a)+i+ce(o,2)}function ve(e,t){return e%60==0?(e>0?"-":"+")+ce(Math.abs(e)/60,2):pe(e,t)}function pe(e,t){var n=t||"",l=e>0?"-":"+",a=Math.abs(e);return l+ce(Math.floor(a/60),2)+n+ce(a%60,2)}function Ee(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function ge(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var fe={p:ge,P:function(e,t){var n,l=e.match(/(P+)(p+)?/)||[],a=l[1],o=l[2];if(!o)return Ee(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Ee(a,t)).replace("{{time}}",ge(o,t))}},he=["D","DD"],ye=["YY","YYYY"];function Se(e){return-1!==he.indexOf(e)}function _e(e){return-1!==ye.indexOf(e)}function Ce(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}var be=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Te=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,De=/^'([^]*?)'?$/,Ne=/''/g,Ae=/[a-zA-Z]/;function we(e,t,n){E(2,arguments);var l=String(t),a=n||{},o=a.locale||ne,i=o.options&&o.options.firstWeekContainsDate,r=null==i?1:O(i),u=null==a.firstWeekContainsDate?r:O(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=o.options&&o.options.weekStartsOn,c=null==s?0:O(s),d=null==a.weekStartsOn?c:O(a.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!o.localize)throw new RangeError("locale must contain localize property");if(!o.formatLong)throw new RangeError("locale must contain formatLong property");var m=g(e);if(!k(m))throw new RangeError("Invalid time value");var v=P(m),p=le(m,v),f={firstWeekContainsDate:u,weekStartsOn:d,locale:o,_originalDate:m},h=l.match(Te).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,fe[t])(e,o.formatLong,f):e}).join("").match(be).map(function(n){if("''"===n)return"'";var l=n[0];if("'"===l)return Ie(n);var i=de[l];if(i)return!a.useAdditionalWeekYearTokens&&_e(n)&&Ce(n,t,e),!a.useAdditionalDayOfYearTokens&&Se(n)&&Ce(n,t,e),i(p,n,o.localize,f);if(l.match(Ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return n}).join("");return h}function Ie(e){return e.match(De)[1].replace(Ne,"'")}function xe(e){return function(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}({},e)}function Le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};E(2,arguments);var l=n.locale||ne;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=M(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var o,i,r=xe(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=a,a>0?(o=g(t),i=g(e)):(o=g(e),i=g(t));var u,s=Y(i,o),c=(P(i)-P(o))/1e3,d=Math.round((s-c)/60);if(d<2)return n.includeSeconds?s<5?l.formatDistance("lessThanXSeconds",5,r):s<10?l.formatDistance("lessThanXSeconds",10,r):s<20?l.formatDistance("lessThanXSeconds",20,r):s<40?l.formatDistance("halfAMinute",null,r):l.formatDistance(s<60?"lessThanXMinutes":"xMinutes",1,r):0===d?l.formatDistance("lessThanXMinutes",1,r):l.formatDistance("xMinutes",d,r);if(d<45)return l.formatDistance("xMinutes",d,r);if(d<90)return l.formatDistance("aboutXHours",1,r);if(d<1440){var m=Math.round(d/60);return l.formatDistance("aboutXHours",m,r)}if(d<2520)return l.formatDistance("xDays",1,r);if(d<43200){var v=Math.round(d/1440);return l.formatDistance("xDays",v,r)}if(d<86400)return u=Math.round(d/43200),l.formatDistance("aboutXMonths",u,r);if((u=z(i,o))<12){var p=Math.round(d/43200);return l.formatDistance("xMonths",p,r)}var f=u%12,h=Math.floor(u/12);return f<3?l.formatDistance("aboutXYears",h,r):f<9?l.formatDistance("overXYears",h,r):l.formatDistance("almostXYears",h+1,r)}const Oe=()=>{var e,i,r,u,s,c,m,v,p;const{t:E}=a.useTranslation(),g=o.useHistory(),{id:f}=o.useParams(),h=Digit.ULBService.getCurrentTenantId(),{isLoading:y,data:S}=Digit.Hooks.events.useInbox(h,{},{eventTypes:"EVENTSONGROUND",ids:f},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[_,C,b]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[T,D,N]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[A,w,I]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);if(n.useEffect(()=>{C(!1),I(),N()},[]),y)return l.createElement(t.Loader,null);const L={defaultTenantId:null==S?void 0:S.tenantId,name:null==S?void 0:S.name,fromDate:we(new Date(null==S||null===(e=S.eventDetails)||void 0===e?void 0:e.fromDate),"yyyy-MM-dd"),toDate:we(new Date(null==S||null===(i=S.eventDetails)||void 0===i?void 0:i.toDate),"yyyy-MM-dd"),organizer:null==S||null===(r=S.eventDetails)||void 0===r?void 0:r.organizer,fees:null==S||null===(u=S.eventDetails)||void 0===u?void 0:u.fees,description:null==S?void 0:S.description,address:null==S||null===(s=S.eventDetails)||void 0===s?void 0:s.address,category:null==S?void 0:S.eventCategory,fromTime:we(new Date(null==S||null===(c=S.eventDetails)||void 0===c?void 0:c.fromDate),"HH:mm"),toTime:we(new Date(null==S||null===(m=S.eventDetails)||void 0===m?void 0:m.toDate),"HH:mm"),geoLocation:{latitude:null==S||null===(v=S.eventDetails)||void 0===v?void 0:v.latitude,longitude:null==S||null===(p=S.eventDetails)||void 0===p?void 0:p.longitude}};return l.createElement(n.Fragment,null,l.createElement(t.Header,null,E("ES_TITLE_EDIT_EVENTS")),l.createElement(t.FormComposer,{defaultValues:L,config:x,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:i,address:r,organizer:u,fees:s,geoLocation:c}=e,m={events:[d({},S,{source:"WEBAPP",status:"ACTIVE",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:d({},null==S?void 0:S.eventDetails,{fromDate:new Date(l+" "+o).getTime(),toDate:new Date(a+" "+i).getTime(),fromTime:o,toTime:i,address:r,organizer:u,fees:s,latitude:null==c?void 0:c.latitude,longitude:null==c?void 0:c.longitude})})]};g.push("/digit-ui/employee/engagement/event/response?update=true",m)},label:E("EVENTS_SAVE_CHANGES")}))},Re=e=>{var n,o,i;const{t:r}=a.useTranslation();return l.createElement(t.Banner,{message:r(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,info:r("ENGAGEMENT_EVENT_NAME"),successful:e.isSuccess})},Pe=e=>{var i,u,s,c,d,m,v;const p=r.useQueryClient(),{t:E}=a.useTranslation(),g=Digit.Hooks.useQueryParams(),f=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),h=Digit.Hooks.events.useUpdateEvent(),[y,S]=n.useState(!1),{state:_}=e.location,[C,b,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[D,N,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1),[w,I,x]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),L=(e,t)=>{var n,l,a;I((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),b(!0)};if(n.useEffect(()=>{f.data&&N(f.data)},[f.data]),n.useEffect(()=>{h.data&&N(h.data)},[h.data]),n.useEffect(()=>{const e=()=>{b(!0),p.clear()};return C?()=>{p.clear()}:Boolean(null==g?void 0:g.delete)||Boolean(null==g?void 0:g.update)?void h.mutate(_,{onError:L,onSuccess:e}):void f.mutate(_,{onError:L,onSuccess:e})},[]),null!=g&&g.delete||null!=g&&g.update)return h.isLoading||h.isIdle&&!C?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Re,{t:E,message:null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED",data:h.data||D,isSuccess:(null==h?void 0:h.isSuccess)||D,isLoading:h.isIdle&&!C||h.isLoading}),l.createElement(t.CardText,null,E(null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))));if(f.isLoading||f.isIdle&&!C)return l.createElement(t.Loader,null);const O=(null==f||null===(i=f.data)||void 0===i||null===(u=i.events)||void 0===u?void 0:u[0])||(null==D||null===(s=D.events)||void 0===s?void 0:s[0])||{};return l.createElement(t.Card,null,l.createElement(Re,{t:E,message:f.isSuccess||D?"ENGAGEMENT_EVENT_CREATED_MESSAGE":"ENGAGEMENT_EVENT_FAILED_MESSAGES",data:f.data||D,isSuccess:f.isSuccess||D,isLoading:f.isIdle&&!C||f.isLoading}),l.createElement(t.CardText,null,f.isSuccess||D?E("ENGAGEMENT_EVENT_CREATED_MESSAGES",{eventName:null==O?void 0:O.name,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==O||null===(c=O.eventDetails)||void 0===c?void 0:c.fromDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==O||null===(d=O.eventDetails)||void 0===d?void 0:d.toDate),fromTime:f.isSuccess?we(new Date(null==O||null===(m=O.eventDetails)||void 0===m?void 0:m.fromDate),"HH:mm"):null,toTime:f.isSuccess?we(new Date(null==O||null===(v=O.eventDetails)||void 0===v?void 0:v.toDate),"HH:mm"):null}):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))))},Me=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p})},Fe=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:i}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:i})},ke=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:m,formState:v,reset:p,control:E}=i.useForm({defaultValues:a}),g=innerWidth<=640,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=(Digit.ULBService.getCurrentTenantId(),Digit.UserService.getUser().info),S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),_=()=>{p({ulb:null,eventName:""}),n({ulb:null,eventName:""})},C=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:_},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(e=>{n(e),"mobile"===r&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(Fe,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,C()))))),("mobile"===r||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},C(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Be=e=>{let{title:n="EVENTS_EVENTS_HEADER",links:i,icon:r="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},"calender"===r?l.createElement(t.EventCalendar,null):"survey"===r?"surveyIcon":l.createElement(t.DocumentIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},i.map((e,t)=>{let{link:n,text:a,hyperlink:i=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Ue=e=>{var n,o;let{status:i,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:s(i),pageType:"employee"})},He=["ACTIVE","INACTIVE"],Ve=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==He?void 0:He.map((e,a)=>l.createElement(Ue,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},We=e=>{var o;let{type:i="desktop",onClose:r,onFilterChange:u,searchParams:s}=e;const{t:c}=a.useTranslation(),[m,v]=n.useState(()=>d({},s)),p=Digit.ULBService.getCurrentTenantId(),E=null==p?void 0:p.split(".")[0],{isLoading:g,data:f}=Digit.Hooks.useCommonMDMS(E,"mseva",["EventCategories"]),h=()=>{v({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),u({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==r||r()},y=e=>{v(d({},m,e))};return g?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},c("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:h},c("ES_COMMON_CLEAR_ALL")),"desktop"===i&&l.createElement("span",{className:"clear-search",onClick:h},l.createElement(t.RefreshIcon,null)),"mobile"===i&&l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+c("EVENTS_CATEGORY_LABEL")),l.createElement(t.Dropdown,{option:null==f||null===(o=f.mseva)||void 0===o?void 0:o.EventCategories,optionKey:"code",t:c,selected:null==m?void 0:m.eventCategory,select:e=>y({eventCategory:e})}),l.createElement(t.DateRange,{t:c,values:null==m?void 0:m.range,onFilterChange:y,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(Ve,{onAssignmentChange:(e,t)=>{var n;y(e.target.checked?{eventStatus:[...(null==m?void 0:m.eventStatus)||[],t]}:{eventStatus:null==m||null===(n=m.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:m})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(u(m),void(null==r||r())),label:c("ES_COMMON_APPLY")}))))},qe=e=>l.createElement("span",{className:""},e),je=e=>{let{isLoading:n,data:a,t:i,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:p,onFilterChange:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_}=e;const C=l.useMemo(()=>[{Header:i("EVENTS_EVENT_NAME_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:u+"/event/inbox/event-details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_EVENT_CATEGORY_LABEL"),accessor:e=>qe(null!=e&&e.eventCategory?i("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)):"")},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?qe(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?qe(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return qe((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let b;return n?b=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(b=l.createElement(Me,{t:i,data:a,columns:C,globalSearch:m,onSearch:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(We,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(ke,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},ze=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,serviceRequestIdKey:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i);Digit.ULBService.getCurrentTenantId(),o.useHistory(),n.useEffect(()=>{m&&E(!0)},[m]);const h=()=>{E(!1),f(i)};let y;return 0===(null==c?void 0:c.length)?y=l.createElement(t.Card,{style:{marginTop:20}},s("ES_NO_EVENTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(y=l.createElement(t.DetailsCard,{data:c,linkPrefix:"/digit-ui/employee/engagement/event/inbox/event-details/",serviceRequestIdKey:d})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),y,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(We,{onFilterChange:r,onClose:h,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(ke,{t:s,type:"mobile",onClose:h,onSearch:u,searchParams:i,searchFields:a}))))},Ye=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),Ge=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:a,icon:o,links:i}),l.createElement(ze,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s,c,d,m,v,p;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(i=u.ulb)||void 0===i?void 0:i.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!k(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(p=u.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a;return{applicationNo:null==e?void 0:e.id,[n("EVENTS_EVENT_NAME_LABEL")]:null==e?void 0:e.name,[n("EVENTS_EVENT_CATEGORY_LABEL")]:n("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)),[n("EVENTS_START_DATE_LABEL")]:we(new Date(null==e||null===(t=e.eventDetails)||void 0===t?void 0:t.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:we(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(a=e.user)||void 0===a?void 0:a.name,[n("EVENTS_STATUS_LABEL")]:Ye(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,serviceRequestIdKey:"applicationNo"}))))},Ke=e=>{var o;let{tenants:i,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const s=Digit.ULBService.getCurrentTenantId(),[c,m]=n.useState(10),[v,p]=n.useState(0),[E,g]=n.useState({eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const h=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_NAME_LABEL"),name:"eventName"}],y=[{text:u("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox/new-event"}],{data:S,isLoading:_}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{eventTypes:"EVENTSONGROUND",limit:c,offset:v},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),C=e=>{let t=d({},e);null!=e&&e.ulb||(t=d({},e,{ulb:{code:s}})),g(d({},E,t))},b=e=>{g(d({},E,e))},T=n.useCallback(()=>{p(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{p(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(Ge,{data:null==S?void 0:S.events,searchParams:E,searchFields:h(),t:u,onFilterChange:b,onSearch:C,isLoading:_,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:y}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_EVENTS_HEADER"),Number(null==S?void 0:S.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==S?void 0:S.totalCount)):null),l.createElement(je,{t:u,data:null==S?void 0:S.events,links:y,parentRoute:r,searchParams:E,onSearch:C,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.eventName||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.eventName.toUpperCase())))&&(null==E||null===(i=E.ulb)||void 0===i||!i.code||e.original.tenantId===(null==E||null===(r=E.ulb)||void 0===r?void 0:r.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!k(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:h(),onFilterChange:b,pageSizeLimit:c,totalRecords:null==S?void 0:S.totalCount,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:y,currentPage:parseInt(v/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{m(t=>e.target.value)}}))},Qe=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p})},Xe=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:i}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:i})},Ze=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:m,formState:v,reset:p,control:E}=i.useForm({defaultValues:a}),g=innerWidth<=640,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),_=()=>{p({ulb:null,name:""}),n({ulb:null,name:""})},C=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:_},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(e=>{n(e),"mobile"===r&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(Xe,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});case"range":return l.createElement(i.Controller,{render:e=>{let{value:n,onChange:a}=e;return l.createElement(t.DateRange,{t:c,values:n,onFilterChange:e=>a(e.range),labelClass:"filter-label"})},name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,C()))))),("mobile"===r||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},C(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},$e=e=>{let{title:n="CS_HEADER_PUBLIC_BRDCST",links:i,icon:r="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},l.createElement(t.PMBIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},i.map((e,t)=>{let{link:n,text:a,hyperlink:i=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Je=e=>{var n,o;let{status:i,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:s(i),pageType:"employee"})},et=["ACTIVE","INACTIVE"],tt=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==et?void 0:et.map((e,a)=>l.createElement(Je,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},nt=e=>{let{type:o="desktop",onClose:i,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,m]=n.useState(()=>d({},u)),v=Digit.ULBService.getCurrentTenantId(),p=null==v?void 0:v.split(".")[0],{isLoading:E}=Digit.Hooks.useCommonMDMS(p,"mseva",["EventCategories"]),g=()=>{m({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),r({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==i||i()},f=n.useCallback(e=>{m(t=>d({},t,e))},[]);return E?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:g},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:g},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:i},l.createElement(t.CloseSvg,null))),l.createElement(t.DateRange,{t:s,values:null==c?void 0:c.range,onFilterChange:f,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(tt,{onAssignmentChange:(e,t)=>{var n;f(e.target.checked?{eventStatus:[...(null==c?void 0:c.eventStatus)||[],t]}:{eventStatus:null==c||null===(n=c.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:c})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(r(c),void(null==i||i())),label:s("ES_COMMON_APPLY")}))))},lt=e=>l.createElement("span",{className:""},e),at=e=>{let{isLoading:n,data:a,t:i,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:p,onFilterChange:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_}=e;const C=l.useMemo(()=>[{Header:i("EVENTS_MESSAGE_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:u+"/messages/inbox/details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_POSTING_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?lt(we(new Date(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime),"dd/MM/yyyy")):""}},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?lt(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?lt(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return lt((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let b;return n?b=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(b=l.createElement(Qe,{t:i,data:a,columns:C,globalSearch:m,onSearch:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement($e,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(nt,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(Ze,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},b)))},ot=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i),h=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&E(!0)},[m]);const y=()=>{E(!1),f(i)};let _;return 0===(null==c?void 0:c.length)?_=l.createElement(t.Card,{style:{marginTop:20}},s("ES_NO_PUBLIC_MESSAGES").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(_=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>{var n;return S(null==t||null===(n=t.user)||void 0===n?void 0:n.name,e["Posted By"])&&S(t.name,e.Title)});t&&h.push("/digit-ui/employee/engagement/messages/inbox/details/"+(null==t?void 0:t.id))}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),_,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(nt,{onFilterChange:r,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Ze,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:i,searchFields:a}))))},it=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),rt=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement($e,{title:a,icon:o,links:i}),l.createElement(ot,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s,c,d,m,v,p;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(i=u.ulb)||void 0===i?void 0:i.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!k(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(p=u.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a,o;return{[n("PUBLIC_BRDCST_TITLE_LABEL")]:null==e?void 0:e.name,[n("EVENTS_POSTING_DATE_LABEL")]:we(new Date(null==e||null===(t=e.auditDetails)||void 0===t?void 0:t.createdTime),"dd/MM/yyyy"),[n("EVENTS_START_DATE_LABEL")]:we(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:we(new Date(null==e||null===(a=e.eventDetails)||void 0===a?void 0:a.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(o=e.user)||void 0===o?void 0:o.name,[n("EVENTS_STATUS_LABEL")]:it(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,responseData:t}))))},ut=e=>{var o;let{tenants:i,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const s=Digit.ULBService.getCurrentTenantId(),[c,m]=n.useState(10),[v,p]=n.useState(0),[E,g]=n.useState({eventStatus:[],name:"",range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const{data:h,isLoading:y}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST",limit:c,offset:v},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),S=e=>{let t=d({},e);null!=e&&e.ulb||(t=d({},e,{ulb:{code:s}})),g(e=>d({},e,t))},_=e=>{g(t=>d({},t,e))},C=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_MESSAGE_LABEL"),name:"name"}],b=[{text:u("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/inbox/create"}],T=n.useCallback(()=>{p(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{p(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(rt,{data:null==h?void 0:h.events,searchParams:E,searchFields:C(),t:u,onFilterChange:_,onSearch:S,isLoading:y,title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",iconName:"calender",links:b}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER"),Number(null==h?void 0:h.length)?l.createElement("p",{className:"inbox-count"},Number(null==h?void 0:h.length)):null),l.createElement(at,{t:u,data:null==h?void 0:h.events,links:b,parentRoute:r,searchParams:E,onSearch:S,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.name||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.name.toUpperCase())))&&(null==E||null===(i=E.ulb)||void 0===i||!i.code||e.original.tenantId===(null==E||null===(r=E.ulb)||void 0===r?void 0:r.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!k(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:C(),onFilterChange:_,pageSizeLimit:c,totalRecords:null==h?void 0:h.totalCount,currentPage:parseInt(v/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{m(t=>e.target.value)},title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",links:b,isLoading:y}))},st=[{head:"",body:[{type:"form",withoutLabel:!0,component:"MessageForm",nextStep:"",route:"",key:"messageData"}]}],ct=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[v,p,E]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),E(),m()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ADD_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{config:st,onSubmit:e=>{var t,n,l;const{fromDate:a,toDate:o,description:r,name:u,documents:s}=e,c={events:[{recepient:null,source:"WEBAPP",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:r,name:u,eventDetails:{documents:s,fromDate:null===(n=I(new Date(""+a)))||void 0===n?void 0:n.getTime(),toDate:null===(l=I(new Date(""+o)))||void 0===l?void 0:l.getTime()}}]};i.push("/digit-ui/employee/engagement/messages/response",c)},label:e("ACTION_ADD_NEW_MESSAGE")}))},dt=e=>{var n,o,i;const{t:r}=a.useTranslation();return l.createElement(t.Banner,{message:r(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,successful:e.isSuccess})},mt=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=Digit.Hooks.useQueryParams(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),d=Digit.Hooks.events.useUpdateEvent(),{state:m}=e.location,[v,p,E]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1),[y,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1);n.useEffect(()=>{d.data&&f(d.data)},[d.data]),n.useEffect(()=>{c.data&&f(c.data)},[c.data]);const C=(e,t)=>{var n,l,a;S((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),p(!0)};return n.useEffect(()=>{const e=()=>{p(!0),i.clear()};if(!v){if(Boolean(null==s?void 0:s.delete)||Boolean(null==s?void 0:s.update))return void d.mutate(m,{onError:C,onSuccess:e});c.mutate(m,{onError:C,onSuccess:e})}},[]),null!=s&&s.delete||null!=s&&s.update?d.isLoading||d.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(dt,{t:u,message:null!=s&&s.update?d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_UPDATED":"ENG_PUBLIC_BRDCST_UPDATION_FAILED":d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_DELETED":"ENGAGEMENT_PUBLIC_BRDCST_DELETION_FAILED",data:d.data||g,isSuccess:(null==d?void 0:d.isSuccess)||g,isLoading:d.isIdle&&!v||d.isLoading}),l.createElement(t.CardText,null,u("ENGAGEMENT_PUBLIC_BRDCST_MESSAGES")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")})))):c.isLoading||c.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(dt,{t:u,message:c.isSuccess||g?"ENGAGEMENT_BROADCAST_MESSAGE_CREATED":"ENGAGEMENT_BROADCAST_MESSAGE_FAILED",data:c.data||g,isSuccess:c.isSuccess||g,isLoading:c.isIdle&&!v||c.isLoading}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},vt=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),{id:r}=o.useParams(),u=Digit.ULBService.getCurrentTenantId(),{isLoading:s,data:c}=Digit.Hooks.events.useInbox(u,{},{eventTypes:"BROADCAST",ids:r},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[m,v,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[E,g,f]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[h,y,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{v(!1),S(),f()},[]);const _=n.useMemo(()=>{var e,t,n;const l=null==c||null===(e=c.eventDetails)||void 0===e?void 0:e.documents;return{name:null==c?void 0:c.name,description:null==c?void 0:c.description,documents:null==l?void 0:l.map(e=>[e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:u}}]),fromDate:c?we(new Date(null==c||null===(t=c.eventDetails)||void 0===t?void 0:t.fromDate),"yyyy-MM-dd"):null,toDate:c?we(new Date(null==c||null===(n=c.eventDetails)||void 0===n?void 0:n.toDate),"yyyy-MM-dd"):null}},[c]);return s?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("EDIT_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{defaultValues:_,config:st,onSubmit:e=>{var t;const{fromDate:n,toDate:l,description:a,name:o,documents:r}=e,u=(e=>!(!e||!e.length||!(Array.isArray(e)&&e.length&&Array.isArray(e[0]))))(r)?(s=r)&&s.length?s.reduce((e,t)=>{let n={};const[l,{file:a,fileStoreId:o}]=t;return n.fileName=null==a?void 0:a.name,n.documentType=null==a?void 0:a.type,n.fileStoreId=null==o?void 0:o.fileStoreId,e.push(n),e},[]):[]:r;var s;const m={events:[d({},c,{source:"WEBAPP",status:"ACTIVE",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:a,name:o,eventDetails:{documents:u,fromDate:w(""+n),toDate:w(""+l)}})]};i.push("/digit-ui/employee/engagement/messages/response?update=true",m)},label:e("ACTION_EDIT_MESSAGE")}))},pt=e=>l.createElement("h1",{className:"heading-m"},e.label),Et=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),gt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Et,null)),ft=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;const{data:g,isLoading:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:h,data:y}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[S,_]=n.useState({}),[C,b]=n.useState({}),[T,D]=n.useState([]),[N,A]=n.useState(null),[w,I]=n.useState(null),[x,L]=n.useState(null),[O,R]=n.useState(null),[P,M]=n.useState([]),[F,k]=n.useState(null),[B,U]=n.useState(!1);function H(e){I(e.target.files[0])}return n.useEffect(()=>{var e;y&&y["egf-master"]&&M(null===(e=y["egf-master"])||void 0===e?void 0:e.FinancialYear)},[y]),n.useEffect(()=>{var e;D(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(w){const e=function(){if(w.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",w,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[w]),n.useEffect(()=>{r&&_(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:o,selectedFinancialYear:i,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+a.action+"_APPLICATION",submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:i})}]}]}})({t:i,action:r,financialYears:P,selectedFinancialYear:F,setSelectedFinancialYear:k}):(e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v}=e;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==o?void 0:o.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:T,selectedApprover:N,setSelectedApprover:A,selectFile:H,uploadedFile:x,setUploadedFile:L,businessService:p}))},[r,T,P,F,x]),r&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(pt,{label:i(S.label.heading)}),headerBarEnd:l.createElement(gt,{onClick:s}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!x,formId:"modal-action"},h?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};m.creationReason="STATUS",c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:d({},m,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==F?void 0:F.name,propertyId:null==m?void 0:m.propertyId,tenantId:u,source:null==m?void 0:m.source,channel:null==m?void 0:m.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!N?[]:[N],x&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==w?void 0:w.name,fileStoreId:x}]),c({Property:d({},m,{workflow:t})})}},defaultValues:C,formId:"modal-action"})):l.createElement(t.Loader,null)},ht=e=>l.createElement("h1",{className:"heading-m"},e.label),yt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),St=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yt,null)),_t=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;console.log("ActionModalActions: ",r);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:f}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[h,y]=n.useState({}),[S,_]=n.useState({}),[C,b]=n.useState([]),[T,D]=n.useState({}),[N,A]=n.useState(null),[w,I]=n.useState(null),[x,L]=n.useState(null),[O,R]=n.useState([]),[P,M]=n.useState(null);n.useEffect(()=>{var e;f&&f["egf-master"]&&R(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]);const{data:F}=Digit.Hooks.useCustomMDMS(u,"common-masters",[{name:"Department"}]);function k(e){A(e.target.files[0])}return n.useEffect(()=>{if(E&&F){var e;const t=F["common-masters"].Department;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const o=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,i=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===o);return console.log("matchedDept===",i),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==i?void 0:i.name)}}))}},[E]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",N,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),n.useEffect(()=>{r&&y((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:T,setSelectedApprover:D,selectFile:k,uploadedFile:w,setUploadedFile:I,businessService:p}))},[r,C,O,P,w]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ht,{label:i(h.label.heading)}),headerBarEnd:l.createElement(St,{onClick:s}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:h.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){m=d({},m,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,wfDocuments:w?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:w}]:null}),c({Licenses:[m]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Ct=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),bt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Tt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(bt,null)),Dt=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;const{data:E,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState({}),[D,N]=n.useState(null),[A,w]=n.useState(null),[I,x]=n.useState(null),L=!!Digit.Utils.browser.isMobile();function O(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))x(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",D,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(){x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(v=!1),a.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:O,uploadedFile:A,setUploadedFile:w,businessService:p,error:I}))},[r,_,A,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ct,{label:i(f.label.heading)}),headerBarEnd:l.createElement(Tt,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:L?{width:"720px"}:{},style:L?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:L?{paddingLeft:"5px"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){m=d({},m,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null}),c({Licenses:[m]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Nt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),At=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),wt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(At,null)),It=e=>{var a,o,i,u,s,c,m,p,E,g,f,h;let{t:y,action:S,tenantId:_,closeModal:C,submitAction:b,applicationDetails:T,applicationData:D,businessService:N,workflowDetails:A,blockReason:w}=e;console.log("applicationData",D),console.log("workflowDetails",A),Digit.Hooks.obps.useObpsAPI(null!==(a=D)&&void 0!==a&&null!==(o=a.landInfo)&&void 0!==o&&null!==(i=o.address)&&void 0!==i&&i.city?null===(u=D)||void 0===u||null===(s=u.landInfo)||void 0===s||null===(c=s.address)||void 0===c?void 0:c.city:_,!1);const{data:I,isLoading:x}=Digit.Hooks.useEmployeeSearch(_,{roles:null==A||null===(m=A.data)||void 0===m||null===(p=m.initialActionState)||void 0===p||null===(E=p.nextActions)||void 0===E||null===(g=E.filter(e=>(null==e?void 0:e.action)==(null==S?void 0:S.action)))||void 0===g||null===(f=g[0])||void 0===f||null===(h=f.assigneeRoles)||void 0===h?void 0:h.map(e=>({code:e})),isActive:!0},{enabled:!(null!=S&&S.isTerminateState)}),[L,O]=(r.useQueryClient(),n.useState({})),[R,P]=n.useState({}),[M,F]=n.useState([]),[k,B]=n.useState([]),[U,H]=n.useState({}),[V,W]=n.useState({}),[q,j]=n.useState(null),[z,Y]=n.useState(null),[G,K]=n.useState(null),[Q,X]=n.useState(null),Z=!!Digit.Utils.browser.isMobile();function $(e){j(e.target.files[0])}n.useEffect(()=>{var e;F(null==I||null===(e=I.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[I]),n.useEffect(()=>{!function(){try{K(null);const e=function(){if(q){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(q.size>=5242880)K(y("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=q&&q.type&&!e.test(null==q?void 0:q.type))K(y("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",q,Digit.ULBService.getStateId()||(null==_?void 0:_.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):K(y("CS_FILE_UPLOAD_ERROR"))})},function(){K(y("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[q]);const J=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},ee=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},te=e=>{var t,n;let l=[],a=[];var o,i;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(i=l)||void 0===i?void 0:i.length)>0&&l.map((e,t)=>{a.push({docs:J(e.Documents),date:e.InspectionDate,questions:ee(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},ne=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{B(null==w?void 0:w.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),S&&O((e=>{var n,a,o,i,r,u,s;let{t:c,action:d,approvers:m,selectedApprover:v,setSelectedApprover:p,selectedBlockReason:E,setBlockReason:g,selectFile:f,uploadedFile:h,setUploadedFile:y,assigneeLabel:S,businessService:_,error:C,blockReasonFiltered:b}=e,T=!1;return"REVOCATE"!=(null==d?void 0:d.action)&&"REJECT"!=(null==d?void 0:d.action)&&"SKIP_PAYMENT"!=d.action&&"SEND_BACK_TO_CITIZEN"!=(null==d?void 0:d.action)&&"APPROVE"!=(null==d?void 0:d.action)||(T=!0),{label:{heading:"WF_"+(null==d?void 0:d.action)+"_APPLICATION",submit:"WF_"+_+"_"+(null==d?void 0:d.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(n=d.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(a=d.state)||void 0===a?void 0:a.state)?null:c(S||"WF_ROLE_"+(null===(o=d.assigneeRoles)||void 0===o?void 0:o[0])),type:"dropdown",populators:d.isTerminateState||T||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(i=d.state)||void 0===i?void 0:i.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(r=d.state)||void 0===r?void 0:r.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:p,selected:v})},{label:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(u=d.state)||void 0===u?void 0:u.state)?c("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(s=d.state)||void 0===s?void 0:s.state)?l.createElement(t.Dropdown,{option:b,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:g,selected:E,isMandatory:!0}):null},{label:c("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+c("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:f,onDelete:()=>{y(null)},message:h?"1 "+c("ES_PT_ACTION_FILEUPLOADED"):c("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:C})}]}]}})({t:y,action:S,approvers:M,selectedApprover:U,setSelectedApprover:H,selectedBlockReason:V,setBlockReason:W,selectFile:$,uploadedFile:z,setUploadedFile:Y,businessService:N,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:G,blockReasonFiltered:k}))},[S,M,Q,z,G]),S&&L.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Nt,{label:y(L.label.heading)}),headerBarEnd:l.createElement(wt,{onClick:C}),actionCancelLabel:y(L.label.cancel),actionCancelOnSubmit:C,actionSaveLabel:y(L.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Z?{width:"720px"}:{},style:Z?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Z?{paddingLeft:"5px"}:{}},x?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:L.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,o,i,r,u,s,c,m,v,p,E,g,f,h,_,N,w,I,x,L,O,R,P,M,F,k,B,H,W,j,Y,G,K,Q,X,Z,$,J,ee;if(D=d({},D,{documents:null===(t=D)||void 0===t?void 0:t.documents,additionalDetails:d({},null===(n=D)||void 0===n?void 0:n.additionalDetails,{fieldinspection_pending:te(D),pendingapproval:ne(),blockingReason:null==V?void 0:V.name}),workflow:{action:null==S?void 0:S.action,comment:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(a=e.comments)||void 0===a?void 0:a.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==A||null===(o=A.data)||void 0===o||null===(i=o.processInstances)||void 0===i||null===(r=i[0])||void 0===r||null===(u=r.state)||void 0===u?void 0:u.applicationStatus)?[null==A||null===(s=A.data)||void 0===s||null===(c=s.processInstances)||void 0===c||null===(m=c[0])||void 0===m||null===(v=m.assigner)||void 0===v?void 0:v.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==A||null===(p=A.data)||void 0===p||null===(E=p.processInstances)||void 0===E||null===(g=E[0])||void 0===g||null===(f=g.state)||void 0===f?void 0:f.applicationStatus)?[null==A||null===(h=A.data)||void 0===h||null===(_=h.processInstances)||void 0===_||null===(N=_[0])||void 0===N||null===(w=N.assigner)||void 0===w?void 0:w.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,varificationDocuments:z?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==q?void 0:q.name,fileStoreId:z}]:null},action:null==S?void 0:S.action,riskType:null===(I=D)||void 0===I||null===(x=I.additionalDetails)||void 0===x?void 0:x.riskType,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==A||null===(L=A.data)||void 0===L||null===(O=L.processInstances)||void 0===O||null===(R=O[0])||void 0===R||null===(P=R.state)||void 0===P?void 0:P.applicationStatus)?[null==A||null===(M=A.data)||void 0===M||null===(F=M.processInstances)||void 0===F||null===(k=F[0])||void 0===k||null===(B=k.assigner)||void 0===B?void 0:B.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,wfDocuments:z?[{documentType:(null==S?void 0:S.action)+" DOC",fileName:null==q?void 0:q.name,fileStoreId:z}]:null}),parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(H=D)||void 0===H||null===(W=H.additionalDetails)||void 0===W||null===(j=W.selfCertificationCharges)||void 0===j?void 0:j.BPA_MALBA_CHARGES)+parseInt(null===(Y=D)||void 0===Y||null===(G=Y.additionalDetails)||void 0===G||null===(K=G.selfCertificationCharges)||void 0===K?void 0:K.BPA_LABOUR_CESS)+parseInt(null===(Q=D)||void 0===Q||null===(X=Q.additionalDetails)||void 0===X||null===(Z=X.selfCertificationCharges)||void 0===Z?void 0:Z.BPA_WATER_CHARGES)+parseInt(null===($=D)||void 0===$||null===(J=$.additionalDetails)||void 0===J||null===(ee=J.selfCertificationCharges)||void 0===ee?void 0:ee.BPA_GAUSHALA_CHARGES_CESS))C(),alert(y("Enterd Less Adjustment amount is invalid"));else{var le,ae;D.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",D.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",D.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",D.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc");const e=null==T||null===(le=T.nocData)||void 0===le?void 0:le.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:d({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}}),t={};let n=!0,l=!0;null==t||null===(ae=t.Noc)||void 0===ae||ae.map(e=>{var t,a,o,i,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=n&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?n=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let a=[];if(e&&e.map(e=>{var t,o,i,r,u,s,c,d,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(o=t.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(i=e.Noc)||void 0===i||null===(r=i.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(s=u.applicationStatus)||void 0===s?void 0:s.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&n||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&a.push(e)}),"FIELDINSPECTION_INPROGRESS"==D.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?b({BPA:D},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0}):(C(),alert(y("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else b({BPA:D},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0})}return Promise.resolve()}catch(e){return Promise.reject(e)}},defaultValues:R,formId:"modal-action"})):l.createElement(t.Loader,null)},xt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Lt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ot=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Lt,null)),Rt=e=>{var a,i;let{t:u,action:s,tenantId:c,closeModal:m,submitAction:p,applicationData:E,businessService:g}=e;const{data:f,isLoading:h}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[y,S]=(r.useQueryClient(),n.useState({})),[_,C]=n.useState({}),[b,T]=n.useState([]),[D,N]=n.useState({}),[A,w]=n.useState(null),[I,x]=n.useState(null),[L,O]=n.useState(null),R=!!Digit.Utils.browser.isMobile();function P(e){w(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(A){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(A.size>=5242880)O(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=A&&A.type&&!e.test(null==A?void 0:A.type))O(u("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",A,Digit.ULBService.getStateId()||(null==c?void 0:c.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?x(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(u("CS_FILE_UPLOAD_ERROR"))})},function(){O(u("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),n.useEffect(()=>{s&&S((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(E=!0);let g=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(g=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==o?void 0:o.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||g?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||g?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:u,action:s,approvers:b,selectedApprover:D,setSelectedApprover:N,selectFile:P,uploadedFile:I,setUploadedFile:x,businessService:g,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:L}))},[s,b,I,L]),s&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(xt,{label:u(y.label.heading)}),headerBarEnd:l.createElement(Ot,{onClick:m}),actionCancelLabel:u(y.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:u(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:R?{width:"720px"}:{},style:R?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:R?{paddingLeft:"5px"}:{}},h?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:y.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=E)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=E)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{o.push(e)}),E=d({},E,{workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,documents:I?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:I}]:null},documents:o}),p({Noc:E},!1,{isNoc:!0})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)};var Pt=function(e,t){return e===t||e!=e&&t!=t},Mt=function(e,t){for(var n=e.length;n--;)if(Pt(e[n][0],t))return n;return-1},Ft=Array.prototype.splice;function kt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}kt.prototype.clear=function(){this.__data__=[],this.size=0},kt.prototype.delete=function(e){var t=this.__data__,n=Mt(t,e);return!(n<0||(n==t.length-1?t.pop():Ft.call(t,n,1),--this.size,0))},kt.prototype.get=function(e){var t=this.__data__,n=Mt(t,e);return n<0?void 0:t[n][1]},kt.prototype.has=function(e){return Mt(this.__data__,e)>-1},kt.prototype.set=function(e,t){var n=this.__data__,l=Mt(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var Bt=kt,Ut="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ht(e,t){return e(t={exports:{}},t.exports),t.exports}var Vt,Wt="object"==typeof Ut&&Ut&&Ut.Object===Object&&Ut,qt="object"==typeof self&&self&&self.Object===Object&&self,jt=Wt||qt||Function("return this")(),zt=jt.Symbol,Yt=Object.prototype,Gt=Yt.hasOwnProperty,Kt=Yt.toString,Qt=zt?zt.toStringTag:void 0,Xt=Object.prototype.toString,Zt=zt?zt.toStringTag:void 0,$t=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Zt&&Zt in Object(e)?function(e){var t=Gt.call(e,Qt),n=e[Qt];try{e[Qt]=void 0;var l=!0}catch(e){}var a=Kt.call(e);return l&&(t?e[Qt]=n:delete e[Qt]),a}(e):function(e){return Xt.call(e)}(e)},Jt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},en=function(e){if(!Jt(e))return!1;var t=$t(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},tn=jt["__core-js_shared__"],nn=(Vt=/[^.]+$/.exec(tn&&tn.keys&&tn.keys.IE_PROTO||""))?"Symbol(src)_1."+Vt:"",ln=Function.prototype.toString,an=function(e){if(null!=e){try{return ln.call(e)}catch(e){}try{return e+""}catch(e){}}return""},on=/^\[object .+?Constructor\]$/,rn=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),un=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Jt(e)||(t=e,nn&&nn in t))&&(en(e)?rn:on).test(an(e));var t}(n)?n:void 0},sn=un(jt,"Map"),cn=un(Object,"create"),dn=Object.prototype.hasOwnProperty,mn=Object.prototype.hasOwnProperty;function vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}vn.prototype.clear=function(){this.__data__=cn?cn(null):{},this.size=0},vn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},vn.prototype.get=function(e){var t=this.__data__;if(cn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return dn.call(t,e)?t[e]:void 0},vn.prototype.has=function(e){var t=this.__data__;return cn?void 0!==t[e]:mn.call(t,e)},vn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=cn&&void 0===t?"__lodash_hash_undefined__":t,this};var pn=vn,En=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}gn.prototype.clear=function(){this.size=0,this.__data__={hash:new pn,map:new(sn||Bt),string:new pn}},gn.prototype.delete=function(e){var t=En(this,e).delete(e);return this.size-=t?1:0,t},gn.prototype.get=function(e){return En(this,e).get(e)},gn.prototype.has=function(e){return En(this,e).has(e)},gn.prototype.set=function(e,t){var n=En(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var fn=gn;function hn(e){var t=this.__data__=new Bt(e);this.size=t.size}hn.prototype.clear=function(){this.__data__=new Bt,this.size=0},hn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},hn.prototype.get=function(e){return this.__data__.get(e)},hn.prototype.has=function(e){return this.__data__.has(e)},hn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Bt){var l=n.__data__;if(!sn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new fn(l)}return n.set(e,t),this.size=n.size,this};var yn=hn,Sn=function(){try{var e=un(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_n=function(e,t,n){"__proto__"==t&&Sn?Sn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Cn=Object.prototype.hasOwnProperty,bn=function(e,t,n){var l=e[t];Cn.call(e,t)&&Pt(l,n)&&(void 0!==n||t in e)||_n(e,t,n)},Tn=function(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?_n(n,r,u):bn(n,r,u)}return n},Dn=function(e){return null!=e&&"object"==typeof e},Nn=function(e){return Dn(e)&&"[object Arguments]"==$t(e)},An=Object.prototype,wn=An.hasOwnProperty,In=An.propertyIsEnumerable,xn=Nn(function(){return arguments}())?Nn:function(e){return Dn(e)&&wn.call(e,"callee")&&!In.call(e,"callee")},Ln=Array.isArray,On=function(){return!1},Rn=Ht(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?jt.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||On}),Pn=/^(?:0|[1-9]\d*)$/,Mn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Pn.test(e))&&e>-1&&e%1==0&&e<t},Fn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},kn={};kn["[object Float32Array]"]=kn["[object Float64Array]"]=kn["[object Int8Array]"]=kn["[object Int16Array]"]=kn["[object Int32Array]"]=kn["[object Uint8Array]"]=kn["[object Uint8ClampedArray]"]=kn["[object Uint16Array]"]=kn["[object Uint32Array]"]=!0,kn["[object Arguments]"]=kn["[object Array]"]=kn["[object ArrayBuffer]"]=kn["[object Boolean]"]=kn["[object DataView]"]=kn["[object Date]"]=kn["[object Error]"]=kn["[object Function]"]=kn["[object Map]"]=kn["[object Number]"]=kn["[object Object]"]=kn["[object RegExp]"]=kn["[object Set]"]=kn["[object String]"]=kn["[object WeakMap]"]=!1;var Bn=function(e){return function(t){return e(t)}},Un=Ht(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&Wt.process,o=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=o}),Hn=Un&&Un.isTypedArray,Vn=Hn?Bn(Hn):function(e){return Dn(e)&&Fn(e.length)&&!!kn[$t(e)]},Wn=Object.prototype.hasOwnProperty,qn=function(e,t){var n=Ln(e),l=!n&&xn(e),a=!n&&!l&&Rn(e),o=!n&&!l&&!a&&Vn(e),i=n||l||a||o,r=i?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],u=r.length;for(var s in e)!t&&!Wn.call(e,s)||i&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Mn(s,u))||r.push(s);return r},jn=Object.prototype,zn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||jn)},Yn=function(e,t){return function(n){return e(t(n))}},Gn=Yn(Object.keys,Object),Kn=Object.prototype.hasOwnProperty,Qn=function(e){return null!=e&&Fn(e.length)&&!en(e)},Xn=function(e){return Qn(e)?qn(e):function(e){if(!zn(e))return Gn(e);var t=[];for(var n in Object(e))Kn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Zn=Object.prototype.hasOwnProperty,$n=function(e){return Qn(e)?qn(e,!0):function(e){if(!Jt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=zn(e),n=[];for(var l in e)("constructor"!=l||!t&&Zn.call(e,l))&&n.push(l);return n}(e)},Jn=Ht(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?jt.Buffer:void 0,o=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),el=function(){return[]},tl=Object.prototype.propertyIsEnumerable,nl=Object.getOwnPropertySymbols,ll=nl?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,o=0,i=[];++l<a;){var r=t[l];tl.call(e,r)&&(i[o++]=r)}return i}(nl(e)))}:el,al=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},ol=Yn(Object.getPrototypeOf,Object),il=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)al(t,ll(e)),e=ol(e);return t}:el,rl=function(e,t,n){var l=t(e);return Ln(e)?l:al(l,n(e))},ul=function(e){return rl(e,Xn,ll)},sl=function(e){return rl(e,$n,il)},cl=un(jt,"DataView"),dl=un(jt,"Promise"),ml=un(jt,"Set"),vl=un(jt,"WeakMap"),pl=an(cl),El=an(sn),gl=an(dl),fl=an(ml),hl=an(vl),yl=$t;(cl&&"[object DataView]"!=yl(new cl(new ArrayBuffer(1)))||sn&&"[object Map]"!=yl(new sn)||dl&&"[object Promise]"!=yl(dl.resolve())||ml&&"[object Set]"!=yl(new ml)||vl&&"[object WeakMap]"!=yl(new vl))&&(yl=function(e){var t=$t(e),n="[object Object]"==t?e.constructor:void 0,l=n?an(n):"";if(l)switch(l){case pl:return"[object DataView]";case El:return"[object Map]";case gl:return"[object Promise]";case fl:return"[object Set]";case hl:return"[object WeakMap]"}return t});var Sl=yl,_l=Object.prototype.hasOwnProperty,Cl=jt.Uint8Array,bl=function(e){var t=new e.constructor(e.byteLength);return new Cl(t).set(new Cl(e)),t},Tl=/\w*$/,Dl=zt?zt.prototype:void 0,Nl=Dl?Dl.valueOf:void 0,Al=Object.create,wl=function(){function e(){}return function(t){if(!Jt(t))return{};if(Al)return Al(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Il=Un&&Un.isMap,xl=Il?Bn(Il):function(e){return Dn(e)&&"[object Map]"==Sl(e)},Ll=Un&&Un.isSet,Ol=Ll?Bn(Ll):function(e){return Dn(e)&&"[object Set]"==Sl(e)},Rl={};Rl["[object Arguments]"]=Rl["[object Array]"]=Rl["[object ArrayBuffer]"]=Rl["[object DataView]"]=Rl["[object Boolean]"]=Rl["[object Date]"]=Rl["[object Float32Array]"]=Rl["[object Float64Array]"]=Rl["[object Int8Array]"]=Rl["[object Int16Array]"]=Rl["[object Int32Array]"]=Rl["[object Map]"]=Rl["[object Number]"]=Rl["[object Object]"]=Rl["[object RegExp]"]=Rl["[object Set]"]=Rl["[object String]"]=Rl["[object Symbol]"]=Rl["[object Uint8Array]"]=Rl["[object Uint8ClampedArray]"]=Rl["[object Uint16Array]"]=Rl["[object Uint32Array]"]=!0,Rl["[object Error]"]=Rl["[object Function]"]=Rl["[object WeakMap]"]=!1;var Pl=function e(t,n,l,a,o,i){var r,u=1&n,s=2&n,c=4&n;if(l&&(r=o?l(t,a,o,i):l(t)),void 0!==r)return r;if(!Jt(t))return t;var d=Ln(t);if(d){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&_l.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!u)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=Sl(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(Rn(t))return Jn(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(r=s||v?{}:function(e){return"function"!=typeof e.constructor||zn(e)?{}:wl(ol(e))}(t),!u)return s?function(e,t){return Tn(e,il(e),t)}(t,function(e,t){return e&&Tn(t,$n(t),e)}(r,t)):function(e,t){return Tn(e,ll(e),t)}(t,function(e,t){return e&&Tn(t,Xn(t),e)}(r,t))}else{if(!Rl[m])return o?t:{};r=function(e,t,n){var l,a,o=e.constructor;switch(t){case"[object ArrayBuffer]":return bl(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?bl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?bl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Tl.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new o;case"[object Symbol]":return Nl?Object(Nl.call(e)):{}}}(t,m,u)}}i||(i=new yn);var p=i.get(t);if(p)return p;i.set(t,r),Ol(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,i))}):xl(t)&&t.forEach(function(a,o){r.set(o,e(a,n,l,o,t,i))});var E=d?void 0:(c?s?sl:ul:s?$n:Xn)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,o){E&&(a=t[o=a]),bn(r,o,e(a,n,l,o,t,i))}),r},Ml=function(e){return Pl(e,5)};const Fl=e=>l.createElement("h1",{className:"heading-m"},e.label),kl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Bl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kl,null)),Ul=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},Hl=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;const{data:E,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState({}),[D,N]=n.useState(null),[A,w]=n.useState(null),[I,x]=n.useState(null),L=window.Digit.Utils.browser.isMobile(),O=window.location.href.includes("/employee");function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))x(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",D,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{var e,n,a,o;"DisconnectWSConnection"==(null===(e=m)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=m)||void 0===a||null===(o=a.processInstance)||void 0===o?void 0:o.businessService)?r&&h((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:m,businessService:v,error:p}=e,E=!0,g=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(g=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},g&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!g,type:"custom",populators:g?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,d({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{m(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p,error:I})):r&&h((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,businessService:m,error:v}=e,p=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p,error:I}))},[r,_,A,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Fl,{label:i(f.label.heading)}),headerBarEnd:l.createElement(Bl,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:L&&O?{width:"100%",height:"auto"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o,i,s,v,p,E;if(null!==(t=m)&&void 0!==t&&t.isBillAmend){var g,f,h,y,S,_,C,T,N;const t=d({},null===(g=m)||void 0===g||null===(f=g.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=d({},null===(h=m)||void 0===h?void 0:h.billAmendmentDetails,{workflow:{businessId:null===(y=m)||void 0===y||null===(S=y.billAmendmentDetails)||void 0===S?void 0:S.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(_=m)&&void 0!==_&&null!==(C=_.applicationType)&&void 0!==C&&C.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(T=m)&&void 0!==T&&null!==(N=T.applicationType)&&void 0!==N&&N.includes("WATER")?"WS":"SW",assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]}});c({AmendmentUpdate:n})}else{if(m=d({},m,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:[],assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:d({},null===(n=m)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=b&&b.uuid?[{uuid:null==b?void 0:b.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]})}),null!=e&&e.date&&null!==(l=m)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=Ml(null==e?void 0:e.date);m.disconnectionExecutionDate=Ul(t)}else if(null!=e&&e.date){const t=Ml(null==e?void 0:e.date);m.connectionExecutionDate=Ul(t)}var w;if("DisconnectWSConnection"==(null===(o=m)||void 0===o||null===(i=o.processInstance)||void 0===i?void 0:i.businessService)||"DisconnectSWConnection"==(null===(s=m)||void 0===s||null===(v=s.processInstance)||void 0===v?void 0:v.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(w=m)||void 0===w?void 0:w.serviceType)?c({WaterConnection:m,disconnectRequest:!0}):c({SewerageConnection:m,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(p=m)||void 0===p?void 0:p.applicationType))c({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=m)||void 0===E?void 0:E.applicationType))c({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!0});else{var I,x,L,O,R,P,M,F,k,B,U,H,V;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(I=t.value)&&void 0!==I&&I.adhocPenalty&&(m.additionalDetails.adhocPenalty=parseInt(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenalty)||""),null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenaltyComment&&(m.additionalDetails.adhocPenaltyComment=(null==t||null===(O=t.value)||void 0===O?void 0:O.adhocPenaltyComment)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyReason&&(m.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(m.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateComment&&(m.additionalDetails.adhocRebateComment=(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(m.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(V=m)||void 0===V?void 0:V.serviceType)?c({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Vl=e=>l.createElement("h1",{className:"heading-m"},e.label),Wl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ql=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Wl,null)),jl=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;console.log("applicationData",m);const{data:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState(null),[D,N]=n.useState(null),[A,w]=n.useState(null),[I,x]=n.useState(null),[L,O]=n.useState(!1);function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(){x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p}))},[r,_,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Vl,{label:i(f.label.heading)}),headerBarEnd:l.createElement(ql,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};m.creationReason="CREATE",c({PetRegistrationApplications:[d({},m,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!b?[]:[b],A&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]),c({PetRegistrationApplications:[d({},m,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},zl=e=>l.createElement("h1",{className:"heading-m"},e.label),Yl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Gl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Yl,null)),Kl=e=>{var a,o,i;let{t:r,action:u,closeModal:s,submitAction:c,applicationData:m,businessService:v}=e;const p=Digit.ULBService.getStateId(),{data:E,isLoading:g}=Digit.Hooks.tl.useTradeLicenseMDMS(p,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==E||null===(a=E.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",m);const[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState(""),[D,N]=n.useState([]),[A,w]=n.useState(null),I=null===(o=m)||void 0===o||null===(i=o.tradeLicenseDetail)||void 0===i?void 0:i.tradeUnits;console.log("tradeUnits",I);const x=n.useMemo(()=>{var e;if(g||!E||!I.length)return[];const t=new Set(I.map(e=>e.tradeType)),n=(null===(e=E.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[g,E,I]);return console.log("years",x),n.useEffect(()=>{u&&h((e=>{let{t:n,action:a,years:o,selectedApprover:i,setSelectedApprover:r,businessService:u}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==u?void 0:u.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:o,autoComplete:"off",select:r,selected:i})}]}]}})({t:r,action:u,years:x,selectedApprover:b,setSelectedApprover:T,businessService:v}))},[u,x,D,A]),u&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(zl,{label:r(f.label.heading)}),headerBarEnd:l.createElement(Gl,{onClick:s}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=m)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a="20"+Number(l)+"-"+(Number(l)+1);m=d({},m,{financialYear:a,action:"INITIATE",additionalDetail:d({},m.additionalDetail,{validityYears:b.length>0?parseInt(b):""})}),c({Licenses:[m]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Ql=e=>l.createElement("h1",{className:"heading-m"},e.label),Xl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Zl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Xl,null)),$l=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:E,moduleCode:g}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[h,y]=n.useState({}),[S,_]=n.useState({}),[C,b]=n.useState([]),[T,D]=n.useState(null),[N,A]=n.useState(null),[w,I]=n.useState(null),[x,L]=n.useState(null),[O,R]=n.useState(!1);function P(e){R(!0),A(e.target.files[0])}return n.useEffect(()=>{var e;b(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",N,u)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(R(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),console.log("actyhdesh,jhfsefsef",r,m),n.useEffect(()=>{y((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,approvers:u,selectedApprover:s,setSelectedApprover:c,isUploading:d}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",d),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:u,t:n,optionKey:"name",select:c,selected:s})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{r(null)},message:d?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):i?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:T,setSelectedApprover:D,selectFile:P,uploadedFile:w,setUploadedFile:I,businessService:E,isUploading:O}))},[r,C,w]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ql,{label:i(h.label.heading)}),headerBarEnd:l.createElement(Zl,{onClick:s}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:h.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:E,moduleName:g,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==m||null===(t=m.auditDetails)||void 0===t?void 0:t.createdBy]:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null};w&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:w}]),c({streetVendingDetail:d({},m,{workflow:n})})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Jl=e=>l.createElement("h1",{className:"heading-m"},e.label),ea=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ta=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ea,null)),na=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;console.log("applicationData",m);const{data:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[_,C]=n.useState([]),[b,T]=n.useState(null),[D,N]=n.useState(null),[A,w]=n.useState(null),[I,x]=n.useState(null),[L,O]=n.useState(!1);function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;C(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(){x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:u}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+u+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:_,selectedApprover:b,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p}))},[r,_,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Jl,{label:i(f.label.heading)}),headerBarEnd:l.createElement(ta,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:E};A&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,filestoreId:A}]),c({hallsBookingApplication:[d({},m,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},la=e=>l.createElement("h1",{className:"heading-m"},e.label),aa=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),oa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(aa,null)),ia=e=>{var a,i,r;let{t:u,action:s,tenantId:c,closeModal:m,submitAction:v,applicationData:p,businessService:E,moduleCode:g}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(a=s.roles)||void 0===a||null===(i=a[0])||void 0===i||null===(r=i.map)||void 0===r?void 0:r.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),h=o.useHistory(),[y,S]=n.useState({}),[_,C]=n.useState({}),[b,T]=n.useState([]),[D,N]=n.useState(null),[A,w]=n.useState(null);return n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{"INITIATED"===(null==s?void 0:s.state)?h.push("/digit-ui/employee/asset/assetservice/edit/"+(null==p?void 0:p.applicationNo)):S((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:u,action:s,approvers:b,selectedApprover:D,setSelectedApprover:N,uploadedFile:A,setUploadedFile:w,businessService:E}))},[s,b,A]),s&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(la,{label:u(y.label.heading)}),headerBarEnd:l.createElement(oa,{onClick:m}),actionCancelLabel:u(y.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:u(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==s?void 0:s.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:g};A&&(t.documents=[]),v({Asset:d({},p,{workflow:t})})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},ra=e=>null!=e&&e.businessService.includes("PT")?l.createElement(ft,e):null!=e&&e.businessService.includes("ptr")?l.createElement(jl,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(_t,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(Kl,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(Dt,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(It,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(Rt,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(Hl,e):null!=e&&e.businessService.includes("street-vending")?l.createElement($l,e):null!=e&&e.businessService.includes("chb")?l.createElement(na,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(ia,e):void 0;var ua=Ht(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",i="[object Array]",r="[object Boolean]",u="[object Date]",s="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",g="[object Set]",f="[object String]",h="[object Symbol]",y="[object WeakMap]",S="[object ArrayBuffer]",_="[object DataView]",C="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",D="[object Int16Array]",N="[object Int32Array]",A="[object Uint8Array]",w="[object Uint16Array]",I="[object Uint32Array]",x=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,O=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(R.source),F=RegExp(P.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q=/[\\^$.*+?()[\]{}|]/g,j=RegExp(q.source),z=/^\s+/,Y=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,K=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Z=/[()=,{}\[\]\/\s]/,$=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,ie=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,re=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",de="["+ce+"]",me="["+se+"]",ve="\\d+",pe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",fe="[^\\ud800-\\udfff]",he="(?:\\ud83c[\\udde6-\\uddff]){2}",ye="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",_e="(?:"+pe+"|"+Ee+")",Ce="(?:"+Se+"|"+Ee+")",be="(?:"+me+"|"+ge+")?",Te="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[fe,he,ye].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",De="(?:"+["[\\u2700-\\u27bf]",he,ye].join("|")+")"+Te,Ne="(?:"+[fe+me+"?",me,he,ye,"[\\ud800-\\udfff]"].join("|")+")",Ae=RegExp("['’]","g"),we=RegExp(me,"g"),Ie=RegExp(ge+"(?="+ge+")|"+Ne+Te,"g"),xe=RegExp([Se+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[de,Se,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[de,Se+_e,"$"].join("|")+")",Se+"?"+_e+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Se+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,De].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),Oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Pe=-1,Me={};Me[C]=Me[b]=Me[T]=Me[D]=Me[N]=Me[A]=Me["[object Uint8ClampedArray]"]=Me[w]=Me[I]=!0,Me[o]=Me[i]=Me[S]=Me[r]=Me[_]=Me[u]=Me[s]=Me[c]=Me[m]=Me[v]=Me[p]=Me[E]=Me[g]=Me[f]=Me[y]=!1;var Fe={};Fe[o]=Fe[i]=Fe[S]=Fe[_]=Fe[r]=Fe[u]=Fe[C]=Fe[b]=Fe[T]=Fe[D]=Fe[N]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[g]=Fe[f]=Fe[h]=Fe[A]=Fe["[object Uint8ClampedArray]"]=Fe[w]=Fe[I]=!0,Fe[s]=Fe[c]=Fe[y]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,Ue=parseInt,He="object"==typeof Ut&&Ut&&Ut.Object===Object&&Ut,Ve="object"==typeof self&&self&&self.Object===Object&&self,We=He||Ve||Function("return this")(),qe=t&&!t.nodeType&&t,je=qe&&e&&!e.nodeType&&e,ze=je&&je.exports===qe,Ye=ze&&He.process,Ge=function(){try{return je&&je.require&&je.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),Ke=Ge&&Ge.isArrayBuffer,Qe=Ge&&Ge.isDate,Xe=Ge&&Ge.isMap,Ze=Ge&&Ge.isRegExp,$e=Ge&&Ge.isSet,Je=Ge&&Ge.isTypedArray;function et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function tt(e,t,n,l){for(var a=-1,o=null==e?0:e.length;++a<o;){var i=e[a];t(l,i,n(i),e)}return l}function nt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,o=[];++n<l;){var i=e[n];t(i,n,e)&&(o[a++]=i)}return o}function it(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function rt(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function st(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}function dt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function mt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=St("length");function pt(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function Et(e,t,n,l){for(var a=e.length,o=n+(l?1:-1);l?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):Et(e,ht,n)}function ft(e,t,n,l){for(var a=n-1,o=e.length;++a<o;)if(l(e[a],t))return a;return-1}function ht(e){return e!=e}function yt(e,t){var n=null==e?0:e.length;return n?bt(e,t)/n:NaN}function St(e){return function(t){return null==t?void 0:t[e]}}function _t(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,o){n=l?(l=!1,e):t(n,e,a,o)}),n}function bt(e,t){for(var n,l=-1,a=e.length;++l<a;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Tt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Dt(e){return e?e.slice(0,jt(e)+1).replace(z,""):e}function Nt(e){return function(t){return e(t)}}function At(e,t){return ut(t,function(t){return e[t]})}function wt(e,t){return e.has(t)}function It(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function xt(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Ot=_t({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Rt=_t({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Pt(e){return"\\"+ke[e]}function Mt(e){return Le.test(e)}function Ft(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function kt(e,t){return function(n){return e(t(n))}}function Bt(e,t){for(var n=-1,a=e.length,o=0,i=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,i[o++]=n)}return i}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Vt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Mt(e)?function(e){for(var t=Ie.lastIndex=0;Ie.test(e);)++t;return t}(e):vt(e)}function qt(e){return Mt(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.split("")}(e)}function jt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var zt=_t({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Yt=function e(t){var Y=(t=null==t?We:Yt.defaults(We.Object(),t,Yt.pick(We,Re))).Array,se=t.Date,ce=t.Error,de=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,Ee=t.String,ge=t.TypeError,fe=Y.prototype,he=ve.prototype,ye=t["__core-js_shared__"],Se=de.prototype.toString,_e=he.hasOwnProperty,Ce=0,be=function(){var e=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Te=he.toString,De=Se.call(ve),Ne=We._,Ie=pe("^"+Se.call(_e).replace(q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=ze?t.Buffer:void 0,ke=t.Symbol,He=t.Uint8Array,Ve=Le?Le.allocUnsafe:void 0,qe=kt(ve.getPrototypeOf,ve),je=ve.create,Ye=he.propertyIsEnumerable,Ge=fe.splice,vt=ke?ke.isConcatSpreadable:void 0,_t=ke?ke.iterator:void 0,Ut=ke?ke.toStringTag:void 0,Gt=function(){try{var e=Za(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kt=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,Qt=se&&se.now!==We.Date.now&&se.now,Xt=t.setTimeout!==We.setTimeout&&t.setTimeout,Zt=me.ceil,$t=me.floor,Jt=ve.getOwnPropertySymbols,en=Le?Le.isBuffer:void 0,tn=t.isFinite,nn=fe.join,ln=kt(ve.keys,ve),an=me.max,on=me.min,rn=se.now,un=t.parseInt,sn=me.random,cn=fe.reverse,dn=Za(t,"DataView"),mn=Za(t,"Map"),vn=Za(t,"Promise"),pn=Za(t,"Set"),En=Za(t,"WeakMap"),gn=Za(ve,"create"),fn=En&&new En,hn={},yn=Ao(dn),Sn=Ao(mn),_n=Ao(vn),Cn=Ao(pn),bn=Ao(En),Tn=ke?ke.prototype:void 0,Dn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function An(e){if(ji(e)&&!Ri(e)&&!(e instanceof Ln)){if(e instanceof xn)return e;if(_e.call(e,"__wrapped__"))return wo(e)}return new xn(e)}var wn=function(){function e(){}return function(t){if(!qi(t))return{};if(je)return je(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function In(){}function xn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function On(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function Fn(e){var t=this.__data__=new Rn(e);this.size=t.size}function kn(e,t){var n=Ri(e),l=!n&&Oi(e),a=!n&&!l&&ki(e),o=!n&&!l&&!a&&$i(e),i=n||l||a||o,r=i?Tt(e.length,Ee):[],u=r.length;for(var s in e)!t&&!_e.call(e,s)||i&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ao(s,u))||r.push(s);return r}function Bn(e){var t=e.length;return t?e[Pl(0,t-1)]:void 0}function Un(e,t){return Co(Ea(e),Kn(t,0,e.length))}function Hn(e){return Co(Ea(e))}function Vn(e,t,n){(void 0!==n&&!Ii(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Wn(e,t,n){var l=e[t];_e.call(e,t)&&Ii(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function qn(e,t){for(var n=e.length;n--;)if(Ii(e[n][0],t))return n;return-1}function jn(e,t,n,l){return Jn(e,function(e,a,o){t(l,e,n(e),o)}),l}function zn(e,t){return e&&ga(t,Sr(t),e)}function Yn(e,t,n){"__proto__"==t&&Gt?Gt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Gn(e,t){for(var n=-1,l=t.length,a=Y(l),o=null==e;++n<l;)a[n]=o?void 0:Er(e,t[n]);return a}function Kn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Qn(e,t,n,l,a,i){var s,y=1&t,x=2&t,L=4&t;if(n&&(s=a?n(e,l,a,i):n(e)),void 0!==s)return s;if(!qi(e))return e;var O=Ri(e);if(O){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&_e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!y)return Ea(e,s)}else{var R=eo(e),P=R==c||R==d;if(ki(e))return sa(e,y);if(R==p||R==o||P&&!a){if(s=x||P?{}:no(e),!y)return x?function(e,t){return ga(e,Ja(e),t)}(e,function(e,t){return e&&ga(t,_r(t),e)}(s,e)):function(e,t){return ga(e,$a(e),t)}(e,zn(s,e))}else{if(!Fe[R])return a?e:{};s=function(e,t,n){var l=e.constructor;switch(t){case S:return ca(e);case r:case u:return new l(+e);case _:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case C:case b:case T:case D:case N:case A:case"[object Uint8ClampedArray]":case w:case I:return da(e,n);case m:return new l;case v:case f:return new l(e);case E:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case g:return new l;case h:return Dn?ve(Dn.call(e)):{}}}(e,R,y)}}i||(i=new Fn);var M=i.get(e);if(M)return M;i.set(e,s),Qi(e)?e.forEach(function(l){s.add(Qn(l,t,n,l,e,i))}):zi(e)&&e.forEach(function(l,a){s.set(a,Qn(l,t,n,a,e,i))});var F=O?void 0:(L?x?ja:qa:x?_r:Sr)(e);return nt(F||e,function(l,a){F&&(l=e[a=l]),Wn(s,a,Qn(l,t,n,a,e,i))}),s}function Xn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],o=e[a];if(void 0===o&&!(a in e)||!(0,t[a])(o))return!1}return!0}function Zn(e,t,l){if("function"!=typeof e)throw new ge(n);return ho(function(){e.apply(void 0,l)},t)}function $n(e,t,n,l){var a=-1,o=it,i=!0,r=e.length,u=[],s=t.length;if(!r)return u;n&&(t=ut(t,Nt(n))),l?(o=rt,i=!1):t.length>=200&&(o=wt,i=!1,t=new Mn(t));e:for(;++a<r;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,i&&d==d){for(var m=s;m--;)if(t[m]===d)continue e;u.push(c)}else o(t,d,l)||u.push(c)}return u}An.templateSettings={escape:k,evaluate:B,interpolate:U,variable:"",imports:{_:An}},(An.prototype=In.prototype).constructor=An,(xn.prototype=wn(In.prototype)).constructor=xn,(Ln.prototype=wn(In.prototype)).constructor=Ln,On.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},On.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},On.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return _e.call(t,e)?t[e]:void 0},On.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:_e.call(t,e)},On.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=qn(t,e);return!(n<0||(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,0))},Rn.prototype.get=function(e){var t=this.__data__,n=qn(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return qn(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,l=qn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new On,map:new(mn||Rn),string:new On}},Pn.prototype.delete=function(e){var t=Qa(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return Qa(this,e).get(e)},Pn.prototype.has=function(e){return Qa(this,e).has(e)},Pn.prototype.set=function(e,t){var n=Qa(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Mn.prototype.add=Mn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Mn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new Rn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(l)}return n.set(e,t),this.size=n.size,this};var Jn=ya(rl),el=ya(ul,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,a){return n=!!t(e,l,a)}),n}function nl(e,t,n){for(var l=-1,a=e.length;++l<a;){var o=e[l],i=t(o);if(null!=i&&(void 0===r?i==i&&!Zi(i):n(i,r)))var r=i,u=o}return u}function ll(e,t){var n=[];return Jn(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function al(e,t,n,l,a){var o=-1,i=e.length;for(n||(n=lo),a||(a=[]);++o<i;){var r=e[o];t>0&&n(r)?t>1?al(r,t-1,n,l,a):st(a,r):l||(a[a.length]=r)}return a}var ol=Sa(),il=Sa(!0);function rl(e,t){return e&&ol(e,t,Sr)}function ul(e,t){return e&&il(e,t,Sr)}function sl(e,t){return ot(t,function(t){return Hi(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return Ri(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ut&&Ut in ve(e)?function(e){var t=_e.call(e,Ut),n=e[Ut];try{e[Ut]=void 0;var l=!0}catch(e){}var a=Te.call(e);return l&&(t?e[Ut]=n:delete e[Ut]),a}(e):function(e){return Te.call(e)}(e)}function vl(e,t){return e>t}function pl(e,t){return null!=e&&_e.call(e,t)}function El(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?rt:it,a=e[0].length,o=e.length,i=o,r=Y(o),u=Infinity,s=[];i--;){var c=e[i];i&&t&&(c=ut(c,Nt(t))),u=on(c.length,u),r[i]=!n&&(t||a>=120&&c.length>=120)?new Mn(i&&c):void 0}c=e[0];var d=-1,m=r[0];e:for(;++d<a&&s.length<u;){var v=c[d],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?wt(m,p):l(s,p,n))){for(i=o;--i;){var E=r[i];if(!(E?wt(E,p):l(e[i],p,n)))continue e}m&&m.push(p),s.push(v)}}return s}function fl(e,t,n){var l=null==(e=po(e,t=oa(t,e)))?e:e[No(Uo(t))];return null==l?void 0:et(l,e,n)}function hl(e){return ji(e)&&ml(e)==o}function yl(e,t,n,l,a){return e===t||(null==e||null==t||!ji(e)&&!ji(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Ri(e),y=Ri(t),C=d?i:eo(e),b=y?i:eo(t),T=(C=C==o?p:C)==p,D=(b=b==o?p:b)==p,N=C==b;if(N&&ki(e)){if(!ki(t))return!1;d=!0,T=!1}if(N&&!T)return c||(c=new Fn),d||$i(e)?Va(e,t,n,l,a,c):function(e,t,n,l,a,o,i){switch(n){case _:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case r:case u:case v:return Ii(+e,+t);case s:return e.name==t.name&&e.message==t.message;case E:case f:return e==t+"";case m:var c=Ft;case g:if(c||(c=Ht),e.size!=t.size&&!(1&l))return!1;var d=i.get(e);if(d)return d==t;l|=2,i.set(e,t);var p=Va(c(e),c(t),l,a,o,i);return i.delete(e),p;case h:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,C,n,l,a,c);if(!(1&n)){var A=T&&_e.call(e,"__wrapped__"),w=D&&_e.call(t,"__wrapped__");if(A||w){var I=A?e.value():e,x=w?t.value():t;return c||(c=new Fn),a(I,x,n,l,c)}}return!!N&&(c||(c=new Fn),function(e,t,n,l,a,o){var i=1&n,r=qa(e),u=r.length;if(u!=qa(t).length&&!i)return!1;for(var s=u;s--;){var c=r[s];if(!(i?c in t:_e.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var p=i;++s<u;){var E=e[c=r[s]],g=t[c];if(l)var f=i?l(g,E,c,t,e,o):l(E,g,c,e,t,o);if(!(void 0===f?E===g||a(E,g,n,l,o):f)){v=!1;break}p||(p="constructor"==c)}if(v&&!p){var h=e.constructor,y=t.constructor;h==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof y&&y instanceof y||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,a,c))}(e,t,n,l,yl,a))}function Sl(e,t,n,l){var a=n.length,o=a,i=!l;if(null==e)return!o;for(e=ve(e);a--;){var r=n[a];if(i&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<o;){var u=(r=n[a])[0],s=e[u],c=r[1];if(i&&r[2]){if(void 0===s&&!(u in e))return!1}else{var d=new Fn;if(l)var m=l(s,c,u,e,t,d);if(!(void 0===m?yl(c,s,3,l,d):m))return!1}}return!0}function _l(e){return!(!qi(e)||(t=e,be&&be in t))&&(Hi(e)?Ie:le).test(Ao(e));var t}function Cl(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?Ri(e)?Al(e[0],e[1]):Nl(e):tu(e)}function bl(e){if(!so(e))return ln(e);var t=[];for(var n in ve(e))_e.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Tl(e,t){return e<t}function Dl(e,t){var n=-1,l=Mi(e)?Y(e.length):[];return Jn(e,function(e,a,o){l[++n]=t(e,a,o)}),l}function Nl(e){var t=Xa(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||Sl(n,e,t)}}function Al(e,t){return io(e)&&co(t)?mo(No(e),t):function(n){var l=Er(n,e);return void 0===l&&l===t?gr(n,e):yl(t,l,3)}}function wl(e,t,n,l,a){e!==t&&ol(t,function(o,i){if(a||(a=new Fn),qi(o))!function(e,t,n,l,a,o,i){var r=go(e,n),u=go(t,n),s=i.get(u);if(s)Vn(e,n,s);else{var c=o?o(r,u,n+"",e,t,i):void 0,d=void 0===c;if(d){var m=Ri(u),v=!m&&ki(u),p=!m&&!v&&$i(u);c=u,m||v||p?Ri(r)?c=r:Fi(r)?c=Ea(r):v?(d=!1,c=sa(u,!0)):p?(d=!1,c=da(u,!0)):c=[]:Gi(u)||Oi(u)?(c=r,Oi(r)?c=ir(r):qi(r)&&!Hi(r)||(c=no(u))):d=!1}d&&(i.set(u,c),a(c,u,l,o,i),i.delete(u)),Vn(e,n,c)}}(e,t,i,n,wl,l,a);else{var r=l?l(go(e,i),o,i+"",e,t,a):void 0;void 0===r&&(r=o),Vn(e,i,r)}},_r)}function Il(e,t){var n=e.length;if(n)return ao(t+=t<0?n:0,n)?e[t]:void 0}function xl(e,t,n){t=t.length?ut(t,function(e){return Ri(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yr];var l=-1;return t=ut(t,Nt(Ka())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,o=t.criteria,i=a.length,r=n.length;++l<i;){var u=ma(a[l],o[l]);if(u)return l>=r?u:u*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Dl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,o={};++l<a;){var i=t[l],r=cl(e,i);n(r,i)&&Ul(o,oa(i,e),r)}return o}function Ol(e,t,n,l){var a=l?ft:gt,o=-1,i=t.length,r=e;for(e===t&&(t=Ea(t)),n&&(r=ut(e,Nt(n)));++o<i;)for(var u=0,s=t[o],c=n?n(s):s;(u=a(r,c,u,l))>-1;)r!==e&&Ge.call(r,u,1),Ge.call(e,u,1);return e}function Rl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==o){var o=a;ao(a)?Ge.call(e,a,1):Zl(e,a)}}return e}function Pl(e,t){return e+$t(sn()*(t-e+1))}function Ml(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=$t(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return yo(vo(e,t,Yr),e+"")}function kl(e){return Bn(Ir(e))}function Bl(e,t){var n=Ir(e);return Co(n,Kn(t,0,n.length))}function Ul(e,t,n,l){if(!qi(e))return e;for(var a=-1,o=(t=oa(t,e)).length,i=o-1,r=e;null!=r&&++a<o;){var u=No(t[a]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=i){var c=r[u];void 0===(s=l?l(c,u,r):void 0)&&(s=qi(c)?c:ao(t[a+1])?[]:{})}Wn(r,u,s),r=r[u]}return e}var Hl=fn?function(e,t){return fn.set(e,t),e}:Yr,Vl=Gt?function(e,t){return Gt(e,"toString",{configurable:!0,enumerable:!1,value:qr(t),writable:!0})}:Yr;function Wl(e){return Co(Ir(e))}function ql(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Y(a);++l<a;)o[l]=e[l+t];return o}function jl(e,t){var n;return Jn(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function zl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var o=l+a>>>1,i=e[o];null!==i&&!Zi(i)&&(n?i<=t:i<t)?l=o+1:a=o}return a}return Yl(e,t,Yr,n)}function Yl(e,t,n,l){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var i=(t=n(t))!=t,r=null===t,u=Zi(t),s=void 0===t;a<o;){var c=$t((a+o)/2),d=n(e[c]),m=void 0!==d,v=null===d,p=d==d,E=Zi(d);if(i)var g=l||p;else g=s?p&&(l||m):r?p&&m&&(l||!v):u?p&&m&&!v&&(l||!E):!v&&!E&&(l?d<=t:d<t);g?a=c+1:o=c}return on(o,4294967294)}function Gl(e,t){for(var n=-1,l=e.length,a=0,o=[];++n<l;){var i=e[n],r=t?t(i):i;if(!n||!Ii(r,u)){var u=r;o[a++]=0===i?0:i}}return o}function Kl(e){return"number"==typeof e?e:Zi(e)?NaN:+e}function Ql(e){if("string"==typeof e)return e;if(Ri(e))return ut(e,Ql)+"";if(Zi(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xl(e,t,n){var l=-1,a=it,o=e.length,i=!0,r=[],u=r;if(n)i=!1,a=rt;else if(o>=200){var s=t?null:Ma(e);if(s)return Ht(s);i=!1,a=wt,u=new Mn}else u=t?[]:r;e:for(;++l<o;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,i&&d==d){for(var m=u.length;m--;)if(u[m]===d)continue e;t&&u.push(d),r.push(c)}else a(u,d,n)||(u!==r&&u.push(d),r.push(c))}return r}function Zl(e,t){return null==(e=po(e,t=oa(t,e)))||delete e[No(Uo(t))]}function $l(e,t,n,l){return Ul(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,o=l?a:-1;(l?o--:++o<a)&&t(e[o],o,e););return n?ql(e,l?0:o,l?o+1:a):ql(e,l?o+1:0,l?a:o)}function ea(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},n)}function ta(e,t,n){var l=e.length;if(l<2)return l?Xl(e[0]):[];for(var a=-1,o=Y(l);++a<l;)for(var i=e[a],r=-1;++r<l;)r!=a&&(o[a]=$n(o[a]||i,e[r],t,n));return Xl(al(o,1),t,n)}function na(e,t,n){for(var l=-1,a=e.length,o=t.length,i={};++l<a;)n(i,e[l],l<o?t[l]:void 0);return i}function la(e){return Fi(e)?e:[]}function aa(e){return"function"==typeof e?e:Yr}function oa(e,t){return Ri(e)?e:io(e,t)?[e]:Do(rr(e))}var ia=Fl;function ra(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:ql(e,t,n)}var ua=Kt||function(e){return We.clearTimeout(e)};function sa(e,t){if(t)return e.slice();var n=e.length,l=Ve?Ve(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function da(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ma(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,o=Zi(e),i=void 0!==t,r=null===t,u=t==t,s=Zi(t);if(!r&&!s&&!o&&e>t||o&&i&&u&&!r&&!s||l&&i&&u||!n&&u||!a)return 1;if(!l&&!o&&!s&&e<t||s&&n&&a&&!l&&!o||r&&n&&a||!i&&a||!u)return-1}return 0}function va(e,t,n,l){for(var a=-1,o=e.length,i=n.length,r=-1,u=t.length,s=an(o-i,0),c=Y(u+s),d=!l;++r<u;)c[r]=t[r];for(;++a<i;)(d||a<o)&&(c[n[a]]=e[a]);for(;s--;)c[r++]=e[a++];return c}function pa(e,t,n,l){for(var a=-1,o=e.length,i=-1,r=n.length,u=-1,s=t.length,c=an(o-r,0),d=Y(c+s),m=!l;++a<c;)d[a]=e[a];for(var v=a;++u<s;)d[v+u]=t[u];for(;++i<r;)(m||a<o)&&(d[v+n[i]]=e[a++]);return d}function Ea(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?Yn(n,r,u):Wn(n,r,u)}return n}function fa(e,t){return function(n,l){var a=Ri(n)?tt:jn,o=t?t():{};return a(n,e,Ka(l,2),o)}}function ha(e){return Fl(function(t,n){var l=-1,a=n.length,o=a>1?n[a-1]:void 0,i=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&oo(n[0],n[1],i)&&(o=a<3?void 0:o,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,o)}return t})}function ya(e,t){return function(n,l){if(null==n)return n;if(!Mi(n))return e(n,l);for(var a=n.length,o=t?a:-1,i=ve(n);(t?o--:++o<a)&&!1!==l(i[o],o,i););return n}}function Sa(e){return function(t,n,l){for(var a=-1,o=ve(t),i=l(t),r=i.length;r--;){var u=i[e?r:++a];if(!1===n(o[u],u,o))break}return t}}function _a(e){return function(t){var n=Mt(t=rr(t))?qt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ra(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(Hr(Or(t).replace(Ae,"")),e,"")}}function ba(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=wn(e.prototype),l=e.apply(n,t);return qi(l)?l:n}}function Ta(e){return function(t,n,l){var a=ve(t);if(!Mi(t)){var o=Ka(n,3);t=Sr(t),n=function(e){return o(a[e],e,a)}}var i=e(t,n,l);return i>-1?a[o?t[i]:i]:void 0}}function Da(e){return Wa(function(t){var l=t.length,a=l,o=xn.prototype.thru;for(e&&t.reverse();a--;){var i=t[a];if("function"!=typeof i)throw new ge(n);if(o&&!r&&"wrapper"==Ya(i))var r=new xn([],!0)}for(a=r?a:l;++a<l;){var u=Ya(i=t[a]),s="wrapper"==u?za(i):void 0;r=s&&ro(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?r[Ya(s[0])].apply(r,s[3]):1==i.length&&ro(i)?r[u]():r.thru(i)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&Ri(n))return r.plant(n).value();for(var a=0,o=l?t[a].apply(this,e):n;++a<l;)o=t[a].call(this,o);return o}})}function Na(e,t,n,l,a,o,i,r,u,s){var c=128&t,d=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:ba(e);return function g(){for(var f=arguments.length,h=Y(f),y=f;y--;)h[y]=arguments[y];if(v)var S=Ga(g),_=Lt(h,S);if(l&&(h=va(h,l,a,v)),o&&(h=pa(h,o,i,v)),f-=_,v&&f<s){var C=Bt(h,S);return Ra(e,t,Na,g.placeholder,n,h,C,r,u,s-f)}var b=d?n:this,T=m?b[e]:e;return f=h.length,r?h=Eo(h,r):p&&f>1&&h.reverse(),c&&u<f&&(h.length=u),this&&this!==We&&this instanceof g&&(T=E||ba(T)),T.apply(b,h)}}function Aa(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,a,o){t(l,n(e),a,o)}),l}(n,e,t(l),{})}}function wa(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Ql(n),l=Ql(l)):(n=Kl(n),l=Kl(l)),a=e(n,l)}return a}}function Ia(e){return Wa(function(t){return t=ut(t,Nt(Ka())),Fl(function(n){var l=this;return e(t,function(e){return et(e,l,n)})})})}function xa(e,t){var n=(t=void 0===t?" ":Ql(t)).length;if(n<2)return n?Ml(t,e):t;var l=Ml(t,Zt(e/Wt(t)));return Mt(t)?ra(qt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n,l){for(var a=-1,o=an(Zt((t-e)/(n||1)),0),i=Y(o);o--;)i[l?o:++a]=e,e+=n;return i}(t,n,l=void 0===l?t<n?1:-1:nr(l),e)}}function Oa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function Ra(e,t,n,l,a,o,i,r,u,s){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?o:void 0,c?i:void 0,c?void 0:o,c?void 0:i,r,u,s],m=n.apply(void 0,d);return ro(e)&&fo(m,d),m.placeholder=l,So(m,e,t)}function Pa(e){var t=me[e];return function(e,n){if(e=or(e),(n=null==n?0:on(lr(n),292))&&tn(e)){var l=(rr(e)+"e").split("e");return+((l=(rr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Ma=pn&&1/Ht(new pn([,-0]))[1]==1/0?function(e){return new pn(e)}:Zr;function Fa(e){return function(t){var n=eo(t);return n==m?Ft(t):n==g?Vt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,o,i,r,u,s){var c=2&t;if(!c&&"function"!=typeof e)throw new ge(n);var d=o?o.length:0;if(d||(t&=-97,o=i=void 0),u=void 0===u?u:an(lr(u),0),s=void 0===s?s:lr(s),d-=i?i.length:0,64&t){var m=o,v=i;o=i=void 0}var p=c?void 0:za(e),E=[e,t,a,o,i,m,v,r,u,s];if(p&&function(e,t){var n=e[1],a=t[1],o=n|a;if(!(o<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],o|=1&n?0:4);var i=t[3];if(i){var r=e[3];e[3]=r?va(r,i,t[4]):i,e[4]=r?Bt(e[3],l):t[4]}(i=t[5])&&(e[5]=(r=e[5])?pa(r,i,t[6]):i,e[6]=r?Bt(e[5],l):t[6]),(i=t[7])&&(e[7]=i),128&a&&(e[8]=null==e[8]?t[8]:on(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(E,p),e=E[0],t=E[1],a=E[2],o=E[3],i=E[4],!(s=E[9]=void 0===E[9]?c?0:e.length:an(E[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)g=8==t||16==t?function(e,t,n){var l=ba(e);return function a(){for(var o=arguments.length,i=Y(o),r=o,u=Ga(a);r--;)i[r]=arguments[r];var s=o<3&&i[0]!==u&&i[o-1]!==u?[]:Bt(i,u);if((o-=s.length)<n)return Ra(e,t,Na,a.placeholder,void 0,i,s,void 0,void 0,n-o);var c=this&&this!==We&&this instanceof a?l:e;return et(c,this,i)}}(e,t,s):32!=t&&33!=t||i.length?Na.apply(void 0,E):function(e,t,n,l){var a=1&t,o=ba(e);return function t(){for(var i=-1,r=arguments.length,u=-1,s=l.length,c=Y(s+r),d=this&&this!==We&&this instanceof t?o:e;++u<s;)c[u]=l[u];for(;r--;)c[u++]=arguments[++i];return et(d,a?n:this,c)}}(e,t,a,o);else var g=function(e,t,n){var l=1&t,a=ba(e);return function t(){var o=this&&this!==We&&this instanceof t?a:e;return o.apply(l?n:this,arguments)}}(e,t,a);return So((p?Hl:fo)(g,E),e,t)}function Ba(e,t,n,l){return void 0===e||Ii(e,he[n])&&!_e.call(l,n)?t:e}function Ua(e,t,n,l,a,o){return qi(e)&&qi(t)&&(o.set(t,e),wl(e,t,void 0,Ua,o),o.delete(t)),e}function Ha(e){return Gi(e)?void 0:e}function Va(e,t,n,l,a,o){var i=1&n,r=e.length,u=t.length;if(r!=u&&!(i&&u>r))return!1;var s=o.get(e),c=o.get(t);if(s&&c)return s==t&&c==e;var d=-1,m=!0,v=2&n?new Mn:void 0;for(o.set(e,t),o.set(t,e);++d<r;){var p=e[d],E=t[d];if(l)var g=i?l(E,p,d,t,e,o):l(p,E,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(v){if(!mt(t,function(e,t){if(!wt(v,t)&&(p===e||a(p,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(p!==E&&!a(p,E,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function Wa(e){return yo(vo(e,void 0,Po),e+"")}function qa(e){return dl(e,Sr,$a)}function ja(e){return dl(e,_r,Ja)}var za=fn?function(e){return fn.get(e)}:Zr;function Ya(e){for(var t=e.name+"",n=hn[t],l=_e.call(hn,t)?n.length:0;l--;){var a=n[l],o=a.func;if(null==o||o==e)return a.name}return t}function Ga(e){return(_e.call(An,"placeholder")?An:e).placeholder}function Ka(){var e=An.iteratee||Gr;return e=e===Gr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Qa(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Xa(e){for(var t=Sr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,co(a)]}return t}function Za(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return _l(n)?n:void 0}var $a=Jt?function(e){return null==e?[]:(e=ve(e),ot(Jt(e),function(t){return Ye.call(e,t)}))}:au,Ja=Jt?function(e){for(var t=[];e;)st(t,$a(e)),e=qe(e);return t}:au,eo=ml;function to(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,o=!1;++l<a;){var i=No(t[l]);if(!(o=null!=e&&n(e,i)))break;e=e[i]}return o||++l!=a?o:!!(a=null==e?0:e.length)&&Wi(a)&&ao(i,a)&&(Ri(e)||Oi(e))}function no(e){return"function"!=typeof e.constructor||so(e)?{}:wn(qe(e))}function lo(e){return Ri(e)||Oi(e)||!!(vt&&e&&e[vt])}function ao(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oo(e,t,n){if(!qi(n))return!1;var l=typeof t;return!!("number"==l?Mi(n)&&ao(t,n.length):"string"==l&&t in n)&&Ii(n[t],e)}function io(e,t){if(Ri(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Zi(e))||V.test(e)||!H.test(e)||null!=t&&e in ve(t)}function ro(e){var t=Ya(e),n=An[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=za(n);return!!l&&e===l[0]}(dn&&eo(new dn(new ArrayBuffer(1)))!=_||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||pn&&eo(new pn)!=g||En&&eo(new En)!=y)&&(eo=function(e){var t=ml(e),n=t==p?e.constructor:void 0,l=n?Ao(n):"";if(l)switch(l){case yn:return _;case Sn:return m;case _n:return"[object Promise]";case Cn:return g;case bn:return y}return t});var uo=ye?Hi:ou;function so(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function co(e){return e==e&&!qi(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,o=an(l.length-t,0),i=Y(o);++a<o;)i[a]=l[t+a];a=-1;for(var r=Y(t+1);++a<t;)r[a]=l[a];return r[t]=n(i),et(e,this,r)}}function po(e,t){return t.length<2?e:cl(e,ql(t,0,-1))}function Eo(e,t){for(var n=e.length,l=on(t.length,n),a=Ea(e);l--;){var o=t[l];e[l]=ao(o,n)?a[o]:void 0}return e}function go(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fo=_o(Hl),ho=Xt||function(e,t){return We.setTimeout(e,t)},yo=_o(Vl);function So(e,t,n){var l=t+"";return yo(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(G,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return nt(a,function(n){var l="_."+n[0];t&n[1]&&!it(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match(K);return t?t[1].split(Q):[]}(l),n)))}function _o(e){var t=0,n=0;return function(){var l=rn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Co(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var o=Pl(n,a),i=e[o];e[o]=e[n],e[n]=i}return e.length=t,e}var bo,To,Do=(bo=bi(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,n,l,a){t.push(l?a.replace($,"$1"):n||e)}),t},function(e){return 500===To.size&&To.clear(),e}),To=bo.cache,bo);function No(e){if("string"==typeof e||Zi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ao(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function wo(e){if(e instanceof Ln)return e.clone();var t=new xn(e.__wrapped__,e.__chain__);return t.__actions__=Ea(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Io=Fl(function(e,t){return Fi(e)?$n(e,al(t,1,Fi,!0)):[]}),xo=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),Ka(n,2)):[]}),Lo=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),void 0,n):[]});function Oo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),Et(e,Ka(t,3),a)}function Ro(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=lr(n),a=n<0?an(l+a,0):on(a,l-1)),Et(e,Ka(t,3),a,!0)}function Po(e){return null!=e&&e.length?al(e,1):[]}function Mo(e){return e&&e.length?e[0]:void 0}var Fo=Fl(function(e){var t=ut(e,la);return t.length&&t[0]===e[0]?gl(t):[]}),ko=Fl(function(e){var t=Uo(e),n=ut(e,la);return t===Uo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,Ka(t,2)):[]}),Bo=Fl(function(e){var t=Uo(e),n=ut(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Uo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ho=Fl(Vo);function Vo(e,t){return e&&e.length&&t&&t.length?Ol(e,t):e}var Wo=Wa(function(e,t){var n=null==e?0:e.length,l=Gn(e,t);return Rl(e,ut(t,function(e){return ao(e,n)?+e:e}).sort(ma)),l});function qo(e){return null==e?e:cn.call(e)}var jo=Fl(function(e){return Xl(al(e,1,Fi,!0))}),zo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),Xl(al(e,1,Fi,!0),Ka(t,2))}),Yo=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,Xl(al(e,1,Fi,!0),void 0,t)});function Go(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Fi(e))return t=an(e.length,t),!0}),Tt(t,function(t){return ut(e,St(t))})}function Ko(e,t){if(!e||!e.length)return[];var n=Go(e);return null==t?n:ut(n,function(e){return et(t,void 0,e)})}var Qo=Fl(function(e,t){return Fi(e)?$n(e,t):[]}),Xo=Fl(function(e){return ta(ot(e,Fi))}),Zo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),ta(ot(e,Fi),Ka(t,2))}),$o=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,ta(ot(e,Fi),void 0,t)}),Jo=Fl(Go),ei=Fl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Ko(e,n)});function ti(e){var t=An(e);return t.__chain__=!0,t}function ni(e,t){return t(e)}var li=Wa(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return Gn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&ao(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:ni,args:[a],thisArg:void 0}),new xn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ai=fa(function(e,t,n){_e.call(e,n)?++e[n]:Yn(e,n,1)}),oi=Ta(Oo),ii=Ta(Ro);function ri(e,t){return(Ri(e)?nt:Jn)(e,Ka(t,3))}function ui(e,t){return(Ri(e)?lt:el)(e,Ka(t,3))}var si=fa(function(e,t,n){_e.call(e,n)?e[n].push(t):Yn(e,n,[t])}),ci=Fl(function(e,t,n){var l=-1,a="function"==typeof t,o=Mi(e)?Y(e.length):[];return Jn(e,function(e){o[++l]=a?et(t,e,n):fl(e,t,n)}),o}),di=fa(function(e,t,n){Yn(e,n,t)});function mi(e,t){return(Ri(e)?ut:Dl)(e,Ka(t,3))}var vi=fa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),pi=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),xl(e,al(t,1),[])}),Ei=Qt||function(){return We.Date.now()};function gi(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function fi(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=lr(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var hi=Fl(function(e,t,n){var l=1;if(n.length){var a=Bt(n,Ga(hi));l|=32}return ka(e,l,t,n,a)}),yi=Fl(function(e,t,n){var l=3;if(n.length){var a=Bt(n,Ga(yi));l|=32}return ka(t,l,e,n,a)});function Si(e,t,l){var a,o,i,r,u,s,c=0,d=!1,m=!1,v=!0;if("function"!=typeof e)throw new ge(n);function p(t){var n=a,l=o;return a=o=void 0,c=t,r=e.apply(l,n)}function E(e){return c=e,u=ho(f,t),d?p(e):r}function g(e){var n=e-s;return void 0===s||n>=t||n<0||m&&e-c>=i}function f(){var e=Ei();if(g(e))return h(e);u=ho(f,function(e){var n=t-(e-s);return m?on(n,i-(e-c)):n}(e))}function h(e){return u=void 0,v&&a?p(e):(a=o=void 0,r)}function y(){var e=Ei(),n=g(e);if(a=arguments,o=this,s=e,n){if(void 0===u)return E(s);if(m)return ua(u),u=ho(f,t),p(s)}return void 0===u&&(u=ho(f,t)),r}return t=or(t)||0,qi(l)&&(d=!!l.leading,i=(m="maxWait"in l)?an(or(l.maxWait)||0,t):i,v="trailing"in l?!!l.trailing:v),y.cancel=function(){void 0!==u&&ua(u),c=0,a=s=o=u=void 0},y.flush=function(){return void 0===u?r:h(Ei())},y}var _i=Fl(function(e,t){return Zn(e,1,t)}),Ci=Fl(function(e,t,n){return Zn(e,or(t)||0,n)});function bi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=l.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return l.cache=o.set(a,i)||o,i};return l.cache=new(bi.Cache||Pn),l}function Ti(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}bi.Cache=Pn;var Di=ia(function(e,t){var n=(t=1==t.length&&Ri(t[0])?ut(t[0],Nt(Ka())):ut(al(t,1),Nt(Ka()))).length;return Fl(function(l){for(var a=-1,o=on(l.length,n);++a<o;)l[a]=t[a].call(this,l[a]);return et(e,this,l)})}),Ni=Fl(function(e,t){return ka(e,32,void 0,t,Bt(t,Ga(Ni)))}),Ai=Fl(function(e,t){return ka(e,64,void 0,t,Bt(t,Ga(Ai)))}),wi=Wa(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function Ii(e,t){return e===t||e!=e&&t!=t}var xi=Oa(vl),Li=Oa(function(e,t){return e>=t}),Oi=hl(function(){return arguments}())?hl:function(e){return ji(e)&&_e.call(e,"callee")&&!Ye.call(e,"callee")},Ri=Y.isArray,Pi=Ke?Nt(Ke):function(e){return ji(e)&&ml(e)==S};function Mi(e){return null!=e&&Wi(e.length)&&!Hi(e)}function Fi(e){return ji(e)&&Mi(e)}var ki=en||ou,Bi=Qe?Nt(Qe):function(e){return ji(e)&&ml(e)==u};function Ui(e){if(!ji(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Gi(e)}function Hi(e){if(!qi(e))return!1;var t=ml(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Vi(e){return"number"==typeof e&&e==lr(e)}function Wi(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function qi(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ji(e){return null!=e&&"object"==typeof e}var zi=Xe?Nt(Xe):function(e){return ji(e)&&eo(e)==m};function Yi(e){return"number"==typeof e||ji(e)&&ml(e)==v}function Gi(e){if(!ji(e)||ml(e)!=p)return!1;var t=qe(e);if(null===t)return!0;var n=_e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==De}var Ki=Ze?Nt(Ze):function(e){return ji(e)&&ml(e)==E},Qi=$e?Nt($e):function(e){return ji(e)&&eo(e)==g};function Xi(e){return"string"==typeof e||!Ri(e)&&ji(e)&&ml(e)==f}function Zi(e){return"symbol"==typeof e||ji(e)&&ml(e)==h}var $i=Je?Nt(Je):function(e){return ji(e)&&Wi(e.length)&&!!Me[ml(e)]},Ji=Oa(Tl),er=Oa(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Mi(e))return Xi(e)?qt(e):Ea(e);if(_t&&e[_t])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[_t]());var t=eo(e);return(t==m?Ft:t==g?Ht:Ir)(e)}function nr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function lr(e){var t=nr(e),n=t%1;return t==t?n?t-n:t:0}function ar(e){return e?Kn(lr(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Zi(e))return NaN;if(qi(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=qi(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Dt(e);var n=ne.test(e);return n||ae.test(e)?Ue(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ir(e){return ga(e,_r(e))}function rr(e){return null==e?"":Ql(e)}var ur=ha(function(e,t){if(so(t)||Mi(t))ga(t,Sr(t),e);else for(var n in t)_e.call(t,n)&&Wn(e,n,t[n])}),sr=ha(function(e,t){ga(t,_r(t),e)}),cr=ha(function(e,t,n,l){ga(t,_r(t),e,l)}),dr=ha(function(e,t,n,l){ga(t,Sr(t),e,l)}),mr=Wa(Gn),vr=Fl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oo(t[0],t[1],a)&&(l=1);++n<l;)for(var o=t[n],i=_r(o),r=-1,u=i.length;++r<u;){var s=i[r],c=e[s];(void 0===c||Ii(c,he[s])&&!_e.call(e,s))&&(e[s]=o[s])}return e}),pr=Fl(function(e){return e.push(void 0,Ua),et(br,void 0,e)});function Er(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&to(e,t,El)}var fr=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n},qr(Yr)),hr=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),_e.call(e,t)?e[t].push(n):e[t]=[n]},Ka),yr=Fl(fl);function Sr(e){return Mi(e)?kn(e):bl(e)}function _r(e){return Mi(e)?kn(e,!0):function(e){if(!qi(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=so(e),n=[];for(var l in e)("constructor"!=l||!t&&_e.call(e,l))&&n.push(l);return n}(e)}var Cr=ha(function(e,t,n){wl(e,t,n)}),br=ha(function(e,t,n,l){wl(e,t,n,l)}),Tr=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,ja(e),n),l&&(n=Qn(n,7,Ha));for(var a=t.length;a--;)Zl(n,t[a]);return n}),Dr=Wa(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(ja(e),function(e){return[e]});return t=Ka(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Ar=Fa(Sr),wr=Fa(_r);function Ir(e){return null==e?[]:At(e,Sr(e))}var xr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Ur(rr(e).toLowerCase())}function Or(e){return(e=rr(e))&&e.replace(ie,Ot).replace(we,"")}var Rr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Pr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Mr=_a("toLowerCase"),Fr=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Ca(function(e,t,n){return e+(n?" ":"")+Ur(t)}),Br=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ur=_a("toUpperCase");function Hr(e,t,n){return e=rr(e),void 0===(t=n?void 0:t)?function(e){return Oe.test(e)}(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Vr=Fl(function(e,t){try{return et(e,void 0,t)}catch(e){return Ui(e)?e:new ce(e)}}),Wr=Wa(function(e,t){return nt(t,function(t){t=No(t),Yn(e,t,hi(e[t],e))}),e});function qr(e){return function(){return e}}var jr=Da(),zr=Da(!0);function Yr(e){return e}function Gr(e){return Cl("function"==typeof e?e:Qn(e,1))}var Kr=Fl(function(e,t){return function(n){return fl(n,e,t)}}),Qr=Fl(function(e,t){return function(n){return fl(e,n,t)}});function Xr(e,t,n){var l=Sr(t),a=sl(t,l);null!=n||qi(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=sl(t,Sr(t)));var o=!(qi(n)&&"chain"in n&&!n.chain),i=Hi(e);return nt(a,function(n){var l=t[n];e[n]=l,i&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),a=n.__actions__=Ea(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,st([this.value()],arguments))})}),e}function Zr(){}var $r=Ia(ut),Jr=Ia(at),eu=Ia(mt);function tu(e){return io(e)?St(No(e)):function(e){return function(t){return cl(t,e)}}(e)}var nu=La(),lu=La(!0);function au(){return[]}function ou(){return!1}var iu,ru=wa(function(e,t){return e+t},0),uu=Pa("ceil"),su=wa(function(e,t){return e/t},1),cu=Pa("floor"),du=wa(function(e,t){return e*t},1),mu=Pa("round"),vu=wa(function(e,t){return e-t},0);return An.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=lr(e),function(){if(--e<1)return t.apply(this,arguments)}},An.ary=gi,An.assign=ur,An.assignIn=sr,An.assignInWith=cr,An.assignWith=dr,An.at=mr,An.before=fi,An.bind=hi,An.bindAll=Wr,An.bindKey=yi,An.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ri(e)?e:[e]},An.chain=ti,An.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:an(lr(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,o=0,i=Y(Zt(l/t));a<l;)i[o++]=ql(e,a,a+=t);return i},An.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var o=e[t];o&&(a[l++]=o)}return a},An.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(Ri(n)?Ea(n):[n],al(t,1))},An.cond=function(e){var t=null==e?0:e.length,l=Ka();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Fl(function(n){for(var l=-1;++l<t;){var a=e[l];if(et(a[0],this,n))return et(a[1],this,n)}})},An.conforms=function(e){return function(e){var t=Sr(e);return function(n){return Xn(n,e,t)}}(Qn(e,1))},An.constant=qr,An.countBy=ai,An.create=function(e,t){var n=wn(e);return null==t?n:zn(n,t)},An.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.debounce=Si,An.defaults=vr,An.defaultsDeep=pr,An.defer=_i,An.delay=Ci,An.difference=Io,An.differenceBy=xo,An.differenceWith=Lo,An.drop=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,(t=n||void 0===t?1:lr(t))<0?0:t,l):[]},An.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,0,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t):[]},An.dropRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0,!0):[]},An.dropWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0):[]},An.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=lr(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:lr(l))<0&&(l+=a),l=n>l?0:ar(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},An.filter=function(e,t){return(Ri(e)?ot:ll)(e,Ka(t,3))},An.flatMap=function(e,t){return al(mi(e,t),1)},An.flatMapDeep=function(e,t){return al(mi(e,t),1/0)},An.flatMapDepth=function(e,t,n){return n=void 0===n?1:lr(n),al(mi(e,t),n)},An.flatten=Po,An.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},An.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:lr(t)):[]},An.flip=function(e){return ka(e,512)},An.flow=jr,An.flowRight=zr,An.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},An.functions=function(e){return null==e?[]:sl(e,Sr(e))},An.functionsIn=function(e){return null==e?[]:sl(e,_r(e))},An.groupBy=si,An.initial=function(e){return null!=e&&e.length?ql(e,0,-1):[]},An.intersection=Fo,An.intersectionBy=ko,An.intersectionWith=Bo,An.invert=fr,An.invertBy=hr,An.invokeMap=ci,An.iteratee=Gr,An.keyBy=di,An.keys=Sr,An.keysIn=_r,An.map=mi,An.mapKeys=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},An.mapValues=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},An.matches=function(e){return Nl(Qn(e,1))},An.matchesProperty=function(e,t){return Al(e,Qn(t,1))},An.memoize=bi,An.merge=Cr,An.mergeWith=br,An.method=Kr,An.methodOf=Qr,An.mixin=Xr,An.negate=Ti,An.nthArg=function(e){return e=lr(e),Fl(function(t){return Il(t,e)})},An.omit=Tr,An.omitBy=function(e,t){return Nr(e,Ti(Ka(t)))},An.once=function(e){return fi(2,e)},An.orderBy=function(e,t,n,l){return null==e?[]:(Ri(t)||(t=null==t?[]:[t]),Ri(n=l?void 0:n)||(n=null==n?[]:[n]),xl(e,t,n))},An.over=$r,An.overArgs=Di,An.overEvery=Jr,An.overSome=eu,An.partial=Ni,An.partialRight=Ai,An.partition=vi,An.pick=Dr,An.pickBy=Nr,An.property=tu,An.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},An.pull=Ho,An.pullAll=Vo,An.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ol(e,t,Ka(n,2)):e},An.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ol(e,t,void 0,n):e},An.pullAt=Wo,An.range=nu,An.rangeRight=lu,An.rearg=wi,An.reject=function(e,t){return(Ri(e)?ot:ll)(e,Ti(Ka(t,3)))},An.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],o=e.length;for(t=Ka(t,3);++l<o;){var i=e[l];t(i,l,e)&&(n.push(i),a.push(l))}return Rl(e,a),n},An.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Fl(e,t=void 0===t?t:lr(t))},An.reverse=qo,An.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),(Ri(e)?Un:Bl)(e,t)},An.set=function(e,t,n){return null==e?e:Ul(e,t,n)},An.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},An.shuffle=function(e){return(Ri(e)?Hn:Wl)(e)},An.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:lr(t),n=void 0===n?l:lr(n)),ql(e,t,n)):[]},An.sortBy=pi,An.sortedUniq=function(e){return e&&e.length?Gl(e):[]},An.sortedUniqBy=function(e,t){return e&&e.length?Gl(e,Ka(t,2)):[]},An.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!Ki(t))&&!(t=Ql(t))&&Mt(e)?ra(qt(e),0,n):e.split(t,n):[]},An.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:an(lr(t),0),Fl(function(n){var l=n[t],a=ra(n,0,t);return l&&st(a,l),et(e,this,a)})},An.tail=function(e){var t=null==e?0:e.length;return t?ql(e,1,t):[]},An.take=function(e,t,n){return e&&e.length?ql(e,0,(t=n||void 0===t?1:lr(t))<0?0:t):[]},An.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t,l):[]},An.takeRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!1,!0):[]},An.takeWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3)):[]},An.tap=function(e,t){return t(e),e},An.throttle=function(e,t,l){var a=!0,o=!0;if("function"!=typeof e)throw new ge(n);return qi(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),Si(e,t,{leading:a,maxWait:t,trailing:o})},An.thru=ni,An.toArray=tr,An.toPairs=Ar,An.toPairsIn=wr,An.toPath=function(e){return Ri(e)?ut(e,No):Zi(e)?[e]:Ea(Do(rr(e)))},An.toPlainObject=ir,An.transform=function(e,t,n){var l=Ri(e),a=l||ki(e)||$i(e);if(t=Ka(t,4),null==n){var o=e&&e.constructor;n=a?l?new o:[]:qi(e)&&Hi(o)?wn(qe(e)):{}}return(a?nt:rl)(e,function(e,l,a){return t(n,e,l,a)}),n},An.unary=function(e){return gi(e,1)},An.union=jo,An.unionBy=zo,An.unionWith=Yo,An.uniq=function(e){return e&&e.length?Xl(e):[]},An.uniqBy=function(e,t){return e&&e.length?Xl(e,Ka(t,2)):[]},An.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xl(e,void 0,t):[]},An.unset=function(e,t){return null==e||Zl(e,t)},An.unzip=Go,An.unzipWith=Ko,An.update=function(e,t,n){return null==e?e:$l(e,t,aa(n))},An.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:$l(e,t,aa(n),l)},An.values=Ir,An.valuesIn=function(e){return null==e?[]:At(e,_r(e))},An.without=Qo,An.words=Hr,An.wrap=function(e,t){return Ni(aa(t),e)},An.xor=Xo,An.xorBy=Zo,An.xorWith=$o,An.zip=Jo,An.zipObject=function(e,t){return na(e||[],t||[],Wn)},An.zipObjectDeep=function(e,t){return na(e||[],t||[],Ul)},An.zipWith=ei,An.entries=Ar,An.entriesIn=wr,An.extend=sr,An.extendWith=cr,Xr(An,An),An.add=ru,An.attempt=Vr,An.camelCase=xr,An.capitalize=Lr,An.ceil=uu,An.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),Kn(or(e),t,n)},An.clone=function(e){return Qn(e,4)},An.cloneDeep=function(e){return Qn(e,5)},An.cloneDeepWith=function(e,t){return Qn(e,5,t="function"==typeof t?t:void 0)},An.cloneWith=function(e,t){return Qn(e,4,t="function"==typeof t?t:void 0)},An.conformsTo=function(e,t){return null==t||Xn(e,t,Sr(t))},An.deburr=Or,An.defaultTo=function(e,t){return null==e||e!=e?t:e},An.divide=su,An.endsWith=function(e,t,n){e=rr(e),t=Ql(t);var l=e.length,a=n=void 0===n?l:Kn(lr(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},An.eq=Ii,An.escape=function(e){return(e=rr(e))&&F.test(e)?e.replace(P,Rt):e},An.escapeRegExp=function(e){return(e=rr(e))&&j.test(e)?e.replace(q,"\\$&"):e},An.every=function(e,t,n){var l=Ri(e)?at:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},An.find=oi,An.findIndex=Oo,An.findKey=function(e,t){return pt(e,Ka(t,3),rl)},An.findLast=ii,An.findLastIndex=Ro,An.findLastKey=function(e,t){return pt(e,Ka(t,3),ul)},An.floor=cu,An.forEach=ri,An.forEachRight=ui,An.forIn=function(e,t){return null==e?e:ol(e,Ka(t,3),_r)},An.forInRight=function(e,t){return null==e?e:il(e,Ka(t,3),_r)},An.forOwn=function(e,t){return e&&rl(e,Ka(t,3))},An.forOwnRight=function(e,t){return e&&ul(e,Ka(t,3))},An.get=Er,An.gt=xi,An.gte=Li,An.has=function(e,t){return null!=e&&to(e,t,pl)},An.hasIn=gr,An.head=Mo,An.identity=Yr,An.includes=function(e,t,n,l){e=Mi(e)?e:Ir(e),n=n&&!l?lr(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Xi(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&gt(e,t,n)>-1},An.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),gt(e,t,a)},An.inRange=function(e,t,n){return t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n){return e>=on(t,n)&&e<an(t,n)}(e=or(e),t,n)},An.invoke=yr,An.isArguments=Oi,An.isArray=Ri,An.isArrayBuffer=Pi,An.isArrayLike=Mi,An.isArrayLikeObject=Fi,An.isBoolean=function(e){return!0===e||!1===e||ji(e)&&ml(e)==r},An.isBuffer=ki,An.isDate=Bi,An.isElement=function(e){return ji(e)&&1===e.nodeType&&!Gi(e)},An.isEmpty=function(e){if(null==e)return!0;if(Mi(e)&&(Ri(e)||"string"==typeof e||"function"==typeof e.splice||ki(e)||$i(e)||Oi(e)))return!e.length;var t=eo(e);if(t==m||t==g)return!e.size;if(so(e))return!bl(e).length;for(var n in e)if(_e.call(e,n))return!1;return!0},An.isEqual=function(e,t){return yl(e,t)},An.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?yl(e,t,void 0,n):!!l},An.isError=Ui,An.isFinite=function(e){return"number"==typeof e&&tn(e)},An.isFunction=Hi,An.isInteger=Vi,An.isLength=Wi,An.isMap=zi,An.isMatch=function(e,t){return e===t||Sl(e,t,Xa(t))},An.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sl(e,t,Xa(t),n)},An.isNaN=function(e){return Yi(e)&&e!=+e},An.isNative=function(e){if(uo(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return _l(e)},An.isNil=function(e){return null==e},An.isNull=function(e){return null===e},An.isNumber=Yi,An.isObject=qi,An.isObjectLike=ji,An.isPlainObject=Gi,An.isRegExp=Ki,An.isSafeInteger=function(e){return Vi(e)&&e>=-9007199254740991&&e<=9007199254740991},An.isSet=Qi,An.isString=Xi,An.isSymbol=Zi,An.isTypedArray=$i,An.isUndefined=function(e){return void 0===e},An.isWeakMap=function(e){return ji(e)&&eo(e)==y},An.isWeakSet=function(e){return ji(e)&&"[object WeakSet]"==ml(e)},An.join=function(e,t){return null==e?"":nn.call(e,t)},An.kebabCase=Rr,An.last=Uo,An.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=lr(n))<0?an(l+a,0):on(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):Et(e,ht,a,!0)},An.lowerCase=Pr,An.lowerFirst=Mr,An.lt=Ji,An.lte=er,An.max=function(e){return e&&e.length?nl(e,Yr,vl):void 0},An.maxBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),vl):void 0},An.mean=function(e){return yt(e,Yr)},An.meanBy=function(e,t){return yt(e,Ka(t,2))},An.min=function(e){return e&&e.length?nl(e,Yr,Tl):void 0},An.minBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),Tl):void 0},An.stubArray=au,An.stubFalse=ou,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=du,An.nth=function(e,t){return e&&e.length?Il(e,lr(t)):void 0},An.noConflict=function(){return We._===this&&(We._=Ne),this},An.noop=Zr,An.now=Ei,An.pad=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return xa($t(a),n)+e+xa(Zt(a),n)},An.padEnd=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?e+xa(t-l,n):e},An.padStart=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?xa(t-l,n)+e:e},An.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(rr(e).replace(z,""),t||0)},An.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=nr(e),void 0===t?(t=e,e=0):t=nr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=sn();return on(e+a*(t-e+Be("1e-"+((a+"").length-1))),t)}return Pl(e,t)},An.reduce=function(e,t,n){var l=Ri(e)?ct:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,Jn)},An.reduceRight=function(e,t,n){var l=Ri(e)?dt:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,el)},An.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),Ml(rr(e),t)},An.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},An.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=a,o=n),e=Hi(o)?o.call(e):o}return e},An.round=mu,An.runInContext=e,An.sample=function(e){return(Ri(e)?Bn:kl)(e)},An.size=function(e){if(null==e)return 0;if(Mi(e))return Xi(e)?Wt(e):e.length;var t=eo(e);return t==m||t==g?e.size:bl(e).length},An.snakeCase=Fr,An.some=function(e,t,n){var l=Ri(e)?mt:jl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},An.sortedIndex=function(e,t){return zl(e,t)},An.sortedIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2))},An.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=zl(e,t);if(l<n&&Ii(e[l],t))return l}return-1},An.sortedLastIndex=function(e,t){return zl(e,t,!0)},An.sortedLastIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2),!0)},An.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=zl(e,t,!0)-1;if(Ii(e[n],t))return n}return-1},An.startCase=kr,An.startsWith=function(e,t,n){return e=rr(e),n=null==n?0:Kn(lr(n),0,e.length),t=Ql(t),e.slice(n,n+t.length)==t},An.subtract=vu,An.sum=function(e){return e&&e.length?bt(e,Yr):0},An.sumBy=function(e,t){return e&&e.length?bt(e,Ka(t,2)):0},An.template=function(e,t,n){var l=An.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=rr(e),t=cr({},t,l,Ba);var a,o,i=cr({},t.imports,l.imports,Ba),r=Sr(i),u=At(i,r),s=0,c=t.interpolate||re,d="__p += '",m=pe((t.escape||re).source+"|"+c.source+"|"+(c===U?J:re).source+"|"+(t.evaluate||re).source+"|$","g"),v="//# sourceURL="+(_e.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Pe+"]")+"\n";e.replace(m,function(t,n,l,i,r,u){return l||(l=i),d+=e.slice(s,u).replace(ue,Pt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(o=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),d+="';\n";var p=_e.call(t,"variable")&&t.variable;if(p){if(Z.test(p))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(x,""):d).replace(L,"$1").replace(O,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var E=Vr(function(){return de(r,v+"return "+d).apply(void 0,u)});if(E.source=d,Ui(E))throw E;return E},An.times=function(e,t){if((e=lr(e))<1||e>9007199254740991)return[];var n=4294967295,l=on(e,4294967295);e-=4294967295;for(var a=Tt(l,t=Ka(t));++n<e;)t(n);return a},An.toFinite=nr,An.toInteger=lr,An.toLength=ar,An.toLower=function(e){return rr(e).toLowerCase()},An.toNumber=or,An.toSafeInteger=function(e){return e?Kn(lr(e),-9007199254740991,9007199254740991):0===e?e:0},An.toString=rr,An.toUpper=function(e){return rr(e).toUpperCase()},An.trim=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return Dt(e);if(!e||!(t=Ql(t)))return e;var l=qt(e),a=qt(t);return ra(l,It(l,a),xt(l,a)+1).join("")},An.trimEnd=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.slice(0,jt(e)+1);if(!e||!(t=Ql(t)))return e;var l=qt(e);return ra(l,0,xt(l,qt(t))+1).join("")},An.trimStart=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.replace(z,"");if(!e||!(t=Ql(t)))return e;var l=qt(e);return ra(l,It(l,qt(t))).join("")},An.truncate=function(e,t){var n=30,l="...";if(qi(t)){var a="separator"in t?t.separator:a;n="length"in t?lr(t.length):n,l="omission"in t?Ql(t.omission):l}var o=(e=rr(e)).length;if(Mt(e)){var i=qt(e);o=i.length}if(n>=o)return e;var r=n-Wt(l);if(r<1)return l;var u=i?ra(i,0,r).join(""):e.slice(0,r);if(void 0===a)return u+l;if(i&&(r+=u.length-r),Ki(a)){if(e.slice(r).search(a)){var s,c=u;for(a.global||(a=pe(a.source,rr(ee.exec(a))+"g")),a.lastIndex=0;s=a.exec(c);)var d=s.index;u=u.slice(0,void 0===d?r:d)}}else if(e.indexOf(Ql(a),r)!=r){var m=u.lastIndexOf(a);m>-1&&(u=u.slice(0,m))}return u+l},An.unescape=function(e){return(e=rr(e))&&M.test(e)?e.replace(R,zt):e},An.uniqueId=function(e){var t=++Ce;return rr(e)+t},An.upperCase=Br,An.upperFirst=Ur,An.each=ri,An.eachRight=ui,An.first=Mo,Xr(An,(iu={},rl(An,function(e,t){_e.call(An.prototype,t)||(iu[t]=e)}),iu),{chain:!1}),An.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){An[e].placeholder=An}),nt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:an(lr(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=on(n,l.__takeCount__):l.__views__.push({size:on(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),nt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ka(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),nt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(Yr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return fl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Ti(Ka(e)))},Ln.prototype.slice=function(e,t){e=lr(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=lr(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},rl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=An[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);a&&(An.prototype[t]=function(){var t=this.__wrapped__,i=l?[1]:arguments,r=t instanceof Ln,u=i[0],s=r||Ri(t),c=function(e){var t=a.apply(An,st([e],i));return l&&d?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(r=s=!1);var d=this.__chain__,m=!!this.__actions__.length,v=o&&!d,p=r&&!m;if(!o&&s){t=p?t:new Ln(this);var E=e.apply(t,i);return E.__actions__.push({func:ni,args:[c],thisArg:void 0}),new xn(E,d)}return v&&p?e.apply(this,i):(E=this.thru(c),v?l?E.value()[0]:E.value():E)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=fe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);An.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(Ri(a)?a:[],e)}return this[n](function(n){return t.apply(Ri(n)?n:[],e)})}}),rl(Ln.prototype,function(e,t){var n=An[t];if(n){var l=n.name+"";_e.call(hn,l)||(hn[l]=[]),hn[l].push({name:t,func:n})}}),hn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=Ea(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ea(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ea(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ri(e),l=t<0,a=n?e.length:0,o=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var o=n[l],i=o.size;switch(o.type){case"drop":e+=i;break;case"dropRight":t-=i;break;case"take":t=on(t,e+i);break;case"takeRight":e=an(e,t-i)}}return{start:e,end:t}}(0,a,this.__views__),i=o.start,r=o.end,u=r-i,s=l?r:i-1,c=this.__iteratees__,d=c.length,m=0,v=on(u,this.__takeCount__);if(!n||!l&&a==u&&v==u)return ea(e,this.__actions__);var p=[];e:for(;u--&&m<v;){for(var E=-1,g=e[s+=t];++E<d;){var f=c[E],h=f.type,y=(0,f.iteratee)(g);if(2==h)g=y;else if(!y){if(1==h)continue e;break e}}p[m++]=g}return p},An.prototype.at=li,An.prototype.chain=function(){return ti(this)},An.prototype.commit=function(){return new xn(this.value(),this.__chain__)},An.prototype.next=function(){void 0===this.__values__&&(this.__values__=tr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(e){for(var t,n=this;n instanceof In;){var l=wo(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},An.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:ni,args:[qo],thisArg:void 0}),new xn(t,this.__chain__)}return this.thru(qo)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,_t&&(An.prototype[_t]=function(){return this}),An}();je?((je.exports=Yt)._=Yt,qe._=Yt):We._=Yt}).call(Ut)});function sa(e){let{documents:n,svgStyles:o={},isSendBackFlow:i=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:s}=a.useTranslation(),c=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!c&&(null==n?void 0:n.map((e,a)=>{var o,c,d;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},s(null==n?void 0:n.title)),i?null!=n&&null!==(o=n.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),i?(null!==(c=value)&&void 0!==c&&null!==(d=c.documentType)&&void 0!==d&&d.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),c&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+s(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const ca=e=>{var t,a;let{t:o,formData:i,applicationData:r,docs:u,bpaActionsDetails:s}=e;const c=(null==r?void 0:r.status)||"",d=(null==s||null===(t=s.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,p]=n.useState((null==i||null===(a=i.documents)||void 0===a?void 0:a.documents)||[]),[E,g]=n.useState(null),[f,h]=n.useState([]),[y,S]=n.useState(!0),[_,C]=n.useState(!1),[b,T]=n.useState(!1),{isLoading:D,data:N}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:A,data:w}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var o,i;null!=N&&null!==(e=N.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==N||null===(o=N.BPA)||void 0===o||null===(i=o.DocTypeMapping)||void 0===i?void 0:i.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let s=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==w||null===(t=w["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;o===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),s.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(s)),h(s)},[!D,!A]),n.useEffect(()=>{let e=0;f.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),S("0"!=e&&0!=e||!(v.length>0))},[v,_]),n.useEffect(()=>{T("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[r,s]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==f?void 0:f.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(da,{key:t,index:t,document:e,t:o,error:E,setError:g,setDocuments:p,documents:v,setCheckRequiredFields:C,applicationStatus:c,actions:d,bpaTaxDocuments:f,checkEnablingDocs:b}))))};function da(e){var a,o;let{t:i,document:r,setDocuments:u,documents:s,index:c,bpaTaxDocuments:m,checkEnablingDocs:v}=e;const p=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[g,f]=n.useState(p?d({},p,{active:!0,code:null==p?void 0:p.documentType,i18nKey:null==p?void 0:p.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[h,y]=n.useState(null),[S,_]=n.useState(()=>(null==p?void 0:p.fileStoreId)||null),[C,b]=n.useState([]);return n.useEffect(()=>{null!=g&&g.code&&u(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==g?void 0:g.code));return 0===(null==S?void 0:S.length)||null===S?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==g?void 0:g.code,fileStoreId:S,documentUid:S,fileName:(null==h?void 0:h.name)||"",id:s?null===(t=s.find(e=>e.documentType===(null==g?void 0:g.code)))||void 0===t?void 0:t.id:void 0}]})},[S,g]),n.useEffect(()=>{try{C.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],C.map(e=>{var t,n,l;null!=g&&g.code&&r.newUploadedDocs.push({documentType:null==g?void 0:g.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),m[c]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(m)))}catch(e){Promise.reject(e)}},[C,g]),n.useEffect(()=>{},[h]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+i(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(sa,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),v?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?i(null==r?void 0:r.code)+"* ":""+i(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:i,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:g,optionKey:"i18nKey",select:e=>f(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);0!==Object.keys(n).length&&b(l),function(e){e&&y(e.file)}(l[l.length-1])})(0,e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function ma(e){let{fiReport:n,isCitizen:o=!1}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+i("BPA_FI_REPORT")),n.map((e,a)=>{var o,r,u,s,c,d;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+i("BPA_FI_REPORT"):i("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(o=e.date)||void 0===o?void 0:o.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(u=e.date)||void 0===u?void 0:u.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(s=e.questions)||void 0===s?void 0:s.length)&&(null==e||null===(c=e.questions)||void 0===c?void 0:c.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+i(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(sa,{documents:(d=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==d?void 0:d.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function va(e){let{t:a,document:o,setNocDocuments:i,setError:r,nocDocuments:u}=e;const s=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],c=Digit.ULBService.getStateId(),[d,m]=n.useState(),[p,E]=n.useState(null),[g,f]=n.useState(()=>(null==s?void 0:s.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&i(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==g?void 0:g.length)||null===g?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==g),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:g,documentUid:g,fileName:(null==p?void 0:p.name)||""}]})},[g]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[p]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);!function(e){e&&E(e.file)}(n[n.length-1])})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const pa=e=>{var a;let{t:o,noc:i,docs:r,isNoc:u,applicationData:s,NOCdata:c,bpaActionsDetails:d}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==s?void 0:s.status)||"",p=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[h,y]=n.useState([]),[S,_]=n.useState([]),[C,b]=n.useState(!1),[T,D]=Digit.Hooks.useSessionStorage(null==i?void 0:i.nocType,[]),[N,A]=n.useState(null),w=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;y(null==f||null===(e=f["common-masters"])||void 0===e?void 0:e.DocumentType)},[f]),n.useEffect(()=>{var e,t,n;let l,a=[];var o,r,c,d;l=u?null==E||null===(o=E.NOC)||void 0===o||null===(r=o.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==i?void 0:i.applicationType)&&(null==e?void 0:e.nocType)===(null==i?void 0:i.nocType)):null==g||null===(c=g.BPA)||void 0===c||null===(d=c.DocTypeMapping)||void 0===d?void 0:d.filter(e=>{var t,n;return e.WFState==(null==s?void 0:s.status)&&e.RiskType==(null==s?void 0:s.riskType)&&e.ServiceType==(null==s||null===(t=s.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==s||null===(n=s.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==i?void 0:i.additionalDetails,applicationStatus:null==i?void 0:i.applicationStatus,appNumberLink:null==i?void 0:i.applicationNo,nocNo:null==i?void 0:i.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==h||h.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),_(m))},[E,h]),n.useEffect(()=>{b("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[s,d]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:w?""+o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"):o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),c&&c.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:w?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:w?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(sa,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),C&&(null==S?void 0:S.map((e,t)=>l.createElement(va,{key:t,document:e,t:o,error:N,setError:A,setNocDocuments:D,nocDocuments:T,checkEnablingDocs:C}))))},Ea=e=>{let{permissions:a,t:o}=e;const[i,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[s,c,m]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const v=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==i?void 0:i.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:v?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==i?void 0:i.map((e,t)=>n===t?d({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==s?void 0:s.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{c(()=>null==s?void 0:s.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:v?"96%":"830px",width:v?"96%":"830px"},style:v?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:v?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...s];t.splice(e,1),c([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:v?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{c([...s,{label:""}])}}))};function ga(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:o}=n,{t:i}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:i("ES_PT_TITLE_TAX_HEADS"),text:i("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:i(e.taxHeadCode),label:i(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:i("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function fa(e){let{floors:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function ha(e){let{owners:n}=e,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:i}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},s={position:"relative",padding:"8px"},c={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},s={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u=d({},u,{maxWidth:"950px"}),u=d({},u,{maxWidth:"950px"}),c={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},o.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:u,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?i(null==e?void 0:e.title)+" "+(n+1):i(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:s},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:i(e.title),label:""+i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const ya=e=>{var o,i,r,u,s,c,d,m,p,E,g,f,h,y,S,_,C,b,T,D,N,A,w;let{scrutinyDetails:I,paymentsList:x=[],additionalDetails:L,applicationData:O}=e;const R=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==O?void 0:O.status))&&window.location.href.includes("bpa"),[P,M]=n.useState(),[F,k]=n.useState(),[B,U]=n.useState(),H=Digit.ULBService.getStateId(),[V,W]=n.useState(),[q,j]=n.useState(),[z,Y]=n.useState([]),[G,K]=n.useState(),[Q,X]=n.useState(""),[Z,$]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,oe]=n.useState(!1);n.useEffect(()=>{!function(){try{$(null);const e=function(){if(G&&null!=G&&G.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==G||null===(t=G.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(G.size>=2e6)$(ie("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",G,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?Y([...z,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):$(ie("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else $(ie("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[G]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(z))},[z]),n.useEffect(()=>{var e,t,n,l,a,o,i;if(null!=L&&null!==(e=L.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==L?void 0:L.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==L||null===(n=L.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==L||null===(l=L.lessAdjustmentFeeFiles[(null==L||null===(a=L.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),k(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==L||null===(o=L.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==L||null===(i=L.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),W(null==L?void 0:L.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==L?void 0:L.otherFeesDiscription),Y(null==L?void 0:L.lessAdjustmentFeeFiles)},[L]);const{t:ie}=a.useTranslation(),re=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},ie(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?ie(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void ie("NA");return l.createElement(n.Fragment,null,!(null!=I&&I.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==I||null===(o=I.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+ie(""+e.title),text:null!=e&&e.value?re(e)+" "+ie(null==e?void 0:e.isUnit):ie("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+ie(""+e.title),text:re(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},ie(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},ie(null==e?void 0:e.title))),null==I||null===(i=I.permit)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==I||null===(r=I.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!0)}},ie("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!1)}},ie("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,ie("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:ie("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==L?void 0:L.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:ie("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==L?void 0:L.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==I||null===(u=I.values[0])||void 0===u?void 0:u.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},ie("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},ie("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,ie("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==L||null===(s=L.selfCertificationCharges)||void 0===s?void 0:s.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==L||null===(c=L.selfCertificationCharges)||void 0===c?void 0:c.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==L||null===(d=L.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==L||null===(m=L.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,ie("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,ie("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==L||null===(p=L.selfCertificationCharges)||void 0===p?void 0:p.BPA_DEVELOPMENT_CHARGES)||0,value:P,disabled:!R,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,ie("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==L||null===(E=L.selfCertificationCharges)||void 0===E?void 0:E.BPA_OTHER_CHARGES)||0,value:F,disabled:!R,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(k(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:ie,type:"text",name:"otherChargesDiscription",defaultValue:null==L||null===(g=L.selfCertificationCharges)||void 0===g?void 0:g.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:V,disabled:!R,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==L||null===(f=L.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:B,disabled:!R,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(t=L.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(n=L.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==L||null===(l=L.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==L||null===(a=L.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(B)>0&&R?l.createElement("div",null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){j(e.target.files[0]),K(e.target.files[0])},disabled:!R,onDelete:()=>{j(null),K("")},message:q?"1 "+ie("FILEUPLOADED"):ie("ES_NO_FILE_SELECTED_LABEL"),error:Z,uploadMessage:Q})):null,(null==J||null===(h=J.fileStoreIds)||void 0===h?void 0:h.length)&&parseInt(null==L||null===(y=L.selfCertificationCharges)||void 0===y?void 0:y.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},ie("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(S=J.fileStoreIds)||void 0===S?void 0:S.length)&&parseInt(null==L||null===(_=L.selfCertificationCharges)||void 0===_?void 0:_.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(C=J.fileStoreIds[(null==J||null===(b=J.fileStoreIds)||void 0===b?void 0:b.length)-1])||void 0===C?void 0:C.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==L||null===(T=L.selfCertificationCharges)||void 0===T?void 0:T.BPA_MALBA_CHARGES)+parseFloat(null==L||null===(D=L.selfCertificationCharges)||void 0===D?void 0:D.BPA_LABOUR_CESS)+parseFloat(null==L||null===(N=L.selfCertificationCharges)||void 0===N?void 0:N.BPA_WATER_CHARGES)+parseFloat(null==L||null===(A=L.selfCertificationCharges)||void 0===A?void 0:A.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(B)?parseFloat(B):0))}))),l.createElement("div",null,null==I||null===(w=I.scruntinyDetails)||void 0===w?void 0:w.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+ie(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},ie(null==e?void 0:e.text))))))))},Sa=e=>{var o,i,r,u,s;let{edcrDetails:c,applicationData:d}=e;const{t:m}=a.useTranslation(),v=window.Digit.Utils.browser.isMobile(),p=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},g=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function f(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,o,i,r;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:Number(null===(a=e.occupancies)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.builtUpArea).toFixed(2),FloorArea:Number(null===(i=e.occupancies)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.floorArea).toFixed(2)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function h(e){var t;let n=null==d||null===(t=d.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,o;let t=null===(a=n[e])||void 0===a||null===(o=a.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==c||null===(o=c.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==c||null===(i=c.subOccupancyTableDetails)||void 0===i||null===(r=i[0])||void 0===r||null===(u=r.value)||void 0===u||null===(s=u.planDetail)||void 0===s?void 0:s.blocks.map((e,n)=>{var a,o,i,r,u;return l.createElement("div",{key:n,style:(null==c||null===(a=c.subOccupancyTableDetails)||void 0===a||null===(o=a[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.planDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:f(e),columns:g,getCellProps:e=>({style:{}})})))})))},_a=e=>{let{headComment:t,otherComment:n}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,t),l.createElement("p",null,n))},Ca=e=>{var o,i,r;let{data:u,OpenImage:s,privacy:c={}}=e;const[d,m]=n.useState(!1),{t:v}=a.useTranslation();return l.createElement("div",null,u.date&&l.createElement("p",null,u.date),l.createElement("p",null,u.name),u.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:u.mobileNumber,privacy:c}),l.createElement("p",null,"    ")),u.source&&l.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+u.source.toUpperCase())),u.comment&&l.createElement(_a,{otherComment:null==u?void 0:u.otherComment,headComment:null==u?void 0:u.comment}),null!=u&&u.wfComment?l.createElement("div",null,null==u||null===(o=u.wfComment)||void 0===o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("WF_COMMON_COMMENTS")),!d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==u||null===(i=u.thumbnailsToShow)||void 0===i||null===(r=i.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==u?void 0:u.thumbnailsToShow.thumbs,onClick:(e,t)=>{s(e,t,null==u?void 0:u.thumbnailsToShow)}})):null)};function ba(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function Ta(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const Da=e=>{var o,i,r,u,s;let{wsAdditionalDetails:c}=e;const{t:d}=a.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:g,roadCuttingDetails:f,roadCuttingAddlDetails:h,activationDetails:y}=(null==c?void 0:c.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==c||null===(o=c.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(i=c.additionalDetails)||void 0===i?void 0:i.plumberDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==g?void 0:g.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==c||null===(r=c.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==f?void 0:f.map(e=>{var n;return l.createElement("div",{style:(null==f?void 0:f.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==c||null===(u=c.additionalDetails)||void 0===u?void 0:u.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==h?void 0:h.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(s=c.additionalDetails)||void 0===s?void 0:s.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==y?void 0:y.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},Na=[{title:"PT_PENDING_DUES_FROM_EARLIER",value:"Pending dues from earlier"},{title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT",value:"Miscalculation of earlier Assessment"},{title:"PT_ONE_TIME_PENALITY",value:"One time penality"},{title:"PT_OTHERS",value:"Others"}],Aa=[{title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER",value:"Advanced Paid By Citizen Earlier"},{title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO",value:"Rebate provided by commissioner/EO"},{title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN",value:"Additional amount charged from the citizen"},{title:"PT_OTHERS",value:"Others"}],wa=e=>{var o,i,r,u;let{wsAdditionalDetails:s}=e;const{t:c}=a.useTranslation(),[m,v,p]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,g,f]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==s||null===(o=s.additionalDetails)||void 0===o||!o.isPaid),[y,S]=n.useState(!1),[C,b]=n.useState(m||{}),[T,D]=n.useState(null),[N,A]=n.useState(s.additionalDetails.data?s.additionalDetails.data:{}),[w,I]=n.useState(s.additionalDetails.values?s.additionalDetails.values:[]),x=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(x,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=d({},null==s||null===(e=s.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==m||null===(n=m.billDetails)||void 0===n?void 0:n.length)>0){var o,i,r,u,c,p,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(o=m.billDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(r=m.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==m||null===(c=m.billDetails)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.taxAmount)}];I(e),A(null==m||null===(E=m.billDetails)||void 0===E?void 0:E[0])}else v(a),b(a)},[]);let L={};const O=e=>l.createElement("h1",{className:"heading-m"},e.label),R=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(R,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=d({},C);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,o;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}b(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},w&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==w?void 0:w.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+c("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==N?void 0:N.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=s&&null!==(i=s.additionalDetails)&&void 0!==i&&i.isAdhocRebate?l.createElement("div",{onClick:e=>{S(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,y&&l.createElement(t.Modal,{headerBarMain:l.createElement(O,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{b(m),S(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{b(m),S(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=C&&C.adhocPenalty?Number(null==C?void 0:C.adhocPenalty):0,n=null!=C&&C.adhocRebate?Number(null==C?void 0:C.adhocRebate):0;var l,a;if(t||n)if(n>(null==s||null===(l=s.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))D({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,i,r,u,m,p,E,f,h,y;const e=null==s||null===(o=s.additionalDetails)||void 0===o||null===(i=o.appDetails)||void 0===i?void 0:i.applicationNo,t=null==s||null===(r=s.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,n=d({},null==s||null===(m=s.additionalDetails)||void 0===m||null===(p=m.appDetails)||void 0===p?void 0:p.additionalDetails,C);s.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==s||null===(E=s.additionalDetails)||void 0===E||null===(f=E.appDetails)||void 0===f?void 0:f.service)?[{applicationNo:e,tenantId:t,waterConnection:s.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:s.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==s||null===(h=s.additionalDetails)||void 0===h||null===(y=h.appDetails)||void 0===y?void 0:y.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,o,i,r,u,s,c,d,m,p,E,f,h;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(f=E[0])||void 0===f||null===(h=f.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.taxHeadEstimates,"category");const y=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(s=e.Calculation)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.charge},{title:"WS_TAX_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.taxAmount}];g(Ml(e.Calculation[0])),A(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),I(y),C.billDetails=null==e?void 0:e.Calculation,v(C),S(!1)}).catch(e=>{var t,n,l,a,o,i;D({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?c(""+(null==e||null===(a=e.response)||void 0===a||null===(o=a.data)||void 0===o||null===(i=o.Errors[0])||void 0===i?void 0:i.code)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:c("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Na,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==C?void 0:C.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==C||null===(r=C.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==C?void 0:C.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==C?void 0:C.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_REBATE")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Aa,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==C?void 0:C.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==C||null===(u=C.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==C?void 0:C.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==C?void 0:C.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),T&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==T?void 0:T.isWarning,error:null==T||!T.isWarning,label:c(null==T?void 0:T.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},Ia=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:d({},t),display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},xa=e=>{let{t:n,userType:a=!1,infoBannerLabel:o="",infoClickLable:i="",infoClickInfoLabel:r="",infoClickInfoLabel1:u=""}=e;a=a||Digit.SessionStorage.get("userType");const s=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:s?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(o))),n(i)+" ",l.createElement(Ia,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(u)))))},La=e=>{var o,i,r,u,s,c,d;let{wsAdditionalDetails:m}=e;const{t:v}=a.useTranslation(),[p,E]=n.useState(!1),[g,f]=n.useState({}),h=e=>l.createElement("h1",{className:"heading-m"},e.label),y=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),S=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(y,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),f(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&l.createElement(t.Modal,{headerBarMain:l.createElement(h,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(S,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==g||null===(i=g.billSlabData)||void 0===i||null===(r=i.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==g||null===(u=g.billSlabData)||void 0===u||null===(s=u.CHARGES)||void 0===s?void 0:s.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==g||null===(c=g.billSlabData)||void 0===c||null===(d=c.TAX)||void 0===d?void 0:d.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},Oa={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},Ra=e=>{let{className:t="table",headers:n=[],values:o=[],arrears:i=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:Oa.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:Oa.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:d({},Oa.cell,Oa.cellLeft,Oa.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:d({},Oa.cell,n.length==t+1?Oa.cellRight:{},Oa.cellHeader),key:t},r(e))))),l.createElement("tbody",null,Object.values(o).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:d({},Oa.cell,Oa.cellLeft),component:"th",scope:"row"},Object.keys(o)[t]),n.map((t,a)=>l.createElement("td",{style:d({},Oa.cell,{textAlign:"left"},n.length==a+1?Oa.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:d({},Oa.cell,Oa.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:d({},Oa.cell,Oa.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},i):t==n.length-2?l.createElement("td",{style:d({},Oa.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:Oa.cell,key:t,numeric:!0})))))))},Pa={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},Ma=e=>{var t,o,i;let{bill:r={}}=e;const{t:u}=a.useTranslation();let s={},c=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];c=[...c];const d=(null===(o=c)||void 0===o?void 0:o.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==d||null===(i=d.toFixed)||void 0===i?void 0:i.call(d,0))||Number(0).toFixed(0));c.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:o=[]}=e;return o.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);s[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?"FY"+(n.getYear()+1900)+"-"+(l.getYear()-100):n.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=t});let v={};!s||Object.keys(s).map((e,t)=>{Object.keys(s[e]).map(t=>{v[t]=s[e]&&s[e][t]&&s[e][t].order||0})});let p=[];p=Object.keys(v),p.sort((e,t)=>v[e]-v[t]);const[E,g]=n.useState(!1);return 0==d||d<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:Pa.headerStyle},u("CS_ARREARS_DETAILS")),E&&l.createElement(Ra,{headers:[...p],values:s,arrears:m}),!E&&l.createElement("div",{style:Pa.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{g(!0)}},u("CS_SHOW_CARD"))),E&&l.createElement("div",{style:Pa.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{g(!1)}},u("CS_HIDE_CARD"))))},Fa=e=>{let{assessmentData:t}=e;const[a,o]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{o(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,n)=>l.createElement("div",{key:n,className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),l.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),l.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},l.createElement("div",{style:{display:"flex",gap:"75px"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),l.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}},"          ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess"),"          ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel"),"        ")),n!==t.length-1&&l.createElement("hr",null)))))};function ka(e){var i,r,u,s,c,m,v,p,E,g,f,h,y,S,C,b;let{applicationDetails:T,demandData:D,workflowDetails:N,isDataLoading:A,applicationData:w,businessService:I,timelineStatusPrefix:x,showTimeLine:L=!0,statusAttribute:O="status",paymentsList:R,oldValue:P,isInfoLabel:M=!1,propertyId:F,moduleCode:k}=e;const{t:B}=a.useTranslation(),U=o.useHistory(),H=Digit.ULBService.getCurrentTenantId(),[V,W]=n.useState(null),[q,j]=n.useState([]);let z=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function Y(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",T);const[G,K]=n.useState({}),[Q,X]=n.useState(),[Z,$]=n.useState([]),[J,ee]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==w?void 0:w.status)||J.loading||J.loaded||J.canLoad||ee({loading:!1,loaded:!1,canLoad:!0}),null==J||!J.canLoad||J.loading||J.loaded||(ee({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function o(){n(i),l({loading:!1,loaded:!0,canLoad:!0})}let i={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0){const n=a.Assessments.filter(e=>"ACTIVE"===e.status),l=new Map;n.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,n=l.get(t);(!n||e.createdDate>n.createdDate)&&l.set(t,e)}),console.log("grouped",l);const o=Array.from(l.values());return $(o),console.log(o),X(null==a?void 0:a.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){i=e})}}();return r&&r.then?r.then(o):o()})}catch(e){return Promise.reject(e)}}((null==w?void 0:w.tenantId)||H,null==w?void 0:w.propertyId,K,ee));const te=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+t.getFullYear()},ne=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:te(null==w||null===(a=w.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==w?void 0:w.channel)||""};return l.createElement(Ca,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,i,r,u,s;const a={uuid:null==e||null===(o=e.assignes)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==T?void 0:T.tenantId,businessIds:null==T?void 0:T.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber"),n}}},c=n[t-1],d={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.name,comment:B(null==e?void 0:e.comment),wfComment:c?c.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(Ca,{data:d,OpenImage:Y,privacy:a})}{var c,d,m,v,p;const t={date:te(null==w||null===(c=w.auditDetails)||void 0===c?void 0:c.lastModifiedTime),name:null==e||null===(d=e.assignes)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(v=e.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.mobileNumber};return l.createElement(Ca,{data:t})}},le=(e,t)=>e?t?e:B(e):B("NA"),ae=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),oe=window.location.href.includes("employee/noc"),ie=window.location.href.includes("employee/obps"),re=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ae?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),ue=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?le(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+B(null==e?void 0:e.isUnit):B("N/A"):null!=e&&e.value?le(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):B("N/A"),[se,ce]=n.useState(!1);console.log("demand Data arr",D),null==D||D.reduce((e,t)=>e+t.demandInterest,0),null==D||D.reduce((e,t)=>e+t.demandPenality,0),null==D||D.reduce((e,t)=>e+t.collectionTax,0),null==D||D.reduce((e,t)=>e+t.collectionInterest,0),null==D||D.reduce((e,t)=>e+t.collectionPenality,0),null==D||D.reduce((e,t)=>e+t.balanceTax,0),null==D||D.reduce((e,t)=>e+t.balanceInterest,0),null==D||D.reduce((e,t)=>e+t.balancePenality,0);const de=function(e,t,n){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const l=d({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:d({},e.additionalDetails,{propertytobestatus:t}),workflow:d({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:d({},l)},H,n)).then(function(e){console.log("response from inactive/active",e)})}catch(e){return Promise.reject(e)}},me=null==T?void 0:T.applicationData,ve=(null==T||null===(i=T.applicationData)||void 0===i?void 0:i.propertyId)||"",pe=null==T||null===(r=T.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return console.log("applicationDetails?.applicationDetails",T,I),console.log("infolabel",M),console.log("assessment details",Q),n.useEffect(()=>{try{let e={consumerCodes:F};const t=!0;"BPREG"===k?Digit.OBPSService.paymentsearch({tenantId:H,filters:e,auth:t}).then(e=>{j(null==e?void 0:e.Payments),console.log(e)}):Digit.PTService.paymentsearch({tenantId:H,filters:e,auth:t}).then(e=>{j(null==e?void 0:e.Payments),console.log(e)})}catch(e){console.log(e)}},[]),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},M?l.createElement(xa,{t:B,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==T||null===(u=T.applicationDetails)||void 0===u?void 0:u.map((e,a)=>{var i,r,u,s,c,d,m,v,p,E,g,f,h,y,S,_,C,b,D,A,w,I,x,L,O,M,F,k,U,H,V,W,q,j,Y,K,Q,X;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:ae?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&ae?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},oe?""+B(e.title):B(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},B(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},B(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},B(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},B(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ae?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i,r,u;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:B(n.title),label:B(n.title),text:l.createElement("img",{src:B(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:B(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},B(null==n?void 0:n.title)))):oe||ie?""+B(n.title):B(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:re(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+B(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:B(n.title),label:B(n.title),text:ue(n),last:a===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:re(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(Ma,{bill:null===(r=G.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(ya,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:R,additionalDetails:null==T||null===(u=T.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==T?void 0:T.applicationData}),(null==T||null===(s=T.applicationData)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(d=c.fieldinspection_pending)||void 0===d?void 0:d.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(ma,{fiReport:null==T||null===(v=T.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(fa,{floors:null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&l.createElement(ha,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units)&&l.createElement(Ta,{units:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.units}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.accessories)&&l.createElement(ba,{units:null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.accessories}),!z&&(null==e||null===(b=e.additionalDetails)||void 0===b?void 0:b.permissions)&&(null==N||null===(D=N.data)||void 0===D||null===(A=D.nextActions)||void 0===A?void 0:A.length)>0&&l.createElement(Ea,{applicationData:null==T?void 0:T.applicationData,t:B,permissions:null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.permissions}),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(ca,{t:B,applicationData:null==T?void 0:T.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:N})),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.noc)&&l.createElement(pa,{t:B,isNoc:!0,NOCdata:e.values,applicationData:null==T?void 0:T.applicationData,docs:e.additionalDetails.noc,noc:null===(L=e.additionalDetails)||void 0===L?void 0:L.data,bpaActionsDetails:N}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.scruntinyDetails)&&l.createElement(ya,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.buildingExtractionDetails)&&l.createElement(ya,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.subOccupancyTableDetails)&&l.createElement(Sa,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==T?void 0:T.applicationData}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.documentsWithUrl)&&l.createElement(sa,{documents:null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.documentsWithUrl}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.taxHeadEstimatesCalculation)&&l.createElement(ga,{taxHeadEstimatesCalculation:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(Da,{wsAdditionalDetails:e,oldValue:P}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(o.Link,{to:null==e||null===(q=e.additionalDetails)||void 0===q||null===(j=q.redirectUrl)||void 0===j?void 0:j.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(Y=e.additionalDetails)||void 0===Y||null===(K=Y.redirectUrl)||void 0===K?void 0:K.title))),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.estimationDetails)&&l.createElement(wa,{wsAdditionalDetails:e,workflowDetails:N}),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.estimationDetails)&&l.createElement(La,{wsAdditionalDetails:e,workflowDetails:N}))}),(null==Q?void 0:Q.length)>0&&l.createElement(Fa,{assessmentData:Z}),L&&(null==N||null===(s=N.data)||void 0===s||null===(c=s.timeline)||void 0===c?void 0:c.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==N?void 0:N.isLoading)||A)&&l.createElement(t.Loader,null),!(null!=N&&N.isLoading)&&!A&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},B("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=N&&null!==(m=N.data)&&void 0!==m&&m.timeline&&1===(null==N||null===(v=N.data)||void 0===v||null===(p=v.timeline)||void 0===p?void 0:p.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:B(""+x+(null==N||null===(E=N.data)||void 0===E||null===(g=E.timeline[0])||void 0===g?void 0:g.state)),customChild:ne(null==N||null===(f=N.data)||void 0===f?void 0:f.timeline[0],null==N||null===(h=N.data)||void 0===h?void 0:h.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==N||null===(y=N.data)||void 0===y?void 0:y.timeline)&&(null==N||null===(S=N.data)||void 0===S?void 0:S.timeline.slice(0,se?null==N?void 0:N.data.timeline.length:2).map((e,n,a)=>{var o;let i="";var r,u,s,c,d,m;return window.location.href.includes("/obps/")&&(i=null!=N&&null!==(r=N.data)&&void 0!==r&&null!==(u=r.timeline[n-1])&&void 0!==u&&null!==(s=u.state)&&void 0!==s&&s.includes("BACK_FROM")||null!=N&&null!==(c=N.data)&&void 0!==c&&null!==(d=c.timeline[n-1])&&void 0!==d&&null!==(m=d.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:B(""+x+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[O])+i),customChild:ne(e,n,null==N||null===(o=N.data)||void 0===o?void 0:o.timeline)}))}))),(null==N||null===(C=N.data)||void 0===C||null===(b=C.timeline)||void 0===b?void 0:b.length)>2&&l.createElement(t.LinkButton,{label:B(se?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ce(e=>!e)}})))),window.location.href.includes("/pt/")?l.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},l.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==pe?de(me,"ACTIVE",ve):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==pe?de(me,"INACTIVE",ve):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==T||null===(e=T.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var n,l,a;if("INACTIVE"===(null==T||null===(n=T.applicationData)||void 0===n?void 0:n.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==T||null===(l=T.applicationData)||void 0===l?void 0:l.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==T||null===(a=T.applicationData)||void 0===a?void 0:a.status)&&U.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var o,i,r;if("INACTIVE"===(null==T||null===(o=T.applicationData)||void 0===o?void 0:o.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==T||null===(i=T.applicationData)||void 0===i?void 0:i.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==T||null===(r=T.applicationData)||void 0===r?void 0:r.status)&&U.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),l.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):l.createElement("div",null),V&&l.createElement(t.Toast,{error:V.isError,label:B(V.label),onClose:()=>{W(null)},isDleteBtn:"false"}))}function Ba(e){var n,a,o,i,r,u,s,c,d,m,v,p,E,g,f,h,y,S;let{t:_,showToast:C,closeToast:b,businessService:T}=e;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var D;let e="";switch(null==C||null===(D=C.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==C?void 0:C.key)?null==C||null===(n=C.error)||void 0===n?void 0:n.message:_("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==C?void 0:C.key)?null==C||null===(a=C.error)||void 0===a?void 0:a.message:_("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==C?void 0:C.key)?null==C||null===(o=C.error)||void 0===o?void 0:o.message:_("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==C?void 0:C.key)?null==C||null===(i=C.error)||void 0===i?void 0:i.message:_("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==C?void 0:C.key)?null==C||null===(r=C.error)||void 0===r?void 0:r.message:_("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==C?void 0:C.key)?null==C||null===(u=C.error)||void 0===u?void 0:u.message:_("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==C?void 0:C.key)?null==C||null===(s=C.error)||void 0===s?void 0:s.message:_("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==C?void 0:C.key)?null==C||null===(c=C.error)||void 0===c?void 0:c.message:_("ES_"+T+"_"+(null==C||null===(d=C.action)||void 0===d?void 0:d.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:e,onClose:b}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var N;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=T&&T.includes("BPA_OC")?_(e[1]):_(e[0]),n};let n="";switch(null==C||null===(N=C.action)||void 0===N?void 0:N.action){case"REVOCATE":n="error"===(null==C?void 0:C.key)?null==C||null===(m=C.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==C?void 0:C.key)?null==C||null===(v=C.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==C?void 0:C.key)?null==C||null===(p=C.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==C?void 0:C.key)?null==C||null===(E=C.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==C?void 0:C.key)?null==C||null===(g=C.error)||void 0===g?void 0:g.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==C?void 0:C.key)?null==C||null===(f=C.error)||void 0===f?void 0:f.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==C?void 0:C.key)?null==C||null===(h=C.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==C?void 0:C.key)?null==C||null===(y=C.error)||void 0===y?void 0:y.message:_("ES_"+T+"_"+(null==C||null===(S=C.action)||void 0===S?void 0:S.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:n,onClose:b}))}{var A,w;const e="error"===(null==C?void 0:C.key)?null==C||null===(A=C.error)||void 0===A?void 0:A.message:"ES_"+T+"_"+(null==C||null===(w=C.action)||void 0===w?void 0:w.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,C&&l.createElement(t.Toast,{error:"error"===C.key,label:_(e),onClose:b}))}}function Ua(e){var o,i,r,u,s,c,m,v,p,E,g,f,h,y,S,_;let{workflowDetails:C,displayMenu:b,onActionSelect:T,setDisplayMenu:D,businessService:N,forcedActionPrefix:A,ActionBarStyle:w={},MenuStyle:I={}}=e;const{t:x}=a.useTranslation();let L=Digit.UserService.getUser();const O=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};L=null==t?void 0:t.value}const R=null===(o=L)||void 0===o||null===(i=o.info)||void 0===i||null===(r=i.roles)||void 0===r?void 0:r.map(e=>e.code);let P=!1,M=!1,F=(null==C||null===(u=C.data)||void 0===u||null===(s=u.actionState)||void 0===s||null===(c=s.nextActions)||void 0===c?void 0:c.filter(e=>(null==R?void 0:R.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==C||null===(m=C.data)||void 0===m||null===(v=m.nextActions)||void 0===v?void 0:v.filter(e=>(null==R?void 0:R.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return console.log("ActionsInPayment",C),Digit.Hooks.useClickOutside(O,()=>{D(!1)},b),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(p=F[0])&&void 0!==p&&null!==(E=p.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(M=!1,P=!0):(null==F?void 0:F.length)>0&&(M=!0,P=!1),l.createElement(l.Fragment,null,!(null!=C&&C.isLoading)&&M&&!P&&l.createElement(t.ActionBar,{style:d({},w)},b&&(null!=C&&null!==(g=C.data)&&void 0!==g&&null!==(f=g.actionState)&&void 0!==f&&f.nextActions||null!=C&&null!==(h=C.data)&&void 0!==h&&h.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:A||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()),options:F,optionKey:"action",t:x,onSelect:T,style:I}):null,l.createElement(t.SubmitBar,{ref:O,label:x("WF_TAKE_ACTION"),onSubmit:()=>D(!b)})),!(null!=C&&C.isLoading)&&!M&&P&&l.createElement(t.ActionBar,{style:d({},w)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(y=F[0])||void 0===y?void 0:y.action,value:null==F||null===(S=F[0])||void 0===S?void 0:S.action,onClick:e=>{T((null==F?void 0:F[0])||{})}},x((A||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()))+"_"+(null==F||null===(_=F[0])||void 0===_?void 0:_.action)))))}const Ha=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Va=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ha,null));function Wa(e){let{action:n,closeWarningPopup:o}=e;const{t:i}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},i("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Va,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,i("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",i("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+i("PT_AMOUNT_DUE"),text:"₹"+i(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:i("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:i("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const qa=e=>{var i,u;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const c=Digit.ULBService.getCurrentTenantId(),m=Digit.ULBService.getStateId(),{data:p}=Digit.Hooks.obps.useMDMS(m,"BPA",["BlockReason"]),{t:E}=a.useTranslation(),g=o.useHistory();let{id:f}=o.useParams();const[h,y]=n.useState(!1),[S,_]=n.useState(null),[C,b]=n.useState(!1),[T,D]=n.useState(!1),[N,A]=n.useState(!1),{data:w}=Digit.Hooks.obps.useMDMS(m,"BPA",["RiskTypeComputation"]),{applicationDetails:I,demandData:x,totalDemandTax:L,totalBalanceTax:O,showToast:R,setShowToast:P,isLoading:M,isDataLoading:F,applicationData:k,mutate:B,nocMutation:U,workflowDetails:H,id:V,businessService:W,closeToast:q,moduleCode:j,timelineStatusPrefix:z,forcedActionPrefix:Y,statusAttribute:G,ActionBarStyle:K,MenuStyle:Q,paymentsList:X,showTimeLine:Z=!0,oldValue:$,isInfoLabel:J=!1,clearDataDetails:ee,propertyId:te}=e;n.useEffect(()=>{R&&H.revalidate()},[R]);const ne=r.useQueryClient(),le=()=>{_(null),b(!1)};return console.log("ActionsInPayment2",H),M||T?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,M?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(ka,{applicationDetails:I,demandData:x,id:V,workflowDetails:H,isDataLoading:F,applicationData:k,totalDemandTax:L,totalBalanceTax:O,businessService:W,timelineStatusPrefix:z,statusAttribute:G,paymentsList:X,showTimeLine:Z,oldValue:$,isInfoLabel:J,propertyId:te,moduleCode:j}),C?l.createElement(ra,{t:E,action:S,tenantId:c,state:m,id:f,applicationDetails:I,applicationData:null==I?void 0:I.applicationData,closeModal:le,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,o,i,r,u,s,c,m,p,f,h,y,_,C,b,T,N,A){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(o=a.workflow)||void 0===o||null===(i=o.comment)||void 0===i?void 0:i.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.action)?0==(null==e||null===(s=e.Licenses)||void 0===s||null===(c=s[0])||void 0===c||null===(m=c.additionalDetail)||void 0===m||null===(p=m.validityYears)||void 0===p?void 0:p.length):0==(null==e||null===(f=e.Licenses)||void 0===f||null===(h=f[0])||void 0===h||null===(y=h.comment)||void 0===y?void 0:y.length))||0==(null==e||null===(_=e.WaterConnection)||void 0===_||null===(C=_.comment)||void 0===C?void 0:C.length)||0==(null==e||null===(b=e.SewerageConnection)||void 0===b||null===(T=b.comment)||void 0===T?void 0:T.length)||0==(null==e||null===(N=e.BPA)||void 0===N||null===(A=N.comment)||void 0===A?void 0:A.length)){var w,I;"INITIATE"===(null==e||null===(w=e.Licenses)||void 0===w||null===(I=w[0])||void 0===I?void 0:I.action)?alert(E("Please fill in the validity before submitting")):alert(E("Please fill in the comments before submitting"))}else{const a=function(a,o,i,r,u){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(o=e.BPA)&&void 0!==o&&null!==(i=o.additionalDetails)&&void 0!==i&&i.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(u=r.workflow)||void 0===u?void 0:u.action)){function s(t){if(l)return t;B&&(D(!0),B(e,{onError:(e,t)=>{D(!1),P({key:"error",error:e}),setTimeout(q,5e3)},onSuccess:(e,t)=>{var l,a,o,i,r,u;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),D(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=S,g.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=S,g.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&g.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(i=e.Amendments)||void 0===i?void 0:i.length)>0){var s,c,d,m,v,p,f,h;null!=t&&null!==(s=t.AmendmentUpdate)&&void 0!==s&&null!==(c=s.workflow)&&void 0!==c&&c.action.includes("SEND_BACK")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(p=v.workflow)&&void 0!==p&&p.action.includes("APPROVE")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(f=t.AmendmentUpdate)&&void 0!==f&&null!==(h=f.workflow)&&void 0!==h&&h.action.includes("REJECT")&&P({key:"success",label:E("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var y,_,C;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(u=e.Licenses[0])&&void 0!==u&&u.applicationNumber)return null!=e&&null!==(y=e.Licenses[0])&&void 0!==y&&null!==(_=y.businessService)&&void 0!==_&&_.includes("BPAREG")?(P({key:"success",action:S}),e.selectedAction=S,void g.push("/digit-ui/employee/obps/stakeholder-response",{data:e})):(P({key:"success",action:S}),void g.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(C=e.Licenses[0])||void 0===C?void 0:C.applicationNumber)));P({key:"success",action:S}),ee&&setTimeout(ee,3e3),setTimeout(q,5e3),ne.clear(),ne.refetchQueries("APPLICATION_SEARCH")}}})),le()}D(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(d({},e)));const a=function(){if(!1!==t&&U){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==U?void 0:U.mutateAsync(e)),a=v(function(){return D(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,o,i,r,u,s,c,d,m,v;D(!1);let p=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&o.code?E(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.code):(null==e||null===(c=e.response)||void 0===c||null===(d=c.data)||void 0===d||null===(m=d.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;le(),P({key:"error",error:{message:p}}),setTimeout(q,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(s):s(a)}alert(E("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==H||null===(i=H.data)||void 0===i?void 0:i.timeline,businessService:W,workflowDetails:H,moduleCode:j,blockReason:null==p||null===(u=p.BPA)||void 0===u?void 0:u.BlockReason}):null,N?l.createElement(Wa,{action:S,workflowDetails:H,businessService:W,isWarningPop:N,closeWarningPopup:()=>{A(!1)}}):null,l.createElement(Ba,{t:E,showToast:R,closeToast:q,businessService:W}),l.createElement("div",null,s?l.createElement(t.SubmitBar,{style:{marginRight:20},label:E("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return console.log("JJJJJJ"),Promise.resolve(Digit.OBPSService.BPASearch(c,{applicationNo:null==k?void 0:k.applicationNo})).then(function(e){var t,n,l,a,o,i;const r=Digit.Utils.obps.calculateRiskType(null==w||null===(t=w.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==I||null===(n=I.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==I||null===(o=I.edcrDetails)||void 0===o||null===(i=o.planDetail)||void 0===i?void 0:i.blocks),u={BPA:e.BPA[0]};u.BPA.riskType=r,u.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null},u.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",u.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",u.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc");const s=function(e,t,n,l,a,o,i,r,s,d,m,v){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==u||null===(e=u.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==u||null===(l=u.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null==u||null===(i=u.BPA)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null==u||null===(d=u.BPA)||void 0===d||null===(m=d.additionalDetails)||void 0===m||null===(v=m.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(u,c)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(E("Enterd Less Adjustment amount is invalid"))}();if(s&&s.then)return s.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&l.createElement(Ua,{workflowDetails:H,displayMenu:h,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa"))window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]);else if(null!=e&&e.isWarningPopUp)A(!0);else if(null!=e&&e.redirectionUrll){var a,o,i,r,u;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))g.push(""+(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(u=location)||void 0===u?void 0:u.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.action)){var s,c;g.push(""+(null==e||null===(s=e.redirectionUrll)||void 0===s?void 0:s.pathname),{data:null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.state})}else{var m;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(m=e.redirectionUrll)||void 0===m?void 0:m.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))console.log("Got Inside Direct"),b(!0);else{var v,p;g.push({pathname:null===(v=e.redirectionUrl)||void 0===v?void 0:v.pathname,state:d({},null===(p=e.redirectionUrl)||void 0===p?void 0:p.state)})}else b(!0);_(e),y(!1)},setDisplayMenu:y,businessService:W,forcedActionPrefix:Y,ActionBarStyle:K,MenuStyle:Q}))))},ja=e=>{let{t:t,heading:n}=e;return l.createElement("h1",{className:"heading-m"},""+t(n))},za=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ya=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(za,null)),Ga=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null," ",t("CONFIRM_DELETE_MSG")+" "," ",l.createElement("b",null," "+n)," "))},Ka=e=>{let{t:n,heading:a,docName:o,closeModal:i,actionCancelLabel:r,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return l.createElement(t.Modal,{headerBarMain:l.createElement(ja,{t:n,heading:a}),headerBarEnd:l.createElement(Ya,{onClick:i}),actionCancelLabel:n(r),actionCancelOnSubmit:u,actionSaveLabel:n(s),actionSaveOnSubmit:c,formId:"modal-action"},l.createElement(Ga,{t:n,title:o}))},Qa=["uploadedFilesData"],Xa=["EDIT","DELETE"],Za=()=>{var e,i,r,u,s,c,v,p,E,g,f,h,y,S,_,C,T,D;let N=window.Digit.Utils.browser.isMobile();const{id:A}=o.useParams(),{t:w}=a.useTranslation(),I=o.useHistory(),[x,L]=n.useState(!1),[O,R]=n.useState(!1),P=Digit.ULBService.getCurrentTenantId(),{isLoading:M,data:F}=Digit.Hooks.events.useEventDetails(P,{ids:A},{}),[k,B,U]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[H,V,W]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[q,j,z]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{B(!1),z(),W()},[]),M?l.createElement(t.Loader,null):l.createElement("div",null,x?l.createElement(Ka,{t:w,heading:"CONFIRM_DELETE_PUB_BRCST",docName:null==F||null===(e=F.applicationData)||void 0===e?void 0:e.name,closeModal:()=>L(!x),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){L(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:()=>{const e={events:[d({},m(null==F?void 0:F.applicationData,Qa),{status:"CANCELLED"})]};I.push("/digit-ui/employee/engagement/messages/response?delete=true",e)}}):null,l.createElement(t.Header,null,w("CS_HEADER_PUBLIC_BRDCST")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_ULB_LABEL")+":")," ",l.createElement("p",null,(e=>{var t,n,l;let a=null==e?void 0:e.split(".")[1];return a=""+(null===(t=a)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.toUpperCase())+(null===(l=a)||void 0===l?void 0:l.slice(1))+" ",a})(null==F?void 0:F.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("PUBLIC_BRDCST_TITLE_LABEL")+":")," ",l.createElement("p",null,null==F||null===(i=F.applicationData)||void 0===i?void 0:i.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_COMMENTS_LABEL")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=F&&null!==(r=F.applicationData)&&void 0!==r&&null!==(u=r.description)&&void 0!==u&&u.length?null==F||null===(s=F.applicationData)||void 0===s?void 0:s.description:"NA")," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_FROM_DATE_LABEL")+":")," ",l.createElement("p",null,null!=F&&null!==(c=F.applicationData)&&void 0!==c&&null!==(v=c.eventDetails)&&void 0!==v&&v.fromDate?we(new Date(null==F||null===(p=F.applicationData)||void 0===p||null===(E=p.eventDetails)||void 0===E?void 0:E.fromDate),"dd/MM/yyyy"):null)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_TO_DATE_LABEL")+":")," ",l.createElement("p",null,null!=F&&null!==(g=F.applicationData)&&void 0!==g&&null!==(f=g.eventDetails)&&void 0!==f&&f.toDate?we(new Date(null==F||null===(h=F.applicationData)||void 0===h||null===(y=h.eventDetails)||void 0===y?void 0:y.toDate),"dd/MM/yyyy"):null)," "),l.createElement("span",{className:"documentDetails_subheader"},""+w("CS_COMMON_DOCUMENTS")),null!=F&&null!==(S=F.applicationData)&&void 0!==S&&null!==(_=S.eventDetails)&&void 0!==_&&null!==(C=_.documents)&&void 0!==C&&C.length?(e=>{let n=window.Digit.Utils.browser.isMobile();return e||e.length?l.createElement("div",{style:{display:"flex",flexDirection:n?"column":"row",gap:n?"40px":"100px"}},e.map(e=>{let{fileStoreId:n,fileName:a}=e;return l.createElement("div",{className:"documentDetails_pdf"},l.createElement("div",{style:{width:"100px"},onClick:()=>b(n,a)},l.createElement(t.GenericFileIcon,null),l.createElement("span",{className:"cell-text"},null==a?void 0:a.split(10))))})):null})(null==F||null===(T=F.applicationData)||void 0===T||null===(D=T.eventDetails)||void 0===D?void 0:D.documents):"NA")),l.createElement(t.ActionBar,null,O?l.createElement(t.Menu,{style:{width:N?"full":"240px"},localeKeyPrefix:"ES_CE",options:Xa,t:w,onSelect:function(e){"EDIT"===e&&I.push("/digit-ui/employee/engagement/messages/inbox/edit/"+A),"DELETE"===e&&L(!0),R(!1)}}):null,l.createElement(t.SubmitBar,{label:w("ES_COMMON_TAKE_ACTION"),onSubmit:()=>R(!O)})))},$a=e=>{let{match:{path:n}={},tenants:a,parentRoute:i}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/create",component:e=>l.createElement(ct,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/create",component:e=>l.createElement(ct,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/details/:id",component:e=>l.createElement(Za,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/edit/:id",component:e=>l.createElement(vt,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(ut,d({},e,{tenants:a,parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/response",component:e=>l.createElement(mt,e)}))},Ja=/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats-officedocument)$/i,eo=["header","actions","eventNotificationText","timePastAfterEventCreation","timeApproxiamationInUnits"],to=e=>{let{header:t,actions:n,eventNotificationText:o,timePastAfterEventCreation:i,timeApproxiamationInUnits:r}=e,u=m(e,eo);const{t:s}=a.useTranslation(),c=u.eventDetails.documents;return l.createElement("div",{className:"WhatsNewCard"},l.createElement("h2",null,s(t)),l.createElement("p",null,o),null==n?void 0:n.map(e=>{return l.createElement("a",{href:null==e?void 0:e.actionUrl},""+s("CS_COMMON_"+("number"==typeof(t=null==e?void 0:e.code)?t:t&&t.toUpperCase().replace(/[.:-\s\/]/g,"_"))));var t}),(null==c?void 0:c.length)>1?((e,t)=>t.length?l.createElement("div",{className:"broadcastnotifications_actionswrapper-multi"},t.map((t,n)=>{let{fileName:a,fileStoreId:o}=t;return l.createElement("div",{className:"display-flex-gap-2"},a.length?l.createElement("p",null,a," : "):null,o.length?l.createElement("span",{className:"link",onClick:()=>b(o,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,o.length?l.createElement("span",{className:"link",onClick:()=>D(o)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})):null)(s,c):((e,t)=>{if(null==t||!t.length)return null;const{fileStoreId:n,fileName:a}=null==t?void 0:t[0];return l.createElement("div",{className:"display-flex-gap-2"},n&&n.length?l.createElement("span",{className:"link",onClick:()=>b(n,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,n&&n.length?l.createElement("span",{className:"link",onClick:()=>D(n)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})(s,c),l.createElement("p",null,i+" "+s(r)))},no=e=>l.createElement("h1",{className:"heading-m"},e.label),lo=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ao=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(lo,null)),oo=()=>{const{id:e}=o.useParams(),{t:i}=a.useTranslation(),r=o.useHistory(),[u,s]=n.useState(!1),[c,m]=n.useState(!1),v=Digit.ULBService.getCurrentTenantId(),{isLoading:p,data:E}=Digit.Hooks.events.useEventDetails(v,{ids:e}),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[y,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[C,b,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{f(!1),T(),_()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,i("ES_TITLE_APPLICATION_DETAILS")),l.createElement(qa,{applicationData:null==E?void 0:E.applicationData,applicationDetails:E,isLoading:p,isDataLoading:p}),l.createElement(t.ActionBar,null,c?l.createElement(t.Menu,{localeKeyPrefix:"ES_EVENT",options:["EDIT","DELETE"],t:i,onSelect:function(t){"EDIT"===t&&r.push("/digit-ui/employee/engagement/event/edit-event/"+e),"DELETE"===t&&s(!0),m(!1)}}):null,l.createElement(t.SubmitBar,{label:i("ES_COMMON_TAKE_ACTION"),onSubmit:()=>m(!c)})),u&&l.createElement(t.Modal,{headerBarMain:l.createElement(no,{label:i("ES_EVENT_DELETE_POPUP_HEADER")}),headerBarEnd:l.createElement(ao,{onClick:()=>s(!1)}),actionCancelLabel:i("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>s(!1),actionSaveLabel:i("ES_EVENT_DELETE"),actionSaveOnSubmit:()=>{const e={events:[d({},null==E?void 0:E.applicationData,{status:"CANCELLED"})]};r.push("/digit-ui/employee/engagement/event/response?delete=true",e)}},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement(t.CardText,null,i("ES_EVENT_DELETE_TEXT")))))},io=e=>{let{searchValue:n,onChange:a,handleKeyPress:o,handleSearch:i,t:r}=e;return l.createElement("div",null,l.createElement(t.TextInput,{textInputStyle:{maxWidth:"960px"},className:"searchInput",placeholder:r("CE_SERACH_DOCUMENTS"),value:n,onChange:e=>a(e.target.value),signature:!0,signatureImg:l.createElement(t.SearchIconSvg,{className:"signature-img",onClick:()=>i()}),onKeyPress:o}))},ro=(e,t)=>{const[l,a]=n.useState(e);return n.useEffect(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),l},uo=e=>{let{documentTitle:n,documentSize:a=2.3,lastModifiedData:o,description:i,filestoreId:r,documentLink:u,t:s}=e,c=window.Digit.Utils.browser.isMobile();return l.createElement("div",{className:"notice_and_circular_main"},l.createElement("div",{className:"notice_and_circular_image"},l.createElement(t.GenericFileIcon,{height:""+(c?66:100),width:""+(c?53:100)})),l.createElement("div",{className:"notice_and_circular_content"},l.createElement("div",{className:"notice_and_circular_heading_mb"},l.createElement(t.CardHeader,null,n),a?l.createElement(t.CardCaption,null,N(a)):null),l.createElement("div",{className:"notice_and_circular_caption"},l.createElement(t.CardCaption,null,s("CE_DCOUMENT_UPLOADED_ON")+" "+(o?we(new Date(o),"do MMMM yyyy"):"-"))),l.createElement("div",{className:"notice_and_circular_text"},l.createElement(t.CardText,null,null!=i&&i.length?i:"NA")),l.createElement("div",{className:"view_download_main"},r&&r.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>b(r||null,n)},l.createElement(t.ViewsIcon,null),l.createElement("p",null,s("CE_DOCUMENT_VIEW_LINK")))}):null,u&&u.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>T(u,n)},l.createElement(t.ExternalLinkIcon,null),l.createElement("p",null,s("CE_DOCUMENT_OPEN_LINK")))}):null,r&&r.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views download_views_padding"},l.createElement(t.DownloadImgIcon,null),l.createElement("p",null,s("CE_DOCUMENT_DOWNLOAD_LINK"))),onClick:()=>D(r||null)}):null)))},so=(e,t)=>e.map((e,n)=>{let{name:a,createdTime:o,description:i,documentLink:r,fileSize:u,filestoreId:s}=e;return l.createElement(uo,{key:n,documentTitle:a,documentSize:u,lastModifiedData:o,description:i,documentLink:r,filestoreId:s,t:t})}),co=e=>{let{t:n,title:a,count:o,onClick:i,children:r}=e;const[u,s]=l.useState(!1);return l.createElement("div",{className:"accordion-wrapper",onClick:()=>i(a,o)},l.createElement("div",{className:"accordion-title "+(u?"open":""),onClick:()=>s(!u)},n(a)+" ("+o+")",l.createElement(t.PrevIcon,null)),l.createElement("div",{className:"accordion-item "+(u?"":"collapsed")},l.createElement("div",{className:"accordion-content"},r)))},mo=e=>{var a,i,r,u,s;let{t:c}=e;const d=o.useHistory(),[m,v]=n.useState(""),p=Digit.ULBService.getCitizenCurrentTenant(),E=ro(m,700),{data:g,isLoading:f}=Digit.Hooks.engagement.useDocSearch({name:E,tenantIds:p},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}});if(null===(a=Digit.UserService)||void 0===a||null===(i=a.getUser())||void 0===i||!i.access_token)return l.createElement(Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:location.pathname+location.search}}});const h=(e,t)=>{d.push("documents/list/"+e+"/"+t)};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,c("DOCUMENTS_DOCUMENT_HEADER")),l.createElement("div",{className:"Docs_CardWrapper"},l.createElement(io,{searchValue:m,handleKeyPress:e=>{"Enter"===e.key&&v("")},handleSearch:e=>{v("")},onChange:v,t:c}),l.createElement("hr",{style:{color:"#ccc"}}),f?l.createElement(t.Loader,null):l.createElement("div",{className:"wrapper"},m.length&&null!=g&&null!==(r=g.documentList)&&void 0!==r&&r.length?so(g.documentList,c):null!=g&&g.statusCount&&null!=g&&null!==(u=g.statusCount)&&void 0!==u&&u.length?null==g||null===(s=g.statusCount)||void 0===s?void 0:s.map((e,t)=>{let{category:n,count:a}=e;return l.createElement(co,{t:c,title:n,count:a,key:t,onClick:h})}):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))))},vo=e=>{const{t:n}=a.useTranslation(),{applicationNumber:o,tenantId:i}=Digit.Hooks.useQueryParams(),{data:r,isLoading:u}=Digit.Hooks.engagement.useDocSearch({uuid:o,tenantId:i},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}}),{documentList:s=[]}=r||{},{name:c=!1,createdTime:d,description:m,documentLink:v,fileSize:p,filestoreId:E}=(null==s?void 0:s[0])||{};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,""+n("COMMON_VIEW_DOC")),u&&l.createElement(t.Loader,null),c&&l.createElement(uo,{key:1,documentTitle:c,documentSize:p,lastModifiedData:d,description:m,documentLink:v,filestoreId:E,t:n}),!c&&!u&&l.createElement(t.Card,null,l.createElement(t.CardCaption,null,n("COMMON_DOC_DATA_NOT_FOUND"))))},po=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.mutation.isSuccess?"SURVEY_RESPONSE_SUBMITED":"SURVEY_RESPONSE_FAILED"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Surveys)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.mutation.isSuccess?e.surveyTitle:"",successful:e.mutation.isSuccess,whichSvg:"tick"});var o,i,r,u},Eo=e=>{var i;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useSubmitResponse()),{state:d}=e.location,m=null==d||null===(i=d.AnswerEntity)||void 0===i?void 0:i.surveyTitle;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading&&!c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(po,{t:s,mutation:c,surveyTitle:m}),l.createElement(t.CardText,null,c.isSuccess?s("SURVEY_FORM_RESPONSE_MESSAGE"):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen/engagement/surveys/list"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},go=e=>{var r,u,s;const{userType:c}=e,m=o.useHistory(),{t:v}=a.useTranslation(),p=Digit.UserService.getUser().info;console.log("userinfo",p);const E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS");let g=E.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});const f="employee"===c.toLowerCase()?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY");if(0===(null===(r=g)||void 0===r?void 0:r.length)||"pb.punjab"===f){let e={i18nKey:"TENANT_TENANTS_"+f.replace(".","_").toUpperCase(),code:""+f};g="pb.punjab"===f?[e,...E]:[e]}const[h,y]=n.useState(!1),[S,_]=n.useState(null),[C,b]=n.useState([]),T={city:null===(u=g)||void 0===u?void 0:u[0],offset:0,limit:10,sortOrder:"DESC"},{register:D,control:N,handleSubmit:A,formState:{},watch:w}=i.useForm({defaultValues:T}),I=w(),x=e=>l.createElement("span",{className:"cell-text styled-cell"},e),L=n.useMemo(()=>[{Header:v("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",null,t.original.surveyTitle))}},{Header:v("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?x(we(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:v("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?x(we(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:v("Fill Survey"),accessor:"fillSurvey",Cell:e=>{let{row:n}=e;return l.createElement(t.SubmitBar,{label:v("Start Survey"),onSubmit:()=>{R(n.original)}})}}]);function O(){var e;y(!0);const t={tenantId:null==I||null===(e=I.city)||void 0===e?void 0:e.code,active:!0,openSurveyFlag:!0};Digit.Surveys.searchSurvey(t).then(e=>{let t=e.Surveys.filter(e=>e.active);t=t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),b(t),_(t.length),y(!1)}).catch(e=>{y(!1),console.error("Failed to fetch surveys",e)})}n.useEffect(()=>{O()},[]),console.log("userinfo",p);const R=e=>{console.log("Survey Details: ",e);const t={employee:"/digit-ui/employee/engagement/surveys/fill-citizen-details-survey",citizen:"/digit-ui/citizen/engagement/surveys/fill-survey"}[c.toLowerCase()]||"";m.push({pathname:t,state:{surveyDetails:e,userInfo:p,userType:c}})};return l.createElement("div",null,"pb.punjab"===f&&window.location.href.includes("/employee")?l.createElement(t.Card,{style:{marginTop:"16px",marginBottom:"16px",backgroundColor:"white",maxWidth:"99%"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{fontSize:"20px"}}," Search Surveys ")),l.createElement("hr",{style:{marginTop:"10px"}}),l.createElement("form",{className:"search-form-wrapper rm-mb form-field-flex-one",onSubmit:A(O)},l.createElement(t.SearchField,null,l.createElement("label",null,v("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,d({rules:{required:v("REQUIRED_FIELD")}},D("city"),{render:e=>l.createElement(t.Dropdown,{option:g,optionKey:"i18nKey",selected:null==I?void 0:I.city,select:t=>{e.onChange(t)},t:v}),name:"city",control:N,defaultValue:null===(s=g)||void 0===s?void 0:s[0]}))),l.createElement("div",{className:"form-field",style:{marginTop:"40px"}}," ",l.createElement(t.SubmitBar,{label:"Search",submit:"submit",onSubmit:O})))):null,l.createElement(t.Table,{t:v,data:C,totalRecords:S,columns:L,getCellProps:e=>({style:{minWidth:"300px",padding:"20px 18px",fontSize:"16px"}}),noResultsMessage:"No Questions found",inboxStyles:{overflowX:"scroll",overflowY:"hidden"}}),h&&l.createElement(t.Loader,null))},fo=e=>l.createElement("h1",{className:"heading-m"},e.label),ho=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),yo=e=>l.createElement("div",{onClick:null==e?void 0:e.onClick,style:null!=e&&e.isMobileView?{padding:5,cursor:"pointer"}:{cursor:"pointer"}},null!=e&&e.isMobileView?l.createElement(t.CloseSvg,null):l.createElement("div",{className:"icon-bg-secondary",style:{backgroundColor:"#505A5F"}}," ",l.createElement(ho,null)," ")),So=e=>{let{onSelect:n,onCancel:o,onDismiss:i,heading:r,actionCancel:u,content:s,hideSubmit:c}=e;const{t:d}=a.useTranslation(),[m,v]=l.useState(window.innerWidth<=780),p=()=>{window.innerWidth<=780?m||v(!0):m&&v(!1)};return l.useEffect(()=>(window.addEventListener("resize",()=>{p()}),()=>{window.addEventListener("resize",()=>{p()})})),m?l.createElement(t.Modal,{popupStyles:{height:"174px",maxHeight:"174px",width:"324px",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},popupModuleActionBarStyles:{display:"flex",flex:1,justifyContent:"flex-start",width:"100%",position:"absolute",left:0,bottom:0,padding:"18px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},popupModuleMianStyles:{padding:"18px"},headerBarMain:l.createElement(fo,{label:d(r)}),headerBarEnd:l.createElement(yo,{onClick:i,isMobileView:m}),actionCancelLabel:!!u&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{margin:0}}," ",s))):l.createElement(t.Modal,{popupModuleMianStyles:{paddingTop:"30px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},headerBarMain:l.createElement(fo,{label:d(r)}),headerBarEnd:l.createElement(yo,{onClick:i,isMobileView:!1}),actionCancelLabel:!!u&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{marginBottom:"54px",marginLeft:"8px",marginRight:"8px"}},s)))},_o=e=>{const{t:r}=a.useTranslation(),[u,s]=n.useState({}),{data:c}=Digit.Hooks.useTenants(),[m,v]=n.useState(null),[p,E]=n.useState(!1),[g,f]=n.useState(!1),[h,y]=n.useState(null),[S,_]=n.useState(!1),[C,b]=n.useState({latitude:null,longitude:null}),[T,D]=n.useState(),[N,A]=n.useState(""),[w,I]=n.useState(!1),x=(Digit.ULBService.getCurrentTenantId(),e.location.state),[L,O]=n.useState(null);console.log("city",localStorage.getItem("CITIZEN.CITY")),n.useEffect(()=>{try{return E(!0),Promise.resolve(Digit.LocationService.getLocalities(m)).then(function(e){E(!1);let t=[];e&&e.TenantBoundary.length>0&&(E(!0),t=Digit.LocalityService.get(e.TenantBoundary[0]),E(!1)),y(t)})}catch(e){Promise.reject(e)}},[m]),n.useEffect(()=>{!function(){try{const e=function(){var e;if("EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase())return E(!0),Promise.resolve(Digit.LocationService.getLocalities(null===(e=x.citizenData.city)||void 0===e?void 0:e.code)).then(function(e){E(!1);let t=[];e&&e.TenantBoundary.length>0&&(E(!0),t=Digit.LocalityService.get(e.TenantBoundary[0]),E(!1)),y(t)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]);const{register:R,formState:{}}=i.useForm({defaultValues:u}),[P,M]=n.useState(null),[F,k]=n.useState(null),B=e.userType,U=o.useHistory(),[H,V]=n.useState(!1),W=n.useRef({});let q=x.surveyDetails;console.log("data",q),q=d({},q,{sections:q.sections.sort((e,t)=>e.sectionOrder-t.sectionOrder).map(e=>d({},e,{questions:e.questions.sort((e,t)=>e.qorder-t.qorder).map(e=>d({},e,{question:d({},e.question,{options:e.question.options.sort((e,t)=>(null==e?void 0:e.optionOrder)-(null==t?void 0:t.optionOrder))})}))}))});const j=function(e){try{var t,n;E(!0);let l={surveyUuid:q.uuid,citizenId:x.userInfo.uuid,tenantId:null===m&&window.location.href.includes("/employee")?null==x||null===(t=x.citizenData)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code:m};try{Digit.Surveys.getAnswers(l).then(t=>{if(E(!1),(null==t?void 0:t.sectionResponses.length)>0){let n={};return t.sectionResponses.forEach(e=>{let t={};e.questionResponses.forEach(n=>{t[n.questionUuid]=d({},u[e.sectionUuid][n.questionUuid],{answerUuid:n.answerUuid})}),n[e.sectionUuid]=t}),s(n),void("draft"===e?Z():$())}"draft"===e?Z():$()})}catch(e){return E(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}};n.useEffect(()=>{!function(){try{var e,t;E(!0);let n={surveyUuid:q.uuid,citizenId:x.userInfo.uuid,tenantId:null==m?window.location.href.includes("/employee")?null==x||null===(e=x.citizenData)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code:localStorage.getItem("CITIZEN.CITY"):m};try{Digit.Surveys.getAnswers(n).then(e=>{if(D(e),E(!1),(null==e?void 0:e.sectionResponses.length)>0){if("Draft"==e.status&&(f(!1),"CITIZEN"===(null==x?void 0:x.userType).toUpperCase()?Y():z()),"Submit"===e.status)return f(!0),_(!0),void V(l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"This Survey is already submitted. Cannot be reSubmitted"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to go back"),l.createElement("button",{onClick:()=>"CITIZEN"===(null==x?void 0:x.userType).toUpperCase()?U.push("/digit-ui/citizen/engagement/surveys/active-open-surveys"):U.push("/digit-ui/employee/engagement/surveys/active-open-surveys"),style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Go Back")));let t={};return e.sectionResponses.forEach(e=>{let n={};e.questionResponses.forEach(e=>{n[e.questionUuid]={answer:e.answerResponse.answerDetails[0].answerContent,answerUuid:e.answerUuid,comments:e.comments,weightage:e.answerResponse.answerDetails[0].weightage}}),t[e.sectionUuid]=n}),void s(t)}"CITIZEN"===(null==x?void 0:x.userType).toUpperCase()?Y():z()})}catch(e){return E(!1),Promise.resolve(e)}Promise.resolve()}catch(e){return Promise.reject(e)}}()},[q.uuid,x.userInfo.uuid]);const z=function(){try{return navigator.geolocation.getCurrentPosition(e=>{I(!0),b({latitude:e.coords.latitude,longitude:e.coords.longitude})},e=>{if(1===e.code)return I(!1),void alert("Location access is mandatory. Without it, we cannot proceed.");I(!1)}),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{var e,t,n;E(!0);const l={uuid:[null==x||null===(e=x.userInfo)||void 0===e?void 0:e.uuid],tenantId:null==x||null===(t=x.userInfo)||void 0===t?void 0:t.tenantId},a={tenantId:null==x||null===(n=x.userInfo)||void 0===n?void 0:n.tenantId};return Digit.Surveys.userSearch(l,a).then(e=>{var t,n,l,a,o,i,r,u;if(E(!1),("200"===(null==e||null===(t=e.responseInfo)||void 0===t?void 0:t.status)||"201"===(null==e||null===(n=e.responseInfo)||void 0===n?void 0:n.status))&&(null==e?void 0:e.user.length)>0)if(null===(null==e||null===(l=e.user[0])||void 0===l?void 0:l.gender)||null===(null==e||null===(a=e.user[0])||void 0===a?void 0:a.emailId)||null===(null==e||null===(o=e.user[0])||void 0===o?void 0:o.dob)||""===(null==e||null===(i=e.user[0])||void 0===i?void 0:i.gender)||""===(null==e||null===(r=e.user[0])||void 0===r?void 0:r.emailId)||""===(null==e||null===(u=e.user[0])||void 0===u?void 0:u.dob))O(!1);else{var s;const t=new Date,n=new Date(null==e||null===(s=e.user[0])||void 0===s?void 0:s.dob);let l=t.getFullYear()-n.getFullYear();const a=t.getMonth()-n.getMonth();if((a<0||0===a&&t.getDate()<n.getDate())&&l--,l<15||l>100)return O(!1),void alert("Citizen age must be between 15 and 100 years.");O(!0),z()}else M({key:!0,isError:!0,label:"ERROR FILE FETCHING CITIZEN DETAILS"})}).catch(e=>(E(!1),e)),Promise.resolve()}catch(e){return Promise.reject(e)}},G=(e,t,n,l,a,o)=>{s(i=>{var r;return d({},i,{[e]:d({},i[e],{[t]:d({},null==i||null===(r=i[e])||void 0===r?void 0:r[t],{answer:a,answerUuid:o,answerType:n,weightage:"MULTIPLE_ANSWER_TYPE"===n||"CHECKBOX_ANSWER_TYPE"===n||"DROP_DOWN_MENU_ANSWER_TYPE"===n?l:null})})})})},K=(e,t,n)=>{s(l=>{var a;return d({},l,{[e]:d({},l[e],{[t]:d({},null==l||null===(a=l[e])||void 0===a?void 0:a[t],{comments:n})})})})},[Q,X]=n.useState({});n.useEffect(()=>{const e=setInterval(()=>{JSON.stringify(W.current)!==JSON.stringify(u)&&(x.citizenFill&&"employee"===B.toLowerCase()||"citizen"===B.toLowerCase())&&(W.current=u,F&&j("draft"))},1e4);return()=>clearInterval(e)},[u]);const Z=function(){try{var e,t,n,l,a,o,i,r,s;E(!0);let d=[];for(const e in u)for(const t in u[e]){var c;d.push({uuid:u[e][t].answerUuid,surveyUuid:q.uuid,questionUuid:t,sectionUuid:e,comments:(null===(c=u[e][t])||void 0===c?void 0:c.comments)||"",answerDetails:[{answerType:u[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===u[e][t].answerType?u[e][t].answer.join(","):u[e][t].answer,weightage:u[e][t].weightage}]})}let v={User:{type:x.userInfo.type,uuid:x.userInfo.uuid,gender:"EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()?null==x||null===(e=x.citizenData)||void 0===e?void 0:e.gender:x.userInfo.gender,emailId:"EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()?null==x||null===(t=x.citizenData)||void 0===t?void 0:t.email:x.userInfo.emailId,dob:"EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()?null==x||null===(n=x.citizenData)||void 0===n?void 0:n.dob:x.userInfo.dob},SurveyResponse:{surveyUuid:q.uuid,tenantId:null===m?window.location.href.includes("/employee")?null==x||null===(l=x.citizenData)||void 0===l||null===(a=l.city)||void 0===a?void 0:a.code:localStorage.getItem("CITIZEN.CITY"):m,city:null===m?window.location.href.includes("/employee")?null==x||null===(o=x.citizenData)||void 0===o||null===(i=o.city)||void 0===i?void 0:i.code:localStorage.getItem("CITIZEN.CITY"):m,locality:F,tenantId:null===m?window.location.href.includes("/employee")?null==x||null===(r=x.citizenData)||void 0===r||null===(s=r.city)||void 0===s?void 0:s.code:localStorage.getItem("CITIZEN.CITY"):m,status:"Draft",coordinates:C.latitude+","+C.longitude,answers:d}};try{Digit.Surveys.submitSurvey(v).then(e=>{var t;E(!1),void 0!==(null==e?void 0:e.SubmitResponse)||M({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)})})}catch(e){return E(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}},$=()=>{var e,t,n,l,a,o,i;E(!0);let r=[];for(const e in u)for(const t in u[e]){var s,c,d;r.push({uuid:u[e][t].answerUuid,surveyUuid:q.uuid,questionUuid:t,sectionUuid:e,comments:(null===(s=u[e][t])||void 0===s?void 0:s.comments)||"",tenantId:window.location.href.includes("/employee")?null==x||null===(c=x.citizenData)||void 0===c||null===(d=c.city)||void 0===d?void 0:d.code:localStorage.getItem("CITIZEN.CITY"),answerDetails:[{answerType:u[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===u[e][t].answerType?u[e][t].answer.join(","):u[e][t].answer,weightage:u[e][t].weightage}]})}let v={User:{type:x.userInfo.type,uuid:x.userInfo.uuid,gender:"EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()?null==x||null===(e=x.citizenData)||void 0===e?void 0:e.gender:x.userInfo.gender,emailId:"EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()?null==x||null===(t=x.citizenData)||void 0===t?void 0:t.email:x.userInfo.emailId,dob:"EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()?null==x||null===(n=x.citizenData)||void 0===n?void 0:n.dob:x.userInfo.dob},SurveyResponse:{surveyUuid:q.uuid,status:"Submit",locality:F,coordinates:C.latitude+","+C.longitude,tenantId:null===m?window.location.href.includes("/employee")?null==x||null===(l=x.citizenData)||void 0===l||null===(a=l.city)||void 0===a?void 0:a.code:localStorage.getItem("CITIZEN.CITY"):m,city:null===m?window.location.href.includes("/employee")?null==x||null===(o=x.citizenData)||void 0===o||null===(i=o.city)||void 0===i?void 0:i.code:localStorage.getItem("CITIZEN.CITY"):m,answers:r}};try{Digit.Surveys.submitSurvey(v).then(e=>{var t;E(!1),void 0===(null==e?void 0:e.SubmitResponse)?M({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)}):"EMPLOYEE"===B.toUpperCase()?U.push("/digit-ui/employee/engagement/surveys/submit-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0}):U.push("/digit-ui/citizen/engagement/surveys/submit-survey-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0})})}catch(e){return E(!1),e}},[J,ee]=n.useState({latitude:null,longitude:null});n.useEffect(()=>{if(T){const e=null!=T&&T.tenantId?null==T?void 0:T.tenantId:localStorage.getItem("CITIZEN.CITY");e&&v(e)}},[T]),console.log("city",m);const te=e=>{k(e.target.value)};function ne(){_(!1)}return n.useEffect(()=>{T&&k(null==T?void 0:T.locality)},[T]),!0===g&&S?l.createElement(So,{onSelect:function(){_(!1)},onCancel:ne,onDismiss:ne,heading:"Survey already Submitted!",actionCancel:!1,content:H,hideSubmit:!0}):("EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()||null!=x&&x.citizenFill)&&!0===w||"CITIZEN"===(null==x?void 0:x.userType).toUpperCase()&&!0===L&&!0===w?l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},q.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},q.surveyDescription))),"EMPLOYEE"===(null==x?void 0:x.userType).toUpperCase()?l.createElement(n.Fragment,null,l.createElement(t.CardLabel,null,""+r("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:F,onChange:e=>{te(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==h&&l.createElement(n.Fragment,null,h.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),Q&&Q.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.locality.answerRequired)):l.createElement(n.Fragment,null,l.createElement(t.CardLabel,null,""+r("CITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:m,onChange:e=>{(e=>{v(e.target.value)})(e)},disabled:"pb.punjab"!==localStorage.getItem("CITIZEN.CITY")},l.createElement("option",{value:""},"--Please choose a city--"),c.map((e,t)=>l.createElement("option",{key:t,value:e.code},null==e?void 0:e.name))),Q&&Q.city&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.city.answerRequired),l.createElement(t.CardLabel,null,""+r("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:F,onChange:e=>{te(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==m&&null!==h&&l.createElement(n.Fragment,null,h.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),Q&&Q.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.locality.answerRequired)),l.createElement("form",{onSubmit:e=>{e.preventDefault(),x.citizenFill&&"employee"===(null==x?void 0:x.userType).toLowerCase()||"citizen"===(null==x?void 0:x.userType).toLowerCase()?(()=>{const e={};return q.sections.forEach(t=>{t.questions.forEach(n=>{var l,a,o,i;const r=null===(l=u[t.uuid])||void 0===l?void 0:l[n.question.uuid||""];var s,c,m;!0===n.required&&0===(null==r||null===(a=r.answer)||void 0===a?void 0:a.length)&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(s=e[t.uuid])||void 0===s?void 0:s[n.question.uuid],{answerRequired:n.question.questionStatement+" is required*"})})),(null==r||null===(o=r.answer)||void 0===o?void 0:o.length)>500&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(c=e[t.uuid])||void 0===c?void 0:c[n.question.uuid],{answerLength:"Answer length allowed only to 500 characters*"})})),(null==r||null===(i=r.comments)||void 0===i?void 0:i.length)>500&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(m=e[t.uuid])||void 0===m?void 0:m[n.question.uuid],{commentsLength:"Comments length allowed only to 500 characters*"})}))})}),null===F&&(e.locality={answerRequired:"Please select your locality"}),"CITIZEN"===(null==x?void 0:x.userType).toUpperCase()&&null===m&&(e.city={answerRequired:"Please select your city"}),X(e),0===Object.keys(e).length})()&&j("submit"):M({key:!0,isError:!0,label:"PLEASE FILL CITIZEN DETAILS"})}},q.sections.length>0?q.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((a,o)=>l.createElement("div",null,l.createElement("h3",null,a.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},o+1,". ",a.question.questionStatement," ",(null==a?void 0:a.required)&&l.createElement("span",{style:{color:"red"}},"*")),((e,a,o)=>{var i,c,m,v,p,E,g,f,h,y,S,_,C,b,T,D,N,A,w,I,x,L,O,P,M,F,k,B,U,H,V,W,q,j,z,Y,X,Z,$,J,ee,te,ne,le,ae,oe,ie,re,ue,se,ce,de,me,ve,pe,Ee,ge,fe,he,ye,Se,_e,Ce,be,Te,De,Ne,Ae,we,Ie,xe,Le,Oe,Re,Pe,Me,Fe,ke,Be,Ue,He,Ve,We,qe,je,ze,Ye,Ge,Ke,Qe,Xe,Ze,$e,Je,et,tt,nt,lt,at,ot,it,rt,ut,st,ct,dt,mt,vt;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,textInputStyle:{maxWidth:"none"},value:null===(i=u[o.uuid])||void 0===i||null===(c=i[a.uuid])||void 0===c?void 0:c.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},type:"text",inputRef:R({maxLength:{value:200,message:r("EXCEEDS_200_CHAR_LIMIT")},required:a.required})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(m=Q[o.uuid])||void 0===m||null===(v=m[a.uuid])||void 0===v?void 0:v.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(p=Q[o.uuid])||void 0===p||null===(E=p[a.uuid])||void 0===E?void 0:E.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(g=Q[o.uuid])||void 0===g||null===(f=g[a.uuid])||void 0===f?void 0:f.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(h=Q[o.uuid])||void 0===h||null===(y=h[a.uuid])||void 0===y?void 0:y.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(S=u[o.uuid])||void 0===S||null===(_=S[a.uuid])||void 0===_?void 0:_.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(C=Q[o.uuid])||void 0===C||null===(b=C[a.uuid])||void 0===b?void 0:b.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(T=Q[o.uuid])||void 0===T||null===(D=T[a.uuid])||void 0===D?void 0:D.commentsLength));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},value:null===(N=u[o.uuid])||void 0===N||null===(A=N[a.uuid])||void 0===A?void 0:A.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")},required:a.required})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(w=Q[o.uuid])||void 0===w||null===(I=w[a.uuid])||void 0===I?void 0:I.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(x=Q[o.uuid])||void 0===x||null===(L=x[a.uuid])||void 0===L?void 0:L.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(O=Q[o.uuid])||void 0===O||null===(P=O[a.uuid])||void 0===P?void 0:P.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(M=Q[o.uuid])||void 0===M||null===(F=M[a.uuid])||void 0===F?void 0:F.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(k=u[o.uuid])||void 0===k||null===(B=k[a.uuid])||void 0===B?void 0:B.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(U=Q[o.uuid])||void 0===U||null===(H=U[a.uuid])||void 0===H?void 0:H.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(V=Q[o.uuid])||void 0===V||null===(W=V[a.uuid])||void 0===W?void 0:W.commentsLength));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:null===(q=u[o.uuid])||void 0===q||null===(j=q[a.uuid])||void 0===j?void 0:j.answer,onChange:e=>{var t,n;const l=a.options.find(t=>t.optionText===e.target.value);G(o.uuid,a.uuid,a.type,(null==l?void 0:l.weightage)||0,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(z=Q[o.uuid])||void 0===z||null===(Y=z[a.uuid])||void 0===Y?void 0:Y.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(X=Q[o.uuid])||void 0===X||null===(Z=X[a.uuid])||void 0===Z?void 0:Z.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===($=Q[o.uuid])||void 0===$||null===(J=$[a.uuid])||void 0===J?void 0:J.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ee=Q[o.uuid])||void 0===ee||null===(te=ee[a.uuid])||void 0===te?void 0:te.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ne=u[o.uuid])||void 0===ne||null===(le=ne[a.uuid])||void 0===le?void 0:le.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ae=Q[o.uuid])||void 0===ae||null===(oe=ae[a.uuid])||void 0===oe?void 0:oe.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ie=Q[o.uuid])||void 0===ie||null===(re=ie[a.uuid])||void 0===re?void 0:re.commentsLength));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,checked:(null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer)===e.optionText,onChange:t=>{var n,l;return G(o.uuid,a.uuid,a.type,e.weightage,t.target.value,null===(n=u[o.uuid])||void 0===n||null===(l=n[a.uuid])||void 0===l?void 0:l.answerUuid)},required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText)})),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ue=Q[o.uuid])||void 0===ue||null===(se=ue[a.uuid])||void 0===se?void 0:se.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ce=Q[o.uuid])||void 0===ce||null===(de=ce[a.uuid])||void 0===de?void 0:de.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(me=Q[o.uuid])||void 0===me||null===(ve=me[a.uuid])||void 0===ve?void 0:ve.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(pe=Q[o.uuid])||void 0===pe||null===(Ee=pe[a.uuid])||void 0===Ee?void 0:Ee.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ge=u[o.uuid])||void 0===ge||null===(fe=ge[a.uuid])||void 0===fe?void 0:fe.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(he=Q[o.uuid])||void 0===he||null===(ye=he[a.uuid])||void 0===ye?void 0:ye.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Se=Q[o.uuid])||void 0===Se||null===(_e=Se[a.uuid])||void 0===_e?void 0:_e.commentsLength));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,checked:(null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer.includes(e.optionText))||!1,onChange:t=>{const n=t.target.value,l=t.target.checked;s(t=>{var i,r,s,c,m,v;const p=l?[...(null===(i=t[o.uuid])||void 0===i||null===(r=i[a.uuid])||void 0===r?void 0:r.answer)||"",n]:((null===(s=t[o.uuid])||void 0===s||null===(c=s[a.uuid])||void 0===c?void 0:c.answer)||"").filter(e=>e!==n);return d({},t,{[o.uuid]:d({},t[o.uuid],{[a.uuid]:{answer:p,answerUuid:null===(m=u[o.uuid])||void 0===m||null===(v=m[a.uuid])||void 0===v?void 0:v.answerUuid,answerType:a.type,weightage:e.weightage}})})})}}),e.optionText)})),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ce=Q[o.uuid])||void 0===Ce||null===(be=Ce[a.uuid])||void 0===be?void 0:be.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Te=Q[o.uuid])||void 0===Te||null===(De=Te[a.uuid])||void 0===De?void 0:De.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ne=Q[o.uuid])||void 0===Ne||null===(Ae=Ne[a.uuid])||void 0===Ae?void 0:Ae.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(we=Q[o.uuid])||void 0===we||null===(Ie=we[a.uuid])||void 0===Ie?void 0:Ie.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(xe=u[o.uuid])||void 0===xe||null===(Le=xe[a.uuid])||void 0===Le?void 0:Le.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Oe=Q[o.uuid])||void 0===Oe||null===(Re=Oe[a.uuid])||void 0===Re?void 0:Re.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Pe=Q[o.uuid])||void 0===Pe||null===(Me=Pe[a.uuid])||void 0===Me?void 0:Me.commentsLength));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},value:null===(Fe=u[o.uuid])||void 0===Fe||null===(ke=Fe[a.uuid])||void 0===ke?void 0:ke.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Be=Q[o.uuid])||void 0===Be||null===(Ue=Be[a.uuid])||void 0===Ue?void 0:Ue.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(He=Q[o.uuid])||void 0===He||null===(Ve=He[a.uuid])||void 0===Ve?void 0:Ve.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(We=Q[o.uuid])||void 0===We||null===(qe=We[a.uuid])||void 0===qe?void 0:qe.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(je=Q[o.uuid])||void 0===je||null===(ze=je[a.uuid])||void 0===ze?void 0:ze.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(Ye=u[o.uuid])||void 0===Ye||null===(Ge=Ye[a.uuid])||void 0===Ge?void 0:Ge.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ke=Q[o.uuid])||void 0===Ke||null===(Qe=Ke[a.uuid])||void 0===Qe?void 0:Qe.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Xe=Q[o.uuid])||void 0===Xe||null===(Ze=Xe[a.uuid])||void 0===Ze?void 0:Ze.commentsLength));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},value:null===($e=u[o.uuid])||void 0===$e||null===(Je=$e[a.uuid])||void 0===Je?void 0:Je.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(et=Q[o.uuid])||void 0===et||null===(tt=et[a.uuid])||void 0===tt?void 0:tt.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(nt=Q[o.uuid])||void 0===nt||null===(lt=nt[a.uuid])||void 0===lt?void 0:lt.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(at=Q[o.uuid])||void 0===at||null===(ot=at[a.uuid])||void 0===ot?void 0:ot.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(it=Q[o.uuid])||void 0===it||null===(rt=it[a.uuid])||void 0===rt?void 0:rt.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ut=u[o.uuid])||void 0===ut||null===(st=ut[a.uuid])||void 0===st?void 0:st.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ct=Q[o.uuid])||void 0===ct||null===(dt=ct[a.uuid])||void 0===dt?void 0:dt.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(mt=Q[o.uuid])||void 0===mt||null===(vt=mt[a.uuid])||void 0===vt?void 0:vt.commentsLength));default:return l.createElement(t.TextInput,{name:a.uuid,onChange:e=>G(o.uuid,a.uuid,e.target.value),type:"text",inputRef:R({maxLength:{value:200,message:r("EXCEEDS_200_CHAR_LIMIT")},required:a.required})})}})(a.question.type,a.question,e),Q[a.uuid]&&l.createElement("span",{className:"error"},Q[a.uuid]),l.createElement("div",null)))))):null,l.createElement("button",{type:"submit",style:{marginLeft:"10px"}},"Submit"))),P&&l.createElement(t.Toast,{error:P.isError,label:r(P.label),onClose:()=>{M(null)},isDleteBtn:"false"})):"CITIZEN"===(null==x?void 0:x.userType).toUpperCase()&&!1===L?l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"Please fill in your basic details to proceed with the survey"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to fill in your details"),l.createElement("button",{onClick:()=>U.push("/digit-ui/citizen/user/profile"),style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Fill your details : Name, Gender, DOB and Email are required"),p&&l.createElement(t.Loader,null)):null},Co=e=>{var n,o;const{t:i}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},bo=e=>{const{t:n}=a.useTranslation();return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Co,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},To=e=>{let{path:n,userType:i}=e;const r=o.useLocation(),{t:u}=a.useTranslation(),s=Digit.ComponentRegistryService.getComponent("NotificationsAndWhatsNew"),c=Digit.ComponentRegistryService.getComponent("EventsListOnGround"),m=Digit.ComponentRegistryService.getComponent("EventDetails"),v=Digit.ComponentRegistryService.getComponent("DocumentList"),p=Digit.ComponentRegistryService.getComponent("SurveyList"),E=(Digit.ComponentRegistryService.getComponent("FillSurvey"),Digit.ComponentRegistryService.getComponent("ShowSurvey"));return l.createElement(l.Fragment,null,l.createElement("div",{className:"engagement-citizen-wrapper"},!r.pathname.includes("response")&&l.createElement(t.BackButton,null,u("CS_COMMON_BACK")),l.createElement(o.Switch,null,l.createElement(o.Route,{path:n+"/notifications",component:()=>l.createElement(s,{variant:"notifications",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/whats-new",component:()=>l.createElement(s,{variant:"whats-new",parentRoute:n})}),l.createElement(t.PrivateRoute,{exact:!0,path:n+"/events",component:()=>l.createElement(c,{variant:"events",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/events/details/:id",component:()=>l.createElement(m,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/docs",component:()=>l.createElement(mo,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/viewDocument",component:()=>l.createElement(vo,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/list/:category/:count",component:e=>l.createElement(v,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/list",component:e=>l.createElement(p,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-response",component:e=>l.createElement(Eo,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/show-survey",component:e=>l.createElement(E,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/active-open-surveys",component:e=>l.createElement(go,d({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/fill-survey",component:e=>l.createElement(_o,d({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-survey-response",component:e=>l.createElement(bo,e)}))))},Do=[{body:[{type:"form",key:"ULB",component:"EngagementDocSelectULB",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],No=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u]=n.useState(!1);return l.createElement("div",null,l.createElement(t.Header,null,e("ES_ENGAGEMENT_DOCUMENTS")),l.createElement(t.FormComposer,{label:e("ES_COMMON_APPLICATION_SUBMIT"),config:Do,onSubmit:e=>{var t,n,l,a,o,r,u,s;const c={name:e.documentName,description:null!=e&&e.description.length?e.description:"",category:null===(t=e.docCategory)||void 0===t?void 0:t.name,documentLink:null===(n=e.document)||void 0===n?void 0:n.documentLink,filestoreId:null===(l=e.document)||void 0===l||null===(a=l.filestoreId)||void 0===a?void 0:a.fileStoreId,fileSize:null===(o=e.document)||void 0===o||null===(r=o.filestoreId)||void 0===r?void 0:r.fileSize,fileType:null===(u=e.document)||void 0===u||null===(s=u.filestoreId)||void 0===s?void 0:s.fileType,tenantIds:e.ULB.map(e=>e.code)};i.push("/digit-ui/employee/engagement/documents/response",{DocumentEntity:c})},fieldStyle:{},onFormValueChange:(e,t,n)=>{var l;null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&null!==(l=t.ULB)&&void 0!==l&&l.length?u(!0):u(!1)},isDisabled:!r}))},Ao=[{body:[{type:"form",key:"ULB",component:"EngagementULBDropdown",withoutLabel:!0},{type:"form",key:"documentName",component:"EnagementDocName",withoutLabel:!0},{type:"form",key:"docCategory",component:"EngagementDocCategory",withoutLabel:!0},{type:"form",key:"description",component:"EngagementDocDescription",withoutLabel:!0},{type:"form",key:"document",component:"EngagementDocUploadDocument",withoutLabel:!0,inputs:[{name:""}]}]}],wo=e=>{var i;const{t:r}=a.useTranslation(),u=o.useHistory(),[s,c]=n.useState(!1),m=n.useCallback((e,t,n)=>{null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&t.ULB&&Object.keys(null==t?void 0:t.ULB).length?c(!0):c(!1)},[]);return l.createElement(l.Fragment,null,l.createElement(t.Header,null,r("ES_ENGAGEMENT_EDIT_DOC")),l.createElement(t.FormComposer,{label:r("ES_COMMON_UPDATE"),config:Ao,onSubmit:t=>{(t=>{var n,l,a,o,i,r,s,c,m,v,p,E,g,f,h,y,S,_,C;const b=null!==(n=t.document)&&void 0!==n&&null!==(l=n.filestoreId)&&void 0!==l&&l.fileSize?null===(a=t.document)||void 0===a||null===(o=a.filestoreId)||void 0===o?void 0:o.fileSize:null===(i=e.location.state)||void 0===i||null===(r=i.DocumentEntity)||void 0===r?void 0:r.fileSize,T=null!==(s=t.document)&&void 0!==s&&null!==(c=s.filestoreId)&&void 0!==c&&c.fileType?null===(m=t.document)||void 0===m||null===(v=m.filestoreId)||void 0===v?void 0:v.fileType:null===(p=e.location.state)||void 0===p||null===(E=p.DocumentEntity)||void 0===E?void 0:E.fileType,D=d({},null===(g=e.location)||void 0===g||null===(f=g.state)||void 0===f?void 0:f.DocumentEntity,{name:t.documentName,description:null!=t&&t.description.length?t.description:"",category:null===(h=t.docCategory)||void 0===h?void 0:h.name,filestoreId:null===(y=t.document)||void 0===y||null===(S=y.filestoreId)||void 0===S?void 0:S.fileStoreId,fileSize:b,fileType:T,documentLink:null===(_=t.document)||void 0===_?void 0:_.documentLink,tenantId:null==t||null===(C=t.ULB)||void 0===C?void 0:C.code});delete D.ULB,delete D.docCategory,delete D.documentName,u.push("/digit-ui/employee/engagement/documents/update-response",{DocumentEntity:D})})(t)},fieldStyle:{},onFormValueChange:m,defaultValues:null===(i=e.location.state)||void 0===i?void 0:i.DocumentEntity,isDisabled:!s}))},Io=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_CREATED":"ENGAGEMENT_DOC_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,u},xo=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocCreate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{i.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Io,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Lo=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_UPDATED":"ENGAGEMENT_DOC_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,u},Oo=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocUpdate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{i.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Lo,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Ro=e=>{var n;const{t:o}=a.useTranslation();return l.createElement(t.Banner,{message:o(e.isSuccess?"ENGAGEMENT_DOC_DELETED":"ENGAGEMENT_DOC_DELETE_FAILURE"),applicationNumber:null!==(n=e.mutation)&&void 0!==n&&n.isSuccess?e.uuid:"",info:e.isSuccess?o("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess})},Po=e=>{var i;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocDelete()),{state:d}=e.location;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Ro,{t:s,data:c.data,mutation:c,uuid:null==d||null===(i=d.DocumentEntity)||void 0===i?void 0:i.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},Mo=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p,onSort:E,sortParams:g}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,currentPage:d,onNextPage:m,onPrevPage:v,pageSizeLimit:s,onPageSizeChange:p,getCellProps:u,totalRecords:c,onSort:E,sortParams:g})},Fo=e=>{let{onSearch:a,searchParams:o,searchFields:r,type:u,onClose:s,isInboxPage:c,t:m}=e;const{handleSubmit:v,formState:p,reset:E,control:g}=i.useForm({defaultValues:o}),f=innerWidth<=640,h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),_=Digit.UserService.getUser().info,C=h.filter(e=>{var t;return null==_||null===(t=_.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),b=n.useMemo(()=>h.filter(e=>e.code===S),[S,h]),T=()=>{E({name:"",ulbs:{code:S.code},postedBy:""}),a({name:"",ulbs:{code:S.code},postedBy:""})},D=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:T},m("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:v(e=>{a(e),"mobile"===u&&s()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===u||f)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,m("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==r?void 0:r.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,m(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},defaultValue:null==b?void 0:b[0],render:e=>l.createElement(t.Dropdown,{option:C,optionKey:"i18nKey",selected:e.value,select:e.onChange,t:m}),name:e.name,control:g});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:g,defaultValue:null})}})(e)),null!=p&&null!==(a=p.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==p||null===(o=p.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===u&&!f&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:m("ES_COMMON_SEARCH"),submit:!0})),"desktop"===u&&!f&&l.createElement("div",{className:"document-clear-all"},D())))),("mobile"===u||f)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},D(f)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(p.errors).length,label:m("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},ko=e=>{let{type:o="desktop",onClose:i,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,m]=n.useState(()=>d({},u)),v=Digit.ULBService.getCurrentTenantId(),p=null==v?void 0:v.split(".")[0],E=Digit.ULBService.getCurrentUlb(),{data:g,isLoading:f}=Digit.Hooks.engagement.useMDMS(p,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===E.code))[0].categoryList.map(e=>({category:e}))}}),h=()=>{m({category:null,name:null,postedBy:null}),r({category:null,name:null,postedBy:null}),null==i||i()};return f?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:h},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:h},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:i},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+s("DOCUMENTS_CATEGORY_CARD_LABEL")),l.createElement(t.Dropdown,{option:g,optionKey:"category",selected:c,select:e=>{m(d({},c,e))},t:s}),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(r(c),void(null==i||i())),label:s("ES_COMMON_APPLY")}))))},Bo=e=>l.createElement("span",{className:"cell-text styled-cell"},e),Uo=e=>{let{isLoading:n,data:a,t:i,onSearch:r,title:u,iconName:s,links:c,onSort:d,sortParams:m,globalSearch:v,searchFields:p,searchParams:E,onFilterChange:g,pageSizeLimit:f,totalRecords:h,currentPage:y,onNextPage:S,onPrevPage:_,onPageSizeChange:C}=e;const D=l.useMemo(()=>[{Header:i("CE_TABLE_DOCUMENT_NAME"),accessor:e=>{return function(e,t,n){return void 0===e&&(e=""),l.createElement("span",{className:"document-table-docs-columns"},l.createElement(o.Link,{className:"link",to:t},e.length?e:n("CE_DOCUMENT_TITLE")))}(null==e?void 0:e.name,{pathname:"inbox/details/"+(t=e).name,state:{details:t}},i);var t}},{Header:i("DOCUMENTS_CATEGORY_CARD_LABEL"),accessor:e=>Bo(null!=e&&e.category?i(""+(null==e?void 0:e.category)):"")},{Header:i("CE_TABLE_DOCUMENT_LINK"),accessor:e=>function(e,t,n,a){return void 0===e&&(e="mSeva"),l.createElement("span",{className:"document-table-docs-columns"},null!=t&&t.length?l.createElement("span",{className:"link",onClick:()=>b(t,e)}," ",a("CE_DOCUMENT_VIEW_LINK")," "):null,n.length?l.createElement("span",{className:"link",onClick:()=>T(n,e)}," ",a("CE_DOCUMENT_OPEN_LINK")," "):null)}(null==e?void 0:e.name,e.filestoreId,e.documentLink||"",i)},{Header:i("CE_TABLE_DOCUMENT_POSTED_BY"),accessor:e=>Bo(e.postedBy)}],[]);let N;return n?N=l.createElement(t.Loader,null):a&&0!==(null==a?void 0:a.length)?(null==a?void 0:a.length)>0&&(N=l.createElement(Mo,{t:i,data:a,columns:D,onSort:d,sortParams:m,globalSearch:v,onSearch:E,pageSizeLimit:f,totalRecords:h,currentPage:y,onNextPage:S,onPrevPage:_,onPageSizeChange:C,getCellProps:e=>({style:{minWidth:e.column.Header===i("CE_TABLE_DOCUMENT_NAME")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})):N=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},i("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},i("NEW_DOCUMENT_TEXT"))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:u,icon:s,links:c}),l.createElement("div",null,l.createElement(ko,{onFilterChange:g,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(Fo,{t:i,onSearch:r,type:"desktop",searchFields:p,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},N)))},Ho=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i),h=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&E(!0)},[m]);const y=()=>{E(!1),f(i)};let _;return 0===(null==c?void 0:c.length)?_=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},s("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},s("NEW_DOCUMENT_TEXT"))):c&&(null==c?void 0:c.length)>0&&(_=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>S(t.postedBy,e["Posted By"])&&S(t.name,e["Document Name"]));t&&h.push("/digit-ui/employee/engagement/documents/inbox/details/"+(null==t?void 0:t.name),{details:t})}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),_,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(ko,{onFilterChange:r,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Fo,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:i,searchFields:a}))))},Vo=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:a,icon:o,links:i}),l.createElement(Ho,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s;return(!((null==u||null===(t=u.tenantIds)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.tenantIds)||void 0===n?void 0:n.includes(e.tenantId)))&&(null==u||!u.name||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.name)||void 0===a?void 0:a.toUpperCase())))&&(null==u||!u.postedBy||(null===(o=e.postedBy)||void 0===o||null===(i=o.trim())||void 0===i?void 0:i.toLowerCase())===(null==u||null===(r=u.postedBy)||void 0===r||null===(s=r.trim())||void 0===s?void 0:s.toLowerCase()))&&(null==u||!u.category||e.category===(null==u?void 0:u.category))}).map(e=>({[n("CE_TABLE_DOCUMENT_NAME")]:null==e?void 0:e.name,[n("DOCUMENTS_CATEGORY_CARD_LABEL")]:n(""+(null==e?void 0:e.category)),[n("CE_TABLE_DOCUMENT_LINK")]:l.createElement("div",{className:"mobileInbox_attachments"},null!=e&&e.filestoreId?l.createElement("div",{className:"link",onClick:t=>{b(e.filestoreId,e.name)}},n("CE_DOCUMENT_VIEW_LINK")):null,null!=e&&e.documentLink?l.createElement("div",{className:"link",onClick:t=>{T(e.documentLink,e.name)}},n("CE_DOCUMENT_OPEN_LINK")):null),[n("CE_TABLE_DOCUMENT_POSTED_BY")]:null==e?void 0:e.postedBy})),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,responseData:t}))))},Wo=e=>{let{tenants:o}=e;const{t:i}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o);const r=Digit.ULBService.getCurrentTenantId(),[u,s]=n.useState({tenantIds:r,offset:0,limit:10});let c=window.Digit.Utils.browser.isMobile();const{data:m,isLoading:v}=Digit.Hooks.engagement.useDocSearch(u,{select:e=>{let{Documents:t,totalCount:n}=e;return{documentsList:t,totalCount:n}}}),p=e=>{var t,n,l;const a=null!=e&&null!==(t=e.ulbs)&&void 0!==t&&null!==(n=t.code)&&void 0!==n&&n.length?null==e||null===(l=e.ulbs)||void 0===l?void 0:l.code:r,{name:o,postedBy:i}=e;s(e=>d({},e,{name:o,postedBy:i,tenantIds:a}))},E=e=>{s(t=>d({},t,e))},g=n.useCallback(()=>{s(e=>d({},e,{offset:parseInt(null==e?void 0:e.offset)+parseInt(null==e?void 0:e.limit)}))},[]);n.useEffect(()=>{s(e=>d({},e,{tenantIds:r}))},[r]);const f=()=>[{label:i("LABEL_FOR_ULB"),name:"ulbs",type:"ulb"},{label:i("DOCUMENTS_DOCUMENT_HEADER"),name:"name"},{label:i("CE_TABLE_DOCUMENT_POSTED_BY"),name:"postedBy"}],h=[{text:i("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/inbox/new-doc"}];return c?l.createElement(Vo,{data:null==m?void 0:m.documentsList,searchParams:u,searchFields:f(),t:i,onFilterChange:E,onSearch:p,isLoading:v,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:h}):l.createElement("div",null,l.createElement(t.Header,null,i("DOCUMENTS_DOCUMENT_HEADER"),Number(null==m?void 0:m.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==m?void 0:m.totalCount)):null),l.createElement(Uo,{t:i,isLoading:v,data:null==m?void 0:m.documentsList,links:h,searchParams:u,onSearch:p,searchFields:f(),onFilterChange:E,pageSizeLimit:null==u?void 0:u.limit,totalRecords:null==m?void 0:m.totalCount,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:h,currentPage:parseInt(u.offset/u.limit),onNextPage:g,onPrevPage:()=>{s(e=>d({},e,{offset:parseInt(null==e?void 0:e.offset)-parseInt(null==e?void 0:e.limit)}))},onPageSizeChange:e=>{s(t=>d({},t,{limit:e.target.value}))}}))},qo=e=>{let{header:n,about:o,activeTime:i,postedAt:r,responseStatus:u,onCardClick:s}=e;const{t:c}=a.useTranslation();return l.createElement("div",{className:"WhatsNewCard",onClick:s},l.createElement("h2",null,n),l.createElement("p",null,o),l.createElement("div",{className:"surveyListclockDiv"},l.createElement(t.Clock,null)," ",l.createElement("span",null,"Active till "+we(new Date(i),"do MMM HH:mm"))),l.createElement("div",{className:"surveyListstatus"},l.createElement("p",null,function(e,t){return E(1,arguments),Le(e,Date.now(),t)}(new Date(r),{addSuffix:!0})),l.createElement("span",{className:"CS_SURVEY_RESPONDED"===u?"surveyLisResponded":"surveyLisNotResponded"},c(u))))},jo=(e,t)=>{const n=(new Date).getTime();return e<n&&n<=t},zo=["EDIT_DOCUMENT","DELETE"],Yo=e=>{var o;let{location:i,history:r}=e,u=window.Digit.Utils.browser.isMobile();const{t:s}=a.useTranslation(),{details:c}=null==i?void 0:i.state,[m,v]=l.useState(!1),[p,E]=n.useState(!1),g=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentUlb()),f=Digit.ULBService.getStateId(),{data:h}=Digit.Hooks.engagement.useMDMS(f,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===g.code))[0].categoryList.map(e=>({name:e}))}});return l.createElement("div",null,p?l.createElement(Ka,{t:s,heading:"CONFIRM_DELETE_DOC",docName:null==c?void 0:c.name,closeModal:()=>E(!p),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){E(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:function(){E(!1);const e=d({},c);r.push({pathname:"/digit-ui/employee/engagement/documents/delete-response",state:{DocumentEntity:e}})}}):null,l.createElement(t.Header,null,s("CE_DOCUMENT_DETAILS")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("ULB")+":")," ",l.createElement("p",null,(e=>{var t,n;let l=null==e?void 0:e.split(".")[1];return l=""+(null===(t=l[0])||void 0===t?void 0:t.toUpperCase())+(null===(n=l)||void 0===n?void 0:n.slice(1))+" ",l})(null==c?void 0:c.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_NAME")+":")," ",l.createElement("p",null,null==c?void 0:c.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_CATEGORY")+":")," ",l.createElement("p",null,s(null==c?void 0:c.category))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DCOUMENT_DESCRIPTION")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=c&&null!==(o=c.description)&&void 0!==o&&o.length?null==c?void 0:c.description:"NA")," "),null!=c&&c.filestoreId?l.createElement("div",{className:"documentDetails_pdf"},l.createElement("span",{className:"documentDetails_subheader"},""+s("Document")),l.createElement("div",{style:{width:"100px"},onClick:()=>b(null==c?void 0:c.filestoreId,null==c?void 0:c.name)},l.createElement(t.GenericFileIcon,null))):null)),l.createElement(t.ActionBar,null,m?l.createElement(t.Menu,{style:{width:u?"full":"240px"},localeKeyPrefix:"ES_CE",options:zo,t:s,onSelect:function(e){if(v(!1),null!=e&&e.includes("EDIT")){var t;const e=d({tenantIds:null==c?void 0:c.tenantId,documentName:null==c?void 0:c.name,docCategory:null==h||null===(t=h.filter(e=>e.name===(null==c?void 0:c.category)))||void 0===t?void 0:t[0],document:{filestoreId:{fileStoreId:null==c?void 0:c.filestoreId},documentLink:null==c?void 0:c.documentLink},ULB:{code:null==c?void 0:c.tenantId}},c);r.push({pathname:"/digit-ui/employee/engagement/documents/inbox/update",state:{DocumentEntity:e}})}null!=e&&e.includes("DELETE")&&E(!0)}}):null,l.createElement(t.SubmitBar,{label:s("ES_COMMON_TAKE_ACTION"),onSubmit:()=>v(!m)})))},Go=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},Ko=e=>{var o,r,u,s,c;let{registerRef:d,controlSearchForm:m,searchFormState:v}=e;const{t:p}=a.useTranslation(),E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),g=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentTenantId()),f=Digit.UserService.getUser().info;let h=!0,S=E.filter(e=>{var t,n;return null==f||null===(t=f.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);if(0===(null===(o=S)||void 0===o?void 0:o.length)||"pb.punjab"===g){h=!1;let e={i18nKey:"TENANT_TENANTS_"+(null==f?void 0:f.tenantId.replace(".","_").toUpperCase()),code:""+(null==f?void 0:f.tenantId)};S="pb.punjab"===g?[e,...E]:[e]}const _=n.useMemo(()=>{var e;return(null===(e=S)||void 0===e?void 0:e.length)>0&&!0===h?E.filter(e=>e.code===g):S.filter(e=>e.code===g)},[E]);return l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,p("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:p("REQUIRED_FIELD")},defaultValue:null==_?void 0:_[0],render:e=>l.createElement(t.Dropdown,{option:S,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:p}),name:"tenantIds",control:m}),l.createElement(t.CardLabelError,null,null==v||null===(r=v.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,p("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",inputRef:d({maxLength:{value:60,message:p("Survey Name should be less than 60 characters")}})}),l.createElement(t.CardLabelError,null,null==v||null===(s=v.errors)||void 0===s||null===(c=s.title)||void 0===c?void 0:c.message)))},Qo=e=>{let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),g=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],f={tenantIds:E[0],title:""},h={status:g[0]},y={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEY.INBOX"),_=n.useMemo(()=>S||{filterForm:h,searchForm:f,tableForm:y},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[C,b]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},_);let{data:{Surveys:T=[],TotalCount:D}={},isLoading:N}=Digit.Hooks.survey.useSurveyInbox(C);const[A,w]=n.useState([]);n.useEffect(()=>{if(T.length>0){const e=[...T].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);T=e,w(e)}},[T]);const I={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},x=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(Ko,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(Go,{statuses:g,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==C?void 0:C.filterForm,getFilterFormValue:o})},[g]),O={SearchFormFields:x,onSearchFormSubmit:e=>{b({action:"mutateTableForm",data:d({},C.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==C?void 0:C.searchForm,resetSearchFormDefaultValues:f,onSearchFormReset:e=>{e("title",""),e("tenantIds",m),b({action:"mutateSearchForm",data:f})}},R={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==C?void 0:C.filterForm,resetFilterFormDefaultValues:h,onFilterFormReset:e=>{e("status",g[0]),b({action:"mutateFilterForm",data:h})}},P=(e=>{var i,r,u,s;let{onPageSizeChange:c,formState:m,totalCount:v,table:p,dispatch:E,inboxStyles:g={},setShowToast:f}=e;const h=o.useHistory(),y=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:S}=a.useTranslation(),_=Digit.UserService.getUser(),C=n.useMemo(()=>[{Header:S("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link",onClick:()=>{h.push({pathname:"/digit-ui/employee/engagement/surveys/previewQuestions",state:{data:t.original}})}},t.original.surveyTitle))}},{Header:S("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?y(we(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:S("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?y(we(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:l.createElement("div",null,S("EVENTS_STATUS_LABEL")),accessor:"status",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null===(t=n.original)||void 0===t?void 0:t.active)}},{Header:S("EVENTS_POSTEDBY_LABEL"),accessor:"postedBy",Cell:e=>{var t;let{row:n}=e;return y(null===(t=n.original)||void 0===t?void 0:t.postedBy)}},{Header:S("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:S("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:S("Update Survey Status"),accessor:"updateSurvey",Cell:e=>{var n,a;let{row:o}=e;return(null==o||null===(n=o.original)||void 0===n?void 0:n.tenantId)===(null==_||null===(a=_.info)||void 0===a?void 0:a.tenantId)?l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;console.log("Current row: ",e);const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.active?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.active?"Inactive":"Active";f({label:'Are you sure you want to change the survey status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.surveyTitle)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(o)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},S("Click here to update the survey status")))):l.createElement("div",{style:{color:"red"}},"No access")}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"endDate",onPageSizeChange:c,currentPage:parseInt((null===(i=m.tableForm)||void 0===i?void 0:i.offset)/(null===(r=m.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=m.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=m.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(u=m.tableForm)||void 0===u?void 0:u.limit,totalRecords:v,onSearch:null==m||null===(s=m.searchForm)||void 0===s?void 0:s.message,onLastPage:()=>{var e;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:10*Math.ceil(v/10)-parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>E({action:"mutateTableForm",data:d({},m.tableForm,{offset:0})}),data:p,columns:C,noResultsMessage:"CS_NO_SURVEYS_FOUND",inboxStyles:d({},g)}})(d({},{parentRoute:r,onPageSizeChange:e=>{b({action:"mutateTableForm",data:d({},C.tableForm,{limit:e.target.value})})},formState:C,totalCount:D,table:A,noResultsMessage:"CS_SURVEYS_NOT_FOUND",dispatch:b,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:n}]=e,l=n?"DESC":"ASC";C.tableForm.sortBy===t&&C.tableForm.sortOrder===l||b({action:"mutateTableForm",data:d({},C.tableForm,{sortBy:t,sortOrder:n?"DESC":"ASC"})})}}})),M=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const{surveyTitle:n,startDate:a,endDate:i,active:s,postedBy:c,auditDetails:d}=e;return{[r("Survey Name")]:n,[r("EVENTS_START_DATE_LABEL")]:a?we(new Date(a),"dd/MM/yyyy"):"",[r("EVENTS_END_DATE_LABEL")]:i?we(new Date(i),"dd/MM/yyyy"):"",[r("EVENTS_STATUS_LABEL")]:u(s),[r("EVENTS_POSTEDBY_LABEL")]:c,[r("Created On")]:null!=d&&d.createdTime?we(new Date(null==d?void 0:d.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=d&&d.lastModifiedTime?we(new Date(null==d?void 0:d.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Survey Status")]:l.createElement("label",{onClick:()=>{return t=e,console.log("Current row: ",t),void o({label:'Are you sure you want to change the survey status of "'+(null==t?void 0:t.surveyTitle)+'" from '+(null!=t&&t.active?"Active":"Inactive")+" to "+(null!=t&&t.active?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t});var t}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:A,setShowToast:c});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Inbox"),D?l.createElement("p",{className:"inbox-count"},D):null),l.createElement(t.InboxComposer,d({isInboxLoading:N,PropsForInboxLinks:I},O,R,{propsForInboxMobileCards:M,propsForInboxTable:P,formState:C})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData;Digit.Surveys.updateSurvey({uuid:null==e?void 0:e.uuid,active:!(null!=e&&e.active)}).then(e=>{c({label:null==e?void 0:e.message,isDleteBtn:"true"})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,isWarningButtons:s.isWarningButtons,style:{padding:"16px"}}))},Xo=()=>{const{t:e}=a.useTranslation(),r=o.useHistory(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[d,m]=n.useState(null),p=i.useForm({defaultValues:{categoryName:""}}),{register:E,handleSubmit:g,reset:f,formState:{errors:h}}=p,[y,S]=n.useState(!1);function _(){S(!1)}return l.createElement("div",{className:"pageCard"},l.createElement(t.Header,null,e("Create Category")),l.createElement(i.FormProvider,p,l.createElement("form",{onSubmit:g(function(e){try{s(!0);const t={Categories:[{tenantId:c,label:e.categoryName.trim()}]},n=v(function(){return Promise.resolve(Digit.Surveys.createCategory(t)).then(function(e){var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?(s(!1),m({isError:!1,label:"Category created successfully"}),f(),setTimeout(()=>{r.push("/digit-ui/employee/engagement/surveys/search-categories")},2e3)):(s(!1),m({isError:!0,label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong"}))})},function(e){var t,n,l,a;console.log("Error in Digit.Surveys.createCategory:",null==e?void 0:e.response),s(!1),m({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,e("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",null,l.createElement(t.TextInput,{errorStyle:!!h.categoryName,name:"categoryName",type:"text",placeholder:"Enter Category",inputRef:E({required:e("REQUIRED_FIELD"),maxLength:{value:500,message:e("Category length should be less than or equal to 500 characters")}})}),h.categoryName&&l.createElement("p",{style:{color:"red"}},h.categoryName.message)),l.createElement("label",{onClick:function(){S(!0)},style:{width:"24px",display:"flex",justifyContent:"center",alignItems:"center",outline:"none",cursor:"pointer"}},l.createElement(t.InfoIcon,null)))),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:e("Create Category"),submit:"submit"})))),y&&l.createElement(So,{onSelect:function(){S(!1)},onCancel:_,onDismiss:_,heading:"About category creation",content:l.createElement("p",{style:{fontWeight:"bold"}},e("Organize your survey by category to steamline feedback on municipal services.")),hideSubmit:!0}),d&&l.createElement(t.Toast,{error:d.isError,label:e(d.label),onClose:function(){m(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},Zo=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},$o=e=>{var o,r,u;let{controlSearchForm:s,searchFormState:c}=e;const{t:d}=a.useTranslation(),m=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.ULBService.getCurrentTenantId(),p=Digit.SessionStorage.get("citizen.userRequestObject");let E=!0,g=m.filter(e=>{var t,n;return null==p||null===(t=p.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);var f;0===(null===(o=g)||void 0===o?void 0:o.length)&&(E=!1,g=[{i18nKey:"TENANT_TENANTS_"+(null==p||null===(f=p.info)||void 0===f?void 0:f.tenantId.replace(".","_").toUpperCase()),code:""+(null==p?void 0:p.info.tenantId)}]);const h=n.useMemo(()=>{var e;return(null===(e=g)||void 0===e?void 0:e.length)>0&&!0===E?m.filter(e=>e.code===v):g.filter(e=>e.code===v)},[m]),[S,_]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:v}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:d(e.label),i18Key:e.label,value:e.id}}):[];_(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[v]),console.log("controlSearchForm: ",s),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,d("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:d("REQUIRED_FIELD")},defaultValue:null==h?void 0:h[0],render:e=>l.createElement(t.Dropdown,{option:g,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:d}),name:"tenantIds",control:s}),l.createElement(t.CardLabelError,null,null==c||null===(r=c.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,d("Category")),l.createElement(i.Controller,{rules:{required:!1},render:e=>l.createElement(t.Dropdown,{option:S,optionKey:"i18Key",selected:e.value,select:t=>e.onChange(t),t:d}),name:"categoryName",control:s})))},Jo=e=>{var o;let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),g=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],f={tenantIds:E[0],categoryName:""},h={status:g[0]},y={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEYCATEGORY.INBOX"),_=n.useMemo(()=>S||{filterForm:h,searchForm:f,tableForm:y},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[C,b]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},_);let{data:{Categories:T=[]}={},isLoading:D}=Digit.Hooks.survey.useSurveyCategoryInbox(C);const N=null===(o=T)||void 0===o?void 0:o.length,[A,w]=n.useState([]);n.useEffect(()=>{if(T.length>0){const e=[...T].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);T=e,w(e)}},[T]);const I={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},x=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement($o,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(Zo,{statuses:g,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==C?void 0:C.filterForm,getFilterFormValue:o})},[g]),O={SearchFormFields:x,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit: ",e),b({action:"mutateTableForm",data:d({},C.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==C?void 0:C.searchForm,resetSearchFormDefaultValues:f,onSearchFormReset:e=>{e("tenantIds",m),e("categoryName",""),b({action:"mutateSearchForm",data:f})}},R={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==C?void 0:C.filterForm,resetFilterFormDefaultValues:h,onFilterFormReset:e=>{e("status",g[0]),b({action:"mutateFilterForm",data:h})}},P=(e=>{var o,i,r,u;let{onPageSizeChange:s,formState:c,totalCount:m,table:v,dispatch:p,inboxStyles:E={},setShowToast:g}=e;const f=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:h}=a.useTranslation(),y=n.useMemo(()=>[{Header:h("Category"),accessor:"category",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.label))}},{Header:h("Status"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null===(t=n.original)||void 0===t?void 0:t.isActive)}},{Header:h("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?f(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:h("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?f(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:h("Update Category Status"),accessor:"updateCategory",Cell:e=>{let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;console.log("Current row: ",e);const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.isActive?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.isActive?"Inactive":"Active";g({label:'Are you sure you want to change the category status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.label)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},h("Click here to update the category status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(m),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:v,columns:y,noResultsMessage:"No Category found",inboxStyles:d({},E)}})(d({},{parentRoute:r,onPageSizeChange:e=>{b({action:"mutateTableForm",data:d({},C.tableForm,{limit:e.target.value})})},formState:C,totalCount:N,table:A,noResultsMessage:"No Categories found",dispatch:b,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c})),M=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const{label:n,isActive:a,auditDetails:i}=e;return{[r("Category")]:n,[r("Status")]:u(a),[r("Created On")]:null!=i&&i.createdTime?we(new Date(null==i?void 0:i.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=i&&i.lastModifiedTime?we(new Date(null==i?void 0:i.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Category Status")]:l.createElement("label",{onClick:()=>{var t;o({label:'Are you sure you want to change the category status of "'+(null==(t=e)?void 0:t.label)+'" from '+(null!=t&&t.isActive?"Active":"Inactive")+" to "+(null!=t&&t.isActive?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t})}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:A,setShowToast:c});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Search Categories"),N?l.createElement("p",{className:"inbox-count"},N):null),l.createElement(t.InboxComposer,d({isInboxLoading:D,PropsForInboxLinks:I},O,R,{propsForInboxMobileCards:M,propsForInboxTable:P,formState:C})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData,t={Categories:[d({id:null==e?void 0:e.id},"boolean"==typeof(null==e?void 0:e.isActive)&&{isActive:!(null!=e&&e.isActive)})]};Digit.Surveys.updateCategory(t).then(e=>{var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?c({label:"Category status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,style:{padding:"16px"},isWarningButtons:s.isWarningButtons}))},ei=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,isPartiallyEnabled:r,createNewSurvey:u,formDisabled:s,maxLength:c,titleHover:d,weightHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isInputDisabled:f}=e;return l.createElement("div",{className:"options_checkboxes"},n.map(e=>l.createElement("div",{key:e.id},l.createElement(ti,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,maxLength:c,titleHover:d,weightageHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isPartiallyEnabled:r,isInputDisabled:f,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!u&&s||(r?!r:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},ti=e=>{let{index:a,title:o,weightage:i,updateOption:r,removeOption:u,maxLength:s,titleHover:c,weightHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isPartiallyEnabled:f,isInputDisabled:h,formDisabled:y,optionsLength:S}=e;const[_,C]=n.useState(o),[b,T]=n.useState(i),[D,N]=n.useState(!1),[A,w]=n.useState("");return n.useEffect(()=>{r({value:_,id:a,weightage:b})},[_,b]),l.createElement("div",{className:"optioncheckboxwrapper",style:{alignItems:"flex-start"}},l.createElement(t.CheckBox,{disable:h}),l.createElement("input",{ref:E,type:"text",value:_,onChange:e=>C(e.target.value),onBlur:()=>N(!1),onFocus:()=>N(!0),className:D?"simple_editable-input":"simple_readonly-input",maxLength:s,title:c,style:d({},g),disabled:f?!f:y}),S>1&&l.createElement("div",{className:"pointer",onClick:()=>u(a)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:b,required:!0,placeholder:"Option Weightage",min:v,max:p,title:m,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(w(""),T(e.target.value)):w("Please enter a number between 0 and 10.")}}),A&&l.createElement("span",{style:{color:"red"}},A)))},ni=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,createNewSurvey:r,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isInputDisabled:g}=e;return l.createElement("div",{className:"options_checkboxes"},n.map(e=>l.createElement("div",{key:e.id},l.createElement(li,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,inputRef:c,maxLength:d,titleHover:m,weightageHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!r&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},li=e=>{let{index:a,title:o,weightage:i,updateOption:r,removeOption:u,inputRef:s,maxLength:c,titleHover:d,weightHover:m,minWeight:v,maxWeight:p,isPartiallyEnabled:E,isInputDisabled:g,formDisabled:f,optionsLength:h}=e;const[y,S]=n.useState(o),[_,C]=n.useState(i),[b,T]=n.useState(!1),[D,N]=n.useState("");return n.useEffect(()=>{r({value:y,id:a,weightage:_})},[y,_]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"flex-start"}},l.createElement("input",{type:"radio",className:"customradiobutton",disabled:g}),l.createElement("input",{type:"text",ref:s,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:b?"simple_editable-input":"simple_readonly-input",maxLength:c,title:d,disabled:E?!E:f}),h>1&&l.createElement("div",{className:"pointer",onClick:()=>u(a)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:_,required:!0,placeholder:"Option Weightage",min:v,max:p,title:m,className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(N(""),C(e.target.value)):N("Please enter a number between 0 and 10.")},onWheel:e=>e.target.blur()}),D&&l.createElement("span",{style:{color:"red"}},D)))},ai=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,createNewSurvey:r,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isInputDisabled:g}=e;return l.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>l.createElement("div",{key:e.id},l.createElement(oi,{indexNumber:t,index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,inputRef:c,maxLength:d,titleHover:m,weightageHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!r&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},oi=e=>{let{indexNumber:a,index:o,title:i,weightage:r,updateOption:u,removeOption:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:g,formDisabled:f,optionsLength:h}=e;const[y,S]=n.useState(i),[_,C]=n.useState(r),[b,T]=n.useState(!1),[D,N]=n.useState("");return n.useEffect(()=>{u({value:y,id:o,weightage:_})},[y,_]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"flex-start"}},l.createElement("span",null,a+1,"."),l.createElement("input",{type:"text",ref:c,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:b?"simple_editable-input":"simple_readonly-input",maxLength:d,title:m,disabled:g?!g:f}),h>1&&l.createElement("div",{className:"pointer",onClick:()=>s(o)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:_,required:!0,placeholder:"Option Weightage",min:p,max:E,title:v,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(N(""),C(e.target.value)):N("Please enter a number between 0 and 10.")}}),D&&l.createElement("span",{style:{color:"red"}},D)))},ii=e=>{var a,o,r,u,s,c;let{t:m,index:v,category:p,questionStatement:E,type:g,options:f,required:h,uuid:y,qorder:S,disableInputs:_,dispatch:C,isPartiallyEnabled:b,addOption:T,formDisabled:D,controlSurveyForm:N,mainFormState:A,noOfQuestions:w,defaultQuestionValues:I}=e;const x=Digit.ULBService.getCurrentTenantId(),{data:L={}}=Digit.Hooks.engagement.useMDMS(x,"common-masters","questionType")||{};var O=L&&L["common-masters"]&&L["common-masters"].questionType?L["common-masters"].questionType.filter(function(e){return e.active}).map(function(e){return{title:m(e.title),i18Key:e.code,value:e.code}}):[];const[R,P]=n.useState([]);n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:x}).then(e=>{var t,n;const l=null==e||null===(t=e.Categories)||void 0===t||null===(n=t.filter(e=>e.isActive))||void 0===n?void 0:n.map(e=>({title:m(e.label),i18Key:e.label,value:e.id}));P(l)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[x]);const M=window.location.href.includes("/employee/engagement/surveys/create-questions"),[F,k]=n.useState({category:p||I.category,questionStatement:E||I.questionStatement,type:g||I.type,options:(null==f?void 0:f.length)>0?f:I.options,required:h||I.required,uuid:y||I.uuid,qorder:S||I.qorder}),{errors:B}=A,U=()=>{const e=[...F.options,{id:Date.now(),title:m("CMN_OPTION")+" "+(F.options.length+1),optionWeightage:0}];return k(t=>d({},t,{options:e})),e},H=e=>{let{value:t,id:n,weightage:l}=e;const a=F.options.map(e=>e.id===n?d({},e,{title:t,optionWeightage:l}):e);return k(e=>d({},e,{options:a})),a},V=e=>{if(1===F.options.length||(b?!b:D))return F.options;const t=F.options.filter(t=>t.id!==e);return k(e=>d({},e,{options:t})),t};return n.useEffect(()=>{C({type:"updateForm",payload:{index:v,formConfig:F}})},[F]),console.log("surveyQuestionConfig",F.options[0].optionWeightage),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},m("CS_COMMON_QUESTION")+" "+(v+1)+" "),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD")},defaultValue:I.category,name:"questions["+v+"].category",control:N,render:e=>l.createElement(t.Dropdown,{t:m,option:R,placeholder:"Select Category *",optionKey:"i18Key",selected:F.category,select:t=>{var n;e.onChange(t),n=t,k(e=>d({},e,{category:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:_})}),(null===(a=B.questions)||void 0===a||null===(o=a[v])||void 0===o?void 0:o.category)&&l.createElement(t.CardLabelError,null,B.questions[v].category.message),l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD"),maxLength:{value:500,message:"Question length should be less than or equal to 500 characters"},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:"Input should not start with a number"}},defaultValue:I.questionStatement,name:"questions["+v+"].questionStatement",control:N,render:e=>l.createElement(t.TextInput,{placeholder:m("CS_COMMON_TYPE_QUESTION")+" *",value:F.questionStatement,onChange:t=>{var n;n=t,k(e=>d({},e,{questionStatement:n.target.value})),e.onChange(t)},textInputStyle:{width:"100%"},disable:_})}),(null===(r=B.questions)||void 0===r||null===(u=r[v])||void 0===u?void 0:u.questionStatement)&&l.createElement(t.CardLabelError,null,B.questions[v].questionStatement.message),l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD")},defaultValue:I.type,name:"questions["+v+"].type",control:N,render:e=>l.createElement(t.Dropdown,{t:m,option:O,placeholder:"Select Question Type *",optionKey:"i18Key",selected:F.type,select:t=>{var n;e.onChange(t),n=t,k(e=>d({},e,{type:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:_})}),(null===(s=B.questions)||void 0===s||null===(c=s[v])||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,B.questions[v].type.message),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,a,o,r,u,s;switch(null==e?void 0:e.value){case"MULTIPLE_ANSWER_TYPE":return l.createElement("div",null,(null===(n=B.questions)||void 0===n||null===(a=n[v])||void 0===a?void 0:a.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:I.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(ni,{updateOption:t=>{const n=H(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=V(t);e.onChange(n)},options:null==F?void 0:F.options,createNewSurvey:T,isInputDisabled:M,isPartiallyEnabled:b,formDisabled:D,maxLength:500,minWeight:0,maxWeight:10,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),t:m})}));case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,(null===(o=B.questions)||void 0===o||null===(r=o[v])||void 0===r?void 0:r.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:I.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(ei,{updateOption:t=>{const n=H(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=V(t);e.onChange(n)},options:null==F?void 0:F.options,isInputDisabled:M,isPartiallyEnabled:b,createNewSurvey:T,formDisabled:D,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:m})}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement("div",null,(null===(u=B.questions)||void 0===u||null===(s=u[v])||void 0===s?void 0:s.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:I.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(ai,{updateOption:t=>{const n=H(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=V(t);e.onChange(n)},options:null==F?void 0:F.options,isInputDisabled:M,isPartiallyEnabled:b,createNewSurvey:T,formDisabled:D,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:m})}));default:return null}})(null==F?void 0:F.type)),l.createElement("div",{className:"newSurveyForm_actions"},w>1&&l.createElement("div",{className:"newSurveyForm_seprator"}),w>1&&l.createElement("div",{className:"pointer "+(_?"disabled-btn":""),onClick:()=>C({type:"removeForm",payload:{uuid:y}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},m("CS_INFO_DELETE"))))))))},ri=e=>{let{t:t,formsConfig:a,setSurveyConfig:o,disableInputs:i,isPartiallyEnabled:r,addOption:u,formDisabled:s,controlSurveyForm:c,formState:m,defaultQuestionValuesFromFile1:v}=e;const p=v(),E=[p],[g,f]=n.useReducer((e,t)=>{let{type:n,payload:l}=t;switch(n){case"addNewForm":const t=[...e,p];return l.setSurveyConfig("questions",t),t;case"updateForm":const n=[...e];return n.splice(l.index,1,l),l.setSurveyConfig("questions",n),n;case"removeForm":if(1===e.length)return e;const a=e.filter(e=>e.formConfig.uuid!==l.uuid);return l.setSurveyConfig("questions",a),a}},a||E),h=e=>{let{type:t,payload:n}=e;f({type:t,payload:d({},n,{setSurveyConfig:o})})};return l.createElement("div",{className:"surveyformslist_wrapper"},g.length?g.map((e,n)=>l.createElement("div",{key:e.formConfig?e.formConfig.uuid:e.uuid},l.createElement(ii,d({},e.formConfig?null==e?void 0:e.formConfig:e,{addOption:u,t:t,index:n,disableInputs:i,dispatch:h,isPartiallyEnabled:r,formDisabled:s,controlSurveyForm:c,mainFormState:m,noOfQuestions:null==g?void 0:g.length,defaultQuestionValues:p})))):null,l.createElement("div",{className:"pointer"},g.length<100&&l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},onClick:()=>h({type:"addNewForm"}),disabled:g.length>=100},t("CS_COMMON_ADD_QUESTION"))))},ui=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors","watch"],si=()=>{const e=o.useHistory(),{t:r}=a.useTranslation(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[p,E]=n.useState(null),g=()=>({category:null,questionStatement:"",type:{title:r("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},options:[{id:Date.now(),title:r("CMN_OPTION")+" 1",optionWeightage:0}],required:!1,uuid:Date.now()+Math.random().toString(36).substring(2,11),qorder:null}),f=i.useForm({defaultValues:{questions:[g()]}}),{register:h,control:y,handleSubmit:S,setValue:_,getValues:C,reset:b,formState:T,clearErrors:D}=f,N=m(f,ui);function A(e){console.log("data",e);const t=e.questions.map(e=>{let t={};return t="MULTIPLE_ANSWER_TYPE"===e.type.value||"CHECKBOX_ANSWER_TYPE"===e.type.value||"DROP_DOWN_MENU_ANSWER_TYPE"===e.type.value?{tenantId:c,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value,options:e.options.map(e=>({optionText:e.title.trim(),weightage:parseInt(e.optionWeightage)}))}:{tenantId:c,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value},t});return console.log("qus payload",t),t}return l.createElement("div",{className:"pageCard"},l.createElement(t.Header,null,r("Create Questions")),l.createElement(i.FormProvider,d({register:h,handleSubmit:S,setValue:_,getValues:C,reset:b,formState:T,clearErrors:D},N),l.createElement("form",{onSubmit:S(function(t){try{s(!0);const n={Questions:A(t)},l=v(function(){return Promise.resolve(Digit.Surveys.createQuestions(n)).then(function(t){var n;(null==t||null===(n=t.Questions)||void 0===n?void 0:n.length)>0?(s(!1),E({isError:!1,label:"Questions created successfully"}),setTimeout(()=>{e.push("/digit-ui/employee/engagement/surveys/search-questions")},2e3)):(s(!1),E({isError:!0,label:"Something went wrong"}))})},function(e){console.log("Error in Digit.Surveys.createQuestions:",null==e?void 0:e.response),s(!1),E({isError:!0,label:"Something went wrong"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement(t.Card,null,l.createElement(ri,{t:r,setSurveyConfig:_,addOption:!0,controlSurveyForm:y,formState:T,defaultQuestionValuesFromFile1:g})),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:r("Create Questions"),submit:"submit"})))),p&&l.createElement(t.Toast,{error:p.isError,label:r(p.label),onClose:()=>{E(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},ci=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},di=e=>{var o,r,u,s,c,d,m;let{controlSearchForm:v,searchFormState:p}=e;const{t:E}=a.useTranslation(),g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),f=Digit.ULBService.getCurrentTenantId(),h=Digit.SessionStorage.get("citizen.userRequestObject");let S=!0,_=g.filter(e=>{var t,n;return null==h||null===(t=h.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);var C;0===(null===(o=_)||void 0===o?void 0:o.length)&&(S=!1,_=[{i18nKey:"TENANT_TENANTS_"+(null==h||null===(C=h.info)||void 0===C?void 0:C.tenantId.replace(".","_").toUpperCase()),code:""+(null==h?void 0:h.info.tenantId)}]);const b=n.useMemo(()=>{var e;return(null===(e=_)||void 0===e?void 0:e.length)>0&&!0===S?g.filter(e=>e.code===f):_.filter(e=>e.code===f)},[g]),[T,D]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:f}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:E(e.label),i18Key:e.label,value:e.id}}):[];D(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[f]),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,E("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},defaultValue:null==b?void 0:b[0],render:e=>l.createElement(t.Dropdown,{option:_,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:E}),name:"tenantIds",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(r=p.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},render:e=>l.createElement(t.Dropdown,{option:T,optionKey:"name",selected:e.value,select:t=>e.onChange(t),t:E}),name:"categoryName",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(s=p.errors)||void 0===s||null===(c=s.categoryName)||void 0===c?void 0:c.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Question")),l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{name:"questionStatement",type:"text",value:e.value,onChange:t=>e.onChange(t)}),name:"questionStatement",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(d=p.errors)||void 0===d||null===(m=d.questionStatement)||void 0===m?void 0:m.message)))},mi=e=>{var o;let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),[g,f]=n.useState(!1),[h,y]=n.useState(!1),S=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],_={tenantIds:E[0],categoryName:"",questionStatement:""},C={status:S[0]},b={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},T=Digit.SessionStorage.get("CITIZENSURVEYQUESTION.INBOX"),D=n.useMemo(()=>T||{filterForm:C,searchForm:_,tableForm:b},[Object.values((null==T?void 0:T.filterForm)||{}),Object.values((null==T?void 0:T.searchForm)||{}),Object.values((null==T?void 0:T.tableForm)||{})]),[N,A]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},D);let{data:{Questions:w=[],Errors:I=[]}={},isLoading:x}=Digit.Hooks.survey.useSurveyQuestionInbox(N);const L=null===(o=w)||void 0===o?void 0:o.length,[O,R]=n.useState([]);n.useEffect(()=>{if(w.length>0){const e=[...w].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);w=e,R(e)}},[w]);const P={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},M=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(di,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),F=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(ci,{statuses:S,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==N?void 0:N.filterForm,getFilterFormValue:o})},[S]),k={SearchFormFields:M,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit:",e),A({action:"mutateTableForm",data:d({},N.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),A({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==N?void 0:N.searchForm,resetSearchFormDefaultValues:_,onSearchFormReset:e=>{e("tenantIds",m),e("categoryName",""),e("questionStatement",""),A({action:"mutateSearchForm",data:_})}},B={FilterFormFields:F,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),A({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==N?void 0:N.filterForm,resetFilterFormDefaultValues:C,onFilterFormReset:e=>{e("status",S[0]),A({action:"mutateFilterForm",data:C})}},U=(e=>{var o,i,r,u;let{onPageSizeChange:s,formState:c,totalCount:m,table:v,dispatch:p,inboxStyles:E={},setShowToast:g,setOpenQuesDetailsDialog:f,setQuestionDetailsContent:h}=e;const y=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:S}=a.useTranslation(),_=n.useMemo(()=>[{Header:S("Question"),accessor:"questionStatement",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;console.log("question: ",e),f(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,S(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));h(n)}(null==n?void 0:n.original)},null==n||null===(t=n.original)||void 0===t?void 0:t.questionStatement),l.createElement("span",{className:"tooltiptext",style:{top:"40%",bottom:"auto",left:"50%",marginLeft:"-10px",fontSize:"medium",position:"absolute"}},S("Click here to view the question details"))))}},{Header:S("Is Question Active"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return(e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e))(null===(t=n.original)||void 0===t?void 0:t.status)}},{Header:S("Question Type"),accessor:"questionType",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,S(null===(t=n.original)||void 0===t?void 0:t.type)))}},{Header:S("Is Question Required"),accessor:"isQuestionRequired",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,S(null===(t=n.original)||void 0===t?void 0:t.required)))}},{Header:S("Category"),accessor:"category",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=a.original)||void 0===t||null===(n=t.category)||void 0===n?void 0:n.label))}},{Header:S("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:S("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:S("Update Question Status"),accessor:"updateQuestion",Cell:e=>{let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t;const n=null==e||null===(t=e.original)||void 0===t?void 0:t.status,l="ACTIVE"===n?"INACTIVE":"INACTIVE"===n?"ACTIVE":"";g({label:"Are you sure you want to change the question status from "+n+" to "+l+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original,updatedStatus:l})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},S("Click here to update the question status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(m),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:v,columns:_,noResultsMessage:"No Question found",inboxStyles:d({},E)}})(d({},{parentRoute:r,onPageSizeChange:e=>{A({action:"mutateTableForm",data:d({},N.tableForm,{limit:e.target.value})})},formState:N,totalCount:L,table:O,noResultsMessage:"No Questions found",dispatch:A,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c,openQuesDetailsDialog:g,questionDetailsContent:h,setOpenQuesDetailsDialog:f,setQuestionDetailsContent:y})),H=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e);return{data:null==n?void 0:n.map(e=>({[r("Question")]:e.questionStatement,[r("Status")]:u(e.status),[r("Question Type")]:e.type,[r("Category")]:e.category.label,[r("Created On")]:e.auditDetails.createdTime?we(new Date(e.auditDetails.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:e.auditDetails.lastModifiedTime?we(new Date(e.auditDetails.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Question Status")]:l.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.status,n="ACTIVE"===t?"INACTIVE":"INACTIVE"===t?"ACTIVE":"";o({label:"Are you sure you want to change the question status from "+t+" to "+n+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e,updatedStatus:n})})(e)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))})),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:O,setShowToast:c});function V(){f(!1)}return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Search Questions"),L?l.createElement("p",{className:"inbox-count"},L):null),l.createElement(t.InboxComposer,d({isInboxLoading:x,PropsForInboxLinks:P},k,B,{propsForInboxMobileCards:H,propsForInboxTable:U,formState:N})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData;Digit.Surveys.updateQuestions({Questions:[{uuid:null==e?void 0:e.uuid,status:s.updatedStatus}]}).then(e=>{var t,n,l;(null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0?c({label:"Question status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,style:{padding:"16px"},isWarningButtons:s.isWarningButtons}),g&&l.createElement(So,{onSelect:function(){f(!1)},onCancel:V,onDismiss:V,heading:"Question Details",actionCancel:!0,content:h,hideSubmit:!0}))},vi=e=>{let{children:t,currentStep:n=1,stepsList:o=[]}=e;const{t:i}=a.useTranslation(),r=e=>({display:"flex",alignItems:"center",justifyContent:"flex-end",flex:1,color:e?"#3f51b5":"#ccc",padding:"10px 10px",width:"260px"}),u=e=>{let t;return t=e<=n?"#0D43A7":"#FFFFFF",{width:"60px",height:"60px",borderRadius:"50%",backgroundColor:t,color:e<=n?"white":"black",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"10px",fontWeight:"normal",fontSize:"18px",border:e>n?"1px solid black":"",position:"relative"}},s={fontSize:"18px",color:"#1E1E1E",fontWeight:"500",fontFamily:"Noto Sans,sans-serif",marginRight:"6px"},c={fontSize:"18px",color:"#263238",fontWeight:"400",fontFamily:"Noto Sans,sans-serif",margin:"0px 6px 0px 0px"},d={position:"absolute",width:"2px",height:"50px",backgroundColor:"grey",left:"50%",top:"100%",transform:"translateX(-50%)"},m=(window.Digit.Utils.browser.isMobile(),o.length);return l.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"top",justifyContent:"flex-start"}},l.createElement("div",{className:"stepper-navigation-bar",style:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"50%",marginBottom:"20px"}},[...Array(m)].map((e,t)=>l.createElement("div",{className:"step-content",key:t,style:r(t+1<=n)},l.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",margin:"10px"}},t+1===m?null:l.createElement("div",{className:"step-number",style:c}),l.createElement("div",{className:"step-label",style:s},i(o[t].stepLabel))),l.createElement("div",{className:"step-circle",style:u(t+1)},t+1,t<m-1&&l.createElement("div",{style:d}))))),l.createElement("div",{className:"stepper-body",style:{width:"100%",marginBottom:"20px"}},t))},pi=e=>{let{stepsList:t=[],onSubmit:n,step:o,setStep:i}=e;const r=t.filter(e=>e.isStepEnabled),{t:u}=a.useTranslation();function s(){o<r.length?d():o===r.length&&n()}function c(){o>1&&m()}const d=()=>i(o+1),m=()=>i(o-1);return l.createElement(vi,{currentStep:o,nextStep:d,prevStep:m,stepsList:r},(()=>{var e,t;const n=r[o-1],{component:a,key:i,texts:d,currStepConfig:m}=n,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(a);return l.createElement(l.Fragment,null,l.createElement(v,{config:{key:i,texts:d,component:a,currStepNumber:o,currStepConfig:m},onGoNext:s,onBackClick:c,t:u}))})())},Ei=[{head:"Survey Details",stepNumber:1,body:[{type:"component",component:"NewSurveys",key:"NewSurveys",withoutLabel:!0}]},{head:"Survey Sections",stepNumber:2,body:[{type:"component",component:"SurveyCreationPage",key:"SurveyCreationPage",withoutLabel:!0}]},{head:"Summary",stepNumber:3,body:[{type:"component",component:"SurveySummary",key:"SurveySummary",withoutLabel:!0}]}],gi=(e,t)=>({type:"UPDATE_SURVEY_FORM",payload:{key:e,value:t}}),fi=(e,t)=>({type:"FIELD_CHANGE",surveyId:e,data:t}),hi=e=>({type:"ADD_CATEGORY",id:e}),yi=(e,t)=>({type:"ADD_QUESTIONS",categoryId:e,questions:t}),Si=(e,t)=>({type:"UPDATE_CATEGORY",categoryId:e,data:t}),_i=(e,t,n)=>({type:"UPDATE_MANDATORY_QUESTION_SELECTION",categoryId:e,questionId:t,mandatory:n}),Ci=(e,t)=>({type:"SET_QUESTIONS",categoryId:e,questions:t}),bi=e=>({type:"DELETE_CATEGORY",categoryId:e}),Ti=[{head:"SURVEY_DETAILS",stepLabel:"Survey Details",stepNumber:1,isStepEnabled:!0,type:"component",component:"SurveyFormDetails",key:"surveyFormDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_CATEGORIES",stepLabel:"Survey Sections",stepNumber:2,isStepEnabled:!0,type:"component",component:"SurveyFormCategoryDetails",key:"surveyFormCategoryDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_SUMMARY",stepLabel:"Summary",stepNumber:3,isStepEnabled:!0,type:"component",component:"SurveryFormSummary",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"Submit"}}].map(e=>d({},e,{currStepConfig:Ei.filter(t=>t.stepNumber===e.stepNumber)})),Di=()=>{o.useHistory();const{t:e}=a.useTranslation(),i=u.useDispatch(),[r,s]=n.useState(null),c=u.useSelector(e=>e.engagement.surveyForm),d=c.step;return Digit.ULBService.getCurrentTenantId(),console.log("formState: ",c),l.createElement("div",{class:"pageCard"},l.createElement("h1",{style:{color:"black",fontFamily:"Noto Sans,sans-serif",fontSize:"28px",fontWeight:"500"}},e("CREATE_NEW_SURVEY")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"50px"}}),l.createElement(pi,{stepsList:Ti,onSubmit:()=>{},step:d,setStep:e=>{i((e=>({type:"SET_SURVEY_STEP",payload:e}))(e))}}),r&&l.createElement(t.Toast,{error:r.key,label:e(r.label),onClose:()=>{s(null)},isDleteBtn:"true"}))},Ni=e=>{let{formData:o,setFormData:i,errors:r,setErrors:u,stateCode:s,Otp:c,setGetOtp:m,setUser:v}=e;const{data:p}=Digit.Hooks.useTenants(),[E,g]=n.useState(null),{t:f}=a.useTranslation(),h=Digit.ULBService.getCurrentTenantId(),y=n.useMemo(()=>null==p?void 0:p.filter(e=>h===(null==e?void 0:e.code)),[p,h]);n.useEffect(()=>{y&&y.length>0&&i(e=>d({},e,{city:y[0]}))},[y]);const{data:S}=Digit.Hooks.pt.useGenderMDMS(s,"common-masters","GenderType"),_=n.useMemo(()=>(null==S?void 0:S.map(e=>({i18nKey:"PT_COMMON_GENDER_"+e.code,code:e.code,value:e.code})))||[],[S]),C=e=>{const{name:t,value:n}=e.target;i(e=>d({},e,{[t]:n}))};return n.useEffect(()=>{console.log("UPDATED formData",o)},[o]),l.createElement("div",{style:{border:"2px solid #ccc",padding:"15px",borderRadius:"4px"}},l.createElement("h2",null,"Citizen Details"),l.createElement("div",{style:{border:"1px solid #ccc"}}),l.createElement("h3",null,"Mobile Number ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"mobile",value:o.mobile,onChange:C,placeholder:"Enter Mobile Number",required:!0,maxLength:10}),r.mobile&&l.createElement("span",{className:"error"},r.mobile),l.createElement("h3",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"city",name:"city",option:p,className:"cityCss",select:e=>{return t=e,void i(e=>d({},e,{city:t}));var t},placeholder:"Select City",optionKey:"i18nKey",t:f,disable:"pb.punjab"!==h,selected:"pb.punjab"===h?null==o?void 0:o.city:null==y?void 0:y[0]}),r.city&&l.createElement("span",{className:"error"},r.city),l.createElement("label",{onClick:()=>{const e=(()=>{const e={};return o.mobile?/^\d{10}$/.test(o.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",o.city||(e.city="City is required"),e})();if(u(e),0===Object.keys(e).length){var t,n;const e={userName:null==o?void 0:o.mobile,tenantId:(null==o||null===(t=o.city)||void 0===t?void 0:t.code).split(".")[0]},l={tenantId:(null==o||null===(n=o.city)||void 0===n?void 0:n.code).split(".")[0]};Digit.Surveys.userSearch(e,l).then(e=>{var t,n,l,a,o;v(null==e||null===(t=e.user)||void 0===t?void 0:t[0]),console.log("response=====",null==e||null===(n=e.user)||void 0===n?void 0:n[0]),console.log("response",null===(l=e.user[0])||void 0===l?void 0:l.emailId),("200"===(null==e||null===(a=e.responseInfo)||void 0===a?void 0:a.status)||"201"===(null==e||null===(o=e.responseInfo)||void 0===o?void 0:o.status))&&(null==e?void 0:e.user.length)>0?(console.log("coming here na"),i(t=>{var n,l,a,o;return d({},t,{citizenFound:!0,name:null===(n=e.user[0])||void 0===n?void 0:n.name,email:null===(l=e.user[0])||void 0===l?void 0:l.emailId,gender:null===(a=e.user[0])||void 0===a?void 0:a.gender,dob:null===(o=e.user[0])||void 0===o?void 0:o.dob,register:!1,user:e.user[0]})})):(console.log("not here"),i(e=>d({},e,{citizenFound:!1})),g({key:!0,isError:!0,label:"CITIZEN NOT FOUND FOR THE GIVEN DETAILS"}))}).catch(e=>{console.log(e)})}}},"Fetch Details"),!1===o.citizenFound&&l.createElement("div",{style:{display:"flex",flexDirection:"row",columnGap:"10px"}},l.createElement("h3",null,"Do you want to register?"),l.createElement("label",{style:{backgroundColor:"green"},onClick:()=>{i(e=>d({},e,{register:!0}))}},"Yes"),l.createElement("label",{style:{backgroundColor:"red"},onClick:()=>{i(e=>d({},e,{register:!1}))}},"No")),(!0===o.register||!0===o.citizenFound)&&l.createElement(n.Fragment,null,l.createElement("h3",null,"Citizen Name"),l.createElement("input",{type:"text",name:"name",value:o.name,onChange:C,placeholder:"Citizen Name",readOnly:o.citizenFound,maxLength:100}),r.name&&l.createElement("span",{className:"error"},r.name),l.createElement("h3",null,"Citizen Gender"),l.createElement("select",{id:"dropdown",value:null==o?void 0:o.gender,onChange:e=>{return t=e,void i(e=>d({},e,{gender:t.target.value}));var t}},l.createElement("option",{value:""},"--Please choose an option--"),_.map((e,t)=>l.createElement("option",{key:t,value:e.value},e.value))),r.gender&&l.createElement("span",{className:"error"},r.gender),l.createElement("h3",null,"Citizen Email"),l.createElement("input",{type:"email",id:"emailInput",name:"email",value:o.email,onChange:C,placeholder:"Citizen Email",defaultValue:o.email}),r.email&&l.createElement("span",{className:"error"},r.email),l.createElement("h3",null,"Citizen Date of Birth"),l.createElement("input",{name:"dob",type:"date",onChange:e=>{const{name:t,value:n}=e.target;i(e=>d({},e,{[t]:n}))},defaultValue:o.dob,value:o.dob}),r.dob&&l.createElement("span",{className:"error"},r.dob),!0===o.register&&l.createElement("label",{onClick:()=>(()=>{const e={otp:{name:o.name,permanentCity:o.city.code,tenantId:""+s,mobileNumber:o.mobile,type:"register"}};try{Digit.UserService.sendOtp(e,s).then(e=>{!0===(null==e?void 0:e.isSuccessful)?m(!0):(g({key:!0,isError:!0,label:""+e}),m(!1))})}catch(e){m(!1)}})()},"Get OTP")),!0===c?l.createElement(n.Fragment,null,l.createElement("h3",{style:{marginTop:"20px"}},"OTP"),l.createElement("input",{type:"text",name:"otp",value:o.otp,onChange:C,placeholder:"Enter Otp"}),r.otp&&l.createElement("span",{className:"error"},r.otp)):null,E&&l.createElement(t.Toast,{error:E.isError,label:f(E.label),onClose:()=>{g(null)},isDleteBtn:"true"}))},Ai=e=>{var i;let{stateCode:r}=e;const u=o.useHistory(),{t:s}=a.useTranslation(),c=o.useLocation(),[m,p]=n.useState();console.log("loca",c.state.surveyDetails);const E=(null===(i=c.state)||void 0===i?void 0:i.surveyDetails)||{};console.log("surv det",E),Digit.UserService.getUser(),Digit.ULBService.getCurrentTenantId();const[g,f]=n.useState(null),[h,y]=n.useState(null),[S,_]=n.useState(!1),[C,b]=n.useState({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null});console.log("formData",C);const[T,D]=n.useState({});function N(e){const t=new Date(e),n=new Date;let l=n.getFullYear()-t.getFullYear();const a=n.getMonth()-t.getMonth();return(a<0||0===a&&n.getDate()<t.getDate())&&l--,l}return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},E.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},E.surveyDescription))),l.createElement("form",{onSubmit:function(e){try{let t=!1;if(e.preventDefault(),null===C.citizenFound)return f({key:!0,isError:!0,label:"PLEASE CLICK ON FETCH DETAILS BUTTON"}),Promise.resolve();const n=!0===C.register?(()=>{const e={};C.name?/^[A-Za-z\s]+$/.test(C.name)||(e.name="Name can only contain alphabets and spaces"):e.name="Name is required",C.email?/\S+@\S+\.\S+/.test(C.email)||(e.email="Invlid Email"):e.email="Email is required",C.gender||(e.gender="Gender is required");const t=N(C.dob);return C.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",C.mobile?/^\d{10}$/.test(C.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",C.city||(e.city="City is required"),C.otp||(e.otp="Otp is required"),D(e),0===Object.keys(e).length})():!0===C.citizenFound?(()=>{const e={};C.mobile?/^\d{10}$/.test(C.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",C.city||(e.city="City is required"),C.email?/\S+@\S+\.\S+/.test(C.email)||(e.email="Invlid Email"):e.email="Email is required",C.gender||(e.gender="Gender is required");const t=N(C.dob);return C.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",D(e),0===Object.keys(e).length})():null,l=function(){if(n){console.log("Form submitted:",C),console.log("reg",C.register,C.citizenFound),console.log("getUser",m);const e=C.user,n=function(){if((!1===C.register||null===C.register)&&!0===C.citizenFound){function n(e){var n;if(t)return e;console.log("formData",C),u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:C,userInfo:C.user,surveyDetails:E,userType:null===(n=c.state)||void 0===n?void 0:n.userType})}const l=C.email&&C.email!==(null==e?void 0:e.emailId),a=C.gender&&C.gender!==(null==e?void 0:e.gender),o=C.dob&&C.dob!==(null==e?void 0:e.dob),i=function(){if(l||a||o){const e=d({},m,l&&{emailId:C.email},a&&{gender:C.gender},o&&{dob:C.dob}),n=v(function(){return Promise.resolve(Digit.UserService.updateUser(e,null==m?void 0:m.tenantId)).then(function(e){let{user:t}=e;console.log("User updated:",t)})},function(e){console.error("Error updating user:",e),f({key:!0,isError:!0,label:"FAILED TO UPDATE USER INFORMATION"}),t=!0});if(n&&n.then)return n.then(function(){})}else console.log("No user info changed. Skipping API call.")}();return i&&i.then?i.then(n):n(i)}(()=>{let e={name:C.name,username:C.mobile,otpReference:C.otp,tenantId:""+r,permanentCity:C.city.code};try{Digit.UserService.registerUser(e,r).then(e=>{null===(null==e?void 0:e.UserRequest)&&void 0===(null==e?void 0:e.UserRequest)||u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:C,userInfo:e.UserRequest,surveyDetails:E}),console.log("res",e)})}catch(e){console.log(e)}})()}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},l.createElement(Ni,{formData:C,setFormData:b,errors:T,setErrors:D,stateCode:r,Otp:S,setGetOtp:_,city:null==C?void 0:C.city,getUser:m,setUser:p}),l.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"10px",flexDirection:"row",marginTop:"10px"}},l.createElement("button",{type:"submit"},"Next"),l.createElement("button",{style:{backgroundColor:"none"},onClick:()=>b({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null})},"Reset")))),g&&l.createElement(t.Toast,{error:g.isError,label:s(g.label),onClose:()=>{f(null)},isDleteBtn:"true"}))},wi=e=>{var n;const{t:o}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response[0])||void 0===n?void 0:n.uuid,info:e.props.isSuccess?o("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Ii=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),o.useHistory()),[c,d]=n.useState(!1);return n.useEffect(()=>{i.clear(),window.history.replaceState(null,"CREATE_SURVEY_STATE")},[]),l.createElement(t.Card,null,l.createElement(wi,{props:e.location.state}),l.createElement(t.CardText,null,u("SURVEY_FORM_CREATION_MESSAGE",{surveyName:null==e?void 0:e.title,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.startDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.endDate)})),l.createElement(t.ActionBar,null,l.createElement("button",{onClick:()=>{d(e=>!e)}},l.createElement(t.SubmitBar,{label:"Action"}),c&&l.createElement(t.Menu,{options:[u("GO_BACK_TO_HOME"),u("CREATE_ANOTHER_SURVEY")],onSelect:e=>{e===u("GO_BACK_TO_HOME")?s.replace("/digit-ui/employee"):e===u("CREATE_ANOTHER_SURVEY")&&s.replace("/digit-ui/employee/engagement/surveys/create-survey-step-form")}}))))},xi=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_SURVEY_UPDATED":"ENGAGEMENT_SURVEY_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess&&null!=o&&null!==(i=o.data)&&void 0!==i&&null!==(r=i.Surveys)&&void 0!==r&&null!==(u=r[0])&&void 0!==u&&u.uuid?null==o||null===(m=o.data)||void 0===m||null===(v=m.Surveys)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid:o.isSuccess?null===(s=o.data)||void 0===s||null===(c=s.Documents)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.uuid:""),info:e.isSuccess?n("SURVEY_FORM_ID"):"",successful:e.isSuccess});var o,i,r,u,s,c,d,m,v,p},Li=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useUpdate()),{state:c}=e.location;return n.useEffect(()=>{c&&s.mutate(c,{onSuccess:()=>{i.clear(),window.history.replaceState(null,"UPDATE_SURVEY_STATE")}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(xi,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Oi=e=>{let{t:a,question:o,control:r,register:u,formState:s,formDisabled:c,index:d}=e;const m=null==s?void 0:s.errors;if(o)return l.createElement(t.Card,null,l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("span",{className:"question-title"},d+1,". ",o.questionStatement," ",null!=o&&o.required?"*":""),l.createElement("span",null,(e=>{var s,d,v,p,E,g,f,h;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:200,message:a("EXCEEDS_200_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(s=m[o.uuid])||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(d=m[o.uuid])||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_200_CHAR_LIMIT")));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:o.uuid,disabled:c,inputRef:u({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(v=m[o.uuid])||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(p=m[o.uuid])||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_500_CHAR_LIMIT")));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.RadioButtons,{disabled:c,onSelect:n,selectedOption:a,optionsKey:"",options:[...o.options]})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(E=m[o.uuid])||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement("div",{className:"align-columns"},o.options.map(e=>{var o;return l.createElement(t.CheckBox,{disable:c,key:e,onChange:t=>{t.target.checked?n([e,...a||[]]):a&&n(null==a?void 0:a.filter(t=>t!==e))},checked:"string"==typeof a?!(null===(o=[a])||void 0===o||!o.find(t=>t===e)):!(null==a||!a.find(t=>t===e)),label:e,checkboxWidth:{width:"34px",height:"34px"},style:{marginTop:"5px",overflowWrap:"break-word"}})}))}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(g=m[o.uuid])||void 0===g?void 0:g.type)&&l.createElement(t.CardLabelError,{style:{marginTop:"20px"}},a("CS_COMMON_REQUIRED")));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{disabled:c,type:"date",onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(f=m[o.uuid])||void 0===f?void 0:f.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",disabled:c,onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(h=m[o.uuid])||void 0===h?void 0:h.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));default:return l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:60,message:a("EXCEEDS_60_CHAR_LIMIT")},required:o.required})})}})(o.type))))},Ri=e=>{var n,o;let{surveyData:r,onFormSubmit:u,submitDisabled:s,formDisabled:c,formDefaultValues:d,isLoading:m,showToast:v,isSubmitDisabled:p}=e;const{register:E,control:g,handleSubmit:f,getValues:h,formState:y}=i.useForm({defaultValues:d}),{t:S}=a.useTranslation();return m?l.createElement(t.Loader,null):l.createElement("div",{className:"citizenSurvey-wrapper"},l.createElement(t.Header,null,null==r||null===(n=r.title)||void 0===n?void 0:n.toUpperCase()),l.createElement("form",{onSubmit:f(u)},null!=r&&null!==(o=r.questions)&&void 0!==o&&o.length?r.questions.map((e,t)=>l.createElement(Oi,{key:t,t:S,question:e,control:g,register:E,values:h,formState:y,formDisabled:c,index:t})):null,v&&l.createElement(t.Toast,{error:v.key,label:S(v.label)}),l.createElement(t.ActionBar,null,!s&&l.createElement(t.SubmitBar,{disabled:p,label:S("CS_SUBMIT_SURVEY"),submit:"submit"}))))},Pi=(e,t)=>{let n=[];return e.map(e=>{let l={};"Check Boxes"===e.type?(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,l.answers=[],t.map(t=>{var n,a;e.uuid===t.questionId&&(l.timeStamp=Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)+" "+Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime),l.answers=[...l.answers,t.answer])})):(l.type=e.type,l.questionStatement=e.questionStatement,l.options=e.options,t.map(t=>{if(e.uuid===t.questionId){var n,a;l.timeStamp=Digit.DateUtils.ConvertEpochToDate(null==t||null===(n=t.auditDetails)||void 0===n?void 0:n.lastModifiedTime)+" "+Digit.DateUtils.ConvertEpochToTimeInHours(null==t||null===(a=t.auditDetails)||void 0===a?void 0:a.lastModifiedTime);const e=l.answers;e&&e.push(t.answer[0]),l.answers=e||[t.answer[0]]}})),n.push(l)}),n},Mi=e=>{let{t:t,userInfo:n}=e;const a=Object.entries(n);return l.createElement("div",{style:{margin:"30px"}},l.createElement("header",{style:{fontSize:"30px",fontWeight:"bold"}},t("WHO_RESPONDED")),l.createElement("div",{style:{display:"flex",padding:"8px 4px","background-color":"#FAFAFA",border:"1px solid #D6D5D4",boxSizing:"borderBox",borderRadius:"4px",marginTop:"20px",marginBottom:"20px"}},l.createElement("div",{style:{flex:"50%",padding:"10px"}},l.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_EMAIL")),a.map(e=>l.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[1]))),l.createElement("div",{style:{flex:"50%",padding:"10px"}},l.createElement("header",{style:{fontWeight:"bold",fontSize:"25px"}},t("SURVEY_PHONE_NUMBER")),a.map(e=>l.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[0])))))},Fi=e=>{let{surveyTitle:a,surveyDesc:i,t:r,surveyId:u}=e;const s=o.useHistory(),c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser().info,v=c.filter(e=>{var t;return null==m||null===(t=m.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=n.useMemo(()=>c.filter(e=>e.code===d),[c]);return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("LABEL_FOR_ULB")+" * :"),l.createElement("div",{style:{display:"grid",gridAutoFlow:"row"}},l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:v,selected:p,keepNull:!0,disable:!0,t:r}),l.createElement(t.RemoveableTag,{key:"tag",text:r(v[0].i18nKey),extraStyles:{tagStyles:{display:"flex"}}})),l.createElement(t.LinkLabel,{onClick:()=>s.push("/digit-ui/employee/engagement/surveys/inbox/details/"+u)},r("VIEW_SURVEY_QUESTIONS"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",disable:!0,value:a})),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",disable:!0,value:i})))},ki=["#8E29BF","#FBC02D","#048BD0","#EA8A3B","#0BABDE","#800080","#ee82ee","#616161","#3cb371","#6a5acd"],Bi=Math.PI/180,Ui=e=>{let{cx:t,cy:n,midAngle:a,innerRadius:o,outerRadius:i,percent:r}=e;const u=o+.5*(i-o),s=t+u*Math.cos(-a*Bi),c=n+u*Math.sin(-a*Bi);return l.createElement("text",{x:s,y:c,fill:"white",textAnchor:s>t?"start":"end",dominantBaseline:"central"},(100*r).toFixed(0)+"%")},Hi=e=>{const{payload:t}=e;return l.createElement("div",{style:{display:"flex",flexDirection:"column",height:"300px"}},l.createElement("div",{style:{overflow:"auto",flex:"1"}},l.createElement("ul",{style:{listStyle:"disc"}},null==t?void 0:t.map((e,t)=>l.createElement("li",{key:"item-"+t,style:{display:"list-item",color:e.color,fontSize:"19px"}},e.value)))))},Vi=e=>{const t=(e=>{const t=e.options,n=e.answers,l=[];return null==t||t.map(e=>l.push({name:e,value:0})),null==n||n.map((e,t)=>{null==l||l.map((t,n)=>{t.name===e&&(l[n].value=l[n].value+1)})}),l})(e.data);return l.createElement(s.PieChart,{width:400,height:400},l.createElement(s.Pie,{data:t,cx:200,cy:200,labelLine:!1,label:Ui,outerRadius:120,fill:"#8884d8",dataKey:"value"},null==t?void 0:t.map((e,t)=>l.createElement(s.Cell,{key:"cell-"+t,fill:ki[t%ki.length]}))),l.createElement(s.Tooltip,null),l.createElement(s.Legend,{content:Hi,width:100,align:"right",wrapperStyle:{top:40,right:20,left:500,backgroundColor:"#FAFAFA",borderRadius:3,lineHeight:"40px"}}))},Wi=e=>{const t=(e=>{const t=[],n=e.answers;return e.options.map(e=>{const l={};l.name=e,l.value=0,n.map(t=>{t.map(t=>{t===e&&(l.value=l.value+1)})}),t.push(l)}),t})(e.data);return l.createElement("div",{style:{padding:"10px",width:"700px",height:"260px",backgroundColor:"#fafafa"}},l.createElement(s.ResponsiveContainer,null,l.createElement(s.BarChart,{data:t,layout:"vertical",margin:{top:0,right:50,left:0,bottom:0},barCategoryGap:8},l.createElement(s.CartesianGrid,{strokeDasharray:"3 3"}),l.createElement(s.XAxis,{type:"number"}),l.createElement(s.YAxis,{type:"category",width:150,padding:{left:20},dataKey:"name"}),l.createElement(s.Bar,{dataKey:"value",fill:"#048BD0"}),l.createElement(s.Tooltip,null))))},qi=e=>{const t=e.split("-");return{day:t[2],date:["January","February","March","April","May","June","July","August","September","October","November","December"][t[1]-1]+" "+t[0]}},ji=e=>{let{surveyInfo:o,responsesInfoMutation:i}=e;const{t:r}=a.useTranslation(),[u,s]=n.useState(null),[c,d]=n.useState({}),m=Digit.ULBService.getCurrentTenantId();return n.useEffect(function(){try{const e=function(){if(i.isSuccess){const e=Pi(null==o?void 0:o.questions,i.data.answers);return s(e),Promise.resolve(function(e,t){try{let n={},l=[];return l=null==e?void 0:e.map(e=>Digit.UserService.userSearch(t,{uuid:[null==e?void 0:e.citizenId]},{}).then(e=>e)),Promise.resolve(Promise.all(l)).then(function(e){var t;return l=e,l&&(null===(t=l)||void 0===t?void 0:t.length)>0&&l.map(e=>{var t,l,a,o;n["+91 "+(null==e||null===(t=e.user)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.mobileNumber)]=null==e||null===(a=e.user)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.emailId}),n})}catch(e){return Promise.reject(e)}}(i.data.answers,m.split(".")[0])).then(function(e){d(e)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[i]),u?l.createElement("div",{className:"custom-group-merge-container"},l.createElement(t.Header,null,r("CS_COMMON_SURVEYS")),l.createElement(t.MultiLink,{style:{marginTop:"-45px"},onHeadClick:()=>(()=>{const e=((e,t)=>{const n=parseInt(t.length/e.length),l=Pi(null==o?void 0:o.questions,i.data.answers),a=[];for(let t=0;t<n;t++){const n={TimeStamp:""};null==e||e.map(e=>{n[e.questionStatement]=""});const o=null==e?void 0:e.map(e=>e.questionStatement);null==o||o.map(e=>{var a,o,i,r,u,s,c,d,m,v,p,E,g,f,h,y;const S=null==l?void 0:l.filter(t=>(null==t?void 0:t.questionStatement)===e),_="object"==typeof(null==S||null===(a=S[0])||void 0===a||null===(o=a.answers)||void 0===o?void 0:o[t])?null!=S&&null!==(i=S[0])&&void 0!==i&&null!==(r=i.answers)&&void 0!==r&&null!==(u=r[t])&&void 0!==u&&null!==(s=u.join())&&void 0!==s&&s.includes("ul")?"NA":null==S||null===(c=S[0])||void 0===c||null===(d=c.answers)||void 0===d||null===(m=d[t])||void 0===m?void 0:m.join():"ul"===(null==S||null===(v=S[0])||void 0===v||null===(p=v.answers)||void 0===p?void 0:p[t])||""===(null==S||null===(E=S[0])||void 0===E||null===(g=E.answers)||void 0===g?void 0:g[t])?"NA":null==S||null===(f=S[0])||void 0===f||null===(h=f.answers)||void 0===h?void 0:h[t];n[e]=_,n.TimeStamp=null==S||null===(y=S[0])||void 0===y?void 0:y.timeStamp}),a.push(n)}return a})(null==o?void 0:o.questions,i.data.answers);return Digit.Download.Excel(e,i.data.title)})(),downloadBtnClassName:"employee-download-btn-className",label:r("SURVEY_REPORT")}),l.createElement(t.Card,null,l.createElement("div",{style:{margin:"30px"}},l.createElement(Fi,{surveyTitle:o.title,surveyDesc:o.description,t:r,surveyId:o.uuid})),l.createElement(Mi,{t:r,userInfo:c}),null==u?void 0:u.map(e=>{var n;return function(e,n,a,o,i){switch(void 0===o&&(o=0),a){case"Short Answer":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Date":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"date-response"},l.createElement("div",null,qi(e).date),l.createElement("div",{className:"divide"}),l.createElement("div",null,qi(e).day)))));case"Time":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>{return l.createElement("div",{className:"date-response"},l.createElement("div",null,e),l.createElement("div",{className:"divide"}),l.createElement("div",null,((t=(t=e).toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[t]).length>1&&((t=t.slice(1))[5]=+t[0]<12?" AM":" PM",t[0]=+t[0]%12||12),t.join(""))));var t})));case"Paragraph":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Check Boxes":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{padding:"30px"}},l.createElement(Wi,{data:e})));case"Multiple Choice":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{overflow:"-moz-hidden-unscrollable"}},l.createElement(Vi,{data:e})))}}(e,null==e?void 0:e.answers,null==e?void 0:e.type,null==e||null===(n=e.answers)||void 0===n?void 0:n.length,r)}))):l.createElement(t.Loader,null)},zi={SHORT_ANSWER_TYPE:"Short Answer",LONG_ANSWER_TYPE:"Paragraph",MULTIPLE_ANSWER_TYPE:"Multiple Choice",CHECKBOX_ANSWER_TYPE:"Check Boxes",DATE_ANSWER_TYPE:"Date",TIME_ANSWER_TYPE:"Time"},Yi=()=>{const e=Digit.ULBService.getCurrentTenantId(),a=o.useParams(),i=Digit.Hooks.survey.useShowResults(),u=r.useQueryClient();n.useEffect(()=>{i.mutate({surveyId:a.id},{onSuccess:()=>{u.clear()}})},[]);const{isLoading:s,data:c}=Digit.Hooks.survey.useSearch({tenantIds:e,uuid:a.id},{select:e=>{var t;const n=null==e||null===(t=e.Surveys)||void 0===t?void 0:t[0];return{uuid:n.uuid,title:n.title,description:n.description,fromDate:we(new Date(n.startDate),"yyyy-MM-dd"),toDate:we(new Date(n.endDate),"yyyy-MM-dd"),fromTime:we(new Date(n.startDate),"hh:mm"),toTime:we(new Date(n.endDate),"hh:mm"),questions:n.questions.map(e=>{let{questionStatement:t,type:n,required:l,options:a,uuid:o,surveyId:i}=e;return{questionStatement:t,type:zi[n],required:l,options:a,uuid:o,surveyId:i}}),status:n.status,answersCount:n.answersCount}}});return s?l.createElement(t.Loader,null):l.createElement(ji,{surveyInfo:c,responsesInfoMutation:i})},Gi=e=>{var n,o;const{t:i}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Ki=e=>{r.useQueryClient();const{t:n}=a.useTranslation();return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Gi,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},Qi=e=>{const a=e.location.state.data;console.log("questions data",a);const[o,i]=n.useState(""),r=e=>{i("")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("form",null,a.sections.length>0?a.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((e,a)=>l.createElement("div",null,l.createElement("h3",null,e.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},a+1,". ",e.question.questionStatement," ",(null==e?void 0:e.required)&&l.createElement("span",{style:{color:"red"}},"*")),((e,a,i)=>{switch(console.log("answer type",e,a),e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,disable:!0,textInputStyle:{maxWidth:"none"},type:"text"}));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},disable:!0,disabled:!0}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:o,onChange:r},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,disabled:!0,required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText))));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,disabled:!0}),e.optionText))));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},disable:!0}));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},disable:!0}));default:return l.createElement(t.TextInput,{name:a.uuid,disable:!0,type:"text"})}})(e.question.type,e.question),l.createElement("div",null)))))):null)))},Xi=e=>{var a,o,i,r,s,c,d;let{t:m,registerRef:v,controlSurveyForm:p,surveyFormState:E,surveyFormData:g,readOnly:f}=e;const h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),{data:_,isLoading:C}=Digit.Hooks.useTenants();console.log("cities",_),n.useEffect(()=>{if(!C&&null!=_&&_.length&&(null==D||!D.ulb)){const e=null==_?void 0:_.find(e=>e.code===S);e&&T(fi(D.id,{ulb:e}))}},[_,C,S]);const b=Digit.UserService.getUser().info,T=u.useDispatch(),D=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);console.log("surveyDetails====",D);const N=h.filter(e=>{var t;return null==b||null===(t=b.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);console.log("userulbs",N),n.useMemo(()=>h.filter(e=>e.code===S),[h]);const A=e=>{const{name:t,value:n}=e.target;T(fi(D.id,{[t]:n}))};return console.log("survey deta",D),console.log("bb",g,E,v,p),l.createElement("div",{className:"create-survey-card"},l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"ulb",name:"ulb",option:_,className:"cityCss",select:e=>{T(fi(D.id,{ulb:e}))},placeholder:"Select City",optionKey:"i18nKey",t:m,selected:D.ulb}),(null==E||null===(a=E.errors)||void 0===a?void 0:a.tenantIds)&&l.createElement(t.CardLabelError,null,m("ES_ERROR_REQUIRED"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,m("CS_SURVEY_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,{name:"name",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED"),maxLength:{value:500,message:m("Survey Name length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:D.name,onChange:A,placeholder:"Enter Survey Name",disable:f||!1}),(null==E||null===(o=E.errors)||void 0===o?void 0:o.title)&&l.createElement(t.CardLabelError,null,null==E||null===(i=E.errors)||void 0===i||null===(r=i.title)||void 0===r?void 0:r.message))),l.createElement("div",{className:"survey-column",style:{width:"100%"}},l.createElement("label",null,m("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",inputRef:v({maxLength:{value:500,message:m("Survey Description length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:D.description,onChange:A,placeholder:"Enter Survey Description",disable:f||!1}),(null==E||null===(s=E.errors)||void 0===s?void 0:s.description)&&l.createElement(t.CardLabelError,null,null==E||null===(c=E.errors)||void 0===c||null===(d=c.description)||void 0===d?void 0:d.message)))},Zi=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,t.getFullYear()+"-"+n+"-"+l},$i=e=>{var n,a,o,r,s,c,d,m;let{t:v,controlSurveyForm:p,surveyFormState:E,enableEndDateTimeOnly:g,readOnly:f}=e;const h=null==E?void 0:E.errors,y=u.useDispatch(),{getValues:S}=i.useFormContext(),_=(new Date).getTime(),C=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),b=e=>{const{name:t,value:n}=e.target;y(fi(C.id,{[t]:n}))};return l.createElement("div",{className:"create-survey-card"},l.createElement("div",null,l.createElement(t.CardSectionHeader,null,v("Survey Publish Period")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"20px"}})),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromDate",defaultValue:C.fromDate,onChange:b,rules:{required:!0,validate:g?null:{isValidFromDate:e=>{const t=new Date(e).getTime(),n=S("toDate")?new Date(S("toDate")).getTime():(new Date).getTime();return e===S("toDate")&&e>=Zi(_)||n>=t&&e>=Zi(_)}}},render:e=>l.createElement(t.TextInput,{name:"fromDate",type:"date",onChange:b,defaultValue:C.fromDate,disable:f||!1})}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(n=h.fromDate)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(a=h.fromDate)||void 0===a?void 0:a.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_FROM_DATE_ERROR_INVALID"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromTime",defaultValue:C.fromTime,rules:{required:!0,validate:{isValidFromTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"fromTime",type:"time",onChange:b,defaultValue:C.fromTime,disable:f||!1})}),h&&(null==h?void 0:h.fromTime)&&"required"===(null==h||null===(o=h.fromTime)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromTime)&&"isValidFromDate"===(null==h||null===(r=h.fromTime)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toDate",defaultValue:C.toDate,rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>=(S("fromDate")?new Date(S("fromDate")).getTime():(new Date).getTime())}},render:e=>l.createElement(t.TextInput,{name:"toDate",type:"date",onChange:b,defaultValue:C.toDate,disable:f||!1})}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(s=h.toDate)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(c=h.toDate)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))," "),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toTime",defaultValue:null==C?void 0:C.toTime,rules:{required:!0,validate:{isValidToTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"toTime",type:"time",onChange:b,defaultValue:C.toTime,disable:f||!1})}),h&&(null==h?void 0:h.toTime)&&"required"===(null==h||null===(d=h.toTime)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toTime)&&"isValidToDate"===(null==h||null===(m=h.toTime)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))))},Ji=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],er=e=>{let{t:t,initialFormValues:a,onSubmit:o,isFormDisabled:r=!1,readOnly:u}=e;const s=i.useForm({defaultValues:a}),{register:c,control:v,handleSubmit:p,setValue:E,getValues:g,reset:f,formState:h,clearErrors:y}=s,S=m(s,Ji);return console.log("surveyformValue",g,v,h),n.useEffect(()=>{c("questions")},[]),l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,d({register:c,control:v,handleSubmit:p,setValue:E,getValues:g,reset:f,formState:h,clearErrors:y},S),l.createElement("form",{onSubmit:p(o),style:{marginRight:"10px"}},l.createElement(Xi,{t:t,registerRef:c,controlSurveyForm:v,surveyFormState:h,surveyFormData:g,readOnly:u}),l.createElement($i,{t:t,controlSurveyForm:v,surveyFormState:h,readOnly:u}))))},tr=e=>{let{readOnly:t}=e;const{t:n}=a.useTranslation(),o=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),i=Digit.UserService.getUser().info,r=o.filter(e=>{var t;return null==i||null===(t=i.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});return l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement(er,{t:n,initialFormValues:{fromDate:"",fromTime:"",toDate:"",toTime:"",questions:{},tenantIds:r},readOnly:t}))},nr=e=>l.createElement("div",null,l.createElement("h4",null,"Question"),l.createElement("select",null,l.createElement("option",{value:""},"Select Answer Type"),l.createElement("option",{value:"text"},"Text"),l.createElement("option",{value:"number"},"Number"),l.createElement("option",{value:"date"},"Date")),l.createElement("input",{type:"text",placeholder:"Answer"})),lr=e=>{let{category:t,sectionId:n}=e;const a=u.useDispatch();return l.createElement("div",null,l.createElement("h3",null,"Category"),l.createElement("input",{type:"number",value:t.weightage,onChange:e=>{a(((e,t,n)=>({type:"UPDATE_CATEGORY_WEIGHTAGE",sectionId:e,categoryId:t,weightage:n}))(n,t.id,e.target.value))},placeholder:"Category Weightage"}),l.createElement("button",{onClick:()=>{a(((e,t)=>({type:"ADD_QUESTION",sectionId:e,categoryId:t}))(n,t.id))}},"Add Question"),t.questions.map(e=>l.createElement(nr,{key:e.id,question:e})))},ar=e=>{var n;let{section:a}=e;const o=u.useDispatch();return console.log("section in section js",a.categories),l.createElement("div",null,l.createElement("h2",null,"Section"),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},"CS_COMMON_QUESTION"),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(t.TextInput,{value:null==a?void 0:a.weightage,onChange:e=>{o({type:"UPDATE_SECTION_WEIGHTAGE",sectionId:a.id,weightage:e.target.value})},placeholder:"Section Weightage",name:"weightage"}),l.createElement("button",{onClick:()=>{o({type:"ADD_CATEGORY",sectionId:a.id})}},"Add Category"),null!=a&&null!==(n=a.categories)&&void 0!==n&&n.length?a.categories.map(e=>l.createElement(lr,{key:e.id,category:e,sectionId:null==a?void 0:a.id})):null,".")))},or=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],ir=e=>{let{match:{path:n}={},tenants:a,parentRoute:i,userType:r,stateCode:u}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(Qo,d({},e,{tenants:a,parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/create-category",component:e=>l.createElement(Xo,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-categories",component:e=>l.createElement(Jo,d({},e,{parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/create-questions",component:e=>l.createElement(si,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-questions",component:e=>l.createElement(mi,e)}),l.createElement(t.PrivateRoute,{path:n+"/create-survey-step-form",component:e=>l.createElement(Di,e)}),l.createElement(t.PrivateRoute,{path:n+"/fill-citizen-details-survey",component:e=>l.createElement(Ai,d({},e,{stateCode:u}))}),l.createElement(t.PrivateRoute,{path:n+"/fill-survey",component:e=>l.createElement(_o,d({},e,{userType:r}))}),l.createElement(t.PrivateRoute,{path:n+"/active-open-surveys",component:e=>l.createElement(go,d({},e,{userType:r}))}),l.createElement(t.PrivateRoute,{path:n+"/create-response",component:e=>l.createElement(Ii,e)}),l.createElement(t.PrivateRoute,{path:n+"/update-response",component:e=>l.createElement(Li,e)}),l.createElement(t.PrivateRoute,{path:n+"/submit-response",component:e=>l.createElement(Ki,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/results/:id",component:e=>l.createElement(Yi,e)}),l.createElement(t.PrivateRoute,{path:n+"/previewQuestions",component:e=>l.createElement(Qi,e)}))},rr=e=>{let{t:n}=e;return l.createElement(l.Fragment,null,l.createElement("div",{style:{textAlign:"-webkit-center",marginTop:"30%",marginRight:"10%"}},l.createElement("svg",{width:"255",height:"245",viewBox:"0 0 255 245",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("g",{"clip-path":"url(#clip0_47664_105169)"},l.createElement("path",{d:"M214.607 58.0692H213.267V21.2879C213.267 15.642 211.027 10.2273 207.039 6.23508C203.051 2.24282 197.641 2.77689e-09 192.001 2.77689e-09H114.153C111.36 -4.51493e-05 108.595 0.550538 106.015 1.62031C103.435 2.69009 101.09 4.2581 99.1157 6.23483C97.1409 8.21157 95.5744 10.5583 94.5056 13.141C93.4369 15.7238 92.8868 18.492 92.8867 21.2875V223.073C92.8867 228.719 95.1273 234.133 99.1154 238.125C103.104 242.118 108.513 244.36 114.153 244.36H192C197.64 244.36 203.049 242.118 207.038 238.125C211.026 234.133 213.266 228.719 213.266 223.073V84.2507H214.606L214.607 58.0692Z",fill:"#3F3D56"}),l.createElement("path",{d:"M208.905 19.8617V224.497C208.904 228.778 207.206 232.883 204.182 235.91C201.159 238.938 197.058 240.639 192.782 240.641H113.337C109.059 240.641 104.956 238.941 101.93 235.914C98.9044 232.886 97.2039 228.78 97.2026 224.497V19.8617C97.2039 15.5795 98.9043 11.4732 101.93 8.44588C104.955 5.41857 109.058 3.7182 113.336 3.71875H122.973C122.5 4.88362 122.32 6.14702 122.449 7.39789C122.577 8.64876 123.011 9.84881 123.712 10.8926C124.412 11.9363 125.358 12.7918 126.467 13.3838C127.575 13.9759 128.812 14.2863 130.068 14.2879H175.361C176.617 14.2863 177.854 13.9759 178.962 13.3838C180.07 12.7918 181.016 11.9363 181.717 10.8926C182.418 9.84881 182.851 8.64876 182.98 7.39789C183.109 6.14702 182.929 4.88362 182.456 3.71875H192.779C197.055 3.71948 201.156 5.42005 204.18 8.44661C207.204 11.4732 208.904 15.578 208.905 19.8586V19.8617Z",fill:"white"}),l.createElement("path",{d:"M153.04 102.01C171.357 102.01 186.207 87.1455 186.207 68.8088C186.207 50.4722 171.357 35.6074 153.04 35.6074C134.722 35.6074 119.872 50.4722 119.872 68.8088C119.872 87.1455 134.722 102.01 153.04 102.01Z",fill:"#a82227"}),l.createElement("path",{d:"M189.213 137.735H118.616C118.27 137.734 117.937 137.596 117.692 137.351C117.447 137.106 117.309 136.773 117.309 136.426V118.896C117.31 118.55 117.447 118.217 117.692 117.972C117.938 117.726 118.27 117.588 118.616 117.588H189.213C189.559 117.588 189.891 117.726 190.137 117.972C190.382 118.217 190.519 118.55 190.52 118.896V136.426C190.519 136.773 190.382 137.106 190.137 137.351C189.891 137.596 189.559 137.735 189.213 137.735V137.735ZM118.616 118.111C118.408 118.111 118.209 118.194 118.062 118.341C117.915 118.489 117.832 118.688 117.832 118.896V136.426C117.832 136.635 117.915 136.834 118.062 136.981C118.209 137.129 118.408 137.211 118.616 137.212H189.213C189.421 137.211 189.62 137.129 189.767 136.981C189.914 136.834 189.997 136.635 189.997 136.426V118.896C189.997 118.688 189.914 118.489 189.767 118.341C189.62 118.194 189.421 118.111 189.213 118.111H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 123.901C140.206 123.901 139.973 123.998 139.802 124.17C139.63 124.341 139.534 124.575 139.534 124.817C139.534 125.06 139.63 125.293 139.802 125.465C139.973 125.637 140.206 125.734 140.449 125.734H183.591C183.833 125.743 184.07 125.655 184.248 125.49C184.426 125.325 184.531 125.096 184.541 124.853C184.55 124.61 184.462 124.374 184.297 124.195C184.132 124.017 183.903 123.912 183.661 123.902C183.647 123.902 183.634 123.902 183.621 123.902L140.449 123.901Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 129.396C140.206 129.396 139.973 129.493 139.802 129.665C139.63 129.837 139.534 130.07 139.534 130.313C139.534 130.556 139.63 130.789 139.802 130.96C139.973 131.132 140.206 131.229 140.449 131.229H183.591C183.833 131.238 184.07 131.15 184.248 130.985C184.426 130.82 184.531 130.591 184.541 130.348C184.55 130.105 184.462 129.869 184.297 129.69C184.132 129.512 183.903 129.407 183.661 129.397C183.647 129.397 183.634 129.397 183.621 129.397L140.449 129.396Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 166.953H118.616C118.27 166.953 117.937 166.815 117.692 166.57C117.447 166.324 117.309 165.992 117.309 165.645V148.115C117.31 147.768 117.447 147.436 117.692 147.19C117.938 146.945 118.27 146.807 118.616 146.807H189.213C189.559 146.807 189.891 146.945 190.137 147.19C190.382 147.436 190.519 147.768 190.52 148.115V165.645C190.519 165.992 190.381 166.324 190.136 166.57C189.891 166.815 189.559 166.953 189.213 166.953ZM118.616 147.33C118.408 147.33 118.209 147.413 118.062 147.56C117.915 147.707 117.832 147.907 117.832 148.115V165.645C117.832 165.853 117.915 166.053 118.062 166.2C118.209 166.347 118.408 166.43 118.616 166.43H189.213C189.421 166.43 189.62 166.347 189.767 166.2C189.914 166.053 189.997 165.853 189.997 165.645V148.115C189.997 147.907 189.914 147.707 189.767 147.56C189.62 147.413 189.421 147.33 189.213 147.33H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 153.214C140.206 153.214 139.973 153.31 139.802 153.482C139.63 153.654 139.534 153.887 139.534 154.13C139.534 154.373 139.63 154.606 139.802 154.778C139.973 154.95 140.206 155.046 140.449 155.046H183.591C183.83 155.045 184.059 154.95 184.229 154.781C184.399 154.613 184.497 154.384 184.501 154.145C184.505 153.905 184.415 153.674 184.25 153.5C184.086 153.326 183.86 153.223 183.621 153.214H140.449V153.214Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 158.711C140.206 158.711 139.973 158.807 139.802 158.979C139.63 159.151 139.534 159.384 139.534 159.627C139.534 159.87 139.63 160.103 139.802 160.275C139.973 160.447 140.206 160.543 140.449 160.543H183.591C183.83 160.542 184.059 160.447 184.229 160.278C184.399 160.11 184.497 159.881 184.501 159.642C184.505 159.402 184.415 159.171 184.25 158.997C184.086 158.823 183.86 158.72 183.621 158.711H140.449V158.711Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 196.267H118.616C118.27 196.266 117.937 196.129 117.692 195.883C117.447 195.638 117.309 195.305 117.309 194.958V177.429C117.31 177.082 117.447 176.749 117.692 176.504C117.938 176.259 118.27 176.121 118.616 176.12H189.213C189.559 176.121 189.891 176.259 190.137 176.504C190.382 176.749 190.519 177.082 190.52 177.429V194.959C190.519 195.306 190.382 195.638 190.137 195.883C189.891 196.129 189.559 196.267 189.213 196.267V196.267ZM118.616 176.643C118.408 176.644 118.209 176.726 118.062 176.874C117.915 177.021 117.832 177.221 117.832 177.429V194.959C117.832 195.167 117.915 195.366 118.062 195.514C118.209 195.661 118.408 195.744 118.616 195.744H189.213C189.421 195.744 189.62 195.661 189.767 195.514C189.914 195.366 189.997 195.167 189.997 194.959V177.429C189.997 177.221 189.914 177.021 189.767 176.874C189.62 176.726 189.421 176.644 189.213 176.643H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 182.529C140.206 182.529 139.973 182.626 139.802 182.798C139.63 182.969 139.534 183.202 139.534 183.445C139.534 183.688 139.63 183.921 139.802 184.093C139.973 184.265 140.206 184.362 140.449 184.362H183.591C183.711 184.366 183.831 184.347 183.943 184.305C184.056 184.264 184.16 184.2 184.248 184.118C184.336 184.036 184.407 183.938 184.457 183.829C184.508 183.719 184.536 183.601 184.541 183.481C184.545 183.361 184.526 183.241 184.484 183.128C184.443 183.015 184.379 182.912 184.297 182.823C184.216 182.735 184.117 182.664 184.008 182.613C183.899 182.563 183.781 182.535 183.661 182.53C183.647 182.53 183.634 182.53 183.621 182.53L140.449 182.529Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 188.025C140.206 188.025 139.973 188.122 139.802 188.294C139.63 188.466 139.534 188.699 139.534 188.942C139.534 189.184 139.63 189.418 139.802 189.589C139.973 189.761 140.206 189.858 140.449 189.858H183.591C183.711 189.862 183.831 189.843 183.943 189.801C184.056 189.76 184.16 189.696 184.248 189.614C184.336 189.533 184.407 189.434 184.457 189.325C184.508 189.216 184.536 189.097 184.541 188.977C184.545 188.857 184.526 188.737 184.484 188.624C184.443 188.511 184.379 188.408 184.297 188.319C184.216 188.231 184.117 188.16 184.008 188.11C183.899 188.059 183.781 188.031 183.661 188.026C183.647 188.026 183.634 188.026 183.621 188.026H140.449L140.449 188.025Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M254.334 245H0.665646C0.297787 245 0 244.839 0 244.641C0 244.442 0.29813 244.281 0.665646 244.281H254.334C254.702 244.281 255 244.442 255 244.641C255 244.839 254.702 245 254.334 245Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.591 230.984C242.507 231.365 241.344 231.461 240.212 231.261C239.081 231.062 238.02 230.574 237.132 229.845C234.869 227.944 234.16 224.812 233.583 221.913L231.876 213.336L235.45 215.799C238.02 217.571 240.648 219.399 242.428 221.965C244.208 224.531 244.984 228.034 243.554 230.81",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.039 241.965C243.489 238.684 243.952 235.361 243.636 232.046C243.356 229.101 242.458 226.225 240.631 223.866C239.661 222.617 238.481 221.547 237.144 220.703C236.795 220.483 236.474 221.036 236.821 221.255C239.135 222.719 240.925 224.881 241.932 227.429C243.045 230.263 243.224 233.351 243.032 236.361C242.915 238.181 242.67 239.989 242.422 241.795C242.403 241.877 242.415 241.963 242.456 242.036C242.498 242.109 242.565 242.163 242.646 242.188C242.727 242.21 242.814 242.199 242.888 242.157C242.961 242.115 243.016 242.046 243.038 241.965H243.039Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M239.801 236.7C239.337 237.408 238.698 237.983 237.946 238.371C237.195 238.759 236.356 238.947 235.511 238.917C233.339 238.814 231.529 237.297 229.899 235.857L225.078 231.595L228.269 231.443C230.563 231.333 232.917 231.23 235.104 231.938C237.291 232.647 239.305 234.351 239.704 236.614",fill:"#E6E6E6"}),l.createElement("path",{d:"M244.311 243.85C242.147 240.015 239.633 235.752 235.145 234.389C233.897 234.011 232.589 233.876 231.29 233.991C230.88 234.025 230.983 234.658 231.393 234.622C233.57 234.441 235.742 235.017 237.545 236.252C239.28 237.434 240.631 239.077 241.774 240.82C242.474 241.885 243.101 243 243.728 244.111C243.928 244.466 244.514 244.21 244.311 243.85Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M127.423 133.05C130.456 133.05 132.914 130.59 132.914 127.554C132.914 124.518 130.456 122.058 127.423 122.058C124.391 122.058 121.933 124.518 121.933 127.554C121.933 130.59 124.391 133.05 127.423 133.05Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 126.527C124.731 126.527 124.68 126.938 124.68 127.443C124.68 127.949 124.731 128.36 124.795 128.36H130.194C130.257 128.368 130.309 127.965 130.31 127.459C130.345 127.144 130.307 126.825 130.197 126.528H124.795V126.527Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 162.376C130.456 162.376 132.914 159.915 132.914 156.879C132.914 153.844 130.456 151.383 127.423 151.383C124.391 151.383 121.933 153.844 121.933 156.879C121.933 159.915 124.391 162.376 127.423 162.376Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 155.853C124.731 155.853 124.68 156.263 124.68 156.768C124.68 157.274 124.731 157.685 124.795 157.685H130.194C130.257 157.693 130.309 157.29 130.31 156.784C130.345 156.469 130.307 156.15 130.197 155.853L124.795 155.853Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 191.69C130.456 191.69 132.914 189.229 132.914 186.194C132.914 183.158 130.456 180.697 127.423 180.697C124.391 180.697 121.933 183.158 121.933 186.194C121.933 189.229 124.391 191.69 127.423 191.69Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 185.167C124.731 185.167 124.68 185.577 124.68 186.083C124.68 186.589 124.731 186.999 124.795 186.999H130.194C130.257 187.007 130.309 186.604 130.31 186.098C130.345 185.784 130.307 185.465 130.197 185.167L124.795 185.167Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M145.875 59.6918L143.932 61.6367L160.204 77.9258L162.147 75.9808L145.875 59.6918Z",fill:"white"}),l.createElement("path",{d:"M162.147 61.6373L160.204 59.6924L143.932 75.9815L145.875 77.9264L162.147 61.6373Z",fill:"white"}),l.createElement("path",{d:"M71.002 156.83C71.478 156.662 71.9113 156.391 72.2713 156.036C72.6314 155.682 72.9094 155.253 73.0858 154.779C73.2622 154.305 73.3328 153.799 73.2925 153.295C73.2522 152.791 73.102 152.302 72.8526 151.863L80.9466 142.626L74.6282 141.754L67.9107 150.659C67.201 151.127 66.6875 151.84 66.4677 152.662C66.2479 153.484 66.3369 154.358 66.718 155.119C67.099 155.88 67.7456 156.474 68.5352 156.789C69.3248 157.105 70.2025 157.119 71.002 156.83Z",fill:"#9F616A"}),l.createElement("path",{d:"M80.7632 238.688L75.1182 238.688L72.4326 216.892L80.7642 216.892L80.7632 238.688Z",fill:"#9F616A"}),l.createElement("path",{d:"M82.2023 244.166L64 244.165V243.935C64.0001 242.054 64.7466 240.25 66.0752 238.92C67.4039 237.59 69.2058 236.843 71.0848 236.843H71.0853L82.2026 236.843L82.2023 244.166Z",fill:"#2F2E41"}),l.createElement("path",{d:"M110.313 233.959L104.922 235.634L95.9004 215.615L103.857 213.143L110.313 233.959Z",fill:"#9F616A"}),l.createElement("path",{d:"M113.311 238.763L95.9269 244.166L95.8586 243.945C95.3015 242.149 95.4801 240.205 96.3549 238.54C97.2298 236.876 98.7294 235.627 100.524 235.069L100.524 235.069L111.142 231.77L113.311 238.763Z",fill:"#2F2E41"}),l.createElement("path",{d:"M76.4396 138.198L68.0791 147.783L74.6244 148.373L76.4396 138.198Z",fill:"#a82227"}),l.createElement("path",{d:"M73.173 150.552C73.173 150.552 70.269 152.006 69.9059 158.546C69.5429 165.087 70.9951 182.167 70.9951 182.167C70.9951 182.167 69.5432 189.798 70.9951 196.702C72.4469 203.606 69.5432 228.678 71.3581 228.678C73.173 228.678 82.611 229.768 82.974 228.678C83.3371 227.587 83.7001 211.236 83.7001 211.236C83.7001 211.236 86.6042 202.878 83.7001 197.792C83.7001 197.792 93.8397 215.516 100.398 229.042C101.833 232.002 112.74 228.679 110.925 225.408C109.11 222.138 104.754 207.24 104.754 207.24C104.754 207.24 101.487 196.338 95.6794 191.614L98.5835 168.359C98.5835 168.359 104.755 152.733 101.125 150.553C97.4957 148.373 73.173 150.552 73.173 150.552Z",fill:"#2F2E41"}),l.createElement("path",{d:"M84.0629 91.322C89.2754 91.322 93.5009 87.0921 93.5009 81.8744C93.5009 76.6566 89.2754 72.4268 84.0629 72.4268C78.8505 72.4268 74.625 76.6566 74.625 81.8744C74.625 87.0921 78.8505 91.322 84.0629 91.322Z",fill:"#A0616A"}),l.createElement("path",{d:"M94.5899 92.0488L82.8568 98.9528C82.8568 98.9528 78.3642 101.485 76.686 105.857C74.8972 110.516 75.9369 117.075 76.686 118.575C78.1379 121.482 76.077 128.749 76.077 128.749L74.2621 145.464C74.2621 145.464 67.7282 151.642 72.8103 152.368C77.8923 153.095 86.9672 152.005 92.4123 152.368C97.8573 152.732 104.028 153.459 102.213 149.824C100.398 146.189 98.2204 143.647 100.398 136.381C102.103 130.694 102.029 109.431 101.916 100.451C101.901 99.2177 101.57 98.0091 100.956 96.9398C100.342 95.8706 99.4655 94.9763 98.4089 94.3421L94.5899 92.0488Z",fill:"#a82227"}),l.createElement("path",{opacity:"0.1",d:"M89.3278 103.496L90.4166 125.662L79.8631 147.056L78.0732 146.374L88.9634 126.388L89.3278 103.496Z",fill:"black"}),l.createElement("path",{opacity:"0.1",d:"M101.305 130.385V127.841L88.9648 148.19L101.305 130.385Z",fill:"black"}),l.createElement("path",{d:"M77.3647 73.1222L75.8057 72.4978C75.8057 72.4978 79.0687 68.9025 83.607 69.215L82.3303 67.8081C82.3303 67.8081 85.4508 66.5576 88.2879 69.8401C89.7792 71.5657 91.5045 73.5943 92.5813 75.879H94.2523L93.555 77.4162L95.9957 78.9535L93.4904 78.6784C93.7277 80.0055 93.6465 81.3701 93.2534 82.6596L93.3221 83.8746C93.3221 83.8746 90.4167 79.3743 90.4167 78.7499V80.3133C90.4167 80.3133 88.8563 78.9064 88.8563 77.9684L88.0052 79.0628L87.5796 77.3437L82.3314 79.0628L83.1818 77.6552L79.9188 78.1242L81.1955 76.405C81.1955 76.405 77.5076 78.4371 77.3658 80.1569C77.2239 81.8767 75.3802 84.0648 75.3802 84.0648L74.529 82.5014C74.529 82.5014 73.2527 75.4671 77.3647 73.1222Z",fill:"#2F2E41"}),l.createElement("path",{d:"M83.4712 157.858C83.9097 157.608 84.2881 157.264 84.5795 156.851C84.871 156.439 85.0685 155.967 85.1582 155.47C85.2478 154.972 85.2274 154.461 85.0984 153.972C84.9694 153.484 84.735 153.029 84.4116 152.641L90.7392 142.113L84.3665 142.377L79.3346 152.334C78.7192 152.921 78.3404 153.714 78.2698 154.562C78.1992 155.41 78.4419 156.255 78.9518 156.936C79.4617 157.617 80.2033 158.087 81.0363 158.257C81.8693 158.427 82.7356 158.285 83.4712 157.858Z",fill:"#9F616A"}),l.createElement("path",{d:"M97.8577 96.7735L100.58 96.2285C100.58 96.2285 108.748 102.224 106.206 114.215C103.665 126.207 92.4126 144.375 92.4126 144.375C92.4126 144.375 89.8709 147.646 89.1455 148.372C88.4201 149.099 86.9676 148.372 87.6937 149.463C88.4198 150.553 86.6045 151.279 86.6045 151.279C86.6045 151.279 78.6184 151.279 79.3445 148.372C80.0706 145.465 92.4126 124.752 92.4126 124.752L90.5977 105.493C90.5977 105.493 89.1452 96.0466 97.8577 96.7735Z",fill:"#a82227"})),l.createElement("defs",null)),l.createElement("h",{style:{color:"#505A5F",fontWeight:"400",fontFamily:"Roboto",marginLeft:"10%",lineHeight:"3"}},n("SURVEY_ENDED_MESSAGE"))),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},ur=e=>{if(!e)return;const t=[];for(const n in e)t.push({questionId:n,answer:[e[n]]});return t},sr={surveyDetails:[{id:1,ulb:"",tenantIds:"",name:"",description:"",fromDate:"",fromTime:"",toDate:"",toTime:""}],categories:[{id:1,title:"",weightage:100,selectCategory:"",questionStatement:"",questions:[],selectedQuestions:[]}],autoCalculateCategoriesWeight:!0,goPrev:!1,goNext:!1,stepData:{},step:1,isValid:!1,formData:{}},cr=function(e,t){switch(void 0===e&&(e=sr),t.type){case"GO_PREV":return d({},e,{goPrev:!0});case"GO_NEXT":return d({},e,{goNext:!0});case"AUTO_CALCULATE_CATEGORY":return d({},e,{autoCalculateCategoriesWeight:t.categoryWeight});case"ADD_CATEGORY":const n=[...e.categories,{id:t.id,title:"",weightage:"",selectCategory:"",questions:[],selectedQuestions:[]}];return d({},e,{categories:n});case"RECALCULATE_WEIGHTAGE":const l=e.categories.map(t=>d({},t,{weightage:Math.floor(100/e.categories.length*100)/100}));return d({},e,{categories:l});case"DELETE_CATEGORY":const a=e.categories.filter(e=>e.id!==t.categoryId);return d({},e,{categories:a});case"ADD_QUESTIONS_LIST":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:questionsList}):e)});case"ADD_QUESTIONS":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{selectedQuestions:t.questions}):e)});case"UPDATE_QUESTION_WEIGHTAGE":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{selectedQuestions:e.selectedQuestions.map(e=>e.uuid===t.questionId?d({},e,{weightage:t.weightage}):e)}):e)});case"UPDATE_CATEGORY":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,t.data):e)});case"UPDATE_QUESTION_SELECTION":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?d({},e,{selected:t.selected}):e)}):e)});case"UPDATE_MANDATORY_QUESTION_SELECTION":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?d({},e,{mandatory:t.mandatory}):e)}):e)});case"SET_QUESTIONS":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:t.questions}):e)});case"NEXT_STEP":return d({},e,{step:e.step+1});case"PREVIOUS_STEP":return d({},e,{step:e.step-1});case"SET_STEP_DATA":return d({},e,{stepData:d({},e.stepData,{[t.step]:t.data})});case"UPDATE_SURVEY_FORM":return d({},e,{formData:d({},e.formData,{[t.payload.key]:t.payload.value})});case"SET_SURVEY_STEP":return d({},e,{step:t.payload});case"FIELD_CHANGE":return d({},e,{surveyDetails:e.surveyDetails.map(e=>e.id===t.surveyId?d({},e,t.data):e)});case"RESET_FORM":return sr;default:return e}},dr=e=>{let{style:t={}}=e;return l.createElement("hr",{color:"#d6d5d4",className:"break-line",style:t})},mr=["onClick","style","children","className","ReactRef"],vr=e=>{var t;let{onClick:n,style:a,children:i,className:r,ReactRef:u}=e,s=m(e,mr);const{pathname:c}=o.useLocation(),v=Digit.Hooks.fsm.useRouteSubscription(c),p=null===(t=Digit.UserService.getUser())||void 0===t?void 0:t.info;return l.createElement("div",d({className:("employee"===v||"EMPLOYEE"===(null==p?void 0:p.type)?"employeeCard":"card")+" "+(r||""),onClick:n,style:a},s,{ref:u}),i)},pr=e=>l.createElement("h2",{className:"card-label "+e.className,style:e.style},e.children),Er=e=>l.createElement("p",{className:"card-text "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),gr=e=>{const t="employee"===Digit.SessionStorage.get("user_type");return l.createElement("header",{className:(t?"employee-card-sub-header":"card-sub-header")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children)},fr=e=>l.createElement("header",{id:e.id,className:"card-section-header",style:e.style},e.children),hr=e=>{let{children:t,style:n,className:a}=e;return l.createElement("h2",{className:"card-label-desc "+(a||""),style:n},t)},yr=e=>l.createElement("h2",{className:"card-label-error "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children);var Sr="function"==typeof Symbol&&Symbol.for,_r=Sr?Symbol.for("react.element"):60103,Cr=Sr?Symbol.for("react.portal"):60106,br=Sr?Symbol.for("react.fragment"):60107,Tr=Sr?Symbol.for("react.strict_mode"):60108,Dr=Sr?Symbol.for("react.profiler"):60114,Nr=Sr?Symbol.for("react.provider"):60109,Ar=Sr?Symbol.for("react.context"):60110,wr=Sr?Symbol.for("react.async_mode"):60111,Ir=Sr?Symbol.for("react.concurrent_mode"):60111,xr=Sr?Symbol.for("react.forward_ref"):60112,Lr=Sr?Symbol.for("react.suspense"):60113,Or=Sr?Symbol.for("react.suspense_list"):60120,Rr=Sr?Symbol.for("react.memo"):60115,Pr=Sr?Symbol.for("react.lazy"):60116,Mr=Sr?Symbol.for("react.block"):60121,Fr=Sr?Symbol.for("react.fundamental"):60117,kr=Sr?Symbol.for("react.responder"):60118,Br=Sr?Symbol.for("react.scope"):60119;function Ur(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case _r:switch(e=e.type){case wr:case Ir:case br:case Dr:case Tr:case Lr:return e;default:switch(e=e&&e.$$typeof){case Ar:case xr:case Pr:case Rr:case Nr:return e;default:return t}}case Cr:return t}}}function Hr(e){return Ur(e)===Ir}var Vr={AsyncMode:wr,ConcurrentMode:Ir,ContextConsumer:Ar,ContextProvider:Nr,Element:_r,ForwardRef:xr,Fragment:br,Lazy:Pr,Memo:Rr,Portal:Cr,Profiler:Dr,StrictMode:Tr,Suspense:Lr,isAsyncMode:function(e){return Hr(e)||Ur(e)===wr},isConcurrentMode:Hr,isContextConsumer:function(e){return Ur(e)===Ar},isContextProvider:function(e){return Ur(e)===Nr},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===_r},isForwardRef:function(e){return Ur(e)===xr},isFragment:function(e){return Ur(e)===br},isLazy:function(e){return Ur(e)===Pr},isMemo:function(e){return Ur(e)===Rr},isPortal:function(e){return Ur(e)===Cr},isProfiler:function(e){return Ur(e)===Dr},isStrictMode:function(e){return Ur(e)===Tr},isSuspense:function(e){return Ur(e)===Lr},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===br||e===Ir||e===Dr||e===Tr||e===Lr||e===Or||"object"==typeof e&&null!==e&&(e.$$typeof===Pr||e.$$typeof===Rr||e.$$typeof===Nr||e.$$typeof===Ar||e.$$typeof===xr||e.$$typeof===Fr||e.$$typeof===kr||e.$$typeof===Br||e.$$typeof===Mr)},typeOf:Ur},Wr=Ht(function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,r=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,f=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var v=e.type;switch(v){case s:case c:case a:case i:case o:case m:return v;default:var g=v&&v.$$typeof;switch(g){case u:case d:case E:case p:case r:return g;default:return t}}case l:return t}}}var _=c,C=u,b=r,T=n,D=d,N=a,A=E,w=p,I=l,x=i,L=o,O=m,R=!1;function P(e){return S(e)===c}t.AsyncMode=s,t.ConcurrentMode=_,t.ContextConsumer=C,t.ContextProvider=b,t.Element=T,t.ForwardRef=D,t.Fragment=N,t.Lazy=A,t.Memo=w,t.Portal=I,t.Profiler=x,t.StrictMode=L,t.Suspense=O,t.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(e)||S(e)===s},t.isConcurrentMode=P,t.isContextConsumer=function(e){return S(e)===u},t.isContextProvider=function(e){return S(e)===r},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return S(e)===d},t.isFragment=function(e){return S(e)===a},t.isLazy=function(e){return S(e)===E},t.isMemo=function(e){return S(e)===p},t.isPortal=function(e){return S(e)===l},t.isProfiler=function(e){return S(e)===i},t.isStrictMode=function(e){return S(e)===o},t.isSuspense=function(e){return S(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===c||e===i||e===o||e===m||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===p||e.$$typeof===r||e.$$typeof===u||e.$$typeof===d||e.$$typeof===f||e.$$typeof===h||e.$$typeof===y||e.$$typeof===g)},t.typeOf=S}()}),qr=Ht(function(e){e.exports="production"===process.env.NODE_ENV?Vr:Wr}),jr=Object.getOwnPropertySymbols,zr=Object.prototype.hasOwnProperty,Yr=Object.prototype.propertyIsEnumerable;function Gr(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var Kr=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,a=Gr(e),o=1;o<arguments.length;o++){for(var i in n=Object(arguments[o]))zr.call(n,i)&&(a[i]=n[i]);if(jr){l=jr(n);for(var r=0;r<l.length;r++)Yr.call(n,l[r])&&(a[l[r]]=n[l[r]])}}return a},Qr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Xr=Function.call.bind(Object.prototype.hasOwnProperty),Zr=function(){};if("production"!==process.env.NODE_ENV){var $r=Qr,Jr={},eu=Xr;Zr=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function tu(e,t,n,l,a){if("production"!==process.env.NODE_ENV)for(var o in e)if(eu(e,o)){var i;try{if("function"!=typeof e[o]){var r=Error((l||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}i=e[o](t,o,l,n,null,$r)}catch(e){i=e}if(!i||i instanceof Error||Zr((l||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in Jr)){Jr[i.message]=!0;var u=a?a():"";Zr("Failed "+n+" type: "+i.message+(null!=u?u:""))}}}tu.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Jr={})};var nu=tu,lu=function(){};function au(){return null}function ou(){}function iu(){}"production"!==process.env.NODE_ENV&&(lu=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),iu.resetWarningCache=ou;var ru=Ht(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,l={array:r("array"),bigint:r("bigint"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),symbol:r("symbol"),any:i(au),arrayOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=t[n];if(!Array.isArray(r))return new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected an array.");for(var u=0;u<r.length;u++){var s=e(r,u,l,a,i+"["+u+"]",Qr);if(s instanceof Error)return s}return null})},element:i(function(t,n,l,a,i){var r=t[n];return e(r)?null:new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:i(function(e,t,n,l,a){var i=e[t];return qr.isValidElementType(i)?null:new o("Invalid "+l+" `"+a+"` of type `"+c(i)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return i(function(t,n,l,a,i){var r;return t[n]instanceof e?null:new o("Invalid "+a+" `"+i+"` of type `"+((r=t[n]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:i(function(e,t,n,l,a){return s(e[t])?null:new o("Invalid "+l+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=t[n],u=c(r);if("object"!==u)return new o("Invalid "+a+" `"+i+"` of type `"+u+"` supplied to `"+l+"`, expected an object.");for(var s in r)if(Xr(r,s)){var d=e(r,s,l,a,i+"."+s,Qr);if(d instanceof Error)return d}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&lu(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),au;function t(t,n,l,i,r){for(var u=t[n],s=0;s<e.length;s++)if(a(u,e[s]))return null;var c=JSON.stringify(e,function(e,t){return"symbol"===d(t)?String(t):t});return new o("Invalid "+i+" `"+r+"` of value `"+String(u)+"` supplied to `"+l+"`, expected one of "+c+".")}return i(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&lu("Invalid argument supplied to oneOfType, expected an instance of array."),au;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return lu("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+m(n)+" at index "+t+"."),au}return i(function(t,n,l,a,i){for(var r=[],u=0;u<e.length;u++){var s=(0,e[u])(t,n,l,a,i,Qr);if(null==s)return null;s.data&&Xr(s.data,"expectedType")&&r.push(s.data.expectedType)}return new o("Invalid "+a+" `"+i+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return i(function(t,n,l,a,i){var r=t[n],s=c(r);if("object"!==s)return new o("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");for(var m in e){var v=e[m];if("function"!=typeof v)return u(l,a,i,m,d(v));var p=v(r,m,l,a,i+"."+m,Qr);if(p)return p}return null})},exact:function(e){return i(function(t,n,l,a,i){var r=t[n],s=c(r);if("object"!==s)return new o("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");var m=Kr({},t[n],e);for(var v in m){var p=e[v];if(Xr(e,v)&&"function"!=typeof p)return u(l,a,i,v,d(p));if(!p)return new o("Invalid "+a+" `"+i+"` key `"+v+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=p(r,v,l,a,i+"."+v,Qr);if(E)return E}return null})}};function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function o(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function i(e){function t(t,n,l,a,i,r,u){if(a=a||"<<anonymous>>",r=r||l,u!==Qr){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}return null==n[l]?t?new o(null===n[l]?"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `null`.":"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `undefined`."):null:e(n,l,a,i,r)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){return i(function(t,n,l,a,i,r){var u=t[n];return c(u)!==e?new o("Invalid "+a+" `"+i+"` of type `"+d(u)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function u(e,t,n,l,a){return new o((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+a+"`.")}function s(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(s);if(null===t||e(t))return!0;var l=function(e){var t=e&&(n&&e[n]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!l)return!1;var a,o=l.call(t);if(l!==t.entries){for(;!(a=o.next()).done;)if(!s(a.value))return!1}else for(;!(a=o.next()).done;){var i=a.value;if(i&&!s(i[1]))return!1}return!0;default:return!1}}function c(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function d(e){if(null==e)return""+e;var t=c(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function m(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return o.prototype=Error.prototype,l.checkPropTypes=nu,l.resetWarningCache=nu.resetWarningCache,l.PropTypes=l,l}(qr.isElement):function(){function e(e,t,n,l,a,o){if(o!==Qr){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:iu,resetWarningCache:ou};return n.PropTypes=n,n}()});const uu=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("textarea",{placeholder:e.placeholder,name:e.name,ref:e.inputRef,style:e.style,id:e.id,value:e.value,onChange:e.onChange,className:("citizen"!==t?"employee-card-textarea":"card-textarea")+" "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),minLength:e.minLength,maxLength:e.maxLength,autoComplete:"off",disabled:e.disabled}),l.createElement("p",{className:"cell-text"},e.hintText))};uu.propTypes={userType:ru.string,name:ru.string.isRequired,ref:ru.func,value:ru.string,onChange:ru.func,id:ru.string},uu.defaultProps={ref:void 0,onChange:void 0};const su=e=>{var t,a,o,i,r,u,s;const c=Digit.SessionStorage.get("userType"),[m,v]=n.useState(),p=null!=e&&e.watch?{fromDate:null==e?void 0:e.watch("fromDate"),toDate:null==e?void 0:e.watch("toDate")}:{},E=e=>{const{value:t}=e.target;v(function(e){return e?new Date(e).toLocaleString("en-In").split(",")[0]:""}(t))};return l.createElement(l.Fragment,null,l.createElement("div",{className:"text-input "+("employee"===c?"":"text-input-width")+" "+e.className,style:null!=e&&e.textInputStyle?d({},e.textInputStyle):{}},l.createElement("input",e.isMandatory?{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(t=e.validation)||void 0===t?void 0:t.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input-error":"card-input-error")+" "+(e.disable&&"disabled"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&E(t)},ref:e.inputRef,value:e.value,style:d({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(a=e.validation)||void 0===a?void 0:a.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(o=e.validation)||void 0===o?void 0:o.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off",disabled:e.disabled}:{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(i=e.validation)||void 0===i?void 0:i.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&E(t)},ref:e.inputRef,value:e.value,style:d({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,required:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(r=e.validation)||void 0===r?void 0:r.isRequired:e.isRequired||"date"===e.type&&("fromDate"===e.name?p.toDate:p.fromDate),pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(u=e.validation)||void 0===u?void 0:u.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(s=e.validation)||void 0===s?void 0:s.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,onKeyPress:e.onKeyPress,autoComplete:"off",disabled:e.disabled}),e.signature?e.signatureImg:null))};su.propTypes={userType:ru.string,isMandatory:ru.bool,name:ru.string,placeholder:ru.string,onChange:ru.func,ref:ru.func,value:ru.any},su.defaultProps={isMandatory:!1};const cu=e=>l.createElement("div",{className:"action-bar-wrap "+e.className,style:e.style},e.children),du=n.forwardRef((e,t)=>l.createElement("button",d({ref:t,disabled:!!e.disabled,className:(e.disabled?"submit-bar-disabled":"submit-bar")+" "+(e.className?e.className:""),type:e.submit?"submit":"button",style:d({},e.style),onClick:e.onSubmit},e.form?{form:e.form}:{}),e.label));du.propTypes={submit:ru.any,style:ru.object,label:ru.string,onSubmit:ru.func},du.defaultProps={};const mu=e=>l.createElement("div",{style:d({},e.style),className:"label-field-pair"},e.children),vu=e=>l.createElement("button",{className:"card-link cp "+e.className,onClick:e.onClick,style:d({},e.style,vu.defaultProps.style)},e.label);vu.propTypes={label:ru.any,onClick:ru.func,style:ru.object},vu.defaultProps={style:{color:"#FFFFFF",backgroundColor:"#2947A3",border:"none",borderRadius:"8px",cursor:"pointer",padding:"8px 16px",display:"inline-block",height:"35px",fontSize:"18px"}};const pu=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("div",{className:"field-container"},e.hideSpan?null:l.createElement("span",{style:d({maxWidth:"50px",marginTop:"unset"},e.labelStyle),className:"citizen-card-input citizen-card-input--front"},"+91"),l.createElement("div",{className:"text-input "+("employee"===t?"":"text-mobile-input-width")+" "+e.className},l.createElement("input",{type:"text",name:e.name,id:e.id,className:(t?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error"),placeholder:e.placeholder,onChange:t=>{var n;let l=t.target.value;(isNaN(l)||[" ","e","E"].some(e=>l.includes(e))||l.length>(e.maxLength||10))&&(l=l.slice(0,-1)),null==e||null===(n=e.onChange)||void 0===n||n.call(e,l)},ref:e.inputRef,value:e.value,style:d({},e.style),minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:e.pattern,min:e.min,readOnly:e.disable,title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off"}))))};pu.propTypes={userType:ru.string,isMandatory:ru.bool,name:ru.string,placeholder:ru.string,onChange:ru.func,ref:ru.func,value:ru.any},pu.defaultProps={isMandatory:!1};const Eu=e=>{var t;const{register:o,handleSubmit:r,setValue:u,getValues:s,reset:c,watch:m,control:v,formState:p,errors:E,setError:g,clearErrors:f,setApi:h}=i.useForm({defaultValues:e.defaultValues}),{t:y}=a.useTranslation(),S=m();n.useEffect(()=>{var t,n,l,a,o,i,r;const u=sessionStorage.getItem("eyeIconClicked");null!=e&&e.appData&&(null==e||null===(t=e.appData)||void 0===t||null===(n=t.ConnectionHolderDetails)||void 0===n||null===(l=n[0])||void 0===l||!l.sameAsOwnerDetails)&&u&&(null===(a=Object.keys(null==e?void 0:e.appData))||void 0===a?void 0:a.length)>0&&!ua.isEqual(null==e||null===(o=e.appData)||void 0===o||null===(i=o.ConnectionHolderDetails)||void 0===i?void 0:i[0],null==S||null===(r=S.ConnectionHolderDetails)||void 0===r?void 0:r[0])&&c(d({},null==e?void 0:e.appData))},[null==e?void 0:e.appData,S,null==e||null===(t=e.appData)||void 0===t?void 0:t.ConnectionHolderDetails]),n.useEffect(()=>{e.getFormAccessors&&e.getFormAccessors({setValue:u,getValues:s})},[]),n.useEffect(()=>{e.onFormValueChange&&e.onFormValueChange(u,S,p)},[S]);const _=function(e,t,n,a,r,s){void 0===a&&(a=!1);const c="string"==typeof r?Digit.ComponentRegistryService.getComponent(r):r;switch(e){case"text":case"date":case"number":case"password":case"time":return l.createElement("div",{className:"field-container"},null!=t&&t.componentInFront?l.createElement("span",{className:"component-in-front "+(a&&"disabled")},t.componentInFront):null,l.createElement(su,d({className:"fieldNew"},t,{inputRef:o(t.validation),isRequired:n,type:e,disable:a,watch:m})));case"textarea":return l.createElement(uu,d({className:"field",name:(null==t?void 0:t.name)||""},t,{inputRef:o(t.validation),disable:a}));case"mobileNumber":return l.createElement(i.Controller,{render:e=>l.createElement(pu,{className:"field",onChange:e.onChange,value:e.value,disable:a}),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:v});case"custom":return l.createElement(i.Controller,{render:e=>t.component(d({},e,{setValue:u}),t.customProps),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:v});case"component":return l.createElement(i.Controller,{render:e=>l.createElement(c,{userType:"employee",t:y,setValue:u,onSelect:u,config:s,data:S,formData:S,register:o,errors:E,props:e,setError:g,clearErrors:f,formState:p,onBlur:e.onBlur,setApi:h}),name:s.key,control:v});case"form":return l.createElement("form",null,l.createElement(c,{userType:"employee",t:y,setValue:u,onSelect:u,config:s,data:S,formData:S,register:o,errors:E,setError:g,clearErrors:f,formState:p,control:v}));default:return!1!==(null==t?void 0:t.dependency)?t:null}},C=e=>{switch(e){case 0:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"};case 1:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",borderTop:"0px",borderBottom:"0px"};case 2:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px",borderTop:"0px"}}},b={color:"#505A5F",fontWeight:"700",fontSize:"16px"},T=n.useMemo(()=>{var t;return null===(t=e.config)||void 0===t?void 0:t.map((t,a,o)=>l.createElement(l.Fragment,{key:a},t&&(t=>t.head&&t.subHead?l.createElement(n.Fragment,null,l.createElement(fr,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{margin:"5px 0px"},id:t.headId},y(t.head)),l.createElement(fr,{style:b,id:t.headId+"_DES"},y(t.subHead))):t.head?l.createElement(n.Fragment,null,l.createElement(fr,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{},id:t.headId},y(t.head)),l.createElement("div",{style:null!=e&&e.lineStyle?null==e?void 0:e.lineStyle:{}})):l.createElement("div",null))(t),t.body.map((t,a)=>{var o,i,r,u,s,c,m,v;return e.inline?l.createElement(l.Fragment,{key:a},l.createElement("div",{style:t.isInsideBox?C(null==t?void 0:t.placementinbox):{}},!t.withoutLabel&&l.createElement(pr,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"},className:null!=t&&t.disable?"disabled":""},y(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),E&&E[null===(o=t.populators)||void 0===o?void 0:o.name]&&Object.keys(E[null===(i=t.populators)||void 0===i?void 0:i.name]).length?l.createElement(yr,null,y(t.populators.error||(null===(r=E[null===(u=t.populators)||void 0===u?void 0:u.name])||void 0===r?void 0:r.message))):null,l.createElement("div",{style:t.withoutLabel?{width:"100%"}:{},className:"field"},_(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(pr,{style:d({marginTop:"-24px",fontSize:"16px",fontWeight:"bold",color:"#505A5F"},null==t?void 0:t.descriptionStyles)},y(t.description))))):l.createElement(n.Fragment,null,l.createElement(mu,{key:a},!t.withoutLabel&&l.createElement(pr,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"}},y(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),l.createElement("div",{style:t.withoutLabel?d({width:"100%"},null==e?void 0:e.fieldStyle):{},className:"field"},_(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(Er,{style:{fontSize:"14px",marginTop:"-24px"}},y(null==t?void 0:t.description)))),null!=t&&null!==(s=t.populators)&&void 0!==s&&s.name&&E&&E[null==t||null===(c=t.populators)||void 0===c?void 0:c.name]&&Object.keys(E[null==t||null===(m=t.populators)||void 0===m?void 0:m.name]).length?l.createElement(yr,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},y(null==t||null===(v=t.populators)||void 0===v?void 0:v.error)):null)}),!e.noBreakLine&&(o.length-1===a?null:l.createElement(dr,{style:null!=e&&e.breaklineStyle?null==e?void 0:e.breaklineStyle:{}}))))},[e.config,S]),D=e.isDisabled||!1;return console.log(e),l.createElement("form",{onSubmit:r(function(t){e.onSubmit(t)}),onKeyDown:e=>(e=>{13===(e.keyCode?e.keyCode:e.key?e.key:e.which)&&e.preventDefault()})(e),id:e.formId,className:e.className},l.createElement(vr,{style:!0===(null==e?void 0:e.box)?{boxShadow:"none",padding:"20px 48px 48px"}:null},!e.childrenAtTheBottom&&e.children,e.heading&&l.createElement(gr,{className:"headerStyle"}," ",e.heading," "),e.description&&l.createElement(hr,{className:"descStyle"}," ",e.description," "),e.text&&l.createElement(Er,{className:"labelStyle"},e.text),T,e.childrenAtTheBottom&&e.children,e.secondaryActionLabel&&l.createElement("div",{className:"primary-label-btn text-align-right",style:{margin:"20px auto 0 auto"},onClick:function(t){e.onSecondayActionClick()}},e.secondaryActionLabel),e.submitInForm&&l.createElement(du,{label:y(e.label),style:d({},null==e?void 0:e.buttonStyle),submit:"submit",disabled:D,className:"submitButtonNew"}),!e.submitInForm&&e.label&&l.createElement(cu,null,e.currentStep>1&&l.createElement("button",{style:{backgroundColor:"transparent",color:"#3f51b5",border:"1px solid #3f51b5",padding:"10px 10px",margin:"10px",cursor:"pointer"},onClick:()=>{e.onBackClick&&e.onBackClick(S)},className:"submit-bar"},y("COMMON_BACK")),l.createElement(du,{label:y(e.label),submit:"submit",disabled:D}),e.onSkip&&e.showSkip&&l.createElement(vu,{style:null==e?void 0:e.skipStyle,label:y("CS_SKIP_CONTINUE"),onClick:e.onSkip}))))},gu=e=>{let{category:o,checked:i,readOnly:r,onDelete:s,hideQuestionLabel:c}=e;const m=u.useDispatch(),{t:v}=a.useTranslation(),p=Digit.ULBService.getCurrentTenantId(),[E,g]=n.useState(r),[f,h]=n.useState(r),[y,S]=n.useState(""),[_,C]=n.useState({}),[b,T]=n.useState([]),[D,N]=n.useState([]),[A,w]=n.useState(null),I=u.useSelector(e=>e.engagement.surveyForm);n.useEffect(()=>{let e={tenantId:p,id:null};try{Digit.Surveys.searchCategory(e).then(e=>{var t;if((null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0){const t=e.Categories.filter(e=>e.isActive).map(e=>({title:v(e.label),i18Key:e.label,value:e.id}));T(t)}})}catch(e){return e}},[]);const x=e=>{const{name:t,value:n}=e.target;m(Si(o.id,{[t]:n}))},[L,O]=n.useState(!1),[R,P]=n.useState(!1);function M(){O(!1)}return l.createElement("div",{className:"category-card"},l.createElement("h3",null,"Section Title ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"title",value:o.title,readOnly:r,onChange:x,placeholder:"Section Title",required:!0}),l.createElement("h3",null,"Section Weightage"),l.createElement("input",{type:"number",name:"weightage",value:o.weightage,onChange:x,onWheel:e=>e.target.blur(),readOnly:i,placeholder:"Section Weightage",required:!0}),(!1===r||void 0===r)&&l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",marginBottom:"5px"}},l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},onClick:()=>g(!E)},"Add Questions"),l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"red",color:"white",cursor:"pointer"},onClick:()=>{s(o.id)}},"Delete Section")),(E||!0===I.goPrev)&&l.createElement("div",null,l.createElement("h3",null,"Select Category"),l.createElement(t.Dropdown,{required:!0,t:v,id:"selectCategory",name:"selectCategory",option:b,select:e=>{m(Si(o.id,{selectCategory:e})),m(Ci(o.id,[])),h(!1)},placeholder:"Select Category",optionKey:"i18Key",selected:o.selectCategory||null}),(!1===r||void 0===r)&&l.createElement("h3",null,"Search Question"),(!1===r||void 0===r)&&l.createElement("input",{type:"text",name:"questionStatement",value:o.questionStatement,onChange:x,placeholder:"Search Question",readOnly:r}),(!1===r||void 0===r)&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:r,onClick:()=>{var e;""===o.selectCategory?w({key:!0,isError:!0,label:"PLEASE SELECT A CATEGORY"}):((e,t)=>{let n={categoryId:e,tenantId:p,questionStatement:t,status:"ACTIVE"};try{Digit.Surveys.searchQuestions(n).then(e=>{var t;if((null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0){let t=[];e.Questions.map(e=>{let n=d({},e,{selected:!1});t.push(n)}),t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),console.log("arr",t),m(Ci(o.id,t)),N(t),h(!0),w({key:!0,isError:!1,label:"QUESTIONS RETRIEVED"})}else m(Ci(o.id,[])),N([]),h(!1),w({key:!0,isError:!0,label:"NO QUESTIONS FOUND"})})}catch(e){m(Ci(o.id,[])),N([]),h(!1)}})(null===(e=o.selectCategory)||void 0===e?void 0:e.value,o.questionStatement)}},"Go"),f&&1!=c&&o.questions.length>0&&l.createElement("div",null,l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Question Label"),l.createElement("th",null,"Select"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.questions.map(e=>l.createElement("tr",{key:null==e?void 0:e.uuid},l.createElement("td",null,l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;console.log("question: ",e),O(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,v(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));P(n)}(e)},null==e?void 0:e.questionStatement),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},v("Click here to view the question details"))))),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{m(((e,t,n)=>({type:"UPDATE_QUESTION_SELECTION",categoryId:e,questionId:t,selected:n}))(o.id,e.uuid,t.target.checked))},checked:e.selected})),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{m(_i(o.id,e.uuid,t.target.checked))}}))))))),(!1===r||void 0===r)&&f&&o.questions.length>0&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginTop:"10px"},disable:r,onClick:()=>{const e=o.questions.filter(e=>e.selected);if(o.questions.some(e=>e.mandatory&&!e.selected))return void w({key:!0,isError:!0,label:"MANDATORY QUESTIONS MUST BE SELECTED"});if(0===e.length)return void w({key:!0,isError:!0,label:"PLEASE SELECT ATLEAST ONE QUESTION"});const t=e.filter(e=>!o.selectedQuestions.some(t=>t.uuid===e.uuid)),n=e.filter(e=>o.selectedQuestions.some(t=>t.uuid===e.uuid));let l=null;n.length>0&&n.map(e=>{l=o.selectedQuestions.findIndex(t=>t.uuid===e.uuid),o.selectedQuestions.map(t=>{t.uuid===e.uuid&&m(_i(o.id,e.uuid,e.mandatory))}),o.selectedQuestions[l].mandatory=e.mandatory});const a=o.selectCategory.title,i=[...o.selectedQuestions,...t.map(e=>d({},e,{selectedCategory:a}))],r=i.map(e=>d({},e,{weightage:Math.floor(100/i.length*100)/100}));m(yi(o.id,r))}},"Add These Questions"),l.createElement("div",null,o.selectedQuestions.length>0||!0===r?l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Selected Category"),l.createElement("th",null,"Question Statement"),l.createElement("th",null,"Weightage"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.selectedQuestions.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.uuid},l.createElement("td",null,e.selectedCategory),l.createElement("td",null,e.questionStatement),l.createElement("td",null,l.createElement("input",{type:"text",defaultValue:e.weightage,value:e.weightage,required:!0,onChange:n=>((e,t,n)=>{let l={};/^\d*(\.\d{0,2})?$/.test(n)?(m(((e,t,n)=>({type:"UPDATE_QUESTION_WEIGHTAGE",categoryId:e,questionId:t,weightage:n}))(o.id,t,n)),l={},C(l)):(l[e]={weightage:"Invalid weightage value. Please enter a number or decimal upto 2 decimal points"},C(l))})(t,e.uuid,n.target.value)}),"undefined"!=(null===(n=_[t])||void 0===n?void 0:n.weightage)&&l.createElement("span",{className:"error"},null===(a=_[t])||void 0===a?void 0:a.weightage)),l.createElement("td",null,!0===(null==e?void 0:e.mandatory)?"True":"False"),l.createElement("td",null,l.createElement("label",{onClick:()=>(e=>{const t=o.selectedQuestions.filter(t=>t.uuid!==e.uuid),n=t.length,l=t.map(e=>d({},e,{weightage:Math.floor(100/n*100)/100}));m(yi(o.id,l))})(e)},"Delete")))}))):null)),L&&l.createElement(So,{onSelect:function(){O(!1)},onCancel:M,onDismiss:M,heading:"Question Details",actionCancel:!0,content:R,hideSubmit:!0}),A&&l.createElement(t.Toast,{error:A.isError,label:v(A.label),onClose:()=>{w(null)},isDleteBtn:"false",labelstyle:{color:"white",width:"100%"}}))},fu=e=>{let{readOnly:t,hideQuestionLabel:a}=e;const o=u.useSelector(e=>e.engagement.surveyForm.categories),i=u.useSelector(e=>e.engagement.surveyForm.autoCalculateCategoriesWeight),r=u.useDispatch(),[s,c]=n.useState(i);console.log("categories",o);const[d,m]=n.useState(2),v=e=>{console.log("checked",s),1!==o.length?i?(r(bi(e)),r({type:"RECALCULATE_WEIGHTAGE"})):r(bi(e)):alert("Atleast one category must be there")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},o.map(e=>l.createElement(gu,{key:e.id,category:e,checked:i,readOnly:t,onDelete:v,hideQuestionLabel:a})),!0!==t&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginBottom:"10px"},onClick:()=>{console.log("checked",i),!0===i?(r(hi(d)),r({type:"RECALCULATE_WEIGHTAGE"}),m(d+1)):(r(hi(d)),m(d+1))}},"Add Section"),l.createElement("div",{style:{marginTop:"20px"}},l.createElement("div",{style:{display:"flex",columnGap:"20px"}},l.createElement("input",{style:{height:"20px",width:"20px"},type:"checkbox",checked:i,disabled:t,onChange:e=>{console.log("e checked",e.target.checked),r((e=>({type:"AUTO_CALCULATE_CATEGORY",categoryWeight:e}))(e.target.checked)),c(e.target.checked),!0===e.target.checked&&r({type:"RECALCULATE_WEIGHTAGE"})}}),"Auto Calculate Category Weightage")))},hu=()=>{const[e,t]=n.useState({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}}),a=(i.useForm({defaultValues:e}),(e,n)=>{const{value:l,checked:a}=n.target;t(t=>{const n=a?[...t[e].checkboxes,l]:t[e].checkboxes.filter(e=>e!==l);return d({},t,{[e]:d({},t[e],{checkboxes:n})})})}),o=(e,n)=>{const{name:l,value:a}=n.target;t(t=>d({},t,{[e]:d({},t[e],{[l]:a})}))};console.log("formData",e);const[r,u]=n.useState({});return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Title : Citizen Survey"),l.createElement("div",null,l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Description : This is a sample citizen survey")),l.createElement("form",{onSubmit:t=>{t.preventDefault(),(()=>{const t={};return e.name?/^[A-Za-z\s]+$/.test(e.name)||(t.name="Name can only contain alphabets and spaces"):t.name="Name is required",e.relationName?/^[A-Za-z\s]+$/.test(e.relationName)||(t.relationName="Relation Name can only contain alphabets and spaces"):t.relationName="Father/Husband Name is required",e.email?/\S+@\S+\.\S+/.test(e.email)||(t.email="Email is invalid"):t.email="Email is required",e.mobile?/^\d{10}$/.test(e.mobile)||(t.mobile="Mobile number is invalid"):t.mobile="Mobile number is required",e.relation||(t.relation="Relation is required"),e.address||(t.address="Address is required"),e.dob||(t.dob="Date of Birth is required"),!e.section1.checkboxes.length>0&&(t.checkboxes="This question is required to answer"),e.section1.shortText||(t.shortText="This question is required to answer"),e.section2.multipleChoice||(t.multipleChoice="This question is required to answer"),u(t),0===Object.keys(t).length})()&&console.log("Form submitted:",e)}},l.createElement(Ni,{formData:e,setFormData:t,errors:r,relationList:[{label:"Father",value:"Father"},{label:"Husband",value:"Husband"}]}),l.createElement("div",null,l.createElement("h2",null,"Section 1"),l.createElement("div",null,l.createElement("h3",null,"What is your feedback?"),l.createElement("div",null,l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option1",style:{width:"20px",height:"20px",marginRight:"10px"},checked:e.section1.checkboxes.includes("option1"),onChange:e=>a("section1",e)}),"Option 1"),l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option2",style:{width:"20px",height:"20px",marginRight:"10px",color:"#0d43a7"},checked:e.section1.checkboxes.includes("option2"),onChange:e=>a("section1",e)}),"Option 2"),r.checkboxes&&l.createElement("span",{className:"error"},r.checkboxes))),l.createElement("div",null,l.createElement("h3",null,"Tell us more about your product quality?"),l.createElement("div",null,l.createElement("input",{type:"text",name:"shortText",placeholder:"enter here",value:e.section1.shortText,onChange:e=>o("section1",e)}),r.shortText&&l.createElement("span",{className:"error"},r.shortText)))),l.createElement("div",null,l.createElement("h2",null,"Section 2"),l.createElement("div",null,l.createElement("h3",null,"Give your rating?"),l.createElement("div",null,l.createElement("select",{name:"multipleChoice",value:e.section2.multipleChoice,onChange:e=>o("section2",e)},l.createElement("option",{value:""},"Select an option"),l.createElement("option",{value:"choice1"},"Choice 1"),l.createElement("option",{value:"choice2"},"Choice 2"))),r.multipleChoice&&l.createElement("span",{className:"error"},r.multipleChoice))),l.createElement("button",{type:"submit"},"Submit"),l.createElement("button",{style:{backgroundColor:"none",marginLeft:"10px"},onClick:()=>t({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}})},"Reset"))))},yu=e=>{let{location:n}=e;const{t:i}=a.useTranslation(),r=o.useHistory(),u=o.useLocation().search,s=new URLSearchParams(u).get("from")||null,c=[{path:"/digit-ui/employee",content:i("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/engagement/event/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("event/inbox")},{path:"/digit-ui/employee/event/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/new-event")},{path:"/digit-ui/employee/event/inbox/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/inbox/new-event")},{path:"/digit-ui/employee/event/inbox/event-details",content:i("ES_EVENT_EVENT_DETAILS"),show:!!n.pathname.includes("event-details")},{path:"/digit-ui/employee/engagement/event/edit-event",content:i("ES_EVENT_EDIT_EVENT"),show:!!n.pathname.includes("event/edit-event")},{path:"/digit-ui/employee/event/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("event/response")},{path:"/digit-ui/employee/engagement/documents/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/documents/inbox")},{path:"/digit-ui/employee/engagement/documents/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/new-doc")},{path:"/digit-ui/employee/engagement/documents/inbox/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/inbox/new-doc")},{path:"/digit-ui/employee/engagement/documents/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/response")},{path:"/digit-ui/employee/engagement/documents/delete-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/delete-response")},{path:"/digit-ui/employee/engagement/documents/update-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/update-response")},{path:"/digit-ui/employee/engagement/documents/inbox/details/:id",content:i("CE_DOCUMENT_DETAILS"),show:!!n.pathname.includes("/documents/inbox/details")},{path:"/digit-ui/employee/engagement/documents/inbox/update",content:i("DOCUMENTS_EDIT_HEADER"),show:!!n.pathname.includes("/documents/inbox/update")},{path:"/digit-ui/employee/engagement/messages/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/messages/inbox")},{path:"/digit-ui/employee/engagement/messages/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/create")},{path:"/digit-ui/employee/engagement/messages/inbox/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/create")},{path:"/digit-ui/employee/engagement/messages/inbox/details/:id",content:i("CS_HEADER_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/details")},{path:"/digit-ui/employee/engagement/messages/inbox/edit/:id",content:i("EDIT_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/edit")},{path:"/digit-ui/employee/engagement/messages/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response")},{path:"/digit-ui/employee/engagement/messages/response?update=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?update=true")},{path:"/digit-ui/employee/engagement/messages/response?delete=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?delete=true")},{path:"/digit-ui/employee/engagement/surveys/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/surveys/inbox")},{path:"/digit-ui/employee/engagement/surveys/create-survey-step-form",content:s?i(s)+" / "+i("CS_COMMON_SURVEYS"):i("CS_COMMON_SURVEYS"),show:!!n.pathname.includes("/surveys/create-survey-step-form"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-category",content:s?i(s)+" / "+i("Create Category"):i("Create Category"),show:!!n.pathname.includes("/surveys/create-category"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-categories",content:s?i(s)+" / "+i("Search Categories"):i("Search Categories"),show:!!n.pathname.includes("/surveys/search-categories"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-questions",content:s?i(s)+" / "+i("Create Questions"):i("Create Questions"),show:!!n.pathname.includes("/surveys/create-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-questions",content:s?i(s)+" / "+i("Search Questions"):i("Search Questions"),show:!!n.pathname.includes("/surveys/search-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-response",content:s?i(s)+" / "+i("ES_EVENT_NEW_EVENT_RESPONSE"):i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/surveys/create-response"),isBack:s&&!0}];return l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"}},l.createElement(t.BreadCrumb,{crumbs:c}),l.createElement("p",{className:"breadcrumb"},l.createElement("button",{onClick:()=>{r.goBack()},style:{cursor:"pointer",color:"#666"}},"<"," ",i("CS_COMMON_BACK"))))},Su=e=>{let{path:t,userType:a,tenants:i,stateCode:r}=e;const u=o.useLocation();return l.createElement(n.Fragment,null,l.createElement(yu,{location:u}),l.createElement(o.Switch,null,l.createElement(o.Route,{path:t+"/event/inbox",exact:!0},l.createElement(Ke,{tenants:i,parentRoute:t})),l.createElement(o.Route,{path:t+"/event/response",component:e=>l.createElement(Pe,e)}),l.createElement(o.Route,{path:t+"/event/inbox/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/edit-event/:id"},l.createElement(Oe,null)),l.createElement(o.Route,{path:t+"/event/inbox/event-details/:id"},l.createElement(oo,null)),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/update",component:e=>l.createElement(wo,e)}),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/new-doc",component:()=>l.createElement(No,{path:t})}),l.createElement(o.Route,{exact:!0,path:t+"/documents/new-doc",component:()=>l.createElement(No,{path:t})}),l.createElement(o.Route,{path:t+"/documents/inbox/details/:id",component:e=>l.createElement(Yo,e)}),l.createElement(o.Route,{path:t+"/documents/response",component:e=>l.createElement(xo,e)}),l.createElement(o.Route,{path:t+"/documents/update-response",component:e=>l.createElement(Oo,e)}),l.createElement(o.Route,{path:t+"/documents/delete-response",component:e=>l.createElement(Po,e)}),l.createElement(o.Route,{path:t+"/documents/inbox",component:e=>l.createElement(Wo,{tenants:i})}),l.createElement(o.Route,{path:t+"/messages",component:e=>l.createElement($a,d({},e,{tenants:i,parentRoute:t}))}),l.createElement(o.Route,{path:t+"/surveys",component:e=>l.createElement(ir,d({},e,{tenants:i,parentRoute:t,userType:a,stateCode:r}))})))},_u={EngagementModule:e=>{let{stateCode:n,userType:a,tenants:i}=e;const{path:r,url:u}=o.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:c}=Digit.Services.useStore({stateCode:n,moduleCode:"Engagement",language:s});return c?l.createElement(t.Loader,null):(Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i),"citizen"===a?l.createElement(To,{path:r,url:u,userType:a,tenants:i}):l.createElement(Su,{path:r,url:u,userType:a,tenants:i,stateCode:n}))},EngagementCard:()=>{var e,o;const i=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(o=e.info)||void 0===o?void 0:o.roles).find(e=>"EMPLOYEE"===e.code);if(n.useEffect(()=>{Digit.SessionStorage.set("CITIZENSURVEY.INBOX",null)},[]),!i)return null;const r=Digit.ULBService.getCurrentTenantId(),{data:u,isLoading:s}=Digit.Hooks.engagement.useDocSearch({tenantIds:r},{select:e=>null==e?void 0:e.totalCount}),{data:c,isLoading:m}=Digit.Hooks.events.useInbox(r,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST"},{select:e=>null==e?void 0:e.totalCount}),{data:v,isLoading:p}=Digit.Hooks.events.useInbox(r,{},{eventTypes:"EVENTSONGROUND"},{select:e=>null==e?void 0:e.totalCount}),{data:E,isLoading:g}=Digit.Hooks.survey.useSearch({tenantIds:r},{select:e=>null==e?void 0:e.TotalCount}),f=n.useMemo(()=>s?"-":u,[s,u]),h=n.useMemo(()=>p?"-":v,[p,v]),y=n.useMemo(()=>m?"-":c,[m,c]),S=n.useMemo(()=>g?"-":E,[g,E]),{t:_}=a.useTranslation();let C=null;const b={Icon:l.createElement(t.SurveyIconSolid,null),moduleName:_("CS_COMMON_SURVEYS"),kpis:[{count:S,label:_("TOTAL_SURVEYS"),link:"/digit-ui/employee/engagement/surveys/inbox"}],links:[{count:S,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/surveys/inbox"},{label:_("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{label:_("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{label:_("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{label:_("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{label:_("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"},{label:_("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"}]},T={Icon:l.createElement(t.PMBIconSolid,null),moduleName:_("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"),kpis:[{count:y,label:_("TOTAL_MESSAGES"),link:"/digit-ui/employee/engagement/messages/inbox"}],links:[{count:y,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/messages/inbox"},{label:_("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/create"}]},D={Icon:l.createElement(t.EventsIconSolid,null),moduleName:_("TOTAL_EVENTS"),kpis:[{count:h,label:_("TOTAL_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox"}],links:[{count:h,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/event/inbox"},{label:_("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/new-event"}]},N={Icon:l.createElement(t.DocumentIconSolid,null),moduleName:_("ES_TITLE_DOCS"),kpis:[{count:f,label:_("TOTAL_DOCUMENTS"),link:"/digit-ui/employee/engagement/documents/inbox"}],links:[{count:f,label:_("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/documents/inbox"},{label:_("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/new-doc"}]};return i&&(C=l.createElement(n.Fragment,null,[N,D,T,b].map((e,n)=>l.createElement(t.EmployeeModuleCard,d({key:n,longModuleName:!0},e))))),C},EngagementDocSelectULB:e=>{var a,o;let{t:r,setValue:u,config:s,formData:c,errors:d,control:m}=e;const v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.ULBService.getCurrentTenantId(),E=n.useMemo(()=>null!=c&&c.defaultTenantId?null==v?void 0:v.find(e=>(null==e?void 0:e.code)===(null==c?void 0:c.defaultTenantId)):p&&v?null==v?void 0:v.filter(e=>e.code===p):1===(null==f?void 0:f.length)?null==f?void 0:f[0]:null,[p,v]),g=Digit.SessionStorage.get("citizen.userRequestObject"),f=v.filter(e=>{var t,n;return null==g||null===(t=g.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),h=Digit.ULBService.getUserUlbs("SUPERUSER").sort(y);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},r("ES_COMMON_ULB")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:s.key,control:m,defaultValue:null==E?void 0:E[0],rules:{required:!0},render:e=>l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:h,select:t=>{var n,l;e.onChange([...(null==c||null===(n=c[null==s?void 0:s.key])||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>t.code!=(null==e?void 0:e.code)))||[],t])},keepNull:!0,selected:e.value,disable:1===(null==v?void 0:v.length),t:r})}),l.createElement("div",{className:"tag-container"},c&&(null===(a=c[null==s?void 0:s.key])||void 0===a?void 0:a.length)>0&&(null==c||null===(o=c[s.key])||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:r(null==e?void 0:e.i18nKey),onClick:()=>{var t;u(s.key,null==c||null===(t=c[s.key])||void 0===t?void 0:t.filter(t=>t.i18nKey!=e.i18nKey))}})))),d&&d[s.key]&&l.createElement(CardLabelError,null,r("EVENTS_TENANT_ERROR_REQUIRED")))))},EngagementULBDropdown:e=>{let{t:n,config:a,errors:o,control:r}=e;const u=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),s=Digit.UserService.getUser().info,c=u.filter(e=>{var t;return null==s||null===(t=s.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_ULB")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:a.key,control:r,rules:{required:!0},render:e=>{let{onChange:a,value:o}=e;return l.createElement(t.Dropdown,{option:c,selected:o,disable:1===(null==c?void 0:c.length),optionKey:"code",t:n,select:a})}}),o&&o[null==a?void 0:a.key]&&l.createElement(CardLabelError,null,n("EVENTS_TENANT_ERROR_REQUIRED")))))},EnagementDocName:e=>{let{t:n,config:a,register:o}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_DOC_NAME")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{name:a.key,inputRef:o()}))))},EngagementDocCategory:e=>{let{t:a,config:o,formData:r,control:u}=e;const s=Digit.ULBService.getStateId(),[c,d]=n.useState(()=>[]),m=Digit.ULBService.getCurrentUlb()||"pb.amritsar",{data:v}=Digit.Hooks.engagement.useMDMS(s,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===m.code))[0].categoryList.map(e=>({name:e}))}});return n.useEffect(()=>{var e,t;null!=r&&null!==(e=r.ULB)&&void 0!==e&&e.length&&d(null==r||null===(t=r.ULB)||void 0===t?void 0:t.map(e=>null==e?void 0:e.code))},[null==r?void 0:r.ULB]),l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_CATEGORY")+"*"),l.createElement(i.Controller,{name:o.key,control:u,render:e=>l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{option:v,select:e.onChange,selected:e.value,t:a,optionKey:"name"}))})))},EngagementDocDescription:e=>{var n,a,o;let{t:i,config:r,register:u,errors:s}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},i("ES_COMMON_DOC_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(t.TextArea,{name:r.key,inputRef:u({maxLength:140})}),(null==s||null===(n=s.description)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,i("ERROR_"+(null==s||null===(a=s.description)||void 0===a||null===(o=a.type)||void 0===o?void 0:o.toUpperCase())+"_140")))))},EngagementDocUploadDocument:e=>{let{t:a,config:r,formData:u,setError:s,control:c}=e;const[d,m]=n.useState(()=>{var e;return null==u||null===(e=u[r.key])||void 0===e?void 0:e.filestoreId}),[E,g]=n.useState(),[f,h]=n.useState(""),[y,S]=n.useState(),[_,C]=n.useState(!1),[b,T]=(Digit.ULBService.getCurrentTenantId(),n.useState({})),[D,w]=n.useState(!1),[I,x]=n.useState("");n.useEffect(()=>{y&&L()},[y]),n.useEffect(()=>{var e;d||C(!1),null==b||null===(e=b.onChange)||void 0===e||e.call(b,{fileStoreId:d,fileSize:E,fileType:f})},[d,b]);const L=function(){try{const e=p(function(){return v(function(){return w(!0),Promise.resolve(Digit.UploadServices.Filestorage("engagement",y,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?m(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):s(a("CS_FILE_UPLOAD_ERROR"))})},function(){})},function(e,t){if(w(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O=o.useLocation(),R=n.useMemo(()=>!!O.pathname.includes("/documents/inbox/update"),[O.pathname]);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_DOCUMENT")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:r.key+".filestoreId",control:c,render:e=>l.createElement(t.UploadFile,{id:"city-engagement-doc",onUpload:t=>((e,t)=>{var n,l,a,o,i,r;if(S(),g(),h(),x(""),null===(n=e.target)||void 0===n||null===(l=n.files)||void 0===l||!l.length)return;const u=null==e||null===(a=e.target)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.size,s=null==e||null===(i=e.target)||void 0===i||null===(r=i.files[0])||void 0===r?void 0:r.type;if(!(u&&u/1024/1024>5))return s&&(e=>!!e&&!!/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats)$/i.test(e))(s)?(g(u),h(s),T(t),void S(e.target.files[0])):void x("NOT_SUPPORTED_FILE_TYPE");x("FILE_SIZE_EXCEEDED")})(t,e),onDelete:()=>{m(null),g(100)},accept:"image/*, .pdf, .png, .jpeg, .doc",showHintBelow:!0,hintText:a("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE"),message:D?l.createElement(t.Loader,null):A(a,d,R),textStyles:{width:"100%"},inputStyles:{width:"280px"}})}),E?""+N(E):null,I?l.createElement(t.CardLabelError,null,a(I)):null)))},NotificationsAndWhatsNew:e=>{var i,r;let{variant:u,parentRoute:s}=e;const{t:c}=a.useTranslation(),m=o.useLocation(),v=o.useHistory(),p=Digit.ULBService.getCitizenCurrentTenant(),{data:{unreadCount:E}={},refetch:g}=Digit.Hooks.useNotificationCount({tenantId:p,config:{enabled:!(null===(i=Digit.UserService)||void 0===i||null===(r=i.getUser())||void 0===r||!r.access_token)}}),{mutate:f,isSuccess:h}=Digit.Hooks.useClearNotifications();n.useEffect(()=>{h&&g()},[h]),n.useEffect(()=>E&&p?f({tenantId:p}):null,[p,E]);const{data:y,isLoading:S}=Digit.Hooks.useEvents({tenantId:p,variant:u});if(S)return l.createElement(t.Loader,null);if(0===(null==y?void 0:y.length))return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,""+c("CS_HEADER_NOTIFICATIONS")),l.createElement("h1",null,"Nothing to show"));function _(e){v.push(s+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(()=>{switch(u){case"notifications":return l.createElement(t.Header,null,c("CS_HEADER_NOTIFICATIONS")+" "+(E?"("+E+")":""));case"whats-new":return l.createElement(t.Header,null,c("CS_HEADER_WHATSNEW"));default:return l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen",state:{from:m.pathname+m.search}}})}},null),null!=y&&y.length?y.map(e=>"EVENTSONGROUND"===(null==e?void 0:e.eventType)?l.createElement(t.OnGroundEventCard,d({onClick:_},e)):l.createElement("BROADCAST"===(null==e?void 0:e.eventType)?to:t.WhatsNewCard,e)):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))},EventsListOnGround:e=>{var n,i,r,u;let{variant:s,parentRoute:c}=e;const{t:m}=a.useTranslation(),v=o.useLocation(),p=o.useHistory(),E=Digit.ULBService.getCitizenCurrentTenant(),{data:{}={},isSuccess:g}=Digit.Hooks.useNotificationCount({tenantId:E,config:{enabled:!(null===(n=Digit.UserService)||void 0===n||null===(i=n.getUser())||void 0===i||!i.access_token)}}),{data:f,isLoading:h}=Digit.Hooks.useEvents({tenantId:E,variant:s});if(null===(r=Digit.UserService)||void 0===r||null===(u=r.getUser())||void 0===u||!u.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});if(h||!g)return l.createElement(t.Loader,null);function y(e){p.push(c+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,m("EVENTS_EVENTS_HEADER")+"("+(null==f?void 0:f.length)+")"),f.length?f.map(e=>l.createElement(t.OnGroundEventCard,d({onClick:y},e))):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,m("COMMON_INBOX_NO_DATA"))))},EventDetails:()=>{var e,i,r,u,s,c,d;const{t:m}=a.useTranslation(),v=o.useLocation(),{id:p}=(o.useHistory(),o.useParams()),E=Digit.ULBService.getCitizenCurrentTenant(),{data:g,isLoading:f}=Digit.Hooks.useEvents({tenantId:E,variant:"events"});if(null===(e=Digit.UserService)||void 0===e||null===(i=e.getUser())||void 0===i||!i.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});const h=n.useMemo(()=>f?null:null==g?void 0:g.filter(e=>e.id===p)[0],[f,g]);return f?l.createElement(t.Loader,null):l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,m("ES_TITLE_APPLICATION_DETAILS")),l.createElement(t.OnGroundEventCard,function(e){const{eventCategory:t,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}=e;return{eventCategory:m(t),showEventCatergory:!0,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}}(h)),l.createElement("div",{className:"OnGroundEventDetailsCard"},l.createElement("p",{className:"cardCaptionBodyS"},null==h?void 0:h.description),l.createElement("div",{className:"eventAddressAndDirection"},l.createElement("span",null,l.createElement(t.MapMarker,null),l.createElement("div",null,l.createElement("p",null,null==h||null===(r=h.eventDetails)||void 0===r?void 0:r.address),null!=h&&null!==(u=h.eventDetails)&&void 0!==u&&u.latitude&&null!=h&&null!==(s=h.eventDetails)&&void 0!==s&&s.longitude?l.createElement("a",{className:"direction",target:"_blank",href:"https://www.google.com/maps/search/?api=1&query="+(null==h||null===(c=h.eventDetails)||void 0===c?void 0:c.latitude)+"%2C"+(null==h||null===(d=h.eventDetails)||void 0===d?void 0:d.longitude)},m("CS_COMMON_GET_DIRECTIONS")):null))),l.createElement("div",{className:"eventTimeRange"},l.createElement(t.Clock,null),l.createElement("p",null,null==h?void 0:h.onGroundEventTimeRange))))},EventForm:e=>{var r,u,s,c;let{formData:d,control:m,errors:v}=e;const{t:p}=a.useTranslation(),E=Digit.ULBService.getCurrentTenantId(),g=null==E?void 0:E.split(".")[0],f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),{isLoading:_,data:C}=Digit.Hooks.useCommonMDMS(g,"mseva",["EventCategories"]),b=o.useLocation(),T=n.useMemo(()=>!!b.pathname.includes("/engagement/event/edit-event"),[b.pathname]);return _?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:m,defaultValue:null!=d&&d.defaultTenantId?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===(null==d?void 0:d.defaultTenantId)):E?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===E):1===(null==S?void 0:S.length)?null==S?void 0:S[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:S,selected:a,disable:!!T||1===(null==S?void 0:S.length),optionKey:"code",t:p,select:n})}}),v&&v.tenantId&&l.createElement(t.CardLabelError,null,p("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_NAME_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==d?void 0:d.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:m}),v&&(null==v?void 0:v.name)&&"required"===(null==v||null===(r=v.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_COMMENTS_ERROR_REQUIRED")),v&&(null==v?void 0:v.name)&&"maxLength"===(null==v||null===(u=v.name)||void 0===u?void 0:u.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_CATEGORY_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"eventCategory",control:m,defaultValue:null!=d&&d.category?null==C||null===(s=C.mseva)||void 0===s||null===(c=s.EventCategories.filter(e=>e.code===(null==d?void 0:d.category)))||void 0===c?void 0:c[0]:null,rules:{required:!0},render:e=>{var n;let{onChange:a,ref:o,value:i}=e;return l.createElement(t.Dropdown,{inputRef:o,option:null==C||null===(n=C.mseva)||void 0===n?void 0:n.EventCategories,optionKey:"code",t:p,select:a,selected:i})}}),v&&v.eventCategory&&l.createElement(t.CardLabelError,null,p("EVENTS_CATEGORY_ERROR_REQUIRED")))))},MessageForm:e=>{var o,r,u,s,c,d,m,v,p,E;let{formData:g,control:f,errors:h,setError:y}=e;const{t:S}=a.useTranslation(),_=Digit.ULBService.getCurrentTenantId(),C=null==_?void 0:_.split(".")[0],b=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),{isLoading:T,data:D}=Digit.Hooks.useCommonMDMS(C,"mseva",["EventCategories"]),N=Digit.ULBService.getStateId(),A=b.filter(e=>(null==e?void 0:e.code)===_);return T?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,defaultValue:1===(null==A?void 0:A.length)?null==A?void 0:A[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:A,selected:a,disable:1===(null==A?void 0:A.length),optionKey:"code",t:S,select:n})}}),h&&h.tenantId&&l.createElement(t.CardLabelError,null,S("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TITLE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==g?void 0:g.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:f}),h&&(null==h?void 0:h.name)&&"required"===(null==h||null===(o=h.name)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.name)&&"maxLength"===(null==h||null===(r=h.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},S("EVENTS_COMMENTS_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"description",control:f,defaultValue:null!=g&&g.category?null==D||null===(u=D.mseva)||void 0===u||null===(s=u.EventCategories.filter(e=>e.code===(null==g?void 0:g.category)))||void 0===s?void 0:s[0]:null,rules:{required:!0,maxLength:500},render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextArea,{inputRef:a,value:o,name:"description",onChange:n,hintText:S("PUBLIC_BRDCST_MSG_LENGTH")})}}),h&&(null==h?void 0:h.description)&&"required"===(null==h||null===(c=h.description)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.description)&&"maxLength"===(null==h||null===(d=h.description)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},""+S("EVENTS_ATTACHMENT_LABEL")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"documents",control:f,rules:{required:!1},render:e=>{let{onChange:n,value:a=[]}=e;return l.createElement(t.MultiUploadWrapper,{t:S,module:"engagement",tenantId:N,getFormState:function(e){let t=[];e.length>0&&e.forEach(e=>{var n,l,a,o;t.push({fileName:null==e?void 0:e[0],fileStoreId:null==e||null===(n=e[1])||void 0===n||null===(l=n.fileStoreId)||void 0===l?void 0:l.fileStoreId,documentType:null==e||null===(a=e[1])||void 0===a||null===(o=a.file)||void 0===o?void 0:o.type})}),n(t)},showHintBelow:!0,setuploadedstate:a,allowedFileTypesRegex:Ja,allowedMaxSizeInMB:5,hintText:S("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE")})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_FROM_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,name:"fromDate",defaultValue:null==g?void 0:g.fromDate,rules:{required:!0,validate:{isValidFromDate:e=>{const t=I(new Date(""+(null==g?void 0:g.fromDate))),n=new Date;return!(!k(t)||t.getTime()<n.getTime()&&(y("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(m=h.fromDate)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(v=h.fromDate)||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_INVALID")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,name:"toDate",defaultValue:null==g?void 0:g.toDate,rules:{required:!0,validate:{isValidToDate:e=>{const t=I(new Date(""+(null==g?void 0:g.fromDate))),n=I(new Date(""+(null==g?void 0:g.toDate))),l=new Date;return!(!k(n)||(n.getTime()<l.getTime()||n.getTime()<t.getTime())&&(y("toDate",{type:"isValidToDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(p=h.toDate)||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(E=h.toDate)||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_INVALID")))))},DocumentList:e=>{let{match:o}=e;const{t:i}=a.useTranslation(),{category:r,count:u}=o.params,s=Digit.ULBService.getCitizenCurrentTenant(),[c,d]=n.useState(20),[m,v]=n.useState(0),[p,E]=n.useState(),g=ro(p,700),{data:f,isLoading:h}=Digit.Hooks.engagement.useDocSearch({name:g,category:r,tenantIds:s,limit:c},{select:e=>{var t;return null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}})}});return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,i(""+r)+" ("+(u||"-")+")"),l.createElement("div",{className:"documentContainerPadding"},l.createElement("div",null,l.createElement(io,{searchValue:p,handleKeyPress:function(e){try{return"Enter"===e.key&&p.length&&E(""),Promise.resolve()}catch(e){return Promise.reject(e)}},handleSearch:function(e){try{return p.length&&E(""),Promise.resolve()}catch(e){return Promise.reject(e)}},onChange:E,t:i})),h?l.createElement(t.Loader,null):f&&f.length?so(f,i):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,i("COMMON_INBOX_NO_DATA")))))},SelectEventGeolocation:e=>{var o,i;let{onSelect:r,config:u,formData:s}=e;const{t:c}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},""+c("EVENTS_GEOLOCATION_LABEL")),l.createElement("div",{className:"field"},l.createElement(t.LocationSearch,{position:{latitude:null==s||null===(o=s.geoLocation)||void 0===o?void 0:o.latitude,longitude:null==s||null===(i=s.geoLocation)||void 0===i?void 0:i.longitude},onChange:(e,t)=>{r(null==u?void 0:u.key,t)}}))))},SelectToDate:e=>{var o,r;let{formData:u,control:s,errors:c,setError:d}=e;const{t:m}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},m("EVENTS_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:s,name:"toDate",defaultValue:null==u?void 0:u.toDate,rules:{required:!0,validate:{isValidDate:e=>!(!k(new Date(null==u?void 0:u.fromDate))||!k(new Date(e))||(new Date((null==u?void 0:u.fromDate)+" "+(null==u?void 0:u.fromTime))<new Date?(d("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1):new Date(e+" "+(null==u?void 0:u.toTime))<new Date||!(new Date((null==u?void 0:u.fromDate)+" "+(null==u?void 0:u.fromTime))<=new Date(e+" "+(null==u?void 0:u.toTime)))))}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),c&&(null==c?void 0:c.toDate)&&"required"===(null==c||null===(o=c.toDate)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),c&&(null==c?void 0:c.toDate)&&"isValidDate"===(null==c||null===(r=c.toDate)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID")))))},SurveyList:()=>{const{t:e}=a.useTranslation(),n=o.useHistory(),i=Digit.ULBService.getCitizenCurrentTenant(),{data:r,isLoading:u}=Digit.Hooks.survey.useSearch({tenantIds:i},{select:e=>{let{Surveys:t}=e;const n=t.map(e=>{const t=jo(e.startDate,e.endDate);let n="";return n=t&&e.hasResponded?"CS_SURVEY_RESPONDED":t?"CS_SURVEY_YT_TO_RESPOND":"CANNOT_RESPOND_MSG",d({hasResponded:!1,responseStatus:n},e)}),l=[],a=[];for(let e of n)"ACTIVE"===e.status&&jo(e.startDate,e.endDate)?l.push(e):a.push(e);return{activeSurveysList:l,inactiveSurveysList:a}}});return u?l.createElement(t.Loader,null):l.createElement("div",{className:"survey-list-container"},l.createElement(t.Header,null,e("CS_COMMON_SURVEYS")+" ("+(null==r?void 0:r.activeSurveysList.length)+")"),null!=r&&r.activeSurveysList&&r.activeSurveysList.length?r.activeSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(qo,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t,onCardClick:()=>{var t;n.push((t=e).hasResponded?"/digit-ui/citizen/engagement/surveys/show-survey":"/digit-ui/citizen/engagement/surveys/fill-survey?applicationNumber="+(null==t?void 0:t.uuid)+"&tenantId="+(null==t?void 0:t.tenantId),t)}}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_ACTIVE_SURVEYS"))),l.createElement(t.Header,null,e("CS_COMMON_INACTIVE_SURVEYS")+" ("+r.inactiveSurveysList.length+")"),null!=r&&r.inactiveSurveysList&&r.inactiveSurveysList.length?r.inactiveSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(qo,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_INACTIVE_SURVEYS"))))},FillSurvey:e=>{var t,i,r,u,s,c,d,m;const{applicationNumber:v,tenantId:p}=Digit.Hooks.useQueryParams(),{data:E,isLoading:g}=Digit.Hooks.survey.useSearch({uuid:v,tenantId:p},{}),f=null!=E&&null!==(t=E.Surveys)&&void 0!==t&&t[0]?null==E||null===(i=E.Surveys)||void 0===i?void 0:i[0]:{},{t:h}=a.useTranslation();let y=E;const[S,_]=n.useState(null);null==f||null===(r=f.questions)||void 0===r||r.sort((e,t)=>e.qorder-t.qorder);const C=o.useHistory();return n.useEffect(()=>{var e,t,n,l,a,o;E&&1==(null==y||null===(e=y.Surveys)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.hasResponded)||"true"===(null==y||null===(n=y.Surveys)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.hasResponded)?_({key:!0,label:"SURVEY_FORM_IS_ALREADY_SUBMITTED"}):E&&"INACTIVE"==(null==y||null===(a=y.Surveys)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.status)&&_({key:!0,label:"SURVEY_FORM_IS_ALREADY_INACTIVE"})},[null==E||null===(u=E.Surveys)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.hasResponded,null==y||null===(c=y.Surveys)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.hasResponded]),(null===(m=Object.keys(f))||void 0===m?void 0:m.length)>0||g?l.createElement(Ri,{surveyData:f,isSubmitDisabled:!!S,isLoading:g,onFormSubmit:e=>{const t={AnswerEntity:{surveyId:f.uuid,answers:ur(e),surveyTitle:f.title,hasResponded:f.hasResponded}};C.push("/digit-ui/citizen/engagement/surveys/submit-response",t)},formDisabled:!!S,showToast:S}):l.createElement(rr,{t:h})},CitizenSurveyForm:Ri,ShowSurvey:e=>{var a;let{location:o}=e;const i=null==o?void 0:o.state,u=(Digit.ULBService.getCitizenCurrentTenant(),Digit.Hooks.survey.useShowResults()),s=r.useQueryClient();if(n.useEffect(()=>{u.mutate({surveyId:i.uuid},{onSuccess:()=>{s.clear()}})},[]),u.isLoading&&!u.isIdle)return l.createElement(t.Loader,null);if(u.isError)return l.createElement("div",null,"An error occured...");const c=null==u||null===(a=u.data)||void 0===a?void 0:a.answers,d={};return null==c||c.map(e=>{d[null==e?void 0:e.questionId]=1===(null==e?void 0:e.answer.length)?null==e?void 0:e.answer[0]:null==e?void 0:e.answer}),l.createElement(Ri,{surveyData:i,submitDisabled:!0,formDisabled:!0,formDefaultValues:d})},SurveyResults:Yi,CreateSurveyCategory:Xo,SearchCategories:Jo,SurveyForm:e=>{let{t:a,index:o,questionStatement:r,type:u,uuid:s,qorder:c,required:m,options:v,disableInputs:p,dispatch:E,isPartiallyEnabled:g,addOption:f,formDisabled:h}=e;const y=[{title:a("Surveys_Short_Answer"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},{title:a("Surveys_Multiple_Choice"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},{title:a("Surveys_Check_Boxes"),i18Key:"CHECKBOX_ANSWER_TYPE",value:"CHECKBOX_ANSWER_TYPE"},{title:a("Surveys_Paragraph"),i18Key:"LONG_ANSWER_TYPE",value:"LONG_ANSWER_TYPE"},{title:a("Surveys_Date"),i18Key:"DATE_ANSWER_TYPE",value:"DATE_ANSWER_TYPE"},{title:a("Surveys_Time"),i18Key:"TIME_ANSWER_TYPE",value:"TIME_ANSWER_TYPE"}],S=[{title:a("Product Quality"),i18Key:"Product_Quality",value:"Product_Quality"}],_=[{title:a("What is your feedback for this product?"),i18Key:"Product_Quality",value:"Product_Quality"}],C=y.filter(e=>(null==e?void 0:e.value)===("object"==typeof u?u.value:u)),b=window.location.href.includes("/employee/engagement/"),[T,D]=n.useState({questionStatement:r,type:u?null==C?void 0:C[0]:{title:a("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:m,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c}),{register:N,formState:A}=i.useFormContext(),[w,I]=n.useState(0);n.useEffect(()=>{D({questionStatement:r,type:u?null==C?void 0:C[0]:{title:a(""),i18Key:"",value:""},required:m,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c})},[r]);const x=()=>D(e=>{const t=d({},e);return t.options.push(a("CMN_OPTION")+" "+(t.options.length+1)),t}),L=e=>{let{value:t,id:n}=e;D(e=>{const l=d({},e);return l.options.splice(n,1,t),l})},O=e=>{1===T.options.length||!g&&h||D(t=>{const n=d({},t);return n.options.splice(e,1),n})};return n.useEffect(()=>{E({type:"updateForm",payload:{index:o,formConfig:T}})},[T]),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},l.createElement(t.TextInput,{value:T.categoryName,onChange:e=>{D(t=>d({},t,{categoryName:e.target.value}))},name:"category",placeholder:"Category Title"}),l.createElement(t.TextInput,{placeholder:a("Weightage"),value:T.weightage,onChange:e=>{D(t=>d({},t,{weightage:e.target.value}))},textInputStyle:{width:"100%"},name:"Weightage_"+o,disable:p,inputRef:N({required:a("ES_ERROR_REQUIRED"),maxLength:{value:100,message:a("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:a("ES_SURVEY_DONT_START_WITH_NUMBER")}})})),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement("div",null,l.createElement(t.Dropdown,{t:a,option:S,select:e=>{D(t=>d({},t,{Categorytype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Category",optionKey:"i18Key",disable:p,selected:""}),l.createElement(t.TextInput,{placeholder:a("Category Weightage"),name:"QusWeight",disabled:b,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})})),l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:_,select:e=>{D(t=>d({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:T.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{D(t=>d({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},optionKey:"i18Key",disable:p,selected:null==T?void 0:T.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:b,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,o;switch(null==e?void 0:e.value){case"LONG_ANSWER_TYPE":return l.createElement("div",null,l.createElement(t.TextArea,{placeholder:a("LONG_ANSWER_TYPE"),disabled:b,name:"longAnsDescription",inputRef:N({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")}})}),(null==A?void 0:A.errors)&&l.createElement(t.CardLabelError,null,null==A||null===(n=A.errors)||void 0===n||null===(o=n.longAnsDescription)||void 0===o?void 0:o.message));case"DATE_ANSWER_TYPE":return l.createElement(t.DatePicker,{stylesForInput:{width:"calc(100% - 290px)"},style:{width:"202px"},disabled:b});case"TIME_ANSWER_TYPE":return l.createElement(t.TextInput,{type:"time",textInputStyle:{width:"202px"},disable:b});case"MULTIPLE_ANSWER_TYPE":return l.createElement(ni,{maxLength:60,titleHover:a("MAX_LENGTH_60"),t:a,addOption:x,updateOption:L,removeOption:O,options:null==T?void 0:T.options,createNewSurvey:f,isInputDisabled:b,isPartiallyEnabled:g,formDisabled:h});case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,l.createElement(ei,{t:a,addOption:x,updateOption:L,removeOption:O,options:null==T?void 0:T.options,isInputDisabled:b,isPartiallyEnabled:g,createNewSurvey:f,formDisabled:h,maxLength:60,titleHover:a("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}}));default:return null}})(null==T?void 0:T.Answertype)),(void 0!==T.Questype&&console.log("hi"),void 0!==T.Questype?l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:_,select:e=>{D(t=>d({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:T.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{D(t=>d({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},name:"Answertype"+(null==T||null===(R=T.Questype)||void 0===R?void 0:R.index),optionKey:"i18Key",disable:p,selected:null==T?void 0:T.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:b,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))):null),l.createElement("div",{className:"newSurveyForm_actions"},l.createElement("div",null,"Add more questions?"),l.createElement("div",{className:"newSurveyForm_seprator"}),l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>{D(e=>d({},e,{Questype:{value:"ADD_QUESTION",index:w+1}})),I(w+1)}},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("Add more question")))))),l.createElement("div",{className:"newSurveyForm_actions"},0!==o&&l.createElement("div",{className:"newSurveyForm_seprator"}),0!==o&&l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>E({type:"removeForm",payload:{index:o}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("CS_INFO_DELETE"))))))));var R},CreateSurveyForm:e=>{let{disableInputs:t,isPartiallyEnabled:a,formDisabled:o}=e;const r=i.useForm({defaultValues:{sections:[]}}),{register:u,control:s,setValue:c,getValues:v,reset:p,formState:E,clearErrors:g}=r,f=m(r,or);console.log("setSurveyConfig",c),console.log("disable Inputs",t),console.log("partially enabled",a),console.log("forms disable",o);const[h,y]=n.useReducer((e,t)=>{let{type:n}=t;switch(console.log("type im reducer",n),n){case"ADD_SECTION":return d({},e,{sections:[e.sections,{id:2,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}],weightage:0}]});case"ADD_CATEGORY":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:[...e.categories,{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}):e)});case"ADD_QUESTION":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:e.categories.map(e=>e.id===action.categoryId?d({},e,{questions:[...e.questions,{id:Date.now(),type:"",answer:""}]}):e)}):e)});case"UPDATE_SECTION_WEIGHTAGE":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{weightage:action.weightage}):e)});case"UPDATE_CATEGORY_WEIGHTAGE":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:e.categories.map(e=>e.id===action.categoryId?d({},e,{weightage:action.weightage}):e)}):e)});default:return e}},{sections:[{id:1,weightage:20,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}]});return l.createElement(n.Fragment,null,l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,d({register:u,control:s,setValue:c,getValues:v,reset:p,formState:E,clearErrors:g},f),l.createElement("div",null,l.createElement("h1",null,"Survey Creation"),l.createElement("button",{onClick:()=>{(e=>{let{type:t,payload:n}={type:"ADD_SECTION"};console.log("type",t),y({type:t,payload:d({},n,{setSurveyFormValue:c})})})()}},"Add Section"),(console.log("render",h),h.sections.length?h.sections.map((e,t)=>(console.log("section",e),console.log("index",t),l.createElement(ar,{key:t,section:e}))):null))))))},SurveyFormDetails:e=>{let{config:t,onGoNext:n,onBackClick:a,t:o}=e;const i=u.useDispatch(),r=u.useSelector(e=>e.engagement.surveyForm.surveyDetails),s=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[t.key]?e.engagement.surveyForm.formData[t.key]:{}});return l.createElement(l.Fragment,null,l.createElement(Eu,{defaultValues:s,box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},config:t.currStepConfig,onSubmit:function(e){console.log("Data in step "+t.currStepNumber+" is: \n",e);let l=0,a="";r.map(e=>{""===e.name&&(l=1,a+="Please enter Survey Name\n"),e.name.length>500&&(l=1,a+="Please enter a Survey Name that is 500 characters or fewer\n"),e.description.length>500&&(l=1,a+="Please enter a Survey Description that is 500 characters or fewer\n"),""===e.fromDate&&(l=1,a+="Please enter Survey Start Date\n"),""===e.fromTime&&(l=1,a+="Please enter Survey Start Time\n"),""===e.toDate&&(l=1,a+="Please enter Survey End Date\n"),""===e.toTime&&(l=1,a+="Please enter Survey End Time\n"),e.description.length>140&&(l=1,a+="Please enter description less than 140 characters\n"),new Date(e.fromDate+"T"+e.fromTime)>new Date(e.toDate+"T"+e.toTime)&&(l=1,a+="Start date and time must be before end date and time.\n")}),1!==l?n():alert(a)},onFormValueChange:function(e,n){console.log("d",n),console.log("onFormValueChange data in SurveyFormDetails: ",n,"\n Bool: ",!_.isEqual(n,s)),_.isEqual(n,s)||i(gi(t.key,n))},label:o(""+t.texts.submitBarLabel),currentStep:t.currStepNumber,onBackClick:function(e){a(t.key,e)}}))},SurveyFormCategoryDetails:e=>{let{config:n,onGoNext:a,onBackClick:o,t:i}=e;const r=u.useDispatch(),s=u.useSelector(e=>e.engagement.surveyForm.categories),c=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[n.key]?e.engagement.surveyForm.formData[n.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},defaultValues:c,config:n.currStepConfig,onSubmit:function(e){console.log("data in go next",s);let t=0,l="";s.map((e,n)=>{e.title.length>500&&(l+="-> Please enter a Section Title that is 500 characters or fewer for section "+(n+1)+" card\n",t=1),0===e.selectedQuestions.length&&(l+="-> Please select at least one question for section "+(n+1)+" card\n",t=1)});const o=s.reduce((e,t)=>e+parseFloat(t.weightage),0);console.log("tot weight",Math.round(o)),Math.round(o)>100&&(l+="The total weightage of sections should not exceed 100.\n",t=1),Math.round(o)<100&&(l+="The total weightage of sections should not be less than 100.\n",t=1),s.map((e,n)=>{const a=e.selectedQuestions.reduce((e,t)=>e+parseFloat(t.weightage),0);Math.round(a)>100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1),Math.round(a)<100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1)}),1!==t?(console.log("Data in step "+n.currStepNumber+" is: \n",e),a()):alert(l)},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveyFormCategoryDetails: ",t,"\n Bool: ",!_.isEqual(t,c)),_.isEqual(t,c)||r(gi(n.key,t))},label:i(""+n.texts.submitBarLabel),currentStep:n.currStepNumber,onBackClick:function(e){o(n.key,e),r({type:"GO_PREV"})}}))},SurveryFormSummary:e=>{let{config:a,onGoNext:i,onBackClick:r,t:s}=e;const[c,d]=n.useState(null),m=o.useHistory(),v=u.useDispatch(),p=u.useSelector(e=>e.engagement.surveyForm.categories),E=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);Digit.ULBService.getCurrentTenantId();const g=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[a.key]?e.engagement.surveyForm.formData[a.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{defaultValues:g,config:a.currStepConfig,onSubmit:function(e){let t=[];p.map(e=>{let n=[];e.selectedQuestions.map(e=>{let t={questionUuid:e.uuid,weightage:parseFloat(e.weightage),required:e.mandatory};n.push(t)});let l={title:e.title,weightage:parseFloat(e.weightage),questions:n};t.push(l)}),console.log("survey det",E);let n={SurveyEntity:{startDate:new Date(E.fromDate+" "+E.fromTime).getTime(),endDate:new Date(E.toDate+" "+E.toTime).getTime(),tenantId:E.ulb.code,surveyTitle:E.name,surveyCategory:E.name,surveyDescription:E.description,sections:t}};try{Digit.Surveys.createSurvey(n).then(e=>{var t,n;v({type:"RESET_FORM"}),(null==e||null===(t=e.Surveys)||void 0===t?void 0:t.length)>0?m.push("/digit-ui/employee/engagement/surveys/create-response",{message:"SURVEY_FORM_CREATED",response:null==e?void 0:e.Surveys,isSuccess:!0}):d({key:!0,label:""+(null==e||null===(n=e.Errors)||void 0===n?void 0:n.message)})})}catch(e){console.log(e)}console.log("Data in step "+a.currStepNumber+" is: \n",e),i()},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveryFormSummary: ",t,"\n Bool: ",!_.isEqual(t,g)),_.isEqual(t,g)||v(gi(a.key,t))},label:s(""+a.texts.submitBarLabel),currentStep:a.currStepNumber,onBackClick:function(e){r(a.key,e),v({type:"GO_PREV"})}}),c&&l.createElement(Toast,{error:c.key,label:s(c.label),onClose:()=>{d(null)}}))},NewSurveys:tr,SurveyCreationPage:fu,SurveySummary:()=>l.createElement("div",{style:{backgroundColor:"white"}},l.createElement(tr,{readOnly:!0}),l.createElement(fu,{readOnly:!0,hideQuestionLabel:!0})),FillSurveyNew:()=>(console.log("fill survey form new"),l.createElement(hu,null)),FillSurveyEmp:Ai,FillQuestions:_o};exports.SurveyReducers=()=>c.combineReducers({surveyForm:cr}),exports.initEngagementComponents=()=>{Object.entries(_u).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};