@mseva/digit-ui-module-engagement 1.1.32 → 1.1.34
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 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +7729 -1946
- package/dist/index.modern.js.map +1 -1
- package/package.json +39 -38
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t=require("@mseva/digit-ui-react-components"),n=require("react"),l=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,a=require("react-i18next"),o=require("react-router-dom"),i=require("react-hook-form"),r=require("react-query"),u=require("react-redux"),s=require("recharts");require("react-time-picker");var c=require("redux");function d(){return(d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function m(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}function v(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function p(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}function E(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function g(e){E(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function f(e){E(1,arguments);var t=g(e);return t.setHours(0,0,0,0),t}function h(e,t){E(2,arguments);var n=f(e),l=f(t);return n.getTime()===l.getTime()}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const y=(e,t)=>e.name.toUpperCase()<t.name.toUpperCase()?-1:e.name.toUpperCase()>t.name.toUpperCase()?1:0,S=(e,t)=>{var n,l;return!(!e||!t)&&(null==e||null===(n=e.trim())||void 0===n?void 0:n.toLowerCase())===(null==t||null===(l=t.trim())||void 0===l?void 0:l.toLowerCase())},b=function(e){return Promise.resolve(v(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],Digit.ULBService.getStateId())).then(function(e){var t,n;if((null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n?void 0:n.length)>0){var l,a;const t=null===(l=e.data.fileStoreIds[0])||void 0===l?void 0:l.url;if(t.includes(".jpg")||t.includes(".png")){const e=t.split(","),[n,l,a,o]=e;return n}return null===(a=e.data.fileStoreIds[0])||void 0===a?void 0:a.url}})},function(){}))},C=function(e,t){try{if(!e||!e.length)return alert("No Document exists!"),Promise.resolve();const n=window.open("","_blank");return Promise.resolve(b(e)).then(function(e){window.mSewaApp&&window.mSewaApp.isMsewaApp()?(window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3)):(n.location=e,n.document.title=t)})}catch(e){return Promise.reject(e)}},T=(e,t)=>{if(e&&e.length)if(window.mSewaApp&&window.mSewaApp.isMsewaApp())window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3);else{const n=window.open("","_blank");n.location=e,n.document.title=t}else alert("No Document Link exists!")},D=function(e,t){try{return e&&e.length?Promise.resolve(b(e)).then(function(e){e&&Digit.Utils.downloadPDFFromLink(e)}):(alert("No Document exists!"),Promise.resolve())}catch(e){return Promise.reject(e)}},N=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB"][t]},A=(e,t,n)=>{var l;return t?n?null!=t&&null!==(l=t.fileStoreId)&&void 0!==l&&l.length?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):t?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED")},w=e=>{let t=new Date(e);if(function(e){return E(1,arguments),h(e,Date.now())}(t)){const e=new Date;t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59)}return t.getTime()},x=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59),I=[{head:"",body:[{type:"form",withoutLabel:!0,component:"EventForm",nextStep:"",route:"",key:"eventData"},{type:"text",label:"EVENTS_DESCRIPTION_LABEL",isMandatory:!0,description:"EVENTS_DESCRIPTION_TEXT",populators:{name:"description",className:"fullWidth",validation:{required:!0,maxLength:500},error:"EVENTS_DESCRIPTION_ERROR_REQUIRED"}},{type:"date",label:"EVENTS_FROM_DATE_LABEL",isMandatory:!0,populators:{name:"fromDate",className:"fullWidth",validation:{required:!0},shouldUpdate:!0,error:"EVENTS_FROM_DATE_ERROR_INVALID"}},{type:"form",key:"SelectToDate",withoutLabel:!0,component:"SelectToDate",key:"toDate"},{type:"time",label:"EVENTS_FROM_TIME_LABEL",isMandatory:!0,populators:{name:"fromTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_FROM_TIME_ERROR_REQUIRED"}},{type:"time",label:"EVENTS_TO_TIME_LABEL",isMandatory:!0,populators:{name:"toTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_TO_TIME_ERROR_REQUIRED"}},{type:"text",label:"EVENTS_ADDRESS_LABEL",isMandatory:!0,populators:{name:"address",className:"fullWidth",validation:{required:!0},error:"EVENTS_ADDRESS_ERROR_REQUIRED"}},{type:"component",component:"SelectEventGeolocation",withoutLabel:!0,key:"geoLocation"},{type:"text",label:"EVENTS_ORGANIZER_NAME_LABEL",populators:{name:"organizer",className:"fullWidth",validation:{pattern:/^[A-Za-z ]*$/},error:"EVENTS_ORGANIZER_ERROR"}},{type:"number",label:"EVENTS_ENTRY_FEE_INR_LABEL",populators:{name:"fees",className:"fullWidth",error:"EVENTS_ENTRY_ERROR_REQUIRED"}}]}],L=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[c,m,v]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[p,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),g(),v()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ES_TITLE_NEW_EVENTS")),l.createElement(t.FormComposer,{config:I,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:r,address:u,organizer:s,fees:c,geoLocation:m={}}=e,v={events:[{source:"WEBAPP",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:d({fromDate:new Date(l+" "+o).getTime(),toDate:new Date(a+" "+r).getTime(),fromTime:o,toTime:r,address:u,organizer:s,fees:c},m)}]};i.push("/digit-ui/employee/engagement/event/response",v)},label:e("EVENTS_CREATE_EVENT")}))};function O(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function R(e,t){E(2,arguments);var n=g(e).getTime(),l=O(t);return new Date(n+l)}function P(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function M(e,t){E(2,arguments);var n=g(e),l=g(t),a=n.getTime()-l.getTime();return a<0?-1:a>0?1:a}function F(e){return E(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function k(e){if(E(1,arguments),!F(e)&&"number"!=typeof e)return!1;var t=g(e);return!isNaN(Number(t))}function B(e,t){E(2,arguments);var n=g(e),l=g(t),a=n.getFullYear()-l.getFullYear(),o=n.getMonth()-l.getMonth();return 12*a+o}function U(e,t){return E(2,arguments),g(e).getTime()-g(t).getTime()}var V={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function H(e){return e?V[e]:V.trunc}function W(e){E(1,arguments);var t=g(e);return t.setHours(23,59,59,999),t}function q(e){E(1,arguments);var t=g(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function z(e){E(1,arguments);var t=g(e);return W(t).getTime()===q(t).getTime()}function j(e,t){E(2,arguments);var n,l=g(e),a=g(t),o=M(l,a),i=Math.abs(B(l,a));if(i<1)n=0;else{1===l.getMonth()&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-o*i);var r=M(l,a)===-o;z(g(e))&&1===i&&1===M(e,a)&&(r=!1),n=o*(i-Number(r))}return 0===n?0:n}function Y(e,t,n){E(2,arguments);var l=U(e,t)/1e3;return H(null==n?void 0:n.roundingMethod)(l)}var G={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function K(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,l=e.formats[n]||e.formats[e.defaultWidth];return l}}var Q={date:K({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:K({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:K({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},X={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Z(e){return function(t,n){var l,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):o;l=e.formattingValues[i]||e.formattingValues[o]}else{var r=e.defaultWidth,u=a.width?String(a.width):e.defaultWidth;l=e.values[u]||e.values[r]}return l[e.argumentCallback?e.argumentCallback(t):t]}}function $(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.width,a=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var i,r=o[0],u=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(u)?ee(u,function(e){return e.test(r)}):J(u,function(e){return e.test(r)});i=e.valueCallback?e.valueCallback(s):s,i=n.valueCallback?n.valueCallback(i):i;var c=t.slice(r.length);return{value:i,rest:c}}}function J(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function ee(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var te,ne={code:"en-US",formatDistance:function(e,t,n){var l,a=G[e];return l="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+l:l+" ago":l},formatLong:Q,formatRelative:function(e,t,n,l){return X[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),l=n%100;if(l>20||l<10)switch(l%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Z({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Z({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Z({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Z({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Z({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(te={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(te.matchPattern);if(!n)return null;var l=n[0],a=e.match(te.parsePattern);if(!a)return null;var o=te.valueCallback?te.valueCallback(a[0]):a[0];o=t.valueCallback?t.valueCallback(o):o;var i=e.slice(l.length);return{value:o,rest:i}}),era:$({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:$({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:$({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:$({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:$({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function le(e,t){E(2,arguments);var n=O(t);return R(e,-n)}function ae(e){E(1,arguments);var t=1,n=g(e),l=n.getUTCDay(),a=(l<t?7:0)+l-t;return n.setUTCDate(n.getUTCDate()-a),n.setUTCHours(0,0,0,0),n}function oe(e){E(1,arguments);var t=g(e),n=t.getUTCFullYear(),l=new Date(0);l.setUTCFullYear(n+1,0,4),l.setUTCHours(0,0,0,0);var a=ae(l),o=new Date(0);o.setUTCFullYear(n,0,4),o.setUTCHours(0,0,0,0);var i=ae(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function ie(e){E(1,arguments);var t=oe(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var l=ae(n);return l}function re(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.weekStartsOn,o=null==a?0:O(a),i=null==n.weekStartsOn?o:O(n.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var r=g(e),u=r.getUTCDay(),s=(u<i?7:0)+u-i;return r.setUTCDate(r.getUTCDate()-s),r.setUTCHours(0,0,0,0),r}function ue(e,t){E(1,arguments);var n=g(e),l=n.getUTCFullYear(),a=t||{},o=a.locale,i=o&&o.options&&o.options.firstWeekContainsDate,r=null==i?1:O(i),u=null==a.firstWeekContainsDate?r:O(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=new Date(0);s.setUTCFullYear(l+1,0,u),s.setUTCHours(0,0,0,0);var c=re(s,t),d=new Date(0);d.setUTCFullYear(l,0,u),d.setUTCHours(0,0,0,0);var m=re(d,t);return n.getTime()>=c.getTime()?l+1:n.getTime()>=m.getTime()?l:l-1}function se(e,t){E(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.firstWeekContainsDate,o=null==a?1:O(a),i=null==n.firstWeekContainsDate?o:O(n.firstWeekContainsDate),r=ue(e,t),u=new Date(0);u.setUTCFullYear(r,0,i),u.setUTCHours(0,0,0,0);var s=re(u,t);return s}function ce(e,t){for(var n=e<0?"-":"",l=Math.abs(e).toString();l.length<t;)l="0"+l;return n+l}var de={G:function(e,t,n){var l=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(l,{width:"abbreviated"});case"GGGGG":return n.era(l,{width:"narrow"});case"GGGG":default:return n.era(l,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var l=e.getUTCFullYear();return n.ordinalNumber(l>0?l:1-l,{unit:"year"})}return function(e,t){var n=e.getUTCFullYear(),l=n>0?n:1-n;return ce("yy"===t?l%100:l,t.length)}(e,t)},Y:function(e,t,n,l){var a=ue(e,l),o=a>0?a:1-a;return"YY"===t?ce(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):ce(o,t.length)},R:function(e,t){return ce(oe(e),t.length)},u:function(e,t){return ce(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(l);case"QQ":return ce(l,2);case"Qo":return n.ordinalNumber(l,{unit:"quarter"});case"QQQ":return n.quarter(l,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(l,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(l,{width:"wide",context:"formatting"})}},q:function(e,t,n){var l=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(l);case"qq":return ce(l,2);case"qo":return n.ordinalNumber(l,{unit:"quarter"});case"qqq":return n.quarter(l,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(l,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(l,{width:"wide",context:"standalone"})}},M:function(e,t,n){var l=e.getUTCMonth();switch(t){case"M":case"MM":return function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):ce(n+1,2)}(e,t);case"Mo":return n.ordinalNumber(l+1,{unit:"month"});case"MMM":return n.month(l,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(l,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(l,{width:"wide",context:"formatting"})}},L:function(e,t,n){var l=e.getUTCMonth();switch(t){case"L":return String(l+1);case"LL":return ce(l+1,2);case"Lo":return n.ordinalNumber(l+1,{unit:"month"});case"LLL":return n.month(l,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(l,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(l,{width:"wide",context:"standalone"})}},w:function(e,t,n,l){var a=function(e,t){E(1,arguments);var n=g(e),l=re(n,t).getTime()-se(n,t).getTime();return Math.round(l/6048e5)+1}(e,l);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):ce(a,t.length)},I:function(e,t,n){var l=function(e){E(1,arguments);var t=g(e),n=ae(t).getTime()-ie(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(l,{unit:"week"}):ce(l,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return ce(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,n){var l=function(e){E(1,arguments);var t=g(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var l=t.getTime(),a=n-l;return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(l,{unit:"dayOfYear"}):ce(l,t.length)},E:function(e,t,n){var l=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(l,{width:"short",context:"formatting"});case"EEEE":default:return n.day(l,{width:"wide",context:"formatting"})}},e:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ce(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ce(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var l=e.getUTCDay(),a=0===l?7:l;switch(t){case"i":return String(a);case"ii":return ce(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(l,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(l,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(l,{width:"short",context:"formatting"});case"iiii":default:return n.day(l,{width:"wide",context:"formatting"})}},a:function(e,t,n){var l=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},b:function(e,t,n){var l,a=e.getUTCHours();switch(l=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){var l,a=e.getUTCHours();switch(l=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var l=e.getUTCHours()%12;return 0===l&&(l=12),n.ordinalNumber(l,{unit:"hour"})}return function(e,t){return ce(e.getUTCHours()%12||12,t.length)}(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):function(e,t){return ce(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,n){var l=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):ce(l,t.length)},k:function(e,t,n){var l=e.getUTCHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):ce(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return ce(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return ce(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var n=t.length,l=e.getUTCMilliseconds();return ce(Math.floor(l*Math.pow(10,n-3)),t.length)}(e,t)},X:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return ve(a);case"XXXX":case"XX":return pe(a);case"XXXXX":case"XXX":default:return pe(a,":")}},x:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"x":return ve(a);case"xxxx":case"xx":return pe(a);case"xxxxx":case"xxx":default:return pe(a,":")}},O:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+me(a,":");case"OOOO":default:return"GMT"+pe(a,":")}},z:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+me(a,":");case"zzzz":default:return"GMT"+pe(a,":")}},t:function(e,t,n,l){return ce(Math.floor((l._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,l){return ce((l._originalDate||e).getTime(),t.length)}};function me(e,t){var n=e>0?"-":"+",l=Math.abs(e),a=Math.floor(l/60),o=l%60;if(0===o)return n+String(a);var i=t||"";return n+String(a)+i+ce(o,2)}function ve(e,t){return e%60==0?(e>0?"-":"+")+ce(Math.abs(e)/60,2):pe(e,t)}function pe(e,t){var n=t||"",l=e>0?"-":"+",a=Math.abs(e);return l+ce(Math.floor(a/60),2)+n+ce(a%60,2)}function Ee(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function ge(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var fe={p:ge,P:function(e,t){var n,l=e.match(/(P+)(p+)?/)||[],a=l[1],o=l[2];if(!o)return Ee(e,t);switch(a){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Ee(a,t)).replace("{{time}}",ge(o,t))}},he=["D","DD"],ye=["YY","YYYY"];function Se(e){return-1!==he.indexOf(e)}function be(e){return-1!==ye.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 Ce=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Te=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,De=/^'([^]*?)'?$/,Ne=/''/g,Ae=/[a-zA-Z]/;function we(e,t,n){E(2,arguments);var l=String(t),a=n||{},o=a.locale||ne,i=o.options&&o.options.firstWeekContainsDate,r=null==i?1:O(i),u=null==a.firstWeekContainsDate?r:O(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var s=o.options&&o.options.weekStartsOn,c=null==s?0:O(s),d=null==a.weekStartsOn?c:O(a.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!o.localize)throw new RangeError("locale must contain localize property");if(!o.formatLong)throw new RangeError("locale must contain formatLong property");var m=g(e);if(!k(m))throw new RangeError("Invalid time value");var v=P(m),p=le(m,v),f={firstWeekContainsDate:u,weekStartsOn:d,locale:o,_originalDate:m},h=l.match(Te).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,fe[t])(e,o.formatLong,f):e}).join("").match(Ce).map(function(n){if("''"===n)return"'";var l=n[0];if("'"===l)return xe(n);var i=de[l];if(i)return!a.useAdditionalWeekYearTokens&&be(n)&&_e(n,t,e),!a.useAdditionalDayOfYearTokens&&Se(n)&&_e(n,t,e),i(p,n,o.localize,f);if(l.match(Ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return n}).join("");return h}function xe(e){return e.match(De)[1].replace(Ne,"'")}function Ie(e){return function(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}({},e)}function Le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};E(2,arguments);var l=n.locale||ne;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=M(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var o,i,r=Ie(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=a,a>0?(o=g(t),i=g(e)):(o=g(e),i=g(t));var u,s=Y(i,o),c=(P(i)-P(o))/1e3,d=Math.round((s-c)/60);if(d<2)return n.includeSeconds?s<5?l.formatDistance("lessThanXSeconds",5,r):s<10?l.formatDistance("lessThanXSeconds",10,r):s<20?l.formatDistance("lessThanXSeconds",20,r):s<40?l.formatDistance("halfAMinute",null,r):l.formatDistance(s<60?"lessThanXMinutes":"xMinutes",1,r):0===d?l.formatDistance("lessThanXMinutes",1,r):l.formatDistance("xMinutes",d,r);if(d<45)return l.formatDistance("xMinutes",d,r);if(d<90)return l.formatDistance("aboutXHours",1,r);if(d<1440){var m=Math.round(d/60);return l.formatDistance("aboutXHours",m,r)}if(d<2520)return l.formatDistance("xDays",1,r);if(d<43200){var v=Math.round(d/1440);return l.formatDistance("xDays",v,r)}if(d<86400)return u=Math.round(d/43200),l.formatDistance("aboutXMonths",u,r);if((u=j(i,o))<12){var p=Math.round(d/43200);return l.formatDistance("xMonths",p,r)}var f=u%12,h=Math.floor(u/12);return f<3?l.formatDistance("aboutXYears",h,r):f<9?l.formatDistance("overXYears",h,r):l.formatDistance("almostXYears",h+1,r)}const Oe=()=>{var e,i,r,u,s,c,m,v,p;const{t:E}=a.useTranslation(),g=o.useHistory(),{id:f}=o.useParams(),h=Digit.ULBService.getCurrentTenantId(),{isLoading:y,data:S}=Digit.Hooks.events.useInbox(h,{},{eventTypes:"EVENTSONGROUND",ids:f},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[b,_,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[T,D,N]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[A,w,x]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);if(n.useEffect(()=>{_(!1),x(),N()},[]),y)return l.createElement(t.Loader,null);const L={defaultTenantId:null==S?void 0:S.tenantId,name:null==S?void 0:S.name,fromDate:we(new Date(null==S||null===(e=S.eventDetails)||void 0===e?void 0:e.fromDate),"yyyy-MM-dd"),toDate:we(new Date(null==S||null===(i=S.eventDetails)||void 0===i?void 0:i.toDate),"yyyy-MM-dd"),organizer:null==S||null===(r=S.eventDetails)||void 0===r?void 0:r.organizer,fees:null==S||null===(u=S.eventDetails)||void 0===u?void 0:u.fees,description:null==S?void 0:S.description,address:null==S||null===(s=S.eventDetails)||void 0===s?void 0:s.address,category:null==S?void 0:S.eventCategory,fromTime:we(new Date(null==S||null===(c=S.eventDetails)||void 0===c?void 0:c.fromDate),"HH:mm"),toTime:we(new Date(null==S||null===(m=S.eventDetails)||void 0===m?void 0:m.toDate),"HH:mm"),geoLocation:{latitude:null==S||null===(v=S.eventDetails)||void 0===v?void 0:v.latitude,longitude:null==S||null===(p=S.eventDetails)||void 0===p?void 0:p.longitude}};return l.createElement(n.Fragment,null,l.createElement(t.Header,null,E("ES_TITLE_EDIT_EVENTS")),l.createElement(t.FormComposer,{defaultValues:L,config:I,onSubmit:e=>{var t,n;const{fromDate:l,toDate:a,fromTime:o,toTime:i,address:r,organizer:u,fees:s,geoLocation:c}=e,m={events:[d({},S,{source:"WEBAPP",status:"ACTIVE",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:d({},null==S?void 0:S.eventDetails,{fromDate:new Date(l+" "+o).getTime(),toDate:new Date(a+" "+i).getTime(),fromTime:o,toTime:i,address:r,organizer:u,fees:s,latitude:null==c?void 0:c.latitude,longitude:null==c?void 0:c.longitude})})]};g.push("/digit-ui/employee/engagement/event/response?update=true",m)},label:E("EVENTS_SAVE_CHANGES")}))},Re=e=>{var n,o,i;const{t:r}=a.useTranslation();return l.createElement(t.Banner,{message:r(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,info:r("ENGAGEMENT_EVENT_NAME"),successful:e.isSuccess})},Pe=e=>{var i,u,s,c,d,m,v;const p=r.useQueryClient(),{t:E}=a.useTranslation(),g=Digit.Hooks.useQueryParams(),f=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),h=Digit.Hooks.events.useUpdateEvent(),[y,S]=n.useState(!1),{state:b}=e.location,[_,C,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[D,N,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1),[w,x,I]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),L=(e,t)=>{var n,l,a;x((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),C(!0)};if(n.useEffect(()=>{f.data&&N(f.data)},[f.data]),n.useEffect(()=>{h.data&&N(h.data)},[h.data]),n.useEffect(()=>{const e=()=>{C(!0),p.clear()};return _?()=>{p.clear()}:Boolean(null==g?void 0:g.delete)||Boolean(null==g?void 0:g.update)?void h.mutate(b,{onError:L,onSuccess:e}):void f.mutate(b,{onError:L,onSuccess:e})},[]),null!=g&&g.delete||null!=g&&g.update)return h.isLoading||h.isIdle&&!_?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Re,{t:E,message:null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED",data:h.data||D,isSuccess:(null==h?void 0:h.isSuccess)||D,isLoading:h.isIdle&&!_||h.isLoading}),l.createElement(t.CardText,null,E(null!=g&&g.update?h.isSuccess||D?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||D?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))));if(f.isLoading||f.isIdle&&!_)return l.createElement(t.Loader,null);const O=(null==f||null===(i=f.data)||void 0===i||null===(u=i.events)||void 0===u?void 0:u[0])||(null==D||null===(s=D.events)||void 0===s?void 0:s[0])||{};return l.createElement(t.Card,null,l.createElement(Re,{t:E,message:f.isSuccess||D?"ENGAGEMENT_EVENT_CREATED_MESSAGE":"ENGAGEMENT_EVENT_FAILED_MESSAGES",data:f.data||D,isSuccess:f.isSuccess||D,isLoading:f.isIdle&&!_||f.isLoading}),l.createElement(t.CardText,null,f.isSuccess||D?E("ENGAGEMENT_EVENT_CREATED_MESSAGES",{eventName:null==O?void 0:O.name,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==O||null===(c=O.eventDetails)||void 0===c?void 0:c.fromDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==O||null===(d=O.eventDetails)||void 0===d?void 0:d.toDate),fromTime:f.isSuccess?we(new Date(null==O||null===(m=O.eventDetails)||void 0===m?void 0:m.fromDate),"HH:mm"):null,toTime:f.isSuccess?we(new Date(null==O||null===(v=O.eventDetails)||void 0===v?void 0:v.toDate),"HH:mm"):null}):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))))},Me=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p})},Fe=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:i}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:i})},ke=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:m,formState:v,reset:p,control:E}=i.useForm({defaultValues:a}),g=innerWidth<=640,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=(Digit.ULBService.getCurrentTenantId(),Digit.UserService.getUser().info),S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),b=()=>{p({ulb:null,eventName:""}),n({ulb:null,eventName:""})},_=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:b},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(e=>{n(e),"mobile"===r&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(Fe,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,_()))))),("mobile"===r||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},_(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Be=e=>{let{title:n="EVENTS_EVENTS_HEADER",links:i,icon:r="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},"calender"===r?l.createElement(t.EventCalendar,null):"survey"===r?"surveyIcon":l.createElement(t.DocumentIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},i.map((e,t)=>{let{link:n,text:a,hyperlink:i=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Ue=e=>{var n,o;let{status:i,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:s(i),pageType:"employee"})},Ve=["ACTIVE","INACTIVE"],He=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==Ve?void 0:Ve.map((e,a)=>l.createElement(Ue,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},We=e=>{var o;let{type:i="desktop",onClose:r,onFilterChange:u,searchParams:s}=e;const{t:c}=a.useTranslation(),[m,v]=n.useState(()=>d({},s)),p=Digit.ULBService.getCurrentTenantId(),E=null==p?void 0:p.split(".")[0],{isLoading:g,data:f}=Digit.Hooks.useCommonMDMS(E,"mseva",["EventCategories"]),h=()=>{v({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),u({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==r||r()},y=e=>{v(d({},m,e))};return g?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},c("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:h},c("ES_COMMON_CLEAR_ALL")),"desktop"===i&&l.createElement("span",{className:"clear-search",onClick:h},l.createElement(t.RefreshIcon,null)),"mobile"===i&&l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+c("EVENTS_CATEGORY_LABEL")),l.createElement(t.Dropdown,{option:null==f||null===(o=f.mseva)||void 0===o?void 0:o.EventCategories,optionKey:"code",t:c,selected:null==m?void 0:m.eventCategory,select:e=>y({eventCategory:e})}),l.createElement(t.DateRange,{t:c,values:null==m?void 0:m.range,onFilterChange:y,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(He,{onAssignmentChange:(e,t)=>{var n;y(e.target.checked?{eventStatus:[...(null==m?void 0:m.eventStatus)||[],t]}:{eventStatus:null==m||null===(n=m.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:m})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(u(m),void(null==r||r())),label:c("ES_COMMON_APPLY")}))))},qe=e=>l.createElement("span",{className:""},e),ze=e=>{let{isLoading:n,data:a,t:i,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:p,onFilterChange:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:b}=e;const _=l.useMemo(()=>[{Header:i("EVENTS_EVENT_NAME_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:u+"/event/inbox/event-details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_EVENT_CATEGORY_LABEL"),accessor:e=>qe(null!=e&&e.eventCategory?i("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)):"")},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?qe(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?qe(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return qe((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let C;return n?C=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(C=l.createElement(Me,{t:i,data:a,columns:_,globalSearch:m,onSearch:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:b,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(We,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(ke,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},C)))},je=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,serviceRequestIdKey:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i);Digit.ULBService.getCurrentTenantId(),o.useHistory(),n.useEffect(()=>{m&&E(!0)},[m]);const h=()=>{E(!1),f(i)};let y;return 0===(null==c?void 0:c.length)?y=l.createElement(t.Card,{style:{marginTop:20}},s("ES_NO_EVENTS").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):c&&(null==c?void 0:c.length)>0&&(y=l.createElement(t.DetailsCard,{data:c,linkPrefix:"/digit-ui/employee/engagement/event/inbox/event-details/",serviceRequestIdKey:d})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),y,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(We,{onFilterChange:r,onClose:h,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(ke,{t:s,type:"mobile",onClose:h,onSearch:u,searchParams:i,searchFields:a}))))},Ye=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),Ge=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:a,icon:o,links:i}),l.createElement(je,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s,c,d,m,v,p;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(i=u.ulb)||void 0===i?void 0:i.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!k(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(p=u.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a;return{applicationNo:null==e?void 0:e.id,[n("EVENTS_EVENT_NAME_LABEL")]:null==e?void 0:e.name,[n("EVENTS_EVENT_CATEGORY_LABEL")]:n("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)),[n("EVENTS_START_DATE_LABEL")]:we(new Date(null==e||null===(t=e.eventDetails)||void 0===t?void 0:t.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:we(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(a=e.user)||void 0===a?void 0:a.name,[n("EVENTS_STATUS_LABEL")]:Ye(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,serviceRequestIdKey:"applicationNo"}))))},Ke=e=>{var o;let{tenants:i,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const s=Digit.ULBService.getCurrentTenantId(),[c,m]=n.useState(10),[v,p]=n.useState(0),[E,g]=n.useState({eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const h=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_NAME_LABEL"),name:"eventName"}],y=[{text:u("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox/new-event"}],{data:S,isLoading:b}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{eventTypes:"EVENTSONGROUND",limit:c,offset:v},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),_=e=>{let t=d({},e);null!=e&&e.ulb||(t=d({},e,{ulb:{code:s}})),g(d({},E,t))},C=e=>{g(d({},E,e))},T=n.useCallback(()=>{p(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{p(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(Ge,{data:null==S?void 0:S.events,searchParams:E,searchFields:h(),t:u,onFilterChange:C,onSearch:_,isLoading:b,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:y}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_EVENTS_HEADER"),Number(null==S?void 0:S.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==S?void 0:S.totalCount)):null),l.createElement(ze,{t:u,data:null==S?void 0:S.events,links:y,parentRoute:r,searchParams:E,onSearch:_,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.eventName||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.eventName.toUpperCase())))&&(null==E||null===(i=E.ulb)||void 0===i||!i.code||e.original.tenantId===(null==E||null===(r=E.ulb)||void 0===r?void 0:r.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!k(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:h(),onFilterChange:C,pageSizeLimit:c,totalRecords:null==S?void 0:S.totalCount,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:y,currentPage:parseInt(v/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{m(t=>e.target.value)}}))},Qe=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:s,getCellProps:u,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p})},Xe=e=>{let{ulb:n,onAssignmentChange:a,value:o,t:i}=e;return l.createElement(t.Dropdown,{option:n,optionKey:"code",selected:o,select:a,t:i})},Ze=e=>{let{onSearch:n,searchParams:a,searchFields:o,type:r,onClose:u,isInboxPage:s,t:c}=e;const{handleSubmit:m,formState:v,reset:p,control:E}=i.useForm({defaultValues:a}),g=innerWidth<=640,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),b=()=>{p({ulb:null,name:""}),n({ulb:null,name:""})},_=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:b},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:m(e=>{n(e),"mobile"===r&&u()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(Xe,{onAssignmentChange:e.onChange,value:e.value,ulb:S,t:c}),name:e.name,control:E,defaultValue:null});case"range":return l.createElement(i.Controller,{render:e=>{let{value:n,onChange:a}=e;return l.createElement(t.DateRange,{t:c,values:n,onFilterChange:e=>a(e.range),labelClass:"filter-label"})},name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,_()))))),("mobile"===r||g)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},_(g)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},$e=e=>{let{title:n="CS_HEADER_PUBLIC_BRDCST",links:i,icon:r="calender"}=e;const{t:u}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header",style:{justifyContent:"flex-start"}},l.createElement("span",{className:"logo",style:{backgroundColor:"#fff"}},l.createElement(t.PMBIcon,null))," ",l.createElement("span",{className:"text"},u(n))),l.createElement("div",{className:"body"},i.map((e,t)=>{let{link:n,text:a,hyperlink:i=!1,accessTo:r=[]}=e;return l.createElement("span",{className:"link",key:t},i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},Je=e=>{var n,o;let{status:i,onAssignmentChange:r,searchParams:u}=e;const{t:s}=a.useTranslation();return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==u||null===(n=u.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:s(i),pageType:"employee"})},et=["ACTIVE","INACTIVE"],tt=e=>{let{onAssignmentChange:t,searchParams:n}=e;const{t:o}=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},o("ES_INBOX_STATUS")),null==et?void 0:et.map((e,a)=>l.createElement(Je,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},nt=e=>{let{type:o="desktop",onClose:i,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,m]=n.useState(()=>d({},u)),v=Digit.ULBService.getCurrentTenantId(),p=null==v?void 0:v.split(".")[0],{isLoading:E}=Digit.Hooks.useCommonMDMS(p,"mseva",["EventCategories"]),g=()=>{m({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),r({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==i||i()},f=n.useCallback(e=>{m(t=>d({},t,e))},[]);return E?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:g},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:g},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:i},l.createElement(t.CloseSvg,null))),l.createElement(t.DateRange,{t:s,values:null==c?void 0:c.range,onFilterChange:f,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(tt,{onAssignmentChange:(e,t)=>{var n;f(e.target.checked?{eventStatus:[...(null==c?void 0:c.eventStatus)||[],t]}:{eventStatus:null==c||null===(n=c.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:c})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(r(c),void(null==i||i())),label:s("ES_COMMON_APPLY")}))))},lt=e=>l.createElement("span",{className:""},e),at=e=>{let{isLoading:n,data:a,t:i,onSearch:r,parentRoute:u,title:s,iconName:c,links:d,globalSearch:m,searchFields:v,searchParams:p,onFilterChange:E,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:b}=e;const _=l.useMemo(()=>[{Header:i("EVENTS_MESSAGE_LABEL"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:u+"/messages/inbox/details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_POSTING_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?lt(we(new Date(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime),"dd/MM/yyyy")):""}},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?lt(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?lt(we(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return lt((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let C;return n?C=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(C=l.createElement(Qe,{t:i,data:a,columns:_,globalSearch:m,onSearch:p,pageSizeLimit:g,totalRecords:f,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:b,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement($e,{title:s,icon:c,links:d}),l.createElement("div",null,l.createElement(nt,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(Ze,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},C)))},ot=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i),h=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&E(!0)},[m]);const y=()=>{E(!1),f(i)};let b;return 0===(null==c?void 0:c.length)?b=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&&(b=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>{var n;return S(null==t||null===(n=t.user)||void 0===n?void 0:n.name,e["Posted By"])&&S(t.name,e.Title)});t&&h.push("/digit-ui/employee/engagement/messages/inbox/details/"+(null==t?void 0:t.id))}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),b,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(nt,{onFilterChange:r,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Ze,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:i,searchFields:a}))))},it=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),rt=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement($e,{title:a,icon:o,links:i}),l.createElement(ot,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s,c,d,m,v,p;return(!((null==u||null===(t=u.eventStatus)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==u||!u.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==u||null===(o=u.ulb)||void 0===o||!o.code||e.tenantId===(null==u||null===(i=u.ulb)||void 0===i?void 0:i.code))&&(null==u||!u.eventCategory||e.eventCategory===(null==u||null===(r=u.eventCategory)||void 0===r?void 0:r.code))&&(!k(null==u||null===(s=u.range)||void 0===s?void 0:s.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==u||null===(d=u.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==u||null===(m=u.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==u||null===(p=u.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a,o;return{[n("PUBLIC_BRDCST_TITLE_LABEL")]:null==e?void 0:e.name,[n("EVENTS_POSTING_DATE_LABEL")]:we(new Date(null==e||null===(t=e.auditDetails)||void 0===t?void 0:t.createdTime),"dd/MM/yyyy"),[n("EVENTS_START_DATE_LABEL")]:we(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:we(new Date(null==e||null===(a=e.eventDetails)||void 0===a?void 0:a.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(o=e.user)||void 0===o?void 0:o.name,[n("EVENTS_STATUS_LABEL")]:it(n(null==e?void 0:e.status))}}),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,responseData:t}))))},ut=e=>{var o;let{tenants:i,parentRoute:r}=e;const{t:u}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const s=Digit.ULBService.getCurrentTenantId(),[c,m]=n.useState(10),[v,p]=n.useState(0),[E,g]=n.useState({eventStatus:[],name:"",range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===s)});let f=window.Digit.Utils.browser.isMobile();const{data:h,isLoading:y}=Digit.Hooks.events.useInbox(null==E||null===(o=E.ulb)||void 0===o?void 0:o.code,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST",limit:c,offset:v},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),S=e=>{let t=d({},e);null!=e&&e.ulb||(t=d({},e,{ulb:{code:s}})),g(e=>d({},e,t))},b=e=>{g(t=>d({},t,e))},_=()=>[{label:u("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:u("EVENTS_MESSAGE_LABEL"),name:"name"}],C=[{text:u("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/inbox/create"}],T=n.useCallback(()=>{p(e=>parseInt(e)+parseInt(c))},[c]),D=n.useCallback(()=>{p(e=>parseInt(e)-parseInt(c))},[c]);return f?l.createElement(rt,{data:null==h?void 0:h.events,searchParams:E,searchFields:_(),t:u,onFilterChange:b,onSearch:S,isLoading:y,title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",iconName:"calender",links:C}):l.createElement("div",null,l.createElement(t.Header,null,u("EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER"),Number(null==h?void 0:h.length)?l.createElement("p",{className:"inbox-count"},Number(null==h?void 0:h.length)):null),l.createElement(at,{t:u,data:null==h?void 0:h.events,links:C,parentRoute:r,searchParams:E,onSearch:S,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,u,s,c,d,m,v,p;return(!((null==E||null===(t=E.eventStatus)||void 0===t?void 0:t.length)>0)||(null==E||null===(n=E.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==E||!E.name||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==E?void 0:E.name.toUpperCase())))&&(null==E||null===(i=E.ulb)||void 0===i||!i.code||e.original.tenantId===(null==E||null===(r=E.ulb)||void 0===r?void 0:r.code))&&(null==E||!E.eventCategory||e.original.eventCategory===(null==E||null===(u=E.eventCategory)||void 0===u?void 0:u.code))&&(!k(null==E||null===(s=E.range)||void 0===s?void 0:s.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==E||null===(d=E.range)||void 0===d?void 0:d.startDate).getTime())&&(!k(null==E||null===(m=E.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==E||null===(p=E.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:_(),onFilterChange:b,pageSizeLimit:c,totalRecords:null==h?void 0:h.totalCount,currentPage:parseInt(v/c),onNextPage:T,onPrevPage:D,onPageSizeChange:e=>{m(t=>e.target.value)},title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",links:C,isLoading:y}))},st=[{head:"",body:[{type:"form",withoutLabel:!0,component:"MessageForm",nextStep:"",route:"",key:"messageData"}]}],ct=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u,s]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[c,d,m]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[v,p,E]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{u(!1),E(),m()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ADD_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{config:st,onSubmit:e=>{var t,n,l;const{fromDate:a,toDate:o,description:r,name:u,documents:s}=e,c={events:[{recepient:null,source:"WEBAPP",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:r,name:u,eventDetails:{documents:s,fromDate:null===(n=x(new Date(""+a)))||void 0===n?void 0:n.getTime(),toDate:null===(l=x(new Date(""+o)))||void 0===l?void 0:l.getTime()}}]};i.push("/digit-ui/employee/engagement/messages/response",c)},label:e("ACTION_ADD_NEW_MESSAGE")}))},dt=e=>{var n,o,i;const{t:r}=a.useTranslation();return l.createElement(t.Banner,{message:r(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,successful:e.isSuccess})},mt=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=Digit.Hooks.useQueryParams(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),d=Digit.Hooks.events.useUpdateEvent(),{state:m}=e.location,[v,p,E]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1),[y,S,b]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1);n.useEffect(()=>{d.data&&f(d.data)},[d.data]),n.useEffect(()=>{c.data&&f(c.data)},[c.data]);const _=(e,t)=>{var n,l,a;S((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.code)||"ERROR"),p(!0)};return n.useEffect(()=>{const e=()=>{p(!0),i.clear()};if(!v){if(Boolean(null==s?void 0:s.delete)||Boolean(null==s?void 0:s.update))return void d.mutate(m,{onError:_,onSuccess:e});c.mutate(m,{onError:_,onSuccess:e})}},[]),null!=s&&s.delete||null!=s&&s.update?d.isLoading||d.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(dt,{t:u,message:null!=s&&s.update?d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_UPDATED":"ENG_PUBLIC_BRDCST_UPDATION_FAILED":d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_DELETED":"ENGAGEMENT_PUBLIC_BRDCST_DELETION_FAILED",data:d.data||g,isSuccess:(null==d?void 0:d.isSuccess)||g,isLoading:d.isIdle&&!v||d.isLoading}),l.createElement(t.CardText,null,u("ENGAGEMENT_PUBLIC_BRDCST_MESSAGES")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")})))):c.isLoading||c.isIdle&&!v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(dt,{t:u,message:c.isSuccess||g?"ENGAGEMENT_BROADCAST_MESSAGE_CREATED":"ENGAGEMENT_BROADCAST_MESSAGE_FAILED",data:c.data||g,isSuccess:c.isSuccess||g,isLoading:c.isIdle&&!v||c.isLoading}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},vt=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),{id:r}=o.useParams(),u=Digit.ULBService.getCurrentTenantId(),{isLoading:s,data:c}=Digit.Hooks.events.useInbox(u,{},{eventTypes:"BROADCAST",ids:r},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),[m,v,p]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[E,g,f]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[h,y,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{v(!1),S(),f()},[]);const b=n.useMemo(()=>{var e,t,n;const l=null==c||null===(e=c.eventDetails)||void 0===e?void 0:e.documents;return{name:null==c?void 0:c.name,description:null==c?void 0:c.description,documents:null==l?void 0:l.map(e=>[e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:u}}]),fromDate:c?we(new Date(null==c||null===(t=c.eventDetails)||void 0===t?void 0:t.fromDate),"yyyy-MM-dd"):null,toDate:c?we(new Date(null==c||null===(n=c.eventDetails)||void 0===n?void 0:n.toDate),"yyyy-MM-dd"):null}},[c]);return s?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("EDIT_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{defaultValues:b,config:st,onSubmit:e=>{var t;const{fromDate:n,toDate:l,description:a,name:o,documents:r}=e,u=(e=>!(!e||!e.length||!(Array.isArray(e)&&e.length&&Array.isArray(e[0]))))(r)?(s=r)&&s.length?s.reduce((e,t)=>{let n={};const[l,{file:a,fileStoreId:o}]=t;return n.fileName=null==a?void 0:a.name,n.documentType=null==a?void 0:a.type,n.fileStoreId=null==o?void 0:o.fileStoreId,e.push(n),e},[]):[]:r;var s;const m={events:[d({},c,{source:"WEBAPP",status:"ACTIVE",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:a,name:o,eventDetails:{documents:u,fromDate:w(""+n),toDate:w(""+l)}})]};i.push("/digit-ui/employee/engagement/messages/response?update=true",m)},label:e("ACTION_EDIT_MESSAGE")}))};var pt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Et(e,t){return e(t={exports:{}},t.exports),t.exports}var gt="function"==typeof Symbol&&Symbol.for,ft=gt?Symbol.for("react.element"):60103,ht=gt?Symbol.for("react.portal"):60106,yt=gt?Symbol.for("react.fragment"):60107,St=gt?Symbol.for("react.strict_mode"):60108,bt=gt?Symbol.for("react.profiler"):60114,_t=gt?Symbol.for("react.provider"):60109,Ct=gt?Symbol.for("react.context"):60110,Tt=gt?Symbol.for("react.async_mode"):60111,Dt=gt?Symbol.for("react.concurrent_mode"):60111,Nt=gt?Symbol.for("react.forward_ref"):60112,At=gt?Symbol.for("react.suspense"):60113,wt=gt?Symbol.for("react.suspense_list"):60120,xt=gt?Symbol.for("react.memo"):60115,It=gt?Symbol.for("react.lazy"):60116,Lt=gt?Symbol.for("react.block"):60121,Ot=gt?Symbol.for("react.fundamental"):60117,Rt=gt?Symbol.for("react.responder"):60118,Pt=gt?Symbol.for("react.scope"):60119;function Mt(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case ft:switch(e=e.type){case Tt:case Dt:case yt:case bt:case St:case At:return e;default:switch(e=e&&e.$$typeof){case Ct:case Nt:case It:case xt:case _t:return e;default:return t}}case ht:return t}}}function Ft(e){return Mt(e)===Dt}var kt={AsyncMode:Tt,ConcurrentMode:Dt,ContextConsumer:Ct,ContextProvider:_t,Element:ft,ForwardRef:Nt,Fragment:yt,Lazy:It,Memo:xt,Portal:ht,Profiler:bt,StrictMode:St,Suspense:At,isAsyncMode:function(e){return Ft(e)||Mt(e)===Tt},isConcurrentMode:Ft,isContextConsumer:function(e){return Mt(e)===Ct},isContextProvider:function(e){return Mt(e)===_t},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===ft},isForwardRef:function(e){return Mt(e)===Nt},isFragment:function(e){return Mt(e)===yt},isLazy:function(e){return Mt(e)===It},isMemo:function(e){return Mt(e)===xt},isPortal:function(e){return Mt(e)===ht},isProfiler:function(e){return Mt(e)===bt},isStrictMode:function(e){return Mt(e)===St},isSuspense:function(e){return Mt(e)===At},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===yt||e===Dt||e===bt||e===St||e===At||e===wt||"object"==typeof e&&null!==e&&(e.$$typeof===It||e.$$typeof===xt||e.$$typeof===_t||e.$$typeof===Ct||e.$$typeof===Nt||e.$$typeof===Ot||e.$$typeof===Rt||e.$$typeof===Pt||e.$$typeof===Lt)},typeOf:Mt},Bt=Et(function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,r=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,f=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var v=e.type;switch(v){case s:case c:case a:case i:case o:case m:return v;default:var g=v&&v.$$typeof;switch(g){case u:case d:case E:case p:case r:return g;default:return t}}case l:return t}}}var b=c,_=u,C=r,T=n,D=d,N=a,A=E,w=p,x=l,I=i,L=o,O=m,R=!1;function P(e){return S(e)===c}t.AsyncMode=s,t.ConcurrentMode=b,t.ContextConsumer=_,t.ContextProvider=C,t.Element=T,t.ForwardRef=D,t.Fragment=N,t.Lazy=A,t.Memo=w,t.Portal=x,t.Profiler=I,t.StrictMode=L,t.Suspense=O,t.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(e)||S(e)===s},t.isConcurrentMode=P,t.isContextConsumer=function(e){return S(e)===u},t.isContextProvider=function(e){return S(e)===r},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return S(e)===d},t.isFragment=function(e){return S(e)===a},t.isLazy=function(e){return S(e)===E},t.isMemo=function(e){return S(e)===p},t.isPortal=function(e){return S(e)===l},t.isProfiler=function(e){return S(e)===i},t.isStrictMode=function(e){return S(e)===o},t.isSuspense=function(e){return S(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===c||e===i||e===o||e===m||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===p||e.$$typeof===r||e.$$typeof===u||e.$$typeof===d||e.$$typeof===f||e.$$typeof===h||e.$$typeof===y||e.$$typeof===g)},t.typeOf=S}()}),Ut=Et(function(e){e.exports="production"===process.env.NODE_ENV?kt:Bt}),Vt=Object.getOwnPropertySymbols,Ht=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;function qt(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var zt=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,a=qt(e),o=1;o<arguments.length;o++){for(var i in n=Object(arguments[o]))Ht.call(n,i)&&(a[i]=n[i]);if(Vt){l=Vt(n);for(var r=0;r<l.length;r++)Wt.call(n,l[r])&&(a[l[r]]=n[l[r]])}}return a},jt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Yt=Function.call.bind(Object.prototype.hasOwnProperty),Gt=function(){};if("production"!==process.env.NODE_ENV){var Kt=jt,Qt={},Xt=Yt;Gt=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function Zt(e,t,n,l,a){if("production"!==process.env.NODE_ENV)for(var o in e)if(Xt(e,o)){var i;try{if("function"!=typeof e[o]){var r=Error((l||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}i=e[o](t,o,l,n,null,Kt)}catch(e){i=e}if(!i||i instanceof Error||Gt((l||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in Qt)){Qt[i.message]=!0;var u=a?a():"";Gt("Failed "+n+" type: "+i.message+(null!=u?u:""))}}}Zt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Qt={})};var $t=Zt,Jt=function(){};function en(){return null}function tn(){}function nn(){}"production"!==process.env.NODE_ENV&&(Jt=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),nn.resetWarningCache=tn;var ln=Et(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,l={array:r("array"),bigint:r("bigint"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),symbol:r("symbol"),any:i(en),arrayOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=t[n];if(!Array.isArray(r))return new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected an array.");for(var u=0;u<r.length;u++){var s=e(r,u,l,a,i+"["+u+"]",jt);if(s instanceof Error)return s}return null})},element:i(function(t,n,l,a,i){var r=t[n];return e(r)?null:new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:i(function(e,t,n,l,a){var i=e[t];return Ut.isValidElementType(i)?null:new o("Invalid "+l+" `"+a+"` of type `"+c(i)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return i(function(t,n,l,a,i){var r;return t[n]instanceof e?null:new o("Invalid "+a+" `"+i+"` of type `"+((r=t[n]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:i(function(e,t,n,l,a){return s(e[t])?null:new o("Invalid "+l+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=t[n],u=c(r);if("object"!==u)return new o("Invalid "+a+" `"+i+"` of type `"+u+"` supplied to `"+l+"`, expected an object.");for(var s in r)if(Yt(r,s)){var d=e(r,s,l,a,i+"."+s,jt);if(d instanceof Error)return d}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Jt(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),en;function t(t,n,l,i,r){for(var u=t[n],s=0;s<e.length;s++)if(a(u,e[s]))return null;var c=JSON.stringify(e,function(e,t){return"symbol"===d(t)?String(t):t});return new o("Invalid "+i+" `"+r+"` of value `"+String(u)+"` supplied to `"+l+"`, expected one of "+c+".")}return i(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Jt("Invalid argument supplied to oneOfType, expected an instance of array."),en;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return Jt("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+m(n)+" at index "+t+"."),en}return i(function(t,n,l,a,i){for(var r=[],u=0;u<e.length;u++){var s=(0,e[u])(t,n,l,a,i,jt);if(null==s)return null;s.data&&Yt(s.data,"expectedType")&&r.push(s.data.expectedType)}return new o("Invalid "+a+" `"+i+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return i(function(t,n,l,a,i){var r=t[n],s=c(r);if("object"!==s)return new o("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");for(var m in e){var v=e[m];if("function"!=typeof v)return u(l,a,i,m,d(v));var p=v(r,m,l,a,i+"."+m,jt);if(p)return p}return null})},exact:function(e){return i(function(t,n,l,a,i){var r=t[n],s=c(r);if("object"!==s)return new o("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");var m=zt({},t[n],e);for(var v in m){var p=e[v];if(Yt(e,v)&&"function"!=typeof p)return u(l,a,i,v,d(p));if(!p)return new o("Invalid "+a+" `"+i+"` key `"+v+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=p(r,v,l,a,i+"."+v,jt);if(E)return E}return null})}};function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function o(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function i(e){function t(t,n,l,a,i,r,u){if(a=a||"<<anonymous>>",r=r||l,u!==jt){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}return null==n[l]?t?new o(null===n[l]?"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `null`.":"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `undefined`."):null:e(n,l,a,i,r)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){return i(function(t,n,l,a,i,r){var u=t[n];return c(u)!==e?new o("Invalid "+a+" `"+i+"` of type `"+d(u)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function u(e,t,n,l,a){return new o((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+a+"`.")}function s(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(s);if(null===t||e(t))return!0;var l=function(e){var t=e&&(n&&e[n]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!l)return!1;var a,o=l.call(t);if(l!==t.entries){for(;!(a=o.next()).done;)if(!s(a.value))return!1}else for(;!(a=o.next()).done;){var i=a.value;if(i&&!s(i[1]))return!1}return!0;default:return!1}}function c(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function d(e){if(null==e)return""+e;var t=c(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function m(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return o.prototype=Error.prototype,l.checkPropTypes=$t,l.resetWarningCache=$t.resetWarningCache,l.PropTypes=l,l}(Ut.isElement):function(){function e(e,t,n,l,a,o){if(o!==jt){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:nn,resetWarningCache:tn};return n.PropTypes=n,n}()});const an=e=>{const[t,a]=n.useState(e.selectedVal?e.selectedVal:"");return n.useEffect(()=>{e.keepNull?a(""):e.selectedVal?a(e.selectedVal):(a(""),e.setFilter(""))},[e.selectedVal,e.forceSet]),l.createElement("input",{ref:e.inputRef,className:"employee-select-wrap--elipses "+(e.disable&&"disabled"),type:"text",value:t,onChange:function(t){e.freeze||(a(t.target.value),e.setFilter(t.target.value))},onClick:e.onClick,onFocus:function(){e.disable||e.dropdownDisplay(!0)},onBlur:t=>{var n;e.dropdownDisplay(!1),null==e||null===(n=e.onBlur)||void 0===n||n.call(e,t),e.selectedVal!==e.filterVal&&setTimeout(()=>{e.setforceSet(e=>e+1)},1e3)},onKeyDown:t=>{var n,l,a,o,i,r,u,s,c,d,m,v,p;if("ArrowDown"==t.key)e.setOptionIndex(t=>t+1==e.addProps.length?0:t+1),e.addProps.currentIndex+1==e.addProps.length?null==t||null===(n=t.target)||void 0===n||null===(l=n.parentElement)||void 0===l||null===(a=l.parentElement)||void 0===a||null===(o=a.children)||void 0===o||null===(i=o.namedItem("jk-dropdown-unique"))||void 0===i||null===(r=i.scrollTo)||void 0===r||r.call(i,0,0):(null==e||null===(u=e.addProps)||void 0===u?void 0:u.currentIndex)>2&&(null==t||null===(s=t.target)||void 0===s||null===(c=s.parentElement)||void 0===c||null===(d=c.parentElement)||void 0===d||null===(m=d.children)||void 0===m||null===(v=m.namedItem("jk-dropdown-unique"))||void 0===v||null===(p=v.scrollBy)||void 0===p||p.call(v,0,45)),t.preventDefault();else if("ArrowUp"==t.key){var E,g,f,h,y,S,b,_,C,T,D,N,A;e.setOptionIndex(t=>0!==t?t-1:e.addProps.length-1),0==e.addProps.currentIndex?null==t||null===(E=t.target)||void 0===E||null===(g=E.parentElement)||void 0===g||null===(f=g.parentElement)||void 0===f||null===(h=f.children)||void 0===h||null===(y=h.namedItem("jk-dropdown-unique"))||void 0===y||null===(S=y.scrollTo)||void 0===S||S.call(y,1e5,1e5):(null==e||null===(b=e.addProps)||void 0===b?void 0:b.currentIndex)>2&&(null==t||null===(_=t.target)||void 0===_||null===(C=_.parentElement)||void 0===C||null===(T=C.parentElement)||void 0===T||null===(D=T.children)||void 0===D||null===(N=D.namedItem("jk-dropdown-unique"))||void 0===N||null===(A=N.scrollBy)||void 0===A||A.call(N,0,-45)),t.preventDefault()}else"Enter"==t.key&&e.addProps.selectOption(e.addProps.currentIndex)},readOnly:e.disable,autoFocus:e.autoFocus,placeholder:e.placeholder,autoComplete:"off",style:d({},e.style,{zIndex:"auto"})})},on=e=>e,rn=e=>{var a,o,i;const r=Digit.SessionStorage.get("userType"),[u,s]=n.useState(!1),[c,m]=n.useState(e.selected?e.selected:null),[v,p]=n.useState(""),[E,g]=n.useState(0),[f,h]=n.useState(-1),y=n.useRef(null),S=!!e.customSelector,b=e.t||on;function _(){if(!e.disable){var t,n=u;n||document.addEventListener("mousedown",C,!1),s(!n),null==e||null===(t=e.onBlur)||void 0===t||t.call(e)}}function C(e){y.current&&y.current.contains(e.target)||(document.removeEventListener("mousedown",C,!1),s(!1))}function T(t){t!==c||e.allowMultiselect?(e.select(t),m(t),s(!1)):(m(t),g(E+1))}n.useEffect(()=>{m(e.selected)},[e.selected]),console.log("option",e.option);let D=e.option&&(null===(a=e.option)||void 0===a?void 0:a.filter(t=>{var n,l;return(null===(n=b(t[e.optionKey]))||void 0===n||null===(l=n.toUpperCase())||void 0===l?void 0:l.indexOf(null==v?void 0:v.toUpperCase()))>-1}))||[];var N,A;return"PropertyType"==(null==e||null===(o=e.option)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.label)&&(D=e.option),e.isBPAREG&&c&&((null===(N=e.option)||void 0===N||null===(A=N.filter(e=>(null==e?void 0:e.code)===(null==c?void 0:c.code)))||void 0===A?void 0:A.length)>0||m(null)),l.createElement("div",{className:("employee"===r?"employee-select-wrap":"select-wrap")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:d({},e.style)},S&&l.createElement("div",{className:e.showArrow?"cp flex-right column-gap-5":"cp",onClick:_},e.customSelector,e.showArrow&&l.createElement(t.ArrowDown,{onClick:_,className:e.disable&&"disabled"})),!S&&l.createElement("div",{className:(u?"select-active":"select")+" "+(e.disable&&"disabled"),style:e.errorStyle?{border:"1px solid red"}:{}},l.createElement(an,{autoComplete:e.autoComplete,setFilter:function(e){p(e)},forceSet:E,setforceSet:g,setOptionIndex:h,keepNull:e.keepNull,selectedVal:c?e.t?e.isMultiSelectEmp?c+" "+b("BPA_SELECTED_TEXT"):e.t(e.optionKey?c[e.optionKey]:c):e.optionKey?c[e.optionKey]:c:null,filterVal:v,addProps:{length:D.length,currentIndex:f,selectOption:function(e){T(D[e])}},dropdownDisplay:function(e){const t=setTimeout(()=>s(e),500);return()=>{clearTimeout(t)}},handleClick:C,disable:e.disable,freeze:!!e.freeze,autoFocus:e.autoFocus,placeholder:e.placeholder,onBlur:null==e?void 0:e.onBlur,inputRef:e.ref}),l.createElement(t.ArrowDown,{onClick:_,className:"cp",disable:e.disable})),u?e.optionKey?l.createElement("div",{id:"jk-dropdown-unique",className:(S?"margin-top-10 display: table":"")+" options-card",style:d({},e.optionCardStyles),ref:y},D&&D.map((t,n)=>(console.log("option",t),l.createElement("div",{className:"cp profile-dropdown--item display: flex ",style:n===f?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},key:n,onClick:()=>T(t)},t.icon&&l.createElement("span",{className:"icon"}," ",t.icon," "),e.isPropertyAssess?l.createElement("div",null,e.t?e.t(t[e.optionKey]):t[e.optionKey]):l.createElement("span",null," ",e.t?e.t(t[e.optionKey]):t[e.optionKey]),l.createElement("div",null,"(",e.t("COMMON_MASTERS_DESIGNATION_"+t.designation),")")))),D&&0===D.length&&l.createElement("div",{className:"cp profile-dropdown--item display: flex ",key:"-1",onClick:()=>{}},l.createElement("span",null," ",e.t?e.t("CMN_NOOPTION"):"CMN_NOOPTION"))):l.createElement("div",{className:"options-card",style:d({},e.optionCardStyles,{overflow:"scroll",maxHeight:"350px"}),id:"jk-dropdown-unique",ref:y},e.option.filter(e=>(null==e?void 0:e.toUpperCase().indexOf(null==v?void 0:v.toUpperCase()))>-1).map((e,t)=>l.createElement("p",{key:t,style:t===f?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},onClick:()=>T(e)},e))):null)},un=e=>l.createElement("h1",{className:"heading-m"},e.label),sn=()=>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"})),cn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(sn,null)),dn=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;const{data:g,isLoading:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:h,data:y}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[S,b]=n.useState({}),[_,C]=n.useState({}),[T,D]=n.useState([]),[N,A]=n.useState(null),[w,x]=n.useState(null),[I,L]=n.useState(null),[O,R]=n.useState(null),[P,M]=n.useState([]),[F,k]=n.useState(null),[B,U]=n.useState(!1);function V(e){x(e.target.files[0])}return n.useEffect(()=>{var e;y&&y["egf-master"]&&M(null===(e=y["egf-master"])||void 0===e?void 0:e.FinancialYear)},[y]),n.useEffect(()=>{var e;D(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(w){const e=function(){if(w.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",w,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[w]),n.useEffect(()=>{r&&b(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:o,selectedFinancialYear:i,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+a.action+"_APPLICATION",submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:i})}]}]}})({t:i,action:r,financialYears:P,selectedFinancialYear:F,setSelectedFinancialYear:k}):(e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v}=e;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==o?void 0:o.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:T,selectedApprover:N,setSelectedApprover:A,selectFile:V,uploadedFile:I,setUploadedFile:L,businessService:p}))},[r,T,P,F,I]),r&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(un,{label:i(S.label.heading)}),headerBarEnd:l.createElement(cn,{onClick:s}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!I,formId:"modal-action"},h?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};m.creationReason="STATUS",c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:d({},m,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==F?void 0:F.name,propertyId:null==m?void 0:m.propertyId,tenantId:u,source:null==m?void 0:m.source,channel:null==m?void 0:m.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!N?[]:[N],I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==w?void 0:w.name,fileStoreId:I}]),c({Property:d({},m,{workflow:t})})}},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},mn=e=>l.createElement("h1",{className:"heading-m"},e.label),vn=()=>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"})),pn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(vn,null)),En=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;console.log("ActionModalActions: ",r);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:f}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[h,y]=n.useState({}),[S,b]=n.useState({}),[_,C]=n.useState([]),[T,D]=n.useState({}),[N,A]=n.useState(null),[w,x]=n.useState(null),[I,L]=n.useState(null),[O,R]=n.useState([]),[P,M]=n.useState(null);n.useEffect(()=>{var e;f&&f["egf-master"]&&R(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]);const{data:F}=Digit.Hooks.useCustomMDMS(u,"common-masters",[{name:"Department"}]);function k(e){A(e.target.files[0])}return n.useEffect(()=>{if(E&&F){var e;const t=F["common-masters"].Department;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const o=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,i=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===o);return console.log("matchedDept===",i),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==i?void 0:i.name)}}))}},[E]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",N,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?x(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),n.useEffect(()=>{r&&y((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:_,selectedApprover:T,setSelectedApprover:D,selectFile:k,uploadedFile:w,setUploadedFile:x,businessService:p}))},[r,_,O,P,w]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(mn,{label:i(h.label.heading)}),headerBarEnd:l.createElement(pn,{onClick:s}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:h.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){m=d({},m,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,wfDocuments:w?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:w}]:null}),c({Licenses:[m]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},gn=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),fn=()=>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"})),hn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fn,null)),yn=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;const{data:E,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)});console.log(E,"DEKHO");const[f,h]=n.useState({}),[y,S]=n.useState({}),[b,_]=n.useState([]),[C,T]=n.useState({}),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),L=!!Digit.Utils.browser.isMobile();function O(e){N(e.target.files[0])}return n.useEffect(()=>{var e;_(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l,a,o,r;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:(null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation)||"N/A",displayName:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" ("+(i(null==e||null===(o=e.assignments)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.designation)||"N/A")+")"}}))},[E]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))I(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",D,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(){I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:s,setUploadedFile:c,businessService:d,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"SEND_BACK_TO_CITIZEN"!=(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(rn,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i,t:n}):null},{label:n("WF_COMMON_COMMENTS")+"*",type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},message:s?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:i,action:r,approvers:b,selectedApprover:C,setSelectedApprover:T,selectFile:O,uploadedFile:A,setUploadedFile:w,businessService:p,error:x}))},[r,b,A,x]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(gn,{label:i(f.label.heading)}),headerBarEnd:l.createElement(hn,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:L?{width:"720px"}:{},style:L?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:L?{paddingLeft:"5px"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){m=d({},m,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null}),console.log("action",r),console.log("applicationData",m),c({Licenses:[m]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Sn=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),bn=()=>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"})),_n=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(bn,null)),Cn=e=>{var a,o,i,u,s,c,m,p,E,g,f,h,y,S,b,_,C,T;let{t:D,action:N,tenantId:A,closeModal:w,submitAction:x,applicationDetails:I,applicationData:L,businessService:O,workflowDetails:R,blockReason:P}=e;console.log("applicationData_BPAACTIONMODAL",L);const M=[...new Set(null==R||null===(a=R.data)||void 0===a||null===(o=a.initialActionState)||void 0===o||null===(i=o.nextActions)||void 0===i||null===(u=i.find(e=>(null==e?void 0:e.action)===(null==N?void 0:N.action)))||void 0===u||null===(s=u.actions)||void 0===s?void 0:s.flatMap(e=>e.roles||[]))];console.log("workflowDetails_BPAACTIONMODAL",R,M,N),Digit.Hooks.obps.useObpsAPI(null!==(c=L)&&void 0!==c&&null!==(m=c.landInfo)&&void 0!==m&&null!==(p=m.address)&&void 0!==p&&p.city?null===(E=L)||void 0===E||null===(g=E.landInfo)||void 0===g||null===(f=g.address)||void 0===f?void 0:f.city:A,!1);const{data:F,isLoading:k}=Digit.Hooks.useEmployeeSearch(A,{roles:null==M?void 0:M.map(e=>({code:e})),zones:null===(h=L)||void 0===h||null===(y=h.additionalDetails)||void 0===y?void 0:y.zonenumber,categories:null===(S=L)||void 0===S||null===(b=S.additionalDetails)||void 0===b?void 0:b.categories,subcategories:null===(_=L)||void 0===_||null===(C=_.additionalDetails)||void 0===C?void 0:C.subcategories,assignedtenattids:null===(T=L)||void 0===T?void 0:T.tenantId,isActive:!0},{enabled:!(null!=N&&N.isTerminateState)});console.log("approverData",F),r.useQueryClient();const[B,U]=n.useState({}),[V,H]=n.useState({}),[W,q]=n.useState([]),[z,j]=n.useState([]),[Y,G]=n.useState({}),[K,Q]=n.useState({}),[X,Z]=n.useState(null),[$,J]=n.useState(null),[ee,te]=n.useState(null),[ne,le]=n.useState(null),ae=!!Digit.Utils.browser.isMobile();function oe(e){Z(e.target.files[0])}n.useEffect(()=>{var e;q(null==F||null===(e=F.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation}}))},[F]),n.useEffect(()=>{!function(){try{te(null);const e=function(){if(X){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(X.size>=5242880)te(D("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=X&&X.type&&!e.test(null==X?void 0:X.type))te(D("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",X,Digit.ULBService.getStateId()||(null==A?void 0:A.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?J(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):te(D("CS_FILE_UPLOAD_ERROR"))})},function(){te(D("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)}}()},[X]);const ie=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},re=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},ue=e=>{var t,n;let l=[],a=[];var o,i;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(i=l)||void 0===i?void 0:i.length)>0&&l.map((e,t)=>{a.push({docs:ie(e.Documents),date:e.InspectionDate,questions:re(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]},se=()=>{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(()=>{j(null==P?void 0:P.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),N&&U((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectedBlockReason:s,setBlockReason:c,selectFile:d,uploadedFile:m,setUploadedFile:v,assigneeLabel:p,businessService:E,error:g,blockReasonFiltered:f}=e,h=!1;return"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SKIP_PAYMENT"!=o.action&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)||(h=!0),console.log("actionInModal",o),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+E+"_"+(null==o?void 0:o.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:o.isTerminateState||h||"BLOCK"==(null==o?void 0:o.action)||"VERIFY"==(null==o?void 0:o.action)||"SEND_FOR_INSPECTION_REPORT"==(null==o?void 0:o.action)?null:a(p||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||h||"BLOCK"==(null==o?void 0:o.action)||"VERIFY"==(null==o?void 0:o.action)||"SEND_FOR_INSPECTION_REPORT"==(null==o?void 0:o.action)?null:l.createElement(rn,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r,t:a})},{label:"BLOCK"==(null==o?void 0:o.action)?a("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==o?void 0:o.action)?l.createElement(t.Dropdown,{option:f,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:c,selected:s,isMandatory:!0}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{v(null)},message:m?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:g})}]}]}})({t:D,action:N,approvers:W,selectedApprover:Y,setSelectedApprover:G,selectedBlockReason:K,setBlockReason:Q,selectFile:oe,uploadedFile:$,setUploadedFile:J,businessService:O,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:ee,blockReasonFiltered:z}))},[N,W,ne,$,ee]),N&&B.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Sn,{label:D(B.label.heading)}),headerBarEnd:l.createElement(_n,{onClick:w}),actionCancelLabel:D(B.label.cancel),actionCancelOnSubmit:w,actionSaveLabel:D(B.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:ae?{width:"720px"}:{},style:ae?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:ae?{paddingLeft:"5px"}:{}},k?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:B.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,o,i,r,u,s,c,m,v,p,E,g,f,h,y,S,b,_,C,T,A,O,P,M,F,k,B,U,V,H,W,q,z,j,G,Q,Z,J,ee;if(L=d({},L,{documents:null===(t=L)||void 0===t?void 0:t.documents,additionalDetails:d({},null===(n=L)||void 0===n?void 0:n.additionalDetails,{fieldinspection_pending:ue(L),pendingapproval:se(),blockingReason:null==K?void 0:K.name}),workflow:{action:null==N?void 0:N.action,comment:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null!=K&&K.name?(null==K?void 0:K.name)+" - "+(null==e?void 0:e.comments):null==e?void 0:e.comments:null,comments:(null==e||null===(a=e.comments)||void 0===a?void 0:a.length)>0?null!=K&&K.name?(null==K?void 0:K.name)+" - "+(null==e?void 0:e.comments):null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(o=R.data)||void 0===o||null===(i=o.processInstances)||void 0===i||null===(r=i[0])||void 0===r||null===(u=r.state)||void 0===u?void 0:u.applicationStatus)?[null==R||null===(s=R.data)||void 0===s||null===(c=s.processInstances)||void 0===c||null===(m=c[0])||void 0===m||null===(v=m.assigner)||void 0===v?void 0:v.uuid]:null!=Y&&Y.uuid?[null==Y?void 0:Y.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(p=R.data)||void 0===p||null===(E=p.processInstances)||void 0===E||null===(g=E[0])||void 0===g||null===(f=g.state)||void 0===f?void 0:f.applicationStatus)?[null==R||null===(h=R.data)||void 0===h||null===(y=h.processInstances)||void 0===y||null===(S=y[0])||void 0===S||null===(b=S.assigner)||void 0===b?void 0:b.uuid]:null!=Y&&Y.uuid?[null==Y?void 0:Y.uuid]:null,varificationDocuments:$?[{documentType:(null==N?void 0:N.action)+" DOC",fileName:null==X?void 0:X.name,fileStoreId:$}]:null},action:null==N?void 0:N.action,riskType:null===(_=L)||void 0===_||null===(C=_.additionalDetails)||void 0===C?void 0:C.riskType,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(T=R.data)||void 0===T||null===(A=T.processInstances)||void 0===A||null===(O=A[0])||void 0===O||null===(P=O.state)||void 0===P?void 0:P.applicationStatus)?[null==R||null===(M=R.data)||void 0===M||null===(F=M.processInstances)||void 0===F||null===(k=F[0])||void 0===k||null===(B=k.assigner)||void 0===B?void 0:B.uuid]:null!=Y&&Y.uuid?[null==Y?void 0:Y.uuid]:null,wfDocuments:$?[{documentType:(null==N?void 0:N.action)+" DOC",fileName:null==X?void 0:X.name,fileStoreId:$}]:null}),parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(U=L)||void 0===U||null===(V=U.additionalDetails)||void 0===V||null===(H=V.selfCertificationCharges)||void 0===H?void 0:H.BPA_MALBA_CHARGES)+parseInt(null===(W=L)||void 0===W||null===(q=W.additionalDetails)||void 0===q||null===(z=q.selfCertificationCharges)||void 0===z?void 0:z.BPA_LABOUR_CESS)+parseInt(null===(j=L)||void 0===j||null===(G=j.additionalDetails)||void 0===G||null===(Q=G.selfCertificationCharges)||void 0===Q?void 0:Q.BPA_WATER_CHARGES)+parseInt(null===(Z=L)||void 0===Z||null===(J=Z.additionalDetails)||void 0===J||null===(ee=J.selfCertificationCharges)||void 0===ee?void 0:ee.BPA_GAUSHALA_CHARGES_CESS))w(),alert(D("Enterd Less Adjustment amount is invalid"));else{var te,ne;const e=null==I||null===(te=I.nocData)||void 0===te?void 0:te.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:d({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}}),t={};let n=!0,l=!0;null==t||null===(ne=t.Noc)||void 0===ne||ne.map(e=>{var t,a,o,i,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=n&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?n=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let a=[];e&&e.map(e=>{var t,o,i,r,u,s,c,d,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(o=t.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(i=e.Noc)||void 0===i||null===(r=i.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(s=u.applicationStatus)||void 0===s?void 0:s.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&n||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&a.push(e)}),x({BPA:L},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0})}return Promise.resolve()}catch(e){return Promise.reject(e)}},defaultValues:V,formId:"modal-action"})):l.createElement(t.Loader,null)},Tn=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Dn=()=>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"})),Nn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dn,null)),An=e=>{var a,i,u,s,c,m,p;let{t:E,action:g,tenantId:f,closeModal:h,submitAction:y,applicationData:S,businessService:b}=e;const{data:_,isLoading:C}=Digit.Hooks.useEmployeeSearch(f,{roles:null===(a=workflowDetails)||void 0===a||null===(i=a.data)||void 0===i||null===(u=i.initialActionState)||void 0===u||null===(s=u.nextActions)||void 0===s||null===(c=s.filter(e=>(null==e?void 0:e.action)==(null==g?void 0:g.action)))||void 0===c||null===(m=c[0])||void 0===m||null===(p=m.assigneeRoles)||void 0===p?void 0:p.map(e=>({code:e})),isActive:!0},{enabled:!(null!=g&&g.isTerminateState)}),[T,D]=(r.useQueryClient(),n.useState({})),[N,A]=n.useState({}),[w,x]=n.useState([]),[I,L]=n.useState({}),[O,R]=n.useState(null),[P,M]=n.useState(null),[F,k]=n.useState(null),B=!!Digit.Utils.browser.isMobile();function U(e){R(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;x(null==_||null===(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}}))},[_]),n.useEffect(()=>{!function(){try{k(null);const e=function(){if(O){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(O.size>=5242880)k(E("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=O&&O.type&&!e.test(null==O?void 0:O.type))k(E("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",O,Digit.ULBService.getStateId()||(null==f?void 0:f.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?M(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):k(E("CS_FILE_UPLOAD_ERROR"))})},function(){k(E("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)}}()},[O]),n.useEffect(()=>{g&&D((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(E=!0);let g=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(g=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==o?void 0:o.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||g?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||g?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},showHint:!0,message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:E,action:g,approvers:w,selectedApprover:I,setSelectedApprover:L,selectFile:U,uploadedFile:P,setUploadedFile:M,businessService:b,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:F}))},[g,w,P,F]),g&&T.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tn,{label:E(T.label.heading)}),headerBarEnd:l.createElement(Nn,{onClick:h}),actionCancelLabel:E(T.label.cancel),actionCancelOnSubmit:h,actionSaveLabel:E(T.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:B?{width:"720px"}:{},style:B?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:B?{paddingLeft:"5px"}:{}},C?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:T.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=S)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=S)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{o.push(e)}),S=d({},S,{workflow:{action:null==g?void 0:g.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=I&&I.uuid?[null==I?void 0:I.uuid]:null,documents:P?[{documentType:(null==g?void 0:g.action)+" DOC",fileName:null==O?void 0:O.name,fileStoreId:P}]:null},documents:o}),y({Noc:S},!1,{isNoc:!0})},defaultValues:N,formId:"modal-action"})):l.createElement(t.Loader,null)};var wn=function(e,t){return e===t||e!=e&&t!=t},xn=function(e,t){for(var n=e.length;n--;)if(wn(e[n][0],t))return n;return-1},In=Array.prototype.splice;function Ln(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])}}Ln.prototype.clear=function(){this.__data__=[],this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=xn(t,e);return!(n<0||(n==t.length-1?t.pop():In.call(t,n,1),--this.size,0))},Ln.prototype.get=function(e){var t=this.__data__,n=xn(t,e);return n<0?void 0:t[n][1]},Ln.prototype.has=function(e){return xn(this.__data__,e)>-1},Ln.prototype.set=function(e,t){var n=this.__data__,l=xn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var On,Rn=Ln,Pn="object"==typeof pt&&pt&&pt.Object===Object&&pt,Mn="object"==typeof self&&self&&self.Object===Object&&self,Fn=Pn||Mn||Function("return this")(),kn=Fn.Symbol,Bn=Object.prototype,Un=Bn.hasOwnProperty,Vn=Bn.toString,Hn=kn?kn.toStringTag:void 0,Wn=Object.prototype.toString,qn=kn?kn.toStringTag:void 0,zn=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qn&&qn in Object(e)?function(e){var t=Un.call(e,Hn),n=e[Hn];try{e[Hn]=void 0;var l=!0}catch(e){}var a=Vn.call(e);return l&&(t?e[Hn]=n:delete e[Hn]),a}(e):function(e){return Wn.call(e)}(e)},jn=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Yn=function(e){if(!jn(e))return!1;var t=zn(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Gn=Fn["__core-js_shared__"],Kn=(On=/[^.]+$/.exec(Gn&&Gn.keys&&Gn.keys.IE_PROTO||""))?"Symbol(src)_1."+On:"",Qn=Function.prototype.toString,Xn=function(e){if(null!=e){try{return Qn.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Zn=/^\[object .+?Constructor\]$/,$n=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Jn=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!jn(e)||(t=e,Kn&&Kn in t))&&(Yn(e)?$n:Zn).test(Xn(e));var t}(n)?n:void 0},el=Jn(Fn,"Map"),tl=Jn(Object,"create"),nl=Object.prototype.hasOwnProperty,ll=Object.prototype.hasOwnProperty;function al(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])}}al.prototype.clear=function(){this.__data__=tl?tl(null):{},this.size=0},al.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},al.prototype.get=function(e){var t=this.__data__;if(tl){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return nl.call(t,e)?t[e]:void 0},al.prototype.has=function(e){var t=this.__data__;return tl?void 0!==t[e]:ll.call(t,e)},al.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=tl&&void 0===t?"__lodash_hash_undefined__":t,this};var ol=al,il=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 rl(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])}}rl.prototype.clear=function(){this.size=0,this.__data__={hash:new ol,map:new(el||Rn),string:new ol}},rl.prototype.delete=function(e){var t=il(this,e).delete(e);return this.size-=t?1:0,t},rl.prototype.get=function(e){return il(this,e).get(e)},rl.prototype.has=function(e){return il(this,e).has(e)},rl.prototype.set=function(e,t){var n=il(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var ul=rl;function sl(e){var t=this.__data__=new Rn(e);this.size=t.size}sl.prototype.clear=function(){this.__data__=new Rn,this.size=0},sl.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},sl.prototype.get=function(e){return this.__data__.get(e)},sl.prototype.has=function(e){return this.__data__.has(e)},sl.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var l=n.__data__;if(!el||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new ul(l)}return n.set(e,t),this.size=n.size,this};var cl=sl,dl=function(){try{var e=Jn(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ml=function(e,t,n){"__proto__"==t&&dl?dl(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},vl=Object.prototype.hasOwnProperty,pl=function(e,t,n){var l=e[t];vl.call(e,t)&&wn(l,n)&&(void 0!==n||t in e)||ml(e,t,n)},El=function(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?ml(n,r,u):pl(n,r,u)}return n},gl=function(e){return null!=e&&"object"==typeof e},fl=function(e){return gl(e)&&"[object Arguments]"==zn(e)},hl=Object.prototype,yl=hl.hasOwnProperty,Sl=hl.propertyIsEnumerable,bl=fl(function(){return arguments}())?fl:function(e){return gl(e)&&yl.call(e,"callee")&&!Sl.call(e,"callee")},_l=Array.isArray,Cl=function(){return!1},Tl=Et(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Fn.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||Cl}),Dl=/^(?:0|[1-9]\d*)$/,Nl=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Dl.test(e))&&e>-1&&e%1==0&&e<t},Al=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},wl={};wl["[object Float32Array]"]=wl["[object Float64Array]"]=wl["[object Int8Array]"]=wl["[object Int16Array]"]=wl["[object Int32Array]"]=wl["[object Uint8Array]"]=wl["[object Uint8ClampedArray]"]=wl["[object Uint16Array]"]=wl["[object Uint32Array]"]=!0,wl["[object Arguments]"]=wl["[object Array]"]=wl["[object ArrayBuffer]"]=wl["[object Boolean]"]=wl["[object DataView]"]=wl["[object Date]"]=wl["[object Error]"]=wl["[object Function]"]=wl["[object Map]"]=wl["[object Number]"]=wl["[object Object]"]=wl["[object RegExp]"]=wl["[object Set]"]=wl["[object String]"]=wl["[object WeakMap]"]=!1;var xl=function(e){return function(t){return e(t)}},Il=Et(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&Pn.process,o=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=o}),Ll=Il&&Il.isTypedArray,Ol=Ll?xl(Ll):function(e){return gl(e)&&Al(e.length)&&!!wl[zn(e)]},Rl=Object.prototype.hasOwnProperty,Pl=function(e,t){var n=_l(e),l=!n&&bl(e),a=!n&&!l&&Tl(e),o=!n&&!l&&!a&&Ol(e),i=n||l||a||o,r=i?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],u=r.length;for(var s in e)!t&&!Rl.call(e,s)||i&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Nl(s,u))||r.push(s);return r},Ml=Object.prototype,Fl=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ml)},kl=function(e,t){return function(n){return e(t(n))}},Bl=kl(Object.keys,Object),Ul=Object.prototype.hasOwnProperty,Vl=function(e){return null!=e&&Al(e.length)&&!Yn(e)},Hl=function(e){return Vl(e)?Pl(e):function(e){if(!Fl(e))return Bl(e);var t=[];for(var n in Object(e))Ul.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Wl=Object.prototype.hasOwnProperty,ql=function(e){return Vl(e)?Pl(e,!0):function(e){if(!jn(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Fl(e),n=[];for(var l in e)("constructor"!=l||!t&&Wl.call(e,l))&&n.push(l);return n}(e)},zl=Et(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Fn.Buffer:void 0,o=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),jl=function(){return[]},Yl=Object.prototype.propertyIsEnumerable,Gl=Object.getOwnPropertySymbols,Kl=Gl?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,o=0,i=[];++l<a;){var r=t[l];Yl.call(e,r)&&(i[o++]=r)}return i}(Gl(e)))}:jl,Ql=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},Xl=kl(Object.getPrototypeOf,Object),Zl=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ql(t,Kl(e)),e=Xl(e);return t}:jl,$l=function(e,t,n){var l=t(e);return _l(e)?l:Ql(l,n(e))},Jl=function(e){return $l(e,Hl,Kl)},ea=function(e){return $l(e,ql,Zl)},ta=Jn(Fn,"DataView"),na=Jn(Fn,"Promise"),la=Jn(Fn,"Set"),aa=Jn(Fn,"WeakMap"),oa=Xn(ta),ia=Xn(el),ra=Xn(na),ua=Xn(la),sa=Xn(aa),ca=zn;(ta&&"[object DataView]"!=ca(new ta(new ArrayBuffer(1)))||el&&"[object Map]"!=ca(new el)||na&&"[object Promise]"!=ca(na.resolve())||la&&"[object Set]"!=ca(new la)||aa&&"[object WeakMap]"!=ca(new aa))&&(ca=function(e){var t=zn(e),n="[object Object]"==t?e.constructor:void 0,l=n?Xn(n):"";if(l)switch(l){case oa:return"[object DataView]";case ia:return"[object Map]";case ra:return"[object Promise]";case ua:return"[object Set]";case sa:return"[object WeakMap]"}return t});var da=ca,ma=Object.prototype.hasOwnProperty,va=Fn.Uint8Array,pa=function(e){var t=new e.constructor(e.byteLength);return new va(t).set(new va(e)),t},Ea=/\w*$/,ga=kn?kn.prototype:void 0,fa=ga?ga.valueOf:void 0,ha=Object.create,ya=function(){function e(){}return function(t){if(!jn(t))return{};if(ha)return ha(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Sa=Il&&Il.isMap,ba=Sa?xl(Sa):function(e){return gl(e)&&"[object Map]"==da(e)},_a=Il&&Il.isSet,Ca=_a?xl(_a):function(e){return gl(e)&&"[object Set]"==da(e)},Ta={};Ta["[object Arguments]"]=Ta["[object Array]"]=Ta["[object ArrayBuffer]"]=Ta["[object DataView]"]=Ta["[object Boolean]"]=Ta["[object Date]"]=Ta["[object Float32Array]"]=Ta["[object Float64Array]"]=Ta["[object Int8Array]"]=Ta["[object Int16Array]"]=Ta["[object Int32Array]"]=Ta["[object Map]"]=Ta["[object Number]"]=Ta["[object Object]"]=Ta["[object RegExp]"]=Ta["[object Set]"]=Ta["[object String]"]=Ta["[object Symbol]"]=Ta["[object Uint8Array]"]=Ta["[object Uint8ClampedArray]"]=Ta["[object Uint16Array]"]=Ta["[object Uint32Array]"]=!0,Ta["[object Error]"]=Ta["[object Function]"]=Ta["[object WeakMap]"]=!1;var Da=function e(t,n,l,a,o,i){var r,u=1&n,s=2&n,c=4&n;if(l&&(r=o?l(t,a,o,i):l(t)),void 0!==r)return r;if(!jn(t))return t;var d=_l(t);if(d){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ma.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=da(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(Tl(t))return zl(t,u);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(r=s||v?{}:function(e){return"function"!=typeof e.constructor||Fl(e)?{}:ya(Xl(e))}(t),!u)return s?function(e,t){return El(e,Zl(e),t)}(t,function(e,t){return e&&El(t,ql(t),e)}(r,t)):function(e,t){return El(e,Kl(e),t)}(t,function(e,t){return e&&El(t,Hl(t),e)}(r,t))}else{if(!Ta[m])return o?t:{};r=function(e,t,n){var l,a,o=e.constructor;switch(t){case"[object ArrayBuffer]":return pa(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?pa(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?pa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Ea.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new o;case"[object Symbol]":return fa?Object(fa.call(e)):{}}}(t,m,u)}}i||(i=new cl);var p=i.get(t);if(p)return p;i.set(t,r),Ca(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,i))}):ba(t)&&t.forEach(function(a,o){r.set(o,e(a,n,l,o,t,i))});var E=d?void 0:(c?s?ea:Jl:s?ql:Hl)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,o){E&&(a=t[o=a]),pl(r,o,e(a,n,l,o,t,i))}),r},Na=function(e){return Da(e,5)};const Aa=e=>l.createElement("h1",{className:"heading-m"},e.label),wa=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),xa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(wa,null)),Ia=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}},La=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p}=e;const{data:E,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[b,_]=n.useState([]),[C,T]=n.useState({}),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),L=window.Digit.Utils.browser.isMobile(),O=window.location.href.includes("/employee");function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;_(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))I(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",D,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{var e,n,a,o;"DisconnectWSConnection"==(null===(e=m)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=m)||void 0===a||null===(o=a.processInstance)||void 0===o?void 0:o.businessService)?r&&h((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:m,businessService:v,error:p}=e,E=!0,g=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(g=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},g&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!g,type:"custom",populators:g?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,d({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{m(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:b,selectedApprover:C,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p,error:x})):r&&h((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:s,uploadedFile:c,setUploadedFile:d,businessService:m,error:v}=e,p=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:s,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:b,selectedApprover:C,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p,error:x}))},[r,b,A,x]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Aa,{label:i(f.label.heading)}),headerBarEnd:l.createElement(xa,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:L&&O?{width:"100%",height:"auto"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o,i,s,v,p,E;if(null!==(t=m)&&void 0!==t&&t.isBillAmend){var g,f,h,y,S,b,_,T,N;const t=d({},null===(g=m)||void 0===g||null===(f=g.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=d({},null===(h=m)||void 0===h?void 0:h.billAmendmentDetails,{workflow:{businessId:null===(y=m)||void 0===y||null===(S=y.billAmendmentDetails)||void 0===S?void 0:S.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(b=m)&&void 0!==b&&null!==(_=b.applicationType)&&void 0!==_&&_.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(T=m)&&void 0!==T&&null!==(N=T.applicationType)&&void 0!==N&&N.includes("WATER")?"WS":"SW",assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.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!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:[]}});c({AmendmentUpdate:n})}else{if(m=d({},m,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:[],assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]:null,processInstance:d({},null===(n=m)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.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=Na(null==e?void 0:e.date);m.disconnectionExecutionDate=Ia(t)}else if(null!=e&&e.date){const t=Na(null==e?void 0:e.date);m.connectionExecutionDate=Ia(t)}var w;if("DisconnectWSConnection"==(null===(o=m)||void 0===o||null===(i=o.processInstance)||void 0===i?void 0:i.businessService)||"DisconnectSWConnection"==(null===(s=m)||void 0===s||null===(v=s.processInstance)||void 0===v?void 0:v.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(w=m)||void 0===w?void 0:w.serviceType)?c({WaterConnection:m,disconnectRequest:!0}):c({SewerageConnection:m,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(p=m)||void 0===p?void 0:p.applicationType))c({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=m)||void 0===E?void 0:E.applicationType))c({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!0});else{var x,I,L,O,R,P,M,F,k,B,U,V,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocPenalty&&(m.additionalDetails.adhocPenalty=parseInt(null==t||null===(I=t.value)||void 0===I?void 0:I.adhocPenalty)||""),null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenaltyComment&&(m.additionalDetails.adhocPenaltyComment=(null==t||null===(O=t.value)||void 0===O?void 0:O.adhocPenaltyComment)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyReason&&(m.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(m.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateComment&&(m.additionalDetails.adhocRebateComment=(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(m.additionalDetails.adhocRebateReason=(null==t||null===(V=t.value)||void 0===V?void 0:V.adhocRebateReason)||""),"WATER"==(null===(H=m)||void 0===H?void 0:H.serviceType)?c({WaterConnection:m,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:m,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Oa=e=>l.createElement("h1",{className:"heading-m"},e.label),Ra=()=>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"})),Pa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ra,null)),Ma=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;console.log("applicationData",m);const{data:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[b,_]=n.useState([]),[C,T]=n.useState(null),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),[L,O]=n.useState(!1);function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;_(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(){I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:i,action:r,approvers:b,selectedApprover:C,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p}))},[r,b,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Oa,{label:i(f.label.heading)}),headerBarEnd:l.createElement(Pa,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};m.creationReason="CREATE",c({PetRegistrationApplications:[d({},m,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],A&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:A}]),c({PetRegistrationApplications:[d({},m,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Fa=e=>l.createElement("h1",{className:"heading-m"},e.label),ka=()=>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"})),Ba=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ka,null)),Ua=e=>{var a,o,i;let{t:r,action:u,closeModal:s,submitAction:c,applicationData:m,businessService:v}=e;const p=Digit.ULBService.getStateId(),{data:E,isLoading:g}=Digit.Hooks.tl.useTradeLicenseMDMS(p,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==E||null===(a=E.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",m);const[f,h]=n.useState({}),[y,S]=n.useState({}),[b,_]=n.useState([]),[C,T]=n.useState(""),[D,N]=n.useState([]),[A,w]=n.useState(null),x=null===(o=m)||void 0===o||null===(i=o.tradeLicenseDetail)||void 0===i?void 0:i.tradeUnits;console.log("tradeUnits",x);const I=n.useMemo(()=>{var e;if(g||!E||!x.length)return[];const t=new Set(x.map(e=>e.tradeType)),n=(null===(e=E.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[g,E,x]);return console.log("years",I),n.useEffect(()=>{u&&h((e=>{let{t:n,action:a,years:o,selectedApprover:i,setSelectedApprover:r,businessService:u}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==u?void 0:u.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:o,autoComplete:"off",select:r,selected:i})}]}]}})({t:r,action:u,years:I,selectedApprover:C,setSelectedApprover:T,businessService:v}))},[u,I,D,A]),u&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Fa,{label:r(f.label.heading)}),headerBarEnd:l.createElement(Ba,{onClick:s}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=m)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a="20"+Number(l)+"-"+(Number(l)+1);m=d({},m,{financialYear:a,action:"INITIATE",additionalDetail:d({},m.additionalDetail,{validityYears:C.length>0?parseInt(C):""})}),c({Licenses:[m]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Va=e=>l.createElement("h1",{className:"heading-m"},e.label),Ha=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Wa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ha,null)),qa=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:E,moduleCode:g}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[h,y]=n.useState({}),[S,b]=n.useState({}),[_,C]=n.useState([]),[T,D]=n.useState(null),[N,A]=n.useState(null),[w,x]=n.useState(null),[I,L]=n.useState(null),[O,R]=n.useState(!1);function P(e){R(!0),A(e.target.files[0])}return n.useEffect(()=>{var e;C(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(N){const e=function(){if(N.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",N,u)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?x(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(R(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),console.log("actyhdesh,jhfsefsef",r,m),n.useEffect(()=>{y((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,approvers:u,selectedApprover:s,setSelectedApprover:c,isUploading:d}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",d),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:u,t:n,optionKey:"name",select:c,selected:s})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{r(null)},message:d?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):i?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:i,action:r,approvers:_,selectedApprover:T,setSelectedApprover:D,selectFile:P,uploadedFile:w,setUploadedFile:x,businessService:E,isUploading:O}))},[r,_,w]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Va,{label:i(h.label.heading)}),headerBarEnd:l.createElement(Wa,{onClick:s}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:h.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:E,moduleName:g,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==m||null===(t=m.auditDetails)||void 0===t?void 0:t.createdBy]:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null};w&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:w}]),c({streetVendingDetail:d({},m,{workflow:n})})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},za=e=>l.createElement("h1",{className:"heading-m"},e.label),ja=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ya=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ja,null)),Ga=e=>{var a,o;let{t:i,action:r,tenantId:u,closeModal:s,submitAction:c,applicationData:m,businessService:p,moduleCode:E}=e;console.log("applicationData",m);const{data:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,h]=n.useState({}),[y,S]=n.useState({}),[b,_]=n.useState([]),[C,T]=n.useState(null),[D,N]=n.useState(null),[A,w]=n.useState(null),[x,I]=n.useState(null),[L,O]=n.useState(!1);function R(e){N(e.target.files[0])}return n.useEffect(()=>{var e;_(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)I(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):I(i("CS_FILE_UPLOAD_ERROR"))})},function(){I(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&h((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:u}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+u+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:b,selectedApprover:C,setSelectedApprover:T,selectFile:R,uploadedFile:A,setUploadedFile:w,businessService:p}))},[r,b,A]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(za,{label:i(f.label.heading)}),headerBarEnd:l.createElement(Ya,{onClick:s}),actionCancelLabel:i(f.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:E};A&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,filestoreId:A}]),c({hallsBookingApplication:[d({},m,{workflow:t})]})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Ka=e=>l.createElement("h1",{className:"heading-m"},e.label),Qa=()=>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"})),Xa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Qa,null)),Za=e=>{var a,i,r;let{t:u,action:s,tenantId:c,closeModal:m,submitAction:v,applicationData:p,businessService:E,moduleCode:g}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==s||null===(a=s.roles)||void 0===a||null===(i=a[0])||void 0===i||null===(r=i.map)||void 0===r?void 0:r.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),h=o.useHistory(),[y,S]=n.useState({}),[b,_]=n.useState({}),[C,T]=n.useState([]),[D,N]=n.useState(null),[A,w]=n.useState(null);return n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{"INITIATED"===(null==s?void 0:s.state)?h.push("/digit-ui/employee/asset/assetservice/edit/"+(null==p?void 0:p.applicationNo)):S((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:u,action:s,approvers:C,selectedApprover:D,setSelectedApprover:N,uploadedFile:A,setUploadedFile:w,businessService:E}))},[s,C,A]),s&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ka,{label:u(y.label.heading)}),headerBarEnd:l.createElement(Xa,{onClick:m}),actionCancelLabel:u(y.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:u(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==s?void 0:s.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:g};A&&(t.documents=[]),v({Asset:d({},p,{workflow:t})})},defaultValues:b,formId:"modal-action"})):l.createElement(t.Loader,null)},$a=e=>null!=e&&e.businessService.includes("PT")?l.createElement(dn,e):null!=e&&e.businessService.includes("ptr")?l.createElement(Ma,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(En,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(Ua,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(yn,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(Cn,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(An,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(La,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(qa,e):null!=e&&e.businessService.includes("chb")?l.createElement(Ga,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Za,e):void 0;var Ja=Et(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",i="[object Array]",r="[object Boolean]",u="[object Date]",s="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",g="[object Set]",f="[object String]",h="[object Symbol]",y="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",_="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",D="[object Int16Array]",N="[object Int32Array]",A="[object Uint8Array]",w="[object Uint16Array]",x="[object Uint32Array]",I=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,O=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(R.source),F=RegExp(P.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,V=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q=/[\\^$.*+?()[\]{}|]/g,z=RegExp(q.source),j=/^\s+/,Y=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,K=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Z=/[()=,{}\[\]\/\s]/,$=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,ie=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,re=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",de="["+ce+"]",me="["+se+"]",ve="\\d+",pe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",fe="[^\\ud800-\\udfff]",he="(?:\\ud83c[\\udde6-\\uddff]){2}",ye="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",be="(?:"+pe+"|"+Ee+")",_e="(?:"+Se+"|"+Ee+")",Ce="(?:"+me+"|"+ge+")?",Te="[\\ufe0e\\ufe0f]?"+Ce+"(?:\\u200d(?:"+[fe,he,ye].join("|")+")[\\ufe0e\\ufe0f]?"+Ce+")*",De="(?:"+["[\\u2700-\\u27bf]",he,ye].join("|")+")"+Te,Ne="(?:"+[fe+me+"?",me,he,ye,"[\\ud800-\\udfff]"].join("|")+")",Ae=RegExp("['’]","g"),we=RegExp(me,"g"),xe=RegExp(ge+"(?="+ge+")|"+Ne+Te,"g"),Ie=RegExp([Se+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[de,Se,"$"].join("|")+")",_e+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[de,Se+be,"$"].join("|")+")",Se+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Se+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,De].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+se+"\\ufe0e\\ufe0f]"),Oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Pe=-1,Me={};Me[_]=Me[C]=Me[T]=Me[D]=Me[N]=Me[A]=Me["[object Uint8ClampedArray]"]=Me[w]=Me[x]=!0,Me[o]=Me[i]=Me[S]=Me[r]=Me[b]=Me[u]=Me[s]=Me[c]=Me[m]=Me[v]=Me[p]=Me[E]=Me[g]=Me[f]=Me[y]=!1;var Fe={};Fe[o]=Fe[i]=Fe[S]=Fe[b]=Fe[r]=Fe[u]=Fe[_]=Fe[C]=Fe[T]=Fe[D]=Fe[N]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[g]=Fe[f]=Fe[h]=Fe[A]=Fe["[object Uint8ClampedArray]"]=Fe[w]=Fe[x]=!0,Fe[s]=Fe[c]=Fe[y]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,Ue=parseInt,Ve="object"==typeof pt&&pt&&pt.Object===Object&&pt,He="object"==typeof self&&self&&self.Object===Object&&self,We=Ve||He||Function("return this")(),qe=t&&!t.nodeType&&t,ze=qe&&e&&!e.nodeType&&e,je=ze&&ze.exports===qe,Ye=je&&Ve.process,Ge=function(){try{return ze&&ze.require&&ze.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),Ke=Ge&&Ge.isArrayBuffer,Qe=Ge&&Ge.isDate,Xe=Ge&&Ge.isMap,Ze=Ge&&Ge.isRegExp,$e=Ge&&Ge.isSet,Je=Ge&&Ge.isTypedArray;function et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function tt(e,t,n,l){for(var a=-1,o=null==e?0:e.length;++a<o;){var i=e[a];t(l,i,n(i),e)}return l}function nt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,o=[];++n<l;){var i=e[n];t(i,n,e)&&(o[a++]=i)}return o}function it(e,t){return!(null==e||!e.length)&&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,o=null==e?0:e.length;for(l&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}function dt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function mt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=bt("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 gt(e,t,n,l){for(var a=e.length,o=n+(l?1:-1);l?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function 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):gt(e,yt,n)}function ht(e,t,n,l){for(var a=n-1,o=e.length;++a<o;)if(l(e[a],t))return a;return-1}function yt(e){return e!=e}function St(e,t){var n=null==e?0:e.length;return n?Tt(e,t)/n:NaN}function bt(e){return function(t){return null==t?void 0:t[e]}}function _t(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,o){n=l?(l=!1,e):t(n,e,a,o)}),n}function Tt(e,t){for(var n,l=-1,a=e.length;++l<a;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Dt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Nt(e){return e?e.slice(0,zt(e)+1).replace(j,""):e}function At(e){return function(t){return e(t)}}function wt(e,t){return ut(t,function(t){return e[t]})}function xt(e,t){return e.has(t)}function It(e,t){for(var n=-1,l=e.length;++n<l&&ft(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length;n--&&ft(t,e[n],0)>-1;);return n}function Ot(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Rt=_t({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Pt=_t({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+ke[e]}function Ft(e){return Le.test(e)}function kt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Bt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,o=0,i=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,i[o++]=n)}return i}function 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 Ft(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):vt(e)}function qt(e){return Ft(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var jt=_t({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Yt=function e(t){var Y=(t=null==t?We:Yt.defaults(We.Object(),t,Yt.pick(We,Re))).Array,se=t.Date,ce=t.Error,de=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,Ee=t.String,ge=t.TypeError,fe=Y.prototype,he=ve.prototype,ye=t["__core-js_shared__"],Se=de.prototype.toString,be=he.hasOwnProperty,_e=0,Ce=function(){var e=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Te=he.toString,De=Se.call(ve),Ne=We._,xe=pe("^"+Se.call(be).replace(q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=je?t.Buffer:void 0,ke=t.Symbol,Ve=t.Uint8Array,He=Le?Le.allocUnsafe:void 0,qe=Bt(ve.getPrototypeOf,ve),ze=ve.create,Ye=he.propertyIsEnumerable,Ge=fe.splice,vt=ke?ke.isConcatSpreadable:void 0,pt=ke?ke.iterator:void 0,_t=ke?ke.toStringTag:void 0,Gt=function(){try{var e=Za(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kt=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,Qt=se&&se.now!==We.Date.now&&se.now,Xt=t.setTimeout!==We.setTimeout&&t.setTimeout,Zt=me.ceil,$t=me.floor,Jt=ve.getOwnPropertySymbols,en=Le?Le.isBuffer:void 0,tn=t.isFinite,nn=fe.join,ln=Bt(ve.keys,ve),an=me.max,on=me.min,rn=se.now,un=t.parseInt,sn=me.random,cn=fe.reverse,dn=Za(t,"DataView"),mn=Za(t,"Map"),vn=Za(t,"Promise"),pn=Za(t,"Set"),En=Za(t,"WeakMap"),gn=Za(ve,"create"),fn=En&&new En,hn={},yn=Ao(dn),Sn=Ao(mn),bn=Ao(vn),_n=Ao(pn),Cn=Ao(En),Tn=ke?ke.prototype:void 0,Dn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function An(e){if(zi(e)&&!Ri(e)&&!(e instanceof Ln)){if(e instanceof In)return e;if(be.call(e,"__wrapped__"))return wo(e)}return new In(e)}var wn=function(){function e(){}return function(t){if(!qi(t))return{};if(ze)return ze(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function In(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function On(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function Fn(e){var t=this.__data__=new Rn(e);this.size=t.size}function kn(e,t){var n=Ri(e),l=!n&&Oi(e),a=!n&&!l&&ki(e),o=!n&&!l&&!a&&$i(e),i=n||l||a||o,r=i?Dt(e.length,Ee):[],u=r.length;for(var s in e)!t&&!be.call(e,s)||i&&("length"==s||a&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ao(s,u))||r.push(s);return r}function Bn(e){var t=e.length;return t?e[Pl(0,t-1)]:void 0}function Un(e,t){return _o(Ea(e),Kn(t,0,e.length))}function Vn(e){return _o(Ea(e))}function Hn(e,t,n){(void 0!==n&&!xi(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Wn(e,t,n){var l=e[t];be.call(e,t)&&xi(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function qn(e,t){for(var n=e.length;n--;)if(xi(e[n][0],t))return n;return-1}function zn(e,t,n,l){return Jn(e,function(e,a,o){t(l,e,n(e),o)}),l}function jn(e,t){return e&&ga(t,Sr(t),e)}function Yn(e,t,n){"__proto__"==t&&Gt?Gt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Gn(e,t){for(var n=-1,l=t.length,a=Y(l),o=null==e;++n<l;)a[n]=o?void 0:Er(e,t[n]);return a}function Kn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Qn(e,t,n,l,a,i){var s,y=1&t,I=2&t,L=4&t;if(n&&(s=a?n(e,l,a,i):n(e)),void 0!==s)return s;if(!qi(e))return e;var O=Ri(e);if(O){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&be.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!y)return Ea(e,s)}else{var R=eo(e),P=R==c||R==d;if(ki(e))return sa(e,y);if(R==p||R==o||P&&!a){if(s=I||P?{}:no(e),!y)return I?function(e,t){return ga(e,Ja(e),t)}(e,function(e,t){return e&&ga(t,br(t),e)}(s,e)):function(e,t){return ga(e,$a(e),t)}(e,jn(s,e))}else{if(!Fe[R])return a?e:{};s=function(e,t,n){var l=e.constructor;switch(t){case S:return ca(e);case r:case u:return new l(+e);case b:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case _:case C:case T:case D:case N:case A:case"[object Uint8ClampedArray]":case w:case x:return da(e,n);case m:return new l;case v:case f:return new l(e);case E:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case g:return new l;case h:return Dn?ve(Dn.call(e)):{}}}(e,R,y)}}i||(i=new Fn);var M=i.get(e);if(M)return M;i.set(e,s),Qi(e)?e.forEach(function(l){s.add(Qn(l,t,n,l,e,i))}):ji(e)&&e.forEach(function(l,a){s.set(a,Qn(l,t,n,a,e,i))});var F=O?void 0:(L?I?za:qa:I?br:Sr)(e);return nt(F||e,function(l,a){F&&(l=e[a=l]),Wn(s,a,Qn(l,t,n,a,e,i))}),s}function Xn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],o=e[a];if(void 0===o&&!(a in e)||!(0,t[a])(o))return!1}return!0}function Zn(e,t,l){if("function"!=typeof e)throw new ge(n);return ho(function(){e.apply(void 0,l)},t)}function $n(e,t,n,l){var a=-1,o=it,i=!0,r=e.length,u=[],s=t.length;if(!r)return u;n&&(t=ut(t,At(n))),l?(o=rt,i=!1):t.length>=200&&(o=xt,i=!1,t=new Mn(t));e:for(;++a<r;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,i&&d==d){for(var m=s;m--;)if(t[m]===d)continue e;u.push(c)}else o(t,d,l)||u.push(c)}return u}An.templateSettings={escape:k,evaluate:B,interpolate:U,variable:"",imports:{_:An}},(An.prototype=xn.prototype).constructor=An,(In.prototype=wn(xn.prototype)).constructor=In,(Ln.prototype=wn(xn.prototype)).constructor=Ln,On.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},On.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},On.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return be.call(t,e)?t[e]:void 0},On.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:be.call(t,e)},On.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=qn(t,e);return!(n<0||(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,0))},Rn.prototype.get=function(e){var t=this.__data__,n=qn(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return qn(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,l=qn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new On,map:new(mn||Rn),string:new On}},Pn.prototype.delete=function(e){var t=Qa(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return Qa(this,e).get(e)},Pn.prototype.has=function(e){return Qa(this,e).has(e)},Pn.prototype.set=function(e,t){var n=Qa(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Mn.prototype.add=Mn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Mn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.clear=function(){this.__data__=new Rn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(l)}return n.set(e,t),this.size=n.size,this};var Jn=ya(rl),el=ya(ul,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,a){return n=!!t(e,l,a)}),n}function nl(e,t,n){for(var l=-1,a=e.length;++l<a;){var o=e[l],i=t(o);if(null!=i&&(void 0===r?i==i&&!Zi(i):n(i,r)))var r=i,u=o}return u}function ll(e,t){var n=[];return Jn(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function al(e,t,n,l,a){var o=-1,i=e.length;for(n||(n=lo),a||(a=[]);++o<i;){var r=e[o];t>0&&n(r)?t>1?al(r,t-1,n,l,a):st(a,r):l||(a[a.length]=r)}return a}var ol=Sa(),il=Sa(!0);function rl(e,t){return e&&ol(e,t,Sr)}function ul(e,t){return e&&il(e,t,Sr)}function sl(e,t){return ot(t,function(t){return Vi(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return Ri(e)?l:st(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_t&&_t in ve(e)?function(e){var t=be.call(e,_t),n=e[_t];try{e[_t]=void 0;var l=!0}catch(e){}var a=Te.call(e);return l&&(t?e[_t]=n:delete e[_t]),a}(e):function(e){return Te.call(e)}(e)}function vl(e,t){return e>t}function pl(e,t){return null!=e&&be.call(e,t)}function El(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?rt:it,a=e[0].length,o=e.length,i=o,r=Y(o),u=Infinity,s=[];i--;){var c=e[i];i&&t&&(c=ut(c,At(t))),u=on(c.length,u),r[i]=!n&&(t||a>=120&&c.length>=120)?new Mn(i&&c):void 0}c=e[0];var d=-1,m=r[0];e:for(;++d<a&&s.length<u;){var v=c[d],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?xt(m,p):l(s,p,n))){for(i=o;--i;){var E=r[i];if(!(E?xt(E,p):l(e[i],p,n)))continue e}m&&m.push(p),s.push(v)}}return s}function fl(e,t,n){var l=null==(e=po(e,t=oa(t,e)))?e:e[No(Uo(t))];return null==l?void 0:et(l,e,n)}function hl(e){return zi(e)&&ml(e)==o}function yl(e,t,n,l,a){return e===t||(null==e||null==t||!zi(e)&&!zi(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Ri(e),y=Ri(t),_=d?i:eo(e),C=y?i:eo(t),T=(_=_==o?p:_)==p,D=(C=C==o?p:C)==p,N=_==C;if(N&&ki(e)){if(!ki(t))return!1;d=!0,T=!1}if(N&&!T)return c||(c=new Fn),d||$i(e)?Ha(e,t,n,l,a,c):function(e,t,n,l,a,o,i){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!o(new Ve(e),new Ve(t)));case r:case u:case v:return xi(+e,+t);case s:return e.name==t.name&&e.message==t.message;case E:case f:return e==t+"";case m:var c=kt;case g:if(c||(c=Vt),e.size!=t.size&&!(1&l))return!1;var d=i.get(e);if(d)return d==t;l|=2,i.set(e,t);var p=Ha(c(e),c(t),l,a,o,i);return i.delete(e),p;case h:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,_,n,l,a,c);if(!(1&n)){var A=T&&be.call(e,"__wrapped__"),w=D&&be.call(t,"__wrapped__");if(A||w){var x=A?e.value():e,I=w?t.value():t;return c||(c=new Fn),a(x,I,n,l,c)}}return!!N&&(c||(c=new Fn),function(e,t,n,l,a,o){var i=1&n,r=qa(e),u=r.length;if(u!=qa(t).length&&!i)return!1;for(var s=u;s--;){var c=r[s];if(!(i?c in t:be.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var p=i;++s<u;){var E=e[c=r[s]],g=t[c];if(l)var f=i?l(g,E,c,t,e,o):l(E,g,c,e,t,o);if(!(void 0===f?E===g||a(E,g,n,l,o):f)){v=!1;break}p||(p="constructor"==c)}if(v&&!p){var h=e.constructor,y=t.constructor;h==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof y&&y instanceof y||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,a,c))}(e,t,n,l,yl,a))}function Sl(e,t,n,l){var a=n.length,o=a,i=!l;if(null==e)return!o;for(e=ve(e);a--;){var r=n[a];if(i&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<o;){var u=(r=n[a])[0],s=e[u],c=r[1];if(i&&r[2]){if(void 0===s&&!(u in e))return!1}else{var d=new Fn;if(l)var m=l(s,c,u,e,t,d);if(!(void 0===m?yl(c,s,3,l,d):m))return!1}}return!0}function bl(e){return!(!qi(e)||(t=e,Ce&&Ce in t))&&(Vi(e)?xe:le).test(Ao(e));var t}function _l(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?Ri(e)?Al(e[0],e[1]):Nl(e):tu(e)}function Cl(e){if(!so(e))return ln(e);var t=[];for(var n in ve(e))be.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Tl(e,t){return e<t}function Dl(e,t){var n=-1,l=Mi(e)?Y(e.length):[];return Jn(e,function(e,a,o){l[++n]=t(e,a,o)}),l}function Nl(e){var t=Xa(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||Sl(n,e,t)}}function Al(e,t){return io(e)&&co(t)?mo(No(e),t):function(n){var l=Er(n,e);return void 0===l&&l===t?gr(n,e):yl(t,l,3)}}function wl(e,t,n,l,a){e!==t&&ol(t,function(o,i){if(a||(a=new Fn),qi(o))!function(e,t,n,l,a,o,i){var r=go(e,n),u=go(t,n),s=i.get(u);if(s)Hn(e,n,s);else{var c=o?o(r,u,n+"",e,t,i):void 0,d=void 0===c;if(d){var m=Ri(u),v=!m&&ki(u),p=!m&&!v&&$i(u);c=u,m||v||p?Ri(r)?c=r:Fi(r)?c=Ea(r):v?(d=!1,c=sa(u,!0)):p?(d=!1,c=da(u,!0)):c=[]:Gi(u)||Oi(u)?(c=r,Oi(r)?c=ir(r):qi(r)&&!Vi(r)||(c=no(u))):d=!1}d&&(i.set(u,c),a(c,u,l,o,i),i.delete(u)),Hn(e,n,c)}}(e,t,i,n,wl,l,a);else{var r=l?l(go(e,i),o,i+"",e,t,a):void 0;void 0===r&&(r=o),Hn(e,i,r)}},br)}function xl(e,t){var n=e.length;if(n)return ao(t+=t<0?n:0,n)?e[t]:void 0}function Il(e,t,n){t=t.length?ut(t,function(e){return Ri(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yr];var l=-1;return t=ut(t,At(Ka())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,o=t.criteria,i=a.length,r=n.length;++l<i;){var u=ma(a[l],o[l]);if(u)return l>=r?u:u*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Dl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,o={};++l<a;){var i=t[l],r=cl(e,i);n(r,i)&&Ul(o,oa(i,e),r)}return o}function Ol(e,t,n,l){var a=l?ht:ft,o=-1,i=t.length,r=e;for(e===t&&(t=Ea(t)),n&&(r=ut(e,At(n)));++o<i;)for(var u=0,s=t[o],c=n?n(s):s;(u=a(r,c,u,l))>-1;)r!==e&&Ge.call(r,u,1),Ge.call(e,u,1);return e}function Rl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==o){var o=a;ao(a)?Ge.call(e,a,1):Zl(e,a)}}return e}function Pl(e,t){return e+$t(sn()*(t-e+1))}function Ml(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=$t(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return yo(vo(e,t,Yr),e+"")}function kl(e){return Bn(xr(e))}function Bl(e,t){var n=xr(e);return _o(n,Kn(t,0,n.length))}function Ul(e,t,n,l){if(!qi(e))return e;for(var a=-1,o=(t=oa(t,e)).length,i=o-1,r=e;null!=r&&++a<o;){var u=No(t[a]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(a!=i){var c=r[u];void 0===(s=l?l(c,u,r):void 0)&&(s=qi(c)?c:ao(t[a+1])?[]:{})}Wn(r,u,s),r=r[u]}return e}var Vl=fn?function(e,t){return fn.set(e,t),e}:Yr,Hl=Gt?function(e,t){return Gt(e,"toString",{configurable:!0,enumerable:!1,value:qr(t),writable:!0})}:Yr;function Wl(e){return _o(xr(e))}function ql(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Y(a);++l<a;)o[l]=e[l+t];return o}function zl(e,t){var n;return Jn(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function jl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var o=l+a>>>1,i=e[o];null!==i&&!Zi(i)&&(n?i<=t:i<t)?l=o+1:a=o}return a}return Yl(e,t,Yr,n)}function Yl(e,t,n,l){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var i=(t=n(t))!=t,r=null===t,u=Zi(t),s=void 0===t;a<o;){var c=$t((a+o)/2),d=n(e[c]),m=void 0!==d,v=null===d,p=d==d,E=Zi(d);if(i)var g=l||p;else g=s?p&&(l||m):r?p&&m&&(l||!v):u?p&&m&&!v&&(l||!E):!v&&!E&&(l?d<=t:d<t);g?a=c+1:o=c}return on(o,4294967294)}function Gl(e,t){for(var n=-1,l=e.length,a=0,o=[];++n<l;){var i=e[n],r=t?t(i):i;if(!n||!xi(r,u)){var u=r;o[a++]=0===i?0:i}}return o}function Kl(e){return"number"==typeof e?e:Zi(e)?NaN:+e}function Ql(e){if("string"==typeof e)return e;if(Ri(e))return ut(e,Ql)+"";if(Zi(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xl(e,t,n){var l=-1,a=it,o=e.length,i=!0,r=[],u=r;if(n)i=!1,a=rt;else if(o>=200){var s=t?null:Ma(e);if(s)return Vt(s);i=!1,a=xt,u=new Mn}else u=t?[]:r;e:for(;++l<o;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,i&&d==d){for(var m=u.length;m--;)if(u[m]===d)continue e;t&&u.push(d),r.push(c)}else a(u,d,n)||(u!==r&&u.push(d),r.push(c))}return r}function Zl(e,t){return null==(e=po(e,t=oa(t,e)))||delete e[No(Uo(t))]}function $l(e,t,n,l){return Ul(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,o=l?a:-1;(l?o--:++o<a)&&t(e[o],o,e););return n?ql(e,l?0:o,l?o+1:a):ql(e,l?o+1:0,l?a:o)}function ea(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,st([e],t.args))},n)}function ta(e,t,n){var l=e.length;if(l<2)return l?Xl(e[0]):[];for(var a=-1,o=Y(l);++a<l;)for(var i=e[a],r=-1;++r<l;)r!=a&&(o[a]=$n(o[a]||i,e[r],t,n));return Xl(al(o,1),t,n)}function na(e,t,n){for(var l=-1,a=e.length,o=t.length,i={};++l<a;)n(i,e[l],l<o?t[l]:void 0);return i}function la(e){return Fi(e)?e:[]}function aa(e){return"function"==typeof e?e:Yr}function oa(e,t){return Ri(e)?e:io(e,t)?[e]:Do(rr(e))}var ia=Fl;function ra(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:ql(e,t,n)}var ua=Kt||function(e){return We.clearTimeout(e)};function sa(e,t){if(t)return e.slice();var n=e.length,l=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,o=Zi(e),i=void 0!==t,r=null===t,u=t==t,s=Zi(t);if(!r&&!s&&!o&&e>t||o&&i&&u&&!r&&!s||l&&i&&u||!n&&u||!a)return 1;if(!l&&!o&&!s&&e<t||s&&n&&a&&!l&&!o||r&&n&&a||!i&&a||!u)return-1}return 0}function va(e,t,n,l){for(var a=-1,o=e.length,i=n.length,r=-1,u=t.length,s=an(o-i,0),c=Y(u+s),d=!l;++r<u;)c[r]=t[r];for(;++a<i;)(d||a<o)&&(c[n[a]]=e[a]);for(;s--;)c[r++]=e[a++];return c}function pa(e,t,n,l){for(var a=-1,o=e.length,i=-1,r=n.length,u=-1,s=t.length,c=an(o-r,0),d=Y(c+s),m=!l;++a<c;)d[a]=e[a];for(var v=a;++u<s;)d[v+u]=t[u];for(;++i<r;)(m||a<o)&&(d[v+n[i]]=e[a++]);return d}function Ea(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),a?Yn(n,r,u):Wn(n,r,u)}return n}function fa(e,t){return function(n,l){var a=Ri(n)?tt:zn,o=t?t():{};return a(n,e,Ka(l,2),o)}}function ha(e){return Fl(function(t,n){var l=-1,a=n.length,o=a>1?n[a-1]:void 0,i=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&oo(n[0],n[1],i)&&(o=a<3?void 0:o,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,o)}return t})}function ya(e,t){return function(n,l){if(null==n)return n;if(!Mi(n))return e(n,l);for(var a=n.length,o=t?a:-1,i=ve(n);(t?o--:++o<a)&&!1!==l(i[o],o,i););return n}}function Sa(e){return function(t,n,l){for(var a=-1,o=ve(t),i=l(t),r=i.length;r--;){var u=i[e?r:++a];if(!1===n(o[u],u,o))break}return t}}function ba(e){return function(t){var n=Ft(t=rr(t))?qt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ra(n,1).join(""):t.slice(1);return l[e]()+a}}function _a(e){return function(t){return ct(Vr(Or(t).replace(Ae,"")),e,"")}}function Ca(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=wn(e.prototype),l=e.apply(n,t);return qi(l)?l:n}}function Ta(e){return function(t,n,l){var a=ve(t);if(!Mi(t)){var o=Ka(n,3);t=Sr(t),n=function(e){return o(a[e],e,a)}}var i=e(t,n,l);return i>-1?a[o?t[i]:i]:void 0}}function Da(e){return Wa(function(t){var l=t.length,a=l,o=In.prototype.thru;for(e&&t.reverse();a--;){var i=t[a];if("function"!=typeof i)throw new ge(n);if(o&&!r&&"wrapper"==Ya(i))var r=new In([],!0)}for(a=r?a:l;++a<l;){var u=Ya(i=t[a]),s="wrapper"==u?ja(i):void 0;r=s&&ro(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?r[Ya(s[0])].apply(r,s[3]):1==i.length&&ro(i)?r[u]():r.thru(i)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&Ri(n))return r.plant(n).value();for(var a=0,o=l?t[a].apply(this,e):n;++a<l;)o=t[a].call(this,o);return o}})}function Na(e,t,n,l,a,o,i,r,u,s){var c=128&t,d=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:Ca(e);return function g(){for(var f=arguments.length,h=Y(f),y=f;y--;)h[y]=arguments[y];if(v)var S=Ga(g),b=Ot(h,S);if(l&&(h=va(h,l,a,v)),o&&(h=pa(h,o,i,v)),f-=b,v&&f<s){var _=Ut(h,S);return Ra(e,t,Na,g.placeholder,n,h,_,r,u,s-f)}var C=d?n:this,T=m?C[e]:e;return f=h.length,r?h=Eo(h,r):p&&f>1&&h.reverse(),c&&u<f&&(h.length=u),this&&this!==We&&this instanceof g&&(T=E||Ca(T)),T.apply(C,h)}}function Aa(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,a,o){t(l,n(e),a,o)}),l}(n,e,t(l),{})}}function wa(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Ql(n),l=Ql(l)):(n=Kl(n),l=Kl(l)),a=e(n,l)}return a}}function xa(e){return Wa(function(t){return t=ut(t,At(Ka())),Fl(function(n){var l=this;return e(t,function(e){return et(e,l,n)})})})}function Ia(e,t){var n=(t=void 0===t?" ":Ql(t)).length;if(n<2)return n?Ml(t,e):t;var l=Ml(t,Zt(e/Wt(t)));return Ft(t)?ra(qt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n,l){for(var a=-1,o=an(Zt((t-e)/(n||1)),0),i=Y(o);o--;)i[l?o:++a]=e,e+=n;return i}(t,n,l=void 0===l?t<n?1:-1:nr(l),e)}}function Oa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function Ra(e,t,n,l,a,o,i,r,u,s){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?o:void 0,c?i:void 0,c?void 0:o,c?void 0:i,r,u,s],m=n.apply(void 0,d);return ro(e)&&fo(m,d),m.placeholder=l,So(m,e,t)}function Pa(e){var t=me[e];return function(e,n){if(e=or(e),(n=null==n?0:on(lr(n),292))&&tn(e)){var l=(rr(e)+"e").split("e");return+((l=(rr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Ma=pn&&1/Vt(new pn([,-0]))[1]==1/0?function(e){return new pn(e)}:Zr;function Fa(e){return function(t){var n=eo(t);return n==m?kt(t):n==g?Ht(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,o,i,r,u,s){var c=2&t;if(!c&&"function"!=typeof e)throw new ge(n);var d=o?o.length:0;if(d||(t&=-97,o=i=void 0),u=void 0===u?u:an(lr(u),0),s=void 0===s?s:lr(s),d-=i?i.length:0,64&t){var m=o,v=i;o=i=void 0}var p=c?void 0:ja(e),E=[e,t,a,o,i,m,v,r,u,s];if(p&&function(e,t){var n=e[1],a=t[1],o=n|a;if(!(o<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],o|=1&n?0:4);var i=t[3];if(i){var r=e[3];e[3]=r?va(r,i,t[4]):i,e[4]=r?Ut(e[3],l):t[4]}(i=t[5])&&(e[5]=(r=e[5])?pa(r,i,t[6]):i,e[6]=r?Ut(e[5],l):t[6]),(i=t[7])&&(e[7]=i),128&a&&(e[8]=null==e[8]?t[8]:on(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(E,p),e=E[0],t=E[1],a=E[2],o=E[3],i=E[4],!(s=E[9]=void 0===E[9]?c?0:e.length:an(E[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)g=8==t||16==t?function(e,t,n){var l=Ca(e);return function a(){for(var o=arguments.length,i=Y(o),r=o,u=Ga(a);r--;)i[r]=arguments[r];var s=o<3&&i[0]!==u&&i[o-1]!==u?[]:Ut(i,u);if((o-=s.length)<n)return Ra(e,t,Na,a.placeholder,void 0,i,s,void 0,void 0,n-o);var c=this&&this!==We&&this instanceof a?l:e;return et(c,this,i)}}(e,t,s):32!=t&&33!=t||i.length?Na.apply(void 0,E):function(e,t,n,l){var a=1&t,o=Ca(e);return function t(){for(var i=-1,r=arguments.length,u=-1,s=l.length,c=Y(s+r),d=this&&this!==We&&this instanceof t?o:e;++u<s;)c[u]=l[u];for(;r--;)c[u++]=arguments[++i];return et(d,a?n:this,c)}}(e,t,a,o);else var g=function(e,t,n){var l=1&t,a=Ca(e);return function t(){var o=this&&this!==We&&this instanceof t?a:e;return o.apply(l?n:this,arguments)}}(e,t,a);return So((p?Vl:fo)(g,E),e,t)}function Ba(e,t,n,l){return void 0===e||xi(e,he[n])&&!be.call(l,n)?t:e}function Ua(e,t,n,l,a,o){return qi(e)&&qi(t)&&(o.set(t,e),wl(e,t,void 0,Ua,o),o.delete(t)),e}function Va(e){return Gi(e)?void 0:e}function Ha(e,t,n,l,a,o){var i=1&n,r=e.length,u=t.length;if(r!=u&&!(i&&u>r))return!1;var s=o.get(e),c=o.get(t);if(s&&c)return s==t&&c==e;var d=-1,m=!0,v=2&n?new Mn:void 0;for(o.set(e,t),o.set(t,e);++d<r;){var p=e[d],E=t[d];if(l)var g=i?l(E,p,d,t,e,o):l(p,E,d,e,t,o);if(void 0!==g){if(g)continue;m=!1;break}if(v){if(!mt(t,function(e,t){if(!xt(v,t)&&(p===e||a(p,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(p!==E&&!a(p,E,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function Wa(e){return yo(vo(e,void 0,Po),e+"")}function qa(e){return dl(e,Sr,$a)}function za(e){return dl(e,br,Ja)}var ja=fn?function(e){return fn.get(e)}:Zr;function Ya(e){for(var t=e.name+"",n=hn[t],l=be.call(hn,t)?n.length:0;l--;){var a=n[l],o=a.func;if(null==o||o==e)return a.name}return t}function Ga(e){return(be.call(An,"placeholder")?An:e).placeholder}function Ka(){var e=An.iteratee||Gr;return e=e===Gr?_l:e,arguments.length?e(arguments[0],arguments[1]):e}function Qa(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Xa(e){for(var t=Sr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,co(a)]}return t}function Za(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return bl(n)?n:void 0}var $a=Jt?function(e){return null==e?[]:(e=ve(e),ot(Jt(e),function(t){return Ye.call(e,t)}))}:au,Ja=Jt?function(e){for(var t=[];e;)st(t,$a(e)),e=qe(e);return t}:au,eo=ml;function to(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,o=!1;++l<a;){var i=No(t[l]);if(!(o=null!=e&&n(e,i)))break;e=e[i]}return o||++l!=a?o:!!(a=null==e?0:e.length)&&Wi(a)&&ao(i,a)&&(Ri(e)||Oi(e))}function no(e){return"function"!=typeof e.constructor||so(e)?{}:wn(qe(e))}function lo(e){return Ri(e)||Oi(e)||!!(vt&&e&&e[vt])}function ao(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oo(e,t,n){if(!qi(n))return!1;var l=typeof t;return!!("number"==l?Mi(n)&&ao(t,n.length):"string"==l&&t in n)&&xi(n[t],e)}function io(e,t){if(Ri(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Zi(e))||H.test(e)||!V.test(e)||null!=t&&e in ve(t)}function ro(e){var t=Ya(e),n=An[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=ja(n);return!!l&&e===l[0]}(dn&&eo(new dn(new ArrayBuffer(1)))!=b||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||pn&&eo(new pn)!=g||En&&eo(new En)!=y)&&(eo=function(e){var t=ml(e),n=t==p?e.constructor:void 0,l=n?Ao(n):"";if(l)switch(l){case yn:return b;case Sn:return m;case bn:return"[object Promise]";case _n:return g;case Cn:return y}return t});var uo=ye?Vi:ou;function so(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function co(e){return e==e&&!qi(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,o=an(l.length-t,0),i=Y(o);++a<o;)i[a]=l[t+a];a=-1;for(var r=Y(t+1);++a<t;)r[a]=l[a];return r[t]=n(i),et(e,this,r)}}function po(e,t){return t.length<2?e:cl(e,ql(t,0,-1))}function Eo(e,t){for(var n=e.length,l=on(t.length,n),a=Ea(e);l--;){var o=t[l];e[l]=ao(o,n)?a[o]:void 0}return e}function go(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fo=bo(Vl),ho=Xt||function(e,t){return We.setTimeout(e,t)},yo=bo(Hl);function So(e,t,n){var l=t+"";return yo(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(G,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return nt(a,function(n){var l="_."+n[0];t&n[1]&&!it(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match(K);return t?t[1].split(Q):[]}(l),n)))}function bo(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 _o(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var o=Pl(n,a),i=e[o];e[o]=e[n],e[n]=i}return e.length=t,e}var Co,To,Do=(Co=Ci(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,n,l,a){t.push(l?a.replace($,"$1"):n||e)}),t},function(e){return 500===To.size&&To.clear(),e}),To=Co.cache,Co);function No(e){if("string"==typeof e||Zi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ao(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function wo(e){if(e instanceof Ln)return e.clone();var t=new In(e.__wrapped__,e.__chain__);return t.__actions__=Ea(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var xo=Fl(function(e,t){return Fi(e)?$n(e,al(t,1,Fi,!0)):[]}),Io=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),Ka(n,2)):[]}),Lo=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),void 0,n):[]});function Oo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),gt(e,Ka(t,3),a)}function Ro(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=lr(n),a=n<0?an(l+a,0):on(a,l-1)),gt(e,Ka(t,3),a,!0)}function Po(e){return null!=e&&e.length?al(e,1):[]}function Mo(e){return e&&e.length?e[0]:void 0}var Fo=Fl(function(e){var t=ut(e,la);return t.length&&t[0]===e[0]?gl(t):[]}),ko=Fl(function(e){var t=Uo(e),n=ut(e,la);return t===Uo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,Ka(t,2)):[]}),Bo=Fl(function(e){var t=Uo(e),n=ut(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Uo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Vo=Fl(Ho);function Ho(e,t){return e&&e.length&&t&&t.length?Ol(e,t):e}var Wo=Wa(function(e,t){var n=null==e?0:e.length,l=Gn(e,t);return Rl(e,ut(t,function(e){return ao(e,n)?+e:e}).sort(ma)),l});function qo(e){return null==e?e:cn.call(e)}var zo=Fl(function(e){return Xl(al(e,1,Fi,!0))}),jo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),Xl(al(e,1,Fi,!0),Ka(t,2))}),Yo=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,Xl(al(e,1,Fi,!0),void 0,t)});function Go(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Fi(e))return t=an(e.length,t),!0}),Dt(t,function(t){return ut(e,bt(t))})}function Ko(e,t){if(!e||!e.length)return[];var n=Go(e);return null==t?n:ut(n,function(e){return et(t,void 0,e)})}var Qo=Fl(function(e,t){return Fi(e)?$n(e,t):[]}),Xo=Fl(function(e){return ta(ot(e,Fi))}),Zo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),ta(ot(e,Fi),Ka(t,2))}),$o=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,ta(ot(e,Fi),void 0,t)}),Jo=Fl(Go),ei=Fl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Ko(e,n)});function ti(e){var t=An(e);return t.__chain__=!0,t}function ni(e,t){return t(e)}var li=Wa(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return Gn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&ao(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:ni,args:[a],thisArg:void 0}),new In(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ai=fa(function(e,t,n){be.call(e,n)?++e[n]:Yn(e,n,1)}),oi=Ta(Oo),ii=Ta(Ro);function ri(e,t){return(Ri(e)?nt:Jn)(e,Ka(t,3))}function ui(e,t){return(Ri(e)?lt:el)(e,Ka(t,3))}var si=fa(function(e,t,n){be.call(e,n)?e[n].push(t):Yn(e,n,[t])}),ci=Fl(function(e,t,n){var l=-1,a="function"==typeof t,o=Mi(e)?Y(e.length):[];return Jn(e,function(e){o[++l]=a?et(t,e,n):fl(e,t,n)}),o}),di=fa(function(e,t,n){Yn(e,n,t)});function mi(e,t){return(Ri(e)?ut:Dl)(e,Ka(t,3))}var vi=fa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),pi=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),Il(e,al(t,1),[])}),Ei=Qt||function(){return We.Date.now()};function gi(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function fi(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=lr(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var hi=Fl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,Ga(hi));l|=32}return ka(e,l,t,n,a)}),yi=Fl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,Ga(yi));l|=32}return ka(t,l,e,n,a)});function Si(e,t,l){var a,o,i,r,u,s,c=0,d=!1,m=!1,v=!0;if("function"!=typeof e)throw new ge(n);function p(t){var n=a,l=o;return a=o=void 0,c=t,r=e.apply(l,n)}function E(e){return c=e,u=ho(f,t),d?p(e):r}function g(e){var n=e-s;return void 0===s||n>=t||n<0||m&&e-c>=i}function f(){var e=Ei();if(g(e))return h(e);u=ho(f,function(e){var n=t-(e-s);return m?on(n,i-(e-c)):n}(e))}function h(e){return u=void 0,v&&a?p(e):(a=o=void 0,r)}function y(){var e=Ei(),n=g(e);if(a=arguments,o=this,s=e,n){if(void 0===u)return E(s);if(m)return ua(u),u=ho(f,t),p(s)}return void 0===u&&(u=ho(f,t)),r}return t=or(t)||0,qi(l)&&(d=!!l.leading,i=(m="maxWait"in l)?an(or(l.maxWait)||0,t):i,v="trailing"in l?!!l.trailing:v),y.cancel=function(){void 0!==u&&ua(u),c=0,a=s=o=u=void 0},y.flush=function(){return void 0===u?r:h(Ei())},y}var bi=Fl(function(e,t){return Zn(e,1,t)}),_i=Fl(function(e,t,n){return Zn(e,or(t)||0,n)});function Ci(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=l.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return l.cache=o.set(a,i)||o,i};return l.cache=new(Ci.Cache||Pn),l}function Ti(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ci.Cache=Pn;var Di=ia(function(e,t){var n=(t=1==t.length&&Ri(t[0])?ut(t[0],At(Ka())):ut(al(t,1),At(Ka()))).length;return Fl(function(l){for(var a=-1,o=on(l.length,n);++a<o;)l[a]=t[a].call(this,l[a]);return et(e,this,l)})}),Ni=Fl(function(e,t){return ka(e,32,void 0,t,Ut(t,Ga(Ni)))}),Ai=Fl(function(e,t){return ka(e,64,void 0,t,Ut(t,Ga(Ai)))}),wi=Wa(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function xi(e,t){return e===t||e!=e&&t!=t}var Ii=Oa(vl),Li=Oa(function(e,t){return e>=t}),Oi=hl(function(){return arguments}())?hl:function(e){return zi(e)&&be.call(e,"callee")&&!Ye.call(e,"callee")},Ri=Y.isArray,Pi=Ke?At(Ke):function(e){return zi(e)&&ml(e)==S};function Mi(e){return null!=e&&Wi(e.length)&&!Vi(e)}function Fi(e){return zi(e)&&Mi(e)}var ki=en||ou,Bi=Qe?At(Qe):function(e){return zi(e)&&ml(e)==u};function Ui(e){if(!zi(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Gi(e)}function Vi(e){if(!qi(e))return!1;var t=ml(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Hi(e){return"number"==typeof e&&e==lr(e)}function Wi(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function qi(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function zi(e){return null!=e&&"object"==typeof e}var ji=Xe?At(Xe):function(e){return zi(e)&&eo(e)==m};function Yi(e){return"number"==typeof e||zi(e)&&ml(e)==v}function Gi(e){if(!zi(e)||ml(e)!=p)return!1;var t=qe(e);if(null===t)return!0;var n=be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==De}var Ki=Ze?At(Ze):function(e){return zi(e)&&ml(e)==E},Qi=$e?At($e):function(e){return zi(e)&&eo(e)==g};function Xi(e){return"string"==typeof e||!Ri(e)&&zi(e)&&ml(e)==f}function Zi(e){return"symbol"==typeof e||zi(e)&&ml(e)==h}var $i=Je?At(Je):function(e){return zi(e)&&Wi(e.length)&&!!Me[ml(e)]},Ji=Oa(Tl),er=Oa(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Mi(e))return Xi(e)?qt(e):Ea(e);if(pt&&e[pt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[pt]());var t=eo(e);return(t==m?kt:t==g?Vt:xr)(e)}function nr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function lr(e){var t=nr(e),n=t%1;return t==t?n?t-n:t:0}function ar(e){return e?Kn(lr(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Zi(e))return NaN;if(qi(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=qi(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Nt(e);var n=ne.test(e);return n||ae.test(e)?Ue(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ir(e){return ga(e,br(e))}function rr(e){return null==e?"":Ql(e)}var ur=ha(function(e,t){if(so(t)||Mi(t))ga(t,Sr(t),e);else for(var n in t)be.call(t,n)&&Wn(e,n,t[n])}),sr=ha(function(e,t){ga(t,br(t),e)}),cr=ha(function(e,t,n,l){ga(t,br(t),e,l)}),dr=ha(function(e,t,n,l){ga(t,Sr(t),e,l)}),mr=Wa(Gn),vr=Fl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oo(t[0],t[1],a)&&(l=1);++n<l;)for(var o=t[n],i=br(o),r=-1,u=i.length;++r<u;){var s=i[r],c=e[s];(void 0===c||xi(c,he[s])&&!be.call(e,s))&&(e[s]=o[s])}return e}),pr=Fl(function(e){return e.push(void 0,Ua),et(Cr,void 0,e)});function Er(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&to(e,t,El)}var fr=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n},qr(Yr)),hr=Aa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),be.call(e,t)?e[t].push(n):e[t]=[n]},Ka),yr=Fl(fl);function Sr(e){return Mi(e)?kn(e):Cl(e)}function br(e){return Mi(e)?kn(e,!0):function(e){if(!qi(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=so(e),n=[];for(var l in e)("constructor"!=l||!t&&be.call(e,l))&&n.push(l);return n}(e)}var _r=ha(function(e,t,n){wl(e,t,n)}),Cr=ha(function(e,t,n,l){wl(e,t,n,l)}),Tr=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,za(e),n),l&&(n=Qn(n,7,Va));for(var a=t.length;a--;)Zl(n,t[a]);return n}),Dr=Wa(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(za(e),function(e){return[e]});return t=Ka(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Ar=Fa(Sr),wr=Fa(br);function xr(e){return null==e?[]:wt(e,Sr(e))}var Ir=_a(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Ur(rr(e).toLowerCase())}function Or(e){return(e=rr(e))&&e.replace(ie,Rt).replace(we,"")}var Rr=_a(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Pr=_a(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Mr=ba("toLowerCase"),Fr=_a(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=_a(function(e,t,n){return e+(n?" ":"")+Ur(t)}),Br=_a(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ur=ba("toUpperCase");function Vr(e,t,n){return e=rr(e),void 0===(t=n?void 0:t)?function(e){return Oe.test(e)}(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Hr=Fl(function(e,t){try{return et(e,void 0,t)}catch(e){return Ui(e)?e:new ce(e)}}),Wr=Wa(function(e,t){return nt(t,function(t){t=No(t),Yn(e,t,hi(e[t],e))}),e});function qr(e){return function(){return e}}var zr=Da(),jr=Da(!0);function Yr(e){return e}function Gr(e){return _l("function"==typeof e?e:Qn(e,1))}var Kr=Fl(function(e,t){return function(n){return fl(n,e,t)}}),Qr=Fl(function(e,t){return function(n){return fl(e,n,t)}});function Xr(e,t,n){var l=Sr(t),a=sl(t,l);null!=n||qi(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=sl(t,Sr(t)));var o=!(qi(n)&&"chain"in n&&!n.chain),i=Vi(e);return nt(a,function(n){var l=t[n];e[n]=l,i&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),a=n.__actions__=Ea(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,st([this.value()],arguments))})}),e}function Zr(){}var $r=xa(ut),Jr=xa(at),eu=xa(mt);function tu(e){return io(e)?bt(No(e)):function(e){return function(t){return cl(t,e)}}(e)}var nu=La(),lu=La(!0);function au(){return[]}function ou(){return!1}var iu,ru=wa(function(e,t){return e+t},0),uu=Pa("ceil"),su=wa(function(e,t){return e/t},1),cu=Pa("floor"),du=wa(function(e,t){return e*t},1),mu=Pa("round"),vu=wa(function(e,t){return e-t},0);return An.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=lr(e),function(){if(--e<1)return t.apply(this,arguments)}},An.ary=gi,An.assign=ur,An.assignIn=sr,An.assignInWith=cr,An.assignWith=dr,An.at=mr,An.before=fi,An.bind=hi,An.bindAll=Wr,An.bindKey=yi,An.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ri(e)?e:[e]},An.chain=ti,An.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:an(lr(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,o=0,i=Y(Zt(l/t));a<l;)i[o++]=ql(e,a,a+=t);return i},An.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var o=e[t];o&&(a[l++]=o)}return a},An.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return st(Ri(n)?Ea(n):[n],al(t,1))},An.cond=function(e){var t=null==e?0:e.length,l=Ka();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Fl(function(n){for(var l=-1;++l<t;){var a=e[l];if(et(a[0],this,n))return et(a[1],this,n)}})},An.conforms=function(e){return function(e){var t=Sr(e);return function(n){return Xn(n,e,t)}}(Qn(e,1))},An.constant=qr,An.countBy=ai,An.create=function(e,t){var n=wn(e);return null==t?n:jn(n,t)},An.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},An.debounce=Si,An.defaults=vr,An.defaultsDeep=pr,An.defer=bi,An.delay=_i,An.difference=xo,An.differenceBy=Io,An.differenceWith=Lo,An.drop=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,(t=n||void 0===t?1:lr(t))<0?0:t,l):[]},An.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,0,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t):[]},An.dropRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0,!0):[]},An.dropWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0):[]},An.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=lr(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:lr(l))<0&&(l+=a),l=n>l?0:ar(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},An.filter=function(e,t){return(Ri(e)?ot:ll)(e,Ka(t,3))},An.flatMap=function(e,t){return al(mi(e,t),1)},An.flatMapDeep=function(e,t){return al(mi(e,t),1/0)},An.flatMapDepth=function(e,t,n){return n=void 0===n?1:lr(n),al(mi(e,t),n)},An.flatten=Po,An.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},An.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:lr(t)):[]},An.flip=function(e){return ka(e,512)},An.flow=zr,An.flowRight=jr,An.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},An.functions=function(e){return null==e?[]:sl(e,Sr(e))},An.functionsIn=function(e){return null==e?[]:sl(e,br(e))},An.groupBy=si,An.initial=function(e){return null!=e&&e.length?ql(e,0,-1):[]},An.intersection=Fo,An.intersectionBy=ko,An.intersectionWith=Bo,An.invert=fr,An.invertBy=hr,An.invokeMap=ci,An.iteratee=Gr,An.keyBy=di,An.keys=Sr,An.keysIn=br,An.map=mi,An.mapKeys=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},An.mapValues=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},An.matches=function(e){return Nl(Qn(e,1))},An.matchesProperty=function(e,t){return Al(e,Qn(t,1))},An.memoize=Ci,An.merge=_r,An.mergeWith=Cr,An.method=Kr,An.methodOf=Qr,An.mixin=Xr,An.negate=Ti,An.nthArg=function(e){return e=lr(e),Fl(function(t){return xl(t,e)})},An.omit=Tr,An.omitBy=function(e,t){return Nr(e,Ti(Ka(t)))},An.once=function(e){return fi(2,e)},An.orderBy=function(e,t,n,l){return null==e?[]:(Ri(t)||(t=null==t?[]:[t]),Ri(n=l?void 0:n)||(n=null==n?[]:[n]),Il(e,t,n))},An.over=$r,An.overArgs=Di,An.overEvery=Jr,An.overSome=eu,An.partial=Ni,An.partialRight=Ai,An.partition=vi,An.pick=Dr,An.pickBy=Nr,An.property=tu,An.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},An.pull=Vo,An.pullAll=Ho,An.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ol(e,t,Ka(n,2)):e},An.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ol(e,t,void 0,n):e},An.pullAt=Wo,An.range=nu,An.rangeRight=lu,An.rearg=wi,An.reject=function(e,t){return(Ri(e)?ot:ll)(e,Ti(Ka(t,3)))},An.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],o=e.length;for(t=Ka(t,3);++l<o;){var i=e[l];t(i,l,e)&&(n.push(i),a.push(l))}return Rl(e,a),n},An.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Fl(e,t=void 0===t?t:lr(t))},An.reverse=qo,An.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),(Ri(e)?Un:Bl)(e,t)},An.set=function(e,t,n){return null==e?e:Ul(e,t,n)},An.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},An.shuffle=function(e){return(Ri(e)?Vn:Wl)(e)},An.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:lr(t),n=void 0===n?l:lr(n)),ql(e,t,n)):[]},An.sortBy=pi,An.sortedUniq=function(e){return e&&e.length?Gl(e):[]},An.sortedUniqBy=function(e,t){return e&&e.length?Gl(e,Ka(t,2)):[]},An.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!Ki(t))&&!(t=Ql(t))&&Ft(e)?ra(qt(e),0,n):e.split(t,n):[]},An.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:an(lr(t),0),Fl(function(n){var l=n[t],a=ra(n,0,t);return l&&st(a,l),et(e,this,a)})},An.tail=function(e){var t=null==e?0:e.length;return t?ql(e,1,t):[]},An.take=function(e,t,n){return e&&e.length?ql(e,0,(t=n||void 0===t?1:lr(t))<0?0:t):[]},An.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?ql(e,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t,l):[]},An.takeRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!1,!0):[]},An.takeWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3)):[]},An.tap=function(e,t){return t(e),e},An.throttle=function(e,t,l){var a=!0,o=!0;if("function"!=typeof e)throw new ge(n);return qi(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),Si(e,t,{leading:a,maxWait:t,trailing:o})},An.thru=ni,An.toArray=tr,An.toPairs=Ar,An.toPairsIn=wr,An.toPath=function(e){return Ri(e)?ut(e,No):Zi(e)?[e]:Ea(Do(rr(e)))},An.toPlainObject=ir,An.transform=function(e,t,n){var l=Ri(e),a=l||ki(e)||$i(e);if(t=Ka(t,4),null==n){var o=e&&e.constructor;n=a?l?new o:[]:qi(e)&&Vi(o)?wn(qe(e)):{}}return(a?nt:rl)(e,function(e,l,a){return t(n,e,l,a)}),n},An.unary=function(e){return gi(e,1)},An.union=zo,An.unionBy=jo,An.unionWith=Yo,An.uniq=function(e){return e&&e.length?Xl(e):[]},An.uniqBy=function(e,t){return e&&e.length?Xl(e,Ka(t,2)):[]},An.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xl(e,void 0,t):[]},An.unset=function(e,t){return null==e||Zl(e,t)},An.unzip=Go,An.unzipWith=Ko,An.update=function(e,t,n){return null==e?e:$l(e,t,aa(n))},An.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:$l(e,t,aa(n),l)},An.values=xr,An.valuesIn=function(e){return null==e?[]:wt(e,br(e))},An.without=Qo,An.words=Vr,An.wrap=function(e,t){return Ni(aa(t),e)},An.xor=Xo,An.xorBy=Zo,An.xorWith=$o,An.zip=Jo,An.zipObject=function(e,t){return na(e||[],t||[],Wn)},An.zipObjectDeep=function(e,t){return na(e||[],t||[],Ul)},An.zipWith=ei,An.entries=Ar,An.entriesIn=wr,An.extend=sr,An.extendWith=cr,Xr(An,An),An.add=ru,An.attempt=Hr,An.camelCase=Ir,An.capitalize=Lr,An.ceil=uu,An.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),Kn(or(e),t,n)},An.clone=function(e){return Qn(e,4)},An.cloneDeep=function(e){return Qn(e,5)},An.cloneDeepWith=function(e,t){return Qn(e,5,t="function"==typeof t?t:void 0)},An.cloneWith=function(e,t){return Qn(e,4,t="function"==typeof t?t:void 0)},An.conformsTo=function(e,t){return null==t||Xn(e,t,Sr(t))},An.deburr=Or,An.defaultTo=function(e,t){return null==e||e!=e?t:e},An.divide=su,An.endsWith=function(e,t,n){e=rr(e),t=Ql(t);var l=e.length,a=n=void 0===n?l:Kn(lr(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},An.eq=xi,An.escape=function(e){return(e=rr(e))&&F.test(e)?e.replace(P,Pt):e},An.escapeRegExp=function(e){return(e=rr(e))&&z.test(e)?e.replace(q,"\\$&"):e},An.every=function(e,t,n){var l=Ri(e)?at:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},An.find=oi,An.findIndex=Oo,An.findKey=function(e,t){return Et(e,Ka(t,3),rl)},An.findLast=ii,An.findLastIndex=Ro,An.findLastKey=function(e,t){return Et(e,Ka(t,3),ul)},An.floor=cu,An.forEach=ri,An.forEachRight=ui,An.forIn=function(e,t){return null==e?e:ol(e,Ka(t,3),br)},An.forInRight=function(e,t){return null==e?e:il(e,Ka(t,3),br)},An.forOwn=function(e,t){return e&&rl(e,Ka(t,3))},An.forOwnRight=function(e,t){return e&&ul(e,Ka(t,3))},An.get=Er,An.gt=Ii,An.gte=Li,An.has=function(e,t){return null!=e&&to(e,t,pl)},An.hasIn=gr,An.head=Mo,An.identity=Yr,An.includes=function(e,t,n,l){e=Mi(e)?e:xr(e),n=n&&!l?lr(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Xi(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&ft(e,t,n)>-1},An.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),ft(e,t,a)},An.inRange=function(e,t,n){return t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n){return e>=on(t,n)&&e<an(t,n)}(e=or(e),t,n)},An.invoke=yr,An.isArguments=Oi,An.isArray=Ri,An.isArrayBuffer=Pi,An.isArrayLike=Mi,An.isArrayLikeObject=Fi,An.isBoolean=function(e){return!0===e||!1===e||zi(e)&&ml(e)==r},An.isBuffer=ki,An.isDate=Bi,An.isElement=function(e){return zi(e)&&1===e.nodeType&&!Gi(e)},An.isEmpty=function(e){if(null==e)return!0;if(Mi(e)&&(Ri(e)||"string"==typeof e||"function"==typeof e.splice||ki(e)||$i(e)||Oi(e)))return!e.length;var t=eo(e);if(t==m||t==g)return!e.size;if(so(e))return!Cl(e).length;for(var n in e)if(be.call(e,n))return!1;return!0},An.isEqual=function(e,t){return yl(e,t)},An.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?yl(e,t,void 0,n):!!l},An.isError=Ui,An.isFinite=function(e){return"number"==typeof e&&tn(e)},An.isFunction=Vi,An.isInteger=Hi,An.isLength=Wi,An.isMap=ji,An.isMatch=function(e,t){return e===t||Sl(e,t,Xa(t))},An.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sl(e,t,Xa(t),n)},An.isNaN=function(e){return Yi(e)&&e!=+e},An.isNative=function(e){if(uo(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return bl(e)},An.isNil=function(e){return null==e},An.isNull=function(e){return null===e},An.isNumber=Yi,An.isObject=qi,An.isObjectLike=zi,An.isPlainObject=Gi,An.isRegExp=Ki,An.isSafeInteger=function(e){return Hi(e)&&e>=-9007199254740991&&e<=9007199254740991},An.isSet=Qi,An.isString=Xi,An.isSymbol=Zi,An.isTypedArray=$i,An.isUndefined=function(e){return void 0===e},An.isWeakMap=function(e){return zi(e)&&eo(e)==y},An.isWeakSet=function(e){return zi(e)&&"[object WeakSet]"==ml(e)},An.join=function(e,t){return null==e?"":nn.call(e,t)},An.kebabCase=Rr,An.last=Uo,An.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=lr(n))<0?an(l+a,0):on(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):gt(e,yt,a,!0)},An.lowerCase=Pr,An.lowerFirst=Mr,An.lt=Ji,An.lte=er,An.max=function(e){return e&&e.length?nl(e,Yr,vl):void 0},An.maxBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),vl):void 0},An.mean=function(e){return St(e,Yr)},An.meanBy=function(e,t){return St(e,Ka(t,2))},An.min=function(e){return e&&e.length?nl(e,Yr,Tl):void 0},An.minBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),Tl):void 0},An.stubArray=au,An.stubFalse=ou,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=du,An.nth=function(e,t){return e&&e.length?xl(e,lr(t)):void 0},An.noConflict=function(){return We._===this&&(We._=Ne),this},An.noop=Zr,An.now=Ei,An.pad=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return Ia($t(a),n)+e+Ia(Zt(a),n)},An.padEnd=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?e+Ia(t-l,n):e},An.padStart=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?Ia(t-l,n)+e:e},An.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(rr(e).replace(j,""),t||0)},An.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=nr(e),void 0===t?(t=e,e=0):t=nr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=sn();return on(e+a*(t-e+Be("1e-"+((a+"").length-1))),t)}return Pl(e,t)},An.reduce=function(e,t,n){var l=Ri(e)?ct:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,Jn)},An.reduceRight=function(e,t,n){var l=Ri(e)?dt:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,el)},An.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),Ml(rr(e),t)},An.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},An.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=a,o=n),e=Vi(o)?o.call(e):o}return e},An.round=mu,An.runInContext=e,An.sample=function(e){return(Ri(e)?Bn:kl)(e)},An.size=function(e){if(null==e)return 0;if(Mi(e))return Xi(e)?Wt(e):e.length;var t=eo(e);return t==m||t==g?e.size:Cl(e).length},An.snakeCase=Fr,An.some=function(e,t,n){var l=Ri(e)?mt:zl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},An.sortedIndex=function(e,t){return jl(e,t)},An.sortedIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2))},An.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=jl(e,t);if(l<n&&xi(e[l],t))return l}return-1},An.sortedLastIndex=function(e,t){return jl(e,t,!0)},An.sortedLastIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2),!0)},An.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=jl(e,t,!0)-1;if(xi(e[n],t))return n}return-1},An.startCase=kr,An.startsWith=function(e,t,n){return e=rr(e),n=null==n?0:Kn(lr(n),0,e.length),t=Ql(t),e.slice(n,n+t.length)==t},An.subtract=vu,An.sum=function(e){return e&&e.length?Tt(e,Yr):0},An.sumBy=function(e,t){return e&&e.length?Tt(e,Ka(t,2)):0},An.template=function(e,t,n){var l=An.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=rr(e),t=cr({},t,l,Ba);var a,o,i=cr({},t.imports,l.imports,Ba),r=Sr(i),u=wt(i,r),s=0,c=t.interpolate||re,d="__p += '",m=pe((t.escape||re).source+"|"+c.source+"|"+(c===U?J:re).source+"|"+(t.evaluate||re).source+"|$","g"),v="//# sourceURL="+(be.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Pe+"]")+"\n";e.replace(m,function(t,n,l,i,r,u){return l||(l=i),d+=e.slice(s,u).replace(ue,Mt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(o=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),d+="';\n";var p=be.call(t,"variable")&&t.variable;if(p){if(Z.test(p))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(I,""):d).replace(L,"$1").replace(O,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var E=Hr(function(){return de(r,v+"return "+d).apply(void 0,u)});if(E.source=d,Ui(E))throw E;return E},An.times=function(e,t){if((e=lr(e))<1||e>9007199254740991)return[];var n=4294967295,l=on(e,4294967295);e-=4294967295;for(var a=Dt(l,t=Ka(t));++n<e;)t(n);return a},An.toFinite=nr,An.toInteger=lr,An.toLength=ar,An.toLower=function(e){return rr(e).toLowerCase()},An.toNumber=or,An.toSafeInteger=function(e){return e?Kn(lr(e),-9007199254740991,9007199254740991):0===e?e:0},An.toString=rr,An.toUpper=function(e){return rr(e).toUpperCase()},An.trim=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return Nt(e);if(!e||!(t=Ql(t)))return e;var l=qt(e),a=qt(t);return ra(l,It(l,a),Lt(l,a)+1).join("")},An.trimEnd=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=Ql(t)))return e;var l=qt(e);return ra(l,0,Lt(l,qt(t))+1).join("")},An.trimStart=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.replace(j,"");if(!e||!(t=Ql(t)))return e;var l=qt(e);return ra(l,It(l,qt(t))).join("")},An.truncate=function(e,t){var n=30,l="...";if(qi(t)){var a="separator"in t?t.separator:a;n="length"in t?lr(t.length):n,l="omission"in t?Ql(t.omission):l}var o=(e=rr(e)).length;if(Ft(e)){var i=qt(e);o=i.length}if(n>=o)return e;var r=n-Wt(l);if(r<1)return l;var u=i?ra(i,0,r).join(""):e.slice(0,r);if(void 0===a)return u+l;if(i&&(r+=u.length-r),Ki(a)){if(e.slice(r).search(a)){var s,c=u;for(a.global||(a=pe(a.source,rr(ee.exec(a))+"g")),a.lastIndex=0;s=a.exec(c);)var d=s.index;u=u.slice(0,void 0===d?r:d)}}else if(e.indexOf(Ql(a),r)!=r){var m=u.lastIndexOf(a);m>-1&&(u=u.slice(0,m))}return u+l},An.unescape=function(e){return(e=rr(e))&&M.test(e)?e.replace(R,jt):e},An.uniqueId=function(e){var t=++_e;return rr(e)+t},An.upperCase=Br,An.upperFirst=Ur,An.each=ri,An.eachRight=ui,An.first=Mo,Xr(An,(iu={},rl(An,function(e,t){be.call(An.prototype,t)||(iu[t]=e)}),iu),{chain:!1}),An.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){An[e].placeholder=An}),nt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:an(lr(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=on(n,l.__takeCount__):l.__views__.push({size:on(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),nt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ka(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),nt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(Yr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return fl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Ti(Ka(e)))},Ln.prototype.slice=function(e,t){e=lr(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=lr(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},rl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=An[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);a&&(An.prototype[t]=function(){var t=this.__wrapped__,i=l?[1]:arguments,r=t instanceof Ln,u=i[0],s=r||Ri(t),c=function(e){var t=a.apply(An,st([e],i));return l&&d?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(r=s=!1);var d=this.__chain__,m=!!this.__actions__.length,v=o&&!d,p=r&&!m;if(!o&&s){t=p?t:new Ln(this);var E=e.apply(t,i);return E.__actions__.push({func:ni,args:[c],thisArg:void 0}),new In(E,d)}return v&&p?e.apply(this,i):(E=this.thru(c),v?l?E.value()[0]:E.value():E)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=fe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);An.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(Ri(a)?a:[],e)}return this[n](function(n){return t.apply(Ri(n)?n:[],e)})}}),rl(Ln.prototype,function(e,t){var n=An[t];if(n){var l=n.name+"";be.call(hn,l)||(hn[l]=[]),hn[l].push({name:t,func:n})}}),hn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=Ea(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ea(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ea(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ri(e),l=t<0,a=n?e.length:0,o=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var o=n[l],i=o.size;switch(o.type){case"drop":e+=i;break;case"dropRight":t-=i;break;case"take":t=on(t,e+i);break;case"takeRight":e=an(e,t-i)}}return{start:e,end:t}}(0,a,this.__views__),i=o.start,r=o.end,u=r-i,s=l?r:i-1,c=this.__iteratees__,d=c.length,m=0,v=on(u,this.__takeCount__);if(!n||!l&&a==u&&v==u)return ea(e,this.__actions__);var p=[];e:for(;u--&&m<v;){for(var E=-1,g=e[s+=t];++E<d;){var f=c[E],h=f.type,y=(0,f.iteratee)(g);if(2==h)g=y;else if(!y){if(1==h)continue e;break e}}p[m++]=g}return p},An.prototype.at=li,An.prototype.chain=function(){return ti(this)},An.prototype.commit=function(){return new In(this.value(),this.__chain__)},An.prototype.next=function(){void 0===this.__values__&&(this.__values__=tr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=wo(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},An.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:ni,args:[qo],thisArg:void 0}),new In(t,this.__chain__)}return this.thru(qo)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,pt&&(An.prototype[pt]=function(){return this}),An}();ze?((ze.exports=Yt)._=Yt,qe._=Yt):We._=Yt}).call(pt)});function eo(e){let{documents:n,svgStyles:o={},isSendBackFlow:i=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:s}=a.useTranslation(),c=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!c&&(null==n?void 0:n.map((e,a)=>{var o,c,d;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},s(null==n?void 0:n.title)),i?null!=n&&null!==(o=n.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),i?(null!==(c=value)&&void 0!==c&&null!==(d=c.documentType)&&void 0!==d&&d.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),c&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+s(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const to=e=>{var t,a;let{t:o,formData:i,applicationData:r,docs:u,bpaActionsDetails:s}=e;const c=(null==r?void 0:r.status)||"",d=(null==s||null===(t=s.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,p]=n.useState((null==i||null===(a=i.documents)||void 0===a?void 0:a.documents)||[]),[E,g]=n.useState(null),[f,h]=n.useState([]),[y,S]=n.useState(!0),[b,_]=n.useState(!1),[C,T]=n.useState(!1),{isLoading:D,data:N}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:A,data:w}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var o,i;null!=N&&null!==(e=N.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==N||null===(o=N.BPA)||void 0===o||null===(i=o.DocTypeMapping)||void 0===i?void 0:i.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let s=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==w||null===(t=w["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;o===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),s.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(s)),h(s)},[!D,!A]),n.useEffect(()=>{let e=0;f.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),S("0"!=e&&0!=e||!(v.length>0))},[v,b]),n.useEffect(()=>{T("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[r,s]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==f?void 0:f.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(no,{key:t,index:t,document:e,t:o,error:E,setError:g,setDocuments:p,documents:v,setCheckRequiredFields:_,applicationStatus:c,actions:d,bpaTaxDocuments:f,checkEnablingDocs:C}))))};function no(e){var a,o;let{t:i,document:r,setDocuments:u,documents:s,index:c,bpaTaxDocuments:m,checkEnablingDocs:v}=e;const p=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[g,f]=n.useState(p?d({},p,{active:!0,code:null==p?void 0:p.documentType,i18nKey:null==p?void 0:p.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[h,y]=n.useState(null),[S,b]=n.useState(()=>(null==p?void 0:p.fileStoreId)||null),[_,C]=n.useState([]);return n.useEffect(()=>{null!=g&&g.code&&u(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==g?void 0:g.code));return 0===(null==S?void 0:S.length)||null===S?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==g?void 0:g.code,fileStoreId:S,documentUid:S,fileName:(null==h?void 0:h.name)||"",id:s?null===(t=s.find(e=>e.documentType===(null==g?void 0:g.code)))||void 0===t?void 0:t.id:void 0}]})},[S,g]),n.useEffect(()=>{try{_.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],_.map(e=>{var t,n,l;null!=g&&g.code&&r.newUploadedDocs.push({documentType:null==g?void 0:g.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),m[c]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(m)))}catch(e){Promise.reject(e)}},[_,g]),n.useEffect(()=>{},[h]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+i(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(eo,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),v?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?i(null==r?void 0:r.code)+"* ":""+i(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:i,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:g,optionKey:"i18nKey",select:e=>f(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);0!==Object.keys(n).length&&C(l),function(e){e&&y(e.file)}(l[l.length-1])})(0,e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function lo(e){let{fiReport:n,isCitizen:o=!1}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+i("BPA_FI_REPORT")),n.map((e,a)=>{var o,r,u,s,c,d;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+i("BPA_FI_REPORT"):i("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(o=e.date)||void 0===o?void 0:o.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(u=e.date)||void 0===u?void 0:u.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(s=e.questions)||void 0===s?void 0:s.length)&&(null==e||null===(c=e.questions)||void 0===c?void 0:c.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+i(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(eo,{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 ao(e){let{t:a,document:o,setNocDocuments:i,setError:r,nocDocuments:u}=e;const s=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],c=Digit.ULBService.getStateId(),[d,m]=n.useState(),[p,E]=n.useState(null),[g,f]=n.useState(()=>(null==s?void 0:s.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&i(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==g?void 0:g.length)||null===g?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==g),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:g,documentUid:g,fileName:(null==p?void 0:p.name)||""}]})},[g]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=v(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[p]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);!function(e){e&&E(e.file)}(n[n.length-1])})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const oo=e=>{var a;let{t:o,noc:i,docs:r,isNoc:u,applicationData:s,NOCdata:c,bpaActionsDetails:d}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==s?void 0:s.status)||"",p=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:g}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!u}),{data:f}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[h,y]=n.useState([]),[S,b]=n.useState([]),[_,C]=n.useState(!1),[T,D]=Digit.Hooks.useSessionStorage(null==i?void 0:i.nocType,[]),[N,A]=n.useState(null),w=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;y(null==f||null===(e=f["common-masters"])||void 0===e?void 0:e.DocumentType)},[f]),n.useEffect(()=>{var e,t,n;let l,a=[];var o,r,c,d;l=u?null==E||null===(o=E.NOC)||void 0===o||null===(r=o.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==i?void 0:i.applicationType)&&(null==e?void 0:e.nocType)===(null==i?void 0:i.nocType)):null==g||null===(c=g.BPA)||void 0===c||null===(d=c.DocTypeMapping)||void 0===d?void 0:d.filter(e=>{var t,n;return e.WFState==(null==s?void 0:s.status)&&e.RiskType==(null==s?void 0:s.riskType)&&e.ServiceType==(null==s||null===(t=s.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==s||null===(n=s.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==i?void 0:i.additionalDetails,applicationStatus:null==i?void 0:i.applicationStatus,appNumberLink:null==i?void 0:i.applicationNo,nocNo:null==i?void 0:i.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==h||h.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),b(m))},[E,h]),n.useEffect(()=>{C("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[s,d]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:w?""+o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"):o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),c&&c.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:w?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:w?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(eo,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),_&&(null==S?void 0:S.map((e,t)=>l.createElement(ao,{key:t,document:e,t:o,error:N,setError:A,setNocDocuments:D,nocDocuments:T,checkEnablingDocs:_}))))},io=e=>{let{permissions:a,t:o}=e;const[i,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[s,c,m]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const v=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==i?void 0:i.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:v?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==i?void 0:i.map((e,t)=>n===t?d({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==s?void 0:s.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{c(()=>null==s?void 0:s.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:v?"96%":"830px",width:v?"96%":"830px"},style:v?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:v?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...s];t.splice(e,1),c([...t])})(n)}))),l.createElement(t.LinkButton,{style:{maxWidth:v?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{c([...s,{label:""}])}}))};function ro(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:o}=n,{t:i}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:i("ES_PT_TITLE_TAX_HEADS"),text:i("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:i(e.taxHeadCode),label:i(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:i("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function uo(e){let{floors:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function so(e){let{owners:n}=e,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:i}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},s={position:"relative",padding:"8px"},c={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",minWidth:"280px",width:"100%"},s={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u=d({},u,{maxWidth:"950px"}),u=d({},u,{maxWidth:"950px"}),c={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},o.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:u,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?i(null==e?void 0:e.title)+" "+(n+1):i(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:s},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:i(e.title),label:""+i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const co=e=>{var o,i;let{scrutinyDetails:r,paymentsList:u=[],additionalDetails:s,applicationData:c}=e;(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==c?void 0:c.status))&&window.location.href.includes("bpa");const[d,m]=n.useState(),[p,E]=n.useState(),[g,f]=n.useState(),h=Digit.ULBService.getStateId(),[y,S]=n.useState(),[b,_]=n.useState(),[C,T]=n.useState([]),[D,N]=n.useState(),[A,w]=n.useState(""),[x,I]=n.useState(null),[L,O]=n.useState({}),[R,P]=n.useState(!1),[M,F]=n.useState(!1);n.useEffect(()=>{!function(){try{I(null);const e=function(){if(D&&null!=D&&D.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==D||null===(t=D.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(D.size>=2e6)I(k("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=v(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",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?T([...C,{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}]):I(k("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else I(k("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(C))},[C]),n.useEffect(()=>{var e,t,n,l,a,o,i;if(null!=s&&null!==(e=s.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==s?void 0:s.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==s||null===(n=s.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==s||null===(l=s.lessAdjustmentFeeFiles[(null==s||null===(a=s.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,h).then(e=>O(null==e?void 0:e.data))}m(null==s||null===(t=s.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==s||null===(n=s.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),E(null==s||null===(l=s.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==s||null===(a=s.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),f(null==s||null===(o=s.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==s||null===(i=s.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),S(null==s?void 0:s.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==s?void 0:s.otherFeesDiscription),T(null==s?void 0:s.lessAdjustmentFeeFiles)},[s]);const{t:k}=a.useTranslation(),B=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},k(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?k(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void k("NA");return l.createElement(n.Fragment,null,!(null!=r&&r.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==r||null===(o=r.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+k(""+e.title),text:null!=e&&e.value?B(e)+" "+k(null==e?void 0:e.isUnit):k("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:""+k(""+e.title),text:B(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},k(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},k(null==e?void 0:e.title))),null==r||null===(i=r.permit)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))))))},mo=e=>{var o,i,r,u,s;let{edcrDetails:c,applicationData:d}=e;const{t:m}=a.useTranslation(),v=window.Digit.Utils.browser.isMobile(),p=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_DEDUCTION",id:"Deduction"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},g=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function f(e){var t;let n=[],l=0,a=0,o=0;return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,i,r,u,s,c,d,v,p,E,g,f,h,y;const S=Number(null===(t=e.occupancies)||void 0===t||null===(i=t[0])||void 0===i?void 0:i.builtUpArea)||0,b=Number(null===(r=e.occupancies)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.floorArea)||0,_=Number(null===(s=e.occupancies)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.deduction)||0;l+=S,a+=b,o+=_,n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(d=e.occupancies)||void 0===d||null===(v=d[0])||void 0===v?void 0:v.type)),BuildupArea:Number(null===(p=e.occupancies)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.builtUpArea).toFixed(2),Deduction:Number(null===(g=e.occupancies)||void 0===g||null===(f=g[0])||void 0===f?void 0:f.deduction).toFixed(2),FloorArea:Number(null===(h=e.occupancies)||void 0===h||null===(y=h[0])||void 0===y?void 0:y.floorArea).toFixed(2)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n.push({Floor:m("BPA_TOTAL"),Level:"",Occupancy:"",BuildupArea:Number(l).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),Deduction:Number(o).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),FloorArea:Number(a).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL")}),n}function h(e){var t;let n=null==d||null===(t=d.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,o;let t=null===(a=n[e])||void 0===a||null===(o=a.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},null==c||null===(o=c.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""})),null==c||null===(i=c.subOccupancyTableDetails)||void 0===i||null===(r=i[0])||void 0===r||null===(u=r.value)||void 0===u||null===(s=u.planDetail)||void 0===s?void 0:s.blocks.map((e,n)=>{var a,o,i,r,u;return l.createElement("div",{key:n,style:(null==c||null===(a=c.subOccupancyTableDetails)||void 0===a||null===(o=a[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.planDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:f(e),columns:g,getCellProps:e=>({style:{}})})))})))},vo=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))},po=e=>{var o,i,r;let{data:u,OpenImage:s,privacy:c={}}=e;const[d,m]=n.useState(!1),{t:v}=a.useTranslation();return l.createElement("div",null,u.date&&l.createElement("p",null,u.date),l.createElement("p",null,u.name),u.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:u.mobileNumber,privacy:c}),l.createElement("p",null," ")),u.source&&l.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+u.source.toUpperCase())),u.comment&&l.createElement(vo,{otherComment:null==u?void 0:u.otherComment,headComment:null==u?void 0:u.comment}),null!=u&&u.wfComment?l.createElement("div",null,null==u||null===(o=u.wfComment)||void 0===o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("WF_COMMON_COMMENTS")),!d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==u||null===(i=u.thumbnailsToShow)||void 0===i||null===(r=i.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==u?void 0:u.thumbnailsToShow.thumbs,onClick:(e,t)=>{s(e,t,null==u?void 0:u.thumbnailsToShow)}})):null)};function Eo(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function go(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const fo=e=>{var o,i,r,u,s;let{wsAdditionalDetails:c}=e;const{t:d}=a.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:g,roadCuttingDetails:f,roadCuttingAddlDetails:h,activationDetails:y}=(null==c?void 0:c.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==c||null===(o=c.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(i=c.additionalDetails)||void 0===i?void 0:i.plumberDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==g?void 0:g.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==c||null===(r=c.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==f?void 0:f.map(e=>{var n;return l.createElement("div",{style:(null==f?void 0:f.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==c||null===(u=c.additionalDetails)||void 0===u?void 0:u.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==h?void 0:h.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(s=c.additionalDetails)||void 0===s?void 0:s.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==y?void 0:y.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},ho=[{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"}],yo=[{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"}],So=e=>{var o,i,r,u;let{wsAdditionalDetails:s}=e;const{t:c}=a.useTranslation(),[m,v,p]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,g,f]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),h=!(null==s||null===(o=s.additionalDetails)||void 0===o||!o.isPaid),[y,S]=n.useState(!1),[b,C]=n.useState(m||{}),[T,D]=n.useState(null),[N,A]=n.useState(s.additionalDetails.data?s.additionalDetails.data:{}),[w,x]=n.useState(s.additionalDetails.values?s.additionalDetails.values:[]),I=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(I,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=d({},null==s||null===(e=s.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==m||null===(n=m.billDetails)||void 0===n?void 0:n.length)>0){var o,i,r,u,c,p,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(o=m.billDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==m||null===(r=m.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==m||null===(c=m.billDetails)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.taxAmount)}];x(e),A(null==m||null===(E=m.billDetails)||void 0===E?void 0:E[0])}else v(a),C(a)},[]);let L={};const O=e=>l.createElement("h1",{className:"heading-m"},e.label),R=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(R,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=d({},b);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,o;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}C(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},w&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==w?void 0:w.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+c("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==N?void 0:N.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(h?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:h?{color:"#00703C"}:{color:"#D4351C"}}))),null!=s&&null!==(i=s.additionalDetails)&&void 0!==i&&i.isAdhocRebate?l.createElement("div",{onClick:e=>{S(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,y&&l.createElement(t.Modal,{headerBarMain:l.createElement(O,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{C(m),S(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{C(m),S(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=b&&b.adhocPenalty?Number(null==b?void 0:b.adhocPenalty):0,n=null!=b&&b.adhocRebate?Number(null==b?void 0:b.adhocRebate):0;var l,a;if(t||n)if(n>(null==s||null===(l=s.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))D({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,i,r,u,m,p,E,f,h,y;const e=null==s||null===(o=s.additionalDetails)||void 0===o||null===(i=o.appDetails)||void 0===i?void 0:i.applicationNo,t=null==s||null===(r=s.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,n=d({},null==s||null===(m=s.additionalDetails)||void 0===m||null===(p=m.appDetails)||void 0===p?void 0:p.additionalDetails,b);s.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==s||null===(E=s.additionalDetails)||void 0===E||null===(f=E.appDetails)||void 0===f?void 0:f.service)?[{applicationNo:e,tenantId:t,waterConnection:s.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:s.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==s||null===(h=s.additionalDetails)||void 0===h||null===(y=h.appDetails)||void 0===y?void 0:y.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,o,i,r,u,s,c,d,m,p,E,f,h;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(f=E[0])||void 0===f||null===(h=f.taxHeadEstimates)||void 0===h||h.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.taxHeadEstimates,"category");const y=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(s=e.Calculation)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.charge},{title:"WS_TAX_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.taxAmount}];g(Na(e.Calculation[0])),A(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),x(y),b.billDetails=null==e?void 0:e.Calculation,v(b),S(!1)}).catch(e=>{var t,n,l,a,o,i;D({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?c(""+(null==e||null===(a=e.response)||void 0===a||null===(o=a.data)||void 0===o||null===(i=o.Errors[0])||void 0===i?void 0:i.code)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:c("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:ho,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==b?void 0:b.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==b||null===(r=b.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==b?void 0:b.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==b?void 0:b.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_REBATE")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:yo,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==b?void 0:b.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==b||null===(u=b.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==b?void 0:b.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},L={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,d({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==b?void 0:b.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},L={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),T&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==T?void 0:T.isWarning,error:null==T||!T.isWarning,label:c(null==T?void 0:T.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},bo=e=>{var o,i,r,u,s,c,d;let{wsAdditionalDetails:m}=e;const{t:v}=a.useTranslation(),[p,E]=n.useState(!1),[g,f]=n.useState({}),h=e=>l.createElement("h1",{className:"heading-m"},e.label),y=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),S=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(y,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),f(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&l.createElement(t.Modal,{headerBarMain:l.createElement(h,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(S,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==g||null===(i=g.billSlabData)||void 0===i||null===(r=i.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==g||null===(u=g.billSlabData)||void 0===u||null===(s=u.CHARGES)||void 0===s?void 0:s.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==g||null===(c=g.billSlabData)||void 0===c||null===(d=c.TAX)||void 0===d?void 0:d.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==g?void 0:g.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},_o=e=>{let{assessmentData:t}=e;const[a,o]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{o(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,n)=>l.createElement("div",{key:n,className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),l.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),l.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},l.createElement("div",{style:{display:"flex",gap:"75px"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),l.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}}," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess")," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel")," ")),n!==t.length-1&&l.createElement("hr",null)))))},Co=e=>{var t;let{applicationData:a}=e;const[i,r]=n.useState(!1);return o.useHistory(),l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{r(!i)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),l.createElement("span",{style:{fontSize:"1.2em"}},i?"<":">"))),i&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},l.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),l.createElement("span",{style:{flex:"1",color:"black"}},a.acknowldgementNumber)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.propertyId)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(u=null===(t=a.auditDetails)||void 0===t?void 0:t.createdTime,new Date(u).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.status)),l.createElement("div",null,l.createElement(o.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+a.acknowldgementNumber,state:{propertyId:a.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var u},To=e=>{let{payments:t}=e;const[a,o]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{o(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&l.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payments found"),(null==t?void 0:t.length)>0&&l.createElement("div",null,l.createElement("table",{style:{width:"100%",borderCollapse:"collapse",marginTop:"10px"}},l.createElement("thead",null,l.createElement("tr",{style:{backgroundColor:"#f5f5f5"}},l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Receipt Number"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction Date"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Amount Paid"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Payment Mode"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction ID"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Status"))),l.createElement("tbody",null,t.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.id||t},l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},(null===(n=e.paymentDetails)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.receiptNumber)||e.receiptNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionDate?new Date(e.transactionDate).toLocaleDateString():"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},"₹",e.totalAmountPaid||e.amount||"0"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.paymentMode||e.instrumentType||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionNumber||e.instrumentNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},l.createElement("span",{style:{color:"NEW"===e.paymentStatus||"SUCCESSFUL"===e.paymentStatus||"DEPOSITED"===e.paymentStatus?"green":"FAILED"===e.paymentStatus?"red":"orange",fontWeight:"bold"}},"DEPOSITED"===e.paymentStatus?l.createElement("p",null,"Deposited"):e.paymentStatus||"N/A")))}))),l.createElement("div",{style:{marginTop:"10px",fontSize:"14px",color:"#666"}},"Total Payments: ",t.length))))},Do=e=>{if(!e||"N/A"===e)return null;if("string"==typeof e&&null!=e&&e.includes("/")){const[t,n,l]=null==e?void 0:e.split("/");return new Date(l,n-1,t)}return new Date(e)},No=(e,t)=>{if(!e||!t)return"N/A";const n=Do(e),l=Do(t);if(!n||!l||isNaN(null==n?void 0:n.getTime())||isNaN(null==l?void 0:l.getTime()))return"N/A";const a=Math.floor((l-n)/864e5);return a<0?"N/A":0===a?"0 Days":a+" Days"},Ao=l.memo(e=>{let{width:t=85,height:n=100,style:a}=e;return l.createElement("svg",{style:a,xmlns:"http://www.w3.org/2000/svg",width:t,height:n,viewBox:"0 0 20 20",fill:"gray"},l.createElement("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"}))}),wo=l.memo(e=>{let{value:a,Code:o,index:i}=e;const{isLoading:r,data:u}=Digit.Hooks.ads.useADSDocumentSearch({value:a},{value:a},o,i),s=n.useMemo(()=>{var e;const t=null!=a&&a.documents?null==a||null===(e=a.documents)||void 0===e?void 0:e.documents:a;return(null==t?void 0:t.filter(e=>(null==e?void 0:e.documentType)===o))||[]},[a,o]);return r?l.createElement(t.Loader,null):l.createElement("div",{className:"timeline-docs-wrapper"},null==s?void 0:s.map((e,t)=>{const n=((e,t)=>{var n;const l=(null==e?void 0:e[t])||"",a=(null==l||null===(n=l.split(","))||void 0===n?void 0:n.filter(Boolean))||[];return(null==a?void 0:a.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==a?void 0:a[0])||""})(null==u?void 0:u.pdfFiles,null==e?void 0:e.fileStoreId);return n?l.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:n,className:"timeline-doc-link"},l.createElement(Ao,{className:"timeline-doc-icon"})):null}))}),xo=[{label:"CM_TIMELINE_NAME",key:"assignerName"},{label:"CM_TIMELINE_ACTION_TAKEN",key:"performedAction"},{label:"CM_TIMELINE_ACTION_TAKEN_ON",key:"lastModified"},{label:"CM_TIMELINE_DATE_RECEIVED",key:"createdDate"},{label:"CM_TIMELINE_NO_OF_DAYS",key:"noOfDays"}],Io=l.memo(e=>{var t,n;let{checkpoint:a,t:o}=e;return l.createElement("div",{className:"timeline-card"},l.createElement("div",{className:"timeline-header"},null==xo?void 0:xo.map(e=>{let{label:t,key:n}=e;return l.createElement("div",{key:n,className:"timeline-header-item"},l.createElement("span",{className:"timeline-label"},o(t),":"),l.createElement("span",{className:"timeline-value"},o(null==a?void 0:a[n])||"N/A"))})),l.createElement("div",{className:"timeline-note"},l.createElement("span",{className:"timeline-label"},o("CM_TIMELINE_NOTE"),":"),l.createElement("div",{className:"note-box"},(null==a?void 0:a.comment)||o("CM_TIMELINE_NO_COMMENTS"))),(null==a||null===(t=a.documents)||void 0===t?void 0:t.length)>0&&l.createElement("div",{className:"timeline-docs"},l.createElement("span",{className:"timeline-label"},o("CM_TIMELINE_DOCUMENT_ATTACHED"),":"),null==a||null===(n=a.documents)||void 0===n?void 0:n.map((e,t)=>l.createElement(wo,{key:(null==e?void 0:e.documentType)+"-"+t,value:null==a?void 0:a.documents,Code:null==e?void 0:e.documentType,index:t}))))}),Lo=e=>{var a,o,i,r,u,s,c,d;let{workflowDetails:m,t:v}=e;const p=(null==m?void 0:m.data)||m,E=n.useMemo(()=>(e=>{var t;const n=null==e||null===(t=e.data)||void 0===t?void 0:t.timeline;return n&&Array.isArray(n)?null==n?void 0:n.map((e,t)=>{var n,l,a,o;const i=(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.created)||"N/A",r=(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.lastModified)||"N/A";return{id:t,state:null==e?void 0:e.state,assignerName:(null==e||null===(a=e.assigner)||void 0===a?void 0:a.name)||"N/A",performedAction:null==e?void 0:e.performedAction,comment:(null==e||null===(o=e.wfComment)||void 0===o?void 0:o[0])||"",documents:(null==e?void 0:e.wfDocuments)||[],createdDate:i,lastModified:r,noOfDays:No(i,r)}}):[]})({data:p}),[p]),g=null==m||null===(a=m.data)||void 0===a||null===(o=a.timeline)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.state,{isLoading:f,data:h}=Digit.Hooks.ads.useADSDocumentSearch({value:(null==m||null===(r=m.data)||void 0===r||null===(u=r.timeline)||void 0===u?void 0:u.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},{value:(null==m||null===(s=m.data)||void 0===s||null===(c=s.timeline)||void 0===c?void 0:c.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},null,0);console.log("data of doc hook",h);const y=n.useCallback(()=>{if(!f){const e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")||{},t=function(e,t,n,l){var a,o,i,r,u,s,c,d,m;void 0===n&&(n={}),console.log("pdfFiles",n);const v=(null==e||null===(a=e.data)||void 0===a?void 0:a.timeline)||(null==e?void 0:e.timeline)||[],p=(null==e||null===(o=e.data)||void 0===o?void 0:o.processInstances)||(null==e?void 0:e.processInstances)||[],E=(null==p||null===(i=p[0])||void 0===i?void 0:i.businessId)||"N/A",g=(null==p||null===(r=p[0])||void 0===r?void 0:r.businessService)||"N/A",f=(null==p||null===(u=p[0])||void 0===u?void 0:u.moduleName)||"N/A",h=(e,t)=>{var n;const l=(null==e?void 0:e[t])||"",a=(null==l||null===(n=l.split(","))||void 0===n?void 0:n.filter(Boolean))||[];return(null==a?void 0:a.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==a?void 0:a[0])||""},y=v.map((e,t)=>{var a,o,i,r,u,s;const c=(null==e||null===(a=e.auditDetails)||void 0===a?void 0:a.created)||"N/A",d=(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.timing)||"N/A",m=(null==e||null===(i=e.assigner)||void 0===i?void 0:i.name)||"N/A",v=(null==e||null===(r=e.assigner)||void 0===r?void 0:r.type)||"N/A",p=(null==e||null===(u=e.assigner)||void 0===u?void 0:u.mobileNumber)||"N/A",E=(null==e?void 0:e.performedAction)||"N/A",g=(null==e?void 0:e.status)||(null==e?void 0:e.state)||"N/A",f=(null==e||null===(s=e.wfComment)||void 0===s?void 0:s[0])||"-",y=(null==e?void 0:e.wfDocuments)||[];return{sNo:t+1,action:l?l(E):E,status:l?l(g):g,assignerName:m,assignerType:v,mobileNumber:p,designation:v,date:c,time:d,dateTime:(c+" "+("N/A"!==d?d:"")).trim(),comment:f,documents:y.map(e=>({name:(null==e?void 0:e.fileName)||(null==e?void 0:e.documentType)||"Document",type:(null==e?void 0:e.documentType)||"Document",fileStoreId:null==e?void 0:e.fileStoreId,link:h(n,null==e?void 0:e.fileStoreId)})),hasDocuments:y.length>0}});return{t:l,tenantId:(null==t?void 0:t.code)||"",tenantName:(null==t?void 0:t.name)||(null==t?void 0:t.i18nKey)||"Government Department",name:l?l("TIMELINE_PDF_TITLE"):"Application Timeline",heading:l?l("TIMELINE_PDF_HEADING"):"File Movement Report",businessId:E,businessService:l?l("CS_COMMON_"+(null==g?void 0:g.toUpperCase())):g,moduleName:f,currentStatus:l?l((null==v||null===(s=v[0])||void 0===s?void 0:s.status)||(null==v||null===(c=v[0])||void 0===c?void 0:c.state)||"N/A"):(null==v||null===(d=v[0])||void 0===d?void 0:d.status)||(null==v||null===(m=v[0])||void 0===m?void 0:m.state)||"N/A",generatedDate:(new Date).toLocaleDateString("en-IN",{day:"2-digit",month:"long",year:"numeric"}),generatedDateTime:(new Date).toLocaleString("en-IN",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}),timelineRows:y,totalSteps:y.length}}(m,e,(null==h?void 0:h.pdfFiles)||{},v);Digit.Utils.pdf.generateTimelinePDF(t)}},[m,h,v]);return null!=E&&E.length?f?l.createElement(t.Loader,null):l.createElement("div",{className:"timeline-hoc-container"},l.createElement("div",{className:"timeline-header-wrapper"},l.createElement(t.CardSubHeader,{className:"timeline-subheader"},v("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")),l.createElement("span",{onClick:y,className:"download-button"},v("CS_COMMON_DOWNLOAD"))),1===(null==E?void 0:E.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:v(null==E||null===(d=E[0])||void 0===d?void 0:d.state),customChild:l.createElement(Io,{checkpoint:null==E?void 0:E[0],t:v,onDownloadPDF:y})}):l.createElement(t.ConnectingCheckPoints,null,null==E?void 0:E.map(e=>l.createElement(t.CheckPoint,{key:null==e?void 0:e.id,keyValue:null==e?void 0:e.id,isCompleted:(null==e?void 0:e.state)===g,label:v(null==e?void 0:e.state),customChild:l.createElement(Io,{checkpoint:e,t:v,onDownloadPDF:y})})))):null};function Oo(e){var i,r,u,s,c,m,p,E,g,f,h,y,S,b,C,T;let{applicationDetails:D,demandData:N,workflowDetails:A,isDataLoading:w,applicationData:x,timelineStatusPrefix:I,showTimeLine:L=!0,statusAttribute:O="status",paymentsList:R,oldValue:P,isInfoLabel:M=!1,propertyId:F,moduleCode:k}=e;const{t:B}=a.useTranslation(),U=o.useHistory(),V=Digit.ULBService.getCurrentTenantId(),[H,W]=n.useState(null),[q,z]=n.useState([]);let j=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const Y=[{Header:B("BPA_DOCUMENT_DETAILS_LABEL"),accessor:"title",Cell:e=>{let{value:t}=e;return B(t)||B("CS_NA")}},{Header:B(" "),accessor:"url",Cell:e=>{let{value:n}=e;return n?l.createElement(t.LinkButton,{style:{float:"right",display:"inline"},label:B("View"),onClick:()=>{window.open(n,"_blank")}}):B("CS_NA")}}];function G(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("TIMELINE",D,k),n.useEffect(()=>{!function(){try{const e=function(){if(window.location.href.includes("employee/ws")&&null!=x&&x.connectionNo){const e=v(function(){return Promise.resolve(Digit.WSService.paymentsearch({tenantId:(null==x?void 0:x.tenantId)||V,filters:{consumerCodes:null==x?void 0:x.connectionNo,consumerCode:null==x?void 0:x.connectionNo},BusinessService:"SEWERAGE"===(null==x?void 0:x.serviceType)||"SEWARAGE"===(null==x?void 0:x.serviceType)?"SW":"WS"})).then(function(e){Array.isArray(e)&&e.length>0?z(e):null!=e&&e.Payments&&e.Payments.length>0&&z(e.Payments)})},function(e){console.error("❌ Payment fetch error:",e)});if(e&&e.then)return e.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[null==x?void 0:x.connectionNo,null==x?void 0:x.serviceType,V]);const[K,Q]=n.useState({}),[X,Z]=n.useState(),[$,J]=n.useState([]),[ee,te]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==x?void 0:x.status)||ee.loading||ee.loaded||ee.canLoad||te({loading:!1,loaded:!1,canLoad:!0}),null==ee||!ee.canLoad||ee.loading||ee.loaded||(te({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function o(){n(i),l({loading:!1,loaded:!0,canLoad:!0})}let i={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0){const n=a.Assessments.filter(e=>"ACTIVE"===e.status),l=new Map;n.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,n=l.get(t);(!n||e.createdDate>n.createdDate)&&l.set(t,e)});const o=Array.from(l.values());return J(o),Z(null==a?void 0:a.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){i=e})}}();return r&&r.then?r.then(o):o()})}catch(e){return Promise.reject(e)}}((null==x?void 0:x.tenantId)||V,null==x?void 0:x.propertyId,Q,te));const ne=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()},le=function(e,t,n){if(void 0===t&&(t=0),!e)return null;if("OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:ne(null==x||null===(a=x.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==x?void 0:x.channel)||""};return l.createElement(po,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,i,r,u,s,c,d,m,v,p,E,g,f,h,y,S,b,C,T,N;const a={uuid:(null==e||null===(o=e.assigner)||void 0===o?void 0:o.uuid)||(null==e||null===(i=e.assignes)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.uuid),fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==D?void 0:D.tenantId,businessIds:null==D?void 0:D.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+(_.get(e,"ProcessInstances["+t+"].assigner.mobileNumber")||_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber")),n}}},A=n&&Array.isArray(n)&&t>0&&t-1<n.length?n[t-1]:null,w={date:null==e||null===(u=e.auditDetails)||void 0===u?void 0:u.lastModified,name:(null==e||null===(s=e.assigner)||void 0===s?void 0:s.name)||(null==e||null===(c=e.assignes)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.name)||"N/A",mobileNumber:(null==x||null===(m=x.processInstance)||void 0===m||null===(v=m.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)===(null==e||null===(E=e.assigner)||void 0===E?void 0:E.uuid)&&null!=x&&null!==(g=x.processInstance)&&void 0!==g&&null!==(f=g.assignes)&&void 0!==f&&null!==(h=f[0])&&void 0!==h&&h.mobileNumber?null==x||null===(y=x.processInstance)||void 0===y||null===(S=y.assignes)||void 0===S||null===(b=S[0])||void 0===b?void 0:b.mobileNumber:(null==e||null===(C=e.assigner)||void 0===C?void 0:C.mobileNumber)||(null==e||null===(T=e.assignes)||void 0===T||null===(N=T[0])||void 0===N?void 0:N.mobileNumber)||"N/A",comment:null!=e&&e.comment?B(e.comment):"",wfComment:A&&A.wfComment||[],thumbnailsToShow:(null==e?void 0:e.thumbnailsToShow)||[]};return l.createElement(po,{data:w,OpenImage:G,privacy:a})}{var A,w,I,L,O;const t={date:ne(null==x||null===(A=x.auditDetails)||void 0===A?void 0:A.lastModifiedTime),name:(null==e||null===(w=e.assignes)||void 0===w||null===(I=w[0])||void 0===I?void 0:I.name)||"N/A",wfComment:(null==e?void 0:e.wfComment)||[],mobileNumber:(null==e||null===(L=e.assignes)||void 0===L||null===(O=L[0])||void 0===O?void 0:O.mobileNumber)||"N/A"};return l.createElement(po,{data:t})}},ae=(e,t)=>e?t?e:B(e):B("NA"),oe=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),ie=window.location.href.includes("employee/noc"),re=window.location.href.includes("employee/obps"),ue=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||oe?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),se=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?ae(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+B(null==e?void 0:e.isUnit):B("N/A"):null!=e&&e.value?ae(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):B("N/A"),[ce,de]=n.useState(!1),me=(null==N||N.reduce((e,t)=>e+t.demandInterest,0),null==N||N.reduce((e,t)=>e+t.demandPenality,0),null==N||N.reduce((e,t)=>e+t.collectionTax,0),null==N||N.reduce((e,t)=>e+t.collectionInterest,0),null==N||N.reduce((e,t)=>e+t.collectionPenality,0),null==N||N.reduce((e,t)=>e+t.balanceTax,0),null==N||N.reduce((e,t)=>e+t.balanceInterest,0),null==N||N.reduce((e,t)=>e+t.balancePenality,0),function(e,t,n){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const l=d({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:d({},e.additionalDetails,{propertytobestatus:t}),workflow:d({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:d({},l)},V,n)).then(function(){})}catch(e){return Promise.reject(e)}}),ve=null==D?void 0:D.applicationData,pe=(null==D||null===(i=D.applicationData)||void 0===i?void 0:i.propertyId)||"",Ee=null==D||null===(r=D.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return n.useEffect(()=>{if("WS"!==k&&"SW"!==k&&!window.location.href.includes("employee/ws")&&!window.location.href.includes("/ws/")&&F)try{let e={consumerCodes:F};const t=!0;"BPAREG"===k?Digit.OBPSService.paymentsearch({tenantId:V,filters:e,auth:t}).then(e=>{z(null==e?void 0:e.Payments)}):"PT"===k&&Digit.PTService.paymentsearch({tenantId:V,filters:e,auth:t}).then(e=>{z(null==e?void 0:e.Payments)})}catch(e){console.error("❌ Payment search error for PT/BPREG:",e)}},[k,F,V]),l.createElement(t.Card,{style:{position:"relative"}},null==D||null===(u=D.applicationDetails)||void 0===u?void 0:u.map((e,a)=>{var i,r,u,s,c,d,m,v,p,E,g,f,h,y,S,b,_,C,T,N,w,x,I,L,O,M,F,k,U,V,H,W,q,z,G,K,Q,X,Z;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"),{})},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&oe?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},ie?""+B(e.title):B(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},B(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},B(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},B(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},B(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||oe?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i,r;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:B(n.title),label:B(n.title),text:l.createElement("img",{src:B(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:B(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},B(null==n?void 0:n.title)))):ie||re?""+B(n.title):B(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(r=e.values)||void 0===r?void 0:r.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:ue(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+B(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:B(n.title),label:B(n.title),text:se(n),last:a===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:ue(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}})})))),(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(co,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:R,additionalDetails:null==D||null===(u=D.applicationData)||void 0===u?void 0:u.additionalDetails,applicationData:null==D?void 0:D.applicationData}),(null==D||null===(s=D.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(lo,{fiReport:null==D||null===(v=D.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(uo,{floors:null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.floors}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.owners)&&l.createElement(so,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units)&&l.createElement(go,{units:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.units}),(null==e||null===(b=e.additionalDetails)||void 0===b?void 0:b.accessories)&&l.createElement(Eo,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.accessories}),!j&&(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.permissions)&&(null==A||null===(T=A.data)||void 0===T||null===(N=T.nextActions)||void 0===N?void 0:N.length)>0&&l.createElement(io,{applicationData:null==D?void 0:D.applicationData,t:B,permissions:null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.permissions}),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(to,{t:B,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:A})),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.noc)&&l.createElement(oo,{t:B,isNoc:!0,NOCdata:e.values,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.noc,noc:null===(L=e.additionalDetails)||void 0===L?void 0:L.data,bpaActionsDetails:A}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.scruntinyDetails)&&l.createElement(co,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.buildingExtractionDetails)&&l.createElement(co,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.subOccupancyTableDetails)&&l.createElement(mo,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==D?void 0:D.applicationData}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.documentsWithUrl)&&l.createElement(t.Table,{className:"customTable table-border-style",t:B,data:(null==e||null===(U=e.additionalDetails)||void 0===U||null===(V=U.documentsWithUrl[0])||void 0===V?void 0:V.values)||[],columns:Y,getCellProps:()=>({style:{}}),disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.taxHeadEstimatesCalculation)&&l.createElement(ro,{taxHeadEstimatesCalculation:null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(fo,{wsAdditionalDetails:e,oldValue:P}),(null==e||null===(q=e.additionalDetails)||void 0===q?void 0:q.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(o.Link,{to:null==e||null===(z=e.additionalDetails)||void 0===z||null===(G=z.redirectUrl)||void 0===G?void 0:G.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(K=e.additionalDetails)||void 0===K||null===(Q=K.redirectUrl)||void 0===Q?void 0:Q.title))),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.estimationDetails)&&l.createElement(So,{wsAdditionalDetails:e,workflowDetails:A}),(null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.estimationDetails)&&l.createElement(bo,{wsAdditionalDetails:e,workflowDetails:A}))}),(null==X?void 0:X.length)>0&&l.createElement(_o,{assessmentData:$}),l.createElement(To,{payments:q}),"WS"!==k&&"SW"!==k&&"OBPS"!==k&&"BPAStakeholder"!==k&&"BPAREG"!==k&&l.createElement(Co,{applicationData:null==D?void 0:D.applicationData}),L&&(null==A||null===(s=A.data)||void 0===s||null===(c=s.timeline)||void 0===c?void 0:c.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==A?void 0:A.isLoading)||w)&&l.createElement(t.Loader,null),!(null!=A&&A.isLoading)&&!w&&"BPAREG"!==k&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},B("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=A&&null!==(m=A.data)&&void 0!==m&&m.timeline&&1===(null==A||null===(p=A.data)||void 0===p||null===(E=p.timeline)||void 0===E?void 0:E.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:B(""+I+(null==A||null===(g=A.data)||void 0===g||null===(f=g.timeline[0])||void 0===f?void 0:f.state)),customChild:le(null==A||null===(h=A.data)||void 0===h?void 0:h.timeline[0],null==A||null===(y=A.data)||void 0===y?void 0:y.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==A||null===(S=A.data)||void 0===S?void 0:S.timeline)&&(null==A||null===(b=A.data)||void 0===b?void 0:b.timeline.slice(0,ce?null==A?void 0:A.data.timeline.length:2).map((e,n,a)=>{var o;let i="";var r,u,s,c,d,m;return window.location.href.includes("/obps/")&&(i=null!=A&&null!==(r=A.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!=A&&null!==(c=A.data)&&void 0!==c&&null!==(d=c.timeline[n-1])&&void 0!==d&&null!==(m=d.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:B(""+I+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[O])+i),customChild:le(e,n,null==A||null===(o=A.data)||void 0===o?void 0:o.timeline)}))}))),(null==A||null===(C=A.data)||void 0===C||null===(T=C.timeline)||void 0===T?void 0:T.length)>2&&l.createElement(t.LinkButton,{label:B(ce?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{de(e=>!e)}}))),!(null!=A&&A.isLoading)&&!w&&"BPAREG"===k&&l.createElement(Lo,{workflowDetails:A,t:B})),window.location.href.includes("/pt/")?l.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},l.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==Ee?me(ve,"ACTIVE",pe):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==Ee?me(ve,"INACTIVE",pe):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==D||null===(e=D.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var n,l,a;if("INACTIVE"===(null==D||null===(n=D.applicationData)||void 0===n?void 0:n.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==D||null===(l=D.applicationData)||void 0===l?void 0:l.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==D||null===(a=D.applicationData)||void 0===a?void 0:a.status)&&U.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var o,i,r;if("INACTIVE"===(null==D||null===(o=D.applicationData)||void 0===o?void 0:o.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==D||null===(i=D.applicationData)||void 0===i?void 0:i.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==D||null===(r=D.applicationData)||void 0===r?void 0:r.status)&&U.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),l.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):l.createElement("div",null),H&&l.createElement(t.Toast,{error:H.isError,label:B(H.label),onClose:()=>{W(null)},isDleteBtn:"false"}))}function Ro(e){var n,a,o,i,r,u,s,c,d,m,v,p,E,g,f,h,y,S;let{t:b,showToast:_,closeToast:C,businessService:T}=e;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var D;let e="";switch(null==_||null===(D=_.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==_?void 0:_.key)?null==_||null===(n=_.error)||void 0===n?void 0:n.message:b("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==_?void 0:_.key)?null==_||null===(a=_.error)||void 0===a?void 0:a.message:b("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==_?void 0:_.key)?null==_||null===(o=_.error)||void 0===o?void 0:o.message:b("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==_?void 0:_.key)?null==_||null===(i=_.error)||void 0===i?void 0:i.message:b("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==_?void 0:_.key)?null==_||null===(r=_.error)||void 0===r?void 0:r.message:b("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==_?void 0:_.key)?null==_||null===(u=_.error)||void 0===u?void 0:u.message:b("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==_?void 0:_.key)?null==_||null===(s=_.error)||void 0===s?void 0:s.message:b("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==_?void 0:_.key)?null==_||null===(c=_.error)||void 0===c?void 0:c.message:b("ES_"+T+"_"+(null==_||null===(d=_.action)||void 0===d?void 0:d.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,_&&l.createElement(t.Toast,{error:"error"===_.key,label:e,onClose:C}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var N;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=T&&T.includes("BPA_OC")?b(e[1]):b(e[0]),n};let n="";switch(null==_||null===(N=_.action)||void 0===N?void 0:N.action){case"REVOCATE":n="error"===(null==_?void 0:_.key)?null==_||null===(m=_.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==_?void 0:_.key)?null==_||null===(v=_.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==_?void 0:_.key)?null==_||null===(p=_.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==_?void 0:_.key)?null==_||null===(E=_.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==_?void 0:_.key)?null==_||null===(g=_.error)||void 0===g?void 0:g.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==_?void 0:_.key)?null==_||null===(f=_.error)||void 0===f?void 0:f.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==_?void 0:_.key)?null==_||null===(h=_.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==_?void 0:_.key)?null==_||null===(y=_.error)||void 0===y?void 0:y.message:b("ES_"+T+"_"+(null==_||null===(S=_.action)||void 0===S?void 0:S.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,_&&l.createElement(t.Toast,{error:"error"===_.key,label:n,onClose:C}))}{var A,w;const e="error"===(null==_?void 0:_.key)?null==_||null===(A=_.error)||void 0===A?void 0:A.message:"ES_"+T+"_"+(null==_||null===(w=_.action)||void 0===w?void 0:w.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,_&&l.createElement(t.Toast,{error:"error"===_.key,label:b(e),onClose:C}))}}function Po(e){var o,i,r,u,s,c,m,v,p,E,g,f,h,y,S,b;let{workflowDetails:_,displayMenu:C,onActionSelect:T,setDisplayMenu:D,businessService:N,forcedActionPrefix:A,ActionBarStyle:w={},MenuStyle:x={}}=e;const{t:I}=a.useTranslation();let L=Digit.UserService.getUser();const O=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};L=null==t?void 0:t.value}const R=null===(o=L)||void 0===o||null===(i=o.info)||void 0===i||null===(r=i.roles)||void 0===r?void 0:r.map(e=>e.code);let P=!1,M=!1,F=(null==_||null===(u=_.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==_||null===(m=_.data)||void 0===m||null===(v=m.nextActions)||void 0===v?void 0:v.filter(e=>(null==R?void 0:R.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return console.log("ActionsInPayment",_),Digit.Hooks.useClickOutside(O,()=>{D(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(p=F[0])&&void 0!==p&&null!==(E=p.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(M=!1,P=!0):(null==F?void 0:F.length)>0&&(M=!0,P=!1),l.createElement(l.Fragment,null,!(null!=_&&_.isLoading)&&M&&!P&&l.createElement(t.ActionBar,{style:d({},w)},C&&(null!=_&&null!==(g=_.data)&&void 0!==g&&null!==(f=g.actionState)&&void 0!==f&&f.nextActions||null!=_&&null!==(h=_.data)&&void 0!==h&&h.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:A||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()),options:F,optionKey:"action",t:I,onSelect:T,style:x}):null,l.createElement(t.SubmitBar,{ref:O,label:I("WF_TAKE_ACTION"),onSubmit:()=>D(!C)})),!(null!=_&&_.isLoading)&&!M&&P&&l.createElement(t.ActionBar,{style:d({},w)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(y=F[0])||void 0===y?void 0:y.action,value:null==F||null===(S=F[0])||void 0===S?void 0:S.action,onClick:e=>{T((null==F?void 0:F[0])||{})}},I((A||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()))+"_"+(null==F||null===(b=F[0])||void 0===b?void 0:b.action)))))}const Mo=()=>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"})),Fo=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Mo,null));function ko(e){let{action:n,closeWarningPopup:o}=e;const{t:i}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},i("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Fo,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,i("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",i("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+i("PT_AMOUNT_DUE"),text:"₹"+i(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:i("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:i("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const Bo=e=>{var i,u;let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const c=Digit.ULBService.getCurrentTenantId(),m=Digit.ULBService.getStateId(),{data:p}=Digit.Hooks.obps.useMDMS(m,"BPA",["BlockReason"]),{t:E}=a.useTranslation(),g=o.useHistory();let{id:f}=o.useParams();const[h,y]=n.useState(!1),[S,b]=n.useState(null),[_,C]=n.useState(!1),[T,D]=n.useState(!1),[N,A]=n.useState(!1),{data:w}=Digit.Hooks.obps.useMDMS(m,"BPA",["RiskTypeComputation"]),{applicationDetails:x,demandData:I,totalDemandTax:L,totalBalanceTax:O,showToast:R,setShowToast:P,isLoading:M,isDataLoading:F,applicationData:k,mutate:B,nocMutation:U,workflowDetails:V,id:H,businessService:W,closeToast:q,moduleCode:z,timelineStatusPrefix:j,forcedActionPrefix:Y,statusAttribute:G,ActionBarStyle:K,MenuStyle:Q,paymentsList:X,showTimeLine:Z=!0,oldValue:$,isInfoLabel:J=!1,clearDataDetails:ee,propertyId:te}=e;n.useEffect(()=>{R&&V&&V.revalidate&&V.revalidate()},[R]);const ne=r.useQueryClient(),le=()=>{b(null),C(!1)};return console.log("ActionsInPayment2",V),M||T?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,M?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(Oo,{applicationDetails:x,demandData:I,id:H,workflowDetails:V,isDataLoading:F,applicationData:k,totalDemandTax:L,totalBalanceTax:O,businessService:W,timelineStatusPrefix:j,statusAttribute:G,paymentsList:X,showTimeLine:Z,oldValue:$,isInfoLabel:J,propertyId:te,moduleCode:z}),_?l.createElement($a,{t:E,action:S,tenantId:c,state:m,id:f,applicationDetails:x,applicationData:null==x?void 0:x.applicationData,closeModal:le,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,o,i,r,u,s,c,m,p,f,h,y,b,_,C,T,N,A){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(o=a.workflow)||void 0===o||null===(i=o.comment)||void 0===i?void 0:i.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.action)?0==(null==e||null===(s=e.Licenses)||void 0===s||null===(c=s[0])||void 0===c||null===(m=c.additionalDetail)||void 0===m||null===(p=m.validityYears)||void 0===p?void 0:p.length):0==(null==e||null===(f=e.Licenses)||void 0===f||null===(h=f[0])||void 0===h||null===(y=h.comment)||void 0===y?void 0:y.length))||0==(null==e||null===(b=e.WaterConnection)||void 0===b||null===(_=b.comment)||void 0===_?void 0:_.length)||0==(null==e||null===(C=e.SewerageConnection)||void 0===C||null===(T=C.comment)||void 0===T?void 0:T.length)||0==(null==e||null===(N=e.BPA)||void 0===N||null===(A=N.comment)||void 0===A?void 0:A.length)){var w,x;"INITIATE"===(null==e||null===(w=e.Licenses)||void 0===w||null===(x=w[0])||void 0===x?void 0:x.action)?alert(E("Please fill in the validity before submitting")):alert(E("Please fill in the comments before submitting"))}else{const a=function(a,o,i,r,u){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(o=e.BPA)&&void 0!==o&&null!==(i=o.additionalDetails)&&void 0!==i&&i.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(u=r.workflow)||void 0===u?void 0:u.action)){function s(t){if(l)return t;B&&(D(!0),B(e,{onError:(e,t)=>{D(!1),P({key:"error",error:e}),setTimeout(q,5e3)},onSuccess:(e,t)=>{var l,a,o,i,r,u;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),D(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=S,g.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=S,g.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&g.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(i=e.Amendments)||void 0===i?void 0:i.length)>0){var s,c,d,m,v,p,f,h;null!=t&&null!==(s=t.AmendmentUpdate)&&void 0!==s&&null!==(c=s.workflow)&&void 0!==c&&c.action.includes("SEND_BACK")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(p=v.workflow)&&void 0!==p&&p.action.includes("APPROVE")?P({key:"success",label:E("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(f=t.AmendmentUpdate)&&void 0!==f&&null!==(h=f.workflow)&&void 0!==h&&h.action.includes("REJECT")&&P({key:"success",label:E("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var y,b,_;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(u=e.Licenses[0])&&void 0!==u&&u.applicationNumber)return null!=e&&null!==(y=e.Licenses[0])&&void 0!==y&&null!==(b=y.businessService)&&void 0!==b&&b.includes("BPAREG")?(P({key:"success",action:S}),e.selectedAction=S,void g.push("/digit-ui/employee/obps/stakeholder-response",{data:e})):(P({key:"success",action:S}),void g.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(_=e.Licenses[0])||void 0===_?void 0:_.applicationNumber)));P({key:"success",action:S}),ee&&setTimeout(ee,3e3),setTimeout(q,5e3);try{const e=(W||"").toUpperCase(),t=((null==S?void 0:S.action)||"").toUpperCase();e.includes("DISCONNECT")&&(t.includes("APPROVE")||t.includes("EXECUTE")||t.includes("APPROVE_CONNECTION"))&&setTimeout(()=>{var e;null!==(e=window)&&void 0!==e&&e.location&&(window.location.href="https://mseva.lgpunjab.gov.in/employee/inbox")},3e3)}catch(e){}ne.clear(),ne.refetchQueries("APPLICATION_SEARCH")}}})),le()}D(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(d({},e)));const a=function(){if(!1!==t&&U){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==U?void 0:U.mutateAsync(e)),a=v(function(){return D(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,o,i,r,u,s,c,d,m,v;D(!1);let p=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&o.code?E(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.code):(null==e||null===(c=e.response)||void 0===c||null===(d=c.data)||void 0===d||null===(m=d.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;le(),P({key:"error",error:{message:p}}),setTimeout(q,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(s):s(a)}alert(E("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==V||null===(i=V.data)||void 0===i?void 0:i.timeline,businessService:W,workflowDetails:V,moduleCode:z,blockReason:null==p||null===(u=p.BPA)||void 0===u?void 0:u.BlockReason}):null,N?l.createElement(ko,{action:S,workflowDetails:V,businessService:W,isWarningPop:N,closeWarningPopup:()=>{A(!1)}}):null,l.createElement(Ro,{t:E,showToast:R,closeToast:q,businessService:W}),l.createElement("div",null,s?l.createElement(t.SubmitBar,{style:{marginRight:20},label:E("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return console.log("JJJJJJ",e),Promise.resolve(Digit.OBPSService.BPASearch(c,{applicationNo:null==k?void 0:k.applicationNo})).then(function(e){var t,n,l,a,o,i;const r=Digit.Utils.obps.calculateRiskType(null==w||null===(t=w.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==x||null===(n=x.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==x||null===(o=x.edcrDetails)||void 0===o||null===(i=o.planDetail)||void 0===i?void 0:i.blocks),u={BPA:e.BPA[0]};u.BPA.riskType=r,u.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null};const s=function(e,t,n,l,a,o,i,r,s,d,m,v){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==u||null===(e=u.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==u||null===(l=u.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null==u||null===(i=u.BPA)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null==u||null===(d=u.BPA)||void 0===d||null===(m=d.additionalDetails)||void 0===m||null===(v=m.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(u,c)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(E("Enterd Less Adjustment amount is invalid"))}();if(s&&s.then)return s.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&l.createElement(Po,{workflowDetails:V,displayMenu:h,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa"))window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]);else if(null!=e&&e.isWarningPopUp)A(!0);else if(null!=e&&e.redirectionUrll){var a,o,i,r,u;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))g.push(""+(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(u=location)||void 0===u?void 0:u.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.action)){var s,c;g.push(""+(null==e||null===(s=e.redirectionUrll)||void 0===s?void 0:s.pathname),{data:null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.state})}else{var m;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(m=e.redirectionUrll)||void 0===m?void 0:m.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))C(!0);else{var v,p;g.push({pathname:null===(v=e.redirectionUrl)||void 0===v?void 0:v.pathname,state:d({},null===(p=e.redirectionUrl)||void 0===p?void 0:p.state)})}else C(!0);b(e),y(!1)},setDisplayMenu:y,businessService:W,forcedActionPrefix:Y,ActionBarStyle:K,MenuStyle:Q}))))},Uo=e=>{let{t:t,heading:n}=e;return l.createElement("h1",{className:"heading-m"},""+t(n))},Vo=()=>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"})),Ho=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Vo,null)),Wo=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)," "))},qo=e=>{let{t:n,heading:a,docName:o,closeModal:i,actionCancelLabel:r,actionCancelOnSubmit:u,actionSaveLabel:s,actionSaveOnSubmit:c}=e;return l.createElement(t.Modal,{headerBarMain:l.createElement(Uo,{t:n,heading:a}),headerBarEnd:l.createElement(Ho,{onClick:i}),actionCancelLabel:n(r),actionCancelOnSubmit:u,actionSaveLabel:n(s),actionSaveOnSubmit:c,formId:"modal-action"},l.createElement(Wo,{t:n,title:o}))},zo=["uploadedFilesData"],jo=["EDIT","DELETE"],Yo=()=>{var e,i,r,u,s,c,v,p,E,g,f,h,y,S,b,_,T,D;let N=window.Digit.Utils.browser.isMobile();const{id:A}=o.useParams(),{t:w}=a.useTranslation(),x=o.useHistory(),[I,L]=n.useState(!1),[O,R]=n.useState(!1),P=Digit.ULBService.getCurrentTenantId(),{isLoading:M,data:F}=Digit.Hooks.events.useEventDetails(P,{ids:A},{}),[k,B,U]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),[V,H,W]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1),[q,z,j]=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{B(!1),j(),W()},[]),M?l.createElement(t.Loader,null):l.createElement("div",null,I?l.createElement(qo,{t:w,heading:"CONFIRM_DELETE_PUB_BRCST",docName:null==F||null===(e=F.applicationData)||void 0===e?void 0:e.name,closeModal:()=>L(!I),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){L(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:()=>{const e={events:[d({},m(null==F?void 0:F.applicationData,zo),{status:"CANCELLED"})]};x.push("/digit-ui/employee/engagement/messages/response?delete=true",e)}}):null,l.createElement(t.Header,null,w("CS_HEADER_PUBLIC_BRDCST")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_ULB_LABEL")+":")," ",l.createElement("p",null,(e=>{var t,n,l;let a=null==e?void 0:e.split(".")[1];return a=""+(null===(t=a)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.toUpperCase())+(null===(l=a)||void 0===l?void 0:l.slice(1))+" ",a})(null==F?void 0:F.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("PUBLIC_BRDCST_TITLE_LABEL")+":")," ",l.createElement("p",null,null==F||null===(i=F.applicationData)||void 0===i?void 0:i.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_COMMENTS_LABEL")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=F&&null!==(r=F.applicationData)&&void 0!==r&&null!==(u=r.description)&&void 0!==u&&u.length?null==F||null===(s=F.applicationData)||void 0===s?void 0:s.description:"NA")," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_FROM_DATE_LABEL")+":")," ",l.createElement("p",null,null!=F&&null!==(c=F.applicationData)&&void 0!==c&&null!==(v=c.eventDetails)&&void 0!==v&&v.fromDate?we(new Date(null==F||null===(p=F.applicationData)||void 0===p||null===(E=p.eventDetails)||void 0===E?void 0:E.fromDate),"dd/MM/yyyy"):null)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},w("EVENTS_TO_DATE_LABEL")+":")," ",l.createElement("p",null,null!=F&&null!==(g=F.applicationData)&&void 0!==g&&null!==(f=g.eventDetails)&&void 0!==f&&f.toDate?we(new Date(null==F||null===(h=F.applicationData)||void 0===h||null===(y=h.eventDetails)||void 0===y?void 0:y.toDate),"dd/MM/yyyy"):null)," "),l.createElement("span",{className:"documentDetails_subheader"},""+w("CS_COMMON_DOCUMENTS")),null!=F&&null!==(S=F.applicationData)&&void 0!==S&&null!==(b=S.eventDetails)&&void 0!==b&&null!==(_=b.documents)&&void 0!==_&&_.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:()=>C(n,a)},l.createElement(t.GenericFileIcon,null),l.createElement("span",{className:"cell-text"},null==a?void 0:a.split(10))))})):null})(null==F||null===(T=F.applicationData)||void 0===T||null===(D=T.eventDetails)||void 0===D?void 0:D.documents):"NA")),l.createElement(t.ActionBar,null,O?l.createElement(t.Menu,{style:{width:N?"full":"240px"},localeKeyPrefix:"ES_CE",options:jo,t:w,onSelect:function(e){"EDIT"===e&&x.push("/digit-ui/employee/engagement/messages/inbox/edit/"+A),"DELETE"===e&&L(!0),R(!1)}}):null,l.createElement(t.SubmitBar,{label:w("ES_COMMON_TAKE_ACTION"),onSubmit:()=>R(!O)})))},Go=e=>{let{match:{path:n}={},tenants:a,parentRoute:i}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/create",component:e=>l.createElement(ct,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/create",component:e=>l.createElement(ct,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/details/:id",component:e=>l.createElement(Yo,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/edit/:id",component:e=>l.createElement(vt,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(ut,d({},e,{tenants:a,parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/response",component:e=>l.createElement(mt,e)}))},Ko=/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats-officedocument)$/i,Qo=["header","actions","eventNotificationText","timePastAfterEventCreation","timeApproxiamationInUnits"],Xo=e=>{let{header:t,actions:n,eventNotificationText:o,timePastAfterEventCreation:i,timeApproxiamationInUnits:r}=e,u=m(e,Qo);const{t:s}=a.useTranslation(),c=u.eventDetails.documents;return l.createElement("div",{className:"WhatsNewCard"},l.createElement("h2",null,s(t)),l.createElement("p",null,o),null==n?void 0:n.map(e=>{return l.createElement("a",{href:null==e?void 0:e.actionUrl},""+s("CS_COMMON_"+("number"==typeof(t=null==e?void 0:e.code)?t:t&&t.toUpperCase().replace(/[.:-\s\/]/g,"_"))));var t}),(null==c?void 0:c.length)>1?((e,t)=>t.length?l.createElement("div",{className:"broadcastnotifications_actionswrapper-multi"},t.map((t,n)=>{let{fileName:a,fileStoreId:o}=t;return l.createElement("div",{className:"display-flex-gap-2"},a.length?l.createElement("p",null,a," : "):null,o.length?l.createElement("span",{className:"link",onClick:()=>C(o,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,o.length?l.createElement("span",{className:"link",onClick:()=>D(o)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})):null)(s,c):((e,t)=>{if(null==t||!t.length)return null;const{fileStoreId:n,fileName:a}=null==t?void 0:t[0];return l.createElement("div",{className:"display-flex-gap-2"},n&&n.length?l.createElement("span",{className:"link",onClick:()=>C(n,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,n&&n.length?l.createElement("span",{className:"link",onClick:()=>D(n)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})(s,c),l.createElement("p",null,i+" "+s(r)))},Zo=e=>l.createElement("h1",{className:"heading-m"},e.label),$o=()=>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"})),Jo=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement($o,null)),ei=()=>{const{id:e}=o.useParams(),{t:i}=a.useTranslation(),r=o.useHistory(),[u,s]=n.useState(!1),[c,m]=n.useState(!1),v=Digit.ULBService.getCurrentTenantId(),{isLoading:p,data:E}=Digit.Hooks.events.useEventDetails(v,{ids:e}),[g,f,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),[y,S,b]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1),[_,C,T]=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1);return n.useEffect(()=>{f(!1),T(),b()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,i("ES_TITLE_APPLICATION_DETAILS")),l.createElement(Bo,{applicationData:null==E?void 0:E.applicationData,applicationDetails:E,isLoading:p,isDataLoading:p}),l.createElement(t.ActionBar,null,c?l.createElement(t.Menu,{localeKeyPrefix:"ES_EVENT",options:["EDIT","DELETE"],t:i,onSelect:function(t){"EDIT"===t&&r.push("/digit-ui/employee/engagement/event/edit-event/"+e),"DELETE"===t&&s(!0),m(!1)}}):null,l.createElement(t.SubmitBar,{label:i("ES_COMMON_TAKE_ACTION"),onSubmit:()=>m(!c)})),u&&l.createElement(t.Modal,{headerBarMain:l.createElement(Zo,{label:i("ES_EVENT_DELETE_POPUP_HEADER")}),headerBarEnd:l.createElement(Jo,{onClick:()=>s(!1)}),actionCancelLabel:i("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>s(!1),actionSaveLabel:i("ES_EVENT_DELETE"),actionSaveOnSubmit:()=>{const e={events:[d({},null==E?void 0:E.applicationData,{status:"CANCELLED"})]};r.push("/digit-ui/employee/engagement/event/response?delete=true",e)}},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement(t.CardText,null,i("ES_EVENT_DELETE_TEXT")))))},ti=e=>{let{searchValue:n,onChange:a,handleKeyPress:o,handleSearch:i,t:r}=e;return l.createElement("div",null,l.createElement(t.TextInput,{textInputStyle:{maxWidth:"960px"},className:"searchInput",placeholder:r("CE_SERACH_DOCUMENTS"),value:n,onChange:e=>a(e.target.value),signature:!0,signatureImg:l.createElement(t.SearchIconSvg,{className:"signature-img",onClick:()=>i()}),onKeyPress:o}))},ni=(e,t)=>{const[l,a]=n.useState(e);return n.useEffect(()=>{const n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),l},li=e=>{let{documentTitle:n,documentSize:a=2.3,lastModifiedData:o,description:i,filestoreId:r,documentLink:u,t:s}=e,c=window.Digit.Utils.browser.isMobile();return l.createElement("div",{className:"notice_and_circular_main"},l.createElement("div",{className:"notice_and_circular_image"},l.createElement(t.GenericFileIcon,{height:""+(c?66:100),width:""+(c?53:100)})),l.createElement("div",{className:"notice_and_circular_content"},l.createElement("div",{className:"notice_and_circular_heading_mb"},l.createElement(t.CardHeader,null,n),a?l.createElement(t.CardCaption,null,N(a)):null),l.createElement("div",{className:"notice_and_circular_caption"},l.createElement(t.CardCaption,null,s("CE_DCOUMENT_UPLOADED_ON")+" "+(o?we(new Date(o),"do MMMM yyyy"):"-"))),l.createElement("div",{className:"notice_and_circular_text"},l.createElement(t.CardText,null,null!=i&&i.length?i:"NA")),l.createElement("div",{className:"view_download_main"},r&&r.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>C(r||null,n)},l.createElement(t.ViewsIcon,null),l.createElement("p",null,s("CE_DOCUMENT_VIEW_LINK")))}):null,u&&u.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>T(u,n)},l.createElement(t.ExternalLinkIcon,null),l.createElement("p",null,s("CE_DOCUMENT_OPEN_LINK")))}):null,r&&r.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views download_views_padding"},l.createElement(t.DownloadImgIcon,null),l.createElement("p",null,s("CE_DOCUMENT_DOWNLOAD_LINK"))),onClick:()=>D(r||null)}):null)))},ai=(e,t)=>e.map((e,n)=>{let{name:a,createdTime:o,description:i,documentLink:r,fileSize:u,filestoreId:s}=e;return l.createElement(li,{key:n,documentTitle:a,documentSize:u,lastModifiedData:o,description:i,documentLink:r,filestoreId:s,t:t})}),oi=e=>{let{t:n,title:a,count:o,onClick:i,children:r}=e;const[u,s]=l.useState(!1);return l.createElement("div",{className:"accordion-wrapper",onClick:()=>i(a,o)},l.createElement("div",{className:"accordion-title "+(u?"open":""),onClick:()=>s(!u)},n(a)+" ("+o+")",l.createElement(t.PrevIcon,null)),l.createElement("div",{className:"accordion-item "+(u?"":"collapsed")},l.createElement("div",{className:"accordion-content"},r)))},ii=e=>{var a,i,r,u,s;let{t:c}=e;const d=o.useHistory(),[m,v]=n.useState(""),p=Digit.ULBService.getCitizenCurrentTenant(),E=ni(m,700),{data:g,isLoading:f}=Digit.Hooks.engagement.useDocSearch({name:E,tenantIds:p},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}});if(null===(a=Digit.UserService)||void 0===a||null===(i=a.getUser())||void 0===i||!i.access_token)return l.createElement(Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:location.pathname+location.search}}});const h=(e,t)=>{d.push("documents/list/"+e+"/"+t)};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,c("DOCUMENTS_DOCUMENT_HEADER")),l.createElement("div",{className:"Docs_CardWrapper"},l.createElement(ti,{searchValue:m,handleKeyPress:e=>{"Enter"===e.key&&v("")},handleSearch:e=>{v("")},onChange:v,t:c}),l.createElement("hr",{style:{color:"#ccc"}}),f?l.createElement(t.Loader,null):l.createElement("div",{className:"wrapper"},m.length&&null!=g&&null!==(r=g.documentList)&&void 0!==r&&r.length?ai(g.documentList,c):null!=g&&g.statusCount&&null!=g&&null!==(u=g.statusCount)&&void 0!==u&&u.length?null==g||null===(s=g.statusCount)||void 0===s?void 0:s.map((e,t)=>{let{category:n,count:a}=e;return l.createElement(oi,{t:c,title:n,count:a,key:t,onClick:h})}):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))))},ri=e=>{const{t:n}=a.useTranslation(),{applicationNumber:o,tenantId:i}=Digit.Hooks.useQueryParams(),{data:r,isLoading:u}=Digit.Hooks.engagement.useDocSearch({uuid:o,tenantId:i},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}}),statusCount:null==e?void 0:e.statusCount}}}),{documentList:s=[]}=r||{},{name:c=!1,createdTime:d,description:m,documentLink:v,fileSize:p,filestoreId:E}=(null==s?void 0:s[0])||{};return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,""+n("COMMON_VIEW_DOC")),u&&l.createElement(t.Loader,null),c&&l.createElement(li,{key:1,documentTitle:c,documentSize:p,lastModifiedData:d,description:m,documentLink:v,filestoreId:E,t:n}),!c&&!u&&l.createElement(t.Card,null,l.createElement(t.CardCaption,null,n("COMMON_DOC_DATA_NOT_FOUND"))))},ui=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.mutation.isSuccess?"SURVEY_RESPONSE_SUBMITED":"SURVEY_RESPONSE_FAILED"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Surveys)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.mutation.isSuccess?e.surveyTitle:"",successful:e.mutation.isSuccess,whichSvg:"tick"});var o,i,r,u},si=e=>{var i;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useSubmitResponse()),{state:d}=e.location,m=null==d||null===(i=d.AnswerEntity)||void 0===i?void 0:i.surveyTitle;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading&&!c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(ui,{t:s,mutation:c,surveyTitle:m}),l.createElement(t.CardText,null,c.isSuccess?s("SURVEY_FORM_RESPONSE_MESSAGE"):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen/engagement/surveys/list"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ci=e=>{var r,u,s;const c=n.useRef(null),{userType:m}=e,v=o.useHistory(),{t:p}=a.useTranslation(),E=Digit.UserService.getUser().info;console.log("userinfo",E);const g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS");let f=g.filter(e=>{var t;return null==E||null===(t=E.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});const h="employee"===m.toLowerCase()?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY");if(0===(null===(r=f)||void 0===r?void 0:r.length)||"pb.punjab"===h){let e={i18nKey:"TENANT_TENANTS_"+h.replace(".","_").toUpperCase(),code:""+h};f="pb.punjab"===h?[e,...g]:[e]}const[y,S]=n.useState(!1),[b,_]=n.useState(null),[C,T]=n.useState([]),D={city:null===(u=f)||void 0===u?void 0:u[0],offset:0,limit:10,sortOrder:"DESC"},{register:N,control:A,handleSubmit:w,formState:{},watch:x}=i.useForm({defaultValues:D}),I=x();n.useEffect(()=>{var e;const t=null===(e=c.current)||void 0===e?void 0:e.querySelector(".table");t&&(t.style.overflowX="auto",t.style.overflowY="hidden",t.style.WebkitOverflowScrolling="touch")},[]);const L=n.useMemo(()=>[{Header:p("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",null,t.original.surveyTitle))}},{Header:p("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:a}=e;return null!==(t=a.original)&&void 0!==t&&t.startDate?(e=>l.createElement("span",{className:"cell-text styled-cell"},e))(we(new Date(null===(n=a.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:p("Fill Survey"),accessor:"fillSurvey",Cell:e=>{let{row:n}=e;return l.createElement(t.SubmitBar,{label:p("Start Survey"),onSubmit:()=>{R(n.original)}})}}]);function O(){var e;S(!0);const t={tenantId:null==I||null===(e=I.city)||void 0===e?void 0:e.code,active:!0,openSurveyFlag:!0};Digit.Surveys.searchSurvey(t).then(e=>{let t=e.Surveys.filter(e=>e.active);t=t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),T(t),_(t.length),S(!1)}).catch(e=>{S(!1),console.error("Failed to fetch surveys",e)})}n.useEffect(()=>{O()},[]),console.log("userinfo",E);const R=e=>{console.log("Survey Details: ",e);const t={employee:"/digit-ui/employee/engagement/surveys/fill-citizen-details-survey",citizen:"/digit-ui/citizen/engagement/surveys/fill-survey"}[m.toLowerCase()]||"";v.push({pathname:t,state:{surveyDetails:e,userInfo:E,userType:m}})};let P=Digit.Utils.browser.isMobile();return l.createElement("div",null,"pb.punjab"===h&&window.location.href.includes("/employee")?l.createElement(t.Card,{style:{marginTop:"16px",marginBottom:"16px",backgroundColor:"white",maxWidth:"99%"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{fontSize:"20px"}}," Search Surveys ")),l.createElement("hr",{style:{marginTop:"10px"}}),l.createElement("form",{className:"search-form-wrapper rm-mb form-field-flex-one",onSubmit:w(O)},l.createElement(t.SearchField,null,l.createElement("label",null,p("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,d({rules:{required:p("REQUIRED_FIELD")}},N("city"),{render:e=>l.createElement(t.Dropdown,{option:f,optionKey:"i18nKey",selected:null==I?void 0:I.city,select:t=>{e.onChange(t)},t:p}),name:"city",control:A,defaultValue:null===(s=f)||void 0===s?void 0:s[0]}))),l.createElement("div",{className:"form-field",style:{marginTop:"40px"}}," ",l.createElement(t.SubmitBar,{label:"Search",submit:"submit",onSubmit:O})))):null,l.createElement("div",null,P?l.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},(null==C?void 0:C.length)>0?null==C?void 0:C.map((e,n)=>l.createElement(t.Card,{key:n,style:{padding:"12px",borderRadius:"8px",boxShadow:"0px 2px 6px rgba(0,0,0,0.1)"}},l.createElement("h3",{style:{fontSize:"16px",marginBottom:"8px"}},null==e?void 0:e.surveyTitle),l.createElement("p",{style:{margin:"4px 0"}},l.createElement("b",null,"Start:")," ",null!=e&&e.startDate?we(new Date(null==e?void 0:e.startDate),"dd/MM/yyyy"):"NA"),l.createElement(t.SubmitBar,{label:p("Start Survey"),onSubmit:()=>R(e)}))):l.createElement(t.Card,null,p("No Questions found"))):l.createElement(t.Table,{t:p,data:C,totalRecords:b,columns:L,getCellProps:e=>({style:{minWidth:"300px",padding:"20px 18px",fontSize:"16px"}}),noResultsMessage:"No Questions found"})),y&&l.createElement(t.Loader,null))},di=e=>l.createElement("h1",{className:"heading-m"},e.label),mi=()=>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"})),vi=e=>l.createElement("div",{onClick:null==e?void 0:e.onClick,style:null!=e&&e.isMobileView?{padding:5,cursor:"pointer"}:{cursor:"pointer"}},null!=e&&e.isMobileView?l.createElement(t.CloseSvg,null):l.createElement("div",{className:"icon-bg-secondary",style:{backgroundColor:"#505A5F"}}," ",l.createElement(mi,null)," ")),pi=e=>{let{onSelect:n,onCancel:o,onDismiss:i,heading:r,actionCancel:u,content:s,hideSubmit:c}=e;const{t:d}=a.useTranslation(),[m,v]=l.useState(window.innerWidth<=780),p=()=>{window.innerWidth<=780?m||v(!0):m&&v(!1)};return l.useEffect(()=>(window.addEventListener("resize",()=>{p()}),()=>{window.addEventListener("resize",()=>{p()})})),m?l.createElement(t.Modal,{popupStyles:{height:"174px",maxHeight:"174px",width:"324px",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},popupModuleActionBarStyles:{display:"flex",flex:1,justifyContent:"flex-start",width:"100%",position:"absolute",left:0,bottom:0,padding:"18px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},popupModuleMianStyles:{padding:"18px"},headerBarMain:l.createElement(di,{label:d(r)}),headerBarEnd:l.createElement(vi,{onClick:i,isMobileView:m}),actionCancelLabel:!!u&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{margin:0}}," ",s))):l.createElement(t.Modal,{popupModuleMianStyles:{paddingTop:"30px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},headerBarMain:l.createElement(di,{label:d(r)}),headerBarEnd:l.createElement(vi,{onClick:i,isMobileView:!1}),actionCancelLabel:!!u&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{marginBottom:"54px",marginLeft:"8px",marginRight:"8px"}},s)))},Ei=e=>{const{t:r}=a.useTranslation(),[u,s]=n.useState({}),{data:c}=Digit.Hooks.useTenants(),[m,v]=n.useState(null),[p,E]=n.useState(!1),[g,f]=n.useState(!1),[h,y]=n.useState(null),[S,b]=n.useState(!1),[_,C]=n.useState({latitude:null,longitude:null}),[T,D]=n.useState(),[N,A]=n.useState(""),[w,x]=n.useState(!1),I=(Digit.ULBService.getCurrentTenantId(),e.location.state),[L,O]=n.useState(null);console.log("city",localStorage.getItem("CITIZEN.CITY")),n.useEffect(()=>{try{return E(!0),Promise.resolve(Digit.LocationService.getLocalities(m)).then(function(e){E(!1);let t=[];e&&e.TenantBoundary.length>0&&(E(!0),t=Digit.LocalityService.get(e.TenantBoundary[0]),E(!1)),y(t)})}catch(e){Promise.reject(e)}},[m]),n.useEffect(()=>{!function(){try{const e=function(){var e;if("EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase())return E(!0),Promise.resolve(Digit.LocationService.getLocalities(null===(e=I.citizenData.city)||void 0===e?void 0:e.code)).then(function(e){E(!1);let t=[];e&&e.TenantBoundary.length>0&&(E(!0),t=Digit.LocalityService.get(e.TenantBoundary[0]),E(!1)),y(t)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]);const{register:R,formState:{}}=i.useForm({defaultValues:u}),[P,M]=n.useState(null),[F,k]=n.useState(null),B=e.userType,U=o.useHistory(),[V,H]=n.useState(!1),W=n.useRef({});let q=I.surveyDetails;console.log("data",q),q=d({},q,{sections:q.sections.sort((e,t)=>e.sectionOrder-t.sectionOrder).map(e=>d({},e,{questions:e.questions.sort((e,t)=>e.qorder-t.qorder).map(e=>d({},e,{question:d({},e.question,{options:e.question.options.sort((e,t)=>(null==e?void 0:e.optionOrder)-(null==t?void 0:t.optionOrder))})}))}))});const z=function(e){try{var t,n;E(!0);let l={surveyUuid:q.uuid,citizenId:I.userInfo.uuid,tenantId:null===m&&window.location.href.includes("/employee")?null==I||null===(t=I.citizenData)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code:m};try{Digit.Surveys.getAnswers(l).then(t=>{if(E(!1),(null==t?void 0:t.sectionResponses.length)>0){let n={};return t.sectionResponses.forEach(e=>{let t={};e.questionResponses.forEach(n=>{t[n.questionUuid]=d({},u[e.sectionUuid][n.questionUuid],{answerUuid:n.answerUuid})}),n[e.sectionUuid]=t}),s(n),void("draft"===e?Z():$())}"draft"===e?Z():$()})}catch(e){return E(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}};n.useEffect(()=>{!function(){try{var e,t;E(!0);let n={surveyUuid:q.uuid,citizenId:I.userInfo.uuid,tenantId:null==m?window.location.href.includes("/employee")?null==I||null===(e=I.citizenData)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code:localStorage.getItem("CITIZEN.CITY"):m};try{Digit.Surveys.getAnswers(n).then(e=>{if(D(e),E(!1),(null==e?void 0:e.sectionResponses.length)>0){if("Draft"==e.status&&(f(!1),"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()?Y():j()),"Submit"===e.status)return f(!0),b(!0),void H(l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"This Survey is already submitted. Cannot be reSubmitted"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to go back"),l.createElement("button",{onClick:()=>"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()?U.push("/digit-ui/citizen/engagement/surveys/active-open-surveys"):U.push("/digit-ui/employee/engagement/surveys/active-open-surveys"),style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Go Back")));let t={};return e.sectionResponses.forEach(e=>{let n={};e.questionResponses.forEach(e=>{n[e.questionUuid]={answer:e.answerResponse.answerDetails[0].answerContent,answerUuid:e.answerUuid,comments:e.comments,weightage:e.answerResponse.answerDetails[0].weightage}}),t[e.sectionUuid]=n}),void s(t)}"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()?Y():j()})}catch(e){return E(!1),Promise.resolve(e)}Promise.resolve()}catch(e){return Promise.reject(e)}}()},[q.uuid,I.userInfo.uuid]);const j=function(){try{return navigator.geolocation.getCurrentPosition(e=>{x(!0),C({latitude:e.coords.latitude,longitude:e.coords.longitude})},e=>{if(1===e.code)return x(!1),void alert("Location access is mandatory. Without it, we cannot proceed.");x(!1)}),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{var e,t,n;E(!0);const l={uuid:[null==I||null===(e=I.userInfo)||void 0===e?void 0:e.uuid],tenantId:null==I||null===(t=I.userInfo)||void 0===t?void 0:t.tenantId},a={tenantId:null==I||null===(n=I.userInfo)||void 0===n?void 0:n.tenantId};return Digit.Surveys.userSearch(l,a).then(e=>{var t,n,l,a,o,i,r,u;if(E(!1),("200"===(null==e||null===(t=e.responseInfo)||void 0===t?void 0:t.status)||"201"===(null==e||null===(n=e.responseInfo)||void 0===n?void 0:n.status))&&(null==e?void 0:e.user.length)>0)if(null===(null==e||null===(l=e.user[0])||void 0===l?void 0:l.gender)||null===(null==e||null===(a=e.user[0])||void 0===a?void 0:a.emailId)||null===(null==e||null===(o=e.user[0])||void 0===o?void 0:o.dob)||""===(null==e||null===(i=e.user[0])||void 0===i?void 0:i.gender)||""===(null==e||null===(r=e.user[0])||void 0===r?void 0:r.emailId)||""===(null==e||null===(u=e.user[0])||void 0===u?void 0:u.dob))O(!1);else{var s;const t=new Date,n=new Date(null==e||null===(s=e.user[0])||void 0===s?void 0:s.dob);let l=t.getFullYear()-n.getFullYear();const a=t.getMonth()-n.getMonth();if((a<0||0===a&&t.getDate()<n.getDate())&&l--,l<15||l>100)return O(!1),void alert("Citizen age must be between 15 and 100 years.");O(!0),j()}else M({key:!0,isError:!0,label:"ERROR FILE FETCHING CITIZEN DETAILS"})}).catch(e=>(E(!1),e)),Promise.resolve()}catch(e){return Promise.reject(e)}},G=(e,t,n,l,a,o)=>{s(i=>{var r;return d({},i,{[e]:d({},i[e],{[t]:d({},null==i||null===(r=i[e])||void 0===r?void 0:r[t],{answer:a,answerUuid:o,answerType:n,weightage:"MULTIPLE_ANSWER_TYPE"===n||"CHECKBOX_ANSWER_TYPE"===n||"DROP_DOWN_MENU_ANSWER_TYPE"===n?l:null})})})})},K=(e,t,n)=>{s(l=>{var a;return d({},l,{[e]:d({},l[e],{[t]:d({},null==l||null===(a=l[e])||void 0===a?void 0:a[t],{comments:n})})})})},[Q,X]=n.useState({});n.useEffect(()=>{const e=setInterval(()=>{JSON.stringify(W.current)!==JSON.stringify(u)&&(I.citizenFill&&"employee"===B.toLowerCase()||"citizen"===B.toLowerCase())&&(W.current=u,F&&z("draft"))},1e4);return()=>clearInterval(e)},[u]);const Z=function(){try{var e,t,n,l,a,o,i,r,s;E(!0);let d=[];for(const e in u)for(const t in u[e]){var c;d.push({uuid:u[e][t].answerUuid,surveyUuid:q.uuid,questionUuid:t,sectionUuid:e,comments:(null===(c=u[e][t])||void 0===c?void 0:c.comments)||"",answerDetails:[{answerType:u[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===u[e][t].answerType?u[e][t].answer.join(","):u[e][t].answer,weightage:u[e][t].weightage}]})}let v={User:{type:I.userInfo.type,uuid:I.userInfo.uuid,gender:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(e=I.citizenData)||void 0===e?void 0:e.gender:I.userInfo.gender,emailId:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(t=I.citizenData)||void 0===t?void 0:t.email:I.userInfo.emailId,dob:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(n=I.citizenData)||void 0===n?void 0:n.dob:I.userInfo.dob},SurveyResponse:{surveyUuid:q.uuid,tenantId:null===m?window.location.href.includes("/employee")?null==I||null===(l=I.citizenData)||void 0===l||null===(a=l.city)||void 0===a?void 0:a.code:localStorage.getItem("CITIZEN.CITY"):m,city:null===m?window.location.href.includes("/employee")?null==I||null===(o=I.citizenData)||void 0===o||null===(i=o.city)||void 0===i?void 0:i.code:localStorage.getItem("CITIZEN.CITY"):m,locality:F,tenantId:null===m?window.location.href.includes("/employee")?null==I||null===(r=I.citizenData)||void 0===r||null===(s=r.city)||void 0===s?void 0:s.code:localStorage.getItem("CITIZEN.CITY"):m,status:"Draft",coordinates:_.latitude+","+_.longitude,answers:d}};try{Digit.Surveys.submitSurvey(v).then(e=>{var t;E(!1),void 0!==(null==e?void 0:e.SubmitResponse)||M({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)})})}catch(e){return E(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}},$=()=>{var e,t,n,l,a,o,i;E(!0);let r=[];for(const e in u)for(const t in u[e]){var s,c,d;r.push({uuid:u[e][t].answerUuid,surveyUuid:q.uuid,questionUuid:t,sectionUuid:e,comments:(null===(s=u[e][t])||void 0===s?void 0:s.comments)||"",tenantId:window.location.href.includes("/employee")?null==I||null===(c=I.citizenData)||void 0===c||null===(d=c.city)||void 0===d?void 0:d.code:localStorage.getItem("CITIZEN.CITY"),answerDetails:[{answerType:u[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===u[e][t].answerType?u[e][t].answer.join(","):u[e][t].answer,weightage:u[e][t].weightage}]})}let v={User:{type:I.userInfo.type,uuid:I.userInfo.uuid,gender:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(e=I.citizenData)||void 0===e?void 0:e.gender:I.userInfo.gender,emailId:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(t=I.citizenData)||void 0===t?void 0:t.email:I.userInfo.emailId,dob:"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?null==I||null===(n=I.citizenData)||void 0===n?void 0:n.dob:I.userInfo.dob},SurveyResponse:{surveyUuid:q.uuid,status:"Submit",locality:F,coordinates:_.latitude+","+_.longitude,tenantId:null===m?window.location.href.includes("/employee")?null==I||null===(l=I.citizenData)||void 0===l||null===(a=l.city)||void 0===a?void 0:a.code:localStorage.getItem("CITIZEN.CITY"):m,city:null===m?window.location.href.includes("/employee")?null==I||null===(o=I.citizenData)||void 0===o||null===(i=o.city)||void 0===i?void 0:i.code:localStorage.getItem("CITIZEN.CITY"):m,answers:r}};try{Digit.Surveys.submitSurvey(v).then(e=>{var t;E(!1),void 0===(null==e?void 0:e.SubmitResponse)?M({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)}):"EMPLOYEE"===B.toUpperCase()?U.push("/digit-ui/employee/engagement/surveys/submit-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0}):U.push("/digit-ui/citizen/engagement/surveys/submit-survey-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0})})}catch(e){return E(!1),e}},[J,ee]=n.useState({latitude:null,longitude:null});n.useEffect(()=>{if(T){const e=null!=T&&T.tenantId?null==T?void 0:T.tenantId:localStorage.getItem("CITIZEN.CITY");e&&v(e)}},[T]),console.log("city",m);const te=e=>{k(e.target.value)};function ne(){b(!1)}return n.useEffect(()=>{T&&k(null==T?void 0:T.locality)},[T]),!0===g&&S?l.createElement(pi,{onSelect:function(){b(!1)},onCancel:ne,onDismiss:ne,heading:"Survey already Submitted!",actionCancel:!1,content:V,hideSubmit:!0}):("EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()||null!=I&&I.citizenFill)&&!0===w||"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()&&!0===L&&!0===w?l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},q.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},q.surveyDescription))),"EMPLOYEE"===(null==I?void 0:I.userType).toUpperCase()?l.createElement(n.Fragment,null,l.createElement(t.CardLabel,null,""+r("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:F,onChange:e=>{te(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==h&&l.createElement(n.Fragment,null,h.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),Q&&Q.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.locality.answerRequired)):l.createElement(n.Fragment,null,l.createElement(t.CardLabel,null,""+r("CITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:m,onChange:e=>{(e=>{v(e.target.value)})(e)},disabled:"pb.punjab"!==localStorage.getItem("CITIZEN.CITY")},l.createElement("option",{value:""},"--Please choose a city--"),c.map((e,t)=>l.createElement("option",{key:t,value:e.code},null==e?void 0:e.name))),Q&&Q.city&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.city.answerRequired),l.createElement(t.CardLabel,null,""+r("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:F,onChange:e=>{te(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==m&&null!==h&&l.createElement(n.Fragment,null,h.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),Q&&Q.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q?void 0:Q.locality.answerRequired)),l.createElement("form",{onSubmit:e=>{e.preventDefault(),I.citizenFill&&"employee"===(null==I?void 0:I.userType).toLowerCase()||"citizen"===(null==I?void 0:I.userType).toLowerCase()?(()=>{const e={};return q.sections.forEach(t=>{t.questions.forEach(n=>{var l,a,o,i;const r=null===(l=u[t.uuid])||void 0===l?void 0:l[n.question.uuid||""];var s,c,m;!0===n.required&&0===(null==r||null===(a=r.answer)||void 0===a?void 0:a.length)&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(s=e[t.uuid])||void 0===s?void 0:s[n.question.uuid],{answerRequired:n.question.questionStatement+" is required*"})})),(null==r||null===(o=r.answer)||void 0===o?void 0:o.length)>500&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(c=e[t.uuid])||void 0===c?void 0:c[n.question.uuid],{answerLength:"Answer length allowed only to 500 characters*"})})),(null==r||null===(i=r.comments)||void 0===i?void 0:i.length)>500&&(e[t.uuid]=d({},e[t.uuid],{[n.question.uuid]:d({},null===(m=e[t.uuid])||void 0===m?void 0:m[n.question.uuid],{commentsLength:"Comments length allowed only to 500 characters*"})}))})}),null===F&&(e.locality={answerRequired:"Please select your locality"}),"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()&&null===m&&(e.city={answerRequired:"Please select your city"}),X(e),0===Object.keys(e).length})()&&z("submit"):M({key:!0,isError:!0,label:"PLEASE FILL CITIZEN DETAILS"})}},q.sections.length>0?q.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((a,o)=>l.createElement("div",null,l.createElement("h3",null,a.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},o+1,". ",a.question.questionStatement," ",(null==a?void 0:a.required)&&l.createElement("span",{style:{color:"red"}},"*")),((e,a,o)=>{var i,c,m,v,p,E,g,f,h,y,S,b,_,C,T,D,N,A,w,x,I,L,O,P,M,F,k,B,U,V,H,W,q,z,j,Y,X,Z,$,J,ee,te,ne,le,ae,oe,ie,re,ue,se,ce,de,me,ve,pe,Ee,ge,fe,he,ye,Se,be,_e,Ce,Te,De,Ne,Ae,we,xe,Ie,Le,Oe,Re,Pe,Me,Fe,ke,Be,Ue,Ve,He,We,qe,ze,je,Ye,Ge,Ke,Qe,Xe,Ze,$e,Je,et,tt,nt,lt,at,ot,it,rt,ut,st,ct,dt,mt,vt;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,textInputStyle:{maxWidth:"none"},value:null===(i=u[o.uuid])||void 0===i||null===(c=i[a.uuid])||void 0===c?void 0:c.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},type:"text",inputRef:R({maxLength:{value:200,message:r("EXCEEDS_200_CHAR_LIMIT")},required:a.required})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(m=Q[o.uuid])||void 0===m||null===(v=m[a.uuid])||void 0===v?void 0:v.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(p=Q[o.uuid])||void 0===p||null===(E=p[a.uuid])||void 0===E?void 0:E.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(g=Q[o.uuid])||void 0===g||null===(f=g[a.uuid])||void 0===f?void 0:f.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(h=Q[o.uuid])||void 0===h||null===(y=h[a.uuid])||void 0===y?void 0:y.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(S=u[o.uuid])||void 0===S||null===(b=S[a.uuid])||void 0===b?void 0:b.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(_=Q[o.uuid])||void 0===_||null===(C=_[a.uuid])||void 0===C?void 0:C.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(T=Q[o.uuid])||void 0===T||null===(D=T[a.uuid])||void 0===D?void 0:D.commentsLength));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},value:null===(N=u[o.uuid])||void 0===N||null===(A=N[a.uuid])||void 0===A?void 0:A.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")},required:a.required})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(w=Q[o.uuid])||void 0===w||null===(x=w[a.uuid])||void 0===x?void 0:x.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(I=Q[o.uuid])||void 0===I||null===(L=I[a.uuid])||void 0===L?void 0:L.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(O=Q[o.uuid])||void 0===O||null===(P=O[a.uuid])||void 0===P?void 0:P.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(M=Q[o.uuid])||void 0===M||null===(F=M[a.uuid])||void 0===F?void 0:F.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(k=u[o.uuid])||void 0===k||null===(B=k[a.uuid])||void 0===B?void 0:B.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(U=Q[o.uuid])||void 0===U||null===(V=U[a.uuid])||void 0===V?void 0:V.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(H=Q[o.uuid])||void 0===H||null===(W=H[a.uuid])||void 0===W?void 0:W.commentsLength));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:null===(q=u[o.uuid])||void 0===q||null===(z=q[a.uuid])||void 0===z?void 0:z.answer,onChange:e=>{var t,n;const l=a.options.find(t=>t.optionText===e.target.value);G(o.uuid,a.uuid,a.type,(null==l?void 0:l.weightage)||0,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(j=Q[o.uuid])||void 0===j||null===(Y=j[a.uuid])||void 0===Y?void 0:Y.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(X=Q[o.uuid])||void 0===X||null===(Z=X[a.uuid])||void 0===Z?void 0:Z.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===($=Q[o.uuid])||void 0===$||null===(J=$[a.uuid])||void 0===J?void 0:J.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ee=Q[o.uuid])||void 0===ee||null===(te=ee[a.uuid])||void 0===te?void 0:te.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ne=u[o.uuid])||void 0===ne||null===(le=ne[a.uuid])||void 0===le?void 0:le.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ae=Q[o.uuid])||void 0===ae||null===(oe=ae[a.uuid])||void 0===oe?void 0:oe.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ie=Q[o.uuid])||void 0===ie||null===(re=ie[a.uuid])||void 0===re?void 0:re.commentsLength));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,checked:(null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer)===e.optionText,onChange:t=>{var n,l;return G(o.uuid,a.uuid,a.type,e.weightage,t.target.value,null===(n=u[o.uuid])||void 0===n||null===(l=n[a.uuid])||void 0===l?void 0:l.answerUuid)},required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText)})),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ue=Q[o.uuid])||void 0===ue||null===(se=ue[a.uuid])||void 0===se?void 0:se.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ce=Q[o.uuid])||void 0===ce||null===(de=ce[a.uuid])||void 0===de?void 0:de.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(me=Q[o.uuid])||void 0===me||null===(ve=me[a.uuid])||void 0===ve?void 0:ve.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(pe=Q[o.uuid])||void 0===pe||null===(Ee=pe[a.uuid])||void 0===Ee?void 0:Ee.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ge=u[o.uuid])||void 0===ge||null===(fe=ge[a.uuid])||void 0===fe?void 0:fe.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(he=Q[o.uuid])||void 0===he||null===(ye=he[a.uuid])||void 0===ye?void 0:ye.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Se=Q[o.uuid])||void 0===Se||null===(be=Se[a.uuid])||void 0===be?void 0:be.commentsLength));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,checked:(null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer.includes(e.optionText))||!1,onChange:t=>{const n=t.target.value,l=t.target.checked;s(t=>{var i,r,s,c,m,v;const p=l?[...(null===(i=t[o.uuid])||void 0===i||null===(r=i[a.uuid])||void 0===r?void 0:r.answer)||"",n]:((null===(s=t[o.uuid])||void 0===s||null===(c=s[a.uuid])||void 0===c?void 0:c.answer)||"").filter(e=>e!==n);return d({},t,{[o.uuid]:d({},t[o.uuid],{[a.uuid]:{answer:p,answerUuid:null===(m=u[o.uuid])||void 0===m||null===(v=m[a.uuid])||void 0===v?void 0:v.answerUuid,answerType:a.type,weightage:e.weightage}})})})}}),e.optionText)})),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(_e=Q[o.uuid])||void 0===_e||null===(Ce=_e[a.uuid])||void 0===Ce?void 0:Ce.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Te=Q[o.uuid])||void 0===Te||null===(De=Te[a.uuid])||void 0===De?void 0:De.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ne=Q[o.uuid])||void 0===Ne||null===(Ae=Ne[a.uuid])||void 0===Ae?void 0:Ae.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(we=Q[o.uuid])||void 0===we||null===(xe=we[a.uuid])||void 0===xe?void 0:xe.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(Ie=u[o.uuid])||void 0===Ie||null===(Le=Ie[a.uuid])||void 0===Le?void 0:Le.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Oe=Q[o.uuid])||void 0===Oe||null===(Re=Oe[a.uuid])||void 0===Re?void 0:Re.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Pe=Q[o.uuid])||void 0===Pe||null===(Me=Pe[a.uuid])||void 0===Me?void 0:Me.commentsLength));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},value:null===(Fe=u[o.uuid])||void 0===Fe||null===(ke=Fe[a.uuid])||void 0===ke?void 0:ke.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Be=Q[o.uuid])||void 0===Be||null===(Ue=Be[a.uuid])||void 0===Ue?void 0:Ue.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Ve=Q[o.uuid])||void 0===Ve||null===(He=Ve[a.uuid])||void 0===He?void 0:He.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(We=Q[o.uuid])||void 0===We||null===(qe=We[a.uuid])||void 0===qe?void 0:qe.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(ze=Q[o.uuid])||void 0===ze||null===(je=ze[a.uuid])||void 0===je?void 0:je.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(Ye=u[o.uuid])||void 0===Ye||null===(Ge=Ye[a.uuid])||void 0===Ge?void 0:Ge.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(Ke=Q[o.uuid])||void 0===Ke||null===(Qe=Ke[a.uuid])||void 0===Qe?void 0:Qe.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(Xe=Q[o.uuid])||void 0===Xe||null===(Ze=Xe[a.uuid])||void 0===Ze?void 0:Ze.commentsLength));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},value:null===($e=u[o.uuid])||void 0===$e||null===(Je=$e[a.uuid])||void 0===Je?void 0:Je.answer,onChange:e=>{var t,n;return G(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=u[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(et=Q[o.uuid])||void 0===et||null===(tt=et[a.uuid])||void 0===tt?void 0:tt.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(nt=Q[o.uuid])||void 0===nt||null===(lt=nt[a.uuid])||void 0===lt?void 0:lt.answerRequired),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(at=Q[o.uuid])||void 0===at||null===(ot=at[a.uuid])||void 0===ot?void 0:ot.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(it=Q[o.uuid])||void 0===it||null===(rt=it[a.uuid])||void 0===rt?void 0:rt.answerLength),l.createElement("div",null," ","Add Suggestions/Comments"),l.createElement(t.TextArea,{name:a.uuid,value:null===(ut=u[o.uuid])||void 0===ut||null===(st=ut[a.uuid])||void 0===st?void 0:st.comments,maxLength:500,style:{maxWidth:"none",marginBottom:"0px"},onChange:e=>K(o.uuid,a.uuid,e.target.value),inputRef:R({maxLength:{value:500,message:r("EXCEEDS_500_CHAR_LIMIT")}})}),Q&&(null==Q?void 0:Q[o.uuid])&&(null==Q||null===(ct=Q[o.uuid])||void 0===ct||null===(dt=ct[a.uuid])||void 0===dt?void 0:dt.commentsLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==Q||null===(mt=Q[o.uuid])||void 0===mt||null===(vt=mt[a.uuid])||void 0===vt?void 0:vt.commentsLength));default:return l.createElement(t.TextInput,{name:a.uuid,onChange:e=>G(o.uuid,a.uuid,e.target.value),type:"text",inputRef:R({maxLength:{value:200,message:r("EXCEEDS_200_CHAR_LIMIT")},required:a.required})})}})(a.question.type,a.question,e),Q[a.uuid]&&l.createElement("span",{className:"error"},Q[a.uuid]),l.createElement("div",null)))))):null,l.createElement("button",{type:"submit",style:{marginLeft:"10px"}},"Submit"))),P&&l.createElement(t.Toast,{error:P.isError,label:r(P.label),onClose:()=>{M(null)},isDleteBtn:"false"})):"CITIZEN"===(null==I?void 0:I.userType).toUpperCase()&&!1===L?l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"Please fill in your basic details to proceed with the survey"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to fill in your details"),l.createElement("button",{onClick:()=>U.push("/digit-ui/citizen/user/profile"),style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Fill your details : Name, Gender, DOB and Email are required"),p&&l.createElement(t.Loader,null)):null},gi=e=>{var n,o;const{t:i}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},fi=e=>{const{t:n}=a.useTranslation();return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(gi,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},hi=e=>{let{path:n,userType:i}=e;const r=o.useLocation(),{t:u}=a.useTranslation(),s=Digit.ComponentRegistryService.getComponent("NotificationsAndWhatsNew"),c=Digit.ComponentRegistryService.getComponent("EventsListOnGround"),m=Digit.ComponentRegistryService.getComponent("EventDetails"),v=Digit.ComponentRegistryService.getComponent("DocumentList"),p=Digit.ComponentRegistryService.getComponent("SurveyList"),E=(Digit.ComponentRegistryService.getComponent("FillSurvey"),Digit.ComponentRegistryService.getComponent("ShowSurvey"));return l.createElement(l.Fragment,null,l.createElement("div",{className:"engagement-citizen-wrapper"},!r.pathname.includes("response")&&l.createElement(t.BackButton,null,u("CS_COMMON_BACK")),l.createElement(o.Switch,null,l.createElement(o.Route,{path:n+"/notifications",component:()=>l.createElement(s,{variant:"notifications",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/whats-new",component:()=>l.createElement(s,{variant:"whats-new",parentRoute:n})}),l.createElement(t.PrivateRoute,{exact:!0,path:n+"/events",component:()=>l.createElement(c,{variant:"events",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/events/details/:id",component:()=>l.createElement(m,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/docs",component:()=>l.createElement(ii,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/viewDocument",component:()=>l.createElement(ri,{t:u,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/list/:category/:count",component:e=>l.createElement(v,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/list",component:e=>l.createElement(p,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-response",component:e=>l.createElement(si,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/show-survey",component:e=>l.createElement(E,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/active-open-surveys",component:e=>l.createElement(ci,d({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/fill-survey",component:e=>l.createElement(Ei,d({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-survey-response",component:e=>l.createElement(fi,e)}))))},yi=[{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:""}]}]}],Si=()=>{const{t:e}=a.useTranslation(),i=o.useHistory(),[r,u]=n.useState(!1);return l.createElement("div",null,l.createElement(t.Header,null,e("ES_ENGAGEMENT_DOCUMENTS")),l.createElement(t.FormComposer,{label:e("ES_COMMON_APPLICATION_SUBMIT"),config:yi,onSubmit:e=>{var t,n,l,a,o,r,u,s;const c={name:e.documentName,description:null!=e&&e.description.length?e.description:"",category:null===(t=e.docCategory)||void 0===t?void 0:t.name,documentLink:null===(n=e.document)||void 0===n?void 0:n.documentLink,filestoreId:null===(l=e.document)||void 0===l||null===(a=l.filestoreId)||void 0===a?void 0:a.fileStoreId,fileSize:null===(o=e.document)||void 0===o||null===(r=o.filestoreId)||void 0===r?void 0:r.fileSize,fileType:null===(u=e.document)||void 0===u||null===(s=u.filestoreId)||void 0===s?void 0:s.fileType,tenantIds:e.ULB.map(e=>e.code)};i.push("/digit-ui/employee/engagement/documents/response",{DocumentEntity:c})},fieldStyle:{},onFormValueChange:(e,t,n)=>{var l;null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&null!==(l=t.ULB)&&void 0!==l&&l.length?u(!0):u(!1)},isDisabled:!r}))},bi=[{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:""}]}]}],_i=e=>{var i;const{t:r}=a.useTranslation(),u=o.useHistory(),[s,c]=n.useState(!1),m=n.useCallback((e,t,n)=>{null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&t.ULB&&Object.keys(null==t?void 0:t.ULB).length?c(!0):c(!1)},[]);return l.createElement(l.Fragment,null,l.createElement(t.Header,null,r("ES_ENGAGEMENT_EDIT_DOC")),l.createElement(t.FormComposer,{label:r("ES_COMMON_UPDATE"),config:bi,onSubmit:t=>{(t=>{var n,l,a,o,i,r,s,c,m,v,p,E,g,f,h,y,S,b,_;const C=null!==(n=t.document)&&void 0!==n&&null!==(l=n.filestoreId)&&void 0!==l&&l.fileSize?null===(a=t.document)||void 0===a||null===(o=a.filestoreId)||void 0===o?void 0:o.fileSize:null===(i=e.location.state)||void 0===i||null===(r=i.DocumentEntity)||void 0===r?void 0:r.fileSize,T=null!==(s=t.document)&&void 0!==s&&null!==(c=s.filestoreId)&&void 0!==c&&c.fileType?null===(m=t.document)||void 0===m||null===(v=m.filestoreId)||void 0===v?void 0:v.fileType:null===(p=e.location.state)||void 0===p||null===(E=p.DocumentEntity)||void 0===E?void 0:E.fileType,D=d({},null===(g=e.location)||void 0===g||null===(f=g.state)||void 0===f?void 0:f.DocumentEntity,{name:t.documentName,description:null!=t&&t.description.length?t.description:"",category:null===(h=t.docCategory)||void 0===h?void 0:h.name,filestoreId:null===(y=t.document)||void 0===y||null===(S=y.filestoreId)||void 0===S?void 0:S.fileStoreId,fileSize:C,fileType:T,documentLink:null===(b=t.document)||void 0===b?void 0:b.documentLink,tenantId:null==t||null===(_=t.ULB)||void 0===_?void 0:_.code});delete D.ULB,delete D.docCategory,delete D.documentName,u.push("/digit-ui/employee/engagement/documents/update-response",{DocumentEntity:D})})(t)},fieldStyle:{},onFormValueChange:m,defaultValues:null===(i=e.location.state)||void 0===i?void 0:i.DocumentEntity,isDisabled:!s}))},Ci=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_CREATED":"ENGAGEMENT_DOC_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,u},Ti=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocCreate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{i.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Ci,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Di=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_UPDATED":"ENGAGEMENT_DOC_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,u},Ni=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocUpdate()),{state:c}=e.location;return n.useEffect(()=>{s.mutate(c,{onSuccess:()=>{i.clear()}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Di,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Ai=e=>{var n;const{t:o}=a.useTranslation();return l.createElement(t.Banner,{message:o(e.isSuccess?"ENGAGEMENT_DOC_DELETED":"ENGAGEMENT_DOC_DELETE_FAILURE"),applicationNumber:null!==(n=e.mutation)&&void 0!==n&&n.isSuccess?e.uuid:"",info:e.isSuccess?o("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess})},wi=e=>{var i;const u=r.useQueryClient(),{t:s}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocDelete()),{state:d}=e.location;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{u.clear()}})},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Ai,{t:s,data:c.data,mutation:c,uuid:null==d||null===(i=d.DocumentEntity)||void 0===i?void 0:i.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},xi=e=>{let{t:n,data:a,columns:o,globalSearch:i,onSearch:r,getCellProps:u,pageSizeLimit:s,totalRecords:c,currentPage:d,onNextPage:m,onPrevPage:v,onPageSizeChange:p,onSort:E,sortParams:g}=e;return l.createElement(t.Table,{t:n,data:a,columns:o,onSearch:r,globalSearch:i,manualGlobalFilter:!0,manualPagination:!0,currentPage:d,onNextPage:m,onPrevPage:v,pageSizeLimit:s,onPageSizeChange:p,getCellProps:u,totalRecords:c,onSort:E,sortParams:g})},Ii=e=>{let{onSearch:a,searchParams:o,searchFields:r,type:u,onClose:s,isInboxPage:c,t:m}=e;const{handleSubmit:v,formState:p,reset:E,control:g}=i.useForm({defaultValues:o}),f=innerWidth<=640,h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),b=Digit.UserService.getUser().info,_=h.filter(e=>{var t;return null==b||null===(t=b.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),C=n.useMemo(()=>h.filter(e=>e.code===S),[S,h]),T=()=>{E({name:"",ulbs:{code:S.code},postedBy:""}),a({name:"",ulbs:{code:S.code},postedBy:""})},D=e=>l.createElement(t.LinkLabel,{style:d({display:"inline"},e?{margin:0}:{}),onClick:T},m("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:v(e=>{a(e),"mobile"===u&&s()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===u||f)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,m("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==r?void 0:r.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,m(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},defaultValue:null==C?void 0:C[0],render:e=>l.createElement(t.Dropdown,{option:_,optionKey:"i18nKey",selected:e.value,select:e.onChange,t:m}),name:e.name,control:g});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:g,defaultValue:null})}})(e)),null!=p&&null!==(a=p.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==p||null===(o=p.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===u&&!f&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:m("ES_COMMON_SEARCH"),submit:!0})),"desktop"===u&&!f&&l.createElement("div",{className:"document-clear-all"},D())))),("mobile"===u||f)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},D(f)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(p.errors).length,label:m("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Li=e=>{let{type:o="desktop",onClose:i,onFilterChange:r,searchParams:u}=e;const{t:s}=a.useTranslation(),[c,m]=n.useState(()=>d({},u)),v=Digit.ULBService.getCurrentTenantId(),p=null==v?void 0:v.split(".")[0],E=Digit.ULBService.getCurrentUlb(),{data:g,isLoading:f}=Digit.Hooks.engagement.useMDMS(p,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===E.code))[0].categoryList.map(e=>({category:e}))}}),h=()=>{m({category:null,name:null,postedBy:null}),r({category:null,name:null,postedBy:null}),null==i||i()};return f?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},s("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:h},s("ES_COMMON_CLEAR_ALL")),"desktop"===o&&l.createElement("span",{className:"clear-search",onClick:h},l.createElement(t.RefreshIcon,null)),"mobile"===o&&l.createElement("span",{onClick:i},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+s("DOCUMENTS_CATEGORY_CARD_LABEL")),l.createElement(t.Dropdown,{option:g,optionKey:"category",selected:c,select:e=>{m(d({},c,e))},t:s}),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(r(c),void(null==i||i())),label:s("ES_COMMON_APPLY")}))))},Oi=e=>l.createElement("span",{className:"cell-text styled-cell"},e),Ri=e=>{let{isLoading:n,data:a,t:i,onSearch:r,title:u,iconName:s,links:c,onSort:d,sortParams:m,globalSearch:v,searchFields:p,searchParams:E,onFilterChange:g,pageSizeLimit:f,totalRecords:h,currentPage:y,onNextPage:S,onPrevPage:b,onPageSizeChange:_}=e;const D=l.useMemo(()=>[{Header:i("CE_TABLE_DOCUMENT_NAME"),accessor:e=>function(e,t,n){return void 0===e&&(e=""),l.createElement("span",{className:"document-table-docs-columns"},l.createElement(o.Link,{className:"link",to:t},e.length?e:n("CE_DOCUMENT_TITLE")))}(null==e?void 0:e.name,(e=>({pathname:"inbox/details/"+e.name,state:{details:e}}))(e),i)},{Header:i("DOCUMENTS_CATEGORY_CARD_LABEL"),accessor:e=>Oi(null!=e&&e.category?i(""+(null==e?void 0:e.category)):"")},{Header:i("CE_TABLE_DOCUMENT_LINK"),accessor:e=>function(e,t,n,a){return void 0===e&&(e="mSeva"),l.createElement("span",{className:"document-table-docs-columns"},null!=t&&t.length?l.createElement("span",{className:"link",onClick:()=>C(t,e)}," ",a("CE_DOCUMENT_VIEW_LINK")," "):null,n.length?l.createElement("span",{className:"link",onClick:()=>T(n,e)}," ",a("CE_DOCUMENT_OPEN_LINK")," "):null)}(null==e?void 0:e.name,e.filestoreId,e.documentLink||"",i)},{Header:i("CE_TABLE_DOCUMENT_POSTED_BY"),accessor:e=>Oi(e.postedBy)}],[]);let N;return n?N=l.createElement(t.Loader,null):a&&0!==(null==a?void 0:a.length)?(null==a?void 0:a.length)>0&&(N=l.createElement(xi,{t:i,data:a,columns:D,onSort:d,sortParams:m,globalSearch:v,onSearch:E,pageSizeLimit:f,totalRecords:h,currentPage:y,onNextPage:S,onPrevPage:b,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===i("CE_TABLE_DOCUMENT_NAME")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})):N=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},i("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},i("NEW_DOCUMENT_TEXT"))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:u,icon:s,links:c}),l.createElement("div",null,l.createElement(Li,{onFilterChange:g,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(Ii,{t:i,onSearch:r,type:"desktop",searchFields:p,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},N)))},Pi=e=>{let{searchFields:a,searchParams:i,onFilterChange:r,onSearch:u,t:s,data:c,responseData:d}=e;const[m,v]=n.useState(""),[p,E]=n.useState(!1),[g,f]=n.useState(i),h=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{m&&E(!0)},[m]);const y=()=>{E(!1),f(i)};let b;return 0===(null==c?void 0:c.length)?b=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},s("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},s("NEW_DOCUMENT_TEXT"))):c&&(null==c?void 0:c.length)>0&&(b=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>S(t.postedBy,e["Posted By"])&&S(t.name,e["Document Name"]));t&&h.push("/digit-ui/employee/engagement/documents/inbox/details/"+(null==t?void 0:t.name),{details:t})}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{v("SEARCH"),E(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{v("FILTER"),E(!0)}})),b,p&&l.createElement(t.PopUp,null,"FILTER"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Li,{onFilterChange:r,onClose:y,onSearch:u,type:"mobile",searchParams:g})),"SEARCH"===m&&l.createElement("div",{className:"popup-module"},l.createElement(Ii,{t:s,type:"mobile",onClose:y,onSearch:u,searchParams:i,searchFields:a}))))},Mi=e=>{let{data:t,t:n,title:a,iconName:o,links:i,searchFields:r,searchParams:u,onFilterChange:s,onSearch:c,isLoading:d}=e;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Be,{title:a,icon:o,links:i}),l.createElement(Pi,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,o,i,r,s;return(!((null==u||null===(t=u.tenantIds)||void 0===t?void 0:t.length)>0)||(null==u||null===(n=u.tenantIds)||void 0===n?void 0:n.includes(e.tenantId)))&&(null==u||!u.name||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==u||null===(a=u.name)||void 0===a?void 0:a.toUpperCase())))&&(null==u||!u.postedBy||(null===(o=e.postedBy)||void 0===o||null===(i=o.trim())||void 0===i?void 0:i.toLowerCase())===(null==u||null===(r=u.postedBy)||void 0===r||null===(s=r.trim())||void 0===s?void 0:s.toLowerCase()))&&(null==u||!u.category||e.category===(null==u?void 0:u.category))}).map(e=>({[n("CE_TABLE_DOCUMENT_NAME")]:null==e?void 0:e.name,[n("DOCUMENTS_CATEGORY_CARD_LABEL")]:n(""+(null==e?void 0:e.category)),[n("CE_TABLE_DOCUMENT_LINK")]:l.createElement("div",{className:"mobileInbox_attachments"},null!=e&&e.filestoreId?l.createElement("div",{className:"link",onClick:t=>{C(e.filestoreId,e.name)}},n("CE_DOCUMENT_VIEW_LINK")):null,null!=e&&e.documentLink?l.createElement("div",{className:"link",onClick:t=>{T(e.documentLink,e.name)}},n("CE_DOCUMENT_OPEN_LINK")):null),[n("CE_TABLE_DOCUMENT_POSTED_BY")]:null==e?void 0:e.postedBy})),onFilterChange:s,isLoading:d,onSearch:c,searchParams:u,searchFields:r,responseData:t}))))},Fi=e=>{let{tenants:o}=e;const{t:i}=a.useTranslation();Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o);const r=Digit.ULBService.getCurrentTenantId(),[u,s]=n.useState({tenantIds:r,offset:0,limit:10});let c=window.Digit.Utils.browser.isMobile();const{data:m,isLoading:v}=Digit.Hooks.engagement.useDocSearch(u,{select:e=>{let{Documents:t,totalCount:n}=e;return{documentsList:t,totalCount:n}}}),p=e=>{var t,n,l;const a=null!=e&&null!==(t=e.ulbs)&&void 0!==t&&null!==(n=t.code)&&void 0!==n&&n.length?null==e||null===(l=e.ulbs)||void 0===l?void 0:l.code:r,{name:o,postedBy:i}=e;s(e=>d({},e,{name:o,postedBy:i,tenantIds:a}))},E=e=>{s(t=>d({},t,e))},g=n.useCallback(()=>{s(e=>d({},e,{offset:parseInt(null==e?void 0:e.offset)+parseInt(null==e?void 0:e.limit)}))},[]);n.useEffect(()=>{s(e=>d({},e,{tenantIds:r}))},[r]);const f=()=>[{label:i("LABEL_FOR_ULB"),name:"ulbs",type:"ulb"},{label:i("DOCUMENTS_DOCUMENT_HEADER"),name:"name"},{label:i("CE_TABLE_DOCUMENT_POSTED_BY"),name:"postedBy"}],h=[{text:i("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/inbox/new-doc"}];return c?l.createElement(Mi,{data:null==m?void 0:m.documentsList,searchParams:u,searchFields:f(),t:i,onFilterChange:E,onSearch:p,isLoading:v,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:h}):l.createElement("div",null,l.createElement(t.Header,null,i("DOCUMENTS_DOCUMENT_HEADER"),Number(null==m?void 0:m.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==m?void 0:m.totalCount)):null),l.createElement(Ri,{t:i,isLoading:v,data:null==m?void 0:m.documentsList,links:h,searchParams:u,onSearch:p,searchFields:f(),onFilterChange:E,pageSizeLimit:null==u?void 0:u.limit,totalRecords:null==m?void 0:m.totalCount,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:h,currentPage:parseInt(u.offset/u.limit),onNextPage:g,onPrevPage:()=>{s(e=>d({},e,{offset:parseInt(null==e?void 0:e.offset)-parseInt(null==e?void 0:e.limit)}))},onPageSizeChange:e=>{s(t=>d({},t,{limit:e.target.value}))}}))},ki=e=>{let{header:n,about:o,activeTime:i,postedAt:r,responseStatus:u,onCardClick:s}=e;const{t:c}=a.useTranslation();return l.createElement("div",{className:"WhatsNewCard",onClick:s},l.createElement("h2",null,n),l.createElement("p",null,o),l.createElement("div",{className:"surveyListclockDiv"},l.createElement(t.Clock,null)," ",l.createElement("span",null,"Active till "+we(new Date(i),"do MMM HH:mm"))),l.createElement("div",{className:"surveyListstatus"},l.createElement("p",null,function(e,t){return E(1,arguments),Le(e,Date.now(),t)}(new Date(r),{addSuffix:!0})),l.createElement("span",{className:"CS_SURVEY_RESPONDED"===u?"surveyLisResponded":"surveyLisNotResponded"},c(u))))},Bi=(e,t)=>{const n=(new Date).getTime();return e<n&&n<=t},Ui=["EDIT_DOCUMENT","DELETE"],Vi=e=>{var o;let{location:i,history:r}=e,u=window.Digit.Utils.browser.isMobile();const{t:s}=a.useTranslation(),{details:c}=null==i?void 0:i.state,[m,v]=l.useState(!1),[p,E]=n.useState(!1),g=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentUlb()),f=Digit.ULBService.getStateId(),{data:h}=Digit.Hooks.engagement.useMDMS(f,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===g.code))[0].categoryList.map(e=>({name:e}))}});return l.createElement("div",null,p?l.createElement(qo,{t:s,heading:"CONFIRM_DELETE_DOC",docName:null==c?void 0:c.name,closeModal:()=>E(!p),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){E(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:function(){E(!1);const e=d({},c);r.push({pathname:"/digit-ui/employee/engagement/documents/delete-response",state:{DocumentEntity:e}})}}):null,l.createElement(t.Header,null,s("CE_DOCUMENT_DETAILS")),l.createElement("div",{className:"notice_and_circular_main gap-ten"},l.createElement("div",{className:"documentDetails_wrapper"},l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("ULB")+":")," ",l.createElement("p",null,(e=>{var t,n;let l=null==e?void 0:e.split(".")[1];return l=""+(null===(t=l[0])||void 0===t?void 0:t.toUpperCase())+(null===(n=l)||void 0===n?void 0:n.slice(1))+" ",l})(null==c?void 0:c.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_NAME")+":")," ",l.createElement("p",null,null==c?void 0:c.name)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DOCUMENT_CATEGORY")+":")," ",l.createElement("p",null,s(null==c?void 0:c.category))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},s("DCOUMENT_DESCRIPTION")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=c&&null!==(o=c.description)&&void 0!==o&&o.length?null==c?void 0:c.description:"NA")," "),null!=c&&c.filestoreId?l.createElement("div",{className:"documentDetails_pdf"},l.createElement("span",{className:"documentDetails_subheader"},""+s("Document")),l.createElement("div",{style:{width:"100px"},onClick:()=>C(null==c?void 0:c.filestoreId,null==c?void 0:c.name)},l.createElement(t.GenericFileIcon,null))):null)),l.createElement(t.ActionBar,null,m?l.createElement(t.Menu,{style:{width:u?"full":"240px"},localeKeyPrefix:"ES_CE",options:Ui,t:s,onSelect:function(e){if(v(!1),null!=e&&e.includes("EDIT")){var t;const e=d({tenantIds:null==c?void 0:c.tenantId,documentName:null==c?void 0:c.name,docCategory:null==h||null===(t=h.filter(e=>e.name===(null==c?void 0:c.category)))||void 0===t?void 0:t[0],document:{filestoreId:{fileStoreId:null==c?void 0:c.filestoreId},documentLink:null==c?void 0:c.documentLink},ULB:{code:null==c?void 0:c.tenantId}},c);r.push({pathname:"/digit-ui/employee/engagement/documents/inbox/update",state:{DocumentEntity:e}})}null!=e&&e.includes("DELETE")&&E(!0)}}):null,l.createElement(t.SubmitBar,{label:s("ES_COMMON_TAKE_ACTION"),onSubmit:()=>v(!m)})))},Hi=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},Wi=e=>{var o,r,u,s,c;let{registerRef:d,controlSearchForm:m,searchFormState:v}=e;const{t:p}=a.useTranslation(),E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),g=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentTenantId()),f=Digit.UserService.getUser().info;let h=!0,S=E.filter(e=>{var t,n;return null==f||null===(t=f.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);if(0===(null===(o=S)||void 0===o?void 0:o.length)||"pb.punjab"===g){h=!1;let e={i18nKey:"TENANT_TENANTS_"+(null==f?void 0:f.tenantId.replace(".","_").toUpperCase()),code:""+(null==f?void 0:f.tenantId)};S="pb.punjab"===g?[e,...E]:[e]}const b=n.useMemo(()=>{var e;return(null===(e=S)||void 0===e?void 0:e.length)>0&&!0===h?E.filter(e=>e.code===g):S.filter(e=>e.code===g)},[E]);return l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,p("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:p("REQUIRED_FIELD")},defaultValue:null==b?void 0:b[0],render:e=>l.createElement(t.Dropdown,{option:S,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:p}),name:"tenantIds",control:m}),l.createElement(t.CardLabelError,null,null==v||null===(r=v.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,p("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",inputRef:d({maxLength:{value:60,message:p("Survey Name should be less than 60 characters")}})}),l.createElement(t.CardLabelError,null,null==v||null===(s=v.errors)||void 0===s||null===(c=s.title)||void 0===c?void 0:c.message)))},qi=e=>{let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),g=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],f={tenantIds:E[0],title:""},h={status:g[0]},y={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEY.INBOX"),b=n.useMemo(()=>S||{filterForm:h,searchForm:f,tableForm:y},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[_,C]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},b);let{data:{Surveys:T=[],TotalCount:D}={},isLoading:N}=Digit.Hooks.survey.useSurveyInbox(_);const[A,w]=n.useState([]);n.useEffect(()=>{if(T.length>0){const e=[...T].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);T=e,w(e)}},[T]);const x={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},I=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(Wi,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(Hi,{statuses:g,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:o})},[g]),O={SearchFormFields:I,onSearchFormSubmit:e=>{C({action:"mutateTableForm",data:d({},_.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:f,onSearchFormReset:e=>{e("title",""),e("tenantIds",m),C({action:"mutateSearchForm",data:f})}},R={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:h,onFilterFormReset:e=>{e("status",g[0]),C({action:"mutateFilterForm",data:h})}},P=(e=>{var i,r,u,s;let{onPageSizeChange:c,formState:m,totalCount:v,table:p,dispatch:E,inboxStyles:g={},setShowToast:f}=e;const h=o.useHistory(),y=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:S}=a.useTranslation(),b=(Digit.UserService.getUser(),n.useMemo(()=>[{Header:S("Survey Name"),accessor:"suveyName",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link",onClick:()=>{h.push({pathname:"/digit-ui/employee/engagement/surveys/previewQuestions",state:{data:t.original}})}},t.original.surveyTitle))}},{Header:S("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.startDate?y(we(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:S("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let{row:l}=e;return null!==(t=l.original)&&void 0!==t&&t.endDate?y(we(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:l.createElement("div",null,S("EVENTS_STATUS_LABEL")),accessor:"status",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null===(t=n.original)||void 0===t?void 0:t.active)}},{Header:S("EVENTS_POSTEDBY_LABEL"),accessor:"postedBy",Cell:e=>{var t;let{row:n}=e;return y(null===(t=n.original)||void 0===t?void 0:t.postedBy)}},{Header:S("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:S("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:S("Update Survey Status"),accessor:"updateSurvey",Cell:e=>{let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;console.log("Current row: ",e);const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.active?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.active?"Inactive":"Active";f({label:'Are you sure you want to change the survey status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.surveyTitle)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},S("Click here to update the survey status"))))}}]));return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"endDate",onPageSizeChange:c,currentPage:parseInt((null===(i=m.tableForm)||void 0===i?void 0:i.offset)/(null===(r=m.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=m.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=m.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(u=m.tableForm)||void 0===u?void 0:u.limit,totalRecords:v,onSearch:null==m||null===(s=m.searchForm)||void 0===s?void 0:s.message,onLastPage:()=>{var e;return E({action:"mutateTableForm",data:d({},m.tableForm,{offset:10*Math.ceil(v/10)-parseInt(null===(e=m.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>E({action:"mutateTableForm",data:d({},m.tableForm,{offset:0})}),data:p,columns:b,noResultsMessage:"CS_NO_SURVEYS_FOUND",inboxStyles:d({},g)}})(d({},{parentRoute:r,onPageSizeChange:e=>{C({action:"mutateTableForm",data:d({},_.tableForm,{limit:e.target.value})})},formState:_,totalCount:D,table:A,noResultsMessage:"CS_SURVEYS_NOT_FOUND",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:n}]=e,l=n?"DESC":"ASC";_.tableForm.sortBy===t&&_.tableForm.sortOrder===l||C({action:"mutateTableForm",data:d({},_.tableForm,{sortBy:t,sortOrder:n?"DESC":"ASC"})})}}})),M=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const{surveyTitle:n,startDate:a,endDate:i,active:s,postedBy:c,auditDetails:d}=e;return{[r("Survey Name")]:n,[r("EVENTS_START_DATE_LABEL")]:a?we(new Date(a),"dd/MM/yyyy"):"",[r("EVENTS_END_DATE_LABEL")]:i?we(new Date(i),"dd/MM/yyyy"):"",[r("EVENTS_STATUS_LABEL")]:u(s),[r("EVENTS_POSTEDBY_LABEL")]:c,[r("Created On")]:null!=d&&d.createdTime?we(new Date(null==d?void 0:d.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=d&&d.lastModifiedTime?we(new Date(null==d?void 0:d.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Survey Status")]:l.createElement("label",{onClick:()=>{return t=e,console.log("Current row: ",t),void o({label:'Are you sure you want to change the survey status of "'+(null==t?void 0:t.surveyTitle)+'" from '+(null!=t&&t.active?"Active":"Inactive")+" to "+(null!=t&&t.active?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t});var t}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:A,setShowToast:c});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Inbox"),D?l.createElement("p",{className:"inbox-count"},D):null),l.createElement(t.InboxComposer,d({isInboxLoading:N,PropsForInboxLinks:x},O,R,{propsForInboxMobileCards:M,propsForInboxTable:P,formState:_})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData;Digit.Surveys.updateSurvey({uuid:null==e?void 0:e.uuid,active:!(null!=e&&e.active)}).then(e=>{c({label:null==e?void 0:e.message,isDleteBtn:"true"})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,isWarningButtons:s.isWarningButtons,style:{padding:"16px"}}))},zi=()=>{const{t:e}=a.useTranslation(),r=o.useHistory(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[d,m]=n.useState(null),p=i.useForm({defaultValues:{categoryName:""}}),{register:E,handleSubmit:g,reset:f,formState:{errors:h}}=p,[y,S]=n.useState(!1);function b(){S(!1)}return l.createElement("div",{className:"card"},l.createElement(t.Header,null,e("Create Category")),l.createElement(i.FormProvider,p,l.createElement("form",{onSubmit:g(function(e){try{s(!0);const t={Categories:[{tenantId:c,label:e.categoryName.trim()}]},n=v(function(){return Promise.resolve(Digit.Surveys.createCategory(t)).then(function(e){var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?(s(!1),m({isError:!1,label:"Category created successfully"}),f(),setTimeout(()=>{r.push("/digit-ui/employee/engagement/surveys/search-categories")},2e3)):(s(!1),m({isError:!0,label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong"}))})},function(e){var t,n,l,a;console.log("Error in Digit.Surveys.createCategory:",null==e?void 0:e.response),s(!1),m({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,e("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",null,l.createElement(t.TextInput,{errorStyle:!!h.categoryName,name:"categoryName",type:"text",placeholder:"Enter Category",inputRef:E({required:e("REQUIRED_FIELD"),maxLength:{value:500,message:e("Category length should be less than or equal to 500 characters")}})}),h.categoryName&&l.createElement("p",{style:{color:"red"}},h.categoryName.message)),l.createElement("label",{onClick:function(){S(!0)},style:{width:"24px",display:"flex",justifyContent:"center",alignItems:"center",outline:"none",cursor:"pointer"}},l.createElement(t.InfoIcon,null)))),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:e("Create Category"),submit:"submit"})))),y&&l.createElement(pi,{onSelect:function(){S(!1)},onCancel:b,onDismiss:b,heading:"About category creation",content:l.createElement("p",{style:{fontWeight:"bold"}},e("Organize your survey by category to steamline feedback on municipal services.")),hideSubmit:!0}),d&&l.createElement(t.Toast,{error:d.isError,label:e(d.label),onClose:function(){m(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},ji=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},Yi=e=>{var o,r,u;let{controlSearchForm:s,searchFormState:c}=e;const{t:d}=a.useTranslation(),m=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.ULBService.getCurrentTenantId(),p=Digit.SessionStorage.get("citizen.userRequestObject");let E=!0,g=m.filter(e=>{var t,n;return null==p||null===(t=p.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);var f;0===(null===(o=g)||void 0===o?void 0:o.length)&&(E=!1,g=[{i18nKey:"TENANT_TENANTS_"+(null==p||null===(f=p.info)||void 0===f?void 0:f.tenantId.replace(".","_").toUpperCase()),code:""+(null==p?void 0:p.info.tenantId)}]);const h=n.useMemo(()=>{var e;return(null===(e=g)||void 0===e?void 0:e.length)>0&&!0===E?m.filter(e=>e.code===v):g.filter(e=>e.code===v)},[m]),[S,b]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:v}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:d(e.label),i18Key:e.label,value:e.id}}):[];b(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[v]),console.log("controlSearchForm: ",s),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,d("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:d("REQUIRED_FIELD")},defaultValue:null==h?void 0:h[0],render:e=>l.createElement(t.Dropdown,{option:g,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:d}),name:"tenantIds",control:s}),l.createElement(t.CardLabelError,null,null==c||null===(r=c.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,d("Category")),l.createElement(i.Controller,{rules:{required:!1},render:e=>l.createElement(t.Dropdown,{option:S,optionKey:"i18Key",selected:e.value,select:t=>e.onChange(t),t:d}),name:"categoryName",control:s})))},Gi=e=>{var o;let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),g=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],f={tenantIds:E[0],categoryName:""},h={status:g[0]},y={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},S=Digit.SessionStorage.get("CITIZENSURVEYCATEGORY.INBOX"),b=n.useMemo(()=>S||{filterForm:h,searchForm:f,tableForm:y},[Object.values((null==S?void 0:S.filterForm)||{}),Object.values((null==S?void 0:S.searchForm)||{}),Object.values((null==S?void 0:S.tableForm)||{})]),[_,C]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},b);let{data:{Categories:T=[]}={},isLoading:D}=Digit.Hooks.survey.useSurveyCategoryInbox(_);const N=null===(o=T)||void 0===o?void 0:o.length,[A,w]=n.useState([]);n.useEffect(()=>{if(T.length>0){const e=[...T].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);T=e,w(e)}},[T]);const x={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},I=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(Yi,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),L=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(ji,{statuses:g,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:o})},[g]),O={SearchFormFields:I,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit: ",e),C({action:"mutateTableForm",data:d({},_.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:f,onSearchFormReset:e=>{e("tenantIds",m),e("categoryName",""),C({action:"mutateSearchForm",data:f})}},R={FilterFormFields:L,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),C({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:h,onFilterFormReset:e=>{e("status",g[0]),C({action:"mutateFilterForm",data:h})}},P=(e=>{var o,i,r,u;let{onPageSizeChange:s,formState:c,totalCount:m,table:v,dispatch:p,inboxStyles:E={},setShowToast:g}=e;const f=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:h}=a.useTranslation(),y=n.useMemo(()=>[{Header:h("Category"),accessor:"category",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=n.original)||void 0===t?void 0:t.label))}},{Header:h("Status"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null===(t=n.original)||void 0===t?void 0:t.isActive)}},{Header:h("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?f(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:h("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?f(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:h("Update Category Status"),accessor:"updateCategory",Cell:e=>{let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;console.log("Current row: ",e);const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.isActive?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.isActive?"Inactive":"Active";g({label:'Are you sure you want to change the category status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.label)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},h("Click here to update the category status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(m),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:v,columns:y,noResultsMessage:"No Category found",inboxStyles:d({},E)}})(d({},{parentRoute:r,onPageSizeChange:e=>{C({action:"mutateTableForm",data:d({},_.tableForm,{limit:e.target.value})})},formState:_,totalCount:N,table:A,noResultsMessage:"No Categories found",dispatch:C,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c})),M=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const{label:n,isActive:a,auditDetails:i}=e;return{[r("Category")]:n,[r("Status")]:u(a),[r("Created On")]:null!=i&&i.createdTime?we(new Date(null==i?void 0:i.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=i&&i.lastModifiedTime?we(new Date(null==i?void 0:i.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Category Status")]:l.createElement("label",{onClick:()=>{var t;o({label:'Are you sure you want to change the category status of "'+(null==(t=e)?void 0:t.label)+'" from '+(null!=t&&t.isActive?"Active":"Inactive")+" to "+(null!=t&&t.isActive?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t})}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:A,setShowToast:c});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Search Categories"),N?l.createElement("p",{className:"inbox-count"},N):null),l.createElement(t.InboxComposer,d({isInboxLoading:D,PropsForInboxLinks:x},O,R,{propsForInboxMobileCards:M,propsForInboxTable:P,formState:_})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData,t={Categories:[d({id:null==e?void 0:e.id},"boolean"==typeof(null==e?void 0:e.isActive)&&{isActive:!(null!=e&&e.isActive)})]};Digit.Surveys.updateCategory(t).then(e=>{var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?c({label:"Category status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,style:{padding:"16px"},isWarningButtons:s.isWarningButtons}))},Ki=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,isPartiallyEnabled:r,createNewSurvey:u,formDisabled:s,maxLength:c,titleHover:d,weightHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isInputDisabled:f}=e;return l.createElement("div",{className:"options_checkboxes"},n.map(e=>l.createElement("div",{key:e.id},l.createElement(Qi,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,maxLength:c,titleHover:d,weightageHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isPartiallyEnabled:r,isInputDisabled:f,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!u&&s||(r?!r:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},Qi=e=>{let{index:a,title:o,weightage:i,updateOption:r,removeOption:u,maxLength:s,titleHover:c,weightHover:m,minWeight:v,maxWeight:p,inputRef:E,labelstyle:g,isPartiallyEnabled:f,isInputDisabled:h,formDisabled:y,optionsLength:S}=e;const[b,_]=n.useState(o),[C,T]=n.useState(i),[D,N]=n.useState(!1),[A,w]=n.useState("");return n.useEffect(()=>{r({value:b,id:a,weightage:C})},[b,C]),l.createElement("div",{className:"optioncheckboxwrapper",style:{alignItems:"flex-start"}},l.createElement(t.CheckBox,{disable:h}),l.createElement("input",{ref:E,type:"text",value:b,onChange:e=>_(e.target.value),onBlur:()=>N(!1),onFocus:()=>N(!0),className:D?"simple_editable-input":"simple_readonly-input",maxLength:s,title:c,style:d({},g),disabled:f?!f:y}),S>1&&l.createElement("div",{className:"pointer",onClick:()=>u(a)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:C,required:!0,placeholder:"Option Weightage",min:v,max:p,title:m,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(w(""),T(e.target.value)):w("Please enter a number between 0 and 10.")}}),A&&l.createElement("span",{style:{color:"red"}},A)))},Xi=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,createNewSurvey:r,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isInputDisabled:g}=e;return l.createElement("div",{className:"options_checkboxes"},n.map(e=>l.createElement("div",{key:e.id},l.createElement(Zi,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,inputRef:c,maxLength:d,titleHover:m,weightageHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!r&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},Zi=e=>{let{index:a,title:o,weightage:i,updateOption:r,removeOption:u,inputRef:s,maxLength:c,titleHover:d,weightHover:m,minWeight:v,maxWeight:p,isPartiallyEnabled:E,isInputDisabled:g,formDisabled:f,optionsLength:h}=e;const[y,S]=n.useState(o),[b,_]=n.useState(i),[C,T]=n.useState(!1),[D,N]=n.useState("");return n.useEffect(()=>{r({value:y,id:a,weightage:b})},[y,b]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"flex-start"}},l.createElement("input",{type:"radio",className:"customradiobutton",disabled:g}),l.createElement("input",{type:"text",ref:s,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:C?"simple_editable-input":"simple_readonly-input",maxLength:c,title:d,disabled:E?!E:f}),h>1&&l.createElement("div",{className:"pointer",onClick:()=>u(a)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:b,required:!0,placeholder:"Option Weightage",min:v,max:p,title:m,className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(N(""),_(e.target.value)):N("Please enter a number between 0 and 10.")},onWheel:e=>e.target.blur()}),D&&l.createElement("span",{style:{color:"red"}},D)))},$i=e=>{let{t:t,options:n=[],updateOption:a,addOption:o,removeOption:i,createNewSurvey:r,isPartiallyEnabled:u,formDisabled:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isInputDisabled:g}=e;return l.createElement("div",{className:"options_checkboxes"},n.map((e,t)=>l.createElement("div",{key:e.id},l.createElement(Ji,{indexNumber:t,index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:a,removeOption:i,inputRef:c,maxLength:d,titleHover:m,weightageHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:s,optionsLength:n.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!r&&s||(u?!u:s),onClick:()=>o()},t("CS_COMMON_ADD_OPTION"))))},Ji=e=>{let{indexNumber:a,index:o,title:i,weightage:r,updateOption:u,removeOption:s,inputRef:c,maxLength:d,titleHover:m,weightHover:v,minWeight:p,maxWeight:E,isPartiallyEnabled:g,formDisabled:f,optionsLength:h}=e;const[y,S]=n.useState(i),[b,_]=n.useState(r),[C,T]=n.useState(!1),[D,N]=n.useState("");return n.useEffect(()=>{u({value:y,id:o,weightage:b})},[y,b]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"flex-start"}},l.createElement("span",null,a+1,"."),l.createElement("input",{type:"text",ref:c,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:C?"simple_editable-input":"simple_readonly-input",maxLength:d,title:m,disabled:g?!g:f}),h>1&&l.createElement("div",{className:"pointer",onClick:()=>s(o)},l.createElement(t.CloseSvg,null)),l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:b,required:!0,placeholder:"Option Weightage",min:p,max:E,title:v,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(N(""),_(e.target.value)):N("Please enter a number between 0 and 10.")}}),D&&l.createElement("span",{style:{color:"red"}},D)))},er=e=>{var a,o,r,u,s,c;let{t:m,index:v,category:p,questionStatement:E,type:g,options:f,required:h,uuid:y,qorder:S,disableInputs:b,dispatch:_,isPartiallyEnabled:C,addOption:T,formDisabled:D,controlSurveyForm:N,mainFormState:A,noOfQuestions:w,defaultQuestionValues:x}=e;const I=Digit.ULBService.getCurrentTenantId(),{data:L={}}=Digit.Hooks.engagement.useMDMS(I,"common-masters","questionType")||{};var O=L&&L["common-masters"]&&L["common-masters"].questionType?L["common-masters"].questionType.filter(function(e){return e.active}).map(function(e){return{title:m(e.title),i18Key:e.code,value:e.code}}):[];const[R,P]=n.useState([]);n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:I}).then(e=>{var t,n;const l=null==e||null===(t=e.Categories)||void 0===t||null===(n=t.filter(e=>e.isActive))||void 0===n?void 0:n.map(e=>({title:m(e.label),i18Key:e.label,value:e.id}));P(l)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[I]);const M=window.location.href.includes("/employee/engagement/surveys/create-questions"),[F,k]=n.useState({category:p||x.category,questionStatement:E||x.questionStatement,type:g||x.type,options:(null==f?void 0:f.length)>0?f:x.options,required:h||x.required,uuid:y||x.uuid,qorder:S||x.qorder}),{errors:B}=A,U=()=>{const e=[...F.options,{id:Date.now(),title:m("CMN_OPTION")+" "+(F.options.length+1),optionWeightage:0}];return k(t=>d({},t,{options:e})),e},V=e=>{let{value:t,id:n,weightage:l}=e;const a=F.options.map(e=>e.id===n?d({},e,{title:t,optionWeightage:l}):e);return k(e=>d({},e,{options:a})),a},H=e=>{if(1===F.options.length||(C?!C:D))return F.options;const t=F.options.filter(t=>t.id!==e);return k(e=>d({},e,{options:t})),t};return n.useEffect(()=>{_({type:"updateForm",payload:{index:v,formConfig:F}})},[F]),console.log("surveyQuestionConfig",F.options[0].optionWeightage),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},m("CS_COMMON_QUESTION")+" "+(v+1)+" "),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD")},defaultValue:x.category,name:"questions["+v+"].category",control:N,render:e=>l.createElement(t.Dropdown,{t:m,option:R,placeholder:"Select Category *",optionKey:"i18Key",selected:F.category,select:t=>{var n;e.onChange(t),n=t,k(e=>d({},e,{category:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:b})}),(null===(a=B.questions)||void 0===a||null===(o=a[v])||void 0===o?void 0:o.category)&&l.createElement(t.CardLabelError,null,B.questions[v].category.message),l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD"),maxLength:{value:500,message:"Question length should be less than or equal to 500 characters"},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:"Input should not start with a number"}},defaultValue:x.questionStatement,name:"questions["+v+"].questionStatement",control:N,render:e=>l.createElement(t.TextInput,{placeholder:m("CS_COMMON_TYPE_QUESTION")+" *",value:F.questionStatement,onChange:t=>{var n;n=t,k(e=>d({},e,{questionStatement:n.target.value})),e.onChange(t)},textInputStyle:{width:"100%"},disable:b})}),(null===(r=B.questions)||void 0===r||null===(u=r[v])||void 0===u?void 0:u.questionStatement)&&l.createElement(t.CardLabelError,null,B.questions[v].questionStatement.message),l.createElement(i.Controller,{rules:{required:m("REQUIRED_FIELD")},defaultValue:x.type,name:"questions["+v+"].type",control:N,render:e=>l.createElement(t.Dropdown,{t:m,option:O,placeholder:"Select Question Type *",optionKey:"i18Key",selected:F.type,select:t=>{var n;e.onChange(t),n=t,k(e=>d({},e,{type:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:b})}),(null===(s=B.questions)||void 0===s||null===(c=s[v])||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,B.questions[v].type.message),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,a,o,r,u,s;switch(null==e?void 0:e.value){case"MULTIPLE_ANSWER_TYPE":return l.createElement("div",null,(null===(n=B.questions)||void 0===n||null===(a=n[v])||void 0===a?void 0:a.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(Xi,{updateOption:t=>{const n=V(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=H(t);e.onChange(n)},options:null==F?void 0:F.options,createNewSurvey:T,isInputDisabled:M,isPartiallyEnabled:C,formDisabled:D,maxLength:500,minWeight:0,maxWeight:10,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),t:m})}));case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,(null===(o=B.questions)||void 0===o||null===(r=o[v])||void 0===r?void 0:r.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(Ki,{updateOption:t=>{const n=V(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=H(t);e.onChange(n)},options:null==F?void 0:F.options,isInputDisabled:M,isPartiallyEnabled:C,createNewSurvey:T,formDisabled:D,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:m})}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement("div",null,(null===(u=B.questions)||void 0===u||null===(s=u[v])||void 0===s?void 0:s.options)&&l.createElement(t.CardLabelError,null,B.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement($i,{updateOption:t=>{const n=V(t);e.onChange(n)},addOption:()=>{const t=U();e.onChange(t)},removeOption:t=>{const n=H(t);e.onChange(n)},options:null==F?void 0:F.options,isInputDisabled:M,isPartiallyEnabled:C,createNewSurvey:T,formDisabled:D,titleHover:m("The maximum length is 500 characters"),weightHover:m("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:m})}));default:return null}})(null==F?void 0:F.type)),l.createElement("div",{className:"newSurveyForm_actions"},w>1&&l.createElement("div",{className:"newSurveyForm_seprator"}),w>1&&l.createElement("div",{className:"pointer "+(b?"disabled-btn":""),onClick:()=>_({type:"removeForm",payload:{uuid:y}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},m("CS_INFO_DELETE"))))))))},tr=e=>{let{t:t,formsConfig:a,setSurveyConfig:o,disableInputs:i,isPartiallyEnabled:r,addOption:u,formDisabled:s,controlSurveyForm:c,formState:m,defaultQuestionValuesFromFile1:v}=e;const p=v(),E=[p],[g,f]=n.useReducer((e,t)=>{let{type:n,payload:l}=t;switch(n){case"addNewForm":const t=[...e,p];return l.setSurveyConfig("questions",t),t;case"updateForm":const n=[...e];return n.splice(l.index,1,l),l.setSurveyConfig("questions",n),n;case"removeForm":if(1===e.length)return e;const a=e.filter(e=>e.formConfig.uuid!==l.uuid);return l.setSurveyConfig("questions",a),a}},a||E),h=e=>{let{type:t,payload:n}=e;f({type:t,payload:d({},n,{setSurveyConfig:o})})};return l.createElement("div",{className:"surveyformslist_wrapper"},g.length?g.map((e,n)=>l.createElement("div",{key:e.formConfig?e.formConfig.uuid:e.uuid},l.createElement(er,d({},e.formConfig?null==e?void 0:e.formConfig:e,{addOption:u,t:t,index:n,disableInputs:i,dispatch:h,isPartiallyEnabled:r,formDisabled:s,controlSurveyForm:c,mainFormState:m,noOfQuestions:null==g?void 0:g.length,defaultQuestionValues:p})))):null,l.createElement("div",{className:"pointer"},g.length<100&&l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},onClick:()=>h({type:"addNewForm"}),disabled:g.length>=100},t("CS_COMMON_ADD_QUESTION"))))},nr=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors","watch"],lr=()=>{const e=o.useHistory(),{t:r}=a.useTranslation(),[u,s]=n.useState(!1),c=Digit.ULBService.getCurrentTenantId(),[p,E]=n.useState(null),g=()=>({category:null,questionStatement:"",type:{title:r("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},options:[{id:Date.now(),title:r("CMN_OPTION")+" 1",optionWeightage:0}],required:!1,uuid:Date.now()+Math.random().toString(36).substring(2,11),qorder:null}),f=i.useForm({defaultValues:{questions:[g()]}}),{register:h,control:y,handleSubmit:S,setValue:b,getValues:_,reset:C,formState:T,clearErrors:D}=f,N=m(f,nr);function A(e){console.log("data",e);const t=e.questions.map(e=>{let t={};return t="MULTIPLE_ANSWER_TYPE"===e.type.value||"CHECKBOX_ANSWER_TYPE"===e.type.value||"DROP_DOWN_MENU_ANSWER_TYPE"===e.type.value?{tenantId:c,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value,options:e.options.map(e=>({optionText:e.title.trim(),weightage:parseInt(e.optionWeightage)}))}:{tenantId:c,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value},t});return console.log("qus payload",t),t}return l.createElement("div",{className:"card"},l.createElement(t.Header,null,r("Create Questions")),l.createElement(i.FormProvider,d({register:h,handleSubmit:S,setValue:b,getValues:_,reset:C,formState:T,clearErrors:D},N),l.createElement("form",{onSubmit:S(function(t){try{s(!0);const n={Questions:A(t)},l=v(function(){return Promise.resolve(Digit.Surveys.createQuestions(n)).then(function(t){var n;(null==t||null===(n=t.Questions)||void 0===n?void 0:n.length)>0?(s(!1),E({isError:!1,label:"Questions created successfully"}),setTimeout(()=>{e.push("/digit-ui/employee/engagement/surveys/search-questions")},2e3)):(s(!1),E({isError:!0,label:"Something went wrong"}))})},function(e){console.log("Error in Digit.Surveys.createQuestions:",null==e?void 0:e.response),s(!1),E({isError:!0,label:"Something went wrong"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement(t.Card,null,l.createElement(tr,{t:r,setSurveyConfig:b,addOption:!0,controlSurveyForm:y,formState:T,defaultQuestionValuesFromFile1:g})),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:r("Create Questions"),submit:"submit"})))),p&&l.createElement(t.Toast,{error:p.isError,label:r(p.label),onClose:()=>{E(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},ar=e=>{let{statuses:o,controlFilterForm:r}=e;const{t:u}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let{ref:a,onChange:i,value:r}=e;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},u("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:u,select:i,selected:r}))}})))},or=e=>{var o,r,u,s,c,d,m;let{controlSearchForm:v,searchFormState:p}=e;const{t:E}=a.useTranslation(),g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),f=Digit.ULBService.getCurrentTenantId(),h=Digit.SessionStorage.get("citizen.userRequestObject");let S=!0,b=g.filter(e=>{var t,n;return null==h||null===(t=h.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);var _;0===(null===(o=b)||void 0===o?void 0:o.length)&&(S=!1,b=[{i18nKey:"TENANT_TENANTS_"+(null==h||null===(_=h.info)||void 0===_?void 0:_.tenantId.replace(".","_").toUpperCase()),code:""+(null==h?void 0:h.info.tenantId)}]);const C=n.useMemo(()=>{var e;return(null===(e=b)||void 0===e?void 0:e.length)>0&&!0===S?g.filter(e=>e.code===f):b.filter(e=>e.code===f)},[g]),[T,D]=n.useState([]);return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:f}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:E(e.label),i18Key:e.label,value:e.id}}):[];D(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[f]),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,E("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},defaultValue:null==C?void 0:C[0],render:e=>l.createElement(t.Dropdown,{option:b,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:E}),name:"tenantIds",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(r=p.errors)||void 0===r||null===(u=r.tenantIds)||void 0===u?void 0:u.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},render:e=>l.createElement(t.Dropdown,{option:T,optionKey:"name",selected:e.value,select:t=>e.onChange(t),t:E}),name:"categoryName",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(s=p.errors)||void 0===s||null===(c=s.categoryName)||void 0===c?void 0:c.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Question")),l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{name:"questionStatement",type:"text",value:e.value,onChange:t=>e.onChange(t)}),name:"questionStatement",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(d=p.errors)||void 0===d||null===(m=d.questionStatement)||void 0===m?void 0:m.message)))},ir=e=>{var o;let{parentRoute:r}=e;const{t:u}=a.useTranslation(),[s,c]=n.useState(null),m=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),[g,f]=n.useState(!1),[h,y]=n.useState(!1),S=[{code:"ALL",name:""+u("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+u("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+u("ES_COMMON_INACTIVE"),bool:!1}],b={tenantIds:E[0],categoryName:"",questionStatement:""},_={status:S[0]},C={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},T=Digit.SessionStorage.get("CITIZENSURVEYQUESTION.INBOX"),D=n.useMemo(()=>T||{filterForm:_,searchForm:b,tableForm:C},[Object.values((null==T?void 0:T.filterForm)||{}),Object.values((null==T?void 0:T.searchForm)||{}),Object.values((null==T?void 0:T.tableForm)||{})]),[N,A]=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{searchForm:t.data})),d({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{filterForm:t.data})),d({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",d({},e,{tableForm:t.data})),d({},e,{tableForm:t.data})}},D);let{data:{Questions:w=[],Errors:x=[]}={},isLoading:I}=Digit.Hooks.survey.useSurveyQuestionInbox(N);const L=null===(o=w)||void 0===o?void 0:o.length,[O,R]=n.useState([]);n.useEffect(()=>{if(w.length>0){const e=[...w].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);w=e,R(e)}},[w]);const P={logoIcon:l.createElement(t.DocumentIcon,null),headerText:"CS_COMMON_SURVEYS",links:[{text:u("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:u("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:u("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:u("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:u("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:u("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:u("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},M=n.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:a}=e;return l.createElement(or,{registerRef:t,searchFormState:n,controlSearchForm:a})},[]),F=n.useCallback(e=>{let{registerRef:t,controlFilterForm:n,setFilterFormValue:a,getFilterFormValue:o}=e;return l.createElement(ar,{statuses:S,registerRef:t,controlFilterForm:n,setFilterFormValue:a,filterFormState:null==N?void 0:N.filterForm,getFilterFormValue:o})},[S]),k={SearchFormFields:M,onSearchFormSubmit:e=>{console.log("onSearchFormSubmit:",e),A({action:"mutateTableForm",data:d({},N.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),A({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==N?void 0:N.searchForm,resetSearchFormDefaultValues:b,onSearchFormReset:e=>{e("tenantIds",m),e("categoryName",""),e("questionStatement",""),A({action:"mutateSearchForm",data:b})}},B={FilterFormFields:F,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),A({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==N?void 0:N.filterForm,resetFilterFormDefaultValues:_,onFilterFormReset:e=>{e("status",S[0]),A({action:"mutateFilterForm",data:_})}},U=(e=>{var o,i,r,u;let{onPageSizeChange:s,formState:c,totalCount:m,table:v,dispatch:p,inboxStyles:E={},setShowToast:g,setOpenQuesDetailsDialog:f,setQuestionDetailsContent:h}=e;const y=e=>l.createElement("span",{className:"cell-text styled-cell"},e),{t:S}=a.useTranslation(),b=n.useMemo(()=>[{Header:S("Question"),accessor:"questionStatement",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;console.log("question: ",e),f(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,S(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));h(n)}(null==n?void 0:n.original)},null==n||null===(t=n.original)||void 0===t?void 0:t.questionStatement),l.createElement("span",{className:"tooltiptext",style:{top:"40%",bottom:"auto",left:"50%",marginLeft:"-10px",fontSize:"medium",position:"absolute"}},S("Click here to view the question details"))))}},{Header:S("Is Question Active"),accessor:"isActive",Cell:e=>{var t;let{row:n}=e;return(e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e))(null===(t=n.original)||void 0===t?void 0:t.status)}},{Header:S("Question Type"),accessor:"questionType",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,S(null===(t=n.original)||void 0===t?void 0:t.type)))}},{Header:S("Is Question Required"),accessor:"isQuestionRequired",Cell:e=>{var t;let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,S(null===(t=n.original)||void 0===t?void 0:t.required)))}},{Header:S("Category"),accessor:"category",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",null,null===(t=a.original)||void 0===t||null===(n=t.category)||void 0===n?void 0:n.label))}},{Header:S("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:S("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let{row:o}=e;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?y(we(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:S("Update Question Status"),accessor:"updateQuestion",Cell:e=>{let{row:n}=e;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t;const n=null==e||null===(t=e.original)||void 0===t?void 0:t.status,l="ACTIVE"===n?"INACTIVE":"INACTIVE"===n?"ACTIVE":"";g({label:"Are you sure you want to change the question status from "+n+" to "+l+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original,updatedStatus:l})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},S("Click here to update the question status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:s,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:d({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(m),onSearch:null==c||null===(u=c.searchForm)||void 0===u?void 0:u.message,data:v,columns:b,noResultsMessage:"No Question found",inboxStyles:d({},E)}})(d({},{parentRoute:r,onPageSizeChange:e=>{A({action:"mutateTableForm",data:d({},N.tableForm,{limit:e.target.value})})},formState:N,totalCount:L,table:O,noResultsMessage:"No Questions found",dispatch:A,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c,openQuesDetailsDialog:g,questionDetailsContent:h,setOpenQuesDetailsDialog:f,setQuestionDetailsContent:y})),V=(e=>{let{table:n,setShowToast:o}=e;const{t:r}=a.useTranslation(),u=e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e);return{data:null==n?void 0:n.map(e=>({[r("Question")]:e.questionStatement,[r("Status")]:u(e.status),[r("Question Type")]:e.type,[r("Category")]:e.category.label,[r("Created On")]:e.auditDetails.createdTime?we(new Date(e.auditDetails.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:e.auditDetails.lastModifiedTime?we(new Date(e.auditDetails.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Question Status")]:l.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.status,n="ACTIVE"===t?"INACTIVE":"INACTIVE"===t?"ACTIVE":"";o({label:"Are you sure you want to change the question status from "+t+" to "+n+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e,updatedStatus:n})})(e)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))})),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:a,value:o}=n;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:O,setShowToast:c});function H(){f(!1)}return l.createElement(n.Fragment,null,l.createElement(t.Header,null,u("Search Questions"),L?l.createElement("p",{className:"inbox-count"},L):null),l.createElement(t.InboxComposer,d({isInboxLoading:I,PropsForInboxLinks:P},k,B,{propsForInboxMobileCards:V,propsForInboxTable:U,formState:N})),s&&l.createElement(t.Toast,{label:u(s.label),isDleteBtn:s.isDleteBtn,error:s.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=s.rowData;Digit.Surveys.updateQuestions({Questions:[{uuid:null==e?void 0:e.uuid,status:s.updatedStatus}]}).then(e=>{var t,n,l;(null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0?c({label:"Question status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:s.warning,style:{padding:"16px"},isWarningButtons:s.isWarningButtons}),g&&l.createElement(pi,{onSelect:function(){f(!1)},onCancel:H,onDismiss:H,heading:"Question Details",actionCancel:!0,content:h,hideSubmit:!0}))},rr=e=>{let{children:t,currentStep:n=1,stepsList:o=[]}=e;const{t:i}=a.useTranslation(),r=(e,t)=>({display:"flex",alignItems:"center",justifyContent:"flex-start",flex:"0 0 auto",color:e?"#0D43A7":"#9CA3AF",padding:"14px 12px",width:"260px",marginBottom:t?"6px":"18px"}),u=e=>{const t=e<=n;return{width:"56px",height:"56px",borderRadius:"50%",background:t?"linear-gradient(135deg,#2563eb,#7c3aed)":"#ffffff",color:t?"#ffffff":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"8px",fontWeight:600,fontSize:"18px",border:t?"none":"1px solid rgba(15,23,42,0.08)",boxShadow:t?"0 6px 18px rgba(37,99,235,0.18)":"0 2px 6px rgba(2,6,23,0.04)",position:"relative"}},s={fontSize:"16px",color:"#0f172a",fontWeight:600,fontFamily:"Noto Sans, sans-serif",marginRight:"8px",textAlign:"right"},c={fontSize:"14px",color:"#6b7280",fontWeight:500,fontFamily:"Noto Sans, sans-serif",margin:"0 6px 0 0"},m={position:"absolute",width:"3px",height:"56px",backgroundColor:"rgba(15,23,42,0.06)",left:"50%",top:"100%",transform:"translateX(-50%)",borderRadius:"2px"},v=window.Digit.Utils.browser.isMobile(),p=o.length,E=v?{width:"32px",height:"32px",fontSize:"12px"}:{},g=v?{fontSize:"10px"}:{},f=v?{width:"auto",padding:"6px",marginBottom:"0",flexDirection:"column",alignItems:"center"}:{};return l.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:v?"column":"row",gap:"24px"}},l.createElement("div",{className:"stepper-navigation-bar",style:d({display:"flex",flexDirection:"column",alignItems:"center",padding:"18px",minWidth:"120px",maxWidth:"320px",marginBottom:"20px",marginTop:v?"20px":"0",height:v?"106px":""},v?{flexDirection:"row",overflowX:"auto",whiteSpace:"nowrap",minWidth:"100%",maxWidth:"100%",gap:"8px",padding:"10px"}:{})},[...Array(p)].map((e,t)=>l.createElement("div",{className:"step-content",key:t,style:d({},r(t+1<=n,t===p-1),f)},l.createElement("div",{className:"step-circle",style:d({},u(t+1),E)},t+1,t<p-1&&!v&&l.createElement("div",{style:m})),l.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:v?"center":"flex-end",margin:v?"4px":"10px"}},t+1===p?null:l.createElement("div",{className:"step-number",style:c}),l.createElement("div",{className:"step-label",style:d({},s,g,{textAlign:v?"center":"right"})},i(o[t].stepLabel)))))),l.createElement("div",{className:"stepper-body",style:{width:"100%",marginBottom:"20px",background:"transparent"}},t))},ur=e=>{let{stepsList:t=[],onSubmit:n,step:o,setStep:i}=e;const r=t.filter(e=>e.isStepEnabled),{t:u}=a.useTranslation();function s(){o<r.length?d():o===r.length&&n()}function c(){o>1&&m()}const d=()=>i(o+1),m=()=>i(o-1);return l.createElement(rr,{currentStep:o,nextStep:d,prevStep:m,stepsList:r},(()=>{var e,t;const n=r[o-1],{component:a,key:i,texts:d,currStepConfig:m}=n,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(a);return l.createElement(l.Fragment,null,l.createElement(v,{config:{key:i,texts:d,component:a,currStepNumber:o,currStepConfig:m},onGoNext:s,onBackClick:c,t:u}))})())},sr=[{head:"Survey Details",stepNumber:1,body:[{type:"component",component:"NewSurveys",key:"NewSurveys",withoutLabel:!0}]},{head:"Survey Sections",stepNumber:2,body:[{type:"component",component:"SurveyCreationPage",key:"SurveyCreationPage",withoutLabel:!0}]},{head:"Summary",stepNumber:3,body:[{type:"component",component:"SurveySummary",key:"SurveySummary",withoutLabel:!0}]}],cr=(e,t)=>({type:"UPDATE_SURVEY_FORM",payload:{key:e,value:t}}),dr=(e,t)=>({type:"FIELD_CHANGE",surveyId:e,data:t}),mr=e=>({type:"ADD_CATEGORY",id:e}),vr=(e,t)=>({type:"ADD_QUESTIONS",categoryId:e,questions:t}),pr=(e,t)=>({type:"UPDATE_CATEGORY",categoryId:e,data:t}),Er=(e,t,n)=>({type:"UPDATE_MANDATORY_QUESTION_SELECTION",categoryId:e,questionId:t,mandatory:n}),gr=(e,t)=>({type:"SET_QUESTIONS",categoryId:e,questions:t}),fr=e=>({type:"DELETE_CATEGORY",categoryId:e}),hr=[{head:"SURVEY_DETAILS",stepLabel:"Survey Details",stepNumber:1,isStepEnabled:!0,type:"component",component:"SurveyFormDetails",key:"surveyFormDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_CATEGORIES",stepLabel:"Survey Sections",stepNumber:2,isStepEnabled:!0,type:"component",component:"SurveyFormCategoryDetails",key:"surveyFormCategoryDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_SUMMARY",stepLabel:"Summary",stepNumber:3,isStepEnabled:!0,type:"component",component:"SurveryFormSummary",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"Submit"}}].map(e=>d({},e,{currStepConfig:sr.filter(t=>t.stepNumber===e.stepNumber)})),yr=()=>{o.useHistory();const{t:e}=a.useTranslation(),i=u.useDispatch(),[r,s]=n.useState(null),c=u.useSelector(e=>e.engagement.surveyForm),d=c.step;return Digit.ULBService.getCurrentTenantId(),console.log("formState: ",c),l.createElement("div",{class:"card"},l.createElement("h1",{style:{color:"black",fontFamily:"Noto Sans,sans-serif",fontSize:"28px",fontWeight:"500"}},e("CREATE_NEW_SURVEY")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"50px"}}),l.createElement(ur,{stepsList:hr,onSubmit:()=>{},step:d,setStep:e=>{i((e=>({type:"SET_SURVEY_STEP",payload:e}))(e))}}),r&&l.createElement(t.Toast,{error:r.key,label:e(r.label),onClose:()=>{s(null)},isDleteBtn:"true"}))},Sr=e=>{let{formData:o,setFormData:i,errors:r,setErrors:u,stateCode:s,Otp:c,setGetOtp:m,setUser:v}=e;const{data:p}=Digit.Hooks.useTenants(),[E,g]=n.useState(null),{t:f}=a.useTranslation(),h=Digit.ULBService.getCurrentTenantId(),y=n.useMemo(()=>null==p?void 0:p.filter(e=>h===(null==e?void 0:e.code)),[p,h]);n.useEffect(()=>{y&&y.length>0&&i(e=>d({},e,{city:y[0]}))},[y]);const{data:S}=Digit.Hooks.pt.useGenderMDMS(s,"common-masters","GenderType"),b=n.useMemo(()=>(null==S?void 0:S.map(e=>({i18nKey:"PT_COMMON_GENDER_"+e.code,code:e.code,value:e.code})))||[],[S]),_=e=>{const{name:t,value:n}=e.target;i(e=>d({},e,{[t]:n}))};return n.useEffect(()=>{console.log("UPDATED formData",o)},[o]),l.createElement("div",{style:{border:"2px solid #ccc",padding:"15px",borderRadius:"4px"}},l.createElement("h2",null,"Citizen Details"),l.createElement("div",{style:{border:"1px solid #ccc"}}),l.createElement("h3",null,"Mobile Number ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"mobile",value:o.mobile,onChange:_,placeholder:"Enter Mobile Number",required:!0,maxLength:10}),r.mobile&&l.createElement("span",{className:"error"},r.mobile),l.createElement("h3",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"city",name:"city",option:p,className:"cityCss",select:e=>{return t=e,void i(e=>d({},e,{city:t}));var t},placeholder:"Select City",optionKey:"i18nKey",t:f,disable:"pb.punjab"!==h,selected:"pb.punjab"===h?null==o?void 0:o.city:null==y?void 0:y[0]}),r.city&&l.createElement("span",{className:"error"},r.city),l.createElement("label",{onClick:()=>{const e=(()=>{const e={};return o.mobile?/^\d{10}$/.test(o.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",o.city||(e.city="City is required"),e})();if(u(e),0===Object.keys(e).length){var t,n;const e={userName:null==o?void 0:o.mobile,tenantId:(null==o||null===(t=o.city)||void 0===t?void 0:t.code).split(".")[0]},l={tenantId:(null==o||null===(n=o.city)||void 0===n?void 0:n.code).split(".")[0]};Digit.Surveys.userSearch(e,l).then(e=>{var t,n,l,a,o;v(null==e||null===(t=e.user)||void 0===t?void 0:t[0]),console.log("response=====",null==e||null===(n=e.user)||void 0===n?void 0:n[0]),console.log("response",null===(l=e.user[0])||void 0===l?void 0:l.emailId),("200"===(null==e||null===(a=e.responseInfo)||void 0===a?void 0:a.status)||"201"===(null==e||null===(o=e.responseInfo)||void 0===o?void 0:o.status))&&(null==e?void 0:e.user.length)>0?(console.log("coming here na"),i(t=>{var n,l,a,o;return d({},t,{citizenFound:!0,name:null===(n=e.user[0])||void 0===n?void 0:n.name,email:null===(l=e.user[0])||void 0===l?void 0:l.emailId,gender:null===(a=e.user[0])||void 0===a?void 0:a.gender,dob:null===(o=e.user[0])||void 0===o?void 0:o.dob,register:!1,user:e.user[0]})})):(console.log("not here"),i(e=>d({},e,{citizenFound:!1})),g({key:!0,isError:!0,label:"CITIZEN NOT FOUND FOR THE GIVEN DETAILS"}))}).catch(e=>{console.log(e)})}}},"Fetch Details"),!1===o.citizenFound&&l.createElement("div",{style:{display:"flex",flexDirection:"row",columnGap:"10px"}},l.createElement("h3",null,"Do you want to register?"),l.createElement("label",{style:{backgroundColor:"green"},onClick:()=>{i(e=>d({},e,{register:!0}))}},"Yes"),l.createElement("label",{style:{backgroundColor:"red"},onClick:()=>{i(e=>d({},e,{register:!1}))}},"No")),(!0===o.register||!0===o.citizenFound)&&l.createElement(n.Fragment,null,l.createElement("h3",null,"Citizen Name"),l.createElement("input",{type:"text",name:"name",value:o.name,onChange:_,placeholder:"Citizen Name",readOnly:o.citizenFound,maxLength:100}),r.name&&l.createElement("span",{className:"error"},r.name),l.createElement("h3",null,"Citizen Gender"),l.createElement("select",{id:"dropdown",value:null==o?void 0:o.gender,onChange:e=>{return t=e,void i(e=>d({},e,{gender:t.target.value}));var t}},l.createElement("option",{value:""},"--Please choose an option--"),b.map((e,t)=>l.createElement("option",{key:t,value:e.value},e.value))),r.gender&&l.createElement("span",{className:"error"},r.gender),l.createElement("h3",null,"Citizen Email"),l.createElement("input",{type:"email",id:"emailInput",name:"email",value:o.email,onChange:_,placeholder:"Citizen Email",defaultValue:o.email}),r.email&&l.createElement("span",{className:"error"},r.email),l.createElement("h3",null,"Citizen Date of Birth"),l.createElement("input",{name:"dob",type:"date",onChange:e=>{const{name:t,value:n}=e.target;i(e=>d({},e,{[t]:n}))},defaultValue:o.dob,value:o.dob}),r.dob&&l.createElement("span",{className:"error"},r.dob),!0===o.register&&l.createElement("label",{onClick:()=>(()=>{const e={otp:{name:o.name,permanentCity:o.city.code,tenantId:""+s,mobileNumber:o.mobile,type:"register"}};try{Digit.UserService.sendOtp(e,s).then(e=>{!0===(null==e?void 0:e.isSuccessful)?m(!0):(g({key:!0,isError:!0,label:""+e}),m(!1))})}catch(e){m(!1)}})()},"Get OTP")),!0===c?l.createElement(n.Fragment,null,l.createElement("h3",{style:{marginTop:"20px"}},"OTP"),l.createElement("input",{type:"text",name:"otp",value:o.otp,onChange:_,placeholder:"Enter Otp"}),r.otp&&l.createElement("span",{className:"error"},r.otp)):null,E&&l.createElement(t.Toast,{error:E.isError,label:f(E.label),onClose:()=>{g(null)},isDleteBtn:"true"}))},br=e=>{var i;let{stateCode:r}=e;const u=o.useHistory(),{t:s}=a.useTranslation(),c=o.useLocation(),[m,p]=n.useState();console.log("loca",c.state.surveyDetails);const E=(null===(i=c.state)||void 0===i?void 0:i.surveyDetails)||{};console.log("surv det",E),Digit.UserService.getUser(),Digit.ULBService.getCurrentTenantId();const[g,f]=n.useState(null),[h,y]=n.useState(null),[S,b]=n.useState(!1),[_,C]=n.useState({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null});console.log("formData",_);const[T,D]=n.useState({});function N(e){const t=new Date(e),n=new Date;let l=n.getFullYear()-t.getFullYear();const a=n.getMonth()-t.getMonth();return(a<0||0===a&&n.getDate()<t.getDate())&&l--,l}return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},E.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},E.surveyDescription))),l.createElement("form",{onSubmit:function(e){try{let t=!1;if(e.preventDefault(),null===_.citizenFound)return f({key:!0,isError:!0,label:"PLEASE CLICK ON FETCH DETAILS BUTTON"}),Promise.resolve();const n=!0===_.register?(()=>{const e={};_.name?/^[A-Za-z\s]+$/.test(_.name)||(e.name="Name can only contain alphabets and spaces"):e.name="Name is required",_.email?/\S+@\S+\.\S+/.test(_.email)||(e.email="Invlid Email"):e.email="Email is required",_.gender||(e.gender="Gender is required");const t=N(_.dob);return _.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",_.mobile?/^\d{10}$/.test(_.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",_.city||(e.city="City is required"),_.otp||(e.otp="Otp is required"),D(e),0===Object.keys(e).length})():!0===_.citizenFound?(()=>{const e={};_.mobile?/^\d{10}$/.test(_.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",_.city||(e.city="City is required"),_.email?/\S+@\S+\.\S+/.test(_.email)||(e.email="Invlid Email"):e.email="Email is required",_.gender||(e.gender="Gender is required");const t=N(_.dob);return _.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",D(e),0===Object.keys(e).length})():null,l=function(){if(n){console.log("Form submitted:",_),console.log("reg",_.register,_.citizenFound),console.log("getUser",m);const e=_.user,n=function(){if((!1===_.register||null===_.register)&&!0===_.citizenFound){function n(e){var n;if(t)return e;console.log("formData",_),u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:_,userInfo:_.user,surveyDetails:E,userType:null===(n=c.state)||void 0===n?void 0:n.userType})}const l=_.email&&_.email!==(null==e?void 0:e.emailId),a=_.gender&&_.gender!==(null==e?void 0:e.gender),o=_.dob&&_.dob!==(null==e?void 0:e.dob),i=function(){if(l||a||o){const e=d({},m,l&&{emailId:_.email},a&&{gender:_.gender},o&&{dob:_.dob}),n=v(function(){return Promise.resolve(Digit.UserService.updateUser(e,null==m?void 0:m.tenantId)).then(function(e){let{user:t}=e;console.log("User updated:",t)})},function(e){console.error("Error updating user:",e),f({key:!0,isError:!0,label:"FAILED TO UPDATE USER INFORMATION"}),t=!0});if(n&&n.then)return n.then(function(){})}else console.log("No user info changed. Skipping API call.")}();return i&&i.then?i.then(n):n(i)}(()=>{let e={name:_.name,username:_.mobile,otpReference:_.otp,tenantId:""+r,permanentCity:_.city.code};try{Digit.UserService.registerUser(e,r).then(e=>{null===(null==e?void 0:e.UserRequest)&&void 0===(null==e?void 0:e.UserRequest)||u.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:_,userInfo:e.UserRequest,surveyDetails:E}),console.log("res",e)})}catch(e){console.log(e)}})()}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},l.createElement(Sr,{formData:_,setFormData:C,errors:T,setErrors:D,stateCode:r,Otp:S,setGetOtp:b,city:null==_?void 0:_.city,getUser:m,setUser:p}),l.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"10px",flexDirection:"row",marginTop:"10px"}},l.createElement("button",{type:"submit"},"Next"),l.createElement("button",{style:{backgroundColor:"none"},onClick:()=>C({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null})},"Reset")))),g&&l.createElement(t.Toast,{error:g.isError,label:s(g.label),onClose:()=>{f(null)},isDleteBtn:"true"}))},_r=e=>{var n;const{t:o}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response[0])||void 0===n?void 0:n.uuid,info:e.props.isSuccess?o("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Cr=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),o.useHistory()),[c,d]=n.useState(!1);return n.useEffect(()=>{i.clear(),window.history.replaceState(null,"CREATE_SURVEY_STATE")},[]),l.createElement(t.Card,null,l.createElement(_r,{props:e.location.state}),l.createElement(t.CardText,null,u("SURVEY_FORM_CREATION_MESSAGE",{surveyName:null==e?void 0:e.title,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.startDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.endDate)})),l.createElement(t.ActionBar,null,l.createElement("button",{onClick:()=>{d(e=>!e)}},l.createElement(t.SubmitBar,{label:"Action"}),c&&l.createElement(t.Menu,{options:[u("GO_BACK_TO_HOME"),u("CREATE_ANOTHER_SURVEY")],onSelect:e=>{e===u("GO_BACK_TO_HOME")?s.replace("/digit-ui/employee"):e===u("CREATE_ANOTHER_SURVEY")&&s.replace("/digit-ui/employee/engagement/surveys/create-survey-step-form")}}))))},Tr=e=>{const{t:n}=a.useTranslation();return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_SURVEY_UPDATED":"ENGAGEMENT_SURVEY_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess&&null!=o&&null!==(i=o.data)&&void 0!==i&&null!==(r=i.Surveys)&&void 0!==r&&null!==(u=r[0])&&void 0!==u&&u.uuid?null==o||null===(m=o.data)||void 0===m||null===(v=m.Surveys)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid:o.isSuccess?null===(s=o.data)||void 0===s||null===(c=s.Documents)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.uuid:""),info:e.isSuccess?n("SURVEY_FORM_ID"):"",successful:e.isSuccess});var o,i,r,u,s,c,d,m,v,p},Dr=e=>{const i=r.useQueryClient(),{t:u}=a.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useUpdate()),{state:c}=e.location;return n.useEffect(()=>{c&&s.mutate(c,{onSuccess:()=>{i.clear(),window.history.replaceState(null,"UPDATE_SURVEY_STATE")}})},[]),s.isLoading||s.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Tr,{t:u,data:s.data,mutation:s,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},Nr=e=>{let{t:a,question:o,control:r,register:u,formState:s,formDisabled:c,index:d}=e;const m=null==s?void 0:s.errors;if(o)return l.createElement(t.Card,null,l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("span",{className:"question-title"},d+1,". ",o.questionStatement," ",null!=o&&o.required?"*":""),l.createElement("span",null,(e=>{var s,d,v,p,E,g,f,h;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:200,message:a("EXCEEDS_200_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(s=m[o.uuid])||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(d=m[o.uuid])||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_200_CHAR_LIMIT")));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:o.uuid,disabled:c,inputRef:u({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")},required:o.required})}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(v=m[o.uuid])||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),m&&(null==m?void 0:m[o.uuid])&&"maxLength"===(null==m||null===(p=m[o.uuid])||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_500_CHAR_LIMIT")));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.RadioButtons,{disabled:c,onSelect:n,selectedOption:a,optionsKey:"",options:[...o.options]})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(E=m[o.uuid])||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement("div",{className:"align-columns"},o.options.map(e=>{var o;return l.createElement(t.CheckBox,{disable:c,key:e,onChange:t=>{t.target.checked?n([e,...a||[]]):a&&n(null==a?void 0:a.filter(t=>t!==e))},checked:"string"==typeof a?!(null===(o=[a])||void 0===o||!o.find(t=>t===e)):!(null==a||!a.find(t=>t===e)),label:e,checkboxWidth:{width:"34px",height:"34px"},style:{marginTop:"5px",overflowWrap:"break-word"}})}))}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(g=m[o.uuid])||void 0===g?void 0:g.type)&&l.createElement(t.CardLabelError,{style:{marginTop:"20px"}},a("CS_COMMON_REQUIRED")));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{disabled:c,type:"date",onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(f=m[o.uuid])||void 0===f?void 0:f.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"time",disabled:c,onChange:n,defaultValue:a})}}),m&&(null==m?void 0:m[o.uuid])&&"required"===(null==m||null===(h=m[o.uuid])||void 0===h?void 0:h.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));default:return l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:u({maxLength:{value:60,message:a("EXCEEDS_60_CHAR_LIMIT")},required:o.required})})}})(o.type))))},Ar=e=>{var n,o;let{surveyData:r,onFormSubmit:u,submitDisabled:s,formDisabled:c,formDefaultValues:d,isLoading:m,showToast:v,isSubmitDisabled:p}=e;const{register:E,control:g,handleSubmit:f,getValues:h,formState:y}=i.useForm({defaultValues:d}),{t:S}=a.useTranslation();return m?l.createElement(t.Loader,null):l.createElement("div",{className:"citizenSurvey-wrapper"},l.createElement(t.Header,null,null==r||null===(n=r.title)||void 0===n?void 0:n.toUpperCase()),l.createElement("form",{onSubmit:f(u)},null!=r&&null!==(o=r.questions)&&void 0!==o&&o.length?r.questions.map((e,t)=>l.createElement(Nr,{key:t,t:S,question:e,control:g,register:E,values:h,formState:y,formDisabled:c,index:t})):null,v&&l.createElement(t.Toast,{error:v.key,label:S(v.label)}),l.createElement(t.ActionBar,null,!s&&l.createElement(t.SubmitBar,{disabled:p,label:S("CS_SUBMIT_SURVEY"),submit:"submit"}))))},wr=(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},xr=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])))))},Ir=e=>{let{surveyTitle:a,surveyDesc:i,t:r,surveyId:u}=e;const s=o.useHistory(),c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser().info,v=c.filter(e=>{var t;return null==m||null===(t=m.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=n.useMemo(()=>c.filter(e=>e.code===d),[c]);return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("LABEL_FOR_ULB")+" * :"),l.createElement("div",{style:{display:"grid",gridAutoFlow:"row"}},l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:v,selected:p,keepNull:!0,disable:!0,t:r}),l.createElement(t.RemoveableTag,{key:"tag",text:r(v[0].i18nKey),extraStyles:{tagStyles:{display:"flex"}}})),l.createElement(t.LinkLabel,{onClick:()=>s.push("/digit-ui/employee/engagement/surveys/inbox/details/"+u)},r("VIEW_SURVEY_QUESTIONS"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",disable:!0,value:a})),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",disable:!0,value:i})))},Lr=["#8E29BF","#FBC02D","#048BD0","#EA8A3B","#0BABDE","#800080","#ee82ee","#616161","#3cb371","#6a5acd"],Or=Math.PI/180,Rr=e=>{let{cx:t,cy:n,midAngle:a,innerRadius:o,outerRadius:i,percent:r}=e;const u=o+.5*(i-o),s=t+u*Math.cos(-a*Or),c=n+u*Math.sin(-a*Or);return l.createElement("text",{x:s,y:c,fill:"white",textAnchor:s>t?"start":"end",dominantBaseline:"central"},(100*r).toFixed(0)+"%")},Pr=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)))))},Mr=e=>{const t=(e=>{const t=e.options,n=e.answers,l=[];return null==t||t.map(e=>l.push({name:e,value:0})),null==n||n.map((e,t)=>{null==l||l.map((t,n)=>{t.name===e&&(l[n].value=l[n].value+1)})}),l})(e.data);return l.createElement(s.PieChart,{width:400,height:400},l.createElement(s.Pie,{data:t,cx:200,cy:200,labelLine:!1,label:Rr,outerRadius:120,fill:"#8884d8",dataKey:"value"},null==t?void 0:t.map((e,t)=>l.createElement(s.Cell,{key:"cell-"+t,fill:Lr[t%Lr.length]}))),l.createElement(s.Tooltip,null),l.createElement(s.Legend,{content:Pr,width:100,align:"right",wrapperStyle:{top:40,right:20,left:500,backgroundColor:"#FAFAFA",borderRadius:3,lineHeight:"40px"}}))},Fr=e=>{const t=(e=>{const t=[],n=e.answers;return e.options.map(e=>{const l={};l.name=e,l.value=0,n.map(t=>{t.map(t=>{t===e&&(l.value=l.value+1)})}),t.push(l)}),t})(e.data);return l.createElement("div",{style:{padding:"10px",width:"700px",height:"260px",backgroundColor:"#fafafa"}},l.createElement(s.ResponsiveContainer,null,l.createElement(s.BarChart,{data:t,layout:"vertical",margin:{top:0,right:50,left:0,bottom:0},barCategoryGap:8},l.createElement(s.CartesianGrid,{strokeDasharray:"3 3"}),l.createElement(s.XAxis,{type:"number"}),l.createElement(s.YAxis,{type:"category",width:150,padding:{left:20},dataKey:"name"}),l.createElement(s.Bar,{dataKey:"value",fill:"#048BD0"}),l.createElement(s.Tooltip,null))))},kr=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]}},Br=e=>{let{surveyInfo:o,responsesInfoMutation:i}=e;const{t:r}=a.useTranslation(),[u,s]=n.useState(null),[c,d]=n.useState({}),m=Digit.ULBService.getCurrentTenantId();return n.useEffect(function(){try{const e=function(){if(i.isSuccess){const e=wr(null==o?void 0:o.questions,i.data.answers);return s(e),Promise.resolve(function(e,t){try{let n={},l=[];return l=null==e?void 0:e.map(e=>Digit.UserService.userSearch(t,{uuid:[null==e?void 0:e.citizenId]},{}).then(e=>e)),Promise.resolve(Promise.all(l)).then(function(e){var t;return l=e,l&&(null===(t=l)||void 0===t?void 0:t.length)>0&&l.map(e=>{var t,l,a,o;n["+91 "+(null==e||null===(t=e.user)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.mobileNumber)]=null==e||null===(a=e.user)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.emailId}),n})}catch(e){return Promise.reject(e)}}(i.data.answers,m.split(".")[0])).then(function(e){d(e)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[i]),u?l.createElement("div",{className:"custom-group-merge-container"},l.createElement(t.Header,null,r("CS_COMMON_SURVEYS")),l.createElement(t.MultiLink,{style:{marginTop:"-45px"},onHeadClick:()=>(()=>{const e=((e,t)=>{const n=parseInt(t.length/e.length),l=wr(null==o?void 0:o.questions,i.data.answers),a=[];for(let t=0;t<n;t++){const n={TimeStamp:""};null==e||e.map(e=>{n[e.questionStatement]=""});const o=null==e?void 0:e.map(e=>e.questionStatement);null==o||o.map(e=>{var a,o,i,r,u,s,c,d,m,v,p,E,g,f,h,y;const S=null==l?void 0:l.filter(t=>(null==t?void 0:t.questionStatement)===e),b="object"==typeof(null==S||null===(a=S[0])||void 0===a||null===(o=a.answers)||void 0===o?void 0:o[t])?null!=S&&null!==(i=S[0])&&void 0!==i&&null!==(r=i.answers)&&void 0!==r&&null!==(u=r[t])&&void 0!==u&&null!==(s=u.join())&&void 0!==s&&s.includes("ul")?"NA":null==S||null===(c=S[0])||void 0===c||null===(d=c.answers)||void 0===d||null===(m=d[t])||void 0===m?void 0:m.join():"ul"===(null==S||null===(v=S[0])||void 0===v||null===(p=v.answers)||void 0===p?void 0:p[t])||""===(null==S||null===(E=S[0])||void 0===E||null===(g=E.answers)||void 0===g?void 0:g[t])?"NA":null==S||null===(f=S[0])||void 0===f||null===(h=f.answers)||void 0===h?void 0:h[t];n[e]=b,n.TimeStamp=null==S||null===(y=S[0])||void 0===y?void 0:y.timeStamp}),a.push(n)}return a})(null==o?void 0:o.questions,i.data.answers);return Digit.Download.Excel(e,i.data.title)})(),downloadBtnClassName:"employee-download-btn-className",label:r("SURVEY_REPORT")}),l.createElement(t.Card,null,l.createElement("div",{style:{margin:"30px"}},l.createElement(Ir,{surveyTitle:o.title,surveyDesc:o.description,t:r,surveyId:o.uuid})),l.createElement(xr,{t:r,userInfo:c}),null==u?void 0:u.map(e=>{var n;return function(e,n,a,o,i){switch(void 0===o&&(o=0),a){case"Short Answer":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Date":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"date-response"},l.createElement("div",null,kr(e).date),l.createElement("div",{className:"divide"}),l.createElement("div",null,kr(e).day)))));case"Time":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>{return l.createElement("div",{className:"date-response"},l.createElement("div",null,e),l.createElement("div",{className:"divide"}),l.createElement("div",null,((t=(t=e).toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[t]).length>1&&((t=t.slice(1))[5]=+t[0]<12?" AM":" PM",t[0]=+t[0]%12||12),t.join(""))));var t})));case"Paragraph":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Check Boxes":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{padding:"30px"}},l.createElement(Fr,{data:e})));case"Multiple Choice":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{overflow:"-moz-hidden-unscrollable"}},l.createElement(Mr,{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)},Ur={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"},Vr=()=>{const e=Digit.ULBService.getCurrentTenantId(),a=o.useParams(),i=Digit.Hooks.survey.useShowResults(),u=r.useQueryClient();n.useEffect(()=>{i.mutate({surveyId:a.id},{onSuccess:()=>{u.clear()}})},[]);const{isLoading:s,data:c}=Digit.Hooks.survey.useSearch({tenantIds:e,uuid:a.id},{select:e=>{var t;const n=null==e||null===(t=e.Surveys)||void 0===t?void 0:t[0];return{uuid:n.uuid,title:n.title,description:n.description,fromDate:we(new Date(n.startDate),"yyyy-MM-dd"),toDate:we(new Date(n.endDate),"yyyy-MM-dd"),fromTime:we(new Date(n.startDate),"hh:mm"),toTime:we(new Date(n.endDate),"hh:mm"),questions:n.questions.map(e=>{let{questionStatement:t,type:n,required:l,options:a,uuid:o,surveyId:i}=e;return{questionStatement:t,type:Ur[n],required:l,options:a,uuid:o,surveyId:i}}),status:n.status,answersCount:n.answersCount}}});return s?l.createElement(t.Loader,null):l.createElement(Br,{surveyInfo:c,responsesInfoMutation:i})},Hr=e=>{var n,o;const{t:i}=a.useTranslation();return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Wr=e=>{r.useQueryClient();const{t:n}=a.useTranslation();return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Hr,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},qr=e=>{const a=e.location.state.data;console.log("questions data",a);const[o,i]=n.useState(""),r=e=>{i("")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("form",null,a.sections.length>0?a.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((e,a)=>l.createElement("div",null,l.createElement("h3",null,e.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},a+1,". ",e.question.questionStatement," ",(null==e?void 0:e.required)&&l.createElement("span",{style:{color:"red"}},"*")),((e,a,i)=>{switch(console.log("answer type",e,a),e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,disable:!0,textInputStyle:{maxWidth:"none"},type:"text"}));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},disable:!0,disabled:!0}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:o,onChange:r},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,disabled:!0,required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText))));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,disabled:!0}),e.optionText))));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},disable:!0}));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},disable:!0}));default:return l.createElement(t.TextInput,{name:a.uuid,disable:!0,type:"text"})}})(e.question.type,e.question),l.createElement("div",null)))))):null)))},zr=e=>{var a,o,i,r,s,c,d;let{t:m,registerRef:v,controlSurveyForm:p,surveyFormState:E,surveyFormData:g,readOnly:f}=e;const h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),S=Digit.ULBService.getCurrentTenantId(),{data:b,isLoading:_}=Digit.Hooks.useTenants();console.log("cities",b),n.useEffect(()=>{if(!_&&null!=b&&b.length&&(null==D||!D.ulb)){const e=null==b?void 0:b.find(e=>e.code===S);e&&T(dr(D.id,{ulb:e}))}},[b,_,S]);const C=Digit.UserService.getUser().info,T=u.useDispatch(),D=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);console.log("surveyDetails====",D);const N=h.filter(e=>{var t;return null==C||null===(t=C.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);console.log("userulbs",N),n.useMemo(()=>h.filter(e=>e.code===S),[h]);const A=e=>{const{name:t,value:n}=e.target;T(dr(D.id,{[t]:n}))};return console.log("survey deta",D),console.log("bb",g,E,v,p),l.createElement("div",{className:"create-survey-card"},l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"ulb",name:"ulb",option:b,className:"cityCss",select:e=>{T(dr(D.id,{ulb:e}))},placeholder:"Select City",optionKey:"i18nKey",t:m,selected:D.ulb}),(null==E||null===(a=E.errors)||void 0===a?void 0:a.tenantIds)&&l.createElement(t.CardLabelError,null,m("ES_ERROR_REQUIRED"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,m("CS_SURVEY_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,{name:"name",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED"),maxLength:{value:500,message:m("Survey Name length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:D.name,onChange:A,placeholder:"Enter Survey Name",disable:f||!1}),(null==E||null===(o=E.errors)||void 0===o?void 0:o.title)&&l.createElement(t.CardLabelError,null,null==E||null===(i=E.errors)||void 0===i||null===(r=i.title)||void 0===r?void 0:r.message))),l.createElement("div",{className:"survey-column",style:{width:"100%"}},l.createElement("label",null,m("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",inputRef:v({maxLength:{value:500,message:m("Survey Description length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:f||!1,value:D.description,onChange:A,placeholder:"Enter Survey Description",disable:f||!1}),(null==E||null===(s=E.errors)||void 0===s?void 0:s.description)&&l.createElement(t.CardLabelError,null,null==E||null===(c=E.errors)||void 0===c||null===(d=c.description)||void 0===d?void 0:d.message)))},jr=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},Yr=e=>{var n,a,o,r,s,c,d,m;let{t:v,controlSurveyForm:p,surveyFormState:E,enableEndDateTimeOnly:g,readOnly:f}=e;const h=null==E?void 0:E.errors,y=u.useDispatch(),{getValues:S}=i.useFormContext(),b=(new Date).getTime(),_=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),C=e=>{const{name:t,value:n}=e.target;y(dr(_.id,{[t]:n}))};return l.createElement("div",{className:"create-survey-card"},l.createElement("div",null,l.createElement(t.CardSectionHeader,null,v("Survey Publish Period")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"20px"}})),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromDate",defaultValue:_.fromDate,onChange:C,rules:{required:!0,validate:g?null:{isValidFromDate:e=>{const t=new Date(e).getTime(),n=S("toDate")?new Date(S("toDate")).getTime():(new Date).getTime();return e===S("toDate")&&e>=jr(b)||n>=t&&e>=jr(b)}}},render:e=>l.createElement(t.TextInput,{name:"fromDate",type:"date",onChange:C,defaultValue:_.fromDate,disable:f||!1})}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(n=h.fromDate)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(a=h.fromDate)||void 0===a?void 0:a.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_FROM_DATE_ERROR_INVALID"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromTime",defaultValue:_.fromTime,rules:{required:!0,validate:{isValidFromTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"fromTime",type:"time",onChange:C,defaultValue:_.fromTime,disable:f||!1})}),h&&(null==h?void 0:h.fromTime)&&"required"===(null==h||null===(o=h.fromTime)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromTime)&&"isValidFromDate"===(null==h||null===(r=h.fromTime)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toDate",defaultValue:_.toDate,rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>=(S("fromDate")?new Date(S("fromDate")).getTime():(new Date).getTime())}},render:e=>l.createElement(t.TextInput,{name:"toDate",type:"date",onChange:C,defaultValue:_.toDate,disable:f||!1})}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(s=h.toDate)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(c=h.toDate)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))," "),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toTime",defaultValue:null==_?void 0:_.toTime,rules:{required:!0,validate:{isValidToTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"toTime",type:"time",onChange:C,defaultValue:_.toTime,disable:f||!1})}),h&&(null==h?void 0:h.toTime)&&"required"===(null==h||null===(d=h.toTime)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toTime)&&"isValidToDate"===(null==h||null===(m=h.toTime)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))))},Gr=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],Kr=e=>{let{t:t,initialFormValues:a,onSubmit:o,isFormDisabled:r=!1,readOnly:u}=e;const s=i.useForm({defaultValues:a}),{register:c,control:v,handleSubmit:p,setValue:E,getValues:g,reset:f,formState:h,clearErrors:y}=s,S=m(s,Gr);return console.log("surveyformValue",g,v,h),n.useEffect(()=>{c("questions")},[]),l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,d({register:c,control:v,handleSubmit:p,setValue:E,getValues:g,reset:f,formState:h,clearErrors:y},S),l.createElement("form",{onSubmit:p(o),style:{marginRight:"10px"}},l.createElement(zr,{t:t,registerRef:c,controlSurveyForm:v,surveyFormState:h,surveyFormData:g,readOnly:u}),l.createElement(Yr,{t:t,controlSurveyForm:v,surveyFormState:h,readOnly:u}))))},Qr=e=>{let{readOnly:t}=e;const{t:n}=a.useTranslation(),o=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),i=Digit.UserService.getUser().info,r=o.filter(e=>{var t;return null==i||null===(t=i.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});return l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement(Kr,{t:n,initialFormValues:{fromDate:"",fromTime:"",toDate:"",toTime:"",questions:{},tenantIds:r},readOnly:t}))},Xr=e=>l.createElement("div",null,l.createElement("h4",null,"Question"),l.createElement("select",null,l.createElement("option",{value:""},"Select Answer Type"),l.createElement("option",{value:"text"},"Text"),l.createElement("option",{value:"number"},"Number"),l.createElement("option",{value:"date"},"Date")),l.createElement("input",{type:"text",placeholder:"Answer"})),Zr=e=>{let{category:t,sectionId:n}=e;const a=u.useDispatch();return l.createElement("div",null,l.createElement("h3",null,"Category"),l.createElement("input",{type:"number",value:t.weightage,onChange:e=>{a(((e,t,n)=>({type:"UPDATE_CATEGORY_WEIGHTAGE",sectionId:e,categoryId:t,weightage:n}))(n,t.id,e.target.value))},placeholder:"Category Weightage"}),l.createElement("button",{onClick:()=>{a(((e,t)=>({type:"ADD_QUESTION",sectionId:e,categoryId:t}))(n,t.id))}},"Add Question"),t.questions.map(e=>l.createElement(Xr,{key:e.id,question:e})))},$r=e=>{var n;let{section:a}=e;const o=u.useDispatch();return console.log("section in section js",a.categories),l.createElement("div",null,l.createElement("h2",null,"Section"),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},"CS_COMMON_QUESTION"),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(t.TextInput,{value:null==a?void 0:a.weightage,onChange:e=>{o({type:"UPDATE_SECTION_WEIGHTAGE",sectionId:a.id,weightage:e.target.value})},placeholder:"Section Weightage",name:"weightage"}),l.createElement("button",{onClick:()=>{o({type:"ADD_CATEGORY",sectionId:a.id})}},"Add Category"),null!=a&&null!==(n=a.categories)&&void 0!==n&&n.length?a.categories.map(e=>l.createElement(Zr,{key:e.id,category:e,sectionId:null==a?void 0:a.id})):null,".")))},Jr=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],eu=e=>{let{match:{path:n}={},tenants:a,parentRoute:i,userType:r,stateCode:u}=e;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/inbox",component:e=>l.createElement(qi,d({},e,{tenants:a,parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/create-category",component:e=>l.createElement(zi,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-categories",component:e=>l.createElement(Gi,d({},e,{parentRoute:i}))}),l.createElement(t.PrivateRoute,{path:n+"/create-questions",component:e=>l.createElement(lr,e)}),l.createElement(t.PrivateRoute,{path:n+"/search-questions",component:e=>l.createElement(ir,e)}),l.createElement(t.PrivateRoute,{path:n+"/create-survey-step-form",component:e=>l.createElement(yr,e)}),l.createElement(t.PrivateRoute,{path:n+"/fill-citizen-details-survey",component:e=>l.createElement(br,d({},e,{stateCode:u}))}),l.createElement(t.PrivateRoute,{path:n+"/fill-survey",component:e=>l.createElement(Ei,d({},e,{userType:r}))}),l.createElement(t.PrivateRoute,{path:n+"/active-open-surveys",component:e=>l.createElement(ci,d({},e,{userType:r}))}),l.createElement(t.PrivateRoute,{path:n+"/create-response",component:e=>l.createElement(Cr,e)}),l.createElement(t.PrivateRoute,{path:n+"/update-response",component:e=>l.createElement(Dr,e)}),l.createElement(t.PrivateRoute,{path:n+"/submit-response",component:e=>l.createElement(Wr,e)}),l.createElement(t.PrivateRoute,{path:n+"/inbox/results/:id",component:e=>l.createElement(Vr,e)}),l.createElement(t.PrivateRoute,{path:n+"/previewQuestions",component:e=>l.createElement(qr,e)}))},tu=e=>{let{t:n}=e;return l.createElement(l.Fragment,null,l.createElement("div",{style:{textAlign:"-webkit-center",marginTop:"30%",marginRight:"10%"}},l.createElement("svg",{width:"255",height:"245",viewBox:"0 0 255 245",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("g",{"clip-path":"url(#clip0_47664_105169)"},l.createElement("path",{d:"M214.607 58.0692H213.267V21.2879C213.267 15.642 211.027 10.2273 207.039 6.23508C203.051 2.24282 197.641 2.77689e-09 192.001 2.77689e-09H114.153C111.36 -4.51493e-05 108.595 0.550538 106.015 1.62031C103.435 2.69009 101.09 4.2581 99.1157 6.23483C97.1409 8.21157 95.5744 10.5583 94.5056 13.141C93.4369 15.7238 92.8868 18.492 92.8867 21.2875V223.073C92.8867 228.719 95.1273 234.133 99.1154 238.125C103.104 242.118 108.513 244.36 114.153 244.36H192C197.64 244.36 203.049 242.118 207.038 238.125C211.026 234.133 213.266 228.719 213.266 223.073V84.2507H214.606L214.607 58.0692Z",fill:"#3F3D56"}),l.createElement("path",{d:"M208.905 19.8617V224.497C208.904 228.778 207.206 232.883 204.182 235.91C201.159 238.938 197.058 240.639 192.782 240.641H113.337C109.059 240.641 104.956 238.941 101.93 235.914C98.9044 232.886 97.2039 228.78 97.2026 224.497V19.8617C97.2039 15.5795 98.9043 11.4732 101.93 8.44588C104.955 5.41857 109.058 3.7182 113.336 3.71875H122.973C122.5 4.88362 122.32 6.14702 122.449 7.39789C122.577 8.64876 123.011 9.84881 123.712 10.8926C124.412 11.9363 125.358 12.7918 126.467 13.3838C127.575 13.9759 128.812 14.2863 130.068 14.2879H175.361C176.617 14.2863 177.854 13.9759 178.962 13.3838C180.07 12.7918 181.016 11.9363 181.717 10.8926C182.418 9.84881 182.851 8.64876 182.98 7.39789C183.109 6.14702 182.929 4.88362 182.456 3.71875H192.779C197.055 3.71948 201.156 5.42005 204.18 8.44661C207.204 11.4732 208.904 15.578 208.905 19.8586V19.8617Z",fill:"white"}),l.createElement("path",{d:"M153.04 102.01C171.357 102.01 186.207 87.1455 186.207 68.8088C186.207 50.4722 171.357 35.6074 153.04 35.6074C134.722 35.6074 119.872 50.4722 119.872 68.8088C119.872 87.1455 134.722 102.01 153.04 102.01Z",fill:"#a82227"}),l.createElement("path",{d:"M189.213 137.735H118.616C118.27 137.734 117.937 137.596 117.692 137.351C117.447 137.106 117.309 136.773 117.309 136.426V118.896C117.31 118.55 117.447 118.217 117.692 117.972C117.938 117.726 118.27 117.588 118.616 117.588H189.213C189.559 117.588 189.891 117.726 190.137 117.972C190.382 118.217 190.519 118.55 190.52 118.896V136.426C190.519 136.773 190.382 137.106 190.137 137.351C189.891 137.596 189.559 137.735 189.213 137.735V137.735ZM118.616 118.111C118.408 118.111 118.209 118.194 118.062 118.341C117.915 118.489 117.832 118.688 117.832 118.896V136.426C117.832 136.635 117.915 136.834 118.062 136.981C118.209 137.129 118.408 137.211 118.616 137.212H189.213C189.421 137.211 189.62 137.129 189.767 136.981C189.914 136.834 189.997 136.635 189.997 136.426V118.896C189.997 118.688 189.914 118.489 189.767 118.341C189.62 118.194 189.421 118.111 189.213 118.111H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 123.901C140.206 123.901 139.973 123.998 139.802 124.17C139.63 124.341 139.534 124.575 139.534 124.817C139.534 125.06 139.63 125.293 139.802 125.465C139.973 125.637 140.206 125.734 140.449 125.734H183.591C183.833 125.743 184.07 125.655 184.248 125.49C184.426 125.325 184.531 125.096 184.541 124.853C184.55 124.61 184.462 124.374 184.297 124.195C184.132 124.017 183.903 123.912 183.661 123.902C183.647 123.902 183.634 123.902 183.621 123.902L140.449 123.901Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 129.396C140.206 129.396 139.973 129.493 139.802 129.665C139.63 129.837 139.534 130.07 139.534 130.313C139.534 130.556 139.63 130.789 139.802 130.96C139.973 131.132 140.206 131.229 140.449 131.229H183.591C183.833 131.238 184.07 131.15 184.248 130.985C184.426 130.82 184.531 130.591 184.541 130.348C184.55 130.105 184.462 129.869 184.297 129.69C184.132 129.512 183.903 129.407 183.661 129.397C183.647 129.397 183.634 129.397 183.621 129.397L140.449 129.396Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 166.953H118.616C118.27 166.953 117.937 166.815 117.692 166.57C117.447 166.324 117.309 165.992 117.309 165.645V148.115C117.31 147.768 117.447 147.436 117.692 147.19C117.938 146.945 118.27 146.807 118.616 146.807H189.213C189.559 146.807 189.891 146.945 190.137 147.19C190.382 147.436 190.519 147.768 190.52 148.115V165.645C190.519 165.992 190.381 166.324 190.136 166.57C189.891 166.815 189.559 166.953 189.213 166.953ZM118.616 147.33C118.408 147.33 118.209 147.413 118.062 147.56C117.915 147.707 117.832 147.907 117.832 148.115V165.645C117.832 165.853 117.915 166.053 118.062 166.2C118.209 166.347 118.408 166.43 118.616 166.43H189.213C189.421 166.43 189.62 166.347 189.767 166.2C189.914 166.053 189.997 165.853 189.997 165.645V148.115C189.997 147.907 189.914 147.707 189.767 147.56C189.62 147.413 189.421 147.33 189.213 147.33H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 153.214C140.206 153.214 139.973 153.31 139.802 153.482C139.63 153.654 139.534 153.887 139.534 154.13C139.534 154.373 139.63 154.606 139.802 154.778C139.973 154.95 140.206 155.046 140.449 155.046H183.591C183.83 155.045 184.059 154.95 184.229 154.781C184.399 154.613 184.497 154.384 184.501 154.145C184.505 153.905 184.415 153.674 184.25 153.5C184.086 153.326 183.86 153.223 183.621 153.214H140.449V153.214Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 158.711C140.206 158.711 139.973 158.807 139.802 158.979C139.63 159.151 139.534 159.384 139.534 159.627C139.534 159.87 139.63 160.103 139.802 160.275C139.973 160.447 140.206 160.543 140.449 160.543H183.591C183.83 160.542 184.059 160.447 184.229 160.278C184.399 160.11 184.497 159.881 184.501 159.642C184.505 159.402 184.415 159.171 184.25 158.997C184.086 158.823 183.86 158.72 183.621 158.711H140.449V158.711Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 196.267H118.616C118.27 196.266 117.937 196.129 117.692 195.883C117.447 195.638 117.309 195.305 117.309 194.958V177.429C117.31 177.082 117.447 176.749 117.692 176.504C117.938 176.259 118.27 176.121 118.616 176.12H189.213C189.559 176.121 189.891 176.259 190.137 176.504C190.382 176.749 190.519 177.082 190.52 177.429V194.959C190.519 195.306 190.382 195.638 190.137 195.883C189.891 196.129 189.559 196.267 189.213 196.267V196.267ZM118.616 176.643C118.408 176.644 118.209 176.726 118.062 176.874C117.915 177.021 117.832 177.221 117.832 177.429V194.959C117.832 195.167 117.915 195.366 118.062 195.514C118.209 195.661 118.408 195.744 118.616 195.744H189.213C189.421 195.744 189.62 195.661 189.767 195.514C189.914 195.366 189.997 195.167 189.997 194.959V177.429C189.997 177.221 189.914 177.021 189.767 176.874C189.62 176.726 189.421 176.644 189.213 176.643H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 182.529C140.206 182.529 139.973 182.626 139.802 182.798C139.63 182.969 139.534 183.202 139.534 183.445C139.534 183.688 139.63 183.921 139.802 184.093C139.973 184.265 140.206 184.362 140.449 184.362H183.591C183.711 184.366 183.831 184.347 183.943 184.305C184.056 184.264 184.16 184.2 184.248 184.118C184.336 184.036 184.407 183.938 184.457 183.829C184.508 183.719 184.536 183.601 184.541 183.481C184.545 183.361 184.526 183.241 184.484 183.128C184.443 183.015 184.379 182.912 184.297 182.823C184.216 182.735 184.117 182.664 184.008 182.613C183.899 182.563 183.781 182.535 183.661 182.53C183.647 182.53 183.634 182.53 183.621 182.53L140.449 182.529Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 188.025C140.206 188.025 139.973 188.122 139.802 188.294C139.63 188.466 139.534 188.699 139.534 188.942C139.534 189.184 139.63 189.418 139.802 189.589C139.973 189.761 140.206 189.858 140.449 189.858H183.591C183.711 189.862 183.831 189.843 183.943 189.801C184.056 189.76 184.16 189.696 184.248 189.614C184.336 189.533 184.407 189.434 184.457 189.325C184.508 189.216 184.536 189.097 184.541 188.977C184.545 188.857 184.526 188.737 184.484 188.624C184.443 188.511 184.379 188.408 184.297 188.319C184.216 188.231 184.117 188.16 184.008 188.11C183.899 188.059 183.781 188.031 183.661 188.026C183.647 188.026 183.634 188.026 183.621 188.026H140.449L140.449 188.025Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M254.334 245H0.665646C0.297787 245 0 244.839 0 244.641C0 244.442 0.29813 244.281 0.665646 244.281H254.334C254.702 244.281 255 244.442 255 244.641C255 244.839 254.702 245 254.334 245Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.591 230.984C242.507 231.365 241.344 231.461 240.212 231.261C239.081 231.062 238.02 230.574 237.132 229.845C234.869 227.944 234.16 224.812 233.583 221.913L231.876 213.336L235.45 215.799C238.02 217.571 240.648 219.399 242.428 221.965C244.208 224.531 244.984 228.034 243.554 230.81",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.039 241.965C243.489 238.684 243.952 235.361 243.636 232.046C243.356 229.101 242.458 226.225 240.631 223.866C239.661 222.617 238.481 221.547 237.144 220.703C236.795 220.483 236.474 221.036 236.821 221.255C239.135 222.719 240.925 224.881 241.932 227.429C243.045 230.263 243.224 233.351 243.032 236.361C242.915 238.181 242.67 239.989 242.422 241.795C242.403 241.877 242.415 241.963 242.456 242.036C242.498 242.109 242.565 242.163 242.646 242.188C242.727 242.21 242.814 242.199 242.888 242.157C242.961 242.115 243.016 242.046 243.038 241.965H243.039Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M239.801 236.7C239.337 237.408 238.698 237.983 237.946 238.371C237.195 238.759 236.356 238.947 235.511 238.917C233.339 238.814 231.529 237.297 229.899 235.857L225.078 231.595L228.269 231.443C230.563 231.333 232.917 231.23 235.104 231.938C237.291 232.647 239.305 234.351 239.704 236.614",fill:"#E6E6E6"}),l.createElement("path",{d:"M244.311 243.85C242.147 240.015 239.633 235.752 235.145 234.389C233.897 234.011 232.589 233.876 231.29 233.991C230.88 234.025 230.983 234.658 231.393 234.622C233.57 234.441 235.742 235.017 237.545 236.252C239.28 237.434 240.631 239.077 241.774 240.82C242.474 241.885 243.101 243 243.728 244.111C243.928 244.466 244.514 244.21 244.311 243.85Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M127.423 133.05C130.456 133.05 132.914 130.59 132.914 127.554C132.914 124.518 130.456 122.058 127.423 122.058C124.391 122.058 121.933 124.518 121.933 127.554C121.933 130.59 124.391 133.05 127.423 133.05Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 126.527C124.731 126.527 124.68 126.938 124.68 127.443C124.68 127.949 124.731 128.36 124.795 128.36H130.194C130.257 128.368 130.309 127.965 130.31 127.459C130.345 127.144 130.307 126.825 130.197 126.528H124.795V126.527Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 162.376C130.456 162.376 132.914 159.915 132.914 156.879C132.914 153.844 130.456 151.383 127.423 151.383C124.391 151.383 121.933 153.844 121.933 156.879C121.933 159.915 124.391 162.376 127.423 162.376Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 155.853C124.731 155.853 124.68 156.263 124.68 156.768C124.68 157.274 124.731 157.685 124.795 157.685H130.194C130.257 157.693 130.309 157.29 130.31 156.784C130.345 156.469 130.307 156.15 130.197 155.853L124.795 155.853Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 191.69C130.456 191.69 132.914 189.229 132.914 186.194C132.914 183.158 130.456 180.697 127.423 180.697C124.391 180.697 121.933 183.158 121.933 186.194C121.933 189.229 124.391 191.69 127.423 191.69Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 185.167C124.731 185.167 124.68 185.577 124.68 186.083C124.68 186.589 124.731 186.999 124.795 186.999H130.194C130.257 187.007 130.309 186.604 130.31 186.098C130.345 185.784 130.307 185.465 130.197 185.167L124.795 185.167Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M145.875 59.6918L143.932 61.6367L160.204 77.9258L162.147 75.9808L145.875 59.6918Z",fill:"white"}),l.createElement("path",{d:"M162.147 61.6373L160.204 59.6924L143.932 75.9815L145.875 77.9264L162.147 61.6373Z",fill:"white"}),l.createElement("path",{d:"M71.002 156.83C71.478 156.662 71.9113 156.391 72.2713 156.036C72.6314 155.682 72.9094 155.253 73.0858 154.779C73.2622 154.305 73.3328 153.799 73.2925 153.295C73.2522 152.791 73.102 152.302 72.8526 151.863L80.9466 142.626L74.6282 141.754L67.9107 150.659C67.201 151.127 66.6875 151.84 66.4677 152.662C66.2479 153.484 66.3369 154.358 66.718 155.119C67.099 155.88 67.7456 156.474 68.5352 156.789C69.3248 157.105 70.2025 157.119 71.002 156.83Z",fill:"#9F616A"}),l.createElement("path",{d:"M80.7632 238.688L75.1182 238.688L72.4326 216.892L80.7642 216.892L80.7632 238.688Z",fill:"#9F616A"}),l.createElement("path",{d:"M82.2023 244.166L64 244.165V243.935C64.0001 242.054 64.7466 240.25 66.0752 238.92C67.4039 237.59 69.2058 236.843 71.0848 236.843H71.0853L82.2026 236.843L82.2023 244.166Z",fill:"#2F2E41"}),l.createElement("path",{d:"M110.313 233.959L104.922 235.634L95.9004 215.615L103.857 213.143L110.313 233.959Z",fill:"#9F616A"}),l.createElement("path",{d:"M113.311 238.763L95.9269 244.166L95.8586 243.945C95.3015 242.149 95.4801 240.205 96.3549 238.54C97.2298 236.876 98.7294 235.627 100.524 235.069L100.524 235.069L111.142 231.77L113.311 238.763Z",fill:"#2F2E41"}),l.createElement("path",{d:"M76.4396 138.198L68.0791 147.783L74.6244 148.373L76.4396 138.198Z",fill:"#a82227"}),l.createElement("path",{d:"M73.173 150.552C73.173 150.552 70.269 152.006 69.9059 158.546C69.5429 165.087 70.9951 182.167 70.9951 182.167C70.9951 182.167 69.5432 189.798 70.9951 196.702C72.4469 203.606 69.5432 228.678 71.3581 228.678C73.173 228.678 82.611 229.768 82.974 228.678C83.3371 227.587 83.7001 211.236 83.7001 211.236C83.7001 211.236 86.6042 202.878 83.7001 197.792C83.7001 197.792 93.8397 215.516 100.398 229.042C101.833 232.002 112.74 228.679 110.925 225.408C109.11 222.138 104.754 207.24 104.754 207.24C104.754 207.24 101.487 196.338 95.6794 191.614L98.5835 168.359C98.5835 168.359 104.755 152.733 101.125 150.553C97.4957 148.373 73.173 150.552 73.173 150.552Z",fill:"#2F2E41"}),l.createElement("path",{d:"M84.0629 91.322C89.2754 91.322 93.5009 87.0921 93.5009 81.8744C93.5009 76.6566 89.2754 72.4268 84.0629 72.4268C78.8505 72.4268 74.625 76.6566 74.625 81.8744C74.625 87.0921 78.8505 91.322 84.0629 91.322Z",fill:"#A0616A"}),l.createElement("path",{d:"M94.5899 92.0488L82.8568 98.9528C82.8568 98.9528 78.3642 101.485 76.686 105.857C74.8972 110.516 75.9369 117.075 76.686 118.575C78.1379 121.482 76.077 128.749 76.077 128.749L74.2621 145.464C74.2621 145.464 67.7282 151.642 72.8103 152.368C77.8923 153.095 86.9672 152.005 92.4123 152.368C97.8573 152.732 104.028 153.459 102.213 149.824C100.398 146.189 98.2204 143.647 100.398 136.381C102.103 130.694 102.029 109.431 101.916 100.451C101.901 99.2177 101.57 98.0091 100.956 96.9398C100.342 95.8706 99.4655 94.9763 98.4089 94.3421L94.5899 92.0488Z",fill:"#a82227"}),l.createElement("path",{opacity:"0.1",d:"M89.3278 103.496L90.4166 125.662L79.8631 147.056L78.0732 146.374L88.9634 126.388L89.3278 103.496Z",fill:"black"}),l.createElement("path",{opacity:"0.1",d:"M101.305 130.385V127.841L88.9648 148.19L101.305 130.385Z",fill:"black"}),l.createElement("path",{d:"M77.3647 73.1222L75.8057 72.4978C75.8057 72.4978 79.0687 68.9025 83.607 69.215L82.3303 67.8081C82.3303 67.8081 85.4508 66.5576 88.2879 69.8401C89.7792 71.5657 91.5045 73.5943 92.5813 75.879H94.2523L93.555 77.4162L95.9957 78.9535L93.4904 78.6784C93.7277 80.0055 93.6465 81.3701 93.2534 82.6596L93.3221 83.8746C93.3221 83.8746 90.4167 79.3743 90.4167 78.7499V80.3133C90.4167 80.3133 88.8563 78.9064 88.8563 77.9684L88.0052 79.0628L87.5796 77.3437L82.3314 79.0628L83.1818 77.6552L79.9188 78.1242L81.1955 76.405C81.1955 76.405 77.5076 78.4371 77.3658 80.1569C77.2239 81.8767 75.3802 84.0648 75.3802 84.0648L74.529 82.5014C74.529 82.5014 73.2527 75.4671 77.3647 73.1222Z",fill:"#2F2E41"}),l.createElement("path",{d:"M83.4712 157.858C83.9097 157.608 84.2881 157.264 84.5795 156.851C84.871 156.439 85.0685 155.967 85.1582 155.47C85.2478 154.972 85.2274 154.461 85.0984 153.972C84.9694 153.484 84.735 153.029 84.4116 152.641L90.7392 142.113L84.3665 142.377L79.3346 152.334C78.7192 152.921 78.3404 153.714 78.2698 154.562C78.1992 155.41 78.4419 156.255 78.9518 156.936C79.4617 157.617 80.2033 158.087 81.0363 158.257C81.8693 158.427 82.7356 158.285 83.4712 157.858Z",fill:"#9F616A"}),l.createElement("path",{d:"M97.8577 96.7735L100.58 96.2285C100.58 96.2285 108.748 102.224 106.206 114.215C103.665 126.207 92.4126 144.375 92.4126 144.375C92.4126 144.375 89.8709 147.646 89.1455 148.372C88.4201 149.099 86.9676 148.372 87.6937 149.463C88.4198 150.553 86.6045 151.279 86.6045 151.279C86.6045 151.279 78.6184 151.279 79.3445 148.372C80.0706 145.465 92.4126 124.752 92.4126 124.752L90.5977 105.493C90.5977 105.493 89.1452 96.0466 97.8577 96.7735Z",fill:"#a82227"})),l.createElement("defs",null)),l.createElement("h",{style:{color:"#505A5F",fontWeight:"400",fontFamily:"Roboto",marginLeft:"10%",lineHeight:"3"}},n("SURVEY_ENDED_MESSAGE"))),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},nu=e=>{if(!e)return;const t=[];for(const n in e)t.push({questionId:n,answer:[e[n]]});return t},lu={surveyDetails:[{id:1,ulb:"",tenantIds:"",name:"",description:"",fromDate:"",fromTime:"",toDate:"",toTime:""}],categories:[{id:1,title:"",weightage:100,selectCategory:"",questionStatement:"",questions:[],selectedQuestions:[]}],autoCalculateCategoriesWeight:!0,goPrev:!1,goNext:!1,stepData:{},step:1,isValid:!1,formData:{}},au=function(e,t){switch(void 0===e&&(e=lu),t.type){case"GO_PREV":return d({},e,{goPrev:!0});case"GO_NEXT":return d({},e,{goNext:!0});case"AUTO_CALCULATE_CATEGORY":return d({},e,{autoCalculateCategoriesWeight:t.categoryWeight});case"ADD_CATEGORY":const n=[...e.categories,{id:t.id,title:"",weightage:"",selectCategory:"",questions:[],selectedQuestions:[]}];return d({},e,{categories:n});case"RECALCULATE_WEIGHTAGE":const l=e.categories.map(t=>d({},t,{weightage:Math.floor(100/e.categories.length*100)/100}));return d({},e,{categories:l});case"DELETE_CATEGORY":const a=e.categories.filter(e=>e.id!==t.categoryId);return d({},e,{categories:a});case"ADD_QUESTIONS_LIST":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:questionsList}):e)});case"ADD_QUESTIONS":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{selectedQuestions:t.questions}):e)});case"UPDATE_QUESTION_WEIGHTAGE":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{selectedQuestions:e.selectedQuestions.map(e=>e.uuid===t.questionId?d({},e,{weightage:t.weightage}):e)}):e)});case"UPDATE_CATEGORY":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,t.data):e)});case"UPDATE_QUESTION_SELECTION":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?d({},e,{selected:t.selected}):e)}):e)});case"UPDATE_MANDATORY_QUESTION_SELECTION":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?d({},e,{mandatory:t.mandatory}):e)}):e)});case"SET_QUESTIONS":return d({},e,{categories:e.categories.map(e=>e.id===t.categoryId?d({},e,{questions:t.questions}):e)});case"NEXT_STEP":return d({},e,{step:e.step+1});case"PREVIOUS_STEP":return d({},e,{step:e.step-1});case"SET_STEP_DATA":return d({},e,{stepData:d({},e.stepData,{[t.step]:t.data})});case"UPDATE_SURVEY_FORM":return d({},e,{formData:d({},e.formData,{[t.payload.key]:t.payload.value})});case"SET_SURVEY_STEP":return d({},e,{step:t.payload});case"FIELD_CHANGE":return d({},e,{surveyDetails:e.surveyDetails.map(e=>e.id===t.surveyId?d({},e,t.data):e)});case"RESET_FORM":return lu;default:return e}},ou=e=>{let{style:t={}}=e;return l.createElement("hr",{color:"#d6d5d4",className:"break-line",style:t})},iu=["onClick","style","children","className","ReactRef"],ru=e=>{var t;let{onClick:n,style:a,children:i,className:r,ReactRef:u}=e,s=m(e,iu);const{pathname:c}=o.useLocation(),v=Digit.Hooks.fsm.useRouteSubscription(c),p=null===(t=Digit.UserService.getUser())||void 0===t?void 0:t.info;return l.createElement("div",d({className:("employee"===v||"EMPLOYEE"===(null==p?void 0:p.type)?"employeeCard":"card")+" "+(r||""),onClick:n,style:a},s,{ref:u}),i)},uu=e=>l.createElement("h2",{className:"card-label "+e.className,style:e.style},e.children),su=e=>l.createElement("p",{className:"card-text "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),cu=e=>{const t="employee"===Digit.SessionStorage.get("user_type");return l.createElement("header",{className:(t?"employee-card-sub-header":"card-sub-header")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children)},du=e=>l.createElement("header",{id:e.id,className:"card-section-header",style:e.style},e.children),mu=e=>{let{children:t,style:n,className:a}=e;return l.createElement("h2",{className:"card-label-desc "+(a||""),style:n},t)},vu=e=>l.createElement("h2",{className:"card-label-error "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),pu=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("textarea",{placeholder:e.placeholder,name:e.name,ref:e.inputRef,style:e.style,id:e.id,value:e.value,onChange:e.onChange,className:("citizen"!==t?"employee-card-textarea":"card-textarea")+" "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),minLength:e.minLength,maxLength:e.maxLength,autoComplete:"off",disabled:e.disabled}),l.createElement("p",{className:"cell-text"},e.hintText))};pu.propTypes={userType:ln.string,name:ln.string.isRequired,ref:ln.func,value:ln.string,onChange:ln.func,id:ln.string},pu.defaultProps={ref:void 0,onChange:void 0};const Eu=e=>{var t,a,o,i,r,u,s;const c=Digit.SessionStorage.get("userType"),[m,v]=n.useState(),p=null!=e&&e.watch?{fromDate:null==e?void 0:e.watch("fromDate"),toDate:null==e?void 0:e.watch("toDate")}:{},E=e=>{const{value:t}=e.target;v(function(e){return e?new Date(e).toLocaleString("en-In").split(",")[0]:""}(t))};return l.createElement(l.Fragment,null,l.createElement("div",{className:"text-input "+("employee"===c?"":"text-input-width")+" "+e.className,style:null!=e&&e.textInputStyle?d({},e.textInputStyle):{}},l.createElement("input",e.isMandatory?{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(t=e.validation)||void 0===t?void 0:t.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input-error":"card-input-error")+" "+(e.disable&&"disabled"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&E(t)},ref:e.inputRef,value:e.value,style:d({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(a=e.validation)||void 0===a?void 0:a.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(o=e.validation)||void 0===o?void 0:o.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off",disabled:e.disabled}:{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(i=e.validation)||void 0===i?void 0:i.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&E(t)},ref:e.inputRef,value:e.value,style:d({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,required:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(r=e.validation)||void 0===r?void 0:r.isRequired:e.isRequired||"date"===e.type&&("fromDate"===e.name?p.toDate:p.fromDate),pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(u=e.validation)||void 0===u?void 0:u.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(s=e.validation)||void 0===s?void 0:s.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,onKeyPress:e.onKeyPress,autoComplete:"off",disabled:e.disabled}),e.signature?e.signatureImg:null))};Eu.propTypes={userType:ln.string,isMandatory:ln.bool,name:ln.string,placeholder:ln.string,onChange:ln.func,ref:ln.func,value:ln.any},Eu.defaultProps={isMandatory:!1};const gu=e=>l.createElement("div",{className:"action-bar-wrap "+e.className,style:e.style},e.children),fu=n.forwardRef((e,t)=>l.createElement("button",d({ref:t,disabled:!!e.disabled,className:(e.disabled?"submit-bar-disabled":"submit-bar")+" "+(e.className?e.className:""),type:e.submit?"submit":"button",style:d({},e.style),onClick:e.onSubmit},e.form?{form:e.form}:{}),e.label));fu.propTypes={submit:ln.any,style:ln.object,label:ln.string,onSubmit:ln.func},fu.defaultProps={};const hu=e=>l.createElement("div",{style:d({},e.style),className:"label-field-pair"},e.children),yu=e=>{const t=e.className&&e.className.includes("submit-bar")?e.style:d({},yu.defaultProps.style,e.style);return l.createElement("button",{className:"card-link cp "+(e.className||""),onClick:e.onClick,style:t},e.label)};yu.propTypes={label:ln.any,onClick:ln.func,style:ln.object},yu.defaultProps={style:{}};const Su=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("div",{className:"field-container"},l.createElement("div",{className:"text-input "+("EMPLOYEE"===t?"":"text-mobile-input-width")+" "+e.className,style:{position:"relative"}},!e.hideSpan&&l.createElement("span",{className:"mobile-number-prefix"},"+91"),l.createElement("input",{type:"text",name:e.name,id:e.id,className:(t?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error")+" "+(e.hideSpan?"":"mobile-number-input-with-prefix"),placeholder:e.placeholder,onChange:t=>{var n;let l=t.target.value;(isNaN(l)||[" ","e","E"].some(e=>l.includes(e))||l.length>(e.maxLength||10))&&(l=l.slice(0,-1)),null==e||null===(n=e.onChange)||void 0===n||n.call(e,l)},ref:e.inputRef,value:e.value,style:e.style,minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:e.pattern,min:e.min,readOnly:e.disable,title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off"}))))};Su.propTypes={userType:ln.string,isMandatory:ln.bool,name:ln.string,placeholder:ln.string,onChange:ln.func,ref:ln.func,value:ln.any},Su.defaultProps={isMandatory:!1};const bu=e=>{var t;const{register:o,handleSubmit:r,setValue:u,getValues:s,reset:c,watch:m,control:v,formState:p,errors:E,setError:g,clearErrors:f,setApi:h}=i.useForm({defaultValues:e.defaultValues}),{t:y}=a.useTranslation(),S=m();n.useEffect(()=>{var t,n,l,a,o,i,r;const u=sessionStorage.getItem("eyeIconClicked");null!=e&&e.appData&&(null==e||null===(t=e.appData)||void 0===t||null===(n=t.ConnectionHolderDetails)||void 0===n||null===(l=n[0])||void 0===l||!l.sameAsOwnerDetails)&&u&&(null===(a=Object.keys(null==e?void 0:e.appData))||void 0===a?void 0:a.length)>0&&!Ja.isEqual(null==e||null===(o=e.appData)||void 0===o||null===(i=o.ConnectionHolderDetails)||void 0===i?void 0:i[0],null==S||null===(r=S.ConnectionHolderDetails)||void 0===r?void 0:r[0])&&c(d({},null==e?void 0:e.appData))},[null==e?void 0:e.appData,S,null==e||null===(t=e.appData)||void 0===t?void 0:t.ConnectionHolderDetails]),n.useEffect(()=>{e.getFormAccessors&&e.getFormAccessors({setValue:u,getValues:s})},[]),n.useEffect(()=>{e.onFormValueChange&&e.onFormValueChange(u,S,p)},[S]);const b=function(e,t,n,a,r,s){void 0===a&&(a=!1);const c="string"==typeof r?Digit.ComponentRegistryService.getComponent(r):r;switch(e){case"text":case"date":case"number":case"password":case"time":return l.createElement("div",{className:"field-container"},null!=t&&t.componentInFront?l.createElement("span",{className:"component-in-front "+(a&&"disabled")},t.componentInFront):null,l.createElement(Eu,d({className:"fieldNew"},t,{inputRef:o(t.validation),isRequired:n,type:e,disable:a,watch:m})));case"textarea":return l.createElement(pu,d({className:"field",name:(null==t?void 0:t.name)||""},t,{inputRef:o(t.validation),disable:a}));case"mobileNumber":return l.createElement(i.Controller,{render:e=>l.createElement(Su,{className:"field",onChange:e.onChange,value:e.value,disable:a}),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:v});case"custom":return l.createElement(i.Controller,{render:e=>t.component(d({},e,{setValue:u}),t.customProps),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:v});case"component":return l.createElement(i.Controller,{render:e=>l.createElement(c,{userType:"employee",t:y,setValue:u,onSelect:u,config:s,data:S,formData:S,register:o,errors:E,props:e,setError:g,clearErrors:f,formState:p,onBlur:e.onBlur,setApi:h}),name:s.key,control:v});case"form":return l.createElement("form",null,l.createElement(c,{userType:"employee",t:y,setValue:u,onSelect:u,config:s,data:S,formData:S,register:o,errors:E,setError:g,clearErrors:f,formState:p,control:v}));default:return!1!==(null==t?void 0:t.dependency)?t:null}},_=e=>{switch(e){case 0:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"};case 1:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",borderTop:"0px",borderBottom:"0px"};case 2:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px",borderTop:"0px"}}},C={color:"#505A5F",fontWeight:"700",fontSize:"16px"},T=n.useMemo(()=>{var t;return null===(t=e.config)||void 0===t?void 0:t.map((t,a,o)=>l.createElement(l.Fragment,{key:a},t&&(t=>t.head&&t.subHead?l.createElement(n.Fragment,null,l.createElement(du,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{margin:"5px 0px"},id:t.headId},y(t.head)),l.createElement(du,{style:C,id:t.headId+"_DES"},y(t.subHead))):t.head?l.createElement(n.Fragment,null,l.createElement(du,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{},id:t.headId},y(t.head)),l.createElement("div",{style:null!=e&&e.lineStyle?null==e?void 0:e.lineStyle:{}})):l.createElement("div",null))(t),t.body.map((t,a)=>{var o,i,r,u,s,c,m,v;return e.inline?l.createElement(l.Fragment,{key:a},l.createElement("div",{style:t.isInsideBox?_(null==t?void 0:t.placementinbox):{}},!t.withoutLabel&&l.createElement(uu,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"},className:null!=t&&t.disable?"disabled":""},y(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),E&&E[null===(o=t.populators)||void 0===o?void 0:o.name]&&Object.keys(E[null===(i=t.populators)||void 0===i?void 0:i.name]).length?l.createElement(vu,null,y(t.populators.error||(null===(r=E[null===(u=t.populators)||void 0===u?void 0:u.name])||void 0===r?void 0:r.message))):null,l.createElement("div",{style:t.withoutLabel?{width:"100%"}:{},className:"field"},b(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(uu,{style:d({marginTop:"-24px",fontSize:"16px",fontWeight:"bold",color:"#505A5F"},null==t?void 0:t.descriptionStyles)},y(t.description))))):l.createElement(n.Fragment,null,l.createElement(hu,{key:a},!t.withoutLabel&&l.createElement(uu,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"}},y(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),l.createElement("div",{style:t.withoutLabel?d({width:"100%"},null==e?void 0:e.fieldStyle):{},className:"field"},b(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(su,{style:{fontSize:"14px",marginTop:"-24px"}},y(null==t?void 0:t.description)))),null!=t&&null!==(s=t.populators)&&void 0!==s&&s.name&&E&&E[null==t||null===(c=t.populators)||void 0===c?void 0:c.name]&&Object.keys(E[null==t||null===(m=t.populators)||void 0===m?void 0:m.name]).length?l.createElement(vu,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},y(null==t||null===(v=t.populators)||void 0===v?void 0:v.error)):null)}),!e.noBreakLine&&(o.length-1===a?null:l.createElement(ou,{style:null!=e&&e.breaklineStyle?null==e?void 0:e.breaklineStyle:{}}))))},[e.config,S]),D=e.isDisabled||!1;return console.log(e),l.createElement("form",{onSubmit:r(function(t){e.onSubmit(t)}),onKeyDown:e=>(e=>{13===(e.keyCode?e.keyCode:e.key?e.key:e.which)&&e.preventDefault()})(e),id:e.formId,className:e.className},l.createElement(ru,{style:!0===(null==e?void 0:e.box)?{boxShadow:"none",padding:"20px 48px 48px"}:null},!e.childrenAtTheBottom&&e.children,e.heading&&l.createElement(cu,{className:"headerStyle"}," ",e.heading," "),e.description&&l.createElement(mu,{style:{fontSize:"16px"},className:"descStyle"}," ",e.description," "),e.text&&l.createElement(su,{className:"labelStyle"},e.text),T,e.childrenAtTheBottom&&e.children,e.secondaryActionLabel&&l.createElement("div",{className:"primary-label-btn text-align-right",style:{margin:"20px auto 0 auto"},onClick:function(t){e.onSecondayActionClick()}},e.secondaryActionLabel),e.submitInForm&&l.createElement(fu,{label:y(e.label),style:d({},null==e?void 0:e.buttonStyle),submit:"submit",disabled:D,className:"submitButtonNew"}),!e.submitInForm&&e.label&&l.createElement(gu,null,e.currentStep>1&&l.createElement("button",{onClick:()=>{e.onBackClick&&e.onBackClick(S)},className:"submit-bar submit-bar-back"},y("COMMON_BACK")),l.createElement(fu,{label:y(e.label),submit:"submit",disabled:D}),e.onSkip&&e.showSkip&&l.createElement(yu,{style:null==e?void 0:e.skipStyle,label:y("CS_SKIP_CONTINUE"),onClick:e.onSkip}))))},_u=e=>{let{category:o,checked:i,readOnly:r,onDelete:s,hideQuestionLabel:c}=e;const m=u.useDispatch(),{t:v}=a.useTranslation(),p=Digit.ULBService.getCurrentTenantId(),[E,g]=n.useState(r),[f,h]=n.useState(r),[y,S]=n.useState(""),[b,_]=n.useState({}),[C,T]=n.useState([]),[D,N]=n.useState([]),[A,w]=n.useState(null),x=u.useSelector(e=>e.engagement.surveyForm);n.useEffect(()=>{let e={tenantId:p,id:null};try{Digit.Surveys.searchCategory(e).then(e=>{var t;if((null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0){const t=e.Categories.filter(e=>e.isActive).map(e=>({title:v(e.label),i18Key:e.label,value:e.id}));T(t)}})}catch(e){return e}},[]);const I=e=>{const{name:t,value:n}=e.target;m(pr(o.id,{[t]:n}))},[L,O]=n.useState(!1),[R,P]=n.useState(!1);function M(){O(!1)}return l.createElement("div",{className:"category-card"},l.createElement("h3",null,"Section Title ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"title",value:o.title,readOnly:r,onChange:I,placeholder:"Section Title",required:!0}),l.createElement("h3",null,"Section Weightage"),l.createElement("input",{type:"number",name:"weightage",value:o.weightage,onChange:I,onWheel:e=>e.target.blur(),readOnly:i,placeholder:"Section Weightage",required:!0}),(!1===r||void 0===r)&&l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",marginBottom:"5px"}},l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},onClick:()=>g(!E)},"Add Questions"),l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"red",color:"white",cursor:"pointer"},onClick:()=>{s(o.id)}},"Delete Section")),(E||!0===x.goPrev)&&l.createElement("div",null,l.createElement("h3",null,"Select Category"),l.createElement(t.Dropdown,{required:!0,t:v,id:"selectCategory",name:"selectCategory",option:C,select:e=>{m(pr(o.id,{selectCategory:e})),m(gr(o.id,[])),h(!1)},placeholder:"Select Category",optionKey:"i18Key",selected:o.selectCategory||null}),(!1===r||void 0===r)&&l.createElement("h3",null,"Search Question"),(!1===r||void 0===r)&&l.createElement("input",{type:"text",name:"questionStatement",value:o.questionStatement,onChange:I,placeholder:"Search Question",readOnly:r}),(!1===r||void 0===r)&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:r,onClick:()=>{var e;""===o.selectCategory?w({key:!0,isError:!0,label:"PLEASE SELECT A CATEGORY"}):((e,t)=>{let n={categoryId:e,tenantId:p,questionStatement:t,status:"ACTIVE"};try{Digit.Surveys.searchQuestions(n).then(e=>{var t;if((null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0){let t=[];e.Questions.map(e=>{let n=d({},e,{selected:!1});t.push(n)}),t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),console.log("arr",t),m(gr(o.id,t)),N(t),h(!0),w({key:!0,isError:!1,label:"QUESTIONS RETRIEVED"})}else m(gr(o.id,[])),N([]),h(!1),w({key:!0,isError:!0,label:"NO QUESTIONS FOUND"})})}catch(e){m(gr(o.id,[])),N([]),h(!1)}})(null===(e=o.selectCategory)||void 0===e?void 0:e.value,o.questionStatement)}},"Go"),f&&1!=c&&o.questions.length>0&&l.createElement("div",null,l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Question Label"),l.createElement("th",null,"Select"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.questions.map(e=>l.createElement("tr",{key:null==e?void 0:e.uuid},l.createElement("td",null,l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;console.log("question: ",e),O(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,v(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));P(n)}(e)},null==e?void 0:e.questionStatement),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},v("Click here to view the question details"))))),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{m(((e,t,n)=>({type:"UPDATE_QUESTION_SELECTION",categoryId:e,questionId:t,selected:n}))(o.id,e.uuid,t.target.checked))},checked:e.selected})),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{m(Er(o.id,e.uuid,t.target.checked))}}))))))),(!1===r||void 0===r)&&f&&o.questions.length>0&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginTop:"10px"},disable:r,onClick:()=>{const e=o.questions.filter(e=>e.selected);if(o.questions.some(e=>e.mandatory&&!e.selected))return void w({key:!0,isError:!0,label:"MANDATORY QUESTIONS MUST BE SELECTED"});if(0===e.length)return void w({key:!0,isError:!0,label:"PLEASE SELECT ATLEAST ONE QUESTION"});const t=e.filter(e=>!o.selectedQuestions.some(t=>t.uuid===e.uuid)),n=e.filter(e=>o.selectedQuestions.some(t=>t.uuid===e.uuid));let l=null;n.length>0&&n.map(e=>{l=o.selectedQuestions.findIndex(t=>t.uuid===e.uuid),o.selectedQuestions.map(t=>{t.uuid===e.uuid&&m(Er(o.id,e.uuid,e.mandatory))}),o.selectedQuestions[l].mandatory=e.mandatory});const a=o.selectCategory.title,i=[...o.selectedQuestions,...t.map(e=>d({},e,{selectedCategory:a}))],r=i.map(e=>d({},e,{weightage:Math.floor(100/i.length*100)/100}));m(vr(o.id,r))}},"Add These Questions"),l.createElement("div",null,o.selectedQuestions.length>0||!0===r?l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Selected Category"),l.createElement("th",null,"Question Statement"),l.createElement("th",null,"Weightage"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.selectedQuestions.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.uuid},l.createElement("td",null,e.selectedCategory),l.createElement("td",null,e.questionStatement),l.createElement("td",null,l.createElement("input",{type:"text",defaultValue:e.weightage,value:e.weightage,required:!0,onChange:n=>((e,t,n)=>{let l={};/^\d*(\.\d{0,2})?$/.test(n)?(m(((e,t,n)=>({type:"UPDATE_QUESTION_WEIGHTAGE",categoryId:e,questionId:t,weightage:n}))(o.id,t,n)),l={},_(l)):(l[e]={weightage:"Invalid weightage value. Please enter a number or decimal upto 2 decimal points"},_(l))})(t,e.uuid,n.target.value)}),"undefined"!=(null===(n=b[t])||void 0===n?void 0:n.weightage)&&l.createElement("span",{className:"error"},null===(a=b[t])||void 0===a?void 0:a.weightage)),l.createElement("td",null,!0===(null==e?void 0:e.mandatory)?"True":"False"),l.createElement("td",null,l.createElement("label",{onClick:()=>(e=>{const t=o.selectedQuestions.filter(t=>t.uuid!==e.uuid),n=t.length,l=t.map(e=>d({},e,{weightage:Math.floor(100/n*100)/100}));m(vr(o.id,l))})(e)},"Delete")))}))):null)),L&&l.createElement(pi,{onSelect:function(){O(!1)},onCancel:M,onDismiss:M,heading:"Question Details",actionCancel:!0,content:R,hideSubmit:!0}),A&&l.createElement(t.Toast,{error:A.isError,label:v(A.label),onClose:()=>{w(null)},isDleteBtn:"false",labelstyle:{color:"white",width:"100%"}}))},Cu=e=>{let{readOnly:t,hideQuestionLabel:a}=e;const o=u.useSelector(e=>e.engagement.surveyForm.categories),i=u.useSelector(e=>e.engagement.surveyForm.autoCalculateCategoriesWeight),r=u.useDispatch(),[s,c]=n.useState(i);console.log("categories",o);const[d,m]=n.useState(2),v=e=>{console.log("checked",s),1!==o.length?i?(r(fr(e)),r({type:"RECALCULATE_WEIGHTAGE"})):r(fr(e)):alert("Atleast one category must be there")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},o.map(e=>l.createElement(_u,{key:e.id,category:e,checked:i,readOnly:t,onDelete:v,hideQuestionLabel:a})),!0!==t&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginBottom:"10px"},onClick:()=>{console.log("checked",i),!0===i?(r(mr(d)),r({type:"RECALCULATE_WEIGHTAGE"}),m(d+1)):(r(mr(d)),m(d+1))}},"Add Section"),l.createElement("div",{style:{marginTop:"20px"}},l.createElement("div",{style:{display:"flex",columnGap:"20px"}},l.createElement("input",{style:{height:"20px",width:"20px"},type:"checkbox",checked:i,disabled:t,onChange:e=>{console.log("e checked",e.target.checked),r((e=>({type:"AUTO_CALCULATE_CATEGORY",categoryWeight:e}))(e.target.checked)),c(e.target.checked),!0===e.target.checked&&r({type:"RECALCULATE_WEIGHTAGE"})}}),"Auto Calculate Category Weightage")))},Tu=()=>{const[e,t]=n.useState({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}}),a=(i.useForm({defaultValues:e}),(e,n)=>{const{value:l,checked:a}=n.target;t(t=>{const n=a?[...t[e].checkboxes,l]:t[e].checkboxes.filter(e=>e!==l);return d({},t,{[e]:d({},t[e],{checkboxes:n})})})}),o=(e,n)=>{const{name:l,value:a}=n.target;t(t=>d({},t,{[e]:d({},t[e],{[l]:a})}))};console.log("formData",e);const[r,u]=n.useState({});return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Title : Citizen Survey"),l.createElement("div",null,l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Description : This is a sample citizen survey")),l.createElement("form",{onSubmit:t=>{t.preventDefault(),(()=>{const t={};return e.name?/^[A-Za-z\s]+$/.test(e.name)||(t.name="Name can only contain alphabets and spaces"):t.name="Name is required",e.relationName?/^[A-Za-z\s]+$/.test(e.relationName)||(t.relationName="Relation Name can only contain alphabets and spaces"):t.relationName="Father/Husband Name is required",e.email?/\S+@\S+\.\S+/.test(e.email)||(t.email="Email is invalid"):t.email="Email is required",e.mobile?/^\d{10}$/.test(e.mobile)||(t.mobile="Mobile number is invalid"):t.mobile="Mobile number is required",e.relation||(t.relation="Relation is required"),e.address||(t.address="Address is required"),e.dob||(t.dob="Date of Birth is required"),!e.section1.checkboxes.length>0&&(t.checkboxes="This question is required to answer"),e.section1.shortText||(t.shortText="This question is required to answer"),e.section2.multipleChoice||(t.multipleChoice="This question is required to answer"),u(t),0===Object.keys(t).length})()&&console.log("Form submitted:",e)}},l.createElement(Sr,{formData:e,setFormData:t,errors:r,relationList:[{label:"Father",value:"Father"},{label:"Husband",value:"Husband"}]}),l.createElement("div",null,l.createElement("h2",null,"Section 1"),l.createElement("div",null,l.createElement("h3",null,"What is your feedback?"),l.createElement("div",null,l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option1",style:{width:"20px",height:"20px",marginRight:"10px"},checked:e.section1.checkboxes.includes("option1"),onChange:e=>a("section1",e)}),"Option 1"),l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option2",style:{width:"20px",height:"20px",marginRight:"10px",color:"#0d43a7"},checked:e.section1.checkboxes.includes("option2"),onChange:e=>a("section1",e)}),"Option 2"),r.checkboxes&&l.createElement("span",{className:"error"},r.checkboxes))),l.createElement("div",null,l.createElement("h3",null,"Tell us more about your product quality?"),l.createElement("div",null,l.createElement("input",{type:"text",name:"shortText",placeholder:"enter here",value:e.section1.shortText,onChange:e=>o("section1",e)}),r.shortText&&l.createElement("span",{className:"error"},r.shortText)))),l.createElement("div",null,l.createElement("h2",null,"Section 2"),l.createElement("div",null,l.createElement("h3",null,"Give your rating?"),l.createElement("div",null,l.createElement("select",{name:"multipleChoice",value:e.section2.multipleChoice,onChange:e=>o("section2",e)},l.createElement("option",{value:""},"Select an option"),l.createElement("option",{value:"choice1"},"Choice 1"),l.createElement("option",{value:"choice2"},"Choice 2"))),r.multipleChoice&&l.createElement("span",{className:"error"},r.multipleChoice))),l.createElement("button",{type:"submit"},"Submit"),l.createElement("button",{style:{backgroundColor:"none",marginLeft:"10px"},onClick:()=>t({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}})},"Reset"))))},Du=()=>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"})),Nu=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Du,null)),Au=e=>{let{isOpen:i,onClose:r}=e;const u=o.useHistory(),{t:s}=a.useTranslation(),c=Digit.UserService.getUser().info,[d,m]=n.useState(!0),[v,p]=n.useState([]),[E,g]=n.useState(!1),f=localStorage.getItem("CITIZEN.CITY");return console.log(f,"TENANTTTTTT"),n.useEffect(()=>{const e=sessionStorage.getItem("survey_modal_data");if(e)try{const t=JSON.parse(e);p(t),g(!0),m(!1)}catch(e){console.error("Failed to parse cached survey data",e)}},[]),n.useEffect(()=>{i&&f&&!E&&(m(!0),Digit.Surveys.searchSurvey({tenantId:f,active:!0,openSurveyFlag:!0}).then(e=>{let t=e.Surveys.filter(e=>e.active);t=t.sort((e,t)=>t.auditDetails.lastModifiedTime-e.auditDetails.lastModifiedTime),p(t),sessionStorage.setItem("survey_modal_data",JSON.stringify(t)),g(!0),m(!1)}).catch(e=>{g(!0),m(!1),console.error("Failed to fetch surveys",e)}))},[i,f,E]),i?!E||E&&0===v.length?null:l.createElement(t.Modal,{headerBarMain:l.createElement("div",{className:"survey-modal-header"},l.createElement("span",null,s("Active Surveys")),(null==v?void 0:v.length)>0&&l.createElement("span",{className:"survey-badge"},v.length)),headerBarEnd:l.createElement(Nu,{onClick:r}),hideSubmit:!0,popupStyles:{width:"95%",maxWidth:"600px",height:"auto",maxHeight:"90vh",borderRadius:"16px",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.15)",padding:"15px"},popupModuleMianStyles:{maxHeight:"calc(90vh - 120px)",overflowY:"auto",padding:"24px",backgroundColor:"#f9fafb"}},l.createElement("div",{className:"survey-modal-wrapper"},d?l.createElement("div",{className:"survey-modal-loader"},l.createElement(t.Loader,null)):v&&v.length>0?l.createElement("div",{className:"new-card-cards-grid"},null==v?void 0:v.map((e,n)=>l.createElement("div",{key:n,className:"new-card-option"},l.createElement("h3",{className:"survey-card-title"},null==e?void 0:e.surveyTitle),l.createElement("div",{className:"survey-card-container"},l.createElement("div",{className:"survey-card-field"},l.createElement("span",{className:"survey-card-label"},"Start Date:"),l.createElement("p",{className:"survey-card-value"},null!=e&&e.startDate?we(new Date(null==e?void 0:e.startDate),"dd/MM/yyyy"):"NA")),(null==e?void 0:e.endDate)&&l.createElement("div",{className:"survey-card-field"},l.createElement("span",{className:"survey-card-label"},"End Date:"),l.createElement("p",{className:"survey-card-value"},we(new Date(null==e?void 0:e.endDate),"dd/MM/yyyy"))),l.createElement("div",{className:"survey-card-field"},l.createElement("span",{className:"survey-card-label"},"Description:"),l.createElement("p",{className:"survey-card-value"},(null==e?void 0:e.surveyDescription)||"No description available"))),l.createElement(t.SubmitBar,{label:s("Start Survey"),onSubmit:()=>(u.push({pathname:"/digit-ui/citizen/engagement/surveys/fill-survey",state:{surveyDetails:e,userInfo:c,userType:"citizen"}}),void r())})))):l.createElement("div",{className:"survey-modal-empty-state"},l.createElement("p",null,s("No active surveys available at this time")),l.createElement("p",null,"Please check back later for new surveys")))):null},wu=e=>{let{location:n}=e;const{t:i}=a.useTranslation(),r=o.useHistory(),u=o.useLocation().search,s=new URLSearchParams(u).get("from")||null,c=[{path:"/digit-ui/employee",content:i("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/engagement/event/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("event/inbox")},{path:"/digit-ui/employee/event/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/new-event")},{path:"/digit-ui/employee/event/inbox/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/inbox/new-event")},{path:"/digit-ui/employee/event/inbox/event-details",content:i("ES_EVENT_EVENT_DETAILS"),show:!!n.pathname.includes("event-details")},{path:"/digit-ui/employee/engagement/event/edit-event",content:i("ES_EVENT_EDIT_EVENT"),show:!!n.pathname.includes("event/edit-event")},{path:"/digit-ui/employee/event/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("event/response")},{path:"/digit-ui/employee/engagement/documents/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/documents/inbox")},{path:"/digit-ui/employee/engagement/documents/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/new-doc")},{path:"/digit-ui/employee/engagement/documents/inbox/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/inbox/new-doc")},{path:"/digit-ui/employee/engagement/documents/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/response")},{path:"/digit-ui/employee/engagement/documents/delete-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/delete-response")},{path:"/digit-ui/employee/engagement/documents/update-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/update-response")},{path:"/digit-ui/employee/engagement/documents/inbox/details/:id",content:i("CE_DOCUMENT_DETAILS"),show:!!n.pathname.includes("/documents/inbox/details")},{path:"/digit-ui/employee/engagement/documents/inbox/update",content:i("DOCUMENTS_EDIT_HEADER"),show:!!n.pathname.includes("/documents/inbox/update")},{path:"/digit-ui/employee/engagement/messages/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/messages/inbox")},{path:"/digit-ui/employee/engagement/messages/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/create")},{path:"/digit-ui/employee/engagement/messages/inbox/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/create")},{path:"/digit-ui/employee/engagement/messages/inbox/details/:id",content:i("CS_HEADER_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/details")},{path:"/digit-ui/employee/engagement/messages/inbox/edit/:id",content:i("EDIT_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/edit")},{path:"/digit-ui/employee/engagement/messages/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response")},{path:"/digit-ui/employee/engagement/messages/response?update=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?update=true")},{path:"/digit-ui/employee/engagement/messages/response?delete=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?delete=true")},{path:"/digit-ui/employee/engagement/surveys/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/surveys/inbox")},{path:"/digit-ui/employee/engagement/surveys/create-survey-step-form",content:s?i(s)+" / "+i("CS_COMMON_SURVEYS"):i("CS_COMMON_SURVEYS"),show:!!n.pathname.includes("/surveys/create-survey-step-form"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-category",content:s?i(s)+" / "+i("Create Category"):i("Create Category"),show:!!n.pathname.includes("/surveys/create-category"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-categories",content:s?i(s)+" / "+i("Search Categories"):i("Search Categories"),show:!!n.pathname.includes("/surveys/search-categories"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-questions",content:s?i(s)+" / "+i("Create Questions"):i("Create Questions"),show:!!n.pathname.includes("/surveys/create-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/search-questions",content:s?i(s)+" / "+i("Search Questions"):i("Search Questions"),show:!!n.pathname.includes("/surveys/search-questions"),isBack:s&&!0},{path:"/digit-ui/employee/engagement/surveys/create-response",content:s?i(s)+" / "+i("ES_EVENT_NEW_EVENT_RESPONSE"):i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/surveys/create-response"),isBack:s&&!0}];return l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"}},l.createElement(t.BreadCrumb,{crumbs:c}),l.createElement("p",{className:"breadcrumb"},l.createElement("button",{onClick:()=>{r.goBack()},style:{cursor:"pointer",color:"#666"}},"<"," ",i("CS_COMMON_BACK"))))},xu=e=>{let{path:t,userType:a,tenants:i,stateCode:r}=e;const u=o.useLocation();return l.createElement(n.Fragment,null,l.createElement(wu,{location:u}),l.createElement(o.Switch,null,l.createElement(o.Route,{path:t+"/event/inbox",exact:!0},l.createElement(Ke,{tenants:i,parentRoute:t})),l.createElement(o.Route,{path:t+"/event/response",component:e=>l.createElement(Pe,e)}),l.createElement(o.Route,{path:t+"/event/inbox/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/edit-event/:id"},l.createElement(Oe,null)),l.createElement(o.Route,{path:t+"/event/inbox/event-details/:id"},l.createElement(ei,null)),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/update",component:e=>l.createElement(_i,e)}),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/new-doc",component:()=>l.createElement(Si,{path:t})}),l.createElement(o.Route,{exact:!0,path:t+"/documents/new-doc",component:()=>l.createElement(Si,{path:t})}),l.createElement(o.Route,{path:t+"/documents/inbox/details/:id",component:e=>l.createElement(Vi,e)}),l.createElement(o.Route,{path:t+"/documents/response",component:e=>l.createElement(Ti,e)}),l.createElement(o.Route,{path:t+"/documents/update-response",component:e=>l.createElement(Ni,e)}),l.createElement(o.Route,{path:t+"/documents/delete-response",component:e=>l.createElement(wi,e)}),l.createElement(o.Route,{path:t+"/documents/inbox",component:e=>l.createElement(Fi,{tenants:i})}),l.createElement(o.Route,{path:t+"/messages",component:e=>l.createElement(Go,d({},e,{tenants:i,parentRoute:t}))}),l.createElement(o.Route,{path:t+"/surveys",component:e=>l.createElement(eu,d({},e,{tenants:i,parentRoute:t,userType:a,stateCode:r}))})))},Iu={EngagementModule:e=>{let{stateCode:n,userType:a,tenants:i}=e;const{path:r,url:u}=o.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:c}=Digit.Services.useStore({stateCode:n,moduleCode:"Engagement",language:s});return c?l.createElement(t.Loader,null):(Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i),"citizen"===a?l.createElement(hi,{path:r,url:u,userType:a,tenants:i}):l.createElement(xu,{path:r,url:u,userType:a,tenants:i,stateCode:n}))},EngagementCard:()=>{var e,o;const i=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(o=e.info)||void 0===o?void 0:o.roles).find(e=>"EMPLOYEE"===e.code);if(n.useEffect(()=>{Digit.SessionStorage.set("CITIZENSURVEY.INBOX",null)},[]),!i)return null;const r=Digit.ULBService.getCurrentTenantId(),{data:u,isLoading:s}=Digit.Hooks.engagement.useDocSearch({tenantIds:r},{select:e=>null==e?void 0:e.totalCount}),{data:c,isLoading:m}=Digit.Hooks.events.useInbox(r,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST"},{select:e=>null==e?void 0:e.totalCount}),{data:v,isLoading:p}=Digit.Hooks.events.useInbox(r,{},{eventTypes:"EVENTSONGROUND"},{select:e=>null==e?void 0:e.totalCount}),{data:E,isLoading:g}=Digit.Hooks.survey.useSearch({tenantIds:r},{select:e=>null==e?void 0:e.TotalCount}),f=n.useMemo(()=>s?"-":u,[s,u]),h=n.useMemo(()=>p?"-":v,[p,v]),y=n.useMemo(()=>m?"-":c,[m,c]),S=n.useMemo(()=>g?"-":E,[g,E]),{t:b}=a.useTranslation();let _=null;const C={Icon:l.createElement(t.SurveyIconSolid,null),moduleName:b("CS_COMMON_SURVEYS"),kpis:[{count:S,label:b("TOTAL_SURVEYS"),link:"/digit-ui/employee/engagement/surveys/inbox"}],links:[{count:S,label:b("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/surveys/inbox"},{label:b("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{label:b("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{label:b("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{label:b("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{label:b("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"},{label:b("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"}]},T={Icon:l.createElement(t.PMBIconSolid,null),moduleName:b("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"),kpis:[{count:y,label:b("TOTAL_MESSAGES"),link:"/digit-ui/employee/engagement/messages/inbox"}],links:[{count:y,label:b("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/messages/inbox"},{label:b("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/create"}]},D={Icon:l.createElement(t.EventsIconSolid,null),moduleName:b("TOTAL_EVENTS"),kpis:[{count:h,label:b("TOTAL_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox"}],links:[{count:h,label:b("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/event/inbox"},{label:b("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/new-event"}]},N={Icon:l.createElement(t.DocumentIconSolid,null),moduleName:b("ES_TITLE_DOCS"),kpis:[{count:f,label:b("TOTAL_DOCUMENTS"),link:"/digit-ui/employee/engagement/documents/inbox"}],links:[{count:f,label:b("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/documents/inbox"},{label:b("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/new-doc"}]};return i&&(_=l.createElement(n.Fragment,null,[N,D,T,C].map((e,n)=>l.createElement(t.EmployeeModuleCard,d({key:n,longModuleName:!0},e))))),_},EngagementDocSelectULB:e=>{var a,o;let{t:r,setValue:u,config:s,formData:c,errors:d,control:m}=e;const v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.ULBService.getCurrentTenantId(),E=n.useMemo(()=>null!=c&&c.defaultTenantId?null==v?void 0:v.find(e=>(null==e?void 0:e.code)===(null==c?void 0:c.defaultTenantId)):p&&v?null==v?void 0:v.filter(e=>e.code===p):1===(null==f?void 0:f.length)?null==f?void 0:f[0]:null,[p,v]),g=Digit.SessionStorage.get("citizen.userRequestObject"),f=v.filter(e=>{var t,n;return null==g||null===(t=g.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),h=Digit.ULBService.getUserUlbs("SUPERUSER").sort(y);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},r("ES_COMMON_ULB")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:s.key,control:m,defaultValue:null==E?void 0:E[0],rules:{required:!0},render:e=>l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:h,select:t=>{var n,l;e.onChange([...(null==c||null===(n=c[null==s?void 0:s.key])||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>t.code!=(null==e?void 0:e.code)))||[],t])},keepNull:!0,selected:e.value,disable:1===(null==v?void 0:v.length),t:r})}),l.createElement("div",{className:"tag-container"},c&&(null===(a=c[null==s?void 0:s.key])||void 0===a?void 0:a.length)>0&&(null==c||null===(o=c[s.key])||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:r(null==e?void 0:e.i18nKey),onClick:()=>{var t;u(s.key,null==c||null===(t=c[s.key])||void 0===t?void 0:t.filter(t=>t.i18nKey!=e.i18nKey))}})))),d&&d[s.key]&&l.createElement(CardLabelError,null,r("EVENTS_TENANT_ERROR_REQUIRED")))))},EngagementULBDropdown:e=>{let{t:n,config:a,errors:o,control:r}=e;const u=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),s=Digit.UserService.getUser().info,c=u.filter(e=>{var t;return null==s||null===(t=s.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_ULB")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:a.key,control:r,rules:{required:!0},render:e=>{let{onChange:a,value:o}=e;return l.createElement(t.Dropdown,{option:c,selected:o,disable:1===(null==c?void 0:c.length),optionKey:"code",t:n,select:a})}}),o&&o[null==a?void 0:a.key]&&l.createElement(CardLabelError,null,n("EVENTS_TENANT_ERROR_REQUIRED")))))},EnagementDocName:e=>{let{t:n,config:a,register:o}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_DOC_NAME")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{name:a.key,inputRef:o()}))))},EngagementDocCategory:e=>{let{t:a,config:o,formData:r,control:u}=e;const s=Digit.ULBService.getStateId(),[c,d]=n.useState(()=>[]),m=Digit.ULBService.getCurrentUlb()||"pb.amritsar",{data:v}=Digit.Hooks.engagement.useMDMS(s,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===m.code))[0].categoryList.map(e=>({name:e}))}});return n.useEffect(()=>{var e,t;null!=r&&null!==(e=r.ULB)&&void 0!==e&&e.length&&d(null==r||null===(t=r.ULB)||void 0===t?void 0:t.map(e=>null==e?void 0:e.code))},[null==r?void 0:r.ULB]),l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_CATEGORY")+"*"),l.createElement(i.Controller,{name:o.key,control:u,render:e=>l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{option:v,select:e.onChange,selected:e.value,t:a,optionKey:"name"}))})))},EngagementDocDescription:e=>{var n,a,o;let{t:i,config:r,register:u,errors:s}=e;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},i("ES_COMMON_DOC_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(t.TextArea,{name:r.key,inputRef:u({maxLength:140})}),(null==s||null===(n=s.description)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,i("ERROR_"+(null==s||null===(a=s.description)||void 0===a||null===(o=a.type)||void 0===o?void 0:o.toUpperCase())+"_140")))))},EngagementDocUploadDocument:e=>{let{t:a,config:r,formData:u,setError:s,control:c}=e;const[d,m]=n.useState(()=>{var e;return null==u||null===(e=u[r.key])||void 0===e?void 0:e.filestoreId}),[E,g]=n.useState(),[f,h]=n.useState(""),[y,S]=n.useState(),[b,_]=n.useState(!1),[C,T]=(Digit.ULBService.getCurrentTenantId(),n.useState({})),[D,w]=n.useState(!1),[x,I]=n.useState("");n.useEffect(()=>{y&&L()},[y]),n.useEffect(()=>{var e;d||_(!1),null==C||null===(e=C.onChange)||void 0===e||e.call(C,{fileStoreId:d,fileSize:E,fileType:f})},[d,C]);const L=function(){try{const e=p(function(){return v(function(){return w(!0),Promise.resolve(Digit.UploadServices.Filestorage("engagement",y,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?m(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):s(a("CS_FILE_UPLOAD_ERROR"))})},function(){})},function(e,t){if(w(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O=o.useLocation(),R=n.useMemo(()=>!!O.pathname.includes("/documents/inbox/update"),[O.pathname]);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_DOCUMENT")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:r.key+".filestoreId",control:c,render:e=>l.createElement(t.UploadFile,{id:"city-engagement-doc",onUpload:t=>((e,t)=>{var n,l,a,o,i,r;if(S(),g(),h(),I(""),null===(n=e.target)||void 0===n||null===(l=n.files)||void 0===l||!l.length)return;const u=null==e||null===(a=e.target)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.size,s=null==e||null===(i=e.target)||void 0===i||null===(r=i.files[0])||void 0===r?void 0:r.type;if(!(u&&u/1024/1024>5))return s&&(e=>!!e&&!!/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats)$/i.test(e))(s)?(g(u),h(s),T(t),void S(e.target.files[0])):void I("NOT_SUPPORTED_FILE_TYPE");I("FILE_SIZE_EXCEEDED")})(t,e),onDelete:()=>{m(null),g(100)},accept:"image/*, .pdf, .png, .jpeg, .doc",showHintBelow:!0,hintText:a("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE"),message:D?l.createElement(t.Loader,null):A(a,d,R),textStyles:{width:"100%"},inputStyles:{width:"280px"}})}),E?""+N(E):null,x?l.createElement(t.CardLabelError,null,a(x)):null)))},NotificationsAndWhatsNew:e=>{var i,r;let{variant:u,parentRoute:s}=e;const{t:c}=a.useTranslation(),m=o.useLocation(),v=o.useHistory(),p=Digit.ULBService.getCitizenCurrentTenant(),{data:{unreadCount:E}={},refetch:g}=Digit.Hooks.useNotificationCount({tenantId:p,config:{enabled:!(null===(i=Digit.UserService)||void 0===i||null===(r=i.getUser())||void 0===r||!r.access_token)}}),{mutate:f,isSuccess:h}=Digit.Hooks.useClearNotifications();n.useEffect(()=>{h&&g()},[h]),n.useEffect(()=>E&&p?f({tenantId:p}):null,[p,E]);const{data:y,isLoading:S}=Digit.Hooks.useEvents({tenantId:p,variant:u});if(S)return l.createElement(t.Loader,null);if(0===(null==y?void 0:y.length))return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,""+c("CS_HEADER_NOTIFICATIONS")),l.createElement("h1",null,"Nothing to show"));function b(e){v.push(s+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(()=>{switch(u){case"notifications":return l.createElement(t.Header,null,c("CS_HEADER_NOTIFICATIONS")+" "+(E?"("+E+")":""));case"whats-new":return l.createElement(t.Header,null,c("CS_HEADER_WHATSNEW"));default:return l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen",state:{from:m.pathname+m.search}}})}},null),null!=y&&y.length?y.map(e=>"EVENTSONGROUND"===(null==e?void 0:e.eventType)?l.createElement(t.OnGroundEventCard,d({onClick:b},e)):l.createElement("BROADCAST"===(null==e?void 0:e.eventType)?Xo:t.WhatsNewCard,e)):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))},EventsListOnGround:e=>{var n,i,r,u;let{variant:s,parentRoute:c}=e;const{t:m}=a.useTranslation(),v=o.useLocation(),p=o.useHistory(),E=Digit.ULBService.getCitizenCurrentTenant(),{data:{}={},isSuccess:g}=Digit.Hooks.useNotificationCount({tenantId:E,config:{enabled:!(null===(n=Digit.UserService)||void 0===n||null===(i=n.getUser())||void 0===i||!i.access_token)}}),{data:f,isLoading:h}=Digit.Hooks.useEvents({tenantId:E,variant:s});if(null===(r=Digit.UserService)||void 0===r||null===(u=r.getUser())||void 0===u||!u.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});if(h||!g)return l.createElement(t.Loader,null);function y(e){p.push(c+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,m("EVENTS_EVENTS_HEADER")+"("+(null==f?void 0:f.length)+")"),f.length?f.map(e=>l.createElement(t.OnGroundEventCard,d({onClick:y},e))):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,m("COMMON_INBOX_NO_DATA"))))},EventDetails:()=>{var e,i,r,u,s,c,d;const{t:m}=a.useTranslation(),v=o.useLocation(),{id:p}=(o.useHistory(),o.useParams()),E=Digit.ULBService.getCitizenCurrentTenant(),{data:g,isLoading:f}=Digit.Hooks.useEvents({tenantId:E,variant:"events"});if(null===(e=Digit.UserService)||void 0===e||null===(i=e.getUser())||void 0===i||!i.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});const h=n.useMemo(()=>f?null:null==g?void 0:g.filter(e=>e.id===p)[0],[f,g]);return f?l.createElement(t.Loader,null):l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,m("ES_TITLE_APPLICATION_DETAILS")),l.createElement(t.OnGroundEventCard,function(e){const{eventCategory:t,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}=e;return{eventCategory:m(t),showEventCatergory:!0,name:n,onGroundEventDate:l,onGroundEventMonth:a,onGroundEventTimeRange:o}}(h)),l.createElement("div",{className:"OnGroundEventDetailsCard"},l.createElement("p",{className:"cardCaptionBodyS"},null==h?void 0:h.description),l.createElement("div",{className:"eventAddressAndDirection"},l.createElement("span",null,l.createElement(t.MapMarker,null),l.createElement("div",null,l.createElement("p",null,null==h||null===(r=h.eventDetails)||void 0===r?void 0:r.address),null!=h&&null!==(u=h.eventDetails)&&void 0!==u&&u.latitude&&null!=h&&null!==(s=h.eventDetails)&&void 0!==s&&s.longitude?l.createElement("a",{className:"direction",target:"_blank",href:"https://www.google.com/maps/search/?api=1&query="+(null==h||null===(c=h.eventDetails)||void 0===c?void 0:c.latitude)+"%2C"+(null==h||null===(d=h.eventDetails)||void 0===d?void 0:d.longitude)},m("CS_COMMON_GET_DIRECTIONS")):null))),l.createElement("div",{className:"eventTimeRange"},l.createElement(t.Clock,null),l.createElement("p",null,null==h?void 0:h.onGroundEventTimeRange))))},EventForm:e=>{var r,u,s,c;let{formData:d,control:m,errors:v}=e;const{t:p}=a.useTranslation(),E=Digit.ULBService.getCurrentTenantId(),g=null==E?void 0:E.split(".")[0],f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,S=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(y),{isLoading:b,data:_}=Digit.Hooks.useCommonMDMS(g,"mseva",["EventCategories"]),C=o.useLocation(),T=n.useMemo(()=>!!C.pathname.includes("/engagement/event/edit-event"),[C.pathname]);return b?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:m,defaultValue:null!=d&&d.defaultTenantId?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===(null==d?void 0:d.defaultTenantId)):E?null==f?void 0:f.find(e=>(null==e?void 0:e.code)===E):1===(null==S?void 0:S.length)?null==S?void 0:S[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:S,selected:a,disable:!!T||1===(null==S?void 0:S.length),optionKey:"code",t:p,select:n})}}),v&&v.tenantId&&l.createElement(t.CardLabelError,null,p("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_NAME_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==d?void 0:d.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:m}),v&&(null==v?void 0:v.name)&&"required"===(null==v||null===(r=v.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_COMMENTS_ERROR_REQUIRED")),v&&(null==v?void 0:v.name)&&"maxLength"===(null==v||null===(u=v.name)||void 0===u?void 0:u.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_CATEGORY_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"eventCategory",control:m,defaultValue:null!=d&&d.category?null==_||null===(s=_.mseva)||void 0===s||null===(c=s.EventCategories.filter(e=>e.code===(null==d?void 0:d.category)))||void 0===c?void 0:c[0]:null,rules:{required:!0},render:e=>{var n;let{onChange:a,ref:o,value:i}=e;return l.createElement(t.Dropdown,{inputRef:o,option:null==_||null===(n=_.mseva)||void 0===n?void 0:n.EventCategories,optionKey:"code",t:p,select:a,selected:i})}}),v&&v.eventCategory&&l.createElement(t.CardLabelError,null,p("EVENTS_CATEGORY_ERROR_REQUIRED")))))},MessageForm:e=>{var o,r,u,s,c,d,m,v,p,E;let{formData:g,control:f,errors:h,setError:y}=e;const{t:S}=a.useTranslation(),b=Digit.ULBService.getCurrentTenantId(),_=null==b?void 0:b.split(".")[0],C=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),{isLoading:T,data:D}=Digit.Hooks.useCommonMDMS(_,"mseva",["EventCategories"]),N=Digit.ULBService.getStateId(),A=C.filter(e=>(null==e?void 0:e.code)===b);return T?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,defaultValue:1===(null==A?void 0:A.length)?null==A?void 0:A[0]:null,name:"tenantId",rules:{required:!0},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.Dropdown,{option:A,selected:a,disable:1===(null==A?void 0:A.length),optionKey:"code",t:S,select:n})}}),h&&h.tenantId&&l.createElement(t.CardLabelError,null,S("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TITLE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==g?void 0:g.name,render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextInput,{value:o,type:"text",name:"name",onChange:n,inputRef:a})},name:"name",rules:{required:!0,maxLength:66},control:f}),h&&(null==h?void 0:h.name)&&"required"===(null==h||null===(o=h.name)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.name)&&"maxLength"===(null==h||null===(r=h.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},S("EVENTS_COMMENTS_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"description",control:f,defaultValue:null!=g&&g.category?null==D||null===(u=D.mseva)||void 0===u||null===(s=u.EventCategories.filter(e=>e.code===(null==g?void 0:g.category)))||void 0===s?void 0:s[0]:null,rules:{required:!0,maxLength:500},render:e=>{let{onChange:n,ref:a,value:o}=e;return l.createElement(t.TextArea,{inputRef:a,value:o,name:"description",onChange:n,hintText:S("PUBLIC_BRDCST_MSG_LENGTH")})}}),h&&(null==h?void 0:h.description)&&"required"===(null==h||null===(c=h.description)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.description)&&"maxLength"===(null==h||null===(d=h.description)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},""+S("EVENTS_ATTACHMENT_LABEL")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"documents",control:f,rules:{required:!1},render:e=>{let{onChange:n,value:a=[]}=e;return l.createElement(t.MultiUploadWrapper,{t:S,module:"engagement",tenantId:N,getFormState:function(e){let t=[];e.length>0&&e.forEach(e=>{var n,l,a,o;t.push({fileName:null==e?void 0:e[0],fileStoreId:null==e||null===(n=e[1])||void 0===n||null===(l=n.fileStoreId)||void 0===l?void 0:l.fileStoreId,documentType:null==e||null===(a=e[1])||void 0===a||null===(o=a.file)||void 0===o?void 0:o.type})}),n(t)},showHintBelow:!0,setuploadedstate:a,allowedFileTypesRegex:Ko,allowedMaxSizeInMB:5,hintText:S("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE")})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_FROM_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,name:"fromDate",defaultValue:null==g?void 0:g.fromDate,rules:{required:!0,validate:{isValidFromDate:e=>{const t=x(new Date(""+(null==g?void 0:g.fromDate))),n=new Date;return!(!k(t)||t.getTime()<n.getTime()&&(y("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(m=h.fromDate)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(v=h.fromDate)||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_INVALID")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:f,name:"toDate",defaultValue:null==g?void 0:g.toDate,rules:{required:!0,validate:{isValidToDate:e=>{const t=x(new Date(""+(null==g?void 0:g.fromDate))),n=x(new Date(""+(null==g?void 0:g.toDate))),l=new Date;return!(!k(n)||(n.getTime()<l.getTime()||n.getTime()<t.getTime())&&(y("toDate",{type:"isValidToDate"},{shouldFocus:!0}),1))}}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(p=h.toDate)||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(E=h.toDate)||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_INVALID")))))},DocumentList:e=>{let{match:o}=e;const{t:i}=a.useTranslation(),{category:r,count:u}=o.params,s=Digit.ULBService.getCitizenCurrentTenant(),[c,d]=n.useState(20),[m,v]=n.useState(0),[p,E]=n.useState(),g=ni(p,700),{data:f,isLoading:h}=Digit.Hooks.engagement.useDocSearch({name:g,category:r,tenantIds:s,limit:c},{select:e=>{var t;return null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let{uuid:t,name:n,category:l,documentLink:a,description:o,auditDetails:i,fileSize:r,filestoreId:u}=e;return{docId:t,name:n,category:l,description:o,documentLink:a,createdTime:null==i?void 0:i.createdTime,fileSize:r,filestoreId:u}})}});return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,i(""+r)+" ("+(u||"-")+")"),l.createElement("div",{className:"documentContainerPadding"},l.createElement("div",null,l.createElement(ti,{searchValue:p,handleKeyPress:function(e){try{return"Enter"===e.key&&p.length&&E(""),Promise.resolve()}catch(e){return Promise.reject(e)}},handleSearch:function(e){try{return p.length&&E(""),Promise.resolve()}catch(e){return Promise.reject(e)}},onChange:E,t:i})),h?l.createElement(t.Loader,null):f&&f.length?ai(f,i):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,i("COMMON_INBOX_NO_DATA")))))},SelectEventGeolocation:e=>{var o,i;let{onSelect:r,config:u,formData:s}=e;const{t:c}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},""+c("EVENTS_GEOLOCATION_LABEL")),l.createElement("div",{className:"field"},l.createElement(t.LocationSearch,{position:{latitude:null==s||null===(o=s.geoLocation)||void 0===o?void 0:o.latitude,longitude:null==s||null===(i=s.geoLocation)||void 0===i?void 0:i.longitude},onChange:(e,t)=>{r(null==u?void 0:u.key,t)}}))))},SelectToDate:e=>{var o,r;let{formData:u,control:s,errors:c,setError:d}=e;const{t:m}=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},m("EVENTS_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:s,name:"toDate",defaultValue:null==u?void 0:u.toDate,rules:{required:!0,validate:{isValidDate:e=>!(!k(new Date(null==u?void 0:u.fromDate))||!k(new Date(e))||(new Date((null==u?void 0:u.fromDate)+" "+(null==u?void 0:u.fromTime))<new Date?(d("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1):new Date(e+" "+(null==u?void 0:u.toTime))<new Date||!(new Date((null==u?void 0:u.fromDate)+" "+(null==u?void 0:u.fromTime))<=new Date(e+" "+(null==u?void 0:u.toTime)))))}},render:e=>{let{onChange:n,value:a}=e;return l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:n,defaultValue:a})}}),c&&(null==c?void 0:c.toDate)&&"required"===(null==c||null===(o=c.toDate)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),c&&(null==c?void 0:c.toDate)&&"isValidDate"===(null==c||null===(r=c.toDate)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID")))))},SurveyList:()=>{const{t:e}=a.useTranslation(),n=o.useHistory(),i=Digit.ULBService.getCitizenCurrentTenant(),{data:r,isLoading:u}=Digit.Hooks.survey.useSearch({tenantIds:i},{select:e=>{let{Surveys:t}=e;const n=t.map(e=>{const t=Bi(e.startDate,e.endDate);let n="";return n=t&&e.hasResponded?"CS_SURVEY_RESPONDED":t?"CS_SURVEY_YT_TO_RESPOND":"CANNOT_RESPOND_MSG",d({hasResponded:!1,responseStatus:n},e)}),l=[],a=[];for(let e of n)"ACTIVE"===e.status&&Bi(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(ki,{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(ki,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_INACTIVE_SURVEYS"))))},FillSurvey:e=>{var t,i,r,u,s,c,d,m;const{applicationNumber:v,tenantId:p}=Digit.Hooks.useQueryParams(),{data:E,isLoading:g}=Digit.Hooks.survey.useSearch({uuid:v,tenantId:p},{}),f=null!=E&&null!==(t=E.Surveys)&&void 0!==t&&t[0]?null==E||null===(i=E.Surveys)||void 0===i?void 0:i[0]:{},{t:h}=a.useTranslation();let y=E;const[S,b]=n.useState(null);null==f||null===(r=f.questions)||void 0===r||r.sort((e,t)=>e.qorder-t.qorder);const _=o.useHistory();return n.useEffect(()=>{var e,t,n,l,a,o;E&&1==(null==y||null===(e=y.Surveys)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.hasResponded)||"true"===(null==y||null===(n=y.Surveys)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.hasResponded)?b({key:!0,label:"SURVEY_FORM_IS_ALREADY_SUBMITTED"}):E&&"INACTIVE"==(null==y||null===(a=y.Surveys)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.status)&&b({key:!0,label:"SURVEY_FORM_IS_ALREADY_INACTIVE"})},[null==E||null===(u=E.Surveys)||void 0===u||null===(s=u[0])||void 0===s?void 0:s.hasResponded,null==y||null===(c=y.Surveys)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.hasResponded]),(null===(m=Object.keys(f))||void 0===m?void 0:m.length)>0||g?l.createElement(Ar,{surveyData:f,isSubmitDisabled:!!S,isLoading:g,onFormSubmit:e=>{const t={AnswerEntity:{surveyId:f.uuid,answers:nu(e),surveyTitle:f.title,hasResponded:f.hasResponded}};_.push("/digit-ui/citizen/engagement/surveys/submit-response",t)},formDisabled:!!S,showToast:S}):l.createElement(tu,{t:h})},CitizenSurveyForm:Ar,ShowSurvey:e=>{var a;let{location:o}=e;const i=null==o?void 0:o.state,u=(Digit.ULBService.getCitizenCurrentTenant(),Digit.Hooks.survey.useShowResults()),s=r.useQueryClient();if(n.useEffect(()=>{u.mutate({surveyId:i.uuid},{onSuccess:()=>{s.clear()}})},[]),u.isLoading&&!u.isIdle)return l.createElement(t.Loader,null);if(u.isError)return l.createElement("div",null,"An error occured...");const c=null==u||null===(a=u.data)||void 0===a?void 0:a.answers,d={};return null==c||c.map(e=>{d[null==e?void 0:e.questionId]=1===(null==e?void 0:e.answer.length)?null==e?void 0:e.answer[0]:null==e?void 0:e.answer}),l.createElement(Ar,{surveyData:i,submitDisabled:!0,formDisabled:!0,formDefaultValues:d})},SurveyResults:Vr,CreateSurveyCategory:zi,SearchCategories:Gi,SurveyForm:e=>{let{t:a,index:o,questionStatement:r,type:u,uuid:s,qorder:c,required:m,options:v,disableInputs:p,dispatch:E,isPartiallyEnabled:g,addOption:f,formDisabled:h}=e;const y=[{title:a("Surveys_Short_Answer"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},{title:a("Surveys_Multiple_Choice"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},{title:a("Surveys_Check_Boxes"),i18Key:"CHECKBOX_ANSWER_TYPE",value:"CHECKBOX_ANSWER_TYPE"},{title:a("Surveys_Paragraph"),i18Key:"LONG_ANSWER_TYPE",value:"LONG_ANSWER_TYPE"},{title:a("Surveys_Date"),i18Key:"DATE_ANSWER_TYPE",value:"DATE_ANSWER_TYPE"},{title:a("Surveys_Time"),i18Key:"TIME_ANSWER_TYPE",value:"TIME_ANSWER_TYPE"}],S=[{title:a("Product Quality"),i18Key:"Product_Quality",value:"Product_Quality"}],b=[{title:a("What is your feedback for this product?"),i18Key:"Product_Quality",value:"Product_Quality"}],_=y.filter(e=>(null==e?void 0:e.value)===("object"==typeof u?u.value:u)),C=window.location.href.includes("/employee/engagement/"),[T,D]=n.useState({questionStatement:r,type:u?null==_?void 0:_[0]:{title:a("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:m,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c}),{register:N,formState:A}=i.useFormContext(),[w,x]=n.useState(0);n.useEffect(()=>{D({questionStatement:r,type:u?null==_?void 0:_[0]:{title:a(""),i18Key:"",value:""},required:m,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:s,qorder:c})},[r]);const I=()=>D(e=>{const t=d({},e);return t.options.push(a("CMN_OPTION")+" "+(t.options.length+1)),t}),L=e=>{let{value:t,id:n}=e;D(e=>{const l=d({},e);return l.options.splice(n,1,t),l})},O=e=>{1===T.options.length||!g&&h||D(t=>{const n=d({},t);return n.options.splice(e,1),n})};return n.useEffect(()=>{E({type:"updateForm",payload:{index:o,formConfig:T}})},[T]),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},l.createElement(t.TextInput,{value:T.categoryName,onChange:e=>{D(t=>d({},t,{categoryName:e.target.value}))},name:"category",placeholder:"Category Title"}),l.createElement(t.TextInput,{placeholder:a("Weightage"),value:T.weightage,onChange:e=>{D(t=>d({},t,{weightage:e.target.value}))},textInputStyle:{width:"100%"},name:"Weightage_"+o,disable:p,inputRef:N({required:a("ES_ERROR_REQUIRED"),maxLength:{value:100,message:a("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:a("ES_SURVEY_DONT_START_WITH_NUMBER")}})})),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement("div",null,l.createElement(t.Dropdown,{t:a,option:S,select:e=>{D(t=>d({},t,{Categorytype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Category",optionKey:"i18Key",disable:p,selected:""}),l.createElement(t.TextInput,{placeholder:a("Category Weightage"),name:"QusWeight",disabled:C,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})})),l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:b,select:e=>{D(t=>d({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:T.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{D(t=>d({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},optionKey:"i18Key",disable:p,selected:null==T?void 0:T.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:C,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,o;switch(null==e?void 0:e.value){case"LONG_ANSWER_TYPE":return l.createElement("div",null,l.createElement(t.TextArea,{placeholder:a("LONG_ANSWER_TYPE"),disabled:C,name:"longAnsDescription",inputRef:N({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")}})}),(null==A?void 0:A.errors)&&l.createElement(t.CardLabelError,null,null==A||null===(n=A.errors)||void 0===n||null===(o=n.longAnsDescription)||void 0===o?void 0:o.message));case"DATE_ANSWER_TYPE":return l.createElement(t.DatePicker,{stylesForInput:{width:"calc(100% - 290px)"},style:{width:"202px"},disabled:C});case"TIME_ANSWER_TYPE":return l.createElement(t.TextInput,{type:"time",textInputStyle:{width:"202px"},disable:C});case"MULTIPLE_ANSWER_TYPE":return l.createElement(Xi,{maxLength:60,titleHover:a("MAX_LENGTH_60"),t:a,addOption:I,updateOption:L,removeOption:O,options:null==T?void 0:T.options,createNewSurvey:f,isInputDisabled:C,isPartiallyEnabled:g,formDisabled:h});case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,l.createElement(Ki,{t:a,addOption:I,updateOption:L,removeOption:O,options:null==T?void 0:T.options,isInputDisabled:C,isPartiallyEnabled:g,createNewSurvey:f,formDisabled:h,maxLength:60,titleHover:a("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}}));default:return null}})(null==T?void 0:T.Answertype)),(void 0!==T.Questype&&console.log("hi"),void 0!==T.Questype?l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:b,select:e=>{D(t=>d({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:T.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{D(t=>d({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},name:"Answertype"+(null==T||null===(R=T.Questype)||void 0===R?void 0:R.index),optionKey:"i18Key",disable:p,selected:null==T?void 0:T.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:C,inputRef:N({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))):null),l.createElement("div",{className:"newSurveyForm_actions"},l.createElement("div",null,"Add more questions?"),l.createElement("div",{className:"newSurveyForm_seprator"}),l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>{D(e=>d({},e,{Questype:{value:"ADD_QUESTION",index:w+1}})),x(w+1)}},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("Add more question")))))),l.createElement("div",{className:"newSurveyForm_actions"},0!==o&&l.createElement("div",{className:"newSurveyForm_seprator"}),0!==o&&l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>E({type:"removeForm",payload:{index:o}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("CS_INFO_DELETE"))))))));var R},CreateSurveyForm:e=>{let{disableInputs:t,isPartiallyEnabled:a,formDisabled:o}=e;const r=i.useForm({defaultValues:{sections:[]}}),{register:u,control:s,setValue:c,getValues:v,reset:p,formState:E,clearErrors:g}=r,f=m(r,Jr);console.log("setSurveyConfig",c),console.log("disable Inputs",t),console.log("partially enabled",a),console.log("forms disable",o);const[h,y]=n.useReducer((e,t)=>{let{type:n}=t;switch(console.log("type im reducer",n),n){case"ADD_SECTION":return d({},e,{sections:[e.sections,{id:2,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}],weightage:0}]});case"ADD_CATEGORY":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:[...e.categories,{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}):e)});case"ADD_QUESTION":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:e.categories.map(e=>e.id===action.categoryId?d({},e,{questions:[...e.questions,{id:Date.now(),type:"",answer:""}]}):e)}):e)});case"UPDATE_SECTION_WEIGHTAGE":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{weightage:action.weightage}):e)});case"UPDATE_CATEGORY_WEIGHTAGE":return d({},e,{sections:e.sections.map(e=>e.id===action.sectionId?d({},e,{categories:e.categories.map(e=>e.id===action.categoryId?d({},e,{weightage:action.weightage}):e)}):e)});default:return e}},{sections:[{id:1,weightage:20,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}]});return l.createElement(n.Fragment,null,l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,d({register:u,control:s,setValue:c,getValues:v,reset:p,formState:E,clearErrors:g},f),l.createElement("div",null,l.createElement("h1",null,"Survey Creation"),l.createElement("button",{onClick:()=>{(e=>{let{type:t,payload:n}={type:"ADD_SECTION"};console.log("type",t),y({type:t,payload:d({},n,{setSurveyFormValue:c})})})()}},"Add Section"),(console.log("render",h),h.sections.length?h.sections.map((e,t)=>(console.log("section",e),console.log("index",t),l.createElement($r,{key:t,section:e}))):null))))))},SurveyFormDetails:e=>{let{config:t,onGoNext:n,onBackClick:a,t:o}=e;const i=u.useDispatch(),r=u.useSelector(e=>e.engagement.surveyForm.surveyDetails),s=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[t.key]?e.engagement.surveyForm.formData[t.key]:{}});return l.createElement(l.Fragment,null,l.createElement(bu,{defaultValues:s,box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},config:t.currStepConfig,onSubmit:function(e){console.log("Data in step "+t.currStepNumber+" is: \n",e);let l=0,a="";r.map(e=>{""===e.name&&(l=1,a+="Please enter Survey Name\n"),e.name.length>500&&(l=1,a+="Please enter a Survey Name that is 500 characters or fewer\n"),e.description.length>500&&(l=1,a+="Please enter a Survey Description that is 500 characters or fewer\n"),""===e.fromDate&&(l=1,a+="Please enter Survey Start Date\n"),""===e.fromTime&&(l=1,a+="Please enter Survey Start Time\n"),""===e.toDate&&(l=1,a+="Please enter Survey End Date\n"),""===e.toTime&&(l=1,a+="Please enter Survey End Time\n"),e.description.length>140&&(l=1,a+="Please enter description less than 140 characters\n"),new Date(e.fromDate+"T"+e.fromTime)>new Date(e.toDate+"T"+e.toTime)&&(l=1,a+="Start date and time must be before end date and time.\n")}),1!==l?n():alert(a)},onFormValueChange:function(e,n){console.log("d",n),console.log("onFormValueChange data in SurveyFormDetails: ",n,"\n Bool: ",!_.isEqual(n,s)),_.isEqual(n,s)||i(cr(t.key,n))},label:o(""+t.texts.submitBarLabel),currentStep:t.currStepNumber,onBackClick:function(e){a(t.key,e)}}))},SurveyFormCategoryDetails:e=>{let{config:n,onGoNext:a,onBackClick:o,t:i}=e;const r=u.useDispatch(),s=u.useSelector(e=>e.engagement.surveyForm.categories),c=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[n.key]?e.engagement.surveyForm.formData[n.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},defaultValues:c,config:n.currStepConfig,onSubmit:function(e){console.log("data in go next",s);let t=0,l="";s.map((e,n)=>{e.title.length>500&&(l+="-> Please enter a Section Title that is 500 characters or fewer for section "+(n+1)+" card\n",t=1),0===e.selectedQuestions.length&&(l+="-> Please select at least one question for section "+(n+1)+" card\n",t=1)});const o=s.reduce((e,t)=>e+parseFloat(t.weightage),0);console.log("tot weight",Math.round(o)),Math.round(o)>100&&(l+="The total weightage of sections should not exceed 100.\n",t=1),Math.round(o)<100&&(l+="The total weightage of sections should not be less than 100.\n",t=1),s.map((e,n)=>{const a=e.selectedQuestions.reduce((e,t)=>e+parseFloat(t.weightage),0);Math.round(a)>100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1),Math.round(a)<100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1)}),1!==t?(console.log("Data in step "+n.currStepNumber+" is: \n",e),a()):alert(l)},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveyFormCategoryDetails: ",t,"\n Bool: ",!_.isEqual(t,c)),_.isEqual(t,c)||r(cr(n.key,t))},label:i(""+n.texts.submitBarLabel),currentStep:n.currStepNumber,onBackClick:function(e){o(n.key,e),r({type:"GO_PREV"})}}))},SurveryFormSummary:e=>{let{config:a,onGoNext:i,onBackClick:r,t:s}=e;const[c,d]=n.useState(null),m=o.useHistory(),v=u.useDispatch(),p=u.useSelector(e=>e.engagement.surveyForm.categories),E=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);Digit.ULBService.getCurrentTenantId();const g=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[a.key]?e.engagement.surveyForm.formData[a.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{defaultValues:g,config:a.currStepConfig,onSubmit:function(e){let t=[];p.map(e=>{let n=[];e.selectedQuestions.map(e=>{let t={questionUuid:e.uuid,weightage:parseFloat(e.weightage),required:e.mandatory};n.push(t)});let l={title:e.title,weightage:parseFloat(e.weightage),questions:n};t.push(l)}),console.log("survey det",E);let n={SurveyEntity:{startDate:new Date(E.fromDate+" "+E.fromTime).getTime(),endDate:new Date(E.toDate+" "+E.toTime).getTime(),tenantId:E.ulb.code,surveyTitle:E.name,surveyCategory:E.name,surveyDescription:E.description,sections:t}};try{Digit.Surveys.createSurvey(n).then(e=>{var t,n;v({type:"RESET_FORM"}),(null==e||null===(t=e.Surveys)||void 0===t?void 0:t.length)>0?m.push("/digit-ui/employee/engagement/surveys/create-response",{message:"SURVEY_FORM_CREATED",response:null==e?void 0:e.Surveys,isSuccess:!0}):d({key:!0,label:""+(null==e||null===(n=e.Errors)||void 0===n?void 0:n.message)})})}catch(e){console.log(e)}console.log("Data in step "+a.currStepNumber+" is: \n",e),i()},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveryFormSummary: ",t,"\n Bool: ",!_.isEqual(t,g)),_.isEqual(t,g)||v(cr(a.key,t))},label:s(""+a.texts.submitBarLabel),currentStep:a.currStepNumber,onBackClick:function(e){r(a.key,e),v({type:"GO_PREV"})}}),c&&l.createElement(Toast,{error:c.key,label:s(c.label),onClose:()=>{d(null)}}))},NewSurveys:Qr,SurveyCreationPage:Cu,SurveySummary:()=>l.createElement("div",{style:{backgroundColor:"white"}},l.createElement(Qr,{readOnly:!0}),l.createElement(Cu,{readOnly:!0,hideQuestionLabel:!0})),FillSurveyNew:()=>(console.log("fill survey form new"),l.createElement(Tu,null)),FillSurveyEmp:br,FillQuestions:Ei,SurveyModal:Au};exports.SurveyModal=Au,exports.SurveyReducers=()=>c.combineReducers({surveyForm:au}),exports.initEngagementComponents=()=>{Object.entries(Iu).forEach(e=>{let[t,n]=e;console.log("Registering component:",t,n),Digit.ComponentRegistryService.setComponent(t,n)})};
|
|
1
|
+
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@mseva/digit-ui-react-components"),n=require("react"),l=e(n),a=require("react-i18next"),o=require("react-router-dom"),i=require("react-hook-form"),r=require("react-query"),s=e(require("react-dom")),u=require("react-redux"),c=require("recharts");require("react-time-picker");var d=require("redux");function m(){return(m=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 v(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}function p(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function E(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}function f(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function g(e){f(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 h(e){f(1,arguments);var t=g(e);return t.setHours(0,0,0,0),t}function y(e,t){f(2,arguments);var n=h(e),l=h(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 S=(e,t)=>e.name.toUpperCase()<t.name.toUpperCase()?-1:e.name.toUpperCase()>t.name.toUpperCase()?1:0,b=(e,t)=>{var n,l;return!(!e||!t)&&(null==e||null===(n=e.trim())||void 0===n?void 0:n.toLowerCase())===(null==t||null===(l=t.trim())||void 0===l?void 0:l.toLowerCase())},C=function(e){return Promise.resolve(p(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;return t.includes(".jpg")||t.includes(".png")?t.split(",")[0]:null===(a=e.data.fileStoreIds[0])||void 0===a?void 0:a.url}})},function(){}))},T=function(e,t){try{if(!e||!e.length)return alert("No Document exists!"),Promise.resolve();const n=window.open("","_blank");return Promise.resolve(C(e)).then(function(e){window.mSewaApp&&window.mSewaApp.isMsewaApp()?(window.open(e,"_blank"),setTimeout(()=>{window.location.href=e},1e3)):(n.location=e,n.document.title=t)})}catch(e){return Promise.reject(e)}},D=(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!")},N=function(e,t){try{return e&&e.length?Promise.resolve(C(e)).then(function(e){e&&Digit.Utils.downloadPDFFromLink(e)}):(alert("No Document exists!"),Promise.resolve())}catch(e){return Promise.reject(e)}},w=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB","TB"][t]},A=(e,t,n)=>{var l;return t?n?null!=t&&null!==(l=t.fileStoreId)&&void 0!==l&&l.length?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):t?"1 "+e("CS_ACTION_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED"):e("CS_ACTION_NO_FILEUPLOADED")},x=e=>{let t=new Date(e);if(function(e){return f(1,arguments),y(e,Date.now())}(t)){const e=new Date;t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59)}return t.getTime()},O=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59),I=[{head:"",body:[{type:"form",withoutLabel:!0,component:"EventForm",nextStep:"",route:"",key:"eventData"},{type:"text",label:"EVENTS_DESCRIPTION_LABEL",isMandatory:!0,description:"EVENTS_DESCRIPTION_TEXT",populators:{name:"description",className:"fullWidth",validation:{required:!0,maxLength:500},error:"EVENTS_DESCRIPTION_ERROR_REQUIRED"}},{type:"date",label:"EVENTS_FROM_DATE_LABEL",isMandatory:!0,populators:{name:"fromDate",className:"fullWidth",validation:{required:!0},shouldUpdate:!0,error:"EVENTS_FROM_DATE_ERROR_INVALID"}},{type:"form",key:"SelectToDate",withoutLabel:!0,component:"SelectToDate",key:"toDate"},{type:"time",label:"EVENTS_FROM_TIME_LABEL",isMandatory:!0,populators:{name:"fromTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_FROM_TIME_ERROR_REQUIRED"}},{type:"time",label:"EVENTS_TO_TIME_LABEL",isMandatory:!0,populators:{name:"toTime",className:"fullWidth",validation:{required:!0},error:"EVENTS_TO_TIME_ERROR_REQUIRED"}},{type:"text",label:"EVENTS_ADDRESS_LABEL",isMandatory:!0,populators:{name:"address",className:"fullWidth",validation:{required:!0},error:"EVENTS_ADDRESS_ERROR_REQUIRED"}},{type:"component",component:"SelectEventGeolocation",withoutLabel:!0,key:"geoLocation"},{type:"text",label:"EVENTS_ORGANIZER_NAME_LABEL",populators:{name:"organizer",className:"fullWidth",validation:{pattern:/^[A-Za-z ]*$/},error:"EVENTS_ORGANIZER_ERROR"}},{type:"number",label:"EVENTS_ENTRY_FEE_INR_LABEL",populators:{name:"fees",className:"fullWidth",error:"EVENTS_ENTRY_ERROR_REQUIRED"}}]}],L=()=>{const e=a.useTranslation().t,i=o.useHistory(),r=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1)[1],s=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1)[2],u=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1)[2];return n.useEffect(()=>{r(!1),u(),s()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ES_TITLE_NEW_EVENTS")),l.createElement(t.FormComposer,{config:I,onSubmit:e=>{var t,n;const l=e.toDate,a=e.fromTime,o=e.toTime,r=e.address,s=e.organizer,u=e.fees,c=e.geoLocation,d=void 0===c?{}:c,v={events:[{source:"WEBAPP",eventType:"EVENTSONGROUND",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:null==e?void 0:e.description,name:null==e?void 0:e.name,eventcategory:null==e||null===(n=e.eventCategory)||void 0===n?void 0:n.code,eventDetails:m({fromDate:new Date(e.fromDate+" "+a).getTime(),toDate:new Date(l+" "+o).getTime(),fromTime:a,toTime:o,address:r,organizer:s,fees:u},d)}]};i.push("/digit-ui/employee/engagement/event/response",v)},label:e("EVENTS_CREATE_EVENT")}))};function R(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 M(e,t){f(2,arguments);var n=g(e).getTime(),l=R(t);return new Date(n+l)}function P(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function F(e,t){f(2,arguments);var n=g(e),l=g(t),a=n.getTime()-l.getTime();return a<0?-1:a>0?1:a}function k(e){return f(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function B(e){if(f(1,arguments),!k(e)&&"number"!=typeof e)return!1;var t=g(e);return!isNaN(Number(t))}function U(e,t){f(2,arguments);var n=g(e),l=g(t),a=n.getFullYear()-l.getFullYear(),o=n.getMonth()-l.getMonth();return 12*a+o}function H(e,t){return f(2,arguments),g(e).getTime()-g(t).getTime()}var V={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function W(e){return e?V[e]:V.trunc}function z(e){f(1,arguments);var t=g(e);return t.setHours(23,59,59,999),t}function j(e){f(1,arguments);var t=g(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function q(e){f(1,arguments);var t=g(e);return z(t).getTime()===j(t).getTime()}function Y(e,t){f(2,arguments);var n,l=g(e),a=g(t),o=F(l,a),i=Math.abs(U(l,a));if(i<1)n=0;else{1===l.getMonth()&&l.getDate()>27&&l.setDate(30),l.setMonth(l.getMonth()-o*i);var r=F(l,a)===-o;q(g(e))&&1===i&&1===F(e,a)&&(r=!1),n=o*(i-Number(r))}return 0===n?0:n}function G(e,t,n){f(2,arguments);var l=H(e,t)/1e3;return W(null==n?void 0:n.roundingMethod)(l)}var K={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 Q(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 X={date:Q({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Q({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:Q({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 $(e){return function(t,n){var l,a=n||{};if("formatting"===(a.context?String(a.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=a.width?String(a.width):o;l=e.formattingValues[i]||e.formattingValues[o]}else{var r=e.defaultWidth,s=a.width?String(a.width):e.defaultWidth;l=e.values[s]||e.values[r]}return l[e.argumentCallback?e.argumentCallback(t):t]}}function J(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=n.width,a=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var i,r=o[0],s=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(s)?te(s,function(e){return e.test(r)}):ee(s,function(e){return e.test(r)});i=e.valueCallback?e.valueCallback(u):u,i=n.valueCallback?n.valueCallback(i):i;var c=t.slice(r.length);return{value:i,rest:c}}}function ee(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function te(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}var ne,le={code:"en-US",formatDistance:function(e,t,n){var l,a=K[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:X,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:$({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:$({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:$({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:$({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:$({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:(ne={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(ne.matchPattern);if(!n)return null;var l=n[0],a=e.match(ne.parsePattern);if(!a)return null;var o=ne.valueCallback?ne.valueCallback(a[0]):a[0];o=t.valueCallback?t.valueCallback(o):o;var i=e.slice(l.length);return{value:o,rest:i}}),era:J({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:J({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:J({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:J({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:J({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 ae(e,t){f(2,arguments);var n=R(t);return M(e,-n)}function oe(e){f(1,arguments);var t=1,n=g(e),l=n.getUTCDay(),a=(l<t?7:0)+l-t;return n.setUTCDate(n.getUTCDate()-a),n.setUTCHours(0,0,0,0),n}function ie(e){f(1,arguments);var t=g(e),n=t.getUTCFullYear(),l=new Date(0);l.setUTCFullYear(n+1,0,4),l.setUTCHours(0,0,0,0);var a=oe(l),o=new Date(0);o.setUTCFullYear(n,0,4),o.setUTCHours(0,0,0,0);var i=oe(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function re(e){f(1,arguments);var t=ie(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var l=oe(n);return l}function se(e,t){f(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.weekStartsOn,o=null==a?0:R(a),i=null==n.weekStartsOn?o:R(n.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var r=g(e),s=r.getUTCDay(),u=(s<i?7:0)+s-i;return r.setUTCDate(r.getUTCDate()-u),r.setUTCHours(0,0,0,0),r}function ue(e,t){f(1,arguments);var n=g(e),l=n.getUTCFullYear(),a=t||{},o=a.locale,i=o&&o.options&&o.options.firstWeekContainsDate,r=null==i?1:R(i),s=null==a.firstWeekContainsDate?r:R(a.firstWeekContainsDate);if(!(s>=1&&s<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var u=new Date(0);u.setUTCFullYear(l+1,0,s),u.setUTCHours(0,0,0,0);var c=se(u,t),d=new Date(0);d.setUTCFullYear(l,0,s),d.setUTCHours(0,0,0,0);var m=se(d,t);return n.getTime()>=c.getTime()?l+1:n.getTime()>=m.getTime()?l:l-1}function ce(e,t){f(1,arguments);var n=t||{},l=n.locale,a=l&&l.options&&l.options.firstWeekContainsDate,o=null==a?1:R(a),i=null==n.firstWeekContainsDate?o:R(n.firstWeekContainsDate),r=ue(e,t),s=new Date(0);s.setUTCFullYear(r,0,i),s.setUTCHours(0,0,0,0);var u=se(s,t);return u}function de(e,t){for(var n=e<0?"-":"",l=Math.abs(e).toString();l.length<t;)l="0"+l;return n+l}var me={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 de("yy"===t?l%100:l,t.length)}(e,t)},Y:function(e,t,n,l){var a=ue(e,l),o=a>0?a:1-a;return"YY"===t?de(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):de(o,t.length)},R:function(e,t){return de(ie(e),t.length)},u:function(e,t){return de(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 de(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 de(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):de(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 de(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){f(1,arguments);var n=g(e),l=se(n,t).getTime()-ce(n,t).getTime();return Math.round(l/6048e5)+1}(e,l);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):de(a,t.length)},I:function(e,t,n){var l=function(e){f(1,arguments);var t=g(e),n=oe(t).getTime()-re(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(l,{unit:"week"}):de(l,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):function(e,t){return de(e.getUTCDate(),t.length)}(e,t)},D:function(e,t,n){var l=function(e){f(1,arguments);var t=g(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var l=t.getTime(),a=n-l;return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(l,{unit:"dayOfYear"}):de(l,t.length)},E:function(e,t,n){var l=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(l,{width:"short",context:"formatting"});case"EEEE":default:return n.day(l,{width:"wide",context:"formatting"})}},e:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return de(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,l){var a=e.getUTCDay(),o=(a-l.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return de(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){var l=e.getUTCDay(),a=0===l?7:l;switch(t){case"i":return String(a);case"ii":return de(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 de(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 de(e.getUTCHours(),t.length)}(e,t)},K:function(e,t,n){var l=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(l,{unit:"hour"}):de(l,t.length)},k:function(e,t,n){var l=e.getUTCHours();return 0===l&&(l=24),"ko"===t?n.ordinalNumber(l,{unit:"hour"}):de(l,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):function(e,t){return de(e.getUTCMinutes(),t.length)}(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):function(e,t){return de(e.getUTCSeconds(),t.length)}(e,t)},S:function(e,t){return function(e,t){var n=t.length,l=e.getUTCMilliseconds();return de(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 pe(a);case"XXXX":case"XX":return Ee(a);case"XXXXX":case"XXX":default:return Ee(a,":")}},x:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"x":return pe(a);case"xxxx":case"xx":return Ee(a);case"xxxxx":case"xxx":default:return Ee(a,":")}},O:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ve(a,":");case"OOOO":default:return"GMT"+Ee(a,":")}},z:function(e,t,n,l){var a=(l._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ve(a,":");case"zzzz":default:return"GMT"+Ee(a,":")}},t:function(e,t,n,l){return de(Math.floor((l._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,l){return de((l._originalDate||e).getTime(),t.length)}};function ve(e,t){var n=e>0?"-":"+",l=Math.abs(e),a=Math.floor(l/60),o=l%60;if(0===o)return n+String(a);var i=t||"";return n+String(a)+i+de(o,2)}function pe(e,t){return e%60==0?(e>0?"-":"+")+de(Math.abs(e)/60,2):Ee(e,t)}function Ee(e,t){var n=t||"",l=e>0?"-":"+",a=Math.abs(e);return l+de(Math.floor(a/60),2)+n+de(a%60,2)}function fe(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function ge(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var he={p:ge,P:function(e,t){var n,l=e.match(/(P+)(p+)?/)||[],a=l[1],o=l[2];if(!o)return fe(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}}",fe(a,t)).replace("{{time}}",ge(o,t))}},ye=["D","DD"],Se=["YY","YYYY"];function be(e){return-1!==ye.indexOf(e)}function _e(e){return-1!==Se.indexOf(e)}function Ce(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://git.io/fxCyr"))}var Te=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,De=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ne=/^'([^]*?)'?$/,we=/''/g,Ae=/[a-zA-Z]/;function xe(e,t,n){f(2,arguments);var l=String(t),a=n||{},o=a.locale||le,i=o.options&&o.options.firstWeekContainsDate,r=null==i?1:R(i),s=null==a.firstWeekContainsDate?r:R(a.firstWeekContainsDate);if(!(s>=1&&s<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var u=o.options&&o.options.weekStartsOn,c=null==u?0:R(u),d=null==a.weekStartsOn?c:R(a.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!o.localize)throw new RangeError("locale must contain localize property");if(!o.formatLong)throw new RangeError("locale must contain formatLong property");var m=g(e);if(!B(m))throw new RangeError("Invalid time value");var v=P(m),p=ae(m,v),E={firstWeekContainsDate:s,weekStartsOn:d,locale:o,_originalDate:m},h=l.match(De).map(function(e){var t=e[0];return"p"===t||"P"===t?(0,he[t])(e,o.formatLong,E):e}).join("").match(Te).map(function(n){if("''"===n)return"'";var l=n[0];if("'"===l)return Oe(n);var i=me[l];if(i)return!a.useAdditionalWeekYearTokens&&_e(n)&&Ce(n,t,e),!a.useAdditionalDayOfYearTokens&&be(n)&&Ce(n,t,e),i(p,n,o.localize,E);if(l.match(Ae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return n}).join("");return h}function Oe(e){return e.match(Ne)[1].replace(we,"'")}function Ie(e){return function(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}({},e)}function Le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};f(2,arguments);var l=n.locale||le;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var a=F(e,t);if(isNaN(a))throw new RangeError("Invalid time value");var o,i,r=Ie(n);r.addSuffix=Boolean(n.addSuffix),r.comparison=a,a>0?(o=g(t),i=g(e)):(o=g(e),i=g(t));var s,u=G(i,o),c=(P(i)-P(o))/1e3,d=Math.round((u-c)/60);if(d<2)return n.includeSeconds?u<5?l.formatDistance("lessThanXSeconds",5,r):u<10?l.formatDistance("lessThanXSeconds",10,r):u<20?l.formatDistance("lessThanXSeconds",20,r):u<40?l.formatDistance("halfAMinute",null,r):l.formatDistance(u<60?"lessThanXMinutes":"xMinutes",1,r):0===d?l.formatDistance("lessThanXMinutes",1,r):l.formatDistance("xMinutes",d,r);if(d<45)return l.formatDistance("xMinutes",d,r);if(d<90)return l.formatDistance("aboutXHours",1,r);if(d<1440){var m=Math.round(d/60);return l.formatDistance("aboutXHours",m,r)}if(d<2520)return l.formatDistance("xDays",1,r);if(d<43200){var v=Math.round(d/1440);return l.formatDistance("xDays",v,r)}if(d<86400)return s=Math.round(d/43200),l.formatDistance("aboutXMonths",s,r);if((s=Y(i,o))<12){var p=Math.round(d/43200);return l.formatDistance("xMonths",p,r)}var E=s%12,h=Math.floor(s/12);return E<3?l.formatDistance("aboutXYears",h,r):E<9?l.formatDistance("overXYears",h,r):l.formatDistance("almostXYears",h+1,r)}const Re=()=>{var e,i,r,s,u,c,d,v,p;const E=a.useTranslation().t,f=o.useHistory(),g=o.useParams().id,h=Digit.ULBService.getCurrentTenantId(),y=Digit.Hooks.events.useInbox(h,{},{eventTypes:"EVENTSONGROUND",ids:g},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),S=y.isLoading,b=y.data,_=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1)[1],C=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1)[2],T=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1)[2];if(n.useEffect(()=>{_(!1),T(),C()},[]),S)return l.createElement(t.Loader,null);const D={defaultTenantId:null==b?void 0:b.tenantId,name:null==b?void 0:b.name,fromDate:xe(new Date(null==b||null===(e=b.eventDetails)||void 0===e?void 0:e.fromDate),"yyyy-MM-dd"),toDate:xe(new Date(null==b||null===(i=b.eventDetails)||void 0===i?void 0:i.toDate),"yyyy-MM-dd"),organizer:null==b||null===(r=b.eventDetails)||void 0===r?void 0:r.organizer,fees:null==b||null===(s=b.eventDetails)||void 0===s?void 0:s.fees,description:null==b?void 0:b.description,address:null==b||null===(u=b.eventDetails)||void 0===u?void 0:u.address,category:null==b?void 0:b.eventCategory,fromTime:xe(new Date(null==b||null===(c=b.eventDetails)||void 0===c?void 0:c.fromDate),"HH:mm"),toTime:xe(new Date(null==b||null===(d=b.eventDetails)||void 0===d?void 0:d.toDate),"HH:mm"),geoLocation:{latitude:null==b||null===(v=b.eventDetails)||void 0===v?void 0:v.latitude,longitude:null==b||null===(p=b.eventDetails)||void 0===p?void 0:p.longitude}};return l.createElement(n.Fragment,null,l.createElement(t.Header,null,E("ES_TITLE_EDIT_EVENTS")),l.createElement(t.FormComposer,{defaultValues:D,config:I,onSubmit:e=>{var t,n;const l=e.toDate,a=e.fromTime,o=e.toTime,i=e.address,r=e.organizer,s=e.fees,u=e.geoLocation,c={events:[m({},b,{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:m({},null==b?void 0:b.eventDetails,{fromDate:new Date(e.fromDate+" "+a).getTime(),toDate:new Date(l+" "+o).getTime(),fromTime:a,toTime:o,address:i,organizer:r,fees:s,latitude:null==u?void 0:u.latitude,longitude:null==u?void 0:u.longitude})})]};f.push("/digit-ui/employee/engagement/event/response?update=true",c)},label:E("EVENTS_SAVE_CHANGES")}))},Me=e=>{var n,o,i;const r=a.useTranslation().t;return l.createElement(t.Banner,{message:r(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,info:r("ENGAGEMENT_EVENT_NAME"),successful:e.isSuccess})},Pe=e=>{var i,s,u,c,d,m,v;const p=r.useQueryClient(),E=a.useTranslation().t,f=Digit.Hooks.useQueryParams(),g=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),h=Digit.Hooks.events.useUpdateEvent(),y=(n.useState(!1),e.location.state),S=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1),b=S[0],_=S[1],C=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1),T=C[0],D=C[1],N=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1)[1],w=(e,t)=>{var n,l,a;N((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"),_(!0)};if(n.useEffect(()=>{g.data&&D(g.data)},[g.data]),n.useEffect(()=>{h.data&&D(h.data)},[h.data]),n.useEffect(()=>{const e=()=>{_(!0),p.clear()};return b?()=>{p.clear()}:Boolean(null==f?void 0:f.delete)||Boolean(null==f?void 0:f.update)?void h.mutate(y,{onError:w,onSuccess:e}):void g.mutate(y,{onError:w,onSuccess:e})},[]),null!=f&&f.delete||null!=f&&f.update)return h.isLoading||h.isIdle&&!b?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Me,{t:E,message:null!=f&&f.update?h.isSuccess||T?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||T?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED",data:h.data||T,isSuccess:(null==h?void 0:h.isSuccess)||T,isLoading:h.isIdle&&!b||h.isLoading}),l.createElement(t.CardText,null,E(null!=f&&f.update?h.isSuccess||T?"ENGAGEMENT_EVENT_UPDATED":"ENGAGEMENT_EVENT_UPDATED_FAILED":h.isSuccess||T?"ENGAGEMENT_EVENT_DELETED":"ENGAGEMENT_EVENT_DELETED_FAILED")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))));if(g.isLoading||g.isIdle&&!b)return l.createElement(t.Loader,null);const A=(null==g||null===(i=g.data)||void 0===i||null===(s=i.events)||void 0===s?void 0:s[0])||(null==T||null===(u=T.events)||void 0===u?void 0:u[0])||{};return l.createElement(t.Card,null,l.createElement(Me,{t:E,message:g.isSuccess||T?"ENGAGEMENT_EVENT_CREATED_MESSAGE":"ENGAGEMENT_EVENT_FAILED_MESSAGES",data:g.data||T,isSuccess:g.isSuccess||T,isLoading:g.isIdle&&!b||g.isLoading}),l.createElement(t.CardText,null,g.isSuccess||T?E("ENGAGEMENT_EVENT_CREATED_MESSAGES",{eventName:null==A?void 0:A.name,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==A||null===(c=A.eventDetails)||void 0===c?void 0:c.fromDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==A||null===(d=A.eventDetails)||void 0===d?void 0:d.toDate),fromTime:g.isSuccess?xe(new Date(null==A||null===(m=A.eventDetails)||void 0===m?void 0:m.fromDate),"HH:mm"):null,toTime:g.isSuccess?xe(new Date(null==A||null===(v=A.eventDetails)||void 0===v?void 0:v.toDate),"HH:mm"):null}):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:E("CORE_COMMON_GO_TO_HOME")}))))},Fe=e=>l.createElement(t.Table,{t:e.t,data:e.data,columns:e.columns,onSearch:e.onSearch,globalSearch:e.globalSearch,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:e.pageSizeLimit,getCellProps:e.getCellProps,totalRecords:e.totalRecords,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,onPageSizeChange:e.onPageSizeChange}),ke=e=>l.createElement(t.Dropdown,{option:e.ulb,optionKey:"code",selected:e.value,select:e.onAssignmentChange,t:e.t}),Be=e=>{let n=e.onSearch,a=e.searchFields,o=e.type,r=e.onClose,s=e.isInboxPage,u=e.t;const c=i.useForm({defaultValues:e.searchParams}),d=c.handleSubmit,v=c.formState,p=c.reset,E=c.control,f=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=(Digit.ULBService.getCurrentTenantId(),Digit.UserService.getUser().info),y=g.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(S),b=()=>{p({ulb:null,eventName:""}),n({ulb:null,eventName:""})},_=e=>l.createElement(t.LinkLabel,{style:m({display:"inline"},e?{margin:0}:{}),onClick:b},u("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:d(e=>{n(e),"mobile"===o&&r()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===o||f)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,u("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==a?void 0:a.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,u(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(ke,{onAssignmentChange:e.onChange,value:e.value,ulb:y,t:u}),name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===o&&!f&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,_()))))),("mobile"===o||f)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},_(f)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:u("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Ue=e=>{let n=e.title,i=void 0===n?"EVENTS_EVENTS_HEADER":n,r=e.links,s=e.icon,u=void 0===s?"calender":s;const c=a.useTranslation().t;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"===u?l.createElement(t.EventCalendar,null):"survey"===u?"surveyIcon":l.createElement(t.DocumentIcon,null))," ",l.createElement("span",{className:"text"},c(i))),l.createElement("div",{className:"body"},r.map((e,t)=>{let n=e.link,a=e.text,i=e.hyperlink;return l.createElement("span",{className:"link",key:t},void 0!==i&&i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},He=e=>{var n,o;let i=e.status,r=e.onAssignmentChange,s=e.searchParams;const u=a.useTranslation().t;return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==s||null===(n=s.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:u(i),pageType:"employee"})},Ve=["ACTIVE","INACTIVE"],We=e=>{let t=e.onAssignmentChange,n=e.searchParams;const o=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},(0,o.t)("ES_INBOX_STATUS")),null==Ve?void 0:Ve.map((e,a)=>l.createElement(He,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},ze=e=>{var o;let i=e.type,r=void 0===i?"desktop":i,s=e.onClose,u=e.onFilterChange,c=e.searchParams;const d=a.useTranslation().t,v=n.useState(()=>m({},c)),p=v[0],E=v[1],f=Digit.ULBService.getCurrentTenantId(),g=null==f?void 0:f.split(".")[0],h=Digit.Hooks.useCommonMDMS(g,"mseva",["EventCategories"]),y=h.data,S=()=>{E({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),u({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==s||s()},b=e=>{E(m({},p,e))};return h.isLoading?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"},d("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:S},d("ES_COMMON_CLEAR_ALL")),"desktop"===r&&l.createElement("span",{className:"clear-search",onClick:S},l.createElement(t.RefreshIcon,null)),"mobile"===r&&l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+d("EVENTS_CATEGORY_LABEL")),l.createElement(t.Dropdown,{option:null==y||null===(o=y.mseva)||void 0===o?void 0:o.EventCategories,optionKey:"code",t:d,selected:null==p?void 0:p.eventCategory,select:e=>b({eventCategory:e})}),l.createElement(t.DateRange,{t:d,values:null==p?void 0:p.range,onFilterChange:b,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(We,{onAssignmentChange:(e,t)=>{var n;b(e.target.checked?{eventStatus:[...(null==p?void 0:p.eventStatus)||[],t]}:{eventStatus:null==p||null===(n=p.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:p})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(u(p),void(null==s||s())),label:d("ES_COMMON_APPLY")}))))},je=e=>l.createElement("span",{className:""},e),qe=e=>{let n=e.isLoading,a=e.data,i=e.t,r=e.onSearch,s=e.parentRoute,u=e.title,c=e.iconName,d=e.links,m=e.globalSearch,v=e.searchFields,p=e.searchParams,E=e.onFilterChange,f=e.pageSizeLimit,g=e.totalRecords,h=e.currentPage,y=e.onNextPage,S=e.onPrevPage,b=e.onPageSizeChange;const _=l.useMemo(()=>[{Header:i("EVENTS_EVENT_NAME_LABEL"),accessor:"name",Cell:e=>{let t=e.row;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:s+"/event/inbox/event-details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_EVENT_CATEGORY_LABEL"),accessor:e=>je(null!=e&&e.eventCategory?i("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)):"")},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?je(xe(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?je(xe(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return je((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let C;return n?C=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(C=l.createElement(Fe,{t:i,data:a,columns:_,globalSearch:m,onSearch:p,pageSizeLimit:f,totalRecords:g,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:b,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Ue,{title:u,icon:c,links:d}),l.createElement("div",null,l.createElement(ze,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement(Be,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},C)))},Ye=e=>{let a=e.searchFields,i=e.searchParams,r=e.onFilterChange,s=e.onSearch,u=e.t,c=e.data,d=e.serviceRequestIdKey;const m=n.useState(""),v=m[0],p=m[1],E=n.useState(!1),f=E[0],g=E[1],h=n.useState(i),y=h[0],S=h[1];Digit.ULBService.getCurrentTenantId(),o.useHistory(),n.useEffect(()=>{v&&g(!0)},[v]);const b=()=>{g(!1),S(i)};let _;return 0===(null==c?void 0:c.length)?_=l.createElement(t.Card,{style:{marginTop:20}},u("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&&(_=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"},s&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{p("SEARCH"),g(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{p("FILTER"),g(!0)}})),_,f&&l.createElement(t.PopUp,null,"FILTER"===v&&l.createElement("div",{className:"popup-module"},l.createElement(ze,{onFilterChange:r,onClose:b,onSearch:s,type:"mobile",searchParams:y})),"SEARCH"===v&&l.createElement("div",{className:"popup-module"},l.createElement(Be,{t:u,type:"mobile",onClose:b,onSearch:s,searchParams:i,searchFields:a}))))},Ge=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),Ke=e=>{let t=e.data,n=e.t,a=e.searchFields,o=e.searchParams,i=e.onFilterChange,r=e.onSearch,s=e.isLoading;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Ue,{title:e.title,icon:e.iconName,links:e.links}),l.createElement(Ye,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,i,r,s,u,c,d,m,v,p;return(!((null==o||null===(t=o.eventStatus)||void 0===t?void 0:t.length)>0)||(null==o||null===(n=o.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==o||!o.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==o||null===(a=o.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==o||null===(i=o.ulb)||void 0===i||!i.code||e.tenantId===(null==o||null===(r=o.ulb)||void 0===r?void 0:r.code))&&(null==o||!o.eventCategory||e.eventCategory===(null==o||null===(s=o.eventCategory)||void 0===s?void 0:s.code))&&(!B(null==o||null===(u=o.range)||void 0===u?void 0:u.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==o||null===(d=o.range)||void 0===d?void 0:d.startDate).getTime())&&(!B(null==o||null===(m=o.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==o||null===(p=o.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a;return{applicationNo:null==e?void 0:e.id,[n("EVENTS_EVENT_NAME_LABEL")]:null==e?void 0:e.name,[n("EVENTS_EVENT_CATEGORY_LABEL")]:n("MSEVA_EVENTCATEGORIES_"+(null==e?void 0:e.eventCategory)),[n("EVENTS_START_DATE_LABEL")]:xe(new Date(null==e||null===(t=e.eventDetails)||void 0===t?void 0:t.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:xe(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")]:Ge(n(null==e?void 0:e.status))}}),onFilterChange:i,isLoading:s,onSearch:r,searchParams:o,searchFields:a,serviceRequestIdKey:"applicationNo"}))))},Qe=e=>{var o;let i=e.tenants,r=e.parentRoute;const s=a.useTranslation().t;Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const u=Digit.ULBService.getCurrentTenantId(),c=n.useState(10),d=c[0],v=c[1],p=n.useState(0),E=p[0],f=p[1],g=n.useState({eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===u)}),h=g[0],y=g[1];let S=window.Digit.Utils.browser.isMobile();const b=()=>[{label:s("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:s("EVENTS_NAME_LABEL"),name:"eventName"}],_=[{text:s("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox/new-event"}],C=Digit.Hooks.events.useInbox(null==h||null===(o=h.ulb)||void 0===o?void 0:o.code,{},{eventTypes:"EVENTSONGROUND",limit:d,offset:E},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),T=C.data,D=C.isLoading,N=e=>{let t=m({},e);null!=e&&e.ulb||(t=m({},e,{ulb:{code:u}})),y(m({},h,t))},w=e=>{y(m({},h,e))},A=n.useCallback(()=>{f(e=>parseInt(e)+parseInt(d))},[d]),x=n.useCallback(()=>{f(e=>parseInt(e)-parseInt(d))},[d]);return S?l.createElement(Ke,{data:null==T?void 0:T.events,searchParams:h,searchFields:b(),t:s,onFilterChange:w,onSearch:N,isLoading:D,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:_}):l.createElement("div",null,l.createElement(t.Header,null,s("EVENTS_EVENTS_HEADER"),Number(null==T?void 0:T.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==T?void 0:T.totalCount)):null),l.createElement(qe,{t:s,data:null==T?void 0:T.events,links:_,parentRoute:r,searchParams:h,onSearch:N,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,s,u,c,d,m,v,p;return(!((null==h||null===(t=h.eventStatus)||void 0===t?void 0:t.length)>0)||(null==h||null===(n=h.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==h||!h.eventName||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==h?void 0:h.eventName.toUpperCase())))&&(null==h||null===(i=h.ulb)||void 0===i||!i.code||e.original.tenantId===(null==h||null===(r=h.ulb)||void 0===r?void 0:r.code))&&(null==h||!h.eventCategory||e.original.eventCategory===(null==h||null===(s=h.eventCategory)||void 0===s?void 0:s.code))&&(!B(null==h||null===(u=h.range)||void 0===u?void 0:u.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==h||null===(d=h.range)||void 0===d?void 0:d.startDate).getTime())&&(!B(null==h||null===(m=h.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==h||null===(p=h.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:b(),onFilterChange:w,pageSizeLimit:d,totalRecords:null==T?void 0:T.totalCount,title:"EVENTS_EVENTS_HEADER",iconName:"calender",links:_,currentPage:parseInt(E/d),onNextPage:A,onPrevPage:x,onPageSizeChange:e=>{v(t=>e.target.value)}}))},Xe=e=>l.createElement(t.Table,{t:e.t,data:e.data,columns:e.columns,onSearch:e.onSearch,globalSearch:e.globalSearch,manualGlobalFilter:!0,manualPagination:!0,pageSizeLimit:e.pageSizeLimit,getCellProps:e.getCellProps,totalRecords:e.totalRecords,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,onPageSizeChange:e.onPageSizeChange}),Ze=e=>l.createElement(t.Dropdown,{option:e.ulb,optionKey:"code",selected:e.value,select:e.onAssignmentChange,t:e.t}),$e=e=>{let n=e.onSearch,a=e.searchFields,o=e.type,r=e.onClose,s=e.isInboxPage,u=e.t;const c=i.useForm({defaultValues:e.searchParams}),d=c.handleSubmit,v=c.formState,p=c.reset,E=c.control,f=innerWidth<=640,g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,y=g.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(S),b=()=>{p({ulb:null,name:""}),n({ulb:null,name:""})},_=e=>l.createElement(t.LinkLabel,{style:m({display:"inline"},e?{margin:0}:{}),onClick:b},u("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:d(e=>{n(e),"mobile"===o&&r()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:s?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===o||f)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,u("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(s?"":"for-search"),style:{width:"100%",display:"grid"}},null==a?void 0:a.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,u(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},render:e=>l.createElement(Ze,{onAssignmentChange:e.onChange,value:e.value,ulb:y,t:u}),name:e.name,control:E,defaultValue:null});case"range":return l.createElement(i.Controller,{render:e=>{let n=e.onChange;return l.createElement(t.DateRange,{t:u,values:e.value,onFilterChange:e=>n(e.range),labelClass:"filter-label"})},name:e.name,control:E,defaultValue:null});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:E,defaultValue:null})}})(e)),null!=v&&null!==(a=v.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==v||null===(o=v.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===o&&!f&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset",marginTop:"55px"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("div",null,_()))))),("mobile"===o||f)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},_(f)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(v.errors).length,label:u("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},Je=e=>{let n=e.title,i=void 0===n?"CS_HEADER_PUBLIC_BRDCST":n,r=e.links;const s=a.useTranslation().t;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"},s(i))),l.createElement("div",{className:"body"},r.map((e,t)=>{let n=e.link,a=e.text,i=e.hyperlink;return l.createElement("span",{className:"link",key:t},void 0!==i&&i?l.createElement("a",{href:n},a):l.createElement(o.Link,{to:n},a))}))))},et=e=>{var n,o;let i=e.status,r=e.onAssignmentChange,s=e.searchParams;const u=a.useTranslation().t;return l.createElement(t.CheckBox,{onChange:e=>r(e,i),checked:(null==s||null===(n=s.eventStatus)||void 0===n||null===(o=n.filter(e=>e===i))||void 0===o?void 0:o.length)>0,label:u(i),pageType:"employee"})},tt=["ACTIVE","INACTIVE"],nt=e=>{let t=e.onAssignmentChange,n=e.searchParams;const o=a.useTranslation();return l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},(0,o.t)("ES_INBOX_STATUS")),null==tt?void 0:tt.map((e,a)=>l.createElement(et,{key:a,status:e,onAssignmentChange:t,searchParams:n})))},lt=e=>{let o=e.type,i=void 0===o?"desktop":o,r=e.onClose,s=e.onFilterChange,u=e.searchParams;const c=a.useTranslation().t,d=n.useState(()=>m({},u)),v=d[0],p=d[1],E=Digit.ULBService.getCurrentTenantId(),f=null==E?void 0:E.split(".")[0],g=Digit.Hooks.useCommonMDMS(f,"mseva",["EventCategories"]).isLoading,h=()=>{p({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),s({eventCategory:null,eventStatus:[],range:{startDate:null,endDate:new Date(""),title:""}}),null==r||r()},y=n.useCallback(e=>{p(t=>m({},t,e))},[]);return g?l.createElement(t.Loader,null):l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},c("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:h},c("ES_COMMON_CLEAR_ALL")),"desktop"===i&&l.createElement("span",{className:"clear-search",onClick:h},l.createElement(t.RefreshIcon,null)),"mobile"===i&&l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement(t.DateRange,{t:c,values:null==v?void 0:v.range,onFilterChange:y,labelClass:"filter-label"}),l.createElement("div",null,l.createElement(nt,{onAssignmentChange:(e,t)=>{var n;y(e.target.checked?{eventStatus:[...(null==v?void 0:v.eventStatus)||[],t]}:{eventStatus:null==v||null===(n=v.eventStatus)||void 0===n?void 0:n.filter(e=>e!==t)})},searchParams:v})),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(s(v),void(null==r||r())),label:c("ES_COMMON_APPLY")}))))},at=e=>l.createElement("span",{className:""},e),ot=e=>{let n=e.isLoading,a=e.data,i=e.t,r=e.onSearch,s=e.parentRoute,u=e.title,c=e.iconName,d=e.links,m=e.globalSearch,v=e.searchFields,p=e.searchParams,E=e.onFilterChange,f=e.pageSizeLimit,g=e.totalRecords,h=e.currentPage,y=e.onNextPage,S=e.onPrevPage,b=e.onPageSizeChange;const _=l.useMemo(()=>[{Header:i("EVENTS_MESSAGE_LABEL"),accessor:"name",Cell:e=>{let t=e.row;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:s+"/messages/inbox/details/"+t.original.id},t.original.name)))}},{Header:i("EVENTS_POSTING_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?at(xe(new Date(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime),"dd/MM/yyyy")):""}},{Header:i("EVENTS_START_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.fromDate?at(xe(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.fromDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_END_DATE_LABEL"),accessor:e=>{var t,n;return null!=e&&null!==(t=e.eventDetails)&&void 0!==t&&t.toDate?at(xe(new Date(null==e||null===(n=e.eventDetails)||void 0===n?void 0:n.toDate),"dd/MM/yyyy")):""}},{Header:i("EVENTS_POSTEDBY_LABEL"),accessor:e=>{var t;return at((null==e||null===(t=e.user)||void 0===t?void 0:t.name)||"")}},{Header:i("EVENTS_STATUS_LABEL"),accessor:e=>(e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e))(i(null==e?void 0:e.status))}]);let C;return n?C=l.createElement(t.Loader,null):(null==a?void 0:a.length)>0&&(C=l.createElement(Xe,{t:i,data:a,columns:_,globalSearch:m,onSearch:p,pageSizeLimit:f,totalRecords:g,currentPage:h,onNextPage:y,onPrevPage:S,onPageSizeChange:b,getCellProps:e=>({style:{minWidth:e.column.Header===i("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Je,{title:u,icon:c,links:d}),l.createElement("div",null,l.createElement(lt,{onFilterChange:E,searchParams:p}))),l.createElement("div",{style:{flex:1}},l.createElement($e,{t:i,onSearch:r,type:"desktop",searchFields:v,isInboxPage:!0,searchParams:p}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},C)))},it=e=>{let a=e.searchFields,i=e.searchParams,r=e.onFilterChange,s=e.onSearch,u=e.t,c=e.data,d=e.responseData;const m=n.useState(""),v=m[0],p=m[1],E=n.useState(!1),f=E[0],g=E[1],h=n.useState(i),y=h[0],S=h[1],_=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{v&&g(!0)},[v]);const C=()=>{g(!1),S(i)};let T;return 0===(null==c?void 0:c.length)?T=l.createElement(t.Card,{style:{marginTop:20}},u("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&&(T=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>{var n;return b(null==t||null===(n=t.user)||void 0===n?void 0:n.name,e["Posted By"])&&b(t.name,e.Title)});t&&_.push("/digit-ui/employee/engagement/messages/inbox/details/"+(null==t?void 0:t.id))}})),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},s&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{p("SEARCH"),g(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{p("FILTER"),g(!0)}})),T,f&&l.createElement(t.PopUp,null,"FILTER"===v&&l.createElement("div",{className:"popup-module"},l.createElement(lt,{onFilterChange:r,onClose:C,onSearch:s,type:"mobile",searchParams:y})),"SEARCH"===v&&l.createElement("div",{className:"popup-module"},l.createElement($e,{t:u,type:"mobile",onClose:C,onSearch:s,searchParams:i,searchFields:a}))))},rt=e=>l.createElement("span","Active"===e?{className:"sla-cell-success"}:{className:"sla-cell-error"},e),st=e=>{let t=e.data,n=e.t,a=e.searchFields,o=e.searchParams,i=e.onFilterChange,r=e.onSearch,s=e.isLoading;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Je,{title:e.title,icon:e.iconName,links:e.links}),l.createElement(it,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,i,r,s,u,c,d,m,v,p;return(!((null==o||null===(t=o.eventStatus)||void 0===t?void 0:t.length)>0)||(null==o||null===(n=o.eventStatus)||void 0===n?void 0:n.includes(e.status)))&&(null==o||!o.eventName||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==o||null===(a=o.eventName)||void 0===a?void 0:a.toUpperCase())))&&(null==o||null===(i=o.ulb)||void 0===i||!i.code||e.tenantId===(null==o||null===(r=o.ulb)||void 0===r?void 0:r.code))&&(null==o||!o.eventCategory||e.eventCategory===(null==o||null===(s=o.eventCategory)||void 0===s?void 0:s.code))&&(!B(null==o||null===(u=o.range)||void 0===u?void 0:u.startDate)||(null===(c=e.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==o||null===(d=o.range)||void 0===d?void 0:d.startDate).getTime())&&(!B(null==o||null===(m=o.range)||void 0===m?void 0:m.endDate)||(null===(v=e.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==o||null===(p=o.range)||void 0===p?void 0:p.endDate).getTime())}).map(e=>{var t,l,a,o;return{[n("PUBLIC_BRDCST_TITLE_LABEL")]:null==e?void 0:e.name,[n("EVENTS_POSTING_DATE_LABEL")]:xe(new Date(null==e||null===(t=e.auditDetails)||void 0===t?void 0:t.createdTime),"dd/MM/yyyy"),[n("EVENTS_START_DATE_LABEL")]:xe(new Date(null==e||null===(l=e.eventDetails)||void 0===l?void 0:l.fromDate),"dd/MM/yyyy"),[n("EVENTS_END_DATE_LABEL")]:xe(new Date(null==e||null===(a=e.eventDetails)||void 0===a?void 0:a.toDate),"dd/MM/yyyy"),[n("EVENTS_POSTEDBY_LABEL")]:null==e||null===(o=e.user)||void 0===o?void 0:o.name,[n("EVENTS_STATUS_LABEL")]:rt(n(null==e?void 0:e.status))}}),onFilterChange:i,isLoading:s,onSearch:r,searchParams:o,searchFields:a,responseData:t}))))},ut=e=>{var o;let i=e.tenants,r=e.parentRoute;const s=a.useTranslation().t;Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i);const u=Digit.ULBService.getCurrentTenantId(),c=n.useState(10),d=c[0],v=c[1],p=n.useState(0),E=p[0],f=p[1],g=n.useState({eventStatus:[],name:"",range:{startDate:null,endDate:new Date(""),title:""},ulb:null==i?void 0:i.find(e=>(null==e?void 0:e.code)===u)}),h=g[0],y=g[1];let S=window.Digit.Utils.browser.isMobile();const b=Digit.Hooks.events.useInbox(null==h||null===(o=h.ulb)||void 0===o?void 0:o.code,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST",limit:d,offset:E},{select:e=>({events:null==e?void 0:e.events,totalCount:null==e?void 0:e.totalCount})}),_=b.data,C=b.isLoading,T=e=>{let t=m({},e);null!=e&&e.ulb||(t=m({},e,{ulb:{code:u}})),y(e=>m({},e,t))},D=e=>{y(t=>m({},t,e))},N=()=>[{label:s("EVENTS_ULB_LABEL"),name:"ulb",type:"ulb"},{label:s("EVENTS_MESSAGE_LABEL"),name:"name"}],w=[{text:s("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/inbox/create"}],A=n.useCallback(()=>{f(e=>parseInt(e)+parseInt(d))},[d]),x=n.useCallback(()=>{f(e=>parseInt(e)-parseInt(d))},[d]);return S?l.createElement(st,{data:null==_?void 0:_.events,searchParams:h,searchFields:N(),t:s,onFilterChange:D,onSearch:T,isLoading:C,title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",iconName:"calender",links:w}):l.createElement("div",null,l.createElement(t.Header,null,s("EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER"),Number(null==_?void 0:_.length)?l.createElement("p",{className:"inbox-count"},Number(null==_?void 0:_.length)):null),l.createElement(ot,{t:s,data:null==_?void 0:_.events,links:w,parentRoute:r,searchParams:h,onSearch:T,globalSearch:(e,t)=>null==e?void 0:e.filter(e=>{var t,n,l,a,o,i,r,s,u,c,d,m,v,p;return(!((null==h||null===(t=h.eventStatus)||void 0===t?void 0:t.length)>0)||(null==h||null===(n=h.eventStatus)||void 0===n?void 0:n.includes(null===(l=e.original)||void 0===l?void 0:l.status)))&&(null==h||!h.name||(null===(a=e.original)||void 0===a||null===(o=a.name)||void 0===o?void 0:o.toUpperCase().startsWith(null==h?void 0:h.name.toUpperCase())))&&(null==h||null===(i=h.ulb)||void 0===i||!i.code||e.original.tenantId===(null==h||null===(r=h.ulb)||void 0===r?void 0:r.code))&&(null==h||!h.eventCategory||e.original.eventCategory===(null==h||null===(s=h.eventCategory)||void 0===s?void 0:s.code))&&(!B(null==h||null===(u=h.range)||void 0===u?void 0:u.startDate)||(null===(c=e.original.eventDetails)||void 0===c?void 0:c.fromDate)>=new Date(null==h||null===(d=h.range)||void 0===d?void 0:d.startDate).getTime())&&(!B(null==h||null===(m=h.range)||void 0===m?void 0:m.endDate)||(null===(v=e.original.eventDetails)||void 0===v?void 0:v.toDate)<=new Date(null==h||null===(p=h.range)||void 0===p?void 0:p.endDate).getTime())}),searchFields:N(),onFilterChange:D,pageSizeLimit:d,totalRecords:null==_?void 0:_.totalCount,currentPage:parseInt(E/d),onNextPage:A,onPrevPage:x,onPageSizeChange:e=>{v(t=>e.target.value)},title:"EVENTS_PUBLIC_MESSAGE_NOTICE_HEADER",links:w,isLoading:C}))},ct=[{head:"",body:[{type:"form",withoutLabel:!0,component:"MessageForm",nextStep:"",route:"",key:"messageData"}]}],dt=()=>{const e=a.useTranslation().t,i=o.useHistory(),r=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1)[1],s=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1)[2],u=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1)[2];return n.useEffect(()=>{r(!1),u(),s()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,e("ADD_NEW_PUBLIC_MESSAGE")),l.createElement(t.FormComposer,{config:ct,onSubmit:e=>{var t,n,l;const a=e.toDate,o={events:[{recepient:null,source:"WEBAPP",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:e.description,name:e.name,eventDetails:{documents:e.documents,fromDate:null===(n=O(new Date(""+e.fromDate)))||void 0===n?void 0:n.getTime(),toDate:null===(l=O(new Date(""+a)))||void 0===l?void 0:l.getTime()}}]};i.push("/digit-ui/employee/engagement/messages/response",o)},label:e("ACTION_ADD_NEW_MESSAGE")}))},mt=e=>{var n,o,i;const r=a.useTranslation();return l.createElement(t.Banner,{message:(0,r.t)(e.message),applicationNumber:null==e||null===(n=e.data)||void 0===n||null===(o=n.events)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.name,successful:e.isSuccess})},vt=e=>{const i=r.useQueryClient(),s=a.useTranslation().t,u=Digit.Hooks.useQueryParams(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.events.useCreateEvent()),d=Digit.Hooks.events.useUpdateEvent(),m=e.location.state,v=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1),p=v[0],E=v[1],f=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1),g=f[0],h=f[1],y=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1)[1];n.useEffect(()=>{d.data&&h(d.data)},[d.data]),n.useEffect(()=>{c.data&&h(c.data)},[c.data]);const S=(e,t)=>{var n,l,a;y((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),i.clear()};if(!p){if(Boolean(null==u?void 0:u.delete)||Boolean(null==u?void 0:u.update))return void d.mutate(m,{onError:S,onSuccess:e});c.mutate(m,{onError:S,onSuccess:e})}},[]),null!=u&&u.delete||null!=u&&u.update?d.isLoading||d.isIdle&&!p?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(mt,{t:s,message:null!=u&&u.update?d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_UPDATED":"ENG_PUBLIC_BRDCST_UPDATION_FAILED":d.isSuccess||g?"ENGAGEMENT_PUBLIC_BRDCST_DELETED":"ENGAGEMENT_PUBLIC_BRDCST_DELETION_FAILED",data:d.data||g,isSuccess:(null==d?void 0:d.isSuccess)||g,isLoading:d.isIdle&&!p||d.isLoading}),l.createElement(t.CardText,null,s("ENGAGEMENT_PUBLIC_BRDCST_MESSAGES")),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")})))):c.isLoading||c.isIdle&&!p?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(mt,{t:s,message:c.isSuccess||g?"ENGAGEMENT_BROADCAST_MESSAGE_CREATED":"ENGAGEMENT_BROADCAST_MESSAGE_FAILED",data:c.data||g,isSuccess:c.isSuccess||g,isLoading:c.isIdle&&!p||c.isLoading}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},pt=()=>{const e=a.useTranslation().t,i=o.useHistory(),r=o.useParams().id,s=Digit.ULBService.getCurrentTenantId(),u=Digit.Hooks.events.useInbox(s,{},{eventTypes:"BROADCAST",ids:r},{select:e=>{var t;return null==e||null===(t=e.events)||void 0===t?void 0:t[0]}}),c=u.isLoading,d=u.data,v=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1)[1],p=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1)[2],E=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1)[2];n.useEffect(()=>{v(!1),E(),p()},[]);const f=n.useMemo(()=>{var e,t,n;const l=null==d||null===(e=d.eventDetails)||void 0===e?void 0:e.documents;return{name:null==d?void 0:d.name,description:null==d?void 0:d.description,documents:null==l?void 0:l.map(e=>[e.fileName,{file:{name:e.fileName,type:e.documentType},fileStoreId:{fileStoreId:e.fileStoreId,tenantId:s}}]),fromDate:d?xe(new Date(null==d||null===(t=d.eventDetails)||void 0===t?void 0:t.fromDate),"yyyy-MM-dd"):null,toDate:d?xe(new Date(null==d||null===(n=d.eventDetails)||void 0===n?void 0:n.toDate),"yyyy-MM-dd"):null}},[d]);return c?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:f,config:ct,onSubmit:e=>{var t;const n=e.fromDate,l=e.toDate,a=e.description,o=e.name,r=e.documents,s=(e=>!(!e||!e.length||!(Array.isArray(e)&&e.length&&Array.isArray(e[0]))))(r)?(u=r)&&u.length?u.reduce((e,t)=>{let n={};const l=t[1],a=l.file,o=l.fileStoreId;return n.fileName=null==a?void 0:a.name,n.documentType=null==a?void 0:a.type,n.fileStoreId=null==o?void 0:o.fileStoreId,e.push(n),e},[]):[]:r;var u;const c={events:[m({},d,{source:"WEBAPP",status:"ACTIVE",eventType:"BROADCAST",tenantId:null==e||null===(t=e.tenantId)||void 0===t?void 0:t.code,description:a,name:o,eventDetails:{documents:s,fromDate:x(""+n),toDate:x(""+l)}})]};i.push("/digit-ui/employee/engagement/messages/response?update=true",c)},label:e("ACTION_EDIT_MESSAGE")}))};var Et="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ft(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function gt(e,t){return e(t={exports:{}},t.exports),t.exports}var ht="function"==typeof Symbol&&Symbol.for,yt=ht?Symbol.for("react.element"):60103,St=ht?Symbol.for("react.portal"):60106,bt=ht?Symbol.for("react.fragment"):60107,_t=ht?Symbol.for("react.strict_mode"):60108,Ct=ht?Symbol.for("react.profiler"):60114,Tt=ht?Symbol.for("react.provider"):60109,Dt=ht?Symbol.for("react.context"):60110,Nt=ht?Symbol.for("react.async_mode"):60111,wt=ht?Symbol.for("react.concurrent_mode"):60111,At=ht?Symbol.for("react.forward_ref"):60112,xt=ht?Symbol.for("react.suspense"):60113,Ot=ht?Symbol.for("react.suspense_list"):60120,It=ht?Symbol.for("react.memo"):60115,Lt=ht?Symbol.for("react.lazy"):60116,Rt=ht?Symbol.for("react.block"):60121,Mt=ht?Symbol.for("react.fundamental"):60117,Pt=ht?Symbol.for("react.responder"):60118,Ft=ht?Symbol.for("react.scope"):60119;function kt(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case yt:switch(e=e.type){case Nt:case wt:case bt:case Ct:case _t:case xt:return e;default:switch(e=e&&e.$$typeof){case Dt:case At:case Lt:case It:case Tt:return e;default:return t}}case St:return t}}}function Bt(e){return kt(e)===wt}var Ut={AsyncMode:Nt,ConcurrentMode:wt,ContextConsumer:Dt,ContextProvider:Tt,Element:yt,ForwardRef:At,Fragment:bt,Lazy:Lt,Memo:It,Portal:St,Profiler:Ct,StrictMode:_t,Suspense:xt,isAsyncMode:function(e){return Bt(e)||kt(e)===Nt},isConcurrentMode:Bt,isContextConsumer:function(e){return kt(e)===Dt},isContextProvider:function(e){return kt(e)===Tt},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===yt},isForwardRef:function(e){return kt(e)===At},isFragment:function(e){return kt(e)===bt},isLazy:function(e){return kt(e)===Lt},isMemo:function(e){return kt(e)===It},isPortal:function(e){return kt(e)===St},isProfiler:function(e){return kt(e)===Ct},isStrictMode:function(e){return kt(e)===_t},isSuspense:function(e){return kt(e)===xt},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===bt||e===wt||e===Ct||e===_t||e===xt||e===Ot||"object"==typeof e&&null!==e&&(e.$$typeof===Lt||e.$$typeof===It||e.$$typeof===Tt||e.$$typeof===Dt||e.$$typeof===At||e.$$typeof===Mt||e.$$typeof===Pt||e.$$typeof===Ft||e.$$typeof===Rt)},typeOf:kt},Ht=gt(function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,r=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var v=e.type;switch(v){case u:case c:case a:case i:case o:case m:return v;default:var f=v&&v.$$typeof;switch(f){case s:case d:case E:case p:case r:return f;default:return t}}case l:return t}}}var b=c,_=s,C=r,T=n,D=d,N=a,w=E,A=p,x=l,O=i,I=o,L=m,R=!1;function M(e){return S(e)===c}t.AsyncMode=u,t.ConcurrentMode=b,t.ContextConsumer=_,t.ContextProvider=C,t.Element=T,t.ForwardRef=D,t.Fragment=N,t.Lazy=w,t.Memo=A,t.Portal=x,t.Profiler=O,t.StrictMode=I,t.Suspense=L,t.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),M(e)||S(e)===u},t.isConcurrentMode=M,t.isContextConsumer=function(e){return S(e)===s},t.isContextProvider=function(e){return S(e)===r},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return S(e)===d},t.isFragment=function(e){return S(e)===a},t.isLazy=function(e){return S(e)===E},t.isMemo=function(e){return S(e)===p},t.isPortal=function(e){return S(e)===l},t.isProfiler=function(e){return S(e)===i},t.isStrictMode=function(e){return S(e)===o},t.isSuspense=function(e){return S(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===c||e===i||e===o||e===m||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===p||e.$$typeof===r||e.$$typeof===s||e.$$typeof===d||e.$$typeof===g||e.$$typeof===h||e.$$typeof===y||e.$$typeof===f)},t.typeOf=S}()}),Vt=gt(function(e){e.exports="production"===process.env.NODE_ENV?Ut:Ht}),Wt=Object.getOwnPropertySymbols,zt=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable;function qt(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var Yt=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,a=qt(e),o=1;o<arguments.length;o++){for(var i in n=Object(arguments[o]))zt.call(n,i)&&(a[i]=n[i]);if(Wt){l=Wt(n);for(var r=0;r<l.length;r++)jt.call(n,l[r])&&(a[l[r]]=n[l[r]])}}return a},Gt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Kt=Function.call.bind(Object.prototype.hasOwnProperty),Qt=function(){};if("production"!==process.env.NODE_ENV){var Xt=Gt,Zt={},$t=Kt;Qt=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function Jt(e,t,n,l,a){if("production"!==process.env.NODE_ENV)for(var o in e)if($t(e,o)){var i;try{if("function"!=typeof e[o]){var r=Error((l||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}i=e[o](t,o,l,n,null,Xt)}catch(e){i=e}if(!i||i instanceof Error||Qt((l||"React class")+": type specification of "+n+" `"+o+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in Zt)){Zt[i.message]=!0;var s=a?a():"";Qt("Failed "+n+" type: "+i.message+(null!=s?s:""))}}}Jt.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Zt={})};var en=Jt,tn=function(){};function nn(){return null}function ln(){}function an(){}"production"!==process.env.NODE_ENV&&(tn=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),an.resetWarningCache=ln;var on=gt(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,l={array:r("array"),bigint:r("bigint"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),symbol:r("symbol"),any:i(nn),arrayOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=t[n];if(!Array.isArray(r))return new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected an array.");for(var s=0;s<r.length;s++){var u=e(r,s,l,a,i+"["+s+"]",Gt);if(u instanceof Error)return u}return null})},element:i(function(t,n,l,a,i){var r=t[n];return e(r)?null:new o("Invalid "+a+" `"+i+"` of type `"+c(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:i(function(e,t,n,l,a){var i=e[t];return Vt.isValidElementType(i)?null:new o("Invalid "+l+" `"+a+"` of type `"+c(i)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return i(function(t,n,l,a,i){var r;return t[n]instanceof e?null:new o("Invalid "+a+" `"+i+"` of type `"+((r=t[n]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:i(function(e,t,n,l,a){return u(e[t])?null:new o("Invalid "+l+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return i(function(t,n,l,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=t[n],s=c(r);if("object"!==s)return new o("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+l+"`, expected an object.");for(var u in r)if(Kt(r,u)){var d=e(r,u,l,a,i+"."+u,Gt);if(d instanceof Error)return d}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&tn(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),nn;function t(t,n,l,i,r){for(var s=t[n],u=0;u<e.length;u++)if(a(s,e[u]))return null;var c=JSON.stringify(e,function(e,t){return"symbol"===d(t)?String(t):t});return new o("Invalid "+i+" `"+r+"` of value `"+String(s)+"` supplied to `"+l+"`, expected one of "+c+".")}return i(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&tn("Invalid argument supplied to oneOfType, expected an instance of array."),nn;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return tn("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+m(n)+" at index "+t+"."),nn}return i(function(t,n,l,a,i){for(var r=[],s=0;s<e.length;s++){var u=(0,e[s])(t,n,l,a,i,Gt);if(null==u)return null;u.data&&Kt(u.data,"expectedType")&&r.push(u.data.expectedType)}return new o("Invalid "+a+" `"+i+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return i(function(t,n,l,a,i){var r=t[n],u=c(r);if("object"!==u)return new o("Invalid "+a+" `"+i+"` of type `"+u+"` supplied to `"+l+"`, expected `object`.");for(var m in e){var v=e[m];if("function"!=typeof v)return s(l,a,i,m,d(v));var p=v(r,m,l,a,i+"."+m,Gt);if(p)return p}return null})},exact:function(e){return i(function(t,n,l,a,i){var r=t[n],u=c(r);if("object"!==u)return new o("Invalid "+a+" `"+i+"` of type `"+u+"` supplied to `"+l+"`, expected `object`.");var m=Yt({},t[n],e);for(var v in m){var p=e[v];if(Kt(e,v)&&"function"!=typeof p)return s(l,a,i,v,d(p));if(!p)return new o("Invalid "+a+" `"+i+"` key `"+v+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=p(r,v,l,a,i+"."+v,Gt);if(E)return E}return null})}};function a(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function o(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function i(e){function t(t,n,l,a,i,r,s){if(a=a||"<<anonymous>>",r=r||l,s!==Gt){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}return null==n[l]?t?new o(null===n[l]?"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `null`.":"The "+i+" `"+r+"` is marked as required in `"+a+"`, but its value is `undefined`."):null:e(n,l,a,i,r)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){return i(function(t,n,l,a,i,r){var s=t[n];return c(s)!==e?new o("Invalid "+a+" `"+i+"` of type `"+d(s)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function s(e,t,n,l,a){return new o((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+a+"`.")}function u(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(u);if(null===t||e(t))return!0;var l=function(e){var t=e&&(n&&e[n]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!l)return!1;var a,o=l.call(t);if(l!==t.entries){for(;!(a=o.next()).done;)if(!u(a.value))return!1}else for(;!(a=o.next()).done;){var i=a.value;if(i&&!u(i[1]))return!1}return!0;default:return!1}}function c(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function d(e){if(null==e)return""+e;var t=c(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function m(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return o.prototype=Error.prototype,l.checkPropTypes=en,l.resetWarningCache=en.resetWarningCache,l.PropTypes=l,l}(Vt.isElement):function(){function e(e,t,n,l,a,o){if(o!==Gt){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:an,resetWarningCache:ln};return n.PropTypes=n,n}()});const rn=e=>{const t=n.useState(e.selectedVal?e.selectedVal:""),a=t[0],o=t[1];return n.useEffect(()=>{e.keepNull?o(""):e.selectedVal?o(e.selectedVal):(o(""),e.setFilter(""))},[e.selectedVal,e.forceSet]),l.createElement("input",{ref:e.inputRef,className:"employee-select-wrap--elipses "+(e.disable&&"disabled"),type:"text",value:a,onChange:function(t){e.freeze||(o(t.target.value),e.setFilter(t.target.value))},onClick:e.onClick,onFocus:function(){e.disable||e.dropdownDisplay(!0)},onBlur:t=>{var n;e.dropdownDisplay(!1),null==e||null===(n=e.onBlur)||void 0===n||n.call(e,t),e.selectedVal!==e.filterVal&&setTimeout(()=>{e.setforceSet(e=>e+1)},1e3)},onKeyDown:t=>{var n,l,a,o,i,r,s,u,c,d,m,v,p;if("ArrowDown"==t.key)e.setOptionIndex(t=>t+1==e.addProps.length?0:t+1),e.addProps.currentIndex+1==e.addProps.length?null==t||null===(n=t.target)||void 0===n||null===(l=n.parentElement)||void 0===l||null===(a=l.parentElement)||void 0===a||null===(o=a.children)||void 0===o||null===(i=o.namedItem("jk-dropdown-unique"))||void 0===i||null===(r=i.scrollTo)||void 0===r||r.call(i,0,0):(null==e||null===(s=e.addProps)||void 0===s?void 0:s.currentIndex)>2&&(null==t||null===(u=t.target)||void 0===u||null===(c=u.parentElement)||void 0===c||null===(d=c.parentElement)||void 0===d||null===(m=d.children)||void 0===m||null===(v=m.namedItem("jk-dropdown-unique"))||void 0===v||null===(p=v.scrollBy)||void 0===p||p.call(v,0,45)),t.preventDefault();else if("ArrowUp"==t.key){var E,f,g,h,y,S,b,_,C,T,D,N,w;e.setOptionIndex(t=>0!==t?t-1:e.addProps.length-1),0==e.addProps.currentIndex?null==t||null===(E=t.target)||void 0===E||null===(f=E.parentElement)||void 0===f||null===(g=f.parentElement)||void 0===g||null===(h=g.children)||void 0===h||null===(y=h.namedItem("jk-dropdown-unique"))||void 0===y||null===(S=y.scrollTo)||void 0===S||S.call(y,1e5,1e5):(null==e||null===(b=e.addProps)||void 0===b?void 0:b.currentIndex)>2&&(null==t||null===(_=t.target)||void 0===_||null===(C=_.parentElement)||void 0===C||null===(T=C.parentElement)||void 0===T||null===(D=T.children)||void 0===D||null===(N=D.namedItem("jk-dropdown-unique"))||void 0===N||null===(w=N.scrollBy)||void 0===w||w.call(N,0,-45)),t.preventDefault()}else"Enter"==t.key&&e.addProps.selectOption(e.addProps.currentIndex)},readOnly:e.disable,autoFocus:e.autoFocus,placeholder:e.placeholder,autoComplete:"off",style:m({},e.style,{zIndex:"auto"})})},sn=e=>e,un=e=>{var a,o,i;const r=Digit.SessionStorage.get("userType"),s=n.useState(!1),u=s[0],c=s[1],d=n.useState(e.selected?e.selected:null),v=d[0],p=d[1],E=n.useState(""),f=E[0],g=E[1],h=n.useState(0),y=h[0],S=h[1],b=n.useState(-1),_=b[0],C=b[1],T=n.useRef(null),D=!!e.customSelector,N=e.t||sn;function w(){if(!e.disable){var t,n=u;n||document.addEventListener("mousedown",A,!1),c(!n),null==e||null===(t=e.onBlur)||void 0===t||t.call(e)}}function A(e){T.current&&T.current.contains(e.target)||(document.removeEventListener("mousedown",A,!1),c(!1))}function x(t){t!==v||e.allowMultiselect?(e.select(t),p(t),c(!1)):(p(t),S(y+1))}n.useEffect(()=>{p(e.selected)},[e.selected]),console.log("option",e.option);let O=e.option&&(null===(a=e.option)||void 0===a?void 0:a.filter(t=>{var n,l;return(null===(n=N(t[e.optionKey]))||void 0===n||null===(l=n.toUpperCase())||void 0===l?void 0:l.indexOf(null==f?void 0:f.toUpperCase()))>-1}))||[];var I,L;return"PropertyType"==(null==e||null===(o=e.option)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.label)&&(O=e.option),e.isBPAREG&&v&&((null===(I=e.option)||void 0===I||null===(L=I.filter(e=>(null==e?void 0:e.code)===(null==v?void 0:v.code)))||void 0===L?void 0:L.length)>0||p(null)),l.createElement("div",{className:("employee"===r?"employee-select-wrap":"select-wrap")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:m({},e.style)},D&&l.createElement("div",{className:e.showArrow?"cp flex-right column-gap-5":"cp",onClick:w},e.customSelector,e.showArrow&&l.createElement(t.ArrowDown,{onClick:w,className:e.disable&&"disabled"})),!D&&l.createElement("div",{className:(u?"select-active":"select")+" "+(e.disable&&"disabled"),style:e.errorStyle?{border:"1px solid red"}:{}},l.createElement(rn,{autoComplete:e.autoComplete,setFilter:function(e){g(e)},forceSet:y,setforceSet:S,setOptionIndex:C,keepNull:e.keepNull,selectedVal:v?e.t?e.isMultiSelectEmp?v+" "+N("BPA_SELECTED_TEXT"):e.t(e.optionKey?v[e.optionKey]:v):e.optionKey?v[e.optionKey]:v:null,filterVal:f,addProps:{length:O.length,currentIndex:_,selectOption:function(e){x(O[e])}},dropdownDisplay:function(e){const t=setTimeout(()=>c(e),500);return()=>{clearTimeout(t)}},handleClick:A,disable:e.disable,freeze:!!e.freeze,autoFocus:e.autoFocus,placeholder:e.placeholder,onBlur:null==e?void 0:e.onBlur,inputRef:e.ref}),l.createElement(t.ArrowDown,{onClick:w,className:"cp",disable:e.disable})),u?e.optionKey?l.createElement("div",{id:"jk-dropdown-unique",className:(D?"margin-top-10 display: table":"")+" options-card",style:m({},e.optionCardStyles),ref:T},O&&O.map((t,n)=>(console.log("option",t),l.createElement("div",{className:"cp profile-dropdown--item display: flex ",style:n===_?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},key:n,onClick:()=>x(t)},t.icon&&l.createElement("span",{className:"icon"}," ",t.icon," "),e.isPropertyAssess?l.createElement("div",null,e.t?e.t(t[e.optionKey]):t[e.optionKey]):l.createElement("span",null," ",e.t?e.t(t[e.optionKey]):t[e.optionKey]),l.createElement("div",null,"(",e.t("COMMON_MASTERS_DESIGNATION_"+t.designation),")")))),O&&0===O.length&&l.createElement("div",{className:"cp profile-dropdown--item display: flex ",key:"-1",onClick:()=>{}},l.createElement("span",null," ",e.t?e.t("CMN_NOOPTION"):"CMN_NOOPTION"))):l.createElement("div",{className:"options-card",style:m({},e.optionCardStyles,{overflow:"scroll",maxHeight:"350px"}),id:"jk-dropdown-unique",ref:T},e.option.filter(e=>(null==e?void 0:e.toUpperCase().indexOf(null==f?void 0:f.toUpperCase()))>-1).map((e,t)=>l.createElement("p",{key:t,style:t===_?{opacity:1,backgroundColor:"rgba(238, 238, 238, var(--bg-opacity))"}:{},onClick:()=>x(e)},e))):null)},cn=e=>l.createElement("h1",{className:"heading-m"},e.label),dn=()=>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"})),mn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(dn,null)),vn=e=>{var a,o;let i=e.t,r=e.action,s=e.tenantId,u=e.closeModal,c=e.submitAction,d=e.applicationData,v=e.businessService,E=e.moduleCode;const f=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),g=f.data,h=f.isLoading,y=Digit.Hooks.pt.useMDMS(s,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),S=y.isLoading,b=y.data,_=n.useState({}),C=_[0],T=_[1],D=n.useState({})[0],N=n.useState([]),w=N[0],A=N[1],x=n.useState(null),O=x[0],I=x[1],L=n.useState(null),R=L[0],M=L[1],P=n.useState(null),F=P[0],k=P[1],B=n.useState(null)[1],U=n.useState([]),H=U[0],V=U[1],W=n.useState(null),z=W[0],j=W[1];function q(e){M(e.target.files[0])}return n.useState(!1),n.useEffect(()=>{var e;b&&b["egf-master"]&&V(null===(e=b["egf-master"])||void 0===e?void 0:e.FinancialYear)},[b]),n.useEffect(()=>{var e;A(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{B(null);const e=function(){if(R){const e=function(){if(R.size>=5242880)B(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",R,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?k(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):B(i("CS_FILE_UPLOAD_ERROR"))})},function(){B(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[R]),n.useEffect(()=>{r&&T(null!=r&&r.showFinancialYearsModal?(e=>{let n=e.action,a=e.financialYears,o=e.selectedFinancialYear,i=e.setSelectedFinancialYear;return{label:{heading:"WF_"+n.action+"_APPLICATION",submit:"WF_PT.CREATE_"+n.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:(0,e.t)("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:a,optionsKey:"name",onSelect:i,selectedOption:o})}]}]}})({t:i,action:r,financialYears:H,selectedFinancialYear:z,setSelectedFinancialYear:j}):(e=>{var n;let a=e.t,o=e.action,i=e.approvers,r=e.selectedApprover,s=e.setSelectedApprover,u=e.selectFile,c=e.uploadedFile,d=e.setUploadedFile;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==o?void 0:o.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:a(e.assigneeLabel||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{d(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:w,selectedApprover:O,setSelectedApprover:I,selectFile:q,uploadedFile:F,setUploadedFile:k,businessService:v}))},[r,w,H,z,F]),r&&C.form?l.createElement(t.Modal,{headerBarMain:l.createElement(cn,{label:i(C.label.heading)}),headerBarEnd:l.createElement(mn,{onClick:u}),actionCancelLabel:i(C.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(C.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!z:h||(null==r?void 0:r.docUploadRequired)&&!F,formId:"modal-action"},S?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:C.form,className:"BPAemployeeCard bpa-workflow-modal-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:m({},d,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==z?void 0:z.name,propertyId:null==d?void 0:d.propertyId,tenantId:s,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:v,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!O?[]:[O],F&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==R?void 0:R.name,fileStoreId:F}]),c({Property:m({},d,{workflow:t})})}},defaultValues:D,formId:"modal-action"})):l.createElement(t.Loader,null)},pn=e=>l.createElement("h1",{className:"heading-m"},e.label),En=()=>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"})),fn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(En,null)),gn=e=>{var a,o;let i=e.t,r=e.action,s=e.tenantId,u=e.closeModal,c=e.submitAction,d=e.applicationData,v=e.businessService;console.log("ActionModalActions: ",r);const E=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}).data,f=Digit.Hooks.pt.useMDMS(s,v,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),g=f.isLoading,h=f.data,y=n.useState({}),S=y[0],b=y[1],_=n.useState({})[0],C=n.useState([]),T=C[0],D=C[1],N=n.useState({}),w=N[0],A=N[1],x=n.useState(null),O=x[0],I=x[1],L=n.useState(null),R=L[0],M=L[1],P=n.useState(null)[1],F=n.useState([]),k=F[0],B=F[1],U=n.useState(null)[0];n.useEffect(()=>{var e;h&&h["egf-master"]&&B(null===(e=h["egf-master"])||void 0===e?void 0:e.FinancialYear)},[h]);const H=Digit.Hooks.useCustomMDMS(s,"common-masters",[{name:"Department"}]).data;function V(e){I(e.target.files[0])}return n.useEffect(()=>{if(E&&H){var e;const t=H["common-masters"].Department;D(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const o=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,i=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===o);return console.log("matchedDept===",i),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==i?void 0:i.name)}}))}},[E]),n.useEffect(()=>{!function(){try{P(null);const e=function(){if(O){const e=function(){if(O.size>=5242880)P(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",O,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?M(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):P(i("CS_FILE_UPLOAD_ERROR"))})},function(){P(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[O]),n.useEffect(()=>{r&&b((e=>{let n=e.t,a=e.action,o=e.approvers,i=e.selectedApprover,r=e.setSelectedApprover,s=e.selectFile,u=e.uploadedFile,c=e.setUploadedFile,d=e.businessService,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:"CANCEL"===(null==a?void 0:a.action)?"WF_CANCEL_LICENSE":"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},...m?[{label:n("TL_FORWARD_NAME_LABEL"),type:"text",populators:{name:"name",placeholder:n("TL_FORWARD_NAME_PLACEHOLDER")}},{label:n("TL_FORWARD_DATE_LABEL"),type:"date",populators:{name:"date"}}]:[],{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{c(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:T,selectedApprover:w,setSelectedApprover:A,selectFile:V,uploadedFile:R,setUploadedFile:M,businessService:v}))},[r,T,k,U,R]),r&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(pn,{label:i(S.label.heading)}),headerBarEnd:l.createElement(fn,{onClick:u}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;d=m({},d,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=w&&w.uuid?[null==w?void 0:w.uuid]:null,additionalDetails:m({},(null===(t=d)||void 0===t?void 0:t.additionalDetails)||{},null!=e&&e.name||null!=e&&e.date?{forwardedBy:(null==e?void 0:e.name)||"",forwardedDate:(null==e?void 0:e.date)||""}:{}),wfDocuments:R?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==O?void 0:O.name,fileStoreId:R}]:null}),c({Licenses:[d]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},hn=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),yn=()=>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"})),Sn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(yn,null)),bn=e=>{var a,o;let i=e.t,r=e.action,s=e.tenantId,u=e.closeModal,c=e.submitAction,d=e.applicationData,v=e.businessService;const E=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),f=E.data,g=E.isLoading;console.log(f,"DEKHO");const h=n.useState({}),y=h[0],S=h[1],b=n.useState({})[0],_=n.useState([]),C=_[0],T=_[1],D=n.useState({}),N=D[0],w=D[1],A=n.useState(null),x=A[0],O=A[1],I=n.useState(null),L=I[0],R=I[1],M=n.useState(null),P=M[0],F=M[1],k=!!Digit.Utils.browser.isMobile();function B(e){O(e.target.files[0])}return n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l,a,o,r;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:(null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation)||"N/A",displayName:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" ("+(i(null==e||null===(o=e.assignments)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.designation)||"N/A")+")"}}))},[f]),n.useEffect(()=>{!function(){try{F(null);const e=function(){if(x){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(x.size>=5242880)F(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=x&&x.type&&!e.test(null==x?void 0:x.type))F(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",x,Digit.ULBService.getStateId()||(null==s?void 0:s.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?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):F(i("CS_FILE_UPLOAD_ERROR"))})},function(){F(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[x]),n.useEffect(()=>{r&&S((e=>{let n=e.t,a=e.action,o=e.approvers,i=e.selectedApprover,r=e.setSelectedApprover,s=e.selectFile,u=e.uploadedFile,c=e.setUploadedFile,d=e.businessService,m=e.error,v=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"SEND_BACK_TO_CITIZEN"!=(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(un,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i,t:n}):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:s,onDelete:()=>{c(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:i,action:r,approvers:C,selectedApprover:N,setSelectedApprover:w,selectFile:B,uploadedFile:L,setUploadedFile:R,businessService:v,error:P}))},[r,C,L,P]),r&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(hn,{label:i(y.label.heading)}),headerBarEnd:l.createElement(Sn,{onClick:u}),actionCancelLabel:i(y.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:k?{width:"720px"}:{},style:k?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:k?{paddingLeft:"5px"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:y.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d=m({},d,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=N&&N.uuid?[null==N?void 0:N.uuid]:null,wfDocuments:L?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==x?void 0:x.name,fileStoreId:L}]:null}),console.log("action",r),console.log("applicationData",d),c({Licenses:[d]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:b,formId:"modal-action"})):l.createElement(t.Loader,null)},_n=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Cn=()=>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"})),Tn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Cn,null)),Dn=e=>{var a,o,i,s,u,c,d,v,E,f,g,h,y,S,b,_,C,T;let D=e.t,N=e.action,w=e.tenantId,A=e.closeModal,x=e.submitAction,O=e.applicationDetails,I=e.applicationData,L=e.businessService,R=e.workflowDetails,M=e.blockReason;console.log("applicationData_BPAACTIONMODAL",I);const P=[...new Set(null==R||null===(a=R.data)||void 0===a||null===(o=a.initialActionState)||void 0===o||null===(i=o.nextActions)||void 0===i||null===(s=i.find(e=>(null==e?void 0:e.action)===(null==N?void 0:N.action)))||void 0===s||null===(u=s.actions)||void 0===u?void 0:u.flatMap(e=>e.roles||[]))];console.log("workflowDetails_BPAACTIONMODAL",R,P,N),Digit.Hooks.obps.useObpsAPI(null!==(c=I)&&void 0!==c&&null!==(d=c.landInfo)&&void 0!==d&&null!==(v=d.address)&&void 0!==v&&v.city?null===(E=I)||void 0===E||null===(f=E.landInfo)||void 0===f||null===(g=f.address)||void 0===g?void 0:g.city:w,!1);const F=Digit.Hooks.useEmployeeSearch(w,{roles:null==P?void 0:P.map(e=>({code:e})),zones:null===(h=I)||void 0===h||null===(y=h.additionalDetails)||void 0===y?void 0:y.zonenumber,categories:null===(S=I)||void 0===S||null===(b=S.additionalDetails)||void 0===b?void 0:b.categories,subcategories:null===(_=I)||void 0===_||null===(C=_.additionalDetails)||void 0===C?void 0:C.subcategories,assignedtenattids:null===(T=I)||void 0===T?void 0:T.tenantId,isActive:!0},{enabled:!(null!=N&&N.isTerminateState)}),k=F.data,B=F.isLoading;console.log("approverData",k),r.useQueryClient();const U=n.useState({}),H=U[0],V=U[1],W=n.useState({})[0],z=n.useState([]),j=z[0],q=z[1],Y=n.useState([]),G=Y[0],K=Y[1],Q=n.useState({}),X=Q[0],Z=Q[1],$=n.useState({}),J=$[0],ee=$[1],te=n.useState(null),ne=te[0],le=te[1],ae=n.useState(null),oe=ae[0],ie=ae[1],re=n.useState(null),se=re[0],ue=re[1],ce=n.useState(null)[0],de=!!Digit.Utils.browser.isMobile();function me(e){le(e.target.files[0])}n.useEffect(()=>{var e,t,n,l,a,o,i,r,s,u,c;q(null==k||null===(e=k.Employees)||void 0===e?void 0:e.map(e=>{var t,n,l;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name,designation:null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.designation}})),1===(null==k||null===(t=k.Employees)||void 0===t?void 0:t.length)&&Z({uuid:null==k||null===(n=k.Employees)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.uuid,name:null==k||null===(a=k.Employees)||void 0===a||null===(o=a[0])||void 0===o||null===(i=o.user)||void 0===i?void 0:i.name,designation:null==k||null===(r=k.Employees)||void 0===r||null===(s=r[0])||void 0===s||null===(u=s.assignments)||void 0===u||null===(c=u[0])||void 0===c?void 0:c.designation})},[k]),n.useEffect(()=>{!function(){try{ue(null);const e=function(){if(ne){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(ne.size>=5242880)ue(D("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=ne&&ne.type&&!e.test(null==ne?void 0:ne.type))ue(D("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",ne,Digit.ULBService.getStateId()||(null==w?void 0:w.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?ie(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):ue(D("CS_FILE_UPLOAD_ERROR"))})},function(){ue(D("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)}}()},[ne]);const ve=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},pe=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},Ee=e=>{var t,n;let l=[],a=[];var o,i;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(i=l)||void 0===i?void 0:i.length)>0&&l.map((e,t)=>{a.push({docs:ve(e.Documents),date:e.InspectionDate,questions:pe(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]},fe=()=>{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(()=>{K(null==M?void 0:M.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),N&&V((e=>{var n;let a=e.t,o=e.action,i=e.approvers,r=e.selectedApprover,s=e.setSelectedApprover,u=e.selectedBlockReason,c=e.setBlockReason,d=e.selectFile,m=e.uploadedFile,v=e.setUploadedFile,p=e.error,E=e.blockReasonFiltered,f=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SKIP_PAYMENT"!=o.action&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)&&"PULLBACK"!=(null==o?void 0:o.action)||(f=!0);let g=!1;return"APPROVE"==(null==o?void 0:o.action)&&(g=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==o?void 0:o.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:o.isTerminateState||f||"BLOCK"==(null==o?void 0:o.action)||"VERIFY"==(null==o?void 0:o.action)||"SEND_FOR_INSPECTION_REPORT"==(null==o?void 0:o.action)||"ESIGN"==(null==o?void 0:o.action)||"UPDATE_FEE"==(null==o?void 0:o.action)||"SEND_BACK"==(null==o?void 0:o.action)||"UPDATE_ZONE"==(null==o?void 0:o.action)?null:a(e.assigneeLabel||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||f||"BLOCK"==(null==o?void 0:o.action)||"VERIFY"==(null==o?void 0:o.action)||"SEND_FOR_INSPECTION_REPORT"==(null==o?void 0:o.action)||"ESIGN"==(null==o?void 0:o.action)||"UPDATE_FEE"==(null==o?void 0:o.action)||"SEND_BACK"==(null==o?void 0:o.action)||"UPDATE_ZONE"==(null==o?void 0:o.action)?null:l.createElement(un,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r,t:a})},{label:"BLOCK"==(null==o?void 0:o.action)?a("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==o?void 0:o.action)?l.createElement(t.Dropdown,{option:E,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:c,selected:u,isMandatory:!0}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},...g?[{label:a("WF_CONDITIONAL_COMMENTS_LABEL"),type:"textarea",populators:{name:"conditionalComments"}}]:[],{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{v(null)},message:m?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:D,action:N,approvers:j,selectedApprover:X,setSelectedApprover:Z,selectedBlockReason:J,setBlockReason:ee,selectFile:me,uploadedFile:oe,setUploadedFile:ie,businessService:L,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:se,blockReasonFiltered:G}))},[N,j,ce,oe,se]),N&&H.form?l.createElement(t.Modal,{headerBarMain:l.createElement(_n,{label:D(H.label.heading)}),headerBarEnd:l.createElement(Tn,{onClick:A}),actionCancelLabel:D(H.label.cancel),actionCancelOnSubmit:A,actionSaveLabel:D(H.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:de?{width:"720px"}:{},style:de?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:de?{paddingLeft:"5px"}:{}},B?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:H.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,o,i,r,s,u,c,d,v,p,E,f,g,h,y,S,b,_,C,T,w,L,M,P,F,k,B,U,H,V,W,z,j,q,Y,G,K,Q,Z,$,ee;const ae=null==e||null===(t=e.comments)||void 0===t?void 0:t.toString().trim(),ie=null==e||null===(n=e.conditionalComments)||void 0===n?void 0:n.trim();let re=ae;if("APPROVE"===(null==N?void 0:N.action)&&ie&&(re=ae+"[#?..**]"+(ie||"")),I=m({},I,{documents:null===(l=I)||void 0===l?void 0:l.documents,additionalDetails:m({},null===(a=I)||void 0===a?void 0:a.additionalDetails,{fieldinspection_pending:Ee(I),pendingapproval:fe(),blockingReason:null==J?void 0:J.name}),workflow:{action:null==N?void 0:N.action,comment:(null==e||null===(o=e.comments)||void 0===o?void 0:o.length)>0?null!=J&&J.name?(null==J?void 0:J.name)+" - "+re:re:null,comments:(null==e||null===(i=e.comments)||void 0===i?void 0:i.length)>0?null!=J&&J.name?(null==J?void 0:J.name)+" - "+re:re:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(r=R.data)||void 0===r||null===(s=r.processInstances)||void 0===s||null===(u=s[0])||void 0===u||null===(c=u.state)||void 0===c?void 0:c.applicationStatus)?[null==R||null===(d=R.data)||void 0===d||null===(v=d.processInstances)||void 0===v||null===(p=v[0])||void 0===p||null===(E=p.assigner)||void 0===E?void 0:E.uuid]:null!=X&&X.uuid?[null==X?void 0:X.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(f=R.data)||void 0===f||null===(g=f.processInstances)||void 0===g||null===(h=g[0])||void 0===h||null===(y=h.state)||void 0===y?void 0:y.applicationStatus)?[null==R||null===(S=R.data)||void 0===S||null===(b=S.processInstances)||void 0===b||null===(_=b[0])||void 0===_||null===(C=_.assigner)||void 0===C?void 0:C.uuid]:null!=X&&X.uuid?[null==X?void 0:X.uuid]:null,varificationDocuments:oe?[{documentType:(null==N?void 0:N.action)+" DOC",fileName:null==ne?void 0:ne.name,fileStoreId:oe}]:null},action:null==N?void 0:N.action,riskType:null===(T=I)||void 0===T||null===(w=T.additionalDetails)||void 0===w?void 0:w.riskType,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==R||null===(L=R.data)||void 0===L||null===(M=L.processInstances)||void 0===M||null===(P=M[0])||void 0===P||null===(F=P.state)||void 0===F?void 0:F.applicationStatus)?[null==R||null===(k=R.data)||void 0===k||null===(B=k.processInstances)||void 0===B||null===(U=B[0])||void 0===U||null===(H=U.assigner)||void 0===H?void 0:H.uuid]:null!=X&&X.uuid?[null==X?void 0:X.uuid]:null,wfDocuments:oe?[{documentType:(null==N?void 0:N.action)+" DOC",fileName:null==ne?void 0:ne.name,fileStoreId:oe}]:null}),parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(V=I)||void 0===V||null===(W=V.additionalDetails)||void 0===W||null===(z=W.selfCertificationCharges)||void 0===z?void 0:z.BPA_MALBA_CHARGES)+parseInt(null===(j=I)||void 0===j||null===(q=j.additionalDetails)||void 0===q||null===(Y=q.selfCertificationCharges)||void 0===Y?void 0:Y.BPA_LABOUR_CESS)+parseInt(null===(G=I)||void 0===G||null===(K=G.additionalDetails)||void 0===K||null===(Q=K.selfCertificationCharges)||void 0===Q?void 0:Q.BPA_WATER_CHARGES)+parseInt(null===(Z=I)||void 0===Z||null===($=Z.additionalDetails)||void 0===$||null===(ee=$.selfCertificationCharges)||void 0===ee?void 0:ee.BPA_GAUSHALA_CHARGES_CESS))A(),alert(D("Enterd Less Adjustment amount is invalid"));else{var te,le;const e=null==O||null===(te=O.nocData)||void 0===te?void 0:te.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:m({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}}),t={};let n=!0,l=!0;null==t||null===(le=t.Noc)||void 0===le||le.map(e=>{var t,a,o,i,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=n&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?n=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let a=[];e&&e.map(e=>{var t,o,i,r,s,u,c,d,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(o=t.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(i=e.Noc)||void 0===i||null===(r=i.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(u=s.applicationStatus)||void 0===u?void 0:u.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&n||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&a.push(e)}),x({BPA:I},(null==a?void 0:a.length)>0&&a,{isStakeholder:!1,bpa:!0})}return Promise.resolve()}catch(e){return Promise.reject(e)}},defaultValues:W,formId:"modal-action"})):l.createElement(t.Loader,null)},Nn=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),wn=()=>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"})),An=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(wn,null)),xn=e=>{var a,i,s,u,c,d,v;let E=e.t,f=e.action,g=e.tenantId,h=e.closeModal,y=e.submitAction,S=e.applicationData,b=e.businessService;const _=Digit.Hooks.useEmployeeSearch(g,{roles:null===(a=workflowDetails)||void 0===a||null===(i=a.data)||void 0===i||null===(s=i.initialActionState)||void 0===s||null===(u=s.nextActions)||void 0===u||null===(c=u.filter(e=>(null==e?void 0:e.action)==(null==f?void 0:f.action)))||void 0===c||null===(d=c[0])||void 0===d||null===(v=d.assigneeRoles)||void 0===v?void 0:v.map(e=>({code:e})),isActive:!0},{enabled:!(null!=f&&f.isTerminateState)}),C=_.data,T=_.isLoading,D=(r.useQueryClient(),n.useState({})),N=D[0],w=D[1],A=n.useState({})[0],x=n.useState([]),O=x[0],I=x[1],L=n.useState({}),R=L[0],M=L[1],P=n.useState(null),F=P[0],k=P[1],B=n.useState(null),U=B[0],H=B[1],V=n.useState(null),W=V[0],z=V[1],j=!!Digit.Utils.browser.isMobile();function q(e){k(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;I(null==C||null===(e=C.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}}))},[C]),n.useEffect(()=>{!function(){try{z(null);const e=function(){if(F){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(F.size>=5242880)z(E("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=F&&F.type&&!e.test(null==F?void 0:F.type))z(E("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",F,Digit.ULBService.getStateId()||(null==g?void 0:g.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?H(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):z(E("CS_FILE_UPLOAD_ERROR"))})},function(){z(E("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)}}()},[F]),n.useEffect(()=>{f&&w((e=>{var n;let a=e.t,o=e.action,i=e.approvers,r=e.selectedApprover,s=e.setSelectedApprover,u=e.selectFile,c=e.uploadedFile,d=e.setUploadedFile,m=e.error,v=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(v=!0);let p=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(p=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==o?void 0:o.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||p?null:a(e.assigneeLabel||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||p?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:v,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,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:m})}]}]}})({t:E,action:f,approvers:O,selectedApprover:R,setSelectedApprover:M,selectFile:q,uploadedFile:U,setUploadedFile:H,businessService:b,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:W}))},[f,O,U,W]),f&&N.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Nn,{label:E(N.label.heading)}),headerBarEnd:l.createElement(An,{onClick:h}),actionCancelLabel:E(N.label.cancel),actionCancelOnSubmit:h,actionSaveLabel:E(N.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:j?{width:"720px"}:{},style:j?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:j?{paddingLeft:"5px"}:{}},T?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:N.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=S)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=S)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{o.push(e)}),S=m({},S,{workflow:{action:null==f?void 0:f.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=R&&R.uuid?[null==R?void 0:R.uuid]:null,documents:U?[{documentType:(null==f?void 0:f.action)+" DOC",fileName:null==F?void 0:F.name,fileStoreId:U}]:null},documents:o}),y({Noc:S},!1,{isNoc:!0})},defaultValues:A,formId:"modal-action"})):l.createElement(t.Loader,null)};var On=function(e,t){return e===t||e!=e&&t!=t},In=function(e,t){for(var n=e.length;n--;)if(On(e[n][0],t))return n;return-1},Ln=Array.prototype.splice;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])}}Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=In(t,e);return!(n<0||(n==t.length-1?t.pop():Ln.call(t,n,1),--this.size,0))},Rn.prototype.get=function(e){var t=this.__data__,n=In(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return In(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,l=In(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var Mn,Pn=Rn,Fn="object"==typeof Et&&Et&&Et.Object===Object&&Et,kn="object"==typeof self&&self&&self.Object===Object&&self,Bn=Fn||kn||Function("return this")(),Un=Bn.Symbol,Hn=Object.prototype,Vn=Hn.hasOwnProperty,Wn=Hn.toString,zn=Un?Un.toStringTag:void 0,jn=Object.prototype.toString,qn=Un?Un.toStringTag:void 0,Yn=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qn&&qn in Object(e)?function(e){var t=Vn.call(e,zn),n=e[zn];try{e[zn]=void 0;var l=!0}catch(e){}var a=Wn.call(e);return l&&(t?e[zn]=n:delete e[zn]),a}(e):function(e){return jn.call(e)}(e)},Gn=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Kn=function(e){if(!Gn(e))return!1;var t=Yn(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Qn=Bn["__core-js_shared__"],Xn=(Mn=/[^.]+$/.exec(Qn&&Qn.keys&&Qn.keys.IE_PROTO||""))?"Symbol(src)_1."+Mn:"",Zn=Function.prototype.toString,$n=function(e){if(null!=e){try{return Zn.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Jn=/^\[object .+?Constructor\]$/,el=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tl=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Gn(e)||(t=e,Xn&&Xn in t))&&(Kn(e)?el:Jn).test($n(e));var t}(n)?n:void 0},nl=tl(Bn,"Map"),ll=tl(Object,"create"),al=Object.prototype.hasOwnProperty,ol=Object.prototype.hasOwnProperty;function il(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])}}il.prototype.clear=function(){this.__data__=ll?ll(null):{},this.size=0},il.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},il.prototype.get=function(e){var t=this.__data__;if(ll){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return al.call(t,e)?t[e]:void 0},il.prototype.has=function(e){var t=this.__data__;return ll?void 0!==t[e]:ol.call(t,e)},il.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ll&&void 0===t?"__lodash_hash_undefined__":t,this};var rl=il,sl=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 ul(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])}}ul.prototype.clear=function(){this.size=0,this.__data__={hash:new rl,map:new(nl||Pn),string:new rl}},ul.prototype.delete=function(e){var t=sl(this,e).delete(e);return this.size-=t?1:0,t},ul.prototype.get=function(e){return sl(this,e).get(e)},ul.prototype.has=function(e){return sl(this,e).has(e)},ul.prototype.set=function(e,t){var n=sl(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var cl=ul;function dl(e){var t=this.__data__=new Pn(e);this.size=t.size}dl.prototype.clear=function(){this.__data__=new Pn,this.size=0},dl.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},dl.prototype.get=function(e){return this.__data__.get(e)},dl.prototype.has=function(e){return this.__data__.has(e)},dl.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Pn){var l=n.__data__;if(!nl||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new cl(l)}return n.set(e,t),this.size=n.size,this};var ml=dl,vl=function(){try{var e=tl(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),pl=function(e,t,n){"__proto__"==t&&vl?vl(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},El=Object.prototype.hasOwnProperty,fl=function(e,t,n){var l=e[t];El.call(e,t)&&On(l,n)&&(void 0!==n||t in e)||pl(e,t,n)},gl=function(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?pl(n,r,s):fl(n,r,s)}return n},hl=function(e){return null!=e&&"object"==typeof e},yl=function(e){return hl(e)&&"[object Arguments]"==Yn(e)},Sl=Object.prototype,bl=Sl.hasOwnProperty,_l=Sl.propertyIsEnumerable,Cl=yl(function(){return arguments}())?yl:function(e){return hl(e)&&bl.call(e,"callee")&&!_l.call(e,"callee")},Tl=Array.isArray,Dl=function(){return!1},Nl=gt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Bn.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||Dl}),wl=/^(?:0|[1-9]\d*)$/,Al=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&wl.test(e))&&e>-1&&e%1==0&&e<t},xl=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Ol={};Ol["[object Float32Array]"]=Ol["[object Float64Array]"]=Ol["[object Int8Array]"]=Ol["[object Int16Array]"]=Ol["[object Int32Array]"]=Ol["[object Uint8Array]"]=Ol["[object Uint8ClampedArray]"]=Ol["[object Uint16Array]"]=Ol["[object Uint32Array]"]=!0,Ol["[object Arguments]"]=Ol["[object Array]"]=Ol["[object ArrayBuffer]"]=Ol["[object Boolean]"]=Ol["[object DataView]"]=Ol["[object Date]"]=Ol["[object Error]"]=Ol["[object Function]"]=Ol["[object Map]"]=Ol["[object Number]"]=Ol["[object Object]"]=Ol["[object RegExp]"]=Ol["[object Set]"]=Ol["[object String]"]=Ol["[object WeakMap]"]=!1;var Il=function(e){return function(t){return e(t)}},Ll=gt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&Fn.process,o=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=o}),Rl=Ll&&Ll.isTypedArray,Ml=Rl?Il(Rl):function(e){return hl(e)&&xl(e.length)&&!!Ol[Yn(e)]},Pl=Object.prototype.hasOwnProperty,Fl=function(e,t){var n=Tl(e),l=!n&&Cl(e),a=!n&&!l&&Nl(e),o=!n&&!l&&!a&&Ml(e),i=n||l||a||o,r=i?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],s=r.length;for(var u in e)!t&&!Pl.call(e,u)||i&&("length"==u||a&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Al(u,s))||r.push(u);return r},kl=Object.prototype,Bl=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||kl)},Ul=function(e,t){return function(n){return e(t(n))}},Hl=Ul(Object.keys,Object),Vl=Object.prototype.hasOwnProperty,Wl=function(e){return null!=e&&xl(e.length)&&!Kn(e)},zl=function(e){return Wl(e)?Fl(e):function(e){if(!Bl(e))return Hl(e);var t=[];for(var n in Object(e))Vl.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},jl=Object.prototype.hasOwnProperty,ql=function(e){return Wl(e)?Fl(e,!0):function(e){if(!Gn(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Bl(e),n=[];for(var l in e)("constructor"!=l||!t&&jl.call(e,l))&&n.push(l);return n}(e)},Yl=gt(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Bn.Buffer:void 0,o=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),Gl=function(){return[]},Kl=Object.prototype.propertyIsEnumerable,Ql=Object.getOwnPropertySymbols,Xl=Ql?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,o=0,i=[];++l<a;){var r=t[l];Kl.call(e,r)&&(i[o++]=r)}return i}(Ql(e)))}:Gl,Zl=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},$l=Ul(Object.getPrototypeOf,Object),Jl=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Zl(t,Xl(e)),e=$l(e);return t}:Gl,ea=function(e,t,n){var l=t(e);return Tl(e)?l:Zl(l,n(e))},ta=function(e){return ea(e,zl,Xl)},na=function(e){return ea(e,ql,Jl)},la=tl(Bn,"DataView"),aa=tl(Bn,"Promise"),oa=tl(Bn,"Set"),ia=tl(Bn,"WeakMap"),ra=$n(la),sa=$n(nl),ua=$n(aa),ca=$n(oa),da=$n(ia),ma=Yn;(la&&"[object DataView]"!=ma(new la(new ArrayBuffer(1)))||nl&&"[object Map]"!=ma(new nl)||aa&&"[object Promise]"!=ma(aa.resolve())||oa&&"[object Set]"!=ma(new oa)||ia&&"[object WeakMap]"!=ma(new ia))&&(ma=function(e){var t=Yn(e),n="[object Object]"==t?e.constructor:void 0,l=n?$n(n):"";if(l)switch(l){case ra:return"[object DataView]";case sa:return"[object Map]";case ua:return"[object Promise]";case ca:return"[object Set]";case da:return"[object WeakMap]"}return t});var va=ma,pa=Object.prototype.hasOwnProperty,Ea=Bn.Uint8Array,fa=function(e){var t=new e.constructor(e.byteLength);return new Ea(t).set(new Ea(e)),t},ga=/\w*$/,ha=Un?Un.prototype:void 0,ya=ha?ha.valueOf:void 0,Sa=Object.create,ba=function(){function e(){}return function(t){if(!Gn(t))return{};if(Sa)return Sa(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),_a=Ll&&Ll.isMap,Ca=_a?Il(_a):function(e){return hl(e)&&"[object Map]"==va(e)},Ta=Ll&&Ll.isSet,Da=Ta?Il(Ta):function(e){return hl(e)&&"[object Set]"==va(e)},Na={};Na["[object Arguments]"]=Na["[object Array]"]=Na["[object ArrayBuffer]"]=Na["[object DataView]"]=Na["[object Boolean]"]=Na["[object Date]"]=Na["[object Float32Array]"]=Na["[object Float64Array]"]=Na["[object Int8Array]"]=Na["[object Int16Array]"]=Na["[object Int32Array]"]=Na["[object Map]"]=Na["[object Number]"]=Na["[object Object]"]=Na["[object RegExp]"]=Na["[object Set]"]=Na["[object String]"]=Na["[object Symbol]"]=Na["[object Uint8Array]"]=Na["[object Uint8ClampedArray]"]=Na["[object Uint16Array]"]=Na["[object Uint32Array]"]=!0,Na["[object Error]"]=Na["[object Function]"]=Na["[object WeakMap]"]=!1;var wa=function e(t,n,l,a,o,i){var r,s=1&n,u=2&n,c=4&n;if(l&&(r=o?l(t,a,o,i):l(t)),void 0!==r)return r;if(!Gn(t))return t;var d=Tl(t);if(d){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&pa.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!s)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=va(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(Nl(t))return Yl(t,s);if("[object Object]"==m||"[object Arguments]"==m||v&&!o){if(r=u||v?{}:function(e){return"function"!=typeof e.constructor||Bl(e)?{}:ba($l(e))}(t),!s)return u?function(e,t){return gl(e,Jl(e),t)}(t,function(e,t){return e&&gl(t,ql(t),e)}(r,t)):function(e,t){return gl(e,Xl(e),t)}(t,function(e,t){return e&&gl(t,zl(t),e)}(r,t))}else{if(!Na[m])return o?t:{};r=function(e,t,n){var l,a,o=e.constructor;switch(t){case"[object ArrayBuffer]":return fa(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?fa(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?fa(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,ga.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new o;case"[object Symbol]":return ya?Object(ya.call(e)):{}}}(t,m,s)}}i||(i=new ml);var p=i.get(t);if(p)return p;i.set(t,r),Da(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,i))}):Ca(t)&&t.forEach(function(a,o){r.set(o,e(a,n,l,o,t,i))});var E=d?void 0:(c?u?na:ta:u?ql:zl)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,o){E&&(a=t[o=a]),fl(r,o,e(a,n,l,o,t,i))}),r},Aa=function(e){return wa(e,5)};const xa=e=>l.createElement("h1",{className:"heading-m"},e.label),Oa=()=>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"})),Ia=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Oa,null)),La=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}},Ra=e=>{var a,o;let i=e.t,r=e.action,s=e.tenantId,u=e.closeModal,c=e.submitAction,d=e.applicationData,v=e.businessService;const E=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),f=E.data,g=E.isLoading,h=n.useState({}),y=h[0],S=h[1],b=n.useState({})[0],_=n.useState([]),C=_[0],T=_[1],D=n.useState({}),N=D[0],w=D[1],A=n.useState(null),x=A[0],O=A[1],I=n.useState(null),L=I[0],R=I[1],M=n.useState(null),P=M[0],F=M[1],k=window.Digit.Utils.browser.isMobile(),B=window.location.href.includes("/employee");function U(e){O(e.target.files[0])}return n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{F(null);const e=function(){if(x){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(x.size>=5242880)F(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=x&&x.type&&!e.test(null==x?void 0:x.type))F(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",x,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?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):F(i("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),F(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[x]),n.useEffect(()=>{var e,n,a,o;"DisconnectWSConnection"==(null===(e=d)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=d)||void 0===a||null===(o=a.processInstance)||void 0===o?void 0:o.businessService)?r&&S((e=>{var n;let a=e.t,o=e.action,i=e.approvers,r=e.selectedApprover,s=e.setSelectedApprover,u=e.selectFile,c=e.uploadedFile,d=e.setUploadedFile,v=e.businessService,p=e.error,E=!0,f=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(f=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,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,m({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:u,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:C,selectedApprover:N,setSelectedApprover:w,selectFile:U,uploadedFile:L,setUploadedFile:R,businessService:v,error:P})):r&&S((e=>{var n;let a=e.t,o=e.action,i=e.approvers,r=e.selectedApprover,s=e.setSelectedApprover,u=e.selectFile,c=e.uploadedFile,d=e.setUploadedFile,m=e.businessService,v=e.error,p=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(p=!1),o.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,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:u,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:C,selectedApprover:N,setSelectedApprover:w,selectFile:U,uploadedFile:L,setUploadedFile:R,businessService:v,error:P}))},[r,C,L,P]),r&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(xa,{label:i(y.label.heading)}),headerBarEnd:l.createElement(Ia,{onClick:u}),actionCancelLabel:i(y.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:k&&B?{width:"100%",height:"auto"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:y.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o,i,u,v,p,E;if(null!==(t=d)&&void 0!==t&&t.isBillAmend){var f,g,h,y,S,b,_,C,T;const t=m({},null===(f=d)||void 0===f||null===(g=f.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=m({},null===(h=d)||void 0===h?void 0:h.billAmendmentDetails,{workflow:{businessId:null===(y=d)||void 0===y||null===(S=y.billAmendmentDetails)||void 0===S?void 0:S.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(b=d)&&void 0!==b&&null!==(_=b.applicationType)&&void 0!==_&&_.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(C=d)&&void 0!==C&&null!==(T=C.applicationType)&&void 0!==T&&T.includes("WATER")?"WS":"SW",assignes:null!=N&&N.uuid?[{uuid:null==N?void 0:N.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:L?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==x?void 0:x.name,fileStoreId:L}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:L?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==x?void 0:x.name,fileStoreId:L}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=N&&N.uuid?[{uuid:null==N?void 0:N.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:L?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==x?void 0:x.name,fileStoreId:L}]:[]}});c({AmendmentUpdate:n})}else{if(d=m({},d,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=N&&N.uuid?[null==N?void 0:N.uuid]:[],assignes:null!=N&&N.uuid?[{uuid:null==N?void 0:N.uuid}]:[],wfDocuments:L?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==x?void 0:x.name,fileStoreId:L}]:null,processInstance:m({},null===(n=d)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=N&&N.uuid?[{uuid:null==N?void 0:N.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:L?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==x?void 0:x.name,fileStoreId:L}]:[]})}),null!=e&&e.date&&null!==(l=d)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=Aa(null==e?void 0:e.date);d.disconnectionExecutionDate=La(t)}else if(null!=e&&e.date){const t=Aa(null==e?void 0:e.date);d.connectionExecutionDate=La(t)}var D;if("DisconnectWSConnection"==(null===(o=d)||void 0===o||null===(i=o.processInstance)||void 0===i?void 0:i.businessService)||"DisconnectSWConnection"==(null===(u=d)||void 0===u||null===(v=u.processInstance)||void 0===v?void 0:v.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(D=d)||void 0===D?void 0:D.serviceType)?c({WaterConnection:d,disconnectRequest:!0}):c({SewerageConnection:d,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(p=d)||void 0===p?void 0:p.applicationType))c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=d)||void 0===E?void 0:E.applicationType))c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!0});else{var w,A,O,I,R,M,P,F,k,B,U,H,V;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(w=t.value)&&void 0!==w&&w.adhocPenalty&&(d.additionalDetails.adhocPenalty=parseInt(null==t||null===(A=t.value)||void 0===A?void 0:A.adhocPenalty)||""),null!=t&&null!==(O=t.value)&&void 0!==O&&O.adhocPenaltyComment&&(d.additionalDetails.adhocPenaltyComment=(null==t||null===(I=t.value)||void 0===I?void 0:I.adhocPenaltyComment)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyReason&&(d.additionalDetails.adhocPenaltyReason=(null==t||null===(M=t.value)||void 0===M?void 0:M.adhocPenaltyReason)||""),null!=t&&null!==(P=t.value)&&void 0!==P&&P.adhocRebate&&(d.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateComment&&(d.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&&(d.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(V=d)||void 0===V?void 0:V.serviceType)?c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:b,formId:"modal-action"})):l.createElement(t.Loader,null)},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)),ka=e=>{var a,o;let i=e.t,r=e.action,s=e.tenantId,u=e.closeModal,c=e.submitAction,d=e.applicationData,v=e.businessService,E=e.moduleCode;console.log("applicationData",d);const f=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}).data,g=n.useState({}),h=g[0],y=g[1],S=n.useState({})[0],b=n.useState([]),_=b[0],C=b[1],T=n.useState(null),D=T[0],N=T[1],w=n.useState(null),A=w[0],x=w[1],O=n.useState(null),I=O[0],L=O[1],R=n.useState(null)[1];function M(e){x(e.target.files[0])}return n.useState(!1),n.useEffect(()=>{var e;C(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",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?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),n.useEffect(()=>{r&&y((e=>{let t=e.action;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==t?void 0:t.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:(0,e.t)("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:i,action:r,approvers:_,selectedApprover:D,setSelectedApprover:N,selectFile:M,uploadedFile:I,setUploadedFile:L,businessService:v}))},[r,_,I]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ma,{label:i(h.label.heading)}),headerBarEnd:l.createElement(Fa,{onClick:u}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:h.form,className:"BPAemployeeCard bpa-workflow-modal-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:[m({},d,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:v,moduleName:E};t.assignes=null!=r&&r.isTerminateState||!D?[]:[D],I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:I}]),c({PetRegistrationApplications:[m({},d,{workflow:t})]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Ba=e=>l.createElement("h1",{className:"heading-m"},e.label),Ua=()=>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"})),Ha=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ua,null)),Va=e=>{var a,o;let i=e.t,r=e.action,s=e.closeModal,u=e.submitAction,c=e.applicationData,d=e.businessService;const v=Digit.ULBService.getStateId(),p=Digit.Hooks.tl.useTradeLicenseMDMS(v,"TradeLicense","TradeUnits","[?(@.type=='TL')]"),E=p.data,f=p.isLoading,g=n.useState({}),h=g[0],y=g[1],S=n.useState({})[0],b=(n.useState([]),n.useState("")),_=b[0],C=b[1],T=n.useState([])[0],D=n.useState(null)[0],N=null===(a=c)||void 0===a||null===(o=a.tradeLicenseDetail)||void 0===o?void 0:o.tradeUnits;console.log("tradeUnits",N);const w=n.useMemo(()=>{var e;if(f||!E||!N.length)return[];const t=new Set(N.map(e=>e.tradeType)),n=(null===(e=E.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[f,E,N]);return console.log("years",w),n.useEffect(()=>{r&&y((e=>{let n=e.t,a=e.action,o=e.years,i=e.selectedApprover,r=e.setSelectedApprover,s=e.businessService;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==s?void 0:s.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:o,autoComplete:"off",select:r,selected:i})}]}]}})({t:i,action:r,years:w,selectedApprover:_,setSelectedApprover:C,businessService:d}))},[r,w,T,D]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ba,{label:i(h.label.heading)}),headerBarEnd:l.createElement(Ha,{onClick:s}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:h.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o;let i=null===(t=c)||void 0===t?void 0:t.financialYear;const r=null==i?void 0:i.split("-")[1],s="20"+Number(r)+"-"+(Number(r)+1),d=new Set(((null===(n=c)||void 0===n||null===(l=n.tradeLicenseDetail)||void 0===l?void 0:l.tradeUnits)||[]).map(e=>e.tradeType)),v=((null==E||null===(a=E.TradeLicense)||void 0===a?void 0:a.TradeType)||[]).filter(e=>d.has(e.code)).some(e=>null==e?void 0:e.ishazardous),p=_.length>0?parseInt(_):1;c=m({},c,{financialYear:s,applicationType:"RENEWAL",workflowCode:v?"NEWTL.HAZ":"DIRECTRENEWAL",action:v?"APPLY":"INITIATE",wfDocuments:null,additionalDetail:m({},c.additionalDetail,{validityYears:_.length>0?parseInt(_):""}),tradeLicenseDetail:m({},c.tradeLicenseDetail,{additionalDetail:m({},null===(o=c.tradeLicenseDetail)||void 0===o?void 0:o.additionalDetail,{validityYears:p})})}),u({Licenses:[c]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Wa=e=>l.createElement("h1",{className:"heading-m"},e.label),za=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ja=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(za,null)),qa=e=>{var a,o;let i=e.t,r=e.action,s=e.tenantId,u=e.closeModal,c=e.submitAction,d=e.applicationData,v=e.businessService,f=e.moduleCode;const g=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}).data,h=n.useState({}),y=h[0],S=h[1],b=n.useState({})[0],_=n.useState([]),C=_[0],T=_[1],D=n.useState(null),N=D[0],w=D[1],A=n.useState(null),x=A[0],O=A[1],I=n.useState(null),L=I[0],R=I[1],M=n.useState(null)[1],P=n.useState(!1),F=P[0],k=P[1];function B(e){k(!0),O(e.target.files[0])}return n.useEffect(()=>{var e;T(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{!function(){try{M(null);const e=function(){if(x){const e=function(){if(x.size>=5242880)M(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=E(function(){return p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",x,s)).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?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):M(i("CS_FILE_UPLOAD_ERROR"))})},function(){M(i("CS_FILE_UPLOAD_ERROR"))})},function(e,t){if(k(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[x]),console.log("actyhdesh,jhfsefsef",r,d),n.useEffect(()=>{S((e=>{let n=e.t,a=e.action,o=e.selectFile,i=e.uploadedFile,r=e.setUploadedFile,s=e.approvers,u=e.selectedApprover,c=e.setSelectedApprover,d=e.isUploading;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",d),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"name",select:c,selected:u})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{r(null)},message:d?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):i?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:N,setSelectedApprover:w,selectFile:B,uploadedFile:L,setUploadedFile:R,businessService:v,isUploading:F}))},[r,C,L]),r&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Wa,{label:i(y.label.heading)}),headerBarEnd:l.createElement(ja,{onClick:u}),actionCancelLabel:i(y.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:v,moduleName:f,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==d||null===(t=d.auditDetails)||void 0===t?void 0:t.createdBy]:null!=N&&N.uuid?[null==N?void 0:N.uuid]:null};L&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==x?void 0:x.name,fileStoreId:L}]),c({streetVendingDetail:m({},d,{workflow:n})})},defaultValues:b,formId:"modal-action"})):l.createElement(t.Loader,null)},Ya=e=>l.createElement("h1",{className:"heading-m"},e.label),Ga=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ka=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ga,null)),Qa=e=>{var a,o;let i=e.t,r=e.action,s=e.tenantId,u=e.closeModal,c=e.submitAction,d=e.applicationData,v=e.businessService,E=e.moduleCode;console.log("applicationData",d);const f=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}).data,g=n.useState({}),h=g[0],y=g[1],S=n.useState({})[0],b=n.useState([]),_=b[0],C=b[1],T=n.useState(null),D=T[0],N=T[1],w=n.useState(null),A=w[0],x=w[1],O=n.useState(null),I=O[0],L=O[1],R=n.useState(null)[1];function M(e){x(e.target.files[0])}return n.useState(!1),n.useEffect(()=>{var e;C(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",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?L(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),n.useEffect(()=>{r&&y((e=>{let n=e.t,a=e.action,o=e.selectFile,i=e.uploadedFile,r=e.setUploadedFile;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:_,selectedApprover:D,setSelectedApprover:N,selectFile:M,uploadedFile:I,setUploadedFile:L,businessService:v}))},[r,_,I]),r&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Ya,{label:i(h.label.heading)}),headerBarEnd:l.createElement(Ka,{onClick:u}),actionCancelLabel:i(h.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:h.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:v,moduleName:E};I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==A?void 0:A.name,filestoreId:I}]),c({hallsBookingApplication:[m({},d,{workflow:t})]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Xa=e=>l.createElement("h1",{className:"heading-m"},e.label),Za=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),$a=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Za,null)),Ja=e=>{var a,i,r;let s=e.t,u=e.action,c=e.closeModal,d=e.submitAction,v=e.applicationData,p=e.businessService,E=e.moduleCode;const f=Digit.Hooks.useEmployeeSearch(e.tenantId,{roles:null==u||null===(a=u.roles)||void 0===a||null===(i=a[0])||void 0===i||null===(r=i.map)||void 0===r?void 0:r.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}).data,g=o.useHistory(),h=n.useState({}),y=h[0],S=h[1],b=n.useState({})[0],_=n.useState([]),C=_[0],T=_[1],D=n.useState(null),N=D[0],w=D[1],A=n.useState(null),x=A[0],O=A[1];return n.useEffect(()=>{var e;T(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{"INITIATED"===(null==u?void 0:u.state)?g.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):S((e=>{let t=e.action;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+e.businessService+"_"+(null==t?void 0:t.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:(0,e.t)("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:s,action:u,approvers:C,selectedApprover:N,setSelectedApprover:w,uploadedFile:x,setUploadedFile:O,businessService:p}))},[u,C,x]),u&&y.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Xa,{label:s(y.label.heading)}),headerBarEnd:l.createElement($a,{onClick:c}),actionCancelLabel:s(y.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:s(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:y.form,className:"BPAemployeeCard bpa-workflow-modal-form",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==u?void 0:u.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:E};x&&(t.documents=[]),d({Asset:m({},v,{workflow:t})})},defaultValues:b,formId:"modal-action"})):l.createElement(t.Loader,null)},eo=e=>{var t;return null!=e&&e.businessService.includes("PT")?l.createElement(vn,e):null!=e&&e.businessService.includes("ptr")?l.createElement(ka,e):"DIRECT_RENEWAL_BUTTON"===(null==e||null===(t=e.action)||void 0===t?void 0:t.action)?l.createElement(Va,m({},e,{applicationData:m({},e.applicationData,{workflowCode:"DIRECTRENEWAL"})})):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(gn,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(Va,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(bn,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(Dn,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(xn,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(Ra,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(qa,e):null!=e&&e.businessService.includes("chb")?l.createElement(Qa,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Ja,e):void 0};var to=gt(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",i="[object Array]",r="[object Boolean]",s="[object Date]",u="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",f="[object Set]",g="[object String]",h="[object Symbol]",y="[object WeakMap]",S="[object ArrayBuffer]",b="[object DataView]",_="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",D="[object Int16Array]",N="[object Int32Array]",w="[object Uint8Array]",A="[object Uint16Array]",x="[object Uint32Array]",O=/\b__p \+= '';/g,I=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,M=/[&<>"']/g,P=RegExp(R.source),F=RegExp(M.source),k=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,j=RegExp(z.source),q=/^\s+/,Y=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,K=/\{\n\/\* \[wrapped with (.+)\] \*/,Q=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Z=/[()=,{}\[\]\/\s]/,$=/\\(\\)?/g,J=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ee=/\w*$/,te=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,le=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,ie=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,re=/($^)/,se=/['\n\r\u2028\u2029\\]/g,ue="\\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="["+ue+"]",ve="\\d+",pe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",fe="\\ud83c[\\udffb-\\udfff]",ge="[^\\ud800-\\udfff]",he="(?:\\ud83c[\\udde6-\\uddff]){2}",ye="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",be="(?:"+pe+"|"+Ee+")",_e="(?:"+Se+"|"+Ee+")",Ce="(?:"+me+"|"+fe+")?",Te="[\\ufe0e\\ufe0f]?"+Ce+"(?:\\u200d(?:"+[ge,he,ye].join("|")+")[\\ufe0e\\ufe0f]?"+Ce+")*",De="(?:"+["[\\u2700-\\u27bf]",he,ye].join("|")+")"+Te,Ne="(?:"+[ge+me+"?",me,he,ye,"[\\ud800-\\udfff]"].join("|")+")",we=RegExp("['’]","g"),Ae=RegExp(me,"g"),xe=RegExp(fe+"(?="+fe+")|"+Ne+Te,"g"),Oe=RegExp([Se+"?"+pe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[de,Se,"$"].join("|")+")",_e+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[de,Se+be,"$"].join("|")+")",Se+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Se+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,De].join("|"),"g"),Ie=RegExp("[\\u200d\\ud800-\\udfff"+ue+"\\ufe0e\\ufe0f]"),Le=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Me=-1,Pe={};Pe[_]=Pe[C]=Pe[T]=Pe[D]=Pe[N]=Pe[w]=Pe["[object Uint8ClampedArray]"]=Pe[A]=Pe[x]=!0,Pe[o]=Pe[i]=Pe[S]=Pe[r]=Pe[b]=Pe[s]=Pe[u]=Pe[c]=Pe[m]=Pe[v]=Pe[p]=Pe[E]=Pe[f]=Pe[g]=Pe[y]=!1;var Fe={};Fe[o]=Fe[i]=Fe[S]=Fe[b]=Fe[r]=Fe[s]=Fe[_]=Fe[C]=Fe[T]=Fe[D]=Fe[N]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[f]=Fe[g]=Fe[h]=Fe[w]=Fe["[object Uint8ClampedArray]"]=Fe[A]=Fe[x]=!0,Fe[u]=Fe[c]=Fe[y]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,Ue=parseInt,He="object"==typeof Et&&Et&&Et.Object===Object&&Et,Ve="object"==typeof self&&self&&self.Object===Object&&self,We=He||Ve||Function("return this")(),ze=t&&!t.nodeType&&t,je=ze&&e&&!e.nodeType&&e,qe=je&&je.exports===ze,Ye=qe&&He.process,Ge=function(){try{return je&&je.require&&je.require("util").types||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),Ke=Ge&&Ge.isArrayBuffer,Qe=Ge&&Ge.isDate,Xe=Ge&&Ge.isMap,Ze=Ge&&Ge.isRegExp,$e=Ge&&Ge.isSet,Je=Ge&&Ge.isTypedArray;function et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function tt(e,t,n,l){for(var a=-1,o=null==e?0:e.length;++a<o;){var i=e[a];t(l,i,n(i),e)}return l}function nt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,o=[];++n<l;){var i=e[n];t(i,n,e)&&(o[a++]=i)}return o}function it(e,t){return!(null==e||!e.length)&>(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 st(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 ut(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}function dt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function mt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var vt=bt("length");function pt(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function ft(e,t,n,l){for(var a=e.length,o=n+(l?1:-1);l?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):ft(e,yt,n)}function ht(e,t,n,l){for(var a=n-1,o=e.length;++a<o;)if(l(e[a],t))return a;return-1}function yt(e){return e!=e}function St(e,t){var n=null==e?0:e.length;return n?Tt(e,t)/n:NaN}function bt(e){return function(t){return null==t?void 0:t[e]}}function _t(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,o){n=l?(l=!1,e):t(n,e,a,o)}),n}function Tt(e,t){for(var n,l=-1,a=e.length;++l<a;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Dt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Nt(e){return e?e.slice(0,jt(e)+1).replace(q,""):e}function wt(e){return function(t){return e(t)}}function At(e,t){return st(t,function(t){return e[t]})}function xt(e,t){return e.has(t)}function Ot(e,t){for(var n=-1,l=e.length;++n<l&>(t,e[n],0)>-1;);return n}function It(e,t){for(var n=e.length;n--&>(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Rt=_t({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Mt=_t({"&":"&","<":"<",">":">",'"':""","'":"'"});function Pt(e){return"\\"+ke[e]}function Ft(e){return Ie.test(e)}function kt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Bt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,o=0,i=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,i[o++]=n)}return i}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Vt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):vt(e)}function zt(e){return Ft(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function jt(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var qt=_t({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Yt=function e(t){var Y=(t=null==t?We:Yt.defaults(We.Object(),t,Yt.pick(We,Re))).Array,ue=t.Date,ce=t.Error,de=t.Function,me=t.Math,ve=t.Object,pe=t.RegExp,Ee=t.String,fe=t.TypeError,ge=Y.prototype,he=ve.prototype,ye=t["__core-js_shared__"],Se=de.prototype.toString,be=he.hasOwnProperty,_e=0,Ce=function(){var e=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Te=he.toString,De=Se.call(ve),Ne=We._,xe=pe("^"+Se.call(be).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ie=qe?t.Buffer:void 0,ke=t.Symbol,He=t.Uint8Array,Ve=Ie?Ie.allocUnsafe:void 0,ze=Bt(ve.getPrototypeOf,ve),je=ve.create,Ye=he.propertyIsEnumerable,Ge=ge.splice,vt=ke?ke.isConcatSpreadable:void 0,Et=ke?ke.iterator:void 0,_t=ke?ke.toStringTag:void 0,Gt=function(){try{var e=Za(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),Kt=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,Qt=ue&&ue.now!==We.Date.now&&ue.now,Xt=t.setTimeout!==We.setTimeout&&t.setTimeout,Zt=me.ceil,$t=me.floor,Jt=ve.getOwnPropertySymbols,en=Ie?Ie.isBuffer:void 0,tn=t.isFinite,nn=ge.join,ln=Bt(ve.keys,ve),an=me.max,on=me.min,rn=ue.now,sn=t.parseInt,un=me.random,cn=ge.reverse,dn=Za(t,"DataView"),mn=Za(t,"Map"),vn=Za(t,"Promise"),pn=Za(t,"Set"),En=Za(t,"WeakMap"),fn=Za(ve,"create"),gn=En&&new En,hn={},yn=wo(dn),Sn=wo(mn),bn=wo(vn),_n=wo(pn),Cn=wo(En),Tn=ke?ke.prototype:void 0,Dn=Tn?Tn.valueOf:void 0,Nn=Tn?Tn.toString:void 0;function wn(e){if(ji(e)&&!Ri(e)&&!(e instanceof In)){if(e instanceof On)return e;if(be.call(e,"__wrapped__"))return Ao(e)}return new On(e)}var An=function(){function e(){}return function(t){if(!zi(t))return{};if(je)return je(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function On(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function In(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Ln(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function 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 Rn(e);this.size=t.size}function kn(e,t){var n=Ri(e),l=!n&&Li(e),a=!n&&!l&&ki(e),o=!n&&!l&&!a&&$i(e),i=n||l||a||o,r=i?Dt(e.length,Ee):[],s=r.length;for(var u in e)!t&&!be.call(e,u)||i&&("length"==u||a&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ao(u,s))||r.push(u);return r}function Bn(e){var t=e.length;return t?e[Ml(0,t-1)]:void 0}function Un(e,t){return _o(Ea(e),Kn(t,0,e.length))}function Hn(e){return _o(Ea(e))}function Vn(e,t,n){(void 0!==n&&!xi(e[t],n)||void 0===n&&!(t in e))&&Yn(e,t,n)}function Wn(e,t,n){var l=e[t];be.call(e,t)&&xi(l,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(xi(e[n][0],t))return n;return-1}function jn(e,t,n,l){return Jn(e,function(e,a,o){t(l,e,n(e),o)}),l}function qn(e,t){return e&&fa(t,Sr(t),e)}function Yn(e,t,n){"__proto__"==t&&Gt?Gt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Gn(e,t){for(var n=-1,l=t.length,a=Y(l),o=null==e;++n<l;)a[n]=o?void 0:Er(e,t[n]);return a}function Kn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Qn(e,t,n,l,a,i){var u,y=1&t,O=2&t,I=4&t;if(n&&(u=a?n(e,l,a,i):n(e)),void 0!==u)return u;if(!zi(e))return e;var L=Ri(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&be.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!y)return Ea(e,u)}else{var R=eo(e),M=R==c||R==d;if(ki(e))return ua(e,y);if(R==p||R==o||M&&!a){if(u=O||M?{}:no(e),!y)return O?function(e,t){return fa(e,Ja(e),t)}(e,function(e,t){return e&&fa(t,br(t),e)}(u,e)):function(e,t){return fa(e,$a(e),t)}(e,qn(u,e))}else{if(!Fe[R])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case S:return ca(e);case r:case s:return new l(+e);case b:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case _:case C:case T:case D:case N:case w:case"[object Uint8ClampedArray]":case A:case x:return da(e,n);case m:return new l;case v:case g:return new l(e);case E:return function(e){var t=new e.constructor(e.source,ee.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case h:return Dn?ve(Dn.call(e)):{}}}(e,R,y)}}i||(i=new Fn);var P=i.get(e);if(P)return P;i.set(e,u),Qi(e)?e.forEach(function(l){u.add(Qn(l,t,n,l,e,i))}):qi(e)&&e.forEach(function(l,a){u.set(a,Qn(l,t,n,a,e,i))});var F=L?void 0:(I?O?ja:za:O?br:Sr)(e);return nt(F||e,function(l,a){F&&(l=e[a=l]),Wn(u,a,Qn(l,t,n,a,e,i))}),u}function Xn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],o=e[a];if(void 0===o&&!(a in e)||!(0,t[a])(o))return!1}return!0}function Zn(e,t,l){if("function"!=typeof e)throw new fe(n);return ho(function(){e.apply(void 0,l)},t)}function $n(e,t,n,l){var a=-1,o=it,i=!0,r=e.length,s=[],u=t.length;if(!r)return s;n&&(t=st(t,wt(n))),l?(o=rt,i=!1):t.length>=200&&(o=xt,i=!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,i&&d==d){for(var m=u;m--;)if(t[m]===d)continue e;s.push(c)}else o(t,d,l)||s.push(c)}return s}wn.templateSettings={escape:k,evaluate:B,interpolate:U,variable:"",imports:{_:wn}},(wn.prototype=xn.prototype).constructor=wn,(On.prototype=An(xn.prototype)).constructor=On,(In.prototype=An(xn.prototype)).constructor=In,Ln.prototype.clear=function(){this.__data__=fn?fn(null):{},this.size=0},Ln.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ln.prototype.get=function(e){var t=this.__data__;if(fn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return be.call(t,e)?t[e]:void 0},Ln.prototype.has=function(e){var t=this.__data__;return fn?void 0!==t[e]:be.call(t,e)},Ln.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},Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=zn(t,e);return!(n<0||(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,0))},Rn.prototype.get=function(e){var t=this.__data__,n=zn(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return zn(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,l=zn(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 Ln,map:new(mn||Rn),string:new Ln}},Mn.prototype.delete=function(e){var t=Qa(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Qa(this,e).get(e)},Mn.prototype.has=function(e){return Qa(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Qa(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},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 Rn,this.size=0},Fn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Fn.prototype.get=function(e){return this.__data__.get(e)},Fn.prototype.has=function(e){return this.__data__.has(e)},Fn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(l)}return n.set(e,t),this.size=n.size,this};var Jn=ya(rl),el=ya(sl,!0);function tl(e,t){var n=!0;return Jn(e,function(e,l,a){return n=!!t(e,l,a)}),n}function nl(e,t,n){for(var l=-1,a=e.length;++l<a;){var o=e[l],i=t(o);if(null!=i&&(void 0===r?i==i&&!Zi(i):n(i,r)))var r=i,s=o}return s}function ll(e,t){var n=[];return Jn(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function al(e,t,n,l,a){var o=-1,i=e.length;for(n||(n=lo),a||(a=[]);++o<i;){var r=e[o];t>0&&n(r)?t>1?al(r,t-1,n,l,a):ut(a,r):l||(a[a.length]=r)}return a}var ol=Sa(),il=Sa(!0);function rl(e,t){return e&&ol(e,t,Sr)}function sl(e,t){return e&&il(e,t,Sr)}function ul(e,t){return ot(t,function(t){return Hi(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function dl(e,t,n){var l=t(e);return Ri(e)?l:ut(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_t&&_t in ve(e)?function(e){var t=be.call(e,_t),n=e[_t];try{e[_t]=void 0;var l=!0}catch(e){}var a=Te.call(e);return l&&(t?e[_t]=n:delete e[_t]),a}(e):function(e){return Te.call(e)}(e)}function vl(e,t){return e>t}function pl(e,t){return null!=e&&be.call(e,t)}function El(e,t){return null!=e&&t in ve(e)}function fl(e,t,n){for(var l=n?rt:it,a=e[0].length,o=e.length,i=o,r=Y(o),s=Infinity,u=[];i--;){var c=e[i];i&&t&&(c=st(c,wt(t))),s=on(c.length,s),r[i]=!n&&(t||a>=120&&c.length>=120)?new Pn(i&&c):void 0}c=e[0];var d=-1,m=r[0];e:for(;++d<a&&u.length<s;){var v=c[d],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?xt(m,p):l(u,p,n))){for(i=o;--i;){var E=r[i];if(!(E?xt(E,p):l(e[i],p,n)))continue e}m&&m.push(p),u.push(v)}}return u}function gl(e,t,n){var l=null==(e=po(e,t=oa(t,e)))?e:e[No(Uo(t))];return null==l?void 0:et(l,e,n)}function hl(e){return ji(e)&&ml(e)==o}function yl(e,t,n,l,a){return e===t||(null==e||null==t||!ji(e)&&!ji(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Ri(e),y=Ri(t),_=d?i:eo(e),C=y?i:eo(t),T=(_=_==o?p:_)==p,D=(C=C==o?p:C)==p,N=_==C;if(N&&ki(e)){if(!ki(t))return!1;d=!0,T=!1}if(N&&!T)return c||(c=new Fn),d||$i(e)?Va(e,t,n,l,a,c):function(e,t,n,l,a,o,i){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case S:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case r:case s:case v:return xi(+e,+t);case u:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var c=kt;case f:if(c||(c=Ht),e.size!=t.size&&!(1&l))return!1;var d=i.get(e);if(d)return d==t;l|=2,i.set(e,t);var p=Va(c(e),c(t),l,a,o,i);return i.delete(e),p;case h:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,_,n,l,a,c);if(!(1&n)){var w=T&&be.call(e,"__wrapped__"),A=D&&be.call(t,"__wrapped__");if(w||A){var x=w?e.value():e,O=A?t.value():t;return c||(c=new Fn),a(x,O,n,l,c)}}return!!N&&(c||(c=new Fn),function(e,t,n,l,a,o){var i=1&n,r=za(e),s=r.length;if(s!=za(t).length&&!i)return!1;for(var u=s;u--;){var c=r[u];if(!(i?c in t:be.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var v=!0;o.set(e,t),o.set(t,e);for(var p=i;++u<s;){var E=e[c=r[u]],f=t[c];if(l)var g=i?l(f,E,c,t,e,o):l(E,f,c,e,t,o);if(!(void 0===g?E===f||a(E,f,n,l,o):g)){v=!1;break}p||(p="constructor"==c)}if(v&&!p){var h=e.constructor,y=t.constructor;h==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof y&&y instanceof y||(v=!1)}return o.delete(e),o.delete(t),v}(e,t,n,l,a,c))}(e,t,n,l,yl,a))}function Sl(e,t,n,l){var a=n.length,o=a,i=!l;if(null==e)return!o;for(e=ve(e);a--;){var r=n[a];if(i&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<o;){var s=(r=n[a])[0],u=e[s],c=r[1];if(i&&r[2]){if(void 0===u&&!(s in e))return!1}else{var d=new Fn;if(l)var m=l(u,c,s,e,t,d);if(!(void 0===m?yl(c,u,3,l,d):m))return!1}}return!0}function bl(e){return!(!zi(e)||(t=e,Ce&&Ce in t))&&(Hi(e)?xe:le).test(wo(e));var t}function _l(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?Ri(e)?wl(e[0],e[1]):Nl(e):ts(e)}function Cl(e){if(!uo(e))return ln(e);var t=[];for(var n in ve(e))be.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Tl(e,t){return e<t}function Dl(e,t){var n=-1,l=Pi(e)?Y(e.length):[];return Jn(e,function(e,a,o){l[++n]=t(e,a,o)}),l}function Nl(e){var t=Xa(e);return 1==t.length&&t[0][2]?mo(t[0][0],t[0][1]):function(n){return n===e||Sl(n,e,t)}}function wl(e,t){return io(e)&&co(t)?mo(No(e),t):function(n){var l=Er(n,e);return void 0===l&&l===t?fr(n,e):yl(t,l,3)}}function Al(e,t,n,l,a){e!==t&&ol(t,function(o,i){if(a||(a=new Fn),zi(o))!function(e,t,n,l,a,o,i){var r=fo(e,n),s=fo(t,n),u=i.get(s);if(u)Vn(e,n,u);else{var c=o?o(r,s,n+"",e,t,i):void 0,d=void 0===c;if(d){var m=Ri(s),v=!m&&ki(s),p=!m&&!v&&$i(s);c=s,m||v||p?Ri(r)?c=r:Fi(r)?c=Ea(r):v?(d=!1,c=ua(s,!0)):p?(d=!1,c=da(s,!0)):c=[]:Gi(s)||Li(s)?(c=r,Li(r)?c=ir(r):zi(r)&&!Hi(r)||(c=no(s))):d=!1}d&&(i.set(s,c),a(c,s,l,o,i),i.delete(s)),Vn(e,n,c)}}(e,t,i,n,Al,l,a);else{var r=l?l(fo(e,i),o,i+"",e,t,a):void 0;void 0===r&&(r=o),Vn(e,i,r)}},br)}function xl(e,t){var n=e.length;if(n)return ao(t+=t<0?n:0,n)?e[t]:void 0}function Ol(e,t,n){t=t.length?st(t,function(e){return Ri(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[Yr];var l=-1;return t=st(t,wt(Ka())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,o=t.criteria,i=a.length,r=n.length;++l<i;){var s=ma(a[l],o[l]);if(s)return l>=r?s:s*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Dl(e,function(e,n,a){return{criteria:st(t,function(t){return t(e)}),index:++l,value:e}}))}function Il(e,t,n){for(var l=-1,a=t.length,o={};++l<a;){var i=t[l],r=cl(e,i);n(r,i)&&Ul(o,oa(i,e),r)}return o}function Ll(e,t,n,l){var a=l?ht:gt,o=-1,i=t.length,r=e;for(e===t&&(t=Ea(t)),n&&(r=st(e,wt(n)));++o<i;)for(var s=0,u=t[o],c=n?n(u):u;(s=a(r,c,s,l))>-1;)r!==e&&Ge.call(r,s,1),Ge.call(e,s,1);return e}function Rl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==o){var o=a;ao(a)?Ge.call(e,a,1):Zl(e,a)}}return e}function Ml(e,t){return e+$t(un()*(t-e+1))}function Pl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=$t(t/2))&&(e+=e)}while(t);return n}function Fl(e,t){return yo(vo(e,t,Yr),e+"")}function kl(e){return Bn(xr(e))}function Bl(e,t){var n=xr(e);return _o(n,Kn(t,0,n.length))}function Ul(e,t,n,l){if(!zi(e))return e;for(var a=-1,o=(t=oa(t,e)).length,i=o-1,r=e;null!=r&&++a<o;){var s=No(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=i){var c=r[s];void 0===(u=l?l(c,s,r):void 0)&&(u=zi(c)?c:ao(t[a+1])?[]:{})}Wn(r,s,u),r=r[s]}return e}var Hl=gn?function(e,t){return gn.set(e,t),e}:Yr,Vl=Gt?function(e,t){return Gt(e,"toString",{configurable:!0,enumerable:!1,value:zr(t),writable:!0})}:Yr;function Wl(e){return _o(xr(e))}function zl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Y(a);++l<a;)o[l]=e[l+t];return o}function jl(e,t){var n;return Jn(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function ql(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var o=l+a>>>1,i=e[o];null!==i&&!Zi(i)&&(n?i<=t:i<t)?l=o+1:a=o}return a}return Yl(e,t,Yr,n)}function Yl(e,t,n,l){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var i=(t=n(t))!=t,r=null===t,s=Zi(t),u=void 0===t;a<o;){var c=$t((a+o)/2),d=n(e[c]),m=void 0!==d,v=null===d,p=d==d,E=Zi(d);if(i)var f=l||p;else f=u?p&&(l||m):r?p&&m&&(l||!v):s?p&&m&&!v&&(l||!E):!v&&!E&&(l?d<=t:d<t);f?a=c+1:o=c}return on(o,4294967294)}function Gl(e,t){for(var n=-1,l=e.length,a=0,o=[];++n<l;){var i=e[n],r=t?t(i):i;if(!n||!xi(r,s)){var s=r;o[a++]=0===i?0:i}}return o}function Kl(e){return"number"==typeof e?e:Zi(e)?NaN:+e}function Ql(e){if("string"==typeof e)return e;if(Ri(e))return st(e,Ql)+"";if(Zi(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xl(e,t,n){var l=-1,a=it,o=e.length,i=!0,r=[],s=r;if(n)i=!1,a=rt;else if(o>=200){var u=t?null:Pa(e);if(u)return Ht(u);i=!1,a=xt,s=new Pn}else s=t?[]:r;e:for(;++l<o;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,i&&d==d){for(var m=s.length;m--;)if(s[m]===d)continue e;t&&s.push(d),r.push(c)}else a(s,d,n)||(s!==r&&s.push(d),r.push(c))}return r}function Zl(e,t){return null==(e=po(e,t=oa(t,e)))||delete e[No(Uo(t))]}function $l(e,t,n,l){return Ul(e,t,n(cl(e,t)),l)}function Jl(e,t,n,l){for(var a=e.length,o=l?a:-1;(l?o--:++o<a)&&t(e[o],o,e););return n?zl(e,l?0:o,l?o+1:a):zl(e,l?o+1:0,l?a:o)}function ea(e,t){var n=e;return n instanceof In&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,ut([e],t.args))},n)}function ta(e,t,n){var l=e.length;if(l<2)return l?Xl(e[0]):[];for(var a=-1,o=Y(l);++a<l;)for(var i=e[a],r=-1;++r<l;)r!=a&&(o[a]=$n(o[a]||i,e[r],t,n));return Xl(al(o,1),t,n)}function na(e,t,n){for(var l=-1,a=e.length,o=t.length,i={};++l<a;)n(i,e[l],l<o?t[l]:void 0);return i}function la(e){return Fi(e)?e:[]}function aa(e){return"function"==typeof e?e:Yr}function oa(e,t){return Ri(e)?e:io(e,t)?[e]:Do(rr(e))}var ia=Fl;function ra(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var sa=Kt||function(e){return We.clearTimeout(e)};function ua(e,t){if(t)return e.slice();var n=e.length,l=Ve?Ve(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function da(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ma(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,o=Zi(e),i=void 0!==t,r=null===t,s=t==t,u=Zi(t);if(!r&&!u&&!o&&e>t||o&&i&&s&&!r&&!u||l&&i&&s||!n&&s||!a)return 1;if(!l&&!o&&!u&&e<t||u&&n&&a&&!l&&!o||r&&n&&a||!i&&a||!s)return-1}return 0}function va(e,t,n,l){for(var a=-1,o=e.length,i=n.length,r=-1,s=t.length,u=an(o-i,0),c=Y(s+u),d=!l;++r<s;)c[r]=t[r];for(;++a<i;)(d||a<o)&&(c[n[a]]=e[a]);for(;u--;)c[r++]=e[a++];return c}function pa(e,t,n,l){for(var a=-1,o=e.length,i=-1,r=n.length,s=-1,u=t.length,c=an(o-r,0),d=Y(c+u),m=!l;++a<c;)d[a]=e[a];for(var v=a;++s<u;)d[v+s]=t[s];for(;++i<r;)(m||a<o)&&(d[v+n[i]]=e[a++]);return d}function Ea(e,t){var n=-1,l=e.length;for(t||(t=Y(l));++n<l;)t[n]=e[n];return t}function fa(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?Yn(n,r,s):Wn(n,r,s)}return n}function ga(e,t){return function(n,l){var a=Ri(n)?tt:jn,o=t?t():{};return a(n,e,Ka(l,2),o)}}function ha(e){return Fl(function(t,n){var l=-1,a=n.length,o=a>1?n[a-1]:void 0,i=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&oo(n[0],n[1],i)&&(o=a<3?void 0:o,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,o)}return t})}function ya(e,t){return function(n,l){if(null==n)return n;if(!Pi(n))return e(n,l);for(var a=n.length,o=t?a:-1,i=ve(n);(t?o--:++o<a)&&!1!==l(i[o],o,i););return n}}function Sa(e){return function(t,n,l){for(var a=-1,o=ve(t),i=l(t),r=i.length;r--;){var s=i[e?r:++a];if(!1===n(o[s],s,o))break}return t}}function ba(e){return function(t){var n=Ft(t=rr(t))?zt(t):void 0,l=n?n[0]:t.charAt(0),a=n?ra(n,1).join(""):t.slice(1);return l[e]()+a}}function _a(e){return function(t){return ct(Hr(Lr(t).replace(we,"")),e,"")}}function Ca(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=An(e.prototype),l=e.apply(n,t);return zi(l)?l:n}}function Ta(e){return function(t,n,l){var a=ve(t);if(!Pi(t)){var o=Ka(n,3);t=Sr(t),n=function(e){return o(a[e],e,a)}}var i=e(t,n,l);return i>-1?a[o?t[i]:i]:void 0}}function Da(e){return Wa(function(t){var l=t.length,a=l,o=On.prototype.thru;for(e&&t.reverse();a--;){var i=t[a];if("function"!=typeof i)throw new fe(n);if(o&&!r&&"wrapper"==Ya(i))var r=new On([],!0)}for(a=r?a:l;++a<l;){var s=Ya(i=t[a]),u="wrapper"==s?qa(i):void 0;r=u&&ro(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[Ya(u[0])].apply(r,u[3]):1==i.length&&ro(i)?r[s]():r.thru(i)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&Ri(n))return r.plant(n).value();for(var a=0,o=l?t[a].apply(this,e):n;++a<l;)o=t[a].call(this,o);return o}})}function Na(e,t,n,l,a,o,i,r,s,u){var c=128&t,d=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:Ca(e);return function f(){for(var g=arguments.length,h=Y(g),y=g;y--;)h[y]=arguments[y];if(v)var S=Ga(f),b=Lt(h,S);if(l&&(h=va(h,l,a,v)),o&&(h=pa(h,o,i,v)),g-=b,v&&g<u){var _=Ut(h,S);return Ra(e,t,Na,f.placeholder,n,h,_,r,s,u-g)}var C=d?n:this,T=m?C[e]:e;return g=h.length,r?h=Eo(h,r):p&&g>1&&h.reverse(),c&&s<g&&(h.length=s),this&&this!==We&&this instanceof f&&(T=E||Ca(T)),T.apply(C,h)}}function wa(e,t){return function(n,l){return function(e,t,n,l){return rl(e,function(e,a,o){t(l,n(e),a,o)}),l}(n,e,t(l),{})}}function Aa(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Ql(n),l=Ql(l)):(n=Kl(n),l=Kl(l)),a=e(n,l)}return a}}function xa(e){return Wa(function(t){return t=st(t,wt(Ka())),Fl(function(n){var l=this;return e(t,function(e){return et(e,l,n)})})})}function Oa(e,t){var n=(t=void 0===t?" ":Ql(t)).length;if(n<2)return n?Pl(t,e):t;var l=Pl(t,Zt(e/Wt(t)));return Ft(t)?ra(zt(l),0,e).join(""):l.slice(0,e)}function Ia(e){return function(t,n,l){return l&&"number"!=typeof l&&oo(t,n,l)&&(n=l=void 0),t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n,l){for(var a=-1,o=an(Zt((t-e)/(n||1)),0),i=Y(o);o--;)i[l?o:++a]=e,e+=n;return i}(t,n,l=void 0===l?t<n?1:-1:nr(l),e)}}function La(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function Ra(e,t,n,l,a,o,i,r,s,u){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?o:void 0,c?i:void 0,c?void 0:o,c?void 0:i,r,s,u],m=n.apply(void 0,d);return ro(e)&&go(m,d),m.placeholder=l,So(m,e,t)}function Ma(e){var t=me[e];return function(e,n){if(e=or(e),(n=null==n?0:on(lr(n),292))&&tn(e)){var l=(rr(e)+"e").split("e");return+((l=(rr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Pa=pn&&1/Ht(new pn([,-0]))[1]==1/0?function(e){return new pn(e)}:Zr;function Fa(e){return function(t){var n=eo(t);return n==m?kt(t):n==f?Vt(t):function(e,t){return st(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,o,i,r,s,u){var c=2&t;if(!c&&"function"!=typeof e)throw new fe(n);var d=o?o.length:0;if(d||(t&=-97,o=i=void 0),s=void 0===s?s:an(lr(s),0),u=void 0===u?u:lr(u),d-=i?i.length:0,64&t){var m=o,v=i;o=i=void 0}var p=c?void 0:qa(e),E=[e,t,a,o,i,m,v,r,s,u];if(p&&function(e,t){var n=e[1],a=t[1],o=n|a;if(!(o<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],o|=1&n?0:4);var i=t[3];if(i){var r=e[3];e[3]=r?va(r,i,t[4]):i,e[4]=r?Ut(e[3],l):t[4]}(i=t[5])&&(e[5]=(r=e[5])?pa(r,i,t[6]):i,e[6]=r?Ut(e[5],l):t[6]),(i=t[7])&&(e[7]=i),128&a&&(e[8]=null==e[8]?t[8]:on(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(E,p),e=E[0],t=E[1],a=E[2],o=E[3],i=E[4],!(u=E[9]=void 0===E[9]?c?0:e.length:an(E[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=Ca(e);return function a(){for(var o=arguments.length,i=Y(o),r=o,s=Ga(a);r--;)i[r]=arguments[r];var u=o<3&&i[0]!==s&&i[o-1]!==s?[]:Ut(i,s);if((o-=u.length)<n)return Ra(e,t,Na,a.placeholder,void 0,i,u,void 0,void 0,n-o);var c=this&&this!==We&&this instanceof a?l:e;return et(c,this,i)}}(e,t,u):32!=t&&33!=t||i.length?Na.apply(void 0,E):function(e,t,n,l){var a=1&t,o=Ca(e);return function t(){for(var i=-1,r=arguments.length,s=-1,u=l.length,c=Y(u+r),d=this&&this!==We&&this instanceof t?o:e;++s<u;)c[s]=l[s];for(;r--;)c[s++]=arguments[++i];return et(d,a?n:this,c)}}(e,t,a,o);else var f=function(e,t,n){var l=1&t,a=Ca(e);return function t(){var o=this&&this!==We&&this instanceof t?a:e;return o.apply(l?n:this,arguments)}}(e,t,a);return So((p?Hl:go)(f,E),e,t)}function Ba(e,t,n,l){return void 0===e||xi(e,he[n])&&!be.call(l,n)?t:e}function Ua(e,t,n,l,a,o){return zi(e)&&zi(t)&&(o.set(t,e),Al(e,t,void 0,Ua,o),o.delete(t)),e}function Ha(e){return Gi(e)?void 0:e}function Va(e,t,n,l,a,o){var i=1&n,r=e.length,s=t.length;if(r!=s&&!(i&&s>r))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,m=!0,v=2&n?new Pn:void 0;for(o.set(e,t),o.set(t,e);++d<r;){var p=e[d],E=t[d];if(l)var f=i?l(E,p,d,t,e,o):l(p,E,d,e,t,o);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!mt(t,function(e,t){if(!xt(v,t)&&(p===e||a(p,e,n,l,o)))return v.push(t)})){m=!1;break}}else if(p!==E&&!a(p,E,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function Wa(e){return yo(vo(e,void 0,Mo),e+"")}function za(e){return dl(e,Sr,$a)}function ja(e){return dl(e,br,Ja)}var qa=gn?function(e){return gn.get(e)}:Zr;function Ya(e){for(var t=e.name+"",n=hn[t],l=be.call(hn,t)?n.length:0;l--;){var a=n[l],o=a.func;if(null==o||o==e)return a.name}return t}function Ga(e){return(be.call(wn,"placeholder")?wn:e).placeholder}function Ka(){var e=wn.iteratee||Gr;return e=e===Gr?_l:e,arguments.length?e(arguments[0],arguments[1]):e}function Qa(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Xa(e){for(var t=Sr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,co(a)]}return t}function Za(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return bl(n)?n:void 0}var $a=Jt?function(e){return null==e?[]:(e=ve(e),ot(Jt(e),function(t){return Ye.call(e,t)}))}:as,Ja=Jt?function(e){for(var t=[];e;)ut(t,$a(e)),e=ze(e);return t}:as,eo=ml;function to(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,o=!1;++l<a;){var i=No(t[l]);if(!(o=null!=e&&n(e,i)))break;e=e[i]}return o||++l!=a?o:!!(a=null==e?0:e.length)&&Wi(a)&&ao(i,a)&&(Ri(e)||Li(e))}function no(e){return"function"!=typeof e.constructor||uo(e)?{}:An(ze(e))}function lo(e){return Ri(e)||Li(e)||!!(vt&&e&&e[vt])}function ao(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function oo(e,t,n){if(!zi(n))return!1;var l=typeof t;return!!("number"==l?Pi(n)&&ao(t,n.length):"string"==l&&t in n)&&xi(n[t],e)}function io(e,t){if(Ri(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Zi(e))||V.test(e)||!H.test(e)||null!=t&&e in ve(t)}function ro(e){var t=Ya(e),n=wn[t];if("function"!=typeof n||!(t in In.prototype))return!1;if(e===n)return!0;var l=qa(n);return!!l&&e===l[0]}(dn&&eo(new dn(new ArrayBuffer(1)))!=b||mn&&eo(new mn)!=m||vn&&"[object Promise]"!=eo(vn.resolve())||pn&&eo(new pn)!=f||En&&eo(new En)!=y)&&(eo=function(e){var t=ml(e),n=t==p?e.constructor:void 0,l=n?wo(n):"";if(l)switch(l){case yn:return b;case Sn:return m;case bn:return"[object Promise]";case _n:return f;case Cn:return y}return t});var so=ye?Hi:os;function uo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function co(e){return e==e&&!zi(e)}function mo(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,o=an(l.length-t,0),i=Y(o);++a<o;)i[a]=l[t+a];a=-1;for(var r=Y(t+1);++a<t;)r[a]=l[a];return r[t]=n(i),et(e,this,r)}}function po(e,t){return t.length<2?e:cl(e,zl(t,0,-1))}function Eo(e,t){for(var n=e.length,l=on(t.length,n),a=Ea(e);l--;){var o=t[l];e[l]=ao(o,n)?a[o]:void 0}return e}function fo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var go=bo(Hl),ho=Xt||function(e,t){return We.setTimeout(e,t)},yo=bo(Vl);function So(e,t,n){var l=t+"";return yo(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(G,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return nt(a,function(n){var l="_."+n[0];t&n[1]&&!it(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match(K);return t?t[1].split(Q):[]}(l),n)))}function bo(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 _o(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var o=Ml(n,a),i=e[o];e[o]=e[n],e[n]=i}return e.length=t,e}var Co,To,Do=(Co=Ci(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,n,l,a){t.push(l?a.replace($,"$1"):n||e)}),t},function(e){return 500===To.size&&To.clear(),e}),To=Co.cache,Co);function No(e){if("string"==typeof e||Zi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function wo(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ao(e){if(e instanceof In)return e.clone();var t=new On(e.__wrapped__,e.__chain__);return t.__actions__=Ea(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var xo=Fl(function(e,t){return Fi(e)?$n(e,al(t,1,Fi,!0)):[]}),Oo=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),Ka(n,2)):[]}),Io=Fl(function(e,t){var n=Uo(t);return Fi(n)&&(n=void 0),Fi(e)?$n(e,al(t,1,Fi,!0),void 0,n):[]});function Lo(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,Ka(t,3),a)}function Ro(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=lr(n),a=n<0?an(l+a,0):on(a,l-1)),ft(e,Ka(t,3),a,!0)}function Mo(e){return null!=e&&e.length?al(e,1):[]}function Po(e){return e&&e.length?e[0]:void 0}var Fo=Fl(function(e){var t=st(e,la);return t.length&&t[0]===e[0]?fl(t):[]}),ko=Fl(function(e){var t=Uo(e),n=st(e,la);return t===Uo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?fl(n,Ka(t,2)):[]}),Bo=Fl(function(e){var t=Uo(e),n=st(e,la);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?fl(n,void 0,t):[]});function Uo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ho=Fl(Vo);function Vo(e,t){return e&&e.length&&t&&t.length?Ll(e,t):e}var Wo=Wa(function(e,t){var n=null==e?0:e.length,l=Gn(e,t);return Rl(e,st(t,function(e){return ao(e,n)?+e:e}).sort(ma)),l});function zo(e){return null==e?e:cn.call(e)}var jo=Fl(function(e){return Xl(al(e,1,Fi,!0))}),qo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),Xl(al(e,1,Fi,!0),Ka(t,2))}),Yo=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,Xl(al(e,1,Fi,!0),void 0,t)});function Go(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Fi(e))return t=an(e.length,t),!0}),Dt(t,function(t){return st(e,bt(t))})}function Ko(e,t){if(!e||!e.length)return[];var n=Go(e);return null==t?n:st(n,function(e){return et(t,void 0,e)})}var Qo=Fl(function(e,t){return Fi(e)?$n(e,t):[]}),Xo=Fl(function(e){return ta(ot(e,Fi))}),Zo=Fl(function(e){var t=Uo(e);return Fi(t)&&(t=void 0),ta(ot(e,Fi),Ka(t,2))}),$o=Fl(function(e){var t=Uo(e);return t="function"==typeof t?t:void 0,ta(ot(e,Fi),void 0,t)}),Jo=Fl(Go),ei=Fl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Ko(e,n)});function ti(e){var t=wn(e);return t.__chain__=!0,t}function ni(e,t){return t(e)}var li=Wa(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return Gn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof In&&ao(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:ni,args:[a],thisArg:void 0}),new On(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ai=ga(function(e,t,n){be.call(e,n)?++e[n]:Yn(e,n,1)}),oi=Ta(Lo),ii=Ta(Ro);function ri(e,t){return(Ri(e)?nt:Jn)(e,Ka(t,3))}function si(e,t){return(Ri(e)?lt:el)(e,Ka(t,3))}var ui=ga(function(e,t,n){be.call(e,n)?e[n].push(t):Yn(e,n,[t])}),ci=Fl(function(e,t,n){var l=-1,a="function"==typeof t,o=Pi(e)?Y(e.length):[];return Jn(e,function(e){o[++l]=a?et(t,e,n):gl(e,t,n)}),o}),di=ga(function(e,t,n){Yn(e,n,t)});function mi(e,t){return(Ri(e)?st:Dl)(e,Ka(t,3))}var vi=ga(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),pi=Fl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),Ol(e,al(t,1),[])}),Ei=Qt||function(){return We.Date.now()};function fi(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function gi(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 hi=Fl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,Ga(hi));l|=32}return ka(e,l,t,n,a)}),yi=Fl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,Ga(yi));l|=32}return ka(t,l,e,n,a)});function Si(e,t,l){var a,o,i,r,s,u,c=0,d=!1,m=!1,v=!0;if("function"!=typeof e)throw new fe(n);function p(t){var n=a,l=o;return a=o=void 0,c=t,r=e.apply(l,n)}function E(e){return c=e,s=ho(g,t),d?p(e):r}function f(e){var n=e-u;return void 0===u||n>=t||n<0||m&&e-c>=i}function g(){var e=Ei();if(f(e))return h(e);s=ho(g,function(e){var n=t-(e-u);return m?on(n,i-(e-c)):n}(e))}function h(e){return s=void 0,v&&a?p(e):(a=o=void 0,r)}function y(){var e=Ei(),n=f(e);if(a=arguments,o=this,u=e,n){if(void 0===s)return E(u);if(m)return sa(s),s=ho(g,t),p(u)}return void 0===s&&(s=ho(g,t)),r}return t=or(t)||0,zi(l)&&(d=!!l.leading,i=(m="maxWait"in l)?an(or(l.maxWait)||0,t):i,v="trailing"in l?!!l.trailing:v),y.cancel=function(){void 0!==s&&sa(s),c=0,a=u=o=s=void 0},y.flush=function(){return void 0===s?r:h(Ei())},y}var bi=Fl(function(e,t){return Zn(e,1,t)}),_i=Fl(function(e,t,n){return Zn(e,or(t)||0,n)});function Ci(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],o=l.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return l.cache=o.set(a,i)||o,i};return l.cache=new(Ci.Cache||Mn),l}function Ti(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)}}Ci.Cache=Mn;var Di=ia(function(e,t){var n=(t=1==t.length&&Ri(t[0])?st(t[0],wt(Ka())):st(al(t,1),wt(Ka()))).length;return Fl(function(l){for(var a=-1,o=on(l.length,n);++a<o;)l[a]=t[a].call(this,l[a]);return et(e,this,l)})}),Ni=Fl(function(e,t){return ka(e,32,void 0,t,Ut(t,Ga(Ni)))}),wi=Fl(function(e,t){return ka(e,64,void 0,t,Ut(t,Ga(wi)))}),Ai=Wa(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function xi(e,t){return e===t||e!=e&&t!=t}var Oi=La(vl),Ii=La(function(e,t){return e>=t}),Li=hl(function(){return arguments}())?hl:function(e){return ji(e)&&be.call(e,"callee")&&!Ye.call(e,"callee")},Ri=Y.isArray,Mi=Ke?wt(Ke):function(e){return ji(e)&&ml(e)==S};function Pi(e){return null!=e&&Wi(e.length)&&!Hi(e)}function Fi(e){return ji(e)&&Pi(e)}var ki=en||os,Bi=Qe?wt(Qe):function(e){return ji(e)&&ml(e)==s};function Ui(e){if(!ji(e))return!1;var t=ml(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Gi(e)}function Hi(e){if(!zi(e))return!1;var t=ml(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Vi(e){return"number"==typeof e&&e==lr(e)}function Wi(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zi(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ji(e){return null!=e&&"object"==typeof e}var qi=Xe?wt(Xe):function(e){return ji(e)&&eo(e)==m};function Yi(e){return"number"==typeof e||ji(e)&&ml(e)==v}function Gi(e){if(!ji(e)||ml(e)!=p)return!1;var t=ze(e);if(null===t)return!0;var n=be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Se.call(n)==De}var Ki=Ze?wt(Ze):function(e){return ji(e)&&ml(e)==E},Qi=$e?wt($e):function(e){return ji(e)&&eo(e)==f};function Xi(e){return"string"==typeof e||!Ri(e)&&ji(e)&&ml(e)==g}function Zi(e){return"symbol"==typeof e||ji(e)&&ml(e)==h}var $i=Je?wt(Je):function(e){return ji(e)&&Wi(e.length)&&!!Pe[ml(e)]},Ji=La(Tl),er=La(function(e,t){return e<=t});function tr(e){if(!e)return[];if(Pi(e))return Xi(e)?zt(e):Ea(e);if(Et&&e[Et])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Et]());var t=eo(e);return(t==m?kt:t==f?Ht:xr)(e)}function nr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function lr(e){var t=nr(e),n=t%1;return t==t?n?t-n:t:0}function ar(e){return e?Kn(lr(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Zi(e))return NaN;if(zi(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zi(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Nt(e);var n=ne.test(e);return n||ae.test(e)?Ue(e.slice(2),n?2:8):te.test(e)?NaN:+e}function ir(e){return fa(e,br(e))}function rr(e){return null==e?"":Ql(e)}var sr=ha(function(e,t){if(uo(t)||Pi(t))fa(t,Sr(t),e);else for(var n in t)be.call(t,n)&&Wn(e,n,t[n])}),ur=ha(function(e,t){fa(t,br(t),e)}),cr=ha(function(e,t,n,l){fa(t,br(t),e,l)}),dr=ha(function(e,t,n,l){fa(t,Sr(t),e,l)}),mr=Wa(Gn),vr=Fl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oo(t[0],t[1],a)&&(l=1);++n<l;)for(var o=t[n],i=br(o),r=-1,s=i.length;++r<s;){var u=i[r],c=e[u];(void 0===c||xi(c,he[u])&&!be.call(e,u))&&(e[u]=o[u])}return e}),pr=Fl(function(e){return e.push(void 0,Ua),et(Cr,void 0,e)});function Er(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&&to(e,t,El)}var gr=wa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n},zr(Yr)),hr=wa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),be.call(e,t)?e[t].push(n):e[t]=[n]},Ka),yr=Fl(gl);function Sr(e){return Pi(e)?kn(e):Cl(e)}function br(e){return Pi(e)?kn(e,!0):function(e){if(!zi(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=uo(e),n=[];for(var l in e)("constructor"!=l||!t&&be.call(e,l))&&n.push(l);return n}(e)}var _r=ha(function(e,t,n){Al(e,t,n)}),Cr=ha(function(e,t,n,l){Al(e,t,n,l)}),Tr=Wa(function(e,t){var n={};if(null==e)return n;var l=!1;t=st(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),fa(e,ja(e),n),l&&(n=Qn(n,7,Ha));for(var a=t.length;a--;)Zl(n,t[a]);return n}),Dr=Wa(function(e,t){return null==e?{}:function(e,t){return Il(e,t,function(t,n){return fr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=st(ja(e),function(e){return[e]});return t=Ka(t),Il(e,n,function(e,n){return t(e,n[0])})}var wr=Fa(Sr),Ar=Fa(br);function xr(e){return null==e?[]:At(e,Sr(e))}var Or=_a(function(e,t,n){return t=t.toLowerCase(),e+(n?Ir(t):t)});function Ir(e){return Ur(rr(e).toLowerCase())}function Lr(e){return(e=rr(e))&&e.replace(ie,Rt).replace(Ae,"")}var Rr=_a(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=_a(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Pr=ba("toLowerCase"),Fr=_a(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=_a(function(e,t,n){return e+(n?" ":"")+Ur(t)}),Br=_a(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ur=ba("toUpperCase");function Hr(e,t,n){return e=rr(e),void 0===(t=n?void 0:t)?function(e){return Le.test(e)}(e)?function(e){return e.match(Oe)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Vr=Fl(function(e,t){try{return et(e,void 0,t)}catch(e){return Ui(e)?e:new ce(e)}}),Wr=Wa(function(e,t){return nt(t,function(t){t=No(t),Yn(e,t,hi(e[t],e))}),e});function zr(e){return function(){return e}}var jr=Da(),qr=Da(!0);function Yr(e){return e}function Gr(e){return _l("function"==typeof e?e:Qn(e,1))}var Kr=Fl(function(e,t){return function(n){return gl(n,e,t)}}),Qr=Fl(function(e,t){return function(n){return gl(e,n,t)}});function Xr(e,t,n){var l=Sr(t),a=ul(t,l);null!=n||zi(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=ul(t,Sr(t)));var o=!(zi(n)&&"chain"in n&&!n.chain),i=Hi(e);return nt(a,function(n){var l=t[n];e[n]=l,i&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),a=n.__actions__=Ea(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,ut([this.value()],arguments))})}),e}function Zr(){}var $r=xa(st),Jr=xa(at),es=xa(mt);function ts(e){return io(e)?bt(No(e)):function(e){return function(t){return cl(t,e)}}(e)}var ns=Ia(),ls=Ia(!0);function as(){return[]}function os(){return!1}var is,rs=Aa(function(e,t){return e+t},0),ss=Ma("ceil"),us=Aa(function(e,t){return e/t},1),cs=Ma("floor"),ds=Aa(function(e,t){return e*t},1),ms=Ma("round"),vs=Aa(function(e,t){return e-t},0);return wn.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)}},wn.ary=fi,wn.assign=sr,wn.assignIn=ur,wn.assignInWith=cr,wn.assignWith=dr,wn.at=mr,wn.before=gi,wn.bind=hi,wn.bindAll=Wr,wn.bindKey=yi,wn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ri(e)?e:[e]},wn.chain=ti,wn.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:an(lr(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,o=0,i=Y(Zt(l/t));a<l;)i[o++]=zl(e,a,a+=t);return i},wn.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var o=e[t];o&&(a[l++]=o)}return a},wn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Y(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return ut(Ri(n)?Ea(n):[n],al(t,1))},wn.cond=function(e){var t=null==e?0:e.length,l=Ka();return e=t?st(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)}})},wn.conforms=function(e){return function(e){var t=Sr(e);return function(n){return Xn(n,e,t)}}(Qn(e,1))},wn.constant=zr,wn.countBy=ai,wn.create=function(e,t){var n=An(e);return null==t?n:qn(n,t)},wn.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},wn.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},wn.debounce=Si,wn.defaults=vr,wn.defaultsDeep=pr,wn.defer=bi,wn.delay=_i,wn.difference=xo,wn.differenceBy=Oo,wn.differenceWith=Io,wn.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:lr(t))<0?0:t,l):[]},wn.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,0,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t):[]},wn.dropRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0,!0):[]},wn.dropWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!0):[]},wn.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oo(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=lr(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:lr(l))<0&&(l+=a),l=n>l?0:ar(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},wn.filter=function(e,t){return(Ri(e)?ot:ll)(e,Ka(t,3))},wn.flatMap=function(e,t){return al(mi(e,t),1)},wn.flatMapDeep=function(e,t){return al(mi(e,t),1/0)},wn.flatMapDepth=function(e,t,n){return n=void 0===n?1:lr(n),al(mi(e,t),n)},wn.flatten=Mo,wn.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},wn.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:lr(t)):[]},wn.flip=function(e){return ka(e,512)},wn.flow=jr,wn.flowRight=qr,wn.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},wn.functions=function(e){return null==e?[]:ul(e,Sr(e))},wn.functionsIn=function(e){return null==e?[]:ul(e,br(e))},wn.groupBy=ui,wn.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},wn.intersection=Fo,wn.intersectionBy=ko,wn.intersectionWith=Bo,wn.invert=gr,wn.invertBy=hr,wn.invokeMap=ci,wn.iteratee=Gr,wn.keyBy=di,wn.keys=Sr,wn.keysIn=br,wn.map=mi,wn.mapKeys=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,t(e,l,a),e)}),n},wn.mapValues=function(e,t){var n={};return t=Ka(t,3),rl(e,function(e,l,a){Yn(n,l,t(e,l,a))}),n},wn.matches=function(e){return Nl(Qn(e,1))},wn.matchesProperty=function(e,t){return wl(e,Qn(t,1))},wn.memoize=Ci,wn.merge=_r,wn.mergeWith=Cr,wn.method=Kr,wn.methodOf=Qr,wn.mixin=Xr,wn.negate=Ti,wn.nthArg=function(e){return e=lr(e),Fl(function(t){return xl(t,e)})},wn.omit=Tr,wn.omitBy=function(e,t){return Nr(e,Ti(Ka(t)))},wn.once=function(e){return gi(2,e)},wn.orderBy=function(e,t,n,l){return null==e?[]:(Ri(t)||(t=null==t?[]:[t]),Ri(n=l?void 0:n)||(n=null==n?[]:[n]),Ol(e,t,n))},wn.over=$r,wn.overArgs=Di,wn.overEvery=Jr,wn.overSome=es,wn.partial=Ni,wn.partialRight=wi,wn.partition=vi,wn.pick=Dr,wn.pickBy=Nr,wn.property=ts,wn.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},wn.pull=Ho,wn.pullAll=Vo,wn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ll(e,t,Ka(n,2)):e},wn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ll(e,t,void 0,n):e},wn.pullAt=Wo,wn.range=ns,wn.rangeRight=ls,wn.rearg=Ai,wn.reject=function(e,t){return(Ri(e)?ot:ll)(e,Ti(Ka(t,3)))},wn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],o=e.length;for(t=Ka(t,3);++l<o;){var i=e[l];t(i,l,e)&&(n.push(i),a.push(l))}return Rl(e,a),n},wn.rest=function(e,t){if("function"!=typeof e)throw new fe(n);return Fl(e,t=void 0===t?t:lr(t))},wn.reverse=zo,wn.sampleSize=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),(Ri(e)?Un:Bl)(e,t)},wn.set=function(e,t,n){return null==e?e:Ul(e,t,n)},wn.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Ul(e,t,n,l)},wn.shuffle=function(e){return(Ri(e)?Hn:Wl)(e)},wn.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oo(e,t,n)?(t=0,n=l):(t=null==t?0:lr(t),n=void 0===n?l:lr(n)),zl(e,t,n)):[]},wn.sortBy=pi,wn.sortedUniq=function(e){return e&&e.length?Gl(e):[]},wn.sortedUniqBy=function(e,t){return e&&e.length?Gl(e,Ka(t,2)):[]},wn.split=function(e,t,n){return n&&"number"!=typeof n&&oo(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=rr(e))&&("string"==typeof t||null!=t&&!Ki(t))&&!(t=Ql(t))&&Ft(e)?ra(zt(e),0,n):e.split(t,n):[]},wn.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&&ut(a,l),et(e,this,a)})},wn.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},wn.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:lr(t))<0?0:t):[]},wn.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:lr(t)))<0?0:t,l):[]},wn.takeRightWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3),!1,!0):[]},wn.takeWhile=function(e,t){return e&&e.length?Jl(e,Ka(t,3)):[]},wn.tap=function(e,t){return t(e),e},wn.throttle=function(e,t,l){var a=!0,o=!0;if("function"!=typeof e)throw new fe(n);return zi(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),Si(e,t,{leading:a,maxWait:t,trailing:o})},wn.thru=ni,wn.toArray=tr,wn.toPairs=wr,wn.toPairsIn=Ar,wn.toPath=function(e){return Ri(e)?st(e,No):Zi(e)?[e]:Ea(Do(rr(e)))},wn.toPlainObject=ir,wn.transform=function(e,t,n){var l=Ri(e),a=l||ki(e)||$i(e);if(t=Ka(t,4),null==n){var o=e&&e.constructor;n=a?l?new o:[]:zi(e)&&Hi(o)?An(ze(e)):{}}return(a?nt:rl)(e,function(e,l,a){return t(n,e,l,a)}),n},wn.unary=function(e){return fi(e,1)},wn.union=jo,wn.unionBy=qo,wn.unionWith=Yo,wn.uniq=function(e){return e&&e.length?Xl(e):[]},wn.uniqBy=function(e,t){return e&&e.length?Xl(e,Ka(t,2)):[]},wn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xl(e,void 0,t):[]},wn.unset=function(e,t){return null==e||Zl(e,t)},wn.unzip=Go,wn.unzipWith=Ko,wn.update=function(e,t,n){return null==e?e:$l(e,t,aa(n))},wn.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:$l(e,t,aa(n),l)},wn.values=xr,wn.valuesIn=function(e){return null==e?[]:At(e,br(e))},wn.without=Qo,wn.words=Hr,wn.wrap=function(e,t){return Ni(aa(t),e)},wn.xor=Xo,wn.xorBy=Zo,wn.xorWith=$o,wn.zip=Jo,wn.zipObject=function(e,t){return na(e||[],t||[],Wn)},wn.zipObjectDeep=function(e,t){return na(e||[],t||[],Ul)},wn.zipWith=ei,wn.entries=wr,wn.entriesIn=Ar,wn.extend=ur,wn.extendWith=cr,Xr(wn,wn),wn.add=rs,wn.attempt=Vr,wn.camelCase=Or,wn.capitalize=Ir,wn.ceil=ss,wn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),Kn(or(e),t,n)},wn.clone=function(e){return Qn(e,4)},wn.cloneDeep=function(e){return Qn(e,5)},wn.cloneDeepWith=function(e,t){return Qn(e,5,t="function"==typeof t?t:void 0)},wn.cloneWith=function(e,t){return Qn(e,4,t="function"==typeof t?t:void 0)},wn.conformsTo=function(e,t){return null==t||Xn(e,t,Sr(t))},wn.deburr=Lr,wn.defaultTo=function(e,t){return null==e||e!=e?t:e},wn.divide=us,wn.endsWith=function(e,t,n){e=rr(e),t=Ql(t);var l=e.length,a=n=void 0===n?l:Kn(lr(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},wn.eq=xi,wn.escape=function(e){return(e=rr(e))&&F.test(e)?e.replace(M,Mt):e},wn.escapeRegExp=function(e){return(e=rr(e))&&j.test(e)?e.replace(z,"\\$&"):e},wn.every=function(e,t,n){var l=Ri(e)?at:tl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},wn.find=oi,wn.findIndex=Lo,wn.findKey=function(e,t){return pt(e,Ka(t,3),rl)},wn.findLast=ii,wn.findLastIndex=Ro,wn.findLastKey=function(e,t){return pt(e,Ka(t,3),sl)},wn.floor=cs,wn.forEach=ri,wn.forEachRight=si,wn.forIn=function(e,t){return null==e?e:ol(e,Ka(t,3),br)},wn.forInRight=function(e,t){return null==e?e:il(e,Ka(t,3),br)},wn.forOwn=function(e,t){return e&&rl(e,Ka(t,3))},wn.forOwnRight=function(e,t){return e&&sl(e,Ka(t,3))},wn.get=Er,wn.gt=Oi,wn.gte=Ii,wn.has=function(e,t){return null!=e&&to(e,t,pl)},wn.hasIn=fr,wn.head=Po,wn.identity=Yr,wn.includes=function(e,t,n,l){e=Pi(e)?e:xr(e),n=n&&!l?lr(n):0;var a=e.length;return n<0&&(n=an(a+n,0)),Xi(e)?n<=a&&e.indexOf(t,n)>-1:!!a&>(e,t,n)>-1},wn.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:lr(n);return a<0&&(a=an(l+a,0)),gt(e,t,a)},wn.inRange=function(e,t,n){return t=nr(t),void 0===n?(n=t,t=0):n=nr(n),function(e,t,n){return e>=on(t,n)&&e<an(t,n)}(e=or(e),t,n)},wn.invoke=yr,wn.isArguments=Li,wn.isArray=Ri,wn.isArrayBuffer=Mi,wn.isArrayLike=Pi,wn.isArrayLikeObject=Fi,wn.isBoolean=function(e){return!0===e||!1===e||ji(e)&&ml(e)==r},wn.isBuffer=ki,wn.isDate=Bi,wn.isElement=function(e){return ji(e)&&1===e.nodeType&&!Gi(e)},wn.isEmpty=function(e){if(null==e)return!0;if(Pi(e)&&(Ri(e)||"string"==typeof e||"function"==typeof e.splice||ki(e)||$i(e)||Li(e)))return!e.length;var t=eo(e);if(t==m||t==f)return!e.size;if(uo(e))return!Cl(e).length;for(var n in e)if(be.call(e,n))return!1;return!0},wn.isEqual=function(e,t){return yl(e,t)},wn.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?yl(e,t,void 0,n):!!l},wn.isError=Ui,wn.isFinite=function(e){return"number"==typeof e&&tn(e)},wn.isFunction=Hi,wn.isInteger=Vi,wn.isLength=Wi,wn.isMap=qi,wn.isMatch=function(e,t){return e===t||Sl(e,t,Xa(t))},wn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Sl(e,t,Xa(t),n)},wn.isNaN=function(e){return Yi(e)&&e!=+e},wn.isNative=function(e){if(so(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return bl(e)},wn.isNil=function(e){return null==e},wn.isNull=function(e){return null===e},wn.isNumber=Yi,wn.isObject=zi,wn.isObjectLike=ji,wn.isPlainObject=Gi,wn.isRegExp=Ki,wn.isSafeInteger=function(e){return Vi(e)&&e>=-9007199254740991&&e<=9007199254740991},wn.isSet=Qi,wn.isString=Xi,wn.isSymbol=Zi,wn.isTypedArray=$i,wn.isUndefined=function(e){return void 0===e},wn.isWeakMap=function(e){return ji(e)&&eo(e)==y},wn.isWeakSet=function(e){return ji(e)&&"[object WeakSet]"==ml(e)},wn.join=function(e,t){return null==e?"":nn.call(e,t)},wn.kebabCase=Rr,wn.last=Uo,wn.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):ft(e,yt,a,!0)},wn.lowerCase=Mr,wn.lowerFirst=Pr,wn.lt=Ji,wn.lte=er,wn.max=function(e){return e&&e.length?nl(e,Yr,vl):void 0},wn.maxBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),vl):void 0},wn.mean=function(e){return St(e,Yr)},wn.meanBy=function(e,t){return St(e,Ka(t,2))},wn.min=function(e){return e&&e.length?nl(e,Yr,Tl):void 0},wn.minBy=function(e,t){return e&&e.length?nl(e,Ka(t,2),Tl):void 0},wn.stubArray=as,wn.stubFalse=os,wn.stubObject=function(){return{}},wn.stubString=function(){return""},wn.stubTrue=function(){return!0},wn.multiply=ds,wn.nth=function(e,t){return e&&e.length?xl(e,lr(t)):void 0},wn.noConflict=function(){return We._===this&&(We._=Ne),this},wn.noop=Zr,wn.now=Ei,wn.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 Oa($t(a),n)+e+Oa(Zt(a),n)},wn.padEnd=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?e+Oa(t-l,n):e},wn.padStart=function(e,t,n){e=rr(e);var l=(t=lr(t))?Wt(e):0;return t&&l<t?Oa(t-l,n)+e:e},wn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),sn(rr(e).replace(q,""),t||0)},wn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oo(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=nr(e),void 0===t?(t=e,e=0):t=nr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=un();return on(e+a*(t-e+Be("1e-"+((a+"").length-1))),t)}return Ml(e,t)},wn.reduce=function(e,t,n){var l=Ri(e)?ct:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,Jn)},wn.reduceRight=function(e,t,n){var l=Ri(e)?dt:Ct,a=arguments.length<3;return l(e,Ka(t,4),n,a,el)},wn.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:lr(t),Pl(rr(e),t)},wn.replace=function(){var e=arguments,t=rr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},wn.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=a,o=n),e=Hi(o)?o.call(e):o}return e},wn.round=ms,wn.runInContext=e,wn.sample=function(e){return(Ri(e)?Bn:kl)(e)},wn.size=function(e){if(null==e)return 0;if(Pi(e))return Xi(e)?Wt(e):e.length;var t=eo(e);return t==m||t==f?e.size:Cl(e).length},wn.snakeCase=Fr,wn.some=function(e,t,n){var l=Ri(e)?mt:jl;return n&&oo(e,t,n)&&(t=void 0),l(e,Ka(t,3))},wn.sortedIndex=function(e,t){return ql(e,t)},wn.sortedIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2))},wn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=ql(e,t);if(l<n&&xi(e[l],t))return l}return-1},wn.sortedLastIndex=function(e,t){return ql(e,t,!0)},wn.sortedLastIndexBy=function(e,t,n){return Yl(e,t,Ka(n,2),!0)},wn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ql(e,t,!0)-1;if(xi(e[n],t))return n}return-1},wn.startCase=kr,wn.startsWith=function(e,t,n){return e=rr(e),n=null==n?0:Kn(lr(n),0,e.length),t=Ql(t),e.slice(n,n+t.length)==t},wn.subtract=vs,wn.sum=function(e){return e&&e.length?Tt(e,Yr):0},wn.sumBy=function(e,t){return e&&e.length?Tt(e,Ka(t,2)):0},wn.template=function(e,t,n){var l=wn.templateSettings;n&&oo(e,t,n)&&(t=void 0),e=rr(e),t=cr({},t,l,Ba);var a,o,i=cr({},t.imports,l.imports,Ba),r=Sr(i),s=At(i,r),u=0,c=t.interpolate||re,d="__p += '",m=pe((t.escape||re).source+"|"+c.source+"|"+(c===U?J:re).source+"|"+(t.evaluate||re).source+"|$","g"),v="//# sourceURL="+(be.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(m,function(t,n,l,i,r,s){return l||(l=i),d+=e.slice(u,s).replace(se,Pt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(o=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),d+="';\n";var p=be.call(t,"variable")&&t.variable;if(p){if(Z.test(p))throw new ce("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(O,""):d).replace(I,"$1").replace(L,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var E=Vr(function(){return de(r,v+"return "+d).apply(void 0,s)});if(E.source=d,Ui(E))throw E;return E},wn.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=Ka(t));++n<e;)t(n);return a},wn.toFinite=nr,wn.toInteger=lr,wn.toLength=ar,wn.toLower=function(e){return rr(e).toLowerCase()},wn.toNumber=or,wn.toSafeInteger=function(e){return e?Kn(lr(e),-9007199254740991,9007199254740991):0===e?e:0},wn.toString=rr,wn.toUpper=function(e){return rr(e).toUpperCase()},wn.trim=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return Nt(e);if(!e||!(t=Ql(t)))return e;var l=zt(e),a=zt(t);return ra(l,Ot(l,a),It(l,a)+1).join("")},wn.trimEnd=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.slice(0,jt(e)+1);if(!e||!(t=Ql(t)))return e;var l=zt(e);return ra(l,0,It(l,zt(t))+1).join("")},wn.trimStart=function(e,t,n){if((e=rr(e))&&(n||void 0===t))return e.replace(q,"");if(!e||!(t=Ql(t)))return e;var l=zt(e);return ra(l,Ot(l,zt(t))).join("")},wn.truncate=function(e,t){var n=30,l="...";if(zi(t)){var a="separator"in t?t.separator:a;n="length"in t?lr(t.length):n,l="omission"in t?Ql(t.omission):l}var o=(e=rr(e)).length;if(Ft(e)){var i=zt(e);o=i.length}if(n>=o)return e;var r=n-Wt(l);if(r<1)return l;var s=i?ra(i,0,r).join(""):e.slice(0,r);if(void 0===a)return s+l;if(i&&(r+=s.length-r),Ki(a)){if(e.slice(r).search(a)){var u,c=s;for(a.global||(a=pe(a.source,rr(ee.exec(a))+"g")),a.lastIndex=0;u=a.exec(c);)var d=u.index;s=s.slice(0,void 0===d?r:d)}}else if(e.indexOf(Ql(a),r)!=r){var m=s.lastIndexOf(a);m>-1&&(s=s.slice(0,m))}return s+l},wn.unescape=function(e){return(e=rr(e))&&P.test(e)?e.replace(R,qt):e},wn.uniqueId=function(e){var t=++_e;return rr(e)+t},wn.upperCase=Br,wn.upperFirst=Ur,wn.each=ri,wn.eachRight=si,wn.first=Po,Xr(wn,(is={},rl(wn,function(e,t){be.call(wn.prototype,t)||(is[t]=e)}),is),{chain:!1}),wn.VERSION="4.17.21",nt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){wn[e].placeholder=wn}),nt(["drop","take"],function(e,t){In.prototype[e]=function(n){n=void 0===n?1:an(lr(n),0);var l=this.__filtered__&&!t?new In(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},In.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;In.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ka(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),nt(["head","last"],function(e,t){var n="take"+(t?"Right":"");In.prototype[e]=function(){return this[n](1).value()[0]}}),nt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");In.prototype[e]=function(){return this.__filtered__?new In(this):this[n](1)}}),In.prototype.compact=function(){return this.filter(Yr)},In.prototype.find=function(e){return this.filter(e).head()},In.prototype.findLast=function(e){return this.reverse().find(e)},In.prototype.invokeMap=Fl(function(e,t){return"function"==typeof e?new In(this):this.map(function(n){return gl(n,e,t)})}),In.prototype.reject=function(e){return this.filter(Ti(Ka(e)))},In.prototype.slice=function(e,t){e=lr(e);var n=this;return n.__filtered__&&(e>0||t<0)?new In(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)},In.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},In.prototype.toArray=function(){return this.take(4294967295)},rl(In.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=wn[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);a&&(wn.prototype[t]=function(){var t=this.__wrapped__,i=l?[1]:arguments,r=t instanceof In,s=i[0],u=r||Ri(t),c=function(e){var t=a.apply(wn,ut([e],i));return l&&d?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var d=this.__chain__,m=!!this.__actions__.length,v=o&&!d,p=r&&!m;if(!o&&u){t=p?t:new In(this);var E=e.apply(t,i);return E.__actions__.push({func:ni,args:[c],thisArg:void 0}),new On(E,d)}return v&&p?e.apply(this,i):(E=this.thru(c),v?l?E.value()[0]:E.value():E)})}),nt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ge[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);wn.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(Ri(a)?a:[],e)}return this[n](function(n){return t.apply(Ri(n)?n:[],e)})}}),rl(In.prototype,function(e,t){var n=wn[t];if(n){var l=n.name+"";be.call(hn,l)||(hn[l]=[]),hn[l].push({name:t,func:n})}}),hn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],In.prototype.clone=function(){var e=new In(this.__wrapped__);return e.__actions__=Ea(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ea(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ea(this.__views__),e},In.prototype.reverse=function(){if(this.__filtered__){var e=new In(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},In.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ri(e),l=t<0,a=n?e.length:0,o=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var o=n[l],i=o.size;switch(o.type){case"drop":e+=i;break;case"dropRight":t-=i;break;case"take":t=on(t,e+i);break;case"takeRight":e=an(e,t-i)}}return{start:e,end:t}}(0,a,this.__views__),i=o.start,r=o.end,s=r-i,u=l?r:i-1,c=this.__iteratees__,d=c.length,m=0,v=on(s,this.__takeCount__);if(!n||!l&&a==s&&v==s)return ea(e,this.__actions__);var p=[];e:for(;s--&&m<v;){for(var E=-1,f=e[u+=t];++E<d;){var g=c[E],h=g.type,y=(0,g.iteratee)(f);if(2==h)f=y;else if(!y){if(1==h)continue e;break e}}p[m++]=f}return p},wn.prototype.at=li,wn.prototype.chain=function(){return ti(this)},wn.prototype.commit=function(){return new On(this.value(),this.__chain__)},wn.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__++]}},wn.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=Ao(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},wn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof In){var t=e;return this.__actions__.length&&(t=new In(this)),(t=t.reverse()).__actions__.push({func:ni,args:[zo],thisArg:void 0}),new On(t,this.__chain__)}return this.thru(zo)},wn.prototype.toJSON=wn.prototype.valueOf=wn.prototype.value=function(){return ea(this.__wrapped__,this.__actions__)},wn.prototype.first=wn.prototype.head,Et&&(wn.prototype[Et]=function(){return this}),wn}();je?((je.exports=Yt)._=Yt,ze._=Yt):We._=Yt}).call(Et)});function no(e){let n=e.documents,o=e.svgStyles,i=void 0===o?{}:o,r=e.isSendBackFlow,s=void 0!==r&&r,u=e.isHrLine,c=void 0!==u&&u,d=e.titleStyles;const m=a.useTranslation().t,v=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"}},!v&&(null==n?void 0:n.map((e,a)=>{var o,i,r;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:d||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},m(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"}},m(null==n?void 0:n.title)),s?null!=n&&null!==(o=n.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},m(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},m(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,m("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:d||{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"}}),s?(null!==(i=value)&&void 0!==i&&null!==(r=i.documentType)&&void 0!==r&&r.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),c&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),v&&(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"}},m(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"}},m(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+m(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"}},""+m(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,m("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const lo=e=>{var t,a;let o=e.t,i=e.formData,r=e.applicationData,s=e.docs,u=e.bpaActionsDetails;const c=(null==r?void 0:r.status)||"",d=(null==u||null===(t=u.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),v=n.useState((null==i||null===(a=i.documents)||void 0===a?void 0:a.documents)||[]),p=v[0],E=v[1],f=n.useState(null),g=f[0],h=f[1],y=n.useState([]),S=y[0],b=y[1],_=n.useState(!0)[1],C=n.useState(!1),T=C[0],D=C[1],N=n.useState(!1),w=N[0],A=N[1],x=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),O=x.isLoading,I=x.data,L=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),R=L.data;return n.useEffect(()=>{var e,t,n,l;let a=[];var o,i;null!=I&&null!==(e=I.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==I||null===(o=I.BPA)||void 0===o||null===(i=o.DocTypeMapping)||void 0===i?void 0:i.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let u=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==R||null===(t=R["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==s||null===(l=s[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;o===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),u.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(u)),b(u)},[!O,!L.isLoading]),n.useEffect(()=>{let e=0;S.map(t=>{let n=!1;p.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),_("0"!=e&&0!=e||!(p.length>0))},[p,T]),n.useEffect(()=>{A("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[r,u]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==S?void 0:S.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(ao,{key:t,index:t,document:e,t:o,error:g,setError:h,setDocuments:E,documents:p,setCheckRequiredFields:D,applicationStatus:c,actions:d,bpaTaxDocuments:S,checkEnablingDocs:w}))))};function ao(e){var a,o;let i=e.t,r=e.document,s=e.setDocuments,u=e.documents,c=e.index,d=e.bpaTaxDocuments,v=e.checkEnablingDocs;const p=null==u?void 0:u.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(),f=n.useState(p?m({},p,{active:!0,code:null==p?void 0:p.documentType,i18nKey:null==p?void 0:p.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),g=f[0],h=f[1],y=n.useState(null),S=y[0],b=y[1],_=n.useState(()=>(null==p?void 0:p.fileStoreId)||null)[0],C=n.useState([]),T=C[0],D=C[1];return n.useEffect(()=>{null!=g&&g.code&&s(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==g?void 0:g.code));return 0===(null==_?void 0:_.length)||null===_?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==g?void 0:g.code,fileStoreId:_,documentUid:_,fileName:(null==S?void 0:S.name)||"",id:u?null===(t=u.find(e=>e.documentType===(null==g?void 0:g.code)))||void 0===t?void 0:t.id:void 0}]})},[_,g]),n.useEffect(()=>{try{T.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],T.map(e=>{var t,n,l;null!=g&&g.code&&r.newUploadedDocs.push({documentType:null==g?void 0:g.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),d[c]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)))}catch(e){Promise.reject(e)}},[T,g]),n.useEffect(()=>{},[S]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+i(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(no,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),v?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?i(null==r?void 0:r.code)+"* ":""+i(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:i,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:g,optionKey:"i18nKey",select:e=>h(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);0!==Object.keys(n).length&&D(l),function(e){e&&b(e.file)}(l[l.length-1])})(0,e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function oo(e){let n=e.fiReport,o=e.isCitizen,i=void 0!==o&&o;const r=a.useTranslation().t;return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(i?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+r("BPA_FI_REPORT")),n.map((e,a)=>{var o,i,s,u,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)?""+r("BPA_FI_REPORT"):r("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+r("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(o=e.date)||void 0===o?void 0:o.split("-")[2])+"/"+(null===(i=e.date)||void 0===i?void 0:i.split("-")[1])+"/"+(null===(s=e.date)||void 0===s?void 0:s.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+r("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(u=e.questions)||void 0===u?void 0:u.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:""+r(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+r("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(no,{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 io(e){let a=e.t,o=e.document,i=e.setNocDocuments,r=e.setError,s=e.nocDocuments;const u=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],c=Digit.ULBService.getStateId(),d=(n.useState(),n.useState(null)),m=d[0],v=d[1],E=n.useState(()=>(null==u?void 0:u.fileStoreId)||null),f=E[0],g=E[1];return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&i(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==f?void 0:f.length)||null===f?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==f),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:f,documentUid:f,fileName:(null==m?void 0:m.name)||""}]})},[f]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(m){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(m.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=m&&m.type&&!e.test(null==m?void 0:m.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=p(function(){return g(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",m,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?g(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[m]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);!function(e){e&&v(e.file)}(n[n.length-1])})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const ro=e=>{var a;let o=e.t,i=e.noc,r=e.docs,s=e.isNoc,u=e.applicationData,c=e.NOCdata,d=e.bpaActionsDetails;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==u?void 0:u.status)||"",p=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],E=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:s}).data,f=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!s}).data,g=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]).data,h=n.useState([]),y=h[0],S=h[1],b=n.useState([]),_=b[0],C=b[1],T=n.useState(!1),D=T[0],N=T[1],w=Digit.Hooks.useSessionStorage(null==i?void 0:i.nocType,[]),A=w[0],x=w[1],O=n.useState(null),I=O[0],L=O[1],R=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;S(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 o,r,c,d;l=s?null==E||null===(o=E.NOC)||void 0===o||null===(r=o.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==i?void 0:i.applicationType)&&(null==e?void 0:e.nocType)===(null==i?void 0:i.nocType)):null==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==u?void 0:u.status)&&e.RiskType==(null==u?void 0:u.riskType)&&e.ServiceType==(null==u||null===(t=u.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==i?void 0:i.additionalDetails,applicationStatus:null==i?void 0:i.applicationStatus,appNumberLink:null==i?void 0:i.applicationNo,nocNo:null==i?void 0:i.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==y||y.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))},[E,y]),n.useEffect(()=>{N("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[u,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:R?""+o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"):o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),c&&c.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:R?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:R?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(no,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),D&&(null==_?void 0:_.map((e,t)=>l.createElement(io,{key:t,document:e,t:o,error:I,setError:L,setNocDocuments:x,nocDocuments:A,checkEnablingDocs:D}))))},so=e=>{let a=e.permissions,o=e.t;const i=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),r=i[0],s=i[1],u=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]),c=u[0],d=u[1];n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const v=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==r?void 0:r.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:v?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;s(()=>null==r?void 0:r.map((e,t)=>n===t?m({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==c?void 0:c.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{d(()=>null==c?void 0:c.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:v?"96%":"830px",width:v?"96%":"830px"},style:v?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:v?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...c];t.splice(e,1),d([...t])})(n)}))),l.createElement(t.LinkButton,{style:{maxWidth:v?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{d([...c,{label:""}])}}))};function uo(e){let n=e.taxHeadEstimatesCalculation;const o=n.taxHeadEstimates,i=a.useTranslation().t;return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:i("ES_PT_TITLE_TAX_HEADS"),text:i("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:i(e.taxHeadCode),label:i(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:i("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function co(e){let n=e.floors;const o=a.useTranslation().t;return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function mo(e){let n=e.owners,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const i=a.useTranslation().t,r=(null==n?void 0:n.length)||1;let s={marginTop:"19px"},u={position:"relative",padding:"8px"},c={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?s={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",minWidth:"280px"}:Number(r)>1||(s={marginTop:"19px",lineHeight:"19px",minWidth:"280px",width:"100%"},u={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(s=m({},s,{maxWidth:"950px"}),s=m({},s,{maxWidth:"950px"}),c={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},o.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:s,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?i(null==e?void 0:e.title)+" "+(n+1):i(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:u},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:i(e.title),label:""+i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const vo=e=>{var o,i;let r=e.scrutinyDetails,s=e.additionalDetails,u=e.applicationData;(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==u?void 0:u.status))&&window.location.href.includes("bpa");const c=n.useState()[1],d=n.useState()[1],m=n.useState()[1],v=Digit.ULBService.getStateId(),E=n.useState()[1],f=(n.useState(),n.useState([])),g=f[0],h=f[1],y=n.useState()[0],S=(n.useState(""),n.useState(null)[1]),b=n.useState({})[1];n.useState(!1),n.useState(!1),n.useEffect(()=>{!function(){try{S(null);const e=function(){if(y&&null!=y&&y.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==y||null===(t=y.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(y.size>=2e6)S(_("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",y,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?h([...g,{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}]):S(_("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else S(_("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[y]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(g))},[g]),n.useEffect(()=>{var e,t,n,l,a,o,i;if(null!=s&&null!==(e=s.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==s?void 0:s.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==s||null===(n=s.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==s||null===(l=s.lessAdjustmentFeeFiles[(null==s||null===(a=s.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,v).then(e=>b(null==e?void 0:e.data))}c(null==s||null===(t=s.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==s||null===(n=s.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),d(null==s||null===(l=s.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==s||null===(a=s.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),m(null==s||null===(o=s.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==s||null===(i=s.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),E(null==s?void 0:s.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==s?void 0:s.otherFeesDiscription),h(null==s?void 0:s.lessAdjustmentFeeFiles)},[s]);const _=a.useTranslation().t,C=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},_(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?_(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void _("NA");return l.createElement(n.Fragment,null,!(null!=r&&r.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==r||null===(o=r.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+_(""+e.title),text:null!=e&&e.value?C(e)+" "+_(null==e?void 0:e.isUnit):_("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:""+_(""+e.title),text:C(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},_(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},_(null==e?void 0:e.title))),null==r||null===(i=r.permit)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))))))},po=e=>{var o,i,r,s,u;let c=e.edcrDetails,d=e.applicationData;const m=a.useTranslation().t,v=window.Digit.Utils.browser.isMobile(),p=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_DEDUCTION",id:"Deduction"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let n=[],l=0,a=0,o=0;return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,i,r,s,u,c,d,v,p,E,f,g,h,y;const S=Number(null===(t=e.occupancies)||void 0===t||null===(i=t[0])||void 0===i?void 0:i.builtUpArea)||0,b=Number(null===(r=e.occupancies)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.floorArea)||0,_=Number(null===(u=e.occupancies)||void 0===u||null===(c=u[0])||void 0===c?void 0:c.deduction)||0;l+=S,a+=b,o+=_,n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(d=e.occupancies)||void 0===d||null===(v=d[0])||void 0===v?void 0:v.type)),BuildupArea:Number(null===(p=e.occupancies)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.builtUpArea).toFixed(2),Deduction:Number(null===(f=e.occupancies)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.deduction).toFixed(2),FloorArea:Number(null===(h=e.occupancies)||void 0===h||null===(y=h[0])||void 0===y?void 0:y.floorArea).toFixed(2)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n.push({Floor:m("BPA_TOTAL"),Level:"",Occupancy:"",BuildupArea:Number(l).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),Deduction:Number(o).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL"),FloorArea:Number(a).toFixed(2)+" "+m("BPA_SQ_MTRS_LABEL")}),n}function h(e){var t;let n=null==d||null===(t=d.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,o;let t=null===(a=n[e])||void 0===a||null===(o=a.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},null==c||null===(o=c.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""})),null==c||null===(i=c.subOccupancyTableDetails)||void 0===i||null===(r=i[0])||void 0===r||null===(s=r.value)||void 0===s||null===(u=s.planDetail)||void 0===u?void 0:u.blocks.map((e,n)=>{var a,o,i,r,s;return l.createElement("div",{key:n,style:(null==c||null===(a=c.subOccupancyTableDetails)||void 0===a||null===(o=a[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.planDetail)||void 0===r||null===(s=r.blocks)||void 0===s?void 0:s.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:h(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!0,autoSort:!1,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},Eo=e=>{let t=e.otherComment;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,e.headComment),l.createElement("p",null,t))},fo=e=>{var o,i,r;let s=e.data,u=e.OpenImage,c=e.privacy,d=void 0===c?{}:c;const m=n.useState(!1),v=m[0],p=m[1],E=a.useTranslation().t;return l.createElement("div",null,s.date&&l.createElement("p",null,s.date),l.createElement("p",null,s.name),s.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:s.mobileNumber,privacy:d}),l.createElement("p",null," ")),s.source&&l.createElement("p",null,E("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+s.source.toUpperCase())),s.comment&&l.createElement(Eo,{otherComment:null==s?void 0:s.otherComment,headComment:null==s?void 0:s.comment}),null!=s&&s.wfComment?l.createElement("div",null,null==s||null===(o=s.wfComment)||void 0===o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,E("WF_COMMON_COMMENTS")),!v&&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:()=>{p(!0)},style:{color:"#800000"}},E("View More")):null),v&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{p(!1)},style:{color:"#800000"}},E("View Less")))))):null,(null==s||null===(i=s.thumbnailsToShow)||void 0===i||null===(r=i.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,E("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==s?void 0:s.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==s?void 0:s.thumbnailsToShow)}})):null)};function go(e){let n=e.units;const o=a.useTranslation().t;return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function ho(e){let n=e.units;const o=a.useTranslation().t;return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const yo=e=>{var o,i,r,s,u;let c=e.wsAdditionalDetails;const d=a.useTranslation().t;let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let n=t.split("="),l=n[1];return e[n[0]]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var E=(null==c?void 0:c.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]},f=E.connectionDetails,g=E.plumberDetails,h=E.roadCuttingDetails,y=E.roadCuttingAddlDetails,S=E.activationDetails;return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==c||null===(o=c.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==f?void 0:f.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(i=c.additionalDetails)||void 0===i?void 0:i.plumberDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==g?void 0:g.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==c||null===(r=c.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==h?void 0:h.map(e=>{var n;return l.createElement("div",{style:(null==h?void 0:h.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===(s=c.additionalDetails)||void 0===s?void 0:s.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==y?void 0:y.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===(u=c.additionalDetails)||void 0===u?void 0:u.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==S?void 0:S.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:""})))))))},So=[{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"}],bo=[{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"}],_o=e=>{var o,i,r,s;let u=e.wsAdditionalDetails;const c=a.useTranslation().t,d=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),v=d[0],p=d[1],E=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{})[1],f=!(null==u||null===(o=u.additionalDetails)||void 0===o||!o.isPaid),g=n.useState(!1),h=g[0],y=g[1],S=n.useState(v||{}),b=S[0],C=S[1],T=n.useState(null),D=T[0],N=T[1],w=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),A=w[0],x=w[1],O=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),I=O[0],L=O[1],R=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(R,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=m({},null==u||null===(e=u.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==v||null===(n=v.billDetails)||void 0===n?void 0:n.length)>0){var o,i,r,s,c,d,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==v||null===(o=v.billDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==v||null===(r=v.billDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==v||null===(c=v.billDetails)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.taxAmount)}];L(e),x(null==v||null===(E=v.billDetails)||void 0===E?void 0:E[0])}else p(a),C(a)},[]);let M={};const P=e=>l.createElement("h1",{className:"heading-m"},e.label),F=()=>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"})),k=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(F,null)),B=function(e,t,n){void 0===t&&(t=!1);let l=m({},b);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,o;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}C(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},I&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==I?void 0:I.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+c("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==A?void 0:A.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(f?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:f?{color:"#00703C"}:{color:"#D4351C"}}))),null!=u&&null!==(i=u.additionalDetails)&&void 0!==i&&i.isAdhocRebate?l.createElement("div",{onClick:e=>{y(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,h&&l.createElement(t.Modal,{headerBarMain:l.createElement(P,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(k,{onClick:()=>{C(v),y(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{C(v),y(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=b&&b.adhocPenalty?Number(null==b?void 0:b.adhocPenalty):0,n=null!=b&&b.adhocRebate?Number(null==b?void 0:b.adhocRebate):0;var l,a;if(t||n)if(n>(null==u||null===(l=u.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))N({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,i,r,s,d,v,f,g,h,S;const e=null==u||null===(o=u.additionalDetails)||void 0===o||null===(i=o.appDetails)||void 0===i?void 0:i.applicationNo,t=null==u||null===(r=u.additionalDetails)||void 0===r||null===(s=r.appDetails)||void 0===s?void 0:s.tenantId,n=m({},null==u||null===(d=u.additionalDetails)||void 0===d||null===(v=d.appDetails)||void 0===v?void 0:v.additionalDetails,b);u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(f=u.additionalDetails)||void 0===f||null===(g=f.appDetails)||void 0===g?void 0:g.service)?[{applicationNo:e,tenantId:t,waterConnection:u.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:u.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==u||null===(h=u.additionalDetails)||void 0===h||null===(S=h.appDetails)||void 0===S?void 0:S.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,o,i,r,s,u,c,d,m,v,f,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===(f=e.Calculation)||void 0===f||null===(g=f[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===(o=e.Calculation)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.taxHeadEstimates,"category");const S=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(u=e.Calculation)||void 0===u||null===(c=u[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}];E(Aa(e.Calculation[0])),x(null==e||null===(v=e.Calculation)||void 0===v?void 0:v[0]),L(S),b.billDetails=null==e?void 0:e.Calculation,p(b),y(!1)}).catch(e=>{var t,n,l,a,o,i;N({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?c(""+(null==e||null===(a=e.response)||void 0===a||null===(o=a.data)||void 0===o||null===(i=o.Errors[0])||void 0===i?void 0:i.code)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else N({isError:!1,isWarning:!0,key:"warning",message:c("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:So,optionKey:"title",select:e=>B("adhocPenaltyReason",!0,e),selected:(null==b?void 0:b.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==b||null===(r=b.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==b?void 0:b.adhocPenaltyComment)||"",onChange:e=>B("adhocPenaltyComment",!1,e)},M={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==b?void 0:b.adhocPenalty)||"",onChange:e=>B("adhocPenalty",!1,e)},M={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_REBATE")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:bo,optionKey:"title",select:e=>B("adhocRebateReason",!0,e),selected:(null==b?void 0:b.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==b||null===(s=b.adhocRebateReason_data)||void 0===s?void 0:s.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==b?void 0:b.adhocRebateComment)||"",onChange:e=>B("adhocRebateComment",!1,e)},M={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==b?void 0:b.adhocRebate)||"",onChange:e=>B("adhocRebate",!1,e)},M={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("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:c(null==D?void 0:D.message),onClose:()=>{N(!1)},isDleteBtn:!0})))},Co=e=>{var o,i,r,s,u,c,d;let m=e.wsAdditionalDetails;const v=a.useTranslation().t,p=n.useState(!1),E=p[0],f=p[1],g=n.useState({}),h=g[0],y=g[1],S=e=>l.createElement("h1",{className:"heading-m"},e.label),b=()=>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"})),_=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(b,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),y(t),f(!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(S,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(_,{onClick:()=>{f(!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==h||null===(i=h.billSlabData)||void 0===i||null===(r=i.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==h?void 0:h.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==h||null===(s=h.billSlabData)||void 0===s||null===(u=s.CHARGES)||void 0===u?void 0:u.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==h?void 0:h.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==h||null===(c=h.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==h?void 0:h.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},To=e=>{let t=e.assessmentData;const a=n.useState(!1),o=a[0],i=a[1];return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!o)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),l.createElement("span",{style:{fontSize:"1.2em"}},o?"<":">"))),o&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},t.map((e,n)=>l.createElement("div",{key:n,className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),l.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),l.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},l.createElement("div",{style:{display:"flex",gap:"75px"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),l.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}}," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>alert("Re-assessing "+e.number)},"Re-assess")," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("Cancelled "+e.number)},"Cancel")," ")),n!==t.length-1&&l.createElement("hr",null)))))};var Do=function(e){return e&&e.default||e}({__proto__:null,default:{}}),No=gt(function(e,t){var n;e.exports=n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==Et&&Et.crypto&&(n=Et.crypto),!n)try{n=Do}catch(e){}var l=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),o={},i=o.lib={},r=i.Base={extend:function(e){var t=a(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,l=this.sigBytes,a=e.sigBytes;if(this.clamp(),l%4)for(var o=0;o<a;o++)t[l+o>>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(l+o)%4*8;else for(var i=0;i<a;i+=4)t[l+i>>>2]=n[i>>>2];return this.sigBytes+=a,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(l());return new s.init(t,e)}}),u=o.enc={},c=u.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,l=[],a=0;a<n;a++){var o=t[a>>>2]>>>24-a%4*8&255;l.push((o>>>4).toString(16)),l.push((15&o).toString(16))}return l.join("")},parse:function(e){for(var t=e.length,n=[],l=0;l<t;l+=2)n[l>>>3]|=parseInt(e.substr(l,2),16)<<24-l%8*4;return new s.init(n,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,l=[],a=0;a<n;a++)l.push(String.fromCharCode(t[a>>>2]>>>24-a%4*8&255));return l.join("")},parse:function(e){for(var t=e.length,n=[],l=0;l<t;l++)n[l>>>2]|=(255&e.charCodeAt(l))<<24-l%4*8;return new s.init(n,t)}},m=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},v=i.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=m.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,l=this._data,a=l.words,o=l.sigBytes,i=this.blockSize,r=o/(4*i),u=(r=t?e.ceil(r):e.max((0|r)-this._minBufferSize,0))*i,c=e.min(4*u,o);if(u){for(var d=0;d<u;d+=i)this._doProcessBlock(a,d);n=a.splice(0,u),l.sigBytes-=c}return new s.init(n,c)},clone:function(){var e=r.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),p=(i.Hasher=v.extend({cfg:r.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new p.HMAC.init(e,n).finalize(t)}}}),o.algo={});return o}(Math)});gt(function(e,t){var n,l,a,o,i;e.exports=(l=(n=(i=No).lib).Base,a=n.WordArray,(o=i.x64={}).Word=l.extend({init:function(e,t){this.high=e,this.low=t}}),o.WordArray=l.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],l=0;l<t;l++){var o=e[l];n.push(o.high),n.push(o.low)}return a.create(n,this.sigBytes)},clone:function(){for(var e=l.clone.call(this),t=e.words=this.words.slice(0),n=t.length,a=0;a<n;a++)t[a]=t[a].clone();return e}}),i)}),gt(function(e,t){var n;e.exports=(n=No,function(){if("function"==typeof ArrayBuffer){var e=n.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,l=[],a=0;a<n;a++)l[a>>>2]|=e[a]<<24-a%4*8;t.call(this,l,n)}else t.apply(this,arguments)}).prototype=e}}(),n.lib.WordArray)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n.lib.WordArray,t=n.enc;function l(e){return e<<8&4278255360|e>>>8&16711935}t.Utf16=t.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,l=[],a=0;a<n;a+=2)l.push(String.fromCharCode(t[a>>>2]>>>16-a%4*8&65535));return l.join("")},parse:function(t){for(var n=t.length,l=[],a=0;a<n;a++)l[a>>>1]|=t.charCodeAt(a)<<16-a%2*16;return e.create(l,2*n)}},t.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,a=[],o=0;o<n;o+=2){var i=l(t[o>>>2]>>>16-o%4*8&65535);a.push(String.fromCharCode(i))}return a.join("")},parse:function(t){for(var n=t.length,a=[],o=0;o<n;o++)a[o>>>1]|=l(t.charCodeAt(o)<<16-o%2*16);return e.create(a,2*n)}}}(),n.enc.Utf16)}),gt(function(e,t){var n,l;e.exports=(n=(l=No).lib.WordArray,l.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,l=this._map;e.clamp();for(var a=[],o=0;o<n;o+=3)for(var i=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,r=0;r<4&&o+.75*r<n;r++)a.push(l.charAt(i>>>6*(3-r)&63));var s=l.charAt(64);if(s)for(;a.length%4;)a.push(s);return a.join("")},parse:function(e){var t=e.length,l=this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var o=0;o<l.length;o++)a[l.charCodeAt(o)]=o}var i=l.charAt(64);if(i){var r=e.indexOf(i);-1!==r&&(t=r)}return function(e,t,l){for(var a=[],o=0,i=0;i<t;i++)if(i%4){var r=l[e.charCodeAt(i-1)]<<i%4*2,s=l[e.charCodeAt(i)]>>>6-i%4*2;a[o>>>2]|=(r|s)<<24-o%4*8,o++}return n.create(a,o)}(e,t,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},l.enc.Base64)}),gt(function(e,t){var n,l;e.exports=(n=(l=No).lib.WordArray,l.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var n=e.words,l=e.sigBytes,a=t?this._safe_map:this._map;e.clamp();for(var o=[],i=0;i<l;i+=3)for(var r=(n[i>>>2]>>>24-i%4*8&255)<<16|(n[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|n[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s<l;s++)o.push(a.charAt(r>>>6*(3-s)&63));var u=a.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var l=e.length,a=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<a.length;i++)o[a.charCodeAt(i)]=i}var r=a.charAt(64);if(r){var s=e.indexOf(r);-1!==s&&(l=s)}return function(e,t,l){for(var a=[],o=0,i=0;i<t;i++)if(i%4){var r=l[e.charCodeAt(i-1)]<<i%4*2,s=l[e.charCodeAt(i)]>>>6-i%4*2;a[o>>>2]|=(r|s)<<24-o%4*8,o++}return n.create(a,o)}(e,l,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},l.enc.Base64url)}),gt(function(e,t){var n;e.exports=(n=No,function(e){var t=n,l=t.lib,a=l.WordArray,o=l.Hasher,i=t.algo,r=[];!function(){for(var t=0;t<64;t++)r[t]=4294967296*e.abs(e.sin(t+1))|0}();var s=i.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var l=t+n,a=e[l];e[l]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var o=this._hash.words,i=e[t+0],s=e[t+1],v=e[t+2],p=e[t+3],E=e[t+4],f=e[t+5],g=e[t+6],h=e[t+7],y=e[t+8],S=e[t+9],b=e[t+10],_=e[t+11],C=e[t+12],T=e[t+13],D=e[t+14],N=e[t+15],w=o[0],A=o[1],x=o[2],O=o[3];w=u(w,A,x,O,i,7,r[0]),O=u(O,w,A,x,s,12,r[1]),x=u(x,O,w,A,v,17,r[2]),A=u(A,x,O,w,p,22,r[3]),w=u(w,A,x,O,E,7,r[4]),O=u(O,w,A,x,f,12,r[5]),x=u(x,O,w,A,g,17,r[6]),A=u(A,x,O,w,h,22,r[7]),w=u(w,A,x,O,y,7,r[8]),O=u(O,w,A,x,S,12,r[9]),x=u(x,O,w,A,b,17,r[10]),A=u(A,x,O,w,_,22,r[11]),w=u(w,A,x,O,C,7,r[12]),O=u(O,w,A,x,T,12,r[13]),x=u(x,O,w,A,D,17,r[14]),w=c(w,A=u(A,x,O,w,N,22,r[15]),x,O,s,5,r[16]),O=c(O,w,A,x,g,9,r[17]),x=c(x,O,w,A,_,14,r[18]),A=c(A,x,O,w,i,20,r[19]),w=c(w,A,x,O,f,5,r[20]),O=c(O,w,A,x,b,9,r[21]),x=c(x,O,w,A,N,14,r[22]),A=c(A,x,O,w,E,20,r[23]),w=c(w,A,x,O,S,5,r[24]),O=c(O,w,A,x,D,9,r[25]),x=c(x,O,w,A,p,14,r[26]),A=c(A,x,O,w,y,20,r[27]),w=c(w,A,x,O,T,5,r[28]),O=c(O,w,A,x,v,9,r[29]),x=c(x,O,w,A,h,14,r[30]),w=d(w,A=c(A,x,O,w,C,20,r[31]),x,O,f,4,r[32]),O=d(O,w,A,x,y,11,r[33]),x=d(x,O,w,A,_,16,r[34]),A=d(A,x,O,w,D,23,r[35]),w=d(w,A,x,O,s,4,r[36]),O=d(O,w,A,x,E,11,r[37]),x=d(x,O,w,A,h,16,r[38]),A=d(A,x,O,w,b,23,r[39]),w=d(w,A,x,O,T,4,r[40]),O=d(O,w,A,x,i,11,r[41]),x=d(x,O,w,A,p,16,r[42]),A=d(A,x,O,w,g,23,r[43]),w=d(w,A,x,O,S,4,r[44]),O=d(O,w,A,x,C,11,r[45]),x=d(x,O,w,A,N,16,r[46]),w=m(w,A=d(A,x,O,w,v,23,r[47]),x,O,i,6,r[48]),O=m(O,w,A,x,h,10,r[49]),x=m(x,O,w,A,D,15,r[50]),A=m(A,x,O,w,f,21,r[51]),w=m(w,A,x,O,C,6,r[52]),O=m(O,w,A,x,p,10,r[53]),x=m(x,O,w,A,b,15,r[54]),A=m(A,x,O,w,s,21,r[55]),w=m(w,A,x,O,y,6,r[56]),O=m(O,w,A,x,N,10,r[57]),x=m(x,O,w,A,g,15,r[58]),A=m(A,x,O,w,T,21,r[59]),w=m(w,A,x,O,E,6,r[60]),O=m(O,w,A,x,_,10,r[61]),x=m(x,O,w,A,v,15,r[62]),A=m(A,x,O,w,S,21,r[63]),o[0]=o[0]+w|0,o[1]=o[1]+A|0,o[2]=o[2]+x|0,o[3]=o[3]+O|0},_doFinalize:function(){var t=this._data,n=t.words,l=8*this._nDataBytes,a=8*t.sigBytes;n[a>>>5]|=128<<24-a%32;var o=e.floor(l/4294967296),i=l;n[15+(a+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(a+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var r=this._hash,s=r.words,u=0;u<4;u++){var c=s[u];s[u]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,l,a,o,i){var r=e+(t&n|~t&l)+a+i;return(r<<o|r>>>32-o)+t}function c(e,t,n,l,a,o,i){var r=e+(t&l|n&~l)+a+i;return(r<<o|r>>>32-o)+t}function d(e,t,n,l,a,o,i){var r=e+(t^n^l)+a+i;return(r<<o|r>>>32-o)+t}function m(e,t,n,l,a,o,i){var r=e+(n^(t|~l))+a+i;return(r<<o|r>>>32-o)+t}t.MD5=o._createHelper(s),t.HmacMD5=o._createHmacHelper(s)}(Math),n.MD5)}),gt(function(e,t){var n,l,a,o,i,r,s;e.exports=(a=(l=(n=s=No).lib).WordArray,i=[],r=n.algo.SHA1=(o=l.Hasher).extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,l=n[0],a=n[1],o=n[2],r=n[3],s=n[4],u=0;u<80;u++){if(u<16)i[u]=0|e[t+u];else{var c=i[u-3]^i[u-8]^i[u-14]^i[u-16];i[u]=c<<1|c>>>31}var d=(l<<5|l>>>27)+s+i[u];d+=u<20?1518500249+(a&o|~a&r):u<40?1859775393+(a^o^r):u<60?(a&o|a&r|o&r)-1894007588:(a^o^r)-899497514,s=r,r=o,o=a<<30|a>>>2,a=l,l=d}n[0]=n[0]+l|0,n[1]=n[1]+a|0,n[2]=n[2]+o|0,n[3]=n[3]+r|0,n[4]=n[4]+s|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,l=8*e.sigBytes;return t[l>>>5]|=128<<24-l%32,t[14+(l+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(l+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=o._createHelper(r),n.HmacSHA1=o._createHmacHelper(r),s.SHA1)}),gt(function(e,t){var n;e.exports=(n=No,function(e){var t=n,l=t.lib,a=l.WordArray,o=l.Hasher,i=t.algo,r=[],s=[];!function(){function t(t){for(var n=e.sqrt(t),l=2;l<=n;l++)if(!(t%l))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var l=2,a=0;a<64;)t(l)&&(a<8&&(r[a]=n(e.pow(l,.5))),s[a]=n(e.pow(l,1/3)),a++),l++}();var u=[],c=i.SHA256=o.extend({_doReset:function(){this._hash=new a.init(r.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,l=n[0],a=n[1],o=n[2],i=n[3],r=n[4],c=n[5],d=n[6],m=n[7],v=0;v<64;v++){if(v<16)u[v]=0|e[t+v];else{var p=u[v-15],E=u[v-2];u[v]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+u[v-7]+((E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10)+u[v-16]}var f=l&a^l&o^a&o,g=m+((r<<26|r>>>6)^(r<<21|r>>>11)^(r<<7|r>>>25))+(r&c^~r&d)+s[v]+u[v];m=d,d=c,c=r,r=i+g|0,i=o,o=a,a=l,l=g+(((l<<30|l>>>2)^(l<<19|l>>>13)^(l<<10|l>>>22))+f)|0}n[0]=n[0]+l|0,n[1]=n[1]+a|0,n[2]=n[2]+o|0,n[3]=n[3]+i|0,n[4]=n[4]+r|0,n[5]=n[5]+c|0,n[6]=n[6]+d|0,n[7]=n[7]+m|0},_doFinalize:function(){var t=this._data,n=t.words,l=8*this._nDataBytes,a=8*t.sigBytes;return n[a>>>5]|=128<<24-a%32,n[14+(a+64>>>9<<4)]=e.floor(l/4294967296),n[15+(a+64>>>9<<4)]=l,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(c),t.HmacSHA256=o._createHmacHelper(c)}(Math),n.SHA256)}),gt(function(e,t){var n,l,a,o,i,r;e.exports=(l=(n=r=No).lib.WordArray,i=(a=n.algo).SHA224=(o=a.SHA256).extend({_doReset:function(){this._hash=new l.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),n.SHA224=o._createHelper(i),n.HmacSHA224=o._createHmacHelper(i),r.SHA224)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n,t=e.lib.Hasher,l=e.x64,a=l.Word,o=l.WordArray,i=e.algo;function r(){return a.create.apply(a,arguments)}var s=[r(1116352408,3609767458),r(1899447441,602891725),r(3049323471,3964484399),r(3921009573,2173295548),r(961987163,4081628472),r(1508970993,3053834265),r(2453635748,2937671579),r(2870763221,3664609560),r(3624381080,2734883394),r(310598401,1164996542),r(607225278,1323610764),r(1426881987,3590304994),r(1925078388,4068182383),r(2162078206,991336113),r(2614888103,633803317),r(3248222580,3479774868),r(3835390401,2666613458),r(4022224774,944711139),r(264347078,2341262773),r(604807628,2007800933),r(770255983,1495990901),r(1249150122,1856431235),r(1555081692,3175218132),r(1996064986,2198950837),r(2554220882,3999719339),r(2821834349,766784016),r(2952996808,2566594879),r(3210313671,3203337956),r(3336571891,1034457026),r(3584528711,2466948901),r(113926993,3758326383),r(338241895,168717936),r(666307205,1188179964),r(773529912,1546045734),r(1294757372,1522805485),r(1396182291,2643833823),r(1695183700,2343527390),r(1986661051,1014477480),r(2177026350,1206759142),r(2456956037,344077627),r(2730485921,1290863460),r(2820302411,3158454273),r(3259730800,3505952657),r(3345764771,106217008),r(3516065817,3606008344),r(3600352804,1432725776),r(4094571909,1467031594),r(275423344,851169720),r(430227734,3100823752),r(506948616,1363258195),r(659060556,3750685593),r(883997877,3785050280),r(958139571,3318307427),r(1322822218,3812723403),r(1537002063,2003034995),r(1747873779,3602036899),r(1955562222,1575990012),r(2024104815,1125592928),r(2227730452,2716904306),r(2361852424,442776044),r(2428436474,593698344),r(2756734187,3733110249),r(3204031479,2999351573),r(3329325298,3815920427),r(3391569614,3928383900),r(3515267271,566280711),r(3940187606,3454069534),r(4118630271,4000239992),r(116418474,1914138554),r(174292421,2731055270),r(289380356,3203993006),r(460393269,320620315),r(685471733,587496836),r(852142971,1086792851),r(1017036298,365543100),r(1126000580,2618297676),r(1288033470,3409855158),r(1501505948,4234509866),r(1607167915,987167468),r(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=r()}();var c=i.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,l=n[0],a=n[1],o=n[2],i=n[3],r=n[4],c=n[5],d=n[6],m=n[7],v=l.high,p=l.low,E=a.high,f=a.low,g=o.high,h=o.low,y=i.high,S=i.low,b=r.high,_=r.low,C=c.high,T=c.low,D=d.high,N=d.low,w=m.high,A=m.low,x=v,O=p,I=E,L=f,R=g,M=h,P=y,F=S,k=b,B=_,U=C,H=T,V=D,W=N,z=w,j=A,q=0;q<80;q++){var Y,G,K=u[q];if(q<16)G=K.high=0|e[t+2*q],Y=K.low=0|e[t+2*q+1];else{var Q=u[q-15],X=Q.high,Z=Q.low,$=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),J=u[q-2],ee=J.high,te=J.low,ne=(te>>>19|ee<<13)^(te<<3|ee>>>29)^(te>>>6|ee<<26),le=u[q-7],ae=u[q-16],oe=ae.low;K.high=G=(G=(G=((X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7)+le.high+((Y=$+le.low)>>>0<$>>>0?1:0))+((ee>>>19|te<<13)^(ee<<3|te>>>29)^ee>>>6)+((Y+=ne)>>>0<ne>>>0?1:0))+ae.high+((Y+=oe)>>>0<oe>>>0?1:0),K.low=Y}var ie,re=k&U^~k&V,se=B&H^~B&W,ue=x&I^x&R^I&R,ce=(O>>>28|x<<4)^(O<<30|x>>>2)^(O<<25|x>>>7),de=s[q],me=de.low,ve=z+((k>>>14|B<<18)^(k>>>18|B<<14)^(k<<23|B>>>9))+((ie=j+((B>>>14|k<<18)^(B>>>18|k<<14)^(B<<23|k>>>9)))>>>0<j>>>0?1:0),pe=ce+(O&L^O&M^L&M);z=V,j=W,V=U,W=H,U=k,H=B,k=P+(ve=(ve=(ve=ve+re+((ie+=se)>>>0<se>>>0?1:0))+de.high+((ie+=me)>>>0<me>>>0?1:0))+G+((ie+=Y)>>>0<Y>>>0?1:0))+((B=F+ie|0)>>>0<F>>>0?1:0)|0,P=R,F=M,R=I,M=L,I=x,L=O,x=ve+(((x>>>28|O<<4)^(x<<30|O>>>2)^(x<<25|O>>>7))+ue+(pe>>>0<ce>>>0?1:0))+((O=ie+pe|0)>>>0<ie>>>0?1:0)|0}p=l.low=p+O,l.high=v+x+(p>>>0<O>>>0?1:0),f=a.low=f+L,a.high=E+I+(f>>>0<L>>>0?1:0),h=o.low=h+M,o.high=g+R+(h>>>0<M>>>0?1:0),S=i.low=S+F,i.high=y+P+(S>>>0<F>>>0?1:0),_=r.low=_+B,r.high=b+k+(_>>>0<B>>>0?1:0),T=c.low=T+H,c.high=C+U+(T>>>0<H>>>0?1:0),N=d.low=N+W,d.high=D+V+(N>>>0<W>>>0?1:0),A=m.low=A+j,m.high=w+z+(A>>>0<j>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,l=8*e.sigBytes;return t[l>>>5]|=128<<24-l%32,t[30+(l+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(l+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),n.SHA512)}),gt(function(e,t){var n,l,a,o,i,r,s,u;e.exports=(a=(l=(n=u=No).x64).Word,o=l.WordArray,s=(i=n.algo).SHA384=(r=i.SHA512).extend({_doReset:function(){this._hash=new o.init([new a.init(3418070365,3238371032),new a.init(1654270250,914150663),new a.init(2438529370,812702999),new a.init(355462360,4144912697),new a.init(1731405415,4290775857),new a.init(2394180231,1750603025),new a.init(3675008525,1694076839),new a.init(1203062813,3204075428)])},_doFinalize:function(){var e=r._doFinalize.call(this);return e.sigBytes-=16,e}}),n.SHA384=r._createHelper(s),n.HmacSHA384=r._createHmacHelper(s),u.SHA384)}),gt(function(e,t){var n;e.exports=(n=No,function(e){var t=n,l=t.lib,a=l.WordArray,o=l.Hasher,i=t.x64.Word,r=t.algo,s=[],u=[],c=[];!function(){for(var e=1,t=0,n=0;n<24;n++){s[e+5*t]=(n+1)*(n+2)/2%64;var l=(2*e+3*t)%5;e=t%5,t=l}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var a=1,o=0;o<24;o++){for(var r=0,d=0,m=0;m<7;m++){if(1&a){var v=(1<<m)-1;v<32?d^=1<<v:r^=1<<v-32}128&a?a=a<<1^113:a<<=1}c[o]=i.create(r,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=i.create()}();var m=r.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new i.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var n=this._state,l=this.blockSize/2,a=0;a<l;a++){var o=e[t+2*a],i=e[t+2*a+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(I=n[a]).high^=i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),I.low^=o}for(var r=0;r<24;r++){for(var m=0;m<5;m++){for(var v=0,p=0,E=0;E<5;E++)v^=(I=n[m+5*E]).high,p^=I.low;var f=d[m];f.high=v,f.low=p}for(m=0;m<5;m++){var g=d[(m+4)%5],h=d[(m+1)%5],y=h.high,S=h.low;for(v=g.high^(y<<1|S>>>31),p=g.low^(S<<1|y>>>31),E=0;E<5;E++)(I=n[m+5*E]).high^=v,I.low^=p}for(var b=1;b<25;b++){var _=(I=n[b]).high,C=I.low,T=s[b];T<32?(v=_<<T|C>>>32-T,p=C<<T|_>>>32-T):(v=C<<T-32|_>>>64-T,p=_<<T-32|C>>>64-T);var D=d[u[b]];D.high=v,D.low=p}var N=d[0],w=n[0];for(N.high=w.high,N.low=w.low,m=0;m<5;m++)for(E=0;E<5;E++){var A=d[b=m+5*E],x=d[(m+1)%5+5*E],O=d[(m+2)%5+5*E];(I=n[b]).high=A.high^~x.high&O.high,I.low=A.low^~x.low&O.low}var I,L=c[r];(I=n[0]).high^=L.high,I.low^=L.low}},_doFinalize:function(){var t=this._data,n=t.words,l=8*t.sigBytes,o=32*this.blockSize;n[l>>>5]|=1<<24-l%32,n[(e.ceil((l+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var i=this._state,r=this.cfg.outputLength/8,s=r/8,u=[],c=0;c<s;c++){var d=i[c],m=d.high,v=d.low;m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),u.push(v=16711935&(v<<8|v>>>24)|4278255360&(v<<24|v>>>8)),u.push(m)}return new a.init(u,r)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});t.SHA3=o._createHelper(m),t.HmacSHA3=o._createHmacHelper(m)}(Math),n.SHA3)}),gt(function(e,t){var n;e.exports=(n=No,function(e){var t=n,l=t.lib,a=l.WordArray,o=l.Hasher,i=t.algo,r=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=a.create([0,1518500249,1859775393,2400959708,2840853838]),m=a.create([1352829926,1548603684,1836072691,2053994217,0]),v=i.RIPEMD160=o.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var l=t+n,a=e[l];e[l]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var o,i,v,S,b,_,C,T,D,N,w,A=this._hash.words,x=d.words,O=m.words,I=r.words,L=s.words,R=u.words,M=c.words;for(_=o=A[0],C=i=A[1],T=v=A[2],D=S=A[3],N=b=A[4],n=0;n<80;n+=1)w=o+e[t+I[n]]|0,w+=n<16?p(i,v,S)+x[0]:n<32?E(i,v,S)+x[1]:n<48?f(i,v,S)+x[2]:n<64?g(i,v,S)+x[3]:h(i,v,S)+x[4],w=(w=y(w|=0,R[n]))+b|0,o=b,b=S,S=y(v,10),v=i,i=w,w=_+e[t+L[n]]|0,w+=n<16?h(C,T,D)+O[0]:n<32?g(C,T,D)+O[1]:n<48?f(C,T,D)+O[2]:n<64?E(C,T,D)+O[3]:p(C,T,D)+O[4],w=(w=y(w|=0,M[n]))+N|0,_=N,N=D,D=y(T,10),T=C,C=w;w=A[1]+v+D|0,A[1]=A[2]+S+N|0,A[2]=A[3]+b+_|0,A[3]=A[4]+o+C|0,A[4]=A[0]+i+T|0,A[0]=w},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,l=8*e.sigBytes;t[l>>>5]|=128<<24-l%32,t[14+(l+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var a=this._hash,o=a.words,i=0;i<5;i++){var r=o[i];o[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function E(e,t,n){return e&t|~e&n}function f(e,t,n){return(e|~t)^n}function g(e,t,n){return e&n|t&~n}function h(e,t,n){return e^(t|~n)}function y(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(v),t.HmacRIPEMD160=o._createHmacHelper(v)}(),n.RIPEMD160)}),gt(function(e,t){var n,l;e.exports=(l=(n=No).enc.Utf8,void(n.algo.HMAC=n.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=l.parse(t));var n=e.blockSize,a=4*n;t.sigBytes>a&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),r=o.words,s=i.words,u=0;u<n;u++)r[u]^=1549556828,s[u]^=909522486;o.sigBytes=i.sigBytes=a,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))}),gt(function(e,t){var n,l,a,o,i,r,s,u;e.exports=(o=(l=(n=u=No).lib).WordArray,r=(i=n.algo).HMAC,s=i.PBKDF2=(a=l.Base).extend({cfg:a.extend({keySize:4,hasher:i.SHA256,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,l=r.create(n.hasher,e),a=o.create(),i=o.create([1]),s=a.words,u=i.words,c=n.keySize,d=n.iterations;s.length<c;){var m=l.update(t).finalize(i);l.reset();for(var v=m.words,p=v.length,E=m,f=1;f<d;f++){E=l.finalize(E),l.reset();for(var g=E.words,h=0;h<p;h++)v[h]^=g[h]}a.concat(m),u[0]++}return a.sigBytes=4*c,a}}),n.PBKDF2=function(e,t,n){return s.create(n).compute(e,t)},u.PBKDF2)}),gt(function(e,t){var n,l,a,o,i,r,s;e.exports=(o=(l=(n=s=No).lib).WordArray,r=(i=n.algo).EvpKDF=(a=l.Base).extend({cfg:a.extend({keySize:4,hasher:i.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,l=this.cfg,a=l.hasher.create(),i=o.create(),r=i.words,s=l.keySize,u=l.iterations;r.length<s;){n&&a.update(n),n=a.update(e).finalize(t),a.reset();for(var c=1;c<u;c++)n=a.finalize(n),a.reset();i.concat(n)}return i.sigBytes=4*s,i}}),n.EvpKDF=function(e,t,n){return r.create(n).compute(e,t)},s.EvpKDF)}),gt(function(e,t){var n,l,a,o,i,r,s,u,c,d,m,v,p,E,f,g,h,y;e.exports=void((n=No).lib.Cipher||(l=n,a=l.lib,o=a.Base,i=a.WordArray,r=a.BufferedBlockAlgorithm,s=l.enc.Base64,u=l.algo.EvpKDF,c=a.Cipher=r.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){r.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?y:g}return function(t){return{encrypt:function(n,l,a){return e(l).encrypt(t,n,l,a)},decrypt:function(n,l,a){return e(l).decrypt(t,n,l,a)}}}}()}),a.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),d=l.mode={},m=a.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),v=d.CBC=function(){var e=m.extend();function t(e,t,n){var l,a=this._iv;a?(l=a,this._iv=void 0):l=this._prevBlock;for(var o=0;o<n;o++)e[t+o]^=l[o]}return e.Encryptor=e.extend({processBlock:function(e,n){var l=this._cipher,a=l.blockSize;t.call(this,e,n,a),l.encryptBlock(e,n),this._prevBlock=e.slice(n,n+a)}}),e.Decryptor=e.extend({processBlock:function(e,n){var l=this._cipher,a=l.blockSize,o=e.slice(n,n+a);l.decryptBlock(e,n),t.call(this,e,n,a),this._prevBlock=o}}),e}(),p=(l.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,l=n-e.sigBytes%n,a=l<<24|l<<16|l<<8|l,o=[],r=0;r<l;r+=4)o.push(a);var s=i.create(o,l);e.concat(s)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},a.BlockCipher=c.extend({cfg:c.cfg.extend({mode:v,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,n=t.iv,l=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=l.createEncryptor:(e=l.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(l,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),E=a.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),f=(l.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?i.create([1398893684,1701076831]).concat(n).concat(t):t).toString(s)},parse:function(e){var t,n=s.parse(e),l=n.words;return 1398893684==l[0]&&1701076831==l[1]&&(t=i.create(l.slice(2,4)),l.splice(0,4),n.sigBytes-=16),E.create({ciphertext:n,salt:t})}},g=a.SerializableCipher=o.extend({cfg:o.extend({format:f}),encrypt:function(e,t,n,l){l=this.cfg.extend(l);var a=e.createEncryptor(n,l),o=a.finalize(t),i=a.cfg;return E.create({ciphertext:o,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:l.format})},decrypt:function(e,t,n,l){return l=this.cfg.extend(l),t=this._parse(t,l.format),e.createDecryptor(n,l).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),h=(l.kdf={}).OpenSSL={execute:function(e,t,n,l,a){if(l||(l=i.random(8)),a)o=u.create({keySize:t+n,hasher:a}).compute(e,l);else var o=u.create({keySize:t+n}).compute(e,l);var r=i.create(o.words.slice(t),4*n);return o.sigBytes=4*t,E.create({key:o,iv:r,salt:l})}},y=a.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:h}),encrypt:function(e,t,n,l){var a=(l=this.cfg.extend(l)).kdf.execute(n,e.keySize,e.ivSize,l.salt,l.hasher);l.iv=a.iv;var o=g.encrypt.call(this,e,t,a.key,l);return o.mixIn(a),o},decrypt:function(e,t,n,l){l=this.cfg.extend(l),t=this._parse(t,l.format);var a=l.kdf.execute(n,e.keySize,e.ivSize,t.salt,l.hasher);return l.iv=a.iv,g.decrypt.call(this,e,t,a.key,l)}})))}),gt(function(e,t){var n;e.exports=((n=No).mode.CFB=function(){var e=n.lib.BlockCipherMode.extend();function t(e,t,n,l){var a,o=this._iv;o?(a=o.slice(0),this._iv=void 0):a=this._prevBlock,l.encryptBlock(a,0);for(var i=0;i<n;i++)e[t+i]^=a[i]}return e.Encryptor=e.extend({processBlock:function(e,n){var l=this._cipher,a=l.blockSize;t.call(this,e,n,a,l),this._prevBlock=e.slice(n,n+a)}}),e.Decryptor=e.extend({processBlock:function(e,n){var l=this._cipher,a=l.blockSize,o=e.slice(n,n+a);t.call(this,e,n,a,l),this._prevBlock=o}}),e}(),n.mode.CFB)}),gt(function(e,t){var n,l,a;e.exports=((a=No).mode.CTR=(l=(n=a.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){var n=this._cipher,l=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0);var i=o.slice(0);n.encryptBlock(i,0),o[l-1]=o[l-1]+1|0;for(var r=0;r<l;r++)e[t+r]^=i[r]}}),n.Decryptor=l,n),a.mode.CTR)}),gt(function(e,t){var n;e.exports=((n=No).mode.CTRGladman=function(){var e=n.lib.BlockCipherMode.extend();function t(e){if(255==(e>>24&255)){var t=e>>16&255,n=e>>8&255,l=255&e;255===t?(t=0,255===n?(n=0,255===l?l=0:++l):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=l}else e+=1<<24;return e}var l=e.Encryptor=e.extend({processBlock:function(e,n){var l=this._cipher,a=l.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0),function(e){0===(e[0]=t(e[0]))&&(e[1]=t(e[1]))}(i);var r=i.slice(0);l.encryptBlock(r,0);for(var s=0;s<a;s++)e[n+s]^=r[s]}});return e.Decryptor=l,e}(),n.mode.CTRGladman)}),gt(function(e,t){var n,l,a;e.exports=((a=No).mode.OFB=(l=(n=a.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){var n=this._cipher,l=n.blockSize,a=this._iv,o=this._keystream;a&&(o=this._keystream=a.slice(0),this._iv=void 0),n.encryptBlock(o,0);for(var i=0;i<l;i++)e[t+i]^=o[i]}}),n.Decryptor=l,n),a.mode.OFB)}),gt(function(e,t){var n,l;e.exports=((l=No).mode.ECB=((n=l.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),n.Decryptor=n.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),n),l.mode.ECB)}),gt(function(e,t){var n;e.exports=((n=No).pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,l=4*t,a=l-n%l,o=n+a-1;e.clamp(),e.words[o>>>2]|=a<<24-o%4*8,e.sigBytes+=a},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},n.pad.Ansix923)}),gt(function(e,t){var n;e.exports=((n=No).pad.Iso10126={pad:function(e,t){var l=4*t,a=l-e.sigBytes%l;e.concat(n.lib.WordArray.random(a-1)).concat(n.lib.WordArray.create([a<<24],1))},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},n.pad.Iso10126)}),gt(function(e,t){var n;e.exports=((n=No).pad.Iso97971={pad:function(e,t){e.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(e,t)},unpad:function(e){n.pad.ZeroPadding.unpad(e),e.sigBytes--}},n.pad.Iso97971)}),gt(function(e,t){var n;e.exports=((n=No).pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},n.pad.ZeroPadding)}),gt(function(e,t){var n;e.exports=((n=No).pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding)}),gt(function(e,t){var n,l,a;e.exports=(n=(a=No).lib.CipherParams,l=a.enc.Hex,a.format.Hex={stringify:function(e){return e.ciphertext.toString(l)},parse:function(e){var t=l.parse(e);return n.create({ciphertext:t})}},a.format.Hex)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n,t=e.lib.BlockCipher,l=e.algo,a=[],o=[],i=[],r=[],s=[],u=[],c=[],d=[],m=[],v=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,l=0;for(t=0;t<256;t++){var p=l^l<<1^l<<2^l<<3^l<<4;a[n]=p=p>>>8^255&p^99,o[p]=n;var E,f=e[n],g=e[f],h=e[g];i[n]=(E=257*e[p]^16843008*p)<<24|E>>>8,r[n]=E<<16|E>>>16,s[n]=E<<8|E>>>24,u[n]=E,c[p]=(E=16843009*h^65537*g^257*f^16843008*n)<<24|E>>>8,d[p]=E<<16|E>>>16,m[p]=E<<8|E>>>24,v[p]=E,n?(n=f^e[e[e[h^f]]],l^=e[e[l]]):n=l=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],E=l.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,l=4*((this._nRounds=n+6)+1),o=this._keySchedule=[],i=0;i<l;i++)i<n?o[i]=t[i]:(u=o[i-1],i%n?n>6&&i%n==4&&(u=a[u>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u]):(u=a[(u=u<<8|u>>>24)>>>24]<<24|a[u>>>16&255]<<16|a[u>>>8&255]<<8|a[255&u],u^=p[i/n|0]<<24),o[i]=o[i-n]^u);for(var r=this._invKeySchedule=[],s=0;s<l;s++){if(i=l-s,s%4)var u=o[i];else u=o[i-4];r[s]=s<4||i<=4?u:c[a[u>>>24]]^d[a[u>>>16&255]]^m[a[u>>>8&255]]^v[a[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,r,s,u,a)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,c,d,m,v,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,l,a,o,i,r){for(var s=this._nRounds,u=e[t]^n[0],c=e[t+1]^n[1],d=e[t+2]^n[2],m=e[t+3]^n[3],v=4,p=1;p<s;p++){var E=l[u>>>24]^a[c>>>16&255]^o[d>>>8&255]^i[255&m]^n[v++],f=l[c>>>24]^a[d>>>16&255]^o[m>>>8&255]^i[255&u]^n[v++],g=l[d>>>24]^a[m>>>16&255]^o[u>>>8&255]^i[255&c]^n[v++],h=l[m>>>24]^a[u>>>16&255]^o[c>>>8&255]^i[255&d]^n[v++];u=E,c=f,d=g,m=h}E=(r[u>>>24]<<24|r[c>>>16&255]<<16|r[d>>>8&255]<<8|r[255&m])^n[v++],f=(r[c>>>24]<<24|r[d>>>16&255]<<16|r[m>>>8&255]<<8|r[255&u])^n[v++],g=(r[d>>>24]<<24|r[m>>>16&255]<<16|r[u>>>8&255]<<8|r[255&c])^n[v++],h=(r[m>>>24]<<24|r[u>>>16&255]<<16|r[c>>>8&255]<<8|r[255&d])^n[v++],e[t]=E,e[t+1]=f,e[t+2]=g,e[t+3]=h},keySize:8});e.AES=t._createHelper(E)}(),n.AES)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n,t=e.lib,l=t.WordArray,a=t.BlockCipher,o=e.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],r=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],s=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=o.DES=a.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;n<56;n++){var l=i[n]-1;t[n]=e[l>>>5]>>>31-l%32&1}for(var a=this._subKeys=[],o=0;o<16;o++){var u=a[o]=[],c=s[o];for(n=0;n<24;n++)u[n/6|0]|=t[(r[n]-1+c)%28]<<31-n%6,u[4+(n/6|0)]|=t[28+(r[n+24]-1+c)%28]<<31-n%6;for(u[0]=u[0]<<1|u[0]>>>31,n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var d=this._invSubKeys=[];for(n=0;n<16;n++)d[n]=a[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,n){this._lBlock=e[t],this._rBlock=e[t+1],m.call(this,4,252645135),m.call(this,16,65535),v.call(this,2,858993459),v.call(this,8,16711935),m.call(this,1,1431655765);for(var l=0;l<16;l++){for(var a=n[l],o=this._lBlock,i=this._rBlock,r=0,s=0;s<8;s++)r|=u[s][((i^a[s])&c[s])>>>0];this._lBlock=i,this._rBlock=o^r}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,m.call(this,1,1431655765),v.call(this,8,16711935),v.call(this,2,858993459),m.call(this,16,65535),m.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function m(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function v(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}e.DES=a._createHelper(d);var p=o.TripleDES=a.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),n=e.length<4?e.slice(0,2):e.slice(2,4),a=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(l.create(t)),this._des2=d.createEncryptor(l.create(n)),this._des3=d.createEncryptor(l.create(a))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=a._createHelper(p)}(),n.TripleDES)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n,t=e.lib.StreamCipher,l=e.algo,a=l.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,l=this._S=[],a=0;a<256;a++)l[a]=a;a=0;for(var o=0;a<256;a++){var i=a%n,r=l[a];l[a]=l[o=(o+l[a]+(t[i>>>2]>>>24-i%4*8&255))%256],l[o]=r}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,n=this._j,l=0,a=0;a<4;a++){var o=e[t=(t+1)%256];e[t]=e[n=(n+e[t])%256],e[n]=o,l|=e[(e[t]+e[n])%256]<<24-8*a}return this._i=t,this._j=n,l}e.RC4=t._createHelper(a);var i=l.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(i)}(),n.RC4)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n,t=e.lib.StreamCipher,l=[],a=[],o=[],i=e.algo.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var l=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],a=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)r.call(this);for(n=0;n<8;n++)a[n]^=l[n+4&7];if(t){var o=t.words,i=o[0],s=o[1],u=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=u>>>16|4294901760&c,m=c<<16|65535&u;for(a[0]^=u,a[1]^=d,a[2]^=c,a[3]^=m,a[4]^=u,a[5]^=d,a[6]^=c,a[7]^=m,n=0;n<4;n++)r.call(this)}},_doProcessBlock:function(e,t){var n=this._X;r.call(this),l[0]=n[0]^n[5]>>>16^n[3]<<16,l[1]=n[2]^n[7]>>>16^n[5]<<16,l[2]=n[4]^n[1]>>>16^n[7]<<16,l[3]=n[6]^n[3]>>>16^n[1]<<16;for(var a=0;a<4;a++)l[a]=16711935&(l[a]<<8|l[a]>>>24)|4278255360&(l[a]<<24|l[a]>>>8),e[t+a]^=l[a]},blockSize:4,ivSize:2});function r(){for(var e=this._X,t=this._C,n=0;n<8;n++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,n=0;n<8;n++){var l=e[n]+t[n],i=65535&l,r=l>>>16;o[n]=((i*i>>>17)+i*r>>>15)+r*r^((4294901760&l)*l|0)+((65535&l)*l|0)}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(i)}(),n.Rabbit)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n,t=e.lib.StreamCipher,l=[],a=[],o=[],i=e.algo.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],l=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var a=0;a<4;a++)r.call(this);for(a=0;a<8;a++)l[a]^=n[a+4&7];if(t){var o=t.words,i=o[0],s=o[1],u=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),c=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=u>>>16|4294901760&c,m=c<<16|65535&u;for(l[0]^=u,l[1]^=d,l[2]^=c,l[3]^=m,l[4]^=u,l[5]^=d,l[6]^=c,l[7]^=m,a=0;a<4;a++)r.call(this)}},_doProcessBlock:function(e,t){var n=this._X;r.call(this),l[0]=n[0]^n[5]>>>16^n[3]<<16,l[1]=n[2]^n[7]>>>16^n[5]<<16,l[2]=n[4]^n[1]>>>16^n[7]<<16,l[3]=n[6]^n[3]>>>16^n[1]<<16;for(var a=0;a<4;a++)l[a]=16711935&(l[a]<<8|l[a]>>>24)|4278255360&(l[a]<<24|l[a]>>>8),e[t+a]^=l[a]},blockSize:4,ivSize:2});function r(){for(var e=this._X,t=this._C,n=0;n<8;n++)a[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,n=0;n<8;n++){var l=e[n]+t[n],i=65535&l,r=l>>>16;o[n]=((i*i>>>17)+i*r>>>15)+r*r^((4294901760&l)*l|0)+((65535&l)*l|0)}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(i)}(),n.RabbitLegacy)}),gt(function(e,t){var n;e.exports=(n=No,function(){var e=n,t=e.lib.BlockCipher;const l=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function i(e,t){let n=e.sbox[0][t>>24&255]+e.sbox[1][t>>16&255];return n^=e.sbox[2][t>>8&255],n+=e.sbox[3][255&t],n}function r(e,t,n){let l,a=t,o=n;for(let t=0;t<16;++t)a^=e.pbox[t],o=i(e,a)^o,l=a,a=o,o=l;return l=a,a=o,o=l,o^=e.pbox[16],a^=e.pbox[17],{left:a,right:o}}var s=e.algo.Blowfish=t.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key;!function(e,t,n){for(let t=0;t<4;t++){e.sbox[t]=[];for(let n=0;n<256;n++)e.sbox[t][n]=a[t][n]}let o=0;for(let a=0;a<18;a++)e.pbox[a]=l[a]^t[o],o++,o>=n&&(o=0);let i=0,s=0,u=0;for(let t=0;t<18;t+=2)u=r(e,i,s),i=u.left,s=u.right,e.pbox[t]=i,e.pbox[t+1]=s;for(let t=0;t<4;t++)for(let n=0;n<256;n+=2)u=r(e,i,s),i=u.left,s=u.right,e.sbox[t][n]=i,e.sbox[t][n+1]=s}(o,e.words,e.sigBytes/4)}},encryptBlock:function(e,t){var n=r(o,e[t],e[t+1]);e[t]=n.left,e[t+1]=n.right},decryptBlock:function(e,t){var n=function(e,t,n){let l,a=t,o=n;for(let t=17;t>1;--t)a^=e.pbox[t],o=i(e,a)^o,l=a,a=o,o=l;return l=a,a=o,o=l,o^=e.pbox[1],a^=e.pbox[0],{left:a,right:o}}(o,e[t],e[t+1]);e[t]=n.left,e[t+1]=n.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=t._createHelper(s)}(),n.Blowfish)}),gt(function(e,t){e.exports=No});const wo=e=>{var t;let a=e.applicationData;const i=n.useState(!1),r=i[0],s=i[1];return o.useHistory(),l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{s(!r)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),l.createElement("span",{style:{fontSize:"1.2em"}},r?"<":">"))),r&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},l.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),l.createElement("span",{style:{flex:"1",color:"black"}},a.acknowldgementNumber)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.propertyId)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(u=null===(t=a.auditDetails)||void 0===t?void 0:t.createdTime,new Date(u).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.status)),l.createElement("div",null,l.createElement(o.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+a.acknowldgementNumber,state:{propertyId:a.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var u},Ao=e=>{let t=e.payments;const a=n.useState(!1),o=a[0],i=a[1];return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{i(!o)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),l.createElement("span",{style:{fontSize:"1.2em"}},o?"<":">"))),o&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&l.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payments found"),(null==t?void 0:t.length)>0&&l.createElement("div",null,l.createElement("table",{style:{width:"100%",borderCollapse:"collapse",marginTop:"10px"}},l.createElement("thead",null,l.createElement("tr",{style:{backgroundColor:"#f5f5f5"}},l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Receipt Number"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction Date"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Amount Paid"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Payment Mode"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Transaction ID"),l.createElement("th",{style:{border:"1px solid #ddd",padding:"8px",textAlign:"left"}},"Status"))),l.createElement("tbody",null,t.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.id||t},l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},(null===(n=e.paymentDetails)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.receiptNumber)||e.receiptNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionDate?new Date(e.transactionDate).toLocaleDateString():"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},"₹",e.totalAmountPaid||e.amount||"0"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.paymentMode||e.instrumentType||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},e.transactionNumber||e.instrumentNumber||"N/A"),l.createElement("td",{style:{border:"1px solid #ddd",padding:"8px"}},l.createElement("span",{style:{color:"NEW"===e.paymentStatus||"SUCCESSFUL"===e.paymentStatus||"DEPOSITED"===e.paymentStatus?"green":"FAILED"===e.paymentStatus?"red":"orange",fontWeight:"bold"}},"DEPOSITED"===e.paymentStatus?l.createElement("p",null,"Deposited"):e.paymentStatus||"N/A")))}))),l.createElement("div",{style:{marginTop:"10px",fontSize:"14px",color:"#666"}},"Total Payments: ",t.length))))},xo=l.memo(e=>{let t=e.width,n=e.height;return l.createElement("svg",{style:e.style,xmlns:"http://www.w3.org/2000/svg",width:void 0===t?85:t,height:void 0===n?100:n,viewBox:"0 0 20 20",fill:"gray"},l.createElement("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"}))}),Oo=l.memo(e=>{let a=e.value,o=e.Code;const i=Digit.Hooks.ads.useADSDocumentSearch({value:a},{value:a},o,e.index),r=i.isLoading,s=i.data,u=n.useMemo(()=>{var e;const t=null!=a&&a.documents?null==a||null===(e=a.documents)||void 0===e?void 0:e.documents:a;return(null==t?void 0:t.filter(e=>(null==e?void 0:e.documentType)===o))||[]},[a,o]);return r?l.createElement(t.Loader,null):l.createElement("div",{className:"timeline-docs-wrapper"},null==u?void 0:u.map((e,t)=>{const n=((e,t)=>{var n;const l=(null==e?void 0:e[t])||"",a=(null==l||null===(n=l.split(","))||void 0===n?void 0:n.filter(Boolean))||[];return(null==a?void 0:a.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==a?void 0:a[0])||""})(null==s?void 0:s.pdfFiles,null==e?void 0:e.fileStoreId);return n?l.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:n,className:"timeline-doc-link"},l.createElement(xo,{className:"timeline-doc-icon"})):null}))}),Io=[{label:"CM_TIMELINE_NAME",key:"assignerName"},{label:"CM_TIMELINE_ACTION_TAKEN",key:"performedAction"},{label:"CM_TIMELINE_ACTION_TAKEN_ON",key:"lastModified"},{label:"CM_TIMELINE_DATE_RECEIVED",key:"createdDate"},{label:"CM_TIMELINE_NO_OF_DAYS",key:"noOfDays"}],Lo=(l.memo(e=>{var t,n;let a=e.checkpoint,o=e.t;return l.createElement("div",{className:"timeline-card"},l.createElement("div",{className:"timeline-header"},null==Io?void 0:Io.map(e=>{let t=e.key;return l.createElement("div",{key:t,className:"timeline-header-item"},l.createElement("span",{className:"timeline-label"},o(e.label),":"),l.createElement("span",{className:"timeline-value"},o(null==a?void 0:a[t])||"N/A"))})),l.createElement("div",{className:"timeline-note"},l.createElement("span",{className:"timeline-label"},o("CM_TIMELINE_NOTE"),":"),l.createElement("div",{className:"note-box"},(null==a?void 0:a.comment)||o("CM_TIMELINE_NO_COMMENTS"))),(null==a||null===(t=a.documents)||void 0===t?void 0:t.length)>0&&l.createElement("div",{className:"timeline-docs"},l.createElement("span",{className:"timeline-label"},o("CM_TIMELINE_DOCUMENT_ATTACHED"),":"),null==a||null===(n=a.documents)||void 0===n?void 0:n.map((e,t)=>l.createElement(Oo,{key:(null==e?void 0:e.documentType)+"-"+t,value:null==a?void 0:a.documents,Code:null==e?void 0:e.documentType,index:t}))))}),l.memo(e=>{let t=e.width,n=e.height;return l.createElement("svg",{style:e.style,xmlns:"http://www.w3.org/2000/svg",width:void 0===t?20:t,height:void 0===n?20:n,viewBox:"0 0 20 20",fill:"gray"},l.createElement("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"}))})),Ro=l.memo(e=>{let a=e.value,o=e.Code;const i=Digit.Hooks.ads.useADSDocumentSearch({value:a},{value:a},o,e.index),r=i.isLoading,s=i.data,u=n.useMemo(()=>{var e;const t=null!=a&&a.documents?null==a||null===(e=a.documents)||void 0===e?void 0:e.documents:a;return(null==t?void 0:t.filter(e=>(null==e?void 0:e.documentType)===o))||[]},[a,o]);return r?l.createElement(t.Loader,null):l.createElement("div",{className:"custom-doc-container"},null==u?void 0:u.map((e,t)=>{const n=((e,t)=>{var n;const l=(null==e?void 0:e[t])||"",a=(null==l||null===(n=l.split(","))||void 0===n?void 0:n.filter(Boolean))||[];return(null==a?void 0:a.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==a?void 0:a[0])||""})(null==s?void 0:s.pdfFiles,(null==e?void 0:e.fileStoreId)||(null==e?void 0:e.documentUid));return n?l.createElement("a",{key:t,target:"_blank",rel:"noopener noreferrer",href:n,className:"custom-doc-link"},l.createElement(Lo,null),l.createElement("span",null,(null==e?void 0:e.fileName)||"Document")):null}))});function Mo(e){var a,o,i,r,s,u;let c=e.workflowDetails,d=e.t,v=e.tenantId,p=void 0===v?Digit.ULBService.getCurrentTenantId():v,E=e.timeObj,f=e.empUserName,g=void 0===f?null:f,h=e.handleSetEmpDesignation,y=void 0===h?()=>{}:h;const S=Digit.Hooks.ads.useADSDocumentSearch({value:(null==c||null===(a=c.data)||void 0===a||null===(o=a.timeline)||void 0===o?void 0:o.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},{value:(null==c||null===(i=c.data)||void 0===i||null===(r=i.timeline)||void 0===r?void 0:r.flatMap(e=>null==e?void 0:e.wfDocuments))||[]},null,0),b=S.isLoading,_=S.data,C=l.useCallback(()=>{if(!b){const e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")||{},t=function(e,t,n,l){var a,o,i,r,s,u,c,d,m;void 0===n&&(n={}),console.log("pdfFiles",n);const v=(null==e||null===(a=e.data)||void 0===a?void 0:a.timeline)||(null==e?void 0:e.timeline)||[],p=(null==e||null===(o=e.data)||void 0===o?void 0:o.processInstances)||(null==e?void 0:e.processInstances)||[],E=(null==p||null===(i=p[0])||void 0===i?void 0:i.businessId)||"N/A",f=(null==p||null===(r=p[0])||void 0===r?void 0:r.businessService)||"N/A",g=(null==p||null===(s=p[0])||void 0===s?void 0:s.moduleName)||"N/A",h=(e,t)=>{var n;const l=(null==e?void 0:e[t])||"",a=(null==l||null===(n=l.split(","))||void 0===n?void 0:n.filter(Boolean))||[];return(null==a?void 0:a.find(e=>!(null!=e&&e.includes("large")||null!=e&&e.includes("medium")||null!=e&&e.includes("small"))))||(null==a?void 0:a[0])||""},y=/\[#\?.*?\*\*\]/,S=v.map((e,t)=>{var a,o,i,r,s,u;const c=(null==e||null===(a=e.auditDetails)||void 0===a?void 0:a.created)||"N/A",d=(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.timing)||"N/A",m=(null==e||null===(i=e.assigner)||void 0===i?void 0:i.name)||"N/A",v=(null==e||null===(r=e.assigner)||void 0===r?void 0:r.type)||"N/A",p=(null==e||null===(s=e.assigner)||void 0===s?void 0:s.mobileNumber)||"N/A",E=(null==e?void 0:e.performedAction)||"N/A",f=(null==e?void 0:e.status)||(null==e?void 0:e.state)||"N/A",g=(null==e||null===(u=e.wfComment)||void 0===u?void 0:u[0])||"-",S="string"==typeof g?g.split(y)[0]:g,b=(null==e?void 0:e.wfDocuments)||[],_=(null==e?void 0:e.sla)||"N/A",C=Array.isArray(null==e?void 0:e.assignes)?e.assignes.map(e=>null==e?void 0:e.name).filter(Boolean).join(", "):"";return{sNo:t+1,action:l?l(E):E,status:l?l(f):f,assignerName:m,assignerType:v,mobileNumber:p,designation:v,date:c,time:d,dateTime:(c+" "+("N/A"!==d?d:"")).trim(),comment:S,documents:b.map(e=>({name:(null==e?void 0:e.fileName)||(null==e?void 0:e.documentType)||"Document",type:(null==e?void 0:e.documentType)||"Document",fileStoreId:null==e?void 0:e.fileStoreId,link:h(n,null==e?void 0:e.fileStoreId)})),hasDocuments:b.length>0,sla:_,assignedTo:C}});return{t:l,tenantId:(null==t?void 0:t.code)||"",tenantName:(null==t?void 0:t.name)||(null==t?void 0:t.i18nKey)||"Government Department",name:l?l("TIMELINE_PDF_TITLE"):"Application Timeline",heading:l?l("TIMELINE_PDF_HEADING"):"File Movement Report",businessId:E,businessService:l?l("CS_COMMON_"+(null==f?void 0:f.toUpperCase())):f,moduleName:g,currentStatus:l?l((null==v||null===(u=v[0])||void 0===u?void 0:u.status)||(null==v||null===(c=v[0])||void 0===c?void 0:c.state)||"N/A"):(null==v||null===(d=v[0])||void 0===d?void 0:d.status)||(null==v||null===(m=v[0])||void 0===m?void 0:m.state)||"N/A",generatedDate:(new Date).toLocaleDateString("en-IN",{day:"2-digit",month:"long",year:"numeric"}),generatedDateTime:(new Date).toLocaleString("en-IN",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}),timelineRows:S,totalSteps:S.length}}(c,e,(null==_?void 0:_.pdfFiles)||{},d);Digit.Utils.pdf.generateTimelinePDF(t)}},[c,_,d,b]),T=e=>{if(null==e||!e.created||null==e||!e.timing)return null;const t=e.created.split("/");return new Date(t[2]+"-"+t[1]+"-"+t[0]+" "+e.timing)},D=(e,t)=>{if(!e||!t)return null;const n=Math.floor((e-t)/6e4),l=Math.floor(n/60),a=Math.floor(l/24);return a>0?a+" day(s)":l>0?l+" hour(s)":n+" minute(s)"},N=n.useMemo(()=>(e=>{const t=(null==e?void 0:e.data)||e,n=null==t?void 0:t.timeline;if(!Array.isArray(n))return[];const l=[...n].reverse();return l.map((e,t)=>{var n;const a=T(e.auditDetails),o=t>0?T(null===(n=l[t-1])||void 0===n?void 0:n.auditDetails):null;return m({},e,{status:(null==e?void 0:e.state)||(null==e?void 0:e.status),assigner:(null==e?void 0:e.assigner)||null,assignes:Array.isArray(null==e?void 0:e.assignes)?e.assignes:[],wfComment:Array.isArray(null==e?void 0:e.wfComment)?e.wfComment:null!=e&&e.comment?[e.comment]:[],wfDocuments:Array.isArray(null==e?void 0:e.wfDocuments)?e.wfDocuments:[],actionDateTime:a,sla:D(a,o)})}).reverse()})(c),[c]),w=(null==N?void 0:N.filter(e=>!("SAVE_AS_DRAFT"===(null==e?void 0:e.performedAction))))||[],A=w.map(e=>{var t;return null==e||null===(t=e.assigner)||void 0===t?void 0:t.userName}).filter(Boolean),x=[...new Set(A)].join(","),O=Digit.Hooks.useEmployeeSearch(p,{codes:x,isActive:!0},{enabled:!!x}),I={};return null==O||null===(s=O.data)||void 0===s||null===(u=s.Employees)||void 0===u||u.forEach(e=>{var t;const n=null==e||null===(t=e.assignments)||void 0===t?void 0:t[0];I[null==e?void 0:e.code]="COMMON_MASTERS_DESIGNATION_"+(null==n?void 0:n.designation)}),O&&g&&y(d(I[g])),b?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"custom-timeline-container"},E&&l.createElement("div",{style:{marginBottom:"8px",fontStyle:"italic"}},d("TOTAL_TIME_TAKEN"),": ",null==E?void 0:E.days," ",d("DAYS")," ",null==E?void 0:E.hours," ",d("HOURS")," ",null==E?void 0:E.minutes," ",d("MINUTES")," ",null==E?void 0:E.seconds," ",d("SECONDS")),l.createElement("div",{className:"custom-timeline-header"},l.createElement("div",{className:"custom-tracking-status-header"},l.createElement("div",{className:"custom-tracking-line"}),l.createElement("span",{className:"custom-tracking-status-text"},d("TRACKING STATUS")),l.createElement("div",{className:"custom-tracking-line"})),l.createElement("div",{className:"custom-title-bar-row"},l.createElement("h2",{className:"custom-timeline-title"},d("Application History")),l.createElement("span",{onClick:C,className:"download-button"},d("CS_COMMON_DOWNLOAD")),l.createElement("div",{className:"custom-blue-bar"}))),l.createElement("div",{className:"custom-timeline-entries"},null==w?void 0:w.map((e,t)=>{var n,a,o,i,r,s,u,c,m,v,p,E,f,g,h,y;return l.createElement("div",{key:t,className:"custom-timeline-entry"},l.createElement("div",{className:"custom-vertical-line"}),l.createElement("div",{className:"custom-date-badge"},null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.created," ",null==e||null===(a=e.auditDetails)||void 0===a?void 0:a.timing),l.createElement("div",{className:"custom-entry-content"},l.createElement("div",{className:"custom-icon-container"},l.createElement("div",{className:"custom-circular-icon"},l.createElement("svg",{className:"custom-mail-icon",viewBox:"0 0 24 24"},l.createElement("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),l.createElement("path",{d:"M3 7l9 6 9-6"})))),l.createElement("div",{className:"custom-content-card"},l.createElement("div",{className:"custom-card-top"},l.createElement("div",{className:"custom-card-column"},l.createElement("h3",{className:"custom-action-title"},d("Action taken by")),(null==e?void 0:e.assigner)&&l.createElement("div",{className:"custom-officer-info"},l.createElement("div",{className:"custom-officer-name"},(null==e||null===(o=e.assigner)||void 0===o?void 0:o.name)||d("CS_COMMON_NA"),I[null==e||null===(i=e.assigner)||void 0===i?void 0:i.userName]&&l.createElement("span",{className:"custom-officer-name"},"- ",d(I[null==e||null===(r=e.assigner)||void 0===r?void 0:r.userName]))),(null==e||null===(s=e.assigner)||void 0===s?void 0:s.emailId)&&l.createElement("div",{className:"custom-officer-email"},l.createElement("span",{className:"custom-email-label"},d("Email"))," ",null==e||null===(u=e.assigner)||void 0===u?void 0:u.emailId))),l.createElement("div",{className:"custom-card-column custom-card-column-mid"},(null==e?void 0:e.sla)&&l.createElement(l.Fragment,null,l.createElement("h3",{className:"custom-action-title"},d("Time Taken")),l.createElement("div",{className:"custom-officer-email"},l.createElement("span",{className:"custom-email-label"},null==e?void 0:e.sla)))),l.createElement("div",{className:"custom-card-column custom-card-column-right"},l.createElement("h3",{className:"custom-action-title"},d("Action")),l.createElement("div",{className:"custom-status-text "+("OBSERVATION"===(null==e?void 0:e.performedAction)?"chb-slot-status--unavailable":"")},d((null==e?void 0:e.performedAction)||"CS_COMMON_NA")))),(null==e?void 0:e.wfComment)&&(null==e||null===(c=e.wfComment)||void 0===c?void 0:c.length)>0&&(null==e||null===(m=e.wfComment)||void 0===m?void 0:m.some(e=>null==e?void 0:e.trim()))&&l.createElement("div",{className:"custom-comments-section container-full-width"},l.createElement("div",{className:"custom-comments-content"},l.createElement("h4",{className:"custom-comments-title"},d("Officer Comments")),l.createElement("div",{className:"custom-comment-text"},null==e||null===(v=e.wfComment)||void 0===v?void 0:v.map((e,t)=>{const n="string"==typeof e?null==e?void 0:e.split(/\[#\?.*?\*\*\]/)[0]:e;return l.createElement("p",{key:t},n)}))),(null==e||null===(p=e.assignes)||void 0===p?void 0:p.length)>0&&l.createElement("div",{className:"custom-assigned-to-footer"},l.createElement("h3",{className:"custom-comments-title"},d("Assigned To")),l.createElement("div",{className:"custom-officer-info"},l.createElement("div",{className:"custom-officer-name"},null===(E=e.assignes[0])||void 0===E?void 0:E.name,I[null===(f=e.assignes[0])||void 0===f?void 0:f.userName]&&l.createElement("span",{className:"custom-officer-email"},"- ",d(I[null===(g=e.assignes[0])||void 0===g?void 0:g.userName])))))),(null==e?void 0:e.wfDocuments)&&(null==e||null===(h=e.wfDocuments)||void 0===h?void 0:h.length)>0&&l.createElement("div",{className:"custom-comments-section-no-border"},l.createElement("h4",{className:"custom-comments-title"},"Document Attached:"),l.createElement("div",{className:"custom-comment-text"},null==e||null===(y=e.wfDocuments)||void 0===y?void 0:y.map((t,n)=>l.createElement(Ro,{key:(null==t?void 0:t.documentType)+"-"+n,value:null==e?void 0:e.wfDocuments,Code:null==t?void 0:t.documentType,index:n})))))))}))))}function Po(e){var i,r,s,u,c,d,v,E,f,g,h,y,S,b,C,T;let D=e.applicationDetails,N=e.demandData,w=e.workflowDetails,A=e.isDataLoading,x=e.applicationData,O=e.timelineStatusPrefix,I=e.showTimeLine,L=void 0===I||I,R=e.statusAttribute,M=void 0===R?"status":R,P=e.paymentsList,F=e.oldValue,k=e.propertyId,B=e.moduleCode;const U=a.useTranslation().t,H=o.useHistory(),V=Digit.ULBService.getCurrentTenantId(),W=n.useState(null),z=W[0],j=W[1],q=n.useState([]),Y=q[0],G=q[1];let K=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const Q=[{Header:U("BPA_DOCUMENT_DETAILS_LABEL"),accessor:"title",Cell:e=>U(e.value)||U("CS_NA")},{Header:U(" "),accessor:"url",Cell:e=>{let n=e.value;return n?l.createElement(t.LinkButton,{style:{float:"right",display:"inline"},label:U("View"),onClick:()=>{window.open(n,"_blank")}}):U("CS_NA")}}];function X(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("TIMELINE",D,B),n.useEffect(()=>{!function(){try{const e=function(){if(window.location.href.includes("employee/ws")&&null!=x&&x.connectionNo){const e=p(function(){return Promise.resolve(Digit.WSService.paymentsearch({tenantId:(null==x?void 0:x.tenantId)||V,filters:{consumerCodes:null==x?void 0:x.connectionNo,consumerCode:null==x?void 0:x.connectionNo},BusinessService:"SEWERAGE"===(null==x?void 0:x.serviceType)||"SEWARAGE"===(null==x?void 0:x.serviceType)?"SW":"WS"})).then(function(e){Array.isArray(e)&&e.length>0?G(e):null!=e&&e.Payments&&e.Payments.length>0&&G(e.Payments)})},function(e){console.error("❌ Payment fetch error:",e)});if(e&&e.then)return e.then(function(){})}}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[null==x?void 0:x.connectionNo,null==x?void 0:x.serviceType,V]);const Z=n.useState({})[1],$=n.useState(),J=$[0],ee=$[1],te=n.useState([]),ne=te[0],le=te[1],ae=n.useState({loading:!1,loaded:!1,canLoad:!1}),oe=ae[0],ie=ae[1];"ACTIVE"!=(null==x?void 0:x.status)||oe.loading||oe.loaded||oe.canLoad||ie({loading:!1,loaded:!1,canLoad:!0}),null==oe||!oe.canLoad||oe.loading||oe.loaded||(ie({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function o(){n(i),l({loading:!1,loaded:!0,canLoad:!0})}let i={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0){const n=a.Assessments.filter(e=>"ACTIVE"===e.status),l=new Map;n.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,n=l.get(t);(!n||e.createdDate>n.createdDate)&&l.set(t,e)});const o=Array.from(l.values());return le(o),ee(null==a?void 0:a.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){i=e})}}();return r&&r.then?r.then(o):o()})}catch(e){return Promise.reject(e)}}((null==x?void 0:x.tenantId)||V,null==x?void 0:x.propertyId,Z,ie));const re=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()},se=function(e,t,n){if(void 0===t&&(t=0),!e)return null;if("OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:re(null==x||null===(a=x.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==x?void 0:x.channel)||""};return l.createElement(fo,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,i,r,s,u,c,d,m,v,p,E,f,g,h,y,S,b,C,T,N;const a={uuid:(null==e||null===(o=e.assigner)||void 0===o?void 0:o.uuid)||(null==e||null===(i=e.assignes)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.uuid),fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==D?void 0:D.tenantId,businessIds:null==D?void 0:D.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+(_.get(e,"ProcessInstances["+t+"].assigner.mobileNumber")||_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber")),n}}},w=n&&Array.isArray(n)&&t>0&&t-1<n.length?n[t-1]:null,A={date:null==e||null===(s=e.auditDetails)||void 0===s?void 0:s.lastModified,name:(null==e||null===(u=e.assigner)||void 0===u?void 0:u.name)||(null==e||null===(c=e.assignes)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.name)||"N/A",mobileNumber:(null==x||null===(m=x.processInstance)||void 0===m||null===(v=m.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)===(null==e||null===(E=e.assigner)||void 0===E?void 0:E.uuid)&&null!=x&&null!==(f=x.processInstance)&&void 0!==f&&null!==(g=f.assignes)&&void 0!==g&&null!==(h=g[0])&&void 0!==h&&h.mobileNumber?null==x||null===(y=x.processInstance)||void 0===y||null===(S=y.assignes)||void 0===S||null===(b=S[0])||void 0===b?void 0:b.mobileNumber:(null==e||null===(C=e.assigner)||void 0===C?void 0:C.mobileNumber)||(null==e||null===(T=e.assignes)||void 0===T||null===(N=T[0])||void 0===N?void 0:N.mobileNumber)||"N/A",comment:null!=e&&e.comment?U(e.comment):"",wfComment:w&&w.wfComment||[],thumbnailsToShow:(null==e?void 0:e.thumbnailsToShow)||[]};return l.createElement(fo,{data:A,OpenImage:X,privacy:a})}{var w,A,O,I,L;const t={date:re(null==x||null===(w=x.auditDetails)||void 0===w?void 0:w.lastModifiedTime),name:(null==e||null===(A=e.assignes)||void 0===A||null===(O=A[0])||void 0===O?void 0:O.name)||"N/A",wfComment:(null==e?void 0:e.wfComment)||[],mobileNumber:(null==e||null===(I=e.assignes)||void 0===I||null===(L=I[0])||void 0===L?void 0:L.mobileNumber)||"N/A"};return l.createElement(fo,{data:t})}},ue=(e,t)=>e?t?e:U(e):U("NA"),ce=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),de=window.location.href.includes("employee/noc"),me=window.location.href.includes("employee/obps"),ve=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ce?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),pe=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?ue(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+U(null==e?void 0:e.isUnit):U("N/A"):null!=e&&e.value?ue(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):U("N/A"),Ee=n.useState(!1),fe=Ee[0],ge=Ee[1],he=(null==N||N.reduce((e,t)=>e+t.demandInterest,0),null==N||N.reduce((e,t)=>e+t.demandPenality,0),null==N||N.reduce((e,t)=>e+t.collectionTax,0),null==N||N.reduce((e,t)=>e+t.collectionInterest,0),null==N||N.reduce((e,t)=>e+t.collectionPenality,0),null==N||N.reduce((e,t)=>e+t.balanceTax,0),null==N||N.reduce((e,t)=>e+t.balanceInterest,0),null==N||N.reduce((e,t)=>e+t.balancePenality,0),function(e,t,n){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const l=m({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:m({},e.additionalDetails,{propertytobestatus:t}),workflow:m({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:m({},l)},V,n)).then(function(){})}catch(e){return Promise.reject(e)}}),ye=null==D?void 0:D.applicationData,Se=(null==D||null===(i=D.applicationData)||void 0===i?void 0:i.propertyId)||"",be=null==D||null===(r=D.additionalDetails)||void 0===r?void 0:r.propertytobestatus;return n.useEffect(()=>{if("WS"!==B&&"SW"!==B&&!window.location.href.includes("employee/ws")&&!window.location.href.includes("/ws/"))if("TL"!==B){if(k)try{let e={consumerCodes:k};const t=!0;"BPAREG"===B?Digit.OBPSService.paymentsearch({tenantId:V,filters:e,auth:t}).then(e=>{G(null==e?void 0:e.Payments)}):"PT"===B&&Digit.PTService.paymentsearch({tenantId:V,filters:e,auth:t}).then(e=>{G(null==e?void 0:e.Payments)})}catch(e){console.error("❌ Payment search error for PT/BPREG:",e)}}else{const e=null==x?void 0:x.applicationNumber;if(!e)return;Digit.PaymentService.recieptSearch(V,"TL",{consumerCodes:e}).then(e=>{var t;console.log("TL Payment History response:",e),(null==e||null===(t=e.Payments)||void 0===t?void 0:t.length)>0&&G(e.Payments)}).catch(e=>{console.error("TL Payment search error:",e)})}},[B,k,V,null==x?void 0:x.applicationNumber]),l.createElement(t.Card,{style:{position:"relative"}},null==D||null===(s=D.applicationDetails)||void 0===s?void 0:s.map((e,a)=>{var i,r,s,u,c,d,m,v,p,E,f,g,h,y,S,b,_,C,T,N,A,x,O,I,L,R,M,k,B,H,V,W,z,j,q,Y,G,X,Z;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"),{})},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&ce?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},de?""+U(e.title):U(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},U(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"}},U(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"}},U(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},U(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ce?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i,r;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:U(n.title),label:U(n.title),text:l.createElement("img",{src:U(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:U(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},U(null==n?void 0:n.title)))):de||me?""+U(n.title):U(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(r=e.values)||void 0===r?void 0:r.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:ve(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+U(""+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:U(n.title),label:U(n.title),text:pe(n),last:a===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:ve(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}})})))),(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(vo,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:P,additionalDetails:null==D||null===(s=D.applicationData)||void 0===s?void 0:s.additionalDetails,applicationData:null==D?void 0:D.applicationData}),(null==D||null===(u=D.applicationData)||void 0===u||null===(c=u.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(oo,{fiReport:null==D||null===(v=D.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(co,{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(mo,{owners:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.owners}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.units)&&l.createElement(ho,{units:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.units}),(null==e||null===(b=e.additionalDetails)||void 0===b?void 0:b.accessories)&&l.createElement(go,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.accessories}),!K&&(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.permissions)&&(null==w||null===(T=w.data)||void 0===T||null===(N=T.nextActions)||void 0===N?void 0:N.length)>0&&l.createElement(so,{applicationData:null==D?void 0:D.applicationData,t:U,permissions:null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.permissions}),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(lo,{t:U,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:w})),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.noc)&&l.createElement(ro,{t:U,isNoc:!0,NOCdata:e.values,applicationData:null==D?void 0:D.applicationData,docs:e.additionalDetails.noc,noc:null===(I=e.additionalDetails)||void 0===I?void 0:I.data,bpaActionsDetails:w}),(null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.scruntinyDetails)&&l.createElement(vo,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(R=e.additionalDetails)||void 0===R?void 0:R.buildingExtractionDetails)&&l.createElement(vo,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(M=e.additionalDetails)||void 0===M?void 0:M.subOccupancyTableDetails)&&l.createElement(po,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==D?void 0:D.applicationData}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.documentsWithUrl)&&l.createElement(t.Table,{className:"customTable table-border-style",t:U,data:(null==e||null===(B=e.additionalDetails)||void 0===B||null===(H=B.documentsWithUrl[0])||void 0===H?void 0:H.values)||[],columns:Q,getCellProps:()=>({style:{}}),disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1}),(null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.taxHeadEstimatesCalculation)&&l.createElement(uo,{taxHeadEstimatesCalculation:null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(yo,{wsAdditionalDetails:e,oldValue:F}),(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(o.Link,{to:null==e||null===(j=e.additionalDetails)||void 0===j||null===(q=j.redirectUrl)||void 0===q?void 0:q.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(Y=e.additionalDetails)||void 0===Y||null===(G=Y.redirectUrl)||void 0===G?void 0:G.title))),(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.estimationDetails)&&l.createElement(_o,{wsAdditionalDetails:e,workflowDetails:w}),(null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.estimationDetails)&&l.createElement(Co,{wsAdditionalDetails:e,workflowDetails:w}))}),(null==J?void 0:J.length)>0&&l.createElement(To,{assessmentData:ne}),l.createElement(Ao,{payments:Y}),"WS"!==B&&"SW"!==B&&"OBPS"!==B&&"BPAStakeholder"!==B&&"BPAREG"!==B&&"TL"!==B&&l.createElement(wo,{applicationData:null==D?void 0:D.applicationData}),L&&(null==w||null===(u=w.data)||void 0===u||null===(c=u.timeline)||void 0===c?void 0:c.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==w?void 0:w.isLoading)||A)&&l.createElement(t.Loader,null),!(null!=w&&w.isLoading)&&!A&&"BPAREG"!==B&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},U("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=w&&null!==(d=w.data)&&void 0!==d&&d.timeline&&1===(null==w||null===(v=w.data)||void 0===v||null===(E=v.timeline)||void 0===E?void 0:E.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:U(""+O+(null==w||null===(f=w.data)||void 0===f||null===(g=f.timeline[0])||void 0===g?void 0:g.state)),customChild:se(null==w||null===(h=w.data)||void 0===h?void 0:h.timeline[0],null==w||null===(y=w.data)||void 0===y?void 0:y.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==w||null===(S=w.data)||void 0===S?void 0:S.timeline)&&(null==w||null===(b=w.data)||void 0===b?void 0:b.timeline.slice(0,fe?null==w?void 0:w.data.timeline.length:2).map((e,n,a)=>{var o;let i="";var r,s,u,c,d,m;return window.location.href.includes("/obps/")&&(i=null!=w&&null!==(r=w.data)&&void 0!==r&&null!==(s=r.timeline[n-1])&&void 0!==s&&null!==(u=s.state)&&void 0!==u&&u.includes("BACK_FROM")||null!=w&&null!==(c=w.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:U(""+O+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[M])+i),customChild:se(e,n,null==w||null===(o=w.data)||void 0===o?void 0:o.timeline)}))}))),(null==w||null===(C=w.data)||void 0===C||null===(T=C.timeline)||void 0===T?void 0:T.length)>2&&l.createElement(t.LinkButton,{label:U(fe?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ge(e=>!e)}}))),!(null!=w&&w.isLoading)&&!A&&"BPAREG"===B&&l.createElement(Mo,{workflowDetails:w,t:U})),window.location.href.includes("/pt/")?l.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},l.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("employee")?"INACTIVE"==be?he(ye,"ACTIVE",Se):alert("Property is already active."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("employee")?"ACTIVE"==be?he(ye,"INACTIVE",Se):alert("Property is already inactive."):alert("You are not authorized to change the property status.")}}),l.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==D||null===(e=D.applicationData)||void 0===e?void 0:e.propertyId;if(t)if(window.location.href.includes("employee")){var n,l,a;if("INACTIVE"===(null==D||null===(n=D.applicationData)||void 0===n?void 0:n.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==D||null===(l=D.applicationData)||void 0===l?void 0:l.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==D||null===(a=D.applicationData)||void 0===a?void 0:a.status)&&H.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}else{var o,i,r;if("INACTIVE"===(null==D||null===(o=D.applicationData)||void 0===o?void 0:o.status))return void alert("Property is inactive, cannot edit.");if("INWORKFLOW"===(null==D||null===(i=D.applicationData)||void 0===i?void 0:i.status))return void alert("Property is in workflow, cannot edit.");"ACTIVE"===(null==D||null===(r=D.applicationData)||void 0===r?void 0:r.status)&&H.push({pathname:"/digit-ui/citizen/pt/property/edit-application/"+t})}}}),l.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{alert("access property")}})):l.createElement("div",null),z&&l.createElement(t.Toast,{error:z.isError,label:U(z.label),onClose:()=>{j(null)},isDleteBtn:"false"}))}function Fo(e){var n,a,o,i,r,s,u,c,d,m,v,p,E,f,g,h,y,S;let b=e.t,_=e.showToast,C=e.closeToast,T=e.businessService;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var D;let e="";switch(null==_||null===(D=_.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==_?void 0:_.key)?null==_||null===(n=_.error)||void 0===n?void 0:n.message:b("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==_?void 0:_.key)?null==_||null===(a=_.error)||void 0===a?void 0:a.message:b("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==_?void 0:_.key)?null==_||null===(o=_.error)||void 0===o?void 0:o.message:b("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==_?void 0:_.key)?null==_||null===(i=_.error)||void 0===i?void 0:i.message:b("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==_?void 0:_.key)?null==_||null===(r=_.error)||void 0===r?void 0:r.message:b("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==_?void 0:_.key)?null==_||null===(s=_.error)||void 0===s?void 0:s.message:b("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==_?void 0:_.key)?null==_||null===(u=_.error)||void 0===u?void 0:u.message:b("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==_?void 0:_.key)?(null==_||null===(c=_.error)||void 0===c?void 0:c.message)||(null==_?void 0:_.label):(null==_?void 0:_.label)||b("ES_"+T+"_"+(null==_||null===(d=_.action)||void 0===d?void 0:d.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,_&&l.createElement(t.Toast,{error:"error"===_.key,label:e,onClose:C}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var N;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=T&&T.includes("BPA_OC")?b(e[1]):b(e[0]),n};let n="";switch(null==_||null===(N=_.action)||void 0===N?void 0:N.action){case"REVOCATE":n="error"===(null==_?void 0:_.key)?null==_||null===(m=_.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==_?void 0:_.key)?null==_||null===(v=_.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==_?void 0:_.key)?null==_||null===(p=_.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==_?void 0:_.key)?null==_||null===(E=_.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==_?void 0:_.key)?null==_||null===(f=_.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==_?void 0:_.key)?null==_||null===(g=_.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==_?void 0:_.key)?null==_||null===(h=_.error)||void 0===h?void 0:h.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==_?void 0:_.key)?null==_||null===(y=_.error)||void 0===y?void 0:y.message:b("ES_"+T+"_"+(null==_||null===(S=_.action)||void 0===S?void 0:S.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,_&&l.createElement(t.Toast,{error:"error"===_.key,label:n,onClose:C}))}{var w,A;const e="error"===(null==_?void 0:_.key)?null==_||null===(w=_.error)||void 0===w?void 0:w.message:"ES_"+T+"_"+(null==_||null===(A=_.action)||void 0===A?void 0:A.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,_&&l.createElement(t.Toast,{error:"error"===_.key,label:b(e),onClose:C}))}}function ko(e){var o,i,r,s,u,c,d,v,p,E,f,g,h,y,S,b;let _=e.workflowDetails,C=e.displayMenu,T=e.onActionSelect,D=e.setDisplayMenu,N=e.businessService,w=e.forcedActionPrefix,A=e.ActionBarStyle,x=void 0===A?{}:A,O=e.MenuStyle,I=void 0===O?{}:O;const L=a.useTranslation().t;let R=Digit.UserService.getUser();const M=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):{};R=null==t?void 0:t.value}const P=null===(o=R)||void 0===o||null===(i=o.info)||void 0===i||null===(r=i.roles)||void 0===r?void 0:r.map(e=>e.code);let F=!1,k=!1,B=(null==_||null===(s=_.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(c=u.nextActions)||void 0===c?void 0:c.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==_||null===(d=_.data)||void 0===d||null===(v=d.nextActions)||void 0===v?void 0:v.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return console.log("ActionsInPayment",_),Digit.Hooks.useClickOutside(M,()=>{D(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==B?void 0:B.length)||null!=B&&null!==(p=B[0])&&void 0!==p&&null!==(E=p.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==B?void 0:B.length)?(k=!1,F=!0):(null==B?void 0:B.length)>0&&(k=!0,F=!1),l.createElement(l.Fragment,null,!(null!=_&&_.isLoading)&&k&&!F&&l.createElement(t.ActionBar,{style:m({},x)},C&&(null!=_&&null!==(f=_.data)&&void 0!==f&&null!==(g=f.actionState)&&void 0!==g&&g.nextActions||null!=_&&null!==(h=_.data)&&void 0!==h&&h.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:w||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()),options:B,optionKey:"action",t:L,onSelect:T,style:I}):null,l.createElement(t.SubmitBar,{ref:M,label:L("WF_TAKE_ACTION"),onSubmit:()=>D(!C)})),!(null!=_&&_.isLoading)&&!k&&F&&l.createElement(t.ActionBar,{style:m({},x)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==B||null===(y=B[0])||void 0===y?void 0:y.action,value:null==B||null===(S=B[0])||void 0===S?void 0:S.action,onClick:e=>{T((null==B?void 0:B[0])||{})}},L((w||"WF_EMPLOYEE_"+(null==N?void 0:N.toUpperCase()))+"_"+(null==B||null===(b=B[0])||void 0===b?void 0:b.action)))))}const Bo=()=>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"})),Uo=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Bo,null));function Ho(e){let n=e.action,o=e.closeWarningPopup;const i=a.useTranslation().t,r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},i("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Uo,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,i("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",i("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+i("PT_AMOUNT_DUE"),text:"₹"+i(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:i("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:i("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const Vo=e=>{var i,s;let u=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const c=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),v=Digit.Hooks.obps.useMDMS(d,"BPA",["BlockReason"]).data,E=a.useTranslation().t,f=o.useHistory();let g=o.useParams().id;const h=n.useState(!1),y=h[0],S=h[1],b=n.useState(null),_=b[0],C=b[1],T=n.useState(!1),D=T[0],N=T[1],w=n.useState(!1),A=w[0],x=w[1],O=n.useState(!1),I=O[0],L=O[1],R=Digit.Hooks.obps.useMDMS(d,"BPA",["RiskTypeComputation"]).data,M=e.applicationDetails,P=e.demandData,F=e.totalDemandTax,k=e.totalBalanceTax,B=e.showToast,U=e.setShowToast,H=e.isLoading,V=e.isDataLoading,W=e.applicationData,z=e.mutate,j=e.nocMutation,q=e.workflowDetails,Y=e.id,G=e.businessService,K=e.closeToast,Q=e.moduleCode,X=e.timelineStatusPrefix,Z=e.forcedActionPrefix,$=e.statusAttribute,J=e.ActionBarStyle,ee=e.MenuStyle,te=e.paymentsList,ne=e.showTimeLine,le=void 0===ne||ne,ae=e.oldValue,oe=e.isInfoLabel,ie=void 0!==oe&&oe,re=e.clearDataDetails,se=e.propertyId;n.useEffect(()=>{B&&q&&q.revalidate&&q.revalidate()},[B]);const ue=r.useQueryClient(),ce=()=>{C(null),N(!1)};return console.log("ActionsInPayment2",q),H||A?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,H?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(Po,{applicationDetails:M,demandData:P,id:Y,workflowDetails:q,isDataLoading:V,applicationData:W,totalDemandTax:F,totalBalanceTax:k,businessService:G,timelineStatusPrefix:X,statusAttribute:$,paymentsList:te,showTimeLine:le,oldValue:ae,isInfoLabel:ie,propertyId:se,moduleCode:Q}),D?l.createElement(eo,{t:E,action:_,tenantId:c,state:d,id:g,applicationDetails:M,applicationData:null==M?void 0:M.applicationData,closeModal:ce,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,o,i,r,s,u,c,d,v,g,h,y,S,b,C,T,D,N){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(o=a.workflow)||void 0===o||null===(i=o.comment)||void 0===i?void 0:i.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.action)?0==(null==e||null===(u=e.Licenses)||void 0===u||null===(c=u[0])||void 0===c||null===(d=c.additionalDetail)||void 0===d||null===(v=d.validityYears)||void 0===v?void 0:v.length):0==(null==e||null===(g=e.Licenses)||void 0===g||null===(h=g[0])||void 0===h||null===(y=h.comment)||void 0===y?void 0:y.length))||0==(null==e||null===(S=e.WaterConnection)||void 0===S||null===(b=S.comment)||void 0===b?void 0:b.length)||0==(null==e||null===(C=e.SewerageConnection)||void 0===C||null===(T=C.comment)||void 0===T?void 0:T.length)||0==(null==e||null===(D=e.BPA)||void 0===D||null===(N=D.comment)||void 0===N?void 0:N.length)){var w,A;"INITIATE"===(null==e||null===(w=e.Licenses)||void 0===w||null===(A=w[0])||void 0===A?void 0:A.action)?alert(E("Please fill in the validity before submitting")):alert(E("Please fill in the comments before submitting"))}else{const a=function(a,o,i,r,s){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(o=e.BPA)&&void 0!==o&&null!==(i=o.additionalDetails)&&void 0!==i&&i.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(s=r.workflow)||void 0===s?void 0:s.action)){function u(t){if(l)return t;z&&(x(!0),z(e,{onError:(e,t)=>{x(!1),U({key:"error",error:e}),setTimeout(K,5e3)},onSuccess:(e,t)=>{var l,a,o,i,r,s;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),x(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,f.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,f.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&f.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(i=e.Amendments)||void 0===i?void 0:i.length)>0){var u,c,d,m,v,p,g,h;null!=t&&null!==(u=t.AmendmentUpdate)&&void 0!==u&&null!==(c=u.workflow)&&void 0!==c&&c.action.includes("SEND_BACK")?U({key:"success",label:E("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?U({key:"success",label:E("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(p=v.workflow)&&void 0!==p&&p.action.includes("APPROVE")?U({key:"success",label:E("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(h=g.workflow)&&void 0!==h&&h.action.includes("REJECT")&&U({key:"success",label:E("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var y,S,b;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(s=e.Licenses[0])&&void 0!==s&&s.applicationNumber)return null!=e&&null!==(y=e.Licenses[0])&&void 0!==y&&null!==(S=y.businessService)&&void 0!==S&&S.includes("BPAREG")?(U({key:"success",action:_}),e.selectedAction=_,void f.push("/digit-ui/employee/obps/stakeholder-response",{data:e})):(U({key:"success",action:_}),void f.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(b=e.Licenses[0])||void 0===b?void 0:b.applicationNumber)));U({key:"success",action:_}),re&&setTimeout(re,3e3),setTimeout(K,5e3);try{const e=(G||"").toUpperCase(),t=((null==_?void 0:_.action)||"").toUpperCase();e.includes("DISCONNECT")&&(t.includes("APPROVE")||t.includes("EXECUTE")||t.includes("APPROVE_CONNECTION"))&&setTimeout(()=>{var e;null!==(e=window)&&void 0!==e&&e.location&&(window.location.href="https://mseva.lgpunjab.gov.in/employee/inbox")},3e3)}catch(e){}ue.clear(),ue.refetchQueries("APPLICATION_SEARCH")}}})),ce()}x(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(m({},e)));const a=function(){if(!1!==t&&j){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==j?void 0:j.mutateAsync(e)),a=p(function(){return x(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,o,i,r,s,u,c,d,m,v;x(!1);let p=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&o.code?E(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r||null===(s=r.Errors)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.code):(null==e||null===(c=e.response)||void 0===c||null===(d=c.data)||void 0===d||null===(m=d.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;ce(),U({key:"error",error:{message:p}}),setTimeout(K,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(u):u(a)}alert(E("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==q||null===(i=q.data)||void 0===i?void 0:i.timeline,businessService:G,workflowDetails:q,moduleCode:Q,blockReason:null==v||null===(s=v.BPA)||void 0===s?void 0:s.BlockReason}):null,I?l.createElement(Ho,{action:_,workflowDetails:q,businessService:G,isWarningPop:I,closeWarningPopup:()=>{L(!1)}}):null,l.createElement(Fo,{t:E,showToast:B,closeToast:K,businessService:G}),l.createElement("div",null,u?l.createElement(t.SubmitBar,{style:{marginRight:20},label:E("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return console.log("JJJJJJ",e),Promise.resolve(Digit.OBPSService.BPASearch(c,{applicationNo:null==W?void 0:W.applicationNo})).then(function(e){var t,n,l,a,o,i;const r=Digit.Utils.obps.calculateRiskType(null==R||null===(t=R.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==M||null===(n=M.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==M||null===(o=M.edcrDetails)||void 0===o||null===(i=o.planDetail)||void 0===i?void 0:i.blocks),s={BPA:e.BPA[0]};s.BPA.riskType=r,s.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null};const u=function(e,t,n,l,a,o,i,r,u,d,m,v){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==s||null===(e=s.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==s||null===(l=s.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null==s||null===(i=s.BPA)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(u=r.selfCertificationCharges)||void 0===u?void 0:u.BPA_WATER_CHARGES)+parseInt(null==s||null===(d=s.BPA)||void 0===d||null===(m=d.additionalDetails)||void 0===m||null===(v=m.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(s,c)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(E("Enterd Less Adjustment amount is invalid"))}();if(u&&u.then)return u.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0}):!(window.location.href.includes("citizen")&&window.location.href.includes("/pt/"))&&l.createElement(ko,{workflowDetails:q,displayMenu:y,onActionSelect:function(e){if(console.log("action====",e),console.log("applicationDetails===>",M),e){var t,n,l;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]),"PAY"==e.action&&window.location.href.includes("tl")&&f.push("/digit-ui/employee/payment/collect/"+M.applicationData.businessService+"/"+M.applicationData.applicationNumber),null!=e&&e.isToast)return console.log("➡️ isToast triggered — blocking action:",null==e?void 0:e.action,"message:",null==e?void 0:e.toastMessage),U({key:"error",error:{message:null==e?void 0:e.toastMessage}}),void setTimeout(K,5e3);if(null!=e&&e.isWarningPopUp)L(!0);else if(null!=e&&e.redirectionUrll){var a,o,i,r,s;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))f.push(""+(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(s=location)||void 0===s?void 0:s.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.action)){var u,c;f.push(""+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname),{data:null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.state})}else{var d;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))N(!0);else{var v,p;f.push({pathname:null===(v=e.redirectionUrl)||void 0===v?void 0:v.pathname,state:m({},null===(p=e.redirectionUrl)||void 0===p?void 0:p.state)})}else N(!0)}C(e),S(!1)},setDisplayMenu:S,businessService:G,forcedActionPrefix:Z,ActionBarStyle:J,MenuStyle:ee}))))},Wo=e=>l.createElement("h1",{className:"heading-m"},""+(0,e.t)(e.heading)),zo=()=>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"})),jo=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(zo,null)),qo=e=>{let t=e.title;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null," ",(0,e.t)("CONFIRM_DELETE_MSG")+" "," ",l.createElement("b",null," "+t)," "))},Yo=e=>{let n=e.t,a=e.docName,o=e.closeModal,i=e.actionCancelLabel,r=e.actionCancelOnSubmit,s=e.actionSaveLabel,u=e.actionSaveOnSubmit;return l.createElement(t.Modal,{headerBarMain:l.createElement(Wo,{t:n,heading:e.heading}),headerBarEnd:l.createElement(jo,{onClick:o}),actionCancelLabel:n(i),actionCancelOnSubmit:r,actionSaveLabel:n(s),actionSaveOnSubmit:u,formId:"modal-action"},l.createElement(qo,{t:n,title:a}))},Go=["uploadedFilesData"],Ko=["EDIT","DELETE"],Qo=()=>{var e,i,r,s,u,c,d,p,E,f,g,h,y,S,b,_,C,D;let N=window.Digit.Utils.browser.isMobile();const w=o.useParams().id,A=a.useTranslation().t,x=o.useHistory(),O=n.useState(!1),I=O[0],L=O[1],R=n.useState(!1),M=R[0],P=R[1],F=Digit.ULBService.getCurrentTenantId(),k=Digit.Hooks.events.useEventDetails(F,{ids:w},{}),B=k.isLoading,U=k.data,H=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_HAPPENED",!1)[1],V=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_ERROR_DATA",!1)[2],W=Digit.Hooks.useSessionStorage("EMPLOYEE_MSG_MUTATION_SUCCESS_DATA",!1)[2];return n.useEffect(()=>{H(!1),W(),V()},[]),B?l.createElement(t.Loader,null):l.createElement("div",null,I?l.createElement(Yo,{t:A,heading:"CONFIRM_DELETE_PUB_BRCST",docName:null==U||null===(e=U.applicationData)||void 0===e?void 0:e.name,closeModal:()=>L(!I),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){L(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:()=>{const e={events:[m({},v(null==U?void 0:U.applicationData,Go),{status:"CANCELLED"})]};x.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==U?void 0:U.tenantId))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},A("PUBLIC_BRDCST_TITLE_LABEL")+":")," ",l.createElement("p",null,null==U||null===(i=U.applicationData)||void 0===i?void 0:i.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!=U&&null!==(r=U.applicationData)&&void 0!==r&&null!==(s=r.description)&&void 0!==s&&s.length?null==U||null===(u=U.applicationData)||void 0===u?void 0:u.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!=U&&null!==(c=U.applicationData)&&void 0!==c&&null!==(d=c.eventDetails)&&void 0!==d&&d.fromDate?xe(new Date(null==U||null===(p=U.applicationData)||void 0===p||null===(E=p.eventDetails)||void 0===E?void 0:E.fromDate),"dd/MM/yyyy"):null)," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},A("EVENTS_TO_DATE_LABEL")+":")," ",l.createElement("p",null,null!=U&&null!==(f=U.applicationData)&&void 0!==f&&null!==(g=f.eventDetails)&&void 0!==g&&g.toDate?xe(new Date(null==U||null===(h=U.applicationData)||void 0===h||null===(y=h.eventDetails)||void 0===y?void 0:y.toDate),"dd/MM/yyyy"):null)," "),l.createElement("span",{className:"documentDetails_subheader"},""+A("CS_COMMON_DOCUMENTS")),null!=U&&null!==(S=U.applicationData)&&void 0!==S&&null!==(b=S.eventDetails)&&void 0!==b&&null!==(_=b.documents)&&void 0!==_&&_.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 n=e.fileStoreId,a=e.fileName;return l.createElement("div",{className:"documentDetails_pdf"},l.createElement("div",{style:{width:"100px"},onClick:()=>T(n,a)},l.createElement(t.GenericFileIcon,null),l.createElement("span",{className:"cell-text"},null==a?void 0:a.split(10))))})):null})(null==U||null===(C=U.applicationData)||void 0===C||null===(D=C.eventDetails)||void 0===D?void 0:D.documents):"NA")),l.createElement(t.ActionBar,null,M?l.createElement(t.Menu,{style:{width:N?"full":"240px"},localeKeyPrefix:"ES_CE",options:Ko,t:A,onSelect:function(e){"EDIT"===e&&x.push("/digit-ui/employee/engagement/messages/inbox/edit/"+w),"DELETE"===e&&L(!0),P(!1)}}):null,l.createElement(t.SubmitBar,{label:A("ES_COMMON_TAKE_ACTION"),onSubmit:()=>P(!M)})))},Xo=e=>{let n=e.match,a=(void 0===n?{}:n).path,i=e.tenants,r=e.parentRoute;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:a+"/create",component:e=>l.createElement(dt,e)}),l.createElement(t.PrivateRoute,{path:a+"/inbox/create",component:e=>l.createElement(dt,e)}),l.createElement(t.PrivateRoute,{path:a+"/inbox/details/:id",component:e=>l.createElement(Qo,e)}),l.createElement(t.PrivateRoute,{path:a+"/inbox/edit/:id",component:e=>l.createElement(pt,e)}),l.createElement(t.PrivateRoute,{path:a+"/inbox",component:e=>l.createElement(ut,m({},e,{tenants:i,parentRoute:r}))}),l.createElement(t.PrivateRoute,{path:a+"/response",component:e=>l.createElement(vt,e)}))},Zo=/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats-officedocument)$/i,$o=["header","actions","eventNotificationText","timePastAfterEventCreation","timeApproxiamationInUnits"],Jo=e=>{let t=e.header,n=e.actions,o=e.eventNotificationText,i=e.timePastAfterEventCreation,r=e.timeApproxiamationInUnits,s=v(e,$o);const u=a.useTranslation().t,c=s.eventDetails.documents;return l.createElement("div",{className:"WhatsNewCard"},l.createElement("h2",null,u(t)),l.createElement("p",null,o),null==n?void 0:n.map(e=>{return l.createElement("a",{href:null==e?void 0:e.actionUrl},""+u("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 a=t.fileName,o=t.fileStoreId;return l.createElement("div",{className:"display-flex-gap-2"},a.length?l.createElement("p",null,a," : "):null,o.length?l.createElement("span",{className:"link",onClick:()=>T(o,a)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,o.length?l.createElement("span",{className:"link",onClick:()=>N(o)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})):null)(u,c):((e,t)=>{if(null==t||!t.length)return null;const n=null==t?void 0:t[0],a=n.fileStoreId,o=n.fileName;return l.createElement("div",{className:"display-flex-gap-2"},a&&a.length?l.createElement("span",{className:"link",onClick:()=>T(a,o)}," ",e("CE_DOCUMENT_VIEW_LINK")," "):null,a&&a.length?l.createElement("span",{className:"link",onClick:()=>N(a)}," ",e("CE_DOCUMENT_DOWNLOAD_LINK")," "):null)})(u,c),l.createElement("p",null,i+" "+u(r)))},ei=e=>l.createElement("h1",{className:"heading-m"},e.label),ti=()=>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"})),ni=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ti,null)),li=()=>{const e=o.useParams().id,i=a.useTranslation().t,r=o.useHistory(),s=n.useState(!1),u=s[0],c=s[1],d=n.useState(!1),v=d[0],p=d[1],E=Digit.ULBService.getCurrentTenantId(),f=Digit.Hooks.events.useEventDetails(E,{ids:e}),g=f.isLoading,h=f.data,y=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_HAPPENED",!1)[1],S=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_ERROR_DATA",!1)[2],b=Digit.Hooks.useSessionStorage("EMPLOYEE_EVENT_MUTATION_SUCCESS_DATA",!1)[2];return n.useEffect(()=>{y(!1),b(),S()},[]),l.createElement(n.Fragment,null,l.createElement(t.Header,null,i("ES_TITLE_APPLICATION_DETAILS")),l.createElement(Vo,{applicationData:null==h?void 0:h.applicationData,applicationDetails:h,isLoading:g,isDataLoading:g}),l.createElement(t.ActionBar,null,v?l.createElement(t.Menu,{localeKeyPrefix:"ES_EVENT",options:["EDIT","DELETE"],t:i,onSelect:function(t){"EDIT"===t&&r.push("/digit-ui/employee/engagement/event/edit-event/"+e),"DELETE"===t&&c(!0),p(!1)}}):null,l.createElement(t.SubmitBar,{label:i("ES_COMMON_TAKE_ACTION"),onSubmit:()=>p(!v)})),u&&l.createElement(t.Modal,{headerBarMain:l.createElement(ei,{label:i("ES_EVENT_DELETE_POPUP_HEADER")}),headerBarEnd:l.createElement(ni,{onClick:()=>c(!1)}),actionCancelLabel:i("CS_COMMON_CANCEL"),actionCancelOnSubmit:()=>c(!1),actionSaveLabel:i("ES_EVENT_DELETE"),actionSaveOnSubmit:()=>{const e={events:[m({},null==h?void 0:h.applicationData,{status:"CANCELLED"})]};r.push("/digit-ui/employee/engagement/event/response?delete=true",e)}},l.createElement(t.Card,{style:{boxShadow:"none"}},l.createElement(t.CardText,null,i("ES_EVENT_DELETE_TEXT")))))},ai=e=>{let n=e.searchValue,a=e.onChange,o=e.handleKeyPress,i=e.handleSearch;return l.createElement("div",null,l.createElement(t.TextInput,{textInputStyle:{maxWidth:"960px"},className:"searchInput",placeholder:(0,e.t)("CE_SERACH_DOCUMENTS"),value:n,onChange:e=>a(e.target.value),signature:!0,signatureImg:l.createElement(t.SearchIconSvg,{className:"signature-img",onClick:()=>i()}),onKeyPress:o}))},oi=(e,t)=>{const l=n.useState(e),a=l[0],o=l[1];return n.useEffect(()=>{const n=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(n)}},[e,t]),a},ii=e=>{let n=e.documentTitle,a=e.documentSize,o=void 0===a?2.3:a,i=e.lastModifiedData,r=e.description,s=e.filestoreId,u=e.documentLink,c=e.t,d=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:""+(d?66:100),width:""+(d?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),o?l.createElement(t.CardCaption,null,w(o)):null),l.createElement("div",{className:"notice_and_circular_caption"},l.createElement(t.CardCaption,null,c("CE_DCOUMENT_UPLOADED_ON")+" "+(i?xe(new Date(i),"do MMMM yyyy"):"-"))),l.createElement("div",{className:"notice_and_circular_text"},l.createElement(t.CardText,null,null!=r&&r.length?r:"NA")),l.createElement("div",{className:"view_download_main"},s&&s.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>T(s||null,n)},l.createElement(t.ViewsIcon,null),l.createElement("p",null,c("CE_DOCUMENT_VIEW_LINK")))}):null,u&&u.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views",onClick:()=>D(u,n)},l.createElement(t.ExternalLinkIcon,null),l.createElement("p",null,c("CE_DOCUMENT_OPEN_LINK")))}):null,s&&s.length?l.createElement(t.LinkButton,{label:l.createElement("div",{className:"views download_views_padding"},l.createElement(t.DownloadImgIcon,null),l.createElement("p",null,c("CE_DOCUMENT_DOWNLOAD_LINK"))),onClick:()=>N(s||null)}):null)))},ri=(e,t)=>e.map((e,n)=>l.createElement(ii,{key:n,documentTitle:e.name,documentSize:e.fileSize,lastModifiedData:e.createdTime,description:e.description,documentLink:e.documentLink,filestoreId:e.filestoreId,t:t})),si=e=>{let n=e.t,a=e.title,o=e.count,i=e.onClick,r=e.children;const s=l.useState(!1),u=s[0],c=s[1];return l.createElement("div",{className:"accordion-wrapper",onClick:()=>i(a,o)},l.createElement("div",{className:"accordion-title "+(u?"open":""),onClick:()=>c(!u)},n(a)+" ("+o+")",l.createElement(t.PrevIcon,null)),l.createElement("div",{className:"accordion-item "+(u?"":"collapsed")},l.createElement("div",{className:"accordion-content"},r)))},ui=e=>{var a,i,r,s,u;let c=e.t;const d=o.useHistory(),m=n.useState(""),v=m[0],p=m[1],E=Digit.ULBService.getCitizenCurrentTenant(),f=oi(v,700),g=Digit.Hooks.engagement.useDocSearch({name:f,tenantIds:E},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let t=e.auditDetails;return{docId:e.uuid,name:e.name,category:e.category,description:e.description,documentLink:e.documentLink,createdTime:null==t?void 0:t.createdTime,fileSize:e.fileSize,filestoreId:e.filestoreId}}),statusCount:null==e?void 0:e.statusCount}}}),h=g.data,y=g.isLoading;if(null===(a=Digit.UserService)||void 0===a||null===(i=a.getUser())||void 0===i||!i.access_token)return l.createElement(Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:location.pathname+location.search}}});const S=(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(ai,{searchValue:v,handleKeyPress:e=>{"Enter"===e.key&&p("")},handleSearch:e=>{p("")},onChange:p,t:c}),l.createElement("hr",{style:{color:"#ccc"}}),y?l.createElement(t.Loader,null):l.createElement("div",{className:"wrapper"},v.length&&null!=h&&null!==(r=h.documentList)&&void 0!==r&&r.length?ri(h.documentList,c):null!=h&&h.statusCount&&null!=h&&null!==(s=h.statusCount)&&void 0!==s&&s.length?null==h||null===(u=h.statusCount)||void 0===u?void 0:u.map((e,t)=>l.createElement(si,{t:c,title:e.category,count:e.count,key:t,onClick:S})):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))))},ci=e=>{const n=a.useTranslation().t,o=Digit.Hooks.useQueryParams(),i=Digit.Hooks.engagement.useDocSearch({uuid:o.applicationNumber,tenantId:o.tenantId},{select:e=>{var t;return{documentList:null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let t=e.auditDetails;return{docId:e.uuid,name:e.name,category:e.category,description:e.description,documentLink:e.documentLink,createdTime:null==t?void 0:t.createdTime,fileSize:e.fileSize,filestoreId:e.filestoreId}}),statusCount:null==e?void 0:e.statusCount}}}),r=i.isLoading,s=(i.data||{}).documentList,u=void 0===s?[]:s,c=(null==u?void 0:u[0])||{},d=c.name,m=void 0!==d&&d,v=c.createdTime,p=c.description,E=c.documentLink,f=c.fileSize,g=c.filestoreId;return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,""+n("COMMON_VIEW_DOC")),r&&l.createElement(t.Loader,null),m&&l.createElement(ii,{key:1,documentTitle:m,documentSize:f,lastModifiedData:v,description:p,documentLink:E,filestoreId:g,t:n}),!m&&!r&&l.createElement(t.Card,null,l.createElement(t.CardCaption,null,n("COMMON_DOC_DATA_NOT_FOUND"))))},di=e=>{const n=a.useTranslation().t;return l.createElement(t.Banner,{message:n(e.mutation.isSuccess?"SURVEY_RESPONSE_SUBMITED":"SURVEY_RESPONSE_FAILED"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Surveys)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.uuid:""),info:e.mutation.isSuccess?e.surveyTitle:"",successful:e.mutation.isSuccess,whichSvg:"tick"});var o,i,r,s},mi=e=>{var i;const s=r.useQueryClient(),u=a.useTranslation().t,c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useSubmitResponse()),d=e.location.state,m=null==d||null===(i=d.AnswerEntity)||void 0===i?void 0:i.surveyTitle;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{s.clear()}})},[]),c.isLoading&&!c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(di,{t:u,mutation:c,surveyTitle:m}),l.createElement(t.CardText,null,c.isSuccess?u("SURVEY_FORM_RESPONSE_MESSAGE"):null),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen/engagement/surveys/list"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},vi=e=>{var r,s,u;const c=n.useRef(null),d=e.userType,v=o.useHistory(),p=a.useTranslation().t,E=Digit.UserService.getUser().info,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS");let g=f.filter(e=>{var t;return null==E||null===(t=E.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});const h="employee"===d.toLowerCase()?Digit.ULBService.getCurrentPermanentCity():localStorage.getItem("CITIZEN.CITY");if(0===(null===(r=g)||void 0===r?void 0:r.length)||"pb.punjab"===h){let e={i18nKey:"TENANT_TENANTS_"+h.replace(".","_").toUpperCase(),code:""+h};g="pb.punjab"===h?[e,...f]:[e]}const y=n.useState(!1),S=y[0],b=y[1],_=n.useState(null),C=_[0],T=_[1],D=n.useState([]),N=D[0],w=D[1],A={city:null===(s=g)||void 0===s?void 0:s[0],offset:0,limit:10,sortOrder:"DESC"},x=i.useForm({defaultValues:A}),O=x.register,I=x.control,L=x.handleSubmit,R=(0,x.watch)();n.useEffect(()=>{var e;const t=null===(e=c.current)||void 0===e?void 0:e.querySelector(".table");t&&(t.style.overflowX="auto",t.style.overflowY="hidden",t.style.WebkitOverflowScrolling="touch")},[]);const M=n.useMemo(()=>[{Header:p("Survey Name"),accessor:"suveyName",Cell:e=>l.createElement("div",null,l.createElement("span",null,e.row.original.surveyTitle))},{Header:p("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let a=e.row;return null!==(t=a.original)&&void 0!==t&&t.startDate?(e=>l.createElement("span",{className:"cell-text styled-cell"},e))(xe(new Date(null===(n=a.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:p("Fill Survey"),accessor:"fillSurvey",Cell:e=>{let n=e.row;return l.createElement(t.SubmitBar,{label:p("Start Survey"),onSubmit:()=>{F(n.original)}})}}]);function P(){var e;b(!0);const t={tenantId:null==R||null===(e=R.city)||void 0===e?void 0:e.code,active:!0,openSurveyFlag:!0};Digit.Surveys.searchSurvey(t).then(e=>{let t=e.Surveys.filter(e=>e.active);t=t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),w(t),T(t.length),b(!1)}).catch(e=>{b(!1)})}n.useEffect(()=>{P()},[]);const F=e=>{const t={employee:"/digit-ui/employee/engagement/surveys/fill-citizen-details-survey",citizen:"/digit-ui/citizen/engagement/surveys/fill-survey"}[d.toLowerCase()]||"";v.push({pathname:t,state:{surveyDetails:e,userInfo:E,userType:d}})};let k=Digit.Utils.browser.isMobile();return l.createElement("div",null,"pb.punjab"===h&&window.location.href.includes("/employee")?l.createElement(t.Card,{style:{marginTop:"16px",marginBottom:"16px",backgroundColor:"white",maxWidth:"99%"}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h1",{style:{fontSize:"20px"}}," Search Surveys ")),l.createElement("hr",{style:{marginTop:"10px"}}),l.createElement("form",{className:"search-form-wrapper rm-mb form-field-flex-one",onSubmit:L(P)},l.createElement(t.SearchField,null,l.createElement("label",null,p("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,m({rules:{required:p("REQUIRED_FIELD")}},O("city"),{render:e=>l.createElement(t.Dropdown,{option:g,optionKey:"i18nKey",selected:null==R?void 0:R.city,select:t=>{e.onChange(t)},t:p}),name:"city",control:I,defaultValue:null===(u=g)||void 0===u?void 0:u[0]}))),l.createElement("div",{className:"form-field",style:{marginTop:"40px"}}," ",l.createElement(t.SubmitBar,{label:"Search",submit:"submit",onSubmit:P})))):null,l.createElement("div",null,k?l.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},(null==N?void 0:N.length)>0?null==N?void 0:N.map((e,n)=>l.createElement(t.Card,{key:n,style:{padding:"12px",borderRadius:"8px",boxShadow:"0px 2px 6px rgba(0,0,0,0.1)"}},l.createElement("h3",{style:{fontSize:"16px",marginBottom:"8px"}},null==e?void 0:e.surveyTitle),l.createElement("p",{style:{margin:"4px 0"}},l.createElement("b",null,"Start:")," ",null!=e&&e.startDate?xe(new Date(null==e?void 0:e.startDate),"dd/MM/yyyy"):"NA"),l.createElement(t.SubmitBar,{label:p("Start Survey"),onSubmit:()=>F(e)}))):l.createElement(t.Card,null,p("No Questions found"))):l.createElement(t.Table,{t:p,data:N,totalRecords:C,columns:M,getCellProps:e=>({style:{minWidth:"300px",padding:"20px 18px",fontSize:"16px"}}),noResultsMessage:"No Questions found"})),S&&l.createElement(t.Loader,null))},pi=e=>l.createElement("h1",{className:"heading-m"},e.label),Ei=()=>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"})),fi=e=>l.createElement("div",{onClick:null==e?void 0:e.onClick,style:null!=e&&e.isMobileView?{padding:5,cursor:"pointer"}:{cursor:"pointer"}},null!=e&&e.isMobileView?l.createElement(t.CloseSvg,null):l.createElement("div",{className:"icon-bg-secondary",style:{backgroundColor:"#505A5F"}}," ",l.createElement(Ei,null)," ")),gi=e=>{let n=e.onSelect,o=e.onCancel,i=e.onDismiss,r=e.heading,s=e.actionCancel,u=e.content,c=e.hideSubmit;const d=a.useTranslation().t,m=l.useState(window.innerWidth<=780),v=m[0],p=m[1],E=()=>{window.innerWidth<=780?v||p(!0):v&&p(!1)};return l.useEffect(()=>(window.addEventListener("resize",()=>{E()}),()=>{window.addEventListener("resize",()=>{E()})})),v?l.createElement(t.Modal,{popupStyles:{height:"174px",maxHeight:"174px",width:"324px",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},popupModuleActionBarStyles:{display:"flex",flex:1,justifyContent:"flex-start",width:"100%",position:"absolute",left:0,bottom:0,padding:"18px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},popupModuleMianStyles:{padding:"18px"},headerBarMain:l.createElement(pi,{label:d(r)}),headerBarEnd:l.createElement(fi,{onClick:i,isMobileView:v}),actionCancelLabel:!!s&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{margin:0}}," ",u))):l.createElement(t.Modal,{popupModuleMianStyles:{paddingTop:"30px"},style:{padding:"10px",display:"flex",alignItems:"center",marginRight:"10px"},headerBarMain:l.createElement(pi,{label:d(r)}),headerBarEnd:l.createElement(fi,{onClick:i,isMobileView:!1}),actionCancelLabel:!!s&&d("OK"),actionCancelOnSubmit:o,actionSaveOnSubmit:n,formId:"modal-action",hideSubmit:c},l.createElement("div",null,l.createElement(t.CardText,{style:{marginBottom:"54px",marginLeft:"8px",marginRight:"8px"}},u)))},hi=e=>l.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:"#cfe6fa",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.3s ease"}},l.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",style:{transform:e.isOpen?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.3s ease"},xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M6 9L12 15L18 9",stroke:"#000000",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})));var yi=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){return[].slice.call(t.querySelectorAll("*"),0).reduce(function(t,n){return t.concat(n.shadowRoot?e(n.shadowRoot):[n])},[]).filter(a)};var n=/^(input|select|textarea|button|object|iframe)$/;function l(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;try{var n=window.getComputedStyle(e),l=n.getPropertyValue("display");return t?"contents"!==l&&function(e,t){return"visible"!==t.getPropertyValue("overflow")||e.scrollWidth<=0&&e.scrollHeight<=0}(e,n):"none"===l}catch(e){return console.warn("Failed to inspect element style"),!1}}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var a=isNaN(t);return(a||t>=0)&&function(e,t){var a=e.nodeName.toLowerCase();return(n.test(a)&&!e.disabled||"a"===a&&e.href||t)&&function(e){for(var t=e,n=e.getRootNode&&e.getRootNode();t&&t!==document.body;){if(n&&t===n&&(t=n.host.parentNode),l(t))return!1;t=t.parentNode}return!0}(e)}(e,!a)}e.exports=t.default});ft(yi);var Si=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){a=[]},t.log=function(){"production"!==process.env.NODE_ENV&&(console.log("focusManager ----------"),a.forEach(function(e){var t=e||{};console.log(t.nodeName,t.className,t.id)}),console.log("end focusManager ----------"))},t.handleBlur=r,t.handleFocus=s,t.markForFocusLater=function(){a.push(document.activeElement)},t.returnFocus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=null;try{return void(0!==a.length&&(t=a.pop()).focus({preventScroll:e}))}catch(e){console.warn(["You tried to return focus to",t,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){a.length>0&&a.pop()},t.setupScopedFocus=function(e){o=e,window.addEventListener?(window.addEventListener("blur",r,!1),document.addEventListener("focus",s,!0)):(window.attachEvent("onBlur",r),document.attachEvent("onFocus",s))},t.teardownScopedFocus=function(){o=null,window.addEventListener?(window.removeEventListener("blur",r),document.removeEventListener("focus",s)):(window.detachEvent("onBlur",r),document.detachEvent("onFocus",s))};var n,l=(n=yi)&&n.__esModule?n:{default:n},a=[],o=null,i=!1;function r(){i=!0}function s(){if(i){if(i=!1,!o)return;setTimeout(function(){o.contains(document.activeElement)||((0,l.default)(o)[0]||o).focus()},0)}}});ft(Si);var bi=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,l.default)(e);if(n.length){var a=void 0,o=t.shiftKey,i=n[0],r=n[n.length-1],s=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return t.activeElement.shadowRoot?e(t.activeElement.shadowRoot):t.activeElement}();if(e===s){if(!o)return;a=r}if(r!==s||o||(a=i),i===s&&o&&(a=r),a)return t.preventDefault(),void a.focus();var u=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null!=u&&"Chrome"!=u[1]&&null==/\biPod\b|\biPad\b/g.exec(navigator.userAgent)){var c=n.indexOf(s);if(c>-1&&(c+=o?-1:1),void 0===(a=n[c]))return t.preventDefault(),void(a=o?r:i).focus();t.preventDefault(),a.focus()}}else t.preventDefault()};var n,l=(n=yi)&&n.__esModule?n:{default:n};e.exports=t.default});ft(bi);var _i=function(){};if("production"!==process.env.NODE_ENV){var Ci=function(e,t){var n=arguments.length;t=new Array(n>1?n-1:0);for(var l=1;l<n;l++)t[l-1]=arguments[l];var a=0,o="Warning: "+e.replace(/%s/g,function(){return t[a++]});"undefined"!=typeof console&&console.error(o);try{throw new Error(o)}catch(e){}};_i=function(e,t,n){var l=arguments.length;n=new Array(l>2?l-2:0);for(var a=2;a<l;a++)n[a-2]=arguments[a];if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");e||Ci.apply(null,[t].concat(n))}}var Ti=_i,Di=gt(function(e){var t,n;n={canUseDOM:t=!("undefined"==typeof window||!window.document||!window.document.createElement),canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen},e.exports?e.exports=n:window.ExecutionEnvironment=n}),Ni=gt(function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=t.SafeNodeList=t.SafeHTMLCollection=void 0;var l=((n=Di)&&n.__esModule?n:{default:n}).default,a=l.canUseDOM?window.HTMLElement:{};t.SafeHTMLCollection=l.canUseDOM?window.HTMLCollection:{},t.SafeNodeList=l.canUseDOM?window.NodeList:{},t.canUseDOM=l.canUseDOM,t.default=a});ft(Ni);var wi=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){a&&(a.removeAttribute?a.removeAttribute("aria-hidden"):null!=a.length?a.forEach(function(e){return e.removeAttribute("aria-hidden")}):document.querySelectorAll(a).forEach(function(e){return e.removeAttribute("aria-hidden")})),a=null},t.log=function(){if("production"!==process.env.NODE_ENV){var e=a||{};console.log("ariaAppHider ----------"),console.log(e.nodeName,e.className,e.id),console.log("end ariaAppHider ----------")}},t.assertNodeList=o,t.setElement=function(e){var t=e;if("string"==typeof t&&Ni.canUseDOM){var n=document.querySelectorAll(t);o(n,t),t=n}return a=t||a},t.validateElement=i,t.hide=function(e){var t=!0,n=!1,l=void 0;try{for(var a,o=i(e)[Symbol.iterator]();!(t=(a=o.next()).done);t=!0)a.value.setAttribute("aria-hidden","true")}catch(e){n=!0,l=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw l}}},t.show=function(e){var t=!0,n=!1,l=void 0;try{for(var a,o=i(e)[Symbol.iterator]();!(t=(a=o.next()).done);t=!0)a.value.removeAttribute("aria-hidden")}catch(e){n=!0,l=e}finally{try{!t&&o.return&&o.return()}finally{if(n)throw l}}},t.documentNotReadyOrSSRTesting=function(){a=null};var n,l=(n=Ti)&&n.__esModule?n:{default:n},a=null;function o(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function i(e){var t=e||a;return t?Array.isArray(t)||t instanceof HTMLCollection||t instanceof NodeList?t:[t]:((0,l.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),[])}});ft(wi);var Ai=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){var e=document.getElementsByTagName("html")[0];for(var t in n)a(e,n[t]);var o=document.body;for(var i in l)a(o,l[i]);n={},l={}},t.log=function(){if("production"!==process.env.NODE_ENV){var e=document.getElementsByTagName("html")[0].className,t="Show tracked classes:\n\n";for(var a in t+="<html /> ("+e+"):\n ",n)t+=" "+a+" "+n[a]+"\n ";for(var o in t+="\n\ndoc.body ("+(e=document.body.className)+"):\n ",l)t+=" "+o+" "+l[o]+"\n ";t+="\n",console.log(t)}};var n={},l={};function a(e,t){e.classList.remove(t)}t.add=function(e,t){return a=e.classList,o="html"==e.nodeName.toLowerCase()?n:l,void t.split(" ").forEach(function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(o,e),a.add(e)});var a,o},t.remove=function(e,t){return a=e.classList,o="html"==e.nodeName.toLowerCase()?n:l,void t.split(" ").forEach(function(e){!function(e,t){e[t]&&(e[t]-=1)}(o,e),0===o[e]&&a.remove(e)});var a,o}});ft(Ai);var xi=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.log=function(){console.log("portalOpenInstances ----------"),console.log(l.openInstances.length),l.openInstances.forEach(function(e){return console.log(e)}),console.log("end portalOpenInstances ----------")},t.resetState=function(){l=new n};var n=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.register=function(e){-1===t.openInstances.indexOf(e)?(t.openInstances.push(e),t.emit("register")):"production"!==process.env.NODE_ENV&&console.warn("React-Modal: Cannot register modal instance that's already open")},this.deregister=function(e){var n=t.openInstances.indexOf(e);-1!==n?(t.openInstances.splice(n,1),t.emit("deregister")):"production"!==process.env.NODE_ENV&&console.warn("React-Modal: Unable to deregister "+e+" as it was never registered")},this.subscribe=function(e){t.subscribers.push(e)},this.emit=function(e){t.subscribers.forEach(function(n){return n(e,t.openInstances.slice())})},this.openInstances=[],this.subscribers=[]},l=new n;t.default=l});ft(xi),ft(gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.resetState=function(){for(var e=[a,o],t=0;t<e.length;t++){var n=e[t];n&&n.parentNode&&n.parentNode.removeChild(n)}a=o=null,i=[]},t.log=function(){console.log("bodyTrap ----------"),console.log(i.length);for(var e=[a,o],t=0;t<e.length;t++){var n=e[t]||{};console.log(n.nodeName,n.className,n.id)}console.log("edn bodyTrap ----------")};var n,l=(n=xi)&&n.__esModule?n:{default:n},a=void 0,o=void 0,i=[];function r(){0!==i.length?i[i.length-1].focusContent():"production"!==process.env.NODE_ENV&&console.warn("React-Modal: Open instances > 0 expected")}l.default.subscribe(function(e,t){a||o||((a=document.createElement("div")).setAttribute("data-react-modal-body-trap",""),a.style.position="absolute",a.style.opacity="0",a.setAttribute("tabindex","0"),a.addEventListener("focus",r),(o=a.cloneNode()).addEventListener("focus",r)),(i=t).length>0?(document.body.firstChild!==a&&document.body.insertBefore(a,document.body.firstChild),document.body.lastChild!==o&&document.body.appendChild(o)):(a.parentElement&&a.parentElement.removeChild(a),o.parentElement&&o.parentElement.removeChild(o))})}));var Oi=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var l=t[n];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}return function(t,n,l){return n&&e(t.prototype,n),l&&e(t,l),t}}(),i=p(on),r=v(Si),s=p(bi),u=v(wi),c=v(Ai),d=p(Ni),m=p(xi);function v(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function p(e){return e&&e.__esModule?e:{default:e}}var E={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},f=0,g=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setOverlayRef=function(e){n.overlay=e,n.props.overlayRef&&n.props.overlayRef(e)},n.setContentRef=function(e){n.content=e,n.props.contentRef&&n.props.contentRef(e)},n.afterClose=function(){var e=n.props,t=e.appElement,l=e.ariaHideApp,a=e.htmlOpenClassName,o=e.bodyOpenClassName,i=e.parentSelector,s=i&&i().ownerDocument||document;o&&c.remove(s.body,o),a&&c.remove(s.getElementsByTagName("html")[0],a),l&&f>0&&0==(f-=1)&&u.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(r.returnFocus(n.props.preventScroll),r.teardownScopedFocus()):r.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose(),m.default.deregister(n)},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(r.setupScopedFocus(n.node),r.markForFocusLater()),n.setState({isOpen:!0},function(){n.openAnimationFrame=requestAnimationFrame(function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen({overlayEl:n.overlay,contentEl:n.content})})}))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus({preventScroll:!0})},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())})},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){(function(e){return"Tab"===e.code||9===e.keyCode})(e)&&(0,s.default)(n.content,e),n.props.shouldCloseOnEsc&&function(e){return"Escape"===e.code||27===e.keyCode}(e)&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var l="object"===(void 0===t?"undefined":a(t))?t:{base:E[e],afterOpen:E[e]+"--after-open",beforeClose:E[e]+"--before-close"},o=l.base;return n.state.afterOpen&&(o=o+" "+l.afterOpen),n.state.beforeClose&&(o=o+" "+l.beforeClose),"string"==typeof t&&t?o+" "+t:o},n.attributesFromObject=function(e,t){return Object.keys(t).reduce(function(n,l){return n[e+"-"+l]=t[l],n},{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.Component),o(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){"production"!==process.env.NODE_ENV&&(e.bodyOpenClassName!==this.props.bodyOpenClassName&&console.warn('React-Modal: "bodyOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.'),e.htmlOpenClassName!==this.props.htmlOpenClassName&&console.warn('React-Modal: "htmlOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.')),this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer),cancelAnimationFrame(this.openAnimationFrame)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,l=e.htmlOpenClassName,a=e.bodyOpenClassName,o=e.parentSelector,i=o&&o().ownerDocument||document;a&&c.add(i.body,a),l&&c.add(i.getElementsByTagName("html")[0],l),n&&(f+=1,u.hide(t)),m.default.register(this)}},{key:"render",value:function(){var e=this.props,t=e.id,l=e.className,a=e.overlayClassName,o=e.defaultStyles,i=e.children,r=l?{}:o.content,s=a?{}:o.overlay;if(this.shouldBeClosed())return null;var u={ref:this.setOverlayRef,className:this.buildClassName("overlay",a),style:n({},s,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},c=n({id:t,ref:this.setContentRef,style:n({},r,this.props.style.content),className:this.buildClassName("content",l),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",n({modal:!0},this.props.aria)),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),d=this.props.contentElement(c,i);return this.props.overlayElement(u,d)}}]),t}();g.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},g.propTypes={isOpen:i.default.bool.isRequired,defaultStyles:i.default.shape({content:i.default.object,overlay:i.default.object}),style:i.default.shape({content:i.default.object,overlay:i.default.object}),className:i.default.oneOfType([i.default.string,i.default.object]),overlayClassName:i.default.oneOfType([i.default.string,i.default.object]),parentSelector:i.default.func,bodyOpenClassName:i.default.string,htmlOpenClassName:i.default.string,ariaHideApp:i.default.bool,appElement:i.default.oneOfType([i.default.instanceOf(d.default),i.default.instanceOf(Ni.SafeHTMLCollection),i.default.instanceOf(Ni.SafeNodeList),i.default.arrayOf(i.default.instanceOf(d.default))]),onAfterOpen:i.default.func,onAfterClose:i.default.func,onRequestClose:i.default.func,closeTimeoutMS:i.default.number,shouldFocusAfterRender:i.default.bool,shouldCloseOnOverlayClick:i.default.bool,shouldReturnFocusAfterClose:i.default.bool,preventScroll:i.default.bool,role:i.default.string,contentLabel:i.default.string,aria:i.default.object,data:i.default.object,children:i.default.node,shouldCloseOnEsc:i.default.bool,overlayRef:i.default.func,contentRef:i.default.func,id:i.default.string,overlayElement:i.default.func,contentElement:i.default.func,testId:i.default.string},t.default=g,e.exports=t.default});function Ii(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function Li(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function Ri(e,t){try{var n=this.props,l=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,l)}finally{this.props=n,this.state=l}}ft(Oi),Ii.__suppressDeprecationWarning=!0,Li.__suppressDeprecationWarning=!0,Ri.__suppressDeprecationWarning=!0;var Mi=gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var l=t[n];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}return function(t,n,l){return n&&e(t.prototype,n),l&&e(t,l),t}}(),o=m(l),i=m(s),r=m(on),u=m(Oi),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(wi),d=m(Ni);function m(e){return e&&e.__esModule?e:{default:e}}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var E=t.portalClassName="ReactModalPortal",f=t.bodyOpenClassName="ReactModal__Body--open",g=Ni.canUseDOM&&void 0!==i.default.createPortal,h=function(e){return document.createElement(e)},y=function(){return g?i.default.createPortal:i.default.unstable_renderSubtreeIntoContainer};function S(e){return e()}var b=function(e){function t(){var e,l,a;v(this,t);for(var r=arguments.length,s=Array(r),c=0;c<r;c++)s[c]=arguments[c];return l=a=p(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),a.removePortal=function(){!g&&i.default.unmountComponentAtNode(a.node);var e=S(a.props.parentSelector);e&&e.contains(a.node)?e.removeChild(a.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},a.portalRef=function(e){a.portal=e},a.renderPortal=function(e){var l=y()(a,o.default.createElement(u.default,n({defaultStyles:t.defaultStyles},e)),a.node);a.portalRef(l)},p(a,l)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.Component),a(t,[{key:"componentDidMount",value:function(){Ni.canUseDOM&&(g||(this.node=h("div")),this.node.className=this.props.portalClassName,S(this.props.parentSelector).appendChild(this.node),!g&&this.renderPortal(this.props))}},{key:"getSnapshotBeforeUpdate",value:function(e){return{prevParent:S(e.parentSelector),nextParent:S(this.props.parentSelector)}}},{key:"componentDidUpdate",value:function(e,t,n){if(Ni.canUseDOM){var l=this.props,a=l.isOpen,o=l.portalClassName;e.portalClassName!==o&&(this.node.className=o);var i=n.prevParent,r=n.nextParent;r!==i&&(i.removeChild(this.node),r.appendChild(this.node)),(e.isOpen||a)&&!g&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(Ni.canUseDOM&&this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return Ni.canUseDOM&&g?(!this.node&&g&&(this.node=h("div")),y()(o.default.createElement(u.default,n({ref:this.portalRef,defaultStyles:t.defaultStyles},this.props)),this.node)):null}}],[{key:"setAppElement",value:function(e){c.setElement(e)}}]),t}();b.propTypes={isOpen:r.default.bool.isRequired,style:r.default.shape({content:r.default.object,overlay:r.default.object}),portalClassName:r.default.string,bodyOpenClassName:r.default.string,htmlOpenClassName:r.default.string,className:r.default.oneOfType([r.default.string,r.default.shape({base:r.default.string.isRequired,afterOpen:r.default.string.isRequired,beforeClose:r.default.string.isRequired})]),overlayClassName:r.default.oneOfType([r.default.string,r.default.shape({base:r.default.string.isRequired,afterOpen:r.default.string.isRequired,beforeClose:r.default.string.isRequired})]),appElement:r.default.oneOfType([r.default.instanceOf(d.default),r.default.instanceOf(Ni.SafeHTMLCollection),r.default.instanceOf(Ni.SafeNodeList),r.default.arrayOf(r.default.instanceOf(d.default))]),onAfterOpen:r.default.func,onRequestClose:r.default.func,closeTimeoutMS:r.default.number,ariaHideApp:r.default.bool,shouldFocusAfterRender:r.default.bool,shouldCloseOnOverlayClick:r.default.bool,shouldReturnFocusAfterClose:r.default.bool,preventScroll:r.default.bool,parentSelector:r.default.func,aria:r.default.object,data:r.default.object,role:r.default.string,contentLabel:r.default.string,shouldCloseOnEsc:r.default.bool,overlayRef:r.default.func,contentRef:r.default.func,id:r.default.string,overlayElement:r.default.func,contentElement:r.default.func},b.defaultProps={isOpen:!1,portalClassName:E,bodyOpenClassName:f,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(e,t){return o.default.createElement("div",e,t)},contentElement:function(e,t){return o.default.createElement("div",e,t)}},b.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},function(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,l=null,a=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?l="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(l="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?a="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(a="UNSAFE_componentWillUpdate"),null!==n||null!==l||null!==a)throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+(e.displayName||e.name)+" uses "+("function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()")+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==l?"\n "+l:"")+(null!==a?"\n "+a:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks");if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=Ii,t.componentWillReceiveProps=Li),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=Ri;var o=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){o.call(this,e,t,this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n)}}}(b),"production"!==process.env.NODE_ENV&&(b.setCreateHTMLElement=function(e){return h=e}),t.default=b});ft(Mi);var Pi=ft(gt(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n,l=(n=Mi)&&n.__esModule?n:{default:n};t.default=l.default,e.exports=t.default}));const Fi=e=>{let t=e.page;return l.createElement("div",{className:"chb-loader-container "+(void 0!==t&&t?"chb-page-loader-overlay":"chb-module-loader-container")},l.createElement("div",{className:"chb-spinner"}))};Fi.propTypes={page:on.bool},Fi.defaultProps={page:!1};const ki=["pwdExpiryDate","createdDate","lastModifiedDate"],Bi=[{name:"Male",code:"MALE"},{name:"Female",code:"FEMALE"},{name:"Transgender",code:"TRANSGENDER"}],Ui=e=>{let o=e.showTermsPopupOwner,r=e.setShowTermsPopupOwner;const s=a.useTranslation().t,u=Digit.UserService.getUser(),c=(window.location.href.includes("citizen")?window.localStorage.getItem("CITIZEN.CITY"):window.localStorage.getItem("Employee.tenant-id"),n.useState(!1)),d=c[0],E=c[1],f=n.useState(null),g=f[0],h=f[1],y=(n.useState(),n.useState()),S=y[0],b=y[1],_=()=>{r(!1)},C=window.innerWidth<=640,T=i.useForm(),D=T.control,N=T.handleSubmit,w=T.formState.errors,A={modal:{width:"100%",height:"100%",top:"0",position:"relative",backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",justifyContent:"center",alignItems:"center"},modalOverlay:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.7)",zIndex:9999},modalContent:{backgroundColor:"#FFFFFF",padding:"2rem",borderRadius:"0.5rem",maxWidth:"800px",margin:"auto",fontFamily:"Roboto, serif",overflowX:"hidden",textAlign:"justify",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.2)",maxHeight:C?"47vh":"80vh",overflowY:"auto",lineHeight:"2"}};return(0,T.watch)("startDate"),console.log("user",null==u?void 0:u.info),console.log("getUserDetails",S),n.useEffect(()=>{!function(){try{var e;const t=null==u||null===(e=u.info)||void 0===e?void 0:e.uuid,n=function(){var e;if(t)return E(!0),Promise.resolve(Digit.UserService.userSearch(null==u||null===(e=u.info)||void 0===e?void 0:e.tenantId,{uuid:[t]},{})).then(function(e){var t;E(!1),b(null==e||null===(t=e.user)||void 0===t?void 0:t[0])})}();Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},[]),l.createElement("div",null,l.createElement(Pi,{isOpen:o,onRequestClose:_,contentLabel:"Self-Declaration",style:{modal:A.modal,overlay:A.modalOverlay,content:A.modalContent}},S&&l.createElement("form",{className:"employeeCard",onSubmit:N(function(e){try{var t;E(!0),console.log("data==",e);const l={};null!=e&&null!==(t=e.gender)&&void 0!==t&&t.code&&(l.gender=e.gender.code);const a=(n=null!=e&&e.dob?e.dob:null==S?void 0:S.dob)?"number"==typeof n?n:"string"==typeof n?new Date(n+"T00:00:00").getTime():null:null;a&&(l.dob=a);const o=m({},v(S||{},ki),l);console.log("userData",o);const i=p(function(){var e;return Promise.resolve(Digit.UserService.updateUser(o,null==u||null===(e=u.info)||void 0===e?void 0:e.tenantId)).then(function(e){h({label:"Profile has been updated successfully",isDleteBtn:"true"}),E(!1),setTimeout(()=>{_(),window.location.reload()},2e3)})},function(e){E(!1),console.log("erroe",e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}var n})},l.createElement("div",{className:"card"},!(null!=S&&S.gender)&&l.createElement("div",{className:"label-field-pair chb-margin-top-20"},l.createElement(t.CardLabel,null,s("CORE_COMMON_GENDER")," ",l.createElement("span",{className:"mandatory-asterisk"},"*")),l.createElement("div",{className:"form-field w-fullwidth"},l.createElement(i.Controller,{control:D,name:"gender",rules:{required:s("gender is required")},render:e=>l.createElement(t.Dropdown,{option:Bi,optionKey:"name",id:"name",select:e.onChange,selected:e.value,placeholder:s("CORE_COMMON_GENDER")})}),w.gender&&l.createElement("p",{className:"chb-error-text"},w.gender.message))),!(null!=S&&S.dob)&&l.createElement("div",{className:"label-field-pair chb-margin-top-20"},l.createElement(t.CardLabel,null,s("CORE_COMMON_DOB")," ",l.createElement("span",{className:"mandatory-asterisk"},"*")),l.createElement("div",{className:"form-field w-fullwidth"},l.createElement(i.Controller,{control:D,name:"dob",rules:{required:"DOB is required",validate:e=>(e=>{if(!e)return!1;const t=new Date,n=new Date(e),l=t.getFullYear()-n.getFullYear(),a=t.getMonth()-n.getMonth();return a<0||0===a&&t.getDate()<n.getDate()?l-1>=18:l>=18})(e)||"Minimum age should be 18 years"},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},t:s,max:(new Date).toISOString().split("T")[0]})}),w.dob&&l.createElement("p",{className:"chb-error-text"},w.dob.message)))),g&&l.createElement(t.Toast,{label:s(g.label),isDleteBtn:g.isDleteBtn,error:g.error,onClose:()=>{h(null)},warning:g.warning,isWarningButtons:g.isWarningButtons,style:{padding:"16px"}}),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{className:"submit-bar-back",label:"Cancel",onSubmit:()=>_()}),l.createElement(t.SubmitBar,{label:"Submit",submit:"submit"})))),d&&l.createElement(Fi,{page:!0}))},Hi=e=>{var r,s,u,c,d,v,p,E,f,g;const h=a.useTranslation().t,y=n.useState({}),S=y[0],b=y[1],_=o.useParams(),C=decodeURIComponent(_.uuid),T=n.useState(!1),D=T[0],N=T[1],w=Digit.Hooks.useTenants().data,A=n.useState(null),x=A[0],O=A[1],I=n.useState(!1),L=I[0],R=I[1],M=(null===(r=Digit.UserService.getUser())||void 0===r?void 0:r.info)||{},P=n.useState(!1),F=P[0],k=P[1],B=n.useState(),U=B[0],H=B[1],V=n.useState(null),W=V[0],z=V[1],j=n.useState(!1),q=j[0],Y=j[1],G=n.useState(),K=G[0],Q=G[1],X=Digit.ULBService.getCurrentTenantId(),Z=e.location.state;let $=null==Z?void 0:Z.surveyDetails;const J=n.useState(null),ee=J[0],te=J[1],ne=n.useState({}),le=ne[0],ae=ne[1],oe=n.useState(null),ie=oe[0],re=oe[1],se=n.useState(null),ue=se[0],ce=se[1],de=n.useState({}),me=de[0],ve=de[1],pe=e.userType,Ee=o.useHistory(),fe=n.useState(!1),ge=fe[0],he=fe[1],ye=n.useRef({});n.useEffect(()=>{try{return R(!0),Promise.resolve(Digit.LocationService.getLocalities("pb.testing")).then(function(e){var t,n,l;R(!1);let a=[];e&&(null===(t=e.TenantBoundary)||void 0===t?void 0:t.length)>0&&(R(!0),a=Digit.LocalityService.get(e.TenantBoundary[0]),R(!1));const o=null===(n=a||[])||void 0===n||null===(l=n.map(e=>{const t=e.name.match(/Ward\s(\d+)/);return m({},e,{wardNumber:t?Number(t[1]):Infinity})}))||void 0===l?void 0:l.sort((e,t)=>e.wardNumber-t.wardNumber);z(o)})}catch(e){Promise.reject(e)}},[x]),n.useEffect(()=>{!function(){try{const e=function(e){var t;if("EMPLOYEE"===(null==M||null===(e=M.type)||void 0===e?void 0:e.toUpperCase()))return R(!0),Promise.resolve(Digit.LocationService.getLocalities(null===(t=Z.citizenData.city)||void 0===t?void 0:t.code)).then(function(e){var t;R(!1);let n=[];e&&(null===(t=e.TenantBoundary)||void 0===t?void 0:t.length)>0&&(R(!0),n=Digit.LocalityService.get(e.TenantBoundary[0]),R(!1)),z(n)})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[]);const Se=i.useForm({defaultValues:S}).register;$=m({},$,{sections:null===(s=$)||void 0===s||null===(u=s.sections)||void 0===u||null===(c=u.sort((e,t)=>e.sectionOrder-t.sectionOrder))||void 0===c?void 0:c.map(e=>{var t,n;return m({},e,{questions:null==e||null===(t=e.questions)||void 0===t||null===(n=t.sort((e,t)=>e.qorder-t.qorder))||void 0===n?void 0:n.map(e=>m({},e,{question:m({},e.question,{options:e.question.options.sort((e,t)=>(null==e?void 0:e.optionOrder)-(null==t?void 0:t.optionOrder))})}))})})});const be=function(e){try{var t,n,l;R(!0);let a={surveyUuid:$.uuid,citizenId:M.uuid,tenantId:null===x&&null!==(t=window.location.href)&&void 0!==t&&t.includes("/employee")?null==Z||null===(n=Z.citizenData)||void 0===n||null===(l=n.city)||void 0===l?void 0:l.code:x};try{Digit.Surveys.getAnswers(a).then(t=>{var n;if(R(!1),(null==t||null===(n=t.sectionResponses)||void 0===n?void 0:n.length)>0){let n={};return t.sectionResponses.forEach(e=>{let t={};e.questionResponses.forEach(n=>{t[n.questionUuid]=m({},S[e.sectionUuid][n.questionUuid],{answerUuid:n.answerUuid})}),n[e.sectionUuid]=t}),b(n),void("draft"===e?Te():De())}"draft"===e?Te():De()})}catch(e){return R(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}};n.useEffect(()=>{!function(){try{var e,t,n;R(!0);let a={surveyUuid:$.uuid||C,citizenId:M.uuid,tenantId:null==x?null!==(e=window.location.href)&&void 0!==e&&e.includes("/employee")?null==Z||null===(t=Z.citizenData)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code:localStorage.getItem("CITIZEN.CITY"):x};try{Digit.Surveys.getAnswers(a).then(e=>{var t,n;if(Q(e),R(!1),(null==e||null===(t=e.sectionResponses)||void 0===t?void 0:t.length)>0){var a;if("Draft"==e.status&&(k(!1),"CITIZEN"===(null==M||null===(a=M.type)||void 0===a?void 0:a.toUpperCase())&&_e()),"Submit"===e.status)return k(!0),Y(!0),void he(l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"This Survey is already submitted. Cannot be Re-submitted"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to go back"),l.createElement("button",{onClick:()=>{var e;return"CITIZEN"===(null==M||null===(e=M.type)||void 0===e?void 0:e.toUpperCase())?Ee.push("/digit-ui/citizen/engagement/surveys/active-open-surveys"):Ee.push("/digit-ui/employee/engagement/surveys/active-open-surveys")},style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Go Back")));let t={};return e.sectionResponses.forEach(e=>{let n={};e.questionResponses.forEach(e=>{n[e.questionUuid]={answer:e.answerResponse.answerDetails[0].answerContent,answerUuid:e.answerUuid,comments:e.comments,weightage:e.answerResponse.answerDetails[0].weightage}}),t[e.sectionUuid]=n}),void b(t)}"CITIZEN"===(null==M||null===(n=M.type)||void 0===n?void 0:n.toUpperCase())&&_e()})}catch(e){return R(!1),Promise.resolve(e)}Promise.resolve()}catch(e){return Promise.reject(e)}}()},[$.uuid,null==M?void 0:M.uuid]);const _e=function(){try{return R(!0),Digit.Surveys.userSearch({uuid:[null==M?void 0:M.uuid],tenantId:null==M?void 0:M.tenantId},{tenantId:null==M?void 0:M.tenantId}).then(e=>{var t,n,l,a,o,i,r;if(R(!1),("200"===(null==e||null===(t=e.responseInfo)||void 0===t?void 0:t.status)||"201"===(null==e||null===(n=e.responseInfo)||void 0===n?void 0:n.status))&&(null==e||null===(l=e.user)||void 0===l?void 0:l.length)>0)if(null===(null==e||null===(a=e.user[0])||void 0===a?void 0:a.gender)||null===(null==e||null===(o=e.user[0])||void 0===o?void 0:o.dob)||""===(null==e||null===(i=e.user[0])||void 0===i?void 0:i.gender)||""===(null==e||null===(r=e.user[0])||void 0===r?void 0:r.dob))te(!1);else{var s;const t=new Date,n=new Date(null==e||null===(s=e.user[0])||void 0===s?void 0:s.dob);let l=t.getFullYear()-n.getFullYear();const a=t.getMonth()-n.getMonth();if((a<0||0===a&&t.getDate()<n.getDate())&&l--,l<15||l>100)return te(!1),void alert("Citizen age must be between 15 and 100 years.");te(!0)}else re({key:!0,isError:!0,label:"ERROR FILE FETCHING CITIZEN DETAILS"})}).catch(e=>(R(!1),e)),Promise.resolve()}catch(e){return Promise.reject(e)}},Ce=(e,t,n,l,a,o)=>{b(i=>{var r;return m({},i,{[e]:m({},i[e],{[t]:m({},null==i||null===(r=i[e])||void 0===r?void 0:r[t],{answer:a,answerUuid:o,answerType:n,weightage:"MULTIPLE_ANSWER_TYPE"===n||"CHECKBOX_ANSWER_TYPE"===n||"DROP_DOWN_MENU_ANSWER_TYPE"===n?l:null})})})})};n.useEffect(()=>{const e=setInterval(()=>{JSON.stringify(ye.current)!==JSON.stringify(S)&&(Z.citizenFill&&"employee"===pe.toLowerCase()||"citizen"===pe.toLowerCase())&&(ye.current=S,ue&&be("draft"))},1e4);return()=>clearInterval(e)},[S]);const Te=function(){try{var e,t,n,l,a,o,i,r,s,u,c,d,m,v,p;R(!0);let f=[];for(const e in S)for(const t in S[e]){var E;f.push({uuid:S[e][t].answerUuid,surveyUuid:$.uuid,questionUuid:t,sectionUuid:e,comments:(null===(E=S[e][t])||void 0===E?void 0:E.comments)||"",answerDetails:[{answerType:S[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===S[e][t].answerType?S[e][t].answer.join(","):S[e][t].answer,weightage:S[e][t].weightage}]})}let g={User:{type:M.type,uuid:M.uuid,gender:"EMPLOYEE"===(null==M||null===(e=M.type)||void 0===e?void 0:e.toUpperCase())?null==Z||null===(t=Z.citizenData)||void 0===t?void 0:t.gender:null==Z?void 0:Z.userInfo.gender,emailId:"EMPLOYEE"===(null==M||null===(n=M.type)||void 0===n?void 0:n.toUpperCase())?null==Z||null===(l=Z.citizenData)||void 0===l?void 0:l.email:null==Z?void 0:Z.userInfo.emailId,dob:"EMPLOYEE"===(null==M||null===(a=M.type)||void 0===a?void 0:a.toUpperCase())?null==Z||null===(o=Z.citizenData)||void 0===o?void 0:o.dob:null==Z?void 0:Z.userInfo.dob},SurveyResponse:{surveyUuid:$.uuid,tenantId:null===x?null!==(i=window.location.href)&&void 0!==i&&i.includes("/employee")?null==Z||null===(r=Z.citizenData)||void 0===r||null===(s=r.city)||void 0===s?void 0:s.code:localStorage.getItem("CITIZEN.CITY"):x,city:null===x?null!==(u=window.location.href)&&void 0!==u&&u.includes("/employee")?null==Z||null===(c=Z.citizenData)||void 0===c||null===(d=c.city)||void 0===d?void 0:d.code:localStorage.getItem("CITIZEN.CITY"):x,locality:ue,tenantId:null===x?null!==(m=window.location.href)&&void 0!==m&&m.includes("/employee")?null==Z||null===(v=Z.citizenData)||void 0===v||null===(p=v.city)||void 0===p?void 0:p.code:localStorage.getItem("CITIZEN.CITY"):x,status:"Draft",answers:f}};try{Digit.Surveys.submitSurvey(g).then(e=>{var t;R(!1),void 0!==(null==e?void 0:e.SubmitResponse)||re({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)})})}catch(e){return R(!1),Promise.resolve(e)}return Promise.resolve()}catch(e){return Promise.reject(e)}},De=()=>{var e,t,n,l,a,o,i,r,s,u,c,d;R(!0);let m=[];for(const e in S)for(const t in S[e]){var v,p,E,f;m.push({uuid:S[e][t].answerUuid,surveyUuid:$.uuid,questionUuid:t,sectionUuid:e,comments:(null===(v=S[e][t])||void 0===v?void 0:v.comments)||"",tenantId:null!==(p=window.location.href)&&void 0!==p&&p.includes("/employee")?null==Z||null===(E=Z.citizenData)||void 0===E||null===(f=E.city)||void 0===f?void 0:f.code:localStorage.getItem("CITIZEN.CITY"),answerDetails:[{answerType:S[e][t].answerType,answerContent:"CHECKBOX_ANSWER_TYPE"===S[e][t].answerType?S[e][t].answer.join(","):S[e][t].answer,weightage:S[e][t].weightage}]})}let g={User:{type:M.type,uuid:M.uuid,gender:"EMPLOYEE"===(null==M||null===(e=M.type)||void 0===e?void 0:e.toUpperCase())?null==Z||null===(t=Z.citizenData)||void 0===t?void 0:t.gender:null==Z?void 0:Z.userInfo.gender,emailId:"EMPLOYEE"===(null==M||null===(n=M.type)||void 0===n?void 0:n.toUpperCase())?null==Z||null===(l=Z.citizenData)||void 0===l?void 0:l.email:M.emailId,dob:"EMPLOYEE"===(null==M||null===(a=M.type)||void 0===a?void 0:a.toUpperCase())?null==Z||null===(o=Z.citizenData)||void 0===o?void 0:o.dob:null==Z?void 0:Z.userInfo.dob},SurveyResponse:{surveyUuid:$.uuid,status:"Submit",comments:U,locality:ue,tenantId:null===x?null!==(i=window.location.href)&&void 0!==i&&i.includes("/employee")?null==Z||null===(r=Z.citizenData)||void 0===r||null===(s=r.city)||void 0===s?void 0:s.code:localStorage.getItem("CITIZEN.CITY"):x,city:null===x?null!==(u=window.location.href)&&void 0!==u&&u.includes("/employee")?null==Z||null===(c=Z.citizenData)||void 0===c||null===(d=c.city)||void 0===d?void 0:d.code:localStorage.getItem("CITIZEN.CITY"):x,answers:m}};try{Digit.Surveys.submitSurvey(g).then(e=>{var t;R(!1),void 0===(null==e?void 0:e.SubmitResponse)?re({key:!0,isError:!0,label:""+(null==e||null===(t=e.Errors)||void 0===t?void 0:t.message)}):"EMPLOYEE"===(null==pe?void 0:pe.toUpperCase())?Ee.push("/digit-ui/employee/engagement/surveys/submit-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0}):Ee.push("/digit-ui/citizen/engagement/surveys/submit-survey-response",{message:"SURVEY FORM SUBMITTED SUCCESSFULLY",response:e,isSuccess:!0})})}catch(e){return R(!1),e}};n.useEffect(()=>{if(K){const e=null!=K&&K.tenantId?null==K?void 0:K.tenantId:localStorage.getItem("CITIZEN.CITY");e&&O(e)}},[K]);const Ne=e=>{ce(e.target.value)};function we(){var e;Y(!1),"CITIZEN"===(null==M||null===(e=M.type)||void 0===e?void 0:e.toUpperCase())?Ee.push("/digit-ui/citizen/engagement/surveys/active-open-surveys"):Ee.push("/digit-ui/employee/engagement/surveys/active-open-surveys")}n.useEffect(()=>{K&&ce(null==K?void 0:K.locality)},[K]);const Ae=1===(null===(d=$.sections)||void 0===d?void 0:d.length);return!0===F&&q?l.createElement(gi,{onSelect:function(){Y(!1)},onCancel:we,onDismiss:we,heading:"Survey already Submitted!",actionCancel:!1,content:ge,hideSubmit:!0}):"EMPLOYEE"===(null==M||null===(v=M.type)||void 0===v?void 0:v.toUpperCase())||null!=Z&&Z.citizenFill||"CITIZEN"===(null==M||null===(p=M.type)||void 0===p?void 0:p.toUpperCase())&&!0===ee?l.createElement("div",{style:{background:"#f7f7f7"},className:"employeeCard surveyCardSection"},l.createElement("div",{style:{background:"#ffffff"},className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"16px",fontWeight:"bold",color:"#00769a"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"#6b6565"}},$.surveyTitle)),$.surveyDescription&&l.createElement("h2",{style:{fontSize:"16px",fontWeight:"bold",color:"#00769a"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"#6b6565"}},$.surveyDescription))),"EMPLOYEE"===(null==M||null===(E=M.type)||void 0===E?void 0:E.toUpperCase())?l.createElement(n.Fragment,null,l.createElement(t.CardLabel,null,""+h("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:ue,onChange:e=>{Ne(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==W&&l.createElement(n.Fragment,null,W.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),me&&me.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me?void 0:me.locality.answerRequired)):l.createElement(n.Fragment,null,l.createElement("div",{style:{width:"70%"}},l.createElement(t.CardLabel,null,""+h("CITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:x,onChange:e=>{(e=>{O(e.target.value)})(e)},disabled:"pb.punjab"!==localStorage.getItem("CITIZEN.CITY")},l.createElement("option",{value:""},"--Please choose a city--"),w.map((e,t)=>l.createElement("option",{key:t,value:e.code},null==e?void 0:e.name))),me&&me.city&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me?void 0:me.city.answerRequired)),l.createElement("div",{style:{width:"70%"}},l.createElement(t.CardLabel,null,""+h("LOCALITY")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement("select",{id:"dropdown",value:ue,onChange:e=>{Ne(e)}},l.createElement("option",{value:""},"--Please choose a locality--"),null!==x&&null!==W&&l.createElement(n.Fragment,null,W.map((e,t)=>l.createElement("option",{key:t,value:e.name},null==e?void 0:e.name)))),me&&me.locality&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me?void 0:me.locality.answerRequired))),l.createElement("form",{className:"engagementForm",onSubmit:e=>{e.preventDefault(),Z.citizenFill&&"employee"===(null==M?void 0:M.type).toLowerCase()||"citizen"===(null==M?void 0:M.type).toLowerCase()?(()=>{var e,t,n,l;const a={};if(null===(e=$)||void 0===e||null===(t=e.sections)||void 0===t||t.forEach(e=>{null==e||e.questions.forEach(t=>{var n,l;const o=null===(n=S[e.uuid])||void 0===n?void 0:n[t.question.uuid||""];var i,r,s;t.required&&(null==(null==o?void 0:o.answer)||""===(null==o?void 0:o.answer)||Array.isArray(null==o?void 0:o.answer)&&0===(null==o?void 0:o.answer.length))&&(a[e.uuid]=m({},a[e.uuid],{[t.question.uuid]:m({},null===(i=a[e.uuid])||void 0===i?void 0:i[t.question.uuid],{answerRequired:"This field is required *"})})),"string"==typeof(null==o?void 0:o.answer)&&o.answer.length>500&&(a[e.uuid]=m({},a[e.uuid],{[t.question.uuid]:m({},null===(r=a[e.uuid])||void 0===r?void 0:r[t.question.uuid],{answerLength:"Answer length allowed only to 500 characters*"})})),(null==o||null===(l=o.comments)||void 0===l?void 0:l.length)>500&&(a[e.uuid]=m({},a[e.uuid],{[t.question.uuid]:m({},null===(s=a[e.uuid])||void 0===s?void 0:s[t.question.uuid],{commentsLength:"Comments length allowed only to 500 characters*"})}))})}),ue&&""!==ue||(a.locality={answerRequired:"Please select your locality"}),"CITIZEN"===(null==M||null===(n=M.type)||void 0===n?void 0:n.toUpperCase())&&null===x&&(a.city={answerRequired:"Please select your city"}),ve(a),Object.keys(a).length>0){const e=Object.keys(a),t={};e.forEach(e=>{t[e]=!0}),ae(e=>m({},e,t))}return 0===(null===(l=Object.keys(a))||void 0===l?void 0:l.length)})()&&be("submit"):re({key:!0,isError:!0,label:"PLEASE FILL CITIZEN DETAILS"})}},(null===(f=$.sections)||void 0===f?void 0:f.length)>0?$.sections.map(e=>l.createElement("div",{key:e.uuid,style:{marginBottom:"20px"}},l.createElement("div",{style:{display:"flex",justifyContent:" space-between",alignItems:"center",cursor:"pointer",background:"rgb(101 183 182 / 19%)",padding:" 10px",borderRadius:"10px"},onClick:()=>{var t;Ae||(t=e.uuid,ae(e=>m({},e,{[t]:!e[t]})))}},l.createElement("h2",{style:{margin:0,width:"fit-content"}},e.title),l.createElement(hi,{isOpen:le[e.uuid]})),(Ae||le[e.uuid])&&l.createElement("div",{style:{padding:"10px 0"}},e.questions.map((a,o)=>l.createElement("div",{key:a.questionUuid},l.createElement("div",{style:{marginTop:"15px"},className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},o+1,". ",a.question.questionStatement,(null==a?void 0:a.required)&&l.createElement("span",{style:{color:"red"}}," *")),((e,a,o)=>{var i,r,s,u,c,d,v,p,E,f,g,y,_,C,T,D,N,w,A,x,O,I,L,R,M,P,F,k,B,U,H,V,W,z,j,q,Y,G,K,Q,X,Z,$,J,ee,te,ne,le,ae,oe,ie,re,se,ue,ce,de,ve,pe,Ee,fe,ge,he,ye,be,_e,Te;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,textInputStyle:{maxWidth:"none"},value:null===(i=S[o.uuid])||void 0===i||null===(r=i[a.uuid])||void 0===r?void 0:r.answer,onChange:e=>{var t,n;return Ce(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=S[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},type:"text",inputRef:Se({maxLength:{value:200,message:h("EXCEEDS_200_CHAR_LIMIT")},required:a.required})}),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(s=me[o.uuid])||void 0===s||null===(u=s[a.uuid])||void 0===u?void 0:u.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(c=me[o.uuid])||void 0===c||null===(d=c[a.uuid])||void 0===d?void 0:d.answerRequired),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(v=me[o.uuid])||void 0===v||null===(p=v[a.uuid])||void 0===p?void 0:p.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(E=me[o.uuid])||void 0===E||null===(f=E[a.uuid])||void 0===f?void 0:f.answerLength));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},value:null===(g=S[o.uuid])||void 0===g||null===(y=g[a.uuid])||void 0===y?void 0:y.answer,onChange:e=>{var t,n;return Ce(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=S[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)},inputRef:Se({maxLength:{value:500,message:h("EXCEEDS_500_CHAR_LIMIT")},required:a.required})}),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(_=me[o.uuid])||void 0===_||null===(C=_[a.uuid])||void 0===C?void 0:C.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(T=me[o.uuid])||void 0===T||null===(D=T[a.uuid])||void 0===D?void 0:D.answerRequired),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(N=me[o.uuid])||void 0===N||null===(w=N[a.uuid])||void 0===w?void 0:w.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(A=me[o.uuid])||void 0===A||null===(x=A[a.uuid])||void 0===x?void 0:x.answerLength));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:null===(O=S[o.uuid])||void 0===O||null===(I=O[a.uuid])||void 0===I?void 0:I.answer,onChange:e=>{var t,n;const l=a.options.find(t=>t.optionText===e.target.value);Ce(o.uuid,a.uuid,a.type,(null==l?void 0:l.weightage)||0,e.target.value,null===(t=S[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(L=me[o.uuid])||void 0===L||null===(R=L[a.uuid])||void 0===R?void 0:R.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"-20px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(M=me[o.uuid])||void 0===M||null===(P=M[a.uuid])||void 0===P?void 0:P.answerRequired),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(F=me[o.uuid])||void 0===F||null===(k=F[a.uuid])||void 0===k?void 0:k.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(B=me[o.uuid])||void 0===B||null===(U=B[a.uuid])||void 0===U?void 0:U.answerLength));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"16px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,checked:(null===(t=S[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answer)===e.optionText,onChange:t=>{var n,l;return Ce(o.uuid,a.uuid,a.type,e.weightage,t.target.value,null===(n=S[o.uuid])||void 0===n||null===(l=n[a.uuid])||void 0===l?void 0:l.answerUuid)},style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText)}),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(H=me[o.uuid])||void 0===H||null===(V=H[a.uuid])||void 0===V?void 0:V.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(W=me[o.uuid])||void 0===W||null===(z=W[a.uuid])||void 0===z?void 0:z.answerRequired),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(j=me[o.uuid])||void 0===j||null===(q=j[a.uuid])||void 0===q?void 0:q.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(Y=me[o.uuid])||void 0===Y||null===(G=Y[a.uuid])||void 0===G?void 0:G.answerLength)));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>{var t,n,i;return l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"16px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,checked:(null===(t=S[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n||null===(i=n.answer)||void 0===i?void 0:i.includes(e.optionText))||!1,onChange:t=>{const n=t.target.value,l=t.target.checked;b(t=>{var i,r,s,u,c,d;const v=l?[...(null===(i=t[o.uuid])||void 0===i||null===(r=i[a.uuid])||void 0===r?void 0:r.answer)||"",n]:((null===(s=t[o.uuid])||void 0===s||null===(u=s[a.uuid])||void 0===u?void 0:u.answer)||"").filter(e=>e!==n);return m({},t,{[o.uuid]:m({},t[o.uuid],{[a.uuid]:{answer:v,answerUuid:null===(c=S[o.uuid])||void 0===c||null===(d=c[a.uuid])||void 0===d?void 0:d.answerUuid,answerType:a.type,weightage:e.weightage}})})})}}),e.optionText)}),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(K=me[o.uuid])||void 0===K||null===(Q=K[a.uuid])||void 0===Q?void 0:Q.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(X=me[o.uuid])||void 0===X||null===(Z=X[a.uuid])||void 0===Z?void 0:Z.answerRequired),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===($=me[o.uuid])||void 0===$||null===(J=$[a.uuid])||void 0===J?void 0:J.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(ee=me[o.uuid])||void 0===ee||null===(te=ee[a.uuid])||void 0===te?void 0:te.answerLength)));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},value:null===(ne=S[o.uuid])||void 0===ne||null===(le=ne[a.uuid])||void 0===le?void 0:le.answer,onChange:e=>{var t,n;return Ce(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=S[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(ae=me[o.uuid])||void 0===ae||null===(oe=ae[a.uuid])||void 0===oe?void 0:oe.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"-20px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(ie=me[o.uuid])||void 0===ie||null===(re=ie[a.uuid])||void 0===re?void 0:re.answerRequired),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(se=me[o.uuid])||void 0===se||null===(ue=se[a.uuid])||void 0===ue?void 0:ue.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(ce=me[o.uuid])||void 0===ce||null===(de=ce[a.uuid])||void 0===de?void 0:de.answerLength));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},value:null===(ve=S[o.uuid])||void 0===ve||null===(pe=ve[a.uuid])||void 0===pe?void 0:pe.answer,onChange:e=>{var t,n;return Ce(o.uuid,a.uuid,a.type,null,e.target.value,null===(t=S[o.uuid])||void 0===t||null===(n=t[a.uuid])||void 0===n?void 0:n.answerUuid)}}),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(Ee=me[o.uuid])||void 0===Ee||null===(fe=Ee[a.uuid])||void 0===fe?void 0:fe.answerRequired)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(ge=me[o.uuid])||void 0===ge||null===(he=ge[a.uuid])||void 0===he?void 0:he.answerRequired),me&&(null==me?void 0:me[o.uuid])&&(null==me||null===(ye=me[o.uuid])||void 0===ye||null===(be=ye[a.uuid])||void 0===be?void 0:be.answerLength)&&l.createElement(t.CardLabelError,{style:{marginTop:"0px",marginBottom:"0px",color:"red",fontWeight:"500"}},null==me||null===(_e=me[o.uuid])||void 0===_e||null===(Te=_e[a.uuid])||void 0===Te?void 0:Te.answerLength));default:return l.createElement(t.TextInput,{name:a.uuid,onChange:e=>Ce(o.uuid,a.uuid,e.target.value),type:"text",inputRef:Se({maxLength:{value:200,message:h("EXCEEDS_200_CHAR_LIMIT")},required:a.required})})}})(a.question.type,a.question,e),me[a.questionUuid]&&l.createElement("span",{className:"error"},me[a.questionUuid]))))))):null,l.createElement("div",null," Add Suggestions/Comments"),l.createElement(t.TextArea,{name:"comment",maxLength:500,onChange:e=>{var t;H(null==e||null===(t=e.target)||void 0===t?void 0:t.value)},style:{maxWidth:"none",marginBottom:"0px"},inputRef:Se()}),l.createElement("button",{type:"submit",style:{marginTop:"20px"}},"Submit"))),ie&&l.createElement(t.Toast,{error:ie.isError,label:h(ie.label),onClose:()=>{re(null)},isDleteBtn:"false"})):"CITIZEN"===(null==M||null===(g=M.type)||void 0===g?void 0:g.toUpperCase())&&!1===ee?l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("h3",{style:{color:"red",fontSize:"20px"}},"Please fill in your basic details to proceed with the survey"),l.createElement("h4",{style:{fontSize:"16px"}},"Click on below button to fill in your details"),l.createElement("button",{onClick:()=>{N(!0)},style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",marginTop:"10px"}},"Fill your details : Name, Gender, DOB are required"),L&&l.createElement(t.Loader,null),D&&l.createElement(Ui,{showTermsPopupOwner:D,setShowTermsPopupOwner:N,getData:[],tenantId:X})):null},Vi=e=>{var n,o;const i=a.useTranslation().t;return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Wi=e=>{const n=a.useTranslation().t;return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Vi,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},zi=e=>{let n=e.location;const o=a.useTranslation().t,i=[{path:"/digit-ui/citizen",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/citizen",content:o("Survey"),show:!!n.pathname.includes("/engagement")}];return l.createElement(t.BreadCrumb,{crumbs:i})},ji=e=>{let n=e.path,i=e.userType;const r=o.useLocation(),s=a.useTranslation().t,u=Digit.ComponentRegistryService.getComponent("NotificationsAndWhatsNew"),c=Digit.ComponentRegistryService.getComponent("EventsListOnGround"),d=Digit.ComponentRegistryService.getComponent("EventDetails"),v=Digit.ComponentRegistryService.getComponent("DocumentList"),p=Digit.ComponentRegistryService.getComponent("SurveyList"),E=(Digit.ComponentRegistryService.getComponent("FillSurvey"),Digit.ComponentRegistryService.getComponent("ShowSurvey")),f=window.location.href.includes("/response"),g=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{className:"engagement-citizen-wrapper"},f?null:l.createElement("div",{style:window.location.href.includes("application-overview")||g?{marginLeft:"10px"}:{}},l.createElement(zi,{location:r})),l.createElement(o.Switch,null,l.createElement(o.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(c,{variant:"events",parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/events/details/:id",component:()=>l.createElement(d,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/docs",component:()=>l.createElement(ui,{t:s,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/viewDocument",component:()=>l.createElement(ci,{t:s,path:n})}),l.createElement(t.PrivateRoute,{path:n+"/documents/list/:category/:count",component:e=>l.createElement(v,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/list",component:e=>l.createElement(p,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-response",component:e=>l.createElement(mi,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/show-survey",component:e=>l.createElement(E,e)}),l.createElement(t.PrivateRoute,{path:n+"/surveys/active-open-surveys",component:e=>l.createElement(vi,m({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/fill-survey",component:e=>l.createElement(Hi,m({},e,{userType:i}))}),l.createElement(t.PrivateRoute,{path:n+"/surveys/submit-survey-response",component:e=>l.createElement(Wi,e)}))))},qi=[{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:""}]}]}],Yi=()=>{const e=a.useTranslation().t,i=o.useHistory(),r=n.useState(!1),s=r[0],u=r[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:qi,onSubmit:e=>{var t,n,l,a,o,r,s,u;const c={name:e.documentName,description:null!=e&&e.description.length?e.description:"",category:null===(t=e.docCategory)||void 0===t?void 0:t.name,documentLink:null===(n=e.document)||void 0===n?void 0:n.documentLink,filestoreId:null===(l=e.document)||void 0===l||null===(a=l.filestoreId)||void 0===a?void 0:a.fileStoreId,fileSize:null===(o=e.document)||void 0===o||null===(r=o.filestoreId)||void 0===r?void 0:r.fileSize,fileType:null===(s=e.document)||void 0===s||null===(u=s.filestoreId)||void 0===u?void 0:u.fileType,tenantIds:e.ULB.map(e=>e.code)};i.push("/digit-ui/employee/engagement/documents/response",{DocumentEntity:c})},fieldStyle:{},onFormValueChange:(e,t,n)=>{var l;null!=t&&t.documentName&&null!=t&&t.docCategory&&(null!=t&&t.document.filestoreId||null!=t&&t.document.documentLink)&&null!=t&&null!==(l=t.ULB)&&void 0!==l&&l.length?u(!0):u(!1)},isDisabled:!s}))},Gi=[{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:""}]}]}],Ki=e=>{var i;const r=a.useTranslation().t,s=o.useHistory(),u=n.useState(!1),c=u[0],d=u[1],v=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?d(!0):d(!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:Gi,onSubmit:t=>{(t=>{var n,l,a,o,i,r,u,c,d,v,p,E,f,g,h,y,S,b,_;const C=null!==(n=t.document)&&void 0!==n&&null!==(l=n.filestoreId)&&void 0!==l&&l.fileSize?null===(a=t.document)||void 0===a||null===(o=a.filestoreId)||void 0===o?void 0:o.fileSize:null===(i=e.location.state)||void 0===i||null===(r=i.DocumentEntity)||void 0===r?void 0:r.fileSize,T=null!==(u=t.document)&&void 0!==u&&null!==(c=u.filestoreId)&&void 0!==c&&c.fileType?null===(d=t.document)||void 0===d||null===(v=d.filestoreId)||void 0===v?void 0:v.fileType:null===(p=e.location.state)||void 0===p||null===(E=p.DocumentEntity)||void 0===E?void 0:E.fileType,D=m({},null===(f=e.location)||void 0===f||null===(g=f.state)||void 0===g?void 0:g.DocumentEntity,{name:t.documentName,description:null!=t&&t.description.length?t.description:"",category:null===(h=t.docCategory)||void 0===h?void 0:h.name,filestoreId:null===(y=t.document)||void 0===y||null===(S=y.filestoreId)||void 0===S?void 0:S.fileStoreId,fileSize:C,fileType:T,documentLink:null===(b=t.document)||void 0===b?void 0:b.documentLink,tenantId:null==t||null===(_=t.ULB)||void 0===_?void 0:_.code});delete D.ULB,delete D.docCategory,delete D.documentName,s.push("/digit-ui/employee/engagement/documents/update-response",{DocumentEntity:D})})(t)},fieldStyle:{},onFormValueChange:v,defaultValues:null===(i=e.location.state)||void 0===i?void 0:i.DocumentEntity,isDisabled:!c}))},Qi=e=>{const n=a.useTranslation().t;return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_CREATED":"ENGAGEMENT_DOC_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,s},Xi=e=>{const i=r.useQueryClient(),s=a.useTranslation().t,u=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocCreate()),c=e.location.state;return n.useEffect(()=>{u.mutate(c,{onSuccess:()=>{i.clear()}})},[]),u.isLoading||u.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Qi,{t:s,data:u.data,mutation:u,isSuccess:u.isSuccess,isLoading:u.isIdle||u.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},Zi=e=>{const n=a.useTranslation().t;return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_DOC_UPDATED":"ENGAGEMENT_DOC_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess?null===(i=o.data)||void 0===i||null===(r=i.Documents)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.uuid:""),info:e.isSuccess?n("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess});var o,i,r,s},$i=e=>{const i=r.useQueryClient(),s=a.useTranslation().t,u=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocUpdate()),c=e.location.state;return n.useEffect(()=>{u.mutate(c,{onSuccess:()=>{i.clear()}})},[]),u.isLoading||u.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Zi,{t:s,data:u.data,mutation:u,isSuccess:u.isSuccess,isLoading:u.isIdle||u.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},Ji=e=>{var n;const o=a.useTranslation().t;return l.createElement(t.Banner,{message:o(e.isSuccess?"ENGAGEMENT_DOC_DELETED":"ENGAGEMENT_DOC_DELETE_FAILURE"),applicationNumber:null!==(n=e.mutation)&&void 0!==n&&n.isSuccess?e.uuid:"",info:e.isSuccess?o("ENGAGEMENT_DOCUMENT_ID"):"",successful:e.isSuccess})},er=e=>{var i;const s=r.useQueryClient(),u=a.useTranslation().t,c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.engagement.useDocDelete()),d=e.location.state;return n.useEffect(()=>{c.mutate(d,{onSuccess:()=>{s.clear()}})},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Ji,{t:u,data:c.data,mutation:c,uuid:null==d||null===(i=d.DocumentEntity)||void 0===i?void 0:i.uuid,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:u("CORE_COMMON_GO_TO_HOME")}))))},tr=e=>l.createElement(t.Table,{t:e.t,data:e.data,columns:e.columns,onSearch:e.onSearch,globalSearch:e.globalSearch,manualGlobalFilter:!0,manualPagination:!0,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,pageSizeLimit:e.pageSizeLimit,onPageSizeChange:e.onPageSizeChange,getCellProps:e.getCellProps,totalRecords:e.totalRecords,onSort:e.onSort,sortParams:e.sortParams}),nr=e=>{let a=e.onSearch,o=e.searchFields,r=e.type,s=e.onClose,u=e.isInboxPage,c=e.t;const d=i.useForm({defaultValues:e.searchParams}),v=d.handleSubmit,p=d.formState,E=d.reset,f=d.control,g=innerWidth<=640,h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),y=Digit.ULBService.getCurrentTenantId(),b=Digit.UserService.getUser().info,_=h.filter(e=>{var t;return null==b||null===(t=b.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(S),C=n.useMemo(()=>h.filter(e=>e.code===y),[y,h]),T=()=>{E({name:"",ulbs:{code:y.code},postedBy:""}),a({name:"",ulbs:{code:y.code},postedBy:""})},D=e=>l.createElement(t.LinkLabel,{style:m({display:"inline"},e?{margin:0}:{}),onClick:T},c("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:v(e=>{a(e),"mobile"===r&&s()})},l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:u?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||g)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,c("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(u?"":"for-search"),style:{width:"100%",display:"grid"}},null==o?void 0:o.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,c(e.label)+" "+(e.isMendatory?"*":"")),(e=>{switch(e.type){case"ulb":return l.createElement(i.Controller,{rules:{required:!0},defaultValue:null==C?void 0:C[0],render:e=>l.createElement(t.Dropdown,{option:_,optionKey:"i18nKey",selected:e.value,select:e.onChange,t:c}),name:e.name,control:f});default:return l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:f,defaultValue:null})}})(e)),null!=p&&null!==(a=p.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==p||null===(o=p.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),"desktop"===r&&!g&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:c("ES_COMMON_SEARCH"),submit:!0})),"desktop"===r&&!g&&l.createElement("div",{className:"document-clear-all"},D())))),("mobile"===r||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(p.errors).length,label:c("ES_COMMON_SEARCH"),style:{flex:1},submit:!0})))},lr=e=>{let o=e.type,i=void 0===o?"desktop":o,r=e.onClose,s=e.onFilterChange,u=e.searchParams;const c=a.useTranslation().t,d=n.useState(()=>m({},u)),v=d[0],p=d[1],E=Digit.ULBService.getCurrentTenantId(),f=null==E?void 0:E.split(".")[0],g=Digit.ULBService.getCurrentUlb(),h=Digit.Hooks.engagement.useMDMS(f,"DocumentUploader",["UlbLevelCategories"],{select:e=>{var t,n,l;return(null==e||null===(t=e.DocumentUploader)||void 0===t||null===(n=t.UlbLevelCategories)||void 0===n||null===(l=n.filter)||void 0===l?void 0:l.call(n,e=>e.ulb===g.code))[0].categoryList.map(e=>({category:e}))}}),y=h.data,S=()=>{p({category:null,name:null,postedBy:null}),s({category:null,name:null,postedBy:null}),null==r||r()};return h.isLoading?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:S},c("ES_COMMON_CLEAR_ALL")),"desktop"===i&&l.createElement("span",{className:"clear-search",onClick:S},l.createElement(t.RefreshIcon,null)),"mobile"===i&&l.createElement("span",{onClick:r},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"filter-label"},""+c("DOCUMENTS_CATEGORY_CARD_LABEL")),l.createElement(t.Dropdown,{option:y,optionKey:"category",selected:v,select:e=>{p(m({},v,e))},t:c}),l.createElement("div",null,l.createElement(t.SubmitBar,{style:{width:"100%"},onSubmit:()=>(s(v),void(null==r||r())),label:c("ES_COMMON_APPLY")}))))},ar=e=>l.createElement("span",{className:"cell-text styled-cell"},e),or=e=>{let n=e.isLoading,a=e.data,i=e.t,r=e.onSearch,s=e.title,u=e.iconName,c=e.links,d=e.onSort,m=e.sortParams,v=e.globalSearch,p=e.searchFields,E=e.searchParams,f=e.onFilterChange,g=e.pageSizeLimit,h=e.totalRecords,y=e.currentPage,S=e.onNextPage,b=e.onPrevPage,_=e.onPageSizeChange;const C=l.useMemo(()=>[{Header:i("CE_TABLE_DOCUMENT_NAME"),accessor:e=>function(e,t,n){return void 0===e&&(e=""),l.createElement("span",{className:"document-table-docs-columns"},l.createElement(o.Link,{className:"link",to:t},e.length?e:n("CE_DOCUMENT_TITLE")))}(null==e?void 0:e.name,(e=>({pathname:"inbox/details/"+e.name,state:{details:e}}))(e),i)},{Header:i("DOCUMENTS_CATEGORY_CARD_LABEL"),accessor:e=>ar(null!=e&&e.category?i(""+(null==e?void 0:e.category)):"")},{Header:i("CE_TABLE_DOCUMENT_LINK"),accessor:e=>function(e,t,n,a){return void 0===e&&(e="mSeva"),l.createElement("span",{className:"document-table-docs-columns"},null!=t&&t.length?l.createElement("span",{className:"link",onClick:()=>T(t,e)}," ",a("CE_DOCUMENT_VIEW_LINK")," "):null,n.length?l.createElement("span",{className:"link",onClick:()=>D(n,e)}," ",a("CE_DOCUMENT_OPEN_LINK")," "):null)}(null==e?void 0:e.name,e.filestoreId,e.documentLink||"",i)},{Header:i("CE_TABLE_DOCUMENT_POSTED_BY"),accessor:e=>ar(e.postedBy)}],[]);let N;return n?N=l.createElement(t.Loader,null):a&&0!==(null==a?void 0:a.length)?(null==a?void 0:a.length)>0&&(N=l.createElement(tr,{t:i,data:a,columns:C,onSort:d,sortParams:m,globalSearch:v,onSearch:E,pageSizeLimit:g,totalRecords:h,currentPage:y,onNextPage:S,onPrevPage:b,onPageSizeChange:_,getCellProps:e=>({style:{minWidth:e.column.Header===i("CE_TABLE_DOCUMENT_NAME")?"240px":"",padding:"20px 18px",fontSize:"16px"}})})):N=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},i("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},i("NEW_DOCUMENT_TEXT"))),l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Ue,{title:s,icon:u,links:c}),l.createElement("div",null,l.createElement(lr,{onFilterChange:f,searchParams:E}))),l.createElement("div",{style:{flex:1}},l.createElement(nr,{t:i,onSearch:r,type:"desktop",searchFields:p,isInboxPage:!0,searchParams:E}),l.createElement("div",{className:"result",style:{marginLeft:"24px",flex:1}},N)))},ir=e=>{let a=e.searchFields,i=e.searchParams,r=e.onFilterChange,s=e.onSearch,u=e.t,c=e.data,d=e.responseData;const m=n.useState(""),v=m[0],p=m[1],E=n.useState(!1),f=E[0],g=E[1],h=n.useState(i),y=h[0],S=h[1],_=(Digit.ULBService.getCurrentTenantId(),o.useHistory());n.useEffect(()=>{v&&g(!0)},[v]);const C=()=>{g(!1),S(i)};let T;return 0===(null==c?void 0:c.length)?T=l.createElement(t.Card,{style:{marginTop:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},u("CE_DOCUMENTS_NOT_FOUND"),l.createElement("br",null),l.createElement(o.Link,{className:"link",to:"/digit-ui/employee/engagement/documents/inbox/new-doc"},u("NEW_DOCUMENT_TEXT"))):c&&(null==c?void 0:c.length)>0&&(T=l.createElement(t.DetailsCard,{data:c,handleSelect:()=>{},handleDetailCardClick:e=>{const t=null==d?void 0:d.find(t=>b(t.postedBy,e["Posted By"])&&b(t.name,e["Document Name"]));t&&_.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"},s&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{p("SEARCH"),g(!0)}}),l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{p("FILTER"),g(!0)}})),T,f&&l.createElement(t.PopUp,null,"FILTER"===v&&l.createElement("div",{className:"popup-module"},l.createElement(lr,{onFilterChange:r,onClose:C,onSearch:s,type:"mobile",searchParams:y})),"SEARCH"===v&&l.createElement("div",{className:"popup-module"},l.createElement(nr,{t:u,type:"mobile",onClose:C,onSearch:s,searchParams:i,searchFields:a}))))},rr=e=>{let t=e.data,n=e.t,a=e.searchFields,o=e.searchParams,i=e.onFilterChange,r=e.onSearch,s=e.isLoading;return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement(Ue,{title:e.title,icon:e.iconName,links:e.links}),l.createElement(ir,{t:n,data:null==t?void 0:t.filter(e=>{var t,n,l,a,i,r,s,u;return(!((null==o||null===(t=o.tenantIds)||void 0===t?void 0:t.length)>0)||(null==o||null===(n=o.tenantIds)||void 0===n?void 0:n.includes(e.tenantId)))&&(null==o||!o.name||(null===(l=e.name)||void 0===l?void 0:l.toUpperCase().startsWith(null==o||null===(a=o.name)||void 0===a?void 0:a.toUpperCase())))&&(null==o||!o.postedBy||(null===(i=e.postedBy)||void 0===i||null===(r=i.trim())||void 0===r?void 0:r.toLowerCase())===(null==o||null===(s=o.postedBy)||void 0===s||null===(u=s.trim())||void 0===u?void 0:u.toLowerCase()))&&(null==o||!o.category||e.category===(null==o?void 0:o.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=>{T(e.filestoreId,e.name)}},n("CE_DOCUMENT_VIEW_LINK")):null,null!=e&&e.documentLink?l.createElement("div",{className:"link",onClick:t=>{D(e.documentLink,e.name)}},n("CE_DOCUMENT_OPEN_LINK")):null),[n("CE_TABLE_DOCUMENT_POSTED_BY")]:null==e?void 0:e.postedBy})),onFilterChange:i,isLoading:s,onSearch:r,searchParams:o,searchFields:a,responseData:t}))))},sr=e=>{let o=e.tenants;const i=a.useTranslation().t;Digit.SessionStorage.set("ENGAGEMENT_TENANTS",o);const r=Digit.ULBService.getCurrentTenantId(),s=n.useState({tenantIds:r,offset:0,limit:10}),u=s[0],c=s[1];let d=window.Digit.Utils.browser.isMobile();const v=Digit.Hooks.engagement.useDocSearch(u,{select:e=>({documentsList:e.Documents,totalCount:e.totalCount})}),p=v.data,E=v.isLoading,f=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,o=e.name,i=e.postedBy;c(e=>m({},e,{name:o,postedBy:i,tenantIds:a}))},g=e=>{c(t=>m({},t,e))},h=n.useCallback(()=>{c(e=>m({},e,{offset:parseInt(null==e?void 0:e.offset)+parseInt(null==e?void 0:e.limit)}))},[]);n.useEffect(()=>{c(e=>m({},e,{tenantIds:r}))},[r]);const y=()=>[{label:i("LABEL_FOR_ULB"),name:"ulbs",type:"ulb"},{label:i("DOCUMENTS_DOCUMENT_HEADER"),name:"name"},{label:i("CE_TABLE_DOCUMENT_POSTED_BY"),name:"postedBy"}],S=[{text:i("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/inbox/new-doc"}];return d?l.createElement(rr,{data:null==p?void 0:p.documentsList,searchParams:u,searchFields:y(),t:i,onFilterChange:g,onSearch:f,isLoading:E,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:S}):l.createElement("div",null,l.createElement(t.Header,null,i("DOCUMENTS_DOCUMENT_HEADER"),Number(null==p?void 0:p.totalCount)?l.createElement("p",{className:"inbox-count"},Number(null==p?void 0:p.totalCount)):null),l.createElement(or,{t:i,isLoading:E,data:null==p?void 0:p.documentsList,links:S,searchParams:u,onSearch:f,searchFields:y(),onFilterChange:g,pageSizeLimit:null==u?void 0:u.limit,totalRecords:null==p?void 0:p.totalCount,title:"DOCUMENTS_DOCUMENT_HEADER",iconName:"document",links:S,currentPage:parseInt(u.offset/u.limit),onNextPage:h,onPrevPage:()=>{c(e=>m({},e,{offset:parseInt(null==e?void 0:e.offset)-parseInt(null==e?void 0:e.limit)}))},onPageSizeChange:e=>{c(t=>m({},t,{limit:e.target.value}))}}))},ur=e=>{let n=e.header,o=e.about,i=e.activeTime,r=e.postedAt,s=e.responseStatus,u=e.onCardClick;const c=a.useTranslation().t;return l.createElement("div",{className:"WhatsNewCard",onClick:u},l.createElement("h2",null,n),l.createElement("p",null,o),l.createElement("div",{className:"surveyListclockDiv"},l.createElement(t.Clock,null)," ",l.createElement("span",null,"Active till "+xe(new Date(i),"do MMM HH:mm"))),l.createElement("div",{className:"surveyListstatus"},l.createElement("p",null,function(e,t){return f(1,arguments),Le(e,Date.now(),t)}(new Date(r),{addSuffix:!0})),l.createElement("span",{className:"CS_SURVEY_RESPONDED"===s?"surveyLisResponded":"surveyLisNotResponded"},c(s))))},cr=(e,t)=>{const n=(new Date).getTime();return e<n&&n<=t},dr=["EDIT_DOCUMENT","DELETE"],mr=e=>{var o;let i=e.location,r=e.history,s=window.Digit.Utils.browser.isMobile();const u=a.useTranslation().t,c=(null==i?void 0:i.state).details,d=l.useState(!1),v=d[0],p=d[1],E=n.useState(!1),f=E[0],g=E[1],h=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentUlb()),y=Digit.ULBService.getStateId(),S=Digit.Hooks.engagement.useMDMS(y,"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===h.code))[0].categoryList.map(e=>({name:e}))}}).data;return l.createElement("div",null,f?l.createElement(Yo,{t:u,heading:"CONFIRM_DELETE_DOC",docName:null==c?void 0:c.name,closeModal:()=>g(!f),actionCancelLabel:"CS_COMMON_CANCEL",actionCancelOnSubmit:function(){g(!1)},actionSaveLabel:"ES_COMMON_Y_DEL",actionSaveOnSubmit:function(){g(!1);const e=m({},c);r.push({pathname:"/digit-ui/employee/engagement/documents/delete-response",state:{DocumentEntity:e}})}}):null,l.createElement(t.Header,null,u("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"},u("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"},u("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"},u("DOCUMENT_CATEGORY")+":")," ",l.createElement("p",null,u(null==c?void 0:c.category))," "),l.createElement("div",{className:"documentDetails_row_items"},l.createElement("p",{className:"documentDetails_title"},u("DCOUMENT_DESCRIPTION")+":")," ",l.createElement("p",{className:"documentDetails__description"},null!=c&&null!==(o=c.description)&&void 0!==o&&o.length?null==c?void 0:c.description:"NA")," "),null!=c&&c.filestoreId?l.createElement("div",{className:"documentDetails_pdf"},l.createElement("span",{className:"documentDetails_subheader"},""+u("Document")),l.createElement("div",{style:{width:"100px"},onClick:()=>T(null==c?void 0:c.filestoreId,null==c?void 0:c.name)},l.createElement(t.GenericFileIcon,null))):null)),l.createElement(t.ActionBar,null,v?l.createElement(t.Menu,{style:{width:s?"full":"240px"},localeKeyPrefix:"ES_CE",options:dr,t:u,onSelect:function(e){if(p(!1),null!=e&&e.includes("EDIT")){var t;const e=m({tenantIds:null==c?void 0:c.tenantId,documentName:null==c?void 0:c.name,docCategory:null==S||null===(t=S.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")&&g(!0)}}):null,l.createElement(t.SubmitBar,{label:u("ES_COMMON_TAKE_ACTION"),onSubmit:()=>p(!v)})))},vr=e=>{let o=e.statuses,r=e.controlFilterForm;const s=a.useTranslation().t;return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let a=e.ref,i=e.onChange,r=e.value;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},s("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:s,select:i,selected:r}))}})))},pr=e=>{var o,r,s,u,c;let d=e.registerRef,m=e.controlSearchForm,v=e.searchFormState;const p=a.useTranslation().t,E=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),f=(Digit.Hooks.useTenants(),Digit.ULBService.getCurrentTenantId()),g=Digit.UserService.getUser().info;let h=!0,y=E.filter(e=>{var t;return null==g||null===(t=g.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(S);if(console.log("userUlbs",y),0===(null===(o=y)||void 0===o?void 0:o.length)||"pb.punjab"===f){h=!1;let e={i18nKey:"TENANT_TENANTS_"+(null==g?void 0:g.tenantId.replace(".","_").toUpperCase()),code:""+(null==g?void 0:g.tenantId)};y="pb.punjab"===f?[e,...E]:[e]}const b=n.useMemo(()=>{var e;return(null===(e=y)||void 0===e?void 0:e.length)>0&&!0===h?E.filter(e=>e.code===f):y.filter(e=>e.code===f)},[E]);return l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,p("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:p("REQUIRED_FIELD")},defaultValue:null==b?void 0:b[0],render:e=>l.createElement(t.Dropdown,{option:y,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:p}),name:"tenantIds",control:m}),l.createElement(t.CardLabelError,null,null==v||null===(r=v.errors)||void 0===r||null===(s=r.tenantIds)||void 0===s?void 0:s.message)),l.createElement(t.SearchField,null,l.createElement("label",null,p("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",inputRef:d({maxLength:{value:60,message:p("Survey Name should be less than 60 characters")}})}),l.createElement(t.CardLabelError,null,null==v||null===(u=v.errors)||void 0===u||null===(c=u.title)||void 0===c?void 0:c.message)))},Er=e=>{let o=e.showTermsPopupOwner,r=e.setShowTermsPopupOwner,s=e.getData;const u=a.useTranslation().t,c=(Digit.UserService.getUser(),window.location.href.includes("citizen")?window.localStorage.getItem("CITIZEN.CITY"):window.localStorage.getItem("Employee.tenant-id"),n.useState(!1)),d=c[0],m=c[1],v=n.useState(null),p=v[0],E=v[1],f=()=>{r(!1)},g=i.useForm(),h=g.control,y=g.handleSubmit,S=g.formState.errors,b={modal:{width:"100%",height:"100%",top:"0",position:"relative",backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",justifyContent:"center",alignItems:"center"},modalOverlay:{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.7)",zIndex:9999},modalContent:{backgroundColor:"#FFFFFF",padding:"2rem",borderRadius:"0.5rem",maxWidth:"800px",margin:"auto",fontFamily:"Roboto, serif",overflowX:"hidden",textAlign:"justify",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.2)",maxHeight:"80vh",overflowY:"auto",lineHeight:"2"}},_=(0,g.watch)("startDate");return l.createElement("div",null,l.createElement(Pi,{isOpen:o,onRequestClose:f,contentLabel:"Self-Declaration",style:{modal:b.modal,overlay:b.modalOverlay,content:b.modalContent}},l.createElement("form",{className:"employeeCard",onSubmit:y(function(e){try{m(!0);const t=null==s?void 0:s.original,n={uuid:null==t?void 0:t.uuid,startDate:new Date(null==e?void 0:e.startDate).getTime(),endDate:new Date(null==e?void 0:e.endDate).getTime(),active:!0};return Digit.Surveys.updateSurvey(n).then(e=>{E({label:"Date has been updated successfully",isDleteBtn:"true"}),m(!1),setTimeout(()=>{f()},2e3)}).catch(e=>{var t,n,l,a;m(!1),E({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||ERR_MESSAGE,isDleteBtn:"true",error:!0})}),Promise.resolve()}catch(e){return Promise.reject(e)}})},l.createElement("div",{className:"card"},l.createElement("div",{className:"label-field-pair chb-margin-top-20"},l.createElement(t.CardLabel,null,u("SELECT_DATE")," ",l.createElement("span",{className:"mandatory-asterisk"},"*")),l.createElement("div",{className:"form-field w-fullwidth"},l.createElement(i.Controller,{control:h,name:"startDate",rules:{required:u("START_DATE_REQ")},render:e=>l.createElement(t.TextInput,{type:"date",className:"form-field chb-form-field-margin",value:e.value,min:(new Date).toISOString().split("T")[0],onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)}})}),S.startDate&&l.createElement("p",{className:"chb-error-text"},S.startDate.message))),l.createElement("div",{className:"label-field-pair chb-margin-top-20"},l.createElement(t.CardLabel,null,u("SELECT_END_DATE")," ",l.createElement("span",{className:"mandatory-asterisk"},"*")),l.createElement("div",{className:"form-field w-fullwidth"},l.createElement(i.Controller,{control:h,name:"endDate",rules:{required:u("END_DATE_REQ")},render:e=>l.createElement(t.TextInput,{type:"date",className:"form-field chb-form-field-margin",value:e.value,min:_||(new Date).toISOString().split("T")[0],onChange:t=>{e.onChange(t.target.value)},onBlur:t=>{e.onBlur(t)},disabled:!_})}),S.endDate&&l.createElement("p",{className:"chb-error-text"},S.endDate.message)))),p&&l.createElement(t.Toast,{label:u(p.label),isDleteBtn:p.isDleteBtn,error:p.error,onClose:()=>{E(null)},warning:p.warning,isWarningButtons:p.isWarningButtons,style:{padding:"16px"}}),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{className:"submit-bar-back",label:"Cancel",onSubmit:()=>f()}),l.createElement(t.SubmitBar,{label:"Submit",submit:"submit"})))),d&&l.createElement(Fi,{page:!0}))},fr=e=>{let r=e.parentRoute;const s=a.useTranslation().t,u=n.useState(null),c=u[0],d=u[1],v=n.useState(!1),p=v[0],E=v[1],f=n.useState([]),g=f[0],h=f[1],y=n.useState(!1),S=y[0],b=y[1],_=Digit.ULBService.getCurrentTenantId(),C=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),T=Digit.UserService.getUser().info,D=null==C?void 0:C.filter(e=>{var t;return null==T||null===(t=T.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),N=[{code:"ALL",name:""+s("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+s("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+s("ES_COMMON_INACTIVE"),bool:!1}],w={tenantIds:(null==D?void 0:D.find(e=>e.code===_))||(null==D?void 0:D[0]),title:""},A={status:N[0]},x={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},O=Digit.SessionStorage.get("CITIZENSURVEY.INBOX"),I=n.useMemo(()=>O||{filterForm:A,searchForm:w,tableForm:x},[Object.values((null==O?void 0:O.filterForm)||{}),Object.values((null==O?void 0:O.searchForm)||{}),Object.values((null==O?void 0:O.tableForm)||{})]),L=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",m({},e,{searchForm:t.data})),m({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",m({},e,{filterForm:t.data})),m({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEY.INBOX",m({},e,{tableForm:t.data})),m({},e,{tableForm:t.data})}},I),R=L[0],M=L[1];let P=Digit.Hooks.survey.useSurveyInbox(R),F=P.data,k=void 0===F?{}:F,B=k.Surveys,U=void 0===B?[]:B,H=k.TotalCount,V=P.isLoading;const W=n.useState([]),z=W[0],j=W[1];n.useEffect(()=>{if(U.length>0){const e=[...U].sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime);U=e,j(e)}},[U]);const q={links:[{text:s("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:s("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:s("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:s("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:s("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:s("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:s("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},Y=n.useCallback(e=>l.createElement(pr,{registerRef:e.registerRef,searchFormState:e.searchFormState,controlSearchForm:e.controlSearchForm}),[]),G=n.useCallback(e=>l.createElement(vr,{statuses:N,registerRef:e.registerRef,controlFilterForm:e.controlFilterForm,setFilterFormValue:e.setFilterFormValue,filterFormState:null==R?void 0:R.filterForm,getFilterFormValue:e.getFilterFormValue}),[N]),K={SearchFormFields:Y,onSearchFormSubmit:e=>{M({action:"mutateTableForm",data:m({},R.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),M({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==R?void 0:R.searchForm,resetSearchFormDefaultValues:w,onSearchFormReset:e=>{const t=R.searchForm.tenantIds;e("title",""),e("tenantIds",t),M({action:"mutateSearchForm",data:m({},w,{tenantIds:t})}),M({action:"mutateTableForm",data:m({},x)})}},Q={FilterFormFields:G,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),M({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==R?void 0:R.filterForm,resetFilterFormDefaultValues:A,onFilterFormReset:e=>{e("status",N[0]),M({action:"mutateFilterForm",data:A})}},X=(e=>{var i,r,s,u;let c=e.onPageSizeChange,d=e.formState,v=e.totalCount,p=e.table,E=e.dispatch,f=e.inboxStyles,g=void 0===f?{}:f,h=e.setShowToast,y=e.setShowTermsPopup,S=e.setData;const b=o.useHistory(),_=e=>l.createElement("span",{className:"cell-text styled-cell"},e),C=a.useTranslation().t,T=(Digit.UserService.getUser(),n.useMemo(()=>[{Header:C("Survey Name"),accessor:"suveyName",Cell:e=>{let t=e.row;return l.createElement("div",null,l.createElement("span",{className:"link",onClick:()=>{b.push({pathname:"/digit-ui/employee/engagement/surveys/previewQuestions",state:{data:t.original}})}},t.original.surveyTitle))}},{Header:C("EVENTS_START_DATE_LABEL"),accessor:"startDate",Cell:e=>{var t,n;let l=e.row;return null!==(t=l.original)&&void 0!==t&&t.startDate?_(xe(new Date(null===(n=l.original)||void 0===n?void 0:n.startDate),"dd/MM/yyyy")):""}},{Header:C("EVENTS_END_DATE_LABEL"),accessor:"endDate",Cell:e=>{var t,n;let l=e.row;return null!==(t=l.original)&&void 0!==t&&t.endDate?_(xe(new Date(null===(n=l.original)||void 0===n?void 0:n.endDate),"dd/MM/yyyy")):""}},{Header:l.createElement("div",null,C("EVENTS_STATUS_LABEL")),accessor:"status",Cell:e=>{var t;let n=e.row;return l.createElement("div",{style:{wordBreak:"normal"}},(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null==n||null===(t=n.original)||void 0===t?void 0:t.active))}},{Header:C("EVENTS_POSTEDBY_LABEL"),accessor:"postedBy",Cell:e=>{var t;return _(null===(t=e.row.original)||void 0===t?void 0:t.postedBy)}},{Header:C("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let o=e.row;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?_(xe(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:C("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let o=e.row;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?_(xe(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:C("Update Status"),accessor:"updateSurvey",Cell:e=>{let n=e.row;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.active?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.active?"Inactive":"Active";h({label:'Are you sure you want to change the survey status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.surveyTitle)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},C("Click here to update the survey status"))))}},{Header:C("Update Date"),accessor:"updateSurveyDate",Cell:e=>{let n=e.row;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>{y(!0),S(n)}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},C("Click here to update the survey date"))))}}]));return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"endDate",onPageSizeChange:c,currentPage:parseInt((null===(i=d.tableForm)||void 0===i?void 0:i.offset)/(null===(r=d.tableForm)||void 0===r?void 0:r.limit)),onNextPage:()=>{var e,t;return E({action:"mutateTableForm",data:m({},d.tableForm,{offset:parseInt(null===(e=d.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=d.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return E({action:"mutateTableForm",data:m({},d.tableForm,{offset:parseInt(null===(e=d.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=d.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(s=d.tableForm)||void 0===s?void 0:s.limit,totalRecords:v,onSearch:null==d||null===(u=d.searchForm)||void 0===u?void 0:u.message,onLastPage:()=>{var e;return E({action:"mutateTableForm",data:m({},d.tableForm,{offset:10*Math.ceil(v/10)-parseInt(null===(e=d.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>E({action:"mutateTableForm",data:m({},d.tableForm,{offset:0})}),data:p,columns:T,noResultsMessage:"CS_NO_SURVEYS_FOUND",inboxStyles:m({},g)}})(m({},{parentRoute:r,onPageSizeChange:e=>{M({action:"mutateTableForm",data:m({},R.tableForm,{limit:e.target.value})})},formState:R,totalCount:H,table:z,noResultsMessage:"CS_SURVEYS_NOT_FOUND",dispatch:M,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:d,onSortingByData:e=>{if(e.length>0){const t=e[0],n=t.id,l=t.desc,a=l?"DESC":"ASC";R.tableForm.sortBy===n&&R.tableForm.sortOrder===a||M({action:"mutateTableForm",data:m({},R.tableForm,{sortBy:n,sortOrder:l?"DESC":"ASC"})})}},setShowTermsPopup:E,setData:h})),Z=(e=>{let n=e.table,o=e.setShowToast;const r=a.useTranslation().t,s=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const n=e.surveyTitle,a=e.startDate,i=e.endDate,u=e.active,c=e.postedBy,d=e.auditDetails;return{[r("Survey Name")]:n,[r("EVENTS_START_DATE_LABEL")]:a?xe(new Date(a),"dd/MM/yyyy"):"",[r("EVENTS_END_DATE_LABEL")]:i?xe(new Date(i),"dd/MM/yyyy"):"",[r("EVENTS_STATUS_LABEL")]:s(u),[r("EVENTS_POSTEDBY_LABEL")]:c,[r("Created On")]:null!=d&&d.createdTime?xe(new Date(null==d?void 0:d.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=d&&d.lastModifiedTime?xe(new Date(null==d?void 0:d.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Survey Status")]:l.createElement("label",{onClick:()=>{var t;o({label:'Are you sure you want to change the survey status of "'+(null==(t=e)?void 0:t.surveyTitle)+'" from '+(null!=t&&t.active?"Active":"Inactive")+" to "+(null!=t&&t.active?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t})}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],n=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n.control,render:n=>{let a=n.onChange,o=n.value;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:r,table:z,setShowToast:d});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,s("Inbox"),H?l.createElement("p",{className:"inbox-count"},H):null),l.createElement(t.InboxComposer,m({isInboxLoading:V,PropsForInboxLinks:q},K,Q,{propsForInboxMobileCards:Z,propsForInboxTable:X,formState:R})),c&&l.createElement(t.Toast,{label:s(c.label),isDleteBtn:c.isDleteBtn,error:c.error,onClose:()=>{d(null)},onNo:()=>{d(null)},onYes:()=>{(()=>{b(!0);const e=c.rowData;Digit.Surveys.updateSurvey({uuid:null==e?void 0:e.uuid,active:!(null!=e&&e.active)}).then(e=>{b(!1),d({label:null==e?void 0:e.message,isDleteBtn:"true"})}).catch(e=>{var t,n,l,a;b(!1),d({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:c.warning,isWarningButtons:c.isWarningButtons,style:{padding:"16px"}}),l.createElement("h1",{onClick:()=>E(!0)},"Show modal"),p&&l.createElement(Er,{showTermsPopupOwner:p,setShowTermsPopupOwner:E,getData:g,tenantId:_}),(V||S)&&l.createElement(Fi,{page:!0}))},gr=()=>{const e=a.useTranslation().t,r=o.useHistory(),s=n.useState(!1),u=s[0],c=s[1],d=Digit.ULBService.getCurrentTenantId(),m=n.useState(null),v=m[0],E=m[1],f=i.useForm({defaultValues:{categoryName:""}}),g=f.register,h=f.handleSubmit,y=f.reset,S=f.formState.errors,b=n.useState(!1),_=b[0],C=b[1];function T(){C(!1)}return l.createElement("div",{className:"card"},l.createElement(t.Header,null,e("Create Category")),l.createElement(i.FormProvider,f,l.createElement("form",{onSubmit:h(function(e){try{c(!0);const t={Categories:[{tenantId:d,label:e.categoryName.trim()}]},n=p(function(){return Promise.resolve(Digit.Surveys.createCategory(t)).then(function(e){var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?(c(!1),E({isError:!1,label:"Category created successfully"}),y(),setTimeout(()=>{r.push("/digit-ui/employee/engagement/surveys/search-categories")},2e3)):(c(!1),E({isError:!0,label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong"}))})},function(e){var t,n,l,a;console.log("Error in Digit.Surveys.createCategory:",null==e?void 0:e.response),c(!1),E({isError:!0,label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,e("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("div",null,l.createElement(t.TextInput,{errorStyle:!!S.categoryName,name:"categoryName",type:"text",placeholder:"Enter Category",inputRef:g({required:e("REQUIRED_FIELD"),maxLength:{value:500,message:e("Category length should be less than or equal to 500 characters")}})}),S.categoryName&&l.createElement("p",{style:{color:"red"}},S.categoryName.message)),l.createElement("label",{onClick:function(){C(!0)},style:{width:"24px",display:"flex",justifyContent:"center",alignItems:"center",outline:"none",cursor:"pointer"}},l.createElement(t.InfoIcon,null)))),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:e("Create Category"),submit:"submit"})))),_&&l.createElement(gi,{onSelect:function(){C(!1)},onCancel:T,onDismiss:T,heading:"About category creation",content:l.createElement("p",{style:{fontWeight:"bold"}},e("Organize your survey by category to steamline feedback on municipal services.")),hideSubmit:!0}),v&&l.createElement(t.Toast,{error:v.isError,label:e(v.label),onClose:function(){E(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},hr=e=>{let o=e.statuses,r=e.controlFilterForm;const s=a.useTranslation().t;return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let a=e.ref,i=e.onChange,r=e.value;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},s("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:s,select:i,selected:r}))}})))},yr=e=>{var o,r,s;let u=e.controlSearchForm,c=e.searchFormState;const d=a.useTranslation().t,m=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),v=Digit.ULBService.getCurrentTenantId(),p=Digit.UserService.getUser().info;let E=!0,f=m.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(S);if(0===(null===(o=f)||void 0===o?void 0:o.length)||"pb.punjab"===v){E=!1;let e={i18nKey:"TENANT_TENANTS_"+(null==p?void 0:p.tenantId.replace(".","_").toUpperCase()),code:""+(null==p?void 0:p.tenantId)};f="pb.punjab"===v?[e,...m]:[e]}n.useMemo(()=>{var e;return(null===(e=f)||void 0===e?void 0:e.length)>0&&!0===E?m.filter(e=>e.code===v):f.filter(e=>e.code===v)},[m]);const g=n.useState([]),h=g[0],y=g[1];return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:v}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:d(e.label),i18Key:e.label,value:e.id}}):[];y(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[v]),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,d("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{name:"tenantIds",control:u,rules:{required:d("REQUIRED_FIELD")},render:e=>l.createElement(t.Dropdown,{option:f,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:d})}),l.createElement(t.CardLabelError,null,null==c||null===(r=c.errors)||void 0===r||null===(s=r.tenantIds)||void 0===s?void 0:s.message)),l.createElement(t.SearchField,null,l.createElement("label",null,d("Category")),l.createElement(i.Controller,{rules:{required:!1},render:e=>l.createElement(t.Dropdown,{option:h,optionKey:"i18Key",selected:e.value,select:t=>e.onChange(t),t:d}),name:"categoryName",control:u})))},Sr=e=>{let o=e.parentRoute;const r=a.useTranslation().t,s=n.useState(null),u=s[0],c=s[1],d=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),f=[{code:"ALL",name:""+r("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+r("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+r("ES_COMMON_INACTIVE"),bool:!1}],g=n.useMemo(()=>(null==E?void 0:E.find(e=>e.code===d))||(null==E?void 0:E[0]),[E,d]),h={tenantIds:g,categoryName:""},y={status:f[0]},S={sortBy:"",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},b=Digit.SessionStorage.get("CITIZENSURVEYCATEGORY.INBOX"),_=n.useMemo(()=>b||{filterForm:y,searchForm:h,tableForm:S},[Object.values((null==b?void 0:b.filterForm)||{}),Object.values((null==b?void 0:b.searchForm)||{}),Object.values((null==b?void 0:b.tableForm)||{})]),C=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",m({},e,{searchForm:t.data})),m({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",m({},e,{filterForm:t.data})),m({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYCATEGORY.INBOX",m({},e,{tableForm:t.data})),m({},e,{tableForm:t.data})}},_),T=C[0],D=C[1];let N=Digit.Hooks.survey.useSurveyCategoryInbox(T),w=N.data,A=(void 0===w?{}:w).Categories,x=void 0===A?[]:A,O=N.isLoading;const I=null==x?void 0:x.length,L=n.useMemo(()=>[...x||[]].sort((e,t)=>t.auditDetails.lastModifiedTime-e.auditDetails.lastModifiedTime),[x]),R={links:[{text:r("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:r("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:r("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:r("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:r("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:r("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:r("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},M=n.useCallback(e=>l.createElement(yr,{registerRef:e.registerRef,searchFormState:e.searchFormState,controlSearchForm:e.controlSearchForm}),[]),P=n.useCallback(e=>l.createElement(hr,{statuses:f,registerRef:e.registerRef,controlFilterForm:e.controlFilterForm,setFilterFormValue:e.setFilterFormValue,filterFormState:null==T?void 0:T.filterForm,getFilterFormValue:e.getFilterFormValue}),[f]),F={SearchFormFields:M,onSearchFormSubmit:e=>{D({action:"mutateTableForm",data:m({},T.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),D({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==T?void 0:T.searchForm,resetSearchFormDefaultValues:h,onSearchFormReset:e=>{e("tenantIds",g),e("categoryName",""),D({action:"mutateSearchForm",data:{tenantIds:g,categoryName:""}}),D({action:"mutateTableForm",data:S})}},k={FilterFormFields:P,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),D({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==T?void 0:T.filterForm,resetFilterFormDefaultValues:y,onFilterFormReset:e=>{e("status",f[0]),D({action:"mutateFilterForm",data:y})}},B=(e=>{var o,i,r,s;let u=e.onPageSizeChange,c=e.formState,d=e.totalCount,v=e.table,p=e.dispatch,E=e.inboxStyles,f=void 0===E?{}:E,g=e.setShowToast;const h=e=>l.createElement("span",{className:"cell-text styled-cell"},e),y=a.useTranslation().t,S=n.useMemo(()=>[{Header:y("Category"),accessor:"category",Cell:e=>{var t;return l.createElement("div",null,l.createElement("span",null,null===(t=e.row.original)||void 0===t?void 0:t.label))}},{Header:y("Status"),accessor:"isActive",Cell:e=>{var t;return(e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-")(null===(t=e.row.original)||void 0===t?void 0:t.isActive)}},{Header:y("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let o=e.row;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?h(xe(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:y("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let o=e.row;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?h(xe(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:y("Update Category Status"),accessor:"updateCategory",Cell:e=>{let n=e.row;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t,n,l;const a=null!=e&&null!==(t=e.original)&&void 0!==t&&t.isActive?"Active":"Inactive",o=null!=e&&null!==(n=e.original)&&void 0!==n&&n.isActive?"Inactive":"Active";g({label:'Are you sure you want to change the category status of "'+(null==e||null===(l=e.original)||void 0===l?void 0:l.label)+'" from '+a+" to "+o+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},y("Click here to update the category status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:u,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:m({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:m({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(d),onSearch:null==c||null===(s=c.searchForm)||void 0===s?void 0:s.message,data:v,columns:S,noResultsMessage:"No Category found",inboxStyles:m({},f)}})(m({},{parentRoute:o,onPageSizeChange:e=>{D({action:"mutateTableForm",data:m({},T.tableForm,{limit:e.target.value})})},formState:T,totalCount:I,table:L,noResultsMessage:"No Categories found",dispatch:D,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c})),U=(e=>{let n=e.table,o=e.setShowToast;const r=a.useTranslation().t,s=e=>!0===e?l.createElement("span",{className:"sla-cell-success"},"Active"):!1===e?l.createElement("span",{className:"sla-cell-error"},"Inactive"):"-";return{data:null==n?void 0:n.map(e=>{const n=e.label,a=e.isActive,i=e.auditDetails;return{[r("Category")]:n,[r("Status")]:s(a),[r("Created On")]:null!=i&&i.createdTime?xe(new Date(null==i?void 0:i.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:null!=i&&i.lastModifiedTime?xe(new Date(null==i?void 0:i.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Category Status")]:l.createElement("label",{onClick:()=>{var t;o({label:'Are you sure you want to change the category status of "'+(null==(t=e)?void 0:t.label)+'" from '+(null!=t&&t.isActive?"Active":"Inactive")+" to "+(null!=t&&t.isActive?"Inactive":"Active")+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:t})}},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))}}),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],n=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n.control,render:n=>{let a=n.onChange,o=n.value;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:o,table:L,setShowToast:c});return l.createElement(n.Fragment,null,l.createElement(t.Header,null,r("Search Categories"),I?l.createElement("p",{className:"inbox-count"},I):null),l.createElement(t.InboxComposer,m({isInboxLoading:O,PropsForInboxLinks:R},F,k,{propsForInboxMobileCards:U,propsForInboxTable:B,formState:T})),u&&l.createElement(t.Toast,{label:r(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=u.rowData,t={Categories:[m({id:null==e?void 0:e.id},"boolean"==typeof(null==e?void 0:e.isActive)&&{isActive:!(null!=e&&e.isActive)})]};Digit.Surveys.updateCategory(t).then(e=>{var t,n,l;(null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0?c({label:"Category status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,style:{padding:"16px"},isWarningButtons:u.isWarningButtons}))},br=e=>{let t=e.t,n=e.options,a=void 0===n?[]:n,o=e.updateOption,i=e.addOption,r=e.removeOption,s=e.isPartiallyEnabled,u=e.createNewSurvey,c=e.formDisabled,d=e.maxLength,m=e.titleHover,v=e.weightHover,p=e.minWeight,E=e.maxWeight,f=e.inputRef,g=e.labelstyle,h=e.isInputDisabled;return l.createElement("div",{className:"options_checkboxes"},a.map(e=>l.createElement("div",{key:e.id},l.createElement(_r,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:o,removeOption:r,maxLength:d,titleHover:m,weightageHover:v,minWeight:p,maxWeight:E,inputRef:f,labelstyle:g,isPartiallyEnabled:s,isInputDisabled:h,formDisabled:c,optionsLength:a.length}))),l.createElement("div",null,l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!u&&c||(s?!s:c),onClick:()=>i()},t("CS_COMMON_ADD_OPTION"))))},_r=e=>{let a=e.index,o=e.weightage,i=e.updateOption,r=e.removeOption,s=e.maxLength,u=e.titleHover,c=e.weightHover,d=e.minWeight,v=e.maxWeight,p=e.inputRef,E=e.labelstyle,f=e.isPartiallyEnabled,g=e.isInputDisabled,h=e.formDisabled,y=e.optionsLength;const S=n.useState(e.title),b=S[0],_=S[1],C=n.useState(o),T=C[0],D=C[1],N=n.useState(!1)[1],w=n.useState(""),A=w[0],x=w[1];return n.useEffect(()=>{i({value:b,id:a,weightage:T})},[b,T]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"end",justifyContent:"flex-start",position:"relative"}},l.createElement("div",{style:{display:"flex",gap:"10px",justifyContent:"center",alignItems:"center"}},l.createElement(t.CheckBox,{disable:g}),l.createElement("input",{ref:p,type:"text",value:b,onChange:e=>_(e.target.value),onBlur:()=>N(!1),onFocus:()=>N(!0),className:"employee-card-input",maxLength:s,title:u,style:m({},E),disabled:f?!f:h})),l.createElement("div",{style:{display:"flex",flexDirection:"column",fontSize:"14px"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:T,required:!0,placeholder:"Option Weightage",min:d,max:v,title:c,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(x(""),D(e.target.value)):x("Please enter a number between 0 and 10.")}}),A&&l.createElement("span",{style:{color:"red"}},A)),y>1&&l.createElement("div",{style:{position:"absolute",right:"65px",top:"32px"},className:"pointer",onClick:()=>r(a)},l.createElement(t.CloseSvg,null)))},Cr=e=>{let t=e.t,n=e.options,a=void 0===n?[]:n,o=e.updateOption,i=e.addOption,r=e.removeOption,s=e.createNewSurvey,u=e.isPartiallyEnabled,c=e.formDisabled,d=e.inputRef,m=e.maxLength,v=e.titleHover,p=e.weightHover,E=e.minWeight,f=e.maxWeight,g=e.isInputDisabled;return l.createElement("div",{className:"options_checkboxes"},a.map(e=>l.createElement("div",{key:e.id},l.createElement(Tr,{index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:o,removeOption:r,inputRef:d,maxLength:m,titleHover:v,weightageHover:p,minWeight:E,maxWeight:f,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:c,optionsLength:a.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!s&&c||(u?!u:c),onClick:()=>i()},t("CS_COMMON_ADD_OPTION"))))},Tr=e=>{let a=e.index,o=e.weightage,i=e.updateOption,r=e.removeOption,s=e.inputRef,u=e.maxLength,c=e.titleHover,d=e.weightHover,m=e.minWeight,v=e.maxWeight,p=e.isPartiallyEnabled,E=e.isInputDisabled,f=e.formDisabled,g=e.optionsLength;const h=n.useState(e.title),y=h[0],S=h[1],b=n.useState(o),_=b[0],C=b[1],T=n.useState(!1)[1],D=n.useState(""),N=D[0],w=D[1];return n.useEffect(()=>{i({value:y,id:a,weightage:_})},[y,_]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"end",justifyContent:"flex-start",position:"relative"}},l.createElement("div",{style:{display:"flex",gap:"10px",justifyContent:"center",alignItems:"center"}},l.createElement("input",{type:"radio",className:"customradiobutton",disabled:E}),l.createElement("input",{type:"text",ref:s,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:"employee-card-input",maxLength:u,title:c,disabled:p?!p:f})),l.createElement("div",{style:{display:"flex",flexDirection:"column",fontSize:"14px"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:_,required:!0,placeholder:"Option Weightage",min:m,max:v,title:d,className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(w(""),C(e.target.value)):w("Please enter a number between 0 and 10.")},onWheel:e=>e.target.blur()}),N&&l.createElement("span",{style:{color:"red"}},N)),g>1&&l.createElement("div",{style:{position:"absolute",right:"75px",top:"32px"},className:"pointer",onClick:()=>r(a)},l.createElement(t.CloseSvg,null)))},Dr=e=>{let t=e.t,n=e.options,a=void 0===n?[]:n,o=e.updateOption,i=e.addOption,r=e.removeOption,s=e.createNewSurvey,u=e.isPartiallyEnabled,c=e.formDisabled,d=e.inputRef,m=e.maxLength,v=e.titleHover,p=e.weightHover,E=e.minWeight,f=e.maxWeight,g=e.isInputDisabled;return l.createElement("div",{className:"options_checkboxes"},a.map((e,t)=>l.createElement("div",{key:e.id},l.createElement(Nr,{indexNumber:t,index:e.id,title:e.title,weightage:e.optionWeightage,updateOption:o,removeOption:r,inputRef:d,maxLength:m,titleHover:v,weightageHover:p,minWeight:E,maxWeight:f,isPartiallyEnabled:u,isInputDisabled:g,formDisabled:c,optionsLength:a.length}))),l.createElement("div",null,l.createElement("button",{className:"unstyled-button link",type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},disabled:!s&&c||(u?!u:c),onClick:()=>i()},t("CS_COMMON_ADD_OPTION"))))},Nr=e=>{let a=e.indexNumber,o=e.index,i=e.weightage,r=e.updateOption,s=e.removeOption,u=e.inputRef,c=e.maxLength,d=e.titleHover,m=e.weightHover,v=e.minWeight,p=e.maxWeight,E=e.isPartiallyEnabled,f=e.formDisabled,g=e.optionsLength;const h=n.useState(e.title),y=h[0],S=h[1],b=n.useState(i),_=b[0],C=b[1],T=n.useState(!1)[1],D=n.useState(""),N=D[0],w=D[1];return n.useEffect(()=>{r({value:y,id:o,weightage:_})},[y,_]),l.createElement("div",{className:"optionradiobtnwrapper",style:{alignItems:"end",justifyContent:"flex-start",position:"relative"}},l.createElement("div",{style:{display:"flex",gap:"10px",justifyContent:"center",alignItems:"center"}},l.createElement("span",null,a+1,"."),l.createElement("input",{type:"text",ref:u,value:y,onChange:e=>S(e.target.value),onBlur:()=>T(!1),onFocus:()=>T(!0),className:"employee-card-input",maxLength:c,title:d,disabled:E?!E:f})),l.createElement("div",{style:{display:"flex",flexDirection:"column",fontSize:"14px"}},l.createElement("label",{htmlFor:"numberInput"},"Enter a number (0-10):"),l.createElement("input",{type:"number",id:"numberInput",value:_,required:!0,placeholder:"Option Weightage",min:v,max:p,title:m,onWheel:e=>e.target.blur(),className:"employee-card-input",onChange:e=>{const t=e.target.value;""===t||/^(10|[0-9])$/.test(t)&&!t.includes("-")?(w(""),C(e.target.value)):w("Please enter a number between 0 and 10.")}}),N&&l.createElement("span",{style:{color:"red"}},N),g>1&&l.createElement("div",{style:{position:"absolute",right:"88px",top:"32px"},className:"pointer",onClick:()=>s(o)},l.createElement(t.CloseSvg,null))))},wr=e=>{var a,o,r,s,u,c;let d=e.t,v=e.index,p=e.category,E=e.questionStatement,f=e.type,g=e.options,h=e.required,y=e.uuid,S=e.qorder,b=e.disableInputs,_=e.dispatch,C=e.isPartiallyEnabled,T=e.addOption,D=e.formDisabled,N=e.controlSurveyForm,w=e.mainFormState,A=e.noOfQuestions,x=e.defaultQuestionValues;const O=Digit.ULBService.getCurrentTenantId(),I=(Digit.Hooks.engagement.useMDMS(O,"common-masters","questionType")||{}).data,L=void 0===I?{}:I;var R=L&&L["common-masters"]&&L["common-masters"].questionType?L["common-masters"].questionType.filter(function(e){return e.active}).map(function(e){return{title:d(e.title),i18Key:e.code,value:e.code}}):[];const M=n.useState([]),P=M[0],F=M[1];n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:O}).then(e=>{var t,n;const l=null==e||null===(t=e.Categories)||void 0===t||null===(n=t.filter(e=>e.isActive))||void 0===n?void 0:n.map(e=>({title:d(e.label),i18Key:e.label,value:e.id}));F(l)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[O]);const k=window.location.href.includes("/employee/engagement/surveys/create-questions"),B=n.useState({category:p||x.category,questionStatement:E||x.questionStatement,type:f||x.type,options:(null==g?void 0:g.length)>0?g:x.options,required:h||x.required,uuid:y||x.uuid,qorder:S||x.qorder}),U=B[0],H=B[1],V=w.errors,W=()=>{const e=[...U.options,{id:Date.now(),title:d("CMN_OPTION")+" "+(U.options.length+1),optionWeightage:0}];return H(t=>m({},t,{options:e})),e},z=e=>{let t=e.value,n=e.id,l=e.weightage;const a=U.options.map(e=>e.id===n?m({},e,{title:t,optionWeightage:l}):e);return H(e=>m({},e,{options:a})),a},j=e=>{if(1===U.options.length||(C?!C:D))return U.options;const t=U.options.filter(t=>t.id!==e);return H(e=>m({},e,{options:t})),t};return n.useEffect(()=>{_({type:"updateForm",payload:{index:v,formConfig:U}})},[U]),console.log("surveyQuestionConfig",U.options[0].optionWeightage),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},d("CS_COMMON_QUESTION")+" "+(v+1)+" "),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(i.Controller,{rules:{required:d("REQUIRED_FIELD")},defaultValue:x.category,name:"questions["+v+"].category",control:N,render:e=>l.createElement(t.Dropdown,{t:d,option:P,placeholder:"Select Category *",optionKey:"i18Key",selected:U.category,select:t=>{var n;e.onChange(t),n=t,H(e=>m({},e,{category:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:b})}),(null===(a=V.questions)||void 0===a||null===(o=a[v])||void 0===o?void 0:o.category)&&l.createElement(t.CardLabelError,null,V.questions[v].category.message),l.createElement(i.Controller,{rules:{required:d("REQUIRED_FIELD"),maxLength:{value:500,message:"Question length should be less than or equal to 500 characters"},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:"Input should not start with a number"}},defaultValue:x.questionStatement,name:"questions["+v+"].questionStatement",control:N,render:e=>l.createElement(t.TextInput,{placeholder:d("CS_COMMON_TYPE_QUESTION")+" *",value:U.questionStatement,onChange:t=>{var n;n=t,H(e=>m({},e,{questionStatement:n.target.value})),e.onChange(t)},textInputStyle:{width:"100%"},disable:b})}),(null===(r=V.questions)||void 0===r||null===(s=r[v])||void 0===s?void 0:s.questionStatement)&&l.createElement(t.CardLabelError,null,V.questions[v].questionStatement.message),l.createElement(i.Controller,{rules:{required:d("REQUIRED_FIELD")},defaultValue:x.type,name:"questions["+v+"].type",control:N,render:e=>l.createElement(t.Dropdown,{t:d,option:R,placeholder:"Select Question Type *",optionKey:"i18Key",selected:U.type,select:t=>{var n;e.onChange(t),n=t,H(e=>m({},e,{type:n?{title:n.title,i18Key:n.i18Key,value:n.value}:null}))},disable:b})}),(null===(u=V.questions)||void 0===u||null===(c=u[v])||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,V.questions[v].type.message),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,a,o,r,s,u;switch(null==e?void 0:e.value){case"MULTIPLE_ANSWER_TYPE":return l.createElement("div",null,(null===(n=V.questions)||void 0===n||null===(a=n[v])||void 0===a?void 0:a.options)&&l.createElement(t.CardLabelError,null,V.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(Cr,{updateOption:t=>{const n=z(t);e.onChange(n)},addOption:()=>{const t=W();e.onChange(t)},removeOption:t=>{const n=j(t);e.onChange(n)},options:null==U?void 0:U.options,createNewSurvey:T,isInputDisabled:k,isPartiallyEnabled:C,formDisabled:D,maxLength:500,minWeight:0,maxWeight:10,titleHover:d("The maximum length is 500 characters"),weightHover:d("Enter a number between 0 and 10"),t:d})}));case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,(null===(o=V.questions)||void 0===o||null===(r=o[v])||void 0===r?void 0:r.options)&&l.createElement(t.CardLabelError,null,V.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(br,{updateOption:t=>{const n=z(t);e.onChange(n)},addOption:()=>{const t=W();e.onChange(t)},removeOption:t=>{const n=j(t);e.onChange(n)},options:null==U?void 0:U.options,isInputDisabled:k,isPartiallyEnabled:C,createNewSurvey:T,formDisabled:D,titleHover:d("The maximum length is 500 characters"),weightHover:d("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:d})}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement("div",null,(null===(s=V.questions)||void 0===s||null===(u=s[v])||void 0===u?void 0:u.options)&&l.createElement(t.CardLabelError,null,V.questions[v].options.message),l.createElement(i.Controller,{rules:{validate:e=>e.every(e=>""!==e.title.trim())||"Some options are empty. Please provide text or remove the empty options."},defaultValue:x.options,name:"questions["+v+"].options",control:N,render:e=>l.createElement(Dr,{updateOption:t=>{const n=z(t);e.onChange(n)},addOption:()=>{const t=W();e.onChange(t)},removeOption:t=>{const n=j(t);e.onChange(n)},options:null==U?void 0:U.options,isInputDisabled:k,isPartiallyEnabled:C,createNewSurvey:T,formDisabled:D,titleHover:d("The maximum length is 500 characters"),weightHover:d("Enter a number between 0 and 10"),labelstyle:{marginLeft:"-20px"},maxLength:500,minWeight:0,maxWeight:10,t:d})}));default:return null}})(null==U?void 0:U.type)),l.createElement("div",{className:"newSurveyForm_actions"},A>1&&l.createElement("div",{className:"newSurveyForm_seprator"}),A>1&&l.createElement("div",{className:"pointer "+(b?"disabled-btn":""),onClick:()=>_({type:"removeForm",payload:{uuid:y}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},d("CS_INFO_DELETE"))))))))},Ar=e=>{let t=e.t,a=e.formsConfig,o=e.setSurveyConfig,i=e.disableInputs,r=e.isPartiallyEnabled,s=e.addOption,u=e.formDisabled,c=e.controlSurveyForm,d=e.formState;const v=(0,e.defaultQuestionValuesFromFile1)(),p=n.useReducer((e,t)=>{let n=t.payload;switch(t.type){case"addNewForm":const t=[...e,v];return n.setSurveyConfig("questions",t),t;case"updateForm":const l=[...e];return l.splice(n.index,1,n),n.setSurveyConfig("questions",l),l;case"removeForm":if(1===e.length)return e;const a=e.filter(e=>e.formConfig.uuid!==n.uuid);return n.setSurveyConfig("questions",a),a}},a||[v]),E=p[0],f=p[1],g=e=>{f({type:e.type,payload:m({},e.payload,{setSurveyConfig:o})})};return l.createElement("div",{className:"surveyformslist_wrapper"},E.length?E.map((e,n)=>l.createElement("div",{key:e.formConfig?e.formConfig.uuid:e.uuid},l.createElement(wr,m({},e.formConfig?null==e?void 0:e.formConfig:e,{addOption:s,t:t,index:n,disableInputs:i,dispatch:g,isPartiallyEnabled:r,formDisabled:u,controlSurveyForm:c,mainFormState:d,noOfQuestions:null==E?void 0:E.length,defaultQuestionValues:v})))):null,l.createElement("div",{className:"pointer"},E.length<100&&l.createElement("button",{type:"button",style:{display:"block",padding:"8px 16px 8px",backgroundColor:"#2947a3",color:"white",borderRadius:"8px"},onClick:()=>g({type:"addNewForm"}),disabled:E.length>=100},t("CS_COMMON_ADD_QUESTION"))))},xr=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors","watch"],Or=()=>{const e=o.useHistory(),r=a.useTranslation().t,s=n.useState(!1),u=s[0],c=s[1],d=Digit.ULBService.getCurrentTenantId(),E=n.useState(null),f=E[0],g=E[1],h=()=>({category:null,questionStatement:"",type:{title:r("MULTIPLE_ANSWER_TYPE"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},options:[{id:Date.now(),title:r("CMN_OPTION")+" 1",optionWeightage:0}],required:!1,uuid:Date.now()+Math.random().toString(36).substring(2,11),qorder:null}),y=i.useForm({defaultValues:{questions:[h()]}}),S=y.register,b=y.control,_=y.handleSubmit,C=y.setValue,T=y.getValues,D=y.reset,N=y.formState,w=y.clearErrors,A=v(y,xr);function x(e){console.log("data",e);const t=e.questions.map(e=>{let t={};return t="MULTIPLE_ANSWER_TYPE"===e.type.value||"CHECKBOX_ANSWER_TYPE"===e.type.value||"DROP_DOWN_MENU_ANSWER_TYPE"===e.type.value?{tenantId:d,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value,options:e.options.map(e=>({optionText:e.title.trim(),weightage:parseInt(e.optionWeightage)}))}:{tenantId:d,categoryId:e.category.value,questionStatement:e.questionStatement.trim(),type:e.type.value},t});return console.log("qus payload",t),t}return l.createElement("div",{className:"card"},l.createElement(t.Header,null,r("Create Questions")),l.createElement(i.FormProvider,m({register:S,handleSubmit:_,setValue:C,getValues:T,reset:D,formState:N,clearErrors:w},A),l.createElement("form",{onSubmit:_(function(t){try{c(!0);const n={Questions:x(t)},l=p(function(){return Promise.resolve(Digit.Surveys.createQuestions(n)).then(function(t){var n;(null==t||null===(n=t.Questions)||void 0===n?void 0:n.length)>0?(c(!1),g({isError:!1,label:"Questions created successfully"}),setTimeout(()=>{e.push("/digit-ui/employee/engagement/surveys/search-questions")},2e3)):(c(!1),g({isError:!0,label:"Something went wrong"}))})},function(e){console.log("Error in Digit.Surveys.createQuestions:",null==e?void 0:e.response),c(!1),g({isError:!0,label:"Something went wrong"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement(t.Card,null,l.createElement(Ar,{t:r,setSurveyConfig:C,addOption:!0,controlSurveyForm:b,formState:N,defaultQuestionValuesFromFile1:h})),l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:r("Create Questions"),submit:"submit"})))),f&&l.createElement(t.Toast,{error:f.isError,label:r(f.label),onClose:()=>{g(null)},isDleteBtn:"true"}),u&&l.createElement(t.Loader,null))},Ir=e=>{let o=e.statuses,r=e.controlFilterForm;const s=a.useTranslation().t;return l.createElement(n.Fragment,null,l.createElement(t.FilterFormField,null,l.createElement(i.Controller,{name:"status",control:r,render:e=>{let a=e.ref,i=e.onChange,r=e.value;return l.createElement(n.Fragment,null,l.createElement("div",{className:"filter-label"},s("CS_SURVEY_STATUS")),l.createElement(t.Dropdown,{inputRef:a,option:o,optionKey:"code",t:s,select:i,selected:r}))}})))},Lr=e=>{var o,r,s,u,c,d,m;let v=e.controlSearchForm,p=e.searchFormState;const E=a.useTranslation().t,f=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),g=Digit.ULBService.getCurrentTenantId(),h=Digit.UserService.getUser().info;let y=!0,b=f.filter(e=>{var t;return null==h||null===(t=h.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(S);if(0===(null===(o=b)||void 0===o?void 0:o.length)){y=!1;let e={i18nKey:"TENANT_TENANTS_"+(null==h?void 0:h.tenantId.replace(".","_").toUpperCase()),code:""+(null==h?void 0:h.tenantId)};b="pb.punjab"===g?[e,...f]:[e]}n.useMemo(()=>{var e;return(null===(e=b)||void 0===e?void 0:e.length)>0&&!0===y?f.filter(e=>e.code===g):b.filter(e=>e.code===g)},[f]);const _=n.useState([]),C=_[0],T=_[1];return n.useEffect(()=>{Digit.Surveys.searchCategory({tenantId:g}).then(e=>{const t=e&&e.Categories?e.Categories.map(function(e){return{name:E(e.label),i18Key:e.label,value:e.id}}):[];T(t)}).catch(e=>{console.error("Failed to fetch categories:",e)})},[g]),l.createElement(n.Fragment,null,l.createElement(t.SearchField,null,l.createElement("label",null,E("City")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},render:e=>l.createElement(t.Dropdown,{option:b,optionKey:"i18nKey",selected:e.value,select:t=>e.onChange(t),t:E}),name:"tenantIds",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(r=p.errors)||void 0===r||null===(s=r.tenantIds)||void 0===s?void 0:s.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Category")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{rules:{required:E("REQUIRED_FIELD")},render:e=>l.createElement(t.Dropdown,{option:C,optionKey:"name",selected:e.value,select:t=>e.onChange(t),t:E}),name:"categoryName",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(u=p.errors)||void 0===u||null===(c=u.categoryName)||void 0===c?void 0:c.message)),l.createElement(t.SearchField,null,l.createElement("label",null,E("Question")),l.createElement(i.Controller,{render:e=>l.createElement(t.TextInput,{name:"questionStatement",type:"text",value:e.value,onChange:t=>e.onChange(t)}),name:"questionStatement",control:v}),l.createElement(t.CardLabelError,null,null==p||null===(d=p.errors)||void 0===d||null===(m=d.questionStatement)||void 0===m?void 0:m.message)))},Rr=e=>{let o=e.parentRoute;const r=a.useTranslation().t,s=n.useState(null),u=s[0],c=s[1],d=Digit.ULBService.getCurrentTenantId(),v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.UserService.getUser().info,E=v.filter(e=>{var t;return null==p||null===(t=p.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),f=n.useState(!1),g=f[0],h=f[1],y=n.useState(!1),S=y[0],b=y[1],_=[{code:"ALL",name:""+r("ES_COMMON_ALL"),bool:null},{code:"ACTIVE",name:""+r("ES_COMMON_ACTIVE"),bool:!0},{code:"INACTIVE",name:""+r("ES_COMMON_INACTIVE"),bool:!1}],C={tenantIds:(null==E?void 0:E.find(e=>e.code===d))||(null==E?void 0:E[0]),categoryName:"",questionStatement:""},T={status:_[0]},D={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},N=Digit.SessionStorage.get("CITIZENSURVEYQUESTION.INBOX"),w=n.useMemo(()=>N||{filterForm:T,searchForm:C,tableForm:D},[Object.values((null==N?void 0:N.filterForm)||{}),Object.values((null==N?void 0:N.searchForm)||{}),Object.values((null==N?void 0:N.tableForm)||{})]),A=n.useReducer(function(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",m({},e,{searchForm:t.data})),m({},e,{searchForm:t.data});case"mutateFilterForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",m({},e,{filterForm:t.data})),m({},e,{filterForm:t.data});case"mutateTableForm":return Digit.SessionStorage.set("CITIZENSURVEYQUESTION.INBOX",m({},e,{tableForm:t.data})),m({},e,{tableForm:t.data})}},w),x=A[0],O=A[1];let I=Digit.Hooks.survey.useSurveyQuestionInbox(x),L=I.data,R=(void 0===L?{}:L).Questions,M=void 0===R?[]:R,P=I.isLoading;const F=null==M?void 0:M.length,k=n.useMemo(()=>[...M||[]].sort((e,t)=>t.auditDetails.lastModifiedTime-e.auditDetails.lastModifiedTime),[M]),B={links:[{text:r("Create New Survey"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{text:r("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"},{text:r("Surveys Inbox/Search Surveys"),link:"/digit-ui/employee/engagement/surveys/inbox"},{text:r("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{text:r("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{text:r("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{text:r("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"}]},U=n.useCallback(e=>l.createElement(Lr,{registerRef:e.registerRef,searchFormState:e.searchFormState,controlSearchForm:e.controlSearchForm}),[]),H=n.useCallback(e=>l.createElement(Ir,{statuses:_,registerRef:e.registerRef,controlFilterForm:e.controlFilterForm,setFilterFormValue:e.setFilterFormValue,filterFormState:null==x?void 0:x.filterForm,getFilterFormValue:e.getFilterFormValue}),[_]),V={SearchFormFields:U,onSearchFormSubmit:e=>{O({action:"mutateTableForm",data:m({},x.tableForm,{offset:0})}),e.hasOwnProperty("")&&(null==e||delete e[""]),O({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==x?void 0:x.searchForm,resetSearchFormDefaultValues:C,onSearchFormReset:e=>{const t=(null==E?void 0:E.find(e=>e.code===d))||(null==E?void 0:E[0]);e("tenantIds",t),e("categoryName",""),e("questionStatement",""),O({action:"mutateSearchForm",data:m({},C,{tenantIds:t})}),O({action:"mutateTableForm",data:m({},D)})}},W={FilterFormFields:H,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),O({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==x?void 0:x.filterForm,resetFilterFormDefaultValues:T,onFilterFormReset:e=>{e("status",_[0]),O({action:"mutateFilterForm",data:T})}},z=(e=>{var o,i,r,s;let u=e.onPageSizeChange,c=e.formState,d=e.totalCount,v=e.table,p=e.dispatch,E=e.inboxStyles,f=void 0===E?{}:E,g=e.setShowToast,h=e.setOpenQuesDetailsDialog,y=e.setQuestionDetailsContent;const S=e=>l.createElement("span",{className:"cell-text styled-cell"},e),b=a.useTranslation().t,_=n.useMemo(()=>[{Header:b("Question"),accessor:"questionStatement",Cell:e=>{var t;let n=e.row;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;h(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,b(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));y(n)}(null==n?void 0:n.original)},null==n||null===(t=n.original)||void 0===t?void 0:t.questionStatement),l.createElement("span",{className:"tooltiptext",style:{top:"40%",bottom:"auto",left:"50%",marginLeft:"-10px",fontSize:"medium",position:"absolute"}},b("Click here to view the question details"))))}},{Header:b("Is Question Active"),accessor:"isActive",Cell:e=>{var t;return(e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e))(null===(t=e.row.original)||void 0===t?void 0:t.status)}},{Header:b("Question Type"),accessor:"questionType",Cell:e=>{var t;return l.createElement("div",null,l.createElement("span",null,b(null===(t=e.row.original)||void 0===t?void 0:t.type)))}},{Header:b("Category"),accessor:"category",Cell:e=>{var t,n;return l.createElement("div",null,l.createElement("span",null,null===(t=e.row.original)||void 0===t||null===(n=t.category)||void 0===n?void 0:n.label))}},{Header:b("Created On"),accessor:"createdTime",Cell:e=>{var t,n,l,a;let o=e.row;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?S(xe(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.createdTime),"dd/MM/yyyy")):""}},{Header:b("Last Updated On"),accessor:"updatedTime",Cell:e=>{var t,n,l,a;let o=e.row;return null!==(t=o.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.lastModifiedTime?S(xe(new Date(null===(l=o.original)||void 0===l||null===(a=l.auditDetails)||void 0===a?void 0:a.lastModifiedTime),"dd/MM/yyyy")):""}},{Header:b("Update Question Status"),accessor:"updateQuestion",Cell:e=>{let n=e.row;return l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("button",{onClick:()=>(e=>{var t;const n=null==e||null===(t=e.original)||void 0===t?void 0:t.status,l="ACTIVE"===n?"INACTIVE":"INACTIVE"===n?"ACTIVE":"";g({label:"Are you sure you want to change the question status from "+n+" to "+l+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:null==e?void 0:e.original,updatedStatus:l})})(n)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}})),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},b("Click here to update the question status"))))}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortI:"endDate",onPageSizeChange:u,currentPage:parseInt((null===(o=c.tableForm)||void 0===o?void 0:o.offset)/(null===(i=c.tableForm)||void 0===i?void 0:i.limit)),onNextPage:()=>{var e,t;return p({action:"mutateTableForm",data:m({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},onPrevPage:()=>{var e,t;return p({action:"mutateTableForm",data:m({},c.tableForm,{offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)})})},pageSizeLimit:null===(r=c.tableForm)||void 0===r?void 0:r.limit,totalRecords:parseInt(d),onSearch:null==c||null===(s=c.searchForm)||void 0===s?void 0:s.message,data:v,columns:_,noResultsMessage:"No Question found",inboxStyles:m({},f)}})(m({},{parentRoute:o,onPageSizeChange:e=>{O({action:"mutateTableForm",data:m({},x.tableForm,{limit:e.target.value})})},formState:x,totalCount:F,table:k,noResultsMessage:"No Questions found",dispatch:O,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},setShowToast:c,openQuesDetailsDialog:g,questionDetailsContent:S,setOpenQuesDetailsDialog:h,setQuestionDetailsContent:b})),j=(e=>{let n=e.table,o=e.setShowToast;const r=a.useTranslation().t,s=e=>l.createElement("span",{className:"ACTIVE"===e?"sla-cell-success":"sla-cell-error"},e);return{data:null==n?void 0:n.map(e=>({[r("Question")]:e.questionStatement,[r("Status")]:s(e.status),[r("Question Type")]:e.type,[r("Category")]:e.category.label,[r("Created On")]:e.auditDetails.createdTime?xe(new Date(e.auditDetails.createdTime),"dd/MM/yyyy"):"",[r("Last Updated On")]:e.auditDetails.lastModifiedTime?xe(new Date(e.auditDetails.lastModifiedTime),"dd/MM/yyyy"):"",[r("Update Question Status")]:l.createElement("label",{onClick:()=>(e=>{const t=null==e?void 0:e.status,n="ACTIVE"===t?"INACTIVE":"INACTIVE"===t?"ACTIVE":"";o({label:"Are you sure you want to change the question status from "+t+" to "+n+"? Please confirm.",isDeleteBtn:!0,warning:!0,isWarningButtons:!0,rowData:e,updatedStatus:n})})(e)},l.createElement(t.EditIcon,{className:"table-cell-for-update",fill:"#a82227",style:{cursor:"pointer",marginLeft:"20px"}}))})),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],n=i.useFormContext();return l.createElement(t.SearchField,null,l.createElement(i.Controller,{name:"sortOrder",control:n.control,render:n=>{let a=n.onChange,o=n.value;return l.createElement(t.RadioButtons,{onSelect:e=>{a(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:o,table:k,setShowToast:c});function q(){h(!1)}return l.createElement(n.Fragment,null,l.createElement(t.Header,null,r("Search Questions"),F?l.createElement("p",{className:"inbox-count"},F):null),l.createElement(t.InboxComposer,m({isInboxLoading:P,PropsForInboxLinks:B},V,W,{propsForInboxMobileCards:j,propsForInboxTable:z,formState:x})),u&&l.createElement(t.Toast,{label:r(u.label),isDleteBtn:u.isDleteBtn,error:u.error,onClose:()=>{c(null)},onNo:()=>{c(null)},onYes:()=>{(()=>{const e=u.rowData;Digit.Surveys.updateQuestions({Questions:[{uuid:null==e?void 0:e.uuid,status:u.updatedStatus}]}).then(e=>{var t,n,l;(null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0?c({label:"Question status updated successfully",isDleteBtn:"true"}):c({label:(null==e||null===(n=e.Errors)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.message)||"Something went wrong",isDleteBtn:"true",error:!0})}).catch(e=>{var t,n,l,a;c({label:(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.message)||"Something went wrong",isDleteBtn:"true",error:!0})})})()},warning:u.warning,style:{padding:"16px"},isWarningButtons:u.isWarningButtons}),g&&l.createElement(gi,{onSelect:function(){h(!1)},onCancel:q,onDismiss:q,heading:"Question Details",actionCancel:!0,content:S,hideSubmit:!0}))},Mr=e=>{let t=e.children,n=e.currentStep,o=void 0===n?1:n,i=e.stepsList,r=void 0===i?[]:i;const s=a.useTranslation().t,u=(e,t)=>({display:"flex",alignItems:"center",justifyContent:"flex-start",flex:"0 0 auto",color:e?"#0D43A7":"#9CA3AF",padding:"14px 12px",width:"260px",marginBottom:t?"6px":"18px"}),c=e=>{const t=e<=o;return{width:"56px",height:"56px",borderRadius:"50%",background:t?"linear-gradient(135deg,#2563eb,#7c3aed)":"#ffffff",color:t?"#ffffff":"#0f172a",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"8px",fontWeight:600,fontSize:"18px",border:t?"none":"1px solid rgba(15,23,42,0.08)",boxShadow:t?"0 6px 18px rgba(37,99,235,0.18)":"0 2px 6px rgba(2,6,23,0.04)",position:"relative"}},d={fontSize:"16px",color:"#0f172a",fontWeight:600,fontFamily:"Noto Sans, sans-serif",marginRight:"8px",textAlign:"right"},v={fontSize:"14px",color:"#6b7280",fontWeight:500,fontFamily:"Noto Sans, sans-serif",margin:"0 6px 0 0"},p={position:"absolute",width:"3px",height:"56px",backgroundColor:"rgba(15,23,42,0.06)",left:"50%",top:"100%",transform:"translateX(-50%)",borderRadius:"2px"},E=window.Digit.Utils.browser.isMobile(),f=r.length,g=E?{width:"32px",height:"32px",fontSize:"12px"}:{},h=E?{fontSize:"10px"}:{},y=E?{width:"auto",padding:"6px",marginBottom:"0",flexDirection:"column",alignItems:"center"}:{};return l.createElement("div",{className:"stepper",style:{width:"100%",display:"flex",flexDirection:E?"column":"row",gap:"24px"}},l.createElement("div",{className:"stepper-navigation-bar",style:m({display:"flex",flexDirection:"column",alignItems:"center",padding:"18px",minWidth:"120px",maxWidth:"320px",marginBottom:"20px",marginTop:E?"20px":"0",height:E?"106px":""},E?{flexDirection:"row",overflowX:"auto",whiteSpace:"nowrap",minWidth:"100%",maxWidth:"100%",gap:"8px",padding:"10px"}:{})},[...Array(f)].map((e,t)=>l.createElement("div",{className:"step-content",key:t,style:m({},u(t+1<=o,t===f-1),y)},l.createElement("div",{className:"step-circle",style:m({},c(t+1),g)},t+1,t<f-1&&!E&&l.createElement("div",{style:p})),l.createElement("div",{className:"step-sub-content",style:{display:"flex",flexDirection:"column",alignItems:E?"center":"flex-end",margin:E?"4px":"10px"}},t+1===f?null:l.createElement("div",{className:"step-number",style:v}),l.createElement("div",{className:"step-label",style:m({},d,h,{textAlign:E?"center":"right"})},s(r[t].stepLabel)))))),l.createElement("div",{className:"stepper-body",style:{width:"100%",marginBottom:"20px",background:"transparent"}},t))},Pr=e=>{let t=e.stepsList,n=e.onSubmit,o=e.step,i=e.setStep;const r=(void 0===t?[]:t).filter(e=>e.isStepEnabled),s=a.useTranslation().t;function u(){o<r.length?d():o===r.length&&n()}function c(){o>1&&m()}const d=()=>i(o+1),m=()=>i(o-1);return l.createElement(Mr,{currentStep:o,nextStep:d,prevStep:m,stepsList:r},(()=>{var e,t;const n=r[o-1],a=n.component,i=n.key,d=n.texts,m=n.currStepConfig,v=null===(e=Digit)||void 0===e||null===(t=e.ComponentRegistryService)||void 0===t?void 0:t.getComponent(a);return l.createElement(l.Fragment,null,l.createElement(v,{config:{key:i,texts:d,component:a,currStepNumber:o,currStepConfig:m},onGoNext:u,onBackClick:c,t:s}))})())},Fr=[{head:"Survey Details",stepNumber:1,body:[{type:"component",component:"NewSurveys",key:"NewSurveys",withoutLabel:!0}]},{head:"Survey Sections",stepNumber:2,body:[{type:"component",component:"SurveyCreationPage",key:"SurveyCreationPage",withoutLabel:!0}]},{head:"Summary",stepNumber:3,body:[{type:"component",component:"SurveySummary",key:"SurveySummary",withoutLabel:!0}]}],kr=(e,t)=>({type:"UPDATE_SURVEY_FORM",payload:{key:e,value:t}}),Br=(e,t)=>({type:"FIELD_CHANGE",surveyId:e,data:t}),Ur=e=>({type:"ADD_CATEGORY",id:e}),Hr=(e,t)=>({type:"ADD_QUESTIONS",categoryId:e,questions:t}),Vr=(e,t)=>({type:"UPDATE_CATEGORY",categoryId:e,data:t}),Wr=(e,t,n)=>({type:"UPDATE_MANDATORY_QUESTION_SELECTION",categoryId:e,questionId:t,mandatory:n}),zr=(e,t)=>({type:"SET_QUESTIONS",categoryId:e,questions:t}),jr=e=>({type:"DELETE_CATEGORY",categoryId:e}),qr=[{head:"SURVEY_DETAILS",stepLabel:"Survey Details",stepNumber:1,isStepEnabled:!0,type:"component",component:"SurveyFormDetails",key:"surveyFormDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_CATEGORIES",stepLabel:"Survey Sections",stepNumber:2,isStepEnabled:!0,type:"component",component:"SurveyFormCategoryDetails",key:"surveyFormCategoryDetails",withoutLabel:!0,texts:{submitBarLabel:"Next Step"}},{head:"SURVEY_SUMMARY",stepLabel:"Summary",stepNumber:3,isStepEnabled:!0,type:"component",component:"SurveryFormSummary",key:"summary",withoutLabel:!0,texts:{submitBarLabel:"Submit"}}].map(e=>m({},e,{currStepConfig:Fr.filter(t=>t.stepNumber===e.stepNumber)})),Yr=()=>{o.useHistory();const e=a.useTranslation().t,i=u.useDispatch(),r=n.useState(null),s=r[0],c=r[1],d=u.useSelector(e=>e.engagement.surveyForm),m=d.step;return Digit.ULBService.getCurrentTenantId(),console.log("formState: ",d),l.createElement("div",{class:"card"},l.createElement("h1",{style:{color:"black",fontFamily:"Noto Sans,sans-serif",fontSize:"28px",fontWeight:"500"}},e("CREATE_NEW_SURVEY")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"50px"}}),l.createElement(Pr,{stepsList:qr,onSubmit:()=>{},step:m,setStep:e=>{i((e=>({type:"SET_SURVEY_STEP",payload:e}))(e))}}),s&&l.createElement(t.Toast,{error:s.key,label:e(s.label),onClose:()=>{c(null)},isDleteBtn:"true"}))},Gr=e=>{let o=e.formData,i=e.setFormData,r=e.errors,s=e.setErrors,u=e.stateCode,c=e.Otp,d=e.setGetOtp,v=e.setUser;const p=Digit.Hooks.useTenants().data,E=n.useState(null),f=E[0],g=E[1],h=a.useTranslation().t,y=Digit.ULBService.getCurrentTenantId(),S=n.useMemo(()=>null==p?void 0:p.filter(e=>y===(null==e?void 0:e.code)),[p,y]);n.useEffect(()=>{S&&S.length>0&&i(e=>m({},e,{city:S[0]}))},[S]);const b=Digit.Hooks.pt.useGenderMDMS(u,"common-masters","GenderType").data,_=n.useMemo(()=>(null==b?void 0:b.map(e=>({i18nKey:"PT_COMMON_GENDER_"+e.code,code:e.code,value:e.code})))||[],[b]),C=e=>{const t=e.target,n=t.name,l=t.value;i(e=>m({},e,{[n]:l}))};return n.useEffect(()=>{console.log("UPDATED formData",o)},[o]),l.createElement("div",{style:{border:"2px solid #ccc",padding:"15px",borderRadius:"4px"}},l.createElement("h2",null,"Citizen Details"),l.createElement("div",{style:{border:"1px solid #ccc"}}),l.createElement("h3",null,"Mobile Number ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"mobile",value:o.mobile,onChange:C,placeholder:"Enter Mobile Number",required:!0,maxLength:10}),r.mobile&&l.createElement("span",{className:"error"},r.mobile),l.createElement("h3",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"city",name:"city",option:p,className:"cityCss",select:e=>{return t=e,void i(e=>m({},e,{city:t}));var t},placeholder:"Select City",optionKey:"i18nKey",t:h,disable:"pb.punjab"!==y,selected:"pb.punjab"===y?null==o?void 0:o.city:null==S?void 0:S[0]}),r.city&&l.createElement("span",{className:"error"},r.city),l.createElement("label",{onClick:()=>{const e=(()=>{const e={};return o.mobile?/^\d{10}$/.test(o.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",o.city||(e.city="City is required"),e})();if(s(e),0===Object.keys(e).length){var t,n;const e={userName:null==o?void 0:o.mobile,tenantId:(null==o||null===(t=o.city)||void 0===t?void 0:t.code).split(".")[0]},l={tenantId:(null==o||null===(n=o.city)||void 0===n?void 0:n.code).split(".")[0]};Digit.Surveys.userSearch(e,l).then(e=>{var t,n,l,a,o;v(null==e||null===(t=e.user)||void 0===t?void 0:t[0]),console.log("response=====",null==e||null===(n=e.user)||void 0===n?void 0:n[0]),console.log("response",null===(l=e.user[0])||void 0===l?void 0:l.emailId),("200"===(null==e||null===(a=e.responseInfo)||void 0===a?void 0:a.status)||"201"===(null==e||null===(o=e.responseInfo)||void 0===o?void 0:o.status))&&(null==e?void 0:e.user.length)>0?(console.log("coming here na"),i(t=>{var n,l,a,o;return m({},t,{citizenFound:!0,name:null===(n=e.user[0])||void 0===n?void 0:n.name,email:null===(l=e.user[0])||void 0===l?void 0:l.emailId,gender:null===(a=e.user[0])||void 0===a?void 0:a.gender,dob:null===(o=e.user[0])||void 0===o?void 0:o.dob,register:!1,user:e.user[0]})})):(console.log("not here"),i(e=>m({},e,{citizenFound:!1})),g({key:!0,isError:!0,label:"CITIZEN NOT FOUND FOR THE GIVEN DETAILS"}))}).catch(e=>{console.log(e)})}}},"Fetch Details"),!1===o.citizenFound&&l.createElement("div",{style:{display:"flex",flexDirection:"row",columnGap:"10px"}},l.createElement("h3",null,"Do you want to register?"),l.createElement("label",{style:{backgroundColor:"green"},onClick:()=>{i(e=>m({},e,{register:!0}))}},"Yes"),l.createElement("label",{style:{backgroundColor:"red"},onClick:()=>{i(e=>m({},e,{register:!1}))}},"No")),(!0===o.register||!0===o.citizenFound)&&l.createElement(n.Fragment,null,l.createElement("h3",null,"Citizen Name"),l.createElement("input",{type:"text",name:"name",value:o.name,onChange:C,placeholder:"Citizen Name",readOnly:o.citizenFound,maxLength:100}),r.name&&l.createElement("span",{className:"error"},r.name),l.createElement("h3",null,"Citizen Gender"),l.createElement("select",{id:"dropdown",value:null==o?void 0:o.gender,onChange:e=>{return t=e,void i(e=>m({},e,{gender:t.target.value}));var t}},l.createElement("option",{value:""},"--Please choose an option--"),_.map((e,t)=>l.createElement("option",{key:t,value:e.value},e.value))),r.gender&&l.createElement("span",{className:"error"},r.gender),l.createElement("h3",null,"Citizen Email"),l.createElement("input",{type:"email",id:"emailInput",name:"email",value:o.email,onChange:C,placeholder:"Citizen Email",defaultValue:o.email}),r.email&&l.createElement("span",{className:"error"},r.email),l.createElement("h3",null,"Citizen Date of Birth"),l.createElement("input",{name:"dob",type:"date",onChange:e=>{const t=e.target,n=t.name,l=t.value;i(e=>m({},e,{[n]:l}))},defaultValue:o.dob,value:o.dob}),r.dob&&l.createElement("span",{className:"error"},r.dob),!0===o.register&&l.createElement("label",{onClick:()=>(()=>{const e={otp:{name:o.name,permanentCity:o.city.code,tenantId:""+u,mobileNumber:o.mobile,type:"register"}};try{Digit.UserService.sendOtp(e,u).then(e=>{!0===(null==e?void 0:e.isSuccessful)?d(!0):(g({key:!0,isError:!0,label:""+e}),d(!1))})}catch(e){d(!1)}})()},"Get OTP")),!0===c?l.createElement(n.Fragment,null,l.createElement("h3",{style:{marginTop:"20px"}},"OTP"),l.createElement("input",{type:"text",name:"otp",value:o.otp,onChange:C,placeholder:"Enter Otp"}),r.otp&&l.createElement("span",{className:"error"},r.otp)):null,f&&l.createElement(t.Toast,{error:f.isError,label:h(f.label),onClose:()=>{g(null)},isDleteBtn:"true"}))},Kr=e=>{var i;let r=e.stateCode;const s=o.useHistory(),u=a.useTranslation().t,c=o.useLocation(),d=n.useState(),v=d[0],E=d[1];console.log("loca",c.state.surveyDetails);const f=(null===(i=c.state)||void 0===i?void 0:i.surveyDetails)||{};console.log("surv det",f),Digit.UserService.getUser(),Digit.ULBService.getCurrentTenantId();const g=n.useState(null),h=g[0],y=g[1],S=(n.useState(null),n.useState(!1)),b=S[0],_=S[1],C=n.useState({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null}),T=C[0],D=C[1];console.log("formData",T);const N=n.useState({}),w=N[0],A=N[1];function x(e){const t=new Date(e),n=new Date;let l=n.getFullYear()-t.getFullYear();const a=n.getMonth()-t.getMonth();return(a<0||0===a&&n.getDate()<t.getDate())&&l--,l}return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("div",null,l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Name: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},f.surveyTitle)),l.createElement("h2",{style:{fontSize:"20px",fontWeight:"bold",color:"black"}},"Survey Description: ",l.createElement("span",{style:{fontWeight:"normal",color:"black"}},f.surveyDescription))),l.createElement("form",{onSubmit:function(e){try{let t=!1;if(e.preventDefault(),null===T.citizenFound)return y({key:!0,isError:!0,label:"PLEASE CLICK ON FETCH DETAILS BUTTON"}),Promise.resolve();const n=!0===T.register?(()=>{const e={};T.name?/^[A-Za-z\s]+$/.test(T.name)||(e.name="Name can only contain alphabets and spaces"):e.name="Name is required",T.email?/\S+@\S+\.\S+/.test(T.email)||(e.email="Invlid Email"):e.email="Email is required",T.gender||(e.gender="Gender is required");const t=x(T.dob);return T.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",T.mobile?/^\d{10}$/.test(T.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",T.city||(e.city="City is required"),T.otp||(e.otp="Otp is required"),A(e),0===Object.keys(e).length})():!0===T.citizenFound?(()=>{const e={};T.mobile?/^\d{10}$/.test(T.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",T.city||(e.city="City is required"),T.email?/\S+@\S+\.\S+/.test(T.email)||(e.email="Invlid Email"):e.email="Email is required",T.gender||(e.gender="Gender is required");const t=x(T.dob);return T.dob?(t<15||t>100)&&(e.dob="Age must be between 15 and 100 years"):e.dob="Date of Birth is required",A(e),0===Object.keys(e).length})():null,l=function(){if(n){console.log("Form submitted:",T),console.log("reg",T.register,T.citizenFound),console.log("getUser",v);const e=T.user,n=function(){if((!1===T.register||null===T.register)&&!0===T.citizenFound){function n(e){var n;if(t)return e;console.log("formData",T),s.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:T,userInfo:T.user,surveyDetails:f,userType:null===(n=c.state)||void 0===n?void 0:n.userType})}const l=T.email&&T.email!==(null==e?void 0:e.emailId),a=T.gender&&T.gender!==(null==e?void 0:e.gender),o=T.dob&&T.dob!==(null==e?void 0:e.dob),i=function(){if(l||a||o){const e=m({},v,l&&{emailId:T.email},a&&{gender:T.gender},o&&{dob:T.dob}),n=p(function(){return Promise.resolve(Digit.UserService.updateUser(e,null==v?void 0:v.tenantId)).then(function(e){console.log("User updated:",e.user)})},function(e){console.error("Error updating user:",e),y({key:!0,isError:!0,label:"FAILED TO UPDATE USER INFORMATION"}),t=!0});if(n&&n.then)return n.then(function(){})}else console.log("No user info changed. Skipping API call.")}();return i&&i.then?i.then(n):n(i)}(()=>{let e={name:T.name,username:T.mobile,otpReference:T.otp,tenantId:""+r,permanentCity:T.city.code};try{Digit.UserService.registerUser(e,r).then(e=>{null===(null==e?void 0:e.UserRequest)&&void 0===(null==e?void 0:e.UserRequest)||s.push("/digit-ui/employee/engagement/surveys/fill-survey",{citizenFill:!0,citizenData:T,userInfo:e.UserRequest,surveyDetails:f}),console.log("res",e)})}catch(e){console.log(e)}})()}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},l.createElement(Gr,{formData:T,setFormData:D,errors:w,setErrors:A,stateCode:r,Otp:b,setGetOtp:_,city:null==T?void 0:T.city,getUser:v,setUser:E}),l.createElement("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"10px",flexDirection:"row",marginTop:"10px"}},l.createElement("button",{type:"submit"},"Next"),l.createElement("button",{style:{backgroundColor:"none"},onClick:()=>D({name:"",mobile:"",email:"",dob:"",gender:"",city:"",otp:"",citizenFound:null,register:null,user:null})},"Reset")))),h&&l.createElement(t.Toast,{error:h.isError,label:u(h.label),onClose:()=>{y(null)},isDleteBtn:"true"}))},Qr=e=>{var n;const o=a.useTranslation().t;return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response[0])||void 0===n?void 0:n.uuid,info:e.props.isSuccess?o("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Xr=e=>{const i=r.useQueryClient(),s=a.useTranslation().t,u=(Digit.ULBService.getCurrentTenantId(),o.useHistory()),c=n.useState(!1),d=c[0],m=c[1];return n.useEffect(()=>{i.clear(),window.history.replaceState(null,"CREATE_SURVEY_STATE")},[]),l.createElement(t.Card,null,l.createElement(Qr,{props:e.location.state}),l.createElement(t.CardText,null,s("SURVEY_FORM_CREATION_MESSAGE",{surveyName:null==e?void 0:e.title,fromDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.startDate),toDate:Digit.DateUtils.ConvertTimestampToDate(null==e?void 0:e.endDate)})),l.createElement(t.ActionBar,null,l.createElement("button",{onClick:()=>{m(e=>!e)}},l.createElement(t.SubmitBar,{label:"Action"}),d&&l.createElement(t.Menu,{options:[s("GO_BACK_TO_HOME"),s("CREATE_ANOTHER_SURVEY")],onSelect:e=>{e===s("GO_BACK_TO_HOME")?u.replace("/digit-ui/employee"):e===s("CREATE_ANOTHER_SURVEY")&&u.replace("/digit-ui/employee/engagement/surveys/create-survey-step-form")}}))))},Zr=e=>{const n=a.useTranslation().t;return l.createElement(t.Banner,{message:n(e.isSuccess?"ENGAGEMENT_SURVEY_UPDATED":"ENGAGEMENT_SURVEY_UPDATE_FAILURE"),applicationNumber:(o=e.mutation,o.isSuccess&&null!=o&&null!==(i=o.data)&&void 0!==i&&null!==(r=i.Surveys)&&void 0!==r&&null!==(s=r[0])&&void 0!==s&&s.uuid?null==o||null===(m=o.data)||void 0===m||null===(v=m.Surveys)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid:o.isSuccess?null===(u=o.data)||void 0===u||null===(c=u.Documents)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.uuid:""),info:e.isSuccess?n("SURVEY_FORM_ID"):"",successful:e.isSuccess});var o,i,r,s,u,c,d,m,v,p},$r=e=>{const i=r.useQueryClient(),s=a.useTranslation().t,u=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.survey.useUpdate()),c=e.location.state;return n.useEffect(()=>{c&&u.mutate(c,{onSuccess:()=>{i.clear(),window.history.replaceState(null,"UPDATE_SURVEY_STATE")}})},[]),u.isLoading||u.isIdle?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Zr,{t:s,data:u.data,mutation:u,isSuccess:u.isSuccess,isLoading:u.isIdle||u.isLoading})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},Jr=e=>{let a=e.t,o=e.question,r=e.control,s=e.register,u=e.formState,c=e.formDisabled;const d=null==u?void 0:u.errors;if(o)return l.createElement(t.Card,null,l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("span",{className:"question-title"},e.index+1,". ",o.questionStatement," ",null!=o&&o.required?"*":""),l.createElement("span",null,(e=>{var u,m,v,p,E,f,g,h;switch(e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:s({maxLength:{value:200,message:a("EXCEEDS_200_CHAR_LIMIT")},required:o.required})}),d&&(null==d?void 0:d[o.uuid])&&"required"===(null==d||null===(u=d[o.uuid])||void 0===u?void 0:u.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),d&&(null==d?void 0:d[o.uuid])&&"maxLength"===(null==d||null===(m=d[o.uuid])||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_200_CHAR_LIMIT")));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:o.uuid,disabled:c,inputRef:s({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")},required:o.required})}),d&&(null==d?void 0:d[o.uuid])&&"required"===(null==d||null===(v=d[o.uuid])||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,a("CS_COMMON_REQUIRED")),d&&(null==d?void 0:d[o.uuid])&&"maxLength"===(null==d||null===(p=d[o.uuid])||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,a("EXCEEDS_500_CHAR_LIMIT")));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>l.createElement(t.RadioButtons,{disabled:c,onSelect:e.onChange,selectedOption:e.value,optionsKey:"",options:[...o.options]})}),d&&(null==d?void 0:d[o.uuid])&&"required"===(null==d||null===(E=d[o.uuid])||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>{let n=e.onChange,a=e.value;return l.createElement("div",{className:"align-columns"},o.options.map(e=>{var o;return l.createElement(t.CheckBox,{disable:c,key:e,onChange:t=>{t.target.checked?n([e,...a||[]]):a&&n(null==a?void 0:a.filter(t=>t!==e))},checked:"string"==typeof a?!(null===(o=[a])||void 0===o||!o.find(t=>t===e)):!(null==a||!a.find(t=>t===e)),label:e,checkboxWidth:{width:"34px",height:"34px"},style:{marginTop:"5px",overflowWrap:"break-word"}})}))}}),d&&(null==d?void 0:d[o.uuid])&&"required"===(null==d||null===(f=d[o.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(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>l.createElement(t.TextInput,{disabled:c,type:"date",onChange:e.onChange,defaultValue:e.value})}),d&&(null==d?void 0:d[o.uuid])&&"required"===(null==d||null===(g=d[o.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(i.Controller,{control:r,name:o.uuid,rules:{required:o.required},render:e=>l.createElement(t.TextInput,{type:"time",disabled:c,onChange:e.onChange,defaultValue:e.value})}),d&&(null==d?void 0:d[o.uuid])&&"required"===(null==d||null===(h=d[o.uuid])||void 0===h?void 0:h.type)&&l.createElement(t.CardLabelError,null,a("EVENTS_TO_DATE_ERROR_REQUIRED")));default:return l.createElement(t.TextInput,{name:o.uuid,disabled:c,type:"text",inputRef:s({maxLength:{value:60,message:a("EXCEEDS_60_CHAR_LIMIT")},required:o.required})})}})(o.type))))},es=e=>{var n,o;let r=e.surveyData,s=e.onFormSubmit,u=e.submitDisabled,c=e.formDisabled,d=e.isLoading,m=e.showToast,v=e.isSubmitDisabled;const p=i.useForm({defaultValues:e.formDefaultValues}),E=p.register,f=p.control,g=p.handleSubmit,h=p.getValues,y=p.formState,S=a.useTranslation().t;return d?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(s)},null!=r&&null!==(o=r.questions)&&void 0!==o&&o.length?r.questions.map((e,t)=>l.createElement(Jr,{key:t,t:S,question:e,control:f,register:E,values:h,formState:y,formDisabled:c,index:t})):null,m&&l.createElement(t.Toast,{error:m.key,label:S(m.label)}),l.createElement(t.ActionBar,null,!u&&l.createElement(t.SubmitBar,{disabled:v,label:S("CS_SUBMIT_SURVEY"),submit:"submit"}))))},ts=(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},ns=e=>{let t=e.t;const n=Object.entries(e.userInfo);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")),n.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")),n.map(e=>l.createElement("p",{style:{margin:"10px 0px 10px 0px"}},e[0])))))},ls=e=>{let a=e.surveyTitle,i=e.surveyDesc,r=e.t,s=e.surveyId;const u=o.useHistory(),c=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),d=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser().info,v=c.filter(e=>{var t;return null==m||null===(t=m.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}),p=n.useMemo(()=>c.filter(e=>e.code===d),[c]);return l.createElement("div",{className:"surveydetailsform-wrapper"},l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("LABEL_FOR_ULB")+" * :"),l.createElement("div",{style:{display:"grid",gridAutoFlow:"row"}},l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:v,selected:p,keepNull:!0,disable:!0,t:r}),l.createElement(t.RemoveableTag,{key:"tag",text:r(v[0].i18nKey),extraStyles:{tagStyles:{display:"flex"}}})),l.createElement(t.LinkLabel,{onClick:()=>u.push("/digit-ui/employee/engagement/surveys/inbox/details/"+s)},r("VIEW_SURVEY_QUESTIONS"))),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_NAME")),l.createElement(t.TextInput,{name:"title",type:"text",disable:!0,value:a})),l.createElement("span",{className:"surveyformfield"},l.createElement("label",null,r("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",disable:!0,value:i})))},as=["#8E29BF","#FBC02D","#048BD0","#EA8A3B","#0BABDE","#800080","#ee82ee","#616161","#3cb371","#6a5acd"],os=Math.PI/180,is=e=>{let t=e.cx,n=e.cy,a=e.midAngle,o=e.innerRadius,i=e.percent;const r=o+.5*(e.outerRadius-o),s=t+r*Math.cos(-a*os),u=n+r*Math.sin(-a*os);return l.createElement("text",{x:s,y:u,fill:"white",textAnchor:s>t?"start":"end",dominantBaseline:"central"},(100*i).toFixed(0)+"%")},rs=e=>{const t=e.payload;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)))))},ss=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(c.PieChart,{width:400,height:400},l.createElement(c.Pie,{data:t,cx:200,cy:200,labelLine:!1,label:is,outerRadius:120,fill:"#8884d8",dataKey:"value"},null==t?void 0:t.map((e,t)=>l.createElement(c.Cell,{key:"cell-"+t,fill:as[t%as.length]}))),l.createElement(c.Tooltip,null),l.createElement(c.Legend,{content:rs,width:100,align:"right",wrapperStyle:{top:40,right:20,left:500,backgroundColor:"#FAFAFA",borderRadius:3,lineHeight:"40px"}}))},us=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(c.ResponsiveContainer,null,l.createElement(c.BarChart,{data:t,layout:"vertical",margin:{top:0,right:50,left:0,bottom:0},barCategoryGap:8},l.createElement(c.CartesianGrid,{strokeDasharray:"3 3"}),l.createElement(c.XAxis,{type:"number"}),l.createElement(c.YAxis,{type:"category",width:150,padding:{left:20},dataKey:"name"}),l.createElement(c.Bar,{dataKey:"value",fill:"#048BD0"}),l.createElement(c.Tooltip,null))))},cs=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]}},ds=e=>{let o=e.surveyInfo,i=e.responsesInfoMutation;const r=a.useTranslation().t,s=n.useState(null),u=s[0],c=s[1],d=n.useState({}),m=d[0],v=d[1],p=Digit.ULBService.getCurrentTenantId();return n.useEffect(function(){try{const e=function(){if(i.isSuccess){const e=ts(null==o?void 0:o.questions,i.data.answers);return c(e),Promise.resolve(function(e,t){try{let n={},l=[];return l=null==e?void 0:e.map(e=>Digit.UserService.userSearch(t,{uuid:[null==e?void 0:e.citizenId]},{}).then(e=>e)),Promise.resolve(Promise.all(l)).then(function(e){var t;return l=e,l&&(null===(t=l)||void 0===t?void 0:t.length)>0&&l.map(e=>{var t,l,a,o;n["+91 "+(null==e||null===(t=e.user)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.mobileNumber)]=null==e||null===(a=e.user)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.emailId}),n})}catch(e){return Promise.reject(e)}}(i.data.answers,p.split(".")[0])).then(function(e){v(e)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[i]),u?l.createElement("div",{className:"custom-group-merge-container"},l.createElement(t.Header,null,r("CS_COMMON_SURVEYS")),l.createElement(t.MultiLink,{style:{marginTop:"-45px"},onHeadClick:()=>(()=>{const e=((e,t)=>{const n=parseInt(t.length/e.length),l=ts(null==o?void 0:o.questions,i.data.answers),a=[];for(let t=0;t<n;t++){const n={TimeStamp:""};null==e||e.map(e=>{n[e.questionStatement]=""});const o=null==e?void 0:e.map(e=>e.questionStatement);null==o||o.map(e=>{var a,o,i,r,s,u,c,d,m,v,p,E,f,g,h,y;const S=null==l?void 0:l.filter(t=>(null==t?void 0:t.questionStatement)===e),b="object"==typeof(null==S||null===(a=S[0])||void 0===a||null===(o=a.answers)||void 0===o?void 0:o[t])?null!=S&&null!==(i=S[0])&&void 0!==i&&null!==(r=i.answers)&&void 0!==r&&null!==(s=r[t])&&void 0!==s&&null!==(u=s.join())&&void 0!==u&&u.includes("ul")?"NA":null==S||null===(c=S[0])||void 0===c||null===(d=c.answers)||void 0===d||null===(m=d[t])||void 0===m?void 0:m.join():"ul"===(null==S||null===(v=S[0])||void 0===v||null===(p=v.answers)||void 0===p?void 0:p[t])||""===(null==S||null===(E=S[0])||void 0===E||null===(f=E.answers)||void 0===f?void 0:f[t])?"NA":null==S||null===(g=S[0])||void 0===g||null===(h=g.answers)||void 0===h?void 0:h[t];n[e]=b,n.TimeStamp=null==S||null===(y=S[0])||void 0===y?void 0:y.timeStamp}),a.push(n)}return a})(null==o?void 0:o.questions,i.data.answers);return Digit.Download.Excel(e,i.data.title)})(),downloadBtnClassName:"employee-download-btn-className",label:r("SURVEY_REPORT")}),l.createElement(t.Card,null,l.createElement("div",{style:{margin:"30px"}},l.createElement(ls,{surveyTitle:o.title,surveyDesc:o.description,t:r,surveyId:o.uuid})),l.createElement(ns,{t:r,userInfo:m}),null==u?void 0:u.map(e=>{var n;return function(e,n,a,o,i){switch(void 0===o&&(o=0),a){case"Short Answer":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Date":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"date-response"},l.createElement("div",null,cs(e).date),l.createElement("div",{className:"divide"}),l.createElement("div",null,cs(e).day)))));case"Time":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"date-container"},null==n?void 0:n.map(e=>{return l.createElement("div",{className:"date-response"},l.createElement("div",null,e),l.createElement("div",{className:"divide"}),l.createElement("div",null,((t=(t=e).toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[t]).length>1&&((t=t.slice(1))[5]=+t[0]<12?" AM":" PM",t[0]=+t[0]%12||12),t.join(""))));var t})));case"Paragraph":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container"},null==n?void 0:n.map(e=>l.createElement("div",{className:"response-result responses-container-line"},e,l.createElement(t.BreakLine,{style:{marginTop:"10px"}})))));case"Check Boxes":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{padding:"30px"}},l.createElement(us,{data:e})));case"Multiple Choice":return l.createElement("div",{style:{margin:"30px"}},l.createElement(t.CardSectionHeader,null,e.questionStatement),l.createElement("header",{style:{fontWeight:"bold"}},o+" "+i("SURVEY_RESPONSES")),l.createElement("div",{className:"responses-container",style:{overflow:"-moz-hidden-unscrollable"}},l.createElement(ss,{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)},ms={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"},vs=()=>{const e=Digit.ULBService.getCurrentTenantId(),a=o.useParams(),i=Digit.Hooks.survey.useShowResults(),s=r.useQueryClient();n.useEffect(()=>{i.mutate({surveyId:a.id},{onSuccess:()=>{s.clear()}})},[]);const u=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:xe(new Date(n.startDate),"yyyy-MM-dd"),toDate:xe(new Date(n.endDate),"yyyy-MM-dd"),fromTime:xe(new Date(n.startDate),"hh:mm"),toTime:xe(new Date(n.endDate),"hh:mm"),questions:n.questions.map(e=>({questionStatement:e.questionStatement,type:ms[e.type],required:e.required,options:e.options,uuid:e.uuid,surveyId:e.surveyId})),status:n.status,answersCount:n.answersCount}}}),c=u.data;return u.isLoading?l.createElement(t.Loader,null):l.createElement(ds,{surveyInfo:c,responsesInfoMutation:i})},ps=e=>{var n,o;const i=a.useTranslation().t;return console.log("props",e),l.createElement(t.Banner,{message:e.props.message,applicationNumber:null===(n=e.props.response)||void 0===n||null===(o=n.SubmitResponse)||void 0===o?void 0:o.surveyUuid,info:e.props.isSuccess?i("SURVEY_FORM_ID"):"",successful:e.props.isSuccess})},Es=e=>{r.useQueryClient();const n=a.useTranslation().t;return Digit.ULBService.getCurrentTenantId(),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ps,{props:e.location.state})),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},fs=e=>{const a=e.location.state.data;console.log("questions data",a);const o=n.useState(""),i=o[0],r=o[1],s=e=>{r("")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("form",null,a.sections.length>0?a.sections.map(e=>l.createElement("div",null,l.createElement("h2",null,e.title),e.questions.map((e,a)=>l.createElement("div",null,l.createElement("h3",null,e.questionStatement),l.createElement("div",{className:"surveyQuestion-wrapper"},l.createElement("div",{style:{display:"inline"}},a+1,". ",e.question.questionStatement," ",(null==e?void 0:e.required)&&l.createElement("span",{style:{color:"red"}},"*")),((e,a,o)=>{switch(console.log("answer type",e,a),e){case"SHORT_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{name:a.uuid,disable:!0,textInputStyle:{maxWidth:"none"},type:"text"}));case"LONG_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextArea,{name:a.uuid,style:{maxWidth:"none"},disable:!0,disabled:!0}));case"DROP_DOWN_MENU_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("select",{id:"dropdown",value:i,onChange:s},l.createElement("option",{value:""},"--Please choose an option--"),a.options.map((e,t)=>l.createElement("option",{key:t,value:null==e?void 0:e.optionText},null==e?void 0:e.optionText))));case"MULTIPLE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{type:"radio",name:a.uuid,value:null==e?void 0:e.optionText,disabled:!0,required:!0,style:{marginRight:"10px",width:"25px",height:"25px"}}),null==e?void 0:e.optionText))));case"CHECKBOX_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement("div",{style:{display:"flex",flexDirection:"column"}},a.options.map(e=>l.createElement("h4",{key:null==e?void 0:e.uuid,style:{display:"flex",alignItems:"center",marginBottom:"10px",fontSize:"18px"}},l.createElement("input",{style:{width:"25px",height:"25px",marginRight:"10px"},type:"checkbox",value:null==e?void 0:e.optionText,disabled:!0}),e.optionText))));case"DATE_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"date",textInputStyle:{maxWidth:"none"},disable:!0}));case"TIME_ANSWER_TYPE":return l.createElement(n.Fragment,null,l.createElement(t.TextInput,{type:"time",textInputStyle:{maxWidth:"none"},disable:!0}));default:return l.createElement(t.TextInput,{name:a.uuid,disable:!0,type:"text"})}})(e.question.type,e.question),l.createElement("div",null)))))):null)))},gs=e=>{var a,o,i,r,s,c,d;let m=e.t,v=e.registerRef,p=e.controlSurveyForm,E=e.surveyFormState,f=e.surveyFormData,g=e.readOnly;const h=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),y=Digit.ULBService.getCurrentTenantId(),b=Digit.Hooks.useTenants(),_=b.data,C=b.isLoading;console.log("cities",_),n.useEffect(()=>{if(!C&&null!=_&&_.length&&(null==N||!N.ulb)){const e=null==_?void 0:_.find(e=>e.code===y);e&&D(Br(N.id,{ulb:e}))}},[_,C,y]);const T=Digit.UserService.getUser().info,D=u.useDispatch(),N=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);console.log("surveyDetails====",N);const w=h.filter(e=>{var t;return null==T||null===(t=T.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(S);console.log("userulbs",w),n.useMemo(()=>h.filter(e=>e.code===y),[h]);const A=e=>{const t=e.target;D(Br(N.id,{[t.name]:t.value}))};return console.log("survey deta",N),console.log("bb",f,E,v,p),l.createElement("div",{className:"create-survey-card"},l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,"City"),l.createElement(t.Dropdown,{required:!0,id:"ulb",name:"ulb",option:_,className:"cityCss",select:e=>{D(Br(N.id,{ulb:e}))},placeholder:"Select City",optionKey:"i18nKey",t:m,selected:N.ulb}),(null==E||null===(a=E.errors)||void 0===a?void 0:a.tenantIds)&&l.createElement(t.CardLabelError,null,m("ES_ERROR_REQUIRED"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,m("CS_SURVEY_NAME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(t.TextInput,{name:"name",type:"text",inputRef:v({required:m("ES_ERROR_REQUIRED"),maxLength:{value:500,message:m("Survey Name length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:g||!1,value:N.name,onChange:A,placeholder:"Enter Survey Name",disable:g||!1}),(null==E||null===(o=E.errors)||void 0===o?void 0:o.title)&&l.createElement(t.CardLabelError,null,null==E||null===(i=E.errors)||void 0===i||null===(r=i.title)||void 0===r?void 0:r.message))),l.createElement("div",{className:"survey-column",style:{width:"100%"}},l.createElement("label",null,m("CS_SURVEY_DESCRIPTION")),l.createElement(t.TextInput,{name:"description",type:"text",inputRef:v({maxLength:{value:500,message:m("Survey Description length should be less than or equal to 500 characters")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -]*$/,message:m("ES_SURVEY_DONT_START_WITH_NUMBER")}}),readOnly:g||!1,value:N.description,onChange:A,placeholder:"Enter Survey Description",disable:g||!1}),(null==E||null===(s=E.errors)||void 0===s?void 0:s.description)&&l.createElement(t.CardLabelError,null,null==E||null===(c=E.errors)||void 0===c||null===(d=c.description)||void 0===d?void 0:d.message)))},hs=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},ys=e=>{var n,a,o,r,s,c,d,m;let v=e.t,p=e.controlSurveyForm,E=e.surveyFormState,f=e.enableEndDateTimeOnly,g=e.readOnly;const h=null==E?void 0:E.errors,y=u.useDispatch(),S=i.useFormContext().getValues,b=(new Date).getTime(),_=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]),C=e=>{const t=e.target;y(Br(_.id,{[t.name]:t.value}))};return l.createElement("div",{className:"create-survey-card"},l.createElement("div",null,l.createElement(t.CardSectionHeader,null,v("Survey Publish Period")),l.createElement("div",{style:{border:"1px solid #DFE0E2",marginBottom:"20px"}})),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromDate",defaultValue:_.fromDate,onChange:C,rules:{required:!0,validate:f?null:{isValidFromDate:e=>{const t=new Date(e).getTime(),n=S("toDate")?new Date(S("toDate")).getTime():(new Date).getTime();return e===S("toDate")&&e>=hs(b)||n>=t&&e>=hs(b)}}},render:e=>l.createElement(t.TextInput,{name:"fromDate",type:"date",onChange:C,defaultValue:_.fromDate,disable:g||!1})}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(n=h.fromDate)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(a=h.fromDate)||void 0===a?void 0:a.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_FROM_DATE_ERROR_INVALID"))),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_START_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"fromTime",defaultValue:_.fromTime,rules:{required:!0,validate:{isValidFromTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"fromTime",type:"time",onChange:C,defaultValue:_.fromTime,disable:g||!1})}),h&&(null==h?void 0:h.fromTime)&&"required"===(null==h||null===(o=h.fromTime)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromTime)&&"isValidFromDate"===(null==h||null===(r=h.fromTime)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))),l.createElement("div",{className:"survey-row"},l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_DATE")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toDate",defaultValue:_.toDate,rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>=(S("fromDate")?new Date(S("fromDate")).getTime():(new Date).getTime())}},render:e=>l.createElement(t.TextInput,{name:"toDate",type:"date",onChange:C,defaultValue:_.toDate,disable:g||!1})}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(s=h.toDate)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(c=h.toDate)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID"))," "),l.createElement("div",{className:"survey-column"},l.createElement("label",null,v("LABEL_SURVEY_END_TIME")," ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement(i.Controller,{control:p,name:"toTime",defaultValue:null==_?void 0:_.toTime,rules:{required:!0,validate:{isValidToTime:()=>!0}},render:e=>l.createElement(t.TextInput,{name:"toTime",type:"time",onChange:C,defaultValue:_.toTime,disable:g||!1})}),h&&(null==h?void 0:h.toTime)&&"required"===(null==h||null===(d=h.toTime)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toTime)&&"isValidToDate"===(null==h||null===(m=h.toTime)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,v("EVENTS_TO_DATE_ERROR_INVALID")))))},Ss=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],bs=e=>{let t=e.t,a=e.onSubmit,o=e.readOnly;const r=i.useForm({defaultValues:e.initialFormValues}),s=r.register,u=r.control,c=r.handleSubmit,d=r.setValue,p=r.getValues,E=r.reset,f=r.formState,g=r.clearErrors,h=v(r,Ss);return console.log("surveyformValue",p,u,f),n.useEffect(()=>{s("questions")},[]),l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,m({register:s,control:u,handleSubmit:c,setValue:d,getValues:p,reset:E,formState:f,clearErrors:g},h),l.createElement("form",{onSubmit:c(a),style:{marginRight:"10px"}},l.createElement(gs,{t:t,registerRef:s,controlSurveyForm:u,surveyFormState:f,surveyFormData:p,readOnly:o}),l.createElement(ys,{t:t,controlSurveyForm:u,surveyFormState:f,readOnly:o}))))},_s=e=>{let t=e.readOnly;const n=a.useTranslation().t,o=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),i=Digit.UserService.getUser().info,r=o.filter(e=>{var t;return null==i||null===(t=i.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))});return l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement(bs,{t:n,initialFormValues:{fromDate:"",fromTime:"",toDate:"",toTime:"",questions:{},tenantIds:r},readOnly:t}))},Cs=e=>l.createElement("div",null,l.createElement("h4",null,"Question"),l.createElement("select",null,l.createElement("option",{value:""},"Select Answer Type"),l.createElement("option",{value:"text"},"Text"),l.createElement("option",{value:"number"},"Number"),l.createElement("option",{value:"date"},"Date")),l.createElement("input",{type:"text",placeholder:"Answer"})),Ts=e=>{let t=e.category,n=e.sectionId;const a=u.useDispatch();return l.createElement("div",null,l.createElement("h3",null,"Category"),l.createElement("input",{type:"number",value:t.weightage,onChange:e=>{a(((e,t,n)=>({type:"UPDATE_CATEGORY_WEIGHTAGE",sectionId:e,categoryId:t,weightage:n}))(n,t.id,e.target.value))},placeholder:"Category Weightage"}),l.createElement("button",{onClick:()=>{a(((e,t)=>({type:"ADD_QUESTION",sectionId:e,categoryId:t}))(n,t.id))}},"Add Question"),t.questions.map(e=>l.createElement(Cs,{key:e.id,question:e})))},Ds=e=>{var n;let a=e.section;const o=u.useDispatch();return console.log("section in section js",a.categories),l.createElement("div",null,l.createElement("h2",null,"Section"),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},"CS_COMMON_QUESTION"),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement(t.TextInput,{value:null==a?void 0:a.weightage,onChange:e=>{o({type:"UPDATE_SECTION_WEIGHTAGE",sectionId:a.id,weightage:e.target.value})},placeholder:"Section Weightage",name:"weightage"}),l.createElement("button",{onClick:()=>{o({type:"ADD_CATEGORY",sectionId:a.id})}},"Add Category"),null!=a&&null!==(n=a.categories)&&void 0!==n&&n.length?a.categories.map(e=>l.createElement(Ts,{key:e.id,category:e,sectionId:null==a?void 0:a.id})):null,".")))},Ns=["register","control","handleSubmit","setValue","getValues","reset","formState","clearErrors"],ws=e=>{let n=e.match,a=(void 0===n?{}:n).path,i=e.tenants,r=e.parentRoute,s=e.userType,u=e.stateCode;return l.createElement(o.Switch,null,l.createElement(t.PrivateRoute,{path:a+"/inbox",component:e=>l.createElement(fr,m({},e,{tenants:i,parentRoute:r}))}),l.createElement(t.PrivateRoute,{path:a+"/create-category",component:e=>l.createElement(gr,e)}),l.createElement(t.PrivateRoute,{path:a+"/search-categories",component:e=>l.createElement(Sr,m({},e,{parentRoute:r}))}),l.createElement(t.PrivateRoute,{path:a+"/create-questions",component:e=>l.createElement(Or,e)}),l.createElement(t.PrivateRoute,{path:a+"/search-questions",component:e=>l.createElement(Rr,e)}),l.createElement(t.PrivateRoute,{path:a+"/create-survey-step-form",component:e=>l.createElement(Yr,e)}),l.createElement(t.PrivateRoute,{path:a+"/fill-citizen-details-survey",component:e=>l.createElement(Kr,m({},e,{stateCode:u}))}),l.createElement(t.PrivateRoute,{path:a+"/fill-survey",component:e=>l.createElement(Hi,m({},e,{userType:s}))}),l.createElement(t.PrivateRoute,{path:a+"/active-open-surveys",component:e=>l.createElement(vi,m({},e,{userType:s}))}),l.createElement(t.PrivateRoute,{path:a+"/create-response",component:e=>l.createElement(Xr,e)}),l.createElement(t.PrivateRoute,{path:a+"/update-response",component:e=>l.createElement($r,e)}),l.createElement(t.PrivateRoute,{path:a+"/submit-response",component:e=>l.createElement(Es,e)}),l.createElement(t.PrivateRoute,{path:a+"/inbox/results/:id",component:e=>l.createElement(vs,e)}),l.createElement(t.PrivateRoute,{path:a+"/previewQuestions",component:e=>l.createElement(fs,e)}))},As=e=>{let n=e.t;return l.createElement(l.Fragment,null,l.createElement("div",{style:{textAlign:"-webkit-center",marginTop:"30%",marginRight:"10%"}},l.createElement("svg",{width:"255",height:"245",viewBox:"0 0 255 245",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("g",{"clip-path":"url(#clip0_47664_105169)"},l.createElement("path",{d:"M214.607 58.0692H213.267V21.2879C213.267 15.642 211.027 10.2273 207.039 6.23508C203.051 2.24282 197.641 2.77689e-09 192.001 2.77689e-09H114.153C111.36 -4.51493e-05 108.595 0.550538 106.015 1.62031C103.435 2.69009 101.09 4.2581 99.1157 6.23483C97.1409 8.21157 95.5744 10.5583 94.5056 13.141C93.4369 15.7238 92.8868 18.492 92.8867 21.2875V223.073C92.8867 228.719 95.1273 234.133 99.1154 238.125C103.104 242.118 108.513 244.36 114.153 244.36H192C197.64 244.36 203.049 242.118 207.038 238.125C211.026 234.133 213.266 228.719 213.266 223.073V84.2507H214.606L214.607 58.0692Z",fill:"#3F3D56"}),l.createElement("path",{d:"M208.905 19.8617V224.497C208.904 228.778 207.206 232.883 204.182 235.91C201.159 238.938 197.058 240.639 192.782 240.641H113.337C109.059 240.641 104.956 238.941 101.93 235.914C98.9044 232.886 97.2039 228.78 97.2026 224.497V19.8617C97.2039 15.5795 98.9043 11.4732 101.93 8.44588C104.955 5.41857 109.058 3.7182 113.336 3.71875H122.973C122.5 4.88362 122.32 6.14702 122.449 7.39789C122.577 8.64876 123.011 9.84881 123.712 10.8926C124.412 11.9363 125.358 12.7918 126.467 13.3838C127.575 13.9759 128.812 14.2863 130.068 14.2879H175.361C176.617 14.2863 177.854 13.9759 178.962 13.3838C180.07 12.7918 181.016 11.9363 181.717 10.8926C182.418 9.84881 182.851 8.64876 182.98 7.39789C183.109 6.14702 182.929 4.88362 182.456 3.71875H192.779C197.055 3.71948 201.156 5.42005 204.18 8.44661C207.204 11.4732 208.904 15.578 208.905 19.8586V19.8617Z",fill:"white"}),l.createElement("path",{d:"M153.04 102.01C171.357 102.01 186.207 87.1455 186.207 68.8088C186.207 50.4722 171.357 35.6074 153.04 35.6074C134.722 35.6074 119.872 50.4722 119.872 68.8088C119.872 87.1455 134.722 102.01 153.04 102.01Z",fill:"#a82227"}),l.createElement("path",{d:"M189.213 137.735H118.616C118.27 137.734 117.937 137.596 117.692 137.351C117.447 137.106 117.309 136.773 117.309 136.426V118.896C117.31 118.55 117.447 118.217 117.692 117.972C117.938 117.726 118.27 117.588 118.616 117.588H189.213C189.559 117.588 189.891 117.726 190.137 117.972C190.382 118.217 190.519 118.55 190.52 118.896V136.426C190.519 136.773 190.382 137.106 190.137 137.351C189.891 137.596 189.559 137.735 189.213 137.735V137.735ZM118.616 118.111C118.408 118.111 118.209 118.194 118.062 118.341C117.915 118.489 117.832 118.688 117.832 118.896V136.426C117.832 136.635 117.915 136.834 118.062 136.981C118.209 137.129 118.408 137.211 118.616 137.212H189.213C189.421 137.211 189.62 137.129 189.767 136.981C189.914 136.834 189.997 136.635 189.997 136.426V118.896C189.997 118.688 189.914 118.489 189.767 118.341C189.62 118.194 189.421 118.111 189.213 118.111H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 123.901C140.206 123.901 139.973 123.998 139.802 124.17C139.63 124.341 139.534 124.575 139.534 124.817C139.534 125.06 139.63 125.293 139.802 125.465C139.973 125.637 140.206 125.734 140.449 125.734H183.591C183.833 125.743 184.07 125.655 184.248 125.49C184.426 125.325 184.531 125.096 184.541 124.853C184.55 124.61 184.462 124.374 184.297 124.195C184.132 124.017 183.903 123.912 183.661 123.902C183.647 123.902 183.634 123.902 183.621 123.902L140.449 123.901Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 129.396C140.206 129.396 139.973 129.493 139.802 129.665C139.63 129.837 139.534 130.07 139.534 130.313C139.534 130.556 139.63 130.789 139.802 130.96C139.973 131.132 140.206 131.229 140.449 131.229H183.591C183.833 131.238 184.07 131.15 184.248 130.985C184.426 130.82 184.531 130.591 184.541 130.348C184.55 130.105 184.462 129.869 184.297 129.69C184.132 129.512 183.903 129.407 183.661 129.397C183.647 129.397 183.634 129.397 183.621 129.397L140.449 129.396Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 166.953H118.616C118.27 166.953 117.937 166.815 117.692 166.57C117.447 166.324 117.309 165.992 117.309 165.645V148.115C117.31 147.768 117.447 147.436 117.692 147.19C117.938 146.945 118.27 146.807 118.616 146.807H189.213C189.559 146.807 189.891 146.945 190.137 147.19C190.382 147.436 190.519 147.768 190.52 148.115V165.645C190.519 165.992 190.381 166.324 190.136 166.57C189.891 166.815 189.559 166.953 189.213 166.953ZM118.616 147.33C118.408 147.33 118.209 147.413 118.062 147.56C117.915 147.707 117.832 147.907 117.832 148.115V165.645C117.832 165.853 117.915 166.053 118.062 166.2C118.209 166.347 118.408 166.43 118.616 166.43H189.213C189.421 166.43 189.62 166.347 189.767 166.2C189.914 166.053 189.997 165.853 189.997 165.645V148.115C189.997 147.907 189.914 147.707 189.767 147.56C189.62 147.413 189.421 147.33 189.213 147.33H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 153.214C140.206 153.214 139.973 153.31 139.802 153.482C139.63 153.654 139.534 153.887 139.534 154.13C139.534 154.373 139.63 154.606 139.802 154.778C139.973 154.95 140.206 155.046 140.449 155.046H183.591C183.83 155.045 184.059 154.95 184.229 154.781C184.399 154.613 184.497 154.384 184.501 154.145C184.505 153.905 184.415 153.674 184.25 153.5C184.086 153.326 183.86 153.223 183.621 153.214H140.449V153.214Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 158.711C140.206 158.711 139.973 158.807 139.802 158.979C139.63 159.151 139.534 159.384 139.534 159.627C139.534 159.87 139.63 160.103 139.802 160.275C139.973 160.447 140.206 160.543 140.449 160.543H183.591C183.83 160.542 184.059 160.447 184.229 160.278C184.399 160.11 184.497 159.881 184.501 159.642C184.505 159.402 184.415 159.171 184.25 158.997C184.086 158.823 183.86 158.72 183.621 158.711H140.449V158.711Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M189.213 196.267H118.616C118.27 196.266 117.937 196.129 117.692 195.883C117.447 195.638 117.309 195.305 117.309 194.958V177.429C117.31 177.082 117.447 176.749 117.692 176.504C117.938 176.259 118.27 176.121 118.616 176.12H189.213C189.559 176.121 189.891 176.259 190.137 176.504C190.382 176.749 190.519 177.082 190.52 177.429V194.959C190.519 195.306 190.382 195.638 190.137 195.883C189.891 196.129 189.559 196.267 189.213 196.267V196.267ZM118.616 176.643C118.408 176.644 118.209 176.726 118.062 176.874C117.915 177.021 117.832 177.221 117.832 177.429V194.959C117.832 195.167 117.915 195.366 118.062 195.514C118.209 195.661 118.408 195.744 118.616 195.744H189.213C189.421 195.744 189.62 195.661 189.767 195.514C189.914 195.366 189.997 195.167 189.997 194.959V177.429C189.997 177.221 189.914 177.021 189.767 176.874C189.62 176.726 189.421 176.644 189.213 176.643H118.616Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 182.529C140.206 182.529 139.973 182.626 139.802 182.798C139.63 182.969 139.534 183.202 139.534 183.445C139.534 183.688 139.63 183.921 139.802 184.093C139.973 184.265 140.206 184.362 140.449 184.362H183.591C183.711 184.366 183.831 184.347 183.943 184.305C184.056 184.264 184.16 184.2 184.248 184.118C184.336 184.036 184.407 183.938 184.457 183.829C184.508 183.719 184.536 183.601 184.541 183.481C184.545 183.361 184.526 183.241 184.484 183.128C184.443 183.015 184.379 182.912 184.297 182.823C184.216 182.735 184.117 182.664 184.008 182.613C183.899 182.563 183.781 182.535 183.661 182.53C183.647 182.53 183.634 182.53 183.621 182.53L140.449 182.529Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M140.449 188.025C140.206 188.025 139.973 188.122 139.802 188.294C139.63 188.466 139.534 188.699 139.534 188.942C139.534 189.184 139.63 189.418 139.802 189.589C139.973 189.761 140.206 189.858 140.449 189.858H183.591C183.711 189.862 183.831 189.843 183.943 189.801C184.056 189.76 184.16 189.696 184.248 189.614C184.336 189.533 184.407 189.434 184.457 189.325C184.508 189.216 184.536 189.097 184.541 188.977C184.545 188.857 184.526 188.737 184.484 188.624C184.443 188.511 184.379 188.408 184.297 188.319C184.216 188.231 184.117 188.16 184.008 188.11C183.899 188.059 183.781 188.031 183.661 188.026C183.647 188.026 183.634 188.026 183.621 188.026H140.449L140.449 188.025Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M254.334 245H0.665646C0.297787 245 0 244.839 0 244.641C0 244.442 0.29813 244.281 0.665646 244.281H254.334C254.702 244.281 255 244.442 255 244.641C255 244.839 254.702 245 254.334 245Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.591 230.984C242.507 231.365 241.344 231.461 240.212 231.261C239.081 231.062 238.02 230.574 237.132 229.845C234.869 227.944 234.16 224.812 233.583 221.913L231.876 213.336L235.45 215.799C238.02 217.571 240.648 219.399 242.428 221.965C244.208 224.531 244.984 228.034 243.554 230.81",fill:"#E6E6E6"}),l.createElement("path",{d:"M243.039 241.965C243.489 238.684 243.952 235.361 243.636 232.046C243.356 229.101 242.458 226.225 240.631 223.866C239.661 222.617 238.481 221.547 237.144 220.703C236.795 220.483 236.474 221.036 236.821 221.255C239.135 222.719 240.925 224.881 241.932 227.429C243.045 230.263 243.224 233.351 243.032 236.361C242.915 238.181 242.67 239.989 242.422 241.795C242.403 241.877 242.415 241.963 242.456 242.036C242.498 242.109 242.565 242.163 242.646 242.188C242.727 242.21 242.814 242.199 242.888 242.157C242.961 242.115 243.016 242.046 243.038 241.965H243.039Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M239.801 236.7C239.337 237.408 238.698 237.983 237.946 238.371C237.195 238.759 236.356 238.947 235.511 238.917C233.339 238.814 231.529 237.297 229.899 235.857L225.078 231.595L228.269 231.443C230.563 231.333 232.917 231.23 235.104 231.938C237.291 232.647 239.305 234.351 239.704 236.614",fill:"#E6E6E6"}),l.createElement("path",{d:"M244.311 243.85C242.147 240.015 239.633 235.752 235.145 234.389C233.897 234.011 232.589 233.876 231.29 233.991C230.88 234.025 230.983 234.658 231.393 234.622C233.57 234.441 235.742 235.017 237.545 236.252C239.28 237.434 240.631 239.077 241.774 240.82C242.474 241.885 243.101 243 243.728 244.111C243.928 244.466 244.514 244.21 244.311 243.85Z",fill:"#F2F2F2"}),l.createElement("path",{d:"M127.423 133.05C130.456 133.05 132.914 130.59 132.914 127.554C132.914 124.518 130.456 122.058 127.423 122.058C124.391 122.058 121.933 124.518 121.933 127.554C121.933 130.59 124.391 133.05 127.423 133.05Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 126.527C124.731 126.527 124.68 126.938 124.68 127.443C124.68 127.949 124.731 128.36 124.795 128.36H130.194C130.257 128.368 130.309 127.965 130.31 127.459C130.345 127.144 130.307 126.825 130.197 126.528H124.795V126.527Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 162.376C130.456 162.376 132.914 159.915 132.914 156.879C132.914 153.844 130.456 151.383 127.423 151.383C124.391 151.383 121.933 153.844 121.933 156.879C121.933 159.915 124.391 162.376 127.423 162.376Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 155.853C124.731 155.853 124.68 156.263 124.68 156.768C124.68 157.274 124.731 157.685 124.795 157.685H130.194C130.257 157.693 130.309 157.29 130.31 156.784C130.345 156.469 130.307 156.15 130.197 155.853L124.795 155.853Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M127.423 191.69C130.456 191.69 132.914 189.229 132.914 186.194C132.914 183.158 130.456 180.697 127.423 180.697C124.391 180.697 121.933 183.158 121.933 186.194C121.933 189.229 124.391 191.69 127.423 191.69Z",fill:"#a82227"}),l.createElement("path",{d:"M124.795 185.167C124.731 185.167 124.68 185.577 124.68 186.083C124.68 186.589 124.731 186.999 124.795 186.999H130.194C130.257 187.007 130.309 186.604 130.31 186.098C130.345 185.784 130.307 185.465 130.197 185.167L124.795 185.167Z",fill:"#E6E6E6"}),l.createElement("path",{d:"M145.875 59.6918L143.932 61.6367L160.204 77.9258L162.147 75.9808L145.875 59.6918Z",fill:"white"}),l.createElement("path",{d:"M162.147 61.6373L160.204 59.6924L143.932 75.9815L145.875 77.9264L162.147 61.6373Z",fill:"white"}),l.createElement("path",{d:"M71.002 156.83C71.478 156.662 71.9113 156.391 72.2713 156.036C72.6314 155.682 72.9094 155.253 73.0858 154.779C73.2622 154.305 73.3328 153.799 73.2925 153.295C73.2522 152.791 73.102 152.302 72.8526 151.863L80.9466 142.626L74.6282 141.754L67.9107 150.659C67.201 151.127 66.6875 151.84 66.4677 152.662C66.2479 153.484 66.3369 154.358 66.718 155.119C67.099 155.88 67.7456 156.474 68.5352 156.789C69.3248 157.105 70.2025 157.119 71.002 156.83Z",fill:"#9F616A"}),l.createElement("path",{d:"M80.7632 238.688L75.1182 238.688L72.4326 216.892L80.7642 216.892L80.7632 238.688Z",fill:"#9F616A"}),l.createElement("path",{d:"M82.2023 244.166L64 244.165V243.935C64.0001 242.054 64.7466 240.25 66.0752 238.92C67.4039 237.59 69.2058 236.843 71.0848 236.843H71.0853L82.2026 236.843L82.2023 244.166Z",fill:"#2F2E41"}),l.createElement("path",{d:"M110.313 233.959L104.922 235.634L95.9004 215.615L103.857 213.143L110.313 233.959Z",fill:"#9F616A"}),l.createElement("path",{d:"M113.311 238.763L95.9269 244.166L95.8586 243.945C95.3015 242.149 95.4801 240.205 96.3549 238.54C97.2298 236.876 98.7294 235.627 100.524 235.069L100.524 235.069L111.142 231.77L113.311 238.763Z",fill:"#2F2E41"}),l.createElement("path",{d:"M76.4396 138.198L68.0791 147.783L74.6244 148.373L76.4396 138.198Z",fill:"#a82227"}),l.createElement("path",{d:"M73.173 150.552C73.173 150.552 70.269 152.006 69.9059 158.546C69.5429 165.087 70.9951 182.167 70.9951 182.167C70.9951 182.167 69.5432 189.798 70.9951 196.702C72.4469 203.606 69.5432 228.678 71.3581 228.678C73.173 228.678 82.611 229.768 82.974 228.678C83.3371 227.587 83.7001 211.236 83.7001 211.236C83.7001 211.236 86.6042 202.878 83.7001 197.792C83.7001 197.792 93.8397 215.516 100.398 229.042C101.833 232.002 112.74 228.679 110.925 225.408C109.11 222.138 104.754 207.24 104.754 207.24C104.754 207.24 101.487 196.338 95.6794 191.614L98.5835 168.359C98.5835 168.359 104.755 152.733 101.125 150.553C97.4957 148.373 73.173 150.552 73.173 150.552Z",fill:"#2F2E41"}),l.createElement("path",{d:"M84.0629 91.322C89.2754 91.322 93.5009 87.0921 93.5009 81.8744C93.5009 76.6566 89.2754 72.4268 84.0629 72.4268C78.8505 72.4268 74.625 76.6566 74.625 81.8744C74.625 87.0921 78.8505 91.322 84.0629 91.322Z",fill:"#A0616A"}),l.createElement("path",{d:"M94.5899 92.0488L82.8568 98.9528C82.8568 98.9528 78.3642 101.485 76.686 105.857C74.8972 110.516 75.9369 117.075 76.686 118.575C78.1379 121.482 76.077 128.749 76.077 128.749L74.2621 145.464C74.2621 145.464 67.7282 151.642 72.8103 152.368C77.8923 153.095 86.9672 152.005 92.4123 152.368C97.8573 152.732 104.028 153.459 102.213 149.824C100.398 146.189 98.2204 143.647 100.398 136.381C102.103 130.694 102.029 109.431 101.916 100.451C101.901 99.2177 101.57 98.0091 100.956 96.9398C100.342 95.8706 99.4655 94.9763 98.4089 94.3421L94.5899 92.0488Z",fill:"#a82227"}),l.createElement("path",{opacity:"0.1",d:"M89.3278 103.496L90.4166 125.662L79.8631 147.056L78.0732 146.374L88.9634 126.388L89.3278 103.496Z",fill:"black"}),l.createElement("path",{opacity:"0.1",d:"M101.305 130.385V127.841L88.9648 148.19L101.305 130.385Z",fill:"black"}),l.createElement("path",{d:"M77.3647 73.1222L75.8057 72.4978C75.8057 72.4978 79.0687 68.9025 83.607 69.215L82.3303 67.8081C82.3303 67.8081 85.4508 66.5576 88.2879 69.8401C89.7792 71.5657 91.5045 73.5943 92.5813 75.879H94.2523L93.555 77.4162L95.9957 78.9535L93.4904 78.6784C93.7277 80.0055 93.6465 81.3701 93.2534 82.6596L93.3221 83.8746C93.3221 83.8746 90.4167 79.3743 90.4167 78.7499V80.3133C90.4167 80.3133 88.8563 78.9064 88.8563 77.9684L88.0052 79.0628L87.5796 77.3437L82.3314 79.0628L83.1818 77.6552L79.9188 78.1242L81.1955 76.405C81.1955 76.405 77.5076 78.4371 77.3658 80.1569C77.2239 81.8767 75.3802 84.0648 75.3802 84.0648L74.529 82.5014C74.529 82.5014 73.2527 75.4671 77.3647 73.1222Z",fill:"#2F2E41"}),l.createElement("path",{d:"M83.4712 157.858C83.9097 157.608 84.2881 157.264 84.5795 156.851C84.871 156.439 85.0685 155.967 85.1582 155.47C85.2478 154.972 85.2274 154.461 85.0984 153.972C84.9694 153.484 84.735 153.029 84.4116 152.641L90.7392 142.113L84.3665 142.377L79.3346 152.334C78.7192 152.921 78.3404 153.714 78.2698 154.562C78.1992 155.41 78.4419 156.255 78.9518 156.936C79.4617 157.617 80.2033 158.087 81.0363 158.257C81.8693 158.427 82.7356 158.285 83.4712 157.858Z",fill:"#9F616A"}),l.createElement("path",{d:"M97.8577 96.7735L100.58 96.2285C100.58 96.2285 108.748 102.224 106.206 114.215C103.665 126.207 92.4126 144.375 92.4126 144.375C92.4126 144.375 89.8709 147.646 89.1455 148.372C88.4201 149.099 86.9676 148.372 87.6937 149.463C88.4198 150.553 86.6045 151.279 86.6045 151.279C86.6045 151.279 78.6184 151.279 79.3445 148.372C80.0706 145.465 92.4126 124.752 92.4126 124.752L90.5977 105.493C90.5977 105.493 89.1452 96.0466 97.8577 96.7735Z",fill:"#a82227"})),l.createElement("defs",null)),l.createElement("h",{style:{color:"#505A5F",fontWeight:"400",fontFamily:"Roboto",marginLeft:"10%",lineHeight:"3"}},n("SURVEY_ENDED_MESSAGE"))),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},xs=e=>{if(!e)return;const t=[];for(const n in e)t.push({questionId:n,answer:[e[n]]});return t},Os={surveyDetails:[{id:1,ulb:"",tenantIds:"",name:"",description:"",fromDate:"",fromTime:"",toDate:"",toTime:""}],categories:[{id:1,title:"",weightage:100,selectCategory:"",questionStatement:"",questions:[],selectedQuestions:[]}],autoCalculateCategoriesWeight:!0,goPrev:!1,goNext:!1,stepData:{},step:1,isValid:!1,formData:{}},Is=function(e,t){switch(void 0===e&&(e=Os),t.type){case"GO_PREV":return m({},e,{goPrev:!0});case"GO_NEXT":return m({},e,{goNext:!0});case"AUTO_CALCULATE_CATEGORY":return m({},e,{autoCalculateCategoriesWeight:t.categoryWeight});case"ADD_CATEGORY":const n=[...e.categories,{id:t.id,title:"",weightage:"",selectCategory:"",questions:[],selectedQuestions:[]}];return m({},e,{categories:n});case"RECALCULATE_WEIGHTAGE":const l=e.categories.map(t=>m({},t,{weightage:Math.floor(100/e.categories.length*100)/100}));return m({},e,{categories:l});case"DELETE_CATEGORY":const a=e.categories.filter(e=>e.id!==t.categoryId);return m({},e,{categories:a});case"ADD_QUESTIONS_LIST":return m({},e,{categories:e.categories.map(e=>e.id===t.categoryId?m({},e,{questions:questionsList}):e)});case"ADD_QUESTIONS":return m({},e,{categories:e.categories.map(e=>e.id===t.categoryId?m({},e,{selectedQuestions:t.questions}):e)});case"UPDATE_QUESTION_WEIGHTAGE":return m({},e,{categories:e.categories.map(e=>e.id===t.categoryId?m({},e,{selectedQuestions:e.selectedQuestions.map(e=>e.uuid===t.questionId?m({},e,{weightage:t.weightage}):e)}):e)});case"UPDATE_CATEGORY":return m({},e,{categories:e.categories.map(e=>e.id===t.categoryId?m({},e,t.data):e)});case"UPDATE_QUESTION_SELECTION":return m({},e,{categories:e.categories.map(e=>e.id===t.categoryId?m({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?m({},e,{selected:t.selected}):e)}):e)});case"UPDATE_MANDATORY_QUESTION_SELECTION":return m({},e,{categories:e.categories.map(e=>e.id===t.categoryId?m({},e,{questions:e.questions.map(e=>e.uuid===t.questionId?m({},e,{mandatory:t.mandatory}):e)}):e)});case"SET_QUESTIONS":return m({},e,{categories:e.categories.map(e=>e.id===t.categoryId?m({},e,{questions:t.questions}):e)});case"NEXT_STEP":return m({},e,{step:e.step+1});case"PREVIOUS_STEP":return m({},e,{step:e.step-1});case"SET_STEP_DATA":return m({},e,{stepData:m({},e.stepData,{[t.step]:t.data})});case"UPDATE_SURVEY_FORM":return m({},e,{formData:m({},e.formData,{[t.payload.key]:t.payload.value})});case"SET_SURVEY_STEP":return m({},e,{step:t.payload});case"FIELD_CHANGE":return m({},e,{surveyDetails:e.surveyDetails.map(e=>e.id===t.surveyId?m({},e,t.data):e)});case"RESET_FORM":return Os;default:return e}},Ls=e=>{let t=e.style;return l.createElement("hr",{color:"#d6d5d4",className:"break-line",style:void 0===t?{}:t})},Rs=["onClick","style","children","className","ReactRef"],Ms=e=>{var t;let n=e.onClick,a=e.style,i=e.children,r=e.className,s=e.ReactRef,u=v(e,Rs);const c=o.useLocation(),d=Digit.Hooks.fsm.useRouteSubscription(c.pathname),p=null===(t=Digit.UserService.getUser())||void 0===t?void 0:t.info;return l.createElement("div",m({className:("employee"===d||"EMPLOYEE"===(null==p?void 0:p.type)?"employeeCard":"card")+" "+(r||""),onClick:n,style:a},u,{ref:s}),i)},Ps=e=>l.createElement("h2",{className:"card-label "+e.className,style:e.style},e.children),Fs=e=>l.createElement("p",{className:"card-text "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),ks=e=>{const t="employee"===Digit.SessionStorage.get("user_type");return l.createElement("header",{className:(t?"employee-card-sub-header":"card-sub-header")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children)},Bs=e=>l.createElement("header",{id:e.id,className:"card-section-header",style:e.style},e.children),Us=e=>l.createElement("h2",{className:"card-label-desc "+(e.className||""),style:e.style},e.children),Hs=e=>l.createElement("h2",{className:"card-label-error "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),Vs=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("textarea",{placeholder:e.placeholder,name:e.name,ref:e.inputRef,style:e.style,id:e.id,value:e.value,onChange:e.onChange,className:("citizen"!==t?"employee-card-textarea":"card-textarea")+" "+(e.disable&&"disabled")+" "+(null!=e&&e.className?null==e?void 0:e.className:""),minLength:e.minLength,maxLength:e.maxLength,autoComplete:"off",disabled:e.disabled}),l.createElement("p",{className:"cell-text"},e.hintText))};Vs.propTypes={userType:on.string,name:on.string.isRequired,ref:on.func,value:on.string,onChange:on.func,id:on.string},Vs.defaultProps={ref:void 0,onChange:void 0};const Ws=e=>{var t,a,o,i,r,s,u;const c=Digit.SessionStorage.get("userType"),d=n.useState()[1],v=null!=e&&e.watch?{fromDate:null==e?void 0:e.watch("fromDate"),toDate:null==e?void 0:e.watch("toDate")}:{},p=e=>{d(function(e){if(!e)return"";const t=e.includes("T")?e:e+"T00:00:00",n=new Date(t);return isNaN(n)?"":String(n.getDate()).padStart(2,"0")+"/"+String(n.getMonth()+1).padStart(2,"0")+"/"+n.getFullYear()}(e.target.value))};return l.createElement(l.Fragment,null,l.createElement("div",{className:"text-input "+("employee"===c?"":"text-input-width")+" "+e.className,style:null!=e&&e.textInputStyle?m({},e.textInputStyle):{}},l.createElement("input",e.isMandatory?{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(t=e.validation)||void 0===t?void 0:t.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input-error":"card-input-error")+" "+(e.disable&&"disabled"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&p(t)},ref:e.inputRef,value:e.value,style:m({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(a=e.validation)||void 0===a?void 0:a.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(o=e.validation)||void 0===o?void 0:o.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off",disabled:e.disabled}:{type:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(i=e.validation)||void 0===i?void 0:i.type:e.type||"text",name:e.name,id:e.id,className:(c?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error"),placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t)),"date"===e.type&&p(t)},ref:e.inputRef,value:e.value,style:m({},e.style),defaultValue:e.defaultValue,minLength:e.minlength,maxLength:e.maxlength,max:e.max,required:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(r=e.validation)||void 0===r?void 0:r.isRequired:e.isRequired||"date"===e.type&&("fromDate"===e.name?v.toDate:v.fromDate),pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(s=e.validation)||void 0===s?void 0:s.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(u=e.validation)||void 0===u?void 0:u.title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,onKeyPress:e.onKeyPress,autoComplete:"off",disabled:e.disabled}),e.signature?e.signatureImg:null))};Ws.propTypes={userType:on.string,isMandatory:on.bool,name:on.string,placeholder:on.string,onChange:on.func,ref:on.func,value:on.any},Ws.defaultProps={isMandatory:!1};const zs=e=>l.createElement("div",{className:"action-bar-wrap "+e.className,style:e.style},e.children),js=n.forwardRef((e,t)=>l.createElement("button",m({ref:t,disabled:!!e.disabled,className:(e.disabled?"submit-bar-disabled":"submit-bar")+" "+(e.className?e.className:""),type:e.submit?"submit":"button",style:m({},e.style),onClick:e.onSubmit},e.form?{form:e.form}:{}),e.label));js.propTypes={submit:on.any,style:on.object,label:on.string,onSubmit:on.func},js.defaultProps={};const qs=e=>l.createElement("div",{style:m({},e.style),className:"label-field-pair"},e.children),Ys=e=>{const t=e.className&&e.className.includes("submit-bar")?e.style:m({},Ys.defaultProps.style,e.style);return l.createElement("button",{className:"card-link cp "+(e.className||""),onClick:e.onClick,style:t},e.label)};Ys.propTypes={label:on.any,onClick:on.func,style:on.object},Ys.defaultProps={style:{}};const Gs=e=>{const t=Digit.SessionStorage.get("userType");return l.createElement(l.Fragment,null,l.createElement("div",{className:"form-field"},l.createElement("div",{className:"text-input "+("EMPLOYEE"===t?"":"text-mobile-input-width")+" "+e.className,style:{position:"relative"}},!e.hideSpan&&l.createElement("span",{className:"mobile-number-prefix"},"+91"),l.createElement("input",{type:"text",name:e.name,id:e.id,className:(t?"employee-card-input":"citizen-card-input")+" "+(e.disable&&"disabled")+" focus-visible "+(e.errorStyle&&"employee-card-input-error")+" "+(e.hideSpan?"":"mobile-number-input-with-prefix"),placeholder:e.placeholder,onChange:t=>{var n;let l=t.target.value;(isNaN(l)||[" ","e","E"].some(e=>l.includes(e))||l.length>(e.maxLength||10))&&(l=l.slice(0,-1)),null==e||null===(n=e.onChange)||void 0===n||n.call(e,l)},ref:e.inputRef,value:e.value,style:e.style,minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:e.pattern,min:e.min,readOnly:e.disable,title:e.title,step:e.step,autoFocus:e.autoFocus,onBlur:e.onBlur,autoComplete:"off"}))))};Gs.propTypes={userType:on.string,isMandatory:on.bool,name:on.string,placeholder:on.string,onChange:on.func,ref:on.func,value:on.any},Gs.defaultProps={isMandatory:!1};const Ks=e=>{var t;const o=i.useForm({defaultValues:e.defaultValues}),r=o.register,s=o.handleSubmit,u=o.setValue,c=o.getValues,d=o.reset,v=o.watch,p=o.control,E=o.formState,f=o.errors,g=o.setError,h=o.clearErrors,y=o.setApi,S=a.useTranslation().t,b=v();n.useEffect(()=>{var t,n,l,a,o,i,r;const s=sessionStorage.getItem("eyeIconClicked");null!=e&&e.appData&&(null==e||null===(t=e.appData)||void 0===t||null===(n=t.ConnectionHolderDetails)||void 0===n||null===(l=n[0])||void 0===l||!l.sameAsOwnerDetails)&&s&&(null===(a=Object.keys(null==e?void 0:e.appData))||void 0===a?void 0:a.length)>0&&!to.isEqual(null==e||null===(o=e.appData)||void 0===o||null===(i=o.ConnectionHolderDetails)||void 0===i?void 0:i[0],null==b||null===(r=b.ConnectionHolderDetails)||void 0===r?void 0:r[0])&&d(m({},null==e?void 0:e.appData))},[null==e?void 0:e.appData,b,null==e||null===(t=e.appData)||void 0===t?void 0:t.ConnectionHolderDetails]),n.useEffect(()=>{e.getFormAccessors&&e.getFormAccessors({setValue:u,getValues:c})},[]),n.useEffect(()=>{e.onFormValueChange&&e.onFormValueChange(u,b,E)},[b]);const _=function(e,t,n,a,o,s){void 0===a&&(a=!1);const c="string"==typeof o?Digit.ComponentRegistryService.getComponent(o):o;switch(e){case"text":case"date":case"number":case"password":case"time":return l.createElement("div",{className:"field-container"},null!=t&&t.componentInFront?l.createElement("span",{className:"component-in-front "+(a&&"disabled")},t.componentInFront):null,l.createElement(Ws,m({className:"fieldNew"},t,{inputRef:r(t.validation),isRequired:n,type:e,disable:a,watch:v})));case"textarea":return l.createElement(Vs,m({className:"form-field",name:(null==t?void 0:t.name)||""},t,{inputRef:r(t.validation),disable:a}));case"mobileNumber":return l.createElement(i.Controller,{render:e=>l.createElement(Gs,{className:"form-field",onChange:e.onChange,value:e.value,disable:a}),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:p});case"custom":return l.createElement(i.Controller,{render:e=>t.component(m({},e,{setValue:u}),t.customProps),defaultValue:t.defaultValue,name:null==t?void 0:t.name,control:p});case"component":return l.createElement(i.Controller,{render:e=>l.createElement(c,{userType:"employee",t:S,setValue:u,onSelect:u,config:s,data:b,formData:b,register:r,errors:f,props:e,setError:g,clearErrors:h,formState:E,onBlur:e.onBlur,setApi:y}),name:s.key,control:p});case"form":return l.createElement("form",null,l.createElement(c,{userType:"employee",t:S,setValue:u,onSelect:u,config:s,data:b,formData:b,register:r,errors:f,setError:g,clearErrors:h,formState:E,control:p}));default:return!1!==(null==t?void 0:t.dependency)?t:null}},C=e=>{switch(e){case 0:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"};case 1:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",borderTop:"0px",borderBottom:"0px"};case 2:return{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"-30px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px",borderTop:"0px"}}},T={color:"#505A5F",fontWeight:"700",fontSize:"16px"},D=n.useMemo(()=>{var t;return null===(t=e.config)||void 0===t?void 0:t.map((t,a,o)=>l.createElement(l.Fragment,{key:a},t&&(t=>t.head&&t.subHead?l.createElement(n.Fragment,null,l.createElement(Bs,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{margin:"5px 0px"},id:t.headId},S(t.head)),l.createElement(Bs,{style:T,id:t.headId+"_DES"},S(t.subHead))):t.head?l.createElement(n.Fragment,null,l.createElement(Bs,{style:null!=e&&e.sectionHeadStyle?null==e?void 0:e.sectionHeadStyle:{},id:t.headId},S(t.head)),l.createElement("div",{style:null!=e&&e.lineStyle?null==e?void 0:e.lineStyle:{}})):l.createElement("div",null))(t),t.body.map((t,a)=>{var o,i,r,s,u,c,d,v;return e.inline?l.createElement(l.Fragment,{key:a},l.createElement("div",{style:t.isInsideBox?C(null==t?void 0:t.placementinbox):{}},!t.withoutLabel&&l.createElement(Ps,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"},className:null!=t&&t.disable?"disabled":""},S(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),f&&f[null===(o=t.populators)||void 0===o?void 0:o.name]&&Object.keys(f[null===(i=t.populators)||void 0===i?void 0:i.name]).length?l.createElement(Hs,null,S(t.populators.error||(null===(r=f[null===(s=t.populators)||void 0===s?void 0:s.name])||void 0===r?void 0:r.message))):null,l.createElement("div",{style:t.withoutLabel?{width:"100%"}:{},className:"form-field"},_(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(Ps,{style:m({marginTop:"-24px",fontSize:"16px",fontWeight:"bold",color:"#505A5F"},null==t?void 0:t.descriptionStyles)},S(t.description))))):l.createElement(n.Fragment,null,l.createElement(qs,{key:a},!t.withoutLabel&&l.createElement(Ps,{style:{color:t.isSectionText?"#505A5F":"",marginBottom:e.inline?"8px":"revert"}},S(t.label),t.isMandatory?" * ":null,t.labelChildren&&t.labelChildren),l.createElement("div",{style:t.withoutLabel?m({width:"100%"},null==e?void 0:e.fieldStyle):{},className:"form-field"},_(t.type,t.populators,t.isMandatory,null==t?void 0:t.disable,null==t?void 0:t.component,t),(null==t?void 0:t.description)&&l.createElement(Fs,{style:{fontSize:"14px",marginTop:"-24px"}},S(null==t?void 0:t.description)))),null!=t&&null!==(u=t.populators)&&void 0!==u&&u.name&&f&&f[null==t||null===(c=t.populators)||void 0===c?void 0:c.name]&&Object.keys(f[null==t||null===(d=t.populators)||void 0===d?void 0:d.name]).length?l.createElement(Hs,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},S(null==t||null===(v=t.populators)||void 0===v?void 0:v.error)):null)}),!e.noBreakLine&&(o.length-1===a?null:l.createElement(Ls,{style:null!=e&&e.breaklineStyle?null==e?void 0:e.breaklineStyle:{}}))))},[e.config,b]),N=e.isDisabled||!1;return console.log(e),l.createElement("form",{onSubmit:s(function(t){e.onSubmit(t)}),onKeyDown:e=>(e=>{13===(e.keyCode?e.keyCode:e.key?e.key:e.which)&&e.preventDefault()})(e),id:e.formId,className:e.className},l.createElement(Ms,{style:!0===(null==e?void 0:e.box)?{boxShadow:"none",padding:"20px 48px 48px"}:null},!e.childrenAtTheBottom&&e.children,e.heading&&l.createElement(ks,{className:"headerStyle"}," ",e.heading," "),e.description&&l.createElement(Us,{style:{fontSize:"16px"},className:"descStyle"}," ",e.description," "),e.text&&l.createElement(Fs,{className:"labelStyle"},e.text),D,e.childrenAtTheBottom&&e.children,e.secondaryActionLabel&&l.createElement("div",{className:"primary-label-btn text-align-right",style:{margin:"20px auto 0 auto"},onClick:function(t){e.onSecondayActionClick()}},e.secondaryActionLabel),e.submitInForm&&l.createElement(js,{label:S(e.label),style:m({},null==e?void 0:e.buttonStyle),submit:"submit",disabled:N,className:"submitButtonNew"}),!e.submitInForm&&e.label&&l.createElement(zs,null,e.currentStep>1&&l.createElement("button",{onClick:()=>{e.onBackClick&&e.onBackClick(b)},className:"submit-bar submit-bar-back"},S("COMMON_BACK")),l.createElement(js,{label:S(e.label),submit:"submit",disabled:N}),e.onSkip&&e.showSkip&&l.createElement(Ys,{style:null==e?void 0:e.skipStyle,label:S("CS_SKIP_CONTINUE"),onClick:e.onSkip}))))},Qs=e=>{let o=e.category,i=e.checked,r=e.readOnly,s=e.onDelete,c=e.hideQuestionLabel;const d=u.useDispatch(),v=a.useTranslation().t,p=Digit.ULBService.getCurrentTenantId(),E=n.useState(r),f=E[0],g=E[1],h=n.useState(r),y=h[0],S=h[1],b=(n.useState(""),n.useState({})),_=b[0],C=b[1],T=n.useState([]),D=T[0],N=T[1],w=n.useState([])[1],A=n.useState(null),x=A[0],O=A[1],I=u.useSelector(e=>e.engagement.surveyForm);n.useEffect(()=>{let e={tenantId:p,id:null};try{Digit.Surveys.searchCategory(e).then(e=>{var t;if((null==e||null===(t=e.Categories)||void 0===t?void 0:t.length)>0){const t=e.Categories.filter(e=>e.isActive).map(e=>({title:v(e.label),i18Key:e.label,value:e.id}));N(t)}})}catch(e){return e}},[]);const L=e=>{const t=e.target;d(Vr(o.id,{[t.name]:t.value}))},R=n.useState(!1),M=R[0],P=R[1],F=n.useState(!1),k=F[0],B=F[1];function U(){P(!1)}return l.createElement("div",{className:"category-card"},l.createElement("h3",null,"Section Title ",l.createElement("span",{style:{color:"red"}},"*")),l.createElement("input",{type:"text",name:"title",value:o.title,readOnly:r,onChange:L,placeholder:"Section Title",required:!0}),l.createElement("h3",null,"Section Weightage"),l.createElement("input",{type:"number",name:"weightage",value:o.weightage,onChange:L,onWheel:e=>e.target.blur(),readOnly:i,placeholder:"Section Weightage",required:!0}),(!1===r||void 0===r)&&l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"10px",marginBottom:"5px"}},l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},onClick:()=>g(!f)},"Add Questions"),l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"red",color:"white",cursor:"pointer"},onClick:()=>{s(o.id)}},"Delete Section")),(f||!0===I.goPrev)&&l.createElement("div",null,l.createElement("h3",null,"Select Category"),l.createElement(t.Dropdown,{required:!0,t:v,id:"selectCategory",name:"selectCategory",option:D,select:e=>{d(Vr(o.id,{selectCategory:e})),d(zr(o.id,[])),S(!1)},placeholder:"Select Category",optionKey:"i18Key",selected:o.selectCategory||null}),(!1===r||void 0===r)&&l.createElement("h3",null,"Search Question"),(!1===r||void 0===r)&&l.createElement("input",{type:"text",name:"questionStatement",value:o.questionStatement,onChange:L,placeholder:"Search Question",readOnly:r}),(!1===r||void 0===r)&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer"},disable:r,onClick:()=>{var e;""===o.selectCategory?O({key:!0,isError:!0,label:"PLEASE SELECT A CATEGORY"}):((e,t)=>{let n={categoryId:e,tenantId:p,questionStatement:t,status:"ACTIVE"};try{Digit.Surveys.searchQuestions(n).then(e=>{var t;if((null==e||null===(t=e.Questions)||void 0===t?void 0:t.length)>0){let t=[];e.Questions.map(e=>{let n=m({},e,{selected:!1});t.push(n)}),t.sort((e,t)=>e.auditDetails.lastModifiedTime-t.auditDetails.lastModifiedTime),console.log("arr",t),d(zr(o.id,t)),w(t),S(!0),O({key:!0,isError:!1,label:"QUESTIONS RETRIEVED"})}else d(zr(o.id,[])),w([]),S(!1),O({key:!0,isError:!0,label:"NO QUESTIONS FOUND"})})}catch(e){d(zr(o.id,[])),w([]),S(!1)}})(null===(e=o.selectCategory)||void 0===e?void 0:e.value,o.questionStatement)}},"Go"),y&&1!=c&&o.questions.length>0&&l.createElement("div",null,l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Question Label"),l.createElement("th",null,"Select"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.questions.map(e=>l.createElement("tr",{key:null==e?void 0:e.uuid},l.createElement("td",null,l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement("div",{style:{cursor:"pointer"},onClick:()=>function(e){var t;console.log("question: ",e),P(!0);const n=l.createElement("div",null,l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question:"),l.createElement("p",null,null==e?void 0:e.questionStatement)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Category:"),l.createElement("p",null,null==e||null===(t=e.category)||void 0===t?void 0:t.label)),l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Question Type:"),l.createElement("p",null,v(null==e?void 0:e.type))),("MULTIPLE_ANSWER_TYPE"===(null==e?void 0:e.type)||"CHECKBOX_ANSWER_TYPE"===(null==e?void 0:e.type))&&l.createElement("fieldset",null,l.createElement("legend",{style:{fontWeight:"bold"}},"Options:"),null==e?void 0:e.options.map((e,t)=>l.createElement("li",{key:e.uuid},t+1,". ",null==e?void 0:e.optionText))));B(n)}(e)},null==e?void 0:e.questionStatement),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},v("Click here to view the question details"))))),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{d(((e,t,n)=>({type:"UPDATE_QUESTION_SELECTION",categoryId:e,questionId:t,selected:n}))(o.id,e.uuid,t.target.checked))},checked:e.selected})),l.createElement("td",null,l.createElement(t.CheckBox,{disable:r,key:e.uuid,onChange:t=>{d(Wr(o.id,e.uuid,t.target.checked))}}))))))),(!1===r||void 0===r)&&y&&o.questions.length>0&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginTop:"10px"},disable:r,onClick:()=>{const e=o.questions.filter(e=>e.selected);if(o.questions.some(e=>e.mandatory&&!e.selected))return void O({key:!0,isError:!0,label:"MANDATORY QUESTIONS MUST BE SELECTED"});if(0===e.length)return void O({key:!0,isError:!0,label:"PLEASE SELECT ATLEAST ONE QUESTION"});const t=e.filter(e=>!o.selectedQuestions.some(t=>t.uuid===e.uuid)),n=e.filter(e=>o.selectedQuestions.some(t=>t.uuid===e.uuid));let l=null;n.length>0&&n.map(e=>{l=o.selectedQuestions.findIndex(t=>t.uuid===e.uuid),o.selectedQuestions.map(t=>{t.uuid===e.uuid&&d(Wr(o.id,e.uuid,e.mandatory))}),o.selectedQuestions[l].mandatory=e.mandatory});const a=o.selectCategory.title,i=[...o.selectedQuestions,...t.map(e=>m({},e,{selectedCategory:a}))],r=i.map(e=>m({},e,{weightage:Math.floor(100/i.length*100)/100}));d(Hr(o.id,r))}},"Add These Questions"),l.createElement("div",null,o.selectedQuestions.length>0||!0===r?l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Selected Category"),l.createElement("th",null,"Question Statement"),l.createElement("th",null,"Weightage"),l.createElement("th",null,"Is Mandatory"))),l.createElement("tbody",null,o.selectedQuestions.map((e,t)=>{var n,a;return l.createElement("tr",{key:e.uuid},l.createElement("td",null,e.selectedCategory),l.createElement("td",null,e.questionStatement),l.createElement("td",null,l.createElement("input",{type:"text",defaultValue:e.weightage,value:e.weightage,required:!0,onChange:n=>((e,t,n)=>{let l={};/^\d*(\.\d{0,2})?$/.test(n)?(d(((e,t,n)=>({type:"UPDATE_QUESTION_WEIGHTAGE",categoryId:e,questionId:t,weightage:n}))(o.id,t,n)),l={},C(l)):(l[e]={weightage:"Invalid weightage value. Please enter a number or decimal upto 2 decimal points"},C(l))})(t,e.uuid,n.target.value)}),"undefined"!=(null===(n=_[t])||void 0===n?void 0:n.weightage)&&l.createElement("span",{className:"error"},null===(a=_[t])||void 0===a?void 0:a.weightage)),l.createElement("td",null,!0===(null==e?void 0:e.mandatory)?"True":"False"),l.createElement("td",null,l.createElement("label",{onClick:()=>(e=>{const t=o.selectedQuestions.filter(t=>t.uuid!==e.uuid),n=t.length,l=t.map(e=>m({},e,{weightage:Math.floor(100/n*100)/100}));d(Hr(o.id,l))})(e)},"Delete")))}))):null)),M&&l.createElement(gi,{onSelect:function(){P(!1)},onCancel:U,onDismiss:U,heading:"Question Details",actionCancel:!0,content:k,hideSubmit:!0}),x&&l.createElement(t.Toast,{error:x.isError,label:v(x.label),onClose:()=>{O(null)},isDleteBtn:"false",labelstyle:{color:"white",width:"100%"}}))},Xs=e=>{let t=e.readOnly,a=e.hideQuestionLabel;const o=u.useSelector(e=>e.engagement.surveyForm.categories),i=u.useSelector(e=>e.engagement.surveyForm.autoCalculateCategoriesWeight),r=u.useDispatch(),s=n.useState(i),c=s[0],d=s[1];console.log("categories",o);const m=n.useState(2),v=m[0],p=m[1],E=e=>{console.log("checked",c),1!==o.length?i?(r(jr(e)),r({type:"RECALCULATE_WEIGHTAGE"})):r(jr(e)):alert("Atleast one category must be there")};return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},o.map(e=>l.createElement(Qs,{key:e.id,category:e,checked:i,readOnly:t,onDelete:E,hideQuestionLabel:a})),!0!==t&&l.createElement("label",{style:{padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:"#007bff",color:"white",cursor:"pointer",marginBottom:"10px"},onClick:()=>{console.log("checked",i),!0===i?(r(Ur(v)),r({type:"RECALCULATE_WEIGHTAGE"}),p(v+1)):(r(Ur(v)),p(v+1))}},"Add Section"),l.createElement("div",{style:{marginTop:"20px"}},l.createElement("div",{style:{display:"flex",columnGap:"20px"}},l.createElement("input",{style:{height:"20px",width:"20px"},type:"checkbox",checked:i,disabled:t,onChange:e=>{console.log("e checked",e.target.checked),r((e=>({type:"AUTO_CALCULATE_CATEGORY",categoryWeight:e}))(e.target.checked)),d(e.target.checked),!0===e.target.checked&&r({type:"RECALCULATE_WEIGHTAGE"})}}),"Auto Calculate Category Weightage")))},Zs=()=>{const e=n.useState({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}}),t=e[0],a=e[1],o=(i.useForm({defaultValues:t}),(e,t)=>{const n=t.target,l=n.value,o=n.checked;a(t=>{const n=o?[...t[e].checkboxes,l]:t[e].checkboxes.filter(e=>e!==l);return m({},t,{[e]:m({},t[e],{checkboxes:n})})})}),r=(e,t)=>{const n=t.target,l=n.name,o=n.value;a(t=>m({},t,{[e]:m({},t[e],{[l]:o})}))};console.log("formData",t);const s=n.useState({}),u=s[0],c=s[1];return l.createElement("div",{className:"create-survey-page",style:{background:"white",display:"block",padding:"15px"}},l.createElement("div",{className:"category-card"},l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Title : Citizen Survey"),l.createElement("div",null,l.createElement("h1",{style:{fontWeight:"bold",fontSize:"20px"}},"Survey Description : This is a sample citizen survey")),l.createElement("form",{onSubmit:e=>{e.preventDefault(),(()=>{const e={};return t.name?/^[A-Za-z\s]+$/.test(t.name)||(e.name="Name can only contain alphabets and spaces"):e.name="Name is required",t.relationName?/^[A-Za-z\s]+$/.test(t.relationName)||(e.relationName="Relation Name can only contain alphabets and spaces"):e.relationName="Father/Husband Name is required",t.email?/\S+@\S+\.\S+/.test(t.email)||(e.email="Email is invalid"):e.email="Email is required",t.mobile?/^\d{10}$/.test(t.mobile)||(e.mobile="Mobile number is invalid"):e.mobile="Mobile number is required",t.relation||(e.relation="Relation is required"),t.address||(e.address="Address is required"),t.dob||(e.dob="Date of Birth is required"),!t.section1.checkboxes.length>0&&(e.checkboxes="This question is required to answer"),t.section1.shortText||(e.shortText="This question is required to answer"),t.section2.multipleChoice||(e.multipleChoice="This question is required to answer"),c(e),0===Object.keys(e).length})()&&console.log("Form submitted:",t)}},l.createElement(Gr,{formData:t,setFormData:a,errors:u,relationList:[{label:"Father",value:"Father"},{label:"Husband",value:"Husband"}]}),l.createElement("div",null,l.createElement("h2",null,"Section 1"),l.createElement("div",null,l.createElement("h3",null,"What is your feedback?"),l.createElement("div",null,l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option1",style:{width:"20px",height:"20px",marginRight:"10px"},checked:t.section1.checkboxes.includes("option1"),onChange:e=>o("section1",e)}),"Option 1"),l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("input",{type:"checkbox",value:"option2",style:{width:"20px",height:"20px",marginRight:"10px",color:"#0d43a7"},checked:t.section1.checkboxes.includes("option2"),onChange:e=>o("section1",e)}),"Option 2"),u.checkboxes&&l.createElement("span",{className:"error"},u.checkboxes))),l.createElement("div",null,l.createElement("h3",null,"Tell us more about your product quality?"),l.createElement("div",null,l.createElement("input",{type:"text",name:"shortText",placeholder:"enter here",value:t.section1.shortText,onChange:e=>r("section1",e)}),u.shortText&&l.createElement("span",{className:"error"},u.shortText)))),l.createElement("div",null,l.createElement("h2",null,"Section 2"),l.createElement("div",null,l.createElement("h3",null,"Give your rating?"),l.createElement("div",null,l.createElement("select",{name:"multipleChoice",value:t.section2.multipleChoice,onChange:e=>r("section2",e)},l.createElement("option",{value:""},"Select an option"),l.createElement("option",{value:"choice1"},"Choice 1"),l.createElement("option",{value:"choice2"},"Choice 2"))),u.multipleChoice&&l.createElement("span",{className:"error"},u.multipleChoice))),l.createElement("button",{type:"submit"},"Submit"),l.createElement("button",{style:{backgroundColor:"none",marginLeft:"10px"},onClick:()=>a({name:"",mobile:"",relationName:"",relation:null,address:"",email:"",dob:"",section1:{checkboxes:[],shortText:""},section2:{multipleChoice:""}})},"Reset"))))},$s=()=>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"})),Js=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement($s,null)),eu=e=>{let i=e.isOpen,r=e.onClose;const s=o.useHistory(),u=a.useTranslation().t,c=Digit.UserService.getUser().info,d=n.useState(!0),m=d[0],v=d[1],p=n.useState([]),E=p[0],f=p[1],g=n.useState(!1),h=g[0],y=g[1],S=localStorage.getItem("CITIZEN.CITY");return console.log(S,"TENANTTTTTT"),n.useEffect(()=>{const e=sessionStorage.getItem("survey_modal_data");if(e)try{const t=JSON.parse(e);f(t),y(!0),v(!1)}catch(e){console.error("Failed to parse cached survey data",e)}},[]),n.useEffect(()=>{i&&S&&!h&&(v(!0),Digit.Surveys.searchSurvey({tenantId:S,active:!0,openSurveyFlag:!0}).then(e=>{let t=e.Surveys.filter(e=>e.active);t=t.sort((e,t)=>t.auditDetails.lastModifiedTime-e.auditDetails.lastModifiedTime),f(t),sessionStorage.setItem("survey_modal_data",JSON.stringify(t)),y(!0),v(!1)}).catch(e=>{y(!0),v(!1),console.error("Failed to fetch surveys",e)}))},[i,S,h]),i?!h||h&&0===E.length?null:l.createElement(t.Modal,{headerBarMain:l.createElement("div",{className:"survey-modal-header"},l.createElement("span",null,u("Active Surveys")),(null==E?void 0:E.length)>0&&l.createElement("span",{className:"survey-badge"},E.length)),headerBarEnd:l.createElement(Js,{onClick:r}),hideSubmit:!0,popupStyles:{width:"95%",maxWidth:"600px",height:"auto",maxHeight:"90vh",borderRadius:"16px",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.15)",padding:"15px"},popupModuleMianStyles:{maxHeight:"calc(90vh - 120px)",overflowY:"auto",padding:"24px",backgroundColor:"#f9fafb"}},l.createElement("div",{className:"survey-modal-wrapper"},m?l.createElement("div",{className:"survey-modal-loader"},l.createElement(t.Loader,null)):E&&E.length>0?l.createElement("div",{className:"new-card-cards-grid"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement("div",{key:n,className:"new-card-option"},l.createElement("h3",{className:"survey-card-title"},null==e?void 0:e.surveyTitle),l.createElement("div",{className:"survey-card-container"},l.createElement("div",{className:"survey-card-field"},l.createElement("span",{className:"survey-card-label"},"Start Date:"),l.createElement("p",{className:"survey-card-value"},null!=e&&e.startDate?xe(new Date(null==e?void 0:e.startDate),"dd/MM/yyyy"):"NA")),(null==e?void 0:e.endDate)&&l.createElement("div",{className:"survey-card-field"},l.createElement("span",{className:"survey-card-label"},"End Date:"),l.createElement("p",{className:"survey-card-value"},xe(new Date(null==e?void 0:e.endDate),"dd/MM/yyyy"))),l.createElement("div",{className:"survey-card-field"},l.createElement("span",{className:"survey-card-label"},"Description:"),l.createElement("p",{className:"survey-card-value"},(null==e?void 0:e.surveyDescription)||"No description available"))),l.createElement(t.SubmitBar,{label:u("Start Survey"),onSubmit:()=>(s.push({pathname:"/digit-ui/citizen/engagement/surveys/fill-survey",state:{surveyDetails:e,userInfo:c,userType:"citizen"}}),void r())})),l.createElement("div",{style:{justifyItems:"center"}},l.createElement("div",{style:{alignItems:"center",height:"50px",color:"white",background:"#1e50da",width:"79px",textAlign:"center",justifyContent:"center",display:"flex",borderRadius:"12px",marginTop:" 60px"},onClick:r},"Close"))))):l.createElement("div",{className:"survey-modal-empty-state"},l.createElement("p",null,u("No active surveys available at this time")),l.createElement("p",null,"Please check back later for new surveys")))):null},tu=e=>{let n=e.location;const i=a.useTranslation().t,r=o.useHistory(),s=o.useLocation().search,u=new URLSearchParams(s).get("from")||null,c=[{path:"/digit-ui/employee",content:i("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/engagement/event/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("event/inbox")},{path:"/digit-ui/employee/event/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/new-event")},{path:"/digit-ui/employee/event/inbox/new-event",content:i("ES_EVENT_NEW_EVENT"),show:!!n.pathname.includes("event/inbox/new-event")},{path:"/digit-ui/employee/event/inbox/event-details",content:i("ES_EVENT_EVENT_DETAILS"),show:!!n.pathname.includes("event-details")},{path:"/digit-ui/employee/engagement/event/edit-event",content:i("ES_EVENT_EDIT_EVENT"),show:!!n.pathname.includes("event/edit-event")},{path:"/digit-ui/employee/event/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("event/response")},{path:"/digit-ui/employee/engagement/documents/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/documents/inbox")},{path:"/digit-ui/employee/engagement/documents/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/new-doc")},{path:"/digit-ui/employee/engagement/documents/inbox/new-doc",content:i("NEW_DOCUMENT_TEXT"),show:!!n.pathname.includes("/documents/inbox/new-doc")},{path:"/digit-ui/employee/engagement/documents/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/response")},{path:"/digit-ui/employee/engagement/documents/delete-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/delete-response")},{path:"/digit-ui/employee/engagement/documents/update-response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/documents/update-response")},{path:"/digit-ui/employee/engagement/documents/inbox/details/:id",content:i("CE_DOCUMENT_DETAILS"),show:!!n.pathname.includes("/documents/inbox/details")},{path:"/digit-ui/employee/engagement/documents/inbox/update",content:i("DOCUMENTS_EDIT_HEADER"),show:!!n.pathname.includes("/documents/inbox/update")},{path:"/digit-ui/employee/engagement/messages/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/messages/inbox")},{path:"/digit-ui/employee/engagement/messages/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/create")},{path:"/digit-ui/employee/engagement/messages/inbox/create",content:i("NEW_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/create")},{path:"/digit-ui/employee/engagement/messages/inbox/details/:id",content:i("CS_HEADER_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/details")},{path:"/digit-ui/employee/engagement/messages/inbox/edit/:id",content:i("EDIT_PUBLIC_BRDCST"),show:!!n.pathname.includes("/messages/inbox/edit")},{path:"/digit-ui/employee/engagement/messages/response",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response")},{path:"/digit-ui/employee/engagement/messages/response?update=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?update=true")},{path:"/digit-ui/employee/engagement/messages/response?delete=true",content:i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/messages/response?delete=true")},{path:"/digit-ui/employee/engagement/surveys/inbox",content:i("ES_EVENT_INBOX"),show:!!n.pathname.includes("/surveys/inbox")},{path:"/digit-ui/employee/engagement/surveys/create-survey-step-form",content:u?i(u)+" / "+i("CS_COMMON_SURVEYS"):i("CS_COMMON_SURVEYS"),show:!!n.pathname.includes("/surveys/create-survey-step-form"),isBack:u&&!0},{path:"/digit-ui/employee/engagement/surveys/create-category",content:u?i(u)+" / "+i("Create Category"):i("Create Category"),show:!!n.pathname.includes("/surveys/create-category"),isBack:u&&!0},{path:"/digit-ui/employee/engagement/surveys/search-categories",content:u?i(u)+" / "+i("Search Categories"):i("Search Categories"),show:!!n.pathname.includes("/surveys/search-categories"),isBack:u&&!0},{path:"/digit-ui/employee/engagement/surveys/create-questions",content:u?i(u)+" / "+i("Create Questions"):i("Create Questions"),show:!!n.pathname.includes("/surveys/create-questions"),isBack:u&&!0},{path:"/digit-ui/employee/engagement/surveys/search-questions",content:u?i(u)+" / "+i("Search Questions"):i("Search Questions"),show:!!n.pathname.includes("/surveys/search-questions"),isBack:u&&!0},{path:"/digit-ui/employee/engagement/surveys/create-response",content:u?i(u)+" / "+i("ES_EVENT_NEW_EVENT_RESPONSE"):i("ES_EVENT_NEW_EVENT_RESPONSE"),show:!!n.pathname.includes("/surveys/create-response"),isBack:u&&!0}];return l.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"4px"}},l.createElement(t.BreadCrumb,{crumbs:c}),l.createElement("p",{className:"breadcrumb"},l.createElement("button",{onClick:()=>{r.goBack()},style:{cursor:"pointer",color:"#666"}},"<"," ",i("CS_COMMON_BACK"))))},nu=e=>{let t=e.path,a=e.userType,i=e.tenants,r=e.stateCode;const s=o.useLocation();return l.createElement(n.Fragment,null,l.createElement(tu,{location:s}),l.createElement(o.Switch,null,l.createElement(o.Route,{path:t+"/event/inbox",exact:!0},l.createElement(Qe,{tenants:i,parentRoute:t})),l.createElement(o.Route,{path:t+"/event/response",component:e=>l.createElement(Pe,e)}),l.createElement(o.Route,{path:t+"/event/inbox/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/new-event"},l.createElement(L,null)),l.createElement(o.Route,{path:t+"/event/edit-event/:id"},l.createElement(Re,null)),l.createElement(o.Route,{path:t+"/event/inbox/event-details/:id"},l.createElement(li,null)),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/update",component:e=>l.createElement(Ki,e)}),l.createElement(o.Route,{exact:!0,path:t+"/documents/inbox/new-doc",component:()=>l.createElement(Yi,{path:t})}),l.createElement(o.Route,{exact:!0,path:t+"/documents/new-doc",component:()=>l.createElement(Yi,{path:t})}),l.createElement(o.Route,{path:t+"/documents/inbox/details/:id",component:e=>l.createElement(mr,e)}),l.createElement(o.Route,{path:t+"/documents/response",component:e=>l.createElement(Xi,e)}),l.createElement(o.Route,{path:t+"/documents/update-response",component:e=>l.createElement($i,e)}),l.createElement(o.Route,{path:t+"/documents/delete-response",component:e=>l.createElement(er,e)}),l.createElement(o.Route,{path:t+"/documents/inbox",component:e=>l.createElement(sr,{tenants:i})}),l.createElement(o.Route,{path:t+"/messages",component:e=>l.createElement(Xo,m({},e,{tenants:i,parentRoute:t}))}),l.createElement(o.Route,{path:t+"/surveys",component:e=>l.createElement(ws,m({},e,{tenants:i,parentRoute:t,userType:a,stateCode:r}))})))},lu={EngagementModule:e=>{let n=e.stateCode,a=e.userType,i=e.tenants;const r=o.useRouteMatch(),s=r.path,u=r.url,c=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:n,moduleCode:"Engagement",language:c}).isLoading?l.createElement(t.Loader,null):(Digit.SessionStorage.set("ENGAGEMENT_TENANTS",i),"citizen"===a?l.createElement(ji,{path:s,url:u,userType:a,tenants:i}):l.createElement(nu,{path:s,url:u,userType:a,tenants:i,stateCode:n}))},EngagementCard:()=>{var e,o;const i=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(o=e.info)||void 0===o?void 0:o.roles).find(e=>"EMPLOYEE"===e.code);if(n.useEffect(()=>{Digit.SessionStorage.set("CITIZENSURVEY.INBOX",null)},[]),!i)return null;const r=Digit.ULBService.getCurrentTenantId(),s=Digit.Hooks.engagement.useDocSearch({tenantIds:r},{select:e=>null==e?void 0:e.totalCount}),u=s.data,c=s.isLoading,d=Digit.Hooks.events.useInbox(r,{},{status:"ACTIVE,INACTIVE",eventTypes:"BROADCAST"},{select:e=>null==e?void 0:e.totalCount}),v=d.data,p=d.isLoading,E=Digit.Hooks.events.useInbox(r,{},{eventTypes:"EVENTSONGROUND"},{select:e=>null==e?void 0:e.totalCount}),f=E.data,g=E.isLoading,h=Digit.Hooks.survey.useSearch({tenantIds:r},{select:e=>null==e?void 0:e.TotalCount}),y=h.data,S=h.isLoading,b=n.useMemo(()=>c?"-":u,[c,u]),_=n.useMemo(()=>g?"-":f,[g,f]),C=n.useMemo(()=>p?"-":v,[p,v]),T=n.useMemo(()=>S?"-":y,[S,y]),D=a.useTranslation().t;let N=null;const w={Icon:l.createElement(t.SurveyIconSolid,null),moduleName:D("CS_COMMON_SURVEYS"),kpis:[{count:T,label:D("TOTAL_SURVEYS"),link:"/digit-ui/employee/engagement/surveys/inbox"}],links:[{count:T,label:D("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/surveys/inbox"},{label:D("CS_COMMON_NEW_SURVEY"),link:"/digit-ui/employee/engagement/surveys/create-survey-step-form"},{label:D("Create Category"),link:"/digit-ui/employee/engagement/surveys/create-category"},{label:D("Search Categories"),link:"/digit-ui/employee/engagement/surveys/search-categories"},{label:D("Create Questions"),link:"/digit-ui/employee/engagement/surveys/create-questions"},{label:D("Search Questions"),link:"/digit-ui/employee/engagement/surveys/search-questions"},{label:D("Active and Open Surveys"),link:"/digit-ui/employee/engagement/surveys/active-open-surveys"}]},A={Icon:l.createElement(t.PMBIconSolid,null),moduleName:D("ACTION_TEST_PUBLIC_MESSAGE_BROADCAST"),kpis:[{count:C,label:D("TOTAL_MESSAGES"),link:"/digit-ui/employee/engagement/messages/inbox"}],links:[{count:C,label:D("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/messages/inbox"},{label:D("NEW_PUBLIC_MESSAGE_BUTTON_LABEL"),link:"/digit-ui/employee/engagement/messages/create"}]},x={Icon:l.createElement(t.EventsIconSolid,null),moduleName:D("TOTAL_EVENTS"),kpis:[{count:_,label:D("TOTAL_EVENTS"),link:"/digit-ui/employee/engagement/event/inbox"}],links:[{count:_,label:D("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/event/inbox"},{label:D("ES_TITLE_NEW_EVENTS"),link:"/digit-ui/employee/engagement/event/new-event"}]},O={Icon:l.createElement(t.DocumentIconSolid,null),moduleName:D("ES_TITLE_DOCS"),kpis:[{count:b,label:D("TOTAL_DOCUMENTS"),link:"/digit-ui/employee/engagement/documents/inbox"}],links:[{count:b,label:D("ES_TITLE_INBOX"),link:"/digit-ui/employee/engagement/documents/inbox"},{label:D("NEW_DOCUMENT_TEXT"),link:"/digit-ui/employee/engagement/documents/new-doc"}]};return i&&(N=l.createElement(n.Fragment,null,[O,x,A,w].map((e,n)=>l.createElement(t.EmployeeModuleCard,m({key:n,longModuleName:!0},e))))),N},EngagementDocSelectULB:e=>{var a,o;let r=e.t,s=e.setValue,u=e.config,c=e.formData,d=e.errors,m=e.control;const v=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),p=Digit.ULBService.getCurrentTenantId(),E=n.useMemo(()=>null!=c&&c.defaultTenantId?null==v?void 0:v.find(e=>(null==e?void 0:e.code)===(null==c?void 0:c.defaultTenantId)):p&&v?null==v?void 0:v.filter(e=>e.code===p):1===(null==g?void 0:g.length)?null==g?void 0:g[0]:null,[p,v]),f=Digit.SessionStorage.get("citizen.userRequestObject"),g=v.filter(e=>{var t,n;return null==f||null===(t=f.info)||void 0===t||null===(n=t.roles)||void 0===n?void 0:n.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(S),h=Digit.ULBService.getUserUlbs("SUPERUSER").sort(S);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},r("ES_COMMON_ULB")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:u.key,control:m,defaultValue:null==E?void 0:E[0],rules:{required:!0},render:e=>l.createElement(t.Dropdown,{allowMultiselect:!0,optionKey:"i18nKey",option:h,select:t=>{var n,l;e.onChange([...(null==c||null===(n=c[null==u?void 0:u.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==u?void 0:u.key])||void 0===a?void 0:a.length)>0&&(null==c||null===(o=c[u.key])||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:r(null==e?void 0:e.i18nKey),onClick:()=>{var t;s(u.key,null==c||null===(t=c[u.key])||void 0===t?void 0:t.filter(t=>t.i18nKey!=e.i18nKey))}})))),d&&d[u.key]&&l.createElement(CardLabelError,null,r("EVENTS_TENANT_ERROR_REQUIRED")))))},EngagementULBDropdown:e=>{let n=e.t,a=e.config,o=e.errors,r=e.control;const s=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),u=Digit.UserService.getUser().info,c=s.filter(e=>{var t;return null==u||null===(t=u.roles)||void 0===t?void 0:t.some(t=>(null==t?void 0:t.tenantId)===(null==e?void 0:e.code))}).sort(S);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{alignItems:"start"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},n("ES_COMMON_ULB")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:a.key,control:r,rules:{required:!0},render:e=>l.createElement(t.Dropdown,{option:c,selected:e.value,disable:1===(null==c?void 0:c.length),optionKey:"code",t:n,select:e.onChange})}),o&&o[null==a?void 0:a.key]&&l.createElement(CardLabelError,null,n("EVENTS_TENANT_ERROR_REQUIRED")))))},EnagementDocName:e=>{let n=e.config,a=e.register;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{style:{marginBottom:"20px"}},l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},(0,e.t)("ES_COMMON_DOC_NAME")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{name:n.key,inputRef:a()}))))},EngagementDocCategory:e=>{let a=e.t,o=e.config,r=e.formData,s=e.control;const u=Digit.ULBService.getStateId(),c=n.useState(()=>[])[1],d=Digit.ULBService.getCurrentUlb()||"pb.amritsar",m=Digit.Hooks.engagement.useMDMS(u,"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===d.code))[0].categoryList.map(e=>({name:e}))}}).data;return n.useEffect(()=>{var e,t;null!=r&&null!==(e=r.ULB)&&void 0!==e&&e.length&&c(null==r||null===(t=r.ULB)||void 0===t?void 0:t.map(e=>null==e?void 0:e.code))},[null==r?void 0:r.ULB]),l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_CATEGORY")+"*"),l.createElement(i.Controller,{name:o.key,control:s,render:e=>l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{option:m,select:e.onChange,selected:e.value,t:a,optionKey:"name"}))})))},EngagementDocDescription:e=>{var n,a,o;let i=e.t,r=e.config,s=e.register,u=e.errors;return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},i("ES_COMMON_DOC_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(t.TextArea,{name:r.key,inputRef:s({maxLength:140})}),(null==u||null===(n=u.description)||void 0===n?void 0:n.type)&&l.createElement(t.CardLabelError,null,i("ERROR_"+(null==u||null===(a=u.description)||void 0===a||null===(o=a.type)||void 0===o?void 0:o.toUpperCase())+"_140")))))},EngagementDocUploadDocument:e=>{let a=e.t,r=e.config,s=e.formData,u=e.setError,c=e.control;const d=n.useState(()=>{var e;return null==s||null===(e=s[r.key])||void 0===e?void 0:e.filestoreId}),m=d[0],v=d[1],f=n.useState(),g=f[0],h=f[1],y=n.useState(""),S=y[0],b=y[1],_=n.useState(),C=_[0],T=_[1],D=n.useState(!1)[1],N=(Digit.ULBService.getCurrentTenantId(),n.useState({})),x=N[0],O=N[1],I=n.useState(!1),L=I[0],R=I[1],M=n.useState(""),P=M[0],F=M[1];n.useEffect(()=>{C&&k()},[C]),n.useEffect(()=>{var e;m||D(!1),null==x||null===(e=x.onChange)||void 0===e||e.call(x,{fileStoreId:m,fileSize:g,fileType:S})},[m,x]);const k=function(){try{const e=E(function(){return p(function(){return R(!0),Promise.resolve(Digit.UploadServices.Filestorage("engagement",C,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?v(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):u(a("CS_FILE_UPLOAD_ERROR"))})},function(){})},function(e,t){if(R(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},B=o.useLocation(),U=n.useMemo(()=>!!B.pathname.includes("/documents/inbox/update"),[B.pathname]);return l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{style:{fontWeight:"bold"}},a("ES_COMMON_DOC_DOCUMENT")+"*"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:r.key+".filestoreId",control:c,render:e=>l.createElement(t.UploadFile,{id:"city-engagement-doc",onUpload:t=>((e,t)=>{var n,l,a,o,i,r;if(T(),h(),b(),F(""),null===(n=e.target)||void 0===n||null===(l=n.files)||void 0===l||!l.length)return;const s=null==e||null===(a=e.target)||void 0===a||null===(o=a.files[0])||void 0===o?void 0:o.size,u=null==e||null===(i=e.target)||void 0===i||null===(r=i.files[0])||void 0===r?void 0:r.type;if(!(s&&s/1024/1024>5))return u&&(e=>!!e&&!!/(.*?)(jpg|jpeg|png|image|pdf|msword|openxmlformats)$/i.test(e))(u)?(h(s),b(u),O(t),void T(e.target.files[0])):void F("NOT_SUPPORTED_FILE_TYPE");F("FILE_SIZE_EXCEEDED")})(t,e),onDelete:()=>{v(null),h(100)},accept:"image/*, .pdf, .png, .jpeg, .doc",showHintBelow:!0,hintText:a("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE"),message:L?l.createElement(t.Loader,null):A(a,m,U),textStyles:{width:"100%"},inputStyles:{width:"280px"}})}),g?""+w(g):null,P?l.createElement(t.CardLabelError,null,a(P)):null)))},NotificationsAndWhatsNew:e=>{var i,r;let s=e.variant,u=e.parentRoute;const c=a.useTranslation().t,d=o.useLocation(),v=o.useHistory(),p=Digit.ULBService.getCitizenCurrentTenant(),E=Digit.Hooks.useNotificationCount({tenantId:p,config:{enabled:!(null===(i=Digit.UserService)||void 0===i||null===(r=i.getUser())||void 0===r||!r.access_token)}}),f=E.data,g=(void 0===f?{}:f).unreadCount,h=E.refetch,y=Digit.Hooks.useClearNotifications(),S=y.mutate,b=y.isSuccess;n.useEffect(()=>{b&&h()},[b]),n.useEffect(()=>g&&p?S({tenantId:p}):null,[p,g]);const _=Digit.Hooks.useEvents({tenantId:p,variant:s}),C=_.data;if(_.isLoading)return l.createElement(t.Loader,null);if(0===(null==C?void 0:C.length))return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,""+c("CS_HEADER_NOTIFICATIONS")),l.createElement("h1",null,"Nothing to show"));function T(e){v.push(u+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(()=>{switch(s){case"notifications":return l.createElement(t.Header,null,c("CS_HEADER_NOTIFICATIONS")+" "+(g?"("+g+")":""));case"whats-new":return l.createElement(t.Header,null,c("CS_HEADER_WHATSNEW"));default:return l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen",state:{from:d.pathname+d.search}}})}},null),null!=C&&C.length?C.map(e=>"EVENTSONGROUND"===(null==e?void 0:e.eventType)?l.createElement(t.OnGroundEventCard,m({onClick:T},e)):l.createElement("BROADCAST"===(null==e?void 0:e.eventType)?Jo:t.WhatsNewCard,e)):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c("COMMON_INBOX_NO_DATA"))))},EventsListOnGround:e=>{var n,i,r,s;let u=e.variant,c=e.parentRoute;const d=a.useTranslation().t,v=o.useLocation(),p=o.useHistory(),E=Digit.ULBService.getCitizenCurrentTenant(),f=Digit.Hooks.useNotificationCount({tenantId:E,config:{enabled:!(null===(n=Digit.UserService)||void 0===n||null===(i=n.getUser())||void 0===i||!i.access_token)}}).isSuccess,g=Digit.Hooks.useEvents({tenantId:E,variant:u}),h=g.data,y=g.isLoading;if(null===(r=Digit.UserService)||void 0===r||null===(s=r.getUser())||void 0===s||!s.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});if(y||!f)return l.createElement(t.Loader,null);function S(e){p.push(c+"/events/details/"+e)}return l.createElement("div",{className:"CitizenEngagementNotificationWrapper"},l.createElement(t.Header,null,d("EVENTS_EVENTS_HEADER")+"("+(null==h?void 0:h.length)+")"),h.length?h.map(e=>l.createElement(t.OnGroundEventCard,m({onClick:S},e))):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,d("COMMON_INBOX_NO_DATA"))))},EventDetails:()=>{var e,i,r,s,u,c,d;const m=a.useTranslation().t,v=o.useLocation(),p=(o.useHistory(),o.useParams().id),E=Digit.ULBService.getCitizenCurrentTenant(),f=Digit.Hooks.useEvents({tenantId:E,variant:"events"}),g=f.data,h=f.isLoading;if(null===(e=Digit.UserService)||void 0===e||null===(i=e.getUser())||void 0===i||!i.access_token)return localStorage.clear(),sessionStorage.clear(),l.createElement(o.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:v.pathname+v.search}}});const y=n.useMemo(()=>h?null:null==g?void 0:g.filter(e=>e.id===p)[0],[h,g]);return h?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 t=e.name,n=e.onGroundEventDate,l=e.onGroundEventMonth,a=e.onGroundEventTimeRange;return{eventCategory:m(e.eventCategory),showEventCatergory:!0,name:t,onGroundEventDate:n,onGroundEventMonth:l,onGroundEventTimeRange:a}}(y)),l.createElement("div",{className:"OnGroundEventDetailsCard"},l.createElement("p",{className:"cardCaptionBodyS"},null==y?void 0:y.description),l.createElement("div",{className:"eventAddressAndDirection"},l.createElement("span",null,l.createElement(t.MapMarker,null),l.createElement("div",null,l.createElement("p",null,null==y||null===(r=y.eventDetails)||void 0===r?void 0:r.address),null!=y&&null!==(s=y.eventDetails)&&void 0!==s&&s.latitude&&null!=y&&null!==(u=y.eventDetails)&&void 0!==u&&u.longitude?l.createElement("a",{className:"direction",target:"_blank",href:"https://www.google.com/maps/search/?api=1&query="+(null==y||null===(c=y.eventDetails)||void 0===c?void 0:c.latitude)+"%2C"+(null==y||null===(d=y.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==y?void 0:y.onGroundEventTimeRange))))},EventForm:e=>{var r,s,u,c;let d=e.formData,m=e.control,v=e.errors;const p=a.useTranslation().t,E=Digit.ULBService.getCurrentTenantId(),f=null==E?void 0:E.split(".")[0],g=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),h=Digit.UserService.getUser().info,y=g.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(S),b=Digit.Hooks.useCommonMDMS(f,"mseva",["EventCategories"]),_=b.isLoading,C=b.data,T=o.useLocation(),D=n.useMemo(()=>!!T.pathname.includes("/engagement/event/edit-event"),[T.pathname]);return _?l.createElement(t.Loader,null):l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_ULB_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:m,defaultValue:null!=d&&d.defaultTenantId?null==g?void 0:g.find(e=>(null==e?void 0:e.code)===(null==d?void 0:d.defaultTenantId)):E?null==g?void 0:g.find(e=>(null==e?void 0:e.code)===E):1===(null==y?void 0:y.length)?null==y?void 0:y[0]:null,name:"tenantId",rules:{required:!0},render:e=>l.createElement(t.Dropdown,{option:y,selected:e.value,disable:!!D||1===(null==y?void 0:y.length),optionKey:"code",t:p,select:e.onChange})}),v&&v.tenantId&&l.createElement(t.CardLabelError,null,p("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_NAME_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==d?void 0:d.name,render:e=>l.createElement(t.TextInput,{value:e.value,type:"text",name:"name",onChange:e.onChange,inputRef:e.ref}),name:"name",rules:{required:!0,maxLength:66},control:m}),v&&(null==v?void 0:v.name)&&"required"===(null==v||null===(r=v.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_COMMENTS_ERROR_REQUIRED")),v&&(null==v?void 0:v.name)&&"maxLength"===(null==v||null===(s=v.name)||void 0===s?void 0:s.type)&&l.createElement(t.CardLabelError,null,p("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},p("EVENTS_CATEGORY_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"eventCategory",control:m,defaultValue:null!=d&&d.category?null==C||null===(u=C.mseva)||void 0===u||null===(c=u.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;return l.createElement(t.Dropdown,{inputRef:e.ref,option:null==C||null===(n=C.mseva)||void 0===n?void 0:n.EventCategories,optionKey:"code",t:p,select:e.onChange,selected:e.value})}}),v&&v.eventCategory&&l.createElement(t.CardLabelError,null,p("EVENTS_CATEGORY_ERROR_REQUIRED")))))},MessageForm:e=>{var o,r,s,u,c,d,m,v,p,E;let f=e.formData,g=e.control,h=e.errors,y=e.setError;const S=a.useTranslation().t,b=Digit.ULBService.getCurrentTenantId(),_=null==b?void 0:b.split(".")[0],C=Digit.SessionStorage.get("ENGAGEMENT_TENANTS"),T=Digit.Hooks.useCommonMDMS(_,"mseva",["EventCategories"]),D=T.isLoading,N=T.data,w=Digit.ULBService.getStateId(),A=C.filter(e=>(null==e?void 0:e.code)===b);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(i.Controller,{control:g,defaultValue:1===(null==A?void 0:A.length)?null==A?void 0:A[0]:null,name:"tenantId",rules:{required:!0},render:e=>l.createElement(t.Dropdown,{option:A,selected:e.value,disable:1===(null==A?void 0:A.length),optionKey:"code",t:S,select:e.onChange})}),h&&h.tenantId&&l.createElement(t.CardLabelError,null,S("EVENTS_TENANT_ERROR_REQUIRED")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TITLE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{defaultValue:null==f?void 0:f.name,render:e=>l.createElement(t.TextInput,{value:e.value,type:"text",name:"name",onChange:e.onChange,inputRef:e.ref}),name:"name",rules:{required:!0,maxLength:66},control:g}),h&&(null==h?void 0:h.name)&&"required"===(null==h||null===(o=h.name)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.name)&&"maxLength"===(null==h||null===(r=h.name)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_66_CHARS_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},S("EVENTS_COMMENTS_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"description",control:g,defaultValue:null!=f&&f.category?null==N||null===(s=N.mseva)||void 0===s||null===(u=s.EventCategories.filter(e=>e.code===(null==f?void 0:f.category)))||void 0===u?void 0:u[0]:null,rules:{required:!0,maxLength:500},render:e=>l.createElement(t.TextArea,{inputRef:e.ref,value:e.value,name:"description",onChange:e.onChange,hintText:S("PUBLIC_BRDCST_MSG_LENGTH")})}),h&&(null==h?void 0:h.description)&&"required"===(null==h||null===(c=h.description)||void 0===c?void 0:c.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_COMMENTS_ERROR_REQUIRED")),h&&(null==h?void 0:h.description)&&"maxLength"===(null==h||null===(d=h.description)||void 0===d?void 0:d.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_MAXLENGTH_REACHED")))),l.createElement(t.LabelFieldPair,{style:{marginBottom:"24px"}},l.createElement(t.CardLabel,{className:"card-label-smaller"},""+S("EVENTS_ATTACHMENT_LABEL")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{name:"documents",control:g,rules:{required:!1},render:e=>{let n=e.onChange,a=e.value;return l.createElement(t.MultiUploadWrapper,{t:S,module:"engagement",tenantId:w,getFormState:function(e){let t=[];e.length>0&&e.forEach(e=>{var n,l,a,o;t.push({fileName:null==e?void 0:e[0],fileStoreId:null==e||null===(n=e[1])||void 0===n||null===(l=n.fileStoreId)||void 0===l?void 0:l.fileStoreId,documentType:null==e||null===(a=e[1])||void 0===a||null===(o=a.file)||void 0===o?void 0:o.type})}),n(t)},showHintBelow:!0,setuploadedstate:void 0===a?[]:a,allowedFileTypesRegex:Zo,allowedMaxSizeInMB:5,hintText:S("DOCUMENTS_ATTACH_RESTRICTIONS_SIZE")})}}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_FROM_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:g,name:"fromDate",defaultValue:null==f?void 0:f.fromDate,rules:{required:!0,validate:{isValidFromDate:e=>{const t=O(new Date(""+(null==f?void 0:f.fromDate))),n=new Date;return!(!B(t)||t.getTime()<n.getTime()&&(y("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1))}}},render:e=>l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:e.onChange,defaultValue:e.value})}),h&&(null==h?void 0:h.fromDate)&&"required"===(null==h||null===(m=h.fromDate)||void 0===m?void 0:m.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.fromDate)&&"isValidFromDate"===(null==h||null===(v=h.fromDate)||void 0===v?void 0:v.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_FROM_DATE_ERROR_INVALID")))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},S("PUBLIC_BRDCST_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:g,name:"toDate",defaultValue:null==f?void 0:f.toDate,rules:{required:!0,validate:{isValidToDate:e=>{const t=O(new Date(""+(null==f?void 0:f.fromDate))),n=O(new Date(""+(null==f?void 0:f.toDate))),l=new Date;return!(!B(n)||(n.getTime()<l.getTime()||n.getTime()<t.getTime())&&(y("toDate",{type:"isValidToDate"},{shouldFocus:!0}),1))}}},render:e=>l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:e.onChange,defaultValue:e.value})}),h&&(null==h?void 0:h.toDate)&&"required"===(null==h||null===(p=h.toDate)||void 0===p?void 0:p.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_REQUIRED")),h&&(null==h?void 0:h.toDate)&&"isValidToDate"===(null==h||null===(E=h.toDate)||void 0===E?void 0:E.type)&&l.createElement(t.CardLabelError,null,S("EVENTS_TO_DATE_ERROR_INVALID")))))},DocumentList:e=>{let o=e.match;const i=a.useTranslation().t,r=o.params,s=r.category,u=r.count,c=Digit.ULBService.getCitizenCurrentTenant(),d=n.useState(20)[0],m=(n.useState(0),n.useState()),v=m[0],p=m[1],E=oi(v,700),f=Digit.Hooks.engagement.useDocSearch({name:E,category:s,tenantIds:c,limit:d},{select:e=>{var t;return null==e||null===(t=e.Documents)||void 0===t?void 0:t.map(e=>{let t=e.auditDetails;return{docId:e.uuid,name:e.name,category:e.category,description:e.description,documentLink:e.documentLink,createdTime:null==t?void 0:t.createdTime,fileSize:e.fileSize,filestoreId:e.filestoreId}})}}),g=f.data,h=f.isLoading;return l.createElement(t.AppContainer,null,l.createElement(t.Header,null,i(""+s)+" ("+(u||"-")+")"),l.createElement("div",{className:"documentContainerPadding"},l.createElement("div",null,l.createElement(ai,{searchValue:v,handleKeyPress:function(e){try{return"Enter"===e.key&&v.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},handleSearch:function(e){try{return v.length&&p(""),Promise.resolve()}catch(e){return Promise.reject(e)}},onChange:p,t:i})),h?l.createElement(t.Loader,null):g&&g.length?ri(g,i):l.createElement(t.Card,null,l.createElement(t.CardCaption,null,i("COMMON_INBOX_NO_DATA")))))},SelectEventGeolocation:e=>{var o,i;let r=e.onSelect,s=e.config,u=e.formData;const c=a.useTranslation();return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},""+(0,c.t)("EVENTS_GEOLOCATION_LABEL")),l.createElement("div",{className:"field"},l.createElement(t.LocationSearch,{position:{latitude:null==u||null===(o=u.geoLocation)||void 0===o?void 0:o.latitude,longitude:null==u||null===(i=u.geoLocation)||void 0===i?void 0:i.longitude},onChange:(e,t)=>{r(null==s?void 0:s.key,t)}}))))},SelectToDate:e=>{var o,r;let s=e.formData,u=e.control,c=e.errors,d=e.setError;const m=a.useTranslation().t;return l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},m("EVENTS_TO_DATE_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:u,name:"toDate",defaultValue:null==s?void 0:s.toDate,rules:{required:!0,validate:{isValidDate:e=>!(!B(new Date(null==s?void 0:s.fromDate))||!B(new Date(e))||(new Date((null==s?void 0:s.fromDate)+" "+(null==s?void 0:s.fromTime))<new Date?(d("fromDate",{type:"isValidFromDate"},{shouldFocus:!0}),1):new Date(e+" "+(null==s?void 0:s.toTime))<new Date||!(new Date((null==s?void 0:s.fromDate)+" "+(null==s?void 0:s.fromTime))<=new Date(e+" "+(null==s?void 0:s.toTime)))))}},render:e=>l.createElement(t.TextInput,{type:"date",isRequired:!0,onChange:e.onChange,defaultValue:e.value})}),c&&(null==c?void 0:c.toDate)&&"required"===(null==c||null===(o=c.toDate)||void 0===o?void 0:o.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_REQUIRED")),c&&(null==c?void 0:c.toDate)&&"isValidDate"===(null==c||null===(r=c.toDate)||void 0===r?void 0:r.type)&&l.createElement(t.CardLabelError,null,m("EVENTS_TO_DATE_ERROR_INVALID")))))},SurveyList:()=>{const e=a.useTranslation().t,n=o.useHistory(),i=Digit.ULBService.getCitizenCurrentTenant(),r=Digit.Hooks.survey.useSearch({tenantIds:i},{select:e=>{const t=e.Surveys.map(e=>{const t=cr(e.startDate,e.endDate);let n="";return n=t&&e.hasResponded?"CS_SURVEY_RESPONDED":t?"CS_SURVEY_YT_TO_RESPOND":"CANNOT_RESPOND_MSG",m({hasResponded:!1,responseStatus:n},e)}),n=[],l=[];for(let e of t)"ACTIVE"===e.status&&cr(e.startDate,e.endDate)?n.push(e):l.push(e);return{activeSurveysList:n,inactiveSurveysList:l}}}),s=r.data;return r.isLoading?l.createElement(t.Loader,null):l.createElement("div",{className:"survey-list-container"},l.createElement(t.Header,null,e("CS_COMMON_SURVEYS")+" ("+(null==s?void 0:s.activeSurveysList.length)+")"),null!=s&&s.activeSurveysList&&s.activeSurveysList.length?s.activeSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(ur,{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")+" ("+s.inactiveSurveysList.length+")"),null!=s&&s.inactiveSurveysList&&s.inactiveSurveysList.length?s.inactiveSurveysList.map((e,t)=>l.createElement("div",{className:"surveyListCardMargin"},l.createElement(ur,{header:e.title,about:e.description,activeTime:e.endDate,postedAt:e.auditDetails.createdTime,responseStatus:e.responseStatus,hasResponsed:e.status,key:t}))):l.createElement("div",{className:"centered-message"},l.createElement("p",null,e("CS_NO_INACTIVE_SURVEYS"))))},FillSurvey:e=>{var t,i,r,s,u,c,d,m;const v=Digit.Hooks.useQueryParams(),p=Digit.Hooks.survey.useSearch({uuid:v.applicationNumber,tenantId:v.tenantId},{}),E=p.data,f=p.isLoading,g=null!=E&&null!==(t=E.Surveys)&&void 0!==t&&t[0]?null==E||null===(i=E.Surveys)||void 0===i?void 0:i[0]:{},h=a.useTranslation().t;let y=E;const S=n.useState(null),b=S[0],_=S[1];null==g||null===(r=g.questions)||void 0===r||r.sort((e,t)=>e.qorder-t.qorder);const C=o.useHistory();return n.useEffect(()=>{var e,t,n,l,a,o;E&&1==(null==y||null===(e=y.Surveys)||void 0===e||null===(t=e[0])||void 0===t?void 0:t.hasResponded)||"true"===(null==y||null===(n=y.Surveys)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.hasResponded)?_({key:!0,label:"SURVEY_FORM_IS_ALREADY_SUBMITTED"}):E&&"INACTIVE"==(null==y||null===(a=y.Surveys)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.status)&&_({key:!0,label:"SURVEY_FORM_IS_ALREADY_INACTIVE"})},[null==E||null===(s=E.Surveys)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.hasResponded,null==y||null===(c=y.Surveys)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.hasResponded]),(null===(m=Object.keys(g))||void 0===m?void 0:m.length)>0||f?l.createElement(es,{surveyData:g,isSubmitDisabled:!!b,isLoading:f,onFormSubmit:e=>{const t={AnswerEntity:{surveyId:g.uuid,answers:xs(e),surveyTitle:g.title,hasResponded:g.hasResponded}};C.push("/digit-ui/citizen/engagement/surveys/submit-response",t)},formDisabled:!!b,showToast:b}):l.createElement(As,{t:h})},CitizenSurveyForm:es,ShowSurvey:e=>{var a;let o=e.location;const i=null==o?void 0:o.state,s=(Digit.ULBService.getCitizenCurrentTenant(),Digit.Hooks.survey.useShowResults()),u=r.useQueryClient();if(n.useEffect(()=>{s.mutate({surveyId:i.uuid},{onSuccess:()=>{u.clear()}})},[]),s.isLoading&&!s.isIdle)return l.createElement(t.Loader,null);if(s.isError)return l.createElement("div",null,"An error occured...");const c=null==s||null===(a=s.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(es,{surveyData:i,submitDisabled:!0,formDisabled:!0,formDefaultValues:d})},SurveyResults:vs,CreateSurveyCategory:gr,SearchCategories:Sr,SurveyForm:e=>{let a=e.t,o=e.index,r=e.questionStatement,s=e.type,u=e.uuid,c=e.qorder,d=e.required,v=e.options,p=e.disableInputs,E=e.dispatch,f=e.isPartiallyEnabled,g=e.addOption,h=e.formDisabled;const y=[{title:a("Surveys_Short_Answer"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},{title:a("Surveys_Multiple_Choice"),i18Key:"MULTIPLE_ANSWER_TYPE",value:"MULTIPLE_ANSWER_TYPE"},{title:a("Surveys_Check_Boxes"),i18Key:"CHECKBOX_ANSWER_TYPE",value:"CHECKBOX_ANSWER_TYPE"},{title:a("Surveys_Paragraph"),i18Key:"LONG_ANSWER_TYPE",value:"LONG_ANSWER_TYPE"},{title:a("Surveys_Date"),i18Key:"DATE_ANSWER_TYPE",value:"DATE_ANSWER_TYPE"},{title:a("Surveys_Time"),i18Key:"TIME_ANSWER_TYPE",value:"TIME_ANSWER_TYPE"}],S=[{title:a("Product Quality"),i18Key:"Product_Quality",value:"Product_Quality"}],b=[{title:a("What is your feedback for this product?"),i18Key:"Product_Quality",value:"Product_Quality"}],_=y.filter(e=>(null==e?void 0:e.value)===("object"==typeof s?s.value:s)),C=window.location.href.includes("/employee/engagement/"),T=n.useState({questionStatement:r,type:s?null==_?void 0:_[0]:{title:a("SHORT_ANSWER_TYPE"),i18Key:"SHORT_ANSWER_TYPE",value:"SHORT_ANSWER_TYPE"},required:d,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:u,qorder:c}),D=T[0],N=T[1],w=i.useFormContext(),A=w.register,x=w.formState,O=n.useState(0),I=O[0],L=O[1];n.useEffect(()=>{N({questionStatement:r,type:s?null==_?void 0:_[0]:{title:a(""),i18Key:"",value:""},required:d,options:(null==v?void 0:v.length)>0?v:[a("CMN_OPTION")+" 1"],uuid:u,qorder:c})},[r]);const R=()=>N(e=>{const t=m({},e);return t.options.push(a("CMN_OPTION")+" "+(t.options.length+1)),t}),M=e=>{let t=e.value,n=e.id;N(e=>{const l=m({},e);return l.options.splice(n,1,t),l})},P=e=>{1===D.options.length||!f&&h||N(t=>{const n=m({},t);return n.options.splice(e,1),n})};return n.useEffect(()=>{E({type:"updateForm",payload:{index:o,formConfig:D}})},[D]),l.createElement("div",{className:"newSurveyForm_wrapper"},l.createElement("span",{className:"newSurveyForm_quesno"},l.createElement(t.TextInput,{value:D.categoryName,onChange:e=>{N(t=>m({},t,{categoryName:e.target.value}))},name:"category",placeholder:"Category Title"}),l.createElement(t.TextInput,{placeholder:a("Weightage"),value:D.weightage,onChange:e=>{N(t=>m({},t,{weightage:e.target.value}))},textInputStyle:{width:"100%"},name:"Weightage_"+o,disable:p,inputRef:A({required:a("ES_ERROR_REQUIRED"),maxLength:{value:100,message:a("EXCEEDS_100_CHAR_LIMIT")},pattern:{value:/^[A-Za-z_-][A-Za-z0-9_\ -?]*$/,message:a("ES_SURVEY_DONT_START_WITH_NUMBER")}})})),l.createElement("span",{className:"newSurveyForm_mainsection"},l.createElement("div",null,l.createElement(t.Dropdown,{t:a,option:S,select:e=>{N(t=>m({},t,{Categorytype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Category",optionKey:"i18Key",disable:p,selected:""}),l.createElement(t.TextInput,{placeholder:a("Category Weightage"),name:"QusWeight",disabled:C,inputRef:A({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})})),l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:b,select:e=>{N(t=>m({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:D.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{N(t=>m({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},optionKey:"i18Key",disable:p,selected:null==D?void 0:D.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:C,inputRef:A({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))),l.createElement("div",{className:"newSurveyForm_answer"},(e=>{var n,o;switch(null==e?void 0:e.value){case"LONG_ANSWER_TYPE":return l.createElement("div",null,l.createElement(t.TextArea,{placeholder:a("LONG_ANSWER_TYPE"),disabled:C,name:"longAnsDescription",inputRef:A({maxLength:{value:500,message:a("EXCEEDS_500_CHAR_LIMIT")}})}),(null==x?void 0:x.errors)&&l.createElement(t.CardLabelError,null,null==x||null===(n=x.errors)||void 0===n||null===(o=n.longAnsDescription)||void 0===o?void 0:o.message));case"DATE_ANSWER_TYPE":return l.createElement(t.DatePicker,{stylesForInput:{width:"calc(100% - 290px)"},style:{width:"202px"},disabled:C});case"TIME_ANSWER_TYPE":return l.createElement(t.TextInput,{type:"time",textInputStyle:{width:"202px"},disable:C});case"MULTIPLE_ANSWER_TYPE":return l.createElement(Cr,{maxLength:60,titleHover:a("MAX_LENGTH_60"),t:a,addOption:R,updateOption:M,removeOption:P,options:null==D?void 0:D.options,createNewSurvey:g,isInputDisabled:C,isPartiallyEnabled:f,formDisabled:h});case"CHECKBOX_ANSWER_TYPE":return l.createElement("div",null,l.createElement(br,{t:a,addOption:R,updateOption:M,removeOption:P,options:null==D?void 0:D.options,isInputDisabled:C,isPartiallyEnabled:f,createNewSurvey:g,formDisabled:h,maxLength:60,titleHover:a("MAX_LENGTH_60"),labelstyle:{marginLeft:"-20px"}}));default:return null}})(null==D?void 0:D.Answertype)),(void 0!==D.Questype&&console.log("hi"),void 0!==D.Questype?l.createElement("div",{className:"newSurveyForm_questions"},l.createElement(t.Dropdown,{t:a,option:b,select:e=>{N(t=>m({},t,{Question:{title:e.title,i18Key:e.i18Key,value:e.value}}))},placeholder:"Select Question",optionKey:"title",disable:p,selected:"",value:D.Question}),l.createElement(t.Dropdown,{t:a,option:y,select:e=>{N(t=>m({},t,{Answertype:{title:e.title,i18Key:e.i18Key,value:e.value}}))},name:"Answertype"+(null==D||null===(F=D.Questype)||void 0===F?void 0:F.index),optionKey:"i18Key",disable:p,selected:null==D?void 0:D.Answertype,placeholder:"Select Answer Type"}),l.createElement("div",{style:{width:"10%"}},l.createElement(t.TextInput,{placeholder:a("Question Weightage"),name:"QusWeight",disabled:C,inputRef:A({maxLength:{value:100,message:a("EXCEEDS_200_CHAR_LIMIT")}})}))):null),l.createElement("div",{className:"newSurveyForm_actions"},l.createElement("div",null,"Add more questions?"),l.createElement("div",{className:"newSurveyForm_seprator"}),l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>{N(e=>m({},e,{Questype:{value:"ADD_QUESTION",index:I+1}})),L(I+1)}},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("Add more question")))))),l.createElement("div",{className:"newSurveyForm_actions"},0!==o&&l.createElement("div",{className:"newSurveyForm_seprator"}),0!==o&&l.createElement("div",{className:"pointer "+(p?"disabled-btn":""),onClick:()=>E({type:"removeForm",payload:{index:o}})},l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(t.DustbinIcon,null),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"100px",marginLeft:"50%",fontSize:"medium"}},a("CS_INFO_DELETE"))))))));var F},CreateSurveyForm:e=>{let t=e.disableInputs,a=e.isPartiallyEnabled,o=e.formDisabled;const r=i.useForm({defaultValues:{sections:[]}}),s=r.register,u=r.control,c=r.setValue,d=r.getValues,p=r.reset,E=r.formState,f=r.clearErrors,g=v(r,Ns);console.log("setSurveyConfig",c),console.log("disable Inputs",t),console.log("partially enabled",a),console.log("forms disable",o);const h=n.useReducer((e,t)=>{let n=t.type;switch(console.log("type im reducer",n),n){case"ADD_SECTION":return m({},e,{sections:[e.sections,{id:2,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}],weightage:0}]});case"ADD_CATEGORY":return m({},e,{sections:e.sections.map(e=>e.id===action.sectionId?m({},e,{categories:[...e.categories,{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}):e)});case"ADD_QUESTION":return m({},e,{sections:e.sections.map(e=>e.id===action.sectionId?m({},e,{categories:e.categories.map(e=>e.id===action.categoryId?m({},e,{questions:[...e.questions,{id:Date.now(),type:"",answer:""}]}):e)}):e)});case"UPDATE_SECTION_WEIGHTAGE":return m({},e,{sections:e.sections.map(e=>e.id===action.sectionId?m({},e,{weightage:action.weightage}):e)});case"UPDATE_CATEGORY_WEIGHTAGE":return m({},e,{sections:e.sections.map(e=>e.id===action.sectionId?m({},e,{categories:e.categories.map(e=>e.id===action.categoryId?m({},e,{weightage:action.weightage}):e)}):e)});default:return e}},{sections:[{id:1,weightage:20,categories:[{id:1,weightage:"",questions:[{id:1,type:"",answer:""}]}]}]}),y=h[0],S=h[1];return l.createElement(n.Fragment,null,l.createElement("div",{style:{marginLeft:"-20px"}},l.createElement("div",{style:{margin:"8px"}},l.createElement(i.FormProvider,m({register:s,control:u,setValue:c,getValues:d,reset:p,formState:E,clearErrors:f},g),l.createElement("div",null,l.createElement("h1",null,"Survey Creation"),l.createElement("button",{onClick:()=>{(e=>{let t=e.type,n=e.payload;console.log("type",t),S({type:t,payload:m({},n,{setSurveyFormValue:c})})})({type:"ADD_SECTION"})}},"Add Section"),(console.log("render",y),y.sections.length?y.sections.map((e,t)=>(console.log("section",e),console.log("index",t),l.createElement(Ds,{key:t,section:e}))):null))))))},SurveyFormDetails:e=>{let t=e.config,n=e.onGoNext,a=e.onBackClick,o=e.t;const i=u.useDispatch(),r=u.useSelector(e=>e.engagement.surveyForm.surveyDetails),s=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[t.key]?e.engagement.surveyForm.formData[t.key]:{}});return l.createElement(l.Fragment,null,l.createElement(Ks,{defaultValues:s,box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},config:t.currStepConfig,onSubmit:function(e){console.log("Data in step "+t.currStepNumber+" is: \n",e);let l=0,a="";r.map(e=>{""===e.name&&(l=1,a+="Please enter Survey Name\n"),e.name.length>500&&(l=1,a+="Please enter a Survey Name that is 500 characters or fewer\n"),e.description.length>500&&(l=1,a+="Please enter a Survey Description that is 500 characters or fewer\n"),""===e.fromDate&&(l=1,a+="Please enter Survey Start Date\n"),""===e.fromTime&&(l=1,a+="Please enter Survey Start Time\n"),""===e.toDate&&(l=1,a+="Please enter Survey End Date\n"),""===e.toTime&&(l=1,a+="Please enter Survey End Time\n"),e.description.length>140&&(l=1,a+="Please enter description less than 140 characters\n"),new Date(e.fromDate+"T"+e.fromTime)>new Date(e.toDate+"T"+e.toTime)&&(l=1,a+="Start date and time must be before end date and time.\n")}),1!==l?n():alert(a)},onFormValueChange:function(e,n){console.log("d",n),console.log("onFormValueChange data in SurveyFormDetails: ",n,"\n Bool: ",!_.isEqual(n,s)),_.isEqual(n,s)||i(kr(t.key,n))},label:o(""+t.texts.submitBarLabel),currentStep:t.currStepNumber,onBackClick:function(e){a(t.key,e)}}))},SurveyFormCategoryDetails:e=>{let n=e.config,a=e.onGoNext,o=e.onBackClick,i=e.t;const r=u.useDispatch(),s=u.useSelector(e=>e.engagement.surveyForm.categories),c=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[n.key]?e.engagement.surveyForm.formData[n.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{box:!0,lineStyle:{border:"1px solid #DFE0E2",marginBottom:"20px",marginLeft:"-10px"},sectionHeadStyle:{marginLeft:"-10px"},defaultValues:c,config:n.currStepConfig,onSubmit:function(e){console.log("data in go next",s);let t=0,l="";s.map((e,n)=>{e.title.length>500&&(l+="-> Please enter a Section Title that is 500 characters or fewer for section "+(n+1)+" card\n",t=1),0===e.selectedQuestions.length&&(l+="-> Please select at least one question for section "+(n+1)+" card\n",t=1)});const o=s.reduce((e,t)=>e+parseFloat(t.weightage),0);console.log("tot weight",Math.round(o)),Math.round(o)>100&&(l+="The total weightage of sections should not exceed 100.\n",t=1),Math.round(o)<100&&(l+="The total weightage of sections should not be less than 100.\n",t=1),s.map((e,n)=>{const a=e.selectedQuestions.reduce((e,t)=>e+parseFloat(t.weightage),0);Math.round(a)>100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1),Math.round(a)<100&&(l+="The total weightage of questions in section "+(n+1)+' titled "'+(null==e?void 0:e.title)+'" should sum upto 100.\n',t=1)}),1!==t?(console.log("Data in step "+n.currStepNumber+" is: \n",e),a()):alert(l)},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveyFormCategoryDetails: ",t,"\n Bool: ",!_.isEqual(t,c)),_.isEqual(t,c)||r(kr(n.key,t))},label:i(""+n.texts.submitBarLabel),currentStep:n.currStepNumber,onBackClick:function(e){o(n.key,e),r({type:"GO_PREV"})}}))},SurveryFormSummary:e=>{let i=e.config,r=e.onGoNext,s=e.onBackClick;const c=a.useTranslation().t,d=n.useState(null),m=d[0],v=d[1],p=o.useHistory(),E=u.useDispatch(),f=u.useSelector(e=>e.engagement.surveyForm.categories),g=u.useSelector(e=>e.engagement.surveyForm.surveyDetails[0]);Digit.ULBService.getCurrentTenantId();const h=u.useSelector(function(e){return e.engagement.surveyForm.formData&&e.engagement.surveyForm.formData[i.key]?e.engagement.surveyForm.formData[i.key]:{}});return l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{defaultValues:h,config:i.currStepConfig,onSubmit:function(e){let t=[];f.map(e=>{let n=[];e.selectedQuestions.map(e=>{let t={questionUuid:e.uuid,weightage:parseFloat(e.weightage),required:e.mandatory};n.push(t)});let l={title:e.title,weightage:parseFloat(e.weightage),questions:n};t.push(l)}),console.log("survey det",g);let n={SurveyEntity:{startDate:new Date(g.fromDate+" "+g.fromTime).getTime(),endDate:new Date(g.toDate+" "+g.toTime).getTime(),tenantId:g.ulb.code,surveyTitle:g.name,surveyCategory:g.name,surveyDescription:g.description,sections:t}};try{Digit.Surveys.createSurvey(n).then(e=>{var t,n;E({type:"RESET_FORM"}),(null==e||null===(t=e.Surveys)||void 0===t?void 0:t.length)>0?p.push("/digit-ui/employee/engagement/surveys/create-response",{message:c("ENGAGEMENT_SURVEY_CREATED"),response:null==e?void 0:e.Surveys,isSuccess:!0}):v({key:!0,label:""+(null==e||null===(n=e.Errors)||void 0===n?void 0:n.message)})})}catch(e){console.log(e)}console.log("Data in step "+i.currStepNumber+" is: \n",e),r()},onFormValueChange:function(e,t){console.log("onFormValueChange data in SurveryFormSummary: ",t,"\n Bool: ",!_.isEqual(t,h)),_.isEqual(t,h)||E(kr(i.key,t))},label:c(""+i.texts.submitBarLabel),currentStep:i.currStepNumber,onBackClick:function(e){s(i.key,e),E({type:"GO_PREV"})}}),m&&l.createElement(Toast,{error:m.key,label:c(m.label),onClose:()=>{v(null)}}))},NewSurveys:_s,SurveyCreationPage:Xs,SurveySummary:()=>l.createElement("div",{style:{backgroundColor:"white"}},l.createElement(_s,{readOnly:!0}),l.createElement(Xs,{readOnly:!0,hideQuestionLabel:!0})),FillSurveyNew:()=>(console.log("fill survey form new"),l.createElement(Zs,null)),FillSurveyEmp:Kr,FillQuestions:Hi,SurveyModal:eu};exports.SurveyModal=eu,exports.SurveyReducers=()=>d.combineReducers({surveyForm:Is}),exports.initEngagementComponents=()=>{Object.entries(lu).forEach(e=>{Digit.ComponentRegistryService.setComponent(e[0],e[1])})};
|