@mseva/digit-ui-module-engagement 1.0.0
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.
- package/dist/index.js +1 -0
- package/package.json +32 -0
package/dist/index.js
ADDED
|
@@ -0,0 +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"),i=require("react-router-dom"),o=require("react-hook-form"),r=require("react-query");require("react-time-picker");var u=require("recharts");function s(){return(s=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 c(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function d(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function m(e){d(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 v(e){d(1,arguments);var t=m(e);return t.setHours(0,0,0,0),t}function E(e,t){d(2,arguments);var n=v(e),l=v(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 p=(e,t)=>e.name.toUpperCase()<t.name.toUpperCase()?-1:e.name.toUpperCase()>t.name.toUpperCase()?1:0,f=(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())},g=function(e){return Promise.resolve(c(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,i]=e;return n}return null===(a=e.data.fileStoreIds[0])||void 0===a?void 0:a.url}})},function(){}))},h=function(e,t){try{if(!e||!e.length)return alert("No Document exists!"),Promise.resolve();const n=window.open("","_blank");return Promise.resolve(g(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)}},S=(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!")},C=function(e,t){try{return e&&e.length?Promise.resolve(g(e)).then(function(e){e&&Digit.Utils.downloadPDFFromLink(e)}):(alert("No Document exists!"),Promise.resolve())}catch(e){return Promise.reject(e)}},y=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]},T=(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")},D=e=>{let t=new Date(e);if(function(e){return d(1,arguments),E(e,Date.now())}(t)){const e=new Date;t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59)}return t.getTime()},b=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59),A=[{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"}}]}],N=()=>{const{t:e}=a.useTranslation(),o=i.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),p(),m()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ES_TITLE_NEW_EVENTS")),l.createElement(t.FormComposer,{config:A,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:i,toTime:r,address:u,organizer:s,fees:c,geoLocation:d={}}=e,m={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:{fromDate:new Date(`${l} ${i}`).getTime(),toDate:new Date(`${a} ${r}`).getTime(),fromTime:i,toTime:r,address:u,organizer:s,fees:c,...d}}]};o.push("/digit-ui/employee/engagement/event/response",m)},label:e("EVENTS_CREATE_EVENT")}))};function L(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 O(e,t){d(2,arguments);var n=m(e).getTime(),l=L(t);return new Date(n+l)}function I(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 w(e,t){d(2,arguments);var n=m(e),l=m(t),a=n.getTime()-l.getTime();return a<0?-1:a>0?1:a}function R(e){return d(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function x(e){if(d(1,arguments),!R(e)&&"number"!=typeof e)return!1;var t=m(e);return!isNaN(Number(t))}function M(e,t){d(2,arguments);var n=m(e),l=m(t),a=n.getFullYear()-l.getFullYear(),i=n.getMonth()-l.getMonth();return 12*a+i}function P(e,t){return d(2,arguments),m(e).getTime()-m(t).getTime()}var F={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function B(e){return e?F[e]:F.trunc}function U(e){d(1,arguments);var t=m(e);return t.setHours(23,59,59,999),t}function k(e){d(1,arguments);var t=m(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function V(e){d(1,arguments);var t=m(e);return U(t).getTime()===k(t).getTime()}function H(e,t){d(2,arguments);var n,l=m(e),a=m(t),i=w(l,a),o=Math.abs(M(l,a));if(o<1)n=0;else{1===l.getMonth()&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-i*o);var r=w(l,a)===-i;V(m(e))&&1===o&&1===w(e,a)&&(r=!1),n=i*(o-Number(r))}return 0===n?0:n}function W(e,t,n){d(2,arguments);var l=P(e,t)/1e3;return B(null==n?void 0:n.roundingMethod)(l)}var j={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 Y(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 G={date:Y({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Y({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:Y({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},z={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function q(e){return function(t,n){var l,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,o=a.width?String(a.width):i;l=e.formattingValues[o]||e.formattingValues[i]}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],i=t.match(a);if(!i)return null;var o,r=i[0],u=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(u)?X(u,function(e){return e.test(r)}):K(u,function(e){return e.test(r)});o=e.valueCallback?e.valueCallback(s):s,o=n.valueCallback?n.valueCallback(o):o;var c=t.slice(r.length);return{value:o,rest:c}}}function K(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function X(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var Z,Q={code:"en-US",formatDistance:function(e,t,n){var l,a=j[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:G,formatRelative:function(e,t,n,l){return z[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:q({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:q({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:q({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:q({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:q({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:(Z={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(Z.matchPattern);if(!n)return null;var l=n[0],a=e.match(Z.parsePattern);if(!a)return null;var i=Z.valueCallback?Z.valueCallback(a[0]):a[0];i=t.valueCallback?t.valueCallback(i):i;var o=e.slice(l.length);return{value:i,rest:o}}),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 J(e,t){d(2,arguments);var n=L(t);return O(e,-n)}function ee(e){d(1,arguments);var t=1,n=m(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 te(e){d(1,arguments);var t=m(e),n=t.getUTCFullYear(),l=new Date(0);l.setUTCFullYear(n+1,0,4),l.setUTCHours(0,0,0,0);var a=ee(l),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var o=ee(i);return t.getTime()>=a.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function ne(e){d(1,arguments);var t=te(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var l=ee(n);return l}function le(e,t){d(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.weekStartsOn,i=null==a?0:L(a),o=null==n.weekStartsOn?i:L(n.weekStartsOn);if(!(o>=0&&o<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var r=m(e),u=r.getUTCDay(),s=(u<o?7:0)+u-o;return r.setUTCDate(r.getUTCDate()-s),r.setUTCHours(0,0,0,0),r}function ae(e,t){d(1,arguments);var n=m(e),l=n.getUTCFullYear(),a=t||{},i=a.locale,o=i&&i.options&&i.options.firstWeekContainsDate,r=null==o?1:L(o),u=null==a.firstWeekContainsDate?r:L(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=le(s,t),v=new Date(0);v.setUTCFullYear(l,0,u),v.setUTCHours(0,0,0,0);var E=le(v,t);return n.getTime()>=c.getTime()?l+1:n.getTime()>=E.getTime()?l:l-1}function ie(e,t){d(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.firstWeekContainsDate,i=null==a?1:L(a),o=null==n.firstWeekContainsDate?i:L(n.firstWeekContainsDate),r=ae(e,t),u=new Date(0);u.setUTCFullYear(r,0,o),u.setUTCHours(0,0,0,0);var s=le(u,t);return s}function oe(e,t){for(var n=e<0?"-":"",l=Math.abs(e).toString();l.length<t;)l="0"+l;return n+l}var re={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 oe("yy"===t?l%100:l,t.length)}(e,t)},Y:function(e,t,n,l){var a=ae(e,l),i=a>0?a:1-a;return"YY"===t?oe(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):oe(i,t.length)},R:function(e,t){return oe(te(e),t.length)},u:function(e,t){return oe(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 oe(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 oe(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):oe(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 oe(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){d(1,arguments);var n=m(e),l=le(n,t).getTime()-ie(n,t).getTime();return Math.round(l/6048e5)+1}(e,l);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):oe(a,t.length)},I:function(e,t,n){var l=function(e){d(1,arguments);var t=m(e),n=ee(t).getTime()-ne(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(l,{unit:"week"}):oe(l,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return oe(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,n){var l=function(e){d(1,arguments);var t=m(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"}):oe(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(),i=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return oe(i,2);case"eo":return n.ordinalNumber(i,{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(),i=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return oe(i,t.length);case"co":return n.ordinalNumber(i,{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 oe(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 oe(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 oe(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,n){var l=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):oe(l,t.length)},k:function(e,t,n){var l=e.getUTCHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):oe(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return oe(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return oe(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var n=t.length,l=e.getUTCMilliseconds();return oe(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 se(a);case"XXXX":case"XX":return ce(a);case"XXXXX":case"XXX":default:return ce(a,":")}},x:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"x":return se(a);case"xxxx":case"xx":return ce(a);case"xxxxx":case"xxx":default:return ce(a,":")}},O:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ue(a,":");case"OOOO":default:return"GMT"+ce(a,":")}},z:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ue(a,":");case"zzzz":default:return"GMT"+ce(a,":")}},t:function(e,t,n,l){return oe(Math.floor((l._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,l){return oe((l._originalDate||e).getTime(),t.length)}};function ue(e,t){var n=e>0?"-":"+",l=Math.abs(e),a=Math.floor(l/60),i=l%60;if(0===i)return n+String(a);var o=t||"";return n+String(a)+o+oe(i,2)}function se(e,t){return e%60==0?(e>0?"-":"+")+oe(Math.abs(e)/60,2):ce(e,t)}function ce(e,t){var n=t||"",l=e>0?"-":"+",a=Math.abs(e);return l+oe(Math.floor(a/60),2)+n+oe(a%60,2)}function de(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 me(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 ve={p:me,P:function(e,t){var n,l=e.match(/(P+)(p+)?/)||[],a=l[1],i=l[2];if(!i)return de(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}}",de(a,t)).replace("{{time}}",me(i,t))}},Ee=["D","DD"],pe=["YY","YYYY"];function fe(e){return-1!==Ee.indexOf(e)}function ge(e){return-1!==pe.indexOf(e)}function _e(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 he=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Se=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ce=/^'([^]*?)'?$/,ye=/''/g,Te=/[a-zA-Z]/;function De(e,t,n){d(2,arguments);var l=String(t),a=n||{},i=a.locale||Q,o=i.options&&i.options.firstWeekContainsDate,r=null==o?1:L(o),u=null==a.firstWeekContainsDate?r:L(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=i.options&&i.options.weekStartsOn,c=null==s?0:L(s),v=null==a.weekStartsOn?c:L(a.weekStartsOn);if(!(v>=0&&v<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!i.localize)throw new RangeError("locale must contain localize property");if(!i.formatLong)throw new RangeError("locale must contain formatLong property");var E=m(e);if(!x(E))throw new RangeError("Invalid time value");var p=I(E),f=J(E,p),g={firstWeekContainsDate:u,weekStartsOn:v,locale:i,_originalDate:E},_=l.match(Se).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,ve[t])(e,i.formatLong,g):e}).join("").match(he).map(function(n){if("''"===n)return"'";var l=n[0];if("'"===l)return be(n);var o=re[l];if(o)return!a.useAdditionalWeekYearTokens&&ge(n)&&_e(n,t,e),!a.useAdditionalDayOfYearTokens&&fe(n)&&_e(n,t,e),o(f,n,i.localize,g);if(l.match(Te))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return n}).join("");return _}function be(e){return e.match(Ce)[1].replace(ye,"'")}function Ae(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 Ne(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};d(2,arguments);var l=n.locale||Q;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=w(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var i,o,r=Ae(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=a,a>0?(i=m(t),o=m(e)):(i=m(e),o=m(t));var u,s=W(o,i),c=(I(o)-I(i))/1e3,v=Math.round((s-c)/60);if(v<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===v?l.formatDistance("lessThanXMinutes",1,r):l.formatDistance("xMinutes",v,r);if(v<45)return l.formatDistance("xMinutes",v,r);if(v<90)return l.formatDistance("aboutXHours",1,r);if(v<1440){var E=Math.round(v/60);return l.formatDistance("aboutXHours",E,r)}if(v<2520)return l.formatDistance("xDays",1,r);if(v<43200){var p=Math.round(v/1440);return l.formatDistance("xDays",p,r)}if(v<86400)return u=Math.round(v/43200),l.formatDistance("aboutXMonths",u,r);if((u=H(o,i))<12){var f=Math.round(v/43200);return l.formatDistance("xMonths",f,r)}var g=u%12,_=Math.floor(u/12);return g<3?l.formatDistance("aboutXYears",_,r):g<9?l.formatDistance("overXYears",_,r):l.formatDistance("almostXYears",_+1,r)}const Le=()=>{var e,o,r,u,s,c,d,m,v;const{t:E}=a.useTranslation(),p=i.useHistory(),{id:f}=i.useParams(),g=Digit.ULBService.getCurrentTenantId(),{isLoading:_,data:h}=Digit.Hooks.events.useInbox(g,{},{eventTypes:"EVENTSONGROUND",ids:f},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[S,C,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[T,D,b]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[N,L,O]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);if(n.useEffect(()=>{C(!1),O(),b()},[]),_)return l.createElement(t.Loader,null);const I={defaultTenantId:null==h?void 0:h.tenantId,name:null==h?void 0:h.name,fromDate:De(new Date(null==h||null===(e=h.eventDetails)||void 0===e?void 0:e.fromDate),"yyyy-MM-dd"),toDate:De(new Date(null==h||null===(o=h.eventDetails)||void 0===o?void 0:o.toDate),"yyyy-MM-dd"),organizer:null==h||null===(r=h.eventDetails)||void 0===r?void 0:r.organizer,fees:null==h||null===(u=h.eventDetails)||void 0===u?void 0:u.fees,description:null==h?void 0:h.description,address:null==h||null===(s=h.eventDetails)||void 0===s?void 0:s.address,category:null==h?void 0:h.eventCategory,fromTime:De(new Date(null==h||null===(c=h.eventDetails)||void 0===c?void 0:c.fromDate),"HH:mm"),toTime:De(new Date(null==h||null===(d=h.eventDetails)||void 0===d?void 0:d.toDate),"HH:mm"),geoLocation:{latitude:null==h||null===(m=h.eventDetails)||void 0===m?void 0:m.latitude,longitude:null==h||null===(v=h.eventDetails)||void 0===v?void 0:v.longitude}};return l.createElement(n.Fragment,null,l.createElement(t.Header,null,E("ES_TITLE_EDIT_EVENTS")),l.createElement(t.FormComposer,{defaultValues:I,config:A,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:i,toTime:o,address:r,organizer:u,fees:s,geoLocation:c}=e,d={events:[{...h,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:{...null==h?void 0:h.eventDetails,fromDate:new Date(`${l} ${i}`).getTime(),toDate:new Date(`${a} ${o}`).getTime(),fromTime:i,toTime:o,address:r,organizer:u,fees:s,latitude:null==c?void 0:c.latitude,longitude:null==c?void 0:c.longitude}}]};p.push("/digit-ui/employee/engagement/event/response?update=true",d)},label:E("EVENTS_SAVE_CHANGES")}))},Oe=e=>{var n,i,o;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===(i=n.events)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.name,info:r("ENGAGEMENT_EVENT_NAME"),successful:e.isSuccess})},Ie=e=>{var o,u,s,c,d,m,v;const E=r.useQueryClient(),{t:p}=a.useTranslation(),f=Digit.Hooks.useQueryParams(),g=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),_=Digit.Hooks.events.useUpdateEvent(),[h,S]=n.useState(!1),{state:C}=e.location,[y,T,D]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[b,A,N]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1),[L,O,I]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),w=(e,t)=>{var n,l,a;O((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"),T(!0)};if(n.useEffect(()=>{g.data&&A(g.data)},[g.data]),n.useEffect(()=>{_.data&&A(_.data)},[_.data]),n.useEffect(()=>{const e=()=>{T(!0),E.clear()};return y?()=>{E.clear()}:Boolean(null==f?void 0:f.delete)||Boolean(null==f?void 0:f.update)?void _.mutate(C,{onError:w,onSuccess:e}):void g.mutate(C,{onError:w,onSuccess:e})},[]),null!=f&&f.delete||null!=f&&f.update)return _.isLoading||_.isIdle&&!y?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Oe,{t:p,message:null!=f&&f.update?_.isSuccess||b?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":_.isSuccess||b?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED",data:_.data||b,isSuccess:(null==_?void 0:_.isSuccess)||b,isLoading:_.isIdle&&!y||_.isLoading}),l.createElement(t.CardText,null,p(null!=f&&f.update?_.isSuccess||b?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":_.isSuccess||b?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED")),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:p("CORE_COMMON_GO_TO_HOME")}))));if(g.isLoading||g.isIdle&&!y)return l.createElement(t.Loader,null);const R=(null==g||null===(o=g.data)||void 0===o||null===(u=o.events)||void 0===u?void 0:u[0])||(null==b||null===(s=b.events)||void 0===s?void 0:s[0])||{};return l.createElement(t.Card,null,l.createElement(Oe,{t:p,message:g.isSuccess||b?"ENGAGEMENT_EVENT_CREATED_MESSAGE":"ENGAGEMENT_EVENT_FAILED_MESSAGES",data:g.data||b,isSuccess:g.isSuccess||b,isLoading:g.isIdle&&!y||g.isLoading}),l.createElement(t.CardText,null,g.isSuccess||b?p("ENGAGEMENT_EVENT_CREATED_MESSAGES",{eventName:null==R?void 0:R.name,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==R||null===(c=R.eventDetails)||void 0===c?void 0:c.fromDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==R||null===(d=R.eventDetails)||void 0===d?void 0:d.toDate),fromTime:g.isSuccess?De(new Date(null==R||null===(m=R.eventDetails)||void 0===m?void 0:m.fromDate),"HH:mm"):null,toTime:g.isSuccess?De(new Date(null==R||null===(v=R.eventDetails)||void 0===v?void 0:v.toDate),"HH:mm"):null}):null),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:p("CORE_COMMON_GO_TO_HOME")}))))},we=e=>{let{t:n,data:a,columns:i,globalSearch:o,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E}=e;return l.createElement(t.Table,{t:n,data:a,columns:i,onSearch:r,globalSearch:o,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E})},Re=e=>{let{ulb:n,onAssignmentChange:a,value:i,t:o}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:i,select:a,t:o})},xe=e=>{let{onSearch:n,searchParams:a,searchFields:i,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:d,formState:m,reset:v,control:E}=o.useForm({defaultValues:a}),f=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),_=(Digit.ULBService.getCurrentTenantId(),Digit.UserService.getUser().info),h=g.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(p),S=()=>{v({ulb:null,eventName:""}),n({ulb:null,eventName:""})},C=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:S},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:d(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||f)&&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==i?void 0:i.map((e,n)=>{var a,i,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(o.Controller,{rules:{required:!0},render:e=>l.createElement(Re,{onAssignmentChange:e.onChange,value:e.value,ulb:h,t:c}),name:e.name,control:E,defaultValue:null});default:return l.createElement(o.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=m&&null!==(a=m.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==m||null===(i=m.errors)||void 0===i||null===(r=i[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!f&&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||f)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},C(f)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(m.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Me=e=>{let{title:n="EVENTS_EVENTS_HEADER",links:o,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"},o.map((e,t)=>{let{link:n,text:a,hyperlink:o=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},o?l.createElement("a",{href:n},a):l.createElement(i.Link,{to:n},a))}))))},Pe=e=>{var n,i;let{status:o,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,o),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(i=n.filter(e=>e===o))||void 0===i?void 0:i.length)>0,label:s(o),pageType:"employee"})},Fe=["ACTIVE","INACTIVE"],Be=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:i}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},i("ES_INBOX_STATUS")),null==Fe?void 0:Fe.map((e,a)=>l.createElement(Pe,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},Ue=e=>{var i;let{type:o="desktop",onClose:r,onFilterChange:u,searchParams:s}=e;const{t:c}=a.useTranslation(),[d,m]=n.useState(()=>({...s})),v=Digit.ULBService.getCurrentTenantId(),E=null==v?void 0:v.split(".")[0],{isLoading:p,data:f}=Digit.Hooks.useCommonMDMS(E,"mseva",["EventCategories"]),g=()=>{m({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),u({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==r||r()},_=e=>{m({...d,...e})};return p?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:g},c("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:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+c("EVENTS_CATEGORY_LABEL")),l.createElement(t.Dropdown,{option:null==f||null===(i=f.mseva)||void 0===i?void 0:i.EventCategories,optionKey:"code",t:c,selected:null==d?void 0:d.eventCategory,select:e=>_({eventCategory:e})}),l.createElement(t.DateRange,{t:c,values:null==d?void 0:d.range,onFilterChange:_,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(Be,{onAssignmentChange:(e,t)=>{var n;_(e.target.checked?{eventStatus:[...(null==d?void 0:d.eventStatus)||[],t]}:{eventStatus:null==d||null===(n=d.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:d})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(u(d),void(null==r||r())),label:c("ES_COMMON_APPLY")}))))},ke=e=>l.createElement("span",{className:""},e),Ve=e=>{let{isLoading:n,data:a,t:o,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:E,onFilterChange:p,pageSizeLimit:f,totalRecords:g,currentPage:_,onNextPage:h,onPrevPage:S,onPageSizeChange:C}=e;const y=l.useMemo(()=>[{Header:o("EVENTS_EVENT_NAME_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:`${u}/event/inbox/event-details/${t.original.id}`},t.original.name)))}},{Header:o("EVENTS_EVENT_CATEGORY_LABEL"),accessor:e=>ke(null!=e&&e.eventCategory?o("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)):"")},{Header:o("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?ke(De(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?ke(De(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return ke((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:o("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(o(null==e?void 0:e.status))}]);let T;return n?T=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(T=l.createElement(we,{t:o,data:a,columns:y,globalSearch:m,onSearch:E,pageSizeLimit:f,totalRecords:g,currentPage:_,onNextPage:h,onPrevPage:S,onPageSizeChange:C,getCellProps:e=>({style:{minWidth:e.column.Header===o("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Me,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(Ue,{onFilterChange:p,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(xe,{t:o,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},T)))},He=e=>{let{searchFields:a,searchParams:o,onFilterChange:r,onSearch:u,t:s,data:c,serviceRequestIdKey:d}=e;const[m,v]=n.useState(""),[E,p]=n.useState(!1),[f,g]=n.useState(o);Digit.ULBService.getCurrentTenantId(),i.useHistory(),n.useEffect(()=>{m&&p(!0)},[m]);const _=()=>{p(!1),g(o)};let h;return 0===(null==c?void 0:c.length)?h=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&&(h=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"),p(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),h,E&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Ue,{onFilterChange:r,onClose:_,onSearch:u,type:"mobile",searchParams:f})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(xe,{t:s,type:"mobile",onClose:_,onSearch:u,searchParams:o,searchFields:a}))))},We=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),je=e=>{let{data:t,t:n,title:a,iconName:i,links:o,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(Me,{title:a,icon:i,links:o}),l.createElement(He,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,i,o,r,s,c,d,m,v,E;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===(i=u.ulb)||void 0===i||!i.code||e.tenantId===(null==u||null===(o=u.ulb)||void 0===o?void 0:o.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!x(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())&&(!x(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===(E=u.range)||void 0===E?void 0:E.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")]:De(new Date(null==e||null===(t=e.eventDetails)||void 0===t?void 0:t.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:De(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")]:We(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,serviceRequestIdKey:"applicationNo"}))))},Ye=e=>{var i;let{tenants:o,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o);const s=Digit.ULBService.getCurrentTenantId(),[c,d]=n.useState(10),[m,v]=n.useState(0),[E,p]=n.useState({eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""},ulb:null==o?void 0:o.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const g=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_NAME_LABEL"),name:"eventName"}],_=[{text:u("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox/new-event"}],{data:h,isLoading:S}=Digit.Hooks.events.useInbox(null==E||null===(i=E.ulb)||void 0===i?void 0:i.code,{},{eventTypes:"EVENTSONGROUND",limit:c,offset:m},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),C=e=>{let t={...e};null!=e&&e.ulb||(t={...e,ulb:{code:s}}),p({...E,...t})},y=e=>{p({...E,...e})},T=n.useCallback(()=>{v(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{v(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(je,{data:null==h?void 0:h.events,searchParams:E,searchFields:g(),t:u,onFilterChange:y,onSearch:C,isLoading:S,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:_}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_EVENTS_HEADER"),Number(null==h?void 0:h.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==h?void 0:h.totalCount)):null),l.createElement(Ve,{t:u,data:null==h?void 0:h.events,links:_,parentRoute:r,searchParams:E,onSearch:C,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,i,o,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===(i=a.name)||void 0===i?void 0:i.toUpperCase().startsWith(null==E?void 0:E.eventName.toUpperCase())))&&(null==E||null===(o=E.ulb)||void 0===o||!o.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))&&(!x(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())&&(!x(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:g(),onFilterChange:y,pageSizeLimit:c,totalRecords:null==h?void 0:h.totalCount,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:_,currentPage:parseInt(m/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{d(t=>e.target.value)}}))},Ge=e=>{let{t:n,data:a,columns:i,globalSearch:o,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E}=e;return l.createElement(t.Table,{t:n,data:a,columns:i,onSearch:r,globalSearch:o,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E})},ze=e=>{let{ulb:n,onAssignmentChange:a,value:i,t:o}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:i,select:a,t:o})},qe=e=>{let{onSearch:n,searchParams:a,searchFields:i,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:d,formState:m,reset:v,control:E}=o.useForm({defaultValues:a}),f=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),_=Digit.UserService.getUser().info,h=g.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(p),S=()=>{v({ulb:null,name:""}),n({ulb:null,name:""})},C=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:S},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:d(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||f)&&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==i?void 0:i.map((e,n)=>{var a,i,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(o.Controller,{rules:{required:!0},render:e=>l.createElement(ze,{onAssignmentChange:e.onChange,value:e.value,ulb:h,t:c}),name:e.name,control:E,defaultValue:null});case"range":return l.createElement(o.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(o.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=m&&null!==(a=m.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==m||null===(i=m.errors)||void 0===i||null===(r=i[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!f&&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||f)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},C(f)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(m.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},$e=e=>{let{title:n="CS_HEADER_PUBLIC_BRDCST",links:o,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"},o.map((e,t)=>{let{link:n,text:a,hyperlink:o=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},o?l.createElement("a",{href:n},a):l.createElement(i.Link,{to:n},a))}))))},Ke=e=>{var n,i;let{status:o,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,o),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(i=n.filter(e=>e===o))||void 0===i?void 0:i.length)>0,label:s(o),pageType:"employee"})},Xe=["ACTIVE","INACTIVE"],Ze=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:i}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},i("ES_INBOX_STATUS")),null==Xe?void 0:Xe.map((e,a)=>l.createElement(Ke,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},Qe=e=>{let{type:i="desktop",onClose:o,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,d]=n.useState(()=>({...u})),m=Digit.ULBService.getCurrentTenantId(),v=null==m?void 0:m.split(".")[0],{isLoading:E}=Digit.Hooks.useCommonMDMS(v,"mseva",["EventCategories"]),p=()=>{d({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),r({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==o||o()},f=n.useCallback(e=>{d(t=>({...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:p},s("ES_COMMON_CLEAR_ALL")),"desktop"===i&&l.createElement("span",{className:"clear-search",onClick:p},l.createElement(t.RefreshIcon,null)),"mobile"===i&&l.createElement("span",{onClick:o},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(Ze,{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==o||o())),label:s("ES_COMMON_APPLY")}))))},Je=e=>l.createElement("span",{className:""},e),et=e=>{let{isLoading:n,data:a,t:o,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:E,onFilterChange:p,pageSizeLimit:f,totalRecords:g,currentPage:_,onNextPage:h,onPrevPage:S,onPageSizeChange:C}=e;const y=l.useMemo(()=>[{Header:o("EVENTS_MESSAGE_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:`${u}/messages/inbox/details/${t.original.id}`},t.original.name)))}},{Header:o("EVENTS_POSTING_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Je(De(new Date(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime),"dd/MM/yyyy")):""}},{Header:o("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?Je(De(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?Je(De(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:o("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return Je((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:o("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(o(null==e?void 0:e.status))}]);let T;return n?T=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(T=l.createElement(Ge,{t:o,data:a,columns:y,globalSearch:m,onSearch:E,pageSizeLimit:f,totalRecords:g,currentPage:_,onNextPage:h,onPrevPage:S,onPageSizeChange:C,getCellProps:e=>({style:{minWidth:e.column.Header===o("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(Qe,{onFilterChange:p,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(qe,{t:o,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},T)))},tt=e=>{let{searchFields:a,searchParams:o,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[E,p]=n.useState(!1),[g,_]=n.useState(o),h=(Digit.ULBService.getCurrentTenantId(),i.useHistory());n.useEffect(()=>{m&&p(!0)},[m]);const S=()=>{p(!1),_(o)};let C;return 0===(null==c?void 0:c.length)?C=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&&(C=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>{var n;return f(null==t||null===(n=t.user)||void 0===n?void 0:n.name,e["Posted By"])&&f(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"),p(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),C,E&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Qe,{onFilterChange:r,onClose:S,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(qe,{t:s,type:"mobile",onClose:S,onSearch:u,searchParams:o,searchFields:a}))))},nt=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),lt=e=>{let{data:t,t:n,title:a,iconName:i,links:o,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:i,links:o}),l.createElement(tt,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,i,o,r,s,c,d,m,v,E;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===(i=u.ulb)||void 0===i||!i.code||e.tenantId===(null==u||null===(o=u.ulb)||void 0===o?void 0:o.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!x(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())&&(!x(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===(E=u.range)||void 0===E?void 0:E.endDate).getTime())}).map(e=>{var t,l,a,i;return{[n("PUBLIC_BRDCST_TITLE_LABEL")]:null==e?void 0:e.name,[n("EVENTS_POSTING_DATE_LABEL")]:De(new Date(null==e||null===(t=e.auditDetails)||void 0===t?void 0:t.createdTime),"dd/MM/yyyy"),[n("EVENTS_START_DATE_LABEL")]:De(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:De(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===(i=e.user)||void 0===i?void 0:i.name,[n("EVENTS_STATUS_LABEL")]:nt(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,responseData:t}))))},at=e=>{var i;let{tenants:o,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o);const s=Digit.ULBService.getCurrentTenantId(),[c,d]=n.useState(10),[m,v]=n.useState(0),[E,p]=n.useState({eventStatus:[],name:"",range:{startDate:null,endDate:new Date(""),title:""},ulb:null==o?void 0:o.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const{data:g,isLoading:_}=Digit.Hooks.events.useInbox(null==E||null===(i=E.ulb)||void 0===i?void 0:i.code,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST",limit:c,offset:m},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),h=e=>{let t={...e};null!=e&&e.ulb||(t={...e,ulb:{code:s}}),p(e=>({...e,...t}))},S=e=>{p(t=>({...t,...e}))},C=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_MESSAGE_LABEL"),name:"name"}],y=[{text:u("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/inbox/create"}],T=n.useCallback(()=>{v(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{v(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(lt,{data:null==g?void 0:g.events,searchParams:E,searchFields:C(),t:u,onFilterChange:S,onSearch:h,isLoading:_,title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",iconName:"calender",links:y}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER"),Number(null==g?void 0:g.length)?l.createElement("p",{className:"inbox-count"},Number(null==g?void 0:g.length)):null),l.createElement(et,{t:u,data:null==g?void 0:g.events,links:y,parentRoute:r,searchParams:E,onSearch:h,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,i,o,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===(i=a.name)||void 0===i?void 0:i.toUpperCase().startsWith(null==E?void 0:E.name.toUpperCase())))&&(null==E||null===(o=E.ulb)||void 0===o||!o.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))&&(!x(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())&&(!x(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:S,pageSizeLimit:c,totalRecords:null==g?void 0:g.totalCount,currentPage:parseInt(m/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{d(t=>e.target.value)},title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",links:y,isLoading:_}))},it=[{head:"",body:[{type:"form",withoutLabel:!0,component:"MessageForm",nextStep:"",route:"",key:"messageData"}]}],ot=()=>{const{t:e}=a.useTranslation(),o=i.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[v,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),p(),m()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ADD_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{config:it,onSubmit:e=>{var t,n,l;const{fromDate:a,toDate:i,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=b(new Date(""+a)))||void 0===n?void 0:n.getTime(),toDate:null===(l=b(new Date(""+i)))||void 0===l?void 0:l.getTime()}}]};o.push("/digit-ui/employee/engagement/messages/response",c)},label:e("ACTION_ADD_NEW_MESSAGE")}))},rt=e=>{var n,i,o;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===(i=n.events)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.name,successful:e.isSuccess})},ut=e=>{const o=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,E,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[f,g,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1),[h,S,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1);n.useEffect(()=>{d.data&&g(d.data)},[d.data]),n.useEffect(()=>{c.data&&g(c.data)},[c.data]);const y=(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"),E(!0)};return n.useEffect(()=>{const e=()=>{E(!0),o.clear()};if(!v){if(Boolean(null==s?void 0:s.delete)||Boolean(null==s?void 0:s.update))return void d.mutate(m,{onError:y,onSuccess:e});c.mutate(m,{onError:y,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(rt,{t:u,message:null!=s&&s.update?d.isSuccess||f?"ENGAGEMENT_PUBLIC_BRDCST_UPDATED":"ENG_PUBLIC_BRDCST_UPDATION_FAILED":d.isSuccess||f?"ENGAGEMENT_PUBLIC_BRDCST_DELETED":"ENGAGEMENT_PUBLIC_BRDCST_DELETION_FAILED",data:d.data||f,isSuccess:(null==d?void 0:d.isSuccess)||f,isLoading:d.isIdle&&!v||d.isLoading}),l.createElement(t.CardText,null,u("ENGAGEMENT_PUBLIC_BRDCST_MESSAGES")),l.createElement(t.ActionBar,null,l.createElement(i.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(rt,{t:u,message:c.isSuccess||f?"ENGAGEMENT_BROADCAST_MESSAGE_CREATED":"ENGAGEMENT_BROADCAST_MESSAGE_FAILED",data:c.data||f,isSuccess:c.isSuccess||f,isLoading:c.isIdle&&!v||c.isLoading}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},st=()=>{const{t:e}=a.useTranslation(),o=i.useHistory(),{id:r}=i.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]}}),[d,m,v]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[E,p,f]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[g,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{m(!1),h(),f()},[]);const S=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?De(new Date(null==c||null===(t=c.eventDetails)||void 0===t?void 0:t.fromDate),"yyyy-MM-dd"):null,toDate:c?De(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:S,config:it,onSubmit:e=>{var t;const{fromDate:n,toDate:l,description:a,name:i,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:i}]=t;return n.fileName=null==a?void 0:a.name,n.documentType=null==a?void 0:a.type,n.fileStoreId=null==i?void 0:i.fileStoreId,e.push(n),e},[]):[]:r;var s;const d={events:[{...c,source:"WEBAPP",status:"ACTIVE",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:a,name:i,eventDetails:{documents:u,fromDate:D(""+n),toDate:D(""+l)}}]};o.push("/digit-ui/employee/engagement/messages/response?update=true",d)},label:e("ACTION_EDIT_MESSAGE")}))};function ct(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const dt=e=>l.createElement("h1",{className:"heading-m"},e.label),mt=()=>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"})),vt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(mt,null)),Et=e=>{var a,i;let{t:o,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m,moduleCode:v}=e;const{data:E,isLoading:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:f,data:g}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,h]=n.useState({}),[S,C]=n.useState({}),[y,T]=n.useState([]),[D,b]=n.useState(null),[A,N]=n.useState(null),[L,O]=n.useState(null),[I,w]=n.useState(null),[R,x]=n.useState([]),[M,P]=n.useState(null),[F,B]=n.useState(!1);function U(e){N(e.target.files[0])}return n.useEffect(()=>{var e;g&&g["egf-master"]&&x(null===(e=g["egf-master"])||void 0===e?void 0:e.FinancialYear)},[g]),n.useEffect(()=>{var e;T(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{w(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)w(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=ct(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",A,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?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):w(o("CS_FILE_UPLOAD_ERROR"))})},function(){w(o("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)}}()},[A]),n.useEffect(()=>{r&&h(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:i,selectedFinancialYear:o,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:i,optionsKey:"name",onSelect:r,selectedOption:o})}]}]}})({t:o,action:r,financialYears:R,selectedFinancialYear:M,setSelectedFinancialYear:P}):(e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v}=e;return{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${v}_${null==i?void 0:i.action}`,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:l.createElement(t.Dropdown,{option:o,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")}${i.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:o,action:r,approvers:y,selectedApprover:D,setSelectedApprover:b,selectFile:U,uploadedFile:L,setUploadedFile:O,businessService:m}))},[r,y,R,M,L]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(dt,{label:o(_.label.heading)}),headerBarEnd:l.createElement(vt,{onClick:s}),actionCancelLabel:o(_.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:o(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!M:p||(null==r?void 0:r.docUploadRequired)&&!L,formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.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"};d.creationReason="STATUS",c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:{...d,workflow:t}})}else if(null!=r&&r.showFinancialYearsModal)c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.name,propertyId:null==d?void 0:d.propertyId,tenantId:u,source:null==d?void 0:d.source,channel:null==d?void 0:d.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:m,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!D?[]:[D],L&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:L}]),c({Property:{...d,workflow:t}})}},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},pt=e=>l.createElement("h1",{className:"heading-m"},e.label),ft=()=>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(ft,null)),_t=e=>{var a,i;let{t:o,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m}=e;const{data:v}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:E,data:p}=Digit.Hooks.pt.useMDMS(u,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[f,g]=n.useState({}),[_,h]=n.useState({}),[S,C]=n.useState([]),[y,T]=n.useState({}),[D,b]=n.useState(null),[A,N]=n.useState(null),[L,O]=n.useState(null),[I,w]=n.useState([]),[R,x]=n.useState(null);function M(e){b(e.target.files[0])}return n.useEffect(()=>{var e;p&&p["egf-master"]&&w(null===(e=p["egf-master"])||void 0===e?void 0:e.FinancialYear)},[p]),n.useEffect(()=>{var e;C(null==v||null===(e=v.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}}))},[v]),n.useEffect(()=>{!function(){try{O(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=ct(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",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?N(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(o("CS_FILE_UPLOAD_ERROR"))})},function(){O(o("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&&g((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,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:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):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:o,action:r,approvers:S,selectedApprover:y,setSelectedApprover:T,selectFile:M,uploadedFile:A,setUploadedFile:N,businessService:m}))},[r,S,I,R,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(pt,{label:o(f.label.heading)}),headerBarEnd:l.createElement(gt,{onClick:s}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d={...d,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null},c({Licenses:[d]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},ht=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),St=()=>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"})),Ct=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(St,null)),yt=e=>{var a,i;let{t:o,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m}=e;const{data:v,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[p,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[C,y]=n.useState({}),[T,D]=n.useState(null),[b,A]=n.useState(null),[N,L]=n.useState(null),O=!!Digit.Utils.browser.isMobile();function I(e){D(e.target.files[0])}return n.useEffect(()=>{var e;S(null==v||null===(e=v.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}}))},[v]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)L(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))L(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=ct(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",T,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?A(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(o("CS_FILE_UPLOAD_ERROR"))})},function(){L(o("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)}}()},[T]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,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:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):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:o,action:r,approvers:h,selectedApprover:C,setSelectedApprover:y,selectFile:I,uploadedFile:b,setUploadedFile:A,businessService:m,error:N}))},[r,h,b,N]),r&&p.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ht,{label:o(p.label.heading)}),headerBarEnd:l.createElement(Ct,{onClick:s}),actionCancelLabel:o(p.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:o(p.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:O?{width:"720px"}:{},style:O?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:O?{paddingLeft:"5px"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:p.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d={...d,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:b?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:b}]:null},c({Licenses:[d]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Tt=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Dt=()=>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"})),bt=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dt,null)),At=e=>{var a,i,o,u,s,c,d,m,v,E,p,f;let{t:g,action:_,tenantId:h,closeModal:S,submitAction:C,applicationDetails:y,applicationData:T,businessService:D,workflowDetails:b,blockReason:A}=e;console.log("applicationData",T),console.log("workflowDetails",b),Digit.Hooks.obps.useObpsAPI(null!==(a=T)&&void 0!==a&&null!==(i=a.landInfo)&&void 0!==i&&null!==(o=i.address)&&void 0!==o&&o.city?null===(u=T)||void 0===u||null===(s=u.landInfo)||void 0===s||null===(c=s.address)||void 0===c?void 0:c.city:h,!1);const{data:N,isLoading:L}=Digit.Hooks.useEmployeeSearch(h,{roles:null==b||null===(d=b.data)||void 0===d||null===(m=d.initialActionState)||void 0===m||null===(v=m.nextActions)||void 0===v||null===(E=v.filter(e=>(null==e?void 0:e.action)==(null==_?void 0:_.action)))||void 0===E||null===(p=E[0])||void 0===p||null===(f=p.assigneeRoles)||void 0===f?void 0:f.map(e=>({code:e})),isActive:!0},{enabled:!(null!=_&&_.isTerminateState)}),[O,I]=(r.useQueryClient(),n.useState({})),[w,R]=n.useState({}),[x,M]=n.useState([]),[P,F]=n.useState([]),[B,U]=n.useState({}),[k,V]=n.useState({}),[H,W]=n.useState(null),[j,Y]=n.useState(null),[G,z]=n.useState(null),[q,$]=n.useState(null),K=!!Digit.Utils.browser.isMobile();function X(e){W(e.target.files[0])}n.useEffect(()=>{var e;M(null==N||null===(e=N.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}}))},[N]),n.useEffect(()=>{!function(){try{z(null);const e=function(){if(H){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(H.size>=5242880)z(g("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=H&&H.type&&!e.test(null==H?void 0:H.type))z(g("NOT_SUPPORTED_FILE_TYPE"));else{const e=ct(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",H,Digit.ULBService.getStateId()||(null==h?void 0:h.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):z(g("CS_FILE_UPLOAD_ERROR"))})},function(){z(g("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)}}()},[H]);const Z=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},Q=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},J=e=>{var t,n;let l=[],a=[];var i,o;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===(i=e.additionalDetails)||void 0===i?void 0:i.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===(o=l)||void 0===o?void 0:o.length)>0&&l.map((e,t)=>{a.push({docs:Z(e.Documents),date:e.InspectionDate,questions:Q(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]},ee=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,i,o,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===(i=e.uploadedDocuments)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},te=()=>{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(()=>{F(null==A?void 0:A.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),_&&I((e=>{var n,a,i,o,r,u,s;let{t:c,action:d,approvers:m,selectedApprover:v,setSelectedApprover:E,selectedBlockReason:p,setBlockReason:f,selectFile:g,uploadedFile:_,setUploadedFile:h,assigneeLabel:S,businessService:C,error:y,blockReasonFiltered:T}=e,D=!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)||(D=!0),{label:{heading:`WF_${null==d?void 0:d.action}_APPLICATION`,submit:`WF_${C}_${null==d?void 0:d.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:d.isTerminateState||D||"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===(i=d.assigneeRoles)||void 0===i?void 0:i[0])),type:"dropdown",populators:d.isTerminateState||D||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(o=d.state)||void 0===o?void 0:o.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:E,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:T,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:f,selected:p,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:g,onDelete:()=>{h(null)},message:_?"1 "+c("ES_PT_ACTION_FILEUPLOADED"):c("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:y})}]}]}})({t:g,action:_,approvers:x,selectedApprover:B,setSelectedApprover:U,selectedBlockReason:k,setBlockReason:V,selectFile:X,uploadedFile:j,setUploadedFile:Y,businessService:D,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:G,blockReasonFiltered:P}))},[_,x,q,j,G]),_&&O.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tt,{label:g(O.label.heading)}),headerBarEnd:l.createElement(bt,{onClick:S}),actionCancelLabel:g(O.label.cancel),actionCancelOnSubmit:S,actionSaveLabel:g(O.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:K?{width:"720px"}:{},style:K?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:K?{paddingLeft:"5px"}:{}},L?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:O.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,i,o,r,u,s,c,d,m,v,E,p,f,D,A,N,L,O,I,w,R,x,M,P;T={...T,documents:ee(),additionalDetails:{...null===(t=T)||void 0===t?void 0:t.additionalDetails,fieldinspection_pending:J(T),pendingapproval:te(),blockingReason:null==k?void 0:k.name},workflow:{action:null==_?void 0:_.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==b||null===(a=b.data)||void 0===a||null===(i=a.processInstances)||void 0===i||null===(o=i[0])||void 0===o||null===(r=o.state)||void 0===r?void 0:r.applicationStatus)?[null==b||null===(u=b.data)||void 0===u||null===(s=u.processInstances)||void 0===s||null===(c=s[0])||void 0===c||null===(d=c.assigner)||void 0===d?void 0:d.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==b||null===(m=b.data)||void 0===m||null===(v=m.processInstances)||void 0===v||null===(E=v[0])||void 0===E||null===(p=E.state)||void 0===p?void 0:p.applicationStatus)?[null==b||null===(f=b.data)||void 0===f||null===(D=f.processInstances)||void 0===D||null===(A=D[0])||void 0===A||null===(N=A.assigner)||void 0===N?void 0:N.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,varificationDocuments:j?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==H?void 0:H.name,fileStoreId:j}]:null},action:null==_?void 0:_.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==b||null===(L=b.data)||void 0===L||null===(O=L.processInstances)||void 0===O||null===(I=O[0])||void 0===I||null===(w=I.state)||void 0===w?void 0:w.applicationStatus)?[null==b||null===(R=b.data)||void 0===R||null===(x=R.processInstances)||void 0===x||null===(M=x[0])||void 0===M||null===(P=M.assigner)||void 0===P?void 0:P.uuid]:null!=B&&B.uuid?[null==B?void 0:B.uuid]:null,wfDocuments:j?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==H?void 0:H.name,fileStoreId:j}]:null};const F=function(e,t,n,l,a,i,o,r,u,s,c,d){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=T)||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=T)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null===(o=T)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(u=r.selfCertificationCharges)||void 0===u?void 0:u.BPA_WATER_CHARGES)+parseInt(null===(s=T)||void 0===s||null===(c=s.additionalDetails)||void 0===c||null===(d=c.selfCertificationCharges)||void 0===d?void 0:d.BPA_GAUSHALA_CHARGES_CESS))){var m,v,E;T.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",T.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",T.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",T.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),T.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==y||null===(m=y.nocData)||void 0===m?void 0:m.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:{...e,documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]}}});let t={sourceRefId:null==e||null===(v=e[0])||void 0===v||null===(E=v.Noc)||void 0===E?void 0:E.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(h,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,i,o,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===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.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 i=[];if(e&&e.map(e=>{var t,n,o,r,u,s,c,d,m,v,E,p;("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===(o=e.Noc)||void 0===o||null===(r=o.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===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l||"FIRE_NOC"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&a)&&i.push(e)}),"FIELDINSPECTION_INPROGRESS"==T.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?C({BPA:T},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0}):(S(),alert(g("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else C({BPA:T},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0})})}S(),alert(g("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(F&&F.then?F.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:w,formId:"modal-action"})):l.createElement(t.Loader,null)},Nt=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)),It=e=>{var a,o;let{t:u,action:s,tenantId:c,closeModal:d,submitAction:m,applicationData:v,businessService:E}=e;const{data:p,isLoading:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[g,_]=(r.useQueryClient(),n.useState({})),[h,S]=n.useState({}),[C,y]=n.useState([]),[T,D]=n.useState({}),[b,A]=n.useState(null),[N,L]=n.useState(null),[O,I]=n.useState(null),w=!!Digit.Utils.browser.isMobile();function R(e){A(e.target.files[0])}return i.useHistory(),n.useEffect(()=>{var e;y(null==p||null===(e=p.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}}))},[p]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)I(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))I(u("NOT_SUPPORTED_FILE_TYPE"));else{const e=ct(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",b,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?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(u("CS_FILE_UPLOAD_ERROR"))})},function(){I(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)}}()},[b]),n.useEffect(()=>{s&&_((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v,error:E}=e,p=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(p=!0);let f=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(f=!0),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${v}_${null==i?void 0:i.action}`,cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:i.isTerminateState||f?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||f?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:p,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:E})}]}]}})({t:u,action:s,approvers:C,selectedApprover:T,setSelectedApprover:D,selectFile:R,uploadedFile:N,setUploadedFile:L,businessService:E,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:O}))},[s,C,N,O]),s&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Nt,{label:u(g.label.heading)}),headerBarEnd:l.createElement(Ot,{onClick:d}),actionCancelLabel:u(g.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:u(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:w?{width:"720px"}:{},style:w?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:w?{paddingLeft:"5px"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.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")),i=(null===(t=v)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=v)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),v={...v,workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,documents:N?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:N}]:null},documents:i},m({Noc:v},!1,{isNoc:!0})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)};var wt=function(e,t){return e===t||e!=e&&t!=t},Rt=function(e,t){for(var n=e.length;n--;)if(wt(e[n][0],t))return n;return-1},xt=Array.prototype.splice;function Mt(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])}}Mt.prototype.clear=function(){this.__data__=[],this.size=0},Mt.prototype.delete=function(e){var t=this.__data__,n=Rt(t,e);return!(n<0||(n==t.length-1?t.pop():xt.call(t,n,1),--this.size,0))},Mt.prototype.get=function(e){var t=this.__data__,n=Rt(t,e);return n<0?void 0:t[n][1]},Mt.prototype.has=function(e){return Rt(this.__data__,e)>-1},Mt.prototype.set=function(e,t){var n=this.__data__,l=Rt(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var Pt=Mt,Ft="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Bt(e,t){return e(t={exports:{}},t.exports),t.exports}var Ut,kt="object"==typeof Ft&&Ft&&Ft.Object===Object&&Ft,Vt="object"==typeof self&&self&&self.Object===Object&&self,Ht=kt||Vt||Function("return this")(),Wt=Ht.Symbol,jt=Object.prototype,Yt=jt.hasOwnProperty,Gt=jt.toString,zt=Wt?Wt.toStringTag:void 0,qt=Object.prototype.toString,$t=Wt?Wt.toStringTag:void 0,Kt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$t&&$t in Object(e)?function(e){var t=Yt.call(e,zt),n=e[zt];try{e[zt]=void 0;var l=!0}catch(e){}var a=Gt.call(e);return l&&(t?e[zt]=n:delete e[zt]),a}(e):function(e){return qt.call(e)}(e)},Xt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Zt=function(e){if(!Xt(e))return!1;var t=Kt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Qt=Ht["__core-js_shared__"],Jt=(Ut=/[^.]+$/.exec(Qt&&Qt.keys&&Qt.keys.IE_PROTO||""))?"Symbol(src)_1."+Ut:"",en=Function.prototype.toString,tn=function(e){if(null!=e){try{return en.call(e)}catch(e){}try{return e+""}catch(e){}}return""},nn=/^\[object .+?Constructor\]$/,ln=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),an=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Xt(e)||(t=e,Jt&&Jt in t))&&(Zt(e)?ln:nn).test(tn(e));var t}(n)?n:void 0},on=an(Ht,"Map"),rn=an(Object,"create"),un=Object.prototype.hasOwnProperty,sn=Object.prototype.hasOwnProperty;function cn(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])}}cn.prototype.clear=function(){this.__data__=rn?rn(null):{},this.size=0},cn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},cn.prototype.get=function(e){var t=this.__data__;if(rn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return un.call(t,e)?t[e]:void 0},cn.prototype.has=function(e){var t=this.__data__;return rn?void 0!==t[e]:sn.call(t,e)},cn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=rn&&void 0===t?"__lodash_hash_undefined__":t,this};var dn=cn,mn=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 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.size=0,this.__data__={hash:new dn,map:new(on||Pt),string:new dn}},vn.prototype.delete=function(e){var t=mn(this,e).delete(e);return this.size-=t?1:0,t},vn.prototype.get=function(e){return mn(this,e).get(e)},vn.prototype.has=function(e){return mn(this,e).has(e)},vn.prototype.set=function(e,t){var n=mn(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var En=vn;function pn(e){var t=this.__data__=new Pt(e);this.size=t.size}pn.prototype.clear=function(){this.__data__=new Pt,this.size=0},pn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},pn.prototype.get=function(e){return this.__data__.get(e)},pn.prototype.has=function(e){return this.__data__.has(e)},pn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Pt){var l=n.__data__;if(!on||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new En(l)}return n.set(e,t),this.size=n.size,this};var fn=pn,gn=function(){try{var e=an(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_n=function(e,t,n){"__proto__"==t&&gn?gn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},hn=Object.prototype.hasOwnProperty,Sn=function(e,t,n){var l=e[t];hn.call(e,t)&&wt(l,n)&&(void 0!==n||t in e)||_n(e,t,n)},Cn=function(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?_n(n,r,u):Sn(n,r,u)}return n},yn=function(e){return null!=e&&"object"==typeof e},Tn=function(e){return yn(e)&&"[object Arguments]"==Kt(e)},Dn=Object.prototype,bn=Dn.hasOwnProperty,An=Dn.propertyIsEnumerable,Nn=Tn(function(){return arguments}())?Tn:function(e){return yn(e)&&bn.call(e,"callee")&&!An.call(e,"callee")},Ln=Array.isArray,On=function(){return!1},In=Bt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Ht.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||On}),wn=/^(?:0|[1-9]\d*)$/,Rn=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&wn.test(e))&&e>-1&&e%1==0&&e<t},xn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Mn={};Mn["[object Float32Array]"]=Mn["[object Float64Array]"]=Mn["[object Int8Array]"]=Mn["[object Int16Array]"]=Mn["[object Int32Array]"]=Mn["[object Uint8Array]"]=Mn["[object Uint8ClampedArray]"]=Mn["[object Uint16Array]"]=Mn["[object Uint32Array]"]=!0,Mn["[object Arguments]"]=Mn["[object Array]"]=Mn["[object ArrayBuffer]"]=Mn["[object Boolean]"]=Mn["[object DataView]"]=Mn["[object Date]"]=Mn["[object Error]"]=Mn["[object Function]"]=Mn["[object Map]"]=Mn["[object Number]"]=Mn["[object Object]"]=Mn["[object RegExp]"]=Mn["[object Set]"]=Mn["[object String]"]=Mn["[object WeakMap]"]=!1;var Pn=function(e){return function(t){return e(t)}},Fn=Bt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&kt.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),Bn=Fn&&Fn.isTypedArray,Un=Bn?Pn(Bn):function(e){return yn(e)&&xn(e.length)&&!!Mn[Kt(e)]},kn=Object.prototype.hasOwnProperty,Vn=function(e,t){var n=Ln(e),l=!n&&Nn(e),a=!n&&!l&&In(e),i=!n&&!l&&!a&&Un(e),o=n||l||a||i,r=o?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&&!kn.call(e,s)||o&&("length"==s||a&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Rn(s,u))||r.push(s);return r},Hn=Object.prototype,Wn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Hn)},jn=function(e,t){return function(n){return e(t(n))}},Yn=jn(Object.keys,Object),Gn=Object.prototype.hasOwnProperty,zn=function(e){return null!=e&&xn(e.length)&&!Zt(e)},qn=function(e){return zn(e)?Vn(e):function(e){if(!Wn(e))return Yn(e);var t=[];for(var n in Object(e))Gn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},$n=Object.prototype.hasOwnProperty,Kn=function(e){return zn(e)?Vn(e,!0):function(e){if(!Xt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Wn(e),n=[];for(var l in e)("constructor"!=l||!t&&$n.call(e,l))&&n.push(l);return n}(e)},Xn=Bt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Ht.Buffer:void 0,i=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=i?i(n):new e.constructor(n);return e.copy(l),l}}),Zn=function(){return[]},Qn=Object.prototype.propertyIsEnumerable,Jn=Object.getOwnPropertySymbols,el=Jn?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,i=0,o=[];++l<a;){var r=t[l];Qn.call(e,r)&&(o[i++]=r)}return o}(Jn(e)))}:Zn,tl=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},nl=jn(Object.getPrototypeOf,Object),ll=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tl(t,el(e)),e=nl(e);return t}:Zn,al=function(e,t,n){var l=t(e);return Ln(e)?l:tl(l,n(e))},il=function(e){return al(e,qn,el)},ol=function(e){return al(e,Kn,ll)},rl=an(Ht,"DataView"),ul=an(Ht,"Promise"),sl=an(Ht,"Set"),cl=an(Ht,"WeakMap"),dl=tn(rl),ml=tn(on),vl=tn(ul),El=tn(sl),pl=tn(cl),fl=Kt;(rl&&"[object DataView]"!=fl(new rl(new ArrayBuffer(1)))||on&&"[object Map]"!=fl(new on)||ul&&"[object Promise]"!=fl(ul.resolve())||sl&&"[object Set]"!=fl(new sl)||cl&&"[object WeakMap]"!=fl(new cl))&&(fl=function(e){var t=Kt(e),n="[object Object]"==t?e.constructor:void 0,l=n?tn(n):"";if(l)switch(l){case dl:return"[object DataView]";case ml:return"[object Map]";case vl:return"[object Promise]";case El:return"[object Set]";case pl:return"[object WeakMap]"}return t});var gl=fl,_l=Object.prototype.hasOwnProperty,hl=Ht.Uint8Array,Sl=function(e){var t=new e.constructor(e.byteLength);return new hl(t).set(new hl(e)),t},Cl=/\w*$/,yl=Wt?Wt.prototype:void 0,Tl=yl?yl.valueOf:void 0,Dl=Object.create,bl=function(){function e(){}return function(t){if(!Xt(t))return{};if(Dl)return Dl(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Al=Fn&&Fn.isMap,Nl=Al?Pn(Al):function(e){return yn(e)&&"[object Map]"==gl(e)},Ll=Fn&&Fn.isSet,Ol=Ll?Pn(Ll):function(e){return yn(e)&&"[object Set]"==gl(e)},Il={};Il["[object Arguments]"]=Il["[object Array]"]=Il["[object ArrayBuffer]"]=Il["[object DataView]"]=Il["[object Boolean]"]=Il["[object Date]"]=Il["[object Float32Array]"]=Il["[object Float64Array]"]=Il["[object Int8Array]"]=Il["[object Int16Array]"]=Il["[object Int32Array]"]=Il["[object Map]"]=Il["[object Number]"]=Il["[object Object]"]=Il["[object RegExp]"]=Il["[object Set]"]=Il["[object String]"]=Il["[object Symbol]"]=Il["[object Uint8Array]"]=Il["[object Uint8ClampedArray]"]=Il["[object Uint16Array]"]=Il["[object Uint32Array]"]=!0,Il["[object Error]"]=Il["[object Function]"]=Il["[object WeakMap]"]=!1;var wl=function e(t,n,l,a,i,o){var r,u=1&n,s=2&n,c=4&n;if(l&&(r=i?l(t,a,i,o):l(t)),void 0!==r)return r;if(!Xt(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=gl(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(In(t))return Xn(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!i){if(r=s||v?{}:function(e){return"function"!=typeof e.constructor||Wn(e)?{}:bl(nl(e))}(t),!u)return s?function(e,t){return Cn(e,ll(e),t)}(t,function(e,t){return e&&Cn(t,Kn(t),e)}(r,t)):function(e,t){return Cn(e,el(e),t)}(t,function(e,t){return e&&Cn(t,qn(t),e)}(r,t))}else{if(!Il[m])return i?t:{};r=function(e,t,n){var l,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Sl(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var n=t?Sl(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?Sl(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Cl.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return Tl?Object(Tl.call(e)):{}}}(t,m,u)}}o||(o=new fn);var E=o.get(t);if(E)return E;o.set(t,r),Ol(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):Nl(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var p=d?void 0:(c?s?ol:il:s?Kn:qn)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(p||t,function(a,i){p&&(a=t[i=a]),Sn(r,i,e(a,n,l,i,t,o))}),r},Rl=function(e){return wl(e,5)};const xl=e=>l.createElement("h1",{className:"heading-m"},e.label),Ml=()=>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"})),Pl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ml,null)),Fl=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}},Bl=e=>{var a,i;let{t:o,action:r,tenantId:u,closeModal:c,submitAction:d,applicationData:m,businessService:v}=e;const{data:E,isLoading:p}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[_,h]=n.useState({}),[S,C]=n.useState([]),[y,T]=n.useState({}),[D,b]=n.useState(null),[A,N]=n.useState(null),[L,O]=n.useState(null),I=window.Digit.Utils.browser.isMobile(),w=window.location.href.includes("/employee");function R(e){b(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{O(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)O(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))O(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=ct(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?N(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):O(o("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),O(o("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,i;"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===(i=a.processInstance)||void 0===i?void 0:i.businessService)?r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:u,selectFile:c,uploadedFile:d,setUploadedFile:m,businessService:v,error:E}=e,p=!0,f=!1;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==i?void 0:i.action)||"RESUBMIT_APPLICATION"==(null==i?void 0:i.action))&&(p=!1),i.isTerminateState&&(p=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(f=!0),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==v?void 0:v.toUpperCase()}_${null==i?void 0:i.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:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},f&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,s({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:c,onDelete:()=>{m(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:E,iserror:E,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:S,selectedApprover:y,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:N,businessService:v,error:L})):r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,businessService:m,error:v}=e,E=!0;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(E=!1),i.isTerminateState&&(E=!1),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==i?void 0:i.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:o,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:o,action:r,approvers:S,selectedApprover:y,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:N,businessService:v,error:L}))},[r,S,A,L]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(xl,{label:o(f.label.heading)}),headerBarEnd:l.createElement(Pl,{onClick:c}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:I&&w?{width:"100%",height:"auto"}:{}},p?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,i,o,s,c,v,E;if(null!==(t=m)&&void 0!==t&&t.isBillAmend){var p,f,g,_,h,S,C,T,b;const t={...null===(p=m)||void 0===p||null===(f=p.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,comments:null!=e&&e.comments?e.comments:null},n={...null===(g=m)||void 0===g?void 0:g.billAmendmentDetails,workflow:{businessId:null===(_=m)||void 0===_||null===(h=_.billAmendmentDetails)||void 0===h?void 0:h.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(S=m)&&void 0!==S&&null!==(C=S.applicationType)&&void 0!==C&&C.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(T=m)&&void 0!==T&&null!==(b=T.applicationType)&&void 0!==b&&b.includes("WATER")?"WS":"SW",assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.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!=y&&y.uuid?[{uuid:null==y?void 0:y.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}]:[]}};d({AmendmentUpdate:n})}else{if(m={...m,action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:[],assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:{...null===(n=m)||void 0===n?void 0:n.processInstance,action:null==r?void 0:r.action,assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.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=Rl(null==e?void 0:e.date);m.disconnectionExecutionDate=Fl(t)}else if(null!=e&&e.date){const t=Rl(null==e?void 0:e.date);m.connectionExecutionDate=Fl(t)}var N;if("DisconnectWSConnection"==(null===(i=m)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)||"DisconnectSWConnection"==(null===(s=m)||void 0===s||null===(c=s.processInstance)||void 0===c?void 0:c.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(N=m)||void 0===N?void 0:N.serviceType)?d({WaterConnection:m,disconnectRequest:!0}):d({SewerageConnection:m,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=m)||void 0===v?void 0:v.applicationType))d({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=m)||void 0===E?void 0:E.applicationType))d({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!0});else{var L,O,I,w,R,x,M,P,F,B,U,k,V;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenalty&&(m.additionalDetails.adhocPenalty=parseInt(null==t||null===(O=t.value)||void 0===O?void 0:O.adhocPenalty)||""),null!=t&&null!==(I=t.value)&&void 0!==I&&I.adhocPenaltyComment&&(m.additionalDetails.adhocPenaltyComment=(null==t||null===(w=t.value)||void 0===w?void 0:w.adhocPenaltyComment)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyReason&&(m.additionalDetails.adhocPenaltyReason=(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(m.additionalDetails.adhocRebate=parseInt(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocRebate)||""),null!=t&&null!==(F=t.value)&&void 0!==F&&F.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===(k=t.value)||void 0===k?void 0:k.adhocRebateReason)||""),"WATER"==(null===(V=m)||void 0===V?void 0:V.serviceType)?d({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!1}):d({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Ul=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"})),Vl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(kl,null)),Hl=e=>{var a,i;let{t:o,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:d,businessService:m,moduleCode:v}=e;console.log("applicationData",d);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[p,f]=n.useState({}),[g,_]=n.useState({}),[h,S]=n.useState([]),[C,y]=n.useState(null),[T,D]=n.useState(null),[b,A]=n.useState(null),[N,L]=n.useState(null),[O,I]=n.useState(!1);function w(e){D(e.target.files[0])}return n.useEffect(()=>{var e;S(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{L(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)L(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=ct(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",T,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?A(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(o("CS_FILE_UPLOAD_ERROR"))})},function(){L(o("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)}}()},[T]),n.useEffect(()=>{r&&f((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:o,action:r,approvers:h,selectedApprover:C,setSelectedApprover:y,selectFile:w,uploadedFile:b,setUploadedFile:A,businessService:m}))},[r,h,b]),r&&p.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ul,{label:o(p.label.heading)}),headerBarEnd:l.createElement(Vl,{onClick:s}),actionCancelLabel:o(p.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:o(p.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:p.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"};d.creationReason="CREATE",c({PetRegistrationApplications:[{...d,workflow:t}]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],b&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:b}]),c({PetRegistrationApplications:[{...d,workflow:t}]})},defaultValues:g,formId:"modal-action"})):l.createElement(t.Loader,null)},Wl=e=>null!=e&&e.businessService.includes("PT")?l.createElement(Et,e):null!=e&&e.businessService.includes("ptr")?l.createElement(Hl,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")||null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(_t,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(yt,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(At,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(It,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(Bl,e):void 0;function jl(e){let{documents:n,svgStyles:i={},isSendBackFlow:o=!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 i,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===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i;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)),o?null!=n&&null!==(i=n.documentType)&&void 0!==i&&i.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"}}),o?(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!=i&&i.minWidth?null==i?void 0:i.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")))))})))}Bt(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]],i="[object Arguments]",o="[object Array]",r="[object Boolean]",u="[object Date]",s="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",v="[object Number]",E="[object Object]",p="[object RegExp]",f="[object Set]",g="[object String]",_="[object Symbol]",h="[object WeakMap]",S="[object ArrayBuffer]",C="[object DataView]",y="[object Float32Array]",T="[object Float64Array]",D="[object Int8Array]",b="[object Int16Array]",A="[object Int32Array]",N="[object Uint8Array]",L="[object Uint16Array]",O="[object Uint32Array]",I=/\b__p \+= '';/g,w=/\b(__p \+=) '' \+/g,R=/(__e\(.*?\)|\b__t\)) \+\n'';/g,x=/&(?:amp|lt|gt|quot|#39);/g,M=/[&<>"']/g,P=RegExp(x.source),F=RegExp(M.source),B=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,k=/<%=([\s\S]+?)%>/g,V=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,j=/[\\^$.*+?()[\]{}|]/g,Y=RegExp(j.source),G=/^\s+/,z=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,K=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Z=/[()=,{}\[\]\/\s]/,Q=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,ie=/^(?:0|[1-9]\d*)$/,oe=/[\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+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",pe="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",fe="\\ud83c[\\udffb-\\udfff]",ge="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ce="(?:"+Ee+"|"+pe+")",ye="(?:"+Se+"|"+pe+")",Te="(?:"+me+"|"+fe+")?",De="[\\ufe0e\\ufe0f]?"+Te+"(?:\\u200d(?:"+[ge,_e,he].join("|")+")[\\ufe0e\\ufe0f]?"+Te+")*",be="(?:"+["[\\u2700-\\u27bf]",_e,he].join("|")+")"+De,Ae="(?:"+[ge+me+"?",me,_e,he,"[\\ud800-\\udfff]"].join("|")+")",Ne=RegExp("['’]","g"),Le=RegExp(me,"g"),Oe=RegExp(fe+"(?="+fe+")|"+Ae+De,"g"),Ie=RegExp([Se+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[de,Se,"$"].join("|")+")",ye+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[de,Se+Ce,"$"].join("|")+")",Se+"?"+Ce+"+(?:['’](?: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,be].join("|"),"g"),we=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),Re=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xe=["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"],Me=-1,Pe={};Pe[y]=Pe[T]=Pe[D]=Pe[b]=Pe[A]=Pe[N]=Pe["[object Uint8ClampedArray]"]=Pe[L]=Pe[O]=!0,Pe[i]=Pe[o]=Pe[S]=Pe[r]=Pe[C]=Pe[u]=Pe[s]=Pe[c]=Pe[m]=Pe[v]=Pe[E]=Pe[p]=Pe[f]=Pe[g]=Pe[h]=!1;var Fe={};Fe[i]=Fe[o]=Fe[S]=Fe[C]=Fe[r]=Fe[u]=Fe[y]=Fe[T]=Fe[D]=Fe[b]=Fe[A]=Fe[m]=Fe[v]=Fe[E]=Fe[p]=Fe[f]=Fe[g]=Fe[_]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[L]=Fe[O]=!0,Fe[s]=Fe[c]=Fe[h]=!1;var Be={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,ke=parseInt,Ve="object"==typeof Ft&&Ft&&Ft.Object===Object&&Ft,He="object"==typeof self&&self&&self.Object===Object&&self,We=Ve||He||Function("return this")(),je=t&&!t.nodeType&&t,Ye=je&&e&&!e.nodeType&&e,Ge=Ye&&Ye.exports===je,ze=Ge&&Ve.process,qe=function(){try{return Ye&&Ye.require&&Ye.require("util").types||ze&&ze.binding&&ze.binding("util")}catch(e){}}(),$e=qe&&qe.isArrayBuffer,Ke=qe&&qe.isDate,Xe=qe&&qe.isMap,Ze=qe&&qe.isRegExp,Qe=qe&&qe.isSet,Je=qe&&qe.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,i=null==e?0:e.length;++a<i;){var o=e[a];t(l,o,n(o),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 it(e,t){for(var n=-1,l=null==e?0:e.length,a=0,i=[];++n<l;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function ot(e,t){return!(null==e||!e.length)&&ft(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,i=null==e?0:e.length;for(l&&i&&(n=e[++a]);++a<i;)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 Et(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function pt(e,t,n,l){for(var a=e.length,i=n+(l?1:-1);l?i--:++i<a;)if(t(e[i],i,e))return i;return-1}function ft(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):pt(e,_t,n)}function gt(e,t,n,l){for(var a=n-1,i=e.length;++a<i;)if(l(e[a],t))return a;return-1}function _t(e){return e!=e}function ht(e,t){var n=null==e?0:e.length;return n?Tt(e,t)/n:NaN}function St(e){return function(t){return null==t?void 0:t[e]}}function Ct(e){return function(t){return null==e?void 0:e[t]}}function yt(e,t,n,l,a){return a(e,function(e,a,i){n=l?(l=!1,e):t(n,e,a,i)}),n}function Tt(e,t){for(var n,l=-1,a=e.length;++l<a;){var i=t(e[l]);void 0!==i&&(n=void 0===n?i:n+i)}return n}function Dt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function bt(e){return e?e.slice(0,Yt(e)+1).replace(G,""):e}function At(e){return function(t){return e(t)}}function Nt(e,t){return ut(t,function(t){return e[t]})}function Lt(e,t){return e.has(t)}function Ot(e,t){for(var n=-1,l=e.length;++n<l&&ft(t,e[n],0)>-1;);return n}function It(e,t){for(var n=e.length;n--&&ft(t,e[n],0)>-1;);return n}function wt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Rt=Ct({"À":"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"}),xt=Ct({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+Be[e]}function Pt(e){return we.test(e)}function Bt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Ut(e,t){return function(n){return e(t(n))}}function kt(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[i++]=n)}return o}function Vt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Pt(e)?function(e){for(var t=Oe.lastIndex=0;Oe.test(e);)++t;return t}(e):vt(e)}function jt(e){return Pt(e)?function(e){return e.match(Oe)||[]}(e):function(e){return e.split("")}(e)}function Yt(e){for(var t=e.length;t--&&z.test(e.charAt(t)););return t}var Gt=Ct({"&":"&","<":"<",">":">",""":'"',"'":"'"}),zt=function e(t){var z=(t=null==t?We:zt.defaults(We.Object(),t,zt.pick(We,xe))).Array,se=t.Date,ce=t.Error,de=t.Function,me=t.Math,ve=t.Object,Ee=t.RegExp,pe=t.String,fe=t.TypeError,ge=z.prototype,_e=ve.prototype,he=t["__core-js_shared__"],Se=de.prototype.toString,Ce=_e.hasOwnProperty,ye=0,Te=function(){var e=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),De=_e.toString,be=Se.call(ve),Ae=We._,Oe=Ee("^"+Se.call(Ce).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=Ge?t.Buffer:void 0,Be=t.Symbol,Ve=t.Uint8Array,He=we?we.allocUnsafe:void 0,je=Ut(ve.getPrototypeOf,ve),Ye=ve.create,ze=_e.propertyIsEnumerable,qe=ge.splice,vt=Be?Be.isConcatSpreadable:void 0,Ct=Be?Be.iterator:void 0,Ft=Be?Be.toStringTag:void 0,qt=function(){try{var e=Za(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,Kt=se&&se.now!==We.Date.now&&se.now,Xt=t.setTimeout!==We.setTimeout&&t.setTimeout,Zt=me.ceil,Qt=me.floor,Jt=ve.getOwnPropertySymbols,en=we?we.isBuffer:void 0,tn=t.isFinite,nn=ge.join,ln=Ut(ve.keys,ve),an=me.max,on=me.min,rn=se.now,un=t.parseInt,sn=me.random,cn=ge.reverse,dn=Za(t,"DataView"),mn=Za(t,"Map"),vn=Za(t,"Promise"),En=Za(t,"Set"),pn=Za(t,"WeakMap"),fn=Za(ve,"create"),gn=pn&&new pn,_n={},hn=Ai(dn),Sn=Ai(mn),Cn=Ai(vn),yn=Ai(En),Tn=Ai(pn),Dn=Be?Be.prototype:void 0,bn=Dn?Dn.valueOf:void 0,An=Dn?Dn.toString:void 0;function Nn(e){if(Yo(e)&&!xo(e)&&!(e instanceof wn)){if(e instanceof In)return e;if(Ce.call(e,"__wrapped__"))return Ni(e)}return new In(e)}var Ln=function(){function e(){}return function(t){if(!jo(t))return{};if(Ye)return Ye(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function On(){}function In(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function wn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}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 xn(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.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.__data__=new Mn;++t<n;)this.add(e[t])}function Fn(e){var t=this.__data__=new xn(e);this.size=t.size}function Bn(e,t){var n=xo(e),l=!n&&Ro(e),a=!n&&!l&&Bo(e),i=!n&&!l&&!a&&Qo(e),o=n||l||a||i,r=o?Dt(e.length,pe):[],u=r.length;for(var s in e)!t&&!Ce.call(e,s)||o&&("length"==s||a&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ai(s,u))||r.push(s);return r}function Un(e){var t=e.length;return t?e[Ml(0,t-1)]:void 0}function kn(e,t){return Ci(pa(e),$n(t,0,e.length))}function Vn(e){return Ci(pa(e))}function Hn(e,t,n){(void 0!==n&&!Oo(e[t],n)||void 0===n&&!(t in e))&&zn(e,t,n)}function Wn(e,t,n){var l=e[t];Ce.call(e,t)&&Oo(l,n)&&(void 0!==n||t in e)||zn(e,t,n)}function jn(e,t){for(var n=e.length;n--;)if(Oo(e[n][0],t))return n;return-1}function Yn(e,t,n,l){return Jn(e,function(e,a,i){t(l,e,n(e),i)}),l}function Gn(e,t){return e&&fa(t,Sr(t),e)}function zn(e,t,n){"__proto__"==t&&qt?qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function qn(e,t){for(var n=-1,l=t.length,a=z(l),i=null==e;++n<l;)a[n]=i?void 0:pr(e,t[n]);return a}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Kn(e,t,n,l,a,o){var s,h=1&t,I=2&t,w=4&t;if(n&&(s=a?n(e,l,a,o):n(e)),void 0!==s)return s;if(!jo(e))return e;var R=xo(e);if(R){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ce.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!h)return pa(e,s)}else{var x=ei(e),M=x==c||x==d;if(Bo(e))return sa(e,h);if(x==E||x==i||M&&!a){if(s=I||M?{}:ni(e),!h)return I?function(e,t){return fa(e,Ja(e),t)}(e,function(e,t){return e&&fa(t,Cr(t),e)}(s,e)):function(e,t){return fa(e,Qa(e),t)}(e,Gn(s,e))}else{if(!Fe[x])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 C:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case y:case T:case D:case b:case A:case N:case"[object Uint8ClampedArray]":case L:case O:return da(e,n);case m:return new l;case v:case g:return new l(e);case p:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case _:return bn?ve(bn.call(e)):{}}}(e,x,h)}}o||(o=new Fn);var P=o.get(e);if(P)return P;o.set(e,s),Ko(e)?e.forEach(function(l){s.add(Kn(l,t,n,l,e,o))}):Go(e)&&e.forEach(function(l,a){s.set(a,Kn(l,t,n,a,e,o))});var F=R?void 0:(w?I?Ya:ja:I?Cr:Sr)(e);return nt(F||e,function(l,a){F&&(l=e[a=l]),Wn(s,a,Kn(l,t,n,a,e,o))}),s}function Xn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],i=e[a];if(void 0===i&&!(a in e)||!(0,t[a])(i))return!1}return!0}function Zn(e,t,l){if("function"!=typeof e)throw new fe(n);return gi(function(){e.apply(void 0,l)},t)}function Qn(e,t,n,l){var a=-1,i=ot,o=!0,r=e.length,u=[],s=t.length;if(!r)return u;n&&(t=ut(t,At(n))),l?(i=rt,o=!1):t.length>=200&&(i=Lt,o=!1,t=new Pn(t));e:for(;++a<r;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,o&&d==d){for(var m=s;m--;)if(t[m]===d)continue e;u.push(c)}else i(t,d,l)||u.push(c)}return u}Nn.templateSettings={escape:B,evaluate:U,interpolate:k,variable:"",imports:{_:Nn}},(Nn.prototype=On.prototype).constructor=Nn,(In.prototype=Ln(On.prototype)).constructor=In,(wn.prototype=Ln(On.prototype)).constructor=wn,Rn.prototype.clear=function(){this.__data__=fn?fn(null):{},this.size=0},Rn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Rn.prototype.get=function(e){var t=this.__data__;if(fn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ce.call(t,e)?t[e]:void 0},Rn.prototype.has=function(e){var t=this.__data__;return fn?void 0!==t[e]:Ce.call(t,e)},Rn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fn&&void 0===t?"__lodash_hash_undefined__":t,this},xn.prototype.clear=function(){this.__data__=[],this.size=0},xn.prototype.delete=function(e){var t=this.__data__,n=jn(t,e);return!(n<0||(n==t.length-1?t.pop():qe.call(t,n,1),--this.size,0))},xn.prototype.get=function(e){var t=this.__data__,n=jn(t,e);return n<0?void 0:t[n][1]},xn.prototype.has=function(e){return jn(this.__data__,e)>-1},xn.prototype.set=function(e,t){var n=this.__data__,l=jn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new Rn,map:new(mn||xn),string:new Rn}},Mn.prototype.delete=function(e){var t=Ka(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Ka(this,e).get(e)},Mn.prototype.has=function(e){return Ka(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Ka(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Pn.prototype.add=Pn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Pn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new xn,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 xn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(l)}return n.set(e,t),this.size=n.size,this};var Jn=ha(rl),el=ha(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 i=e[l],o=t(i);if(null!=o&&(void 0===r?o==o&&!Zo(o):n(o,r)))var r=o,u=i}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 i=-1,o=e.length;for(n||(n=li),a||(a=[]);++i<o;){var r=e[i];t>0&&n(r)?t>1?al(r,t-1,n,l,a):st(a,r):l||(a[a.length]=r)}return a}var il=Sa(),ol=Sa(!0);function rl(e,t){return e&&il(e,t,Sr)}function ul(e,t){return e&&ol(e,t,Sr)}function sl(e,t){return it(t,function(t){return Vo(e[t])})}function cl(e,t){for(var n=0,l=(t=ia(t,e)).length;null!=e&&n<l;)e=e[bi(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return xo(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ft&&Ft in ve(e)?function(e){var t=Ce.call(e,Ft),n=e[Ft];try{e[Ft]=void 0;var l=!0}catch(e){}var a=De.call(e);return l&&(t?e[Ft]=n:delete e[Ft]),a}(e):function(e){return De.call(e)}(e)}function vl(e,t){return e>t}function El(e,t){return null!=e&&Ce.call(e,t)}function pl(e,t){return null!=e&&t in ve(e)}function fl(e,t,n){for(var l=n?rt:ot,a=e[0].length,i=e.length,o=i,r=z(i),u=Infinity,s=[];o--;){var c=e[o];o&&t&&(c=ut(c,At(t))),u=on(c.length,u),r[o]=!n&&(t||a>=120&&c.length>=120)?new Pn(o&&c):void 0}c=e[0];var d=-1,m=r[0];e:for(;++d<a&&s.length<u;){var v=c[d],E=t?t(v):v;if(v=n||0!==v?v:0,!(m?Lt(m,E):l(s,E,n))){for(o=i;--o;){var p=r[o];if(!(p?Lt(p,E):l(e[o],E,n)))continue e}m&&m.push(E),s.push(v)}}return s}function gl(e,t,n){var l=null==(e=vi(e,t=ia(t,e)))?e:e[bi(Ui(t))];return null==l?void 0:et(l,e,n)}function _l(e){return Yo(e)&&ml(e)==i}function hl(e,t,n,l,a){return e===t||(null==e||null==t||!Yo(e)&&!Yo(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=xo(e),h=xo(t),y=d?o:ei(e),T=h?o:ei(t),D=(y=y==i?E:y)==E,b=(T=T==i?E:T)==E,A=y==T;if(A&&Bo(e)){if(!Bo(t))return!1;d=!0,D=!1}if(A&&!D)return c||(c=new Fn),d||Qo(e)?Ha(e,t,n,l,a,c):function(e,t,n,l,a,i,o){switch(n){case C:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case r:case u:case v:return Oo(+e,+t);case s:return e.name==t.name&&e.message==t.message;case p:case g:return e==t+"";case m:var c=Bt;case f:if(c||(c=Vt),e.size!=t.size&&!(1&l))return!1;var d=o.get(e);if(d)return d==t;l|=2,o.set(e,t);var E=Ha(c(e),c(t),l,a,i,o);return o.delete(e),E;case _:if(bn)return bn.call(e)==bn.call(t)}return!1}(e,t,y,n,l,a,c);if(!(1&n)){var N=D&&Ce.call(e,"__wrapped__"),L=b&&Ce.call(t,"__wrapped__");if(N||L){var O=N?e.value():e,I=L?t.value():t;return c||(c=new Fn),a(O,I,n,l,c)}}return!!A&&(c||(c=new Fn),function(e,t,n,l,a,i){var o=1&n,r=ja(e),u=r.length;if(u!=ja(t).length&&!o)return!1;for(var s=u;s--;){var c=r[s];if(!(o?c in t:Ce.call(t,c)))return!1}var d=i.get(e),m=i.get(t);if(d&&m)return d==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var E=o;++s<u;){var p=e[c=r[s]],f=t[c];if(l)var g=o?l(f,p,c,t,e,i):l(p,f,c,e,t,i);if(!(void 0===g?p===f||a(p,f,n,l,i):g)){v=!1;break}E||(E="constructor"==c)}if(v&&!E){var _=e.constructor,h=t.constructor;_==h||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof h&&h instanceof h||(v=!1)}return i.delete(e),i.delete(t),v}(e,t,n,l,a,c))}(e,t,n,l,hl,a))}function Sl(e,t,n,l){var a=n.length,i=a,o=!l;if(null==e)return!i;for(e=ve(e);a--;){var r=n[a];if(o&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<i;){var u=(r=n[a])[0],s=e[u],c=r[1];if(o&&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?hl(c,s,3,l,d):m))return!1}}return!0}function Cl(e){return!(!jo(e)||(t=e,Te&&Te in t))&&(Vo(e)?Oe:le).test(Ai(e));var t}function yl(e){return"function"==typeof e?e:null==e?zr:"object"==typeof e?xo(e)?Nl(e[0],e[1]):Al(e):tu(e)}function Tl(e){if(!si(e))return ln(e);var t=[];for(var n in ve(e))Ce.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Dl(e,t){return e<t}function bl(e,t){var n=-1,l=Po(e)?z(e.length):[];return Jn(e,function(e,a,i){l[++n]=t(e,a,i)}),l}function Al(e){var t=Xa(e);return 1==t.length&&t[0][2]?di(t[0][0],t[0][1]):function(n){return n===e||Sl(n,e,t)}}function Nl(e,t){return oi(e)&&ci(t)?di(bi(e),t):function(n){var l=pr(n,e);return void 0===l&&l===t?fr(n,e):hl(t,l,3)}}function Ll(e,t,n,l,a){e!==t&&il(t,function(i,o){if(a||(a=new Fn),jo(i))!function(e,t,n,l,a,i,o){var r=pi(e,n),u=pi(t,n),s=o.get(u);if(s)Hn(e,n,s);else{var c=i?i(r,u,n+"",e,t,o):void 0,d=void 0===c;if(d){var m=xo(u),v=!m&&Bo(u),E=!m&&!v&&Qo(u);c=u,m||v||E?xo(r)?c=r:Fo(r)?c=pa(r):v?(d=!1,c=sa(u,!0)):E?(d=!1,c=da(u,!0)):c=[]:qo(u)||Ro(u)?(c=r,Ro(r)?c=or(r):jo(r)&&!Vo(r)||(c=ni(u))):d=!1}d&&(o.set(u,c),a(c,u,l,i,o),o.delete(u)),Hn(e,n,c)}}(e,t,o,n,Ll,l,a);else{var r=l?l(pi(e,o),i,o+"",e,t,a):void 0;void 0===r&&(r=i),Hn(e,o,r)}},Cr)}function Ol(e,t){var n=e.length;if(n)return ai(t+=t<0?n:0,n)?e[t]:void 0}function Il(e,t,n){t=t.length?ut(t,function(e){return xo(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[zr];var l=-1;return t=ut(t,At($a())),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,i=t.criteria,o=a.length,r=n.length;++l<o;){var u=ma(a[l],i[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}(bl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function wl(e,t,n){for(var l=-1,a=t.length,i={};++l<a;){var o=t[l],r=cl(e,o);n(r,o)&&kl(i,ia(o,e),r)}return i}function Rl(e,t,n,l){var a=l?gt:ft,i=-1,o=t.length,r=e;for(e===t&&(t=pa(t)),n&&(r=ut(e,At(n)));++i<o;)for(var u=0,s=t[i],c=n?n(s):s;(u=a(r,c,u,l))>-1;)r!==e&&qe.call(r,u,1),qe.call(e,u,1);return e}function xl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==i){var i=a;ai(a)?qe.call(e,a,1):Zl(e,a)}}return e}function Ml(e,t){return e+Qt(sn()*(t-e+1))}function Pl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Qt(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return _i(mi(e,t,zr),e+"")}function Bl(e){return Un(Or(e))}function Ul(e,t){var n=Or(e);return Ci(n,$n(t,0,n.length))}function kl(e,t,n,l){if(!jo(e))return e;for(var a=-1,i=(t=ia(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var u=bi(t[a]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=o){var c=r[u];void 0===(s=l?l(c,u,r):void 0)&&(s=jo(c)?c:ai(t[a+1])?[]:{})}Wn(r,u,s),r=r[u]}return e}var Vl=gn?function(e,t){return gn.set(e,t),e}:zr,Hl=qt?function(e,t){return qt(e,"toString",{configurable:!0,enumerable:!1,value:jr(t),writable:!0})}:zr;function Wl(e){return Ci(Or(e))}function jl(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 i=z(a);++l<a;)i[l]=e[l+t];return i}function Yl(e,t){var n;return Jn(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Gl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var i=l+a>>>1,o=e[i];null!==o&&!Zo(o)&&(n?o<=t:o<t)?l=i+1:a=i}return a}return zl(e,t,zr,n)}function zl(e,t,n,l){var a=0,i=null==e?0:e.length;if(0===i)return 0;for(var o=(t=n(t))!=t,r=null===t,u=Zo(t),s=void 0===t;a<i;){var c=Qt((a+i)/2),d=n(e[c]),m=void 0!==d,v=null===d,E=d==d,p=Zo(d);if(o)var f=l||E;else f=s?E&&(l||m):r?E&&m&&(l||!v):u?E&&m&&!v&&(l||!p):!v&&!p&&(l?d<=t:d<t);f?a=c+1:i=c}return on(i,4294967294)}function ql(e,t){for(var n=-1,l=e.length,a=0,i=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!Oo(r,u)){var u=r;i[a++]=0===o?0:o}}return i}function $l(e){return"number"==typeof e?e:Zo(e)?NaN:+e}function Kl(e){if("string"==typeof e)return e;if(xo(e))return ut(e,Kl)+"";if(Zo(e))return An?An.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xl(e,t,n){var l=-1,a=ot,i=e.length,o=!0,r=[],u=r;if(n)o=!1,a=rt;else if(i>=200){var s=t?null:Pa(e);if(s)return Vt(s);o=!1,a=Lt,u=new Pn}else u=t?[]:r;e:for(;++l<i;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,o&&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=vi(e,t=ia(t,e)))||delete e[bi(Ui(t))]}function Ql(e,t,n,l){return kl(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,i=l?a:-1;(l?i--:++i<a)&&t(e[i],i,e););return n?jl(e,l?0:i,l?i+1:a):jl(e,l?i+1:0,l?a:i)}function ea(e,t){var n=e;return n instanceof wn&&(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,i=z(l);++a<l;)for(var o=e[a],r=-1;++r<l;)r!=a&&(i[a]=Qn(i[a]||o,e[r],t,n));return Xl(al(i,1),t,n)}function na(e,t,n){for(var l=-1,a=e.length,i=t.length,o={};++l<a;)n(o,e[l],l<i?t[l]:void 0);return o}function la(e){return Fo(e)?e:[]}function aa(e){return"function"==typeof e?e:zr}function ia(e,t){return xo(e)?e:oi(e,t)?[e]:Di(rr(e))}var oa=Fl;function ra(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:jl(e,t,n)}var ua=$t||function(e){return We.clearTimeout(e)};function sa(e,t){if(t)return e.slice();var n=e.length,l=He?He(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(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,i=Zo(e),o=void 0!==t,r=null===t,u=t==t,s=Zo(t);if(!r&&!s&&!i&&e>t||i&&o&&u&&!r&&!s||l&&o&&u||!n&&u||!a)return 1;if(!l&&!i&&!s&&e<t||s&&n&&a&&!l&&!i||r&&n&&a||!o&&a||!u)return-1}return 0}function va(e,t,n,l){for(var a=-1,i=e.length,o=n.length,r=-1,u=t.length,s=an(i-o,0),c=z(u+s),d=!l;++r<u;)c[r]=t[r];for(;++a<o;)(d||a<i)&&(c[n[a]]=e[a]);for(;s--;)c[r++]=e[a++];return c}function Ea(e,t,n,l){for(var a=-1,i=e.length,o=-1,r=n.length,u=-1,s=t.length,c=an(i-r,0),d=z(c+s),m=!l;++a<c;)d[a]=e[a];for(var v=a;++u<s;)d[v+u]=t[u];for(;++o<r;)(m||a<i)&&(d[v+n[o]]=e[a++]);return d}function pa(e,t){var n=-1,l=e.length;for(t||(t=z(l));++n<l;)t[n]=e[n];return t}function fa(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?zn(n,r,u):Wn(n,r,u)}return n}function ga(e,t){return function(n,l){var a=xo(n)?tt:Yn,i=t?t():{};return a(n,e,$a(l,2),i)}}function _a(e){return Fl(function(t,n){var l=-1,a=n.length,i=a>1?n[a-1]:void 0,o=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,o&&ii(n[0],n[1],o)&&(i=a<3?void 0:i,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,i)}return t})}function ha(e,t){return function(n,l){if(null==n)return n;if(!Po(n))return e(n,l);for(var a=n.length,i=t?a:-1,o=ve(n);(t?i--:++i<a)&&!1!==l(o[i],i,o););return n}}function Sa(e){return function(t,n,l){for(var a=-1,i=ve(t),o=l(t),r=o.length;r--;){var u=o[e?r:++a];if(!1===n(i[u],u,i))break}return t}}function Ca(e){return function(t){var n=Pt(t=rr(t))?jt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ra(n,1).join(""):t.slice(1);return l[e]()+a}}function ya(e){return function(t){return ct(Vr(Rr(t).replace(Ne,"")),e,"")}}function Ta(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=Ln(e.prototype),l=e.apply(n,t);return jo(l)?l:n}}function Da(e){return function(t,n,l){var a=ve(t);if(!Po(t)){var i=$a(n,3);t=Sr(t),n=function(e){return i(a[e],e,a)}}var o=e(t,n,l);return o>-1?a[i?t[o]:o]:void 0}}function ba(e){return Wa(function(t){var l=t.length,a=l,i=In.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new fe(n);if(i&&!r&&"wrapper"==za(o))var r=new In([],!0)}for(a=r?a:l;++a<l;){var u=za(o=t[a]),s="wrapper"==u?Ga(o):void 0;r=s&&ri(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?r[za(s[0])].apply(r,s[3]):1==o.length&&ri(o)?r[u]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&xo(n))return r.plant(n).value();for(var a=0,i=l?t[a].apply(this,e):n;++a<l;)i=t[a].call(this,i);return i}})}function Aa(e,t,n,l,a,i,o,r,u,s){var c=128&t,d=1&t,m=2&t,v=24&t,E=512&t,p=m?void 0:Ta(e);return function f(){for(var g=arguments.length,_=z(g),h=g;h--;)_[h]=arguments[h];if(v)var S=qa(f),C=wt(_,S);if(l&&(_=va(_,l,a,v)),i&&(_=Ea(_,i,o,v)),g-=C,v&&g<s){var y=kt(_,S);return xa(e,t,Aa,f.placeholder,n,_,y,r,u,s-g)}var T=d?n:this,D=m?T[e]:e;return g=_.length,r?_=Ei(_,r):E&&g>1&&_.reverse(),c&&u<g&&(_.length=u),this&&this!==We&&this instanceof f&&(D=p||Ta(D)),D.apply(T,_)}}function Na(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,a,i){t(l,n(e),a,i)}),l}(n,e,t(l),{})}}function La(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=Kl(n),l=Kl(l)):(n=$l(n),l=$l(l)),a=e(n,l)}return a}}function Oa(e){return Wa(function(t){return t=ut(t,At($a())),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?" ":Kl(t)).length;if(n<2)return n?Pl(t,e):t;var l=Pl(t,Zt(e/Wt(t)));return Pt(t)?ra(jt(l),0,e).join(""):l.slice(0,e)}function wa(e){return function(t,n,l){return l&&"number"!=typeof l&&ii(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,i=an(Zt((t-e)/(n||1)),0),o=z(i);i--;)o[l?i:++a]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:nr(l),e)}}function Ra(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ir(t),n=ir(n)),e(t,n)}}function xa(e,t,n,l,a,i,o,r,u,s){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?i:void 0,c?o:void 0,c?void 0:i,c?void 0:o,r,u,s],m=n.apply(void 0,d);return ri(e)&&fi(m,d),m.placeholder=l,hi(m,e,t)}function Ma(e){var t=me[e];return function(e,n){if(e=ir(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 Pa=En&&1/Vt(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Zr;function Fa(e){return function(t){var n=ei(t);return n==m?Bt(t):n==f?Ht(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ba(e,t,a,i,o,r,u,s){var c=2&t;if(!c&&"function"!=typeof e)throw new fe(n);var d=i?i.length:0;if(d||(t&=-97,i=o=void 0),u=void 0===u?u:an(lr(u),0),s=void 0===s?s:lr(s),d-=o?o.length:0,64&t){var m=i,v=o;i=o=void 0}var E=c?void 0:Ga(e),p=[e,t,a,i,o,m,v,r,u,s];if(E&&function(e,t){var n=e[1],a=t[1],i=n|a;if(!(i<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],i|=1&n?0:4);var o=t[3];if(o){var r=e[3];e[3]=r?va(r,o,t[4]):o,e[4]=r?kt(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?Ea(r,o,t[6]):o,e[6]=r?kt(e[5],l):t[6]),(o=t[7])&&(e[7]=o),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]=i}(p,E),e=p[0],t=p[1],a=p[2],i=p[3],o=p[4],!(s=p[9]=void 0===p[9]?c?0:e.length:an(p[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=Ta(e);return function a(){for(var i=arguments.length,o=z(i),r=i,u=qa(a);r--;)o[r]=arguments[r];var s=i<3&&o[0]!==u&&o[i-1]!==u?[]:kt(o,u);if((i-=s.length)<n)return xa(e,t,Aa,a.placeholder,void 0,o,s,void 0,void 0,n-i);var c=this&&this!==We&&this instanceof a?l:e;return et(c,this,o)}}(e,t,s):32!=t&&33!=t||o.length?Aa.apply(void 0,p):function(e,t,n,l){var a=1&t,i=Ta(e);return function t(){for(var o=-1,r=arguments.length,u=-1,s=l.length,c=z(s+r),d=this&&this!==We&&this instanceof t?i:e;++u<s;)c[u]=l[u];for(;r--;)c[u++]=arguments[++o];return et(d,a?n:this,c)}}(e,t,a,i);else var f=function(e,t,n){var l=1&t,a=Ta(e);return function t(){var i=this&&this!==We&&this instanceof t?a:e;return i.apply(l?n:this,arguments)}}(e,t,a);return hi((E?Vl:fi)(f,p),e,t)}function Ua(e,t,n,l){return void 0===e||Oo(e,_e[n])&&!Ce.call(l,n)?t:e}function ka(e,t,n,l,a,i){return jo(e)&&jo(t)&&(i.set(t,e),Ll(e,t,void 0,ka,i),i.delete(t)),e}function Va(e){return qo(e)?void 0:e}function Ha(e,t,n,l,a,i){var o=1&n,r=e.length,u=t.length;if(r!=u&&!(o&&u>r))return!1;var s=i.get(e),c=i.get(t);if(s&&c)return s==t&&c==e;var d=-1,m=!0,v=2&n?new Pn:void 0;for(i.set(e,t),i.set(t,e);++d<r;){var E=e[d],p=t[d];if(l)var f=o?l(p,E,d,t,e,i):l(E,p,d,e,t,i);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!mt(t,function(e,t){if(!Lt(v,t)&&(E===e||a(E,e,n,l,i)))return v.push(t)})){m=!1;break}}else if(E!==p&&!a(E,p,n,l,i)){m=!1;break}}return i.delete(e),i.delete(t),m}function Wa(e){return _i(mi(e,void 0,xi),e+"")}function ja(e){return dl(e,Sr,Qa)}function Ya(e){return dl(e,Cr,Ja)}var Ga=gn?function(e){return gn.get(e)}:Zr;function za(e){for(var t=e.name+"",n=_n[t],l=Ce.call(_n,t)?n.length:0;l--;){var a=n[l],i=a.func;if(null==i||i==e)return a.name}return t}function qa(e){return(Ce.call(Nn,"placeholder")?Nn:e).placeholder}function $a(){var e=Nn.iteratee||qr;return e=e===qr?yl:e,arguments.length?e(arguments[0],arguments[1]):e}function Ka(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,ci(a)]}return t}function Za(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Cl(n)?n:void 0}var Qa=Jt?function(e){return null==e?[]:(e=ve(e),it(Jt(e),function(t){return ze.call(e,t)}))}:au,Ja=Jt?function(e){for(var t=[];e;)st(t,Qa(e)),e=je(e);return t}:au,ei=ml;function ti(e,t,n){for(var l=-1,a=(t=ia(t,e)).length,i=!1;++l<a;){var o=bi(t[l]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++l!=a?i:!!(a=null==e?0:e.length)&&Wo(a)&&ai(o,a)&&(xo(e)||Ro(e))}function ni(e){return"function"!=typeof e.constructor||si(e)?{}:Ln(je(e))}function li(e){return xo(e)||Ro(e)||!!(vt&&e&&e[vt])}function ai(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ie.test(e))&&e>-1&&e%1==0&&e<t}function ii(e,t,n){if(!jo(n))return!1;var l=typeof t;return!!("number"==l?Po(n)&&ai(t,n.length):"string"==l&&t in n)&&Oo(n[t],e)}function oi(e,t){if(xo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Zo(e))||H.test(e)||!V.test(e)||null!=t&&e in ve(t)}function ri(e){var t=za(e),n=Nn[t];if("function"!=typeof n||!(t in wn.prototype))return!1;if(e===n)return!0;var l=Ga(n);return!!l&&e===l[0]}(dn&&ei(new dn(new ArrayBuffer(1)))!=C||mn&&ei(new mn)!=m||vn&&"[object Promise]"!=ei(vn.resolve())||En&&ei(new En)!=f||pn&&ei(new pn)!=h)&&(ei=function(e){var t=ml(e),n=t==E?e.constructor:void 0,l=n?Ai(n):"";if(l)switch(l){case hn:return C;case Sn:return m;case Cn:return"[object Promise]";case yn:return f;case Tn:return h}return t});var ui=he?Vo:iu;function si(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function ci(e){return e==e&&!jo(e)}function di(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function mi(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,i=an(l.length-t,0),o=z(i);++a<i;)o[a]=l[t+a];a=-1;for(var r=z(t+1);++a<t;)r[a]=l[a];return r[t]=n(o),et(e,this,r)}}function vi(e,t){return t.length<2?e:cl(e,jl(t,0,-1))}function Ei(e,t){for(var n=e.length,l=on(t.length,n),a=pa(e);l--;){var i=t[l];e[l]=ai(i,n)?a[i]:void 0}return e}function pi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fi=Si(Vl),gi=Xt||function(e,t){return We.setTimeout(e,t)},_i=Si(Hl);function hi(e,t,n){var l=t+"";return _i(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(q,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return nt(a,function(n){var l="_."+n[0];t&n[1]&&!ot(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(K):[]}(l),n)))}function Si(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 Ci(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var i=Ml(n,a),o=e[i];e[i]=e[n],e[n]=o}return e.length=t,e}var yi,Ti,Di=(yi=To(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,n,l,a){t.push(l?a.replace(Q,"$1"):n||e)}),t},function(e){return 500===Ti.size&&Ti.clear(),e}),Ti=yi.cache,yi);function bi(e){if("string"==typeof e||Zo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ai(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ni(e){if(e instanceof wn)return e.clone();var t=new In(e.__wrapped__,e.__chain__);return t.__actions__=pa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Li=Fl(function(e,t){return Fo(e)?Qn(e,al(t,1,Fo,!0)):[]}),Oi=Fl(function(e,t){var n=Ui(t);return Fo(n)&&(n=void 0),Fo(e)?Qn(e,al(t,1,Fo,!0),$a(n,2)):[]}),Ii=Fl(function(e,t){var n=Ui(t);return Fo(n)&&(n=void 0),Fo(e)?Qn(e,al(t,1,Fo,!0),void 0,n):[]});function wi(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)),pt(e,$a(t,3),a)}function Ri(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)),pt(e,$a(t,3),a,!0)}function xi(e){return null!=e&&e.length?al(e,1):[]}function Mi(e){return e&&e.length?e[0]:void 0}var Pi=Fl(function(e){var t=ut(e,la);return t.length&&t[0]===e[0]?fl(t):[]}),Fi=Fl(function(e){var t=Ui(e),n=ut(e,la);return t===Ui(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?fl(n,$a(t,2)):[]}),Bi=Fl(function(e){var t=Ui(e),n=ut(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?fl(n,void 0,t):[]});function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var ki=Fl(Vi);function Vi(e,t){return e&&e.length&&t&&t.length?Rl(e,t):e}var Hi=Wa(function(e,t){var n=null==e?0:e.length,l=qn(e,t);return xl(e,ut(t,function(e){return ai(e,n)?+e:e}).sort(ma)),l});function Wi(e){return null==e?e:cn.call(e)}var ji=Fl(function(e){return Xl(al(e,1,Fo,!0))}),Yi=Fl(function(e){var t=Ui(e);return Fo(t)&&(t=void 0),Xl(al(e,1,Fo,!0),$a(t,2))}),Gi=Fl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Xl(al(e,1,Fo,!0),void 0,t)});function zi(e){if(!e||!e.length)return[];var t=0;return e=it(e,function(e){if(Fo(e))return t=an(e.length,t),!0}),Dt(t,function(t){return ut(e,St(t))})}function qi(e,t){if(!e||!e.length)return[];var n=zi(e);return null==t?n:ut(n,function(e){return et(t,void 0,e)})}var $i=Fl(function(e,t){return Fo(e)?Qn(e,t):[]}),Ki=Fl(function(e){return ta(it(e,Fo))}),Xi=Fl(function(e){var t=Ui(e);return Fo(t)&&(t=void 0),ta(it(e,Fo),$a(t,2))}),Zi=Fl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,ta(it(e,Fo),void 0,t)}),Qi=Fl(zi),Ji=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,qi(e,n)});function eo(e){var t=Nn(e);return t.__chain__=!0,t}function to(e,t){return t(e)}var no=Wa(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return qn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof wn&&ai(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:to,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)}),lo=ga(function(e,t,n){Ce.call(e,n)?++e[n]:zn(e,n,1)}),ao=Da(wi),io=Da(Ri);function oo(e,t){return(xo(e)?nt:Jn)(e,$a(t,3))}function ro(e,t){return(xo(e)?lt:el)(e,$a(t,3))}var uo=ga(function(e,t,n){Ce.call(e,n)?e[n].push(t):zn(e,n,[t])}),so=Fl(function(e,t,n){var l=-1,a="function"==typeof t,i=Po(e)?z(e.length):[];return Jn(e,function(e){i[++l]=a?et(t,e,n):gl(e,t,n)}),i}),co=ga(function(e,t,n){zn(e,n,t)});function mo(e,t){return(xo(e)?ut:bl)(e,$a(t,3))}var vo=ga(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Eo=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&ii(e,t[0],t[1])?t=[]:n>2&&ii(t[0],t[1],t[2])&&(t=[t[0]]),Il(e,al(t,1),[])}),po=Kt||function(){return We.Date.now()};function fo(e,t,n){return t=n?void 0:t,Ba(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function go(e,t){var l;if("function"!=typeof t)throw new fe(n);return e=lr(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var _o=Fl(function(e,t,n){var l=1;if(n.length){var a=kt(n,qa(_o));l|=32}return Ba(e,l,t,n,a)}),ho=Fl(function(e,t,n){var l=3;if(n.length){var a=kt(n,qa(ho));l|=32}return Ba(t,l,e,n,a)});function So(e,t,l){var a,i,o,r,u,s,c=0,d=!1,m=!1,v=!0;if("function"!=typeof e)throw new fe(n);function E(t){var n=a,l=i;return a=i=void 0,c=t,r=e.apply(l,n)}function p(e){return c=e,u=gi(g,t),d?E(e):r}function f(e){var n=e-s;return void 0===s||n>=t||n<0||m&&e-c>=o}function g(){var e=po();if(f(e))return _(e);u=gi(g,function(e){var n=t-(e-s);return m?on(n,o-(e-c)):n}(e))}function _(e){return u=void 0,v&&a?E(e):(a=i=void 0,r)}function h(){var e=po(),n=f(e);if(a=arguments,i=this,s=e,n){if(void 0===u)return p(s);if(m)return ua(u),u=gi(g,t),E(s)}return void 0===u&&(u=gi(g,t)),r}return t=ir(t)||0,jo(l)&&(d=!!l.leading,o=(m="maxWait"in l)?an(ir(l.maxWait)||0,t):o,v="trailing"in l?!!l.trailing:v),h.cancel=function(){void 0!==u&&ua(u),c=0,a=s=i=u=void 0},h.flush=function(){return void 0===u?r:_(po())},h}var Co=Fl(function(e,t){return Zn(e,1,t)}),yo=Fl(function(e,t,n){return Zn(e,ir(t)||0,n)});function To(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new fe(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=l.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return l.cache=i.set(a,o)||i,o};return l.cache=new(To.Cache||Mn),l}function Do(e){if("function"!=typeof e)throw new fe(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)}}To.Cache=Mn;var bo=oa(function(e,t){var n=(t=1==t.length&&xo(t[0])?ut(t[0],At($a())):ut(al(t,1),At($a()))).length;return Fl(function(l){for(var a=-1,i=on(l.length,n);++a<i;)l[a]=t[a].call(this,l[a]);return et(e,this,l)})}),Ao=Fl(function(e,t){return Ba(e,32,void 0,t,kt(t,qa(Ao)))}),No=Fl(function(e,t){return Ba(e,64,void 0,t,kt(t,qa(No)))}),Lo=Wa(function(e,t){return Ba(e,256,void 0,void 0,void 0,t)});function Oo(e,t){return e===t||e!=e&&t!=t}var Io=Ra(vl),wo=Ra(function(e,t){return e>=t}),Ro=_l(function(){return arguments}())?_l:function(e){return Yo(e)&&Ce.call(e,"callee")&&!ze.call(e,"callee")},xo=z.isArray,Mo=$e?At($e):function(e){return Yo(e)&&ml(e)==S};function Po(e){return null!=e&&Wo(e.length)&&!Vo(e)}function Fo(e){return Yo(e)&&Po(e)}var Bo=en||iu,Uo=Ke?At(Ke):function(e){return Yo(e)&&ml(e)==u};function ko(e){if(!Yo(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qo(e)}function Vo(e){if(!jo(e))return!1;var t=ml(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ho(e){return"number"==typeof e&&e==lr(e)}function Wo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function jo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Yo(e){return null!=e&&"object"==typeof e}var Go=Xe?At(Xe):function(e){return Yo(e)&&ei(e)==m};function zo(e){return"number"==typeof e||Yo(e)&&ml(e)==v}function qo(e){if(!Yo(e)||ml(e)!=E)return!1;var t=je(e);if(null===t)return!0;var n=Ce.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==be}var $o=Ze?At(Ze):function(e){return Yo(e)&&ml(e)==p},Ko=Qe?At(Qe):function(e){return Yo(e)&&ei(e)==f};function Xo(e){return"string"==typeof e||!xo(e)&&Yo(e)&&ml(e)==g}function Zo(e){return"symbol"==typeof e||Yo(e)&&ml(e)==_}var Qo=Je?At(Je):function(e){return Yo(e)&&Wo(e.length)&&!!Pe[ml(e)]},Jo=Ra(Dl),er=Ra(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Po(e))return Xo(e)?jt(e):pa(e);if(Ct&&e[Ct])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ct]());var t=ei(e);return(t==m?Bt:t==f?Vt:Or)(e)}function nr(e){return e?(e=ir(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?$n(lr(e),0,4294967295):0}function ir(e){if("number"==typeof e)return e;if(Zo(e))return NaN;if(jo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=jo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=bt(e);var n=ne.test(e);return n||ae.test(e)?ke(e.slice(2),n?2:8):te.test(e)?NaN:+e}function or(e){return fa(e,Cr(e))}function rr(e){return null==e?"":Kl(e)}var ur=_a(function(e,t){if(si(t)||Po(t))fa(t,Sr(t),e);else for(var n in t)Ce.call(t,n)&&Wn(e,n,t[n])}),sr=_a(function(e,t){fa(t,Cr(t),e)}),cr=_a(function(e,t,n,l){fa(t,Cr(t),e,l)}),dr=_a(function(e,t,n,l){fa(t,Sr(t),e,l)}),mr=Wa(qn),vr=Fl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&ii(t[0],t[1],a)&&(l=1);++n<l;)for(var i=t[n],o=Cr(i),r=-1,u=o.length;++r<u;){var s=o[r],c=e[s];(void 0===c||Oo(c,_e[s])&&!Ce.call(e,s))&&(e[s]=i[s])}return e}),Er=Fl(function(e){return e.push(void 0,ka),et(Tr,void 0,e)});function pr(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function fr(e,t){return null!=e&&ti(e,t,pl)}var gr=Na(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=n},jr(zr)),_r=Na(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),Ce.call(e,t)?e[t].push(n):e[t]=[n]},$a),hr=Fl(gl);function Sr(e){return Po(e)?Bn(e):Tl(e)}function Cr(e){return Po(e)?Bn(e,!0):function(e){if(!jo(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=si(e),n=[];for(var l in e)("constructor"!=l||!t&&Ce.call(e,l))&&n.push(l);return n}(e)}var yr=_a(function(e,t,n){Ll(e,t,n)}),Tr=_a(function(e,t,n,l){Ll(e,t,n,l)}),Dr=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=ia(t,e),l||(l=t.length>1),t}),fa(e,Ya(e),n),l&&(n=Kn(n,7,Va));for(var a=t.length;a--;)Zl(n,t[a]);return n}),br=Wa(function(e,t){return null==e?{}:function(e,t){return wl(e,t,function(t,n){return fr(e,n)})}(e,t)});function Ar(e,t){if(null==e)return{};var n=ut(Ya(e),function(e){return[e]});return t=$a(t),wl(e,n,function(e,n){return t(e,n[0])})}var Nr=Fa(Sr),Lr=Fa(Cr);function Or(e){return null==e?[]:Nt(e,Sr(e))}var Ir=ya(function(e,t,n){return t=t.toLowerCase(),e+(n?wr(t):t)});function wr(e){return kr(rr(e).toLowerCase())}function Rr(e){return(e=rr(e))&&e.replace(oe,Rt).replace(Le,"")}var xr=ya(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=ya(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Pr=Ca("toLowerCase"),Fr=ya(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Br=ya(function(e,t,n){return e+(n?" ":"")+kr(t)}),Ur=ya(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),kr=Ca("toUpperCase");function Vr(e,t,n){return e=rr(e),void 0===(t=n?void 0:t)?function(e){return Re.test(e)}(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Hr=Fl(function(e,t){try{return et(e,void 0,t)}catch(e){return ko(e)?e:new ce(e)}}),Wr=Wa(function(e,t){return nt(t,function(t){t=bi(t),zn(e,t,_o(e[t],e))}),e});function jr(e){return function(){return e}}var Yr=ba(),Gr=ba(!0);function zr(e){return e}function qr(e){return yl("function"==typeof e?e:Kn(e,1))}var $r=Fl(function(e,t){return function(n){return gl(n,e,t)}}),Kr=Fl(function(e,t){return function(n){return gl(e,n,t)}});function Xr(e,t,n){var l=Sr(t),a=sl(t,l);null!=n||jo(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=sl(t,Sr(t)));var i=!(jo(n)&&"chain"in n&&!n.chain),o=Vo(e);return nt(a,function(n){var l=t[n];e[n]=l,o&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),a=n.__actions__=pa(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 Qr=Oa(ut),Jr=Oa(at),eu=Oa(mt);function tu(e){return oi(e)?St(bi(e)):function(e){return function(t){return cl(t,e)}}(e)}var nu=wa(),lu=wa(!0);function au(){return[]}function iu(){return!1}var ou,ru=La(function(e,t){return e+t},0),uu=Ma("ceil"),su=La(function(e,t){return e/t},1),cu=Ma("floor"),du=La(function(e,t){return e*t},1),mu=Ma("round"),vu=La(function(e,t){return e-t},0);return Nn.after=function(e,t){if("function"!=typeof t)throw new fe(n);return e=lr(e),function(){if(--e<1)return t.apply(this,arguments)}},Nn.ary=fo,Nn.assign=ur,Nn.assignIn=sr,Nn.assignInWith=cr,Nn.assignWith=dr,Nn.at=mr,Nn.before=go,Nn.bind=_o,Nn.bindAll=Wr,Nn.bindKey=ho,Nn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return xo(e)?e:[e]},Nn.chain=eo,Nn.chunk=function(e,t,n){t=(n?ii(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,i=0,o=z(Zt(l/t));a<l;)o[i++]=jl(e,a,a+=t);return o},Nn.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var i=e[t];i&&(a[l++]=i)}return a},Nn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=z(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(xo(n)?pa(n):[n],al(t,1))},Nn.cond=function(e){var t=null==e?0:e.length,l=$a();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new fe(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)}})},Nn.conforms=function(e){return function(e){var t=Sr(e);return function(n){return Xn(n,e,t)}}(Kn(e,1))},Nn.constant=jr,Nn.countBy=lo,Nn.create=function(e,t){var n=Ln(e);return null==t?n:Gn(n,t)},Nn.curry=function e(t,n,l){var a=Ba(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},Nn.curryRight=function e(t,n,l){var a=Ba(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},Nn.debounce=So,Nn.defaults=vr,Nn.defaultsDeep=Er,Nn.defer=Co,Nn.delay=yo,Nn.difference=Li,Nn.differenceBy=Oi,Nn.differenceWith=Ii,Nn.drop=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,(t=n||void 0===t?1:lr(t))<0?0:t,l):[]},Nn.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,0,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t):[]},Nn.dropRightWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!0,!0):[]},Nn.dropWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!0):[]},Nn.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&ii(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)):[]},Nn.filter=function(e,t){return(xo(e)?it:ll)(e,$a(t,3))},Nn.flatMap=function(e,t){return al(mo(e,t),1)},Nn.flatMapDeep=function(e,t){return al(mo(e,t),1/0)},Nn.flatMapDepth=function(e,t,n){return n=void 0===n?1:lr(n),al(mo(e,t),n)},Nn.flatten=xi,Nn.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},Nn.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:lr(t)):[]},Nn.flip=function(e){return Ba(e,512)},Nn.flow=Yr,Nn.flowRight=Gr,Nn.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},Nn.functions=function(e){return null==e?[]:sl(e,Sr(e))},Nn.functionsIn=function(e){return null==e?[]:sl(e,Cr(e))},Nn.groupBy=uo,Nn.initial=function(e){return null!=e&&e.length?jl(e,0,-1):[]},Nn.intersection=Pi,Nn.intersectionBy=Fi,Nn.intersectionWith=Bi,Nn.invert=gr,Nn.invertBy=_r,Nn.invokeMap=so,Nn.iteratee=qr,Nn.keyBy=co,Nn.keys=Sr,Nn.keysIn=Cr,Nn.map=mo,Nn.mapKeys=function(e,t){var n={};return t=$a(t,3),rl(e,function(e,l,a){zn(n,t(e,l,a),e)}),n},Nn.mapValues=function(e,t){var n={};return t=$a(t,3),rl(e,function(e,l,a){zn(n,l,t(e,l,a))}),n},Nn.matches=function(e){return Al(Kn(e,1))},Nn.matchesProperty=function(e,t){return Nl(e,Kn(t,1))},Nn.memoize=To,Nn.merge=yr,Nn.mergeWith=Tr,Nn.method=$r,Nn.methodOf=Kr,Nn.mixin=Xr,Nn.negate=Do,Nn.nthArg=function(e){return e=lr(e),Fl(function(t){return Ol(t,e)})},Nn.omit=Dr,Nn.omitBy=function(e,t){return Ar(e,Do($a(t)))},Nn.once=function(e){return go(2,e)},Nn.orderBy=function(e,t,n,l){return null==e?[]:(xo(t)||(t=null==t?[]:[t]),xo(n=l?void 0:n)||(n=null==n?[]:[n]),Il(e,t,n))},Nn.over=Qr,Nn.overArgs=bo,Nn.overEvery=Jr,Nn.overSome=eu,Nn.partial=Ao,Nn.partialRight=No,Nn.partition=vo,Nn.pick=br,Nn.pickBy=Ar,Nn.property=tu,Nn.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},Nn.pull=ki,Nn.pullAll=Vi,Nn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Rl(e,t,$a(n,2)):e},Nn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Rl(e,t,void 0,n):e},Nn.pullAt=Hi,Nn.range=nu,Nn.rangeRight=lu,Nn.rearg=Lo,Nn.reject=function(e,t){return(xo(e)?it:ll)(e,Do($a(t,3)))},Nn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],i=e.length;for(t=$a(t,3);++l<i;){var o=e[l];t(o,l,e)&&(n.push(o),a.push(l))}return xl(e,a),n},Nn.rest=function(e,t){if("function"!=typeof e)throw new fe(n);return Fl(e,t=void 0===t?t:lr(t))},Nn.reverse=Wi,Nn.sampleSize=function(e,t,n){return t=(n?ii(e,t,n):void 0===t)?1:lr(t),(xo(e)?kn:Ul)(e,t)},Nn.set=function(e,t,n){return null==e?e:kl(e,t,n)},Nn.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:kl(e,t,n,l)},Nn.shuffle=function(e){return(xo(e)?Vn:Wl)(e)},Nn.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&ii(e,t,n)?(t=0,n=l):(t=null==t?0:lr(t),n=void 0===n?l:lr(n)),jl(e,t,n)):[]},Nn.sortBy=Eo,Nn.sortedUniq=function(e){return e&&e.length?ql(e):[]},Nn.sortedUniqBy=function(e,t){return e&&e.length?ql(e,$a(t,2)):[]},Nn.split=function(e,t,n){return n&&"number"!=typeof n&&ii(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!$o(t))&&!(t=Kl(t))&&Pt(e)?ra(jt(e),0,n):e.split(t,n):[]},Nn.spread=function(e,t){if("function"!=typeof e)throw new fe(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)})},Nn.tail=function(e){var t=null==e?0:e.length;return t?jl(e,1,t):[]},Nn.take=function(e,t,n){return e&&e.length?jl(e,0,(t=n||void 0===t?1:lr(t))<0?0:t):[]},Nn.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?jl(e,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t,l):[]},Nn.takeRightWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3),!1,!0):[]},Nn.takeWhile=function(e,t){return e&&e.length?Jl(e,$a(t,3)):[]},Nn.tap=function(e,t){return t(e),e},Nn.throttle=function(e,t,l){var a=!0,i=!0;if("function"!=typeof e)throw new fe(n);return jo(l)&&(a="leading"in l?!!l.leading:a,i="trailing"in l?!!l.trailing:i),So(e,t,{leading:a,maxWait:t,trailing:i})},Nn.thru=to,Nn.toArray=tr,Nn.toPairs=Nr,Nn.toPairsIn=Lr,Nn.toPath=function(e){return xo(e)?ut(e,bi):Zo(e)?[e]:pa(Di(rr(e)))},Nn.toPlainObject=or,Nn.transform=function(e,t,n){var l=xo(e),a=l||Bo(e)||Qo(e);if(t=$a(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:jo(e)&&Vo(i)?Ln(je(e)):{}}return(a?nt:rl)(e,function(e,l,a){return t(n,e,l,a)}),n},Nn.unary=function(e){return fo(e,1)},Nn.union=ji,Nn.unionBy=Yi,Nn.unionWith=Gi,Nn.uniq=function(e){return e&&e.length?Xl(e):[]},Nn.uniqBy=function(e,t){return e&&e.length?Xl(e,$a(t,2)):[]},Nn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xl(e,void 0,t):[]},Nn.unset=function(e,t){return null==e||Zl(e,t)},Nn.unzip=zi,Nn.unzipWith=qi,Nn.update=function(e,t,n){return null==e?e:Ql(e,t,aa(n))},Nn.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ql(e,t,aa(n),l)},Nn.values=Or,Nn.valuesIn=function(e){return null==e?[]:Nt(e,Cr(e))},Nn.without=$i,Nn.words=Vr,Nn.wrap=function(e,t){return Ao(aa(t),e)},Nn.xor=Ki,Nn.xorBy=Xi,Nn.xorWith=Zi,Nn.zip=Qi,Nn.zipObject=function(e,t){return na(e||[],t||[],Wn)},Nn.zipObjectDeep=function(e,t){return na(e||[],t||[],kl)},Nn.zipWith=Ji,Nn.entries=Nr,Nn.entriesIn=Lr,Nn.extend=sr,Nn.extendWith=cr,Xr(Nn,Nn),Nn.add=ru,Nn.attempt=Hr,Nn.camelCase=Ir,Nn.capitalize=wr,Nn.ceil=uu,Nn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=ir(n))==n?n:0),void 0!==t&&(t=(t=ir(t))==t?t:0),$n(ir(e),t,n)},Nn.clone=function(e){return Kn(e,4)},Nn.cloneDeep=function(e){return Kn(e,5)},Nn.cloneDeepWith=function(e,t){return Kn(e,5,t="function"==typeof t?t:void 0)},Nn.cloneWith=function(e,t){return Kn(e,4,t="function"==typeof t?t:void 0)},Nn.conformsTo=function(e,t){return null==t||Xn(e,t,Sr(t))},Nn.deburr=Rr,Nn.defaultTo=function(e,t){return null==e||e!=e?t:e},Nn.divide=su,Nn.endsWith=function(e,t,n){e=rr(e),t=Kl(t);var l=e.length,a=n=void 0===n?l:$n(lr(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},Nn.eq=Oo,Nn.escape=function(e){return(e=rr(e))&&F.test(e)?e.replace(M,xt):e},Nn.escapeRegExp=function(e){return(e=rr(e))&&Y.test(e)?e.replace(j,"\\$&"):e},Nn.every=function(e,t,n){var l=xo(e)?at:tl;return n&&ii(e,t,n)&&(t=void 0),l(e,$a(t,3))},Nn.find=ao,Nn.findIndex=wi,Nn.findKey=function(e,t){return Et(e,$a(t,3),rl)},Nn.findLast=io,Nn.findLastIndex=Ri,Nn.findLastKey=function(e,t){return Et(e,$a(t,3),ul)},Nn.floor=cu,Nn.forEach=oo,Nn.forEachRight=ro,Nn.forIn=function(e,t){return null==e?e:il(e,$a(t,3),Cr)},Nn.forInRight=function(e,t){return null==e?e:ol(e,$a(t,3),Cr)},Nn.forOwn=function(e,t){return e&&rl(e,$a(t,3))},Nn.forOwnRight=function(e,t){return e&&ul(e,$a(t,3))},Nn.get=pr,Nn.gt=Io,Nn.gte=wo,Nn.has=function(e,t){return null!=e&&ti(e,t,El)},Nn.hasIn=fr,Nn.head=Mi,Nn.identity=zr,Nn.includes=function(e,t,n,l){e=Po(e)?e:Or(e),n=n&&!l?lr(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Xo(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&ft(e,t,n)>-1},Nn.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)),ft(e,t,a)},Nn.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=ir(e),t,n)},Nn.invoke=hr,Nn.isArguments=Ro,Nn.isArray=xo,Nn.isArrayBuffer=Mo,Nn.isArrayLike=Po,Nn.isArrayLikeObject=Fo,Nn.isBoolean=function(e){return!0===e||!1===e||Yo(e)&&ml(e)==r},Nn.isBuffer=Bo,Nn.isDate=Uo,Nn.isElement=function(e){return Yo(e)&&1===e.nodeType&&!qo(e)},Nn.isEmpty=function(e){if(null==e)return!0;if(Po(e)&&(xo(e)||"string"==typeof e||"function"==typeof e.splice||Bo(e)||Qo(e)||Ro(e)))return!e.length;var t=ei(e);if(t==m||t==f)return!e.size;if(si(e))return!Tl(e).length;for(var n in e)if(Ce.call(e,n))return!1;return!0},Nn.isEqual=function(e,t){return hl(e,t)},Nn.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?hl(e,t,void 0,n):!!l},Nn.isError=ko,Nn.isFinite=function(e){return"number"==typeof e&&tn(e)},Nn.isFunction=Vo,Nn.isInteger=Ho,Nn.isLength=Wo,Nn.isMap=Go,Nn.isMatch=function(e,t){return e===t||Sl(e,t,Xa(t))},Nn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sl(e,t,Xa(t),n)},Nn.isNaN=function(e){return zo(e)&&e!=+e},Nn.isNative=function(e){if(ui(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Cl(e)},Nn.isNil=function(e){return null==e},Nn.isNull=function(e){return null===e},Nn.isNumber=zo,Nn.isObject=jo,Nn.isObjectLike=Yo,Nn.isPlainObject=qo,Nn.isRegExp=$o,Nn.isSafeInteger=function(e){return Ho(e)&&e>=-9007199254740991&&e<=9007199254740991},Nn.isSet=Ko,Nn.isString=Xo,Nn.isSymbol=Zo,Nn.isTypedArray=Qo,Nn.isUndefined=function(e){return void 0===e},Nn.isWeakMap=function(e){return Yo(e)&&ei(e)==h},Nn.isWeakSet=function(e){return Yo(e)&&"[object WeakSet]"==ml(e)},Nn.join=function(e,t){return null==e?"":nn.call(e,t)},Nn.kebabCase=xr,Nn.last=Ui,Nn.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):pt(e,_t,a,!0)},Nn.lowerCase=Mr,Nn.lowerFirst=Pr,Nn.lt=Jo,Nn.lte=er,Nn.max=function(e){return e&&e.length?nl(e,zr,vl):void 0},Nn.maxBy=function(e,t){return e&&e.length?nl(e,$a(t,2),vl):void 0},Nn.mean=function(e){return ht(e,zr)},Nn.meanBy=function(e,t){return ht(e,$a(t,2))},Nn.min=function(e){return e&&e.length?nl(e,zr,Dl):void 0},Nn.minBy=function(e,t){return e&&e.length?nl(e,$a(t,2),Dl):void 0},Nn.stubArray=au,Nn.stubFalse=iu,Nn.stubObject=function(){return{}},Nn.stubString=function(){return""},Nn.stubTrue=function(){return!0},Nn.multiply=du,Nn.nth=function(e,t){return e&&e.length?Ol(e,lr(t)):void 0},Nn.noConflict=function(){return We._===this&&(We._=Ae),this},Nn.noop=Zr,Nn.now=po,Nn.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(Qt(a),n)+e+Ia(Zt(a),n)},Nn.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},Nn.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},Nn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(rr(e).replace(G,""),t||0)},Nn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&ii(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+Ue("1e-"+((a+"").length-1))),t)}return Ml(e,t)},Nn.reduce=function(e,t,n){var l=xo(e)?ct:yt,a=arguments.length<3;return l(e,$a(t,4),n,a,Jn)},Nn.reduceRight=function(e,t,n){var l=xo(e)?dt:yt,a=arguments.length<3;return l(e,$a(t,4),n,a,el)},Nn.repeat=function(e,t,n){return t=(n?ii(e,t,n):void 0===t)?1:lr(t),Pl(rr(e),t)},Nn.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Nn.result=function(e,t,n){var l=-1,a=(t=ia(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var i=null==e?void 0:e[bi(t[l])];void 0===i&&(l=a,i=n),e=Vo(i)?i.call(e):i}return e},Nn.round=mu,Nn.runInContext=e,Nn.sample=function(e){return(xo(e)?Un:Bl)(e)},Nn.size=function(e){if(null==e)return 0;if(Po(e))return Xo(e)?Wt(e):e.length;var t=ei(e);return t==m||t==f?e.size:Tl(e).length},Nn.snakeCase=Fr,Nn.some=function(e,t,n){var l=xo(e)?mt:Yl;return n&&ii(e,t,n)&&(t=void 0),l(e,$a(t,3))},Nn.sortedIndex=function(e,t){return Gl(e,t)},Nn.sortedIndexBy=function(e,t,n){return zl(e,t,$a(n,2))},Nn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Gl(e,t);if(l<n&&Oo(e[l],t))return l}return-1},Nn.sortedLastIndex=function(e,t){return Gl(e,t,!0)},Nn.sortedLastIndexBy=function(e,t,n){return zl(e,t,$a(n,2),!0)},Nn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Gl(e,t,!0)-1;if(Oo(e[n],t))return n}return-1},Nn.startCase=Br,Nn.startsWith=function(e,t,n){return e=rr(e),n=null==n?0:$n(lr(n),0,e.length),t=Kl(t),e.slice(n,n+t.length)==t},Nn.subtract=vu,Nn.sum=function(e){return e&&e.length?Tt(e,zr):0},Nn.sumBy=function(e,t){return e&&e.length?Tt(e,$a(t,2)):0},Nn.template=function(e,t,n){var l=Nn.templateSettings;n&&ii(e,t,n)&&(t=void 0),e=rr(e),t=cr({},t,l,Ua);var a,i,o=cr({},t.imports,l.imports,Ua),r=Sr(o),u=Nt(o,r),s=0,c=t.interpolate||re,d="__p += '",m=Ee((t.escape||re).source+"|"+c.source+"|"+(c===k?J:re).source+"|"+(t.evaluate||re).source+"|$","g"),v="//# sourceURL="+(Ce.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(m,function(t,n,l,o,r,u){return l||(l=o),d+=e.slice(s,u).replace(ue,Mt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(i=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),d+="';\n";var E=Ce.call(t,"variable")&&t.variable;if(E){if(Z.test(E))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(i?d.replace(I,""):d).replace(w,"$1").replace(R,"$1;"),d="function("+(E||"obj")+") {\n"+(E?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var p=Hr(function(){return de(r,v+"return "+d).apply(void 0,u)});if(p.source=d,ko(p))throw p;return p},Nn.times=function(e,t){if((e=lr(e))<1||e>9007199254740991)return[];var n=4294967295,l=on(e,4294967295);e-=4294967295;for(var a=Dt(l,t=$a(t));++n<e;)t(n);return a},Nn.toFinite=nr,Nn.toInteger=lr,Nn.toLength=ar,Nn.toLower=function(e){return rr(e).toLowerCase()},Nn.toNumber=ir,Nn.toSafeInteger=function(e){return e?$n(lr(e),-9007199254740991,9007199254740991):0===e?e:0},Nn.toString=rr,Nn.toUpper=function(e){return rr(e).toUpperCase()},Nn.trim=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return bt(e);if(!e||!(t=Kl(t)))return e;var l=jt(e),a=jt(t);return ra(l,Ot(l,a),It(l,a)+1).join("")},Nn.trimEnd=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.slice(0,Yt(e)+1);if(!e||!(t=Kl(t)))return e;var l=jt(e);return ra(l,0,It(l,jt(t))+1).join("")},Nn.trimStart=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=Kl(t)))return e;var l=jt(e);return ra(l,Ot(l,jt(t))).join("")},Nn.truncate=function(e,t){var n=30,l="...";if(jo(t)){var a="separator"in t?t.separator:a;n="length"in t?lr(t.length):n,l="omission"in t?Kl(t.omission):l}var i=(e=rr(e)).length;if(Pt(e)){var o=jt(e);i=o.length}if(n>=i)return e;var r=n-Wt(l);if(r<1)return l;var u=o?ra(o,0,r).join(""):e.slice(0,r);if(void 0===a)return u+l;if(o&&(r+=u.length-r),$o(a)){if(e.slice(r).search(a)){var s,c=u;for(a.global||(a=Ee(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(Kl(a),r)!=r){var m=u.lastIndexOf(a);m>-1&&(u=u.slice(0,m))}return u+l},Nn.unescape=function(e){return(e=rr(e))&&P.test(e)?e.replace(x,Gt):e},Nn.uniqueId=function(e){var t=++ye;return rr(e)+t},Nn.upperCase=Ur,Nn.upperFirst=kr,Nn.each=oo,Nn.eachRight=ro,Nn.first=Mi,Xr(Nn,(ou={},rl(Nn,function(e,t){Ce.call(Nn.prototype,t)||(ou[t]=e)}),ou),{chain:!1}),Nn.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Nn[e].placeholder=Nn}),nt(["drop","take"],function(e,t){wn.prototype[e]=function(n){n=void 0===n?1:an(lr(n),0);var l=this.__filtered__&&!t?new wn(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},wn.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;wn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$a(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),nt(["head","last"],function(e,t){var n="take"+(t?"Right":"");wn.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");wn.prototype[e]=function(){return this.__filtered__?new wn(this):this[n](1)}}),wn.prototype.compact=function(){return this.filter(zr)},wn.prototype.find=function(e){return this.filter(e).head()},wn.prototype.findLast=function(e){return this.reverse().find(e)},wn.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new wn(this):this.map(function(n){return gl(n,e,t)})}),wn.prototype.reject=function(e){return this.filter(Do($a(e)))},wn.prototype.slice=function(e,t){e=lr(e);var n=this;return n.__filtered__&&(e>0||t<0)?new wn(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)},wn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},wn.prototype.toArray=function(){return this.take(4294967295)},rl(wn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=Nn[l?"take"+("last"==t?"Right":""):t],i=l||/^find/.test(t);a&&(Nn.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof wn,u=o[0],s=r||xo(t),c=function(e){var t=a.apply(Nn,st([e],o));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=i&&!d,E=r&&!m;if(!i&&s){t=E?t:new wn(this);var p=e.apply(t,o);return p.__actions__.push({func:to,args:[c],thisArg:void 0}),new In(p,d)}return v&&E?e.apply(this,o):(p=this.thru(c),v?l?p.value()[0]:p.value():p)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ge[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);Nn.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(xo(a)?a:[],e)}return this[n](function(n){return t.apply(xo(n)?n:[],e)})}}),rl(wn.prototype,function(e,t){var n=Nn[t];if(n){var l=n.name+"";Ce.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Aa(void 0,2).name]=[{name:"wrapper",func:void 0}],wn.prototype.clone=function(){var e=new wn(this.__wrapped__);return e.__actions__=pa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=pa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=pa(this.__views__),e},wn.prototype.reverse=function(){if(this.__filtered__){var e=new wn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},wn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=xo(e),l=t<0,a=n?e.length:0,i=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var i=n[l],o=i.size;switch(i.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=on(t,e+o);break;case"takeRight":e=an(e,t-o)}}return{start:e,end:t}}(0,a,this.__views__),o=i.start,r=i.end,u=r-o,s=l?r:o-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 E=[];e:for(;u--&&m<v;){for(var p=-1,f=e[s+=t];++p<d;){var g=c[p],_=g.type,h=(0,g.iteratee)(f);if(2==_)f=h;else if(!h){if(1==_)continue e;break e}}E[m++]=f}return E},Nn.prototype.at=no,Nn.prototype.chain=function(){return eo(this)},Nn.prototype.commit=function(){return new In(this.value(),this.__chain__)},Nn.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__++]}},Nn.prototype.plant=function(e){for(var t,n=this;n instanceof On;){var l=Ni(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},Nn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof wn){var t=e;return this.__actions__.length&&(t=new wn(this)),(t=t.reverse()).__actions__.push({func:to,args:[Wi],thisArg:void 0}),new In(t,this.__chain__)}return this.thru(Wi)},Nn.prototype.toJSON=Nn.prototype.valueOf=Nn.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},Nn.prototype.first=Nn.prototype.head,Ct&&(Nn.prototype[Ct]=function(){return this}),Nn}();Ye?((Ye.exports=zt)._=zt,je._=zt):We._=zt}).call(Ft)});const Yl=e=>{var t,a;let{t:i,formData:o,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,E]=n.useState((null==o||null===(a=o.documents)||void 0===a?void 0:a.documents)||[]),[p,f]=n.useState(null),[g,_]=n.useState([]),[h,S]=n.useState(!0),[C,y]=n.useState(!1),[T,D]=n.useState(!1),{isLoading:b,data:A}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:N,data:L}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var i,o;null!=A&&null!==(e=A.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==A||null===(i=A.BPA)||void 0===i||null===(o=i.DocTypeMapping)||void 0===o?void 0:o.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 i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==L||null===(t=L["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,i.length);i===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;i===`${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)),_(s)},[!b,!N]),n.useEffect(()=>{let e=0;g.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,C]),n.useEffect(()=>{D("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[r,s]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==g?void 0:g.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(Gl,{key:t,index:t,document:e,t:i,error:p,setError:f,setDocuments:E,documents:v,setCheckRequiredFields:y,applicationStatus:c,actions:d,bpaTaxDocuments:g,checkEnablingDocs:T}))))};function Gl(e){var a,i;let{t:o,document:r,setDocuments:u,documents:s,index:c,bpaTaxDocuments:d,checkEnablingDocs:m}=e;const v=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(),[p,f]=n.useState(v?{...v,active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}:1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[g,_]=n.useState(null),[h,S]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[C,y]=n.useState([]);return n.useEffect(()=>{null!=p&&p.code&&u(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==p?void 0:p.code));return 0===(null==h?void 0:h.length)||null===h?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==h),{documentType:null==p?void 0:p.code,fileStoreId:h,documentUid:h,fileName:(null==g?void 0:g.name)||"",id:s?null===(t=s.find(e=>e.documentType===(null==p?void 0:p.code)))||void 0===t?void 0:t.id:void 0}]})},[h,p]),n.useEffect(()=>{try{C.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],C.map(e=>{var t,n,l;null!=p&&p.code&&r.newUploadedDocs.push({documentType:null==p?void 0:p.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})}),d[c]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)))}catch(e){Promise.reject(e)}},[C,p]),n.useEffect(()=>{},[g]),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"}},""+o(null==r?void 0:r.code)),(null==r||null===(i=r.uploadedDocuments)||void 0===i?void 0:i.length)&&l.createElement(jl,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?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?o(null==r?void 0:r.code)+"* ":""+o(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:o,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:p,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);var a;0!==Object.keys(n).length&&y(l),(a=l[l.length-1])&&_(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function zl(e){let{fiReport:n,isCitizen:i=!1}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(i?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+o("BPA_FI_REPORT")),n.map((e,a)=>{var i,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)?""+o("BPA_FI_REPORT"):`${o("BPA_FI_REPORT")} - ${a+1}`),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?`${null===(i=e.date)||void 0===i?void 0:i.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:""+o("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:""+o(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(jl,{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 ql(e){let{t:a,document:i,setNocDocuments:o,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==i?void 0:i.code)})[0],c=Digit.ULBService.getStateId(),[d,m]=n.useState(),[v,E]=n.useState(null),[p,f]=n.useState(()=>(null==s?void 0:s.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=i&&null!==(e=i.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&o(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==i||null===(t=i.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==p?void 0:p.length)||null===p?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==p),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:p,documentUid:p,fileName:(null==v?void 0:v.name)||""}]})},[p]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(v){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(v.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=v&&v.type&&!e.test(null==v?void 0:v.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=ct(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",v,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(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===(i=l.files[0])||void 0===i?void 0:i.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)}}()},[v]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=i&&i.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);var l;(l=n[n.length-1])&&E(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const $l=e=>{var a;let{t:i,noc:o,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)||"",E=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],{data:p}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[_,h]=n.useState([]),[S,C]=n.useState([]),[y,T]=n.useState(!1),[D,b]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[A,N]=n.useState(null),L=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;h(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,a=[];var i,r,c,d;l=u?null==p||null===(i=p.NOC)||void 0===i||null===(r=i.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==o?void 0:o.applicationType)&&(null==e?void 0:e.nocType)===(null==o?void 0:o.nocType)):null==f||null===(c=f.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==o?void 0:o.additionalDetails,applicationStatus:null==o?void 0:o.applicationStatus,appNumberLink:null==o?void 0:o.applicationNo,nocNo:null==o?void 0:o.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==_||_.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)}),C(m))},[p,_]),n.useEffect(()=>{T("NOC_VERIFICATION_INPROGRESS"===v&&(null==E?void 0:E.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:L?""+i(`BPA_${null==o?void 0:o.nocType}_HEADER`):i(`BPA_${null==o?void 0:o.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:L?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(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:L?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(jl,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),y&&(null==S?void 0:S.map((e,t)=>l.createElement(ql,{key:t,document:e,t:i,error:A,setError:N,setNocDocuments:b,nocDocuments:D,checkEnablingDocs:y}))))},Kl=e=>{let{permissions:a,t:i}=e;const[o,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[s,c,d]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const m=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},i("BPA_PERMIT_CONDITIONS")),null==o?void 0:o.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:m?"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==o?void 0:o.map((e,t)=>n===t?{...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:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:i("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:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...s];t.splice(e,1),c([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{c([...s,{label:""}])}}))};function Xl(e){let{documents:i,svgStyles:o={},isSendBackFlow:r=!1}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(()=>[]),[d,m]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==i||i.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),c(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[i]),n.useEffect(()=>{var e;null!=s&&s.length&&"BillAmend"===(null==i||null===(e=i[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(s,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=s&&s.length&&Digit.UploadServices.Filefetch(s,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[s]);const v=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),E=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!E&&(null==i?void 0:i.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:v?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,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===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a,i;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:v?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},u(null==e?void 0:e.title)),r?null!=e&&null!==(i=e.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),E&&(null==i?void 0:i.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"}},u(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)=>{var a;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],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"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(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"}},""+u(null==e?void 0:e.title))))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}function Zl(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:i}=n,{t:o}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:o("ES_PT_TITLE_TAX_HEADS"),text:o("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==i?void 0:i.map((e,n)=>l.createElement(t.Row,{key:o(e.taxHeadCode),label:o(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==i?void 0:i.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:o("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Ql(e){let{floors:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},i(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"}},i(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:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{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"})}))))}))}))}function Jl(e){let{owners:n}=e,i={};i=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:o}=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={...u,maxWidth:"950px"},u={...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"},i.map((e,n)=>{var a;return l.createElement("div",{key:o(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?`${o(null==e?void 0:e.title)} ${n+1}`:o(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:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{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",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const ea=e=>{var i,o,r,u,s,c,d,m,v,E,p,f,g,_,h,S,C,y,T,D,b,A,N;let{scrutinyDetails:L,paymentsList:O=[],additionalDetails:I,applicationData:w}=e;const R=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==w?void 0:w.status))&&window.location.href.includes("bpa"),[x,M]=n.useState(),[P,F]=n.useState(),[B,U]=n.useState(),k=Digit.ULBService.getStateId(),[V,H]=n.useState(),[W,j]=n.useState(),[Y,G]=n.useState([]),[z,q]=n.useState(),[$,K]=n.useState(""),[X,Z]=n.useState(null),[Q,J]=n.useState({}),ee={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))"}},[te,ne]=n.useState(!1),[le,ae]=n.useState(!1);n.useEffect(()=>{!function(){try{Z(null);const e=function(){if(z&&null!=z&&z.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==z||null===(t=z.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(z.size>=2e6)Z(ie("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=ct(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",z,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?G([...Y,{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}]):Z(ie("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else Z(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)}}()},[z]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(Y))},[Y]),n.useEffect(()=>{var e,t,n,l,a,i,o;if(null!=I&&null!==(e=I.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==I?void 0:I.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==I||null===(n=I.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==I||null===(l=I.lessAdjustmentFeeFiles[(null==I||null===(a=I.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,k).then(e=>J(null==e?void 0:e.data))}M(null==I||null===(t=I.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==I||null===(n=I.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),F(null==I||null===(l=I.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==I||null===(a=I.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==I||null===(i=I.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==I||null===(o=I.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),H(null==I?void 0:I.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==I?void 0:I.otherFeesDiscription),G(null==I?void 0:I.lessAdjustmentFeeFiles)},[I]);const{t:ie}=a.useTranslation(),oe=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!=L&&L.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==L||null===(i=L.values)||void 0===i?void 0:i.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?`${oe(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:oe(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==L||null===(o=L.permit)||void 0===o?void 0:o.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==L||null===(r=L.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!le&&l.createElement("div",{style:ee.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ae(!0)}},ie("SHOW_P1_FEES_DETAILS"))),le&&l.createElement("div",{style:ee.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ae(!1)}},ie("HIDE_P1_FEES_DETAILS"))),le&&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==I?void 0:I.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:ie("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==I?void 0:I.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==L||null===(u=L.values[0])||void 0===u?void 0:u.title)&&l.createElement("div",null,!te&&l.createElement("div",{style:ee.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ne(!0)}},ie("SHOW_P2_FEES_DETAILS"))),te&&l.createElement("div",{style:ee.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ne(!1)}},ie("HIDE_P2_FEES_DETAILS"))),te&&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==I||null===(s=I.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==I||null===(c=I.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==I||null===(d=I.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==I||null===(m=I.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==I||null===(v=I.selfCertificationCharges)||void 0===v?void 0:v.BPA_DEVELOPMENT_CHARGES)||0,value:x,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==I||null===(E=I.selfCertificationCharges)||void 0===E?void 0:E.BPA_OTHER_CHARGES)||0,value:P,disabled:!R,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(F(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(P)>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==I||null===(p=I.selfCertificationCharges)||void 0===p?void 0:p.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:V,disabled:!R,onChange:e=>{!function(e){H(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==I||null===(f=I.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(x)?parseFloat(x):0)+parseFloat(P?parseFloat(P):0)+parseFloat(null==I||null===(t=I.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==I||null===(n=I.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==I||null===(l=I.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==I||null===(a=I.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]),q(e.target.files[0])},disabled:!R,onDelete:()=>{j(null),q("")},message:W?"1 "+ie("FILEUPLOADED"):ie("ES_NO_FILE_SELECTED_LABEL"),error:X,uploadMessage:$})):null,(null==Q||null===(g=Q.fileStoreIds)||void 0===g?void 0:g.length)&&parseInt(null==I||null===(_=I.selfCertificationCharges)||void 0===_?void 0:_.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},ie("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==Q||null===(h=Q.fileStoreIds)||void 0===h?void 0:h.length)&&parseInt(null==I||null===(S=I.selfCertificationCharges)||void 0===S?void 0:S.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==Q||null===(C=Q.fileStoreIds[(null==Q||null===(y=Q.fileStoreIds)||void 0===y?void 0:y.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(x)?parseFloat(x):0)+parseFloat(P?parseFloat(P):0)+parseFloat(null==I||null===(T=I.selfCertificationCharges)||void 0===T?void 0:T.BPA_MALBA_CHARGES)+parseFloat(null==I||null===(D=I.selfCertificationCharges)||void 0===D?void 0:D.BPA_LABOUR_CESS)+parseFloat(null==I||null===(b=I.selfCertificationCharges)||void 0===b?void 0:b.BPA_WATER_CHARGES)+parseFloat(null==I||null===(A=I.selfCertificationCharges)||void 0===A?void 0:A.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(B)?parseFloat(B):0))}))),l.createElement("div",null,null==L||null===(N=L.scruntinyDetails)||void 0===N?void 0:N.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))))))))},ta=e=>{var i,o,r,u,s;let{edcrDetails:c,applicationData:d}=e;const{t:m}=a.useTranslation(),v=window.Digit.Utils.browser.isMobile(),E=[{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"}],p=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>E.map(e=>({Header:m(""+e.name),accessor:p(e.id),id:e.id})));function g(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,i,o,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===(i=a[0])||void 0===i?void 0:i.builtUpArea,FloorArea:(null===(o=e.occupancies)||void 0===o||null===(r=o[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 _(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,i;let t=null===(a=n[e])||void 0===a||null===(i=a.usageCategory)||void 0===i?void 0:i.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===(i=c.values)||void 0===i?void 0:i.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===(o=c.subOccupancyTableDetails)||void 0===o||null===(r=o[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,i,o,r,u;return l.createElement("div",{key:n,style:(null==c||null===(a=c.subOccupancyTableDetails)||void 0===a||null===(i=a[0])||void 0===i||null===(o=i.value)||void 0===o||null===(r=o.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:_(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:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},na=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))},la=e=>{var i,o,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(na,{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===(i=u.wfComment)||void 0===i?void 0:i.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===(o=u.thumbnailsToShow)||void 0===o||null===(r=o.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 aa(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(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"}},`${i(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:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{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",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function ia(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(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"}},`${i(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:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(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 oa=e=>{var i,o,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 E=null==m?void 0:m.mode;var{connectionDetails:p,plumberDetails:f,roadCuttingDetails:g,roadCuttingAddlDetails:_,activationDetails:h}=(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===(i=c.additionalDetails)||void 0===i?void 0:i.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==p?void 0:p.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===(o=c.additionalDetails)||void 0===o?void 0:o.plumberDetails)&&"MODIFY"!=E&&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==f?void 0:f.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"!=E&&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==g?void 0:g.map(e=>{var n;return l.createElement("div",{style:(null==g?void 0:g.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==_?void 0:_.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==h?void 0:h.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:""})))))))},ra=[{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"}],ua=[{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"}],sa=e=>{var i,o,r,u;let{wsAdditionalDetails:c}=e;const{t:d}=a.useTranslation(),[m,v,E]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[p,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==c||null===(i=c.additionalDetails)||void 0===i||!i.isPaid),[S,C]=n.useState(!1),[y,T]=n.useState(m||{}),[D,b]=n.useState(null),[A,N]=n.useState(c.additionalDetails.data?c.additionalDetails.data:{}),[L,O]=n.useState(c.additionalDetails.values?c.additionalDetails.values:[]),I=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(I,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a={...null==c||null===(e=c.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 i,o,r,u,s,d,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(i=m.billDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.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===(s=m.billDetails)||void 0===s||null===(d=s[0])||void 0===d?void 0:d.taxAmount)}];O(e),N(null==m||null===(E=m.billDetails)||void 0===E?void 0:E[0])}else v(a),T(a)},[]);let w={};const R=e=>l.createElement("h1",{className:"heading-m"},e.label),x=()=>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"})),M=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(x,null)),P=function(e,t,n){void 0===t&&(t=!1);let l={...y};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,i;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(i=n.target)||void 0===i?void 0:i.value)||-1;l[e]=1==t?n.target.value:""}T(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},L&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==L?void 0:L.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+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:""+d("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==A?void 0:A.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+d("CS_INBOX_STATUS_FILTER"),text:d(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=c&&null!==(o=c.additionalDetails)&&void 0!==o&&o.isAdhocRebate?l.createElement("div",{onClick:e=>{C(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},d("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,S&&l.createElement(t.Modal,{headerBarMain:l.createElement(R,{label:d("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(M,{onClick:()=>{T(m),C(!1)}}),actionCancelLabel:d("PT_CANCEL"),actionCancelOnSubmit:()=>{T(m),C(!1)},actionSaveLabel:d("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=y&&y.adhocPenalty?Number(null==y?void 0:y.adhocPenalty):0,n=null!=y&&y.adhocRebate?Number(null==y?void 0:y.adhocRebate):0;var l,a;if(t||n)if(n>(null==c||null===(l=c.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))b({isError:!1,isWarning:!0,key:"error",message:d("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,o,r,u,s,m,E,p,g,h;const e=null==c||null===(i=c.additionalDetails)||void 0===i||null===(o=i.appDetails)||void 0===o?void 0:o.applicationNo,t=null==c||null===(r=c.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,n={...null==c||null===(s=c.additionalDetails)||void 0===s||null===(m=s.appDetails)||void 0===m?void 0:m.additionalDetails,...y};c.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==c||null===(E=c.additionalDetails)||void 0===E||null===(p=E.appDetails)||void 0===p?void 0:p.service)?[{applicationNo:e,tenantId:t,waterConnection:c.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:c.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==c||null===(g=c.additionalDetails)||void 0===g||null===(h=g.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,i,o,r,u,s,c,d,m,E,p,g,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===(p=e.Calculation)||void 0===p||null===(g=p[0])||void 0===g||null===(h=g.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(i=e.Calculation)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.taxHeadEstimates,"category");const S=[{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}];f(Rl(e.Calculation[0])),N(null==e||null===(E=e.Calculation)||void 0===E?void 0:E[0]),O(S),y.billDetails=null==e?void 0:e.Calculation,v(y),C(!1)}).catch(e=>{var t,n,l,a,i,o;b({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?d(""+(null==e||null===(a=e.response)||void 0===a||null===(i=a.data)||void 0===i||null===(o=i.Errors[0])||void 0===o?void 0:o.code)):d("PT_COMMON_ADD_REBATE_PENALITY")})})}else b({isError:!1,isWarning:!0,key:"warning",message:d("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"}},d("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ra,optionKey:"title",select:e=>P("adhocPenaltyReason",!0,e),selected:(null==y?void 0:y.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:d})),"PT_OTHERS"===(null==y||null===(r=y.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==y?void 0:y.adhocPenaltyComment)||"",onChange:e=>P("adhocPenaltyComment",!1,e)},w={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==y?void 0:y.adhocPenalty)||"",onChange:e=>P("adhocPenalty",!1,e)},w={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("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"}},d("PT_AD_REBATE")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ua,optionKey:"title",select:e=>P("adhocRebateReason",!0,e),selected:(null==y?void 0:y.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:d})),"PT_OTHERS"===(null==y||null===(u=y.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement(t.TextInput,s({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==y?void 0:y.adhocRebateComment)||"",onChange:e=>P("adhocRebateComment",!1,e)},w={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==y?void 0:y.adhocRebate)||"",onChange:e=>P("adhocRebate",!1,e)},w={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),D&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==D?void 0:D.isWarning,error:null==D||!D.isWarning,label:d(null==D?void 0:D.message),onClose:()=>{b(!1)},isDleteBtn:!0})))},ca=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:{...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"})))},da=e=>{let{t:n,userType:a=!1,infoBannerLabel:i="",infoClickLable:o="",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(i))),n(o)+" ",l.createElement(ca,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(u)))))},ma=e=>{var i,o,r,u,s,c,d;let{wsAdditionalDetails:m}=e;const{t:v}=a.useTranslation(),[E,p]=n.useState(!1),[f,g]=n.useState({}),_=e=>l.createElement("h1",{className:"heading-m"},e.label),h=()=>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(h,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(i=m.additionalDetails)&&void 0!==i&&i.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),g(t),p(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,E&&l.createElement(t.Modal,{headerBarMain:l.createElement(_,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(S,{onClick:()=>{p(!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==f||null===(o=f.billSlabData)||void 0===o||null===(r=o.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==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==f||null===(u=f.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==f?void 0:f.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==f||null===(c=f.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==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},va={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:{}},Ea=e=>{let{className:t="table",headers:n=[],values:i=[],arrears:o=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:va.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:va.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:{...va.cell,...va.cellLeft,...va.cellHeader}},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:{...va.cell,...n.length==t+1?va.cellRight:{},...va.cellHeader},key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:{...va.cell,...va.cellLeft},component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:{...va.cell,textAlign:"left",...n.length==a+1?va.cellRight:{},whiteSpace:"pre"},key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:{...va.cell,...va.cellLeft}}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:{...va.cell,...va.cellRight,textAlign:"left",fontWeight:"700",whiteSpace:"pre"},key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:{...va.cell,textAlign:"left"},key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:va.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))"}},fa=e=>{var t,i,o;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===(i=c)||void 0===i?void 0:i.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==d||null===(o=d.toFixed)||void 0===o?void 0:o.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:i=[]}=e;return i.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 E=[];E=Object.keys(v),E.sort((e,t)=>v[e]-v[t]);const[p,f]=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")),p&&l.createElement(Ea,{headers:[...E],values:s,arrears:m}),!p&&l.createElement("div",{style:pa.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},u("CS_SHOW_CARD"))),p&&l.createElement("div",{style:pa.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},u("CS_HIDE_CARD"))))};function ga(e){var o,r,u,s,c,d,m,v,E,p,f,g,h,S;let{applicationDetails:C,demandData:y,workflowDetails:T,isDataLoading:D,applicationData:b,totalDemandTax:A,timelineStatusPrefix:N,showTimeLine:L=!0,statusAttribute:O="status",paymentsList:I,oldValue:w,isInfoLabel:R=!1}=e;const{t:x}=a.useTranslation();let M=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function P(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",C);const[F,B]=n.useState({}),[U,k]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==b?void 0:b.status)||U.loading||U.loaded||U.canLoad||k({loading:!1,loaded:!1,canLoad:!0}),null==U||!U.canLoad||U.loading||U.loaded||(k({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 i(){n(o),l({loading:!1,loaded:!0,canLoad:!0})}let o={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){o=e})}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==b?void 0:b.tenantId)||tenantId,null==b?void 0:b.propertyId,B,k));const V=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()}`},H=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:V(null==b||null===(a=b.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==b?void 0:b.channel)||""};return l.createElement(la,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,o,r,u,s,c,d,m,v,E,p,f,g,h,S,y,T,D;const a={uuid:null==e||null===(i=e.assignes)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==C?void 0:C.tenantId,businessIds:null==C?void 0:C.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}}},A=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==b||null===(c=b.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===(E=v[0])||void 0===E?void 0:E.uuid)&&null!=b&&null!==(p=b.processInstance)&&void 0!==p&&null!==(f=p.assignes)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber?null==b||null===(h=b.processInstance)||void 0===h||null===(S=h.assignes)||void 0===S||null===(y=S[0])||void 0===y?void 0:y.mobileNumber:null==e||null===(T=e.assignes)||void 0===T||null===(D=T[0])||void 0===D?void 0:D.mobileNumber,comment:x(null==e?void 0:e.comment),wfComment:A?A.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(la,{data:N,OpenImage:P,privacy:a})}{var A,N,L,O,I;const t={date:V(null==b||null===(A=b.auditDetails)||void 0===A?void 0:A.lastModifiedTime),name:null==e||null===(N=e.assignes)||void 0===N||null===(L=N[0])||void 0===L?void 0:L.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(O=e.assignes)||void 0===O||null===(I=O[0])||void 0===I?void 0:I.mobileNumber};return l.createElement(la,{data:t})}},W=(e,t)=>e?t?e:x(e):x("NA"),j=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),Y=window.location.href.includes("employee/noc"),G=window.location.href.includes("employee/obps"),z=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||j?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),q={table:{border:"2px solid black",width:"100%",fontFamily:"sans-serif"},td:{padding:"10px",border:"1px solid black",textAlign:"center"},th:{padding:"10px",border:"1px solid black",textAlign:"center"}},$=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)} ${x(null==e?void 0:e.isUnit)}`:x("N/A"):null!=e&&e.value?W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):x("N/A"),[K,X]=n.useState(!1);console.log("demand Data arr",y);const Z=y.reduce((e,t)=>e+t.demandInterest,0),Q=y.reduce((e,t)=>e+t.demandPenality,0),J=y.reduce((e,t)=>e+t.collectionTax,0),ee=y.reduce((e,t)=>e+t.collectionInterest,0),te=y.reduce((e,t)=>e+t.collectionPenality,0),ne=y.reduce((e,t)=>e+t.balanceTax,0);return y.reduce((e,t)=>e+t.balanceInterest,0),y.reduce((e,t)=>e+t.balancePenality,0),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},R?l.createElement(da,{t:x,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==C||null===(o=C.applicationDetails)||void 0===o?void 0:o.map((e,a)=>{var o,r,u,s,c,d,m,v,E,p,f,g,_,h,S,y,D,b,A,N,L,O,R,P,B,U,k,V,H,W,q,K,X,Z,Q,J,ee,te,ne,le;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"}:j?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&j?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},Y?""+x(e.title):x(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},x(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"}},x(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"}},x(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},x(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||j?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o,r,u;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:x(n.title),label:x(n.title),text:l.createElement("img",{src:x(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:x(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},x(null==n?void 0:n.title)))):Y||G?""+x(n.title):x(n.title),text:l.createElement("div",null,l.createElement(i.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:z(),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:""+x(""+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:x(n.title),label:x(n.title),text:$(n),last:a===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:z(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(fa,{bill:null===(r=F.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(ea,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:I,additionalDetails:null==C||null===(u=C.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==C?void 0:C.applicationData}),(null==C||null===(s=C.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(zl,{fiReport:null==C||null===(v=C.applicationData)||void 0===v||null===(E=v.additionalDetails)||void 0===E?void 0:E.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&l.createElement(Ql,{floors:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&l.createElement(Jl,{owners:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.owners}),(null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.units)&&l.createElement(ia,{units:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.units}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.accessories)&&l.createElement(aa,{units:null==e||null===(D=e.additionalDetails)||void 0===D?void 0:D.accessories}),!M&&(null==e||null===(b=e.additionalDetails)||void 0===b?void 0:b.permissions)&&(null==T||null===(A=T.data)||void 0===A||null===(N=A.nextActions)||void 0===N?void 0:N.length)>0&&l.createElement(Kl,{applicationData:null==C?void 0:C.applicationData,t:x,permissions:null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.permissions}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(Yl,{t:x,applicationData:null==C?void 0:C.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:T})),(null==e||null===(R=e.additionalDetails)||void 0===R?void 0:R.noc)&&l.createElement($l,{t:x,isNoc:!0,NOCdata:e.values,applicationData:null==C?void 0:C.applicationData,docs:e.additionalDetails.noc,noc:null===(P=e.additionalDetails)||void 0===P?void 0:P.data,bpaActionsDetails:T}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.scruntinyDetails)&&l.createElement(ea,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.buildingExtractionDetails)&&l.createElement(ea,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.subOccupancyTableDetails)&&l.createElement(ta,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==C?void 0:C.applicationData}),(null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documentsWithUrl)&&l.createElement(jl,{documents:null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.documentsWithUrl}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.documents)&&l.createElement(Xl,{documents:null==e||null===(q=e.additionalDetails)||void 0===q?void 0:q.documents}),(null==e||null===(K=e.additionalDetails)||void 0===K?void 0:K.taxHeadEstimatesCalculation)&&l.createElement(Zl,{taxHeadEstimatesCalculation:null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(oa,{wsAdditionalDetails:e,oldValue:w}),(null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.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===(ee=e.additionalDetails)||void 0===ee||null===(te=ee.redirectUrl)||void 0===te?void 0:te.title))),(null==e||null===(ne=e.additionalDetails)||void 0===ne?void 0:ne.estimationDetails)&&l.createElement(sa,{wsAdditionalDetails:e,workflowDetails:T}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(ma,{wsAdditionalDetails:e,workflowDetails:T}))}),L&&(null==T||null===(r=T.data)||void 0===r||null===(u=r.timeline)||void 0===u?void 0:u.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==T?void 0:T.isLoading)||D)&&l.createElement(t.Loader,null),!(null!=T&&T.isLoading)&&!D&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},x("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=T&&null!==(s=T.data)&&void 0!==s&&s.timeline&&1===(null==T||null===(c=T.data)||void 0===c||null===(d=c.timeline)||void 0===d?void 0:d.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:x(`${N}${null==T||null===(m=T.data)||void 0===m||null===(v=m.timeline[0])||void 0===v?void 0:v.state}`),customChild:H(null==T||null===(E=T.data)||void 0===E?void 0:E.timeline[0],null==T||null===(p=T.data)||void 0===p?void 0:p.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==T||null===(f=T.data)||void 0===f?void 0:f.timeline)&&(null==T||null===(g=T.data)||void 0===g?void 0:g.timeline.slice(0,K?null==T?void 0:T.data.timeline.length:2).map((e,n,a)=>{var i;let o="";var r,u,s,c,d,m;return window.location.href.includes("/obps/")&&(o=null!=T&&null!==(r=T.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!=T&&null!==(c=T.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:x(`${N}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[O]}${o}`),customChild:H(e,n,null==T||null===(i=T.data)||void 0===i?void 0:i.timeline)}))}))),(null==T||null===(h=T.data)||void 0===h||null===(S=h.timeline)||void 0===S?void 0:S.length)>2&&l.createElement(t.LinkButton,{label:x(K?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{X(e=>!e)}})))),l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"16px",fontSize:"24px"}},"DCB Details"),l.createElement("table",{border:"1px",style:q.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:q.th},"Installments"),l.createElement("th",{colSpan:"3",style:q.th},"Demand"),l.createElement("th",{colSpan:"3",style:q.th},"Collection"),l.createElement("th",{colSpan:"3",style:q.th},"Balance"),l.createElement("th",{style:q.th},"Advance")),l.createElement("tr",null,l.createElement("th",{style:q.th}),l.createElement("th",{style:q.th},"Tax"),l.createElement("th",{style:q.th},"Interest"),l.createElement("th",{style:q.th},"Penalty"),l.createElement("th",{style:q.th},"Tax"),l.createElement("th",{style:q.th},"Interest"),l.createElement("th",{style:q.th},"Penalty"),l.createElement("th",{style:q.th},"Tax"),l.createElement("th",{style:q.th},"Interest"),l.createElement("th",{style:q.th},"Penalty"),l.createElement("th",{style:q.th},"Advance"))),l.createElement("tbody",null,y.map(e=>l.createElement("tr",null,l.createElement("td",{style:q.td},e.taxPeriodFrom,"-",e.taxPeriodTo),l.createElement("td",{style:q.td},e.demandTax),l.createElement("td",{style:q.td},e.demandInterest),l.createElement("td",{style:q.td},e.demandPenality),l.createElement("td",{style:q.td},e.collectionTax),l.createElement("td",{style:q.td},e.collectionInterest),l.createElement("td",{style:q.td},e.collectionPenality),l.createElement("td",{style:q.td},e.balanceTax),l.createElement("td",{style:q.td},e.balanceInterest),l.createElement("td",{style:q.td},e.balancePenality),l.createElement("td",{style:q.td},e.advance))),l.createElement("tr",null,l.createElement("th",{style:q.th},"Total"),l.createElement("td",{style:q.td},A),l.createElement("td",{style:q.td},Z),l.createElement("td",{style:q.td},Q),l.createElement("td",{style:q.td},J),l.createElement("td",{style:q.td},ee),l.createElement("td",{style:q.td},te),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td})),l.createElement("tr",null,l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("th",{style:q.th},"Total"),l.createElement("td",{style:q.td},ne),l.createElement("td",{style:q.td},"0"),l.createElement("td",{style:q.td},"0"),l.createElement("td",{style:q.td},"0")),l.createElement("tr",null,l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("th",{style:q.th},"Total Balance"),l.createElement("td",{style:q.td},ne)))))}function _a(e){var n,a,i,o,r,u,s,c,d,m,v,E,p,f,g,_,h,S;let{t:C,showToast:y,closeToast:T,businessService:D}=e;if(null!=D&&D.includes("NewTL")||null!=D&&D.includes("TL")||null!=D&&D.includes("EDITRENEWAL")){var b;let e="";switch(null==y||null===(b=y.action)||void 0===b?void 0:b.action){case"SENDBACK":e="error"===(null==y?void 0:y.key)?null==y||null===(n=y.error)||void 0===n?void 0:n.message:C("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==y?void 0:y.key)?null==y||null===(a=y.error)||void 0===a?void 0:a.message:C("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==y?void 0:y.key)?null==y||null===(i=y.error)||void 0===i?void 0:i.message:C("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==y?void 0:y.key)?null==y||null===(o=y.error)||void 0===o?void 0:o.message:C("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==y?void 0:y.key)?null==y||null===(r=y.error)||void 0===r?void 0:r.message:C("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==y?void 0:y.key)?null==y||null===(u=y.error)||void 0===u?void 0:u.message:C("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==y?void 0:y.key)?null==y||null===(s=y.error)||void 0===s?void 0:s.message:C("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==y?void 0:y.key)?null==y||null===(c=y.error)||void 0===c?void 0:c.message:C(`ES_${D}_${null==y||null===(d=y.action)||void 0===d?void 0:d.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,y&&l.createElement(t.Toast,{error:"error"===y.key,label:e,onClose:T}))}if(null!=D&&D.includes("BPA")||null!=D&&D.includes("BPA_LOW")||null!=D&&D.includes("BPA_OC")){var A;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!=D&&D.includes("BPA_OC")?C(e[1]):C(e[0]),n};let n="";switch(null==y||null===(A=y.action)||void 0===A?void 0:A.action){case"REVOCATE":n="error"===(null==y?void 0:y.key)?null==y||null===(m=y.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==y?void 0:y.key)?null==y||null===(v=y.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==y?void 0:y.key)?null==y||null===(E=y.error)||void 0===E?void 0:E.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==y?void 0:y.key)?null==y||null===(p=y.error)||void 0===p?void 0:p.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==y?void 0:y.key)?null==y||null===(f=y.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==y?void 0:y.key)?null==y||null===(g=y.error)||void 0===g?void 0:g.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==y?void 0:y.key)?null==y||null===(_=y.error)||void 0===_?void 0:_.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==y?void 0:y.key)?null==y||null===(h=y.error)||void 0===h?void 0:h.message:C(`ES_${D}_${null==y||null===(S=y.action)||void 0===S?void 0:S.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,y&&l.createElement(t.Toast,{error:"error"===y.key,label:n,onClose:T}))}{var N,L;const e="error"===(null==y?void 0:y.key)?null==y||null===(N=y.error)||void 0===N?void 0:N.message:`ES_${D}_${null==y||null===(L=y.action)||void 0===L?void 0:L.action}_UPDATE_SUCCESS`;return l.createElement(l.Fragment,null,y&&l.createElement(t.Toast,{error:"error"===y.key,label:C(e),onClose:T}))}}function ha(e){var i,o,r,u,s,c,d,m,v,E,p,f,g,_,h,S;let{workflowDetails:C,displayMenu:y,onActionSelect:T,setDisplayMenu:D,businessService:b,forcedActionPrefix:A,ActionBarStyle:N={},MenuStyle:L={}}=e;const{t:O}=a.useTranslation();let I=Digit.UserService.getUser();const w=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):{};I=null==t?void 0:t.value}const R=null===(i=I)||void 0===i||null===(o=i.info)||void 0===o||null===(r=o.roles)||void 0===r?void 0:r.map(e=>e.code);let x=!1,M=!1,P=(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===(d=C.data)||void 0===d||null===(m=d.nextActions)||void 0===m?void 0:m.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(w,()=>{D(!1)},y),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==P?void 0:P.length)||null!=P&&null!==(v=P[0])&&void 0!==v&&null!==(E=v.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==P?void 0:P.length)?(M=!1,x=!0):(null==P?void 0:P.length)>0&&(M=!0,x=!1),l.createElement(l.Fragment,null,!(null!=C&&C.isLoading)&&M&&!x&&l.createElement(t.ActionBar,{style:{...N}},y&&(null!=C&&null!==(p=C.data)&&void 0!==p&&null!==(f=p.actionState)&&void 0!==f&&f.nextActions||null!=C&&null!==(g=C.data)&&void 0!==g&&g.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:A||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase()),options:P,optionKey:"action",t:O,onSelect:T,style:L}):null,l.createElement(t.SubmitBar,{ref:w,label:O("WF_TAKE_ACTION"),onSubmit:()=>D(!y)})),!(null!=C&&C.isLoading)&&!M&&x&&l.createElement(t.ActionBar,{style:{...N}},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==P||null===(_=P[0])||void 0===_?void 0:_.action,value:null==P||null===(h=P[0])||void 0===h?void 0:h.action,onClick:e=>{T((null==P?void 0:P[0])||{})}},O(`${A||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase())}_${null==P||null===(S=P[0])||void 0===S?void 0:S.action}`))))}const Sa=()=>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"})),Ca=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Sa,null));function ya(e){let{action:n,closeWarningPopup:i}=e;const{t:o}=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"},o("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Ca,{onClick:()=>{i()}}),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,o("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",o("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:""+o("PT_AMOUNT_DUE"),text:"₹"+o(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:o("ES_PT_COMMON_CANCEL"),onSubmit:i,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:o("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 Ta=e=>{var o,u;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const c=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),{data:m}=Digit.Hooks.obps.useMDMS(d,"BPA",["BlockReason"]),{t:v}=a.useTranslation(),E=i.useHistory();let{id:p}=i.useParams();const[f,g]=n.useState(!1),[_,h]=n.useState(null),[S,C]=n.useState(!1),[y,T]=n.useState(!1),[D,b]=n.useState(!1),{data:A}=Digit.Hooks.obps.useMDMS(d,"BPA",["RiskTypeComputation"]),{applicationDetails:N,demandData:L,totalDemandTax:O,totalBalanceTax:I,showToast:w,setShowToast:R,isLoading:x,isDataLoading:M,applicationData:P,mutate:F,nocMutation:B,workflowDetails:U,id:k,businessService:V,closeToast:H,moduleCode:W,timelineStatusPrefix:j,forcedActionPrefix:Y,statusAttribute:G,ActionBarStyle:z,MenuStyle:q,paymentsList:$,showTimeLine:K=!0,oldValue:X,isInfoLabel:Z=!1,clearDataDetails:Q}=e;n.useEffect(()=>{w&&U.revalidate()},[w]);const J=r.useQueryClient(),ee=()=>{h(null),C(!1)};return x||y?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,x?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(ga,{applicationDetails:N,demandData:L,id:k,workflowDetails:U,isDataLoading:M,applicationData:P,totalDemandTax:O,totalBalanceTax:I,businessService:V,timelineStatusPrefix:j,statusAttribute:G,paymentsList:$,showTimeLine:K,oldValue:X,isInfoLabel:Z}),S?l.createElement(Wl,{t:v,action:_,tenantId:c,state:d,id:p,applicationDetails:N,applicationData:null==N?void 0:N.applicationData,closeModal:ee,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,i,o,r,u,s,c,d,m,p,f,g){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(i=a.workflow)||void 0===i||null===(o=i.comment)||void 0===o?void 0:o.length)||0==(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u||null===(s=u.comment)||void 0===s?void 0:s.length)||0==(null==e||null===(c=e.WaterConnection)||void 0===c||null===(d=c.comment)||void 0===d?void 0:d.length)||0==(null==e||null===(m=e.SewerageConnection)||void 0===m||null===(p=m.comment)||void 0===p?void 0:p.length)||0==(null==e||null===(f=e.BPA)||void 0===f||null===(g=f.comment)||void 0===g?void 0:g.length))alert(v("Please fill in the comments before submitting"));else{const a=function(a,i,o,r,u){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(i=e.BPA)&&void 0!==i&&null!==(o=i.additionalDetails)&&void 0!==o&&o.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;F&&(T(!0),F(e,{onError:(e,t)=>{T(!1),R({key:"error",error:e}),setTimeout(H,5e3)},onSuccess:(e,t)=>{var l,a,i,o,r,u,s,c,d,m,p,f;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),T(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,E.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=n)&&void 0!==i&&i.isNoc&&E.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(o=e.Amendments)||void 0===o?void 0:o.length)>0?null!=t&&null!==(r=t.AmendmentUpdate)&&void 0!==r&&null!==(u=r.workflow)&&void 0!==u&&u.action.includes("SEND_BACK")?R({key:"success",label:v("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(s=t.AmendmentUpdate)&&void 0!==s&&null!==(c=s.workflow)&&void 0!==c&&c.action.includes("RE-SUBMIT")?R({key:"success",label:v("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("APPROVE")?R({key:"success",label:v("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(p=t.AmendmentUpdate)&&void 0!==p&&null!==(f=p.workflow)&&void 0!==f&&f.action.includes("REJECT")&&R({key:"success",label:v("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(R({key:"success",action:_}),Q&&setTimeout(Q,3e3),setTimeout(H,5e3),J.clear(),J.refetchQueries("APPLICATION_SEARCH"))}})),ee()}T(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const a=function(){if(!1!==t&&B){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==B?void 0:B.mutateAsync(e)),a=ct(function(){return T(!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,i,o,r,u,s,c,d,m,E;T(!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!==(i=a[0])&&void 0!==i&&i.code?v(null==e||null===(o=e.response)||void 0===o||null===(r=o.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===(E=m[0])||void 0===E?void 0:E.message)||e;ee(),R({key:"error",error:{message:p}}),setTimeout(H,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(s):s(a)}alert(v("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==U||null===(o=U.data)||void 0===o?void 0:o.timeline,businessService:V,workflowDetails:U,moduleCode:W,blockReason:null==m||null===(u=m.BPA)||void 0===u?void 0:u.BlockReason}):null,D?l.createElement(ya,{action:_,workflowDetails:U,businessService:V,isWarningPop:D,closeWarningPopup:()=>{b(!1)}}):null,l.createElement(_a,{t:v,showToast:w,closeToast:H,businessService:V}),s?l.createElement("div",null,l.createElement(t.SubmitBar,{style:{marginRight:20},label:v("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(c,{applicationNo:null==P?void 0:P.applicationNo})).then(function(e){var t,n,l,a,i,o;const r=Digit.Utils.obps.calculateRiskType(null==A||null===(t=A.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==N||null===(n=N.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==N||null===(i=N.edcrDetails)||void 0===i||null===(o=i.planDetail)||void 0===o?void 0:o.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,i,o,r,s,d,m,E){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===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null==u||null===(o=u.BPA)||void 0===o||null===(r=o.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===(E=m.selfCertificationCharges)||void 0===E?void 0:E.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(v("Enterd Less Adjustment amount is invalid"))}();if(s&&s.then)return s.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0})):l.createElement(ha,{workflowDetails:U,displayMenu:f,onActionSelect:function(e){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]),null!=e&&e.isToast)R({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(H,5e3);else if(null!=e&&e.isWarningPopUp)b(!0);else if(null!=e&&e.redirectionUrll){var t,n,l,a,i;if("ACTIVATE_CONNECTION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action))E.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.state,url:`${null===(i=location)||void 0===i?void 0:i.pathname}${location.search}`}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action)){var o,r;E.push(""+(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.pathname),{data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state})}else{var u;window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname}`)}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action)){var s,c;E.push({pathname:null===(s=e.redirectionUrl)||void 0===s?void 0:s.pathname,state:{...null===(c=e.redirectionUrl)||void 0===c?void 0:c.state}})}else C(!0);h(e),g(!1)},setDisplayMenu:g,businessService:V,forcedActionPrefix:Y,ActionBarStyle:z,MenuStyle:q})))},Da=e=>{let{t:t,heading:n}=e;return l.createElement("h1",{className:"heading-m"},""+t(n))},ba=()=>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"})),Aa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ba,null)),Na=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)," "))},La=e=>{let{t:n,heading:a,docName:i,closeModal:o,actionCancelLabel:r,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return l.createElement(t.Modal,{headerBarMain:l.createElement(Da,{t:n,heading:a}),headerBarEnd:l.createElement(Aa,{onClick:o}),actionCancelLabel:n(r),actionCancelOnSubmit:u,actionSaveLabel:n(s),actionSaveOnSubmit:c,formId:"modal-action"},l.createElement(Na,{t:n,title:i}))},Oa=["EDIT","DELETE"],Ia=()=>{var e,o,r,u,s,c,d,m,v,E,p,f,g,_,S,C,y,T;let D=window.Digit.Utils.browser.isMobile();const{id:b}=i.useParams(),{t:A}=a.useTranslation(),N=i.useHistory(),[L,O]=n.useState(!1),[I,w]=n.useState(!1),R=Digit.ULBService.getCurrentTenantId(),{isLoading:x,data:M}=Digit.Hooks.events.useEventDetails(R,{ids:b},{}),[P,F,B]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[U,k,V]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[H,W,j]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{F(!1),j(),V()},[]),x?l.createElement(t.Loader,null):l.createElement("div",null,L?l.createElement(La,{t:A,heading:"CONFIRM_DELETE_PUB_BRCST",docName:null==M||null===(e=M.applicationData)||void 0===e?void 0:e.name,closeModal:()=>O(!L),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){O(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:()=>{const e={events:[{...(e=>{let{...t}=e;return t})(null==M?void 0:M.applicationData),status:"CANCELLED"}]};N.push("/digit-ui/employee/engagement/messages/response?delete=true",e)}}):null,l.createElement(t.Header,null,A("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"},A("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==M?void 0:M.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},A("PUBLIC_BRDCST_TITLE_LABEL")+":")," ",l.createElement("p",null,null==M||null===(o=M.applicationData)||void 0===o?void 0:o.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},A("EVENTS_COMMENTS_LABEL")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=M&&null!==(r=M.applicationData)&&void 0!==r&&null!==(u=r.description)&&void 0!==u&&u.length?null==M||null===(s=M.applicationData)||void 0===s?void 0:s.description:"NA")," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},A("EVENTS_FROM_DATE_LABEL")+":")," ",l.createElement("p",null,null!=M&&null!==(c=M.applicationData)&&void 0!==c&&null!==(d=c.eventDetails)&&void 0!==d&&d.fromDate?De(new Date(null==M||null===(m=M.applicationData)||void 0===m||null===(v=m.eventDetails)||void 0===v?void 0:v.fromDate),"dd/MM/yyyy"):null)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},A("EVENTS_TO_DATE_LABEL")+":")," ",l.createElement("p",null,null!=M&&null!==(E=M.applicationData)&&void 0!==E&&null!==(p=E.eventDetails)&&void 0!==p&&p.toDate?De(new Date(null==M||null===(f=M.applicationData)||void 0===f||null===(g=f.eventDetails)||void 0===g?void 0:g.toDate),"dd/MM/yyyy"):null)," "),l.createElement("span",{className:"documentDetails_subheader"},""+A("CS_COMMON_DOCUMENTS")),null!=M&&null!==(_=M.applicationData)&&void 0!==_&&null!==(S=_.eventDetails)&&void 0!==S&&null!==(C=S.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:()=>h(n,a)},l.createElement(t.GenericFileIcon,null),l.createElement("span",{className:"cell-text"},null==a?void 0:a.split(10))))})):null})(null==M||null===(y=M.applicationData)||void 0===y||null===(T=y.eventDetails)||void 0===T?void 0:T.documents):"NA")),l.createElement(t.ActionBar,null,I?l.createElement(t.Menu,{style:{width:D?"full":"240px"},localeKeyPrefix:"ES_CE",options:Oa,t:A,onSelect:function(e){"EDIT"===e&&N.push("/digit-ui/employee/engagement/messages/inbox/edit/"+b),"DELETE"===e&&O(!0),w(!1)}}):null,l.createElement(t.SubmitBar,{label:A("ES_COMMON_TAKE_ACTION"),onSubmit:()=>w(!I)})))},wa=e=>{let{match:{path:n}={},tenants:a,parentRoute:o}=e;return l.createElement(i.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/create",component:e=>l.createElement(ot,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/create",component:e=>l.createElement(ot,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/details/:id",component:e=>l.createElement(Ia,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/edit/:id",component:e=>l.createElement(st,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(at,s({},e,{tenants:a,parentRoute:o}))}),l.createElement(t.PrivateRoute,{path:n+"/response",component:e=>l.createElement(ut,e)}))},Ra=/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats-officedocument)$/i,xa=e=>{let{header:t,actions:n,eventNotificationText:i,timePastAfterEventCreation:o,timeApproxiamationInUnits:r,...u}=e;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,i),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:i}=t;return l.createElement("div",{className:"display-flex-gap-2"},a.length?l.createElement("p",null,a," : "):null,i.length?l.createElement("span",{className:"link",onClick:()=>h(i,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,i.length?l.createElement("span",{className:"link",onClick:()=>C(i)}," ",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:()=>h(n,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,n&&n.length?l.createElement("span",{className:"link",onClick:()=>C(n)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})(s,c),l.createElement("p",null,o+" "+s(r)))},Ma=e=>l.createElement("h1",{className:"heading-m"},e.label),Pa=()=>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"})),Fa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Pa,null)),Ba=()=>{const{id:e}=i.useParams(),{t:o}=a.useTranslation(),r=i.useHistory(),[u,s]=n.useState(!1),[c,d]=n.useState(!1),m=Digit.ULBService.getCurrentTenantId(),{isLoading:v,data:E}=Digit.Hooks.events.useEventDetails(m,{ids:e}),[p,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[_,h,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[C,y,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{f(!1),T(),S()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,o("ES_TITLE_APPLICATION_DETAILS")),l.createElement(Ta,{applicationData:null==E?void 0:E.applicationData,applicationDetails:E,isLoading:v,isDataLoading:v}),l.createElement(t.ActionBar,null,c?l.createElement(t.Menu,{localeKeyPrefix:"ES_EVENT",options:["EDIT","DELETE"],t:o,onSelect:function(t){"EDIT"===t&&r.push("/digit-ui/employee/engagement/event/edit-event/"+e),"DELETE"===t&&s(!0),d(!1)}}):null,l.createElement(t.SubmitBar,{label:o("ES_COMMON_TAKE_ACTION"),onSubmit:()=>d(!c)})),u&&l.createElement(t.Modal,{headerBarMain:l.createElement(Ma,{label:o("ES_EVENT_DELETE_POPUP_HEADER")}),headerBarEnd:l.createElement(Fa,{onClick:()=>s(!1)}),actionCancelLabel:o("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>s(!1),actionSaveLabel:o("ES_EVENT_DELETE"),actionSaveOnSubmit:()=>{const e={events:[{...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,o("ES_EVENT_DELETE_TEXT")))))},Ua=e=>{let{searchValue:n,onChange:a,handleKeyPress:i,handleSearch:o,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:()=>o()}),onKeyPress:i}))},ka=(e,t)=>{const[l,a]=n.useState(e);return n.useEffect(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),l},Va=e=>{let{documentTitle:n,documentSize:a=2.3,lastModifiedData:i,description:o,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,y(a)):null),l.createElement("div",{className:"notice_and_circular_caption"},l.createElement(t.CardCaption,null,`${s("CE_DCOUMENT_UPLOADED_ON")} ${i?De(new Date(i),"do MMMM yyyy"):"-"}`)),l.createElement("div",{className:"notice_and_circular_text"},l.createElement(t.CardText,null,null!=o&&o.length?o:"NA")),l.createElement("div",{className:"view_download_main"},r&&r.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>h(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:()=>S(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:()=>C(r||null)}):null)))},Ha=(e,t)=>e.map((e,n)=>{let{name:a,createdTime:i,description:o,documentLink:r,fileSize:u,filestoreId:s}=e;return l.createElement(Va,{key:n,documentTitle:a,documentSize:u,lastModifiedData:i,description:o,documentLink:r,filestoreId:s,t:t})}),Wa=e=>{let{t:n,title:a,count:i,onClick:o,children:r}=e;const[u,s]=l.useState(!1);return l.createElement("div",{className:"accordion-wrapper",onClick:()=>o(a,i)},l.createElement("div",{className:"accordion-title "+(u?"open":""),onClick:()=>s(!u)},`${n(a)} (${i})`,l.createElement(t.PrevIcon,null)),l.createElement("div",{className:"accordion-item "+(u?"":"collapsed")},l.createElement("div",{className:"accordion-content"},r)))},ja=e=>{var a,o,r,u,s;let{t:c}=e;const d=i.useHistory(),[m,v]=n.useState(""),E=Digit.ULBService.getCitizenCurrentTenant(),p=ka(m,700),{data:f,isLoading:g}=Digit.Hooks.engagement.useDocSearch({name:p,tenantIds:E},{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:i,auditDetails:o,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:i,documentLink:a,createdTime:null==o?void 0:o.createdTime,fileSize:r,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}});if(null===(a=Digit.UserService)||void 0===a||null===(o=a.getUser())||void 0===o||!o.access_token)return l.createElement(Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:location.pathname+location.search}}});const _=(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(Ua,{searchValue:m,handleKeyPress:e=>{"Enter"===e.key&&v("")},handleSearch:e=>{v("")},onChange:v,t:c}),l.createElement("hr",{style:{color:"#ccc"}}),g?l.createElement(t.Loader,null):l.createElement("div",{className:"wrapper"},m.length&&null!=f&&null!==(r=f.documentList)&&void 0!==r&&r.length?Ha(f.documentList,c):null!=f&&f.statusCount&&null!=f&&null!==(u=f.statusCount)&&void 0!==u&&u.length?null==f||null===(s=f.statusCount)||void 0===s?void 0:s.map((e,t)=>{let{category:n,count:a}=e;return l.createElement(Wa,{t:c,title:n,count:a,key:t,onClick:_})}):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))))},Ya=e=>{const{t:n}=a.useTranslation(),{applicationNumber:i,tenantId:o}=Digit.Hooks.useQueryParams(),{data:r,isLoading:u}=Digit.Hooks.engagement.useDocSearch({uuid:i,tenantId:o},{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:i,auditDetails:o,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:i,documentLink:a,createdTime:null==o?void 0:o.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:E,filestoreId:p}=(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(Va,{key:1,documentTitle:c,documentSize:E,lastModifiedData:d,description:m,documentLink:v,filestoreId:p,t:n}),!c&&!u&&l.createElement(t.Card,null,l.createElement(t.CardCaption,null,n("COMMON_DOC_DATA_NOT_FOUND"))))},Ga=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.mutation.isSuccess?"SURVEY_RESPONSE_SUBMITED":"SURVEY_RESPONSE_FAILED"),applicationNumber:(i=e.mutation,i.isSuccess?null===(o=i.data)||void 0===o||null===(r=o.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 i,o,r,u},za=e=>{var o;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useSubmitResponse()),{state:d}=e.location,m=null==d||null===(o=d.AnswerEntity)||void 0===o?void 0:o.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(Ga,{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(i.Link,{to:"/digit-ui/citizen/engagement/surveys/list"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},qa=e=>{let{path:n}=e;const o=i.useLocation(),{t:r}=a.useTranslation(),u=Digit.ComponentRegistryService.getComponent("NotificationsAndWhatsNew"),s=Digit.ComponentRegistryService.getComponent("EventsListOnGround"),c=Digit.ComponentRegistryService.getComponent("EventDetails"),d=Digit.ComponentRegistryService.getComponent("DocumentList"),m=Digit.ComponentRegistryService.getComponent("SurveyList"),v=Digit.ComponentRegistryService.getComponent("FillSurvey"),E=Digit.ComponentRegistryService.getComponent("ShowSurvey");return l.createElement(l.Fragment,null,l.createElement("div",{className:"engagement-citizen-wrapper"},!o.pathname.includes("response")&&l.createElement(t.BackButton,null,r("CS_COMMON_BACK")),l.createElement(i.Switch,null,l.createElement(i.Route,{path:n+"/notifications",component:()=>l.createElement(u,{variant:"notifications",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/whats-new",component:()=>l.createElement(u,{variant:"whats-new",parentRoute:n})}),l.createElement(t.PrivateRoute,{exact:!0,path:n+"/events",component:()=>l.createElement(s,{variant:"events",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/events/details/:id",component:()=>l.createElement(c,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/docs",component:()=>l.createElement(ja,{t:r,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/viewDocument",component:()=>l.createElement(Ya,{t:r,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/list/:category/:count",component:e=>l.createElement(d,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/list",component:e=>l.createElement(m,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/fill-survey",component:e=>l.createElement(v,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-response",component:e=>l.createElement(za,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/show-survey",component:e=>l.createElement(E,e)}))))},$a=[{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:""}]}]}],Ka=()=>{const{t:e}=a.useTranslation(),o=i.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:$a,onSubmit:e=>{var t,n,l,a,i,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===(i=e.document)||void 0===i||null===(r=i.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)};o.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}))},Xa=[{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:""}]}]}],Za=e=>{var o;const{t:r}=a.useTranslation(),u=i.useHistory(),[s,c]=n.useState(!1),d=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:Xa,onSubmit:t=>{(t=>{var n,l,a,i,o,r,s,c,d,m,v,E,p,f,g,_,h,S,C;const y=null!==(n=t.document)&&void 0!==n&&null!==(l=n.filestoreId)&&void 0!==l&&l.fileSize?null===(a=t.document)||void 0===a||null===(i=a.filestoreId)||void 0===i?void 0:i.fileSize:null===(o=e.location.state)||void 0===o||null===(r=o.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===(d=t.document)||void 0===d||null===(m=d.filestoreId)||void 0===m?void 0:m.fileType:null===(v=e.location.state)||void 0===v||null===(E=v.DocumentEntity)||void 0===E?void 0:E.fileType,D={...null===(p=e.location)||void 0===p||null===(f=p.state)||void 0===f?void 0:f.DocumentEntity,name:t.documentName,description:null!=t&&t.description.length?t.description:"",category:null===(g=t.docCategory)||void 0===g?void 0:g.name,filestoreId:null===(_=t.document)||void 0===_||null===(h=_.filestoreId)||void 0===h?void 0:h.fileStoreId,fileSize:y,fileType:T,documentLink:null===(S=t.document)||void 0===S?void 0:S.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:d,defaultValues:null===(o=e.location.state)||void 0===o?void 0:o.DocumentEntity,isDisabled:!s}))},Qa=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_CREATED":"ENGAGEMENT_DOC_FAILURE"),applicationNumber:(i=e.mutation,i.isSuccess?null===(o=i.data)||void 0===o||null===(r=o.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 i,o,r,u},Ja=e=>{const o=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:()=>{o.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Qa,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},ei=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_UPDATED":"ENGAGEMENT_DOC_UPDATE_FAILURE"),applicationNumber:(i=e.mutation,i.isSuccess?null===(o=i.data)||void 0===o||null===(r=o.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 i,o,r,u},ti=e=>{const o=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:()=>{o.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ei,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},ni=e=>{var n;const{t:i}=a.useTranslation();return l.createElement(t.Banner,{message:i(e.isSuccess?"ENGAGEMENT_DOC_DELETED":"ENGAGEMENT_DOC_DELETE_FAILURE"),applicationNumber:null!==(n=e.mutation)&&void 0!==n&&n.isSuccess?e.uuid:"",info:e.isSuccess?i("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess})},li=e=>{var o;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(ni,{t:s,data:c.data,mutation:c,uuid:null==d||null===(o=d.DocumentEntity)||void 0===o?void 0:o.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ai=e=>{let{t:n,data:a,columns:i,globalSearch:o,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:E,onSort:p,sortParams:f}=e;return l.createElement(t.Table,{t:n,data:a,columns:i,onSearch:r,globalSearch:o,manualGlobalFilter:!0,manualPagination:!0,currentPage:d,onNextPage:m,onPrevPage:v,pageSizeLimit:s,onPageSizeChange:E,getCellProps:u,totalRecords:c,onSort:p,sortParams:f})},ii=e=>{let{onSearch:a,searchParams:i,searchFields:r,type:u,onClose:s,isInboxPage:c,t:d}=e;const{handleSubmit:m,formState:v,reset:E,control:f}=o.useForm({defaultValues:i}),g=innerWidth<=640,_=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.ULBService.getCurrentTenantId(),S=Digit.UserService.getUser().info,C=_.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(p),y=n.useMemo(()=>_.filter(e=>e.code===h),[h,_]),T=()=>{E({name:"",ulbs:{code:h.code},postedBy:""}),a({name:"",ulbs:{code:h.code},postedBy:""})},D=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:T},d("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(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||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,d("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,i,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,d(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(o.Controller,{rules:{required:!0},defaultValue:null==y?void 0:y[0],render:e=>l.createElement(t.Dropdown,{option:C,optionKey:"i18nKey",selected:e.value,select:e.onChange,t:d}),name:e.name,control:f});default:return l.createElement(o.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:f,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===(i=v.errors)||void 0===i||null===(r=i[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===u&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:d("ES_COMMON_SEARCH"),submit:!0})),"desktop"===u&&!g&&l.createElement("div",{className:"document-clear-all"},D())))),("mobile"===u||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},D(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:d("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},oi=e=>{let{type:i="desktop",onClose:o,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,d]=n.useState(()=>({...u})),m=Digit.ULBService.getCurrentTenantId(),v=null==m?void 0:m.split(".")[0],E=Digit.ULBService.getCurrentUlb(),{data:p,isLoading:f}=Digit.Hooks.engagement.useMDMS(v,"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}))}}),g=()=>{d({category:null,name:null,postedBy:null}),r({category:null,name:null,postedBy:null}),null==o||o()};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:g},s("ES_COMMON_CLEAR_ALL")),"desktop"===i&&l.createElement("span",{className:"clear-search",onClick:g},l.createElement(t.RefreshIcon,null)),"mobile"===i&&l.createElement("span",{onClick:o},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+s("DOCUMENTS_CATEGORY_CARD_LABEL")),l.createElement(t.Dropdown,{option:p,optionKey:"category",selected:c,select:e=>{var t;t=e,d({...c,...t})},t:s}),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(r(c),void(null==o||o())),label:s("ES_COMMON_APPLY")}))))},ri=e=>l.createElement("span",{className:"cell-text styled-cell"},e),ui=e=>{let{isLoading:n,data:a,t:o,onSearch:r,title:u,iconName:s,links:c,onSort:d,sortParams:m,globalSearch:v,searchFields:E,searchParams:p,onFilterChange:f,pageSizeLimit:g,totalRecords:_,currentPage:C,onNextPage:y,onPrevPage:T,onPageSizeChange:D}=e;const b=l.useMemo(()=>[{Header:o("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(i.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}},o);var t}},{Header:o("DOCUMENTS_CATEGORY_CARD_LABEL"),accessor:e=>ri(null!=e&&e.category?o(""+(null==e?void 0:e.category)):"")},{Header:o("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:()=>h(t,e)}," ",a("CE_DOCUMENT_VIEW_LINK")," "):null,n.length?l.createElement("span",{className:"link",onClick:()=>S(n,e)}," ",a("CE_DOCUMENT_OPEN_LINK")," "):null)}(null==e?void 0:e.name,e.filestoreId,e.documentLink||"",o)},{Header:o("CE_TABLE_DOCUMENT_POSTED_BY"),accessor:e=>ri(e.postedBy)}],[]);let A;return n?A=l.createElement(t.Loader,null):a&&0!==(null==a?void 0:a.length)?(null==a?void 0:a.length)>0&&(A=l.createElement(ai,{t:o,data:a,columns:b,onSort:d,sortParams:m,globalSearch:v,onSearch:p,pageSizeLimit:g,totalRecords:_,currentPage:C,onNextPage:y,onPrevPage:T,onPageSizeChange:D,getCellProps:e=>({style:{minWidth:e.column.Header===o("CE_TABLE_DOCUMENT_NAME")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})):A=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},o("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(i.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},o("NEW_DOCUMENT_TEXT"))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Me,{title:u,icon:s,links:c}),l.createElement("div",null,l.createElement(oi,{onFilterChange:f,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(ii,{t:o,onSearch:r,type:"desktop",searchFields:E,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},A)))},si=e=>{let{searchFields:a,searchParams:o,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[E,p]=n.useState(!1),[g,_]=n.useState(o),h=(Digit.ULBService.getCurrentTenantId(),i.useHistory());n.useEffect(()=>{m&&p(!0)},[m]);const S=()=>{p(!1),_(o)};let C;return 0===(null==c?void 0:c.length)?C=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(i.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},s("NEW_DOCUMENT_TEXT"))):c&&(null==c?void 0:c.length)>0&&(C=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>f(t.postedBy,e["Posted By"])&&f(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"),p(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),p(!0)}})),C,E&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(oi,{onFilterChange:r,onClose:S,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(ii,{t:s,type:"mobile",onClose:S,onSearch:u,searchParams:o,searchFields:a}))))},ci=e=>{let{data:t,t:n,title:a,iconName:i,links:o,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(Me,{title:a,icon:i,links:o}),l.createElement(si,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,i,o,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===(i=e.postedBy)||void 0===i||null===(o=i.trim())||void 0===o?void 0:o.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=>{h(e.filestoreId,e.name)}},n("CE_DOCUMENT_VIEW_LINK")):null,null!=e&&e.documentLink?l.createElement("div",{className:"link",onClick:t=>{S(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}))))},di=e=>{let{tenants:i}=e;const{t:o}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const r=Digit.ULBService.getCurrentTenantId(),[u,s]=n.useState({tenantIds:r,offset:0,limit:10});let c=window.Digit.Utils.browser.isMobile();const{data:d,isLoading:m}=Digit.Hooks.engagement.useDocSearch(u,{select:e=>{let{Documents:t,totalCount:n}=e;return{documentsList:t,totalCount:n}}}),v=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:i,postedBy:o}=e;s(e=>({...e,name:i,postedBy:o,tenantIds:a}))},E=e=>{s(t=>({...t,...e}))},p=n.useCallback(()=>{s(e=>({...e,offset:parseInt(null==e?void 0:e.offset)+parseInt(null==e?void 0:e.limit)}))},[]);n.useEffect(()=>{s(e=>({...e,tenantIds:r}))},[r]);const f=()=>[{label:o("LABEL_FOR_ULB"),name:"ulbs",type:"ulb"},{label:o("DOCUMENTS_DOCUMENT_HEADER"),name:"name"},{label:o("CE_TABLE_DOCUMENT_POSTED_BY"),name:"postedBy"}],g=[{text:o("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/inbox/new-doc"}];return c?l.createElement(ci,{data:null==d?void 0:d.documentsList,searchParams:u,searchFields:f(),t:o,onFilterChange:E,onSearch:v,isLoading:m,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:g}):l.createElement("div",null,l.createElement(t.Header,null,o("DOCUMENTS_DOCUMENT_HEADER"),Number(null==d?void 0:d.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==d?void 0:d.totalCount)):null),l.createElement(ui,{t:o,isLoading:m,data:null==d?void 0:d.documentsList,links:g,searchParams:u,onSearch:v,searchFields:f(),onFilterChange:E,pageSizeLimit:null==u?void 0:u.limit,totalRecords:null==d?void 0:d.totalCount,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:g,currentPage:parseInt(u.offset/u.limit),onNextPage:p,onPrevPage:()=>{s(e=>({...e,offset:parseInt(null==e?void 0:e.offset)-parseInt(null==e?void 0:e.limit)}))},onPageSizeChange:e=>{s(t=>({...t,limit:e.target.value}))}}))},mi=e=>{let{header:n,about:i,activeTime:o,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,i),l.createElement("div",{className:"surveyListclockDiv"},l.createElement(t.Clock,null)," ",l.createElement("span",null,"Active till "+De(new Date(o),"do MMM HH:mm"))),l.createElement("div",{className:"surveyListstatus"},l.createElement("p",null,function(e,t){return d(1,arguments),Ne(e,Date.now(),t)}(new Date(r),{addSuffix:!0})),l.createElement("span",{className:"CS_SURVEY_RESPONDED"===u?"surveyLisResponded":"surveyLisNotResponded"},c(u))))},vi=(e,t)=>{const n=(new Date).getTime();return e<n&&n<=t},Ei=["EDIT_DOCUMENT","DELETE"],pi=e=>{var i;let{location:o,history:r}=e,u=window.Digit.Utils.browser.isMobile();const{t:s}=a.useTranslation(),{details:c}=null==o?void 0:o.state,[d,m]=l.useState(!1),[v,E]=n.useState(!1),p=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentUlb()),f=Digit.ULBService.getStateId(),{data:g}=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===p.code))[0].categoryList.map(e=>({name:e}))}});return l.createElement("div",null,v?l.createElement(La,{t:s,heading:"CONFIRM_DELETE_DOC",docName:null==c?void 0:c.name,closeModal:()=>E(!v),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){E(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:function(){E(!1);const e={...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!==(i=c.description)&&void 0!==i&&i.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:()=>h(null==c?void 0:c.filestoreId,null==c?void 0:c.name)},l.createElement(t.GenericFileIcon,null))):null)),l.createElement(t.ActionBar,null,d?l.createElement(t.Menu,{style:{width:u?"full":"240px"},localeKeyPrefix:"ES_CE",options:Ei,t:s,onSelect:function(e){if(m(!1),null!=e&&e.includes("EDIT")){var t;const e={tenantIds:null==c?void 0:c.tenantId,documentName:null==c?void 0:c.name,docCategory:null==g||null===(t=g.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:()=>m(!d)})))},fi=e=>{let{statuses:i,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(o.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:o,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:i,optionKey:"code",t:u,select:o,selected:r}))}})))},gi=e=>{var i,r,u,s;let{registerRef:c,controlSearchForm:d,searchFormState:m}=e;const{t:v}=a.useTranslation(),E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),f=Digit.ULBService.getCurrentTenantId(),g=Digit.SessionStorage.get("citizen.userRequestObject"),_=E.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(p),h=n.useMemo(()=>E.filter(e=>e.code===f),[E]);return l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,v("LABEL_FOR_ULB")),l.createElement(o.Controller,{rules:{required:!0},defaultValue:null==h?void 0:h[0],render:e=>l.createElement(t.Dropdown,{option:_,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:v}),name:"tenantIds",control:d})),l.createElement(t.SearchField,null,l.createElement("label",null,v("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",inputRef:c({maxLength:{value:60,message:v("EXCEEDS_60_CHAR_LIMIT")}})}),l.createElement(t.CardLabelError,null,null==m||null===(i=m.errors)||void 0===i||null===(r=i.title)||void 0===r?void 0:r.message)),l.createElement(t.SearchField,null,l.createElement("label",null,v("EVENTS_POSTEDBY_LABEL")),l.createElement(t.TextInput,{name:"postedBy",type:"text",inputRef:c({maxLength:{value:30,message:v("EXCEEDS_30_CHAR_LIMIT")}})}),l.createElement(t.CardLabelError,null,null==m||null===(u=m.errors)||void 0===u||null===(s=u.postedBy)||void 0===s?void 0:s.message)))},_i=e=>{let{parentRoute:o}=e;const{t:r}=a.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.UserService.getUser().info,m=c.filter(e=>{var t;return null==d||null===(t=d.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),v=[{code:"ALL",name:""+r("ES_COMMON_ALL")},{code:"ACTIVE",name:""+r("ES_COMMON_ACTIVE")},{code:"INACTIVE",name:""+r("ES_COMMON_INACTIVE")}],E={tenantIds:m[0],postedBy:"",title:""},p={status:v[0]},f={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},g=Digit.SessionStorage.get("CITIZENSURVEY.INBOX"),_=n.useMemo(()=>g||{filterForm:p,searchForm:E,tableForm:f},[Object.values((null==g?void 0:g.filterForm)||{}),Object.values((null==g?void 0:g.searchForm)||{}),Object.values((null==g?void 0:g.tableForm)||{})]),[h,S]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data}}},_),{data:{Surveys:C,TotalCount:y}={},isLoading:T}=Digit.Hooks.survey.useSurveyInbox(h),D={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:r("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/inbox/create"}]},b=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(gi,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),A=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:i}=e;return l.createElement(fi,{statuses:v,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==h?void 0:h.filterForm,getFilterFormValue:i})},[v]),N={SearchFormFields:b,onSearchFormSubmit:e=>{S({action:"mutateTableForm",data:{...h.tableForm,offset:0}}),e.hasOwnProperty("")&&(null==e||delete e[""]),S({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==h?void 0:h.searchForm,resetSearchFormDefaultValues:E,onSearchFormReset:e=>{e("postedBy",""),e("title",""),e("tenantIds",u),S({action:"mutateSearchForm",data:E})}},L={FilterFormFields:A,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),S({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==h?void 0:h.filterForm,resetFilterFormDefaultValues:p,onFilterFormReset:e=>{e("status",v[0]),S({action:"mutateFilterForm",data:p})}},O=(e=>{var o,r,u,s;let{parentRoute:c,onPageSizeChange:d,formState:m,totalCount:v,table:E,dispatch:p,inboxStyles:f={}}=e;const g=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:_}=a.useTranslation(),h=n.useMemo(()=>[{Header:_("CS_SURVEY_TITLE"),accessor:"uuid",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement(i.Link,{to:`${c}/surveys/inbox/details/${t.original.uuid}`},l.createElement("span",{className:"link"},t.original.title)))}},{Header:_("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?g(De(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:_("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?g(De(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:_("CS_RESPONSE_COUNT"),accessor:"answersCount",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.answersCount?g(Number(null===(n=l.original)||void 0===n?void 0:n.answersCount)):"-"}},{Header:l.createElement("div",null,_("EVENTS_STATUS_LABEL"),l.createElement("div",{className:"tooltip",style:{marginLeft:"5px"}},l.createElement(t.InfoBannerIcon,{fill:"#0b0c0c",style:!0}),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"120px",marginLeft:"15px",marginBottom:"-260px"}},""+_("SURVEY_STATUS_TOOLTIP")))),accessor:"status",Cell:e=>{var t;let{row:n}=e;return(e=>"active"===(null==e?void 0:e.toLowerCase())?l.createElement("span",{className:"sla-cell-success"},e):l.createElement("span",{className:"sla-cell-error"},e))(null===(t=n.original)||void 0===t?void 0:t.status)}},{Header:_("EVENTS_POSTEDBY_LABEL"),accessor:e=>e.postedBy},{Header:_("CS_SURVEY_RESULTS"),accessor:"results",Cell:e=>{let{row:t}=e;return l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(i.Link,{to:`${c}/surveys/inbox/results/${t.original.uuid}`},l.createElement("span",{className:"link"},l.createElement("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M5.5 18H0V6H5.5V18ZM12.75 0H7.25V18H12.75V0ZM20 8H14.5V18H20V8Z",fill:"#a82227"})))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!0,manualPagination:!0,initSortI:"endDate",onPageSizeChange:d,currentPage:parseInt((null===(o=m.tableForm)||void 0===o?void 0:o.offset)/(null===(r=m.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:{...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 p({action:"mutateTableForm",data:{...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:parseInt(v),onSearch:null==m||null===(s=m.searchForm)||void 0===s?void 0:s.message,data:E,columns:h,noResultsMessage:"CS_NO_SURVEYS_FOUND",inboxStyles:{...f}}})({parentRoute:o,onPageSizeChange:e=>{S({action:"mutateTableForm",data:{...h.tableForm,limit:e.target.value}})},formState:h,totalCount:y,table:C,noResultsMessage:"CS_SURVEYS_NOT_FOUND",dispatch:S,inboxStyles:{overflowX:"scroll",overflowY:"hidden"}}),I=(e=>{let{parentRoute:t,table:n}=e;const{t:l}=a.useTranslation();return{data:null==n?void 0:n.map(e=>{let{title:t,startDate:n,endDate:a,answersCount:i,status:o,postedBy:r}=e;return{[l("CS_SURVEY_TITLE")]:t,[l("EVENTS_START_DATE_LABEL")]:De(new Date(n),"dd/MM/yyyy"),[l("EVENTS_END_DATE_LABEL")]:De(new Date(a),"dd/MM/yyyy"),[l("CS_RESPONSE_COUNT")]:i,[l("EVENTS_STATUS_LABEL")]:o,[l("EVENTS_POSTEDBY_LABEL")]:r}}),linkPrefix:t+"/inbox/",serviceRequestIdKey:l("TL_COMMON_TABLE_COL_APP_NO")}})({parentRoute:o,table:C});return l.createElement(t.InboxComposer,s({isInboxLoading:T,PropsForInboxLinks:D},N,L,{propsForInboxMobileCards:I,propsForInboxTable:O,formState:h}))},hi=e=>{var a,i,r,u,s,c,d;let{t:m,registerRef:v,controlSurveyForm:E,surveyFormState:f,surveyFormData:g,disableInputs:_,enableDescriptionOnly:h}=e;const S=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),C=Digit.ULBService.getCurrentTenantId(),y=Digit.UserService.getUser().info,T=S.filter(e=>{var t;return null==y||null===(t=y.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(p),D=n.useMemo(()=>S.filter(e=>e.code===C),[S]);return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_FOR_ULB")+" * "),l.createElement(o.Controller,{name:"tenantIds",control:E,defaultValue:D,rules:{required:!0},render:e=>(n.useMemo(()=>{var n;return null==e||null===(n=e.value)||void 0===n?void 0:n.map((n,a)=>{return l.createElement(t.RemoveableTag,{key:a,text:n.name,disabled:(i=_,o=h,!(o||!i)||!!o),onClick:()=>{var t;e.onChange(null==e||null===(t=e.value)||void 0===t?void 0:t.filter(e=>e.code!==n.code))}});var i,o})},[null==e?void 0:e.value]),l.createElement("div",{style:{display:"grid",gridAutoFlow:"row"}},l.createElement(t.MultiSelectDropdown,{options:T,isSurvey:!0,optionsKey:"i18nKey",props:e,isPropsNeeded:!0,onSelect:t=>{var n,l;e.onChange([...(null===(n=g("tenantIds"))||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])},selected:null==e?void 0:e.value,defaultLabel:m("ES_COMMON_USER_ULBS"),defaultUnit:m("CS_SELECTED_TEXT")})))}),(null==f||null===(a=f.errors)||void 0===a?void 0:a.tenantIds)&&l.createElement(t.CardLabelError,null,m("ES_ERROR_REQUIRED"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("CS_SURVEY_NAME")+" * "),l.createElement(t.TextInput,{name:"title",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED"),maxLength:{value:60,message:m("EXCEEDS_60_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),disable:_}),(null==f||null===(i=f.errors)||void 0===i?void 0:i.title)&&l.createElement(t.CardLabelError,null,null==f||null===(r=f.errors)||void 0===r||null===(u=r.title)||void 0===u?void 0:u.message)),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("CS_SURVEY_DESCRIPTION")+" "),l.createElement(t.TextInput,{name:"description",type:"text",inputRef:v({maxLength:{value:140,message:m("EXCEEDS_140_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),disable:h?!h:_}),(null==f||null===(s=f.errors)||void 0===s?void 0:s.description)&&l.createElement(t.CardLabelError,null,null==f||null===(c=f.errors)||void 0===c||null===(d=c.description)||void 0===d?void 0:d.message)))},Si=e=>{let{t:t,options:n=checkboxlist,updateOption:a,addOption:i,removeOption:o,isPartiallyEnabled:r,createNewSurvey:u,formDisabled:s,maxLength:c,titleHover:d,inputRef:m,labelstyle:v,isInputDisabled:E}=e;return l.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>l.createElement(Ci,{key:t,index:t,title:e,updateOption:a,removeOption:o,maxLength:c,titleHover:d,inputRef:m,labelstyle:v,isPartiallyEnabled:r,isInputDisabled:E,formDisabled:s})),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",disabled:!u&&s||(r?!r:s),onClick:()=>i()},t("CS_COMMON_ADD_OPTION"))))},Ci=e=>{let{index:a,title:i,updateOption:o,removeOption:r,maxLength:u,titleHover:s,inputRef:c,labelstyle:d,isPartiallyEnabled:m,isInputDisabled:v,formDisabled:E}=e;const[p,f]=n.useState(i),[g,_]=n.useState(!1);return n.useEffect(()=>{o({value:p,id:a})},[p]),l.createElement("div",{className:"optioncheckboxwrapper"},l.createElement(t.CheckBox,{disable:v}),l.createElement("input",{ref:c,type:"text",value:p,onChange:e=>f(e.target.value),onBlur:()=>_(!1),onFocus:()=>_(!0),className:g?"simple_editable-input":"simple_readonly-input",maxLength:u,title:s,style:{...d},disabled:m?!m:E}),l.createElement("div",{className:"pointer",onClick:()=>r(a)},l.createElement(t.CloseSvg,null)))},yi=e=>{let{t:t,options:n=checkboxlist,updateOption:a,addOption:i,removeOption:o,createNewSurvey:r,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,isInputDisabled:v}=e;return l.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>l.createElement(Ti,{key:t,index:t,title:e,updateOption:a,removeOption:o,inputRef:c,maxLength:d,titleHover:m,isPartiallyEnabled:u,isInputDisabled:v,formDisabled:s})),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",disabled:!r&&s||(u?!u:s),onClick:()=>i()},t("CS_COMMON_ADD_OPTION"))))},Ti=e=>{let{index:a,title:i,updateOption:o,removeOption:r,inputRef:u,maxLength:s,titleHover:c,isPartiallyEnabled:d,isInputDisabled:m,formDisabled:v}=e;const[E,p]=n.useState(i),[f,g]=n.useState(!1);return n.useEffect(()=>{o({value:E,id:a})},[E]),l.createElement("div",{className:"optionradiobtnwrapper"},l.createElement("input",{type:"radio",className:"customradiobutton",disabled:m}),l.createElement("input",{type:"text",ref:u,value:E,onChange:e=>p(e.target.value),onBlur:()=>g(!1),onFocus:()=>g(!0),className:f?"simple_editable-input":"simple_readonly-input",maxLength:s,title:c,disabled:d?!d:v}),l.createElement("div",{className:"pointer",onClick:()=>r(a)},l.createElement(t.CloseSvg,null)))},Di=e=>{var a,i;let{t:r,index:u,questionStatement:s,type:c,uuid:d,qorder:m,required:v,options:E,disableInputs:p,dispatch:f,isPartiallyEnabled:g,addOption:_,formDisabled:h}=e;const S=[{title:r("Surveys_Short_Answer"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},{title:r("Surveys_Multiple_Choice"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},{title:r("Surveys_Check_Boxes"),i18Key:"CHECKBOX_ANSWER_TYPE",value:"CHECKBOX_ANSWER_TYPE"},{title:r("Surveys_Paragraph"),i18Key:"LONG_ANSWER_TYPE",value:"LONG_ANSWER_TYPE"},{title:r("Surveys_Date"),i18Key:"DATE_ANSWER_TYPE",value:"DATE_ANSWER_TYPE"},{title:r("Surveys_Time"),i18Key:"TIME_ANSWER_TYPE",value:"TIME_ANSWER_TYPE"}],C=S.filter(e=>(null==e?void 0:e.value)===("object"==typeof c?c.value:c)),y=window.location.href.includes("/employee/engagement/"),[T,D]=n.useState({questionStatement:s,type:c?null==C?void 0:C[0]:{title:r("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:v,options:(null==E?void 0:E.length)>0?E:[r("CMN_OPTION")+" 1"],uuid:d,qorder:m}),{register:b,formState:A}=o.useFormContext();n.useEffect(()=>{D({questionStatement:s,type:c?null==C?void 0:C[0]:{title:r("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:v,options:(null==E?void 0:E.length)>0?E:[r("CMN_OPTION")+" 1"],uuid:d,qorder:m})},[s]);const N=()=>D(e=>{const t={...e};return t.options.push(`${r("CMN_OPTION")} ${t.options.length+1}`),t}),L=e=>{let{value:t,id:n}=e;D(e=>{const l={...e};return l.options.splice(n,1,t),l})},O=e=>{1===T.options.length||!g&&h||D(t=>{const n={...t};return n.options.splice(e,1),n})};return n.useEffect(()=>{f({type:"updateForm",payload:{index:u,formConfig:T}})},[T]),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},`${r("CS_COMMON_QUESTION")} ${u+1} `),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement("div",{className:"newSurveyForm_questions"},l.createElement("div",{style:{width:"75%"}},l.createElement(t.TextInput,{placeholder:r("CS_COMMON_TYPE_QUESTION"),value:T.questionStatement,onChange:e=>{D(t=>({...t,questionStatement:e.target.value}))},textInputStyle:{width:"100%"},name:"QUESTION_SURVEY_"+u,disable:p,inputRef:b({required:r("ES_ERROR_REQUIRED"),maxLength:{value:100,message:r("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:r("ES_SURVEY_DONT_START_WITH_NUMBER")}})}),(null==A?void 0:A.errors)&&l.createElement(t.CardLabelError,null,null==A||null===(a=A.errors)||void 0===a||null===(i=a["QUESTION_SURVEY_"+u])||void 0===i?void 0:i.message)),l.createElement(t.Dropdown,{t:r,option:S,select:e=>{D(t=>({...t,type:{title:e.title,i18Key:e.i18Key,value:e.value}}))},optionKey:"i18Key",disable:p,selected:null==T?void 0:T.type})),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,a,i,o;switch(null==e?void 0:e.value){case"LONG_ANSWER_TYPE":return l.createElement("div",null,l.createElement(t.TextArea,{placeholder:r("LONG_ANSWER_TYPE"),disabled:y,name:"longAnsDescription",inputRef:b({maxLength:{value:500,message:r("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===(a=n.longAnsDescription)||void 0===a?void 0:a.message));case"DATE_ANSWER_TYPE":return l.createElement(t.DatePicker,{stylesForInput:{width:"calc(100% - 290px)"},style:{width:"202px"},disabled:y});case"TIME_ANSWER_TYPE":return l.createElement(t.TextInput,{type:"time",textInputStyle:{width:"202px"},disable:y});case"MULTIPLE_ANSWER_TYPE":return l.createElement(yi,{maxLength:60,titleHover:r("MAX_LENGTH_60"),t:r,addOption:N,updateOption:L,removeOption:O,options:null==T?void 0:T.options,createNewSurvey:_,isInputDisabled:y,isPartiallyEnabled:g,formDisabled:h});case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,l.createElement(Si,{t:r,addOption:N,updateOption:L,removeOption:O,options:null==T?void 0:T.options,isInputDisabled:y,isPartiallyEnabled:g,createNewSurvey:_,formDisabled:h,maxLength:60,titleHover:r("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}}));default:return l.createElement("div",null,l.createElement(t.TextInput,{placeholder:r("SHORT_ANSWER_TYPE"),name:"shortAnsDescription",disabled:y,inputRef:b({maxLength:{value:200,message:r("EXCEEDS_200_CHAR_LIMIT")}})}),(null==A?void 0:A.errors)&&l.createElement(t.CardLabelError,null,null==A||null===(i=A.errors)||void 0===i||null===(o=i.shortAnsDescription)||void 0===o?void 0:o.message))}})(null==T?void 0:T.type)),l.createElement("div",{className:"newSurveyForm_actions"},l.createElement("div",null,l.createElement(t.CheckBox,{onChange:e=>D(e=>({...e,required:!e.required})),checked:T.required,label:r("CS_COMMON_REQUIRED"),pageType:"employee",disable:p,style:{marginTop:"2px"}})),0!==u&&l.createElement("div",{className:"newSurveyForm_seprator"}),0!==u&&l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>f({type:"removeForm",payload:{index:u}})},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"}},r("CS_INFO_DELETE"))))))))},bi=e=>{let{t:t,formsConfig:a,setSurveyConfig:i,disableInputs:o,isPartiallyEnabled:r,addOption:u,formDisabled:c,controlSurveyForm:d}=e;const m={question:"",answerType:"Short Answer",required:!1,options:[],uuid:"",qorder:null},v=[m],[E,p]=n.useReducer((e,t)=>{let{type:n,payload:l}=t;switch(n){case"addNewForm":const t=[...e,m];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];return a.splice(l.index,1),l.setSurveyConfig("questions",a),a}},a||v),f=e=>{let{type:t,payload:n}=e;p({type:t,payload:{...n,setSurveyConfig:i}})};return l.createElement("div",{className:"surveyformslist_wrapper"},l.createElement("div",{className:"heading"},t("CS_SURVEYS_QUESTIONS")),E.length?E.map((e,n)=>l.createElement(Di,s({key:n},e.formConfig?null==e?void 0:e.formConfig:e,{addOption:u,t:t,index:n,disableInputs:o,dispatch:f,isPartiallyEnabled:r,formDisabled:c,controlSurveyForm:d}))):null,l.createElement("div",{className:"pointer"},E.length<30&&l.createElement("button",{className:`unstyled-button link ${o?"disabled-btn":""} ${E.length>=30?"disabled-btn":""} `,type:"button",onClick:()=>f({type:"addNewForm"}),disabled:E.length>=30},t("CS_COMMON_ADD_QUESTION"))))},Ai=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}`},Ni=e=>{var n,a,i,r,u,s,c,d;let{t:m,controlSurveyForm:v,surveyFormState:E,disableInputs:p,enableEndDateTimeOnly:f}=e;const g=null==E?void 0:E.errors,{getValues:_}=o.useFormContext(),h=(new Date).getTime();return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("div",{className:"heading"},m("CS_COMMON_SETTINGS")),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_START_DATE")+" * "),l.createElement(o.Controller,{control:v,name:"fromDate",defaultValue:null==E?void 0:E.fromDate,rules:{required:!0,validate:f?null:{isValidFromDate:e=>{const t=new Date(e).getTime(),n=_("toDate")?new Date(_("toDate")).getTime():(new Date).getTime();return e===_("toDate")&&e>=Ai(h)||n>=t&&e>=Ai(h)}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",onChange:n,defaultValue:a,disable:p})}}),g&&(null==g?void 0:g.fromDate)&&"required"===(null==g||null===(n=g.fromDate)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),g&&(null==g?void 0:g.fromDate)&&"isValidFromDate"===(null==g||null===(a=g.fromDate)||void 0===a?void 0:a.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_FROM_DATE_ERROR_INVALID"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_START_TIME")+" * "),l.createElement(o.Controller,{control:v,name:"fromTime",defaultValue:null==E?void 0:E.fromTime,rules:{required:!0,validate:{isValidFromTime:()=>!0}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",onChange:n,defaultValue:a,disable:p})}}),g&&(null==g?void 0:g.fromTime)&&"required"===(null==g||null===(i=g.fromTime)||void 0===i?void 0:i.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),g&&(null==g?void 0:g.fromTime)&&"isValidFromDate"===(null==g||null===(r=g.fromTime)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_END_DATE")+" * "),l.createElement(o.Controller,{control:v,name:"toDate",defaultValue:null==E?void 0:E.toDate,rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>=(_("fromDate")?new Date(_("fromDate")).getTime():(new Date).getTime())}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",onChange:n,defaultValue:a,disable:f?!f:p})}}),g&&(null==g?void 0:g.toDate)&&"required"===(null==g||null===(u=g.toDate)||void 0===u?void 0:u.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),g&&(null==g?void 0:g.toDate)&&"isValidToDate"===(null==g||null===(s=g.toDate)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID"))," "),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_END_TIME")+" * "),l.createElement(o.Controller,{control:v,name:"toTime",defaultValue:null==E?void 0:E.toTime,rules:{required:!0,validate:{isValidToTime:()=>!0}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",onChange:n,defaultValue:a,disable:f?!f:p})}}),g&&(null==g?void 0:g.toTime)&&"required"===(null==g||null===(c=g.toTime)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),g&&(null==g?void 0:g.toTime)&&"isValidToDate"===(null==g||null===(d=g.toTime)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID"))))},Li=e=>{let{t:a,initialFormValues:i,onSubmit:r,isFormDisabled:u=!1}=e;const{register:c,control:d,handleSubmit:m,setValue:v,getValues:E,reset:p,formState:f,clearErrors:g,..._}=o.useForm({defaultValues:i});return n.useEffect(()=>{c("questions")},[]),l.createElement("div",{style:{margin:"8px"}},l.createElement(o.FormProvider,s({register:c,control:d,handleSubmit:m,setValue:v,getValues:E,reset:p,formState:f,clearErrors:g},_),l.createElement("form",{onSubmit:m(r)},l.createElement(t.Card,null,l.createElement(hi,{t:a,registerRef:c,controlSurveyForm:d,surveyFormState:f,surveyFormData:E}),l.createElement(bi,{t:a,setSurveyConfig:v,addOption:!0,controlSurveyForm:d}),l.createElement(Ni,{t:a,controlSurveyForm:d,surveyFormState:f})),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:a("CS_CREATE_SURVEY"),submit:"submit"})))))},Oi={"Short Answer":"SHORT_ANSWER_TYPE","Short answer":"SHORT_ANSWER_TYPE",Paragraph:"LONG_ANSWER_TYPE","Multiple Choice":"MULTIPLE_ANSWER_TYPE","Check Boxes":"CHECKBOX_ANSWER_TYPE",Date:"DATE_ANSWER_TYPE",Time:"TIME_ANSWER_TYPE"},Ii=function(e,t){var n;if(void 0===e&&(e=[]),!(e=e.map(e=>{var t;return null!=e&&null!==(t=e.formConfig)&&void 0!==t&&t.type?e:{...e,formConfig:{...null==e?void 0:e.formConfig,type:"Short Answer"}}})).length)return;let l=[];return l=e.map((e,t)=>{let{formConfig:n}=e;const{options:l,questionStatement:a,required:i,type:o,uuid:r,qorder:u}=n,s={questionStatement:a,uuid:r||null,qorder:u,status:"ACTIVE",required:i,type:"object"==typeof o&&null!==o?o.value:o.title?Oi[o.title]:Oi[o]};return"Multiple Choice"!==(null==o?void 0:o.title)&&"MULTIPLE_ANSWER_TYPE"!==(null==o?void 0:o.value)&&"Check Boxes"!==(null==o?void 0:o.title)&&"CHECKBOX_ANSWER_TYPE"!==(null==o?void 0:o.value)||(s.options=l),s}),t&&(null==t||null===(n=t.questions)||void 0===n||n.map(e=>{l.length>0&&l.some(t=>t.uuid===(null==e?void 0:e.uuid))||l.push({...e,status:"INACTIVE"})})),l},wi=()=>{const{t:e}=a.useTranslation(),o=i.useHistory(),[r,u]=n.useState(null),s=()=>{u(null)};setTimeout(()=>{s()},1e4),Digit.ULBService.getCurrentTenantId();const c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.UserService.getUser().info,m={fromDate:"",fromTime:"",toDate:"",toTime:"",questions:{},tenantIds:c.filter(e=>{var t;return null==d||null===(t=d.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))})};return l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("CREATE_NEW_SURVEY")),l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement(Li,{t:e,onSubmit:e=>{const{title:t,description:n,tenantIds:l,fromDate:a,toDate:i,fromTime:r,toTime:s,questions:c}=e,d=Ii(c),m={SurveyEntity:{tenantIds:l.map(e=>{let{code:t}=e;return t}),title:t,description:n,startDate:new Date(`${a} ${r}`).getTime(),endDate:new Date(`${i} ${s}`).getTime(),questions:d}};try{var v;let e={tenantIds:null==l||null===(v=l[0])||void 0===v?void 0:v.code,title:t};Digit.Surveys.search(e).then(e=>{var t;(null==e||null===(t=e.Surveys)||void 0===t?void 0:t.length)>0?u({key:!0,label:"SURVEY_SAME_NAME_SURVEY_ALREADY_PRESENT"}):o.push("/digit-ui/employee/engagement/surveys/create-response",m)})}catch(e){}},initialFormValues:m})),r&&l.createElement(t.Toast,{error:r.key,label:e(r.label),onClose:s}))},Ri=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.mutation.isSuccess?"SURVEY_FORM_CREATED":"SURVEY_FORM_FAILURE"),applicationNumber:(i=e.mutation,i.isSuccess?null===(o=i.data)||void 0===o||null===(r=o.Surveys)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.mutation.isSuccess?n("SURVEY_FORM_ID"):"",successful:e.mutation.isSuccess});var i,o,r,u},xi=e=>{var o,u;const s=r.useQueryClient(),{t:c}=a.useTranslation(),d=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useCreate()),{state:m}=e.location,v=i.useHistory(),[E,p]=n.useState(!1);if(n.useEffect(()=>{m&&d.mutate(m,{onSuccess:()=>{s.clear(),window.history.replaceState(null,"CREATE_SURVEY_STATE")}})},[]),d.isLoading&&!d.isIdle)return l.createElement(t.Loader,null);const f=null===(o=d.data)||void 0===o||null===(u=o.Surveys)||void 0===u?void 0:u[0];return l.createElement(t.Card,null,l.createElement(Ri,{t:c,mutation:d}),l.createElement(t.CardText,null,d.isSuccess?c("SURVEY_FORM_CREATION_MESSAGE",{surveyName:null==f?void 0:f.title,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==f?void 0:f.startDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==f?void 0:f.endDate)}):null),l.createElement(t.ActionBar,null,l.createElement("button",{onClick:()=>{p(e=>!e)}},l.createElement(t.SubmitBar,{label:"Action"}),E&&l.createElement(t.Menu,{options:[c("GO_BACK_TO_HOME"),c("CREATE_ANOTHER_SURVEY")],onSelect:e=>{e===c("GO_BACK_TO_HOME")?v.push("/digit-ui/employee"):e===c("CREATE_ANOTHER_SURVEY")&&v.push("/digit-ui/employee/engagement/surveys/create")}}))))},Mi=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_SURVEY_UPDATED":"ENGAGEMENT_SURVEY_UPDATE_FAILURE"),applicationNumber:(i=e.mutation,i.isSuccess&&null!=i&&null!==(o=i.data)&&void 0!==o&&null!==(r=o.Surveys)&&void 0!==r&&null!==(u=r[0])&&void 0!==u&&u.uuid?null==i||null===(m=i.data)||void 0===m||null===(v=m.Surveys)||void 0===v||null===(E=v[0])||void 0===E?void 0:E.uuid:i.isSuccess?null===(s=i.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 i,o,r,u,s,c,d,m,v,E},Pi=e=>{const o=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:()=>{o.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(Mi,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Fi=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_SURVEY_DELETED":"ENGAGEMENT_SURVEY_DELETE_FAILURE"),successful:e.isSuccess})},Bi=e=>{var o;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useDelete()),{state:d}=e.location;return n.useEffect(()=>{d&&c.mutate(d,{onSuccess:()=>{u.clear(),window.history.replaceState(null,"DELETE_SURVEY_STATE")}})},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Fi,{t:s,data:c.data,mutation:c,uuid:null==d||null===(o=d.DocumentEntity)||void 0===o?void 0:o.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},Ui=e=>{let{t:n,userType:a}=e;return a=a||Digit.SessionStorage.get("userType"),l.createElement(l.Fragment,null,l.createElement("div",{style:"citizen"===a?{maxWidth:"970px"}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:window.location.href.includes("/connection-details")?{color:"#3498DB",margin:"0px"}:{color:"#3498DB"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n("SURVEY_INFO_HEADER")))," "+n("SURVEY_INFO_LABEL"))))},ki=e=>{let{t:a,onEdit:i,menuOptions:r,initialSurveysConfig:u,isFormDisabled:s,isPartiallyEnabled:c,displayMenu:d,setDisplayMenu:m,onActionSelect:v,isSurveyActive:E}=e;const p="ACTIVE"===(null==u?void 0:u.status)?!c:s,{register:f,control:g,handleSubmit:_,setValue:h,getValues:S,reset:C,formState:y,clearErrors:T}=o.useForm({defaultValues:{...u}});return n.useEffect(()=>{f("questions")},[]),l.createElement(o.FormProvider,{register:f,control:g,handleSubmit:_,setValue:h,getValues:S,reset:C,formState:y,clearErrors:T},l.createElement("form",{onSubmit:_(i)},l.createElement(t.Card,null,c&&"ACTIVE"===(null==u?void 0:u.status)&&l.createElement(Ui,{t:a}),l.createElement(hi,{t:a,registerRef:f,controlSurveyForm:g,surveyFormState:y,disableInputs:s,enableDescriptionOnly:c,surveyFormData:S}),l.createElement(bi,{t:a,setSurveyConfig:h,disableInputs:s,formsConfig:u.questions,isPartiallyEnabled:c,formDisabled:s,controlSurveyForm:g}),l.createElement(Ni,{t:a,controlSurveyForm:g,surveyFormState:y,disableInputs:s,enableEndDateTimeOnly:c}),l.createElement("span",{className:"edit-action-btn"},!E&&!s&&l.createElement(t.SubmitBar,{label:a("CS_EDIT_SURVEY"),submit:"submit",disabled:c?!c:s}),c&&E&&l.createElement(t.SubmitBar,{label:a("CS_EDIT_SURVEY"),submit:"submit",disabled:c?!c:s})))),p&&l.createElement(t.ActionBar,null,d?l.createElement(t.Menu,{localeKeyPrefix:"ES_SURVEY",options:r,t:a,onSelect:v}):null,l.createElement(t.SubmitBar,{label:a("ES_COMMON_TAKE_ACTION"),onSubmit:()=>m(!d)})))},Vi=e=>l.createElement("h1",{className:"heading-m"},e.t(e.heading)),Hi=()=>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"})),Wi=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Hi,null)),ji=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null," ",t("CONFIRM_DELETE_MSG_NEW")," ",l.createElement("b",null," "+n),t("COMPLETELY_DELETE")," ",l.createElement("br",null),l.createElement("br",null),t("COMPLETELY_DELETE_WARN_MSG")))},Yi=e=>{let{t:n,heading:a,surveyTitle:i,closeModal:o,actionCancelLabel:r,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return l.createElement(t.Modal,{headerBarMain:l.createElement(Vi,{t:n,heading:a}),headerBarEnd:l.createElement(Wi,{onClick:o}),actionCancelLabel:n(r),actionCancelOnSubmit:u,actionSaveLabel:n(s),actionSaveOnSubmit:c,formId:"modal-action"},l.createElement(ji,{t:n,title:i}))},Gi=e=>l.createElement("h1",{className:"heading-m"},e.t(e.heading)),zi=()=>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"})),qi=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(zi,null)),$i=()=>!0,Ki=()=>!0,Xi=()=>!0,Zi=()=>!0,Qi=e=>{var n,a,i,r,u,s,c,d;let{t:m,heading:v,surveyTitle:E,initialValues:p,onSubmit:f,closeModal:g,actionCancelLabel:_,actionCancelOnSubmit:h,actionSaveLabel:S,actionSaveOnSubmit:C}=e;const{fromDate:y,fromTime:T,toDate:D,toTime:b}=p,{control:A,handleSubmit:N,formState:L}=o.useForm({defaultValues:{fromDate:y,fromTime:T,toDate:D,toTime:b}}),O=null==L?void 0:L.errors;return l.createElement(t.Modal,{headerBarMain:l.createElement(Gi,{t:m,heading:v}),headerBarEnd:l.createElement(qi,{onClick:g}),actionCancelLabel:m(_),actionCancelOnSubmit:h,actionSaveLabel:m(S),actionSaveOnSubmit:N(C),formId:"modal-action",headerBarMainStyle:{marginLeft:"20px"}},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement("p",null,m("CONFIRM_ACTIVE_SURVEY_MSG")," ",l.createElement("br",null)," ",E," ",m("CONFIRM_ACTIVE_SURVEY_MSG_END")),l.createElement("br",null),l.createElement("form",{onSubmit:N(f)},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_START_DATE")),l.createElement(o.Controller,{control:A,name:"fromDate",defaultValue:null==L?void 0:L.fromDate,rules:{required:!0,validate:{isValidFromDate:$i}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),O&&(null==O?void 0:O.fromDate)&&"required"===(null==O||null===(n=O.fromDate)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),O&&(null==O?void 0:O.fromDate)&&"isValidToDate"===(null==O||null===(a=O.fromDate)||void 0===a?void 0:a.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_START_TIME")),l.createElement(o.Controller,{control:A,name:"fromTime",defaultValue:null==L?void 0:L.fromTime,rules:{required:!0,validate:{isValidFromTime:Xi}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",isRequired:!0,onChange:n,defaultValue:a})}}),O&&(null==O?void 0:O.fromTime)&&"required"===(null==O||null===(i=O.fromTime)||void 0===i?void 0:i.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),O&&(null==O?void 0:O.fromTime)&&"isValidToDate"===(null==O||null===(r=O.fromTime)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_END_DATE")),l.createElement(o.Controller,{control:A,name:"toDate",defaultValue:null==L?void 0:L.toDate,rules:{required:!0,validate:{isValidToDate:Ki}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),O&&(null==O?void 0:O.toDate)&&"required"===(null==O||null===(u=O.toDate)||void 0===u?void 0:u.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),O&&(null==O?void 0:O.toDate)&&"isValidToDate"===(null==O||null===(s=O.toDate)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID"))," "),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,m("LABEL_SURVEY_END_TIME")),l.createElement(o.Controller,{control:A,name:"toTime",defaultValue:null==L?void 0:L.toTime,rules:{required:!0,validate:{isValidToTime:Zi}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",isRequired:!0,onChange:n,defaultValue:a})}}),O&&(null==O?void 0:O.toTime)&&"required"===(null==O||null===(c=O.toTime)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),O&&(null==O?void 0:O.toTime)&&"isValidToDate"===(null==O||null===(d=O.toTime)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID"))))))},Ji=e=>l.createElement("h1",{className:"heading-m"},e.t(e.heading)),eo=()=>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"})),to=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(eo,null)),no=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null," ",t("CONFIRM_INACTIVE_SURVEY_MSG_NEW")," ",l.createElement("b",null," "+n),t("CONFIRM_INACTIVE_SURVEY_MSG_TO_INACTIVE"),l.createElement("br",null),l.createElement("br",null),t("CONFIRM_INACTIVE_SURVEY_WARN_MSG")))},lo=e=>{let{t:n,heading:a,surveyTitle:i,closeModal:o,actionCancelLabel:r,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return l.createElement(t.Modal,{headerBarMain:l.createElement(Ji,{t:n,heading:a}),headerBarEnd:l.createElement(to,{onClick:o}),actionCancelLabel:n(r),actionCancelOnSubmit:u,actionSaveLabel:n(s),actionSaveOnSubmit:c,formId:"modal-action"},l.createElement(no,{t:n,title:i}))},ao=e=>{if(e)return{...e,type:e.type.includes("_")?e.type:Oi[e.type],options:null==e?void 0:e.options,status:e.status?e.status:"ACTIVE",qorder:e.qorder}},io=e=>{var o,r,u,s,c;window.Digit.Utils.browser.isMobile();const{id:d}=i.useParams(),{t:m}=a.useTranslation(),v=i.useHistory(),[E,p]=n.useState(!1),[f,g]=n.useState(!0),[_,h]=n.useState(!1),[S,C]=n.useState(!1),[y,T]=n.useState(void 0),D=Digit.ULBService.getCurrentTenantId(),b=(null===(o=window)||void 0===o||null===(r=o.Digit.SessionStorage)||void 0===r||null===(u=r.get("CITIZENSURVEY.INBOX"))||void 0===u||null===(s=u.searchForm)||void 0===s||null===(c=s.tenantIds)||void 0===c?void 0:c.code)||D,[A,N]=n.useState(null),L=()=>{N(null)};function O(e){var t=Number(e.match(/^(\d+)/)[1]),n=Number(e.match(/:(\d+)/)[1]),l=e.match(/\s(.*)$/)[1];("PM"===l||"pm"===l&&t<12)&&(t+=12),("AM"===l||"am"===l&&12===t)&&(t-=12);var a=t.toString(),i=n.toString();return t<10&&(a="0"+a),n<10&&(i="0"+i),a+":"+i}setTimeout(()=>{L()},1e4);const{isLoading:I,data:w}=Digit.Hooks.survey.useSearch({tenantIds:b,uuid:d},{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:De(new Date(n.startDate),"yyyy-MM-dd"),toDate:De(new Date(n.endDate),"yyyy-MM-dd"),fromTime:O(new Date(n.startDate).toLocaleString("en-IN",{hour:"numeric",minute:"numeric",hour12:!0})),toTime:O(new Date(n.endDate).toLocaleString("en-IN",{hour:"numeric",minute:"numeric",hour12:!0})),questions:n.questions.map(e=>{let{questionStatement:t,type:n,required:l,options:a,uuid:i,surveyId:o,qorder:r,status:u}=e;return{questionStatement:t,type:n,required:l,options:a,uuid:i,surveyId:o,qorder:r,status:u}}),status:n.status,tenantId:{code:n.tenantId}}}}),R=n.useMemo(()=>{const e=new Date(`${null==w?void 0:w.fromDate} ${null==w?void 0:w.fromTime}`).getTime(),t=new Date(`${null==w?void 0:w.toDate} ${null==w?void 0:w.toTime}`).getTime(),n=(new Date).getTime();return e<n&&n<t},[null==w?void 0:w.fromDate,null==w?void 0:w.fromTime,null==w?void 0:w.toDate,null==w?void 0:w.toTime]),x=e=>{const{fromDate:t,toDate:n,fromTime:l,toTime:a}=e,i={SurveyEntity:{...w,status:"ACTIVE",startDate:new Date(`${t} ${l}`).getTime(),endDate:new Date(`${n} ${a}`).getTime(),questions:w.questions.map(ao),tenantId:D}};v.push("/digit-ui/employee/engagement/surveys/update-response",i)},M=n.useMemo(()=>{const e=["EDIT","DELETE"];return R&&"ACTIVE"===(null==w?void 0:w.status)?e.splice(1,0,"INACTIVE"):R||e.splice(1,0,"ACTIVE"),e},[R,null==w?void 0:w.status]);return I?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.Header,null,m("CS_COMMON_SURVEYS")),l.createElement(ki,{t:m,onEdit:e=>{var t,n;const{title:l,description:a,tenantIds:i,fromDate:o,toDate:r,fromTime:u,toTime:s,questions:c}=e,d=Ii(c,w),m={SurveyEntity:{uuid:w.uuid,tenantId:null!==(t=i[0])&&void 0!==t&&t.code?null===(n=i[0])||void 0===n?void 0:n.code:w.tenantId.code,title:l,description:a,startDate:new Date(`${o} ${u}`).getTime(),endDate:new Date(`${r} ${s}`).getTime(),questions:d,status:R?"ACTIVE":"INACTIVE"}};try{var E,p;let t={tenantIds:null!==(E=i[0])&&void 0!==E&&E.code?null===(p=i[0])||void 0===p?void 0:p.code:w.tenantId.code,title:l};Digit.Surveys.search(t).then(t=>{var n;(null==t||null===(n=t.Surveys)||void 0===n?void 0:n.length)>0&&(null==e?void 0:e.title)!==(null==w?void 0:w.title)?N({key:!0,label:"SURVEY_SAME_NAME_SURVEY_ALREADY_PRESENT"}):v.push("/digit-ui/employee/engagement/surveys/update-response",m)})}catch(e){}},menuOptions:M,displayMenu:S,isFormDisabled:f,isPartiallyEnabled:_,setDisplayMenu:C,onActionSelect:function(e){"EDIT"===e&&(R?h(!_):g(!f),T("EDIT")),"INACTIVE"===e&&(p(!0),T("INACTIVE")),"ACTIVE"===e&&(p(!0),T("ACTIVE")),"DELETE"===e&&(p(!0),T("DELETE")),C(!1)},initialSurveysConfig:w,isSurveyActive:R,formDisabled:f}),E&&"DELETE"===y&&l.createElement(Yi,{t:m,heading:"CONFIRM_DELETE_SURVEY",surveyTitle:w.title,closeModal:()=>p(!1),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:()=>p(!1),actionSaveLabel:"ES_COMMON_DEL",actionSaveOnSubmit:()=>{const e={SurveyEntity:{...w,tenantId:null!=D&&D.code?null==D?void 0:D.code:D}};v.push("/digit-ui/employee/engagement/surveys/delete-response",e)}}),E&&"ACTIVE"===y&&l.createElement(Qi,{t:m,heading:"CONFIRM_MARKACTIVE_SURVEY",initialValues:w,closeModal:()=>p(!1),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:()=>p(!1),actionSaveLabel:"ES_COMMON_SAVE",actionSaveOnSubmit:x,onSubmit:x,surveyTitle:w.title}),E&&"INACTIVE"===y&&l.createElement(lo,{t:m,heading:"CONFIRM_MARKINACTIVE_SURVEY",surveyTitle:w.title,closeModal:()=>p(!1),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:()=>p(!1),actionSaveLabel:"ES_COMMON_Y_MARKINACTIVE",actionSaveOnSubmit:()=>{const e={SurveyEntity:{...w,tenantId:D,questions:w.questions.map(ao),status:"INACTIVE"}};v.push("/digit-ui/employee/engagement/surveys/update-response",e)}}),A&&l.createElement(t.Toast,{error:A.key,label:m(A.label),onClose:L}))},oo=e=>{let{t:a,question:i,control:r,register:u,formState:s,formDisabled:c,index:d}=e;const m=null==s?void 0:s.errors;if(i)return l.createElement(t.Card,null,l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("span",{className:"question-title"},d+1,". ",i.questionStatement," ",null!=i&&i.required?"*":""),l.createElement("span",null,(e=>{var s,d,v,E,p,f,g,_;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:i.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:200,message:a("EXCEEDS_200_CHAR_LIMIT")},required:i.required})}),m&&(null==m?void 0:m[i.uuid])&&"required"===(null==m||null===(s=m[i.uuid])||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[i.uuid])&&"maxLength"===(null==m||null===(d=m[i.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:i.uuid,disabled:c,inputRef:u({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")},required:i.required})}),m&&(null==m?void 0:m[i.uuid])&&"required"===(null==m||null===(v=m[i.uuid])||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[i.uuid])&&"maxLength"===(null==m||null===(E=m[i.uuid])||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_500_CHAR_LIMIT")));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(o.Controller,{control:r,name:i.uuid,rules:{required:i.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.RadioButtons,{disabled:c,onSelect:n,selectedOption:a,optionsKey:"",options:[...i.options]})}}),m&&(null==m?void 0:m[i.uuid])&&"required"===(null==m||null===(p=m[i.uuid])||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(o.Controller,{control:r,name:i.uuid,rules:{required:i.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement("div",{className:"align-columns"},i.options.map(e=>{var i;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===(i=[a])||void 0===i||!i.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[i.uuid])&&"required"===(null==m||null===(f=m[i.uuid])||void 0===f?void 0:f.type)&&l.createElement(t.CardLabelError,{style:{marginTop:"20px"}},a("CS_COMMON_REQUIRED")));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(o.Controller,{control:r,name:i.uuid,rules:{required:i.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[i.uuid])&&"required"===(null==m||null===(g=m[i.uuid])||void 0===g?void 0:g.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(o.Controller,{control:r,name:i.uuid,rules:{required:i.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[i.uuid])&&"required"===(null==m||null===(_=m[i.uuid])||void 0===_?void 0:_.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));default:return l.createElement(t.TextInput,{name:i.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:60,message:a("EXCEEDS_60_CHAR_LIMIT")},required:i.required})})}})(i.type))))},ro=e=>{var n,i;let{surveyData:r,onFormSubmit:u,submitDisabled:s,formDisabled:c,formDefaultValues:d,isLoading:m,showToast:v,isSubmitDisabled:E}=e;const{register:p,control:f,handleSubmit:g,getValues:_,formState:h}=o.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:g(u)},null!=r&&null!==(i=r.questions)&&void 0!==i&&i.length?r.questions.map((e,t)=>l.createElement(oo,{key:t,t:S,question:e,control:f,register:p,values:_,formState:h,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:E,label:S("CS_SUBMIT_SURVEY"),submit:"submit"}))))},uo=(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},so=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])))))},co=e=>{let{surveyTitle:a,surveyDesc:o,t:r,surveyId:u}=e;const s=i.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))}),E=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:E,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:o})))},mo=["#8E29BF","#FBC02D","#048BD0","#EA8A3B","#0BABDE","#800080","#ee82ee","#616161","#3cb371","#6a5acd"],vo=Math.PI/180,Eo=e=>{let{cx:t,cy:n,midAngle:a,innerRadius:i,outerRadius:o,percent:r}=e;const u=i+.5*(o-i),s=t+u*Math.cos(-a*vo),c=n+u*Math.sin(-a*vo);return l.createElement("text",{x:s,y:c,fill:"white",textAnchor:s>t?"start":"end",dominantBaseline:"central"},(100*r).toFixed(0)+"%")},po=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)))))},fo=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(u.PieChart,{width:400,height:400},l.createElement(u.Pie,{data:t,cx:200,cy:200,labelLine:!1,label:Eo,outerRadius:120,fill:"#8884d8",dataKey:"value"},null==t?void 0:t.map((e,t)=>l.createElement(u.Cell,{key:"cell-"+t,fill:mo[t%mo.length]}))),l.createElement(u.Tooltip,null),l.createElement(u.Legend,{content:po,width:100,align:"right",wrapperStyle:{top:40,right:20,left:500,backgroundColor:"#FAFAFA",borderRadius:3,lineHeight:"40px"}}))},go=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(u.ResponsiveContainer,null,l.createElement(u.BarChart,{data:t,layout:"vertical",margin:{top:0,right:50,left:0,bottom:0},barCategoryGap:8},l.createElement(u.CartesianGrid,{strokeDasharray:"3 3"}),l.createElement(u.XAxis,{type:"number"}),l.createElement(u.YAxis,{type:"category",width:150,padding:{left:20},dataKey:"name"}),l.createElement(u.Bar,{dataKey:"value",fill:"#048BD0"}),l.createElement(u.Tooltip,null))))},_o=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]}`}},ho=e=>{let{surveyInfo:i,responsesInfoMutation:o}=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(o.isSuccess){const e=uo(null==i?void 0:i.questions,o.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,i;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===(i=a[0])||void 0===i?void 0:i.emailId}),n})}catch(e){return Promise.reject(e)}}(o.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)}},[o]),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=uo(null==i?void 0:i.questions,o.data.answers),a=[];for(let t=0;t<n;t++){const n={TimeStamp:""};null==e||e.map(e=>{n[e.questionStatement]=""});const i=null==e?void 0:e.map(e=>e.questionStatement);null==i||i.map(e=>{var a,i,o,r,u,s,c,d,m,v,E,p,f,g,_,h;const S=null==l?void 0:l.filter(t=>(null==t?void 0:t.questionStatement)===e),C="object"==typeof(null==S||null===(a=S[0])||void 0===a||null===(i=a.answers)||void 0===i?void 0:i[t])?null!=S&&null!==(o=S[0])&&void 0!==o&&null!==(r=o.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===(E=v.answers)||void 0===E?void 0:E[t])||""===(null==S||null===(p=S[0])||void 0===p||null===(f=p.answers)||void 0===f?void 0:f[t])?"NA":null==S||null===(g=S[0])||void 0===g||null===(_=g.answers)||void 0===_?void 0:_[t];n[e]=C,n.TimeStamp=null==S||null===(h=S[0])||void 0===h?void 0:h.timeStamp}),a.push(n)}return a})(null==i?void 0:i.questions,o.data.answers);return Digit.Download.Excel(e,o.data.title)})(),downloadBtnClassName:"employee-download-btn-className",label:r("SURVEY_REPORT")}),l.createElement(t.Card,null,l.createElement("div",{style:{margin:"30px"}},l.createElement(co,{surveyTitle:i.title,surveyDesc:i.description,t:r,surveyId:i.uuid})),l.createElement(so,{t:r,userInfo:c}),null==u?void 0:u.map(e=>{var n;return function(e,n,a,i,o){switch(void 0===i&&(i=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"}},`${i} ${o("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"}},`${i} ${o("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,_o(e).date),l.createElement("div",{className:"divide"}),l.createElement("div",null,_o(e).day)))));case"Time":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},`${i} ${o("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"}},`${i} ${o("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"}},`${i} ${o("SURVEY_RESPONSES")}`),l.createElement("div",{className:"responses-container",style:{padding:"30px"}},l.createElement(go,{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"}},`${i} ${o("SURVEY_RESPONSES")}`),l.createElement("div",{className:"responses-container",style:{overflow:"-moz-hidden-unscrollable"}},l.createElement(fo,{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)},So={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"},Co=()=>{const e=Digit.ULBService.getCurrentTenantId(),a=i.useParams(),o=Digit.Hooks.survey.useShowResults(),u=r.useQueryClient();n.useEffect(()=>{o.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:De(new Date(n.startDate),"yyyy-MM-dd"),toDate:De(new Date(n.endDate),"yyyy-MM-dd"),fromTime:De(new Date(n.startDate),"hh:mm"),toTime:De(new Date(n.endDate),"hh:mm"),questions:n.questions.map(e=>{let{questionStatement:t,type:n,required:l,options:a,uuid:i,surveyId:o}=e;return{questionStatement:t,type:So[n],required:l,options:a,uuid:i,surveyId:o}}),status:n.status,answersCount:n.answersCount}}});return s?l.createElement(t.Loader,null):l.createElement(ho,{surveyInfo:c,responsesInfoMutation:o})},yo=e=>{let{match:{path:n}={},tenants:a,parentRoute:o}=e;return l.createElement(i.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/inbox/create",component:e=>l.createElement(wi,e)}),l.createElement(t.PrivateRoute,{path:n+"/create",component:e=>l.createElement(wi,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/details/:id",component:e=>l.createElement(io,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/results/:id",component:e=>l.createElement(Co,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(_i,s({},e,{tenants:a,parentRoute:o}))}),l.createElement(t.PrivateRoute,{path:n+"/create-response",component:e=>l.createElement(xi,e)}),l.createElement(t.PrivateRoute,{path:n+"/update-response",component:e=>l.createElement(Pi,e)}),l.createElement(t.PrivateRoute,{path:n+"/delete-response",component:e=>l.createElement(Bi,e)}))},To=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(i.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},Do=e=>{if(!e)return;const t=[];for(const n in e)t.push({questionId:n,answer:[e[n]]});return t},bo=e=>{let{location:n}=e;const{t:i}=a.useTranslation(),o=[{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/inbox/create",content:i("CS_COMMON_SURVEYS"),show:!!n.pathname.includes("/surveys/inbox/create")},{path:"/digit-ui/employee/engagement/surveys/create",content:i("CS_COMMON_SURVEYS"),show:!!n.pathname.includes("/surveys/create")},{path:"/digit-ui/employee/engagement/survey/create-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/engagement/survey/create-response")}];return l.createElement(t.BreadCrumb,{crumbs:o})},Ao=e=>{let{path:t,tenants:a}=e;const o=i.useLocation();return l.createElement(n.Fragment,null,l.createElement(bo,{location:o}),l.createElement(i.Switch,null,l.createElement(i.Route,{path:t+"/event/inbox",exact:!0},l.createElement(Ye,{tenants:a,parentRoute:t})),l.createElement(i.Route,{path:t+"/event/response",component:e=>l.createElement(Ie,e)}),l.createElement(i.Route,{path:t+"/event/inbox/new-event"},l.createElement(N,null)),l.createElement(i.Route,{path:t+"/event/new-event"},l.createElement(N,null)),l.createElement(i.Route,{path:t+"/event/edit-event/:id"},l.createElement(Le,null)),l.createElement(i.Route,{path:t+"/event/inbox/event-details/:id"},l.createElement(Ba,null)),l.createElement(i.Route,{exact:!0,path:t+"/documents/inbox/update",component:e=>l.createElement(Za,e)}),l.createElement(i.Route,{exact:!0,path:t+"/documents/inbox/new-doc",component:()=>l.createElement(Ka,{path:t})}),l.createElement(i.Route,{exact:!0,path:t+"/documents/new-doc",component:()=>l.createElement(Ka,{path:t})}),l.createElement(i.Route,{path:t+"/documents/inbox/details/:id",component:e=>l.createElement(pi,e)}),l.createElement(i.Route,{path:t+"/documents/response",component:e=>l.createElement(Ja,e)}),l.createElement(i.Route,{path:t+"/documents/update-response",component:e=>l.createElement(ti,e)}),l.createElement(i.Route,{path:t+"/documents/delete-response",component:e=>l.createElement(li,e)}),l.createElement(i.Route,{path:t+"/documents/inbox",component:e=>l.createElement(di,{tenants:a})}),l.createElement(i.Route,{path:t+"/messages",component:e=>l.createElement(wa,s({},e,{tenants:a,parentRoute:t}))}),l.createElement(i.Route,{path:t+"/surveys",component:e=>l.createElement(yo,s({},e,{tenants:a,parentRoute:t}))})))},No={EngagementModule:e=>{let{stateCode:n,userType:a,tenants:o}=e;const{path:r,url:u}=i.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",o),l.createElement("citizen"===a?qa:Ao,{path:r,url:u,userType:a,tenants:o}))},EngagementCard:()=>{var e,i;const o=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(i=e.info)||void 0===i?void 0:i.roles).find(e=>"EMPLOYEE"===e.code);if(n.useEffect(()=>{Digit.SessionStorage.set("CITIZENSURVEY.INBOX",null)},[]),!o)return null;const r=Digit.ULBService.getCurrentTenantId(),{data:u,isLoading:c}=Digit.Hooks.engagement.useDocSearch({tenantIds:r},{select:e=>null==e?void 0:e.totalCount}),{data:d,isLoading:m}=Digit.Hooks.events.useInbox(r,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST"},{select:e=>null==e?void 0:e.totalCount}),{data:v,isLoading:E}=Digit.Hooks.events.useInbox(r,{},{eventTypes:"EVENTSONGROUND"},{select:e=>null==e?void 0:e.totalCount}),{data:p,isLoading:f}=Digit.Hooks.survey.useSearch({tenantIds:r},{select:e=>null==e?void 0:e.TotalCount}),g=n.useMemo(()=>c?"-":u,[c,u]),_=n.useMemo(()=>E?"-":v,[E,v]),h=n.useMemo(()=>m?"-":d,[m,d]),S=n.useMemo(()=>f?"-":p,[f,p]),{t:C}=a.useTranslation();let y=null;const T={Icon:l.createElement(t.SurveyIconSolid,null),moduleName:C("CS_COMMON_SURVEYS"),kpis:[{count:S,label:C("TOTAL_SURVEYS"),link:"/digit-ui/employee/engagement/surveys/inbox"}],links:[{count:S,label:C("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/surveys/inbox"},{label:C("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create"}]},D={Icon:l.createElement(t.PMBIconSolid,null),moduleName:C("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"),kpis:[{count:h,label:C("TOTAL_MESSAGES"),link:"/digit-ui/employee/engagement/messages/inbox"}],links:[{count:h,label:C("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/messages/inbox"},{label:C("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/create"}]},b={Icon:l.createElement(t.EventsIconSolid,null),moduleName:C("TOTAL_EVENTS"),kpis:[{count:_,label:C("TOTAL_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox"}],links:[{count:_,label:C("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/event/inbox"},{label:C("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/new-event"}]},A={Icon:l.createElement(t.DocumentIconSolid,null),moduleName:C("ES_TITLE_DOCS"),kpis:[{count:g,label:C("TOTAL_DOCUMENTS"),link:"/digit-ui/employee/engagement/documents/inbox"}],links:[{count:g,label:C("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/documents/inbox"},{label:C("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/new-doc"}]};return o&&(y=l.createElement(n.Fragment,null,[A,b,D,T].map((e,n)=>l.createElement(t.EmployeeModuleCard,s({key:n,longModuleName:!0},e))))),y},EngagementDocSelectULB:e=>{var a,i;let{t:r,setValue:u,config:s,formData:c,errors:d,control:m}=e;const v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),E=Digit.ULBService.getCurrentTenantId(),f=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)):E&&v?null==v?void 0:v.filter(e=>e.code===E):1===(null==_?void 0:_.length)?null==_?void 0:_[0]:null,[E,v]),g=Digit.SessionStorage.get("citizen.userRequestObject"),_=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(p),h=Digit.ULBService.getUserUlbs("SUPERUSER").sort(p);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(o.Controller,{name:s.key,control:m,defaultValue:null==f?void 0:f[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===(i=c[s.key])||void 0===i?void 0:i.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:i,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(p);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(o.Controller,{name:a.key,control:r,rules:{required:!0},render:e=>{let{onChange:a,value:i}=e;return l.createElement(t.Dropdown,{option:c,selected:i,disable:1===(null==c?void 0:c.length),optionKey:"code",t:n,select:a})}}),i&&i[null==a?void 0:a.key]&&l.createElement(CardLabelError,null,n("EVENTS_TENANT_ERROR_REQUIRED")))))},EnagementDocName:e=>{let{t:n,config:a,register:i}=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:i()}))))},EngagementDocCategory:e=>{let{t:a,config:i,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(o.Controller,{name:i.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,i;let{t:o,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"}},o("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,o(`ERROR_${null==s||null===(a=s.description)||void 0===a||null===(i=a.type)||void 0===i?void 0:i.toUpperCase()}_140`)))))},EngagementDocUploadDocument:e=>{let{t:a,config:r,formData:u,setError:s,control:d}=e;const[m,v]=n.useState(()=>{var e;return null==u||null===(e=u[r.key])||void 0===e?void 0:e.filestoreId}),[E,p]=n.useState(),[f,g]=n.useState(""),[_,h]=n.useState(),[S,C]=n.useState(!1),[D,b]=(Digit.ULBService.getCurrentTenantId(),n.useState({})),[A,N]=n.useState(!1),[L,O]=n.useState("");n.useEffect(()=>{_&&I()},[_]),n.useEffect(()=>{var e;m||C(!1),null==D||null===(e=D.onChange)||void 0===e||e.call(D,{fileStoreId:m,fileSize:E,fileType:f})},[m,D]);const I=function(){try{const e=function(e,t){try{var n=c(function(){return N(!0),Promise.resolve(Digit.UploadServices.Filestorage("engagement",_,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?v(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):s(a("CS_FILE_UPLOAD_ERROR"))})},function(){})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,function(e,t){if(N(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},w=i.useLocation(),R=n.useMemo(()=>!!w.pathname.includes("/documents/inbox/update"),[w.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(o.Controller,{name:r.key+".filestoreId",control:d,render:e=>l.createElement(t.UploadFile,{id:"city-engagement-doc",onUpload:t=>((e,t)=>{var n,l,a,i,o,r;if(h(),p(),g(),O(""),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===(i=a.files[0])||void 0===i?void 0:i.size,s=null==e||null===(o=e.target)||void 0===o||null===(r=o.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)?(p(u),g(s),b(t),void h(e.target.files[0])):void O("NOT_SUPPORTED_FILE_TYPE");O("FILE_SIZE_EXCEEDED")})(t,e),onDelete:()=>{v(null),p(100)},accept:"image/*, .pdf, .png, .jpeg, .doc",showHintBelow:!0,hintText:a("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE"),message:A?l.createElement(t.Loader,null):T(a,m,R),textStyles:{width:"100%"},inputStyles:{width:"280px"}})}),E?""+y(E):null,L?l.createElement(t.CardLabelError,null,a(L)):null)))},NotificationsAndWhatsNew:e=>{var o,r;let{variant:u,parentRoute:c}=e;const{t:d}=a.useTranslation(),m=i.useLocation(),v=i.useHistory(),E=Digit.ULBService.getCitizenCurrentTenant(),{data:{unreadCount:p}={},refetch:f}=Digit.Hooks.useNotificationCount({tenantId:E,config:{enabled:!(null===(o=Digit.UserService)||void 0===o||null===(r=o.getUser())||void 0===r||!r.access_token)}}),{mutate:g,isSuccess:_}=Digit.Hooks.useClearNotifications();n.useEffect(()=>{_&&f()},[_]),n.useEffect(()=>p&&E?g({tenantId:E}):null,[E,p]);const{data:h,isLoading:S}=Digit.Hooks.useEvents({tenantId:E,variant:u});if(S)return l.createElement(t.Loader,null);if(0===(null==h?void 0:h.length))return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,""+d("CS_HEADER_NOTIFICATIONS")),l.createElement("h1",null,"Nothing to show"));function C(e){v.push(c+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(()=>{switch(u){case"notifications":return l.createElement(t.Header,null,`${d("CS_HEADER_NOTIFICATIONS")} ${p?`(${p})`:""}`);case"whats-new":return l.createElement(t.Header,null,d("CS_HEADER_WHATSNEW"));default:return l.createElement(i.Redirect,{to:{pathname:"/digit-ui/citizen",state:{from:m.pathname+m.search}}})}},null),null!=h&&h.length?h.map(e=>"EVENTSONGROUND"===(null==e?void 0:e.eventType)?l.createElement(t.OnGroundEventCard,s({onClick:C},e)):l.createElement("BROADCAST"===(null==e?void 0:e.eventType)?xa:t.WhatsNewCard,e)):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,d("COMMON_INBOX_NO_DATA"))))},EventsListOnGround:e=>{var n,o,r,u;let{variant:c,parentRoute:d}=e;const{t:m}=a.useTranslation(),v=i.useLocation(),E=i.useHistory(),p=Digit.ULBService.getCitizenCurrentTenant(),{data:{}={},isSuccess:f}=Digit.Hooks.useNotificationCount({tenantId:p,config:{enabled:!(null===(n=Digit.UserService)||void 0===n||null===(o=n.getUser())||void 0===o||!o.access_token)}}),{data:g,isLoading:_}=Digit.Hooks.useEvents({tenantId:p,variant:c});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(i.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});if(_||!f)return l.createElement(t.Loader,null);function h(e){E.push(d+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,`${m("EVENTS_EVENTS_HEADER")}(${null==g?void 0:g.length})`),g.length?g.map(e=>l.createElement(t.OnGroundEventCard,s({onClick:h},e))):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,m("COMMON_INBOX_NO_DATA"))))},EventDetails:()=>{var e,o,r,u,s,c,d;const{t:m}=a.useTranslation(),v=i.useLocation(),{id:E}=(i.useHistory(),i.useParams()),p=Digit.ULBService.getCitizenCurrentTenant(),{data:f,isLoading:g}=Digit.Hooks.useEvents({tenantId:p,variant:"events"});if(null===(e=Digit.UserService)||void 0===e||null===(o=e.getUser())||void 0===o||!o.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(i.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});const _=n.useMemo(()=>g?null:null==f?void 0:f.filter(e=>e.id===E)[0],[g,f]);return g?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:i}=e;return{eventCategory:m(t),showEventCatergory:!0,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:i}}(_)),l.createElement("div",{className:"OnGroundEventDetailsCard"},l.createElement("p",{className:"cardCaptionBodyS"},null==_?void 0:_.description),l.createElement("div",{className:"eventAddressAndDirection"},l.createElement("span",null,l.createElement(t.MapMarker,null),l.createElement("div",null,l.createElement("p",null,null==_||null===(r=_.eventDetails)||void 0===r?void 0:r.address),null!=_&&null!==(u=_.eventDetails)&&void 0!==u&&u.latitude&&null!=_&&null!==(s=_.eventDetails)&&void 0!==s&&s.longitude?l.createElement("a",{className:"direction",target:"_blank",href:`https://www.google.com/maps/search/?api=1&query=${null==_||null===(c=_.eventDetails)||void 0===c?void 0:c.latitude}%2C${null==_||null===(d=_.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==_?void 0:_.onGroundEventTimeRange))))},EventForm:e=>{var r,u,s,c;let{formData:d,control:m,errors:v}=e;const{t:E}=a.useTranslation(),f=Digit.ULBService.getCurrentTenantId(),g=null==f?void 0:f.split(".")[0],_=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=_.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(p),{isLoading:C,data:y}=Digit.Hooks.useCommonMDMS(g,"mseva",["EventCategories"]),T=i.useLocation(),D=n.useMemo(()=>!!T.pathname.includes("/engagement/event/edit-event"),[T.pathname]);return C?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:m,defaultValue:null!=d&&d.defaultTenantId?null==_?void 0:_.find(e=>(null==e?void 0:e.code)===(null==d?void 0:d.defaultTenantId)):f?null==_?void 0:_.find(e=>(null==e?void 0:e.code)===f):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:!!D||1===(null==S?void 0:S.length),optionKey:"code",t:E,select:n})}}),v&&v.tenantId&&l.createElement(t.CardLabelError,null,E("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("EVENTS_NAME_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(o.Controller,{defaultValue:null==d?void 0:d.name,render:e=>{let{onChange:n,ref:a,value:i}=e;return l.createElement(t.TextInput,{value:i,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,E("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,E("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("EVENTS_CATEGORY_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(o.Controller,{name:"eventCategory",control:m,defaultValue:null!=d&&d.category?null==y||null===(s=y.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:i,value:o}=e;return l.createElement(t.Dropdown,{inputRef:i,option:null==y||null===(n=y.mseva)||void 0===n?void 0:n.EventCategories,optionKey:"code",t:E,select:a,selected:o})}}),v&&v.eventCategory&&l.createElement(t.CardLabelError,null,E("EVENTS_CATEGORY_ERROR_REQUIRED")))))},MessageForm:e=>{var i,r,u,s,c,d,m,v,E,p;let{formData:f,control:g,errors:_,setError:h}=e;const{t:S}=a.useTranslation(),C=Digit.ULBService.getCurrentTenantId(),y=null==C?void 0:C.split(".")[0],T=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),{isLoading:D,data:A}=Digit.Hooks.useCommonMDMS(y,"mseva",["EventCategories"]),N=Digit.ULBService.getStateId(),L=T.filter(e=>(null==e?void 0:e.code)===C);return D?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(o.Controller,{control:g,defaultValue:1===(null==L?void 0:L.length)?null==L?void 0:L[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:L,selected:a,disable:1===(null==L?void 0:L.length),optionKey:"code",t:S,select:n})}}),_&&_.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(o.Controller,{defaultValue:null==f?void 0:f.name,render:e=>{let{onChange:n,ref:a,value:i}=e;return l.createElement(t.TextInput,{value:i,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:g}),_&&(null==_?void 0:_.name)&&"required"===(null==_||null===(i=_.name)||void 0===i?void 0:i.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),_&&(null==_?void 0:_.name)&&"maxLength"===(null==_||null===(r=_.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(o.Controller,{name:"description",control:g,defaultValue:null!=f&&f.category?null==A||null===(u=A.mseva)||void 0===u||null===(s=u.EventCategories.filter(e=>e.code===(null==f?void 0:f.category)))||void 0===s?void 0:s[0]:null,rules:{required:!0,maxLength:500},render:e=>{let{onChange:n,ref:a,value:i}=e;return l.createElement(t.TextArea,{inputRef:a,value:i,name:"description",onChange:n,hintText:S("PUBLIC_BRDCST_MSG_LENGTH")})}}),_&&(null==_?void 0:_.description)&&"required"===(null==_||null===(c=_.description)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),_&&(null==_?void 0:_.description)&&"maxLength"===(null==_||null===(d=_.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(o.Controller,{name:"documents",control:g,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,i;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===(i=a.file)||void 0===i?void 0:i.type})}),n(t)},showHintBelow:!0,setuploadedstate:a,allowedFileTypesRegex:Ra,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(o.Controller,{control:g,name:"fromDate",defaultValue:null==f?void 0:f.fromDate,rules:{required:!0,validate:{isValidFromDate:e=>{const t=b(new Date(""+(null==f?void 0:f.fromDate))),n=new Date;return!(!x(t)||t.getTime()<n.getTime()&&(h("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})}}),_&&(null==_?void 0:_.fromDate)&&"required"===(null==_||null===(m=_.fromDate)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_REQUIRED")),_&&(null==_?void 0:_.fromDate)&&"isValidFromDate"===(null==_||null===(v=_.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(o.Controller,{control:g,name:"toDate",defaultValue:null==f?void 0:f.toDate,rules:{required:!0,validate:{isValidToDate:e=>{const t=b(new Date(""+(null==f?void 0:f.fromDate))),n=b(new Date(""+(null==f?void 0:f.toDate))),l=new Date;return!(!x(n)||(n.getTime()<l.getTime()||n.getTime()<t.getTime())&&(h("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})}}),_&&(null==_?void 0:_.toDate)&&"required"===(null==_||null===(E=_.toDate)||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_REQUIRED")),_&&(null==_?void 0:_.toDate)&&"isValidToDate"===(null==_||null===(p=_.toDate)||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_INVALID")))))},DocumentList:e=>{let{match:i}=e;const{t:o}=a.useTranslation(),{category:r,count:u}=i.params,s=Digit.ULBService.getCitizenCurrentTenant(),[c,d]=n.useState(20),[m,v]=n.useState(0),[E,p]=n.useState(),f=ka(E,700),{data:g,isLoading:_}=Digit.Hooks.engagement.useDocSearch({name:f,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:i,auditDetails:o,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:i,documentLink:a,createdTime:null==o?void 0:o.createdTime,fileSize:r,filestoreId:u}})}});return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,`${o(""+r)} (${u||"-"})`),l.createElement("div",{className:"documentContainerPadding"},l.createElement("div",null,l.createElement(Ua,{searchValue:E,handleKeyPress:function(e){try{return"Enter"===e.key&&E.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},handleSearch:function(e){try{return E.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},onChange:p,t:o})),_?l.createElement(t.Loader,null):g&&g.length?Ha(g,o):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,o("COMMON_INBOX_NO_DATA")))))},SelectEventGeolocation:e=>{var i,o;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===(i=s.geoLocation)||void 0===i?void 0:i.latitude,longitude:null==s||null===(o=s.geoLocation)||void 0===o?void 0:o.longitude},onChange:(e,t)=>{r(null==u?void 0:u.key,t)}}))))},SelectToDate:e=>{var i,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(o.Controller,{control:s,name:"toDate",defaultValue:null==u?void 0:u.toDate,rules:{required:!0,validate:{isValidDate:e=>!(!x(new Date(null==u?void 0:u.fromDate))||!x(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===(i=c.toDate)||void 0===i?void 0:i.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=i.useHistory(),o=Digit.ULBService.getCitizenCurrentTenant(),{data:r,isLoading:u}=Digit.Hooks.survey.useSearch({tenantIds:o},{select:e=>{let{Surveys:t}=e;const n=t.map(e=>{const t=vi(e.startDate,e.endDate);let n="";return n=t&&e.hasResponded?"CS_SURVEY_RESPONDED":t?"CS_SURVEY_YT_TO_RESPOND":"CANNOT_RESPOND_MSG",{hasResponded:!1,responseStatus:n,...e}}),l=[],a=[];for(let e of n)"ACTIVE"===e.status&&vi(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(mi,{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(mi,{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,o,r,u,s,c,d,m;const{applicationNumber:v,tenantId:E}=Digit.Hooks.useQueryParams(),{data:p,isLoading:f}=Digit.Hooks.survey.useSearch({uuid:v,tenantId:E},{}),g=null!=p&&null!==(t=p.Surveys)&&void 0!==t&&t[0]?null==p||null===(o=p.Surveys)||void 0===o?void 0:o[0]:{},{t:_}=a.useTranslation();let h=p;const[S,C]=n.useState(null);null==g||null===(r=g.questions)||void 0===r||r.sort((e,t)=>e.qorder-t.qorder);const y=i.useHistory();return n.useEffect(()=>{var e,t,n,l,a,i;p&&1==(null==h||null===(e=h.Surveys)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.hasResponded)||"true"===(null==h||null===(n=h.Surveys)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.hasResponded)?C({key:!0,label:"SURVEY_FORM_IS_ALREADY_SUBMITTED"}):p&&"INACTIVE"==(null==h||null===(a=h.Surveys)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.status)&&C({key:!0,label:"SURVEY_FORM_IS_ALREADY_INACTIVE"})},[null==p||null===(u=p.Surveys)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.hasResponded,null==h||null===(c=h.Surveys)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.hasResponded]),(null===(m=Object.keys(g))||void 0===m?void 0:m.length)>0||f?l.createElement(ro,{surveyData:g,isSubmitDisabled:!!S,isLoading:f,onFormSubmit:e=>{const t={AnswerEntity:{surveyId:g.uuid,answers:Do(e),surveyTitle:g.title,hasResponded:g.hasResponded}};y.push("/digit-ui/citizen/engagement/surveys/submit-response",t)},formDisabled:!!S,showToast:S}):l.createElement(To,{t:_})},CitizenSurveyForm:ro,ShowSurvey:e=>{var a;let{location:i}=e;const o=null==i?void 0:i.state,u=(Digit.ULBService.getCitizenCurrentTenant(),Digit.Hooks.survey.useShowResults()),s=r.useQueryClient();if(n.useEffect(()=>{u.mutate({surveyId:o.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(ro,{surveyData:o,submitDisabled:!0,formDisabled:!0,formDefaultValues:d})},SurveyResults:Co};exports.initEngagementComponents=()=>{Object.entries(No).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
|