@djb25/digit-ui-module-fsm 1.0.17 → 1.0.18
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 +0 -2
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@djb25/digit-ui-react-components"),n=require("react"),l=e(n),i=require("react-i18next"),a=require("react-router-dom"),o=require("react-hook-form"),r=require("react-query"),u=e(require("react-time-picker"));function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}const d=e=>"PROPERTYTYPE_MASTERS_"+e,c=e=>{if(e){const t=new Date(e);let n=t.getMonth()+1,l=t.getDate(),i=t.getFullYear();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,`${i}-${n}-${l}`}return null};let p=[];const m=e=>{let{currentStep:n=1,flow:a=""}=e;const{t:o}=i.useTranslation(),r=window.Digit.Utils.browser.isMobile();return(e=>{switch(e){case"STAKEHOLDER":p=[];break;case"APPLY":p=["FSM_TIMELINE_PROPERTY_DETAILS","FSM_GENDER_DETAILS","FSM_PAYMENT_DETAILS","FSM_TIMELINE_SUMMARY"];break;case"PT_APPLY":p=["ES_NEW_APPLICATION_PROPERTY_DETAILS","PT_OWNERSHIP_INFO_SUB_HEADER","CE_DOCUMENT_DETAILS","PT_COMMON_SUMMARY"];break;default:p=["TL_COMMON_TR_DETAILS","TL_LOCATION_AND_OWNER_DETAILS","TL_DOCUMENT_DETAIL","TL_COMMON_SUMMARY"]}})(a),l.createElement("div",{className:"timeline-container",style:r?{}:{maxWidth:"960px",marginRight:"auto"}},p.map((e,i,a)=>l.createElement("div",{className:"timeline-checkpoint",key:i},l.createElement("div",{className:"timeline-content"},l.createElement("span",{className:"circle "+(i<=n-1&&"active")},i<n-1?l.createElement(t.TickMark,null):i+1),l.createElement("span",{className:"secondary-color"},o(e))),i<a.length-1&&l.createElement("span",{className:"line "+(i<n-1&&"active")}))))};var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e,t){return e(t={exports:{}},t.exports),t.exports}var _="function"==typeof Symbol&&Symbol.for,S=_?Symbol.for("react.element"):60103,f=_?Symbol.for("react.portal"):60106,y=_?Symbol.for("react.fragment"):60107,T=_?Symbol.for("react.strict_mode"):60108,g=_?Symbol.for("react.profiler"):60114,h=_?Symbol.for("react.provider"):60109,I=_?Symbol.for("react.context"):60110,C=_?Symbol.for("react.async_mode"):60111,N=_?Symbol.for("react.concurrent_mode"):60111,A=_?Symbol.for("react.forward_ref"):60112,D=_?Symbol.for("react.suspense"):60113,O=_?Symbol.for("react.suspense_list"):60120,L=_?Symbol.for("react.memo"):60115,P=_?Symbol.for("react.lazy"):60116,b=_?Symbol.for("react.block"):60121,R=_?Symbol.for("react.fundamental"):60117,M=_?Symbol.for("react.responder"):60118,k=_?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case S:switch(e=e.type){case C:case N:case y:case g:case T:case D:return e;default:switch(e=e&&e.$$typeof){case I:case A:case P:case L:case h:return e;default:return t}}case f:return t}}}function F(e){return w(e)===N}var x={AsyncMode:C,ConcurrentMode:N,ContextConsumer:I,ContextProvider:h,Element:S,ForwardRef:A,Fragment:y,Lazy:P,Memo:L,Portal:f,Profiler:g,StrictMode:T,Suspense:D,isAsyncMode:function(e){return F(e)||w(e)===C},isConcurrentMode:F,isContextConsumer:function(e){return w(e)===I},isContextProvider:function(e){return w(e)===h},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===S},isForwardRef:function(e){return w(e)===A},isFragment:function(e){return w(e)===y},isLazy:function(e){return w(e)===P},isMemo:function(e){return w(e)===L},isPortal:function(e){return w(e)===f},isProfiler:function(e){return w(e)===g},isStrictMode:function(e){return w(e)===T},isSuspense:function(e){return w(e)===D},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===y||e===N||e===g||e===T||e===D||e===O||"object"==typeof e&&null!==e&&(e.$$typeof===P||e.$$typeof===L||e.$$typeof===h||e.$$typeof===I||e.$$typeof===A||e.$$typeof===R||e.$$typeof===M||e.$$typeof===k||e.$$typeof===b)},typeOf:w},H=E(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,i=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,o=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,d=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,_=e?Symbol.for("react.block"):60121,S=e?Symbol.for("react.fundamental"):60117,f=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function T(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var m=e.type;switch(m){case s:case d:case i:case o:case a:case p:return m;default:var _=m&&m.$$typeof;switch(_){case u:case c:case E:case v:case r:return _;default:return t}}case l:return t}}}var g=d,h=u,I=r,C=n,N=c,A=i,D=E,O=v,L=l,P=o,b=a,R=p,M=!1;function k(e){return T(e)===d}t.AsyncMode=s,t.ConcurrentMode=g,t.ContextConsumer=h,t.ContextProvider=I,t.Element=C,t.ForwardRef=N,t.Fragment=A,t.Lazy=D,t.Memo=O,t.Portal=L,t.Profiler=P,t.StrictMode=b,t.Suspense=R,t.isAsyncMode=function(e){return M||(M=!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.")),k(e)||T(e)===s},t.isConcurrentMode=k,t.isContextConsumer=function(e){return T(e)===u},t.isContextProvider=function(e){return T(e)===r},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return T(e)===c},t.isFragment=function(e){return T(e)===i},t.isLazy=function(e){return T(e)===E},t.isMemo=function(e){return T(e)===v},t.isPortal=function(e){return T(e)===l},t.isProfiler=function(e){return T(e)===o},t.isStrictMode=function(e){return T(e)===a},t.isSuspense=function(e){return T(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===d||e===o||e===a||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===v||e.$$typeof===r||e.$$typeof===u||e.$$typeof===c||e.$$typeof===S||e.$$typeof===f||e.$$typeof===y||e.$$typeof===_)},t.typeOf=T}()}),V=E(function(e){e.exports="production"===process.env.NODE_ENV?x:H}),B=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;function G(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var W=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,i=G(e),a=1;a<arguments.length;a++){for(var o in n=Object(arguments[a]))U.call(n,o)&&(i[o]=n[o]);if(B){l=B(n);for(var r=0;r<l.length;r++)Y.call(n,l[r])&&(i[l[r]]=n[l[r]])}}return i},K="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",z=Function.call.bind(Object.prototype.hasOwnProperty),j=function(){};if("production"!==process.env.NODE_ENV){var X=K,$={},q=z;j=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function Z(e,t,n,l,i){if("production"!==process.env.NODE_ENV)for(var a in e)if(q(e,a)){var o;try{if("function"!=typeof e[a]){var r=Error((l||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}o=e[a](t,a,l,n,null,X)}catch(e){o=e}if(!o||o instanceof Error||j((l||"React class")+": type specification of "+n+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof o+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),o instanceof Error&&!(o.message in $)){$[o.message]=!0;var u=i?i():"";j("Failed "+n+" type: "+o.message+(null!=u?u:""))}}}Z.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&($={})};var Q=Z,J=function(){};function ee(){return null}function te(){}function ne(){}"production"!==process.env.NODE_ENV&&(J=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),ne.resetWarningCache=te;var le=E(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:o(ee),arrayOf:function(e){return o(function(t,n,l,i,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=t[n];if(!Array.isArray(r))return new a("Invalid "+i+" `"+o+"` of type `"+d(r)+"` supplied to `"+l+"`, expected an array.");for(var u=0;u<r.length;u++){var s=e(r,u,l,i,o+"["+u+"]",K);if(s instanceof Error)return s}return null})},element:o(function(t,n,l,i,o){var r=t[n];return e(r)?null:new a("Invalid "+i+" `"+o+"` of type `"+d(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:o(function(e,t,n,l,i){var o=e[t];return V.isValidElementType(o)?null:new a("Invalid "+l+" `"+i+"` of type `"+d(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return o(function(t,n,l,i,o){var r;return t[n]instanceof e?null:new a("Invalid "+i+" `"+o+"` of type `"+((r=t[n]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:o(function(e,t,n,l,i){return s(e[t])?null:new a("Invalid "+l+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return o(function(t,n,l,i,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=t[n],u=d(r);if("object"!==u)return new a("Invalid "+i+" `"+o+"` of type `"+u+"` supplied to `"+l+"`, expected an object.");for(var s in r)if(z(r,s)){var c=e(r,s,l,i,o+"."+s,K);if(c instanceof Error)return c}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&J(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."),ee;function t(t,n,l,o,r){for(var u=t[n],s=0;s<e.length;s++)if(i(u,e[s]))return null;var d=JSON.stringify(e,function(e,t){return"symbol"===c(t)?String(t):t});return new a("Invalid "+o+" `"+r+"` of value `"+String(u)+"` supplied to `"+l+"`, expected one of "+d+".")}return o(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&J("Invalid argument supplied to oneOfType, expected an instance of array."),ee;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return J("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+t+"."),ee}return o(function(t,n,l,i,o){for(var r=[],u=0;u<e.length;u++){var s=(0,e[u])(t,n,l,i,o,K);if(null==s)return null;s.data&&z(s.data,"expectedType")&&r.push(s.data.expectedType)}return new a("Invalid "+i+" `"+o+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return o(function(t,n,l,i,o){var r=t[n],s=d(r);if("object"!==s)return new a("Invalid "+i+" `"+o+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");for(var p in e){var m=e[p];if("function"!=typeof m)return u(l,i,o,p,c(m));var v=m(r,p,l,i,o+"."+p,K);if(v)return v}return null})},exact:function(e){return o(function(t,n,l,i,o){var r=t[n],s=d(r);if("object"!==s)return new a("Invalid "+i+" `"+o+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");var p=W({},t[n],e);for(var m in p){var v=e[m];if(z(e,m)&&"function"!=typeof v)return u(l,i,o,m,c(v));if(!v)return new a("Invalid "+i+" `"+o+"` key `"+m+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=v(r,m,l,i,o+"."+m,K);if(E)return E}return null})}};function i(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function o(e){function t(t,n,l,i,o,r,u){if(i=i||"<<anonymous>>",r=r||l,u!==K){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 a(null===n[l]?"The "+o+" `"+r+"` is marked as required in `"+i+"`, but its value is `null`.":"The "+o+" `"+r+"` is marked as required in `"+i+"`, but its value is `undefined`."):null:e(n,l,i,o,r)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){return o(function(t,n,l,i,o,r){var u=t[n];return d(u)!==e?new a("Invalid "+i+" `"+o+"` of type `"+c(u)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function u(e,t,n,l,i){return new a((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}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 i,a=l.call(t);if(l!==t.entries){for(;!(i=a.next()).done;)if(!s(i.value))return!1}else for(;!(i=a.next()).done;){var o=i.value;if(o&&!s(o[1]))return!1}return!0;default:return!1}}function d(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 c(e){if(null==e)return""+e;var t=d(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=c(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,l.checkPropTypes=Q,l.resetWarningCache=Q.resetWarningCache,l.PropTypes=l,l}(V.isElement):function(){function e(e,t,n,l,i,a){if(a!==K){var o=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 o.name="Invariant Violation",o}}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:ne,resetWarningCache:te};return n.PropTypes=n,n}()});const ie=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))};ie.propTypes={userType:le.string,name:le.string.isRequired,ref:le.func,value:le.string,onChange:le.func,id:le.string},ie.defaultProps={ref:void 0,onChange:void 0};const ae=e=>l.createElement("h2",{className:"card-label "+e.className,style:e.style},e.children),oe=e=>l.createElement("h2",{className:"card-label-error "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),re=e=>{var t,n,i,a,o,r,u;const s=Digit.SessionStorage.get("userType"),d=null!=e&&e.watch?{fromDate:null==e?void 0:e.watch("fromDate"),toDate:null==e?void 0:e.watch("toDate")}:{};return l.createElement(l.Fragment,null,l.createElement("div",{className:`text-input ${"employee"===s?"":"text-input-width"} ${e.className}`,style:null!=e&&e.textInputStyle?{...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:`${s?"employee-card-input-error":"card-input-error"} ${e.disable&&"disabled"}`,placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t))},ref:e.inputRef,value:void 0!==e.value?e.value:void 0,defaultValue:void 0===e.value?e.defaultValue:void 0,style:{...e.style},minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(n=e.validation)||void 0===n?void 0:n.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(i=e.validation)||void 0===i?void 0:i.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===(a=e.validation)||void 0===a?void 0:a.type:e.type||"text",name:e.name,id:e.id,className:`${s?"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))},ref:e.inputRef,value:void 0!==e.value?e.value:void 0,defaultValue:void 0===e.value?e.defaultValue:void 0,style:{...e.style},minLength:e.minlength,maxLength:e.maxlength,max:e.max,required:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(o=e.validation)||void 0===o?void 0:o.isRequired:e.isRequired||"date"===e.type&&("fromDate"===e.name?d.toDate:d.fromDate),pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(r=e.validation)||void 0===r?void 0:r.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))};re.propTypes={userType:le.string,isMandatory:le.bool,name:le.string,placeholder:le.string,onChange:le.func,ref:le.func,value:le.any},re.defaultProps={isMandatory:!1};const ue=e=>l.createElement("header",{className:"card-header",style:e.styles?e.styles:{}},e.children),se=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),de=n.forwardRef((e,t)=>l.createElement("button",s({ref:t,disabled:!!e.disabled,className:`${e.disabled?"submit-bar-disabled":"submit-bar"} ${e.className?e.className:""}`,type:e.submit?"submit":"button",style:{...e.style},onClick:e.onSubmit},e.form?{form:e.form}:{}),l.createElement("header",null,e.label)));de.propTypes={submit:le.any,style:le.object,label:le.string,onSubmit:le.func},de.defaultProps={};const ce=e=>l.createElement("span",{className:"card-link cp "+e.className,onClick:e.onClick,style:e.style},e.label);ce.propTypes={label:le.any,onClick:le.func},ce.defaultProps={};const pe=e=>l.createElement("label",{style:e.style,className:"card-caption"},e.children),me=e=>{let{t:t,children:n,texts:i={},submit:a=!1,inputs:o=[],onNext:r,onSkip:u,isDisable:s,onAdd:d,isMultipleAllow:c=!1,cardStyle:p={},className:m}=e;const v=window.Digit.Utils.browser.isMobile();return l.createElement("div",{className:m||"",style:p},i.headerCaption&&l.createElement(pe,null,t(i.headerCaption)),(null==i?void 0:i.header)&&l.createElement(ue,null,t(i.header)),(null==i?void 0:i.cardText)&&l.createElement(se,null,t(i.cardText)),l.createElement("div",{className:"formcomposer-section-grid"},n),i.submitBarLabel?l.createElement("div",{className:"formcomposer-section-button"},l.createElement(de,{disabled:s,submit:a,label:t(i.submitBarLabel),onSubmit:r})," "):null,i.skipLabel?l.createElement(se,{style:{marginTop:"10px",textAlign:v?"center":"left"}}," ",t(i.skipLabel)," "):null,i.skipText?l.createElement(ce,{label:t(i.skipText),onClick:u}):null,c&&i.addMultipleText?l.createElement(ce,{label:t(i.addMultipleText),onClick:d}):null)};me.propTypes={text:le.object,submit:le.bool,onNext:le.func,onSkip:le.func,onAdd:le.func,t:le.func},me.defaultProps={texts:{},submit:!1,onNext:void 0,onSkip:void 0,onAdd:void 0,t:e=>e};const ve=e=>{let{className:t,onClick:n,styles:i,disable:a}=e;return l.createElement("svg",{style:{...i},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:a?"#9E9E9E":"black",className:t,onClick:n,width:"18px",height:"18px"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M7 10l5 5 5-5H7z"}))},Ee=e=>{let{number:t,title:i,children:a,defaultOpen:o=!1,tabs:r=null,defaultTab:u="",onTabChange:s=(()=>{}),style:d,className:c}=e;const[p,m]=n.useState(o),[v,E]=n.useState(u||r&&r[0]||"");return l.createElement("div",{className:"collapsible-card "+(c||""),style:d},l.createElement("div",{className:"collapsible-card-header",onClick:()=>m(!p)},l.createElement("h3",{className:"collapsible-card-title"},t?t+". ":"",i),l.createElement("span",{className:"collapsible-card-arrow "+(p?"rotate":"")},l.createElement(ve,null))),p&&l.createElement("div",{className:"collapsible-card-body"},r&&l.createElement("div",{className:"collapsible-card-tabs"},r.map((e,t)=>l.createElement("button",{key:t,onClick:()=>(e=>{E(e),s(e)})(e),className:"collapsible-card-tab-button "+(v===e?"active":"")},e))),l.createElement("div",{className:"collapsible-card-tab-content"},r?l.createElement(l.Fragment,{key:v},a(v)):a)))},_e=e=>{var t,n;let{t:i,children:a,config:r,onSelect:u,onSkip:d,value:c,onChange:p,isDisabled:m,_defaultValues:v={},forcedError:E,componentInFront:_,onAdd:S,cardStyle:f={},isMultipleAllow:y=!1,showErrorBelowChildren:T=!1,childrenAtTheBottom:g=!0,textInputStyle:h,className:I,isCollapsible:C=!0,defaultOpen:N=!0}=e;const{register:A,errors:D,handleSubmit:O}=o.useForm({defaultValues:v});var L=!!m||r.canDisable&&Object.keys(D).filter(e=>D[e]).length;const P=null===(t=r.inputs)||void 0===t?void 0:t.map((e,t)=>{var n,a,o,r;return"text"===e.type?l.createElement(l.Fragment,{key:t},l.createElement(ae,null,i(e.label)),D[e.name]&&l.createElement(oe,null,i(e.error)),l.createElement("div",{className:"field-container",style:{justifyContent:"left"}},_?l.createElement("span",{className:"citizen-card-input citizen-card-input--front"},_):null,l.createElement(re,{key:t,name:e.name,value:c,onChange:p,minlength:e.validation.minlength,maxlength:e.validation.maxlength,pattern:null===(n=e.validation)||void 0===n?void 0:n.pattern,title:null===(a=e.validation)||void 0===a?void 0:a.title,placeholder:e.placeholder,inputRef:A(e.validation),isMandatory:D[e.name],disable:!!e.disable&&e.disable,textInputStyle:h}))):"textarea"===e.type?l.createElement(l.Fragment,{key:t},l.createElement(ae,null,i(e.label)),l.createElement(ie,{key:t,name:e.name,value:c,onChange:p,inputRef:A(e.validation),maxLength:"1024"})):"date"===e.type?(console.log("datedatedate"),l.createElement(l.Fragment,{key:t},l.createElement(ae,null,i(e.label)," ",e.labelChildren&&e.labelChildren),D[e.name]&&l.createElement(oe,null,i(e.error)),l.createElement("div",{className:"field-container",style:{justifyContent:"left"}},l.createElement(re,{key:t,name:e.name,value:c,onChange:p,pattern:null===(o=e.validation)||void 0===o?void 0:o.pattern,title:null===(r=e.validation)||void 0===r?void 0:r.title,inputRef:A(e.validation),isMandatory:D[e.name],disable:!!e.disable&&e.disable,textInputStyle:h,type:e.type})))):void 0}),b=void 0!==r.isCollapsible?r.isCollapsible:C,R=void 0!==r.defaultOpen?r.defaultOpen:N;return l.createElement("form",{style:{flex:"1"},onSubmit:O(e=>{u(e)})},b?l.createElement(Ee,{title:i(null==r||null===(n=r.texts)||void 0===n?void 0:n.header),defaultOpen:R},l.createElement(me,s({isDisable:L,isMultipleAllow:y},r,{texts:{...r.texts,header:null},cardStyle:f,submit:!0,onSkip:d,onAdd:S,t:i,className:I||""}),!g&&a,P,E&&!T&&l.createElement(oe,null,i(E)),g&&a,E&&T&&l.createElement(oe,null,i(E)))):l.createElement(me,s({isDisable:L,isMultipleAllow:y},r,{cardStyle:f,submit:!0,onSkip:d,onAdd:S,t:i,className:I||""}),!g&&a,P,E&&!T&&l.createElement(oe,null,i(E)),g&&a,E&&T&&l.createElement(oe,null,i(E))))};_e.propTypes={config:le.shape({}),onSelect:le.func,onSkip:le.func,onAdd:le.func,t:le.func},_e.defaultProps={config:{},onSelect:void 0,onSkip:void 0,onAdd:void 0,t:e=>e};var Se=E(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],a="[object Arguments]",o="[object Array]",r="[object Boolean]",u="[object Date]",s="[object Error]",d="[object Function]",c="[object GeneratorFunction]",p="[object Map]",m="[object Number]",E="[object Object]",_="[object RegExp]",S="[object Set]",f="[object String]",y="[object Symbol]",T="[object WeakMap]",g="[object ArrayBuffer]",h="[object DataView]",I="[object Float32Array]",C="[object Float64Array]",N="[object Int8Array]",A="[object Int16Array]",D="[object Int32Array]",O="[object Uint8Array]",L="[object Uint16Array]",P="[object Uint32Array]",b=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,M=/(__e\(.*?\)|\b__t\)) \+\n'';/g,k=/&(?:amp|lt|gt|quot|#39);/g,w=/[&<>"']/g,F=RegExp(k.source),x=RegExp(w.source),H=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,W=/[\\^$.*+?()[\]{}|]/g,K=RegExp(W.source),z=/^\s+/,j=/\s/,X=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,q=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Q=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,ie=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,se=/['\n\r\u2028\u2029\\]/g,de="\\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",pe="["+ce+"]",me="["+de+"]",ve="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",_e="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",Se="\\ud83c[\\udffb-\\udfff]",fe="[^\\ud800-\\udfff]",ye="(?:\\ud83c[\\udde6-\\uddff]){2}",Te="[\\ud800-\\udbff][\\udc00-\\udfff]",ge="[A-Z\\xc0-\\xd6\\xd8-\\xde]",he="(?:"+Ee+"|"+_e+")",Ie="(?:"+ge+"|"+_e+")",Ce="(?:"+me+"|"+Se+")?",Ne="[\\ufe0e\\ufe0f]?"+Ce+"(?:\\u200d(?:"+[fe,ye,Te].join("|")+")[\\ufe0e\\ufe0f]?"+Ce+")*",Ae="(?:"+["[\\u2700-\\u27bf]",ye,Te].join("|")+")"+Ne,De="(?:"+[fe+me+"?",me,ye,Te,"[\\ud800-\\udfff]"].join("|")+")",Oe=RegExp("['’]","g"),Le=RegExp(me,"g"),Pe=RegExp(Se+"(?="+Se+")|"+De+Ne,"g"),be=RegExp([ge+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[pe,ge,"$"].join("|")+")",Ie+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[pe,ge+he,"$"].join("|")+")",ge+"?"+he+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ge+"+(?:['’](?: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,Ae].join("|"),"g"),Re=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Me=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ke=["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"],we=-1,Fe={};Fe[I]=Fe[C]=Fe[N]=Fe[A]=Fe[D]=Fe[O]=Fe["[object Uint8ClampedArray]"]=Fe[L]=Fe[P]=!0,Fe[a]=Fe[o]=Fe[g]=Fe[r]=Fe[h]=Fe[u]=Fe[s]=Fe[d]=Fe[p]=Fe[m]=Fe[E]=Fe[_]=Fe[S]=Fe[f]=Fe[T]=!1;var xe={};xe[a]=xe[o]=xe[g]=xe[h]=xe[r]=xe[u]=xe[I]=xe[C]=xe[N]=xe[A]=xe[D]=xe[p]=xe[m]=xe[E]=xe[_]=xe[S]=xe[f]=xe[y]=xe[O]=xe["[object Uint8ClampedArray]"]=xe[L]=xe[P]=!0,xe[s]=xe[d]=xe[T]=!1;var He={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ve=parseFloat,Be=parseInt,Ue="object"==typeof v&&v&&v.Object===Object&&v,Ye="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ue||Ye||Function("return this")(),We=t&&!t.nodeType&&t,Ke=We&&e&&!e.nodeType&&e,ze=Ke&&Ke.exports===We,je=ze&&Ue.process,Xe=function(){try{return Ke&&Ke.require&&Ke.require("util").types||je&&je.binding&&je.binding("util")}catch(e){}}(),$e=Xe&&Xe.isArrayBuffer,qe=Xe&&Xe.isDate,Ze=Xe&&Xe.isMap,Qe=Xe&&Xe.isRegExp,Je=Xe&&Xe.isSet,et=Xe&&Xe.isTypedArray;function tt(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 nt(e,t,n,l){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(l,o,n(o),e)}return l}function lt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function it(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,i=0,a=[];++n<l;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function rt(e,t){return!(null==e||!e.length)&&St(e,t,0)>-1}function ut(e,t,n){for(var l=-1,i=null==e?0:e.length;++l<i;)if(n(t,e[l]))return!0;return!1}function st(e,t){for(var n=-1,l=null==e?0:e.length,i=Array(l);++n<l;)i[n]=t(e[n],n,e);return i}function dt(e,t){for(var n=-1,l=t.length,i=e.length;++n<l;)e[i+n]=t[n];return e}function ct(e,t,n,l){var i=-1,a=null==e?0:e.length;for(l&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function pt(e,t,n,l){var i=null==e?0:e.length;for(l&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,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=gt("length");function Et(e,t,n){var l;return n(e,function(e,n,i){if(t(e,n,i))return l=n,!1}),l}function _t(e,t,n,l){for(var i=e.length,a=n+(l?1:-1);l?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function St(e,t,n){return t==t?function(e,t,n){for(var l=n-1,i=e.length;++l<i;)if(e[l]===t)return l;return-1}(e,t,n):_t(e,yt,n)}function ft(e,t,n,l){for(var i=n-1,a=e.length;++i<a;)if(l(e[i],t))return i;return-1}function yt(e){return e!=e}function Tt(e,t){var n=null==e?0:e.length;return n?Ct(e,t)/n:NaN}function gt(e){return function(t){return null==t?void 0:t[e]}}function ht(e){return function(t){return null==e?void 0:e[t]}}function It(e,t,n,l,i){return i(e,function(e,i,a){n=l?(l=!1,e):t(n,e,i,a)}),n}function Ct(e,t){for(var n,l=-1,i=e.length;++l<i;){var a=t(e[l]);void 0!==a&&(n=void 0===n?a:n+a)}return n}function Nt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function At(e){return e?e.slice(0,Wt(e)+1).replace(z,""):e}function Dt(e){return function(t){return e(t)}}function Ot(e,t){return st(t,function(t){return e[t]})}function Lt(e,t){return e.has(t)}function Pt(e,t){for(var n=-1,l=e.length;++n<l&&St(t,e[n],0)>-1;);return n}function bt(e,t){for(var n=e.length;n--&&St(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Mt=ht({"À":"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"}),kt=ht({"&":"&","<":"<",">":">",'"':""","'":"'"});function wt(e){return"\\"+He[e]}function Ft(e){return Re.test(e)}function xt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Ht(e,t){return function(n){return e(t(n))}}function Vt(e,t){for(var n=-1,i=e.length,a=0,o=[];++n<i;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[a++]=n)}return o}function Bt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Ut(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Yt(e){return Ft(e)?function(e){for(var t=Pe.lastIndex=0;Pe.test(e);)++t;return t}(e):vt(e)}function Gt(e){return Ft(e)?function(e){return e.match(Pe)||[]}(e):function(e){return e.split("")}(e)}function Wt(e){for(var t=e.length;t--&&j.test(e.charAt(t)););return t}var Kt=ht({"&":"&","<":"<",">":">",""":'"',"'":"'"}),zt=function e(t){var v,j=(t=null==t?Ge:zt.defaults(Ge.Object(),t,zt.pick(Ge,ke))).Array,de=t.Date,ce=t.Error,pe=t.Function,me=t.Math,ve=t.Object,Ee=t.RegExp,_e=t.String,Se=t.TypeError,fe=j.prototype,ye=ve.prototype,Te=t["__core-js_shared__"],ge=pe.prototype.toString,he=ye.hasOwnProperty,Ie=0,Ce=(v=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",Ne=ye.toString,Ae=ge.call(ve),De=Ge._,Pe=Ee("^"+ge.call(he).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=ze?t.Buffer:void 0,He=t.Symbol,Ue=t.Uint8Array,Ye=Re?Re.allocUnsafe:void 0,We=Ht(ve.getPrototypeOf,ve),Ke=ve.create,je=ye.propertyIsEnumerable,Xe=fe.splice,vt=He?He.isConcatSpreadable:void 0,ht=He?He.iterator:void 0,jt=He?He.toStringTag:void 0,Xt=function(){try{var e=Qi(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==Ge.clearTimeout&&t.clearTimeout,qt=de&&de.now!==Ge.Date.now&&de.now,Zt=t.setTimeout!==Ge.setTimeout&&t.setTimeout,Qt=me.ceil,Jt=me.floor,en=ve.getOwnPropertySymbols,tn=Re?Re.isBuffer:void 0,nn=t.isFinite,ln=fe.join,an=Ht(ve.keys,ve),on=me.max,rn=me.min,un=de.now,sn=t.parseInt,dn=me.random,cn=fe.reverse,pn=Qi(t,"DataView"),mn=Qi(t,"Map"),vn=Qi(t,"Promise"),En=Qi(t,"Set"),_n=Qi(t,"WeakMap"),Sn=Qi(ve,"create"),fn=_n&&new _n,yn={},Tn=Da(pn),gn=Da(mn),hn=Da(vn),In=Da(En),Cn=Da(_n),Nn=He?He.prototype:void 0,An=Nn?Nn.valueOf:void 0,Dn=Nn?Nn.toString:void 0;function On(e){if(Ko(e)&&!ko(e)&&!(e instanceof Rn)){if(e instanceof bn)return e;if(he.call(e,"__wrapped__"))return Oa(e)}return new bn(e)}var Ln=function(){function e(){}return function(t){if(!Wo(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Pn(){}function bn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Rn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}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 kn(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 wn(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 Fn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new wn;++t<n;)this.add(e[t])}function xn(e){var t=this.__data__=new kn(e);this.size=t.size}function Hn(e,t){var n=ko(e),l=!n&&Mo(e),i=!n&&!l&&Ho(e),a=!n&&!l&&!i&&Jo(e),o=n||l||i||a,r=o?Nt(e.length,_e):[],u=r.length;for(var s in e)!t&&!he.call(e,s)||o&&("length"==s||i&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||aa(s,u))||r.push(s);return r}function Vn(e){var t=e.length;return t?e[wl(0,t-1)]:void 0}function Bn(e,t){return ha(_i(e),$n(t,0,e.length))}function Un(e){return ha(_i(e))}function Yn(e,t,n){(void 0!==n&&!Po(e[t],n)||void 0===n&&!(t in e))&&jn(e,t,n)}function Gn(e,t,n){var l=e[t];he.call(e,t)&&Po(l,n)&&(void 0!==n||t in e)||jn(e,t,n)}function Wn(e,t){for(var n=e.length;n--;)if(Po(e[n][0],t))return n;return-1}function Kn(e,t,n,l){return el(e,function(e,i,a){t(l,e,n(e),a)}),l}function zn(e,t){return e&&Si(t,gr(t),e)}function jn(e,t,n){"__proto__"==t&&Xt?Xt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Xn(e,t){for(var n=-1,l=t.length,i=j(l),a=null==e;++n<l;)i[n]=a?void 0:_r(e,t[n]);return i}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function qn(e,t,n,l,i,o){var s,v=1&t,T=2&t,b=4&t;if(n&&(s=i?n(e,l,i,o):n(e)),void 0!==s)return s;if(!Wo(e))return e;var R=ko(e);if(R){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&he.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!v)return _i(e,s)}else{var M=ta(e),k=M==d||M==c;if(Ho(e))return di(e,v);if(M==E||M==a||k&&!i){if(s=T||k?{}:la(e),!v)return T?function(e,t){return Si(e,ea(e),t)}(e,function(e,t){return e&&Si(t,hr(t),e)}(s,e)):function(e,t){return Si(e,Ji(e),t)}(e,zn(s,e))}else{if(!xe[M])return i?e:{};s=function(e,t,n){var l=e.constructor;switch(t){case g:return ci(e);case r:case u:return new l(+e);case h:return function(e,t){var n=t?ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case I:case C:case N:case A:case D:case O:case"[object Uint8ClampedArray]":case L:case P:return pi(e,n);case p:return new l;case m:case f:return new l(e);case _:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case S:return new l;case y:return An?ve(An.call(e)):{}}}(e,M,v)}}o||(o=new xn);var w=o.get(e);if(w)return w;o.set(e,s),qo(e)?e.forEach(function(l){s.add(qn(l,t,n,l,e,o))}):zo(e)&&e.forEach(function(l,i){s.set(i,qn(l,t,n,i,e,o))});var F=R?void 0:(b?T?Ki:Wi:T?hr:gr)(e);return lt(F||e,function(l,i){F&&(l=e[i=l]),Gn(s,i,qn(l,t,n,i,e,o))}),s}function Zn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var i=n[l],a=e[i];if(void 0===a&&!(i in e)||!(0,t[i])(a))return!1}return!0}function Qn(e,t,l){if("function"!=typeof e)throw new Se(n);return fa(function(){e.apply(void 0,l)},t)}function Jn(e,t,n,l){var i=-1,a=rt,o=!0,r=e.length,u=[],s=t.length;if(!r)return u;n&&(t=st(t,Dt(n))),l?(a=ut,o=!1):t.length>=200&&(a=Lt,o=!1,t=new Fn(t));e:for(;++i<r;){var d=e[i],c=null==n?d:n(d);if(d=l||0!==d?d:0,o&&c==c){for(var p=s;p--;)if(t[p]===c)continue e;u.push(d)}else a(t,c,l)||u.push(d)}return u}On.templateSettings={escape:H,evaluate:V,interpolate:B,variable:"",imports:{_:On}},(On.prototype=Pn.prototype).constructor=On,(bn.prototype=Ln(Pn.prototype)).constructor=bn,(Rn.prototype=Ln(Pn.prototype)).constructor=Rn,Mn.prototype.clear=function(){this.__data__=Sn?Sn(null):{},this.size=0},Mn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Mn.prototype.get=function(e){var t=this.__data__;if(Sn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return he.call(t,e)?t[e]:void 0},Mn.prototype.has=function(e){var t=this.__data__;return Sn?void 0!==t[e]:he.call(t,e)},Mn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Sn&&void 0===t?"__lodash_hash_undefined__":t,this},kn.prototype.clear=function(){this.__data__=[],this.size=0},kn.prototype.delete=function(e){var t=this.__data__,n=Wn(t,e);return!(n<0||(n==t.length-1?t.pop():Xe.call(t,n,1),--this.size,0))},kn.prototype.get=function(e){var t=this.__data__,n=Wn(t,e);return n<0?void 0:t[n][1]},kn.prototype.has=function(e){return Wn(this.__data__,e)>-1},kn.prototype.set=function(e,t){var n=this.__data__,l=Wn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(mn||kn),string:new Mn}},wn.prototype.delete=function(e){var t=qi(this,e).delete(e);return this.size-=t?1:0,t},wn.prototype.get=function(e){return qi(this,e).get(e)},wn.prototype.has=function(e){return qi(this,e).has(e)},wn.prototype.set=function(e,t){var n=qi(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Fn.prototype.add=Fn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Fn.prototype.has=function(e){return this.__data__.has(e)},xn.prototype.clear=function(){this.__data__=new kn,this.size=0},xn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},xn.prototype.get=function(e){return this.__data__.get(e)},xn.prototype.has=function(e){return this.__data__.has(e)},xn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof kn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new wn(l)}return n.set(e,t),this.size=n.size,this};var el=Ti(ul),tl=Ti(sl,!0);function nl(e,t){var n=!0;return el(e,function(e,l,i){return n=!!t(e,l,i)}),n}function ll(e,t,n){for(var l=-1,i=e.length;++l<i;){var a=e[l],o=t(a);if(null!=o&&(void 0===r?o==o&&!Qo(o):n(o,r)))var r=o,u=a}return u}function il(e,t){var n=[];return el(e,function(e,l,i){t(e,l,i)&&n.push(e)}),n}function al(e,t,n,l,i){var a=-1,o=e.length;for(n||(n=ia),i||(i=[]);++a<o;){var r=e[a];t>0&&n(r)?t>1?al(r,t-1,n,l,i):dt(i,r):l||(i[i.length]=r)}return i}var ol=gi(),rl=gi(!0);function ul(e,t){return e&&ol(e,t,gr)}function sl(e,t){return e&&rl(e,t,gr)}function dl(e,t){return ot(t,function(t){return Uo(e[t])})}function cl(e,t){for(var n=0,l=(t=oi(t,e)).length;null!=e&&n<l;)e=e[Aa(t[n++])];return n&&n==l?e:void 0}function pl(e,t,n){var l=t(e);return ko(e)?l:dt(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":jt&&jt in ve(e)?function(e){var t=he.call(e,jt),n=e[jt];try{e[jt]=void 0;var l=!0}catch(e){}var i=Ne.call(e);return l&&(t?e[jt]=n:delete e[jt]),i}(e):function(e){return Ne.call(e)}(e)}function vl(e,t){return e>t}function El(e,t){return null!=e&&he.call(e,t)}function _l(e,t){return null!=e&&t in ve(e)}function Sl(e,t,n){for(var l=n?ut:rt,i=e[0].length,a=e.length,o=a,r=j(a),u=Infinity,s=[];o--;){var d=e[o];o&&t&&(d=st(d,Dt(t))),u=rn(d.length,u),r[o]=!n&&(t||i>=120&&d.length>=120)?new Fn(o&&d):void 0}d=e[0];var c=-1,p=r[0];e:for(;++c<i&&s.length<u;){var m=d[c],v=t?t(m):m;if(m=n||0!==m?m:0,!(p?Lt(p,v):l(s,v,n))){for(o=a;--o;){var E=r[o];if(!(E?Lt(E,v):l(e[o],v,n)))continue e}p&&p.push(v),s.push(m)}}return s}function fl(e,t,n){var l=null==(e=va(e,t=oi(t,e)))?e:e[Aa(Va(t))];return null==l?void 0:tt(l,e,n)}function yl(e){return Ko(e)&&ml(e)==a}function Tl(e,t,n,l,i){return e===t||(null==e||null==t||!Ko(e)&&!Ko(t)?e!=e&&t!=t:function(e,t,n,l,i,d){var c=ko(e),v=ko(t),T=c?o:ta(e),I=v?o:ta(t),C=(T=T==a?E:T)==E,N=(I=I==a?E:I)==E,A=T==I;if(A&&Ho(e)){if(!Ho(t))return!1;c=!0,C=!1}if(A&&!C)return d||(d=new xn),c||Jo(e)?Yi(e,t,n,l,i,d):function(e,t,n,l,i,a,o){switch(n){case h:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case g:return!(e.byteLength!=t.byteLength||!a(new Ue(e),new Ue(t)));case r:case u:case m:return Po(+e,+t);case s:return e.name==t.name&&e.message==t.message;case _:case f:return e==t+"";case p:var d=xt;case S:if(d||(d=Bt),e.size!=t.size&&!(1&l))return!1;var c=o.get(e);if(c)return c==t;l|=2,o.set(e,t);var v=Yi(d(e),d(t),l,i,a,o);return o.delete(e),v;case y:if(An)return An.call(e)==An.call(t)}return!1}(e,t,T,n,l,i,d);if(!(1&n)){var D=C&&he.call(e,"__wrapped__"),O=N&&he.call(t,"__wrapped__");if(D||O){var L=D?e.value():e,P=O?t.value():t;return d||(d=new xn),i(L,P,n,l,d)}}return!!A&&(d||(d=new xn),function(e,t,n,l,i,a){var o=1&n,r=Wi(e),u=r.length;if(u!=Wi(t).length&&!o)return!1;for(var s=u;s--;){var d=r[s];if(!(o?d in t:he.call(t,d)))return!1}var c=a.get(e),p=a.get(t);if(c&&p)return c==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var v=o;++s<u;){var E=e[d=r[s]],_=t[d];if(l)var S=o?l(_,E,d,t,e,a):l(E,_,d,e,t,a);if(!(void 0===S?E===_||i(E,_,n,l,a):S)){m=!1;break}v||(v="constructor"==d)}if(m&&!v){var f=e.constructor,y=t.constructor;f==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof f&&f instanceof f&&"function"==typeof y&&y instanceof y||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,l,i,d))}(e,t,n,l,Tl,i))}function gl(e,t,n,l){var i=n.length,a=i,o=!l;if(null==e)return!a;for(e=ve(e);i--;){var r=n[i];if(o&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++i<a;){var u=(r=n[i])[0],s=e[u],d=r[1];if(o&&r[2]){if(void 0===s&&!(u in e))return!1}else{var c=new xn;if(l)var p=l(s,d,u,e,t,c);if(!(void 0===p?Tl(d,s,3,l,c):p))return!1}}return!0}function hl(e){return!(!Wo(e)||(t=e,Ce&&Ce in t))&&(Uo(e)?Pe:ie).test(Da(e));var t}function Il(e){return"function"==typeof e?e:null==e?jr:"object"==typeof e?ko(e)?Ol(e[0],e[1]):Dl(e):nu(e)}function Cl(e){if(!da(e))return an(e);var t=[];for(var n in ve(e))he.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Nl(e,t){return e<t}function Al(e,t){var n=-1,l=Fo(e)?j(e.length):[];return el(e,function(e,i,a){l[++n]=t(e,i,a)}),l}function Dl(e){var t=Zi(e);return 1==t.length&&t[0][2]?pa(t[0][0],t[0][1]):function(n){return n===e||gl(n,e,t)}}function Ol(e,t){return ra(e)&&ca(t)?pa(Aa(e),t):function(n){var l=_r(n,e);return void 0===l&&l===t?Sr(n,e):Tl(t,l,3)}}function Ll(e,t,n,l,i){e!==t&&ol(t,function(a,o){if(i||(i=new xn),Wo(a))!function(e,t,n,l,i,a,o){var r=_a(e,n),u=_a(t,n),s=o.get(u);if(s)Yn(e,n,s);else{var d=a?a(r,u,n+"",e,t,o):void 0,c=void 0===d;if(c){var p=ko(u),m=!p&&Ho(u),v=!p&&!m&&Jo(u);d=u,p||m||v?ko(r)?d=r:xo(r)?d=_i(r):m?(c=!1,d=di(u,!0)):v?(c=!1,d=pi(u,!0)):d=[]:Xo(u)||Mo(u)?(d=r,Mo(r)?d=rr(r):Wo(r)&&!Uo(r)||(d=la(u))):c=!1}c&&(o.set(u,d),i(d,u,l,a,o),o.delete(u)),Yn(e,n,d)}}(e,t,o,n,Ll,l,i);else{var r=l?l(_a(e,o),a,o+"",e,t,i):void 0;void 0===r&&(r=a),Yn(e,o,r)}},hr)}function Pl(e,t){var n=e.length;if(n)return aa(t+=t<0?n:0,n)?e[t]:void 0}function bl(e,t,n){t=t.length?st(t,function(e){return ko(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[jr];var l=-1;return t=st(t,Dt($i())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,i=e.criteria,a=t.criteria,o=i.length,r=n.length;++l<o;){var u=mi(i[l],a[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}(Al(e,function(e,n,i){return{criteria:st(t,function(t){return t(e)}),index:++l,value:e}}))}function Rl(e,t,n){for(var l=-1,i=t.length,a={};++l<i;){var o=t[l],r=cl(e,o);n(r,o)&&Bl(a,oi(o,e),r)}return a}function Ml(e,t,n,l){var i=l?ft:St,a=-1,o=t.length,r=e;for(e===t&&(t=_i(t)),n&&(r=st(e,Dt(n)));++a<o;)for(var u=0,s=t[a],d=n?n(s):s;(u=i(r,d,u,l))>-1;)r!==e&&Xe.call(r,u,1),Xe.call(e,u,1);return e}function kl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var i=t[n];if(n==l||i!==a){var a=i;aa(i)?Xe.call(e,i,1):Ql(e,i)}}return e}function wl(e,t){return e+Jt(dn()*(t-e+1))}function Fl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Jt(t/2))&&(e+=e)}while(t);return n}function xl(e,t){return ya(ma(e,t,jr),e+"")}function Hl(e){return Vn(Pr(e))}function Vl(e,t){var n=Pr(e);return ha(n,$n(t,0,n.length))}function Bl(e,t,n,l){if(!Wo(e))return e;for(var i=-1,a=(t=oi(t,e)).length,o=a-1,r=e;null!=r&&++i<a;){var u=Aa(t[i]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=o){var d=r[u];void 0===(s=l?l(d,u,r):void 0)&&(s=Wo(d)?d:aa(t[i+1])?[]:{})}Gn(r,u,s),r=r[u]}return e}var Ul=fn?function(e,t){return fn.set(e,t),e}:jr,Yl=Xt?function(e,t){return Xt(e,"toString",{configurable:!0,enumerable:!1,value:Wr(t),writable:!0})}:jr;function Gl(e){return ha(Pr(e))}function Wl(e,t,n){var l=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=j(i);++l<i;)a[l]=e[l+t];return a}function Kl(e,t){var n;return el(e,function(e,l,i){return!(n=t(e,l,i))}),!!n}function zl(e,t,n){var l=0,i=null==e?l:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;l<i;){var a=l+i>>>1,o=e[a];null!==o&&!Qo(o)&&(n?o<=t:o<t)?l=a+1:i=a}return i}return jl(e,t,jr,n)}function jl(e,t,n,l){var i=0,a=null==e?0:e.length;if(0===a)return 0;for(var o=(t=n(t))!=t,r=null===t,u=Qo(t),s=void 0===t;i<a;){var d=Jt((i+a)/2),c=n(e[d]),p=void 0!==c,m=null===c,v=c==c,E=Qo(c);if(o)var _=l||v;else _=s?v&&(l||p):r?v&&p&&(l||!m):u?v&&p&&!m&&(l||!E):!m&&!E&&(l?c<=t:c<t);_?i=d+1:a=d}return rn(a,4294967294)}function Xl(e,t){for(var n=-1,l=e.length,i=0,a=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!Po(r,u)){var u=r;a[i++]=0===o?0:o}}return a}function $l(e){return"number"==typeof e?e:Qo(e)?NaN:+e}function ql(e){if("string"==typeof e)return e;if(ko(e))return st(e,ql)+"";if(Qo(e))return Dn?Dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zl(e,t,n){var l=-1,i=rt,a=e.length,o=!0,r=[],u=r;if(n)o=!1,i=ut;else if(a>=200){var s=t?null:Fi(e);if(s)return Bt(s);o=!1,i=Lt,u=new Fn}else u=t?[]:r;e:for(;++l<a;){var d=e[l],c=t?t(d):d;if(d=n||0!==d?d:0,o&&c==c){for(var p=u.length;p--;)if(u[p]===c)continue e;t&&u.push(c),r.push(d)}else i(u,c,n)||(u!==r&&u.push(c),r.push(d))}return r}function Ql(e,t){return null==(e=va(e,t=oi(t,e)))||delete e[Aa(Va(t))]}function Jl(e,t,n,l){return Bl(e,t,n(cl(e,t)),l)}function ei(e,t,n,l){for(var i=e.length,a=l?i:-1;(l?a--:++a<i)&&t(e[a],a,e););return n?Wl(e,l?0:a,l?a+1:i):Wl(e,l?a+1:0,l?i:a)}function ti(e,t){var n=e;return n instanceof Rn&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))},n)}function ni(e,t,n){var l=e.length;if(l<2)return l?Zl(e[0]):[];for(var i=-1,a=j(l);++i<l;)for(var o=e[i],r=-1;++r<l;)r!=i&&(a[i]=Jn(a[i]||o,e[r],t,n));return Zl(al(a,1),t,n)}function li(e,t,n){for(var l=-1,i=e.length,a=t.length,o={};++l<i;)n(o,e[l],l<a?t[l]:void 0);return o}function ii(e){return xo(e)?e:[]}function ai(e){return"function"==typeof e?e:jr}function oi(e,t){return ko(e)?e:ra(e,t)?[e]:Na(ur(e))}var ri=xl;function ui(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:Wl(e,t,n)}var si=$t||function(e){return Ge.clearTimeout(e)};function di(e,t){if(t)return e.slice();var n=e.length,l=Ye?Ye(n):new e.constructor(n);return e.copy(l),l}function ci(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function pi(e,t){var n=t?ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function mi(e,t){if(e!==t){var n=void 0!==e,l=null===e,i=e==e,a=Qo(e),o=void 0!==t,r=null===t,u=t==t,s=Qo(t);if(!r&&!s&&!a&&e>t||a&&o&&u&&!r&&!s||l&&o&&u||!n&&u||!i)return 1;if(!l&&!a&&!s&&e<t||s&&n&&i&&!l&&!a||r&&n&&i||!o&&i||!u)return-1}return 0}function vi(e,t,n,l){for(var i=-1,a=e.length,o=n.length,r=-1,u=t.length,s=on(a-o,0),d=j(u+s),c=!l;++r<u;)d[r]=t[r];for(;++i<o;)(c||i<a)&&(d[n[i]]=e[i]);for(;s--;)d[r++]=e[i++];return d}function Ei(e,t,n,l){for(var i=-1,a=e.length,o=-1,r=n.length,u=-1,s=t.length,d=on(a-r,0),c=j(d+s),p=!l;++i<d;)c[i]=e[i];for(var m=i;++u<s;)c[m+u]=t[u];for(;++o<r;)(p||i<a)&&(c[m+n[o]]=e[i++]);return c}function _i(e,t){var n=-1,l=e.length;for(t||(t=j(l));++n<l;)t[n]=e[n];return t}function Si(e,t,n,l){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var r=t[a],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),i?jn(n,r,u):Gn(n,r,u)}return n}function fi(e,t){return function(n,l){var i=ko(n)?nt:Kn,a=t?t():{};return i(n,e,$i(l,2),a)}}function yi(e){return xl(function(t,n){var l=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&oa(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=ve(t);++l<i;){var r=n[l];r&&e(t,r,l,a)}return t})}function Ti(e,t){return function(n,l){if(null==n)return n;if(!Fo(n))return e(n,l);for(var i=n.length,a=t?i:-1,o=ve(n);(t?a--:++a<i)&&!1!==l(o[a],a,o););return n}}function gi(e){return function(t,n,l){for(var i=-1,a=ve(t),o=l(t),r=o.length;r--;){var u=o[e?r:++i];if(!1===n(a[u],u,a))break}return t}}function hi(e){return function(t){var n=Ft(t=ur(t))?Gt(t):void 0,l=n?n[0]:t.charAt(0),i=n?ui(n,1).join(""):t.slice(1);return l[e]()+i}}function Ii(e){return function(t){return ct(Ur(Mr(t).replace(Oe,"")),e,"")}}function Ci(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Ln(e.prototype),l=e.apply(n,t);return Wo(l)?l:n}}function Ni(e){return function(t,n,l){var i=ve(t);if(!Fo(t)){var a=$i(n,3);t=gr(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,l);return o>-1?i[a?t[o]:o]:void 0}}function Ai(e){return Gi(function(t){var l=t.length,i=l,a=bn.prototype.thru;for(e&&t.reverse();i--;){var o=t[i];if("function"!=typeof o)throw new Se(n);if(a&&!r&&"wrapper"==ji(o))var r=new bn([],!0)}for(i=r?i:l;++i<l;){var u=ji(o=t[i]),s="wrapper"==u?zi(o):void 0;r=s&&ua(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?r[ji(s[0])].apply(r,s[3]):1==o.length&&ua(o)?r[u]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&ko(n))return r.plant(n).value();for(var i=0,a=l?t[i].apply(this,e):n;++i<l;)a=t[i].call(this,a);return a}})}function Di(e,t,n,l,i,a,o,r,u,s){var d=128&t,c=1&t,p=2&t,m=24&t,v=512&t,E=p?void 0:Ci(e);return function _(){for(var S=arguments.length,f=j(S),y=S;y--;)f[y]=arguments[y];if(m)var T=Xi(_),g=Rt(f,T);if(l&&(f=vi(f,l,i,m)),a&&(f=Ei(f,a,o,m)),S-=g,m&&S<s){var h=Vt(f,T);return ki(e,t,Di,_.placeholder,n,f,h,r,u,s-S)}var I=c?n:this,C=p?I[e]:e;return S=f.length,r?f=Ea(f,r):v&&S>1&&f.reverse(),d&&u<S&&(f.length=u),this&&this!==Ge&&this instanceof _&&(C=E||Ci(C)),C.apply(I,f)}}function Oi(e,t){return function(n,l){return function(e,t,n,l){return ul(e,function(e,i,a){t(l,n(e),i,a)}),l}(n,e,t(l),{})}}function Li(e,t){return function(n,l){var i;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(i=n),void 0!==l){if(void 0===i)return l;"string"==typeof n||"string"==typeof l?(n=ql(n),l=ql(l)):(n=$l(n),l=$l(l)),i=e(n,l)}return i}}function Pi(e){return Gi(function(t){return t=st(t,Dt($i())),xl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function bi(e,t){var n=(t=void 0===t?" ":ql(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Qt(e/Yt(t)));return Ft(t)?ui(Gt(l),0,e).join(""):l.slice(0,e)}function Ri(e){return function(t,n,l){return l&&"number"!=typeof l&&oa(t,n,l)&&(n=l=void 0),t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n,l){for(var i=-1,a=on(Qt((t-e)/(n||1)),0),o=j(a);a--;)o[l?a:++i]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function Mi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function ki(e,t,n,l,i,a,o,r,u,s){var d=8&t;t|=d?32:64,4&(t&=~(d?64:32))||(t&=-4);var c=[e,t,i,d?a:void 0,d?o:void 0,d?void 0:a,d?void 0:o,r,u,s],p=n.apply(void 0,c);return ua(e)&&Sa(p,c),p.placeholder=l,Ta(p,e,t)}function wi(e){var t=me[e];return function(e,n){if(e=or(e),(n=null==n?0:rn(ir(n),292))&&nn(e)){var l=(ur(e)+"e").split("e");return+((l=(ur(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Fi=En&&1/Bt(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Qr;function xi(e){return function(t){var n=ta(t);return n==p?xt(t):n==S?Ut(t):function(e,t){return st(t,function(t){return[t,e[t]]})}(t,e(t))}}function Hi(e,t,i,a,o,r,u,s){var d=2&t;if(!d&&"function"!=typeof e)throw new Se(n);var c=a?a.length:0;if(c||(t&=-97,a=o=void 0),u=void 0===u?u:on(ir(u),0),s=void 0===s?s:ir(s),c-=o?o.length:0,64&t){var p=a,m=o;a=o=void 0}var v=d?void 0:zi(e),E=[e,t,i,a,o,p,m,r,u,s];if(v&&function(e,t){var n=e[1],i=t[1],a=n|i;if(!(a<131||128==i&&8==n||128==i&&256==n&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n))return e;1&i&&(e[2]=t[2],a|=1&n?0:4);var o=t[3];if(o){var r=e[3];e[3]=r?vi(r,o,t[4]):o,e[4]=r?Vt(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?Ei(r,o,t[6]):o,e[6]=r?Vt(e[5],l):t[6]),(o=t[7])&&(e[7]=o),128&i&&(e[8]=null==e[8]?t[8]:rn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=a}(E,v),e=E[0],t=E[1],i=E[2],a=E[3],o=E[4],!(s=E[9]=void 0===E[9]?d?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,n){var l=Ci(e);return function i(){for(var a=arguments.length,o=j(a),r=a,u=Xi(i);r--;)o[r]=arguments[r];var s=a<3&&o[0]!==u&&o[a-1]!==u?[]:Vt(o,u);if((a-=s.length)<n)return ki(e,t,Di,i.placeholder,void 0,o,s,void 0,void 0,n-a);var d=this&&this!==Ge&&this instanceof i?l:e;return tt(d,this,o)}}(e,t,s):32!=t&&33!=t||o.length?Di.apply(void 0,E):function(e,t,n,l){var i=1&t,a=Ci(e);return function t(){for(var o=-1,r=arguments.length,u=-1,s=l.length,d=j(s+r),c=this&&this!==Ge&&this instanceof t?a:e;++u<s;)d[u]=l[u];for(;r--;)d[u++]=arguments[++o];return tt(c,i?n:this,d)}}(e,t,i,a);else var _=function(e,t,n){var l=1&t,i=Ci(e);return function t(){var a=this&&this!==Ge&&this instanceof t?i:e;return a.apply(l?n:this,arguments)}}(e,t,i);return Ta((v?Ul:Sa)(_,E),e,t)}function Vi(e,t,n,l){return void 0===e||Po(e,ye[n])&&!he.call(l,n)?t:e}function Bi(e,t,n,l,i,a){return Wo(e)&&Wo(t)&&(a.set(t,e),Ll(e,t,void 0,Bi,a),a.delete(t)),e}function Ui(e){return Xo(e)?void 0:e}function Yi(e,t,n,l,i,a){var o=1&n,r=e.length,u=t.length;if(r!=u&&!(o&&u>r))return!1;var s=a.get(e),d=a.get(t);if(s&&d)return s==t&&d==e;var c=-1,p=!0,m=2&n?new Fn:void 0;for(a.set(e,t),a.set(t,e);++c<r;){var v=e[c],E=t[c];if(l)var _=o?l(E,v,c,t,e,a):l(v,E,c,e,t,a);if(void 0!==_){if(_)continue;p=!1;break}if(m){if(!mt(t,function(e,t){if(!Lt(m,t)&&(v===e||i(v,e,n,l,a)))return m.push(t)})){p=!1;break}}else if(v!==E&&!i(v,E,n,l,a)){p=!1;break}}return a.delete(e),a.delete(t),p}function Gi(e){return ya(ma(e,void 0,ka),e+"")}function Wi(e){return pl(e,gr,Ji)}function Ki(e){return pl(e,hr,ea)}var zi=fn?function(e){return fn.get(e)}:Qr;function ji(e){for(var t=e.name+"",n=yn[t],l=he.call(yn,t)?n.length:0;l--;){var i=n[l],a=i.func;if(null==a||a==e)return i.name}return t}function Xi(e){return(he.call(On,"placeholder")?On:e).placeholder}function $i(){var e=On.iteratee||Xr;return e=e===Xr?Il:e,arguments.length?e(arguments[0],arguments[1]):e}function qi(e,t){var n,l,i=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Zi(e){for(var t=gr(e),n=t.length;n--;){var l=t[n],i=e[l];t[n]=[l,i,ca(i)]}return t}function Qi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return hl(n)?n:void 0}var Ji=en?function(e){return null==e?[]:(e=ve(e),ot(en(e),function(t){return je.call(e,t)}))}:au,ea=en?function(e){for(var t=[];e;)dt(t,Ji(e)),e=We(e);return t}:au,ta=ml;function na(e,t,n){for(var l=-1,i=(t=oi(t,e)).length,a=!1;++l<i;){var o=Aa(t[l]);if(!(a=null!=e&&n(e,o)))break;e=e[o]}return a||++l!=i?a:!!(i=null==e?0:e.length)&&Go(i)&&aa(o,i)&&(ko(e)||Mo(e))}function la(e){return"function"!=typeof e.constructor||da(e)?{}:Ln(We(e))}function ia(e){return ko(e)||Mo(e)||!!(vt&&e&&e[vt])}function aa(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 oa(e,t,n){if(!Wo(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&aa(t,n.length):"string"==l&&t in n)&&Po(n[t],e)}function ra(e,t){if(ko(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Qo(e))||Y.test(e)||!U.test(e)||null!=t&&e in ve(t)}function ua(e){var t=ji(e),n=On[t];if("function"!=typeof n||!(t in Rn.prototype))return!1;if(e===n)return!0;var l=zi(n);return!!l&&e===l[0]}(pn&&ta(new pn(new ArrayBuffer(1)))!=h||mn&&ta(new mn)!=p||vn&&"[object Promise]"!=ta(vn.resolve())||En&&ta(new En)!=S||_n&&ta(new _n)!=T)&&(ta=function(e){var t=ml(e),n=t==E?e.constructor:void 0,l=n?Da(n):"";if(l)switch(l){case Tn:return h;case gn:return p;case hn:return"[object Promise]";case In:return S;case Cn:return T}return t});var sa=Te?Uo:ou;function da(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}function ca(e){return e==e&&!Wo(e)}function pa(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function ma(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,i=-1,a=on(l.length-t,0),o=j(a);++i<a;)o[i]=l[t+i];i=-1;for(var r=j(t+1);++i<t;)r[i]=l[i];return r[t]=n(o),tt(e,this,r)}}function va(e,t){return t.length<2?e:cl(e,Wl(t,0,-1))}function Ea(e,t){for(var n=e.length,l=rn(t.length,n),i=_i(e);l--;){var a=t[l];e[l]=aa(a,n)?i[a]:void 0}return e}function _a(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Sa=ga(Ul),fa=Zt||function(e,t){return Ge.setTimeout(e,t)},ya=ga(Yl);function Ta(e,t,n){var l=t+"";return ya(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(X,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(i,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(q):[]}(l),n)))}function ga(e){var t=0,n=0;return function(){var l=un(),i=16-(l-n);if(n=l,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function ha(e,t){var n=-1,l=e.length,i=l-1;for(t=void 0===t?l:t;++n<t;){var a=wl(n,i),o=e[a];e[a]=e[n],e[n]=o}return e.length=t,e}var Ia,Ca,Na=(Ia=Co(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(G,function(e,n,l,i){t.push(l?i.replace(J,"$1"):n||e)}),t},function(e){return 500===Ca.size&&Ca.clear(),e}),Ca=Ia.cache,Ia);function Aa(e){if("string"==typeof e||Qo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Da(e){if(null!=e){try{return ge.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oa(e){if(e instanceof Rn)return e.clone();var t=new bn(e.__wrapped__,e.__chain__);return t.__actions__=_i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var La=xl(function(e,t){return xo(e)?Jn(e,al(t,1,xo,!0)):[]}),Pa=xl(function(e,t){var n=Va(t);return xo(n)&&(n=void 0),xo(e)?Jn(e,al(t,1,xo,!0),$i(n,2)):[]}),ba=xl(function(e,t){var n=Va(t);return xo(n)&&(n=void 0),xo(e)?Jn(e,al(t,1,xo,!0),void 0,n):[]});function Ra(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:ir(n);return i<0&&(i=on(l+i,0)),_t(e,$i(t,3),i)}function Ma(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l-1;return void 0!==n&&(i=ir(n),i=n<0?on(l+i,0):rn(i,l-1)),_t(e,$i(t,3),i,!0)}function ka(e){return null!=e&&e.length?al(e,1):[]}function wa(e){return e&&e.length?e[0]:void 0}var Fa=xl(function(e){var t=st(e,ii);return t.length&&t[0]===e[0]?Sl(t):[]}),xa=xl(function(e){var t=Va(e),n=st(e,ii);return t===Va(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Sl(n,$i(t,2)):[]}),Ha=xl(function(e){var t=Va(e),n=st(e,ii);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Sl(n,void 0,t):[]});function Va(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ba=xl(Ua);function Ua(e,t){return e&&e.length&&t&&t.length?Ml(e,t):e}var Ya=Gi(function(e,t){var n=null==e?0:e.length,l=Xn(e,t);return kl(e,st(t,function(e){return aa(e,n)?+e:e}).sort(mi)),l});function Ga(e){return null==e?e:cn.call(e)}var Wa=xl(function(e){return Zl(al(e,1,xo,!0))}),Ka=xl(function(e){var t=Va(e);return xo(t)&&(t=void 0),Zl(al(e,1,xo,!0),$i(t,2))}),za=xl(function(e){var t=Va(e);return t="function"==typeof t?t:void 0,Zl(al(e,1,xo,!0),void 0,t)});function ja(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(xo(e))return t=on(e.length,t),!0}),Nt(t,function(t){return st(e,gt(t))})}function Xa(e,t){if(!e||!e.length)return[];var n=ja(e);return null==t?n:st(n,function(e){return tt(t,void 0,e)})}var $a=xl(function(e,t){return xo(e)?Jn(e,t):[]}),qa=xl(function(e){return ni(ot(e,xo))}),Za=xl(function(e){var t=Va(e);return xo(t)&&(t=void 0),ni(ot(e,xo),$i(t,2))}),Qa=xl(function(e){var t=Va(e);return t="function"==typeof t?t:void 0,ni(ot(e,xo),void 0,t)}),Ja=xl(ja),eo=xl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Xa(e,n)});function to(e){var t=On(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var lo=Gi(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,i=function(t){return Xn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Rn&&aa(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[i],thisArg:void 0}),new bn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(i)}),io=fi(function(e,t,n){he.call(e,n)?++e[n]:jn(e,n,1)}),ao=Ni(Ra),oo=Ni(Ma);function ro(e,t){return(ko(e)?lt:el)(e,$i(t,3))}function uo(e,t){return(ko(e)?it:tl)(e,$i(t,3))}var so=fi(function(e,t,n){he.call(e,n)?e[n].push(t):jn(e,n,[t])}),co=xl(function(e,t,n){var l=-1,i="function"==typeof t,a=Fo(e)?j(e.length):[];return el(e,function(e){a[++l]=i?tt(t,e,n):fl(e,t,n)}),a}),po=fi(function(e,t,n){jn(e,n,t)});function mo(e,t){return(ko(e)?st:Al)(e,$i(t,3))}var vo=fi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Eo=xl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oa(e,t[0],t[1])?t=[]:n>2&&oa(t[0],t[1],t[2])&&(t=[t[0]]),bl(e,al(t,1),[])}),_o=qt||function(){return Ge.Date.now()};function So(e,t,n){return t=n?void 0:t,Hi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function fo(e,t){var l;if("function"!=typeof t)throw new Se(n);return e=ir(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var yo=xl(function(e,t,n){var l=1;if(n.length){var i=Vt(n,Xi(yo));l|=32}return Hi(e,l,t,n,i)}),To=xl(function(e,t,n){var l=3;if(n.length){var i=Vt(n,Xi(To));l|=32}return Hi(t,l,e,n,i)});function go(e,t,l){var i,a,o,r,u,s,d=0,c=!1,p=!1,m=!0;if("function"!=typeof e)throw new Se(n);function v(t){var n=i,l=a;return i=a=void 0,d=t,r=e.apply(l,n)}function E(e){return d=e,u=fa(S,t),c?v(e):r}function _(e){var n=e-s;return void 0===s||n>=t||n<0||p&&e-d>=o}function S(){var e=_o();if(_(e))return f(e);u=fa(S,function(e){var n=t-(e-s);return p?rn(n,o-(e-d)):n}(e))}function f(e){return u=void 0,m&&i?v(e):(i=a=void 0,r)}function y(){var e=_o(),n=_(e);if(i=arguments,a=this,s=e,n){if(void 0===u)return E(s);if(p)return si(u),u=fa(S,t),v(s)}return void 0===u&&(u=fa(S,t)),r}return t=or(t)||0,Wo(l)&&(c=!!l.leading,o=(p="maxWait"in l)?on(or(l.maxWait)||0,t):o,m="trailing"in l?!!l.trailing:m),y.cancel=function(){void 0!==u&&si(u),d=0,i=s=a=u=void 0},y.flush=function(){return void 0===u?r:f(_o())},y}var ho=xl(function(e,t){return Qn(e,1,t)}),Io=xl(function(e,t,n){return Qn(e,or(t)||0,n)});function Co(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Se(n);var l=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=l.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return l.cache=a.set(i,o)||a,o};return l.cache=new(Co.Cache||wn),l}function No(e){if("function"!=typeof e)throw new Se(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)}}Co.Cache=wn;var Ao=ri(function(e,t){var n=(t=1==t.length&&ko(t[0])?st(t[0],Dt($i())):st(al(t,1),Dt($i()))).length;return xl(function(l){for(var i=-1,a=rn(l.length,n);++i<a;)l[i]=t[i].call(this,l[i]);return tt(e,this,l)})}),Do=xl(function(e,t){return Hi(e,32,void 0,t,Vt(t,Xi(Do)))}),Oo=xl(function(e,t){return Hi(e,64,void 0,t,Vt(t,Xi(Oo)))}),Lo=Gi(function(e,t){return Hi(e,256,void 0,void 0,void 0,t)});function Po(e,t){return e===t||e!=e&&t!=t}var bo=Mi(vl),Ro=Mi(function(e,t){return e>=t}),Mo=yl(function(){return arguments}())?yl:function(e){return Ko(e)&&he.call(e,"callee")&&!je.call(e,"callee")},ko=j.isArray,wo=$e?Dt($e):function(e){return Ko(e)&&ml(e)==g};function Fo(e){return null!=e&&Go(e.length)&&!Uo(e)}function xo(e){return Ko(e)&&Fo(e)}var Ho=tn||ou,Vo=qe?Dt(qe):function(e){return Ko(e)&&ml(e)==u};function Bo(e){if(!Ko(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Xo(e)}function Uo(e){if(!Wo(e))return!1;var t=ml(e);return t==d||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Yo(e){return"number"==typeof e&&e==ir(e)}function Go(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Wo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ko(e){return null!=e&&"object"==typeof e}var zo=Ze?Dt(Ze):function(e){return Ko(e)&&ta(e)==p};function jo(e){return"number"==typeof e||Ko(e)&&ml(e)==m}function Xo(e){if(!Ko(e)||ml(e)!=E)return!1;var t=We(e);if(null===t)return!0;var n=he.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ge.call(n)==Ae}var $o=Qe?Dt(Qe):function(e){return Ko(e)&&ml(e)==_},qo=Je?Dt(Je):function(e){return Ko(e)&&ta(e)==S};function Zo(e){return"string"==typeof e||!ko(e)&&Ko(e)&&ml(e)==f}function Qo(e){return"symbol"==typeof e||Ko(e)&&ml(e)==y}var Jo=et?Dt(et):function(e){return Ko(e)&&Go(e.length)&&!!Fe[ml(e)]},er=Mi(Nl),tr=Mi(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fo(e))return Zo(e)?Gt(e):_i(e);if(ht&&e[ht])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ht]());var t=ta(e);return(t==p?xt:t==S?Bt:Pr)(e)}function lr(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 ir(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function ar(e){return e?$n(ir(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Qo(e))return NaN;if(Wo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Wo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=At(e);var n=le.test(e);return n||ae.test(e)?Be(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return Si(e,hr(e))}function ur(e){return null==e?"":ql(e)}var sr=yi(function(e,t){if(da(t)||Fo(t))Si(t,gr(t),e);else for(var n in t)he.call(t,n)&&Gn(e,n,t[n])}),dr=yi(function(e,t){Si(t,hr(t),e)}),cr=yi(function(e,t,n,l){Si(t,hr(t),e,l)}),pr=yi(function(e,t,n,l){Si(t,gr(t),e,l)}),mr=Gi(Xn),vr=xl(function(e,t){e=ve(e);var n=-1,l=t.length,i=l>2?t[2]:void 0;for(i&&oa(t[0],t[1],i)&&(l=1);++n<l;)for(var a=t[n],o=hr(a),r=-1,u=o.length;++r<u;){var s=o[r],d=e[s];(void 0===d||Po(d,ye[s])&&!he.call(e,s))&&(e[s]=a[s])}return e}),Er=xl(function(e){return e.push(void 0,Bi),tt(Cr,void 0,e)});function _r(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function Sr(e,t){return null!=e&&na(e,t,_l)}var fr=Oi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=n},Wr(jr)),yr=Oi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),he.call(e,t)?e[t].push(n):e[t]=[n]},$i),Tr=xl(fl);function gr(e){return Fo(e)?Hn(e):Cl(e)}function hr(e){return Fo(e)?Hn(e,!0):function(e){if(!Wo(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=da(e),n=[];for(var l in e)("constructor"!=l||!t&&he.call(e,l))&&n.push(l);return n}(e)}var Ir=yi(function(e,t,n){Ll(e,t,n)}),Cr=yi(function(e,t,n,l){Ll(e,t,n,l)}),Nr=Gi(function(e,t){var n={};if(null==e)return n;var l=!1;t=st(t,function(t){return t=oi(t,e),l||(l=t.length>1),t}),Si(e,Ki(e),n),l&&(n=qn(n,7,Ui));for(var i=t.length;i--;)Ql(n,t[i]);return n}),Ar=Gi(function(e,t){return null==e?{}:function(e,t){return Rl(e,t,function(t,n){return Sr(e,n)})}(e,t)});function Dr(e,t){if(null==e)return{};var n=st(Ki(e),function(e){return[e]});return t=$i(t),Rl(e,n,function(e,n){return t(e,n[0])})}var Or=xi(gr),Lr=xi(hr);function Pr(e){return null==e?[]:Ot(e,gr(e))}var br=Ii(function(e,t,n){return t=t.toLowerCase(),e+(n?Rr(t):t)});function Rr(e){return Br(ur(e).toLowerCase())}function Mr(e){return(e=ur(e))&&e.replace(re,Mt).replace(Le,"")}var kr=Ii(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),wr=Ii(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=hi("toLowerCase"),xr=Ii(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Hr=Ii(function(e,t,n){return e+(n?" ":"")+Br(t)}),Vr=Ii(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Br=hi("toUpperCase");function Ur(e,t,n){return e=ur(e),void 0===(t=n?void 0:t)?function(e){return Me.test(e)}(e)?function(e){return e.match(be)||[]}(e):function(e){return e.match(Z)||[]}(e):e.match(t)||[]}var Yr=xl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Bo(e)?e:new ce(e)}}),Gr=Gi(function(e,t){return lt(t,function(t){t=Aa(t),jn(e,t,yo(e[t],e))}),e});function Wr(e){return function(){return e}}var Kr=Ai(),zr=Ai(!0);function jr(e){return e}function Xr(e){return Il("function"==typeof e?e:qn(e,1))}var $r=xl(function(e,t){return function(n){return fl(n,e,t)}}),qr=xl(function(e,t){return function(n){return fl(e,n,t)}});function Zr(e,t,n){var l=gr(t),i=dl(t,l);null!=n||Wo(t)&&(i.length||!l.length)||(n=t,t=e,e=this,i=dl(t,gr(t)));var a=!(Wo(n)&&"chain"in n&&!n.chain),o=Uo(e);return lt(i,function(n){var l=t[n];e[n]=l,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__),i=n.__actions__=_i(this.__actions__);return i.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,dt([this.value()],arguments))})}),e}function Qr(){}var Jr=Pi(st),eu=Pi(at),tu=Pi(mt);function nu(e){return ra(e)?gt(Aa(e)):function(e){return function(t){return cl(t,e)}}(e)}var lu=Ri(),iu=Ri(!0);function au(){return[]}function ou(){return!1}var ru,uu=Li(function(e,t){return e+t},0),su=wi("ceil"),du=Li(function(e,t){return e/t},1),cu=wi("floor"),pu=Li(function(e,t){return e*t},1),mu=wi("round"),vu=Li(function(e,t){return e-t},0);return On.after=function(e,t){if("function"!=typeof t)throw new Se(n);return e=ir(e),function(){if(--e<1)return t.apply(this,arguments)}},On.ary=So,On.assign=sr,On.assignIn=dr,On.assignInWith=cr,On.assignWith=pr,On.at=mr,On.before=fo,On.bind=yo,On.bindAll=Gr,On.bindKey=To,On.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ko(e)?e:[e]},On.chain=to,On.chunk=function(e,t,n){t=(n?oa(e,t,n):void 0===t)?1:on(ir(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var i=0,a=0,o=j(Qt(l/t));i<l;)o[a++]=Wl(e,i,i+=t);return o},On.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,i=[];++t<n;){var a=e[t];a&&(i[l++]=a)}return i},On.concat=function(){var e=arguments.length;if(!e)return[];for(var t=j(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return dt(ko(n)?_i(n):[n],al(t,1))},On.cond=function(e){var t=null==e?0:e.length,l=$i();return e=t?st(e,function(e){if("function"!=typeof e[1])throw new Se(n);return[l(e[0]),e[1]]}):[],xl(function(n){for(var l=-1;++l<t;){var i=e[l];if(tt(i[0],this,n))return tt(i[1],this,n)}})},On.conforms=function(e){return function(e){var t=gr(e);return function(n){return Zn(n,e,t)}}(qn(e,1))},On.constant=Wr,On.countBy=io,On.create=function(e,t){var n=Ln(e);return null==t?n:zn(n,t)},On.curry=function e(t,n,l){var i=Hi(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},On.curryRight=function e(t,n,l){var i=Hi(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},On.debounce=go,On.defaults=vr,On.defaultsDeep=Er,On.defer=ho,On.delay=Io,On.difference=La,On.differenceBy=Pa,On.differenceWith=ba,On.drop=function(e,t,n){var l=null==e?0:e.length;return l?Wl(e,(t=n||void 0===t?1:ir(t))<0?0:t,l):[]},On.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?Wl(e,0,(t=l-(t=n||void 0===t?1:ir(t)))<0?0:t):[]},On.dropRightWhile=function(e,t){return e&&e.length?ei(e,$i(t,3),!0,!0):[]},On.dropWhile=function(e,t){return e&&e.length?ei(e,$i(t,3),!0):[]},On.fill=function(e,t,n,l){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&oa(e,t,n)&&(n=0,l=i),function(e,t,n,l){var i=e.length;for((n=ir(n))<0&&(n=-n>i?0:i+n),(l=void 0===l||l>i?i:ir(l))<0&&(l+=i),l=n>l?0:ar(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},On.filter=function(e,t){return(ko(e)?ot:il)(e,$i(t,3))},On.flatMap=function(e,t){return al(mo(e,t),1)},On.flatMapDeep=function(e,t){return al(mo(e,t),1/0)},On.flatMapDepth=function(e,t,n){return n=void 0===n?1:ir(n),al(mo(e,t),n)},On.flatten=ka,On.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},On.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:ir(t)):[]},On.flip=function(e){return Hi(e,512)},On.flow=Kr,On.flowRight=zr,On.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var i=e[t];l[i[0]]=i[1]}return l},On.functions=function(e){return null==e?[]:dl(e,gr(e))},On.functionsIn=function(e){return null==e?[]:dl(e,hr(e))},On.groupBy=so,On.initial=function(e){return null!=e&&e.length?Wl(e,0,-1):[]},On.intersection=Fa,On.intersectionBy=xa,On.intersectionWith=Ha,On.invert=fr,On.invertBy=yr,On.invokeMap=co,On.iteratee=Xr,On.keyBy=po,On.keys=gr,On.keysIn=hr,On.map=mo,On.mapKeys=function(e,t){var n={};return t=$i(t,3),ul(e,function(e,l,i){jn(n,t(e,l,i),e)}),n},On.mapValues=function(e,t){var n={};return t=$i(t,3),ul(e,function(e,l,i){jn(n,l,t(e,l,i))}),n},On.matches=function(e){return Dl(qn(e,1))},On.matchesProperty=function(e,t){return Ol(e,qn(t,1))},On.memoize=Co,On.merge=Ir,On.mergeWith=Cr,On.method=$r,On.methodOf=qr,On.mixin=Zr,On.negate=No,On.nthArg=function(e){return e=ir(e),xl(function(t){return Pl(t,e)})},On.omit=Nr,On.omitBy=function(e,t){return Dr(e,No($i(t)))},On.once=function(e){return fo(2,e)},On.orderBy=function(e,t,n,l){return null==e?[]:(ko(t)||(t=null==t?[]:[t]),ko(n=l?void 0:n)||(n=null==n?[]:[n]),bl(e,t,n))},On.over=Jr,On.overArgs=Ao,On.overEvery=eu,On.overSome=tu,On.partial=Do,On.partialRight=Oo,On.partition=vo,On.pick=Ar,On.pickBy=Dr,On.property=nu,On.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},On.pull=Ba,On.pullAll=Ua,On.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ml(e,t,$i(n,2)):e},On.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ml(e,t,void 0,n):e},On.pullAt=Ya,On.range=lu,On.rangeRight=iu,On.rearg=Lo,On.reject=function(e,t){return(ko(e)?ot:il)(e,No($i(t,3)))},On.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,i=[],a=e.length;for(t=$i(t,3);++l<a;){var o=e[l];t(o,l,e)&&(n.push(o),i.push(l))}return kl(e,i),n},On.rest=function(e,t){if("function"!=typeof e)throw new Se(n);return xl(e,t=void 0===t?t:ir(t))},On.reverse=Ga,On.sampleSize=function(e,t,n){return t=(n?oa(e,t,n):void 0===t)?1:ir(t),(ko(e)?Bn:Vl)(e,t)},On.set=function(e,t,n){return null==e?e:Bl(e,t,n)},On.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Bl(e,t,n,l)},On.shuffle=function(e){return(ko(e)?Un:Gl)(e)},On.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oa(e,t,n)?(t=0,n=l):(t=null==t?0:ir(t),n=void 0===n?l:ir(n)),Wl(e,t,n)):[]},On.sortBy=Eo,On.sortedUniq=function(e){return e&&e.length?Xl(e):[]},On.sortedUniqBy=function(e,t){return e&&e.length?Xl(e,$i(t,2)):[]},On.split=function(e,t,n){return n&&"number"!=typeof n&&oa(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ur(e))&&("string"==typeof t||null!=t&&!$o(t))&&!(t=ql(t))&&Ft(e)?ui(Gt(e),0,n):e.split(t,n):[]},On.spread=function(e,t){if("function"!=typeof e)throw new Se(n);return t=null==t?0:on(ir(t),0),xl(function(n){var l=n[t],i=ui(n,0,t);return l&&dt(i,l),tt(e,this,i)})},On.tail=function(e){var t=null==e?0:e.length;return t?Wl(e,1,t):[]},On.take=function(e,t,n){return e&&e.length?Wl(e,0,(t=n||void 0===t?1:ir(t))<0?0:t):[]},On.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?Wl(e,(t=l-(t=n||void 0===t?1:ir(t)))<0?0:t,l):[]},On.takeRightWhile=function(e,t){return e&&e.length?ei(e,$i(t,3),!1,!0):[]},On.takeWhile=function(e,t){return e&&e.length?ei(e,$i(t,3)):[]},On.tap=function(e,t){return t(e),e},On.throttle=function(e,t,l){var i=!0,a=!0;if("function"!=typeof e)throw new Se(n);return Wo(l)&&(i="leading"in l?!!l.leading:i,a="trailing"in l?!!l.trailing:a),go(e,t,{leading:i,maxWait:t,trailing:a})},On.thru=no,On.toArray=nr,On.toPairs=Or,On.toPairsIn=Lr,On.toPath=function(e){return ko(e)?st(e,Aa):Qo(e)?[e]:_i(Na(ur(e)))},On.toPlainObject=rr,On.transform=function(e,t,n){var l=ko(e),i=l||Ho(e)||Jo(e);if(t=$i(t,4),null==n){var a=e&&e.constructor;n=i?l?new a:[]:Wo(e)&&Uo(a)?Ln(We(e)):{}}return(i?lt:ul)(e,function(e,l,i){return t(n,e,l,i)}),n},On.unary=function(e){return So(e,1)},On.union=Wa,On.unionBy=Ka,On.unionWith=za,On.uniq=function(e){return e&&e.length?Zl(e):[]},On.uniqBy=function(e,t){return e&&e.length?Zl(e,$i(t,2)):[]},On.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zl(e,void 0,t):[]},On.unset=function(e,t){return null==e||Ql(e,t)},On.unzip=ja,On.unzipWith=Xa,On.update=function(e,t,n){return null==e?e:Jl(e,t,ai(n))},On.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,ai(n),l)},On.values=Pr,On.valuesIn=function(e){return null==e?[]:Ot(e,hr(e))},On.without=$a,On.words=Ur,On.wrap=function(e,t){return Do(ai(t),e)},On.xor=qa,On.xorBy=Za,On.xorWith=Qa,On.zip=Ja,On.zipObject=function(e,t){return li(e||[],t||[],Gn)},On.zipObjectDeep=function(e,t){return li(e||[],t||[],Bl)},On.zipWith=eo,On.entries=Or,On.entriesIn=Lr,On.extend=dr,On.extendWith=cr,Zr(On,On),On.add=uu,On.attempt=Yr,On.camelCase=br,On.capitalize=Rr,On.ceil=su,On.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),$n(or(e),t,n)},On.clone=function(e){return qn(e,4)},On.cloneDeep=function(e){return qn(e,5)},On.cloneDeepWith=function(e,t){return qn(e,5,t="function"==typeof t?t:void 0)},On.cloneWith=function(e,t){return qn(e,4,t="function"==typeof t?t:void 0)},On.conformsTo=function(e,t){return null==t||Zn(e,t,gr(t))},On.deburr=Mr,On.defaultTo=function(e,t){return null==e||e!=e?t:e},On.divide=du,On.endsWith=function(e,t,n){e=ur(e),t=ql(t);var l=e.length,i=n=void 0===n?l:$n(ir(n),0,l);return(n-=t.length)>=0&&e.slice(n,i)==t},On.eq=Po,On.escape=function(e){return(e=ur(e))&&x.test(e)?e.replace(w,kt):e},On.escapeRegExp=function(e){return(e=ur(e))&&K.test(e)?e.replace(W,"\\$&"):e},On.every=function(e,t,n){var l=ko(e)?at:nl;return n&&oa(e,t,n)&&(t=void 0),l(e,$i(t,3))},On.find=ao,On.findIndex=Ra,On.findKey=function(e,t){return Et(e,$i(t,3),ul)},On.findLast=oo,On.findLastIndex=Ma,On.findLastKey=function(e,t){return Et(e,$i(t,3),sl)},On.floor=cu,On.forEach=ro,On.forEachRight=uo,On.forIn=function(e,t){return null==e?e:ol(e,$i(t,3),hr)},On.forInRight=function(e,t){return null==e?e:rl(e,$i(t,3),hr)},On.forOwn=function(e,t){return e&&ul(e,$i(t,3))},On.forOwnRight=function(e,t){return e&&sl(e,$i(t,3))},On.get=_r,On.gt=bo,On.gte=Ro,On.has=function(e,t){return null!=e&&na(e,t,El)},On.hasIn=Sr,On.head=wa,On.identity=jr,On.includes=function(e,t,n,l){e=Fo(e)?e:Pr(e),n=n&&!l?ir(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),Zo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&St(e,t,n)>-1},On.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:ir(n);return i<0&&(i=on(l+i,0)),St(e,t,i)},On.inRange=function(e,t,n){return t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n){return e>=rn(t,n)&&e<on(t,n)}(e=or(e),t,n)},On.invoke=Tr,On.isArguments=Mo,On.isArray=ko,On.isArrayBuffer=wo,On.isArrayLike=Fo,On.isArrayLikeObject=xo,On.isBoolean=function(e){return!0===e||!1===e||Ko(e)&&ml(e)==r},On.isBuffer=Ho,On.isDate=Vo,On.isElement=function(e){return Ko(e)&&1===e.nodeType&&!Xo(e)},On.isEmpty=function(e){if(null==e)return!0;if(Fo(e)&&(ko(e)||"string"==typeof e||"function"==typeof e.splice||Ho(e)||Jo(e)||Mo(e)))return!e.length;var t=ta(e);if(t==p||t==S)return!e.size;if(da(e))return!Cl(e).length;for(var n in e)if(he.call(e,n))return!1;return!0},On.isEqual=function(e,t){return Tl(e,t)},On.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?Tl(e,t,void 0,n):!!l},On.isError=Bo,On.isFinite=function(e){return"number"==typeof e&&nn(e)},On.isFunction=Uo,On.isInteger=Yo,On.isLength=Go,On.isMap=zo,On.isMatch=function(e,t){return e===t||gl(e,t,Zi(t))},On.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,gl(e,t,Zi(t),n)},On.isNaN=function(e){return jo(e)&&e!=+e},On.isNative=function(e){if(sa(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return hl(e)},On.isNil=function(e){return null==e},On.isNull=function(e){return null===e},On.isNumber=jo,On.isObject=Wo,On.isObjectLike=Ko,On.isPlainObject=Xo,On.isRegExp=$o,On.isSafeInteger=function(e){return Yo(e)&&e>=-9007199254740991&&e<=9007199254740991},On.isSet=qo,On.isString=Zo,On.isSymbol=Qo,On.isTypedArray=Jo,On.isUndefined=function(e){return void 0===e},On.isWeakMap=function(e){return Ko(e)&&ta(e)==T},On.isWeakSet=function(e){return Ko(e)&&"[object WeakSet]"==ml(e)},On.join=function(e,t){return null==e?"":ln.call(e,t)},On.kebabCase=kr,On.last=Va,On.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l;return void 0!==n&&(i=(i=ir(n))<0?on(l+i,0):rn(i,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,i):_t(e,yt,i,!0)},On.lowerCase=wr,On.lowerFirst=Fr,On.lt=er,On.lte=tr,On.max=function(e){return e&&e.length?ll(e,jr,vl):void 0},On.maxBy=function(e,t){return e&&e.length?ll(e,$i(t,2),vl):void 0},On.mean=function(e){return Tt(e,jr)},On.meanBy=function(e,t){return Tt(e,$i(t,2))},On.min=function(e){return e&&e.length?ll(e,jr,Nl):void 0},On.minBy=function(e,t){return e&&e.length?ll(e,$i(t,2),Nl):void 0},On.stubArray=au,On.stubFalse=ou,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=pu,On.nth=function(e,t){return e&&e.length?Pl(e,ir(t)):void 0},On.noConflict=function(){return Ge._===this&&(Ge._=De),this},On.noop=Qr,On.now=_o,On.pad=function(e,t,n){e=ur(e);var l=(t=ir(t))?Yt(e):0;if(!t||l>=t)return e;var i=(t-l)/2;return bi(Jt(i),n)+e+bi(Qt(i),n)},On.padEnd=function(e,t,n){e=ur(e);var l=(t=ir(t))?Yt(e):0;return t&&l<t?e+bi(t-l,n):e},On.padStart=function(e,t,n){e=ur(e);var l=(t=ir(t))?Yt(e):0;return t&&l<t?bi(t-l,n)+e:e},On.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),sn(ur(e).replace(z,""),t||0)},On.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oa(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=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var i=dn();return rn(e+i*(t-e+Ve("1e-"+((i+"").length-1))),t)}return wl(e,t)},On.reduce=function(e,t,n){var l=ko(e)?ct:It,i=arguments.length<3;return l(e,$i(t,4),n,i,el)},On.reduceRight=function(e,t,n){var l=ko(e)?pt:It,i=arguments.length<3;return l(e,$i(t,4),n,i,tl)},On.repeat=function(e,t,n){return t=(n?oa(e,t,n):void 0===t)?1:ir(t),Fl(ur(e),t)},On.replace=function(){var e=arguments,t=ur(e[0]);return e.length<3?t:t.replace(e[1],e[2])},On.result=function(e,t,n){var l=-1,i=(t=oi(t,e)).length;for(i||(i=1,e=void 0);++l<i;){var a=null==e?void 0:e[Aa(t[l])];void 0===a&&(l=i,a=n),e=Uo(a)?a.call(e):a}return e},On.round=mu,On.runInContext=e,On.sample=function(e){return(ko(e)?Vn:Hl)(e)},On.size=function(e){if(null==e)return 0;if(Fo(e))return Zo(e)?Yt(e):e.length;var t=ta(e);return t==p||t==S?e.size:Cl(e).length},On.snakeCase=xr,On.some=function(e,t,n){var l=ko(e)?mt:Kl;return n&&oa(e,t,n)&&(t=void 0),l(e,$i(t,3))},On.sortedIndex=function(e,t){return zl(e,t)},On.sortedIndexBy=function(e,t,n){return jl(e,t,$i(n,2))},On.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=zl(e,t);if(l<n&&Po(e[l],t))return l}return-1},On.sortedLastIndex=function(e,t){return zl(e,t,!0)},On.sortedLastIndexBy=function(e,t,n){return jl(e,t,$i(n,2),!0)},On.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=zl(e,t,!0)-1;if(Po(e[n],t))return n}return-1},On.startCase=Hr,On.startsWith=function(e,t,n){return e=ur(e),n=null==n?0:$n(ir(n),0,e.length),t=ql(t),e.slice(n,n+t.length)==t},On.subtract=vu,On.sum=function(e){return e&&e.length?Ct(e,jr):0},On.sumBy=function(e,t){return e&&e.length?Ct(e,$i(t,2)):0},On.template=function(e,t,n){var l=On.templateSettings;n&&oa(e,t,n)&&(t=void 0),e=ur(e),t=cr({},t,l,Vi);var i,a,o=cr({},t.imports,l.imports,Vi),r=gr(o),u=Ot(o,r),s=0,d=t.interpolate||ue,c="__p += '",p=Ee((t.escape||ue).source+"|"+d.source+"|"+(d===B?ee:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),m="//# sourceURL="+(he.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++we+"]")+"\n";e.replace(p,function(t,n,l,o,r,u){return l||(l=o),c+=e.slice(s,u).replace(se,wt),n&&(i=!0,c+="' +\n__e("+n+") +\n'"),r&&(a=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),c+="';\n";var v=he.call(t,"variable")&&t.variable;if(v){if(Q.test(v))throw new ce("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(a?c.replace(b,""):c).replace(R,"$1").replace(M,"$1;"),c="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Yr(function(){return pe(r,m+"return "+c).apply(void 0,u)});if(E.source=c,Bo(E))throw E;return E},On.times=function(e,t){if((e=ir(e))<1||e>9007199254740991)return[];var n=4294967295,l=rn(e,4294967295);e-=4294967295;for(var i=Nt(l,t=$i(t));++n<e;)t(n);return i},On.toFinite=lr,On.toInteger=ir,On.toLength=ar,On.toLower=function(e){return ur(e).toLowerCase()},On.toNumber=or,On.toSafeInteger=function(e){return e?$n(ir(e),-9007199254740991,9007199254740991):0===e?e:0},On.toString=ur,On.toUpper=function(e){return ur(e).toUpperCase()},On.trim=function(e,t,n){if((e=ur(e))&&(n||void 0===t))return At(e);if(!e||!(t=ql(t)))return e;var l=Gt(e),i=Gt(t);return ui(l,Pt(l,i),bt(l,i)+1).join("")},On.trimEnd=function(e,t,n){if((e=ur(e))&&(n||void 0===t))return e.slice(0,Wt(e)+1);if(!e||!(t=ql(t)))return e;var l=Gt(e);return ui(l,0,bt(l,Gt(t))+1).join("")},On.trimStart=function(e,t,n){if((e=ur(e))&&(n||void 0===t))return e.replace(z,"");if(!e||!(t=ql(t)))return e;var l=Gt(e);return ui(l,Pt(l,Gt(t))).join("")},On.truncate=function(e,t){var n=30,l="...";if(Wo(t)){var i="separator"in t?t.separator:i;n="length"in t?ir(t.length):n,l="omission"in t?ql(t.omission):l}var a=(e=ur(e)).length;if(Ft(e)){var o=Gt(e);a=o.length}if(n>=a)return e;var r=n-Yt(l);if(r<1)return l;var u=o?ui(o,0,r).join(""):e.slice(0,r);if(void 0===i)return u+l;if(o&&(r+=u.length-r),$o(i)){if(e.slice(r).search(i)){var s,d=u;for(i.global||(i=Ee(i.source,ur(te.exec(i))+"g")),i.lastIndex=0;s=i.exec(d);)var c=s.index;u=u.slice(0,void 0===c?r:c)}}else if(e.indexOf(ql(i),r)!=r){var p=u.lastIndexOf(i);p>-1&&(u=u.slice(0,p))}return u+l},On.unescape=function(e){return(e=ur(e))&&F.test(e)?e.replace(k,Kt):e},On.uniqueId=function(e){var t=++Ie;return ur(e)+t},On.upperCase=Vr,On.upperFirst=Br,On.each=ro,On.eachRight=uo,On.first=wa,Zr(On,(ru={},ul(On,function(e,t){he.call(On.prototype,t)||(ru[t]=e)}),ru),{chain:!1}),On.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){On[e].placeholder=On}),lt(["drop","take"],function(e,t){Rn.prototype[e]=function(n){n=void 0===n?1:on(ir(n),0);var l=this.__filtered__&&!t?new Rn(this):this.clone();return l.__filtered__?l.__takeCount__=rn(n,l.__takeCount__):l.__views__.push({size:rn(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Rn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),lt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Rn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$i(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Rn.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Rn.prototype[e]=function(){return this.__filtered__?new Rn(this):this[n](1)}}),Rn.prototype.compact=function(){return this.filter(jr)},Rn.prototype.find=function(e){return this.filter(e).head()},Rn.prototype.findLast=function(e){return this.reverse().find(e)},Rn.prototype.invokeMap=xl(function(e,t){return"function"==typeof e?new Rn(this):this.map(function(n){return fl(n,e,t)})}),Rn.prototype.reject=function(e){return this.filter(No($i(e)))},Rn.prototype.slice=function(e,t){e=ir(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Rn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ir(t))<0?n.dropRight(-t):n.take(t-e)),n)},Rn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Rn.prototype.toArray=function(){return this.take(4294967295)},ul(Rn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),i=On[l?"take"+("last"==t?"Right":""):t],a=l||/^find/.test(t);i&&(On.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Rn,u=o[0],s=r||ko(t),d=function(e){var t=i.apply(On,dt([e],o));return l&&c?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(r=s=!1);var c=this.__chain__,p=!!this.__actions__.length,m=a&&!c,v=r&&!p;if(!a&&s){t=v?t:new Rn(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new bn(E,c)}return m&&v?e.apply(this,o):(E=this.thru(d),m?l?E.value()[0]:E.value():E)})}),lt(["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);On.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var i=this.value();return t.apply(ko(i)?i:[],e)}return this[n](function(n){return t.apply(ko(n)?n:[],e)})}}),ul(Rn.prototype,function(e,t){var n=On[t];if(n){var l=n.name+"";he.call(yn,l)||(yn[l]=[]),yn[l].push({name:t,func:n})}}),yn[Di(void 0,2).name]=[{name:"wrapper",func:void 0}],Rn.prototype.clone=function(){var e=new Rn(this.__wrapped__);return e.__actions__=_i(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=_i(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=_i(this.__views__),e},Rn.prototype.reverse=function(){if(this.__filtered__){var e=new Rn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Rn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ko(e),l=t<0,i=n?e.length:0,a=function(e,t,n){for(var l=-1,i=n.length;++l<i;){var a=n[l],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=rn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,r=a.end,u=r-o,s=l?r:o-1,d=this.__iteratees__,c=d.length,p=0,m=rn(u,this.__takeCount__);if(!n||!l&&i==u&&m==u)return ti(e,this.__actions__);var v=[];e:for(;u--&&p<m;){for(var E=-1,_=e[s+=t];++E<c;){var S=d[E],f=S.type,y=(0,S.iteratee)(_);if(2==f)_=y;else if(!y){if(1==f)continue e;break e}}v[p++]=_}return v},On.prototype.at=lo,On.prototype.chain=function(){return to(this)},On.prototype.commit=function(){return new bn(this.value(),this.__chain__)},On.prototype.next=function(){void 0===this.__values__&&(this.__values__=nr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},On.prototype.plant=function(e){for(var t,n=this;n instanceof Pn;){var l=Oa(n);l.__index__=0,l.__values__=void 0,t?i.__wrapped__=l:t=l;var i=l;n=n.__wrapped__}return i.__wrapped__=e,t},On.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Rn){var t=e;return this.__actions__.length&&(t=new Rn(this)),(t=t.reverse()).__actions__.push({func:no,args:[Ga],thisArg:void 0}),new bn(t,this.__chain__)}return this.thru(Ga)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return ti(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,ht&&(On.prototype[ht]=function(){return this}),On}();Ke?((Ke.exports=zt)._=zt,We._=zt):Ge._=zt}).call(v)});const fe=e=>{let{path:n}=e;const o=a.useLocation(),{t:r}=i.useTranslation(),u=Digit.ComponentRegistryService.getComponent("FSMNewApplicationCitizen"),d=Digit.ComponentRegistryService.getComponent("FSMMyApplications"),c=Digit.ComponentRegistryService.getComponent("FSMEmployeeApplicationDetails"),p=Digit.ComponentRegistryService.getComponent("FSMCitizenApplicationDetails"),m=Digit.ComponentRegistryService.getComponent("FSMSelectRating"),v=Digit.ComponentRegistryService.getComponent("FSMRateView"),E=Digit.ComponentRegistryService.getComponent("FSMResponse"),_=Digit.ComponentRegistryService.getComponent("FSMDsoDashboard"),S=Digit.ComponentRegistryService.getComponent("FSMEmpInbox"),f=Digit.ComponentRegistryService.getComponent("EditVendor");return console.log(n+"/registry/modify-vendor/:id"),l.createElement(l.Fragment,null,l.createElement("div",{className:"fsm-citizen-wrapper"},o.pathname.includes("/response")||o.pathname.split("/").includes("check")?null:o.pathname.includes("/street")?l.createElement(t.BackButton,{getBackPageNumber:()=>-4},r("CS_COMMON_BACK")):l.createElement(t.BackButton,null,r("CS_COMMON_BACK")),l.createElement(a.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/inbox",component:()=>Digit.UserService.hasAccess(["FSM_DSO"])?l.createElement(S,{parentRoute:n,isInbox:!0}):l.createElement(a.Redirect,{to:"/digit-ui/citizen"})}),l.createElement(t.PrivateRoute,{path:n+"/search",component:()=>Digit.UserService.hasAccess(["FSM_DSO"])?l.createElement(S,{parentRoute:n,isSearch:!0}):l.createElement(a.Redirect,{to:"/digit-ui/citizen"})}),l.createElement(t.PrivateRoute,{path:n+"/new-application",component:()=>l.createElement(u,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/my-applications",component:d}),l.createElement(t.PrivateRoute,{path:n+"/dso-application-details/:id",component:()=>l.createElement(c,{parentRoute:n,userType:"DSO"})}),l.createElement(t.PrivateRoute,{path:n+"/application-details/:id",component:()=>l.createElement(p,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/rate/:id",component:()=>l.createElement(m,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/rate-view/:id",component:()=>l.createElement(v,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/response",component:e=>l.createElement(E,s({parentRoute:n},e))}),l.createElement(t.PrivateRoute,{path:n+"/dso-dashboard",component:()=>l.createElement(_,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/dso-dashboard",component:()=>l.createElement(_,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/registry/modify-vendor/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(f,e))}))))},ye=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))},Te=e=>{var t,a,o,r,u,s,d,c,p;let{assigner:m}=e;const{t:v}=i.useTranslation(),[E,_]=n.useState(null),S=Digit.ULBService.getCurrentTenantId(),{data:f}=Digit.Hooks.useEmployeeSearch(S,{uuids:null==m?void 0:m.uuid},{enabled:"employee"===Digit.UserService.getType()&&"EMPLOYEE"===(null==m?void 0:m.type)});return l.createElement("p",null,null==m?void 0:m.name," ",null!=f&&null!==(t=f.Employees)&&void 0!==t&&null!==(a=t[0])&&void 0!==a&&null!==(o=a.assignments)&&void 0!==o&&null!==(r=o[0])&&void 0!==r&&r.designation?`(${v("COMMON_MASTERS_DESIGNATION_"+(null==f||null===(u=f.Employees)||void 0===u||null===(s=u[0])||void 0===s||null===(d=s.assignments)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.designation))})`:"","CITIZEN"===(null==m?void 0:m.type)&&null!=m&&null!==(p=m.roles)&&void 0!==p&&p.some(e=>"FSM_DSO"===e.code)?"(DSO)":"")},ge=e=>{let{data:n}=e;const{t:a}=i.useTranslation();return l.createElement("div",null,n.date&&l.createElement("p",null,n.date),l.createElement(Te,{assigner:n.name}),n.mobileNumber&&l.createElement(t.TelePhone,{mobile:n.mobileNumber}),n.source&&l.createElement("p",null,a("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+n.source.toUpperCase())),n.comment&&l.createElement(ye,{otherComment:null==n?void 0:n.otherComment,headComment:null==n?void 0:n.comment}))},he=e=>{var o,r,u,s,d,c;const{t:p}=i.useTranslation(),{isLoading:m,data:v}=Digit.Hooks.useWorkflowDetails({tenantId:null===(o=e.application)||void 0===o?void 0:o.tenantId,id:e.id,moduleCode:"FSM"}),[E,_]=n.useState(!1),S=i=>{var o;const r=null==i||null===(o=i.comment)||void 0===o?void 0:o.split("~"),u=r?r[0]:null,s=r?r[1]:null;if("CREATED"===i.status){var d,c;const t={date:null==i||null===(d=i.auditDetails)||void 0===d?void 0:d.created,source:(null===(c=e.application)||void 0===c?void 0:c.source)||""};return l.createElement(ge,{data:t})}if("PENDING_APPL_FEE_PAYMENT"===i.status||"DSO_REJECTED"===i.status||"CANCELED"===i.status||"REJECTED"===i.status){var m;const e={date:null==i||null===(m=i.auditDetails)||void 0===m?void 0:m.created,name:null==i?void 0:i.assigner,comment:u?p("ES_ACTION_REASON_"+u):null,otherComment:s||null};return l.createElement(ge,{data:e})}if("CITIZEN_FEEDBACK_PENDING"===i.status)return l.createElement(n.Fragment,null,(null==v?void 0:v.nextActions.length)>0&&l.createElement("div",null,l.createElement(a.Link,{to:"/digit-ui/citizen/fsm/rate/"+e.id},l.createElement(t.ActionLinks,null,p("CS_FSM_RATE")))));if("DSO_INPROGRESS"===i.status){var E,_,S;const t={name:null==i?void 0:i.assigner,mobileNumber:null===(E=e.application)||void 0===E||null===(_=E.dsoDetails)||void 0===_?void 0:_.mobileNumber,date:`${p("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(null===(S=e.application)||void 0===S?void 0:S.possibleServiceDate)}`};return l.createElement(ge,{data:t})}if("COMPLETED"===i.status)return l.createElement("div",null,l.createElement(t.Rating,{withText:!0,text:p("CS_FSM_YOU_RATED"),currentRating:i.rating}),l.createElement(a.Link,{to:"/digit-ui/citizen/fsm/rate-view/"+e.id},l.createElement(t.ActionLinks,null,p("CS_FSM_RATE_VIEW"))));if("DISPOSAL_IN_PROGRESS"===i.status){var f,y;const e={date:null==i||null===(f=i.auditDetails)||void 0===f?void 0:f.created,name:null==i?void 0:i.assigner,mobileNumber:null==i||null===(y=i.assigner)||void 0===y?void 0:y.mobileNumber};return null!=i&&i.numberOfTrips&&(e.comment=`${p("NUMBER_OF_TRIPS")}: ${null==i?void 0:i.numberOfTrips}`),l.createElement(ge,{data:e})}if("PENDING_PAYYY"===i.status){var T,g;const t={name:null==i?void 0:i.assigner,mobileNumber:null==i||null===(T=i.assigner)||void 0===T?void 0:T.mobileNumber,date:`${p("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(null===(g=e.application)||void 0===g?void 0:g.possibleServiceDate)}`};return l.createElement(ge,{data:t})}};return m?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,!m&&l.createElement(n.Fragment,null,(null==v||null===(r=v.timeline)||void 0===r?void 0:r.length)>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},p("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=v&&v.timeline&&1===(null==v||null===(u=v.timeline)||void 0===u?void 0:u.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:p("CS_COMMON_FSM_"+("UPDATE"===(null==v||null===(s=v.timeline[0])||void 0===s?void 0:s.performedAction)?"UPDATE_":"")+(null==v||null===(d=v.timeline[0])||void 0===d?void 0:d.status)),customChild:S(null==v?void 0:v.timeline[0])}):l.createElement(t.ConnectingCheckPoints,null,(null==v?void 0:v.timeline)&&(null==v?void 0:v.timeline.slice(0,E?v.timeline.length:2).map((e,n,i)=>l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,label:p("CS_COMMON_"+("UPDATE"===(null==e?void 0:e.performedAction)?"UPDATE_":"")+e.status),customChild:S(e)}))))),(null==v||null===(c=v.timeline)||void 0===c?void 0:c.length)>2&&l.createElement(t.LinkButton,{label:p(E?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{_(e=>!e)}})),v&&(n=>{switch(null==n?void 0:n.action){case"PAY":return l.createElement("div",{style:{marginTop:"24px"}},l.createElement(a.Link,{to:{pathname:`/digit-ui/citizen/payment/my-bills/FSM.TRIP_CHARGES/${e.id}/?tenantId=${e.application.tenantId}`,state:{tenantId:e.application.tenantId}}},window.location.href.includes("citizen/fsm/")&&l.createElement(t.SubmitBar,{label:p("CS_APPLICATION_DETAILS_MAKE_PAYMENT")})));case"SUBMIT_FEEDBACK":return l.createElement("div",{style:{marginTop:"24px"}},l.createElement(a.Link,{to:"/digit-ui/citizen/fsm/rate/"+e.id},l.createElement(t.SubmitBar,{label:p("CS_APPLICATION_DETAILS_RATE")})))}})(null==v?void 0:v.nextActions[0]))},Ie=e=>{let{application:n}=e;const{t:o}=i.useTranslation();return l.createElement(t.Card,null,l.createElement(t.KeyNote,{keyValue:o("CS_FSM_APPLICATION_APPLICATION_NO"),note:n.applicationNo}),l.createElement(t.KeyNote,{keyValue:o("CS_FSM_APPLICATION_SERVICE_CATEGORY"),note:n.serviceCategory||o("CS_TITLE_FSM")}),l.createElement(t.KeyNote,{keyValue:o("CS_FSM_APPLICATION_DETAIL_STATUS"),note:o("CS_COMMON_"+n.applicationStatus)}),l.createElement(a.Link,{to:{pathname:"/digit-ui/citizen/fsm/application-details/"+n.applicationNo,state:{tenantId:n.tenantId}}},l.createElement(t.SubmitBar,{label:o("CS_COMMON_VIEW")})))},Ce=e=>{let{jumpTo:n}=e;const{t:o}=i.useTranslation(),r=a.useHistory();return l.createElement(t.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(n)}})},Ne=e=>{var n,a,o,r,u,s,d,c;let{onSubmit:p,value:v}=e;const{t:E}=i.useTranslation(),{address:_,propertyType:S,subtype:f,pitType:y,pitDetail:T,selectGender:g,selectPaymentPreference:h,selectTripNo:I,roadWidth:C}=v,N=T?Object.values(T).filter(e=>!!e):null,A=null==N?void 0:N.reduce((e,t,n,l)=>n===l.length-1?e+t+"m":e+t+"m x ","");return l.createElement(l.Fragment,null,l.createElement(m,{currentStep:4,flow:"APPLY"}),l.createElement(t.Card,null,l.createElement(t.CardHeader,null,E("CS_CHECK_CHECK_YOUR_ANSWERS")),l.createElement(t.CardText,null,E("CS_CHECK_CHECK_YOUR_ANSWERS_TEXT")),l.createElement(t.CardSubHeader,null,E("CS_CHECK_PROPERTY_DETAILS")),l.createElement(t.StatusTable,null,I&&(null==I?void 0:I.tripNo)&&l.createElement(t.Row,{label:E("ES_FSM_ACTION_NUMBER_OF_TRIPS"),text:E(null==I||null===(n=I.tripNo)||void 0===n?void 0:n.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-trip-number"})}),I&&(null==I?void 0:I.vehicleCapacity)&&l.createElement(t.Row,{label:E("ES_VEHICLE CAPACITY"),text:E(null==I||null===(a=I.vehicleCapacity)||void 0===a?void 0:a.capacity),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-trip-number"})}),g&&l.createElement(t.Row,{label:E("ES_FSM_ACTION_GENDER_TYPE"),text:E(null==g?void 0:g.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-gender"})}),l.createElement(t.Row,{label:E("CS_CHECK_PROPERTY_ID"),text:null!=v&&null!==(o=v.cptId)&&void 0!==o&&o.id?null==v||null===(r=v.cptId)||void 0===r?void 0:r.id:"NA",actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/know-your-property"})}),l.createElement(t.Row,{label:E("CS_CHECK_PROPERTY_TYPE"),text:E(null==S?void 0:S.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/property-type"})}),l.createElement(t.Row,{label:E("CS_CHECK_PROPERTY_SUB_TYPE"),text:E(null==f?void 0:f.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/property-subtype"})}),l.createElement(t.Row,{label:E("CS_CHECK_ADDRESS"),text:((e,t)=>{var n,l,i,a,o,r,u,s,d,c,p,m,v,E,_,S,f,y,T;return console.log("address",e),"OTH1"===(null==e||null===(n=e.gramPanchayat)||void 0===n?void 0:n.code)?`${null!=e&&null!==(i=e.doorNo)&&void 0!==i&&i.trim()?(null==e||null===(a=e.doorNo)||void 0===a?void 0:a.trim())+", ":""} ${null!=e&&null!==(o=e.street)&&void 0!==o&&o.trim()?(null==e||null===(r=e.street)||void 0===r?void 0:r.trim())+", ":""}${"WITHIN_ULB_LIMITS"===(null==e||null===(u=e.propertyLocation)||void 0===u?void 0:u.code)?t(null==e||null===(s=e.locality)||void 0===s?void 0:s.i18nkey):null==e?void 0:e.newGramPanchayat},${t(null==e||null===(d=e.village)||void 0===d?void 0:d.code)}, ${t(null==e?void 0:e.city.code)}`:"WITHIN_ULB_LIMITS"===(null==e||null===(l=e.propertyLocation)||void 0===l?void 0:l.code)?(console.log("trueee",""+t(null==e||null===(c=e.locality)||void 0===c?void 0:c.code)),""+t(null==e||null===(p=e.locality)||void 0===p?void 0:p.code)):`${null!=e&&null!==(m=e.doorNo)&&void 0!==m&&m.trim()?(null==e||null===(v=e.doorNo)||void 0===v?void 0:v.trim())+", ":""} ${null!=e&&null!==(E=e.street)&&void 0!==E&&E.trim()?(null==e||null===(_=e.street)||void 0===_?void 0:_.trim())+", ":""}${"WITHIN_ULB_LIMITS"===(null==e||null===(S=e.propertyLocation)||void 0===S?void 0:S.code)?t(null==e||null===(f=e.locality)||void 0===f?void 0:f.i18nkey):null==e||null===(y=e.gramPanchayat)||void 0===y?void 0:y.i18nkey},${t(null==e||null===(T=e.village)||void 0===T?void 0:T.code)}, ${t(null==e?void 0:e.city.code)}`})(_,E),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/pincode"})}),(null==_||null===(u=_.landmark)||void 0===u?void 0:u.trim())&&l.createElement(t.Row,{label:E("CS_CHECK_LANDMARK"),text:null==_||null===(s=_.landmark)||void 0===s?void 0:s.trim(),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/landmark"})}),!0===(null==_||null===(d=_.slumArea)||void 0===d?void 0:d.code)&&l.createElement(t.Row,{label:E("CS_APPLICATION_DETAILS_SLUM_NAME"),text:E(null==_||null===(c=_.slumData)||void 0===c?void 0:c.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/slum-details"})}),y&&l.createElement(t.Row,{label:E("CS_CHECK_PIT_TYPE"),text:E(y.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/pit-type"})}),l.createElement(t.Row,{label:E("CS_CHECK_ROAD_WIDTH"),text:E(null==C?void 0:C.roadWidth),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/road-details"})}),l.createElement(t.Row,{label:E("CS_CHECK_DISTANCE_FROM_ROAD"),text:E(null==C?void 0:C.distancefromroad),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/road-details"})}),A&&l.createElement(t.Row,{label:E("CS_CHECK_SIZE"),text:[A],actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/tank-size"})}),((null==h?void 0:h.advanceAmount)||0===(null==h?void 0:h.advanceAmount))&&l.createElement(t.Row,{label:E("ADV_AMOUNT"),text:"₹ "+E(null==h?void 0:h.advanceAmount),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-payment-preference"})})),l.createElement(t.SubmitBar,{label:E("CS_COMMON_SUBMIT"),onSubmit:p})),S&&l.createElement(t.CitizenInfoLabel,{style:{marginTop:"8px",padding:"16px"},info:E("CS_FILE_APPLICATION_INFO_LABEL"),text:E("CS_FILE_APPLICATION_INFO_TEXT",{content:E("CS_DEFAULT_INFO_TEXT"),...S})}))},Ae=(e,t)=>{var n,l;return null!=e&&e.slumName?t(e.slumName):null!=e&&null!==(n=e.slum)&&void 0!==n&&n.i18nKey?t(""+(null==e||null===(l=e.slum)||void 0===l?void 0:l.i18nKey)):"N/A"},De=e=>e&&0!==e?"₹ "+e:"N/A",Oe=e=>e&&0!==e?"₹ "+e:"N/A",Le=(e,t)=>{var n,l,i,a,o,r,u;const s=null==e||null===(n=e.tenantId)||void 0===n?void 0:n.toUpperCase().split(".").join("_"),d=null==e||null===(l=e.address)||void 0===l||null===(i=l.locality)||void 0===i?void 0:i.code,c=null==e||null===(a=e.address)||void 0===a||null===(o=a.additionalDetails)||void 0===o?void 0:o.village,p=null==e||null===(r=e.address)||void 0===r||null===(u=r.additionalDetails)||void 0===u?void 0:u.newGramPanchayat;return null!=c&&c.code?t(`${s}_REVENUE_${d}`)+" "+t(null==c?void 0:c.name)||"N/A":p?t(p)+" "+t(null==c?void 0:c.name)||"N/A":t(`${s}_REVENUE_${d}`)||"N/A"},Pe=(e,t,n)=>{var l,i,a,o,r,u,s,c,p,m,v,E,_,S,f,y,T,g,h,I,C,N;const{additionalDetails:A}=e,D=null==A?void 0:A.tripAmount,O=D*(null==e?void 0:e.noOfTrips),L=null==e?void 0:e.advanceAmount;return console.log("applicationapplication",e),{t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_")))}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:(null==e?void 0:e.applicationNo)||"NA",heading:n("PDF_HEADER_DESLUDGING_REQUEST_ACKNOWLEDGEMENT"),details:[{title:n("CS_TITLE_APPLICATION_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_APPLICATION_DATE"),value:Digit.DateUtils.ConvertTimestampToDate(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.createdTime,"dd/MM/yyyy")},{title:n("CS_APPLICATION_DETAILS_APPLICATION_CHANNEL"),value:n("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+(null==e?void 0:e.source))||"N/A"}]},{title:n("CS_APPLICATION_DETAILS_APPLICANT_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_APPLICANT_NAME"),value:(null==e||null===(a=e.citizen)||void 0===a?void 0:a.name)||"N/A"},{title:n("CS_APPLICATION_DETAILS_APPLICANT_MOBILE"),value:(null==e||null===(o=e.citizen)||void 0===o?void 0:o.mobileNumber)||"N/A"},{title:n("CS_APPLICATION_DETAILS_APPLICANT_EMAIL_ID"),value:(null==e||null===(r=e.citizen)||void 0===r?void 0:r.emailId)||(null==e||null===(u=e.additionalDetails)||void 0===u?void 0:u.emailId)||"NA"}]},{title:n("CS_APPLICATION_DETAILS_PROPERTY_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_PROPERTY_ID"),value:(null==e||null===(s=e.additionalDetails)||void 0===s?void 0:s.propertyID)||"N/A"},{title:n("CS_APPLICATION_DETAILS_PROPERTY_TYPE"),value:n((R=null==e?void 0:e.propertyUsage,"PROPERTYTYPE_MASTERS_"+(null==R?void 0:R.split(".")[0])))||"N/A"},{title:n("CS_APPLICATION_DETAILS_PROPERTY_SUB_TYPE"),value:n(d(null==e?void 0:e.propertyUsage))||"N/A"}]},{title:n("CS_APPLICATION_DETAILS_PROPERTY_LOCATION_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_PINCODE"),value:(null==e||null===(c=e.address)||void 0===c?void 0:c.pincode)||"N/A"},{title:n("CS_APPLICATION_DETAILS_CITY"),value:(null==e||null===(p=e.address)||void 0===p?void 0:p.city)||"N/A"},{title:n("CS_APPLICATION_DETAILS_MOHALLA"),value:Le(e,n)},{title:n("CS_APPLICATION_DETAILS_SLUM_NAME"),value:Ae(e,n)},{title:n("CS_APPLICATION_DETAILS_STREET"),value:(null==e||null===(m=e.address)||void 0===m?void 0:m.street)||"N/A"},{title:n("CS_APPLICATION_DETAILS_DOOR_NO"),value:(null==e||null===(v=e.address)||void 0===v?void 0:v.doorNo)||"N/A"},{title:n("CS_APPLICATION_DETAILS_LANDMARK"),value:(null==e||null===(E=e.address)||void 0===E?void 0:E.landmark)||"N/A"}]},{title:n("CS_APPLICATION_DETAILS_PIT_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_PIT_TYPE"),value:null!=e&&e.sanitationtype?n("PITTYPE_MASTERS_"+(null==e?void 0:e.sanitationtype)):"N/A"},{title:n("CS_APPLICATION_DETAILS_ROAD_WIDTH"),value:(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.roadWidth)||"N/A"},{title:n("CS_APPLICATION_DETAILS_DISTANCE_FROM_ROAD"),value:(null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.distancefromroad)||"N/A"},{title:n("CS_APPLICATION_DETAILS_DIMENSION"),value:null!=e&&null!==(f=e.pitDetail)&&void 0!==f&&f.height&&null!==(null==e||null===(y=e.pitDetail)||void 0===y?void 0:y.height)?null!=e&&null!==(T=e.pitDetail)&&void 0!==T&&T.length?`${null==e||null===(g=e.pitDetail)||void 0===g?void 0:g.length}m * ${null==e||null===(h=e.pitDetail)||void 0===h?void 0:h.width}m * ${null==e||null===(I=e.pitDetail)||void 0===I?void 0:I.height}m (${n("CS_COMMON_LENGTH")} x ${n("CS_COMMON_BREADTH")} x ${n("CS_COMMON_DEPTH")})`:`${null==e||null===(C=e.pitDetail)||void 0===C?void 0:C.diameter}m * ${null==e||null===(N=e.pitDetail)||void 0===N?void 0:N.height}m (${n("CS_COMMON_DIAMETER")} x ${n("CS_COMMON_DEPTH")})`:"N/A"},{title:n("ES_APPLICATION_DETAILS_VEHICLE_CAPACITY"),value:(b=null==e?void 0:e.vehicleCapacity,b||"N/A")},{title:n("CS_APPLICATION_DETAILS_TRIPS"),value:(null==e?void 0:e.noOfTrips)||"N/A"},{title:n("CS_APPLICATION_DETAILS_AMOUNT_PER_TRIP"),value:De(D)},{title:n("CS_APPLICATION_DETAILS_AMOUNT_DUE"),value:Oe(O)},{title:n("CS_APPLICATION_DETAILS_ADV_AMOUNT_DUE"),value:(P=L,null===P?"N/A":"₹ "+P)}]}]};var P,b,R},be=()=>{const{t:e}=i.useTranslation();return e("CS_FILE_DESLUDGING_APPLICATION_SUCCESS")},Re=e=>{var n,i,a;return l.createElement(t.Banner,{message:be(),applicationNumber:(null==e||null===(n=e.data)||void 0===n?void 0:n.fsm)&&(null==e||null===(i=e.data)||void 0===i||null===(a=i.fsm[0])||void 0===a?void 0:a.applicationNo),info:e.t("CS_FILE_DESLUDGING_APPLICATION_NO"),successful:e.isSuccess})},Me=e=>{var o,r,u,s,d,c,p,m,v,E;let{data:_,onSuccess:S}=e;const{t:f}=i.useTranslation(),y=Digit.ULBService.getCurrentTenantId(),T=Digit.Hooks.fsm.useDesludging(null!=_&&null!==(o=_.address)&&void 0!==o&&o.city?null===(r=_.address)||void 0===r||null===(u=r.city)||void 0===u?void 0:u.code:y),{data:g}=Digit.Hooks.useStore.getInitData(),{tenants:h}=g||{},[I,C,N]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[A,D,O]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[L,P,b]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),[R,M]=n.useState(null),[k,w]=n.useState(null),[F,x]=n.useState(null),H=(null==T?void 0:T.data)||L,V=null==H||null===(s=H.fsm)||void 0===s||null===(d=s[0].address)||void 0===d||null===(c=d.locality)||void 0===c?void 0:c.code,B=null==H||null===(p=H.fsm)||void 0===p||null===(m=p[0].address)||void 0===m?void 0:m.slumName,U=Digit.Hooks.fsm.useSlum(null==H||null===(v=H.fsm)||void 0===v||null===(E=v[0].address)||void 0===E?void 0:E.tenantId,B,V,{enabled:!!B,retry:!!B}),Y=(e,t)=>{var n,l,i;console.log("error",e),D((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors[0])||void 0===i?void 0:i.code)||"ERROR"),C(!0)};n.useEffect(()=>{T.data&&P(T.data)},[T.data]),n.useEffect(()=>{if(!I&&!A)try{var e,t,n,l,i,a;const o=Digit.SessionStorage.get("total_amount"),r=Digit.SessionStorage.get("amount_per_trip"),{subtype:u,propertyID:s,pitDetail:d,address:c,pitType:p,source:m,selectGender:v,selectPaymentPreference:E,selectTripNo:f}=_,{city:y,locality:g,geoLocation:h,pincode:I,street:N,doorNo:A,landmark:D,slum:O,gramPanchayat:L,village:P,propertyLocation:b,newLocality:R,newGramPanchayat:k,newVillage:F}=c;M(null==E?void 0:E.code);const H=0===o?null:null==E?void 0:E.advanceAmount;x(0===o),w(0===H);const V={fsm:{citizen:{gender:null==v?void 0:v.code},tenantId:null==y?void 0:y.code,propertyUsage:null==u?void 0:u.code,address:{tenantId:null==y?void 0:y.code,additionalDetails:{boundaryType:"FROM_GRAM_PANCHAYAT"===(null==b?void 0:b.code)?"GP":"Locality",gramPanchayat:{code:null==L?void 0:L.code,name:null==L?void 0:L.name},village:null!=P&&P.code?{code:null!=P&&P.code?null==P?void 0:P.code:"",name:null!=P&&P.name?null==P?void 0:P.name:""}:F,newLocality:R,newGramPanchayat:k},street:null==N?void 0:N.trim(),doorNo:null==A?void 0:A.trim(),landmark:D,slumName:O,city:null==y?void 0:y.name,pincode:I,locality:{code:"WITHIN_ULB_LIMITS"===(null==b?void 0:b.code)?null==g?void 0:g.code:null==L?void 0:L.code,name:"WITHIN_ULB_LIMITS"===(null==b?void 0:b.code)?null==g?void 0:g.name:null==L?void 0:L.name},geoLocation:{latitude:null==h?void 0:h.latitude,longitude:null==h?void 0:h.longitude,additionalDetails:{}}},pitDetail:{additionalDetails:{fileStoreId:{CITIZEN:null==d?void 0:d.images}}},source:m,sanitationtype:null==p?void 0:p.code,paymentPreference:0===o?null:null!=E&&E.paymentType?null==E||null===(e=E.paymentType)||void 0===e?void 0:e.code:null,noOfTrips:f?null==f||null===(t=f.tripNo)||void 0===t?void 0:t.code:1,vehicleCapacity:f?null==f||null===(n=f.vehicleCapacity)||void 0===n?void 0:n.capacity:"",additionalDetails:{totalAmount:o,tripAmount:"number"==typeof r?JSON.stringify(r):r,propertyID:null==s?void 0:s.propertyID,distancefromroad:null==_||null===(l=_.roadWidth)||void 0===l?void 0:l.distancefromroad,roadWidth:null==_||null===(i=_.roadWidth)||void 0===i?void 0:i.roadWidth,propertyID:null==_||null===(a=_.cptId)||void 0===a?void 0:a.id},advanceAmount:"number"==typeof H?JSON.stringify(H):H},workflow:null};console.log("formdata212",V,c,_),T.mutate(V,{onError:Y,onSuccess:()=>{C(!0),S()}}),sessionStorage.removeItem("Digit.total_amount"),sessionStorage.removeItem("Digit.fsm.file.address.city")}catch(e){}},[]);const G=!!L||(null==T?void 0:T.isSuccess);return T.isLoading||T.isIdle&&!I?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Re,{t:f,data:H,isSuccess:G,isLoading:T.isIdle&&!I||(null==T?void 0:T.isLoading)}),l.createElement(t.CardText,null,f(R&&"POST_PAY"==R||k?"CS_FILE_PROPERTY_RESPONSE_POST_PAY":F?"CS_FSM_RESPONSE_CREATE_DISPLAY_ZERO_PAY":"CS_FILE_PROPERTY_RESPONSE")),G&&l.createElement(t.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},f("CS_COMMON_DOWNLOAD"))),onClick:()=>{const{fsm:e}=H,[t,...n]=e,l=h.find(e=>e.code===t.tenantId),i=Pe({...t,slum:U},l,f);Digit.Utils.pdf.generate(i)},className:"w-full"}),l.createElement(a.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:f("CORE_COMMON_GO_TO_HOME")})))},ke=e=>{const{t:o}=i.useTranslation(),r=a.useHistory(),[u,s]=n.useState("");let d={texts:{cardText:"",submitBarLabel:"CS_COMMON_NEXT"},inputs:[{label:o("ES_FSM_VEHICLE_NUMBER"),type:"text",name:"vehicleNumber",validation:{pattern:"[A-Z]{2}[0-9]{2}[A-Z]{0,2}[0-9]{4}",title:o("ES_FSM_VEHICLE_FORMAT_TIP")}}],key:"vehicleNumber"};const c=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:c?{}:{marginLeft:"20px"}},l.createElement(t.Header,null,o("ES_FSM_ADD_VEHICLE_LOG"))),l.createElement(t.FormStep,{config:d,onChange:function(e){return 0!=e.target.value.trim().length?s(e.target.value):null},onSelect:e=>{r.push("/digit-ui/employee/fsm/fstp-fsm-request/"+e.vehicleNumber.trim())},t:o,isDisabled:!u,cardStyle:{margin:"10px"},textInputStyle:{maxWidth:"540px"}}))},we=()=>(i.useTranslation(),Digit.ULBService.getStateId(),Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId(),a.useHistory(),l.createElement(l.Fragment,null,l.createElement(t.ULBHomeCard,{title:"ES_COMMON_FSTP_OPERATION",module:[{name:"ES_FSM_ADD_NEW_BUTTON",link:"/digit-ui/employee/fsm/fstp-add-vehicle",icon:l.createElement(t.AddNewIcon,null)},{name:"ES_FSM_VIEW_REPORTS_BUTTON",link:"/employee/report/fsm/FSMFSTPPlantWithVehicleLogReport",hyperlink:!0,icon:l.createElement(t.ViewReportIcon,null)},{name:"ES_COMMON_INBOX",link:"/digit-ui/employee/fsm/fstp-inbox",icon:l.createElement(t.InboxIcon,null)}]}," "))),Fe=e=>{let{parentRoute:o}=e;const{t:r}=i.useTranslation(),u=[{text:r("ES_TITLE_NEW_DESULDGING_APPLICATION"),link:"/digit-ui/employee/fsm/new-application",roles:["FSM_CREATOR_EMP"]},{text:r("ES_TITILE_SEARCH_APPLICATION"),link:o+"/search"},{text:r("ES_TITLE_REPORTS"),link:"/employee/report/fsm/FSMDailyDesludingReport",roles:["FSM_ADMIN"],hyperlink:!0}],[s,d]=n.useState([]),{roles:c}=Digit.UserService.getUser().info;return n.useEffect(()=>{let e=u.filter(e=>{let{roles:t}=e;return(null==t?void 0:t.some(e=>null==c?void 0:c.map(e=>{let{code:t}=e;return t}).includes(e)))||!(null!=t&&t.length)});d(e)},[]),l.createElement(t.Card,{className:"employeeCard inboxLinksFSM"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.ShippingTruck,null))," ",l.createElement("span",{className:"text"},r("ES_TITLE_FAECAL_SLUDGE_MGMT"))),l.createElement("div",{className:"body"},s.map((e,t)=>{let{link:n,text:i,hyperlink:o=!1,accessTo:u=[]}=e;return l.createElement("span",{className:"link",key:t},o?l.createElement("a",{href:n},r(i)):l.createElement(a.Link,{to:n},r(i)))}))))},xe=e=>{let{className:n="table",t:i,currentPage:a,columns:o,data:r,getCellProps:u,disableSort:s,onSort:d,onNextPage:c,onPrevPage:p,onPageSizeChange:m,pageSizeLimit:v,sortParams:E,totalRecords:_,isPaginationRequired:S}=e;return l.createElement(t.Table,{className:n,t:i,data:r,currentPage:a,columns:o,getCellProps:u,onNextPage:c,onPrevPage:p,pageSizeLimit:v,disableSort:s,onPageSizeChange:m,onSort:d,sortParams:E,totalRecords:_,isPaginationRequired:S})},He=e=>{var n,a;let{status:o,fsmfilters:r,onAssignmentChange:u,statusMap:s}=e;const{t:d}=i.useTranslation(),c=null==s||null===(n=s.filter(e=>(null==e?void 0:e.applicationstatus)===o.code))||void 0===n||null===(a=n[0])||void 0===a?void 0:a.count;return l.createElement(t.CheckBox,{onChange:e=>u(e,o),checked:0!==(null==r?void 0:r.applicationStatus.filter(e=>e.name===o.name).length),label:`${d(o.name)} (${c||0})`})},Ve=e=>{let{onAssignmentChange:a,fsmfilters:o,mergedRoleDetails:r,statusMap:u}=e;const{t:s}=i.useTranslation(),{data:d,isLoading:c}=Digit.Hooks.fsm.useApplicationStatus(!0,!0,u),[p,m]=n.useState(!1),v=r.statuses.map(e=>null==d?void 0:d.filter(t=>t.code===e)[0]).filter(e=>null==e?void 0:e.code),E=null==d?void 0:d.filter(e=>!v.find(t=>t.code===e.code));return c?l.createElement(t.Loader,null):(null==v?void 0:v.length)>0?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},s("ES_INBOX_STATUS")),null==v?void 0:v.map((e,t)=>l.createElement(He,{key:t,onAssignmentChange:a,status:e,fsmfilters:o,statusMap:u})),p?null==E?void 0:E.map((e,t)=>l.createElement(He,{key:t,onAssignmentChange:a,status:e,fsmfilters:o,statusMap:u})):null,!1===r.fixed&&E.length>0?l.createElement("div",{className:"filter-button",onClick:()=>m(!p)}," ",s(p?"ES_COMMON_LESS":"ES_COMMON_MORE")," "):null):null},Be=e=>{let{onFilterChange:n,searchParams:i,paginationParms:a,tenantId:o,t:r}=e;const{data:u}=Digit.Hooks.fsm.useInbox(o,{...i,...a,fromDate:null!=i&&i.fromDate?new Date(null==i?void 0:i.fromDate).getTime():void 0,toDate:null!=i&&i.toDate?new Date(null==i?void 0:i.toDate).getTime():void 0,total:!0,uuid:{code:"ASSIGNED_TO_ALL",name:r("ES_INBOX_ASSIGNED_TO_ALL")}}),s=[{code:"ASSIGNED_TO_ME",name:r("ES_INBOX_ASSIGNED_TO_ME")+" (0)"},{code:"ASSIGNED_TO_ALL",name:`${r("ES_INBOX_ASSIGNED_TO_ALL")} (${(null==u?void 0:u.totalCount)||0})`}];return l.createElement(l.Fragment,null,l.createElement(t.RadioButtons,{onSelect:e=>n({uuid:{code:e.code}}),selectedOption:s.filter(e=>{var t;return e.code===(null==i||null===(t=i.uuid)||void 0===t?void 0:t.code)})[0],optionsKey:"name",options:s}))},Ue=e=>{var n,o,r,u;let{searchParams:s,paginationParms:d,onFilterChange:c,onSearch:p,...m}=e;const{t:v}=i.useTranslation(),E=a.useLocation(),_=Digit.UserService.hasAccess(["FSM_DSO"])||!1,S=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,f=Digit.UserService.hasAccess("FSM_EMP_FSTPO")&&E.pathname.includes("fstp-fsm-request")||!1,y=Digit.ULBService.getCurrentTenantId(),T=Digit.ULBService.getStateId(),{data:g,isFetched:h}=Digit.Hooks.fsm.useMDMS(T,"DIGIT-UI","RoleStatusMapping"),I=Digit.UserService.getUser().info.roles.map(e=>e.code),C=null==g?void 0:g.filter(e=>I.filter(t=>t===e.userRole)[0]),N=null==C?void 0:C.reduce((e,t)=>({fixed:(null==t?void 0:t.fixed)&&(null==e?void 0:e.fixed),statuses:[...null==e?void 0:e.statuses,...null==t?void 0:t.statuses].filter((e,t,n)=>n.indexOf(e)==t),zeroCheck:(null==t?void 0:t.zeroCheck)||(null==e?void 0:e.zeroCheck)}),{statuses:[]}),A=()=>{if(S)return c()};return l.createElement(l.Fragment,null,(!_&&!S&&s||(null==N||null===(n=N.statuses)||void 0===n?void 0:n.length)>0||f)&&l.createElement("div",{className:"filter",style:{marginTop:S?"-0px":"revert"}},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},v("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:A},v("ES_COMMON_CLEAR_ALL")),"desktop"===m.type&&l.createElement("span",{className:"clear-search",onClick:A},v("ES_COMMON_CLEAR_ALL")),"mobile"===m.type&&l.createElement("span",{onClick:m.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,!_&&!S&&s&&l.createElement(Be,{onFilterChange:c,searchParams:s,paginationParms:d,tenantId:y,t:v}),l.createElement("div",null)),(null==N||null===(o=N.statuses)||void 0===o?void 0:o.length)>0||f?l.createElement("div",null,l.createElement("div",{className:"filter-label"},v("ES_INBOX_LOCALITY")),l.createElement(t.Localities,{selectLocality:e=>{c(S?{locality:[e]}:{locality:[...null==s?void 0:s.locality,e]})},tenantId:y,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==s?void 0:s.locality.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:e.i18nkey,onClick:()=>{c({locality:null==s?void 0:s.locality.filter(t=>t.code!==e.code)})}})))):null,l.createElement("div",null,h&&N&&null!=m&&null!==(r=m.applications)&&void 0!==r&&r.statuses?l.createElement(Ve,{onAssignmentChange:(e,t)=>{c(e.target.checked?{applicationStatus:[...null==s?void 0:s.applicationStatus,t]}:{applicationStatus:null==s?void 0:s.applicationStatus.filter(e=>t.name!==e.name)})},fsmfilters:s,mergedRoleDetails:N,statusMap:null==m||null===(u=m.applications)||void 0===u?void 0:u.statuses}):E.pathname.includes("fstp-fsm-request")?"":l.createElement(t.Loader,null)))),"mobile"===m.type&&m.onClose&&l.createElement(t.ActionBar,null,l.createElement(t.ApplyFilterBar,{submit:!1,labelLink:v("ES_COMMON_CLEAR_ALL"),buttonLink:v("ES_COMMON_FILTER"),onClear:A,onSubmit:()=>{"mobile"===m.type?p({delete:["applicationNos"]}):p()},style:{flex:1}})))},Ye=e=>{let{onAssignmentChange:n,value:i,applicationStatuses:a,areApplicationStatus:o}=e;return o?l.createElement(t.Dropdown,{option:a,optionKey:"name",selected:i,select:n}):l.createElement(t.Loader,null)},Ge=e=>{let{onSearch:a,type:r,onClose:u,searchFields:d,searchParams:c,isInboxPage:p}=e;const m=p?Digit.SessionStorage.get("fsm/inbox/searchParams"):Digit.SessionStorage.get("fsm/search/searchParams"),{data:v,isFetched:E}=Digit.Hooks.fsm.useApplicationStatus(),{t:_}=i.useTranslation(),{register:S,handleSubmit:f,reset:y,watch:T,control:g}=o.useForm({defaultValues:m||c}),[h,I]=n.useState(!1),C=innerWidth<=640,N=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,A=T(["applicationNos","mobileNumber","fromDate","toDate"]),[D,O]=n.useState(!1);function L(){const e=d.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});y(e),p?Digit.SessionStorage.del("fsm/inbox/searchParams"):Digit.SessionStorage.del("fsm/search/searchParams"),a({})}const P=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:L},_("ES_COMMON_CLEAR_SEARCH")),b=e=>N?null:(I(!(A.applicationNos||A.mobileNumber||A.fromDate&&A.toDate)),!!(A.applicationNos||A.mobileNumber||A.fromDate&&A.toDate)),R=window.location.href.includes("employee/fsm/inbox")||window.location.href.includes("employee/fsm/fstp-inbox")||window.location.href.includes("employee/fsm/fstp-fsm-request");return l.createElement("form",{onSubmit:f(e=>{e.mobileNumber||delete e.mobileNumber,a(e),"mobile"===r&&u()})},l.createElement(l.Fragment,null,R?"":l.createElement(t.Header,{styles:C?{marginTop:"10px"}:{}},_("ACTION_TEST_SEARCH_FSM_APPLICATION")),l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:N?"":p?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||C)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,_("ES_COMMON_SEARCH_BY")),l.createElement("span",{style:{position:"absolute",top:"2%",right:"8px"},onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:N?"complaint-input-container for-pt for-search":"complaint-input-container",style:{width:"100%"}},null==d?void 0:d.map((e,n)=>l.createElement("span",{key:n,className:0===n?"complaint-input":"mobile-input"},l.createElement(t.Label,null,e.label," ",e.labelChildren&&e.labelChildren),(e=>{switch(e.type){case"date":return l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange}),name:e.name,control:g,defaultValue:null});case"status":return l.createElement(o.Controller,{render:e=>l.createElement(Ye,{onAssignmentChange:e.onChange,value:e.value,applicationStatuses:v,areApplicationStatus:E}),name:e.name,control:g,defaultValue:null});default:return l.createElement(t.TextInput,s({},e,{inputRef:S},S(e.name,{validate:b}),{watch:T,shouldUpdate:!0}))}})(e)," ")),"desktop"===r&&!C&&l.createElement(t.SubmitBar,{className:"submit-bar-search",label:_("ES_COMMON_SEARCH"),submit:!0})),h?l.createElement(t.CardLabelError,{className:"search-error-label"},_("ES_SEARCH_APPLICATION_ERROR")):null,"desktop"===r&&!C&&l.createElement("span",{className:"clear-search"},P()))),("mobile"===r||C)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},P(C)),l.createElement(t.SubmitBar,{label:_("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},We=e=>{var n,o,r,u;const{t:s}=i.useTranslation(),d=Digit.UserService.hasAccess(["FSM_DSO"])||!1,c=e=>l.createElement("span",{className:"cell-text"},e),p=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,m=l.useMemo(()=>{if(e.isSearch)return[{Header:s("ES_INBOX_APPLICATION_NO"),accessor:"applicationNo",disableSortBy:!0,Cell:t=>{let{row:n}=t;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:`${e.parentRoute}/${d?"dso-application-details":"application-details"}/`+n.original.applicationNo},n.original.applicationNo)))}},{Header:s("ES_APPLICATION_DETAILS_APPLICANT_NAME"),disableSortBy:!0,accessor:e=>{var t;return c((null===(t=e.citizen)||void 0===t?void 0:t.name)||"")}},{Header:s("ES_APPLICATION_DETAILS_APPLICANT_MOBILE_NO"),disableSortBy:!0,accessor:e=>{var t;return c((null===(t=e.citizen)||void 0===t?void 0:t.mobileNumber)||"")}},{Header:s("ES_APPLICATION_DETAILS_PROPERTY_TYPE"),accessor:e=>s("PROPERTYTYPE_MASTERS_"+e.propertyUsage.split(".")[0]),disableSortBy:!0},{Header:s("ES_APPLICATION_DETAILS_PROPERTY_SUB-TYPE"),accessor:e=>s("PROPERTYTYPE_MASTERS_"+e.propertyUsage),disableSortBy:!0},{Header:s("ES_INBOX_LOCALITY"),accessor:e=>c(s(Digit.Utils.locale.getRevenueLocalityCode(e.address.locality.code,e.tenantId))),disableSortBy:!0},{Header:s("ES_INBOX_STATUS"),accessor:e=>c(s("CS_COMMON_FSM_"+e.applicationStatus)),disableSortBy:!0}];switch(e.userRole){case"FSM_EMP_FSTPO_REQUEST":return[{Header:s("ES_INBOX_APPLICATION_NO"),accessor:"applicationNo",Cell:t=>{var n;let{row:i}=t,o=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>i.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/fstp-operator-details/"+i.original.applicationNo}," ",null==o?void 0:o.applicationNo)))}},{Header:s("CS_COMMON_CITIZEN_NAME"),disableSortBy:!0,Cell:t=>{var n,i;let{row:a}=t,o=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>a.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",null,null==o||null===(i=o.citizen)||void 0===i?void 0:i.name))}},{Header:s("CS_COMMON_CITIZEN_NUMBER"),disableSortBy:!0,accessor:"number",Cell:t=>{var n,i;let{row:a}=t,o=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>a.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",null,null==o||null===(i=o.citizen)||void 0===i?void 0:i.mobileNumber))}},{Header:s("ES_INBOX_LOCALITY"),disableSortBy:!0,accessor:"locality",Cell:t=>{var n,i,a;let{row:o}=t,r=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>o.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",null,s(""+(null==r||null===(i=r.address)||void 0===i||null===(a=i.locality)||void 0===a?void 0:a.name))))}}];case"FSM_EMP_FSTPO":return[{Header:s("ES_INBOX_APPLICATION_NO"),disableSortBy:!0,accessor:"tripDetails",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/fstp-operator-details/"+t.original.applicationNo},t.original.tripDetails.map(e=>l.createElement("div",null,e.referenceNo,l.createElement("br",null))))))}},{Header:s("ES_INBOX_VEHICLE_LOG"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/fstp-operator-details/"+t.original.applicationNo},t.original.applicationNo)))}},{Header:s("ES_INBOX_APPLICATION_DATE"),accessor:"createdTime",Cell:e=>{let{row:t}=e;return c(`${new Date(t.original.auditDetails.createdTime).getDate()}/${new Date(t.original.auditDetails.createdTime).getMonth()+1}/${new Date(t.original.auditDetails.createdTime).getFullYear()}`)}},{Header:s("ES_INBOX_VEHICLE_NO"),disableSortBy:!0,accessor:e=>{var t;return null===(t=e.vehicle)||void 0===t?void 0:t.registrationNumber}},{Header:s("ES_INBOX_DSO_NAME"),disableSortBy:!0,accessor:e=>e.dsoName?`${e.dsoName} - ${e.tripOwner.name}`:""+e.tripOwner.name},{Header:s("ES_INBOX_VEHICLE_STATUS"),disableSortBy:!0,accessor:e=>e.status},{Header:s("ES_INBOX_WASTE_COLLECTED"),disableSortBy:!0,accessor:e=>{var t;return null===(t=e.tripDetails[0])||void 0===t?void 0:t.volume}}];default:return[{Header:s("CS_FILE_DESLUDGING_APPLICATION_NO"),Cell:t=>{let{row:n}=t;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:`${e.parentRoute}/${d?"dso-application-details":"application-details"}/`+n.original.applicationNo},n.original.applicationNo)))}},{Header:s("ES_INBOX_APPLICATION_DATE"),accessor:"createdTime",Cell:e=>{let{row:t}=e;return c(`${t.original.createdTime.getDate()}/${t.original.createdTime.getMonth()+1}/${t.original.createdTime.getFullYear()}`)}},{Header:s("ES_INBOX_LOCALITY"),Cell:e=>{let{row:t}=e;return c(s(Digit.Utils.locale.getRevenueLocalityCode(t.original.locality,t.original.tenantId)))}},{Header:s("ES_INBOX_STATUS"),Cell:e=>c(s("CS_COMMON_FSM_"+e.row.original.status))},{Header:s("ES_INBOX_SLA_DAYS_REMAINING"),Cell:e=>{let{row:t}=e;return"-"===(n=t.original.sla)?l.createElement("span",{className:"sla-cell-success"},"-"):isNaN(n)?l.createElement("span",{className:"sla-cell-success"},"0"):l.createElement("span",n<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},n);var n}}]}},[e.fstprequest,e.data]);let v;return e.isLoading?v=l.createElement(t.Loader,null):e.isSearch&&!e.shouldSearch||0===(null==e||null===(n=e.data)||void 0===n||null===(o=n.table)||void 0===o?void 0:o.length)?v=l.createElement(t.Card,{style:{marginTop:20}},s("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):(null==e||null===(r=e.data)||void 0===r||null===(u=r.table)||void 0===u?void 0:u.length)>0&&(v=l.createElement(xe,{t:s,data:e.data.table,columns:m,getCellProps:e=>({style:{minWidth:e.column.Header===s("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:e.onPageSizeChange,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,pageSizeLimit:e.pageSizeLimit,onSort:e.onSort,disableSort:e.disableSort,sortParams:e.sortParams,totalRecords:e.totalRecords,isPaginationRequired:e.isPaginationRequired})),l.createElement("div",{className:"inbox-container"},"FSM_EMP_FSTPO"!==e.userRole&&!e.isSearch&&l.createElement("div",{className:"filters-container"},"FSM_EMP_FSTPO_REQUEST"!==e.userRole?l.createElement(Fe,{parentRoute:e.parentRoute}):null,l.createElement("div",{style:"FSM_EMP_FSTPO_REQUEST"!==e.userRole?{marginTop:"24px"}:{}},l.createElement(Ue,{searchParams:e.searchParams,paginationParms:e.paginationParms,applications:e.data,onFilterChange:e.onFilterChange,type:"desktop"}))),l.createElement("div",{style:{flex:1,marginLeft:"24px"}},l.createElement(Ge,{onSearch:e.onSearch,type:"desktop",searchFields:e.searchFields,isInboxPage:!(null!=e&&e.isSearch),searchParams:e.searchParams}),l.createElement("div",{className:"result",style:{marginLeft:p||null!=e&&e.isSearch?"":"24px",flex:1}},v)))},Ke=e=>{const{t:a}=i.useTranslation(),[o,r]=n.useState(()=>{var t,n;return null!==(t=e.sortParams)&&void 0!==t&&null!==(n=t[0])&&void 0!==n&&n.desc?{code:"DESC",name:a("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:a("ES_INBOX_DATE_LATEST_LAST")}});function u(){}return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},a("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:u},a("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:u},a("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement(t.RadioButtons,{onSelect:function(t){e.onSort([{id:"createdTime",desc:"DESC"===t.code}]),e.onClose()},selectedOption:o,optionsKey:"name",options:[{code:"DESC",name:a("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:a("ES_INBOX_DATE_LATEST_LAST")}]})))))},ze=e=>{var i;let{t:a,data:o,onFilterChange:r,onSearch:u,onSort:s,serviceRequestIdKey:d,isFstpOperator:c,isLoading:p,isSearch:m,searchParams:v,searchFields:E,sortParams:_,linkPrefix:S,removeParam:f,filterData:y}=e;const[T,g]=n.useState(m?"SEARCH":""),[h,I]=n.useState(!!m),[C,N]=n.useState(v),[A,D]=n.useState(_),O=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:L,isFetched:P}=Digit.Hooks.fsm.useMDMS(O,"DIGIT-UI","RoleStatusMapping"),b=Digit.UserService.getUser().info.roles.map(e=>e.code),R=null==L?void 0:L.filter(e=>b.filter(t=>t===e.userRole)[0]),M=null==R?void 0:R.reduce((e,t)=>({fixed:(null==t?void 0:t.fixed)&&(null==e?void 0:e.fixed),statuses:[...null==e?void 0:e.statuses,...null==t?void 0:t.statuses].filter((e,t,n)=>n.indexOf(e)==t),zeroCheck:(null==t?void 0:t.zeroCheck)||(null==e?void 0:e.zeroCheck)}),{statuses:[]});n.useEffect(()=>{T&&I(!0)},[T]);const k=Digit.UserService.hasAccess(["FSM_DSO"])||!1,w=()=>{I(!1),g(""),N(v),D(_)};if(p||!P)return l.createElement(t.Loader,null);let F;return o&&0!==(null==o?void 0:o.length)?o&&(null==o?void 0:o.length)>0&&(F=l.createElement(t.DetailsCard,{data:o,serviceRequestIdKey:d,linkPrefix:S||(k?"/digit-ui/employee/fsm/application-details/":"/digit-ui/employee/fsm/")})):F=l.createElement(t.Card,{style:{marginTop:20}},a("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{g("SEARCH"),I(!0)}}),!m&&r&&(!k&&!c&&v||(null==M||null===(i=M.statuses)||void 0===i?void 0:i.length)>0)&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{g("FILTER"),I(!0)}}),!m&&l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{g("SORT"),I(!0)}})),F,h&&l.createElement(t.PopUp,null,"FILTER"===T&&l.createElement("div",{className:"popup-module"},l.createElement(Ue,{onFilterChange:e=>{N(t=>({...t,...e}))},onClose:w,onSearch:e=>{r({...C,...e}),g(""),I(!1)},applications:y,type:"mobile",searchParams:C,removeParam:f})),"SORT"===T&&l.createElement("div",{className:"popup-module"},l.createElement(Ke,{type:"mobile",sortParams:_,onClose:w,onSort:s})),"SEARCH"===T&&l.createElement("div",{className:"popup-module"},l.createElement(Ge,{type:"mobile",onClose:w,onSearch:u,isFstpOperator:c,searchParams:v,searchFields:E}))))},je=e=>l.createElement("span",{className:"sla-cell"},e),Xe=e=>{let{data:t,vehicleLog:n,isLoading:a,isSearch:o,onSearch:r,onFilterChange:u,onSort:s,searchParams:d,searchFields:c,linkPrefix:p,removeParam:m,sortParams:v,fstprequest:E,isFSMRequest:_}=e;const{t:S}=i.useTranslation(),f=(Digit.UserService.hasAccess(["FSM_DSO"]),Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1),y=null==n?void 0:n.map(e=>{var t,n;return{[S("ES_INBOX_APPLICATION_NO")]:null==e?void 0:e.tripDetails.map(e=>e.referenceNo),[S("ES_INBOX_VEHICLE_LOG")]:null==e?void 0:e.applicationNo,[S("ES_INBOX_VEHICLE_NO")]:null==e||null===(t=e.vehicle)||void 0===t?void 0:t.registrationNumber,[S("ES_INBOX_DSO_NAME")]:null==e?void 0:e.tripOwner.displayName,[S("ES_INBOX_VEHICLE_STATUS")]:null==e?void 0:e.status,[S("ES_INBOX_WASTE_COLLECTED")]:null==e||null===(n=e.tripDetails[0])||void 0===n?void 0:n.volume}}),T=null==E?void 0:E.map(e=>{var t,l,i,a;let o=null==n?void 0:n.find(t=>{var n;return(null==t||null===(n=t.tripDetails[0])||void 0===n?void 0:n.referenceNo)===(null==e?void 0:e.applicationNo)});return{[S("ES_INBOX_VEHICLE_LOG")]:(null==o?void 0:o.applicationNo)||"N/A",[S("CS_COMMON_CITIZEN_NAME")]:(null==e||null===(t=e.citizen)||void 0===t?void 0:t.name)||"N/A",[S("CS_COMMON_CITIZEN_NUMBER")]:(null==e||null===(l=e.citizen)||void 0===l?void 0:l.mobileNumber)||"N/A",[S("ES_INBOX_LOCALITY")]:(null==e||null===(i=e.address)||void 0===i||null===(a=i.locality)||void 0===a?void 0:a.name)||"N/A"}});return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement("div",{style:{display:"none"}},!o&&l.createElement(Ue,{searchParams:d,applications:t,onFilterChange:u,type:"mobile"})),l.createElement(ze,{t:S,filterData:t,data:t?o?null==t||null===(g=t.table)||void 0===g?void 0:g.map(e=>{let{applicationNo:t,applicationStatus:n,propertyUsage:l,tenantId:i,address:a,citizen:o}=e;return{[S("ES_INBOX_APPLICATION_NO")]:t,[S("ES_APPLICATION_DETAILS_APPLICANT_NAME")]:je((null==o?void 0:o.name)||""),[S("ES_APPLICATION_DETAILS_APPLICANT_MOBILE_NO")]:je((null==o?void 0:o.mobileNumber)||""),[S("ES_APPLICATION_DETAILS_PROPERTY_TYPE")]:je(S("PROPERTYTYPE_MASTERS_"+l.split(".")[0])),[S("ES_APPLICATION_DETAILS_PROPERTY_SUB-TYPE")]:je(S("PROPERTYTYPE_MASTERS_"+l)),[S("ES_INBOX_LOCALITY")]:je(S(Digit.Utils.locale.getRevenueLocalityCode(a.locality.code,i))),[S("ES_INBOX_STATUS")]:je(S("CS_COMMON_FSM_"+n))}}):null==t||null===(h=t.table)||void 0===h?void 0:h.map(e=>{let{locality:t,applicationNo:n,createdTime:i,tenantId:a,status:o,sla:r}=e;return{[S("ES_INBOX_APPLICATION_NO")]:n,[S("ES_INBOX_APPLICATION_DATE")]:`${i.getDate()}/${i.getMonth()+1}/${i.getFullYear()}`,[S("ES_INBOX_LOCALITY")]:je(S(Digit.Utils.locale.getRevenueLocalityCode(t,a))),[S("ES_INBOX_STATUS")]:je(S("CS_COMMON_"+o)),[S("ES_INBOX_SLA_DAYS_REMAINING")]:(u=r,isNaN(u)?l.createElement("span",{className:"sla-cell-success"},"0"):l.createElement("span",u<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},u))};var u}):f&&_?T:y,onFilterChange:!(!_&&f)&&u,serviceRequestIdKey:S(f?"ES_INBOX_VEHICLE_LOG":"ES_INBOX_APPLICATION_NO"),isFstpOperator:f,isLoading:a,isSearch:o,onSearch:r,onSort:s,searchParams:d,searchFields:c,linkPrefix:p,removeParam:m,sortParams:v}))));var g,h},$e={select:e=>({totalCount:null==e?void 0:e.totalCount,vehicleLog:null==e?void 0:e.vehicleTrip.map(e=>{const t=e.tripOwner,n=t.name+(t.userName?"- "+t.userName:""),l={...t,displayName:n};return{...e,tripOwner:l}})})},qe=()=>{var e,o,r;const u=a.useHistory(),{t:s}=i.useTranslation(),d=a.useLocation().pathname.split("/").at(-1),c=Digit.ULBService.getCurrentTenantId(),[p,m]=n.useState({applicationStatus:"WAITING_FOR_DISPOSAL"}),[v,E]=n.useState(null),[_,S]=n.useState(),[f,y]=n.useState([{id:"applicationNo",desc:!0}]),[T,g]=n.useState(0),[h,I]=n.useState(100),[C,N]=n.useState(!1),[A,D]=n.useState(null);Digit.UserService.getUser();let O=window.Digit.Utils.browser.isMobile();const{isLoading:L,data:P}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:c,filters:{registrationNumber:d},config:{enabled:(null==d?void 0:d.length)>0}});let b={businessService:"FSM_VEHICLE_TRIP",vehicleIds:void 0!==P&&(null==P||null===(e=P.vehicle[0])||void 0===e?void 0:e.id.length)>0&&(null==P||null===(o=P.vehicle[0])||void 0===o?void 0:o.id)||"null",applicationStatus:null==p?void 0:p.applicationStatus,sortOrder:!1===(null===(r=f[0])||void 0===r?void 0:r.desc)?"ASC":"DESC"};const{isLoading:R,data:{totalCount:M,vehicleLog:k}={},isSuccess:w}=Digit.Hooks.fsm.useVehicleSearch({tenantId:c,filters:b,config:$e,options:{searchWithDSO:!0}}),{isLoading:F,isIdle:x,data:{data:{table:H}={}}={}}=Digit.Hooks.fsm.useSearchAll(c,v,null,{enabled:!!C});n.useEffect(()=>{var e;const t=null==k?void 0:k.map(e=>{var t;return null==e||null===(t=e.tripDetails[0])||void 0===t?void 0:t.referenceNo}).join(",");E({applicationNos:t||"null",sortOrder:!1===(null===(e=f[0])||void 0===e?void 0:e.desc)?"ASC":"DESC"}),N(!0)},[w,F,L,k,x,R,f,P]),n.useEffect(()=>{H&&D(H)},[H,F,x]),null==k||k.map(e=>{});const V=function(e){var t,n,l;void 0===e&&(e={});const i=(null===(t=e)||void 0===t||null===(n=t.applicationNos)||void 0===n?void 0:n.length)>0?null===(l=e)||void 0===l?void 0:l.applicationNos:null;let a=H.filter(i?e=>e.applicationNo===i:e=>e.applicationNo);D(a)},B=e=>{let t=H.filter(t=>{var n,l,i,a,o;return null==t||null===(n=t.address)||void 0===n||null===(l=n.locality)||void 0===l?void 0:l.name.includes(null!=e&&null!==(i=e.locality)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&a.name?null==e||null===(o=e.locality)||void 0===o?void 0:o[0].name:"")});D(t),S(e)},U=[{label:s("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"}],Y=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&y(e)},[]);if(R&&!w&&F&&L&&!x&&!C)return l.createElement(t.Loader,null);0!==(null==k?void 0:k.length)||0!==(null==H?void 0:H.length)||!w||F||0!==(null==A?void 0:A.length)||L||u.push("/digit-ui/employee/fsm/fstp/new-vehicle-entry/"+d);let G=[];return null==A||A.map(e=>{const t=null==k?void 0:k.find(t=>{var n;return(null==t||null===(n=t.tripDetails[0])||void 0===n?void 0:n.referenceNo)===(null==e?void 0:e.applicationNo)});void 0!==t&&G.push(t)}),O?l.createElement("div",null,l.createElement(t.Header,null,s("ES_FSM_FSTP_SERVICE_REQUEST")),l.createElement(Xe,{onFilterChange:B,vehicleLog:k,fstprequest:A,isFSMRequest:!0,isLoading:R,userRole:"FSM_EMP_FSTPO",linkPrefix:"/digit-ui/employee/fsm/fstp-operator-details/",onSearch:V,searchFields:U,onSort:Y,sortParams:f}),l.createElement("span",{className:"link",style:{margin:"8px"}},l.createElement(a.Link,{to:{pathname:"/digit-ui/employee/fsm/fstp/new-vehicle-entry/"}},s("ES_FSM_FSTP_NEW_ENTRY")))):l.createElement("div",null,l.createElement(t.Header,null,s("ES_FSM_FSTP_SERVICE_REQUEST")),l.createElement(We,{data:{table:G},fstprequest:H,isLoading:R,onSort:Y,isFSMRequest:!0,disableSort:!1,sortParams:f,userRole:"FSM_EMP_FSTPO_REQUEST",onFilterChange:B,searchFields:U,onSearch:V,onNextPage:()=>{g(e=>e+h)},onPrevPage:()=>{g(e=>e-h)},currentPage:Math.floor(T/h),pageSizeLimit:h,onPageSizeChange:e=>{I(Number(e.target.value))},totalRecords:M||0,isPaginationRequired:!1,searchParams:_}),l.createElement("span",{className:"link",style:{margin:"294px",padding:"2px"}},l.createElement(a.Link,{to:{pathname:"/digit-ui/employee/fsm/fstp/new-vehicle-entry/"}},s("ES_FSM_FSTP_NEW_ENTRY"))))},Ze=e=>{let{path:o,url:r,userType:u}=e;const{t:d}=i.useTranslation(),c=a.useLocation();n.useEffect(()=>{var e,t,n;null!=c&&null!==(e=c.pathname)&&void 0!==e&&e.includes("application-details")||(null!=c&&null!==(t=c.pathname)&&void 0!==t&&t.includes("inbox")?null!=c&&null!==(n=c.pathname)&&void 0!==n&&n.includes("search")||Digit.SessionStorage.del("fsm/search/searchParams"):Digit.SessionStorage.del("fsm/inbox/searchParams"))},[c]);const p=Digit.ComponentRegistryService.getComponent("FSMEmpInbox"),m=Digit.ComponentRegistryService.getComponent("FSMFstpInbox"),v=Digit.ComponentRegistryService.getComponent("FSMNewApplicationEmp"),E=Digit.ComponentRegistryService.getComponent("FSMEditApplication"),_=Digit.ComponentRegistryService.getComponent("FSMEmployeeApplicationDetails"),S=Digit.ComponentRegistryService.getComponent("FSMFstpOperatorDetails"),f=Digit.ComponentRegistryService.getComponent("FSMResponse"),y=Digit.ComponentRegistryService.getComponent("FSMApplicationAudit"),T=Digit.ComponentRegistryService.getComponent("FSMRateView"),g=Digit.ComponentRegistryService.getComponent("FSMLinks"),h=Digit.ComponentRegistryService.getComponent("FSMRegistry"),I=Digit.ComponentRegistryService.getComponent("VendorDetails"),C=Digit.ComponentRegistryService.getComponent("AddVendor"),N=Digit.ComponentRegistryService.getComponent("EditVendor"),A=Digit.ComponentRegistryService.getComponent("VehicleDetails"),D=Digit.ComponentRegistryService.getComponent("AddVehicle"),O=Digit.ComponentRegistryService.getComponent("EditVehicle"),L=Digit.ComponentRegistryService.getComponent("DriverDetails"),P=Digit.ComponentRegistryService.getComponent("AddDriver"),b=Digit.ComponentRegistryService.getComponent("EditDriver");return l.createElement(a.Switch,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(t.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(t.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=c.pathname;let n=[{icon:t.HomeIcon,path:"/digit-ui/employee"},{label:d("TITLE_FSM"),path:"/digit-ui/employee/fsm/inbox"}];return e.includes("/registry/new-vendor")?n.push({label:d("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")}):e.includes("/search-vendor")?n.push({label:d("SEARCH_VENDOR")}):e.includes("/registry/new-driver")?n.push({label:d("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")}):e.includes("/registry/vendor-details")||e.includes("/registry/modify-vendor/")?n.push({label:d("VENDOR_VENDOR_DETAILS")}):e.includes("/registry/vehicle-details")||e.includes("/registry/modify-vehicle/")?n.push({label:d("VENDOR_VEHICLE_DETAILS")}):e.includes("/registry/new-vehicle")?n.push({label:d("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")}):e.includes("/registry/driver-details")||e.includes("/registry/modify-driver/")?n.push({label:d("VENDOR_DRIVER_DETAILS")}):e.includes("/registry/additionaldetails")?n.push({label:d("VENDOR_ADDITIONAL_DETAILS")}):e.includes("/registry/modify-vendor/:id")&&n.push({label:d("ES_TITLE_VENDOR_EDIT")}),n})()}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(g,{matchPath:o,userType:u}))}),l.createElement(t.PrivateRoute,{path:o+"/inbox",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(p,s({},e,{parentRoute:o,isInbox:!0})))}),l.createElement(t.PrivateRoute,{path:o+"/fstp-inbox",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(m,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/new-application",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(v,{parentUrl:r}))}),l.createElement(t.PrivateRoute,{path:o+"/modify-application/:id",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(E,null))}),l.createElement(t.PrivateRoute,{path:o+"/application-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(_,s({},e,{parentRoute:o,userType:"EMPLOYEE"})))}),l.createElement(t.PrivateRoute,{path:o+"/fstp-operator-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(S,e))}),l.createElement(t.PrivateRoute,{path:o+"/response",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(f,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/application-audit/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(y,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/search",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(p,s({},e,{parentRoute:o,isSearch:!0})))}),l.createElement(t.PrivateRoute,{path:o+"/rate-view/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(T,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/mark-for-disposal",component:()=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement("div",null))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/registry",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(h,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/vendor-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(I,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/new-vendor",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(C,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/modify-vendor/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(N,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/vehicle-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(A,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/new-vehicle",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(D,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/modify-vehicle/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(O,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/driver-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(L,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/new-driver",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(P,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/modify-driver/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(b,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp-operations",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(we,null))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp-add-vehicle",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(ke,null))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp-fsm-request/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(qe,e))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp/new-vehicle-entry",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(S,e))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp/new-vehicle-entry/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(S,e))}))))};function Qe(e,t,n){return null==e?void 0:e.filter(e=>{var t;return null===(t=e.vehicles)||void 0===t?void 0:t.find(e=>(null==e?void 0:e.capacity)==n)})}function Je(e,t,n){return null==e?void 0:e.filter(e=>{var t;return null===(t=e.vehicles)||void 0===t?void 0:t.find(e=>(null==e?void 0:e.capacity)==n)})}const et=e=>{let{t:n,rejectMenu:i,setReason:a,reason:o,action:r}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+r,submit:"CS_COMMON_"+r,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n(`ES_FSM_ACTION_${r.toUpperCase()}_REASON`),type:"dropdown",populators:l.createElement(t.Dropdown,{t:n,option:null==i?void 0:i.sort((e,t)=>e.name.localeCompare(t.name)),id:"reason",optionKey:"i18nKey",selected:o,select:a}),isMandatory:!0},{label:n("ES_FSM_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}},tt=(e,t)=>{let n=(null==e?void 0:e.defaultValues)||1;return l.createElement(l.Fragment,null,l.createElement("div",{className:"PlusMinus"},l.createElement("button",{type:"button",onClick:()=>{n>1?(n-=1,e.onSelect(n)):(n=1,e.onSelect(n))},className:"PlusMinusbutton"},"-"),l.createElement("input",{readOnly:!0,value:n,style:{textAlign:"center",border:"1px solid #505A5F"}}),l.createElement("button",{type:"button",onClick:()=>{n>=1?(n+=1,e.onSelect(n)):(n=1,e.onSelect(n))},className:"PlusMinusbutton"},"+")))},nt=e=>l.createElement("h1",{className:"heading-m"},e.label),lt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),it=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(lt,null)),at={boxShadow:"0 -2px 8px rgb(0 0 0 / 16%)",maxWidth:"480px",zIndex:"100",left:"0",bottom:"0",width:"100%",backgroundColor:"rgba(255, 255, 255)",padding:"8px",position:"fixed",textAlign:"right",display:"flex",justifyContent:"space-around"},ot=e=>{var i,a,o;let{t:u,action:d,tenantId:c,id:p,closeModal:m,submitAction:v,actionData:E,module:_}=e;const S=!!Digit.Utils.browser.isMobile(),{data:f,isLoading:y,isSuccess:T}=Digit.Hooks.fsm.useDsoSearch(c,{limit:"-1",status:"ACTIVE"}),{isSuccess:g,data:h}=Digit.Hooks.fsm.useSearch(c,{applicationNos:p},{staleTime:Infinity,select:e=>{let{additionalDetails:t}=e;const n=e=>"object"==typeof e?e:n(JSON.parse(e));return t=n(t),{...e,additionalDetails:t}}}),I=(r.useQueryClient(),Digit.ULBService.getStateId()),{data:C,isSuccess:N}=Digit.Hooks.fsm.useMDMS(I,"Vehicle","VehicleType",{staleTime:Infinity}),{data:A,isSuccess:D}=Digit.Hooks.fsm.useMDMS(I,"FSM","PropertyType",{staleTime:Infinity}),{data:O,isSuccess:L}=Digit.Hooks.fsm.useMDMS(I,"FSM","PropertySubtype",{staleTime:Infinity}),{data:P,isSuccess:b}=Digit.Hooks.fsm.useMDMS(I,"FSM","PitType",{staleTime:Infinity}),{data:R,isLoading:M}=Digit.Hooks.fsm.useMDMS(I,"FSM","Reason",{staleTime:Infinity},["ReassignReason","RejectionReason","DeclineReason","CancelReason"]),{data:k}=Digit.Hooks.fsm.useMDMS(I,"Vehicle","FSTPORejectionReason",{staleTime:Infinity}),[w,F]=n.useState([]),[x,H]=n.useState([]),[V,B]=n.useState({}),[U,Y]=n.useState(null),[G,W]=n.useState(null),[K,z]=n.useState([]),[j,X]=n.useState(null),[$,q]=n.useState(null),[Z,Q]=n.useState(null),[J,ee]=n.useState(null),[te,ne]=n.useState(null),[le,ie]=n.useState(!1),[ae,oe]=n.useState(null),[re,ue]=n.useState([]),[se,de]=n.useState(null),[ce,pe]=n.useState(null),[me,ve]=n.useState(null),[Ee,_e]=n.useState(),[Se,fe]=n.useState(),[ye,Te]=n.useState(),[ge,he]=n.useState(null),[Ie,Ce]=n.useState({capacity:null==j?void 0:j.capacity,wasteCollected:null==j?void 0:j.capacity,propertyType:null==h?void 0:h.propertyUsage.split(".")[0],subtype:null==h?void 0:h.propertyUsage,pitType:null==h?void 0:h.sanitationtype,pitDetail:null==h?void 0:h.pitDetail,propertyID:null==h||null===(i=h.additionalDetails)||void 0===i?void 0:i.propertyID,roadWidth:null==h||null===(a=h.additionalDetails)||void 0===a?void 0:a.roadWidth,distancefromroad:null==h||null===(o=h.additionalDetails)||void 0===o?void 0:o.distancefromroad});function Ne(e){Y(e)}function Ae(e){W(e)}function De(e){X(e),Ce({capacity:null==e?void 0:e.capacity,wasteCollected:null==e?void 0:e.capacity})}function Oe(e){Te(e)}function Le(e,t,n){t.comments=n.comments?e.code+"~"+n.comments:e.code}return n.useEffect(()=>{if(g&&N&&h){const[e]=C.filter(e=>e.code===h.vehicleType);let t=Ie;t.capacity=null==h?void 0:h.vehicleCapacity,t.wasteCollected=null==h?void 0:h.vehicleCapacity,z([e]),X(e),Ce(t)}},[N,g]),n.useEffect(()=>{if(g&&D&&h){const[e]=A.filter(e=>e.code===h.propertyUsage.split(".")[0]);let t=Ie;t.propertyType=e,ue([e]),oe(e),Ce(t)}},[D,g]),n.useEffect(()=>{if(g&&L&&h){const[e]=O.filter(e=>e.code===h.propertyUsage);let t=Ie;t.subtype=e,de(e),Ce(t)}},[L,g]),n.useEffect(()=>{if(g&&b&&h){const[e]=P.filter(e=>e.code===h.sanitationtype),t=h.pitDetail;let n=Ie;n.pitType=e,n.pitDetail=t,pe(e),fe(h.pitDetail),Ce(n)}},[b,g]),n.useEffect(()=>{if(j&&T){const e=f.filter(e=>{var t;return null==e||null===(t=e.vehicles)||void 0===t?void 0:t.find(e=>e.type===j.code)});F(e)}},[j,T]),n.useEffect(()=>{if(g&&T&&h&&h.dsoId){var e;const[t]=f.filter(e=>e.id===h.dsoId),n=(null==t||null===(e=t.vehicles)||void 0===e?void 0:e.filter(e=>e.capacity==(null==h?void 0:h.vehicleCapacity))).sort((e,t)=>e.registrationNumber>t.registrationNumber?1:-1);H(n)}},[g,T]),n.useEffect(()=>{var e,t;$||E&&E[0]&&(null===(e=E[0].comment)||void 0===e?void 0:e.length)>0&&"DSO_REJECTED"===(null===(t=E[0])||void 0===t?void 0:t.status)?ie(!0):ie(!1)},[$]),n.useEffect(()=>{ie(!!Z)},[Z]),n.useEffect(()=>{ie(!!J)},[J]),n.useEffect(()=>{ie(!!te)},[te]),n.useEffect(()=>{var e,n,i,a,o;switch(d){case"UPDATE":case"SCHEDULE":case"ES_FSM_SCHEDULE":return ie(!0),B((e=>{let{t:t,noOfTrips:n,action:i}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+i,submit:"CS_COMMON_"+i,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:t("ES_FSM_ACTION_NUMBER_OF_TRIPS"),isMandatory:!0,type:"custom",populators:{name:"noOfTrips",error:t("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID"),validation:{required:!0},defaultValue:n,rules:{required:!0},customProps:{isMandatory:!0,optionsKey:"i18nKey",innerStyles:{minWidth:"33%"}},component:(e,t)=>l.createElement(tt,s({defaultValues:e.value},t,{onSelect:t=>{e.onChange(t)}}))}}]}]}})({t:u,noOfTrips:null==h?void 0:h.noOfTrips,action:d}));case"DSO_ACCEPT":case"ACCEPT":return ie(!!G),B((e=>{let{t:n,selectVehicleNo:i,vehicleNoList:a,vehicleNo:o,noOfTrips:r,action:u}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+u,submit:"CS_COMMON_"+u,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_VEHICLE_REGISTRATION_NO"),isMandatory:!0,type:"dropdown",populators:l.createElement(l.Fragment,null,null!=a&&a.length?null:l.createElement(t.CardLabelError,null,n("ES_FSM_NO_VEHICLE_AVAILABLE")),l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"registrationNumber",id:"vehicle",select:i,selected:o,disable:!((null==a?void 0:a.length)>0)}))},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),isMandatory:!0,type:"text",populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_NUMBER_OF_TRIPS"),isMandatory:!0,type:"text",populators:{name:"noOfTrips",validation:{required:!0},defaultValue:r},disable:!0}]}]}})({t:u,dsoData:f,dso:U,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,noOfTrips:null==h?void 0:h.noOfTrips,vehicleNo:G,vehicleNoList:x,selectVehicleNo:Ae,action:d}));case"ASSIGN":case"GENERATE_DEMAND":case"FSM_GENERATE_DEMAND":return ie(!!U),B((e=>{let{t:n,dsoData:i,dso:a,selectDSO:o,vehicleCapacity:r,action:u}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+u,submit:"CS_COMMON_"+u,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_DSO_NAME"),isMandatory:!0,type:"dropdown",populators:l.createElement(l.Fragment,null,Qe(i,0,r)&&!Qe(i,0,r).length?l.createElement(t.CardLabelError,null,n("ES_COMMON_NO_DSO_AVAILABLE_WITH_SUCH_VEHICLE")):null,l.createElement(t.Dropdown,{option:Qe(i,0,r),autoComplete:"off",optionKey:"displayName",id:"dso",selected:a,select:o,disable:!(!Qe(i,0,r)||Qe(i,0,r).length)}))},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),isMandatory:!0,type:"text",populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!0,type:"custom",populators:{name:"date",validation:{required:!0},customProps:{min:Digit.Utils.date.getDate(),max:Digit.Utils.date.getDate(Date.now()+864e6)},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}}]}]}})({t:u,dsoData:f,dso:U,selectDSO:Ne,vehicleMenu:K,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,selectVehicle:De,action:d}));case"REASSIGN":case"REASSING":case"FSM_REASSING":return U&&($||E&&E[0]&&(null===(e=E[0].comment)||void 0===e?void 0:e.length)>0&&"DSO_REJECTED"===(null===(n=E[0])||void 0===n?void 0:n.status))?ie(!0):ie(!1),B((e=>{let{t:n,dsoData:i,dso:a,selectDSO:o,vehicleCapacity:r,reassignReasonMenu:u,reassignReason:d,selectReassignReason:c,action:p,showReassignReason:m}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+p,submit:"CS_COMMON_"+p,cancel:"CS_COMMON_CLOSE"},form:[{body:[...m?[{label:n("ES_FSM_ACTION_REASSIGN_REASON"),type:"dropdown",isMandatory:!0,populators:l.createElement(t.Dropdown,{option:u,optionKey:"i18nKey",id:"reassign-reason",selected:d,select:c,t:n})}]:[],{label:n("ES_FSM_ACTION_DSO_NAME"),isMandatory:!0,type:"dropdown",populators:l.createElement(l.Fragment,null,Je(i,0,r)&&!Je(i,0,r).length?l.createElement(t.CardLabelError,null,n("ES_COMMON_NO_DSO_AVAILABLE_WITH_SUCH_VEHICLE")):null,l.createElement(t.Dropdown,{option:Je(i,0,r),autoComplete:"off",optionKey:"displayName",id:"dso",selected:a,select:o}))},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),type:"text",populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!0,type:"custom",populators:{name:"date",validation:{required:!0},customProps:{min:Digit.Utils.date.getDate()},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}}]}]}})({t:u,dsoData:f,dso:U,selectDSO:Ne,vehicleMenu:K,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,selectVehicle:De,reassignReasonMenu:null==R?void 0:R.ReassignReason,reassignReason:$,selectReassignReason:q,action:d,showReassignReason:!(E&&E[0]&&(null===(i=E[0].comment)||void 0===i?void 0:i.length)>0&&"DSO_REJECTED"===(null===(a=E[0])||void 0===a?void 0:a.status))}));case"COMPLETE":case"COMPLETED":return ie(!0),B((e=>{let{t:n,vehicleCapacity:i,noOfTrips:a,applicationCreatedTime:o=0,action:r}=e;return{label:{submit:"CS_COMMON_"+r,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_DESLUGED_DATE_LABEL"),isMandatory:!0,type:"custom",populators:{name:"desluged",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),customProps:{min:Digit.Utils.date.getDate(o),max:Digit.Utils.date.getDate()},component:(e,n)=>l.createElement(t.DatePicker,s({disabled:!0,onChange:e.onChange,date:e.value},n))}},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),type:"number",isMandatory:!0,populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_WASTE_VOLUME_LABEL"),type:"number",isMandatory:!0,populators:{name:"wasteCollected",validation:{required:!0,validate:e=>parseInt(e)<=parseInt(i)},error:`${n("ES_FSM_ACTION_INVALID_WASTE_VOLUME")} ${i} ${n("CS_COMMON_LITRES")}`}},{head:"",body:[{type:"component",route:"search-property",isMandatory:!0,component:"CPTSearchProperty",key:"cptsearchproperty",withoutLabel:!0,nextStep:"search-results",hideInEmployee:!0},{type:"component",route:"search-results",isMandatory:!0,component:"CPTSearchResults",key:"cptsearchresults",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"create-property",isMandatory:!0,component:"CPTCreateProperty",key:"cptcreateproperty",withoutLabel:!0,isSkipEnabled:!0,nextStep:"acknowledge-create-property",hideInEmployee:!0},{type:"component",route:"acknowledge-create-property",isMandatory:!0,component:"CPTAcknowledgement",key:"cptacknowledgement",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"property-details",isMandatory:!0,component:"CPTPropertyDetails",key:"propertydetails",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0}]},{head:"FSM_NEW_APPLICATION_PROPERTY",body:[{component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0}]},{label:n("ES_FSM_ACTION_ROAD_WIDTH"),type:"number",isMandatory:!0,populators:{name:"roadWidth",validation:{required:!0}},disable:!1},{label:n("ES_FSM_ACTION_DISTANCE_FROM_ROAD"),type:"number",isMandatory:!0,populators:{name:"distancefromroad",validation:{required:!0}},disable:!1},{label:"ES_NEW_APPLICATION_PROPERTY_TYPE",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",disable:!0,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",disable:!0,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!1,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_DIMENSION",isMandatory:!1,type:"component",route:"tank-size",key:"pitDetail",component:"SelectTankSize",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:null},{label:n("ES_NEW_APPLICATION_PAYMENT_NO_OF_TRIPS")+" *",type:"number",populators:{name:"noOfTrips",error:n("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID"),validation:{required:!0},defaultValue:a},disable:!0}]}]}})({t:u,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,noOfTrips:null==h?void 0:h.noOfTrips,applicationCreatedTime:null==h||null===(o=h.auditDetails)||void 0===o?void 0:o.createdTime,action:d,module:_}));case"SUBMIT":case"FSM_SUBMIT":return history.push("/digit-ui/employee/fsm/modify-application/"+applicationNumber);case"DECLINE":case"DSO_REJECT":return ie(!!J),B(et({t:u,rejectMenu:null==R?void 0:R.DeclineReason,setTrips:he,trips:null==h?void 0:h.noOfTrips,setReason:ee,action:d}));case"REJECT":case"SENDBACK":return ie(!!Z),B(et({t:u,rejectMenu:null==R?void 0:R.RejectionReason,setReason:Q,reason:Z,action:d}));case"CANCEL":return ie(!!te),B(et({t:u,rejectMenu:null==R?void 0:R.CancelReason,setReason:ne,reason:te,action:d}));case"PAY":case"ADDITIONAL_PAY_REQUEST":case"FSM_PAY":return history.push("/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/"+applicationNumber);case"DECLINEVEHICLE":return ie(!!ye),B((e=>{let{t:n,rejectMenu:i,selectReason:a,reason:o,action:r}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+r,submit:"CS_COMMON_"+r,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_DECLINE_REASON"),isMandatory:!0,type:"dropdown",populators:l.createElement(t.Dropdown,{option:null==i?void 0:i.sort((e,t)=>e.name.localeCompare(t.name)),autoComplete:"off",optionKey:"i18nKey",id:"Reason",select:a,selected:o,t:n})},"OTHERS"===(null==o?void 0:o.code)?{label:n("Comments"),isMandatory:!0,type:"text",populators:{name:"comments",validation:{required:!0}}}:{}]}]}})({t:u,rejectMenu:k,selectReason:Oe,reason:ye,action:d}))}},[d,$,y,U,K,Z,G,x,R,ye]),l.useRef(null),d&&V.form&&!y&&!M&&N?l.createElement(t.Modal,{popupStyles:S?{height:"fit-content",minHeight:"100vh"}:{height:"fit-content"},headerBarMain:l.createElement(nt,{label:u(V.label.heading)}),headerBarEnd:l.createElement(it,{onClick:m}),actionCancelLabel:u(V.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:u(V.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:!le,popupModuleMianStyles:S?{paddingBottom:"60px"}:{},popupModuleActionBarStyles:S?at:{}},l.createElement(t.FormComposer,{config:V.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){const t={action:d};U&&(h.dsoId=U.id),G&&"ACCEPT"===d&&(h.vehicleId=G.id),G&&"DSO_ACCEPT"===d&&(h.vehicleId=G.id),j&&"ASSIGN"===d&&(h.vehicleType=j.code),e.date&&(h.possibleServiceDate=new Date(""+e.date).getTime()),e.desluged&&(h.completedOn=new Date(e.desluged).getTime()),e.wasteCollected&&(h.wasteCollected=e.wasteCollected),e.pitDetail&&(h.pitDetail.height=Number(e.pitDetail.height)),e.pitDetail&&(h.pitDetail.width=Number(e.pitDetail.width)),e.pitDetail&&(h.pitDetail.diameter=Number(e.pitDetail.diameter)),e.pitDetail&&(h.pitDetail.length=Number(e.pitDetail.length)),e.pitType&&(h.sanitationtype=e.pitType.code),e.subtype&&"object"==typeof e.subtype&&(h.propertyUsage=e.subtype.code),e.subtype&&"string"==typeof e.subtype&&(h.propertyUsage=e.subtype),e.noOfTrips&&(h.noOfTrips=e.noOfTrips),Ee&&(h.pitDetail.additionalDetails&&h.pitDetail.additionalDetails.fileStoreId?h.pitDetail.additionalDetails.fileStoreId={...h.pitDetail.additionalDetails.fileStoreId,FSM_DSO:Ee}:h.pitDetail.additionalDetails={fileStoreId:{FSM_DSO:Ee}}),e.noOfTrips&&(h.noOfTrips=Number(e.noOfTrips)),"REASSING"===d&&(h.vehicleId=null),$&&Le($,t,e),Z&&Le(Z,t,e),J&&Le(J,t,e),te&&Le(te,t,e),ye&&e.comments&&(t.comments=e.comments),ye&&(t.fstpoRejectionReason=null==ye?void 0:ye.code),v({fsm:h,workflow:t})},formId:"modal-action",defaultValues:Ie}),"COMPLETED"===d?l.createElement(t.UploadPitPhoto,{header:"",tenantId:c,cardText:"",onPhotoChange:e=>{(!Ee||Ee.length<4)&&_e(e)},uploadedImages:null}):null):l.createElement(t.Loader,null)},rt=e=>{const[t,i]=n.useState(null),[a,o]=n.useState(e.fileStoreIds);n.useEffect(()=>{o(e.fileStoreIds)},[e.fileStoreIds]),n.useEffect(()=>{!function(){try{const e=function(){if(null!==a)return Promise.resolve(r()).then(function(){})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[a]);const r=n.useCallback(function(){try{const t=function(){if(null!==a&&a.length>0)return Promise.resolve(Digit.UploadServices.Filefetch(a,e.tenantId)).then(function(e){!function(e){var t=Object.keys(e.data),n=t.findIndex(e=>"fileStoreIds"===e);n>-1&&t.splice(n,1);const l=t.map(t=>({image:e.data[t].split(",")[2],key:t,fullImage:Digit.Utils.getFileUrl(e.data[t])}));i([...l])}(e)})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[a]);return l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==t?void 0:t.map((t,n)=>l.createElement("div",{key:n,style:{minWidth:"160px",marginRight:"8px",marginBottom:"8px",maxWidth:"200px"}},l.createElement("img",{src:t.image,alt:"uploaded thumbnail",onClick:()=>e.onClick(t.fullImage,n)})))))},ut=e=>"lbd"===e,st=e=>{var o,r,u,s,d,c,p,m,v,E,_;let{applicationData:S,channelMenu:f,sanitationMenu:y}=e;const{t:T}=i.useTranslation(),g=a.useHistory(),[h,I]=n.useState(!1),C=Digit.ULBService.getStateId(),{data:N,isLoading:A}=Digit.Hooks.fsm.useMDMS(C,"FSM","CommonFieldsConfig"),{data:D,isLoading:O}=Digit.Hooks.fsm.useMDMS(C,"FSM","PreFieldsConfig"),{isLoading:L}=Digit.Hooks.fsm.useMDMS(C,"FSM","PostFieldsConfig"),[P,b,R]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[M,k,w]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[F,x,H]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{b(!1),H(),w()},[]);var V,B,U,Y,G,W,K,z,j={channel:f.filter(e=>e.code===S.source)[0],applicationData:{applicantName:S.citizen.name,mobileNumber:S.citizen.mobileNumber,applicantGender:S.citizen.gender},tripData:{noOfTrips:S.noOfTrips,amountPerTrip:"null"!==S.additionalDetails.tripAmount?S.additionalDetails.tripAmount:"",amount:"null"!==S.additionalDetails.tripAmount?S.noOfTrips*S.additionalDetails.tripAmount:void 0,vehicleType:{capacity:null==S?void 0:S.vehicleCapacity},vehicleCapacity:null==S?void 0:S.vehicleCapacity,distancefromroad:null==S||null===(o=S.additionalDetails)||void 0===o?void 0:o.distancefromroad,roadWidth:null==S||null===(r=S.additionalDetails)||void 0===r?void 0:r.roadWidth},propertyType:S.propertyUsage.split(".")[0],propertyID:null==S||null===(u=S.additionalDetails)||void 0===u?void 0:u.propertyID,subtype:S.propertyUsage,address:{pincode:S.address.pincode,locality:{...S.address.locality,i18nkey:`${S.tenantId.toUpperCase().split(".").join("_")}_REVENUE_${null==S||null===(s=S.address)||void 0===s||null===(d=s.locality)||void 0===d?void 0:d.code}`},slum:S.address.slumName,street:S.address.street,doorNo:S.address.doorNo,landmark:S.address.landmark},pitType:y.filter(e=>e.code===S.sanitationtype)[0],pitDetail:S.pitDetail,paymentPreference:S.paymentPreference,advanceAmount:S.advanceAmount};if(S&&"Village"===(null==S||null===(c=S.address)||void 0===c||null===(p=c.additionalDetails)||void 0===p?void 0:p.boundaryType)||"GP"===(null==S||null===(m=S.address)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.boundaryType))j.address={...j.address,propertyLocation:{active:!0,code:"FROM_GRAM_PANCHAYAT",i18nKey:"FROM_GRAM_PANCHAYAT",name:"From Gram Panchayat"},additionalDetails:{boundaryType:null==S||null===(V=S.address)||void 0===V||null===(B=V.additionalDetails)||void 0===B?void 0:B.boundaryType,gramPanchayat:null==S||null===(U=S.address)||void 0===U||null===(Y=U.additionalDetails)||void 0===Y?void 0:Y.gramPanchayat,village:null==S||null===(G=S.address)||void 0===G||null===(W=G.additionalDetails)||void 0===W?void 0:W.village,newGp:null==S||null===(K=S.address)||void 0===K||null===(z=K.additionalDetails)||void 0===z?void 0:z.newGramPanchayat}};else if(S&&"Locality"===(null==S||null===(E=S.address)||void 0===E||null===(_=E.additionalDetails)||void 0===_?void 0:_.boundaryType)){var X,$,q,Z;j.address={...j.address,propertyLocation:{active:!0,code:"WITHIN_ULB_LIMITS",i18nKey:"WITHIN_ULB_LIMITS",name:"Witnin ULB Limits"},additionalDetails:{boundaryType:null==S||null===(X=S.address)||void 0===X||null===($=X.additionalDetails)||void 0===$?void 0:$.boundaryType,newLocality:null==S||null===(q=S.address)||void 0===q||null===(Z=q.additionalDetails)||void 0===Z?void 0:Z.newLocality}}}if(A||L||O)return l.createElement(t.Loader,null);const Q=[...D,...N];return console.log(Q,"configs"),l.createElement(t.FormComposer,{isDisabled:!h,label:T("CREATED"!=(null==S?void 0:S.applicationStatus)?"ES_FSM_APPLICATION_SCHEDULE":"ES_FSM_APPLICATION_UPDATE"),config:[{head:"ES_NEW_APPLICATION_PROPERTY_DETAILS",body:[{label:"ES_NEW_APPLICATION_PROPERTY_ID",isMandatory:!0,component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0},{label:"ES_NEW_APPLICATION_PROPERTY_TYPE",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"}]},{head:"ES_TITLE_APPLICANT_DETAILS",body:[{label:"ES_NEW_APPLICATION_APPLICATION_CHANNEL",isMandatory:!0,type:"component",key:"channel",component:"SelectChannel",nextStep:"applicantName"},{type:"component",key:"applicationData",withoutLabel:!0,component:"SelectName"}]},{head:"ES_NEW_APPLICATION_LOCATION_DETAILS",body:[{route:"address",component:"FSMSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"locality-gramPanchayat",isMandatory:!0,type:"component"},{route:"locality-gramPanchayat",component:"SelectLocalityOrGramPanchayat",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"select-trip-number",isMandatory:!0,type:"component"},{route:"pincode",component:"FSMSelectPincode",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_FILE_APPLICATION_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"check-slum",type:"component"},{type:"component",route:"check-slum",isMandatory:!0,component:"CheckSlum",texts:{header:"ES_NEW_APPLICATION_SLUM_CHECK",submitBarLabel:"CS_COMMON_NEXT"},key:"address",withoutLabel:!0,nextStep:"slum-details",hideInEmployee:!0},{type:"component",route:"slum-details",isMandatory:!0,component:"SelectSlumName",texts:{header:"CS_NEW_APPLICATION_SLUM_NAME",cardText:"CS_NEW_APPLICATION_SLUM_TEXT",submitBarLabel:"CS_COMMON_NEXT"},withoutLabel:!0,key:"address",nextStep:"street"},{type:"component",route:"street",component:"FSMSelectStreet",key:"address",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_STREET_DOOR_NO_LABEL",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"landmark"},{type:"component",route:"landmark",component:"FSMSelectLandmark",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},key:"address",nextStep:"pit-type"}]},{head:"CS_CHECK_PIT_SEPTIC_TANK_DETAILS",body:[{label:"ES_NEW_APPLICATION_ROAD_WIDTH",isMandatory:!0,type:"component",route:"road-details",key:"roadWidth",hideInEmployee:!0,component:"SelectRoadDetails",texts:{header:"CS_FILE_PROPERTY_ROAD_WIDTH",cardText:"CS_FILE_PROPERTY_ROAD_WIDTH_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!0,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"road-details"},{route:"tank-size",component:"SelectTankSize",isMandatory:!1,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},type:"component",key:"pitDetail",nextStep:"select-payment-preference",label:"ES_NEW_APPLICATION_PIT_DIMENSION"},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTrips"}]},{head:"CS_FILE_ADDITIONAL_DETAILS",hideInEmployee:!0,body:[{label:"a",isMandatory:!0,type:"component",route:"select-trip-number",key:"selectTripNo",component:"SelectTripNo",hideInEmployee:!0,texts:{headerCaption:"",header:"ES_FSM_SERVICE_REQUEST",cardText:"ES_FSM_SERVICE_REQUEST_TEXT",skipText:"CORE_COMMON_SKIP_CONTINUE",submitBarLabel:"CS_COMMON_NEXT",skipLabel:"CS_COMMON_SERVICE_SKIP_INFO"},nextStep:"property-id"},{label:"a",isMandatory:!1,type:"component",route:"select-gender",hideInEmployee:!0,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"select-payment-preference"},{label:"a",isMandatory:!1,type:"component",route:"select-payment-preference",key:"selectPaymentPreference",hideInEmployee:!0,component:"SelectPaymentPreference",texts:{headerCaption:"",header:"ES_FSM_PAYMENT_PREFERENCE_LABEL",cardText:"ES_FSM_PAYMENT_PREFERENCE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:null}]},{head:"ES_TITLE_PAYMENT_DETAILS",body:[{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTripData"},{type:"component",key:"advancepaymentPreference",withoutLabel:!0,component:"AdvanceCollection"}]}].filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,o,r,u,s,d,c,p,m,v,E,_,f,y,T,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y;const G=e.channel,W=null==e||null===(t=e.pitType)||void 0===t?void 0:t.code,K=null==e?void 0:e.pitDetail,z=null==e||null===(n=e.address)||void 0===n?void 0:n.pincode,j=null==e||null===(l=e.address)||void 0===l||null===(i=l.street)||void 0===i?void 0:i.trim(),X=null==e||null===(a=e.address)||void 0===a||null===(o=a.doorNo)||void 0===o?void 0:o.trim(),$=null==e||null===(r=e.address)||void 0===r?void 0:r.slum,q=null==e||null===(u=e.address)||void 0===u||null===(s=u.landmark)||void 0===s?void 0:s.trim(),Z=e.tripData.noOfTrips,Q=e.tripData.amountPerTrip,J=null==e||null===(d=e.address)||void 0===d||null===(c=d.city)||void 0===c?void 0:c.code,ee=null==e||null===(p=e.address)||void 0===p||null===(m=p.locality)||void 0===m?void 0:m.code,te=null==e||null===(v=e.address)||void 0===v||null===(E=v.locality)||void 0===E?void 0:E.name,ne=null==e?void 0:e.subtype,{height:le,length:ie,width:ae,diameter:oe}=K,re=0===Q?null:null!=e&&null!==(_=e.advancepaymentPreference)&&void 0!==_&&_.advanceAmount?null==e||null===(f=e.advancepaymentPreference)||void 0===f?void 0:f.advanceAmount:S.advanceAmount,ue=Q*Z,se=(null==e||null===(y=e.address)||void 0===y?void 0:y.gramPanchayat)||(null==e||null===(T=e.address)||void 0===T||null===(h=T.additionalDetails)||void 0===h?void 0:h.gramPanchayat),de=(null==e||null===(I=e.address)||void 0===I?void 0:I.village)||(null==e||null===(C=e.address)||void 0===C||null===(N=C.additionalDetails)||void 0===N?void 0:N.village),ce=null==e||null===(A=e.address)||void 0===A||null===(D=A.propertyLocation)||void 0===D?void 0:D.code,pe=(null==e||null===(O=e.address)||void 0===O?void 0:O.newGp)||(null==e||null===(L=e.address)||void 0===L||null===(P=L.additionalDetails)||void 0===P?void 0:P.newGramPanchayat),me=(null==e||null===(b=e.address)||void 0===b?void 0:b.newVillage)||(null==e||null===(R=e.address)||void 0===R||null===(M=R.additionalDetails)||void 0===M?void 0:M.village),ve=(null==e||null===(k=e.address)||void 0===k?void 0:k.newLocality)||(null==e||null===(w=e.address)||void 0===w||null===(F=w.additionalDetails)||void 0===F?void 0:F.newLocality),Ee={...S,sanitationtype:W,source:G.code,additionalDetails:{...S.additionalDetails,tripAmount:"number"==typeof Q?JSON.stringify(Q):Q,totalAmount:"number"==typeof ue?JSON.stringify(ue):ue},propertyUsage:ne,vehicleType:e.tripData.vehicleType.type,vehicleCapacity:null==e||null===(x=e.tripData)||void 0===x||null===(H=x.vehicleType)||void 0===H?void 0:H.capacity,noOfTrips:Z,pitDetail:{...S.pitDetail,distanceFromRoad:e.distanceFromRoad,height:le,length:ie,width:ae,diameter:oe},address:{...S.address,tenantId:J,landmark:q,doorNo:X,street:j,pincode:z,slumName:$,locality:{...S.address.locality,code:"FROM_GRAM_PANCHAYAT"===ce?null==se?void 0:se.code:ee,name:"FROM_GRAM_PANCHAYAT"===ce?null==se?void 0:se.name:te},geoLocation:{...S.address.geoLocation,latitude:null!=e&&null!==(V=e.address)&&void 0!==V&&V.latitude?null==e||null===(B=e.address)||void 0===B?void 0:B.latitude:S.address.geoLocation.latitude,longitude:null!=e&&null!==(U=e.address)&&void 0!==U&&U.longitude?null==e||null===(Y=e.address)||void 0===Y?void 0:Y.longitude:S.address.geoLocation.longitude},additionalDetails:{boundaryType:"FROM_GRAM_PANCHAYAT"===ce?"GP":"Locality",gramPanchayat:{code:null==se?void 0:se.code,name:null==se?void 0:se.name},village:null!=de&&de.code?{code:null!=de&&de.code?null==de?void 0:de.code:"",code:null!=de&&de.code?null==de?void 0:de.code:""}:me,newGramPanchayat:pe,newLocality:ve}},advanceAmount:"number"==typeof re?JSON.stringify(re):re};delete Ee.responseInfo,window.Digit.SessionStorage.set("propertyType",null),window.Digit.SessionStorage.set("subType",null),Digit.SessionStorage.set("city_property",null),Digit.SessionStorage.set("selected_localities",null),Digit.SessionStorage.set("locality_property",null),g.replace("/digit-ui/employee/fsm/response",{applicationData:Ee,key:"update",action:"CREATED"===(null==S?void 0:S.applicationStatus)?"SUBMIT":"SCHEDULE"})},defaultValues:j,onFormValueChange:(e,t)=>{var n,l,i,a,o,r,u,s,d,c,p,m;if(null!=t&&t.propertyType&&null!=t&&t.subtype&&(null!=t&&null!==(n=t.address)&&void 0!==n&&null!==(l=n.locality)&&void 0!==l&&l.code||"FROM_GRAM_PANCHAYAT"===(null==t||null===(i=t.address)||void 0===i||null===(a=i.propertyLocation)||void 0===a?void 0:a.code)&&(null!=t&&null!==(o=t.address)&&void 0!==o&&null!==(r=o.gramPanchayat)&&void 0!==r&&r.code||null!=t&&null!==(u=t.address)&&void 0!==u&&null!==(s=u.additionalDetails)&&void 0!==s&&null!==(d=s.gramPanchayat)&&void 0!==d&&d.code))&&null!=t&&null!==(c=t.tripData)&&void 0!==c&&c.vehicleType&&(null!=t&&null!==(p=t.tripData)&&void 0!==p&&p.amountPerTrip||0===(null==t||null===(m=t.tripData)||void 0===m?void 0:m.amountPerTrip))){I(!0);const e=null!=t&&t.pitDetail?Object.values(null==t?void 0:t.pitDetail).filter(e=>e>0):null;var v,E;null!=t&&t.pitType&&(null===e||0===(null==e?void 0:e.length)||ut(null==t||null===(v=t.pitType)||void 0===v?void 0:v.dimension)&&(null==e?void 0:e.length)>=3||!ut(null==t||null===(E=t.pitType)||void 0===E?void 0:E.dimension)&&(null==e?void 0:e.length)>=2?I(!0):I(!1))}else I(!1)}})},dt={select:e=>({totalCount:null==e?void 0:e.totalCount,vehicleLog:null==e?void 0:e.vehicleTrip.map(e=>{const t=e.tripOwner,n=t.name+(t.userName?"- "+t.userName:""),l={...t,displayName:n};return{...e,tripOwner:l}})})},ct=e=>{let{name:t,value:n,onChange:i}=e;return l.createElement(u,{name:t,onChange:i,onBlur:()=>{const e=null==n?void 0:n.split(":"),t=null==e?void 0:e[1];i(n);let l=document.getElementsByClassName("react-time-picker__inputGroup__minute");for(let e of l){let n=e.value;e.value=Number(n)<60?n:t}},value:n,locale:"en-US",disableClock:!1,clearIcon:null,format:"h:mm a"})},pt={select:e=>e.vehicleTrip[0]},mt={select:e=>e.vehicleTrip},vt=e=>"lbd"===e,Et=(e,t,n,l,i,a)=>{var o,r;const u=0===(null==a||null===(o=a.additionalDetails)||void 0===o?void 0:o.tripAmount)||null===(null==a||null===(r=a.additionalDetails)||void 0===r?void 0:r.tripAmount)||!1;return i(`${l?"E":"C"}S_FSM_RESPONSE_${t||"CREATE"}_${e}${n?"":"_ERROR"}${t?"":0===(null==a?void 0:a.advanceAmount)?"_POST_PAY":u?"_ZERO_PAY":""}`)},_t=(e,t,n,l)=>Et("ACTION",e,t,n,l),St=e=>{var n,i,a,o,r,u;let s=null!=e&&e.action?e.action:null===(n=e.data)||void 0===n||null===(i=n.fsm)||void 0===i?void 0:i[0].applicationStatus,d=((e,t,n,l)=>Et("LABEL",e,t,n,l))((null===(a=e.data)||void 0===a||null===(o=a.fsm)||void 0===o?void 0:o[0].applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t);return e.errorInfo&&null!==e.errorInfo&&""!==e.errorInfo&&"string"==typeof e.errorInfo&&"SCHEDULE"!==e.action&&(d=e.errorInfo),l.createElement(t.Banner,{message:_t(s||e.action,e.isSuccess,e.isEmployee,e.t),applicationNumber:null===(r=e.data)||void 0===r||null===(u=r.fsm)||void 0===u?void 0:u[0].applicationNo,info:d,successful:e.isSuccess})},ft=e=>{let{onSearch:r,type:u,onClose:d,onTabChange:c,searchFields:p,searchParams:m,isInboxPage:v,selectedTab:E}=e;const _=v?Digit.SessionStorage.get("fsm/inbox/searchParams"):Digit.SessionStorage.get("fsm/search/searchParams"),{t:S}=i.useTranslation(),f=a.useHistory(),{register:y,handleSubmit:T,reset:g,watch:h,control:I}=o.useForm({defaultValues:_||m}),[C,N]=n.useState(!1),[A,D]=n.useState(!1),O=innerWidth<=640,L=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1;function P(){const e=p.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});g(e),v?Digit.SessionStorage.del("fsm/inbox/searchParams"):Digit.SessionStorage.del("fsm/search/searchParams"),r({})}h(["applicationNos","mobileNumber"]);const b=e=>null;return l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===u||O)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,S("ES_COMMON_SEARCH_BY")),l.createElement("span",{style:{position:"absolute",top:"2%",right:"8px"},onClick:d},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"search-tabs-container"},l.createElement("div",null,l.createElement("button",{className:"VENDOR"===E?"search-tab-head-selected":"search-tab-head",onClick:()=>{P(),c("VENDOR")}},S("ES_FSM_REGISTRY_INBOX_TAB_VENDOR")),l.createElement("button",{className:"VEHICLE"===E?"search-tab-head-selected":"search-tab-head",onClick:()=>{P(),c("VEHICLE")}},S("ES_FSM_REGISTRY_INBOX_TAB_VEHICLE")),l.createElement("button",{className:"DRIVER"===E?"search-tab-head-selected":"search-tab-head",onClick:()=>{P(),c("DRIVER")}},S("ES_FSM_REGISTRY_INBOX_TAB_DRIVER"))),l.createElement("div",{className:"action-bar-wrap-registry"},l.createElement("div",{className:"search-add",onClick:()=>{D(!A)}},S("ES_FSM_REGISTRY_INBOX_HEADER_ADD"),l.createElement("div",{className:"search-add-icon"},l.createElement(t.AddIcon,{className:""}))),A&&l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_ACTION_CREATE",options:["VENDOR","VEHICLE","DRIVER"],t:S,onSelect:function(e){switch(e){case"VENDOR":return f.push("/digit-ui/employee/fsm/registry/new-vendor");case"VEHICLE":return f.push("/digit-ui/employee/fsm/registry/new-vehicle");case"DRIVER":return f.push("/digit-ui/employee/fsm/registry/new-driver")}}}))),l.createElement("form",{onSubmit:T(e=>{e.mobileNumber||delete e.mobileNumber,r(e),"mobile"===u&&d()})},l.createElement("div",{className:L?"complaint-input-container for-pt for-search":"complaint-input-container",style:{width:"100%",gridTemplateColumns:"33.33% 66.66% 0%"}},null==p?void 0:p.map((e,n)=>l.createElement("span",{key:n,className:0===n?"complaint-input":"mobile-input"},l.createElement(t.Label,null,e.label),(e=>{switch(e.type){case"date":return l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange}),name:e.name,control:I,defaultValue:null});case"status":return l.createElement(o.Controller,{render:e=>l.createElement(Ye,{onAssignmentChange:e.onChange,value:e.value,applicationStatuses:applicationStatuses,areApplicationStatus:areApplicationStatus}),name:e.name,control:I,defaultValue:null});default:return l.createElement(t.TextInput,s({},e,{inputRef:y},y(e.name,{validate:b}),{watch:h,shouldUpdate:!0}))}})(e)," ")),l.createElement("div",{style:{display:"flex"}},"desktop"===u&&!O&&l.createElement(t.SubmitBar,{className:"submit-bar-search",label:S("ES_COMMON_SEARCH"),submit:!0}),"desktop"===u&&!O&&l.createElement("span",{className:"clear-search"},l.createElement(t.LinkLabel,{style:{marginTop:"40px",marginLeft:"16px"},onClick:P},S("ES_COMMON_CLEAR_SEARCH"))))),C?l.createElement(t.CardLabelError,{className:"search-error-label"},S("ES_SEARCH_APPLICATION_ERROR")):null))))},yt=e=>{const o=Digit.ULBService.getCurrentTenantId(),{t:u}=i.useTranslation(),s=a.useHistory(),d=(Digit.UserService.hasAccess(["FSM_DSO"]),e=>l.createElement("span",{className:"cell-text"},e)),c=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,[p,m]=n.useState([]),[v,E]=n.useState(null),[_,S]=n.useState([]),f=r.useQueryClient(),{data:y,refetch:T}=Digit.Hooks.fsm.useDsoSearch(o,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{enabled:!1}),{mutate:g}=Digit.Hooks.fsm.useVendorUpdate(o),{mutate:h}=Digit.Hooks.fsm.useUpdateVehicle(o),{mutate:I}=Digit.Hooks.fsm.useDriverUpdate(o);n.useEffect(()=>{var t;m((null==e||null===(t=e.data)||void 0===t?void 0:t.table)||[])},[e]),n.useEffect(()=>{"DRIVER"!==e.selectedTab&&"VEHICLE"!==e.selectedTab||T()},[e.selectedTab]),n.useEffect(()=>{if(y){let e=y.map(e=>e.dsoDetails);S(e)}},[y]);const C=()=>{E(null)},N=(e,t,n)=>{m(l=>l.map((l,i)=>{var a,o;return i==e.id&&e.id!==(null==l||null===(a=l.popup)||void 0===a?void 0:a.row)&&t.id!==(null==l||null===(o=l.popup)||void 0===o?void 0:o.column)&&n?{...l,popup:{row:e.id,column:t.id}}:{...l,popup:{}}}))},A=(e,t,n)=>{if("VEHICLE"===t)s.push("/digit-ui/employee/fsm/registry/vehicle-details/"+e);else{let t=n.find(t=>t.name===e);s.push("/digit-ui/employee/fsm/registry/driver-details/"+(null==t?void 0:t.id))}},D=()=>{switch(e.selectedTab){case"VENDOR":return s.push("/digit-ui/employee/fsm/registry/new-vendor");case"VEHICLE":return s.push("/digit-ui/employee/fsm/registry/new-vehicle");case"DRIVER":return s.push("/digit-ui/employee/fsm/registry/new-driver")}},O=l.useMemo(()=>{switch(e.selectedTab){case"VENDOR":return[{Header:u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/registry/vendor-details/"+t.original.id},l.createElement("div",null,t.original.name,l.createElement("br",null)))))}},{Header:u("ES_FSM_REGISTRY_INBOX_DATE_VENDOR_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,l,i;let{row:a}=e;return d(null!==(t=a.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(l=a.original)||void 0===l||null===(i=l.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:u("ES_FSM_REGISTRY_INBOX_TOTAL_VEHICLES"),Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.allVehicles)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.allVehicles)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.allVehicles)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.allVehicles)||void 0===p?void 0:p.map(e=>e.registrationNumber),onSelect:e=>A(e,"VEHICLE")}))}},{Header:u("ES_FSM_REGISTRY_INBOX_ACTIVE_VEHICLES"),disableSortBy:!0,Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.vehicles)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.vehicles)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.vehicles)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.vehicles)||void 0===p?void 0:p.map(e=>e.registrationNumber),onSelect:e=>A(e,"VEHICLE")}))}},{Header:u("ES_FSM_REGISTRY_INBOX_TOTAL_DRIVERS"),disableSortBy:!0,Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.drivers)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.drivers)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.drivers)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.drivers)||void 0===p?void 0:p.map(e=>e.name),onSelect:e=>{var t;return A(e,"DRIVER",null===(t=m.original)||void 0===t?void 0:t.drivers)}}))}},{Header:u("ES_FSM_REGISTRY_INBOX_ACTIVE_DRIVERS"),disableSortBy:!0,Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.activeDrivers)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.activeDrivers)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.activeDrivers)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.activeDrivers)||void 0===p?void 0:p.map(e=>e.name),onSelect:e=>{var t;return A(e,"DRIVER",null===(t=m.original)||void 0===t?void 0:t.activeDrivers)}}))}},{Header:u("ES_FSM_REGISTRY_INBOX_ENABLED"),disableSortBy:!0,Cell:n=>{var i,a;let{row:o}=n;return l.createElement(t.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(i=o.original)||void 0===i||null===(a=i.dsoDetails)||void 0===a?void 0:a.status),onChange:()=>(t=>{var n,l,i,a;let o=t.original.dsoDetails;const r={vendor:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(n=o.owner)||void 0===n?void 0:n.gender)||"OTHER",dob:(null==o||null===(l=o.owner)||void 0===l?void 0:l.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(i=o.owner)||void 0===i?void 0:i.emailId)||"abc@egov.com",relationship:(null==o||null===(a=o.owner)||void 0===a?void 0:a.relationship)||"OTHER"}}};g(r,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"VENDOR"}),f.invalidateQueries("DSO_SEARCH"),e.refetchData(),setTimeout(C,3e3)}})})(o),name:"switch-"+o.id})}}];case"VEHICLE":return[{Header:u("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/registry/vehicle-details/"+t.original.registrationNumber},l.createElement("div",null,t.original.registrationNumber,l.createElement("br",null)))))}},{Header:u("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,l,i;let{row:a}=e;return d(null!==(t=a.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(l=a.original)||void 0===l||null===(i=l.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;return d((null===(t=l.original)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n.name)||"NA")}},{Header:u("ES_FSM_REGISTRY_INBOX_ENABLED"),disableSortBy:!0,Cell:n=>{var i;let{row:a}=n;return l.createElement(t.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(i=a.original)||void 0===i?void 0:i.status),onChange:()=>(t=>{let n=t.original;delete n.vendor;const l={vehicle:{...n,status:"ACTIVE"===(null==n?void 0:n.status)?"DISABLED":"ACTIVE"}};h(l,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"VEHICLE"}),f.invalidateQueries("FSM_VEICLES_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(C,3e3)}})})(a),name:"switch-"+a.id})}}];case"DRIVER":return[{Header:u("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),disableSortBy:!0,accessor:"tripDetails",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/registry/driver-details/"+t.original.id},l.createElement("div",null,t.original.name,l.createElement("br",null)))))}},{Header:u("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,l,i;let{row:a}=e;return d(null!==(t=a.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(l=a.original)||void 0===l||null===(i=l.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),minWidth:250,Cell:n=>{let{row:i}=n;return l.createElement(t.Dropdown,{className:"fsm-registry-dropdown",selected:i.original.vendor,option:_,select:t=>((t,n)=>{let l=t.original,i=null==l?void 0:l.vendor,a=n;if(delete l.vendor,l.vendorDriverStatus="ACTIVE",i){const e=null==i?void 0:i.drivers;e.splice(e.findIndex(e=>e.id===l.id),1)}const o={vendor:{...a,drivers:a.drivers?[...a.drivers,l]:[l]}};g(o,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"VENDOR"}),f.invalidateQueries("DSO_SEARCH"),e.refetchData(),setTimeout(C,3e3)}})})(i,t),optionKey:"name",t:u,style:{textAlign:"left",width:"100%",minWidth:"250px"}})}},{Header:u("ES_FSM_REGISTRY_INBOX_ENABLED"),disableSortBy:!0,Cell:n=>{var i;let{row:a}=n;return l.createElement(t.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(i=a.original)||void 0===i?void 0:i.status),onChange:()=>(t=>{var n,l,i,a;let o=t.original;const r={driver:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(n=o.owner)||void 0===n?void 0:n.gender)||"OTHER",dob:(null==o||null===(l=o.owner)||void 0===l?void 0:l.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(i=o.owner)||void 0===i?void 0:i.emailId)||"abc@egov.com",relationship:(null==o||null===(a=o.owner)||void 0===a?void 0:a.relationship)||"OTHER"}}};I(r,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"DRIVER"}),f.invalidateQueries("FSM_DRIVER_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(C,3e3)}})})(a),name:"switch-"+a.id})}}];default:return[]}},[e.selectedTab,_]);let L;if(e.isLoading)L=l.createElement(t.Loader,null);else if(0===p.length){let n="",i="";"VENDOR"===e.selectedTab?(n="ES_FSM_REGISTRY_EMPTY_CARD_VENDOR",i="ES_FSM_REGISTRY_EMPTY_BUTTON_VENDOR"):"VEHICLE"===e.selectedTab?(n="ES_FSM_REGISTRY_EMPTY_CARD_VEHICLE",i="ES_FSM_REGISTRY_EMPTY_BUTTON_VEHICLE"):(n="ES_FSM_REGISTRY_EMPTY_CARD_DRIVER",i="ES_FSM_REGISTRY_EMPTY_BUTTON_DRIVER"),L=l.createElement(t.Card,{style:{display:"flex",justifyContent:"center",minHeight:"250px"}},l.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},l.createElement("div",{style:{marginTop:"50px",marginBottom:"25px"}},u(n)),l.createElement(t.SubmitBar,{className:"",label:u(i),onSubmit:D})))}else p.length>0&&(L=l.createElement(xe,{className:"table registryTable",t:u,data:p,columns:O,getCellProps:e=>({style:{minWidth:e.column.Header===u("ES_INBOX_APPLICATION_NO")?"240px":"",padding:e.column.Header===u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME")?"10px 18px":"20px 18px",fontSize:"16px"}}),onPageSizeChange:e.onPageSizeChange,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,pageSizeLimit:e.pageSizeLimit,onSort:e.onSort,disableSort:e.disableSort,sortParams:e.sortParams,totalRecords:e.totalRecords}));return l.createElement("div",{className:"inbox-container"},"FSM_EMP_FSTPO"!==e.userRole&&"FSM_ADMIN"!==e.userRole&&!e.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(Fe,{parentRoute:e.parentRoute}),l.createElement("div",{style:{marginTop:"24px"}},l.createElement(Ue,{searchParams:e.searchParams,paginationParms:e.paginationParms,applications:e.data,onFilterChange:e.onFilterChange,type:"desktop"}))),l.createElement("div",{style:{flex:1,marginLeft:"FSM_ADMIN"===e.userRole?"":"24px"}},l.createElement(ft,{onSearch:e.onSearch,type:"desktop",searchFields:e.searchFields,isInboxPage:!(null!=e&&e.isSearch),searchParams:e.searchParams,onTabChange:e.onTabChange,selectedTab:e.selectedTab}),l.createElement("div",{className:"result",style:{marginLeft:c||"FSM_ADMIN"===e.userRole||null!=e&&e.isSearch?"":"24px",flex:1}},L)),v&&l.createElement(t.Toast,{error:"error"===v.key,label:u("success"===v.key?`ES_FSM_REGISTRY_${v.action}_DISABLE_SUCCESS`:v.action),onClose:C}))},Tt=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null,t(""+n)," "))},gt=e=>l.createElement("h1",{className:"heading-m"},e.label),ht=()=>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"})),It=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ht,null)),{DatePicker:Ct}=require("@djb25/digit-ui-react-components"),Nt=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_VEHICLE_DETAILS",body:[{label:"ES_FSM_REGISTRY_VEHICLE_NUMBER",isMandatory:!0,type:"text",disable:t,populators:{name:"registrationNumber",ValidationRequired:!0,validation:{pattern:"^[A-Z]{2}-[0-9]{1,2}[A-Z]{0,2}-(?:[A-Z]{1,2}-)?[0-9]{1,4}$",title:e("ES_FSM_VEHICLE_FORMAT_TIP")},error:e("FSM_REGISTRY_INVALID_REGISTRATION_NUMBER"),defaultValue:"",className:"payment-form-text-input-correction"}},{route:"vehicle",component:"SelectVehicle",withoutLabel:!0,key:"vehicle",isMandatory:!0,type:"component"},{label:"ES_FSM_REGISTRY_VEHICLE_POLLUTION_CERT",isMandatory:!1,type:"custom",key:"pollutionCert",populators:{name:"pollutionCert",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_INSURANCE",isMandatory:!1,type:"custom",key:"insurance",populators:{name:"insurance",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_ROAD_TAX",isMandatory:!1,type:"custom",key:"roadTax",populators:{name:"roadTax",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_FITNESS",isMandatory:!1,type:"custom",key:"fitnessValidity",populators:{name:"fitnessValidity",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"ownerName",validation:{required:!0,pattern:/^[A-Za-z]/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction",labelStyle:{border:"1px solid black",borderRight:"none"}}},{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender"},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!1,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t,{max:c((new Date).setFullYear((new Date).getFullYear()))}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VENDOR_ADDITIONAL_DETAILS",isMandatory:!1,type:"textarea",key:"additionalDetails",populators:{name:"additionalDetails",className:"payment-form-text-input-correction"}}]}]},At=e=>l.createElement("h1",{className:"heading-m"},e.label),Dt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ot=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dt,null)),{DatePicker:Lt}=require("@djb25/digit-ui-react-components"),Pt=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_DRIVER_DETAILS",body:[{label:"ES_FSM_REGISTRY_DRIVER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"driverName",validation:{required:!0,pattern:/^[A-Za-z]/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_DRIVER_LICENSE",isMandatory:!0,type:"text",key:"license",populators:{name:"license",validation:{required:!0,pattern:/^[a-zA-Z-]{0,}[- ]{0,1}[ 0-9]{1,}/},error:e("FSM_REGISTRY_INVALID_DRIVER_LICENSE"),required:!1,defaultValue:"",className:"payment-form-text-input-correction"}}]},{head:"ES_FSM_REGISTRY_PERSONAL_DETAILS",body:[{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!1,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>l.createElement(Lt,s({onChange:e.onChange,date:e.value},t,{max:c((new Date).setFullYear((new Date).getFullYear()))}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}}]}]},bt=(e,t)=>{const n=new Date(e);if(e){let e=n.getMonth()+1,l=n.getDate(),i=n.getFullYear();return e=(e>9?"":"0")+e,l=(l>9?"":"0")+l,"asset-create"===t?`${l}-${e}-${i}`:`${l}/${e}/${i}`}return null},Rt=function(e,n,i){var a,o;void 0===n&&(n=!1),void 0===i&&(i={});const r="EKYC"===(null===(a=i)||void 0===a||null===(o=a.serviceType)||void 0===o?void 0:o.code);return[{head:"ES_VRNDOR_NEW_VENDOR_DETAILS",isCollapsible:!0,isDefaultOpen:!0,body:[{label:"ES_FSM_REGISTRY_NEW_VENDOR_NAME",isMandatory:!0,type:"text",disable:n,populators:{name:"vendorName",validation:{required:!0,pattern:/^[A-Za-z\s.,/]+$/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VENDOR_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:n,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},labelStyle:{border:"1px solid black",borderRight:"none"},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",key:"serviceType",component:"SelectServiceType",disable:n,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{header:"CS_COMMON_CHOOSE_SERVICE_TYPE",submitBarLabel:"CS_COMMON_NEXT"}},...r?[{label:"ES_VENDOR_CONTRACT_START_DATE",isMandatory:!0,type:"custom",key:"contractStartDate",populators:{name:"contractStartDate",validation:{required:!0},component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}},{label:"ES_VENDOR_CONTRACT_END_DATE",isMandatory:!0,type:"custom",key:"contractEndDate",populators:{name:"contractEndDate",validation:{required:!0},component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}},{label:"ES_VENDOR_ZONE",isMandatory:!0,type:"component",key:"zoneIds",component:"SelectEkycZones"},{label:"ES_FSM_REGISTRY_NEW_OWNER_NAME",isMandatory:!0,type:"text",populators:{name:"ownerName",validation:{required:!0,pattern:/^[A-Za-z\s.,/]+$/},error:e("FSM_REGISTRY_INVALID_NAME"),className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",key:"gender",component:"SelectEkycDropdown",populators:{name:"gender",options:[{code:"MALE",name:"ES_COMMON_GENDER_MALE"},{code:"FEMALE",name:"ES_COMMON_GENDER_FEMALE"},{code:"OTHER",name:"ES_COMMON_GENDER_OTHER"}],optionsKey:"name"}},{label:"ES_FSM_REGISTRY_NEW_DOB",isMandatory:!0,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n,{max:bt((new Date).setFullYear((new Date).getFullYear()))}))}}]:[]]},{isCreateConnection:!0,className:"new-application-card",body:[{type:"component",key:"propertyAddress",component:"CPTPropertyLocationDetails",withoutLabel:!0,props:{hidePropertySearch:!0,hideZRO:!0}}]}]},Mt={SelectPropertySubtype:e=>{var i,o;let{config:r,onSelect:u,t:s,userType:d,formData:c}=e;const{pathname:p}=a.useLocation();let v=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var E;"undefined"!==v&&(v=JSON.parse(null===(E=sessionStorage)||void 0===E?void 0:E.getItem("Digit_FSM_PT")));const _=Digit.ULBService.getStateId(),{isLoading:S,data:f}=Digit.Hooks.fsm.useMDMS(_,"FSM","PropertySubtype",{select:e=>e.map(e=>({...e,i18nKey:s(e.i18nKey)}))}),[y,T]=n.useState(),[g,h]=n.useState([]);console.log("propertyType",c),c.propertyType=(null===(o=v)||void 0===o?void 0:o.usageCategory)||c.propertyType;const{propertyType:I}=c||{};return n.useEffect(()=>{if(!S&&f){const e=null==f?void 0:f.filter(e=>{var t;return e.code===((null==c||null===(t=c.subtype)||void 0===t?void 0:t.code)||(null==c?void 0:c.subtype))})[0];"string"==typeof I&&(null==e?void 0:e.code.split(".")[0])===I||(null==e?void 0:e.code.split(".")[0])===(null==I?void 0:I.code)?T(e):T(null)}},[I,null==c?void 0:c.subtype,f]),n.useEffect(()=>{if(console.log("propertyType2222",I),!S&&I){const e=f.filter(e=>e.propertyType===((null==I?void 0:I.code)||I));h(e)}},[I,S,f]),S?l.createElement(t.Loader,null):"employee"===d?l.createElement(t.Dropdown,{option:null==g?void 0:g.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"i18nKey",id:"propertySubType",selected:y,select:function(e){u(r.key,e.code)},t:s,disable:!p.includes("/modify-application/")&&!p.includes("/new-application")}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:r,onSelect:()=>{sessionStorage.removeItem("Digit.total_amount"),u(r.key,y)},isDisabled:!y,t:s},l.createElement(t.CardLabel,null,s("CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL")+" *"),l.createElement(t.RadioOrSelect,{options:null==g?void 0:g.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:y,optionKey:"i18nKey",onSelect:e=>{T(e)},t:s})))},SelectPropertyType:e=>{var i,o,r,u;let{config:s,onSelect:d,t:c,userType:p,formData:v}=e;const{pathname:E}=a.useLocation(),_=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),S=Digit.Hooks.fsm.useMDMS(_,"FSM","PropertyType",{select:e=>e.map(e=>({...e,i18nKey:c(e.i18nKey)}))});let f=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var y;"undefined"!==f&&(f=JSON.parse(null===(y=sessionStorage)||void 0===y?void 0:y.getItem("Digit_FSM_PT")));const T=(null===(o=f)||void 0===o||null===(r=o.propertyDetails)||void 0===r?void 0:r.usageCategory)||(null===(u=f)||void 0===u?void 0:u.usageCategory);console.log("formData",v);const[g,h]=n.useState((null==v?void 0:v.propertyType)||"");return n.useEffect(()=>{if("employee"===p&&f&&S.data){let e=[];e=null==S?void 0:S.data.filter(e=>e.code==(null==v?void 0:v.propertyType)),console.log("SSSSSS",e,S),e.length>0&&(d(s.key,e[0].code),h(e[0]))}var e,t,n,l,i,a;f&&(console.log("property",f,S),"COMMERCIAL"!=(null===(e=f)||void 0===e||null===(t=e.propertyDetails)||void 0===t?void 0:t.usageCategory)&&"RESIDENTIAL"!=(null===(n=f)||void 0===n||null===(l=n.propertyDetails)||void 0===l?void 0:l.usageCategory)&&"INSTITUTIONAL"!=(null===(i=f)||void 0===i||null===(a=i.propertyDetails)||void 0===a?void 0:a.usageCategory)||h(T))},[S.isLoading]),n.useEffect(()=>{if(console.log("usageType",T),!S.isLoading&&S.data&&T){const e=S.data.filter(e=>{var t;return e.code===(T||(null==v||null===(t=v.propertyType)||void 0===t?void 0:t.code)||(null==v?void 0:v.propertyType))})[0];console.log("preFilledPropertyType",e),void 0!==e&&h(e)}},[f,null==v?void 0:v.propertyType,S.data]),console.log("propertyType",g),S.isLoading?l.createElement(t.Loader,null):"employee"===p?l.createElement(t.Dropdown,{option:null===(I=S.data)||void 0===I?void 0:I.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"i18nKey",id:"propertyType",selected:g,select:function(e){d(s.key,e.code)},t:c,disable:!(E.includes("/modify-application/")||E.includes("/new-application")&&void 0!==g)}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:s,onSelect:()=>{sessionStorage.removeItem("Digit.total_amount"),d(s.key,g)},isDisabled:!g,t:c},l.createElement(t.CardLabel,null,c("CS_FILE_APPLICATION_PROPERTY_LABEL")+" *"),l.createElement(t.RadioOrSelect,{options:null===(C=S.data)||void 0===C?void 0:C.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:g,optionKey:"i18nKey",onSelect:function(e){console.log("vvv",e),h(e)},t:c})),g&&l.createElement(t.CitizenInfoLabel,{info:c("CS_FILE_APPLICATION_INFO_LABEL"),text:c("CS_FILE_APPLICATION_INFO_TEXT",{content:c("CS_DEFAULT_INFO_TEXT"),...g})}));var I,C},SelectPropertyID:e=>{var i,a;let{t:o,config:r,onSelect:u,formData:s,userType:d}=e;const[c,p]=n.useState((null==s||null===(i=s.propertyID)||void 0===i?void 0:i.propertyID)||""),[v,E]=n.useState(!1),[_,S]=n.useState(""),f=[{type:"text",name:"propertyID",placeholder:"Enter a valid property ID",validation:{maxLength:256}}];function y(e){p(e.target.value),"employee"===d&&u(r.key,{...s[r.key],propertyID:e.target.value})}return n.useEffect(()=>{var e;p(null==s||null===(e=s.additionalDetails)||void 0===e?void 0:e.propertyID)},[null==s||null===(a=s.additionalDetails)||void 0===a?void 0:a.propertyID]),"employee"===d?l.createElement(t.TextInput,{className:"form-field",id:"propertyID",value:c,onChange:y,t:o}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(_e,{t:o,config:{...r,inputs:f},value:c,onSelect:e=>u(r.key,{...s[r.key],...e}),placeholder:f.placeholder,onChange:y,onSkip:()=>u(),forcedError:o(_),isDisabled:!1}))},FSMSelectAddress:e=>{let{t:i,config:o,onSelect:r,userType:u,formData:s}=e;const d=Digit.Hooks.fsm.useTenants();let c=Digit.ULBService.getCurrentTenantId();var p;"employee"!==u&&(c=null===(p=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===p?void 0:p.code);const v=a.useLocation(),E=v.pathname.includes("new-vendor"),_=v.pathname.includes("modify-vendor"),S=[{active:!0,code:"WITHIN_ULB_LIMITS",i18nKey:"WITHIN_ULB_LIMITS",name:"Witnin ULB Limits"},{active:!0,code:"FROM_GRAM_PANCHAYAT",i18nKey:"FROM_GRAM_PANCHAYAT",name:"From Gram Panchayat"}];s&&s.address&&(s.address.hasOwnProperty("propertyLocation")||(s.address.propertyLocation=S[0]));const{pincode:f}=(null==s?void 0:s.address)||"",y="employee"===u?d.filter(e=>e.code===c):f?d.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==f)}):d,[T,g]=n.useState(()=>{var e;return(null==s||null===(e=s.address)||void 0===e?void 0:e.city)||Digit.SessionStorage.get("fsm.file.address.city")||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")}),[h,I]=n.useState(),{data:C}=Digit.Hooks.useBoundaryLocalities(null==T?void 0:T.code,"revenue",{enabled:!!T},i),{data:N}=Digit.Hooks.fsm.useMDMS(c,"FSM","UrcConfig"),A=N&&N.length>0&&N[0].URCEnable,[D,O]=n.useState(()=>{var e,t;return null!=s&&null!==(e=s.address)&&void 0!==e&&e.propertyLocation?null==s||null===(t=s.address)||void 0===t?void 0:t.propertyLocation:Digit.SessionStorage.get("locationType")?Digit.SessionStorage.get("locationType"):S[0]}),[L,P]=n.useState(),[b,R]=n.useState();function M(e){R(null),P(null),Digit.SessionStorage.set("fsm.file.address.city",e),g(e)}function k(e){O(e),Digit.SessionStorage.set("locationType",e),"employee"===u&&("FROM_GRAM_PANCHAYAT"===e.code?(r("tripData",{...s.tripData,amountPerTrip:"",amount:""}),r(o.key,{...s[o.key],propertyLocation:e})):r(o.key,{...s[o.key],propertyLocation:e}))}var w,F;return n.useEffect(()=>{y&&1===y.length&&g(y[0])},[y]),n.useEffect(()=>{if(T&&D&&"employee"===u&&r(o.key,{...s[o.key],city:T,propertyLocation:D}),(!A||E||_)&&T&&C){var e,t;let l=C,i=[];var n;null!=s&&null!==(e=s.address)&&void 0!==e&&e.locality&&R(s.address.locality),null!=s&&null!==(t=s.address)&&void 0!==t&&t.pincode&&(i=l.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==s.address.pincode)}),null!=s&&null!==(n=s.address)&&void 0!==n&&n.locality||R()),"employee"===u&&r(o.key,{...s[o.key],city:T}),P(()=>i.length>0?i:l),1===i.length&&(R(i[0]),"employee"===u&&r(o.key,{...s[o.key],locality:i[0]}))}},[T,D,C]),"employee"===u?l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i("MYCITY_CODE_LABEL"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:1===(null==y?void 0:y.length)?y[0]:T,disable:1===(null==y?void 0:y.length),option:y,select:M,optionKey:"code",t:i})),!A||E||_?l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i("ES_NEW_APPLICATION_LOCATION_MOHALLA"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:b,option:L,select:function(e){R(e),"employee"===u&&r(o.key,{...s[o.key],locality:e})},optionKey:"i18nkey",t:i})),!E&&!_&&!A&&"Other"===(null==s||null===(w=s.address)||void 0===w||null===(F=w.locality)||void 0===F?void 0:F.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"newLocality",key:"newLocality",value:h,onChange:e=>{return I(t=e.target.value),void("employee"===u&&r(o.key,{...s[o.key],newLocality:t}));var t}})))):l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,i("CS_PROPERTY_LOCATION")+" *"),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{selectedOption:D,onSelect:k,style:{display:"flex",marginBottom:0},innerStyles:{marginLeft:"10px"},options:S,optionsKey:"i18nKey"})))):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:o,onSelect:function(){r(o.key,{city:T,propertyLocation:Digit.SessionStorage.get("locationType")?Digit.SessionStorage.get("locationType"):D})},t:i,isDisabled:!D},A&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,i("CS_PROPERTY_LOCATION")+" *"),l.createElement(t.RadioOrSelect,{isMandatory:o.isMandatory,options:S,selectedOption:Digit.SessionStorage.get("locationType")?Digit.SessionStorage.get("locationType"):D,optionKey:"i18nKey",onSelect:k,t:i})),l.createElement(t.CardLabel,null,i("MYCITY_CODE_LABEL")+" *"),l.createElement(t.RadioOrSelect,{options:y,selectedOption:T,optionKey:"i18nKey",onSelect:M,t:i})))},FSMSelectStreet:e=>{var i,a,r,u,d,c,p,v;let{t:E,config:_,onSelect:S,userType:f,formData:y,formState:T,setError:g,clearErrors:h}=e;const[I,C]=n.useState({index:-1,type:""});let N=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var A;"undefined"!==N&&(N=JSON.parse(null===(A=sessionStorage)||void 0===A?void 0:A.getItem("Digit_FSM_PT")));const{control:D,formState:O,watch:L,setValue:P,getValues:b,trigger:R}=o.useForm(),M=L(),{errors:k}=O,[w,F]=(window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details")||window.location.href.includes("tl/edit-application-details/")||window.location.href.includes("/tl/tradelicence/new-application/street")||window.location.href.includes("/tl/tradelicence/renew-trade")||window.location.href.includes("/tl/tradelicence/edit-application"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useState(null===(a=N)||void 0===a||null===(r=a.propertyDetails)||void 0===r||null===(u=r.address)||void 0===u?void 0:u.street)),[x,H]=n.useState(null===(d=N)||void 0===d||null===(c=d.propertyDetails)||void 0===c||null===(p=c.address)||void 0===p?void 0:p.doorNo);let V;window.location.href.includes("tl")?(V=_.inputs,_.inputs[0].disable=window.location.href.includes("edit-application"),_.inputs[1].disable=window.location.href.includes("edit-application"),V[0].validation={minLength:0,maxLength:256},V[1].validation={minLength:0,maxLength:256}):V=[{label:"PT_PROPERTY_ADDRESS_STREET_NAME",type:"text",name:"street",isMandatory:!0,validation:{pattern:"[a-zA-Z0-9 ]{1,255}",title:E("CORE_COMMON_STREET_INVALID")}},{label:"PT_PROPERTY_ADDRESS_HOUSE_NO",type:"text",name:"doorNo",isMandatory:!0,validation:{pattern:"[A-Za-z0-9#,/ -]{1,63}",title:E("CORE_COMMON_DOOR_INVALID")}}];const B=e=>{let{validation:t,name:n,messages:l}=e;if(t){let{pattern:e,maxlength:i,minlength:a,required:o}=t||{};return{pattern:t=>{if(e){var i;if(e instanceof RegExp)return!!e.test(t)||(null==l?void 0:l.pattern)||n.toUpperCase()+"_PATTERN";if("string"==typeof e)return!(null===(i=new RegExp(e))||void 0===i||!i.test(t))||(null==l?void 0:l.pattern)||n.toUpperCase()+"_PATTERN"}return!0},required:e=>!o||!!e||(null==l?void 0:l.required)||n.toUpperCase()+"_REQUIRED",minLength:e=>!a||(null==e?void 0:e.length)>=a||(null==l?void 0:l.minlength)||n.toUpperCase()+"_MINLENGTH",maxLength:e=>!i||(null==e?void 0:e.length)<=i||(null==l?void 0:l.maxlength)||n.toUpperCase()+"_MAXLENGTH"}}return{}};var U;return n.useEffect(()=>{var e,t,n,l,i,a,o;window.location.href.includes("employee/fsm/")&&null!=y&&null!==(e=y.cpt)&&void 0!==e&&e.details&&(P("doorNo",null==y||null===(t=y.cpt)||void 0===t||null===(n=t.details)||void 0===n||null===(l=n.address)||void 0===l?void 0:l.doorNo),P("street",null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o.street))},[y]),n.useEffect(()=>{R()},[]),n.useEffect(()=>{var e,t,n,l;null!=y&&null!==(e=y.address)&&void 0!==e&&e.doorNo&&H(null==y||null===(t=y.address)||void 0===t?void 0:t.doorNo),null!=y&&null!==(n=y.address)&&void 0!==n&&n.street&&F(null==y||null===(l=y.address)||void 0===l?void 0:l.street)},[null==y?void 0:y.address]),n.useEffect(()=>{var e;"employee"===f&&(Object.keys(k).length&&!Se.isEqual((null===(e=T.errors[_.key])||void 0===e?void 0:e.type)||{},k)?g(_.key,{type:k}):!Object.keys(k).length&&T.errors[_.key]&&h(_.key))},[k]),n.useEffect(()=>{const e=Object.keys(M),t={};e.forEach(e=>{var n;return t[e]=null===(n=y[_.key])||void 0===n?void 0:n[e]}),Se.isEqual(M,t)||(S(_.key,{...y[_.key],...M}),R())},[M]),n.useEffect(()=>{var e,t;null!=y&&null!==(e=y.cpt)&&void 0!==e&&e.details&&window.location.href.includes("fsm")&&(null===(t=V)||void 0===t||t.map(e=>{var t,n,l,i,a,o,r,u,s,d,c,p,m,v;b(e.name)!==(null==y||null===(t=y.cpt)||void 0===t||null===(n=t.details)||void 0===n||null===(l=n.address)||void 0===l?void 0:l[e.name])&&P(e.name,null===(null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o[e.name])||""===(null==y||null===(r=y.cpt)||void 0===r||null===(u=r.details)||void 0===u||null===(s=u.address)||void 0===s?void 0:s[e.name])?null!=y&&null!==(d=y.address)&&void 0!==d&&d[e.name]?null==y||null===(c=y.address)||void 0===c?void 0:c[e.name]:"":null==y||null===(p=y.cpt)||void 0===p||null===(m=p.details)||void 0===m||null===(v=m.address)||void 0===v?void 0:v[e.name])}))},[null==y||null===(v=y.cpt)||void 0===v?void 0:v.details]),"employee"===f?null===(U=V)||void 0===U?void 0:U.map((e,n)=>{var i,a,r,u;return l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},E(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,defaultValue:(null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(r=a.address)||void 0===r?void 0:r[null==e?void 0:e.name])||(null==y||null===(u=y.address)||void 0===u?void 0:u[e.name]),name:e.name,rules:{validate:B(e)},render:i=>{var a,o,r,u,d,c,p,m,v,E,_,S,f,T,g,h;return l.createElement("div",{style:{display:"flex",alignItems:"baseline",marginRight:"unset"}},l.createElement(t.TextInput,s({id:e.name,key:e.name,value:i.value,onChange:e=>{C({index:n}),i.onChange(e.target.value)},onBlur:i.onBlur,disable:!(null==y||null===(a=y.cpt)||void 0===a||null===(o=a.details)||void 0===o||null===(r=o.address)||void 0===r||!r[e.name]),autoFocus:(null==I?void 0:I.index)==n},null==e?void 0:e.validation)),l.createElement("div",{style:{marginRight:"-50px",marginLeft:"10px"}},l.createElement(t.WrapUnMaskComponent,{unmaskField:e=>{i.onChange(e)},iseyevisible:!!(i.value?null===(u=i.value)||void 0===u?void 0:u.includes("*"):null==y||null===(d=y.cpt)||void 0===d||null===(c=d.details)||void 0===c||null===(p=c.address)||void 0===p||null===(m=p[e.name])||void 0===m?void 0:m.includes("*")),privacy:{uuid:null==y||null===(v=y.cpt)||void 0===v||null===(E=v.details)||void 0===E||null===(_=E.owners)||void 0===_||null===(S=_[0])||void 0===S?void 0:S.uuid,fieldName:[e.name],model:"Property",loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:null==y||null===(f=y.cpt)||void 0===f||null===(T=f.details)||void 0===T?void 0:T.tenantId,propertyIds:null==y||null===(g=y.cpt)||void 0===g||null===(h=g.details)||void 0===h?void 0:h.propertyId},jsonPath:"Properties[0].address."+e.name,isArray:!1}}})))}})))}):l.createElement(l.Fragment,null,window.location.href.includes("/fsm")?l.createElement(m,{currentStep:2}):l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:{..._,inputs:V},isMandatory:!0,_defaultValues:{street:N.propertyDetails.address.street,doorNo:N.propertyDetails.address.doorNo},onChange:e=>{let{name:t}=e.target,{value:n}=e.target;"street"===t?F(n):H(n)},onSelect:e=>S(_.key,e),onSkip:()=>S(),isDisabled:!x&&!w,t:E}))},FSMSelectLandmark:e=>{var i,a,o,r,u;let{t:d,config:c,onSelect:p,formData:v,userType:E}=e,_=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var S;"undefined"!==_&&(_=JSON.parse(null===(S=sessionStorage)||void 0===S?void 0:S.getItem("Digit_FSM_PT")));const[f,y]=n.useState(null===(a=_)||void 0===a||null===(o=a.propertyDetails)||void 0===o||null===(r=o.address)||void 0===r?void 0:r.landmark),[T,g]=n.useState(""),h=[{label:"ES_NEW_APPLICATION_LOCATION_LANDMARK",type:"textarea",name:"landmark",validation:{maxLength:1024}}];function I(e){e.target.value.length>1024?g("CS_COMMON_LANDMARK_MAX_LENGTH"):(g(null),y(e.target.value),"employee"===E&&p(c.key,{...v[c.key],landmark:e.target.value}))}return n.useEffect(()=>{var e;y(null==v||null===(e=v.address)||void 0===e?void 0:e.landmark)},[null==v||null===(u=v.address)||void 0===u?void 0:u.landmark]),"employee"===E?null==h?void 0:h.map((e,n)=>l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},d(e.label),c.isMandatory?" * ":null),l.createElement(t.TextArea,s({className:"form-field",id:e.name,value:f,onChange:I,name:e.name||""},e.validation)))):l.createElement(l.Fragment,null,window.location.href.includes("/pt")?l.createElement(m,{currentStep:1,flow:"PT_APPLY"}):window.location.href.includes("/tl")?l.createElement(m,{currentStep:2}):l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:{...c,inputs:h},value:f,onChange:I,onSelect:e=>p(c.key,{...v[c.key],...e}),t:d,forcedError:d(T),isDisabled:!1}))},FSMSelectPincode:e=>{var i,o,r,u,d,c,p,v,E,_,S,f,y;let{t:T,config:g,onSelect:h,formData:I={},userType:C}=e;const N=Digit.Hooks.fsm.useTenants(),[A,D]=n.useState((null==I||null===(i=I.cpt)||void 0===i||null===(o=i.details)||void 0===o||null===(r=o.address)||void 0===r?void 0:r.pincode)||(null==I||null===(u=I.address)||void 0===u?void 0:u.pincode)||""),[O,L]=n.useState(null),{pathname:P}=a.useLocation();P.includes("modify");let b=null===(d=sessionStorage)||void 0===d?void 0:d.getItem("Digit_FSM_PT");var R;"undefined"!==b&&(b=JSON.parse(null===(R=sessionStorage)||void 0===R?void 0:R.getItem("Digit_FSM_PT")));const M=[{label:"CORE_COMMON_PINCODE",type:"text",name:"pincode",validation:{minlength:6,maxlength:6,pattern:"^[1-9][0-9]*",max:"9999999",title:T("CORE_COMMON_PINCODE_INVALID")}}];function k(e){if(D(e.target.value),L(null),"employee"===C)if(null==N?void 0:N.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)})){const t=N.filter(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==e.target.value)})[0];h(g.key,{...I.address,city:t,pincode:e.target.value,slum:null})}else h(g.key,{...I.address,pincode:e.target.value}),L("CS_COMMON_PINCODE_NOT_SERVICABLE")}return n.useEffect(()=>{var e,t,n,l,i,a;null!==(e=b)&&void 0!==e&&null!==(t=e.propertyDetails)&&void 0!==t&&null!==(n=t.address)&&void 0!==n&&n.pincode&&D(null===(l=b)||void 0===l||null===(i=l.propertyDetails)||void 0===i||null===(a=i.address)||void 0===a?void 0:a.pincode)},[null===(c=b)||void 0===c||null===(p=c.propertyDetails)||void 0===p||null===(v=p.address)||void 0===v?void 0:v.pincode]),n.useEffect(()=>{var e,t,n,l;if(null!=I&&null!==(e=I.address)&&void 0!==e&&e.pincode)D(I.address.pincode);else if(null!=I&&null!==(t=I.cpt)&&void 0!==t&&null!==(n=t.details)&&void 0!==n&&null!==(l=n.address)&&void 0!==l&&l.pincode){var i,a,o;D(null==I||null===(i=I.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o.pincode)}},[null==I||null===(E=I.address)||void 0===E?void 0:E.pincode,null==I||null===(_=I.cpt)||void 0===_||null===(S=_.details)||void 0===S||null===(f=S.address)||void 0===f?void 0:f.pincode]),n.useEffect(()=>{var e,t,n,l;(null==I||null===(e=I.address)||void 0===e||null===(t=e.locality)||void 0===t?void 0:t.pincode)!==A&&"employee"===C&&(D((null==I||null===(n=I.address)||void 0===n||null===(l=n.locality)||void 0===l?void 0:l.pincode)||""),L(null))},[null==I||null===(y=I.address)||void 0===y?void 0:y.locality]),n.useEffect(()=>{"employee"===C&&A&&h(g.key,{...I.address,pincode:(null==A?void 0:A[0])||A})},[A]),"employee"===C?null==M?void 0:M.map((e,i)=>l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,{key:i},l.createElement(t.CardLabel,{className:"card-label-smaller"},T(e.label),g.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({key:e.name,value:A,onChange:k},e.validation)))),O&&l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},T(O)))):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{t:T,config:{...g,inputs:M},onSelect:function(e){try{return(null==N?void 0:N.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))}))?h(g.key,{pincode:A}):L("CS_COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:A,onChange:k,onSkip:()=>h(),forcedError:T(O),isDisabled:!A}))},SelectTankSize:e=>{var i,a;let{config:o,onSelect:r,t:u,formData:s={},userType:d}=e;const c=Digit.ULBService.getCurrentTenantId(),p=null==s||null===(i=s.pitType)||void 0===i?void 0:i.dimension,[v,E]=n.useState(!0),[_,S]=n.useState((null==s||null===(a=s.pitDetail)||void 0===a?void 0:a.images)||null),[f,y]=n.useState();return n.useEffect(()=>{null!=s&&s.pitType||"employee"===d||r(o.key,{},!0)},[]),n.useEffect(()=>{var e,t,n;(e=>"lbd"===e)(p)?y({...null==s?void 0:s.pitDetail,diameter:0,...0===(null==s||null===(e=s.pitDetail)||void 0===e?void 0:e.length)&&{height:0}}):y({...null==s?void 0:s.pitDetail,length:0,width:0,...0===(null==s||null===(t=s.pitDetail)||void 0===t?void 0:t.diameter)&&{height:0}}),s&&s.pitDetail&&S((null==s||null===(n=s.pitDetail)||void 0===n?void 0:n.images)||null)},[p]),n.useEffect(()=>{_&&_.length&&E(!1)},[_]),"employee"===d?l.createElement(t.PitDimension,{sanitationType:s.pitType,size:f,handleChange:e=>{const{name:t,value:n}=e.target;isNaN(n)||(y(e=>({...e,[t]:n})),"employee"===d&&setTimeout(r(o.key,{...f,[t]:n})))},t:u,disable:!(null!=s&&s.pitType)}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:o,onSkip:()=>r(),onSelect:()=>{r(o.key,{images:_})},isDisabled:v,t:u},l.createElement(t.ImageUploadHandler,{tenantId:c,onPhotoChange:e=>{S(e)},uploadedImages:_})))},SelectPitType:e=>{let{t:i,formData:a,config:o,onSelect:r,userType:u}=e;Digit.ULBService.getCurrentTenantId();const s=Digit.ULBService.getStateId(),[d,c]=n.useState(null==a?void 0:a.pitType),{data:p,isLoading:v}=Digit.Hooks.fsm.useMDMS(s,"FSM","PitType"),E=e=>{c(e),"employee"===u&&(r(o.key,e),r("pitDetail",null))};return v?l.createElement(t.Loader,null):"employee"===u?l.createElement(t.Dropdown,{isMandatory:!0,option:null==p?void 0:p.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"i18nKey",select:E,selected:d,t:i}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:o,onSelect:()=>{r(o.key,d)},onSkip:()=>{r()},isDisabled:!d,t:i},l.createElement(t.CardLabel,null,i("CS_FILE_APPLICATION_PIT_TYPE_LABEL")),l.createElement(t.RadioOrSelect,{isMandatory:o.isMandatory,options:null==p?void 0:p.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:d,optionKey:"i18nKey",onSelect:E,t:i})))},SelectRoadDetails:e=>{var t,i,a,r;let{t:u,config:s,onSelect:d,formData:c}=e;const[p,v]=n.useState({index:-1,type:""}),{watch:E,trigger:_}=o.useForm(),S=E(),[f,y]=n.useState((null==c||null===(t=c.roadWidth)||void 0===t?void 0:t.distancefromroad)||""),[T,g]=n.useState((null==c||null===(i=c.roadWidth)||void 0===i?void 0:i.roadWidth)||"");let h;return window.location.href.includes("tl")?(h=s.inputs,s.inputs[0].disable=window.location.href.includes("edit-application"),s.inputs[1].disable=window.location.href.includes("edit-application"),h[0].validation={minLength:0,maxLength:256},h[1].validation={minLength:0,maxLength:256}):h=[{label:"ES_NEW_APPLICATION_ROAD_WIDTH",type:"text",name:"roadWidth",isMandatory:!0,placeholder:"Enter road width in meters",validation:{maxlength:256,title:u("CORE_COMMON_ROADWIDTH_INVALID")}},{label:"ES_NEW_APPLICATION_DISTANCE_FROM_ROAD",type:"text",name:"distancefromroad",isMandatory:!0,placeholder:"Enter distance of pit from road",validation:{maxlength:256,title:u("CORE_COMMON_DISTANCE_INVALID")}}],n.useEffect(()=>{_()},[]),n.useEffect(()=>{var e,t,n,l;null!=c&&null!==(e=c.roadCharges)&&void 0!==e&&e.distance&&y(null==c||null===(t=c.roadCharges)||void 0===t?void 0:t.distance),null!=c&&null!==(n=c.roadCharges)&&void 0!==n&&n.roadWidth&&g(null==c||null===(l=c.roadCharges)||void 0===l?void 0:l.roadWidth)},[null==c?void 0:c.roadCharges]),n.useEffect(()=>{const e=Object.keys(S),t={};e.forEach(e=>{var n;return t[e]=null===(n=c[s.key])||void 0===n?void 0:n[e]}),Se.isEqual(S,t)||(d(s.key,{...c[s.key],...S}),_())},[S]),l.createElement(l.Fragment,null,window.location.href.includes("/tl")?l.createElement(m,{currentStep:2}):l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(_e,{config:{...s,inputs:h},isMandatory:!0,_defaultValues:{roadWidth:(null==c||null===(a=c.roadWidth)||void 0===a?void 0:a.roadWidth)||"",distancefromroad:(null==c||null===(r=c.roadWidth)||void 0===r?void 0:r.distancefromroad)||""},onChange:e=>{let{name:t}=e.target,{value:n}=e.target;"roadWidth"===t?g(n):y(n)},onSelect:e=>d(s.key,e),isDisabled:!T||!f,t:u,onSkip:()=>d()}))},SelectTripNo:e=>{var i,a,o;let{config:r,formData:u,t:s,onSelect:d,userType:c}=e;const p=Digit.ULBService.getStateId(),m=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),v=null===(i=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===i?void 0:i.code,{data:E,isLoading:_}=Digit.Hooks.fsm.useMDMS(m,"FSM","TripNumber"),{data:S}=Digit.Hooks.fsm.useDsoSearch(v,{limit:-1,status:"ACTIVE"}),{data:f}=Digit.Hooks.fsm.useMDMS(p,"Vehicle","VehicleType",{staleTime:Infinity}),[y,T]=n.useState(null==u?void 0:u.tripNo),[g,h]=n.useState(null==u?void 0:u.capacity),[I,C]=n.useState([]);return n.useEffect(()=>{if(S&&f){const e=S.reduce((e,t)=>t.vehicles&&t.vehicles.length?e.concat(t.vehicles):e,[]),t=Array.from(new Set(e.map(e=>e.capacity))).map(t=>e.find(e=>e.capacity===t));C(t)}},[S,f]),n.useEffect(()=>{if(!_&&E){const e=E.filter(e=>{var t,n;return e.code===((null==u||null===(t=u.selectTripNo)||void 0===t||null===(n=t.tripNo)||void 0===n?void 0:n.code)||(null==u?void 0:u.selectTripNo))})[0];T(e||E.find(e=>1===e.code))}},[null==u||null===(a=u.selectTripNo)||void 0===a?void 0:a.tripNo,E]),n.useEffect(()=>{if(!_&&I){const e=I.filter(e=>{var t,n;return e.capacity===(null==u||null===(t=u.selectTripNo)||void 0===t||null===(n=t.vehicleCapacity)||void 0===n?void 0:n.capacity)})[0];let t=I.reduce((e,t)=>e.capacity<t.capacity?e:t,0);h(e||t)}},[null==u||null===(o=u.selectTripNo)||void 0===o?void 0:o.vehicleCapacity,I]),_||0===I.length?l.createElement(t.Loader,null):"employee"===c?null:l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:r,onSelect:()=>{y&&d(r.key,{tripNo:y,vehicleCapacity:g})},onSkip:()=>{y&&d(r.key,{tripNo:y,vehicleCapacity:g})},isDisabled:!y&&!g,t:s},l.createElement(t.CardText,null," ",s("ES_FSM_NUMBER_OF_TRIPS")," "),l.createElement(t.RadioOrSelect,{options:E,selectedOption:y,optionKey:"i18nKey",onSelect:e=>{if(T(e),"employee"===c)return null},optionCardStyles:{zIndex:"60"},t:s,isMandatory:r.isMandatory}),l.createElement(t.CardText,null," ",s("ES_VEHICLE CAPACITY")," "),l.createElement(t.RadioOrSelect,{options:null==I?void 0:I.map(e=>({...e,label:e.capacity})).sort((e,t)=>e.capacity-t.capacity),selectedOption:g,optionKey:"capacity",onSelect:e=>{if(h(e),"employee"===c)return null},optionCardStyles:{zIndex:"60"},t:s,isMandatory:r.isMandatory,isDropDown:!0})))},FSMSelectGeolocation:e=>{var i,a;let{t:o,config:r,onSelect:u,formData:s={}}=e;const[d,c]=n.useState((null==s||null===(i=s.address)||void 0===i?void 0:i.pincode)||""),[p,v]=n.useState((null==s||null===(a=s.address)||void 0===a?void 0:a.geoLocation)||{}),E=Digit.Hooks.fsm.useTenants(),[_,S]=n.useState(null);return l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.LocationSearchCard,{header:o("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_HEADER"),cardText:o("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_TEXT"),nextText:o("CS_COMMON_NEXT"),skipAndContinueText:o("CORE_COMMON_SKIP_CONTINUE"),skip:()=>u(),t:o,position:p,onSave:()=>u(r.key,{geoLocation:p,pincode:d}),onChange:(e,t)=>((e,t)=>{S(null),(null==E?void 0:E.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==e)}))?(c(e),v(t)):(S("CS_COMMON_PINCODE_NOT_SERVICABLE"),c(""),v({}))})(e,t),disabled:""===d,forcedError:o(_)}))},SelectSlumName:e=>{var i,a,o,r,u,s,d;let{config:c,onSelect:p,t:v,userType:E,formData:_}=e;const S=Digit.ULBService.getCurrentTenantId(),[f,y]=(Digit.ULBService.getStateId(),n.useState()),T=null!=_&&null!==(i=_.address)&&void 0!==i&&i.city?null==_||null===(a=_.address)||void 0===a?void 0:a.city.code:S,{data:g,isLoading:h}=Digit.Hooks.fsm.useMDMS(T,"FSM","Slum"),[I,C]=n.useState();return n.useEffect(()=>{var e,t;"employee"!==E&&!1===(null==_||null===(e=_.address)||void 0===e||null===(t=e.slumArea)||void 0===t?void 0:t.code)&&p(c.key,{slumData:null,slum:null},!0)},[null==_||null===(o=_.address)||void 0===o?void 0:o.slumArea]),n.useEffect(()=>{if(I&&null!=_&&_.address){const e=I.filter(e=>{var t;return e.code===(null==_||null===(t=_.address)||void 0===t?void 0:t.slum)})[0];y(e)}},[null==_||null===(r=_.address)||void 0===r?void 0:r.slum,I]),n.useEffect(()=>{var e,t;const n=null==_||null===(e=_.address)||void 0===e||null===(t=e.locality)||void 0===t?void 0:t.code;if("employee"===E&&!h&&g){var l;const e=g[n]?[{code:null,active:!0,name:"Not residing in slum area",i18nKey:"ES_APPLICATION_NOT_SLUM_AREA"},...g[n]]:[{code:null,active:!0,name:"Not residing in slum area",i18nKey:"ES_APPLICATION_NOT_SLUM_AREA"},...Object.keys(g).map(e=>g[e]).reduce((e,t)=>[...e,...t])];C(e),null!=_&&null!==(l=_.address)&&void 0!==l&&l.slum||(y({code:null,active:!0,name:"Not residing in slum area",i18nKey:"ES_APPLICATION_NOT_SLUM_AREA"}),p(c.key,{..._[c.key],slum:null}))}if("employee"!==E&&!h&&g){const e=Object.keys(g).map(e=>g[e]).reduce((e,t)=>[...e,...t]);C(g[n]?g[n]:e)}},[h,null==_||null===(u=_.address)||void 0===u||null===(s=u.locality)||void 0===s?void 0:s.code]),h?l.createElement(t.Loader,null):"employee"===E?"FROM_GRAM_PANCHAYAT"!==(null==_||null===(d=_.address)||void 0===d?void 0:d.propertyLocation)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},v("ES_NEW_APPLICATION_SLUM_NAME")),l.createElement(t.Dropdown,{t:v,option:I,className:"form-field",optionKey:"i18nKey",id:"slum",selected:f,select:function(e){y(e),p(c.key,{..._[c.key],slum:e.code})}})):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{t:v,config:c,onSelect:function(){sessionStorage.removeItem("Digit.total_amount"),p(c.key,{..._[c.key],slum:f.code,slumData:f})},onSkip:function(){p()}},l.createElement(t.Dropdown,{t:v,option:I,optionKey:"i18nKey",id:"i18nKey",selected:f,select:y})))},CheckSlum:e=>{var i,a,o;let{t:r,config:u,onSelect:s,formData:d}=e;Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId();const[c,p]=n.useState(null==d||null===(i=d.address)||void 0===i?void 0:i.slumArea),v=(null==d||null===(a=d.address)||void 0===a||null===(o=a.locality)||void 0===o||o.code.split("_"),()=>s());return n.useEffect(()=>{var e;"FROM_GRAM_PANCHAYAT"===(null==d||null===(e=d.address)||void 0===e?void 0:e.propertyLocation)&&v()},[d]),l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{t:r,config:u,onSelect:function(){sessionStorage.removeItem("Digit.total_amount"),s(u.key,{slumArea:c})},onSkip:v,isDisabled:!c},l.createElement(t.RadioOrSelect,{isMandatory:u.isMandatory,options:[{code:!0,i18nKey:"CS_COMMON_YES"},{code:!1,i18nKey:"CS_COMMON_NO"}],selectedOption:c,optionKey:"i18nKey",onSelect:p})))},FSMCard:()=>{const{t:e}=i.useTranslation(),a=Digit.UserService.hasAccess(["FSM_DSO"])||!1,o=Digit.UserService.hasAccess("FSM_COLLECTOR")||!1,r=Digit.UserService.hasAccess("FSM_ADMIN")||!1,u=Digit.UserService.hasAccess("FSM_EDITOR_EMP")||!1,d=Digit.UserService.hasAccess("FSM_CREATOR_EMP")||!1,c=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,[p,m]=n.useState("-"),v=Digit.ULBService.getCurrentTenantId();if(!Digit.Utils.fsmAccess())return null;const E={enabled:!!c,select:t=>{const n=t.vehicleTrip.reduce((t,n)=>{const l=n.tripDetails.reduce((e,t)=>t.volume+e,0);return t[e("ES_READY_FOR_DISPOSAL")]+=l/1e3,t},{[e("ES_READY_FOR_DISPOSAL")]:0});return n[e("ES_READY_FOR_DISPOSAL")]=`(${n[e("ES_READY_FOR_DISPOSAL")]} KL)`,n}},{isSuccess:_}=Digit.Hooks.fsm.useVehicleSearch({tenantId:v,filters:{applicationStatus:"WAITING_FOR_DISPOSAL"},config:E}),{data:S}=Digit.Hooks.fsm.useInbox(v,{sortBy:"createdTime",sortOrder:"DESC",total:!0,limit:10,offset:0,...u||d||o||r?{uuid:{code:"ASSIGNED_TO_ALL",name:e("ES_INBOX_ASSIGNED_TO_ALL")}}:{uuid:{code:"ASSIGNED_TO_ME",name:e("ES_INBOX_ASSIGNED_TO_ME")}}},{enabled:!c});n.useEffect(()=>{S&&m((null==S?void 0:S.totalCount)||0)},[S]);const f=r?[{link:"/digit-ui/employee/fsm/registry?selectedTabs=VENDOR",label:e("ES_TITLE_FSM_REGISTRY"),icon:l.createElement(t.AddNewIcon,null)}]:[],y={Icon:l.createElement(t.ShippingTruck,null),moduleName:e("ES_TITLE_VEHICLE_LOG"),links:[{label:e("ES_COMMON_HOME"),link:"/digit-ui/employee/fsm/fstp-operations"}]};if(c&&_)return l.createElement(t.EmployeeModuleCard,y);const T=a||o||u?[]:[{label:e("ES_TITLE_NEW_DESULDGING_APPLICATION"),link:"/digit-ui/employee/fsm/new-application"}],g=c?{Icon:l.createElement(t.ShippingTruck,null),moduleName:e("ES_TITLE_VEHICLE_LOG"),links:[{label:e("ES_COMMON_HOME"),link:"/digit-ui/employee/fsm/fstp-operations"}]}:{Icon:l.createElement(t.ShippingTruck,null),moduleName:e("ES_TITLE_FAECAL_SLUDGE_MGMT"),kpis:[{count:p,label:e("TOTAL_FSM"),link:"/digit-ui/employee/fsm/inbox"},{label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/fsm/inbox"}],links:[{count:p,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/fsm/inbox"},...T,...f]};return l.createElement(t.EmployeeModuleCard,s({},g,{FsmHideCount:!0}))},FSMModule:e=>{let{stateCode:n,userType:i,tenants:o}=e;const{path:r,url:u}=a.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:d}=Digit.Services.useStore({stateCode:n,moduleCode:"FSM",language:s});return d?l.createElement(t.Loader,null):(Digit.SessionStorage.set("FSM_TENANTS",o),"citizen"===i?l.createElement(fe,{path:r}):l.createElement(Ze,{path:r,url:u,userType:i}))},FSMLinks:e=>{let{matchPath:o,userType:r}=e;const{t:u}=i.useTranslation(),[s]=Digit.Hooks.useSessionStorage("FSM_CITIZEN_FILE_PROPERTY",{});n.useEffect(()=>"employee"===r&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]);const d=[{role:"FSM_DSO",from:"/digit-ui/citizen/fsm/dso-dashboard",dashoardLink:"CS_LINK_DSO_DASHBOARD",loginLink:"CS_LINK_LOGIN_DSO"}];if("citizen"===r){const e=[{link:o+"/new-application",i18nKey:u("CS_HOME_APPLY_FOR_DESLUDGING")},{link:o+"/my-applications",i18nKey:u("CS_HOME_MY_APPLICATIONS")}];return d.forEach(t=>{let{role:n,from:l,loginLink:i,dashoardLink:a}=t;Digit.UserService.hasAccess(n)?e.push({link:l,i18nKey:u(a)}):e.push({link:"/digit-ui/citizen/login",state:{role:"FSM_DSO",from:l},i18nKey:u(i)})}),l.createElement(t.CitizenHomeCard,{header:u("CS_HOME_FSM_SERVICES"),links:e,Icon:t.CitizenTruck})}return l.createElement("div",{className:"employee-app-container"},l.createElement("div",{className:"ground-container"},l.createElement("div",{className:"employeeCard"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"}))),l.createElement("span",{className:"text"},u("ES_TITLE_FSM"))),l.createElement("div",{className:"body"},l.createElement("span",{className:"link"},l.createElement(a.Link,{to:o+"/inbox"},u("ES_TITLE_INBOX"))),l.createElement("span",{className:"link"},l.createElement(a.Link,{to:o+"/new-application/"},u("ES_TITLE_NEW_DESULDGING_APPLICATION"))))))))},SelectChannel:e=>{let{t:i,config:o,onSelect:r,formData:u={}}=e;const s=Digit.ULBService.getCurrentTenantId(),{pathname:d}=a.useLocation(),c=d.includes("/modify-application/"),{data:p}=Digit.Hooks.fsm.useMDMS(s,"FSM","EmployeeApplicationChannel"),[m,v]=n.useState(null==u?void 0:u.channel);return p?l.createElement(t.Dropdown,{option:p,optionKey:"i18nKey",id:"channel",selected:m,select:function(e){v(e),r(o.key,e)},t:i,disable:c,autoFocus:!c}):l.createElement(t.Loader,null)},SelectName:e=>{let{t:i,config:o,onSelect:r,formData:u={},errors:d}=e;const c=Digit.ULBService.getStateId(),{data:p,isLoading:m}=Digit.Hooks.fsm.useMDMS(c,"common-masters","FSMGenderType"),{pathname:v}=a.useLocation(),E=v.includes("/modify-application/"),[_,S]=n.useState(""),[f,y]=n.useState([]),[T,g]=n.useState(""),h=[{label:"ES_NEW_APPLICATION_APPLICANT_NAME",type:"text",name:"applicantName",validation:{isRequired:!0,pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$",title:i("CORE_COMMON_APPLICANT_NAME_INVALID")},isMandatory:!0},{label:"ES_NEW_APPLICATION_APPLICANT_MOBILE_NO",type:"text",name:"mobileNumber",validation:{isRequired:!0,pattern:"[6-9]{1}[0-9]{9}",type:"tel",title:i("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID")},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),isMandatory:!0},{label:"ES_NEW_APPLICATION_MAIL_ID",type:"text",name:"emailId",validation:{pattern:"/^[a-zA-Z0-9._%+-]+@[a-z.-]+.(com|org|in)$/",title:i("CORE_COMMON_EMAIL_ID_INVALID")},isMandatory:!1}];function I(e){S(e),r(o.key,{...u[o.key],applicantGender:e.code})}return n.useEffect(()=>{!m&&p&&y(p)},[p]),l.createElement("div",null,null==h?void 0:h.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},"text"===e.type&&l.createElement(l.Fragment,null,d[e.name]&&l.createElement(t.CardLabelError,null,i(e.error)),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field",style:{display:"flex"}},e.componentInFront?e.componentInFront:null,l.createElement(t.TextInput,s({key:e.name,value:u&&u[o.key]?u[o.key][e.name]:null,onChange:t=>((e,t)=>{"emailId"===t&&(/^[a-zA-Z0-9._%+-]+@[a-z.-]+\.(com|org|in)$/.test(e)?g(""):g(i("CORE_INVALID_EMAIL_ID_PATTERN"))),r(o.key,{...u[o.key],[t]:e})})(t.target.value,e.name),disable:E},e.validation)))),"emailId"===e.name&&T&&l.createElement(t.CardLabelError,{style:{color:"red"}},T)),"dropdown"===e.type&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{option:null===(a=e.options)||void 0===a?void 0:a.sort((e,t)=>e.code.localeCompare(t.code)),optionKey:"i18nKey",id:"dropdown",selected:u&&u[o.key]?e.options.find(t=>t.code===u[o.key][e.name]):null,select:I,t:i,disable:E,autoFocus:!E}))))}))},SelectTripData:e=>{var i,o,r,u,d,c,p,m,v,E,_;let{t:S,config:f,onSelect:y,formData:T={}}=e;const g=Digit.ULBService.getCurrentTenantId(),h=Digit.ULBService.getStateId(),{pathname:I}=a.useLocation();I.includes("/modify-application/");let{id:C}=a.useParams();const N=Digit.UserService.getUser(),{pathname:A}=(Digit.Hooks.fsm.useSearch(g,{applicationNos:C,uuid:N.uuid},{staleTime:Infinity}),a.useLocation()),[D,O]=(A.includes("modify"),n.useState({label:null==T||null===(i=T.tripData)||void 0===i?void 0:i.vehicleCapacity})),[L,P]=n.useState(!1),{isLoading:b,data:R}=Digit.Hooks.fsm.useMDMS(h,"Vehicle","VehicleType",{staleTime:Infinity}),{data:M,isLoading:k}=Digit.Hooks.fsm.useDsoSearch(g,{limit:-1,status:"ACTIVE"}),[w,F]=n.useState([]);n.useEffect(()=>{if(M&&R){const e=M.reduce((e,t)=>t.vehicles&&t.vehicles.length?e.concat(t.vehicles):e,[]),t=Array.from(new Set(e.map(e=>e.capacity))).map(t=>e.find(e=>e.capacity===t));F(t)}},[M,R]);const x=[{label:"ES_NEW_APPLICATION_AMOUNT_PER_TRIP",type:"text",name:"amountPerTrip",error:S("ES_NEW_APPLICATION_AMOUNT_INVALID"),validation:{isRequired:!0,pattern:"[0-9]{1,10}",title:S("ES_APPLICATION_BILL_SLAB_ERROR")},default:null==T||null===(o=T.tripData)||void 0===o?void 0:o.amountPerTrip,disable:"FROM_GRAM_PANCHAYAT"!==(null==T||null===(r=T.address)||void 0===r||null===(u=r.propertyLocation)||void 0===u?void 0:u.code),isMandatory:!0},{label:"ES_PAYMENT_DETAILS_TOTAL_AMOUNT",type:"text",name:"amount",validation:{isRequired:!0,title:S("ES_APPLICATION_BILL_SLAB_ERROR")},default:null==T||null===(d=T.tripData)||void 0===d?void 0:d.amount,disable:!0,isMandatory:!0}];function H(e){let t={...T[f.key],...e};console.log("config.key",f.key,t),y(f.key,t)}return n.useEffect(()=>{!function(){try{var e,t,n;(null==T||null===(e=T.tripData)||void 0===e?void 0:e.vehicleType)!==D&&O({label:null==T||null===(t=T.tripData)||void 0===t||null===(n=t.vehicleType)||void 0===n?void 0:n.capacity});const l=function(e,t,n,l,i,a){if(null!=T&&T.propertyType&&null!=T&&T.subtype&&null!=T&&T.address&&null!=T&&null!==(e=T.tripData)&&void 0!==e&&null!==(t=e.vehicleType)&&void 0!==t&&t.capacity&&"WITHIN_ULB_LIMITS"===(null==T||null===(n=T.address)||void 0===n||null===(l=n.propertyLocation)||void 0===l?void 0:l.code)){var o;const e=null==T||null===(o=T.tripData)||void 0===o?void 0:o.vehicleType.capacity,{slum:t}=T.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(g,{propertyType:null==T?void 0:T.subtype,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;console.log("billingDetails",e);const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]);null!=n&&n.price||0===(null==n?void 0:n.price)?(H({amountPerTrip:n.price,amount:n.price*T.tripData.noOfTrips}),P(!1)):(H({amountPerTrip:"",amount:""}),P(!0))})}"FROM_GRAM_PANCHAYAT"===(null==T||null===(i=T.address)||void 0===i||null===(a=i.propertyLocation)||void 0===a?void 0:a.code)&&T.tripData.noOfTrips&&T.tripData.amountPerTrip&&H({amount:T.tripData.amountPerTrip*T.tripData.noOfTrips})}();l&&l.then&&l.then(function(){})}catch(e){Promise.reject(e)}}()},[null==T?void 0:T.propertyType,null==T?void 0:T.subtype,null==T||null===(c=T.address)||void 0===c?void 0:c.slum,null==T||null===(p=T.tripData)||void 0===p||null===(m=p.vehicleType)||void 0===m?void 0:m.capacity,(null==T||null===(v=T.tripData)||void 0===v?void 0:v.noOfTrips)&&(null==T||null===(E=T.address)||void 0===E||null===(_=E.propertyLocation)||void 0===_?void 0:_.code)]),b&&k?l.createElement(t.Loader,null):l.createElement("div",null,null==x?void 0:x.map((e,n)=>l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},S(e.label)+" (₹)",e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({type:e.type,onChange:e=>{var t,l;return 0===n&&"FROM_GRAM_PANCHAYAT"===(null===(t=T.address.propertyLocation)||void 0===t?void 0:t.code)?void y(f.key,{...T[f.key],amountPerTrip:l=e.target.value,amount:l*T.tripData.noOfTrips}):function(e){y(f.key,{...T[f.key],noOfTrips:e})}(e.target.value)},key:e.name,value:e.default?e.default:T&&T[f.key]?T[f.key][e.name]:null},e.validation,{disable:e.disable}))))),L?l.createElement(t.CardLabelError,{style:{width:"100%",textAlign:"center"}},S("ES_APPLICATION_BILL_SLAB_ERROR")):null)},SelectGender:e=>{let{config:i,onSelect:a,t:o,userType:r,formData:u}=e;Digit.ULBService.getCurrentTenantId();const s=Digit.ULBService.getStateId(),{data:d,isLoading:c}=Digit.Hooks.fsm.useMDMS(s,"common-masters","FSMGenderType"),[p,v]=n.useState(null==u?void 0:u.genderType);n.useEffect(()=>{if(!c&&d){const e=d.filter(e=>{var t;return e.code===((null==u||null===(t=u.selectGender)||void 0===t?void 0:t.code)||(null==u?void 0:u.selectGender))})[0];v(e)}},[null==u?void 0:u.selectGender,d]);const E=e=>{v(e),"employee"===r&&(a(i.key,e),a("genderDetail",null))};return c?l.createElement(t.Loader,null):"employee"===r?l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,o(i.label)),l.createElement(t.Dropdown,{className:"payment-form-text-input-correction",isMandatory:i.isMandatory,selected:p,option:null==d?void 0:d.sort((e,t)=>e.code.localeCompare(t.code)),select:E,optionKey:"i18nKey",disable:i.disable,t:o})):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:2,flow:"APPLY"}),l.createElement(t.FormStep,{config:i,onSelect:()=>{a(i.key,p)},onSkip:()=>{a()},isDisabled:!p,t:o},l.createElement(t.RadioOrSelect,{options:null==d?void 0:d.sort((e,t)=>e.code.localeCompare(t.code)),selectedOption:p,optionKey:"i18nKey",onSelect:E,t:o,isMandatory:i.isMandatory})))},SelectPaymentType:e=>{var i;let{t:o,config:r,onSelect:u,formData:s={}}=e;const d=Digit.ULBService.getStateId(),{data:c,isLoading:p}=Digit.Hooks.fsm.useMDMS(d,"FSM","PaymentType"),{pathname:m}=a.useLocation(),v=m.includes("/modify-application/"),[E,_]=n.useState(null),[S,f]=n.useState(),y=[{label:"Payment Preference",type:"RadioButton",name:"paymentPreference",options:c,isMandatory:!1}];function T(e){_(e),u(r.key,e.code)}return n.useEffect(()=>{if(!p&&c){const e=c.filter(e=>{var t;return e.code===((null==s||null===(t=s.paymentPreference)||void 0===t?void 0:t.code)||(null==s?void 0:s.paymentPreference))})[0];_(e||c.find(e=>"POST_PAY"===e.code))}},[s,null==s||null===(i=s.paymentPreference)||void 0===i?void 0:i.code,null==s?void 0:s.paymentPreference,c]),n.useEffect(()=>{if(null!=s&&s.address){const{slum:e}=s.address;f(!!e)}},[s]),l.createElement("div",null,null==y?void 0:y.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},0!==(null==s||null===(i=s.tripData)||void 0===i?void 0:i.amountPerTrip)&&"RadioButton"===e.type&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},o(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{selectedOption:E,onSelect:T,style:{display:"flex",marginBottom:0},innerStyles:{marginLeft:"10px"},options:e.options,optionsKey:"i18nKey",disabled:v}))))}))},SelectPaymentPreference:e=>{var i,a,o,r,u,d,c,p;let{config:v,formData:E,t:_,onSelect:S,userType:f}=e;const y=Digit.ULBService.getCitizenCurrentTenant(),[T,g]=(Digit.ULBService.getStateId(),n.useState(null)),[h,I]=n.useState(null),[C,N]=n.useState(null),[A,D]=n.useState(!1),O=[{label:"ES_NEW_APPLICATION_ADVANCE_COLLECTION",type:"number",name:"advanceAmount",validation:{isRequired:!0},disable:!0,default:null==E||null===(i=E.selectPaymentPreference)||void 0===i?void 0:i.advanceAmount,isMandatory:!0}],L=()=>{S(v.key,{advanceAmount:h})};if(n.useEffect(()=>{!function(){try{const e=function(e,t,n){if(null!=E&&E.propertyType&&null!=E&&E.subtype&&null!=E&&E.address&&null!=E&&null!==(e=E.selectTripNo)&&void 0!==e&&e.vehicleCapacity.capacity&&"WITHIN_ULB_LIMITS"===(null==E||null===(t=E.address)||void 0===t||null===(n=t.propertyLocation)||void 0===n?void 0:n.code)){var l,i,a,o,r,u;const e=null==E||null===(l=E.selectTripNo)||void 0===l?void 0:l.vehicleCapacity.capacity,{slum:t}=E.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(y===(null==E||null===(i=E.address)||void 0===i||null===(a=i.city)||void 0===a?void 0:a.code)?y:null==E||null===(o=E.address)||void 0===o||null===(r=o.city)||void 0===r?void 0:r.code,{propertyType:null==E||null===(u=E.subtype)||void 0===u?void 0:u.code,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]);Digit.SessionStorage.set("amount_per_trip",n.price);const l=function(){if(null!=n&&n.price){var e,t,l,i,a,o;let r=n.price*(null==E||null===(e=E.selectTripNo)||void 0===e||null===(t=e.tripNo)||void 0===t?void 0:t.code);return Promise.resolve(Digit.FSMService.advanceBalanceCalculate(y===(null==E||null===(l=E.address)||void 0===l||null===(i=l.city)||void 0===i?void 0:i.code)?y:null==E||null===(a=E.address)||void 0===a||null===(o=a.city)||void 0===o?void 0:o.code,{totalTripAmount:r})).then(function(e){var t,n;let{advanceAmount:l}=e;I(l),N(r),Digit.SessionStorage.set("total_amount",r),Digit.SessionStorage.set("advance_amount",l),null!=E&&null!==(t=E.selectPaymentPreference)&&void 0!==t&&t.advanceAmount?g(Math.ceil(null==E||null===(n=E.selectPaymentPreference)||void 0===n?void 0:n.advanceAmount)):g(Math.ceil(l)),D(!1)})}0===(null==n?void 0:n.price)?(Digit.SessionStorage.set("total_amount",0),L()):(sessionStorage.removeItem("Digit.total_amount"),sessionStorage.removeItem("Digit.advance_amount"),D(!0))}();if(l&&l.then)return l.then(function(){})})}g(0),Digit.SessionStorage.set("advance_amount",0),Digit.SessionStorage.set("amount_per_trip",null)}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[null==E?void 0:E.propertyType,null==E?void 0:E.subtype,null==E?void 0:E.address,null==E||null===(a=E.selectTripNo)||void 0===a?void 0:a.vehicleCapacity.capacity,null==E||null===(o=E.selectTripNo)||void 0===o||null===(r=o.tripNo)||void 0===r?void 0:r.code]),"employee"===f)return null;let P=T,b=Digit.SessionStorage.get("total_amount"),R=Digit.SessionStorage.get("advance_amount");return null===T?l.createElement(t.Loader,null):(console.log("advance",T,C,h),l.createElement(l.Fragment,null,l.createElement(m,{currentStep:3,flow:"APPLY"}),l.createElement(t.FormStep,{config:v,onSelect:()=>{S(v.key,{advanceAmount:T})},onSkip:L,isDisabled:P>b||P<R,t:_},l.createElement(t.KeyNote,{keyValue:_("ADV_TOTAL_AMOUNT")+" (₹)",note:"FROM_GRAM_PANCHAYAT"===(null==E||null===(u=E.address)||void 0===u||null===(d=u.propertyLocation)||void 0===d?void 0:d.code)?"N/A":b}),"FROM_GRAM_PANCHAYAT"===(null==E||null===(c=E.address)||void 0===c||null===(p=c.propertyLocation)||void 0===p?void 0:p.code)&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},_("FSM_TOTAL_AMOUNT_NOTE")),l.createElement(t.KeyNote,{keyValue:_("FSM_ADV_MIN_PAY")+" (₹)",note:Math.ceil(R)}),null==O?void 0:O.map((e,n)=>l.createElement(l.Fragment,{key:n},l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,null,_(e.label)+" (₹)",e.isMandatory?" * ":null),l.createElement("div",null,l.createElement(t.TextInput,s({type:e.type,key:e.name,disable:!0,onChange:e=>{g(e.target.value)},value:T},e.validation)),P>b&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},_("FSM_ADVANCE_AMOUNT_MAX")),P<R&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},_("FSM_ADVANCE_AMOUNT_MIN")))))))))},FSMEmpInbox:e=>{var a,o,u,s,d,c,p,m;let{parentRoute:v,isSearch:E=!1,isInbox:_=!1}=e;const S=Digit.ULBService.getCurrentTenantId(),f=Digit.UserService.getUser().info.roles,y=Digit.UserService.hasAccess(["FSM_DSO"])||!1,T=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,{t:g}=i.useTranslation(),h=r.useQueryClient(),[I,C]=n.useState(!1),[N,A]=n.useState(0),[D,O]=n.useState(10),[L,P]=n.useState([{id:"createdTime",desc:!0}]),b=_?"fsm/inbox/searchParams":"fsm/search/searchParams",R=_?{applicationStatus:[],locality:[],uuid:y||T?{code:"ASSIGNED_TO_ME",name:g("ES_INBOX_ASSIGNED_TO_ME")}:{code:"ASSIGNED_TO_ALL",name:g("ES_INBOX_ASSIGNED_TO_ALL")}}:{},[M,k]=Digit.Hooks.useSessionStorage(b,R);n.useEffect(()=>{z(M)},[]);let w=window.Digit.Utils.browser.isMobile(),F=w?{limit:100,offset:0,sortBy:null==L||null===(a=L[0])||void 0===a?void 0:a.id,sortOrder:null!=L&&null!==(o=L[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:D,offset:N,sortBy:null==L||null===(u=L[0])||void 0===u?void 0:u.id,sortOrder:null!=L&&null!==(s=L[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const{data:x,isLoading:H,isIdle:V}=Digit.Hooks.fsm.useInbox(S,{...M,...F,fromDate:null!=M&&M.fromDate?new Date(null==M?void 0:M.fromDate).getTime():void 0,toDate:null!=M&&M.toDate?new Date(null==M?void 0:M.toDate).getTime():void 0},{enabled:_},!!y),B=y?(null==x||null===(d=x.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===d?void 0:d.count)+(null==x||null===(c=x.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===c?void 0:c.count):null==x?void 0:x.totalCount,{isLoading:U,data:{data:Y,totalCount:G}={}}=Digit.Hooks.fsm.useSearchAll(S,{limit:D,offset:N,...M,applicationStatus:null==M||null===(p=M.applicationStatus)||void 0===p?void 0:p.code,fromDate:null!=M&&M.fromDate?new Date(null==M?void 0:M.fromDate).getTime():void 0,toDate:null!=M&&M.toDate?new Date(null==M?void 0:M.toDate).getTime():void 0},null,{enabled:I&&E});n.useEffect(()=>{A(0)},[M]);const W=e=>{let t=e.delete,n={...M};t&&t.forEach(e=>delete n[e]),k({...n,...e})},K=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&P(e)},[]),z=function(e){var t;void 0===e&&(e={}),E?(0===(null===(t=Object.keys(e))||void 0===t?void 0:t.length)?(C(!1),h.resetQueries("FSM_CITIZEN_SEARCH")):C(!0),k({...e})):k(t=>{let{applicationStatus:n,locality:l,uuid:i}=t;return{applicationStatus:n,locality:l,uuid:i,...e}})},j=e=>E?[{label:g("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"},{label:g("ES_SEARCH_APPLICATION_MOBILE_NO"),name:"mobileNumber",maxlength:10,pattern:"[6-9][0-9]{9}",title:g("ES_SEARCH_APPLICATION_MOBILE_INVALID")},{label:g("ES_INBOX_STATUS"),name:"applicationStatus",type:"status"},{label:g("ES_SEARCH_FROM_DATE"),name:"fromDate",type:"date"},{label:g("ES_SEARCH_TO_DATE"),name:"toDate",type:"date"}]:e.find(e=>"FSM_EMP_FSTPO"===e.code)?[{label:g("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"},{label:g("ES_FSTP_OPERATOR_VEHICLE_NO"),name:"vehicleNo"},{label:g("ES_FSTP_DSO_NAME"),name:"name"}]:[{label:g("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"},{label:g("ES_SEARCH_APPLICATION_MOBILE_NO"),name:"mobileNumber",maxlength:10}];if(n.useEffect(()=>{var e;const t=["CITIZEN_FEEDBACK_PENDING"];null==x||null===(e=x.table)||void 0===e||e.map(e=>{t.includes(e.status)&&(e.sla="-")})},[x]),null!==(null==x||null===(m=x.table)||void 0===m?void 0:m.length))return w?l.createElement("div",null,!E&&l.createElement(t.Header,null,g("ES_COMMON_INBOX")),l.createElement(Xe,{data:_?x:Y,isLoading:_?H||V:U,isSearch:E,searchFields:j(f),onFilterChange:W,onSearch:z,onSort:K,parentRoute:v,searchParams:M,sortParams:L,removeParam:function(e){void 0===e&&(e={});const t={...M};Object.keys(e).forEach(e=>delete t[e]),k(t)},linkPrefix:`${v}/${y?"dso-application-details":"application-details"}/`})):l.createElement("div",null,!E&&l.createElement(t.Header,null,g("ES_COMMON_INBOX"),Number(B)?l.createElement("p",{className:"inbox-count"},Number(B)):null),l.createElement(We,{data:_?x:Y,isLoading:_?H||V:U,isSearch:E,shouldSearch:I,onFilterChange:W,searchFields:j(f),onSearch:z,onSort:K,onNextPage:()=>{A(e=>e+D)},onPrevPage:()=>{A(e=>e-D)},currentPage:Math.floor(N/D),pageSizeLimit:D,disableSort:!1,searchParams:M,onPageSizeChange:e=>{O(Number(e.target.value))},parentRoute:v,paginationParms:F,sortParams:L,totalRecords:_?Number(B):G}))},FSMFstpInbox:()=>{var e,a,o,r,u,s,d,c,p,m;const{t:v}=i.useTranslation(),E=Digit.ULBService.getCurrentTenantId(),[_,S]=n.useState({applicationStatus:"WAITING_FOR_DISPOSAL"}),[f,y]=n.useState([{id:"createdTime",desc:!0}]),[T,g]=n.useState(0),[h,I]=n.useState(10),{data:C}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:E,filters:{registrationNumber:null==_?void 0:_.registrationNumber},config:{enabled:(null==_||null===(e=_.registrationNumber)||void 0===e?void 0:e.length)>0}}),N=Digit.UserService.getUser();let A=window.Digit.Utils.browser.isMobile(),D=A?{limit:100,offset:0,sortOrder:null!=f&&null!==(a=f[0])&&void 0!==a&&a.desc?"DESC":"ASC"}:{limit:h,offset:T,sortOrder:null!=f&&null!==(o=f[0])&&void 0!==o&&o.desc?"DESC":"ASC"};const{data:O}=Digit.Hooks.fsm.useSearch(E,{applicationNos:null==_?void 0:_.refernceNos,uuid:N.uuid},{staleTime:Infinity}),{data:L}=Digit.Hooks.fsm.useDsoSearch(E,{name:null==_?void 0:_.name,status:"ACTIVE"},{enabled:(null==_||null===(r=_.name)||void 0===r?void 0:r.length)>1});let P={businessService:"FSM_VEHICLE_TRIP",refernceNos:void 0!==O&&(null==_||null===(u=_.refernceNos)||void 0===u?void 0:u.length)>0?(null==O?void 0:O.applicationNo)||"null":"",vehicleIds:void 0!==C&&(null==_||null===(s=_.registrationNumber)||void 0===s?void 0:s.length)>0?(null==C||null===(d=C.vehicle)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.id)||"null":"",tripOwnerIds:void 0!==L&&(null==_||null===(p=_.name)||void 0===p?void 0:p.length)>0?(null==L||null===(m=L[0])||void 0===m?void 0:m.ownerId)||"null":"",applicationStatus:null==_?void 0:_.applicationStatus,...D};null==O&&(P={responseInfo:{apiId:"Rainmaker",ver:null,ts:null,resMsgId:"uief87324",msgId:"1645827148736|en_IN",status:"successful"},vehicle:[],totalCount:0});const{isLoading:b,data:{totalCount:R,vehicleLog:M}={}}=Digit.Hooks.fsm.useVehicleSearch({tenantId:E,filters:P,config:dt,options:{searchWithDSO:!0}}),k=function(e){void 0===e&&(e={}),S({applicationStatus:"WAITING_FOR_DISPOSAL",...e})},w=()=>{},F=[{label:v("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"refernceNos"},{label:v("ES_FSTP_OPERATOR_VEHICLE_NO"),name:"registrationNumber"},{label:v("ES_FSTP_DSO_NAME"),name:"name"}],x=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&y(e)},[]);return A?l.createElement("div",null,l.createElement(t.Header,null,v("ES_COMMON_INBOX")),l.createElement(Xe,{onFilterChange:w,vehicleLog:M,isLoading:b,userRole:"FSM_EMP_FSTPO",linkPrefix:"/digit-ui/employee/fsm/fstp-operator-details/",onSearch:k,searchFields:F,onSort:x,sortParams:f})):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"20px"}},l.createElement(t.Header,null,v("ES_COMMON_INBOX"))),l.createElement(We,{data:{table:M},isLoading:b,onSort:x,disableSort:!1,sortParams:f,userRole:"FSM_EMP_FSTPO",onFilterChange:w,searchFields:F,onSearch:k,onNextPage:()=>{g(e=>e+h)},onPrevPage:()=>{g(e=>e-h)},currentPage:Math.floor(T/h),pageSizeLimit:h,onPageSizeChange:e=>{I(Number(e.target.value))},totalRecords:R||0}))},FSMNewApplicationEmp:e=>{const o=Digit.ULBService.getCurrentTenantId(),r=Digit.ULBService.getStateId(),{isLoading:u}=Digit.Hooks.fsm.useMDMS(r,"FSM","CommonFieldsConfig"),{isLoading:s}=Digit.Hooks.fsm.useMDMS(r,"FSM","PreFieldsConfig"),{isLoading:d}=Digit.Hooks.fsm.useMDMS(r,"FSM","PostFieldsConfig"),[c,p,m]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[v,E,_]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[S,f,y]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{p(!1),y(),_()},[]);const{t:T}=i.useTranslation(),g=a.useHistory(),[h,I]=n.useState(!1);if(u||d||s)return l.createElement(t.Loader,null);let C=[{head:"ES_NEW_APPLICATION_PROPERTY_DETAILS",body:[{label:"ES_NEW_APPLICATION_PROPERTY_ID",isMandatory:!0,component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0},{label:"ES_NEW_APPLICATION_PROPERTY_TYPE",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"}]},{head:"ES_TITLE_APPLICANT_DETAILS",body:[{label:"ES_NEW_APPLICATION_APPLICATION_CHANNEL",isMandatory:!0,type:"component",key:"channel",component:"SelectChannel",nextStep:"applicantName"},{type:"component",key:"applicationData",withoutLabel:!0,component:"SelectName"}]},{head:"ES_NEW_APPLICATION_LOCATION_DETAILS",body:[{route:"address",component:"FSMSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"locality-gramPanchayat",isMandatory:!0,type:"component"},{route:"locality-gramPanchayat",component:"SelectLocalityOrGramPanchayat",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"select-trip-number",isMandatory:!0,type:"component"},{route:"pincode",component:"FSMSelectPincode",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_FILE_APPLICATION_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"check-slum",type:"component"},{type:"component",route:"check-slum",isMandatory:!0,component:"CheckSlum",texts:{header:"ES_NEW_APPLICATION_SLUM_CHECK",submitBarLabel:"CS_COMMON_NEXT"},key:"address",withoutLabel:!0,nextStep:"slum-details",hideInEmployee:!0},{type:"component",route:"slum-details",isMandatory:!0,component:"SelectSlumName",texts:{header:"CS_NEW_APPLICATION_SLUM_NAME",cardText:"CS_NEW_APPLICATION_SLUM_TEXT",submitBarLabel:"CS_COMMON_NEXT"},withoutLabel:!0,key:"address",nextStep:"street"},{type:"component",route:"street",component:"FSMSelectStreet",key:"address",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_STREET_DOOR_NO_LABEL",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"landmark"},{type:"component",route:"landmark",component:"FSMSelectLandmark",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},key:"address",nextStep:"pit-type"}]},{head:"CS_CHECK_PIT_SEPTIC_TANK_DETAILS",body:[{label:"ES_NEW_APPLICATION_ROAD_WIDTH",isMandatory:!0,type:"component",route:"road-details",key:"roadWidth",hideInEmployee:!0,component:"SelectRoadDetails",texts:{header:"CS_FILE_PROPERTY_ROAD_WIDTH",cardText:"CS_FILE_PROPERTY_ROAD_WIDTH_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!0,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"road-details"},{route:"tank-size",component:"SelectTankSize",isMandatory:!1,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},type:"component",key:"pitDetail",nextStep:"select-payment-preference",label:"ES_NEW_APPLICATION_PIT_DIMENSION"},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTrips"}]},{head:"CS_FILE_ADDITIONAL_DETAILS",hideInEmployee:!0,body:[{label:"a",isMandatory:!0,type:"component",route:"select-trip-number",key:"selectTripNo",component:"SelectTripNo",hideInEmployee:!0,texts:{headerCaption:"",header:"ES_FSM_SERVICE_REQUEST",cardText:"ES_FSM_SERVICE_REQUEST_TEXT",skipText:"CORE_COMMON_SKIP_CONTINUE",submitBarLabel:"CS_COMMON_NEXT",skipLabel:"CS_COMMON_SERVICE_SKIP_INFO"},nextStep:"property-id"},{label:"a",isMandatory:!1,type:"component",route:"select-gender",hideInEmployee:!0,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"select-payment-preference"},{label:"a",isMandatory:!1,type:"component",route:"select-payment-preference",key:"selectPaymentPreference",hideInEmployee:!0,component:"SelectPaymentPreference",texts:{headerCaption:"",header:"ES_FSM_PAYMENT_PREFERENCE_LABEL",cardText:"ES_FSM_PAYMENT_PREFERENCE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:null}]},{head:"ES_TITLE_PAYMENT_DETAILS",body:[{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTripData"},{type:"component",key:"advancepaymentPreference",withoutLabel:!0,component:"AdvanceCollection"}]}];return console.log(C,"confffffffff"),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(t.Header,null,T("ES_TITLE_NEW_DESULDGING_APPLICATION"))),l.createElement(t.FormComposer,{isDisabled:!h,label:T("ES_COMMON_APPLICATION_SUBMIT"),config:C.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},formCardStyle:!0,onSubmit:e=>{var t,n,l,i,a,r,u,s,d,c,p,m,v,E,_,S,f,y,T,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y,G,W,K,z,j;console.log("data",e);const X=e.channel,$=null==e||null===(t=e.pitType)||void 0===t?void 0:t.code,q=null==e?void 0:e.pitDetail,Z=e.applicationData.applicantName,Q=e.applicationData.mobileNumber,J=e.applicationData.emailId,ee=null==e||null===(n=e.address)||void 0===n?void 0:n.pincode,te=null==e||null===(l=e.address)||void 0===l||null===(i=l.street)||void 0===i?void 0:i.trim(),ne=null==e||null===(a=e.address)||void 0===a||null===(r=a.doorNo)||void 0===r?void 0:r.trim(),le=null==e||null===(u=e.address)||void 0===u?void 0:u.slum,ie=null==e||null===(s=e.address)||void 0===s||null===(d=s.landmark)||void 0===d?void 0:d.trim(),ae=null==e||null===(c=e.tripData)||void 0===c?void 0:c.noOfTrips,oe=e.tripData.amount||(null==e||null===(p=e.tripData)||void 0===p||null===(m=p.undefined)||void 0===m?void 0:m.amount),re=null==e||null===(v=e.address)||void 0===v||null===(E=v.city)||void 0===E?void 0:E.code,ue=null==e||null===(_=e.address)||void 0===_||null===(S=_.city)||void 0===S?void 0:S.name,se=null==e||null===(f=e.address)||void 0===f||null===(y=f.city)||void 0===y?void 0:y.state,de=(null===(T=e.cpt)||void 0===T||null===(h=T.details)||void 0===h||null===(I=h.address)||void 0===I||null===(C=I.locality)||void 0===C?void 0:C.code)||(null==e||null===(N=e.address)||void 0===N||null===(A=N.locality)||void 0===A?void 0:A.code),ce=(null===(D=e.cpt)||void 0===D||null===(O=D.details)||void 0===O||null===(L=O.address)||void 0===L||null===(P=L.locality)||void 0===P?void 0:P.name)||(null==e||null===(b=e.address)||void 0===b||null===(R=b.locality)||void 0===R?void 0:R.name),pe=0===oe?null:null!=e&&e.paymentPreference?null==e?void 0:e.paymentPreference:null,me=0===oe?null:null===(null==e||null===(M=e.advancepaymentPreference)||void 0===M?void 0:M.advanceAmount)?0:null==e||null===(k=e.advancepaymentPreference)||void 0===k?void 0:k.advanceAmount,ve=null==e||null===(w=e.tripData)||void 0===w?void 0:w.distancefromroad,Ee=null==e||null===(F=e.tripData)||void 0===F?void 0:F.roadWidth,_e=null==e?void 0:e.address.gramPanchayat,Se=null==e?void 0:e.address.village,fe=null==e||null===(x=e.address)||void 0===x||null===(H=x.propertyLocation)||void 0===H?void 0:H.code,ye=null==e||null===(V=e.address)||void 0===V?void 0:V.newLocality,Te=null==e||null===(B=e.address)||void 0===B?void 0:B.newGp,ge=null==e||null===(U=e.address)||void 0===U?void 0:U.newVillage,he={fsm:{citizen:{name:Z,mobileNumber:Q,gender:e.applicationData.applicantGender,emailId:J},tenantId:o,sanitationtype:$,source:X.code,additionalDetails:{tripAmount:"number"==typeof oe?JSON.stringify(oe):oe,distancefromroad:ve,roadWidth:Ee,propertyID:null==e||null===(Y=e.cpt)||void 0===Y||null===(G=Y.details)||void 0===G?void 0:G.propertyId},propertyUsage:null==e?void 0:e.subtype,vehicleCapacity:null==e||null===(W=e.tripData)||void 0===W||null===(K=W.vehicleType)||void 0===K?void 0:K.capacity,pitDetail:{...q,distanceFromRoad:null==e?void 0:e.distanceFromRoad},address:{tenantId:re,landmark:ie,doorNo:ne,street:te,city:ue,state:se,pincode:ee,slumName:le,locality:{code:"FROM_GRAM_PANCHAYAT"===fe?null==_e?void 0:_e.code:de,name:"FROM_GRAM_PANCHAYAT"===fe?null==_e?void 0:_e.name:ce},geoLocation:{latitude:null==e||null===(z=e.address)||void 0===z?void 0:z.latitude,longitude:null==e||null===(j=e.address)||void 0===j?void 0:j.longitude},additionalDetails:{boundaryType:"FROM_GRAM_PANCHAYAT"===fe?"GP":"Locality",gramPanchayat:{code:null==_e?void 0:_e.code,name:null==_e?void 0:_e.name},village:null!=Se&&Se.code?{code:null!=Se&&Se.code?null==Se?void 0:Se.code:"",name:null!=Se&&Se.name?null==Se?void 0:Se.name:""}:ge,newLocality:ye,newGramPanchayat:Te}},noOfTrips:ae,paymentPreference:pe,advanceAmount:"number"==typeof me?JSON.stringify(me):me},workflow:null};window.Digit.SessionStorage.set("propertyType",null),window.Digit.SessionStorage.set("subType",null),Digit.SessionStorage.set("city_property",null),Digit.SessionStorage.set("selected_localities",null),Digit.SessionStorage.set("locality_property",null),g.push("/digit-ui/employee/fsm/response",he)},defaultValues:{tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var n,l,i,a,o,r,u,s,d,c,p,m,v,E,_,S;if(console.log("ProID",t),void 0!==(null==t?void 0:t.pitType)&&null!=t&&null!==(n=t.tripData)&&void 0!==n&&n.vehicleType&&void 0!==(null==t||null===(l=t.tripData)||void 0===l?void 0:l.roadWidth)&&void 0!==(null==t||null===(i=t.tripData)||void 0===i?void 0:i.distancefromroad)&&null!=t&&t.propertyType&&null!=t&&t.subtype&&null!=t&&null!==(a=t.address)&&void 0!==a&&null!==(o=a.locality)&&void 0!==o&&o.code||null!=t&&null!==(r=t.cpt)&&void 0!==r&&null!==(u=r.details)&&void 0!==u&&null!==(s=u.address)&&void 0!==s&&null!==(d=s.locality)&&void 0!==d&&d.code&&null!=t&&null!==(c=t.tripData)&&void 0!==c&&c.vehicleType&&null!=t&&t.channel&&null!=t&&t.pitType&&null!=t&&null!==(p=t.tripData)&&void 0!==p&&p.roadWidth&&null!=t&&null!==(m=t.tripData)&&void 0!==m&&m.distancefromroad&&null!=t&&null!==(v=t.address)&&void 0!==v&&v.street&&null!=t&&null!==(E=t.address)&&void 0!==E&&E.doorNo&&(null!=t&&null!==(_=t.tripData)&&void 0!==_&&_.amountPerTrip||0===(null==t||null===(S=t.tripData)||void 0===S?void 0:S.amountPerTrip))){var f,y,T,g;console.log("formDataformData",t),I(!0);const e=null!=t&&t.pitDetail?Object.values(null==t?void 0:t.pitDetail).filter(e=>e>0):null;let n=Digit.SessionStorage.get("total_amount"),l=Digit.SessionStorage.get("advance_amount");var h,C;null!=t&&t.pitType&&(null===e||0===(null==e?void 0:e.length)||vt(null==t||null===(h=t.pitType)||void 0===h?void 0:h.dimension)&&(null==e?void 0:e.length)>=3||!vt(null==t||null===(C=t.pitType)||void 0===C?void 0:C.dimension)&&(null==e?void 0:e.length)>=2?I(!0):I(!1)),0!==(null==t||null===(f=t.tripData)||void 0===f?void 0:f.amountPerTrip)&&((null==t||null===(y=t.advancepaymentPreference)||void 0===y?void 0:y.advanceAmount)<l||(null==t||null===(T=t.advancepaymentPreference)||void 0===T?void 0:T.advanceAmount)>n||""===(null==t||null===(g=t.advancepaymentPreference)||void 0===g?void 0:g.advanceAmount))&&I(!1)}else I(!1)},noBreakLine:!0,fms_inline:!0}))},FSMEditApplication:e=>{const t=Digit.ULBService.getCurrentTenantId(),n=Digit.ULBService.getStateId();let{id:i}=a.useParams();const o=Digit.UserService.getUser(),{isLoading:r,data:u}=Digit.Hooks.fsm.useSearch(t,{applicationNos:i,uuid:o.uuid},{staleTime:Infinity}),{isLoading:s,data:d}=Digit.Hooks.fsm.useMDMS(n,"Vehicle","VehicleType",{staleTime:Infinity}),{isLoading:c,data:p}=Digit.Hooks.fsm.useMDMS(t,"FSM","ApplicationChannel"),{data:m,isLoading:v}=Digit.Hooks.fsm.useMDMS(n,"FSM","PitType");return u&&!r&&d&&!s&&p&&!c&&!v&&m?l.createElement(st,{applicationData:u,vehicleMenu:d,channelMenu:p,sanitationMenu:m,tenantId:t}):null},FSMEmployeeApplicationDetails:e=>{var o,u,s,d,c,p,m,v,E,_,S,f,y,T,g,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y,G;const W=Digit.ULBService.getCurrentTenantId(),K=Digit.ULBService.getStateId(),{t:z}=i.useTranslation(),j=a.useHistory(),X=r.useQueryClient();let{id:$}=a.useParams();const[q,Z]=n.useState(!1),[Q,J]=n.useState(null),[ee,te]=n.useState(!1),[ne,le]=n.useState(null),[ie,ae]=n.useState(null),[oe,re]=n.useState(!1),{isLoading:ue,data:se}=Digit.Hooks.fsm.useApplicationDetail(z,W,$,{},"EMPLOYEE"),{isLoading:de,data:ce}=Digit.Hooks.fsm.useSearch(W,{applicationNos:$},{staleTime:Infinity}),{mutate:pe}=Digit.Hooks.fsm.useApplicationActions(W),me=Digit.Hooks.useWorkflowDetails({tenantId:(null==se?void 0:se.tenantId)||W,id:$,moduleCode:"POST_PAY"===(null==ce?void 0:ce.paymentPreference)?"FSM_POST_PAY_SERVICE":0===(null==ce?void 0:ce.advanceAmount)?"PAY_LATER_SERVICE":(null==ce?void 0:ce.advanceAmount)>0?"FSM_ADVANCE_PAY_SERVICE":null===(null==ce?void 0:ce.paymentPreference)&&0===(null==ce||null===(o=ce.additionalDetails)||void 0===o?void 0:o.tripAmount)&&null===(null==ce?void 0:ce.advanceAmount)?"FSM_ZERO_PAY_SERVICE":"FSM",role:"FSM_EMPLOYEE",serviceData:se,getTripData:!0});function ve(e){J(e),Z(!1)}n.useEffect(()=>{ne&&me.revalidate()},[ne]),n.useEffect(()=>{switch(Q){case"SCHEDULE":case"DSO_ACCEPT":case"ACCEPT":case"ASSIGN":case"GENERATE_DEMAND":case"FSM_GENERATE_DEMAND":case"REASSIGN":case"COMPLETE":case"COMPLETED":case"CANCEL":case"SENDBACK":case"DSO_REJECT":case"REJECT":case"DECLINE":case"REASSING":case"UPDATE":return te(!0);case"SUBMIT":case"FSM_SUBMIT":return j.push("/digit-ui/employee/fsm/modify-application/"+$);case"PAY":case"FSM_PAY":case"ADDITIONAL_PAY_REQUEST":return j.push(`/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${$}?workflow=FSM`)}},[Q]);const Ee=()=>{J(null),te(!1)},_e=()=>{le(null)};function Se(e,t){ae(e)}const fe=e=>{var n;const i=null==e||null===(n=e.comment)||void 0===n?void 0:n.split("~"),o=i?i[0]:null,r=i?i[1]:null;if("CREATED"===e.status){var u,s,d;const t={date:null==e||null===(u=e.auditDetails)||void 0===u?void 0:u.created,name:null==e?void 0:e.assigner,mobileNumber:null==ce||null===(s=ce.citizen)||void 0===s?void 0:s.mobileNumber,emailId:null==ce||null===(d=ce.citizen)||void 0===d?void 0:d.emailId,source:(null==ce?void 0:ce.source)||""};return l.createElement(ge,{data:t})}if("PENDING_APPL_FEE_PAYMENT"===e.status||"DSO_REJECTED"===e.status||"CANCELED"===e.status||"REJECTED"===e.status){var c;const t={date:null==e||null===(c=e.auditDetails)||void 0===c?void 0:c.created,name:null==e?void 0:e.assigner,comment:o?z("ES_ACTION_REASON_"+o):null,otherComment:r||null};return l.createElement(ge,{data:t})}if("DSO_INPROGRESS"===e.status){var p;const t={name:null==e?void 0:e.assigner,mobileNumber:null==e||null===(p=e.assigner)||void 0===p?void 0:p.mobileNumber,date:`${z("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(null==ce?void 0:ce.possibleServiceDate)}`};return l.createElement(ge,{data:t})}if("COMPLETED"===e.status)return l.createElement("div",null,l.createElement(t.Rating,{withText:!0,text:z("ES_FSM_YOU_RATED"),currentRating:e.rating}),l.createElement(a.Link,{to:"/digit-ui/employee/fsm/rate-view/"+$},l.createElement(t.ActionLinks,null,z("CS_FSM_RATE_VIEW"))));if("WAITING_FOR_DISPOSAL"===e.status||"DISPOSAL_IN_PROGRESS"===e.status||"DISPOSED"===e.status||"CITIZEN_FEEDBACK_PENDING"===e.status){var m,v;const t={date:null==e||null===(m=e.auditDetails)||void 0===m?void 0:m.created,name:null==e?void 0:e.assigner,mobileNumber:null==e||null===(v=e.assigner)||void 0===v?void 0:v.mobileNumber};return null!=e&&e.numberOfTrips&&(t.comment=`${z("NUMBER_OF_TRIPS")}: ${null==e?void 0:e.numberOfTrips}`),l.createElement(ge,{data:t})}};return ue?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,ue?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l.createElement(t.Header,{style:{marginBottom:"16px"}},z("ES_TITLE_APPLICATION_DETAILS")),l.createElement(t.LinkButton,{label:z("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}})),l.createElement(t.Card,{className:"fsm",style:{position:"relative"}},null==se?void 0:se.applicationDetails.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},0===n?null:l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z(e.title)),l.createElement(t.StatusTable,null,null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,i)=>{var a;return null===n?null:l.createElement(t.Row,!0===n.map&&"N/A"!==n.value?{key:z(n.title),label:z(n.title),text:l.createElement("img",{src:z(n.value),alt:""})}:{key:z(n.title),label:z(n.title),text:z(n.value)||"N/A",last:i===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:n.caption,className:"border-none"})})))}),(null==ce||null===(u=ce.pitDetail)||void 0===u||null===(s=u.additionalDetails)||void 0===s||null===(d=s.fileStoreId)||void 0===d||null===(c=d.CITIZEN)||void 0===c?void 0:c.length)&&l.createElement(n.Fragment,null,l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z("ES_FSM_SUB_HEADING_CITIZEN_UPLOADS")),l.createElement(rt,{fileStoreIds:null==ce||null===(p=ce.pitDetail)||void 0===p||null===(m=p.additionalDetails)||void 0===m||null===(v=m.fileStoreId)||void 0===v?void 0:v.CITIZEN,tenantId:K,onClick:(e,t)=>Se(e)})),(null==ce||null===(E=ce.pitDetail)||void 0===E||null===(_=E.additionalDetails)||void 0===_||null===(S=_.fileStoreId)||void 0===S||null===(f=S.FSM_DSO)||void 0===f?void 0:f.length)&&l.createElement(n.Fragment,null,l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z("ES_FSM_SUB_HEADING_DSO_UPLOADS")),l.createElement(rt,{fileStoreIds:null==ce||null===(y=ce.pitDetail)||void 0===y||null===(T=y.additionalDetails)||void 0===T||null===(g=T.fileStoreId)||void 0===g?void 0:g.FSM_DSO,tenantId:W,onClick:(e,t)=>Se(e)})),ie?l.createElement(t.ImageViewer,{imageSrc:ie,onClose:function(){ae(null)}}):null,l.createElement(t.BreakLine,null),((null==me?void 0:me.isLoading)||de)&&l.createElement(t.Loader,null),!(null!=me&&me.isLoading)&&!de&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=me&&null!==(h=me.data)&&void 0!==h&&h.timeline&&1===(null==me||null===(I=me.data)||void 0===I||null===(C=I.timeline)||void 0===C?void 0:C.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:z("CS_COMMON_"+(null==me||null===(N=me.data)||void 0===N||null===(A=N.timeline[0])||void 0===A?void 0:A.status)),customChild:fe(null==me||null===(D=me.data)||void 0===D?void 0:D.timeline[0])}):l.createElement(t.ConnectingCheckPoints,null,(null==me||null===(O=me.data)||void 0===O?void 0:O.timeline)&&(null==me||null===(L=me.data)||void 0===L?void 0:L.timeline.slice(0,oe?me.data.timeline.length:2).map((e,n,i)=>l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,label:z(`CS_COMMON_FSM_${"UPDATE"===e.performedAction?"UPDATE_":""}${e.status}`),customChild:fe(e)}))))),(null==me||null===(P=me.data)||void 0===P||null===(b=P.timeline)||void 0===b?void 0:b.length)>2&&l.createElement(t.LinkButton,{label:z(oe?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{re(e=>!e)}})))),ee?l.createElement(ot,{t:z,action:Q,tenantId:W,state:K,id:$,closeModal:Ee,submitAction:e=>{pe(e,{onError:(e,t)=>{le({key:"error",action:e}),setTimeout(_e,5e3)},onSuccess:(e,t)=>{le({key:"success",action:Q}),setTimeout(_e,5e3),X.invalidateQueries("FSM_CITIZEN_SEARCH");const n=X.getQueryData("FUNCTION_RESET_INBOX");null==n||n.revalidate()}}),Ee()},actionData:null==me||null===(R=me.data)||void 0===R?void 0:R.timeline,module:null==me||null===(M=me.data)||void 0===M?void 0:M.applicationBusinessService}):null,ne&&l.createElement(t.Toast,{error:"error"===ne.key,label:z("success"===ne.key?`ES_FSM_${ne.action}_UPDATE_SUCCESS`:ne.action),onClose:_e}),!(null!=me&&me.isLoading)&&1===(null==me||null===(k=me.data)||void 0===k||null===(w=k.nextActions)||void 0===w?void 0:w.length)&&"RATE"!==(null==me||null===(F=me.data)||void 0===F||null===(x=F.nextActions)||void 0===x||null===(H=x[0])||void 0===H?void 0:H.action)&&l.createElement(t.ActionBar,{style:{zIndex:"19"}},l.createElement(t.SubmitBar,{label:z("ES_FSM_"+(null==me||null===(V=me.data)||void 0===V?void 0:V.nextActions[0].action)),onSubmit:()=>{var e;return ve(null==me||null===(e=me.data)||void 0===e?void 0:e.nextActions[0].action)}})),!(null!=me&&me.isLoading)&&(null==me||null===(B=me.data)||void 0===B||null===(U=B.nextActions)||void 0===U?void 0:U.length)>1&&l.createElement(t.ActionBar,{style:{zIndex:"19"}},q&&null!=me&&null!==(Y=me.data)&&void 0!==Y&&Y.nextActions?l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM",options:null==me||null===(G=me.data)||void 0===G?void 0:G.nextActions.map(e=>e.action),t:z,onSelect:ve}):null,l.createElement(t.SubmitBar,{label:z("ES_COMMON_TAKE_ACTION"),onSubmit:()=>Z(!q)}))))},FSMFstpOperatorDetails:()=>{var e,o,u,s,d,c,p,m,v,E,_,S,f,y,T,g,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y,G,W,K,z,j,X,$,q,Z,Q,J,ee,te,ne;const le=Digit.ULBService.getStateId();let ie=window.Digit.Utils.browser.isMobile();const{t:ae}=i.useTranslation(),oe=a.useHistory(),re=r.useQueryClient(),ue=Digit.ULBService.getCurrentTenantId(),se=Digit.Hooks.fsm.useTenants(),de=Digit.ULBService.getStateId();let{id:ce}=a.useParams();const pe=!!oe.location.pathname.includes("new"),{data:me}=Digit.Hooks.fsm.useMDMS(ue,"FSM","UrcConfig"),ve=me&&me.length>0&&me[0].URCEnable,[Ee,_e]=n.useState(()=>se.filter(e=>(null==e?void 0:e.code)===ue)[0]||null);let Se=[{active:!0,code:"WITHIN_ULB_LIMITS",i18nKey:"WITHIN_ULB_LIMITS",name:"Witnin ULB Limits"},{active:!0,code:"FROM_GRAM_PANCHAYAT",i18nKey:"FROM_GRAM_PANCHAYAT",name:"From Gram Panchayat"},{active:!0,code:"FROM_OTHER_ULB",i18nKey:"FROM_OTHER_ULB",name:"From Other/Outside ULBs"}];const{data:fe}=Digit.Hooks.useBoundaryLocalities(null==Ee?void 0:Ee.code,"revenue",{enabled:!!Ee},ae);var{data:ye}=Digit.Hooks.useBoundaryLocalities(null==Ee?void 0:Ee.code,"gramPanchayats",{enabled:!!Ee},ae);const[Te,ge]=n.useState(null!=ce?{applicationNos:ce}:{applicationNos:"null"}),[he,Ie]=n.useState(!1),[Ce,Ne]=n.useState({}),[Ae,De]=n.useState(null),[Oe,Le]=n.useState(null),[Pe,be]=n.useState(null),[Re,Me]=n.useState({}),[ke,we]=n.useState(null),[Fe,xe]=n.useState(()=>{const e=new Date;return`${(e.getHours()<10?"0":"")+e.getHours()}:${(e.getMinutes()<10?"0":"")+e.getMinutes()}`}),[He,Ve]=n.useState(!1),[Be,Ue]=n.useState(null),[Ye,Ge]=n.useState(!1),[We,Ke]=n.useState(),[ze,je]=n.useState(),[Xe,$e]=n.useState(),[qe,Ze]=n.useState(),Qe=n.useRef(),Je=n.useRef(),et=n.useRef(),[tt,nt]=n.useState(),[lt,it]=n.useState(null),[at,rt]=n.useState(Array),[ut,st]=n.useState(null),[dt,vt]=n.useState(ce),[Et,_t]=n.useState(null),[St,ft]=n.useState(null),[yt,Tt]=n.useState(),gt=a.useLocation(),[ht,It]=n.useState(pe?Se[0]:null),[Ct,Nt]=n.useState(),[At,Dt]=n.useState(),[Ot,Lt]=n.useState([]),[Pt,bt]=n.useState(),[Rt,Mt]=n.useState(null),[kt,wt]=n.useState(),[Ft,xt]=n.useState(),[Ht,Vt]=n.useState(),Bt=e=>{_t(e)},{isSuccess:Ut,data:Yt}=Digit.Hooks.fsm.useVehicleSearch({tenantId:ue,totalconfig:mt}),{isLoading:Gt,isSuccess:Wt,data:Kt}=Digit.Hooks.fsm.useVehicleSearch({tenantId:ue,filters:Te,config:pt}),{isLoading:zt,isIdle:jt,data:{data:{table:Xt}={}}={}}=Digit.Hooks.fsm.useSearchAll(ue,Ce,null,{enabled:!!he});n.useEffect(()=>{fe&&fe.length>0&&Vt(fe)},[fe]),n.useEffect(()=>{ye&&ye.length>0&&Nt(ye)},[ye]),n.useEffect(()=>{Ze(0==(null==Xe?void 0:Xe.length)?1:We-(null==Xe?void 0:Xe.length)+1)},[We,Xe,Yt,Ut,Wt]);const $t=Digit.Hooks.useWorkflowDetails({tenantId:ue,id:gt.pathname.includes("fstp-operator-details")?ce:null,moduleCode:"FSM_VEHICLE_TRIP",role:"FSM_EMP_FSTPO"}),qt=Digit.Hooks.fsm.useVehicleUpdate(ue),Zt=Digit.Hooks.fsm.useVehicleTripCreate(ue);n.useEffect(()=>{if(Wt){var e;be();const t=null==Kt||null===(e=Kt.tripDetails)||void 0===e?void 0:e.map(e=>e.referenceNo).join(",");Ne(t?{applicationNos:t}:{applicationNos:"null"}),Ie(!0)}},[Wt]),n.useEffect(()=>{if(Wt){var e,t;Le(null==Kt||null===(e=Kt.vehicle)||void 0===e?void 0:e.tankCapacity);const n=null==Kt||null===(t=Kt.tripDetails)||void 0===t?void 0:t.map(e=>e.referenceNo).join(",");Ne(n?{applicationNos:n}:{applicationNos:"null"}),Ie(!0)}},[Wt]),n.useEffect(()=>{var e,t;jt||zt||!Xt||(Ke(null===(e=Xt[0])||void 0===e?void 0:e.noOfTrips),je(null===(t=Xt[0])||void 0===t?void 0:t.applicationNo))},[zt,jt,Xt]),n.useEffect(()=>{switch(Be){case"DECLINEVEHICLE":return Ge(!0);case"DISPOSE":case"READY_FOR_DISPOSAL":Ue(null),oe.location.pathname.includes("new")?Jt():Qt();default:Ue()}},[Be]),n.useEffect(()=>{if(Ut){var e;const t=null==Yt||null===(e=Yt.vehicleTrip)||void 0===e?void 0:e.filter((e,t,n)=>{var l;return(null==e||null===(l=e.tripDetails[0])||void 0===l?void 0:l.referenceNo)===ze&&"WAITING_FOR_DISPOSAL"===(null==e?void 0:e.applicationStatus)});$e(t)}},[Ut,Yt,Wt,jt,ze]);const Qt=()=>{const e=Xt.reduce((e,t)=>e+t.volume,0);if(ce&&(!Pe||Pe>e||Pe>Kt.vehicle.tankCapacity))return Me({wasteRecieved:"ES_FSTP_INVALID_WASTE_AMOUNT"}),void Qe.current.scrollIntoView({behavior:"smooth",block:"center"});if(null===ke)return Me({tripStartTime:"ES_FSTP_INVALID_START_TIME"}),void Je.current.scrollIntoView({behavior:"smooth",block:"center"});if(null===Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});if(ke===Fe||ke>Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});Me({});const t=new Date,n=Date.parse(new Date(t.toString().split(":")[0].slice(0,-2)+Fe))/1e3,l=Date.parse(new Date(t.toString().split(":")[0].slice(0,-2)+ke))/1e3,i={tripNo:qe};Kt.tripStartTime=l,Kt.fstpEntryTime=l,Kt.tripEndTime=n,Kt.fstpExitTime=n,Kt.volumeCarried=Pe,Kt.tripDetails[0].additionalDetails=i,Kt.additionalDetails={fileStoreId:at,comments:yt,vehicleCapacity:Oe},qt.mutate({vehicleTrip:[Kt],workflow:{action:"DISPOSE"}},{onSuccess:tn,onError:nn})},Jt=()=>{var e,t,n,l;const i=new RegExp("[A-Z]{2}\\s{0,1}[0-9]{2}\\s{0,1}[A-Z]{0,2}\\s{0,1}[0-9]{4}"),a=new RegExp(/^[A-Za-z0-9 ]*$/),o=new RegExp(/^[A-Za-z0-9 ]*$/);if(!i.test(dt))return De({key:"error",action:"ES_FSM_VEHICLE_FORMAT_TIP"}),void setTimeout(()=>{en()},5e3);if(null===St||0===(null==St||null===(e=St.trim())||void 0===e?void 0:e.length)||!a.test(St))return De({key:"error",action:"ES_FSTP_INVALID_DSO_NAME"}),void setTimeout(()=>{en()},2e3);if(!("FROM_GRAM_PANCHAYAT"===(null==ht?void 0:ht.code)||void 0!==Ft&&"Other"!==(null==Ft?void 0:Ft.name)||null!==Et&&0!==(null==Et||null===(t=Et.trim())||void 0===t?void 0:t.length)&&o.test(Et)))return De({key:"error",action:"ES_FSTP_INVALID_LOCALITY"}),void setTimeout(()=>{en()},2e3);if(!("FROM_GRAM_PANCHAYAT"!==(null==ht?void 0:ht.code)||void 0!==At&&"Other"!==(null==At?void 0:At.name)||null!==Rt&&0!==(null==Rt||null===(n=Rt.trim())||void 0===n?void 0:n.length)))return De({key:"error",action:"ES_FSTP_SELECT_GRAMPANCHAYAT"}),void setTimeout(()=>{en()},2e3);if(null===ke)return Me({tripStartTime:"ES_FSTP_INVALID_START_TIME"}),void Je.current.scrollIntoView({behavior:"smooth",block:"center"});if(!Pe||0===(null==Pe||null===(l=Pe.trim())||void 0===l?void 0:l.length))return De({key:"error",action:"ES_FSTP_INVALID_WASTE_AMOUNT"}),void setTimeout(()=>{en()},2e3);if(null===Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});if(ke===Fe||ke>Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});Me({});let r={};const u=new Date,s=Date.parse(new Date(u.toString().split(":")[0].slice(0,-2)+Fe))/1e3,d=Date.parse(new Date(u.toString().split(":")[0].slice(0,-2)+ke))/1e3;r.tenantId=ue,r.status="ACTIVE",r.tripStartTime=d,r.tripEndTime=s,r.volumeCarried=Pe,r.additionalDetails={vehicleNumber:dt||ce,dsoName:St,locality:Et,vehiclecapacity:Oe,fileStoreId:at,comments:yt,gramPanchayat:At,village:Pt,newGramPanchayat:Rt,newVillage:kt,boundaryType:"FROM_GRAM_PANCHAYAT"===(null==ht?void 0:ht.code)?"GP":"Locality",propertyLocation:null==ht?void 0:ht.code,newLocality:Et},r.businessService="FSM_VEHICLE_TRIP",r.tripDetails=[{tenantId:ue,status:"ACTIVE"}],Zt.mutate({vehicleTrip:[r]},{onSuccess:tn,onError:nn})},en=()=>{De(null)},tn=()=>{"DECLINEVEHICLE"===Be&&Ge(!1),re.invalidateQueries("FSM_VEHICLE_DATA"),De({key:"success",action:"ES_FSM_DISPOSE_UPDATE_SUCCESS"}),setTimeout(()=>{en(),oe.push("/digit-ui/employee")},5e3)},nn=()=>{"DECLINEVEHICLE"===Be&&(Ge(!1),Ue(null)),re.invalidateQueries("FSM_VEHICLE_DATA"),De({key:"error",action:"ES_FSM_DISPOSE_UPDATE_FAILURE"}),setTimeout(()=>{en()},5e3)};if(Gt)return l.createElement(t.Loader,null);const ln=[{title:ae("ES_INBOX_VEHICLE_NO")+" *",value:(null==Kt||null===(e=Kt.vehicle)||void 0===e?void 0:e.registrationNumber)||ce||l.createElement(t.TextInput,{onChange:e=>{vt(e.target.value)},value:dt})},{title:ae("ES_INBOX_DSO_NAME")+" *",value:(null==Kt||null===(o=Kt.tripOwner)||void 0===o?void 0:o.name)||l.createElement(t.TextInput,{onChange:e=>{ft(e.target.value)},value:St})}],an=(e,t)=>{"string"==typeof e&&t(e)};function on(e){Ue(e),Ve(!1)}const rn=e=>{wt(e)};return l.createElement("div",null,l.createElement(t.Header,{styles:{marginLeft:"16px"}},ae("ES_INBOX_VEHICLE_LOG")),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,null==ln?void 0:ln.map((e,n)=>l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:e.title,label:e.title,text:e.value||"N/A",last:!1,labelStyle:{fontWeight:"normal"}})),pe&&ve&&l.createElement("div",{style:!ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"flex",justifyContent:"space-between",paddingBottom:"8px",marginBottom:"8px"}:{}},l.createElement(t.CardLabel,null,ae("CS_PROPERTY_LOCATION")+" *"),l.createElement("div",{style:!ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"50%"}:{}},l.createElement(t.RadioButtons,{selectedOption:ht,onSelect:function(e){It(e)},style:!ie&&oe.location.pathname.includes("new-vehicle-entry")?{marginBottom:0}:{},innerStyles:{marginLeft:"10px"},options:Se,optionsKey:"i18nKey"}))),("FROM_GRAM_PANCHAYAT"===(null==ht?void 0:ht.code)||Xt&&Xt.length>0&&"Village"===(null===(u=Xt[0])||void 0===u||null===(s=u.address)||void 0===s||null===(d=s.additionalDetails)||void 0===d?void 0:d.boundaryType)||Xt&&Xt.length>0&&"GP"===(null===(c=Xt[0])||void 0===c||null===(p=c.address)||void 0===p||null===(m=p.additionalDetails)||void 0===m?void 0:m.boundaryType))&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("CS_GRAM_PANCHAYAT"),label:ae("CS_GRAM_PANCHAYAT")+" * ",text:Xt&&Xt.length>0?null===(v=Xt[0])||void 0===v||null===(E=v.address)||void 0===E||null===(_=E.additionalDetails)||void 0===_||null===(S=_.gramPanchayat)||void 0===S?void 0:S.name:l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:At,option:Ct,select:function(e){if(Dt(e),"Other"!==e.name){var t,n=(null===(t=Ct.filter(t=>t.code===e.code)[0])||void 0===t?void 0:t.children).map(e=>({...e,i18nkey:ue.replace(".","_").toUpperCase()+"_"+e.code}));n.length>0&&(n.push({code:"OTHER",name:"Other",i18nkey:ue.replace(".","_").toUpperCase()+"_OTHER"}),Lt(n))}},optionKey:"i18nkey",style:{width:"100%"},t:ae}),last:!1,labelStyle:{fontWeight:"normal"}}),"Other"===(null==At?void 0:At.name)&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT"),label:ae("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")+" * ",text:Xt&&Xt.length>0?null===(f=Xt[0])||void 0===f||null===(y=f.address)||void 0===y||null===(T=y.locality)||void 0===T?void 0:T.name:l.createElement(t.TextInput,{onChange:e=>{Mt(e.target.value)},value:Rt}),last:!1,labelStyle:{fontWeight:"normal"}}),l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE"),label:""+ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE"),text:Xt&&Xt.length>0?null===(g=Xt[0])||void 0===g||null===(h=g.address)||void 0===h||null===(I=h.locality)||void 0===I?void 0:I.name:l.createElement(t.TextInput,{onChange:e=>rn(e.target.value),value:kt}),last:!1,labelStyle:{fontWeight:"normal"}})),"Other"!==(null==At?void 0:At.name)&&l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("CS_VILLAGE_NAME"),label:""+ae("CS_VILLAGE_NAME"),text:Xt&&Xt.length>0?null!==(C=Xt[0])&&void 0!==C&&null!==(N=C.address)&&void 0!==N&&null!==(A=N.additionalDetails)&&void 0!==A&&null!==(D=A.village)&&void 0!==D&&D.name?null===(O=Xt[0])||void 0===O||null===(L=O.address)||void 0===L||null===(P=L.additionalDetails)||void 0===P||null===(b=P.village)||void 0===b?void 0:b.name:"N/A":Ot.length>0?l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:Pt,option:Ot,select:function(e){bt(e)},optionKey:"i18nkey",style:{width:"100%"},t:ae}):l.createElement(t.TextInput,{onChange:e=>rn(e.target.value),value:kt}),last:!1,labelStyle:{fontWeight:"normal"}}),"OTHER"===(null==Pt?void 0:Pt.code)&&l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE"),label:ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE")+" * ",text:Xt&&Xt.length>0?null===(R=Xt[0])||void 0===R||null===(M=R.address)||void 0===M||null===(k=M.locality)||void 0===k?void 0:k.name:l.createElement(t.TextInput,{onChange:e=>rn(e.target.value),value:kt}),last:!1,labelStyle:{fontWeight:"normal"}})),("WITHIN_ULB_LIMITS"===(null==ht?void 0:ht.code)||Xt&&Xt.length>0&&"Locality"===(null===(w=Xt[0])||void 0===w||null===(F=w.address)||void 0===F||null===(x=F.additionalDetails)||void 0===x?void 0:x.boundaryType))&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_LOCALITY"),label:ae("ES_INBOX_LOCALITY")+" * ",text:Xt&&Xt.length>0?null===(H=Xt[0])||void 0===H||null===(V=H.address)||void 0===V||null===(B=V.locality)||void 0===B?void 0:B.name:l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:Ft,option:null==Ht?void 0:Ht.sort((e,t)=>e.name.localeCompare(t.name)),select:function(e){xt(e)},optionKey:"i18nkey",style:{width:"100%"},t:ae}),last:!1,labelStyle:{fontWeight:"normal"}}),"Other"===(null==Ft?void 0:Ft.name)&&l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_LOCALITY"),label:ae("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" * ",text:Xt&&Xt.length>0?null===(U=Xt[0])||void 0===U||null===(Y=U.address)||void 0===Y||null===(G=Y.locality)||void 0===G?void 0:G.name:l.createElement(t.TextInput,{onChange:e=>Bt(e.target.value),value:Et}),last:!1,labelStyle:{fontWeight:"normal"}})),"FROM_OTHER_ULB"===(null==ht?void 0:ht.code)&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_LOCALITY"),label:ae("ES_INBOX_LOCALITY")+" * ",text:Xt&&Xt.length>0?null===(W=Xt[0])||void 0===W||null===(K=W.address)||void 0===K||null===(z=K.locality)||void 0===z?void 0:z.name:l.createElement(t.TextInput,{onChange:e=>Bt(e.target.value),value:Et}),last:!1,labelStyle:{fontWeight:"normal"}})),l.createElement("div",{ref:Je},l.createElement(t.CardLabelError,null,ae(Re.tripStartTime))),l.createElement("form",null,l.createElement(t.Row,{key:ae("ES_VEHICLE_IN_TIME"),label:ae("ES_VEHICLE_IN_TIME")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"},text:l.createElement("div",null,l.createElement(ct,{name:"tripStartTime",onChange:e=>an(e,we),value:ke}))}),l.createElement(t.Row,{key:ae("ES_VEHICLE_CAPACITY"),label:ae("ES_VEHICLE_CAPACITY")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},text:l.createElement("div",null,l.createElement(t.TextInput,{type:"number",name:"vehicleCapacity",value:Oe,onChange:e=>{Le(e.target.value)},disable:!0})),rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"}}),l.createElement("div",{ref:Qe},l.createElement(t.CardLabelError,null,ae(Re.wasteRecieved))),l.createElement(t.Row,{key:ae("ES_VEHICLE_SEPTAGE_DUMPED"),label:ae("ES_VEHICLE_SEPTAGE_DUMPED")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},text:l.createElement("div",null,l.createElement(t.TextInput,{type:"number",name:"wasteRecieved",value:Pe,onChange:e=>{const{name:t,value:n}=e.target;"tripTime"===t?xe(n):"wasteRecieved"===t&&be(n)}})),rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"}}),l.createElement("div",{ref:et},l.createElement(t.CardLabelError,null,ae(Re.tripTime))),l.createElement(t.Row,{key:ae("ES_VEHICLE_OUT_TIME"),label:ae("ES_VEHICLE_OUT_TIME")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"},text:l.createElement("div",null,l.createElement(ct,{name:"tripTime",onChange:e=>an(e,xe),value:Fe}))}),l.createElement("div",{className:!ie&&"row",style:ie?{}:{diplay:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement(t.CardLabel,{style:{fontWeight:"normal"}}," ",ae("ES_FSM_ADDITIONAL_DETAILS")," "),l.createElement(t.TextArea,{className:"form-field",onChange:e=>{if(e.target.value.length>1024)return null;Tt(e.target.value)},style:ie?{width:"100%"}:{width:"100%",marginLeft:"35%"}})),l.createElement(t.Row,{key:ae("ES_FSM_ATTACHMENTS"),label:""+ae("ES_FSM_ATTACHMENT"),labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between",alignItems:"center"},text:l.createElement(t.MultiUploadWrapper,{t:ae,module:"fsm",tenantId:le,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);!function(e){if(e){var t;let n=[...at,null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId];rt(n),e&&it(e.file)}}(n[n.length-1])})(e)})}),!(null!=$t&&$t.isLoading)&&(null==$t||null===(j=$t.data)||void 0===j||null===(X=j.nextActions)||void 0===X?void 0:X.length)>0&&(1===(null==$t||null===($=$t.data)||void 0===$||null===(q=$.nextActions)||void 0===q?void 0:q.length)?l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:ae("CS_ACTION_"+(null==$t||null===(Z=$t.data)||void 0===Z||null===(Q=Z.nextActions)||void 0===Q||null===(J=Q[0])||void 0===J?void 0:J.action)),onSubmit:()=>{var e,t,n;return on(null==$t||null===(e=$t.data)||void 0===e||null===(t=e.nextActions)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.action)}})):l.createElement(t.ActionBar,null,He&&null!=$t&&null!==(ee=$t.data)&&void 0!==ee&&ee.nextActions?l.createElement(t.Menu,{localeKeyPrefix:"",options:null==$t||null===(te=$t.data)||void 0===te?void 0:te.nextActions.map(e=>e.action),t:ae,onSelect:on}):null,l.createElement(t.SubmitBar,{label:ae("ES_COMMON_TAKE_ACTION"),onSubmit:()=>Ve(!He)})))),Ye?l.createElement(ot,{t:ae,action:Be,tenantId:ue,state:de,id:ce,closeModal:()=>{Ue(null),Ge(!1)},submitAction:e=>{var t,n;Kt.additionalDetails={comments:null==e||null===(t=e.workflow)||void 0===t?void 0:t.comments,vehicleDeclineReason:null==e||null===(n=e.workflow)||void 0===n?void 0:n.fstpoRejectionReason},qt.mutate({vehicleTrip:[Kt],workflow:{action:"DECLINEVEHICLE"}},{onSuccess:tn,onError:nn})},actionData:null==$t||null===(ne=$t.data)||void 0===ne?void 0:ne.timeline}):null)),Ae&&l.createElement(t.Toast,{error:"error"===Ae.key,label:ae(Ae.action),onClose:en}))},FSMResponse:e=>{var o,u,s,d,c,p,m,v,E,_,S,f,y,T;const g=a.useHistory(),[h,I]=n.useState(null),{t:C}=i.useTranslation(),N=r.useQueryClient(),A=Digit.UserService.hasAccess("FSM_COLLECTOR"),D=Digit.UserService.hasAccess("FSM_EDITOR_EMP")||!1,O=Digit.UserService.hasAccess("CITIZEN")||window.location.pathname.includes("citizen")||!1,L=Digit.ULBService.getCurrentTenantId(),P=Digit.ULBService.getStateId(),{state:b}=e.location,R="update"===b.key?Digit.Hooks.fsm.useApplicationActions(L):Digit.Hooks.fsm.useDesludging(L),{data:M}=Digit.Hooks.useStore.getInitData(),{tenants:k}=M||{},[w,F,x]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[H,V,B]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[U,Y,G]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),[W,K]=n.useState(!1),[z,j]=n.useState(null);sessionStorage.removeItem("Digit_FSM_PT");const X=(e,t)=>{var n,l,i;V((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors[0])||void 0===i?void 0:i.code)||(null==e?void 0:e.message)||"ERROR"),F(!0)};n.useEffect(()=>{R.data&&Y(R.data)},[R.data]);const $=null==R||null===(o=R.data)||void 0===o||null===(u=o.fsm)||void 0===u||null===(s=u[0].address)||void 0===s||null===(d=s.locality)||void 0===d?void 0:d.code,q=null==R||null===(c=R.data)||void 0===c||null===(p=c.fsm)||void 0===p||null===(m=p[0].address)||void 0===m?void 0:m.slumName,Z=Digit.Hooks.fsm.useSlum(null==R||null===(v=R.data)||void 0===v||null===(E=v.fsm)||void 0===E||null===(_=E[0])||void 0===_?void 0:_.tenantId,q,$,{enabled:!!q,retry:!!q}),{data:Q}=Digit.Hooks.fsm.useMDMS(P,"Vehicle","VehicleType",{staleTime:Infinity}),J=(null==R?void 0:R.data)||U,ee=((e,t)=>(null==e?void 0:e.i18nKey)&&(null==e?void 0:e.capacity)&&`${t(e.i18nKey)} - ${e.capacity} ${t("CS_COMMON_CAPACITY_LTRS")}`||null)(null==Q?void 0:Q.find(e=>{var t,n;return(null==J||null===(t=J.fsm)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.vehicleType)===(null==e?void 0:e.code)}),C);let te=null===(S=J.fsm)||void 0===S?void 0:S[0].applicationNo;const{data:ne}=Digit.Hooks.fsm.usePaymentHistory(L,te),le=()=>{I(null)};function ie(e){j(e),K(!1)}if(n.useEffect(()=>{w||H||R.mutate("update"===b.key?{fsm:b.applicationData,workflow:{action:b.action,...b.actionData}}:b,{onError:X,onSuccess:()=>{N.clear(),F(!0),window.history.replaceState({},"FSM_CREATE_RESPONSE")}})},[]),n.useEffect(()=>{switch(z){case"GO_TO_HOME":return g.push(O?"/digit-ui/citizen":"/digit-ui/employee");case"ASSIGN_TO_DSO":return g.push("/digit-ui/employee/fsm/application-details/"+te);case"PAY":return void("POST_PAY"===(null==J||null===(e=J.fsm)||void 0===e?void 0:e[0].paymentPreference)?(I({key:"error",action:"ES_FSM_PAYMENT_BEFORE_SCHEDULE_FAILURE"}),setTimeout(()=>{le()},5e3)):g.push("/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/"+((null==b||null===(t=b.applicationData)||void 0===t?void 0:t.applicationNo)||(null==J||null===(n=J.fsm)||void 0===n?void 0:n[0].applicationNo))))}var e,t,n},[z]),R.isLoading||R.isIdle&&!w)return l.createElement(t.Loader,null);let ae=["GO_TO_HOME"];"PENDING_APPL_FEE_PAYMENT"===(null==J||null===(f=J.fsm)||void 0===f?void 0:f[0].applicationStatus)&&A?ae=[...ae,"PAY"]:"ASSING_DSO"===(null==J||null===(y=J.fsm)||void 0===y?void 0:y[0].applicationStatus)&&D&&(ae=[...ae,"ASSIGN_TO_DSO"]);const oe=!!U||(null==R?void 0:R.isSuccess);return l.createElement(t.Card,null,l.createElement(St,{t:C,data:J,action:b.action,isSuccess:oe,isLoading:R.isIdle&&!w||(null==R?void 0:R.isLoading),isEmployee:e.parentRoute.includes("employee"),errorInfo:H}),l.createElement(t.CardText,null,((e,t,n,l,i)=>Et("DISPLAY",e,t,n,l,i))(b.action,oe,e.parentRoute.includes("employee"),C,null==J||null===(T=J.fsm)||void 0===T?void 0:T[0])),oe&&l.createElement(t.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},"COMPLETED"===(null==J||null===(se=J.fsm)||void 0===se?void 0:se[0].applicationStatus)&&null!==(null==J||null===(de=J.fsm)||void 0===de?void 0:de[0].advanceAmount)?C("CS_COMMON_PAYMENT_RECEIPT"):C("CS_COMMON_DOWNLOAD")," ")),style:{width:"100px"},onClick:"COMPLETED"===(null==J||null===(re=J.fsm)||void 0===re?void 0:re[0].applicationStatus)&&null!==(null==J||null===(ue=J.fsm)||void 0===ue?void 0:ue[0].advanceAmount)?function(){try{var e;const n={filestoreIds:[null===(e=ne.Payments[0])||void 0===e?void 0:e.fileStoreId]},l=null!=n&&null!==(t=n.fileStoreIds)&&void 0!==t&&t[0]?Promise.resolve(Digit.PaymentService.printReciept(P,{fileStoreIds:n.filestoreIds[0]})).then(function(e){window.open(e[n.filestoreIds[0]],"_blank"),setShowOptions(!1)}):Promise.resolve(Digit.PaymentService.generatePdf(P,{Payments:[ne.Payments[0]]},"fsm-receipt")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(P,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[e.filestoreIds[0]],"_blank"),setShowOptions(!1)})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}var t}:()=>{const{fsm:e}=R.data||U,[t,...n]=e,l=k.find(e=>e.code===t.tenantId),i=Pe({...t,slum:Z,pdfVehicleType:ee},l,C);Digit.Utils.pdf.generate(i)}}),l.createElement(t.ActionBar,null,W?l.createElement(t.Menu,{localeKeyPrefix:"ES_COMMON",options:ae,t:C,onSelect:ie}):null,l.createElement(t.SubmitBar,1===ae.length?{label:C("ES_COMMON_"+ae[0]),onSubmit:()=>ie(ae[0])}:{label:C("ES_COMMON_TAKE_ACTION"),onSubmit:()=>K(!W)})),h&&l.createElement(t.Toast,{error:"error"===h.key,label:C("success"===h.key?h.action:"ES_FSM_PAYMENT_BEFORE_SCHEDULE_FAILURE"),onClose:le}));var re,ue,se,de},FSMApplicationAudit:e=>{var n,o,r;const{t:u}=i.useTranslation(),{id:s}=a.useParams(),{tenantId:d}=Digit.UserService.getUser().info,{data:c,isLoading:p}=Digit.Hooks.fsm.useApplicationAudit(d,{applicationNo:s}),m=l.useMemo(()=>[{Header:u("ES_AUDIT_WHEN"),accessor:"when"},{Header:u("ES_AUDIT_WHO"),accessor:"who"},{Header:u("ES_AUDIT_WHAT"),accessor:"what"}],[]),v=null==c||null===(n=c.fsmAudit)||void 0===n?void 0:n.map(e=>new Date(e.when).toLocaleString()),E=null==c||null===(o=c.fsmAudit)||void 0===o?void 0:o.map(e=>e.who),_=Digit.Hooks.useUserSearch(null,{uuid:E},{},{enabled:!!E}),S=null==c||null===(r=c.fsmAudit)||void 0===r?void 0:r.map((e,n)=>{const i=(e=>{var t;let n=null==_||null===(t=_.data)||void 0===t?void 0:t.user;return null!=n&&n.length?n.filter(t=>t.uuid===e)[0]:null})(e.who);return{when:v[n],who:`${null==i?void 0:i.name} (${null==i?void 0:i.type})`,what:0===n?l.createElement("p",null,"New Request"," ",l.createElement(a.Link,{to:"/digit-ui/employee/fsm/application-details/"+s},l.createElement(t.LinkButton,{label:u("ES_VIEW_APPLICATION"),style:{color:"#1671ba",marginLeft:"8px"}}))):l.createElement(l.Fragment,null,(o=e.what,Object.keys(o).map((e,t)=>l.createElement("p",{key:t},l.createElement("span",null,e)," : ",l.createElement("span",null,o[e])))))};var o});return p||_.isLoading?l.createElement(t.Loader,null):l.createElement("div",{style:{overflow:"auto"}},l.createElement(t.Header,null,u("ES_TITLE_APPLICATION_AUDIT")),l.createElement(t.Table,{t:u,data:S||[],columns:m,getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}})}))},FSMRateView:e=>{var n,o,r;const{t:u}=i.useTranslation(),s=Digit.ULBService.getCurrentTenantId();let{id:d}=a.useParams();const{isLoading:c,isSuccess:p,data:m}=Digit.Hooks.fsm.useSearch(s,{applicationNos:d}),{isLoading:v,data:E}=Digit.Hooks.useWorkflowDetails({tenantId:null==m?void 0:m.tenantId,id:d,moduleCode:"FSM",config:{enabled:p&&!!m}});return c||v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(t.CardHeader,null,u("CS_RATE_HELP_US")),l.createElement(t.KeyNote,{keyValue:u("CS_FSM_YOU_RATED")},l.createElement(t.Rating,{currentRating:null==E||null===(n=E.timeline[0])||void 0===n?void 0:n.rating})),m.additionalDetails.CheckList.map(e=>l.createElement(t.KeyNote,{keyValue:u(e.code),note:e.value.split(",").map(e=>u(e)).join(", ")})),l.createElement(t.KeyNote,{keyValue:u("CS_COMMON_COMMENTS"),note:(null==E||null===(o=E.timeline[0])||void 0===o||null===(r=o.wfComment)||void 0===r?void 0:r[0])||"N/A"}))},FSMNewApplicationCitizen:e=>{let{parentRoute:o}=e;const u=r.useQueryClient(),s=a.useRouteMatch(),{t:d}=i.useTranslation(),{pathname:c}=a.useLocation(),p=a.useHistory(),m=Digit.ULBService.getStateId();let v=[],E=[];const[_,S,f]=Digit.Hooks.useSessionStorage("FSM_CITIZEN_FILE_PROPERTY",{}),{data:y,isLoading:T}=Digit.Hooks.fsm.useMDMS(m,"FSM","CommonFieldsConfig"),[,g]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,h]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,I]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);function C(e,t,n){S({..._,[e]:{..._[e],...t},source:"ONLINE"}),(e=>{const t=c.split("/").pop(),{nextStep:n}=E.find(e=>e.route===t);let l=p.push;if(e&&(l=p.replace),null===n)return l(o+"/new-application/check");l(`${s.path}/${n}`)})(n)}n.useEffect(()=>{null!=c&&c.includes("new-application/response")||(g(!1),I(),h())},[]);const N=()=>{};return T?l.createElement(t.Loader,null):(y.forEach(e=>{v=v.concat(e.body.filter(e=>!e.hideInCitizen))}),E=[{type:"component",route:"search-property",isMandatory:!0,component:"CPTSearchProperty",key:"cptsearchproperty",withoutLabel:!0,nextStep:"search-results",hideInEmployee:!0},{type:"component",route:"search-results",isMandatory:!0,component:"CPTSearchResults",key:"cptsearchresults",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"create-property",isMandatory:!0,component:"CPTCreateProperty",key:"cptcreateproperty",withoutLabel:!0,isSkipEnabled:!0,nextStep:"acknowledge-create-property",hideInEmployee:!0},{type:"component",route:"acknowledge-create-property",isMandatory:!0,component:"CPTAcknowledgement",key:"cptacknowledgement",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"property-details",isMandatory:!0,component:"CPTPropertyDetails",key:"propertydetails",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{head:"FSM_NEW_APPLICATION_PROPERTY",body:[{component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0}]},{label:"ES_NEW_APPLICATION_PROPERTY_TYPEs",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},{route:"map",component:"FSMSelectGeolocation",nextStep:"pincode",hideInEmployee:!0,key:"address"},{route:"pincode",component:"FSMSelectPincode",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_FILE_APPLICATION_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"address",type:"component"},{route:"address",component:"FSMSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"locality-gramPanchayat",isMandatory:!0,type:"component"},{route:"locality-gramPanchayat",component:"SelectLocalityOrGramPanchayat",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"check-slum",isMandatory:!0,type:"component"},{type:"component",route:"check-slum",isMandatory:!0,component:"CheckSlum",texts:{header:"ES_NEW_APPLICATION_SLUM_CHECK",submitBarLabel:"CS_COMMON_NEXT"},key:"address",withoutLabel:!0,nextStep:"slum-details",hideInEmployee:!0},{type:"component",route:"slum-details",isMandatory:!0,component:"SelectSlumName",texts:{header:"CS_NEW_APPLICATION_SLUM_NAME",cardText:"CS_NEW_APPLICATION_SLUM_TEXT",submitBarLabel:"CS_COMMON_NEXT"},withoutLabel:!0,key:"address",nextStep:"street"},{type:"component",route:"street",component:"FSMSelectStreet",key:"address",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_STREET_DOOR_NO_LABEL",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"landmark"},{type:"component",route:"landmark",component:"FSMSelectLandmark",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"pit-type"},{label:"ES_NEW_APPLICATION_ROAD_WIDTH",isMandatory:!0,type:"component",route:"road-details",key:"roadWidth",hideInEmployee:!0,component:"SelectRoadDetails",texts:{header:"CS_FILE_PROPERTY_ROAD_WIDTH",cardText:"CS_FILE_PROPERTY_ROAD_WIDTH_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!0,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"road-details"},{route:"tank-size",component:"SelectTankSize",isMandatory:!1,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},type:"component",key:"pitDetail",nextStep:"select-payment-preference",label:"ES_NEW_APPLICATION_PIT_DIMENSION"},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTrips"},{label:"a",isMandatory:!0,type:"component",route:"select-trip-number",key:"selectTripNo",component:"SelectTripNo",hideInEmployee:!0,texts:{headerCaption:"",header:"ES_FSM_SERVICE_REQUEST",cardText:"ES_FSM_SERVICE_REQUEST_TEXT",skipText:"CORE_COMMON_SKIP_CONTINUE",submitBarLabel:"CS_COMMON_NEXT",skipLabel:"CS_COMMON_SERVICE_SKIP_INFO"},nextStep:"search-property"},{label:"a",isMandatory:!1,type:"component",route:"select-gender",hideInEmployee:!0,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"select-payment-preference"},{label:"a",isMandatory:!1,type:"component",route:"select-payment-preference",key:"selectPaymentPreference",hideInEmployee:!0,component:"SelectPaymentPreference",texts:{headerCaption:"",header:"ES_FSM_PAYMENT_PREFERENCE_LABEL",cardText:"ES_FSM_PAYMENT_PREFERENCE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:null},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTripData"},{type:"component",key:"advancepaymentPreference",withoutLabel:!0,component:"AdvanceCollection"}],E.indexRoute="select-trip-number",l.createElement(a.Switch,null,E.map((e,t)=>{const{component:n,texts:i,inputs:o,key:r}=e,u="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return l.createElement(a.Route,{path:`${s.path}/${e.route}`,key:t},l.createElement(u,{config:{texts:i,inputs:o,key:r},onSelect:C,onSkip:N,t:d,formData:_}))}),l.createElement(a.Route,{path:s.path+"/check"},l.createElement(Ne,{onSubmit:function(){try{return p.push(o+"/new-application/response"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:_})),l.createElement(a.Route,{path:s.path+"/response"},l.createElement(Me,{data:_,onSuccess:()=>{f(),u.invalidateQueries("FSM_CITIZEN_SEARCH"),g(!0)}})),l.createElement(a.Route,null,l.createElement(a.Redirect,{to:`${s.path}/${E.indexRoute}`}))))},FSMMyApplications:()=>{const{t:e}=i.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),{info:a}=Digit.UserService.getUser(),{isLoading:o,data:{data:{table:r}={}}={}}=Digit.Hooks.fsm.useSearchAll(n,{uuid:a.uuid,limit:100});return o?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,e("CS_FSM_APPLICATION_TITLE_MY_APPLICATION")),(null==r?void 0:r.length)>0&&r.map((e,t)=>l.createElement("div",{key:t},l.createElement(Ie,{application:e}))),0===r.length&&l.createElement(t.Card,null,l.createElement("p",{style:{textAlign:"center"}},`${e("FSM_NO_APPLICATION")} ${a.mobileNumber}`))))},FSMCitizenApplicationDetails:()=>{var e,n;const{t:o}=i.useTranslation(),{id:r}=a.useParams(),u=a.useHistory(),{state:s}=a.useLocation(),d=(null==s?void 0:s.tenantId)||Digit.ULBService.getCurrentTenantId(),{isLoading:c,data:p}=Digit.Hooks.fsm.useApplicationDetail(o,d,r,{},"CITIZEN");return c||!p?l.createElement(t.Loader,null):(0===(null==p||null===(e=p.applicationDetails)||void 0===e?void 0:e.length)&&u.goBack(),l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between",maxWidth:"960px"},className:"cardHeaderWithOptions"},l.createElement(t.Header,null,o("CS_FSM_APPLICATION_DETAIL_TITLE_APPLICATION_DETAILS")),l.createElement("div",null,l.createElement(t.LinkButton,{label:o("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}))),l.createElement(t.Card,{style:{position:"relative"}},null==p||null===(n=p.applicationDetails)||void 0===n?void 0:n.map((e,n)=>{let{title:i,value:a,child:r,caption:u,map:s}=e;return l.createElement(t.KeyNote,{key:n,keyValue:o(i),note:o(a)||(!s||!r)&&"N/A",caption:o(u)},r&&"object"==typeof r?l.createElement(r.element,{...r}):r)}),l.createElement("div",{id:"timeline"},l.createElement(he,{application:null==p?void 0:p.pdfData,id:r})))))},FSMSelectRating:e=>{var o;let{parentRoute:r}=e;const{t:u}=i.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),d=a.useHistory();let{id:c}=a.useParams();const{data:p}=Digit.Hooks.fsm.useSearch(s,{applicationNos:c}),{isLoading:m,data:v}=Digit.Hooks.fsm.useMDMS(s,"FSM","Checklist"),[E,_]=(Digit.Hooks.fsm.useApplicationUpdate(s),n.useState({})),[S,f]=n.useState(!1),[y,T]=n.useState(!1),[g,h,I]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[C,N,A]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[D,O,L]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);if(n.useEffect(()=>{h(!1),L(),A()},[]),m)return l.createElement(t.Loader,null);const P=e=>{switch(e){case"SINGLE_SELECT":return"radio";case"MULTI_SELECT":return"checkbox";case"DROP_DOWN":return"dropDown";default:return"checkbox"}},b=(e,t)=>{if("DROP_DOWN"===e){let e=[];return t.map(t=>{e.push({active:!0,citizenOnly:!1,code:t,i18nKey:t,name:t})}),e}return t},R=(e,t,n)=>{switch(e){case"SINGLE_SELECT":return E[t];case"DROP_DOWN":return n.find(e=>e.code===E[t]);default:return null}},M=null==v||null===(o=v.FSM)||void 0===o?void 0:o.CheckList.map(e=>{return{type:P(e.type),checkLabels:b(e.type,e.options),onSelect:"SINGLE_SELECT"===e.type||"DROP_DOWN"===e.type?(n=e.type,i=e.code,"DROP_DOWN"===n?e=>{_({...E,[i]:e.code})}:e=>{_({...E,[i]:e})}):null,selectedOption:R(e.type,e.code,b(e.type,e.options)),name:e.code,label:"SPILLAGE"===e.code?u("CS_FSM_APPLICATION_RATE_HELP_TEXT"):e.code,error:y?l.createElement(t.CardLabelError,null,u("CS_FEEDBACK_SELECT_ERROR")):null,className:"hhh"};var n,i}),k={texts:{header:u("CS_APPLICATION_DETAILS_RATE_US"),submitBarLabel:u("CS_COMMON_SUBMIT")},inputs:[{type:"rate",maxRating:5,label:u("CS_FSM_APPLICATION_RATE_TEXT"),error:S?l.createElement(t.CardLabelError,null,u("CS_FEEDBACK_ENTER_RATING_ERROR")):null},...M,{type:"textarea",label:u("CS_COMMON_COMMENTS"),name:"comments",className:"Hello"}]};return l.createElement("div",{className:"fsm-citizen-rating-wrapper"},l.createElement(t.RatingCard,{config:k,t:u,onSelect:function(e){const{rating:t,comments:n,SAFETY_GEARS_USED:l}=e;if(0===t||0===l.length)return f(0===t),void T(0===l.length);const i={...e,...E};let a=Object.keys(i).reduce((e,t)=>("comments"===t||"rating"===t||e.push({code:t,value:Array.isArray(i[t])?i[t].join(","):i[t]}),e),[]);p.additionalDetails={...p.additionalDetails,CheckList:a},d.push(r+"/response",{applicationData:p,key:"update",action:"RATE",actionData:{rating:t,comments:n}})}})," ")},FSMDsoDashboard:()=>{var e,a;const o=Digit.ULBService.getCurrentTenantId(),{t:r}=i.useTranslation(),[u,s]=n.useState("-"),[d,c]=n.useState(!0),[p,m]=n.useState(!1),v={limit:10,offset:0,uuid:{code:"ASSIGNED_TO_ME",name:r("ES_INBOX_ASSIGNED_TO_ME")},sortBy:"createdTime",sortOrder:"DESC",total:!0},{data:E}=Digit.Hooks.fsm.useVendorDetail();n.useEffect(()=>{if(null!=E&&E.vendor){const{vendor:e}=E;Digit.UserService.setExtraRoleDetails(e[0]),m(!0)}},[E]);const{data:_}=Digit.Hooks.fsm.useInbox(o,{...v},{enabled:p},!0),S=n.useMemo(()=>{var e,t;return{[r("ES_COMPLETION_PENDING")]:(null==_||null===(e=_.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===e?void 0:e.count)||0,[r("ES_VEHICLE_ASSIGNMENT_PENDING")]:(null==_||null===(t=_.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===t?void 0:t.count)||0}},[null==_?void 0:_.totalCount]),f=n.useMemo(()=>[{link:"/digit-ui/citizen/fsm/inbox",label:r("ES_TITLE_INBOX"),count:u}],[u]);if(n.useEffect(()=>{if(_){var e,t;const n=(null==_||null===(e=_.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===e?void 0:e.count)+(null==_||null===(t=_.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===t?void 0:t.count);s(n),Object.keys(S).length&&c(!1)}},[S,_]),d)return l.createElement(t.Loader,null);const y={Icon:l.createElement(t.ShippingTruck,null),moduleName:r("ES_TITLE_FAECAL_SLUDGE_MGMT"),kpis:[{count:(null==_||null===(e=_.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===e?void 0:e.count)||0,label:r("ES_COMPLETION_PENDING"),link:"/digit-ui/citizen/fsm/inbox"},{count:(null==_||null===(a=_.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===a?void 0:a.count)||0,label:r("ES_VEHICLE_ASSIGNMENT_PENDING"),link:"/digit-ui/citizen/fsm/inbox"}],links:f};return l.createElement("div",{className:"ground-container moduleCardWrapper"},l.createElement(t.EmployeeModuleCard,y))},FSMRegistry:()=>{var e,o;const{t:r}=i.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),[s,d]=n.useState({}),[c,p]=n.useState([{id:"createdTime",desc:!0}]),[m,v]=n.useState(0),[E,_]=n.useState(10),[S,f]=n.useState("VENDOR"),[y,T]=n.useState(""),[g,h]=n.useState(""),[I,C]=n.useState([]),N=a.useHistory(),A=a.useLocation(),D=new URLSearchParams(A.search).get("selectedTabs"),[O,L]=n.useState(!1);Digit.UserService.getUser();let P={limit:E,offset:m,sortBy:null==c||null===(e=c[0])||void 0===e?void 0:e.id,sortOrder:null!=c&&null!==(o=c[0])&&void 0!==o&&o.desc?"DESC":"ASC"};const{data:b,isLoading:R,refetch:M}="VEHICLE"===D?Digit.Hooks.fsm.useVehiclesSearch({tenantId:u,filters:{...P,registrationNumber:null==s?void 0:s.registrationNumber,status:"ACTIVE,DISABLED"},config:{enabled:!1}}):"DRIVER"===D?Digit.Hooks.fsm.useDriverSearch({tenantId:u,filters:{...P,name:null==s?void 0:s.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}}):Digit.Hooks.fsm.useVendorSearch({tenantId:u,filters:{...P,name:null==s?void 0:s.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}}),{data:k,isLoading:w,refetch:F}=Digit.Hooks.fsm.useDsoSearch(u,{vehicleIds:y,driverIds:g},{enabled:!1}),x=(null==b?void 0:b.totalCount)||50;n.useEffect(()=>{M()},[]),n.useEffect(()=>{v(0),M()},[s]),n.useEffect(()=>{M()},[s,c,m,E]),n.useEffect(()=>{if(null!=b&&b.vehicle&&"VEHICLE"===D){const e=b.vehicle.map(e=>e.id).filter(Boolean).join(",");T(e),C(null==b?void 0:b.vehicle)}if(null!=b&&b.driver&&"DRIVER"===D){const e=b.driver.map(e=>e.id).filter(Boolean).join(",");h(e),C(null==b?void 0:b.driver)}if(null!=b&&b.vendor&&"VENDOR"===D){const e=b.vendor.map(e=>{var t,n,l,i;return{mobileNumber:null===(t=e.owner)||void 0===t?void 0:t.mobileNumber,name:e.name,id:e.id,auditDetails:e.auditDetails,drivers:e.drivers,activeDrivers:null===(n=e.drivers)||void 0===n?void 0:n.filter(e=>"ACTIVE"===e.status),allVehicles:e.vehicles,dsoDetails:e,vehicles:null===(l=e.vehicles)||void 0===l||null===(i=l.filter(e=>"ACTIVE"===e.status))||void 0===i?void 0:i.map(e=>({id:e.id,registrationNumber:null==e?void 0:e.registrationNumber,type:e.type,i18nKey:"FSM_VEHICLE_TYPE_"+e.type,capacity:e.tankCapacity,suctionType:e.suctionType,model:e.model}))}});C(e)}},[b]),n.useEffect(()=>{""===y&&""===g||F()},[y,g]),n.useEffect(()=>{if(k){if("VEHICLE"===D){const e=null==b?void 0:b.vehicle.map(e=>{let t=k.find(t=>{var n,l;return null===(n=t.dsoDetails)||void 0===n||null===(l=n.vehicles)||void 0===l?void 0:l.find(t=>t.id===e.id)});if(t){var n,l;let i={...e,vendor:t.dsoDetails};const a=null===(n=t.dsoDetails)||void 0===n||null===(l=n.vehicles)||void 0===l?void 0:l.find(t=>t.id===e.id);return a&&(i.driverData=a.driverData||a.driver||i.driverData),i}return e});C(e),T("")}if("DRIVER"===D){const e=null==b?void 0:b.driver.map(e=>{let t=k.find(t=>{var n,l;return null===(n=t.dsoDetails)||void 0===n||null===(l=n.drivers)||void 0===l?void 0:l.find(t=>t.id===e.id)});return t?{...e,vendor:t.dsoDetails}:e});C(e),h("")}}},[k,b]);let H="VEHICLE"===D?[{label:r("ES_FSM_REGISTRY_SEARCH_VEHICLE_NUMBER"),name:"registrationNumber",labelChildren:l.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},l.createElement(t.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{width:"150px",left:"230%",fontSize:"14px"}},r("ES_FSM_VEHICLE_FORMAT_TIP")))}]:"DRIVER"===D?[{label:r("ES_FSM_REGISTRY_SEARCH_DRIVER_NAME"),name:"name"}]:[{label:r("ES_FSM_REGISTRY_SEARCH_VENDOR_NAME"),name:"name"}];const V=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&p(e)},[]);return n.useEffect(()=>{M(),F()},[]),l.createElement("div",null,l.createElement(t.Header,null,r("ES_FSM_REGISTRY")),l.createElement(yt,{data:{table:I},isLoading:R||w,onSort:V,disableSort:!1,sortParams:c,userRole:"VEHICLE_ADMIN",onFilterChange:()=>{},searchFields:H,onSearch:function(e){void 0===e&&(e={}),d({...e})},onNextPage:()=>{v(e=>e+E)},onPrevPage:()=>{v(e=>e-E)},currentPage:Math.floor(m/E),pageSizeLimit:E,onPageSizeChange:e=>{_(Number(e.target.value))},totalRecords:x||0,onTabChange:e=>{f(e),D!==e&&N.push("/digit-ui/employee/fsm/registry?selectedTabs="+e)},selectedTab:D,refetchData:()=>{M()},refetchVendor:()=>{F()}}))},VendorDetails:e=>{var i,a,r,u;let{t:s,config:d,onSelect:c,userType:p,formData:m}=e;const v=Digit.UserService.getUser().info,E=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].applicantName||(null==m||null===(i=m.ownerKey)||void 0===i?void 0:i.applicantName)||"",_=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].emailId||(null==m||null===(a=m.ownerKey)||void 0===a?void 0:a.emailId)||"",S=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].mobileNumber||(null==m||null===(r=m.ownerKey)||void 0===r?void 0:r.mobileNumber)||(null==v?void 0:v.mobileNumber),f=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].altMobileNumber||(null==m||null===(u=m.ownerKey)||void 0===u?void 0:u.altmobileNumber)||"",[y,T]=n.useState(""),[g,h]=n.useState(""),[I,C]=n.useState(""),[N,A]=n.useState(""),[D,O]=n.useState(),[L,P]=n.useState(""),[b,R]=n.useState(""),[M,k]=n.useState(""),[w,F]=n.useState(""),[x,H]=n.useState(""),[V,B]=n.useState(""),[U,Y]=n.useState(""),[G,W]=n.useState(""),[K,z]=n.useState(""),[j,X]=n.useState(""),[$,q]=n.useState(""),[Z,Q]=n.useState(""),[J,ee]=n.useState("");n.useEffect(()=>{11!==L.length||N||D||$?11===L.length&&N&&D?(A(N),O(D),q($)):(A(""),O(""),q("")):fetch("https://ifsc.razorpay.com/"+L).then(e=>e.json()).then(e=>{e&&e.BANK&&e.BRANCH&&e.MICR&&(A(e.BANK),O(e.BRANCH),q(e.MICR))}).catch(()=>{})},[L]);const te=Digit.ULBService.getCurrentTenantId(),{control:ne}=o.useForm(),{data:le}=Digit.Hooks.fsm.useDsoSearch(te,{staleTime:Infinity});n.useEffect(()=>{if(le){const e=le.find(e=>e.id);e&&(C(e.name),h(e.id))}},[le]);const ie=()=>{let e,t=m.ownerKey&&m.ownerKey[0];"citizen"===p?(e={...t,applicantName:E,mobileNumber:S,altMobileNumber:f,emailId:_},c(d.key,{...m[d.key],...e},!1,0)):(e={...t,VendorCategory:y,name:I,VendorId:g,Bank:N,BankbranchName:D,IFSC:L,AccountNo:b,PanNo:M,GstNo:w,GstState:x,RegistrationNo:V,EpfNo:U,EsiNo:G,VendorType:K,Status:j,micrNo:$,PhoneNo:Z,ContactPerson:J},c(d.key,e,!1,0))};return n.useEffect(()=>{"citizen"===p&&ie()},[y,g,I,N,D,L,b,M,w,x,V,U,G,K,j,$,Z,J,p]),l.createElement(l.Fragment,null,l.createElement(t.VerticalTimeline,{config:[{timeLine:[{actions:s("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:s("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:s("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(t.FormStep,{config:d,onSelect:ie,t:s,className:"formcomposer-grid-container-form"},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},l.createElement(t.CustomTooltip,{label:""+s("IFSC_CODE"),isMandatory:!1,message:s("INVALID_IFSC_CODE_ERROR_MESSAGE")})),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"IFSC",value:L,placeholder:"Enter IFSC Code",onChange:function(e){const t=e.target.value.replace(/[^a-zA-Z0-9]/g,"");t.length<=11&&P(t)},style:{width:"100%"},maxLength:11,ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[A-Z]{4}0[A-Z0-9]{6}$",type:"text",title:s("INVALID_IFSC_CODE_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("VENDOR_BANK_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bankName",placeholder:"Bank Name Auto Select",style:{width:"100%"},value:N,onChange:function(e){A(e.target.value)},disabled:!0})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("VENDOR_BANK_BRANCH_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BankbranchName",value:D,style:{width:"100%"},placeholder:"Bank Branch Name Auto Select",onChange:function(e){O(e.target.value)},disabled:!1})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("VENDOR_MICR_NO")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"MicrNo",value:$,style:{width:"100%"},placeholder:"MICR No",onChange:q,disabled:!1})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("ACCOUNT_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AccountNo",value:b,onChange:function(e){R(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"[0-9]{9,18}",type:"text",title:s("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("PHONE_NO")),l.createElement(t.MobileNumber,{value:Z,name:"PhoneNo",onChange:Q,style:{width:"100%"}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("CONTACT_PERSON")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"ContactPerson",value:J,onChange:function(e){ee(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("PAN_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"PanNo",value:M,onChange:function(e){k(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"[A-Z]{5}[0-9]{4}[A-Z]{1}",type:"text",title:s("INVALID_PAN_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("GST_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstNo",value:w,onChange:function(e){F(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",type:"text",title:s("INVALID_GST_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("GST_REGISTERED_STATE/UT")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstState",value:x,onChange:function(e){H(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("PT_NAME_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("REGISTRATION_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"RegistrationNo",value:V,onChange:function(e){B(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("INVALID_REGISTRATION_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("EPF_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EpfNo",value:U,onChange:function(e){Y(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,15}$",type:"text",title:s("INVALID_EPF_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("ESI_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EsiNo",value:G,onChange:function(e){W(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("INVALID_ESI_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement("div",null,s("VENDOR_TYPE"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+s("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:ne,name:"VendorType",defaultValue:K,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{selected:K,select:z,option:[{i18nKey:"Supplier",code:"SUPPLIER"},{i18nKey:"Contractor",code:"CONTRACTOR"}],optionKey:"i18nKey",placeholder:"Select",t:s})})),l.createElement(t.LabelFieldPair,null,l.createElement("div",null,s("VENOR_CATEGORY"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}}))),l.createElement(o.Controller,{control:ne,name:"VendorCategory",defaultValue:y,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{selected:y,select:T,option:[{i18nKey:"Firm",code:"FIRM"},{i18nKey:"Individual",code:"Individual"}],optionKey:"i18nKey",placeholder:"Select",t:s})})),l.createElement(t.LabelFieldPair,null,l.createElement("div",null,s("STATUS"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+s("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:ne,name:"Status",defaultValue:j,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{selected:j,select:X,option:[{i18nKey:"Active",code:"ACTIVE"},{i18nKey:"Inactive",code:"INACTIVE"}],optionKey:"i18nKey",placeholder:"Select",t:s})})))))},AddVendor:e=>{const o=Digit.ULBService.getCurrentTenantId(),{t:r}=i.useTranslation(),u=a.useHistory(),[s,d]=n.useState(1),[c,p]=n.useState(null),[,m]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,v]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,E]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:_}=Digit.Hooks.fsm.useVendorCreate(o);n.useEffect(()=>{m(!1),E(),v()},[]);const S={serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},[f,y]=n.useState(S),T=Rt(r,!1,f),g=()=>{p(null)};return l.createElement(l.Fragment,null,l.createElement(t.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:"New Vendor Details",currentStep:1}]},{route:"address-details",timeLine:[{actions:"Address Details",currentStep:2}]}],currentActiveIndex:s-1,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(t.FormComposer,{config:T,userType:"employee",onFormValueChange:(e,t)=>{var n,l,i,a;const o=(null==t||null===(n=t.zoneIds)||void 0===n?void 0:n.map(e=>{var t;return null==e||null===(t=e[1])||void 0===t?void 0:t.code}))||[],u=(null==f?void 0:f.zoneIds)||[],c=o.join(",")!==u.join(",");((null==t||null===(l=t.serviceType)||void 0===l?void 0:l.code)!==(null==f||null===(i=f.serviceType)||void 0===i?void 0:i.code)||c)&&y(e=>({...e,serviceType:null==t?void 0:t.serviceType})),c&&y(e=>({...e,zoneIds:o})),(null==t?void 0:t.vendorName)&&(null==t?void 0:t.phone)&&(null==t||null===(a=t.serviceType)||void 0===a?void 0:a.code)?1===s&&(d(2),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(r("ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100)):2===s&&(d(1),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(r("ES_VRNDOR_NEW_VENDOR_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100))},label:r("ES_COMMON_APPLICATION_SUBMIT"),onSubmit:e=>{var t,n,l,i,a,r,s,d,c,m,v,E,S,f,y,T;console.log("-=-=-=-=-=-==-",e);const h=e,I=null==h?void 0:h.propertyAddress,C=null==I?void 0:I.pincode,N=null==I?void 0:I.streetName,A=null==I?void 0:I.houseNo,D=null==I?void 0:I.landmark,O=null==I||null===(t=I.city)||void 0===t?void 0:t.name,L=null==I||null===(n=I.city)||void 0===n?void 0:n.name,P=null==I||null===(l=I.city)||void 0===l?void 0:l.name,b=null==I||null===(i=I.city)||void 0===i?void 0:i.name,R=null==I||null===(a=I.locality)||void 0===a?void 0:a.code,M=null==I||null===(r=I.locality)||void 0===r?void 0:r.name,k=null==I?void 0:I.subLocality,w=null==I||null===(s=I.ward)||void 0===s?void 0:s.code,F=null==I||null===(d=I.ward)||void 0===d?void 0:d.name,x=null==h?void 0:h.vendorName,H=null==h||null===(c=h.plotNo)||void 0===c?void 0:c.trim(),V=null==h||null===(m=h.buildingName)||void 0===m?void 0:m.trim(),B=null==h?void 0:h.emailId,U=null==h?void 0:h.phone,Y="EKYC"===(null==h||null===(v=h.serviceType)||void 0===v?void 0:v.code);let G={tenantId:o,name:x,agencyType:"ULB",paymentPreference:"post-service",address:{tenantId:o,landmark:D,doorNo:A,plotNo:H,street:N,city:O,district:P,region:b,state:L,country:"india",pincode:C,buildingName:V,locality:{code:R||"",name:M||"",label:"Locality",area:k||""},ward:w?{code:w,name:F}:void 0,geoLocation:{latitude:(null==h||null===(E=h.address)||void 0===E?void 0:E.latitude)||28.6139,longitude:(null==h||null===(S=h.address)||void 0===S?void 0:S.longitude)||77.209}},owner:{tenantId:"dl",name:(null==h?void 0:h.ownerName)||x,fatherOrHusbandName:(null==h?void 0:h.fatherOrHusbandName)||x,relationship:(null==h||null===(f=h.relationship)||void 0===f?void 0:f.code)||"OTHER",gender:(null==h||null===(y=h.gender)||void 0===y?void 0:y.code)||"MALE",dob:null!=h&&h.dob?new Date(h.dob).getTime():new Date("1/1/1970").getTime(),emailId:B||"",mobileNumber:U},additionalDetails:{serviceType:Y?"ekyc":null==h||null===(T=h.serviceType)||void 0===T?void 0:T.code},vehicles:[],drivers:[],source:Y?"eKYC Portal":"WhatsApp"};var W,K;Y&&(G={...G,zoneIds:(null==h||null===(W=h.zoneIds)||void 0===W?void 0:W.map(e=>{var t;return null==e||null===(t=e[1])||void 0===t?void 0:t.code}))||[],clusterIds:(null==h||null===(K=h.clusterIds)||void 0===K?void 0:K.map(e=>{var t;return null==e||null===(t=e[1])||void 0===t?void 0:t.code}))||[],contractStartDate:h.contractStartDate?new Date(h.contractStartDate).getTime():null,contractEndDate:h.contractEndDate?new Date(h.contractEndDate).getTime():null}),console.log(G);const z={vendor:G};Y&&(z.RequestInfo={apiId:"Rainmaker",msgId:"ekyc-vendor-create"}),_(z,{onError:e=>{p({key:"error",action:e}),setTimeout(g,5e3)},onSuccess:(e,t)=>{p({key:"success",action:"ADD_VENDOR"}),setTimeout(()=>{g(),u.push("/digit-ui/employee/vendor/search-vendor")},2e3)}})},defaultValues:S,noCard:!0,noBreakLine:!0}),c&&l.createElement(t.Toast,{error:"error"===c.key,label:r("success"===c.key?`ES_FSM_REGISTRY_${c.action}_SUCCESS`:c.action),onClose:g})))},EditVendor:()=>{const e=Digit.ULBService.getCurrentTenantId();let{id:o}=a.useParams();const[u,s]=n.useState(null),[d,c]=n.useState(!1),[p,m]=n.useState({}),[v,E]=n.useState({}),_=r.useQueryClient(),[,S]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,f]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,y]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{data:T,isLoading:g}=Digit.Hooks.fsm.useDsoSearch(e,{ids:o},{staleTime:Infinity}),{mutate:h}=Digit.Hooks.fsm.useVendorUpdate(e);n.useEffect(()=>{S(!1),y(),f()},[]),n.useEffect(()=>{if(T&&T[0]){var e,t,n,l,i,a,o,r,u,s,d,c,p,v,_,S,f,y,g,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B;let U=T[0];E(null==U?void 0:U.dsoDetails);let Y={vendorName:null==U?void 0:U.name,street:null==U||null===(e=U.dsoDetails)||void 0===e||null===(t=e.address)||void 0===t?void 0:t.street,doorNo:null==U||null===(n=U.dsoDetails)||void 0===n||null===(l=n.address)||void 0===l?void 0:l.doorNo,plotNo:null==U||null===(i=U.dsoDetails)||void 0===i||null===(a=i.address)||void 0===a?void 0:a.plotNo,landmark:null==U||null===(o=U.dsoDetails)||void 0===o||null===(r=o.address)||void 0===r?void 0:r.landmark,pincode:null==U||null===(u=U.dsoDetails)||void 0===u||null===(s=u.address)||void 0===s?void 0:s.pincode,buildingName:null==U||null===(d=U.dsoDetails)||void 0===d||null===(c=d.address)||void 0===c?void 0:c.buildingName,address:{pincode:null==U||null===(p=U.dsoDetails)||void 0===p||null===(v=p.address)||void 0===v?void 0:v.pincode,locality:{...null==U||null===(_=U.dsoDetails)||void 0===_||null===(S=_.address)||void 0===S?void 0:S.locality,i18nkey:`${null==U||null===(f=U.dsoDetails)||void 0===f?void 0:f.tenantId.toUpperCase().split(".").join("_")}_REVENUE_${null==U||null===(y=U.dsoDetails)||void 0===y?void 0:y.address.locality.code}`}},phone:null==U?void 0:U.mobileNumber,ownerName:null==U||null===(g=U.dsoDetails)||void 0===g||null===(h=g.owner)||void 0===h?void 0:h.name,fatherOrHusbandName:null==U||null===(I=U.dsoDetails)||void 0===I||null===(C=I.owner)||void 0===C?void 0:C.fatherOrHusbandName,relationship:null==U||null===(N=U.dsoDetails)||void 0===N||null===(A=N.owner)||void 0===A?void 0:A.relationship,selectGender:null==U||null===(D=U.dsoDetails)||void 0===D||null===(O=D.owner)||void 0===O?void 0:O.gender,dob:(null==U||null===(L=U.dsoDetails)||void 0===L||null===(P=L.owner)||void 0===P?void 0:P.dob)&&Digit.DateUtils.ConvertTimestampToDate(null==U||null===(b=U.dsoDetails)||void 0===b||null===(R=b.owner)||void 0===R?void 0:R.dob,"yyyy-MM-dd"),emailId:"abc@egov.com"===(null==U||null===(M=U.dsoDetails)||void 0===M||null===(k=M.owner)||void 0===k?void 0:k.emailId)?"":null==U||null===(w=U.dsoDetails)||void 0===w||null===(F=w.owner)||void 0===F?void 0:F.emailId,correspondenceAddress:null==U||null===(x=U.dsoDetails)||void 0===x||null===(H=x.owner)||void 0===H?void 0:H.correspondenceAddress,additionalDetails:null==U||null===(V=U.dsoDetails)||void 0===V||null===(B=V.additionalDetails)||void 0===B?void 0:B.description};m(Y)}},[T]);const{t:I}=i.useTranslation(),C=a.useHistory(),N=Rt(I,!0),A=()=>{s(null)};return g||0===Object.keys(p).length?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(t.VerticalTimeline,{config:[{timeLine:[{actions:I("ES_FSM_REGISTRY_TITLE_EDIT_VENDOR"),currentStep:1}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(t.FormComposer,{isDisabled:!d,label:I("ES_COMMON_APPLICATION_SUBMIT"),config:N.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,r,u,d,c,p,m,E,S,f,y,T,g,I,N,D,O,L,P,b;const R=null==e?void 0:e.vendorName,M=null==e?void 0:e.phone,k=null==e?void 0:e.pincode,w=null==e||null===(t=e.street)||void 0===t?void 0:t.trim(),F=null==e||null===(n=e.doorNo)||void 0===n?void 0:n.trim(),x=null==e||null===(l=e.plotNo)||void 0===l?void 0:l.trim(),H=null==e||null===(i=e.landmark)||void 0===i?void 0:i.trim(),V=null==e||null===(a=e.address)||void 0===a||null===(r=a.city)||void 0===r?void 0:r.name,B=null==e||null===(u=e.address)||void 0===u||null===(d=u.city)||void 0===d?void 0:d.state,U=null==e||null===(c=e.address)||void 0===c||null===(p=c.city)||void 0===p?void 0:p.name,Y=null==e||null===(m=e.address)||void 0===m||null===(E=m.city)||void 0===E?void 0:E.name,G=null==e||null===(S=e.buildingName)||void 0===S?void 0:S.trim(),W=null==e||null===(f=e.address)||void 0===f||null===(y=f.locality)||void 0===y?void 0:y.code,K=null==e||null===(T=e.address)||void 0===T||null===(g=T.locality)||void 0===g?void 0:g.name,z=null==e||null===(I=e.address)||void 0===I||null===(N=I.locality)||void 0===N?void 0:N.area,j=null==e?void 0:e.additionalDetails,X=null==e||null===(D=e.selectGender)||void 0===D?void 0:D.code,$=null==e?void 0:e.emailId,q=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime(),Z={vendor:{...v,name:R,address:{...v.address,landmark:H,doorNo:F,plotNo:x,street:w,city:V,district:U,region:Y,state:B,country:"in",pincode:k,buildingName:G,locality:{...v.address.locality,code:W||"",name:K||"",label:"Locality",area:z||""},geoLocation:{...v.address.geoLocation,latitude:(null==e||null===(O=e.address)||void 0===O?void 0:O.latitude)||0,longitude:(null==e||null===(L=e.address)||void 0===L?void 0:L.longitude)||0}},owner:{...v.owner,gender:X||(null===(P=v.owner)||void 0===P?void 0:P.gender)||"OTHER",dob:q,emailId:$||"abc@egov.com",mobileNumber:M,relationship:(null===(b=v.owner)||void 0===b?void 0:b.relationship)||"OTHER"},additionalDetails:{...v.additionalDetails,description:j}}};h(Z,{onError:(e,t)=>{s({key:"error",action:e}),setTimeout(A,5e3)},onSuccess:(e,t)=>{s({key:"success",action:"UPDATE_VENDOR"}),setTimeout(A,5e3),_.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{A(),C.push("/digit-ui/employee/fsm/registry/vendor-details/"+o)},5e3)}})},defaultValues:p,onFormValueChange:(e,t)=>{var n;null!=t&&t.phone&&null!=t&&null!==(n=t.address)&&void 0!==n&&n.locality?c(!0):c(!1)},noBreakLine:!0}),u&&l.createElement(t.Toast,{error:"error"===u.key,label:I("success"===u.key?`ES_FSM_REGISTRY_${u.action}_SUCCESS`:u.action),onClose:A})))},VehicleDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=i.useTranslation(),c=a.useHistory(),p=r.useQueryClient();let{id:m}=a.useParams();const[v,E]=n.useState(!1),[_,S]=n.useState(null),[f,y]=n.useState(!1),[T,g]=n.useState(null),[h,I]=n.useState([]),[C,N]=n.useState({}),[A,D]=n.useState(null),{data:O,isLoading:L,refetch:P}=Digit.Hooks.fsm.useVehicleDetails(s,{registrationNumber:m},{staleTime:Infinity});n.useEffect(()=>{var e,t;!L&&O&&D(null==O||null===(e=O[0])||void 0===e||null===(t=e.vehicleData)||void 0===t?void 0:t.id)},[O,L]);const{data:b}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:R}=Digit.Hooks.fsm.useUpdateVehicle(s),{mutate:M}=Digit.Hooks.fsm.useVendorUpdate(s);function k(e){S(e),E(!1)}n.useEffect(()=>{if(b){let e=b.map(e=>e.dsoDetails);I(e)}},[b]),n.useEffect(()=>{P()},[]),n.useEffect(()=>{switch(_){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return y(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-vehicle/"+m);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE")}},[_]);const w=()=>{g(null)},F=()=>{S(null),N({}),y(!1)},x=()=>"DELETE"===_||"DELETE_VENDOR"===_?l.createElement(Tt,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===_||"EDIT_VENDOR"===_?l.createElement(l.Fragment,null,l.createElement(t.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(t.Dropdown,{t:d,option:h,value:C,selected:C,select:N,optionKey:"name"})):void 0;return L||L?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(t.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==O||null===(o=O[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},n>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),l.createElement(t.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(i=e.values)||void 0===i?void 0:i.map((e,n)=>l.createElement(l.Fragment,{key:n},l.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("span",{className:"add-details-link hover-button",onClick:()=>k("ADD_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.AddIcon,{className:"",fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>k("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.EditIcon,null)),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>k("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.DeleteIcon,{className:"delete",fill:"#a82227"}))):l.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))))}))),f&&l.createElement(t.Modal,{headerBarMain:l.createElement(gt,{label:d((()=>{switch(_){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(It,{onClick:F}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:F,actionSaveLabel:d("DELETE"===_||"DELETE_VENDOR"===_?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(_){case"DELETE":return(()=>{var e;const t={vehicle:{...null==O||null===(e=O[0])||void 0===e?void 0:e.vehicleData,status:"INACTIVE"}};R(t,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VEHICLE"}),p.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{w(),c.push("/digit-ui/employee/fsm/registry")},5e3)}}),y(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n;let l={},i=null==O||null===(e=O[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],a=null==i?void 0:i.vehicles;a=a.map(e=>(e.id===A&&(e.vendorVehicleStatus="INACTIVE"),e)),l={vendor:{...i,vehicles:a}},M(l,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VENDOR"}),p.invalidateQueries("FSM_VENDOR_SEARCH"),P(),setTimeout(w,5e3)}}),y(!1)})();case"ADD_VENDOR":return(()=>{var e;let t=C,n=null==O||null===(e=O[0])||void 0===e?void 0:e.vehicleData;n.vendorVehicleStatus="ACTIVE";const l={vendor:{...t,vehicles:t.vehicles?[...t.vehicles,n]:[n]}};M(l,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"ADD_VENDOR"}),P(),p.invalidateQueries("DSO_SEARCH"),setTimeout(w,5e3)}}),y(!1),S(null)})();case"EDIT_VENDOR":return(()=>{var e;let t=C,n=null==O||null===(e=O[0])||void 0===e?void 0:e.vehicleData;n.vendorVehicleStatus="ACTIVE";const l={vendor:{...t,vehicles:t.vehicles?[...t.vehicles,n]:[n]}};M(l,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"EDIT_VENDOR"}),P(),p.invalidateQueries("DSO_SEARCH"),setTimeout(w,5e3)}}),y(!1),S(null)})()}},formId:"modal-action"},"DELETE"===_||"DELETE_VENDOR"===_?x():l.createElement(t.Card,{style:{boxShadow:"none"}},x())),T&&l.createElement(t.Toast,{error:"error"===T.key,label:d("success"===T.key?`ES_FSM_REGISTRY_${T.action}_SUCCESS`:T.action),onClose:w}),l.createElement(t.ActionBar,{style:{zIndex:"19"}},v?l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:d,onSelect:k}):null,l.createElement(t.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>E(!v)})))},AddVehicle:e=>{const o=Digit.ULBService.getCurrentTenantId(),u=Digit.ULBService.getStateId(),[s,d]=n.useState(null),c=a.useHistory(),p=r.useQueryClient(),[m,v,E]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[_,S,f]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[y,T,g]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:h}=Digit.Hooks.fsm.useVehicleCreate(o);n.useEffect(()=>{v(!1),g(),f()},[]);const{t:I}=i.useTranslation(),C=Nt(I);C[0].body.forEach(e=>{"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.label&&(e.labelChildren=l.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},l.createElement(t.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{width:"150px",left:"230%",fontSize:"14px"}},I(e.populators.validation.title))))});const[N,A]=n.useState(!1),D=()=>{d(null)},O=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,I("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"))),l.createElement("div",{style:O?{}:{marginLeft:"-15px"}},l.createElement(t.FormComposer,{isDisabled:!N,label:I("ES_COMMON_APPLICATION_SUBMIT"),config:C.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,r,s;const m=null==e?void 0:e.registrationNumber,v=null==e||null===(t=e.vehicle)||void 0===t||null===(n=t.type)||void 0===n?void 0:n.code,E=null==e||null===(l=e.vehicle)||void 0===l||null===(i=l.modal)||void 0===i?void 0:i.code,_=null==e||null===(a=e.vehicle)||void 0===a||null===(r=a.type)||void 0===r?void 0:r.capacity,S=new Date(""+(null==e?void 0:e.pollutionCert)).getTime(),f=new Date(""+(null==e?void 0:e.insurance)).getTime(),y=new Date(""+(null==e?void 0:e.roadTax)).getTime(),T=new Date(""+(null==e?void 0:e.fitnessValidity)).getTime(),g=null==e?void 0:e.ownerName,I=null==e?void 0:e.phone,C=null==e?void 0:e.additionalDetails,N=null==e||null===(s=e.selectGender)||void 0===s?void 0:s.code,A=null==e?void 0:e.emailId,O=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime();h({vehicle:{tenantId:o,registrationNumber:m,model:E,type:v,tankCapacity:_,suctionType:"SEWER_SUCTION_MACHINE",pollutionCertiValidTill:S,InsuranceCertValidTill:f,fitnessValidTill:T,roadTaxPaidTill:y,gpsEnabled:!0,source:"Municipal records",owner:{tenantId:u,name:g,fatherOrHusbandName:g,relationship:"OTHER",gender:"OTHERS",dob:O,emailId:"abc@egov.com",correspondenceAddress:"",mobileNumber:I,gender:N,dob:O,emailId:A||"abc@egov.com"},additionalDetails:{description:C}}},{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(D,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"ADD_VEHICLE"}),setTimeout(D,5e3),p.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{D(),c.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE")},5e3)}})},defaultValues:{tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var n,l;null!=t&&t.registrationNumber&&null!=t&&t.ownerName&&null!=t&&t.phone&&null!=t&&null!==(n=t.vehicle)&&void 0!==n&&n.modal&&null!=t&&null!==(l=t.vehicle)&&void 0!==l&&l.type&&null!=t&&t.selectGender?A(!0):A(!1)},noBreakLine:!0}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:I("success"===s.key?`ES_FSM_REGISTRY_${s.action}_SUCCESS`:s.action),onClose:D})))},EditVehicle:e=>{const o=Digit.ULBService.getCurrentTenantId();Digit.ULBService.getStateId();let{id:u}=a.useParams();const[s,d]=n.useState(null),[c,p]=n.useState(!1),[m,v]=n.useState({}),[E,_]=n.useState({}),S=r.useQueryClient(),[f,y,T]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[g,h,I]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[C,N,A]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{data:D,isLoading:O}=Digit.Hooks.fsm.useVehicleDetails(o,{registrationNumber:u},{staleTime:Infinity}),{mutate:L}=Digit.Hooks.fsm.useUpdateVehicle(o);n.useEffect(()=>{y(!1),A(),I()},[]),n.useEffect(()=>{if(D&&D[0]){var e,t,n,l,i,a,o,r,u,s,d,c,p,m,E,S,f,y,T,g,h,I,C,N,A,O,L,P;let b=D[0];_(null==b?void 0:b.vehicleData);let R={registrationNumber:null==b||null===(e=b.vehicleData)||void 0===e?void 0:e.registrationNumber,vehicle:{type:null==b||null===(t=b.vehicleData)||void 0===t?void 0:t.type,modal:null==b||null===(n=b.vehicleData)||void 0===n?void 0:n.model,tankCapacity:null==b||null===(l=b.vehicleData)||void 0===l?void 0:l.tankCapacity},pollutionCert:(null==b||null===(i=b.vehicleData)||void 0===i?void 0:i.pollutionCertiValidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(a=b.vehicleData)||void 0===a?void 0:a.pollutionCertiValidTill,"yyyy-MM-dd"),insurance:(null==b||null===(o=b.vehicleData)||void 0===o?void 0:o.InsuranceCertValidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(r=b.vehicleData)||void 0===r?void 0:r.InsuranceCertValidTill,"yyyy-MM-dd"),roadTax:(null==b||null===(u=b.vehicleData)||void 0===u?void 0:u.roadTaxPaidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(s=b.vehicleData)||void 0===s?void 0:s.roadTaxPaidTill,"yyyy-MM-dd"),fitnessValidity:(null==b||null===(d=b.vehicleData)||void 0===d?void 0:d.fitnessValidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(c=b.vehicleData)||void 0===c?void 0:c.fitnessValidTill,"yyyy-MM-dd"),phone:null==b||null===(p=b.vehicleData)||void 0===p||null===(m=p.owner)||void 0===m?void 0:m.mobileNumber,ownerName:null==b||null===(E=b.vehicleData)||void 0===E||null===(S=E.owner)||void 0===S?void 0:S.name,selectGender:null==b||null===(f=b.vehicleData)||void 0===f||null===(y=f.owner)||void 0===y?void 0:y.gender,dob:(null==b||null===(T=b.vehicleData)||void 0===T||null===(g=T.owner)||void 0===g?void 0:g.dob)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(h=b.vehicleData)||void 0===h||null===(I=h.owner)||void 0===I?void 0:I.dob,"yyyy-MM-dd"),emailId:"abc@egov.com"===(null==b||null===(C=b.vehicleData)||void 0===C||null===(N=C.owner)||void 0===N?void 0:N.emailId)?"":null==b||null===(A=b.vehicleData)||void 0===A||null===(O=A.owner)||void 0===O?void 0:O.emailId,additionalDetails:null==b||null===(L=b.vehicleData)||void 0===L||null===(P=L.additionalDetails)||void 0===P?void 0:P.description};v(R)}},[D]);const{t:P}=i.useTranslation(),b=a.useHistory(),R=Nt(P,!1);R[0].body.forEach(e=>{"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.label&&(e.labelChildren=l.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},l.createElement(t.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{width:"150px",left:"230%",fontSize:"14px"}},P(e.populators.validation.title))))});const M=()=>{d(null)};return O||0==Object.keys(m).length?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{isDisabled:!c,label:P("ES_COMMON_APPLICATION_SUBMIT"),config:R.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,o,r,s,c,p,m,v,_,f,y,T,g,h;const I=(null==e||null===(t=e.vehicle)||void 0===t||null===(n=t.type)||void 0===n?void 0:n.code)||(null==e||null===(l=e.vehicle)||void 0===l?void 0:l.type),C=(null==e||null===(i=e.vehicle)||void 0===i||null===(a=i.modal)||void 0===a?void 0:a.code)||(null==e||null===(o=e.vehicle)||void 0===o?void 0:o.modal),N=(null==e||null===(r=e.vehicle)||void 0===r||null===(s=r.type)||void 0===s?void 0:s.capacity)||(null==e||null===(c=e.vehicle)||void 0===c?void 0:c.tankCapacity),A=(null==e?void 0:e.pollutionCert)>0||(null==e||null===(p=e.pollutionCert)||void 0===p?void 0:p.length)>0?new Date(""+(null==e?void 0:e.pollutionCert)).getTime():null,D=(null==e?void 0:e.insurance)>0||(null==e||null===(m=e.insurance)||void 0===m?void 0:m.length)>0?new Date(""+(null==e?void 0:e.insurance)).getTime():null,O=(null==e?void 0:e.roadTax)>0||(null==e||null===(v=e.roadTax)||void 0===v?void 0:v.length)>0?new Date(""+(null==e?void 0:e.roadTax)).getTime():null,P=(null==e?void 0:e.fitnessValidity)>0||(null==e||null===(_=e.fitnessValidity)||void 0===_?void 0:_.length)>0?new Date(""+(null==e?void 0:e.fitnessValidity)).getTime():null,R=null==e?void 0:e.additionalDetails,k=(null==e||null===(f=e.selectGender)||void 0===f?void 0:f.code)||(null==e?void 0:e.selectGender)||(null===(y=E.owner)||void 0===y?void 0:y.gender)||"OTHER",w=null!=e&&e.dob?new Date(""+e.dob).getTime():null===(T=E.owner)||void 0===T?void 0:T.dob,F={vehicle:{...E,registrationNumber:null==e?void 0:e.registrationNumber,model:C,type:I,tankCapacity:N,pollutionCertiValidTill:A,InsuranceCertValidTill:D,fitnessValidTill:P,roadTaxPaidTill:O,additionalDetails:{...E.additionalDetails,description:R},owner:{...E.owner,gender:k,dob:w,emailId:(null==e?void 0:e.emailId)||"abc@egov.com",name:(null==e?void 0:e.ownerName)||(null===(g=E.owner)||void 0===g?void 0:g.name),mobileNumber:(null==e?void 0:e.phone)||(null===(h=E.owner)||void 0===h?void 0:h.mobileNumber)}}};L(F,{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"UPDATE_VEHICLE"}),setTimeout(M,5e3),S.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{M(),b.push("/digit-ui/employee/fsm/registry/vehicle-details/"+((null==e?void 0:e.registrationNumber)||u))},5e3)}})},defaultValues:m,onFormValueChange:(e,t)=>{var n,l,i,a,o,r;if(null!=t&&t.registrationNumber){let n=(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"");if(t.length<=2)return t;const n=t.slice(0,2),l=t.slice(2);if(!l)return n;const i=l.match(/^(\d{1,2})/);if(!i)return n+"-"+l;const a=i[1],o=l.slice(a.length),r=o.match(/^([A-Z]*)/),u=r?r[1]:"",s=o.slice(u.length);if(!s)return n+"-"+a+u;if(u.length>=3){const e=u.length<=3?1:2;return n+"-"+a+u.slice(0,e)+"-"+u.slice(e)+"-"+s.slice(0,4)}return n+"-"+a+u+"-"+s.slice(0,4)})(t.registrationNumber);n.length>15&&(n=n.slice(0,15)),n!==t.registrationNumber&&e("registrationNumber",n)}null!=t&&t.registrationNumber&&null!=t&&t.ownerName&&null!=t&&t.phone&&(null!=t&&null!==(n=t.vehicle)&&void 0!==n&&null!==(l=n.modal)&&void 0!==l&&l.code||null!=t&&null!==(i=t.vehicle)&&void 0!==i&&i.modal)&&(null!=t&&null!==(a=t.vehicle)&&void 0!==a&&null!==(o=a.type)&&void 0!==o&&o.code||null!=t&&null!==(r=t.vehicle)&&void 0!==r&&r.type)&&null!=t&&t.selectGender&&null!=t&&t.dob&&new Date(null==t?void 0:t.dob).getTime()<=(new Date).setFullYear((new Date).getFullYear()-18)?p(!0):p(!1)},noBreakLine:!0,formClassName:"vehicle-details-card"}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:P("success"===s.key?`ES_FSM_REGISTRY_${s.action}_SUCCESS`:s.action),onClose:M}))},SelectVehicle:e=>{var i;let{t:a,config:o,onSelect:r,formData:u,setValue:s}=e;const d=Digit.ULBService.getStateId(),{data:c}=Digit.Hooks.fsm.useMDMS(d,"Vehicle","VehicleMakeModel");Digit.ULBService.getCurrentTenantId();const[p,m]=n.useState([]),[v,E]=n.useState({}),[_,S]=n.useState([]),[f,y]=n.useState({}),[T,g]=n.useState("");return n.useEffect(()=>{if(c){var e;const t=c.filter(e=>{var t,n,l;return e.code===((null==u||null===(t=u.vehicle)||void 0===t||null===(n=t.modal)||void 0===n?void 0:n.code)||(null==u||null===(l=u.vehicle)||void 0===l?void 0:l.modal))}),n=c.filter(e=>{var t,n,l;return e.code===((null==u||null===(t=u.vehicle)||void 0===t||null===(n=t.type)||void 0===n?void 0:n.code)||(null==u||null===(l=u.vehicle)||void 0===l?void 0:l.type))});E(...t),y(...n),g(null==u||null===(e=u.vehicle)||void 0===e?void 0:e.tankCapacity)}},[c]),n.useEffect(()=>{var e;null!=v&&v.code&&(null==v?void 0:v.code)!==(null==u||null===(e=u.vehicle)||void 0===e?void 0:e.modal)&&(y(""),g(""),s("additionalDetails",""),s("pollutionCert",void 0),s("insurance",void 0),s("roadTax",void 0),s("fitnessValidity",void 0))},[null==u||null===(i=u.vehicle)||void 0===i?void 0:i.modal]),n.useEffect(()=>{if(c){const e=c.filter(e=>void 0===e.make),t=c.filter(e=>{var t,n,l;return null!=(null==u||null===(t=u.vehicle)||void 0===t?void 0:t.modal)&&(null==e?void 0:e.make)===(null==u||null===(n=u.vehicle)||void 0===n||null===(l=n.modal)||void 0===l?void 0:l.code)});S(t),m(e)}},[c]),l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,a("ES_FSM_REGISTRY_VEHICLE_MODEL"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:v,disable:!1,option:null==p?void 0:p.sort((e,t)=>e.name.localeCompare(t.name)),select:e=>{const t=c.filter(t=>t.make===e.code);S(t),E(e),r(o.key,{...u[o.key],modal:e,type:""})},optionKey:"name",t:a})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,a("ES_FSM_REGISTRY_VEHICLE_TYPE"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:f,option:null==_?void 0:_.sort((e,t)=>e.name.localeCompare(t.name)),select:e=>{g(e.capacity),y(e),r(o.key,{...u[o.key],type:e})},optionKey:"name",t:a})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,a("ES_FSM_REGISTRY_VEHICLE_CAPACITY"),o.isMandatory?" * ":null),l.createElement(t.TextInput,{className:"",value:T,onChange:()=>{},disable:!0})))},AddDriver:e=>{const o=Digit.ULBService.getCurrentTenantId(),u=Digit.ULBService.getStateId(),[s,d]=n.useState(null),c=a.useHistory(),p=r.useQueryClient(),[m,v,E]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[_,S,f]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[y,T,g]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:h}=Digit.Hooks.fsm.useDriverCreate(o);n.useEffect(()=>{v(!1),g(),f()},[]);const{t:I}=i.useTranslation(),C=Pt(I),[N,A]=n.useState(!1),D=()=>{d(null)},O=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,I("ES_FSM_REGISTRY_TITLE_NEW_DRIVER"))),l.createElement("div",{style:O?{}:{marginLeft:"-15px"}},l.createElement(t.FormComposer,{isDisabled:!N,label:I("ES_COMMON_APPLICATION_SUBMIT"),config:C.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t;const n=null==e?void 0:e.driverName,l=null==e?void 0:e.license,i=null==e||null===(t=e.selectGender)||void 0===t?void 0:t.code,a=null==e?void 0:e.emailId,r=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime();h({driver:{tenantId:o,name:n,licenseNumber:l,additionalDetails:null==e?void 0:e.additionalDetails,status:"ACTIVE",owner:{tenantId:u,name:n,fatherOrHusbandName:n,relationship:"OTHER",gender:i,dob:r,emailId:a||"abc@egov.com"},vendorDriverStatus:"INACTIVE"}},{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(D,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"ADD_DRIVER"}),setTimeout(D,5e3),p.invalidateQueries("FSM_DRIVER_SEARCH"),setTimeout(()=>{D(),c.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER")},5e3)}})},defaultValues:{tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{A(!(null==t||!t.driverName||null==t||!t.selectGender))},noBreakLine:!0}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:I("success"===s.key?`ES_FSM_${s.action}_SUCCESS`:s.action),onClose:D})))},DriverDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=i.useTranslation(),c=a.useHistory(),p=r.useQueryClient(),{id:m}=a.useParams(),[v,E]=n.useState(!1),[_,S]=n.useState(null),[f,y]=n.useState(!1),[T,g]=n.useState(null),[h,I]=n.useState([]),[C,N]=n.useState({}),{data:A,isLoading:D,refetch:O}=Digit.Hooks.fsm.useDriverDetails(s,{ids:m},{staleTime:Infinity}),{data:L}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:P}=Digit.Hooks.fsm.useDriverUpdate(s),{mutate:b}=Digit.Hooks.fsm.useVendorUpdate(s);function R(e){S(e),E(!1)}n.useEffect(()=>{if(L){let e=L.map(e=>e.dsoDetails);I(e)}},[L]),n.useEffect(()=>{O()},[]),n.useEffect(()=>{switch(_){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return y(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-driver/"+m);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER")}},[_]);const M=()=>{g(null)},k=()=>{S(null),N({}),y(!1)},w=()=>"DELETE"===_||"DELETE_VENDOR"===_?l.createElement(Tt,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===_||"EDIT_VENDOR"===_?l.createElement(l.Fragment,null,l.createElement(t.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(t.Dropdown,{t:d,option:h,value:C,selected:C,select:N,optionKey:"name"})):void 0;return D||D?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(t.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==A||null===(o=A[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},n>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),l.createElement(t.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(i=e.values)||void 0===i?void 0:i.map((e,n)=>l.createElement(l.Fragment,{key:n},l.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("span",{className:"add-details-link hover-button",onClick:()=>R("ADD_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.AddIcon,{className:"",fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>R("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.EditIcon,null)),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>R("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.DeleteIcon,{className:"delete",fill:"#a82227"}))):l.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))))}))),f&&l.createElement(t.Modal,{headerBarMain:l.createElement(At,{label:d((()=>{switch(_){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(Ot,{onClick:k}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:k,actionSaveLabel:d("DELETE"===_||"DELETE_VENDOR"===_?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(_){case"DELETE":return(()=>{var e;const t={driver:{...null==A||null===(e=A[0])||void 0===e?void 0:e.driverData,status:"INACTIVE"}};P(t,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_DRIVER"}),p.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{M(),c.push("/digit-ui/employee/fsm/registry")},5e3)}}),y(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n,l;let i={},a=null==A||null===(e=A[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],o=null==a?void 0:a.drivers;o=o.map(e=>(e.id===m&&(e.vendorDriverStatus="INACTIVE"),e)),i={vendor:{...a,owner:{...a.owner,gender:(null===(l=a.owner)||void 0===l?void 0:l.gender)||"OTHERS"},drivers:o}},b(i,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VENDOR"}),p.invalidateQueries("FSM_VENDOR_SEARCH"),O(),setTimeout(M,5e3)}}),y(!1)})();case"ADD_VENDOR":return(()=>{var e,t;let n=C,l=null==A||null===(e=A[0])||void 0===e?void 0:e.driverData;l.vendorDriverStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:n.drivers?[...n.drivers,l]:[l]}};b(i,{onError:(e,t)=>{g({key:"error",action:e}),O(),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"ADD_VENDOR"}),p.invalidateQueries("DSO_SEARCH"),O(),setTimeout(M,5e3)}}),y(!1),S(null)})();case"EDIT_VENDOR":return(()=>{var e,t;let n=C,l=null==A||null===(e=A[0])||void 0===e?void 0:e.driverData;l.vendorDriverStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:n.drivers?[...n.drivers,l]:[l]}};b(i,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"EDIT_VENDOR"}),O(),p.invalidateQueries("DSO_SEARCH"),setTimeout(M,5e3)}}),y(!1),S(null)})()}},formId:"modal-action"},"DELETE"===_||"DELETE_VENDOR"===_?w():l.createElement(t.Card,{style:{boxShadow:"none"}},w())),T&&l.createElement(t.Toast,{error:"error"===T.key,label:d("success"===T.key?`ES_FSM_REGISTRY_${T.action}_SUCCESS`:T.action),onClose:M}),l.createElement(t.ActionBar,{style:{zIndex:"19"}},v?l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:d,onSelect:R}):null,l.createElement(t.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>E(!v)})))},EditDriver:e=>{const o=Digit.ULBService.getCurrentTenantId();Digit.ULBService.getStateId();let{id:u}=a.useParams();const[s,d]=n.useState(null),[c,p]=n.useState(!1),[m,v]=n.useState({}),[E,_]=n.useState({}),S=r.useQueryClient(),[f,y,T]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[g,h,I]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[C,N,A]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{data:D,isLoading:O}=Digit.Hooks.fsm.useDriverDetails(o,{ids:u},{staleTime:Infinity}),{mutate:L}=Digit.Hooks.fsm.useDriverUpdate(o);n.useEffect(()=>{y(!1),A(),I()},[]),n.useEffect(()=>{if(D&&D[0]){var e,t,n,l,i,a,o,r,u,s,d,c,p,m;let E=D[0];_(null==E?void 0:E.driverData);let S={driverName:null==E||null===(e=E.driverData)||void 0===e?void 0:e.name,license:null==E||null===(t=E.driverData)||void 0===t?void 0:t.licenseNumber,selectGender:null==E||null===(n=E.driverData)||void 0===n||null===(l=n.owner)||void 0===l?void 0:l.gender,dob:(null==E||null===(i=E.driverData)||void 0===i||null===(a=i.owner)||void 0===a?void 0:a.dob)&&Digit.DateUtils.ConvertTimestampToDate(null==E||null===(o=E.driverData)||void 0===o||null===(r=o.owner)||void 0===r?void 0:r.dob,"yyyy-MM-dd"),emailId:"abc@egov.com"===(null==E||null===(u=E.driverData)||void 0===u||null===(s=u.owner)||void 0===s?void 0:s.emailId)?"":null==E||null===(d=E.driverData)||void 0===d||null===(c=d.owner)||void 0===c?void 0:c.emailId,additionalDetails:null==E||null===(p=E.driverData)||void 0===p||null===(m=p.additionalDetails)||void 0===m?void 0:m.description};v(S)}},[D]);const{t:P}=i.useTranslation(),b=a.useHistory(),R=Pt(P,!0),M=()=>{d(null)};return O||0==Object.keys(m).length?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(t.FormComposer,{isDisabled:!c,label:P("ES_COMMON_APPLICATION_SUBMIT"),config:R.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n;const l=null==e?void 0:e.license,i=null==e||null===(t=e.selectGender)||void 0===t?void 0:t.code,a=null==e?void 0:e.emailId,o=new Date(""+e.dob).getTime(),r=null==e?void 0:e.additionalDetails,s={driver:{...E,licenseNumber:l,additionalDetails:r,owner:{...E.owner,relationship:(null===(n=E.owner)||void 0===n?void 0:n.relationship)||"OTHER",gender:i||E.owner.gender||"OTHER",dob:o,emailId:a||"abc@egov.com"}}};L(s,{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"UPDATE_DRIVER"}),setTimeout(M,5e3),S.invalidateQueries("FSM_DRIVER_SEARCH"),setTimeout(()=>{M(),b.push("/digit-ui/employee/fsm/registry/driver-details/"+u)},5e3)}})},defaultValues:m,onFormValueChange:(e,t)=>{p(!(null==t||!t.selectGender))},noBreakLine:!0}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:P("success"===s.key?`ES_FSM_REGISTRY_${s.action}_SUCCESS`:s.action),onClose:M})))},FsmBreadCrumb:e=>{var a,o,r,u,s,d,c,p,m,v,E,_,S,f,y,T,g;let{location:h}=e;const{t:I}=i.useTranslation(),C=Digit.UserService.hasAccess(["FSM_DSO"]),N=Digit.UserService.hasAccess(["FSM_EMP_FSTPO"]),A=null==h||null===(a=h.pathname)||void 0===a?void 0:a.includes("application-details"),D=null==h||null===(o=h.pathname)||void 0===o?void 0:o.includes("fstp-operator-details"),O=null==h||null===(r=h.pathname)||void 0===r?void 0:r.includes("inbox"),L=null==h||null===(u=h.pathname)||void 0===u?void 0:u.includes("fsm"),P=null==h||null===(s=h.pathname)||void 0===s?void 0:s.includes("search"),b=null==h||null===(d=h.pathname)||void 0===d?void 0:d.includes("registry"),R=null==h||null===(c=h.pathname)||void 0===c?void 0:c.includes("vendor-details"),M=null==h||null===(p=h.pathname)||void 0===p?void 0:p.includes("modify-vendor"),k=null==h||null===(m=h.pathname)||void 0===m?void 0:m.includes("new-application"),w=null==h||null===(v=h.pathname)||void 0===v?void 0:v.includes("vehicle-details"),F=null==h||null===(E=h.pathname)||void 0===E?void 0:E.includes("modify-vehicle"),x=null==h||null===(_=h.pathname)||void 0===_?void 0:_.includes("driver-details"),H=null==h||null===(S=h.pathname)||void 0===S?void 0:S.includes("modify-driver"),V=null==h||null===(f=h.pathname)||void 0===f?void 0:f.includes("modify-application"),B=null==h||null===(y=h.pathname)||void 0===y?void 0:y.includes("new-vendor"),U=null==h||null===(T=h.pathname)||void 0===T?void 0:T.includes("new-vehicle"),Y=null==h||null===(g=h.pathname)||void 0===g?void 0:g.includes("new-driver"),[G,W]=n.useState(!1),[K,z]=n.useState(!1);n.useEffect(()=>{if(G?(L||O&&G)&&W(!1):W(P),null!=h&&h.pathname){let e=null==h?void 0:h.pathname.split("/");z(e[e.length-1])}},[h]);const j=[{path:C?"/digit-ui/citizen/fsm/dso-dashboard":"/digit-ui/employee",content:I("ES_COMMON_HOME"),show:L},{path:b?"/digit-ui/employee/fsm/registry?selectedTabs=VENDOR":N?"/digit-ui/employee/fsm/fstp-inbox":"/digit-ui/employee",content:D?I("ES_TITLE_INBOX"):"FSM",show:L},{path:k?"/digit-ui/employee/fsm/new-application":"",content:I("FSM_NEW_DESLUDGING_APPLICATION"),show:L&&k},{path:"",content:""+I("FSM_SUCCESS"),show:!!h.pathname.includes("/employee/fsm/response")},{path:O||P||A?"/digit-ui/employee/fsm/inbox":"",content:I("ES_TITLE_INBOX"),show:L&&O||P||A},{path:"/digit-ui/employee/fsm/search",content:I("ES_TITILE_SEARCH_APPLICATION"),show:G},{content:I("ES_TITLE_APPLICATION_DETAILS"),show:A},{content:I("ES_TITLE_VEHICLE_LOG"),show:D},{path:"/digit-ui/employee/fsm/registry/vendor-details/"+K,content:I("ES_TITLE_VENDOR_DETAILS"),show:b&&(R||M)},{path:"/digit-ui/employee/fsm/registry/vehicle-details/"+K,content:I("ES_TITLE_VEHICLE_DETAILS"),show:b&&(w||F)},{path:"/digit-ui/employee/fsm/registry/driver-details/"+K,content:I("ES_TITLE_DRIVER_DETAILS"),show:b&&(x||H)},{content:I("ES_TITLE_VENDOR_EDIT"),show:b&&(M||F||H)},{path:"digit-ui/employee/fsm/modify-application/"+K,content:I("ES_FSM_APPLICATION_UPDATE"),show:V},{content:B?I("ES_FSM_ACTION_CREATE_VENDOR"):U?I("ES_FSM_REGISTRY_DETAILS_TYPE_VEHICLE"):Y?I("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"):null,show:b&&(B||U||Y)}];return l.createElement(t.BreadCrumb,{crumbs:j})},AdvanceCollection:e=>{var i,o,r,u,d,c;let{t:p,config:m,onSelect:v,formData:E,FSMTextFieldStyle:_}=e;const S=Digit.ULBService.getCurrentTenantId(),f=Digit.ULBService.getStateId(),{pathname:y}=a.useLocation();let{id:T}=a.useParams();const g=Digit.UserService.getUser(),[h,I]=n.useState(),[C,N]=n.useState(),{data:A}=Digit.Hooks.fsm.useSearch(S,{applicationNos:T,uuid:g.uuid},{staleTime:Infinity}),[D,O]=n.useState({label:null==E||null===(i=E.tripData)||void 0===i?void 0:i.vehicleCapacity}),[L,P]=n.useState(!1),{isLoading:b}=Digit.Hooks.fsm.useMDMS(f,"Vehicle","VehicleType",{staleTime:Infinity}),{isLoading:R}=Digit.Hooks.fsm.useDsoSearch(S,{limit:-1,status:"ACTIVE"}),M=[{label:"ES_NEW_APPLICATION_ADVANCE_COLLECTION",type:"text",name:"advanceAmount",validation:{isRequired:!0,min:"0",pattern:"^[0-9]+",title:p("ES_NEW_APPLICATION_AMOUNT_INVALID")},default:null==E?void 0:E.advanceAmount,isMandatory:!0}];function k(e){v(m.key,{...E[m.key],...e})}return n.useEffect(()=>{!function(){try{var e,t,n;(null==E||null===(e=E.tripData)||void 0===e?void 0:e.vehicleType)!==D&&O({label:null==E||null===(t=E.tripData)||void 0===t||null===(n=t.vehicleType)||void 0===n?void 0:n.capacity});const l=function(e,t,n,l){if(null!=E&&E.propertyType&&null!=E&&E.subtype&&null!=E&&E.address&&null!=E&&null!==(e=E.tripData)&&void 0!==e&&null!==(t=e.vehicleType)&&void 0!==t&&t.capacity&&"WITHIN_ULB_LIMITS"===(null==E||null===(n=E.address)||void 0===n||null===(l=n.propertyLocation)||void 0===l?void 0:l.code)){var i;const e=null==E||null===(i=E.tripData)||void 0===i?void 0:i.vehicleType.capacity,{slum:t}=E.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(S,{propertyType:null==E?void 0:E.subtype,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]),l=function(){if(null!=n&&n.price||0===(null==n?void 0:n.price)){const e=n.price*E.tripData.noOfTrips;return Promise.resolve(Digit.FSMService.advanceBalanceCalculate(S,{totalTripAmount:e})).then(function(t){var n;let{advanceAmount:l}=t;Digit.SessionStorage.set("total_amount",e),Digit.SessionStorage.set("advance_amount",l),I(e),N(l),(!y.includes("modify")||y.includes("modify")&&l>(null==E||null===(n=E.advancepaymentPreference)||void 0===n?void 0:n.advanceAmount))&&k({advanceAmount:l}),P(!1)})}sessionStorage.removeItem("Digit.total_amount"),sessionStorage.removeItem("Digit.advance_amount"),P(!0)}();if(l&&l.then)return l.then(function(){})})}}();l&&l.then&&l.then(function(){})}catch(e){Promise.reject(e)}}()},[null==E?void 0:E.propertyType,null==E?void 0:E.subtype,null==E||null===(o=E.address)||void 0===o?void 0:o.slum,null==E||null===(r=E.tripData)||void 0===r||null===(u=r.vehicleType)||void 0===u?void 0:u.capacity,null==E||null===(d=E.tripData)||void 0===d?void 0:d.noOfTrips]),n.useEffect(()=>{!function(){try{const e=function(e,t){if("FROM_GRAM_PANCHAYAT"===(null==E||null===(e=E.address)||void 0===e||null===(t=e.propertyLocation)||void 0===t?void 0:t.code)&&E.tripData.noOfTrips&&E.tripData.amountPerTrip){const e=E.tripData.amountPerTrip*E.tripData.noOfTrips;return Promise.resolve(Digit.FSMService.advanceBalanceCalculate(S,{totalTripAmount:e})).then(function(t){var n;let{advanceAmount:l}=t;Digit.SessionStorage.set("total_amount",e),Digit.SessionStorage.set("advance_amount",l),I(e),N(l),(!y.includes("modify")||y.includes("modify")&&l>(null==E||null===(n=E.advancepaymentPreference)||void 0===n?void 0:n.advanceAmount))&&k({advanceAmount:l}),P(!1)})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[E.tripData.noOfTrips,E.tripData.amountPerTrip]),b&&R?l.createElement(t.Loader,null):l.createElement("div",null,0!==(null==E||null===(c=E.tripData)||void 0===c?void 0:c.amountPerTrip)&&(null==M?void 0:M.map((e,n)=>{let i=E&&E[m.key]&&E[m.key][e.name];return l.createElement(l.Fragment,{key:n},l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},p(e.label)+" (₹)",e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({disabled:!!y.includes("modify"),type:e.type,key:e.name,style:_,onChange:e=>{v(m.key,{...E[m.key],advanceAmount:e.target.value})},value:e.default?e.default:E&&E[m.key]?E[m.key][e.name]:0},e.validation)),i>h&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},p("FSM_ADVANCE_AMOUNT_MAX")),i<C&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},p("FSM_ADVANCE_AMOUNT_MIN")),y.includes("modify-application")&&0===Number(C)&&(null==A?void 0:A.advanceAmount)>0&&0===Number(i)&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},p("FSM_ADVANCE_AMOUNT_NOT_ZERO")))))})))},SelectTrips:e=>{var i,o,r,u,d,c,p,m,v;let{t:E,config:_,onSelect:S,formData:f={},styles:y,FSMTextFieldStyle:T}=e;const g=Digit.ULBService.getCurrentTenantId(),h=Digit.ULBService.getStateId(),{pathname:I}=a.useLocation(),C=I.includes("/modify-application/");let{id:N}=a.useParams();const A=Digit.UserService.getUser(),{data:D}=Digit.Hooks.fsm.useSearch(g,{applicationNos:N,uuid:A.uuid},{staleTime:Infinity}),[O,L]=n.useState({label:null==f||null===(i=f.tripData)||void 0===i?void 0:i.vehicleCapacity}),[P,b]=n.useState(!1),{isLoading:R,data:M}=Digit.Hooks.fsm.useMDMS(h,"Vehicle","VehicleType",{staleTime:Infinity}),{data:k,isLoading:w}=Digit.Hooks.fsm.useDsoSearch(g,{limit:-1,status:"ACTIVE"}),[F,x]=n.useState([]);n.useEffect(()=>{if(k&&M){const e=k.reduce((e,t)=>t.vehicles&&t.vehicles.length?e.concat(t.vehicles):e,[]),t=Array.from(new Set(e.map(e=>e.capacity))).map(t=>e.find(e=>e.capacity===t));x(t)}},[k,M]);const H=[{label:"ES_NEW_APPLICATION_PAYMENT_NO_OF_TRIPS",type:"text",name:"noOfTrips",error:E("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID"),validation:{isRequired:!0,pattern:"^[1-9]+",min:"1",title:E("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID")},default:null==f||null===(o=f.tripData)||void 0===o?void 0:o.noOfTrips,disable:!1,isMandatory:!0},{label:"ES_NEW_APPLICATION_DISTANCE_FROM_ROAD",type:"text",name:"distancefromroad",default:null==f||null===(r=f.tripData)||void 0===r?void 0:r.distancefromroad,isMandatory:!0},{label:"ES_NEW_APPLICATION_ROAD_WIDTH",type:"text",name:"roadWidth",default:null==f||null===(u=f.tripData)||void 0===u?void 0:u.roadWidth,isMandatory:!0}];function V(e,t){e&&t&&S(_.key,{...f[_.key],[t]:e})}return n.useEffect(()=>{!function(){try{var e,t,n;(null==f||null===(e=f.tripData)||void 0===e?void 0:e.vehicleType)!==O&&L({label:null==f||null===(t=f.tripData)||void 0===t||null===(n=t.vehicleType)||void 0===n?void 0:n.capacity});const l=function(e,t){if("FROM_GRAM_PANCHAYAT"===(null==f||null===(e=f.address)||void 0===e||null===(t=e.propertyLocation)||void 0===t?void 0:t.code)&&f.tripData.noOfTrips&&f.tripData.amountPerTrip)V({amount:f.tripData.amountPerTrip*f.tripData.noOfTrips});else{const e=function(e,t,n,l){if(null!=f&&f.propertyType&&null!=f&&f.subtype&&null!=f&&f.address&&null!=f&&null!==(e=f.tripData)&&void 0!==e&&null!==(t=e.vehicleType)&&void 0!==t&&t.capacity&&"WITHIN_ULB_LIMITS"===(null==f||null===(n=f.address)||void 0===n||null===(l=n.propertyLocation)||void 0===l?void 0:l.code)){var i;const e=null==f||null===(i=f.tripData)||void 0===i?void 0:i.vehicleType.capacity,{slum:t}=f.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(g,{propertyType:null==f?void 0:f.subtype,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]);null!=n&&n.price||0===(null==n?void 0:n.price)?(V(n.price,"amountPerTrip"),V(n.price*f.tripData.noOfTrips,"amount"),b(!1)):(V({amountPerTrip:"",amount:""}),b(!0))})}}();if(e&&e.then)return e.then(function(){})}}();l&&l.then&&l.then(function(){})}catch(e){Promise.reject(e)}}()},[null==f?void 0:f.propertyType,null==f?void 0:f.subtype,null==f?void 0:f.address,null==f||null===(d=f.tripData)||void 0===d||null===(c=d.vehicleType)||void 0===c?void 0:c.capacity,null==f||null===(p=f.tripData)||void 0===p?void 0:p.noOfTrips,null==f||null===(m=f.address)||void 0===m||null===(v=m.propertyLocation)||void 0===v?void 0:v.code]),R&&w?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_NEW_APPLICATION_LOCATION_VEHICLE_REQUESTED")+" * "),l.createElement(t.Dropdown,{className:"form-field",style:y,isMandatory:!0,option:null==F?void 0:F.map(e=>({...e,label:e.capacity})).sort((e,t)=>e.capacity-t.capacity),optionKey:"label",id:"vehicle",selected:O,select:function(e){L({label:e.capacity}),S(_.key,{...f[_.key],vehicleType:e})},t:E,disable:!(!C||"CREATED"==(null==D?void 0:D.applicationStatus))})),null==H?void 0:H.map((e,n)=>l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},E(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({type:e.type,style:{...y,...T},onChange:t=>V(t.target.value,e.name),key:e.name,value:f&&f[_.key]?f[_.key][e.name]:null},e.validation,{disable:e.disable}))))),P?l.createElement(t.CardLabelError,{style:{width:"100%",textAlign:"center"}},E("ES_APPLICATION_BILL_SLAB_ERROR")):null)},PlusMinusInput:tt,ConfirmationBox:Tt,SelectLocalityOrGramPanchayat:e=>{var i,a,o,r,u,s,d,c,p,v;let{t:E,config:_,onSelect:S,userType:f,formData:y}=e;const T=Digit.Hooks.fsm.useTenants();let g=Digit.ULBService.getCurrentTenantId();var h;"employee"!==f&&(g=null===(h=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===h?void 0:h.code);const{data:I}=Digit.Hooks.fsm.useMDMS(g,"FSM","UrcConfig"),C=I&&I.length>0&&I[0].URCEnable,{pincode:N,propertyLocation:A}=(null==y?void 0:y.address)||"",D=window.sessionStorage.getItem("Digit_OBPS_PT"),O=JSON.parse(D),L="employee"===f?T.filter(e=>(null==e?void 0:e.code)===g):N?T.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==N)}):T,[P,b]=n.useState((null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o.locality)||(null==O||null===(r=O.address)||void 0===r?void 0:r.locality)||""),[R,M]=n.useState(),[k,w]=n.useState(),[F,x]=n.useState(()=>{var e,t;return null!=y&&null!==(e=y.address)&&void 0!==e&&e.gramPanchayat?null==y||null===(t=y.address)||void 0===t?void 0:t.gramPanchayat:{}}),[H,V]=n.useState([]),[B,U]=n.useState(()=>{var e,t;return null!=y&&null!==(e=y.address)&&void 0!==e&&e.village?null==y||null===(t=y.address)||void 0===t?void 0:t.village:{}}),[Y,G]=n.useState(),[W,K]=n.useState(),[z,j]=n.useState(),[X,$]=n.useState(()=>{var e;return(null==y||null===(e=y.address)||void 0===e?void 0:e.city)||Digit.SessionStorage.get("fsm.file.address.city")||null});n.useEffect(()=>{L&&1===L.length&&$(L[0])},[L]);var{data:q}=Digit.Hooks.useBoundaryLocalities(null==X?void 0:X.code,"gramPanchayats",{enabled:!!X},E),{data:Z}=Digit.Hooks.useBoundaryLocalities(null==X?void 0:X.code,"revenue",{enabled:!!X},E);function Q(e){b(e),"employee"===f&&S(_.key,{...y[_.key],locality:e})}function J(e){x(e);const t=null==q?void 0:q.filter(t=>(null==t?void 0:t.code)===(null==e?void 0:e.code))[0].children,n=null==t?void 0:t.map(e=>({...e,i18nkey:g.replace(".","_").toUpperCase()+"_REVENUE_"+(null==e?void 0:e.code)}));(null==n?void 0:n.length)>0&&V(n),"employee"===f&&S(_.key,{...y[_.key],gramPanchayat:e}),Digit.SessionStorage.del("locationType")}function ee(e){U(e),"employee"===f&&S(_.key,{...y[_.key],village:e})}n.useEffect(()=>{var e,t,n,l,i,a,o,r,u;null!=y&&null!==(e=y.cpt)&&void 0!==e&&null!==(t=e.details)&&void 0!==t&&null!==(n=t.address)&&void 0!==n&&n.locality&&"employee"===f&&(b(null==y||null===(l=y.cpt)||void 0===l||null===(i=l.details)||void 0===i||null===(a=i.address)||void 0===a?void 0:a.locality),S(_.key,{...y[_.key],locality:null==y||null===(o=y.cpt)||void 0===o||null===(r=o.details)||void 0===r||null===(u=r.address)||void 0===u?void 0:u.locality}))},[null==y||null===(u=y.cpt)||void 0===u||null===(s=u.details)||void 0===s||null===(d=s.address)||void 0===d?void 0:d.locality]),n.useEffect(()=>{if(X&&Z){var e,t,n,l;let r=Z,u=[];var i,a,o;null!=y&&null!==(e=y.address)&&void 0!==e&&e.locality&&"Locality"===(null==y||null===(t=y.address)||void 0===t||null===(n=t.additionalDetails)||void 0===n?void 0:n.boundaryType)&&(b(y.address.locality),j(null==y||null===(i=y.address)||void 0===i||null===(a=i.additionalDetails)||void 0===a?void 0:a.newLocality)),null!=y&&null!==(l=y.address)&&void 0!==l&&l.pincode&&(u=r.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==y.address.pincode)}),null!=y&&null!==(o=y.address)&&void 0!==o&&o.locality||b()),M(()=>u.length>0?u:r),1===u.length&&(b(u[0]),"employee"===f&&S(_.key,{...y[_.key],locality:u[0]}))}},[X,Z]),n.useEffect(()=>{var e,t;null!=y&&null!==(e=y.address)&&void 0!==e&&e.gramPanchayat&&J(null==y||null===(t=y.address)||void 0===t?void 0:t.gramPanchayat)},[q]),n.useEffect(()=>{var e,t,n;if(q&&(q&&q.length>0&&w(q),null!=y&&null!==(e=y.address)&&void 0!==e&&null!==(t=e.additionalDetails)&&void 0!==t&&null!==(n=t.gramPanchayat)&&void 0!==n&&n.code)){var l,i;const e=q.filter(e=>{var t,n,l;return(null==e?void 0:e.code)===(null==y||null===(t=y.address)||void 0===t||null===(n=t.additionalDetails)||void 0===n||null===(l=n.gramPanchayat)||void 0===l?void 0:l.code)})[0];x(e),K(null==y||null===(l=y.address)||void 0===l||null===(i=l.additionalDetails)||void 0===i?void 0:i.newGp);var a,o,r,u,s,d=null==e?void 0:e.children.filter(e=>{var t,n,l;return(null==e?void 0:e.code)===(null==y||null===(t=y.address)||void 0===t||null===(n=t.additionalDetails)||void 0===n||null===(l=n.village)||void 0===l?void 0:l.code)});d.length>0?(d[0].i18nkey=g.replace(".","_").toUpperCase()+"_REVENUE_"+(null===(a=d[0])||void 0===a?void 0:a.code),U(d[0]),V(d)):G("string"==typeof(null==y||null===(o=y.address)||void 0===o||null===(r=o.additionalDetails)||void 0===r?void 0:r.village)?null==y||null===(u=y.address)||void 0===u||null===(s=u.additionalDetails)||void 0===s?void 0:s.village:"")}},[q,null==y||null===(c=y.address)||void 0===c||null===(p=c.additionalDetails)||void 0===p||null===(v=p.gramPanchayat)||void 0===v?void 0:v.code]),"employee"!==f&&"FROM_GRAM_PANCHAYAT"===(null==A?void 0:A.code)&&(_.texts.cardText="CS_FILE_APPLICATION_PROPERTY_LOCATION_GRAM_PANCHAYAT_TEXT");const te=e=>{G(e),"employee"===f&&S(_.key,{...y[_.key],newVillage:e})},ne=e=>{K(e),"employee"===f&&S(_.key,{...y[_.key],newGp:e})},le=e=>{j(e),"employee"===f&&S(_.key,{...y[_.key],newLocality:e})};var ie,ae;return"employee"===f?l.createElement("div",null,"FROM_GRAM_PANCHAYAT"===(null==A?void 0:A.code)?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_GRAM_PANCHAYAT"),_.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:F,option:null==k?void 0:k.sort((e,t)=>e.name.localeCompare(t.name)),select:J,optionKey:"name",t:E})),"Other"===(null==F?void 0:F.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"newGp",key:"newGp",value:W,onChange:e=>ne(e.target.value)}))),H.length>0&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:B,option:null==H?void 0:H.sort((e,t)=>e.name.localeCompare(t.name)),select:ee,optionKey:"i18nkey",t:E})),0===H.length&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"village",key:"village",value:Y,onChange:e=>te(e.target.value)})))):C&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_CREATECOMPLAINT_MOHALLA"),_.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:P,option:null==Z?void 0:Z.sort((e,t)=>e.name.localeCompare(t.name)),select:Q,optionKey:"name",t:E})),"Other"===(null==y||null===(ie=y.address)||void 0===ie||null===(ae=ie.locality)||void 0===ae?void 0:ae.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"newLocality",key:"newLocality",value:z,onChange:e=>le(e.target.value)}))))):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:_,onSelect:function(){S(_.key,"FROM_GRAM_PANCHAYAT"===(null==A?void 0:A.code)?{gramPanchayat:F,village:B,newGramPanchayat:W,newVillage:Y}:{locality:P,newLocality:z})},isDisabled:"WITHIN_ULB_LIMITS"===(null==A?void 0:A.code)?P&&"Other"===(null==P?void 0:P.name)&&!z:F&&"Other"===(null==F?void 0:F.name)&&!W,t:E},"WITHIN_ULB_LIMITS"===(null==A?void 0:A.code)?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_CREATECOMPLAINT_MOHALLA")+" *"),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:P,option:null==Z?void 0:Z.sort((e,t)=>e.name.localeCompare(t.name)),select:Q,optionKey:"name",t:E})),"Other"===(null==P?void 0:P.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" *"),l.createElement(t.TextInput,{style:{width:"86%"},type:"text",id:"newLocality",key:"newLocality",value:z,onChange:e=>le(e.target.value)}))):l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_GRAM_PANCHAYAT")+" *"),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:F,option:null==k?void 0:k.sort((e,t)=>e.name.localeCompare(t.name)),select:J,optionKey:"i18nkey",t:E})),"Other"===(null==F?void 0:F.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")+" *"),l.createElement(t.TextInput,{style:{width:"86%"},type:"text",id:"newGp",key:"newGp",value:W,onChange:e=>ne(e.target.value)})),H.length>0&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:B,option:null==H?void 0:H.sort((e,t)=>e.name.localeCompare(t.name)),select:ee,optionKey:"i18nkey",t:E})),0===H.length&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement(t.TextInput,{style:{width:"86%"},type:"text",id:"village",key:"village",value:Y,onChange:e=>te(e.target.value)})))))}};exports.initFSMComponents=()=>{Object.entries(Mt).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
|
|
1
|
+
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@djb25/digit-ui-react-components"),n=require("react"),l=e(n),i=require("react-i18next"),a=require("react-router-dom"),o=require("react-hook-form"),r=require("react-query"),u=e(require("react-time-picker"));function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}const d=e=>"PROPERTYTYPE_MASTERS_"+e,c=e=>{if(e){const t=new Date(e);let n=t.getMonth()+1,l=t.getDate(),i=t.getFullYear();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,`${i}-${n}-${l}`}return null};let p=[];const m=e=>{let{currentStep:n=1,flow:a=""}=e;const{t:o}=i.useTranslation(),r=window.Digit.Utils.browser.isMobile();return(e=>{switch(e){case"STAKEHOLDER":p=[];break;case"APPLY":p=["FSM_TIMELINE_PROPERTY_DETAILS","FSM_GENDER_DETAILS","FSM_PAYMENT_DETAILS","FSM_TIMELINE_SUMMARY"];break;case"PT_APPLY":p=["ES_NEW_APPLICATION_PROPERTY_DETAILS","PT_OWNERSHIP_INFO_SUB_HEADER","CE_DOCUMENT_DETAILS","PT_COMMON_SUMMARY"];break;default:p=["TL_COMMON_TR_DETAILS","TL_LOCATION_AND_OWNER_DETAILS","TL_DOCUMENT_DETAIL","TL_COMMON_SUMMARY"]}})(a),l.createElement("div",{className:"timeline-container",style:r?{}:{maxWidth:"960px",marginRight:"auto"}},p.map((e,i,a)=>l.createElement("div",{className:"timeline-checkpoint",key:i},l.createElement("div",{className:"timeline-content"},l.createElement("span",{className:"circle "+(i<=n-1&&"active")},i<n-1?l.createElement(t.TickMark,null):i+1),l.createElement("span",{className:"secondary-color"},o(e))),i<a.length-1&&l.createElement("span",{className:"line "+(i<n-1&&"active")}))))};var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e,t){return e(t={exports:{}},t.exports),t.exports}var _="function"==typeof Symbol&&Symbol.for,S=_?Symbol.for("react.element"):60103,f=_?Symbol.for("react.portal"):60106,y=_?Symbol.for("react.fragment"):60107,T=_?Symbol.for("react.strict_mode"):60108,g=_?Symbol.for("react.profiler"):60114,h=_?Symbol.for("react.provider"):60109,I=_?Symbol.for("react.context"):60110,C=_?Symbol.for("react.async_mode"):60111,N=_?Symbol.for("react.concurrent_mode"):60111,A=_?Symbol.for("react.forward_ref"):60112,D=_?Symbol.for("react.suspense"):60113,O=_?Symbol.for("react.suspense_list"):60120,L=_?Symbol.for("react.memo"):60115,P=_?Symbol.for("react.lazy"):60116,b=_?Symbol.for("react.block"):60121,R=_?Symbol.for("react.fundamental"):60117,M=_?Symbol.for("react.responder"):60118,k=_?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case S:switch(e=e.type){case C:case N:case y:case g:case T:case D:return e;default:switch(e=e&&e.$$typeof){case I:case A:case P:case L:case h:return e;default:return t}}case f:return t}}}function F(e){return w(e)===N}var x={AsyncMode:C,ConcurrentMode:N,ContextConsumer:I,ContextProvider:h,Element:S,ForwardRef:A,Fragment:y,Lazy:P,Memo:L,Portal:f,Profiler:g,StrictMode:T,Suspense:D,isAsyncMode:function(e){return F(e)||w(e)===C},isConcurrentMode:F,isContextConsumer:function(e){return w(e)===I},isContextProvider:function(e){return w(e)===h},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===S},isForwardRef:function(e){return w(e)===A},isFragment:function(e){return w(e)===y},isLazy:function(e){return w(e)===P},isMemo:function(e){return w(e)===L},isPortal:function(e){return w(e)===f},isProfiler:function(e){return w(e)===g},isStrictMode:function(e){return w(e)===T},isSuspense:function(e){return w(e)===D},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===y||e===N||e===g||e===T||e===D||e===O||"object"==typeof e&&null!==e&&(e.$$typeof===P||e.$$typeof===L||e.$$typeof===h||e.$$typeof===I||e.$$typeof===A||e.$$typeof===R||e.$$typeof===M||e.$$typeof===k||e.$$typeof===b)},typeOf:w},H=E(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,i=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,o=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,d=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,_=e?Symbol.for("react.block"):60121,S=e?Symbol.for("react.fundamental"):60117,f=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function T(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var m=e.type;switch(m){case s:case d:case i:case o:case a:case p:return m;default:var _=m&&m.$$typeof;switch(_){case u:case c:case E:case v:case r:return _;default:return t}}case l:return t}}}var g=d,h=u,I=r,C=n,N=c,A=i,D=E,O=v,L=l,P=o,b=a,R=p,M=!1;function k(e){return T(e)===d}t.AsyncMode=s,t.ConcurrentMode=g,t.ContextConsumer=h,t.ContextProvider=I,t.Element=C,t.ForwardRef=N,t.Fragment=A,t.Lazy=D,t.Memo=O,t.Portal=L,t.Profiler=P,t.StrictMode=b,t.Suspense=R,t.isAsyncMode=function(e){return M||(M=!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.")),k(e)||T(e)===s},t.isConcurrentMode=k,t.isContextConsumer=function(e){return T(e)===u},t.isContextProvider=function(e){return T(e)===r},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return T(e)===c},t.isFragment=function(e){return T(e)===i},t.isLazy=function(e){return T(e)===E},t.isMemo=function(e){return T(e)===v},t.isPortal=function(e){return T(e)===l},t.isProfiler=function(e){return T(e)===o},t.isStrictMode=function(e){return T(e)===a},t.isSuspense=function(e){return T(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===d||e===o||e===a||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===v||e.$$typeof===r||e.$$typeof===u||e.$$typeof===c||e.$$typeof===S||e.$$typeof===f||e.$$typeof===y||e.$$typeof===_)},t.typeOf=T}()}),V=E(function(e){e.exports="production"===process.env.NODE_ENV?x:H}),B=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;function G(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var W=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,i=G(e),a=1;a<arguments.length;a++){for(var o in n=Object(arguments[a]))U.call(n,o)&&(i[o]=n[o]);if(B){l=B(n);for(var r=0;r<l.length;r++)Y.call(n,l[r])&&(i[l[r]]=n[l[r]])}}return i},K="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",z=Function.call.bind(Object.prototype.hasOwnProperty),j=function(){};if("production"!==process.env.NODE_ENV){var X=K,$={},q=z;j=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function Z(e,t,n,l,i){if("production"!==process.env.NODE_ENV)for(var a in e)if(q(e,a)){var o;try{if("function"!=typeof e[a]){var r=Error((l||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}o=e[a](t,a,l,n,null,X)}catch(e){o=e}if(!o||o instanceof Error||j((l||"React class")+": type specification of "+n+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof o+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),o instanceof Error&&!(o.message in $)){$[o.message]=!0;var u=i?i():"";j("Failed "+n+" type: "+o.message+(null!=u?u:""))}}}Z.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&($={})};var Q=Z,J=function(){};function ee(){return null}function te(){}function ne(){}"production"!==process.env.NODE_ENV&&(J=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),ne.resetWarningCache=te;var le=E(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:o(ee),arrayOf:function(e){return o(function(t,n,l,i,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=t[n];if(!Array.isArray(r))return new a("Invalid "+i+" `"+o+"` of type `"+d(r)+"` supplied to `"+l+"`, expected an array.");for(var u=0;u<r.length;u++){var s=e(r,u,l,i,o+"["+u+"]",K);if(s instanceof Error)return s}return null})},element:o(function(t,n,l,i,o){var r=t[n];return e(r)?null:new a("Invalid "+i+" `"+o+"` of type `"+d(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:o(function(e,t,n,l,i){var o=e[t];return V.isValidElementType(o)?null:new a("Invalid "+l+" `"+i+"` of type `"+d(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")}),instanceOf:function(e){return o(function(t,n,l,i,o){var r;return t[n]instanceof e?null:new a("Invalid "+i+" `"+o+"` of type `"+((r=t[n]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:o(function(e,t,n,l,i){return s(e[t])?null:new a("Invalid "+l+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return o(function(t,n,l,i,o){if("function"!=typeof e)return new a("Property `"+o+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=t[n],u=d(r);if("object"!==u)return new a("Invalid "+i+" `"+o+"` of type `"+u+"` supplied to `"+l+"`, expected an object.");for(var s in r)if(z(r,s)){var c=e(r,s,l,i,o+"."+s,K);if(c instanceof Error)return c}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&J(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."),ee;function t(t,n,l,o,r){for(var u=t[n],s=0;s<e.length;s++)if(i(u,e[s]))return null;var d=JSON.stringify(e,function(e,t){return"symbol"===c(t)?String(t):t});return new a("Invalid "+o+" `"+r+"` of value `"+String(u)+"` supplied to `"+l+"`, expected one of "+d+".")}return o(t)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&J("Invalid argument supplied to oneOfType, expected an instance of array."),ee;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return J("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(n)+" at index "+t+"."),ee}return o(function(t,n,l,i,o){for(var r=[],u=0;u<e.length;u++){var s=(0,e[u])(t,n,l,i,o,K);if(null==s)return null;s.data&&z(s.data,"expectedType")&&r.push(s.data.expectedType)}return new a("Invalid "+i+" `"+o+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return o(function(t,n,l,i,o){var r=t[n],s=d(r);if("object"!==s)return new a("Invalid "+i+" `"+o+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");for(var p in e){var m=e[p];if("function"!=typeof m)return u(l,i,o,p,c(m));var v=m(r,p,l,i,o+"."+p,K);if(v)return v}return null})},exact:function(e){return o(function(t,n,l,i,o){var r=t[n],s=d(r);if("object"!==s)return new a("Invalid "+i+" `"+o+"` of type `"+s+"` supplied to `"+l+"`, expected `object`.");var p=W({},t[n],e);for(var m in p){var v=e[m];if(z(e,m)&&"function"!=typeof v)return u(l,i,o,m,c(v));if(!v)return new a("Invalid "+i+" `"+o+"` key `"+m+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=v(r,m,l,i,o+"."+m,K);if(E)return E}return null})}};function i(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function a(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function o(e){function t(t,n,l,i,o,r,u){if(i=i||"<<anonymous>>",r=r||l,u!==K){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 a(null===n[l]?"The "+o+" `"+r+"` is marked as required in `"+i+"`, but its value is `null`.":"The "+o+" `"+r+"` is marked as required in `"+i+"`, but its value is `undefined`."):null:e(n,l,i,o,r)}process;var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){return o(function(t,n,l,i,o,r){var u=t[n];return d(u)!==e?new a("Invalid "+i+" `"+o+"` of type `"+c(u)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function u(e,t,n,l,i){return new a((e||"React class")+": "+t+" type `"+n+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}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 i,a=l.call(t);if(l!==t.entries){for(;!(i=a.next()).done;)if(!s(i.value))return!1}else for(;!(i=a.next()).done;){var o=i.value;if(o&&!s(o[1]))return!1}return!0;default:return!1}}function d(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 c(e){if(null==e)return""+e;var t=d(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function p(e){var t=c(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return a.prototype=Error.prototype,l.checkPropTypes=Q,l.resetWarningCache=Q.resetWarningCache,l.PropTypes=l,l}(V.isElement):function(){function e(e,t,n,l,i,a){if(a!==K){var o=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 o.name="Invariant Violation",o}}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:ne,resetWarningCache:te};return n.PropTypes=n,n}()});const ie=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))};ie.propTypes={userType:le.string,name:le.string.isRequired,ref:le.func,value:le.string,onChange:le.func,id:le.string},ie.defaultProps={ref:void 0,onChange:void 0};const ae=e=>l.createElement("h2",{className:"card-label "+e.className,style:e.style},e.children),oe=e=>l.createElement("h2",{className:"card-label-error "+(null!=e&&e.className?null==e?void 0:e.className:""),style:e.style},e.children),re=e=>{var t,n,i,a,o,r,u;const s=Digit.SessionStorage.get("userType"),d=null!=e&&e.watch?{fromDate:null==e?void 0:e.watch("fromDate"),toDate:null==e?void 0:e.watch("toDate")}:{};return l.createElement(l.Fragment,null,l.createElement("div",{className:`text-input ${"employee"===s?"":"text-input-width"} ${e.className}`,style:null!=e&&e.textInputStyle?{...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:`${s?"employee-card-input-error":"card-input-error"} ${e.disable&&"disabled"}`,placeholder:e.placeholder,onChange:t=>{null!=e&&e.onChange&&(null==e||e.onChange(t))},ref:e.inputRef,value:void 0!==e.value?e.value:void 0,defaultValue:void 0===e.value?e.defaultValue:void 0,style:{...e.style},minLength:e.minlength,maxLength:e.maxlength,max:e.max,pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(n=e.validation)||void 0===n?void 0:n.pattern:e.pattern,min:e.min,readOnly:e.disable,title:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(i=e.validation)||void 0===i?void 0:i.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===(a=e.validation)||void 0===a?void 0:a.type:e.type||"text",name:e.name,id:e.id,className:`${s?"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))},ref:e.inputRef,value:void 0!==e.value?e.value:void 0,defaultValue:void 0===e.value?e.defaultValue:void 0,style:{...e.style},minLength:e.minlength,maxLength:e.maxlength,max:e.max,required:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(o=e.validation)||void 0===o?void 0:o.isRequired:e.isRequired||"date"===e.type&&("fromDate"===e.name?d.toDate:d.fromDate),pattern:null!=e&&e.validation&&e.ValidationRequired?null==e||null===(r=e.validation)||void 0===r?void 0:r.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))};re.propTypes={userType:le.string,isMandatory:le.bool,name:le.string,placeholder:le.string,onChange:le.func,ref:le.func,value:le.any},re.defaultProps={isMandatory:!1};const ue=e=>l.createElement("header",{className:"card-header",style:e.styles?e.styles:{}},e.children),se=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),de=n.forwardRef((e,t)=>l.createElement("button",s({ref:t,disabled:!!e.disabled,className:`${e.disabled?"submit-bar-disabled":"submit-bar"} ${e.className?e.className:""}`,type:e.submit?"submit":"button",style:{...e.style},onClick:e.onSubmit},e.form?{form:e.form}:{}),l.createElement("header",null,e.label)));de.propTypes={submit:le.any,style:le.object,label:le.string,onSubmit:le.func},de.defaultProps={};const ce=e=>l.createElement("span",{className:"card-link cp "+e.className,onClick:e.onClick,style:e.style},e.label);ce.propTypes={label:le.any,onClick:le.func},ce.defaultProps={};const pe=e=>l.createElement("label",{style:e.style,className:"card-caption"},e.children),me=e=>{let{t:t,children:n,texts:i={},submit:a=!1,inputs:o=[],onNext:r,onSkip:u,isDisable:s,onAdd:d,isMultipleAllow:c=!1,cardStyle:p={},className:m}=e;const v=window.Digit.Utils.browser.isMobile();return l.createElement("div",{className:m||"",style:p},i.headerCaption&&l.createElement(pe,null,t(i.headerCaption)),(null==i?void 0:i.header)&&l.createElement(ue,null,t(i.header)),(null==i?void 0:i.cardText)&&l.createElement(se,null,t(i.cardText)),l.createElement("div",{className:"formcomposer-section-grid"},n),i.submitBarLabel?l.createElement("div",{className:"formcomposer-section-button"},l.createElement(de,{disabled:s,submit:a,label:t(i.submitBarLabel),onSubmit:r})," "):null,i.skipLabel?l.createElement(se,{style:{marginTop:"10px",textAlign:v?"center":"left"}}," ",t(i.skipLabel)," "):null,i.skipText?l.createElement(ce,{label:t(i.skipText),onClick:u}):null,c&&i.addMultipleText?l.createElement(ce,{label:t(i.addMultipleText),onClick:d}):null)};me.propTypes={text:le.object,submit:le.bool,onNext:le.func,onSkip:le.func,onAdd:le.func,t:le.func},me.defaultProps={texts:{},submit:!1,onNext:void 0,onSkip:void 0,onAdd:void 0,t:e=>e};const ve=e=>{let{className:t,onClick:n,styles:i,disable:a}=e;return l.createElement("svg",{style:{...i},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:a?"#9E9E9E":"black",className:t,onClick:n,width:"18px",height:"18px"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M7 10l5 5 5-5H7z"}))},Ee=e=>{let{number:t,title:i,children:a,defaultOpen:o=!1,tabs:r=null,defaultTab:u="",onTabChange:s=(()=>{}),style:d,className:c}=e;const[p,m]=n.useState(o),[v,E]=n.useState(u||r&&r[0]||"");return l.createElement("div",{className:"collapsible-card "+(c||""),style:d},l.createElement("div",{className:"collapsible-card-header",onClick:()=>m(!p)},l.createElement("h3",{className:"collapsible-card-title"},t?t+". ":"",i),l.createElement("span",{className:"collapsible-card-arrow "+(p?"rotate":"")},l.createElement(ve,null))),p&&l.createElement("div",{className:"collapsible-card-body"},r&&l.createElement("div",{className:"collapsible-card-tabs"},r.map((e,t)=>l.createElement("button",{key:t,onClick:()=>(e=>{E(e),s(e)})(e),className:"collapsible-card-tab-button "+(v===e?"active":"")},e))),l.createElement("div",{className:"collapsible-card-tab-content"},r?l.createElement(l.Fragment,{key:v},a(v)):a)))},_e=e=>{var t,n;let{t:i,children:a,config:r,onSelect:u,onSkip:d,value:c,onChange:p,isDisabled:m,_defaultValues:v={},forcedError:E,componentInFront:_,onAdd:S,cardStyle:f={},isMultipleAllow:y=!1,showErrorBelowChildren:T=!1,childrenAtTheBottom:g=!0,textInputStyle:h,className:I,isCollapsible:C=!0,defaultOpen:N=!0}=e;const{register:A,errors:D,handleSubmit:O}=o.useForm({defaultValues:v});var L=!!m||r.canDisable&&Object.keys(D).filter(e=>D[e]).length;const P=null===(t=r.inputs)||void 0===t?void 0:t.map((e,t)=>{var n,a,o,r;return"text"===e.type?l.createElement(l.Fragment,{key:t},l.createElement(ae,null,i(e.label)),D[e.name]&&l.createElement(oe,null,i(e.error)),l.createElement("div",{className:"field-container",style:{justifyContent:"left"}},_?l.createElement("span",{className:"citizen-card-input citizen-card-input--front"},_):null,l.createElement(re,{key:t,name:e.name,value:c,onChange:p,minlength:e.validation.minlength,maxlength:e.validation.maxlength,pattern:null===(n=e.validation)||void 0===n?void 0:n.pattern,title:null===(a=e.validation)||void 0===a?void 0:a.title,placeholder:e.placeholder,inputRef:A(e.validation),isMandatory:D[e.name],disable:!!e.disable&&e.disable,textInputStyle:h}))):"textarea"===e.type?l.createElement(l.Fragment,{key:t},l.createElement(ae,null,i(e.label)),l.createElement(ie,{key:t,name:e.name,value:c,onChange:p,inputRef:A(e.validation),maxLength:"1024"})):"date"===e.type?(console.log("datedatedate"),l.createElement(l.Fragment,{key:t},l.createElement(ae,null,i(e.label)," ",e.labelChildren&&e.labelChildren),D[e.name]&&l.createElement(oe,null,i(e.error)),l.createElement("div",{className:"field-container",style:{justifyContent:"left"}},l.createElement(re,{key:t,name:e.name,value:c,onChange:p,pattern:null===(o=e.validation)||void 0===o?void 0:o.pattern,title:null===(r=e.validation)||void 0===r?void 0:r.title,inputRef:A(e.validation),isMandatory:D[e.name],disable:!!e.disable&&e.disable,textInputStyle:h,type:e.type})))):void 0}),b=void 0!==r.isCollapsible?r.isCollapsible:C,R=void 0!==r.defaultOpen?r.defaultOpen:N;return l.createElement("form",{style:{flex:"1"},onSubmit:O(e=>{u(e)})},b?l.createElement(Ee,{title:i(null==r||null===(n=r.texts)||void 0===n?void 0:n.header),defaultOpen:R},l.createElement(me,s({isDisable:L,isMultipleAllow:y},r,{texts:{...r.texts,header:null},cardStyle:f,submit:!0,onSkip:d,onAdd:S,t:i,className:I||""}),!g&&a,P,E&&!T&&l.createElement(oe,null,i(E)),g&&a,E&&T&&l.createElement(oe,null,i(E)))):l.createElement(me,s({isDisable:L,isMultipleAllow:y},r,{cardStyle:f,submit:!0,onSkip:d,onAdd:S,t:i,className:I||""}),!g&&a,P,E&&!T&&l.createElement(oe,null,i(E)),g&&a,E&&T&&l.createElement(oe,null,i(E))))};_e.propTypes={config:le.shape({}),onSelect:le.func,onSkip:le.func,onAdd:le.func,t:le.func},_e.defaultProps={config:{},onSelect:void 0,onSkip:void 0,onAdd:void 0,t:e=>e};var Se=E(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],a="[object Arguments]",o="[object Array]",r="[object Boolean]",u="[object Date]",s="[object Error]",d="[object Function]",c="[object GeneratorFunction]",p="[object Map]",m="[object Number]",E="[object Object]",_="[object RegExp]",S="[object Set]",f="[object String]",y="[object Symbol]",T="[object WeakMap]",g="[object ArrayBuffer]",h="[object DataView]",I="[object Float32Array]",C="[object Float64Array]",N="[object Int8Array]",A="[object Int16Array]",D="[object Int32Array]",O="[object Uint8Array]",L="[object Uint16Array]",P="[object Uint32Array]",b=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,M=/(__e\(.*?\)|\b__t\)) \+\n'';/g,k=/&(?:amp|lt|gt|quot|#39);/g,w=/[&<>"']/g,F=RegExp(k.source),x=RegExp(w.source),H=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,W=/[\\^$.*+?()[\]{}|]/g,K=RegExp(W.source),z=/^\s+/,j=/\s/,X=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,q=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Q=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,ie=/^\[object .+?Constructor\]$/,ae=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,se=/['\n\r\u2028\u2029\\]/g,de="\\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",pe="["+ce+"]",me="["+de+"]",ve="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",_e="[^\\ud800-\\udfff"+ce+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",Se="\\ud83c[\\udffb-\\udfff]",fe="[^\\ud800-\\udfff]",ye="(?:\\ud83c[\\udde6-\\uddff]){2}",Te="[\\ud800-\\udbff][\\udc00-\\udfff]",ge="[A-Z\\xc0-\\xd6\\xd8-\\xde]",he="(?:"+Ee+"|"+_e+")",Ie="(?:"+ge+"|"+_e+")",Ce="(?:"+me+"|"+Se+")?",Ne="[\\ufe0e\\ufe0f]?"+Ce+"(?:\\u200d(?:"+[fe,ye,Te].join("|")+")[\\ufe0e\\ufe0f]?"+Ce+")*",Ae="(?:"+["[\\u2700-\\u27bf]",ye,Te].join("|")+")"+Ne,De="(?:"+[fe+me+"?",me,ye,Te,"[\\ud800-\\udfff]"].join("|")+")",Oe=RegExp("['’]","g"),Le=RegExp(me,"g"),Pe=RegExp(Se+"(?="+Se+")|"+De+Ne,"g"),be=RegExp([ge+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[pe,ge,"$"].join("|")+")",Ie+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[pe,ge+he,"$"].join("|")+")",ge+"?"+he+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ge+"+(?:['’](?: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,Ae].join("|"),"g"),Re=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Me=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ke=["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"],we=-1,Fe={};Fe[I]=Fe[C]=Fe[N]=Fe[A]=Fe[D]=Fe[O]=Fe["[object Uint8ClampedArray]"]=Fe[L]=Fe[P]=!0,Fe[a]=Fe[o]=Fe[g]=Fe[r]=Fe[h]=Fe[u]=Fe[s]=Fe[d]=Fe[p]=Fe[m]=Fe[E]=Fe[_]=Fe[S]=Fe[f]=Fe[T]=!1;var xe={};xe[a]=xe[o]=xe[g]=xe[h]=xe[r]=xe[u]=xe[I]=xe[C]=xe[N]=xe[A]=xe[D]=xe[p]=xe[m]=xe[E]=xe[_]=xe[S]=xe[f]=xe[y]=xe[O]=xe["[object Uint8ClampedArray]"]=xe[L]=xe[P]=!0,xe[s]=xe[d]=xe[T]=!1;var He={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ve=parseFloat,Be=parseInt,Ue="object"==typeof v&&v&&v.Object===Object&&v,Ye="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ue||Ye||Function("return this")(),We=t&&!t.nodeType&&t,Ke=We&&e&&!e.nodeType&&e,ze=Ke&&Ke.exports===We,je=ze&&Ue.process,Xe=function(){try{return Ke&&Ke.require&&Ke.require("util").types||je&&je.binding&&je.binding("util")}catch(e){}}(),$e=Xe&&Xe.isArrayBuffer,qe=Xe&&Xe.isDate,Ze=Xe&&Xe.isMap,Qe=Xe&&Xe.isRegExp,Je=Xe&&Xe.isSet,et=Xe&&Xe.isTypedArray;function tt(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 nt(e,t,n,l){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(l,o,n(o),e)}return l}function lt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function it(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,i=0,a=[];++n<l;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function rt(e,t){return!(null==e||!e.length)&&St(e,t,0)>-1}function ut(e,t,n){for(var l=-1,i=null==e?0:e.length;++l<i;)if(n(t,e[l]))return!0;return!1}function st(e,t){for(var n=-1,l=null==e?0:e.length,i=Array(l);++n<l;)i[n]=t(e[n],n,e);return i}function dt(e,t){for(var n=-1,l=t.length,i=e.length;++n<l;)e[i+n]=t[n];return e}function ct(e,t,n,l){var i=-1,a=null==e?0:e.length;for(l&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function pt(e,t,n,l){var i=null==e?0:e.length;for(l&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,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=gt("length");function Et(e,t,n){var l;return n(e,function(e,n,i){if(t(e,n,i))return l=n,!1}),l}function _t(e,t,n,l){for(var i=e.length,a=n+(l?1:-1);l?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function St(e,t,n){return t==t?function(e,t,n){for(var l=n-1,i=e.length;++l<i;)if(e[l]===t)return l;return-1}(e,t,n):_t(e,yt,n)}function ft(e,t,n,l){for(var i=n-1,a=e.length;++i<a;)if(l(e[i],t))return i;return-1}function yt(e){return e!=e}function Tt(e,t){var n=null==e?0:e.length;return n?Ct(e,t)/n:NaN}function gt(e){return function(t){return null==t?void 0:t[e]}}function ht(e){return function(t){return null==e?void 0:e[t]}}function It(e,t,n,l,i){return i(e,function(e,i,a){n=l?(l=!1,e):t(n,e,i,a)}),n}function Ct(e,t){for(var n,l=-1,i=e.length;++l<i;){var a=t(e[l]);void 0!==a&&(n=void 0===n?a:n+a)}return n}function Nt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function At(e){return e?e.slice(0,Wt(e)+1).replace(z,""):e}function Dt(e){return function(t){return e(t)}}function Ot(e,t){return st(t,function(t){return e[t]})}function Lt(e,t){return e.has(t)}function Pt(e,t){for(var n=-1,l=e.length;++n<l&&St(t,e[n],0)>-1;);return n}function bt(e,t){for(var n=e.length;n--&&St(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Mt=ht({"À":"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"}),kt=ht({"&":"&","<":"<",">":">",'"':""","'":"'"});function wt(e){return"\\"+He[e]}function Ft(e){return Re.test(e)}function xt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function Ht(e,t){return function(n){return e(t(n))}}function Vt(e,t){for(var n=-1,i=e.length,a=0,o=[];++n<i;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[a++]=n)}return o}function Bt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Ut(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Yt(e){return Ft(e)?function(e){for(var t=Pe.lastIndex=0;Pe.test(e);)++t;return t}(e):vt(e)}function Gt(e){return Ft(e)?function(e){return e.match(Pe)||[]}(e):function(e){return e.split("")}(e)}function Wt(e){for(var t=e.length;t--&&j.test(e.charAt(t)););return t}var Kt=ht({"&":"&","<":"<",">":">",""":'"',"'":"'"}),zt=function e(t){var v,j=(t=null==t?Ge:zt.defaults(Ge.Object(),t,zt.pick(Ge,ke))).Array,de=t.Date,ce=t.Error,pe=t.Function,me=t.Math,ve=t.Object,Ee=t.RegExp,_e=t.String,Se=t.TypeError,fe=j.prototype,ye=ve.prototype,Te=t["__core-js_shared__"],ge=pe.prototype.toString,he=ye.hasOwnProperty,Ie=0,Ce=(v=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",Ne=ye.toString,Ae=ge.call(ve),De=Ge._,Pe=Ee("^"+ge.call(he).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=ze?t.Buffer:void 0,He=t.Symbol,Ue=t.Uint8Array,Ye=Re?Re.allocUnsafe:void 0,We=Ht(ve.getPrototypeOf,ve),Ke=ve.create,je=ye.propertyIsEnumerable,Xe=fe.splice,vt=He?He.isConcatSpreadable:void 0,ht=He?He.iterator:void 0,jt=He?He.toStringTag:void 0,Xt=function(){try{var e=Qi(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==Ge.clearTimeout&&t.clearTimeout,qt=de&&de.now!==Ge.Date.now&&de.now,Zt=t.setTimeout!==Ge.setTimeout&&t.setTimeout,Qt=me.ceil,Jt=me.floor,en=ve.getOwnPropertySymbols,tn=Re?Re.isBuffer:void 0,nn=t.isFinite,ln=fe.join,an=Ht(ve.keys,ve),on=me.max,rn=me.min,un=de.now,sn=t.parseInt,dn=me.random,cn=fe.reverse,pn=Qi(t,"DataView"),mn=Qi(t,"Map"),vn=Qi(t,"Promise"),En=Qi(t,"Set"),_n=Qi(t,"WeakMap"),Sn=Qi(ve,"create"),fn=_n&&new _n,yn={},Tn=Da(pn),gn=Da(mn),hn=Da(vn),In=Da(En),Cn=Da(_n),Nn=He?He.prototype:void 0,An=Nn?Nn.valueOf:void 0,Dn=Nn?Nn.toString:void 0;function On(e){if(Ko(e)&&!ko(e)&&!(e instanceof Rn)){if(e instanceof bn)return e;if(he.call(e,"__wrapped__"))return Oa(e)}return new bn(e)}var Ln=function(){function e(){}return function(t){if(!Wo(t))return{};if(Ke)return Ke(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Pn(){}function bn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Rn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}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 kn(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 wn(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 Fn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new wn;++t<n;)this.add(e[t])}function xn(e){var t=this.__data__=new kn(e);this.size=t.size}function Hn(e,t){var n=ko(e),l=!n&&Mo(e),i=!n&&!l&&Ho(e),a=!n&&!l&&!i&&Jo(e),o=n||l||i||a,r=o?Nt(e.length,_e):[],u=r.length;for(var s in e)!t&&!he.call(e,s)||o&&("length"==s||i&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||aa(s,u))||r.push(s);return r}function Vn(e){var t=e.length;return t?e[wl(0,t-1)]:void 0}function Bn(e,t){return ha(_i(e),$n(t,0,e.length))}function Un(e){return ha(_i(e))}function Yn(e,t,n){(void 0!==n&&!Po(e[t],n)||void 0===n&&!(t in e))&&jn(e,t,n)}function Gn(e,t,n){var l=e[t];he.call(e,t)&&Po(l,n)&&(void 0!==n||t in e)||jn(e,t,n)}function Wn(e,t){for(var n=e.length;n--;)if(Po(e[n][0],t))return n;return-1}function Kn(e,t,n,l){return el(e,function(e,i,a){t(l,e,n(e),a)}),l}function zn(e,t){return e&&Si(t,gr(t),e)}function jn(e,t,n){"__proto__"==t&&Xt?Xt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Xn(e,t){for(var n=-1,l=t.length,i=j(l),a=null==e;++n<l;)i[n]=a?void 0:_r(e,t[n]);return i}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function qn(e,t,n,l,i,o){var s,v=1&t,T=2&t,b=4&t;if(n&&(s=i?n(e,l,i,o):n(e)),void 0!==s)return s;if(!Wo(e))return e;var R=ko(e);if(R){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&he.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!v)return _i(e,s)}else{var M=ta(e),k=M==d||M==c;if(Ho(e))return di(e,v);if(M==E||M==a||k&&!i){if(s=T||k?{}:la(e),!v)return T?function(e,t){return Si(e,ea(e),t)}(e,function(e,t){return e&&Si(t,hr(t),e)}(s,e)):function(e,t){return Si(e,Ji(e),t)}(e,zn(s,e))}else{if(!xe[M])return i?e:{};s=function(e,t,n){var l=e.constructor;switch(t){case g:return ci(e);case r:case u:return new l(+e);case h:return function(e,t){var n=t?ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case I:case C:case N:case A:case D:case O:case"[object Uint8ClampedArray]":case L:case P:return pi(e,n);case p:return new l;case m:case f:return new l(e);case _:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case S:return new l;case y:return An?ve(An.call(e)):{}}}(e,M,v)}}o||(o=new xn);var w=o.get(e);if(w)return w;o.set(e,s),qo(e)?e.forEach(function(l){s.add(qn(l,t,n,l,e,o))}):zo(e)&&e.forEach(function(l,i){s.set(i,qn(l,t,n,i,e,o))});var F=R?void 0:(b?T?Ki:Wi:T?hr:gr)(e);return lt(F||e,function(l,i){F&&(l=e[i=l]),Gn(s,i,qn(l,t,n,i,e,o))}),s}function Zn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var i=n[l],a=e[i];if(void 0===a&&!(i in e)||!(0,t[i])(a))return!1}return!0}function Qn(e,t,l){if("function"!=typeof e)throw new Se(n);return fa(function(){e.apply(void 0,l)},t)}function Jn(e,t,n,l){var i=-1,a=rt,o=!0,r=e.length,u=[],s=t.length;if(!r)return u;n&&(t=st(t,Dt(n))),l?(a=ut,o=!1):t.length>=200&&(a=Lt,o=!1,t=new Fn(t));e:for(;++i<r;){var d=e[i],c=null==n?d:n(d);if(d=l||0!==d?d:0,o&&c==c){for(var p=s;p--;)if(t[p]===c)continue e;u.push(d)}else a(t,c,l)||u.push(d)}return u}On.templateSettings={escape:H,evaluate:V,interpolate:B,variable:"",imports:{_:On}},(On.prototype=Pn.prototype).constructor=On,(bn.prototype=Ln(Pn.prototype)).constructor=bn,(Rn.prototype=Ln(Pn.prototype)).constructor=Rn,Mn.prototype.clear=function(){this.__data__=Sn?Sn(null):{},this.size=0},Mn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Mn.prototype.get=function(e){var t=this.__data__;if(Sn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return he.call(t,e)?t[e]:void 0},Mn.prototype.has=function(e){var t=this.__data__;return Sn?void 0!==t[e]:he.call(t,e)},Mn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Sn&&void 0===t?"__lodash_hash_undefined__":t,this},kn.prototype.clear=function(){this.__data__=[],this.size=0},kn.prototype.delete=function(e){var t=this.__data__,n=Wn(t,e);return!(n<0||(n==t.length-1?t.pop():Xe.call(t,n,1),--this.size,0))},kn.prototype.get=function(e){var t=this.__data__,n=Wn(t,e);return n<0?void 0:t[n][1]},kn.prototype.has=function(e){return Wn(this.__data__,e)>-1},kn.prototype.set=function(e,t){var n=this.__data__,l=Wn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(mn||kn),string:new Mn}},wn.prototype.delete=function(e){var t=qi(this,e).delete(e);return this.size-=t?1:0,t},wn.prototype.get=function(e){return qi(this,e).get(e)},wn.prototype.has=function(e){return qi(this,e).has(e)},wn.prototype.set=function(e,t){var n=qi(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Fn.prototype.add=Fn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Fn.prototype.has=function(e){return this.__data__.has(e)},xn.prototype.clear=function(){this.__data__=new kn,this.size=0},xn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},xn.prototype.get=function(e){return this.__data__.get(e)},xn.prototype.has=function(e){return this.__data__.has(e)},xn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof kn){var l=n.__data__;if(!mn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new wn(l)}return n.set(e,t),this.size=n.size,this};var el=Ti(ul),tl=Ti(sl,!0);function nl(e,t){var n=!0;return el(e,function(e,l,i){return n=!!t(e,l,i)}),n}function ll(e,t,n){for(var l=-1,i=e.length;++l<i;){var a=e[l],o=t(a);if(null!=o&&(void 0===r?o==o&&!Qo(o):n(o,r)))var r=o,u=a}return u}function il(e,t){var n=[];return el(e,function(e,l,i){t(e,l,i)&&n.push(e)}),n}function al(e,t,n,l,i){var a=-1,o=e.length;for(n||(n=ia),i||(i=[]);++a<o;){var r=e[a];t>0&&n(r)?t>1?al(r,t-1,n,l,i):dt(i,r):l||(i[i.length]=r)}return i}var ol=gi(),rl=gi(!0);function ul(e,t){return e&&ol(e,t,gr)}function sl(e,t){return e&&rl(e,t,gr)}function dl(e,t){return ot(t,function(t){return Uo(e[t])})}function cl(e,t){for(var n=0,l=(t=oi(t,e)).length;null!=e&&n<l;)e=e[Aa(t[n++])];return n&&n==l?e:void 0}function pl(e,t,n){var l=t(e);return ko(e)?l:dt(l,n(e))}function ml(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":jt&&jt in ve(e)?function(e){var t=he.call(e,jt),n=e[jt];try{e[jt]=void 0;var l=!0}catch(e){}var i=Ne.call(e);return l&&(t?e[jt]=n:delete e[jt]),i}(e):function(e){return Ne.call(e)}(e)}function vl(e,t){return e>t}function El(e,t){return null!=e&&he.call(e,t)}function _l(e,t){return null!=e&&t in ve(e)}function Sl(e,t,n){for(var l=n?ut:rt,i=e[0].length,a=e.length,o=a,r=j(a),u=Infinity,s=[];o--;){var d=e[o];o&&t&&(d=st(d,Dt(t))),u=rn(d.length,u),r[o]=!n&&(t||i>=120&&d.length>=120)?new Fn(o&&d):void 0}d=e[0];var c=-1,p=r[0];e:for(;++c<i&&s.length<u;){var m=d[c],v=t?t(m):m;if(m=n||0!==m?m:0,!(p?Lt(p,v):l(s,v,n))){for(o=a;--o;){var E=r[o];if(!(E?Lt(E,v):l(e[o],v,n)))continue e}p&&p.push(v),s.push(m)}}return s}function fl(e,t,n){var l=null==(e=va(e,t=oi(t,e)))?e:e[Aa(Va(t))];return null==l?void 0:tt(l,e,n)}function yl(e){return Ko(e)&&ml(e)==a}function Tl(e,t,n,l,i){return e===t||(null==e||null==t||!Ko(e)&&!Ko(t)?e!=e&&t!=t:function(e,t,n,l,i,d){var c=ko(e),v=ko(t),T=c?o:ta(e),I=v?o:ta(t),C=(T=T==a?E:T)==E,N=(I=I==a?E:I)==E,A=T==I;if(A&&Ho(e)){if(!Ho(t))return!1;c=!0,C=!1}if(A&&!C)return d||(d=new xn),c||Jo(e)?Yi(e,t,n,l,i,d):function(e,t,n,l,i,a,o){switch(n){case h:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case g:return!(e.byteLength!=t.byteLength||!a(new Ue(e),new Ue(t)));case r:case u:case m:return Po(+e,+t);case s:return e.name==t.name&&e.message==t.message;case _:case f:return e==t+"";case p:var d=xt;case S:if(d||(d=Bt),e.size!=t.size&&!(1&l))return!1;var c=o.get(e);if(c)return c==t;l|=2,o.set(e,t);var v=Yi(d(e),d(t),l,i,a,o);return o.delete(e),v;case y:if(An)return An.call(e)==An.call(t)}return!1}(e,t,T,n,l,i,d);if(!(1&n)){var D=C&&he.call(e,"__wrapped__"),O=N&&he.call(t,"__wrapped__");if(D||O){var L=D?e.value():e,P=O?t.value():t;return d||(d=new xn),i(L,P,n,l,d)}}return!!A&&(d||(d=new xn),function(e,t,n,l,i,a){var o=1&n,r=Wi(e),u=r.length;if(u!=Wi(t).length&&!o)return!1;for(var s=u;s--;){var d=r[s];if(!(o?d in t:he.call(t,d)))return!1}var c=a.get(e),p=a.get(t);if(c&&p)return c==t&&p==e;var m=!0;a.set(e,t),a.set(t,e);for(var v=o;++s<u;){var E=e[d=r[s]],_=t[d];if(l)var S=o?l(_,E,d,t,e,a):l(E,_,d,e,t,a);if(!(void 0===S?E===_||i(E,_,n,l,a):S)){m=!1;break}v||(v="constructor"==d)}if(m&&!v){var f=e.constructor,y=t.constructor;f==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof f&&f instanceof f&&"function"==typeof y&&y instanceof y||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,l,i,d))}(e,t,n,l,Tl,i))}function gl(e,t,n,l){var i=n.length,a=i,o=!l;if(null==e)return!a;for(e=ve(e);i--;){var r=n[i];if(o&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++i<a;){var u=(r=n[i])[0],s=e[u],d=r[1];if(o&&r[2]){if(void 0===s&&!(u in e))return!1}else{var c=new xn;if(l)var p=l(s,d,u,e,t,c);if(!(void 0===p?Tl(d,s,3,l,c):p))return!1}}return!0}function hl(e){return!(!Wo(e)||(t=e,Ce&&Ce in t))&&(Uo(e)?Pe:ie).test(Da(e));var t}function Il(e){return"function"==typeof e?e:null==e?jr:"object"==typeof e?ko(e)?Ol(e[0],e[1]):Dl(e):nu(e)}function Cl(e){if(!da(e))return an(e);var t=[];for(var n in ve(e))he.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Nl(e,t){return e<t}function Al(e,t){var n=-1,l=Fo(e)?j(e.length):[];return el(e,function(e,i,a){l[++n]=t(e,i,a)}),l}function Dl(e){var t=Zi(e);return 1==t.length&&t[0][2]?pa(t[0][0],t[0][1]):function(n){return n===e||gl(n,e,t)}}function Ol(e,t){return ra(e)&&ca(t)?pa(Aa(e),t):function(n){var l=_r(n,e);return void 0===l&&l===t?Sr(n,e):Tl(t,l,3)}}function Ll(e,t,n,l,i){e!==t&&ol(t,function(a,o){if(i||(i=new xn),Wo(a))!function(e,t,n,l,i,a,o){var r=_a(e,n),u=_a(t,n),s=o.get(u);if(s)Yn(e,n,s);else{var d=a?a(r,u,n+"",e,t,o):void 0,c=void 0===d;if(c){var p=ko(u),m=!p&&Ho(u),v=!p&&!m&&Jo(u);d=u,p||m||v?ko(r)?d=r:xo(r)?d=_i(r):m?(c=!1,d=di(u,!0)):v?(c=!1,d=pi(u,!0)):d=[]:Xo(u)||Mo(u)?(d=r,Mo(r)?d=rr(r):Wo(r)&&!Uo(r)||(d=la(u))):c=!1}c&&(o.set(u,d),i(d,u,l,a,o),o.delete(u)),Yn(e,n,d)}}(e,t,o,n,Ll,l,i);else{var r=l?l(_a(e,o),a,o+"",e,t,i):void 0;void 0===r&&(r=a),Yn(e,o,r)}},hr)}function Pl(e,t){var n=e.length;if(n)return aa(t+=t<0?n:0,n)?e[t]:void 0}function bl(e,t,n){t=t.length?st(t,function(e){return ko(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[jr];var l=-1;return t=st(t,Dt($i())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,i=e.criteria,a=t.criteria,o=i.length,r=n.length;++l<o;){var u=mi(i[l],a[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}(Al(e,function(e,n,i){return{criteria:st(t,function(t){return t(e)}),index:++l,value:e}}))}function Rl(e,t,n){for(var l=-1,i=t.length,a={};++l<i;){var o=t[l],r=cl(e,o);n(r,o)&&Bl(a,oi(o,e),r)}return a}function Ml(e,t,n,l){var i=l?ft:St,a=-1,o=t.length,r=e;for(e===t&&(t=_i(t)),n&&(r=st(e,Dt(n)));++a<o;)for(var u=0,s=t[a],d=n?n(s):s;(u=i(r,d,u,l))>-1;)r!==e&&Xe.call(r,u,1),Xe.call(e,u,1);return e}function kl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var i=t[n];if(n==l||i!==a){var a=i;aa(i)?Xe.call(e,i,1):Ql(e,i)}}return e}function wl(e,t){return e+Jt(dn()*(t-e+1))}function Fl(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Jt(t/2))&&(e+=e)}while(t);return n}function xl(e,t){return ya(ma(e,t,jr),e+"")}function Hl(e){return Vn(Pr(e))}function Vl(e,t){var n=Pr(e);return ha(n,$n(t,0,n.length))}function Bl(e,t,n,l){if(!Wo(e))return e;for(var i=-1,a=(t=oi(t,e)).length,o=a-1,r=e;null!=r&&++i<a;){var u=Aa(t[i]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=o){var d=r[u];void 0===(s=l?l(d,u,r):void 0)&&(s=Wo(d)?d:aa(t[i+1])?[]:{})}Gn(r,u,s),r=r[u]}return e}var Ul=fn?function(e,t){return fn.set(e,t),e}:jr,Yl=Xt?function(e,t){return Xt(e,"toString",{configurable:!0,enumerable:!1,value:Wr(t),writable:!0})}:jr;function Gl(e){return ha(Pr(e))}function Wl(e,t,n){var l=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=j(i);++l<i;)a[l]=e[l+t];return a}function Kl(e,t){var n;return el(e,function(e,l,i){return!(n=t(e,l,i))}),!!n}function zl(e,t,n){var l=0,i=null==e?l:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;l<i;){var a=l+i>>>1,o=e[a];null!==o&&!Qo(o)&&(n?o<=t:o<t)?l=a+1:i=a}return i}return jl(e,t,jr,n)}function jl(e,t,n,l){var i=0,a=null==e?0:e.length;if(0===a)return 0;for(var o=(t=n(t))!=t,r=null===t,u=Qo(t),s=void 0===t;i<a;){var d=Jt((i+a)/2),c=n(e[d]),p=void 0!==c,m=null===c,v=c==c,E=Qo(c);if(o)var _=l||v;else _=s?v&&(l||p):r?v&&p&&(l||!m):u?v&&p&&!m&&(l||!E):!m&&!E&&(l?c<=t:c<t);_?i=d+1:a=d}return rn(a,4294967294)}function Xl(e,t){for(var n=-1,l=e.length,i=0,a=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!Po(r,u)){var u=r;a[i++]=0===o?0:o}}return a}function $l(e){return"number"==typeof e?e:Qo(e)?NaN:+e}function ql(e){if("string"==typeof e)return e;if(ko(e))return st(e,ql)+"";if(Qo(e))return Dn?Dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zl(e,t,n){var l=-1,i=rt,a=e.length,o=!0,r=[],u=r;if(n)o=!1,i=ut;else if(a>=200){var s=t?null:Fi(e);if(s)return Bt(s);o=!1,i=Lt,u=new Fn}else u=t?[]:r;e:for(;++l<a;){var d=e[l],c=t?t(d):d;if(d=n||0!==d?d:0,o&&c==c){for(var p=u.length;p--;)if(u[p]===c)continue e;t&&u.push(c),r.push(d)}else i(u,c,n)||(u!==r&&u.push(c),r.push(d))}return r}function Ql(e,t){return null==(e=va(e,t=oi(t,e)))||delete e[Aa(Va(t))]}function Jl(e,t,n,l){return Bl(e,t,n(cl(e,t)),l)}function ei(e,t,n,l){for(var i=e.length,a=l?i:-1;(l?a--:++a<i)&&t(e[a],a,e););return n?Wl(e,l?0:a,l?a+1:i):Wl(e,l?a+1:0,l?i:a)}function ti(e,t){var n=e;return n instanceof Rn&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))},n)}function ni(e,t,n){var l=e.length;if(l<2)return l?Zl(e[0]):[];for(var i=-1,a=j(l);++i<l;)for(var o=e[i],r=-1;++r<l;)r!=i&&(a[i]=Jn(a[i]||o,e[r],t,n));return Zl(al(a,1),t,n)}function li(e,t,n){for(var l=-1,i=e.length,a=t.length,o={};++l<i;)n(o,e[l],l<a?t[l]:void 0);return o}function ii(e){return xo(e)?e:[]}function ai(e){return"function"==typeof e?e:jr}function oi(e,t){return ko(e)?e:ra(e,t)?[e]:Na(ur(e))}var ri=xl;function ui(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:Wl(e,t,n)}var si=$t||function(e){return Ge.clearTimeout(e)};function di(e,t){if(t)return e.slice();var n=e.length,l=Ye?Ye(n):new e.constructor(n);return e.copy(l),l}function ci(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function pi(e,t){var n=t?ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function mi(e,t){if(e!==t){var n=void 0!==e,l=null===e,i=e==e,a=Qo(e),o=void 0!==t,r=null===t,u=t==t,s=Qo(t);if(!r&&!s&&!a&&e>t||a&&o&&u&&!r&&!s||l&&o&&u||!n&&u||!i)return 1;if(!l&&!a&&!s&&e<t||s&&n&&i&&!l&&!a||r&&n&&i||!o&&i||!u)return-1}return 0}function vi(e,t,n,l){for(var i=-1,a=e.length,o=n.length,r=-1,u=t.length,s=on(a-o,0),d=j(u+s),c=!l;++r<u;)d[r]=t[r];for(;++i<o;)(c||i<a)&&(d[n[i]]=e[i]);for(;s--;)d[r++]=e[i++];return d}function Ei(e,t,n,l){for(var i=-1,a=e.length,o=-1,r=n.length,u=-1,s=t.length,d=on(a-r,0),c=j(d+s),p=!l;++i<d;)c[i]=e[i];for(var m=i;++u<s;)c[m+u]=t[u];for(;++o<r;)(p||i<a)&&(c[m+n[o]]=e[i++]);return c}function _i(e,t){var n=-1,l=e.length;for(t||(t=j(l));++n<l;)t[n]=e[n];return t}function Si(e,t,n,l){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var r=t[a],u=l?l(n[r],e[r],r,n,e):void 0;void 0===u&&(u=e[r]),i?jn(n,r,u):Gn(n,r,u)}return n}function fi(e,t){return function(n,l){var i=ko(n)?nt:Kn,a=t?t():{};return i(n,e,$i(l,2),a)}}function yi(e){return xl(function(t,n){var l=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,o&&oa(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=ve(t);++l<i;){var r=n[l];r&&e(t,r,l,a)}return t})}function Ti(e,t){return function(n,l){if(null==n)return n;if(!Fo(n))return e(n,l);for(var i=n.length,a=t?i:-1,o=ve(n);(t?a--:++a<i)&&!1!==l(o[a],a,o););return n}}function gi(e){return function(t,n,l){for(var i=-1,a=ve(t),o=l(t),r=o.length;r--;){var u=o[e?r:++i];if(!1===n(a[u],u,a))break}return t}}function hi(e){return function(t){var n=Ft(t=ur(t))?Gt(t):void 0,l=n?n[0]:t.charAt(0),i=n?ui(n,1).join(""):t.slice(1);return l[e]()+i}}function Ii(e){return function(t){return ct(Ur(Mr(t).replace(Oe,"")),e,"")}}function Ci(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Ln(e.prototype),l=e.apply(n,t);return Wo(l)?l:n}}function Ni(e){return function(t,n,l){var i=ve(t);if(!Fo(t)){var a=$i(n,3);t=gr(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,l);return o>-1?i[a?t[o]:o]:void 0}}function Ai(e){return Gi(function(t){var l=t.length,i=l,a=bn.prototype.thru;for(e&&t.reverse();i--;){var o=t[i];if("function"!=typeof o)throw new Se(n);if(a&&!r&&"wrapper"==ji(o))var r=new bn([],!0)}for(i=r?i:l;++i<l;){var u=ji(o=t[i]),s="wrapper"==u?zi(o):void 0;r=s&&ua(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?r[ji(s[0])].apply(r,s[3]):1==o.length&&ua(o)?r[u]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&ko(n))return r.plant(n).value();for(var i=0,a=l?t[i].apply(this,e):n;++i<l;)a=t[i].call(this,a);return a}})}function Di(e,t,n,l,i,a,o,r,u,s){var d=128&t,c=1&t,p=2&t,m=24&t,v=512&t,E=p?void 0:Ci(e);return function _(){for(var S=arguments.length,f=j(S),y=S;y--;)f[y]=arguments[y];if(m)var T=Xi(_),g=Rt(f,T);if(l&&(f=vi(f,l,i,m)),a&&(f=Ei(f,a,o,m)),S-=g,m&&S<s){var h=Vt(f,T);return ki(e,t,Di,_.placeholder,n,f,h,r,u,s-S)}var I=c?n:this,C=p?I[e]:e;return S=f.length,r?f=Ea(f,r):v&&S>1&&f.reverse(),d&&u<S&&(f.length=u),this&&this!==Ge&&this instanceof _&&(C=E||Ci(C)),C.apply(I,f)}}function Oi(e,t){return function(n,l){return function(e,t,n,l){return ul(e,function(e,i,a){t(l,n(e),i,a)}),l}(n,e,t(l),{})}}function Li(e,t){return function(n,l){var i;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(i=n),void 0!==l){if(void 0===i)return l;"string"==typeof n||"string"==typeof l?(n=ql(n),l=ql(l)):(n=$l(n),l=$l(l)),i=e(n,l)}return i}}function Pi(e){return Gi(function(t){return t=st(t,Dt($i())),xl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function bi(e,t){var n=(t=void 0===t?" ":ql(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Qt(e/Yt(t)));return Ft(t)?ui(Gt(l),0,e).join(""):l.slice(0,e)}function Ri(e){return function(t,n,l){return l&&"number"!=typeof l&&oa(t,n,l)&&(n=l=void 0),t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n,l){for(var i=-1,a=on(Qt((t-e)/(n||1)),0),o=j(a);a--;)o[l?a:++i]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function Mi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function ki(e,t,n,l,i,a,o,r,u,s){var d=8&t;t|=d?32:64,4&(t&=~(d?64:32))||(t&=-4);var c=[e,t,i,d?a:void 0,d?o:void 0,d?void 0:a,d?void 0:o,r,u,s],p=n.apply(void 0,c);return ua(e)&&Sa(p,c),p.placeholder=l,Ta(p,e,t)}function wi(e){var t=me[e];return function(e,n){if(e=or(e),(n=null==n?0:rn(ir(n),292))&&nn(e)){var l=(ur(e)+"e").split("e");return+((l=(ur(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Fi=En&&1/Bt(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Qr;function xi(e){return function(t){var n=ta(t);return n==p?xt(t):n==S?Ut(t):function(e,t){return st(t,function(t){return[t,e[t]]})}(t,e(t))}}function Hi(e,t,i,a,o,r,u,s){var d=2&t;if(!d&&"function"!=typeof e)throw new Se(n);var c=a?a.length:0;if(c||(t&=-97,a=o=void 0),u=void 0===u?u:on(ir(u),0),s=void 0===s?s:ir(s),c-=o?o.length:0,64&t){var p=a,m=o;a=o=void 0}var v=d?void 0:zi(e),E=[e,t,i,a,o,p,m,r,u,s];if(v&&function(e,t){var n=e[1],i=t[1],a=n|i;if(!(a<131||128==i&&8==n||128==i&&256==n&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n))return e;1&i&&(e[2]=t[2],a|=1&n?0:4);var o=t[3];if(o){var r=e[3];e[3]=r?vi(r,o,t[4]):o,e[4]=r?Vt(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?Ei(r,o,t[6]):o,e[6]=r?Vt(e[5],l):t[6]),(o=t[7])&&(e[7]=o),128&i&&(e[8]=null==e[8]?t[8]:rn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=a}(E,v),e=E[0],t=E[1],i=E[2],a=E[3],o=E[4],!(s=E[9]=void 0===E[9]?d?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,n){var l=Ci(e);return function i(){for(var a=arguments.length,o=j(a),r=a,u=Xi(i);r--;)o[r]=arguments[r];var s=a<3&&o[0]!==u&&o[a-1]!==u?[]:Vt(o,u);if((a-=s.length)<n)return ki(e,t,Di,i.placeholder,void 0,o,s,void 0,void 0,n-a);var d=this&&this!==Ge&&this instanceof i?l:e;return tt(d,this,o)}}(e,t,s):32!=t&&33!=t||o.length?Di.apply(void 0,E):function(e,t,n,l){var i=1&t,a=Ci(e);return function t(){for(var o=-1,r=arguments.length,u=-1,s=l.length,d=j(s+r),c=this&&this!==Ge&&this instanceof t?a:e;++u<s;)d[u]=l[u];for(;r--;)d[u++]=arguments[++o];return tt(c,i?n:this,d)}}(e,t,i,a);else var _=function(e,t,n){var l=1&t,i=Ci(e);return function t(){var a=this&&this!==Ge&&this instanceof t?i:e;return a.apply(l?n:this,arguments)}}(e,t,i);return Ta((v?Ul:Sa)(_,E),e,t)}function Vi(e,t,n,l){return void 0===e||Po(e,ye[n])&&!he.call(l,n)?t:e}function Bi(e,t,n,l,i,a){return Wo(e)&&Wo(t)&&(a.set(t,e),Ll(e,t,void 0,Bi,a),a.delete(t)),e}function Ui(e){return Xo(e)?void 0:e}function Yi(e,t,n,l,i,a){var o=1&n,r=e.length,u=t.length;if(r!=u&&!(o&&u>r))return!1;var s=a.get(e),d=a.get(t);if(s&&d)return s==t&&d==e;var c=-1,p=!0,m=2&n?new Fn:void 0;for(a.set(e,t),a.set(t,e);++c<r;){var v=e[c],E=t[c];if(l)var _=o?l(E,v,c,t,e,a):l(v,E,c,e,t,a);if(void 0!==_){if(_)continue;p=!1;break}if(m){if(!mt(t,function(e,t){if(!Lt(m,t)&&(v===e||i(v,e,n,l,a)))return m.push(t)})){p=!1;break}}else if(v!==E&&!i(v,E,n,l,a)){p=!1;break}}return a.delete(e),a.delete(t),p}function Gi(e){return ya(ma(e,void 0,ka),e+"")}function Wi(e){return pl(e,gr,Ji)}function Ki(e){return pl(e,hr,ea)}var zi=fn?function(e){return fn.get(e)}:Qr;function ji(e){for(var t=e.name+"",n=yn[t],l=he.call(yn,t)?n.length:0;l--;){var i=n[l],a=i.func;if(null==a||a==e)return i.name}return t}function Xi(e){return(he.call(On,"placeholder")?On:e).placeholder}function $i(){var e=On.iteratee||Xr;return e=e===Xr?Il:e,arguments.length?e(arguments[0],arguments[1]):e}function qi(e,t){var n,l,i=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Zi(e){for(var t=gr(e),n=t.length;n--;){var l=t[n],i=e[l];t[n]=[l,i,ca(i)]}return t}function Qi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return hl(n)?n:void 0}var Ji=en?function(e){return null==e?[]:(e=ve(e),ot(en(e),function(t){return je.call(e,t)}))}:au,ea=en?function(e){for(var t=[];e;)dt(t,Ji(e)),e=We(e);return t}:au,ta=ml;function na(e,t,n){for(var l=-1,i=(t=oi(t,e)).length,a=!1;++l<i;){var o=Aa(t[l]);if(!(a=null!=e&&n(e,o)))break;e=e[o]}return a||++l!=i?a:!!(i=null==e?0:e.length)&&Go(i)&&aa(o,i)&&(ko(e)||Mo(e))}function la(e){return"function"!=typeof e.constructor||da(e)?{}:Ln(We(e))}function ia(e){return ko(e)||Mo(e)||!!(vt&&e&&e[vt])}function aa(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 oa(e,t,n){if(!Wo(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&aa(t,n.length):"string"==l&&t in n)&&Po(n[t],e)}function ra(e,t){if(ko(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Qo(e))||Y.test(e)||!U.test(e)||null!=t&&e in ve(t)}function ua(e){var t=ji(e),n=On[t];if("function"!=typeof n||!(t in Rn.prototype))return!1;if(e===n)return!0;var l=zi(n);return!!l&&e===l[0]}(pn&&ta(new pn(new ArrayBuffer(1)))!=h||mn&&ta(new mn)!=p||vn&&"[object Promise]"!=ta(vn.resolve())||En&&ta(new En)!=S||_n&&ta(new _n)!=T)&&(ta=function(e){var t=ml(e),n=t==E?e.constructor:void 0,l=n?Da(n):"";if(l)switch(l){case Tn:return h;case gn:return p;case hn:return"[object Promise]";case In:return S;case Cn:return T}return t});var sa=Te?Uo:ou;function da(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ye)}function ca(e){return e==e&&!Wo(e)}function pa(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function ma(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,i=-1,a=on(l.length-t,0),o=j(a);++i<a;)o[i]=l[t+i];i=-1;for(var r=j(t+1);++i<t;)r[i]=l[i];return r[t]=n(o),tt(e,this,r)}}function va(e,t){return t.length<2?e:cl(e,Wl(t,0,-1))}function Ea(e,t){for(var n=e.length,l=rn(t.length,n),i=_i(e);l--;){var a=t[l];e[l]=aa(a,n)?i[a]:void 0}return e}function _a(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Sa=ga(Ul),fa=Zt||function(e,t){return Ge.setTimeout(e,t)},ya=ga(Yl);function Ta(e,t,n){var l=t+"";return ya(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(X,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(i,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(q):[]}(l),n)))}function ga(e){var t=0,n=0;return function(){var l=un(),i=16-(l-n);if(n=l,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function ha(e,t){var n=-1,l=e.length,i=l-1;for(t=void 0===t?l:t;++n<t;){var a=wl(n,i),o=e[a];e[a]=e[n],e[n]=o}return e.length=t,e}var Ia,Ca,Na=(Ia=Co(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(G,function(e,n,l,i){t.push(l?i.replace(J,"$1"):n||e)}),t},function(e){return 500===Ca.size&&Ca.clear(),e}),Ca=Ia.cache,Ia);function Aa(e){if("string"==typeof e||Qo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Da(e){if(null!=e){try{return ge.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oa(e){if(e instanceof Rn)return e.clone();var t=new bn(e.__wrapped__,e.__chain__);return t.__actions__=_i(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var La=xl(function(e,t){return xo(e)?Jn(e,al(t,1,xo,!0)):[]}),Pa=xl(function(e,t){var n=Va(t);return xo(n)&&(n=void 0),xo(e)?Jn(e,al(t,1,xo,!0),$i(n,2)):[]}),ba=xl(function(e,t){var n=Va(t);return xo(n)&&(n=void 0),xo(e)?Jn(e,al(t,1,xo,!0),void 0,n):[]});function Ra(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:ir(n);return i<0&&(i=on(l+i,0)),_t(e,$i(t,3),i)}function Ma(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l-1;return void 0!==n&&(i=ir(n),i=n<0?on(l+i,0):rn(i,l-1)),_t(e,$i(t,3),i,!0)}function ka(e){return null!=e&&e.length?al(e,1):[]}function wa(e){return e&&e.length?e[0]:void 0}var Fa=xl(function(e){var t=st(e,ii);return t.length&&t[0]===e[0]?Sl(t):[]}),xa=xl(function(e){var t=Va(e),n=st(e,ii);return t===Va(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?Sl(n,$i(t,2)):[]}),Ha=xl(function(e){var t=Va(e),n=st(e,ii);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?Sl(n,void 0,t):[]});function Va(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Ba=xl(Ua);function Ua(e,t){return e&&e.length&&t&&t.length?Ml(e,t):e}var Ya=Gi(function(e,t){var n=null==e?0:e.length,l=Xn(e,t);return kl(e,st(t,function(e){return aa(e,n)?+e:e}).sort(mi)),l});function Ga(e){return null==e?e:cn.call(e)}var Wa=xl(function(e){return Zl(al(e,1,xo,!0))}),Ka=xl(function(e){var t=Va(e);return xo(t)&&(t=void 0),Zl(al(e,1,xo,!0),$i(t,2))}),za=xl(function(e){var t=Va(e);return t="function"==typeof t?t:void 0,Zl(al(e,1,xo,!0),void 0,t)});function ja(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(xo(e))return t=on(e.length,t),!0}),Nt(t,function(t){return st(e,gt(t))})}function Xa(e,t){if(!e||!e.length)return[];var n=ja(e);return null==t?n:st(n,function(e){return tt(t,void 0,e)})}var $a=xl(function(e,t){return xo(e)?Jn(e,t):[]}),qa=xl(function(e){return ni(ot(e,xo))}),Za=xl(function(e){var t=Va(e);return xo(t)&&(t=void 0),ni(ot(e,xo),$i(t,2))}),Qa=xl(function(e){var t=Va(e);return t="function"==typeof t?t:void 0,ni(ot(e,xo),void 0,t)}),Ja=xl(ja),eo=xl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Xa(e,n)});function to(e){var t=On(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var lo=Gi(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,i=function(t){return Xn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Rn&&aa(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[i],thisArg:void 0}),new bn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(i)}),io=fi(function(e,t,n){he.call(e,n)?++e[n]:jn(e,n,1)}),ao=Ni(Ra),oo=Ni(Ma);function ro(e,t){return(ko(e)?lt:el)(e,$i(t,3))}function uo(e,t){return(ko(e)?it:tl)(e,$i(t,3))}var so=fi(function(e,t,n){he.call(e,n)?e[n].push(t):jn(e,n,[t])}),co=xl(function(e,t,n){var l=-1,i="function"==typeof t,a=Fo(e)?j(e.length):[];return el(e,function(e){a[++l]=i?tt(t,e,n):fl(e,t,n)}),a}),po=fi(function(e,t,n){jn(e,n,t)});function mo(e,t){return(ko(e)?st:Al)(e,$i(t,3))}var vo=fi(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Eo=xl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oa(e,t[0],t[1])?t=[]:n>2&&oa(t[0],t[1],t[2])&&(t=[t[0]]),bl(e,al(t,1),[])}),_o=qt||function(){return Ge.Date.now()};function So(e,t,n){return t=n?void 0:t,Hi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function fo(e,t){var l;if("function"!=typeof t)throw new Se(n);return e=ir(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var yo=xl(function(e,t,n){var l=1;if(n.length){var i=Vt(n,Xi(yo));l|=32}return Hi(e,l,t,n,i)}),To=xl(function(e,t,n){var l=3;if(n.length){var i=Vt(n,Xi(To));l|=32}return Hi(t,l,e,n,i)});function go(e,t,l){var i,a,o,r,u,s,d=0,c=!1,p=!1,m=!0;if("function"!=typeof e)throw new Se(n);function v(t){var n=i,l=a;return i=a=void 0,d=t,r=e.apply(l,n)}function E(e){return d=e,u=fa(S,t),c?v(e):r}function _(e){var n=e-s;return void 0===s||n>=t||n<0||p&&e-d>=o}function S(){var e=_o();if(_(e))return f(e);u=fa(S,function(e){var n=t-(e-s);return p?rn(n,o-(e-d)):n}(e))}function f(e){return u=void 0,m&&i?v(e):(i=a=void 0,r)}function y(){var e=_o(),n=_(e);if(i=arguments,a=this,s=e,n){if(void 0===u)return E(s);if(p)return si(u),u=fa(S,t),v(s)}return void 0===u&&(u=fa(S,t)),r}return t=or(t)||0,Wo(l)&&(c=!!l.leading,o=(p="maxWait"in l)?on(or(l.maxWait)||0,t):o,m="trailing"in l?!!l.trailing:m),y.cancel=function(){void 0!==u&&si(u),d=0,i=s=a=u=void 0},y.flush=function(){return void 0===u?r:f(_o())},y}var ho=xl(function(e,t){return Qn(e,1,t)}),Io=xl(function(e,t,n){return Qn(e,or(t)||0,n)});function Co(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Se(n);var l=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=l.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return l.cache=a.set(i,o)||a,o};return l.cache=new(Co.Cache||wn),l}function No(e){if("function"!=typeof e)throw new Se(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)}}Co.Cache=wn;var Ao=ri(function(e,t){var n=(t=1==t.length&&ko(t[0])?st(t[0],Dt($i())):st(al(t,1),Dt($i()))).length;return xl(function(l){for(var i=-1,a=rn(l.length,n);++i<a;)l[i]=t[i].call(this,l[i]);return tt(e,this,l)})}),Do=xl(function(e,t){return Hi(e,32,void 0,t,Vt(t,Xi(Do)))}),Oo=xl(function(e,t){return Hi(e,64,void 0,t,Vt(t,Xi(Oo)))}),Lo=Gi(function(e,t){return Hi(e,256,void 0,void 0,void 0,t)});function Po(e,t){return e===t||e!=e&&t!=t}var bo=Mi(vl),Ro=Mi(function(e,t){return e>=t}),Mo=yl(function(){return arguments}())?yl:function(e){return Ko(e)&&he.call(e,"callee")&&!je.call(e,"callee")},ko=j.isArray,wo=$e?Dt($e):function(e){return Ko(e)&&ml(e)==g};function Fo(e){return null!=e&&Go(e.length)&&!Uo(e)}function xo(e){return Ko(e)&&Fo(e)}var Ho=tn||ou,Vo=qe?Dt(qe):function(e){return Ko(e)&&ml(e)==u};function Bo(e){if(!Ko(e))return!1;var t=ml(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Xo(e)}function Uo(e){if(!Wo(e))return!1;var t=ml(e);return t==d||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Yo(e){return"number"==typeof e&&e==ir(e)}function Go(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Wo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ko(e){return null!=e&&"object"==typeof e}var zo=Ze?Dt(Ze):function(e){return Ko(e)&&ta(e)==p};function jo(e){return"number"==typeof e||Ko(e)&&ml(e)==m}function Xo(e){if(!Ko(e)||ml(e)!=E)return!1;var t=We(e);if(null===t)return!0;var n=he.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ge.call(n)==Ae}var $o=Qe?Dt(Qe):function(e){return Ko(e)&&ml(e)==_},qo=Je?Dt(Je):function(e){return Ko(e)&&ta(e)==S};function Zo(e){return"string"==typeof e||!ko(e)&&Ko(e)&&ml(e)==f}function Qo(e){return"symbol"==typeof e||Ko(e)&&ml(e)==y}var Jo=et?Dt(et):function(e){return Ko(e)&&Go(e.length)&&!!Fe[ml(e)]},er=Mi(Nl),tr=Mi(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fo(e))return Zo(e)?Gt(e):_i(e);if(ht&&e[ht])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ht]());var t=ta(e);return(t==p?xt:t==S?Bt:Pr)(e)}function lr(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 ir(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function ar(e){return e?$n(ir(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Qo(e))return NaN;if(Wo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Wo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=At(e);var n=le.test(e);return n||ae.test(e)?Be(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return Si(e,hr(e))}function ur(e){return null==e?"":ql(e)}var sr=yi(function(e,t){if(da(t)||Fo(t))Si(t,gr(t),e);else for(var n in t)he.call(t,n)&&Gn(e,n,t[n])}),dr=yi(function(e,t){Si(t,hr(t),e)}),cr=yi(function(e,t,n,l){Si(t,hr(t),e,l)}),pr=yi(function(e,t,n,l){Si(t,gr(t),e,l)}),mr=Gi(Xn),vr=xl(function(e,t){e=ve(e);var n=-1,l=t.length,i=l>2?t[2]:void 0;for(i&&oa(t[0],t[1],i)&&(l=1);++n<l;)for(var a=t[n],o=hr(a),r=-1,u=o.length;++r<u;){var s=o[r],d=e[s];(void 0===d||Po(d,ye[s])&&!he.call(e,s))&&(e[s]=a[s])}return e}),Er=xl(function(e){return e.push(void 0,Bi),tt(Cr,void 0,e)});function _r(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function Sr(e,t){return null!=e&&na(e,t,_l)}var fr=Oi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=n},Wr(jr)),yr=Oi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),he.call(e,t)?e[t].push(n):e[t]=[n]},$i),Tr=xl(fl);function gr(e){return Fo(e)?Hn(e):Cl(e)}function hr(e){return Fo(e)?Hn(e,!0):function(e){if(!Wo(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=da(e),n=[];for(var l in e)("constructor"!=l||!t&&he.call(e,l))&&n.push(l);return n}(e)}var Ir=yi(function(e,t,n){Ll(e,t,n)}),Cr=yi(function(e,t,n,l){Ll(e,t,n,l)}),Nr=Gi(function(e,t){var n={};if(null==e)return n;var l=!1;t=st(t,function(t){return t=oi(t,e),l||(l=t.length>1),t}),Si(e,Ki(e),n),l&&(n=qn(n,7,Ui));for(var i=t.length;i--;)Ql(n,t[i]);return n}),Ar=Gi(function(e,t){return null==e?{}:function(e,t){return Rl(e,t,function(t,n){return Sr(e,n)})}(e,t)});function Dr(e,t){if(null==e)return{};var n=st(Ki(e),function(e){return[e]});return t=$i(t),Rl(e,n,function(e,n){return t(e,n[0])})}var Or=xi(gr),Lr=xi(hr);function Pr(e){return null==e?[]:Ot(e,gr(e))}var br=Ii(function(e,t,n){return t=t.toLowerCase(),e+(n?Rr(t):t)});function Rr(e){return Br(ur(e).toLowerCase())}function Mr(e){return(e=ur(e))&&e.replace(re,Mt).replace(Le,"")}var kr=Ii(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),wr=Ii(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=hi("toLowerCase"),xr=Ii(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Hr=Ii(function(e,t,n){return e+(n?" ":"")+Br(t)}),Vr=Ii(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Br=hi("toUpperCase");function Ur(e,t,n){return e=ur(e),void 0===(t=n?void 0:t)?function(e){return Me.test(e)}(e)?function(e){return e.match(be)||[]}(e):function(e){return e.match(Z)||[]}(e):e.match(t)||[]}var Yr=xl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Bo(e)?e:new ce(e)}}),Gr=Gi(function(e,t){return lt(t,function(t){t=Aa(t),jn(e,t,yo(e[t],e))}),e});function Wr(e){return function(){return e}}var Kr=Ai(),zr=Ai(!0);function jr(e){return e}function Xr(e){return Il("function"==typeof e?e:qn(e,1))}var $r=xl(function(e,t){return function(n){return fl(n,e,t)}}),qr=xl(function(e,t){return function(n){return fl(e,n,t)}});function Zr(e,t,n){var l=gr(t),i=dl(t,l);null!=n||Wo(t)&&(i.length||!l.length)||(n=t,t=e,e=this,i=dl(t,gr(t)));var a=!(Wo(n)&&"chain"in n&&!n.chain),o=Uo(e);return lt(i,function(n){var l=t[n];e[n]=l,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__),i=n.__actions__=_i(this.__actions__);return i.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,dt([this.value()],arguments))})}),e}function Qr(){}var Jr=Pi(st),eu=Pi(at),tu=Pi(mt);function nu(e){return ra(e)?gt(Aa(e)):function(e){return function(t){return cl(t,e)}}(e)}var lu=Ri(),iu=Ri(!0);function au(){return[]}function ou(){return!1}var ru,uu=Li(function(e,t){return e+t},0),su=wi("ceil"),du=Li(function(e,t){return e/t},1),cu=wi("floor"),pu=Li(function(e,t){return e*t},1),mu=wi("round"),vu=Li(function(e,t){return e-t},0);return On.after=function(e,t){if("function"!=typeof t)throw new Se(n);return e=ir(e),function(){if(--e<1)return t.apply(this,arguments)}},On.ary=So,On.assign=sr,On.assignIn=dr,On.assignInWith=cr,On.assignWith=pr,On.at=mr,On.before=fo,On.bind=yo,On.bindAll=Gr,On.bindKey=To,On.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ko(e)?e:[e]},On.chain=to,On.chunk=function(e,t,n){t=(n?oa(e,t,n):void 0===t)?1:on(ir(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var i=0,a=0,o=j(Qt(l/t));i<l;)o[a++]=Wl(e,i,i+=t);return o},On.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,i=[];++t<n;){var a=e[t];a&&(i[l++]=a)}return i},On.concat=function(){var e=arguments.length;if(!e)return[];for(var t=j(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return dt(ko(n)?_i(n):[n],al(t,1))},On.cond=function(e){var t=null==e?0:e.length,l=$i();return e=t?st(e,function(e){if("function"!=typeof e[1])throw new Se(n);return[l(e[0]),e[1]]}):[],xl(function(n){for(var l=-1;++l<t;){var i=e[l];if(tt(i[0],this,n))return tt(i[1],this,n)}})},On.conforms=function(e){return function(e){var t=gr(e);return function(n){return Zn(n,e,t)}}(qn(e,1))},On.constant=Wr,On.countBy=io,On.create=function(e,t){var n=Ln(e);return null==t?n:zn(n,t)},On.curry=function e(t,n,l){var i=Hi(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},On.curryRight=function e(t,n,l){var i=Hi(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return i.placeholder=e.placeholder,i},On.debounce=go,On.defaults=vr,On.defaultsDeep=Er,On.defer=ho,On.delay=Io,On.difference=La,On.differenceBy=Pa,On.differenceWith=ba,On.drop=function(e,t,n){var l=null==e?0:e.length;return l?Wl(e,(t=n||void 0===t?1:ir(t))<0?0:t,l):[]},On.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?Wl(e,0,(t=l-(t=n||void 0===t?1:ir(t)))<0?0:t):[]},On.dropRightWhile=function(e,t){return e&&e.length?ei(e,$i(t,3),!0,!0):[]},On.dropWhile=function(e,t){return e&&e.length?ei(e,$i(t,3),!0):[]},On.fill=function(e,t,n,l){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&oa(e,t,n)&&(n=0,l=i),function(e,t,n,l){var i=e.length;for((n=ir(n))<0&&(n=-n>i?0:i+n),(l=void 0===l||l>i?i:ir(l))<0&&(l+=i),l=n>l?0:ar(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},On.filter=function(e,t){return(ko(e)?ot:il)(e,$i(t,3))},On.flatMap=function(e,t){return al(mo(e,t),1)},On.flatMapDeep=function(e,t){return al(mo(e,t),1/0)},On.flatMapDepth=function(e,t,n){return n=void 0===n?1:ir(n),al(mo(e,t),n)},On.flatten=ka,On.flattenDeep=function(e){return null!=e&&e.length?al(e,1/0):[]},On.flattenDepth=function(e,t){return null!=e&&e.length?al(e,t=void 0===t?1:ir(t)):[]},On.flip=function(e){return Hi(e,512)},On.flow=Kr,On.flowRight=zr,On.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var i=e[t];l[i[0]]=i[1]}return l},On.functions=function(e){return null==e?[]:dl(e,gr(e))},On.functionsIn=function(e){return null==e?[]:dl(e,hr(e))},On.groupBy=so,On.initial=function(e){return null!=e&&e.length?Wl(e,0,-1):[]},On.intersection=Fa,On.intersectionBy=xa,On.intersectionWith=Ha,On.invert=fr,On.invertBy=yr,On.invokeMap=co,On.iteratee=Xr,On.keyBy=po,On.keys=gr,On.keysIn=hr,On.map=mo,On.mapKeys=function(e,t){var n={};return t=$i(t,3),ul(e,function(e,l,i){jn(n,t(e,l,i),e)}),n},On.mapValues=function(e,t){var n={};return t=$i(t,3),ul(e,function(e,l,i){jn(n,l,t(e,l,i))}),n},On.matches=function(e){return Dl(qn(e,1))},On.matchesProperty=function(e,t){return Ol(e,qn(t,1))},On.memoize=Co,On.merge=Ir,On.mergeWith=Cr,On.method=$r,On.methodOf=qr,On.mixin=Zr,On.negate=No,On.nthArg=function(e){return e=ir(e),xl(function(t){return Pl(t,e)})},On.omit=Nr,On.omitBy=function(e,t){return Dr(e,No($i(t)))},On.once=function(e){return fo(2,e)},On.orderBy=function(e,t,n,l){return null==e?[]:(ko(t)||(t=null==t?[]:[t]),ko(n=l?void 0:n)||(n=null==n?[]:[n]),bl(e,t,n))},On.over=Jr,On.overArgs=Ao,On.overEvery=eu,On.overSome=tu,On.partial=Do,On.partialRight=Oo,On.partition=vo,On.pick=Ar,On.pickBy=Dr,On.property=nu,On.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},On.pull=Ba,On.pullAll=Ua,On.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ml(e,t,$i(n,2)):e},On.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Ml(e,t,void 0,n):e},On.pullAt=Ya,On.range=lu,On.rangeRight=iu,On.rearg=Lo,On.reject=function(e,t){return(ko(e)?ot:il)(e,No($i(t,3)))},On.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,i=[],a=e.length;for(t=$i(t,3);++l<a;){var o=e[l];t(o,l,e)&&(n.push(o),i.push(l))}return kl(e,i),n},On.rest=function(e,t){if("function"!=typeof e)throw new Se(n);return xl(e,t=void 0===t?t:ir(t))},On.reverse=Ga,On.sampleSize=function(e,t,n){return t=(n?oa(e,t,n):void 0===t)?1:ir(t),(ko(e)?Bn:Vl)(e,t)},On.set=function(e,t,n){return null==e?e:Bl(e,t,n)},On.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Bl(e,t,n,l)},On.shuffle=function(e){return(ko(e)?Un:Gl)(e)},On.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oa(e,t,n)?(t=0,n=l):(t=null==t?0:ir(t),n=void 0===n?l:ir(n)),Wl(e,t,n)):[]},On.sortBy=Eo,On.sortedUniq=function(e){return e&&e.length?Xl(e):[]},On.sortedUniqBy=function(e,t){return e&&e.length?Xl(e,$i(t,2)):[]},On.split=function(e,t,n){return n&&"number"!=typeof n&&oa(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ur(e))&&("string"==typeof t||null!=t&&!$o(t))&&!(t=ql(t))&&Ft(e)?ui(Gt(e),0,n):e.split(t,n):[]},On.spread=function(e,t){if("function"!=typeof e)throw new Se(n);return t=null==t?0:on(ir(t),0),xl(function(n){var l=n[t],i=ui(n,0,t);return l&&dt(i,l),tt(e,this,i)})},On.tail=function(e){var t=null==e?0:e.length;return t?Wl(e,1,t):[]},On.take=function(e,t,n){return e&&e.length?Wl(e,0,(t=n||void 0===t?1:ir(t))<0?0:t):[]},On.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?Wl(e,(t=l-(t=n||void 0===t?1:ir(t)))<0?0:t,l):[]},On.takeRightWhile=function(e,t){return e&&e.length?ei(e,$i(t,3),!1,!0):[]},On.takeWhile=function(e,t){return e&&e.length?ei(e,$i(t,3)):[]},On.tap=function(e,t){return t(e),e},On.throttle=function(e,t,l){var i=!0,a=!0;if("function"!=typeof e)throw new Se(n);return Wo(l)&&(i="leading"in l?!!l.leading:i,a="trailing"in l?!!l.trailing:a),go(e,t,{leading:i,maxWait:t,trailing:a})},On.thru=no,On.toArray=nr,On.toPairs=Or,On.toPairsIn=Lr,On.toPath=function(e){return ko(e)?st(e,Aa):Qo(e)?[e]:_i(Na(ur(e)))},On.toPlainObject=rr,On.transform=function(e,t,n){var l=ko(e),i=l||Ho(e)||Jo(e);if(t=$i(t,4),null==n){var a=e&&e.constructor;n=i?l?new a:[]:Wo(e)&&Uo(a)?Ln(We(e)):{}}return(i?lt:ul)(e,function(e,l,i){return t(n,e,l,i)}),n},On.unary=function(e){return So(e,1)},On.union=Wa,On.unionBy=Ka,On.unionWith=za,On.uniq=function(e){return e&&e.length?Zl(e):[]},On.uniqBy=function(e,t){return e&&e.length?Zl(e,$i(t,2)):[]},On.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zl(e,void 0,t):[]},On.unset=function(e,t){return null==e||Ql(e,t)},On.unzip=ja,On.unzipWith=Xa,On.update=function(e,t,n){return null==e?e:Jl(e,t,ai(n))},On.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,ai(n),l)},On.values=Pr,On.valuesIn=function(e){return null==e?[]:Ot(e,hr(e))},On.without=$a,On.words=Ur,On.wrap=function(e,t){return Do(ai(t),e)},On.xor=qa,On.xorBy=Za,On.xorWith=Qa,On.zip=Ja,On.zipObject=function(e,t){return li(e||[],t||[],Gn)},On.zipObjectDeep=function(e,t){return li(e||[],t||[],Bl)},On.zipWith=eo,On.entries=Or,On.entriesIn=Lr,On.extend=dr,On.extendWith=cr,Zr(On,On),On.add=uu,On.attempt=Yr,On.camelCase=br,On.capitalize=Rr,On.ceil=su,On.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),$n(or(e),t,n)},On.clone=function(e){return qn(e,4)},On.cloneDeep=function(e){return qn(e,5)},On.cloneDeepWith=function(e,t){return qn(e,5,t="function"==typeof t?t:void 0)},On.cloneWith=function(e,t){return qn(e,4,t="function"==typeof t?t:void 0)},On.conformsTo=function(e,t){return null==t||Zn(e,t,gr(t))},On.deburr=Mr,On.defaultTo=function(e,t){return null==e||e!=e?t:e},On.divide=du,On.endsWith=function(e,t,n){e=ur(e),t=ql(t);var l=e.length,i=n=void 0===n?l:$n(ir(n),0,l);return(n-=t.length)>=0&&e.slice(n,i)==t},On.eq=Po,On.escape=function(e){return(e=ur(e))&&x.test(e)?e.replace(w,kt):e},On.escapeRegExp=function(e){return(e=ur(e))&&K.test(e)?e.replace(W,"\\$&"):e},On.every=function(e,t,n){var l=ko(e)?at:nl;return n&&oa(e,t,n)&&(t=void 0),l(e,$i(t,3))},On.find=ao,On.findIndex=Ra,On.findKey=function(e,t){return Et(e,$i(t,3),ul)},On.findLast=oo,On.findLastIndex=Ma,On.findLastKey=function(e,t){return Et(e,$i(t,3),sl)},On.floor=cu,On.forEach=ro,On.forEachRight=uo,On.forIn=function(e,t){return null==e?e:ol(e,$i(t,3),hr)},On.forInRight=function(e,t){return null==e?e:rl(e,$i(t,3),hr)},On.forOwn=function(e,t){return e&&ul(e,$i(t,3))},On.forOwnRight=function(e,t){return e&&sl(e,$i(t,3))},On.get=_r,On.gt=bo,On.gte=Ro,On.has=function(e,t){return null!=e&&na(e,t,El)},On.hasIn=Sr,On.head=wa,On.identity=jr,On.includes=function(e,t,n,l){e=Fo(e)?e:Pr(e),n=n&&!l?ir(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),Zo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&St(e,t,n)>-1},On.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=null==n?0:ir(n);return i<0&&(i=on(l+i,0)),St(e,t,i)},On.inRange=function(e,t,n){return t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n){return e>=rn(t,n)&&e<on(t,n)}(e=or(e),t,n)},On.invoke=Tr,On.isArguments=Mo,On.isArray=ko,On.isArrayBuffer=wo,On.isArrayLike=Fo,On.isArrayLikeObject=xo,On.isBoolean=function(e){return!0===e||!1===e||Ko(e)&&ml(e)==r},On.isBuffer=Ho,On.isDate=Vo,On.isElement=function(e){return Ko(e)&&1===e.nodeType&&!Xo(e)},On.isEmpty=function(e){if(null==e)return!0;if(Fo(e)&&(ko(e)||"string"==typeof e||"function"==typeof e.splice||Ho(e)||Jo(e)||Mo(e)))return!e.length;var t=ta(e);if(t==p||t==S)return!e.size;if(da(e))return!Cl(e).length;for(var n in e)if(he.call(e,n))return!1;return!0},On.isEqual=function(e,t){return Tl(e,t)},On.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?Tl(e,t,void 0,n):!!l},On.isError=Bo,On.isFinite=function(e){return"number"==typeof e&&nn(e)},On.isFunction=Uo,On.isInteger=Yo,On.isLength=Go,On.isMap=zo,On.isMatch=function(e,t){return e===t||gl(e,t,Zi(t))},On.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,gl(e,t,Zi(t),n)},On.isNaN=function(e){return jo(e)&&e!=+e},On.isNative=function(e){if(sa(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return hl(e)},On.isNil=function(e){return null==e},On.isNull=function(e){return null===e},On.isNumber=jo,On.isObject=Wo,On.isObjectLike=Ko,On.isPlainObject=Xo,On.isRegExp=$o,On.isSafeInteger=function(e){return Yo(e)&&e>=-9007199254740991&&e<=9007199254740991},On.isSet=qo,On.isString=Zo,On.isSymbol=Qo,On.isTypedArray=Jo,On.isUndefined=function(e){return void 0===e},On.isWeakMap=function(e){return Ko(e)&&ta(e)==T},On.isWeakSet=function(e){return Ko(e)&&"[object WeakSet]"==ml(e)},On.join=function(e,t){return null==e?"":ln.call(e,t)},On.kebabCase=kr,On.last=Va,On.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var i=l;return void 0!==n&&(i=(i=ir(n))<0?on(l+i,0):rn(i,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,i):_t(e,yt,i,!0)},On.lowerCase=wr,On.lowerFirst=Fr,On.lt=er,On.lte=tr,On.max=function(e){return e&&e.length?ll(e,jr,vl):void 0},On.maxBy=function(e,t){return e&&e.length?ll(e,$i(t,2),vl):void 0},On.mean=function(e){return Tt(e,jr)},On.meanBy=function(e,t){return Tt(e,$i(t,2))},On.min=function(e){return e&&e.length?ll(e,jr,Nl):void 0},On.minBy=function(e,t){return e&&e.length?ll(e,$i(t,2),Nl):void 0},On.stubArray=au,On.stubFalse=ou,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=pu,On.nth=function(e,t){return e&&e.length?Pl(e,ir(t)):void 0},On.noConflict=function(){return Ge._===this&&(Ge._=De),this},On.noop=Qr,On.now=_o,On.pad=function(e,t,n){e=ur(e);var l=(t=ir(t))?Yt(e):0;if(!t||l>=t)return e;var i=(t-l)/2;return bi(Jt(i),n)+e+bi(Qt(i),n)},On.padEnd=function(e,t,n){e=ur(e);var l=(t=ir(t))?Yt(e):0;return t&&l<t?e+bi(t-l,n):e},On.padStart=function(e,t,n){e=ur(e);var l=(t=ir(t))?Yt(e):0;return t&&l<t?bi(t-l,n)+e:e},On.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),sn(ur(e).replace(z,""),t||0)},On.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oa(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=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var i=dn();return rn(e+i*(t-e+Ve("1e-"+((i+"").length-1))),t)}return wl(e,t)},On.reduce=function(e,t,n){var l=ko(e)?ct:It,i=arguments.length<3;return l(e,$i(t,4),n,i,el)},On.reduceRight=function(e,t,n){var l=ko(e)?pt:It,i=arguments.length<3;return l(e,$i(t,4),n,i,tl)},On.repeat=function(e,t,n){return t=(n?oa(e,t,n):void 0===t)?1:ir(t),Fl(ur(e),t)},On.replace=function(){var e=arguments,t=ur(e[0]);return e.length<3?t:t.replace(e[1],e[2])},On.result=function(e,t,n){var l=-1,i=(t=oi(t,e)).length;for(i||(i=1,e=void 0);++l<i;){var a=null==e?void 0:e[Aa(t[l])];void 0===a&&(l=i,a=n),e=Uo(a)?a.call(e):a}return e},On.round=mu,On.runInContext=e,On.sample=function(e){return(ko(e)?Vn:Hl)(e)},On.size=function(e){if(null==e)return 0;if(Fo(e))return Zo(e)?Yt(e):e.length;var t=ta(e);return t==p||t==S?e.size:Cl(e).length},On.snakeCase=xr,On.some=function(e,t,n){var l=ko(e)?mt:Kl;return n&&oa(e,t,n)&&(t=void 0),l(e,$i(t,3))},On.sortedIndex=function(e,t){return zl(e,t)},On.sortedIndexBy=function(e,t,n){return jl(e,t,$i(n,2))},On.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=zl(e,t);if(l<n&&Po(e[l],t))return l}return-1},On.sortedLastIndex=function(e,t){return zl(e,t,!0)},On.sortedLastIndexBy=function(e,t,n){return jl(e,t,$i(n,2),!0)},On.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=zl(e,t,!0)-1;if(Po(e[n],t))return n}return-1},On.startCase=Hr,On.startsWith=function(e,t,n){return e=ur(e),n=null==n?0:$n(ir(n),0,e.length),t=ql(t),e.slice(n,n+t.length)==t},On.subtract=vu,On.sum=function(e){return e&&e.length?Ct(e,jr):0},On.sumBy=function(e,t){return e&&e.length?Ct(e,$i(t,2)):0},On.template=function(e,t,n){var l=On.templateSettings;n&&oa(e,t,n)&&(t=void 0),e=ur(e),t=cr({},t,l,Vi);var i,a,o=cr({},t.imports,l.imports,Vi),r=gr(o),u=Ot(o,r),s=0,d=t.interpolate||ue,c="__p += '",p=Ee((t.escape||ue).source+"|"+d.source+"|"+(d===B?ee:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),m="//# sourceURL="+(he.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++we+"]")+"\n";e.replace(p,function(t,n,l,o,r,u){return l||(l=o),c+=e.slice(s,u).replace(se,wt),n&&(i=!0,c+="' +\n__e("+n+") +\n'"),r&&(a=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),c+="';\n";var v=he.call(t,"variable")&&t.variable;if(v){if(Q.test(v))throw new ce("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(a?c.replace(b,""):c).replace(R,"$1").replace(M,"$1;"),c="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Yr(function(){return pe(r,m+"return "+c).apply(void 0,u)});if(E.source=c,Bo(E))throw E;return E},On.times=function(e,t){if((e=ir(e))<1||e>9007199254740991)return[];var n=4294967295,l=rn(e,4294967295);e-=4294967295;for(var i=Nt(l,t=$i(t));++n<e;)t(n);return i},On.toFinite=lr,On.toInteger=ir,On.toLength=ar,On.toLower=function(e){return ur(e).toLowerCase()},On.toNumber=or,On.toSafeInteger=function(e){return e?$n(ir(e),-9007199254740991,9007199254740991):0===e?e:0},On.toString=ur,On.toUpper=function(e){return ur(e).toUpperCase()},On.trim=function(e,t,n){if((e=ur(e))&&(n||void 0===t))return At(e);if(!e||!(t=ql(t)))return e;var l=Gt(e),i=Gt(t);return ui(l,Pt(l,i),bt(l,i)+1).join("")},On.trimEnd=function(e,t,n){if((e=ur(e))&&(n||void 0===t))return e.slice(0,Wt(e)+1);if(!e||!(t=ql(t)))return e;var l=Gt(e);return ui(l,0,bt(l,Gt(t))+1).join("")},On.trimStart=function(e,t,n){if((e=ur(e))&&(n||void 0===t))return e.replace(z,"");if(!e||!(t=ql(t)))return e;var l=Gt(e);return ui(l,Pt(l,Gt(t))).join("")},On.truncate=function(e,t){var n=30,l="...";if(Wo(t)){var i="separator"in t?t.separator:i;n="length"in t?ir(t.length):n,l="omission"in t?ql(t.omission):l}var a=(e=ur(e)).length;if(Ft(e)){var o=Gt(e);a=o.length}if(n>=a)return e;var r=n-Yt(l);if(r<1)return l;var u=o?ui(o,0,r).join(""):e.slice(0,r);if(void 0===i)return u+l;if(o&&(r+=u.length-r),$o(i)){if(e.slice(r).search(i)){var s,d=u;for(i.global||(i=Ee(i.source,ur(te.exec(i))+"g")),i.lastIndex=0;s=i.exec(d);)var c=s.index;u=u.slice(0,void 0===c?r:c)}}else if(e.indexOf(ql(i),r)!=r){var p=u.lastIndexOf(i);p>-1&&(u=u.slice(0,p))}return u+l},On.unescape=function(e){return(e=ur(e))&&F.test(e)?e.replace(k,Kt):e},On.uniqueId=function(e){var t=++Ie;return ur(e)+t},On.upperCase=Vr,On.upperFirst=Br,On.each=ro,On.eachRight=uo,On.first=wa,Zr(On,(ru={},ul(On,function(e,t){he.call(On.prototype,t)||(ru[t]=e)}),ru),{chain:!1}),On.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){On[e].placeholder=On}),lt(["drop","take"],function(e,t){Rn.prototype[e]=function(n){n=void 0===n?1:on(ir(n),0);var l=this.__filtered__&&!t?new Rn(this):this.clone();return l.__filtered__?l.__takeCount__=rn(n,l.__takeCount__):l.__views__.push({size:rn(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Rn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),lt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Rn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$i(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Rn.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Rn.prototype[e]=function(){return this.__filtered__?new Rn(this):this[n](1)}}),Rn.prototype.compact=function(){return this.filter(jr)},Rn.prototype.find=function(e){return this.filter(e).head()},Rn.prototype.findLast=function(e){return this.reverse().find(e)},Rn.prototype.invokeMap=xl(function(e,t){return"function"==typeof e?new Rn(this):this.map(function(n){return fl(n,e,t)})}),Rn.prototype.reject=function(e){return this.filter(No($i(e)))},Rn.prototype.slice=function(e,t){e=ir(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Rn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ir(t))<0?n.dropRight(-t):n.take(t-e)),n)},Rn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Rn.prototype.toArray=function(){return this.take(4294967295)},ul(Rn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),i=On[l?"take"+("last"==t?"Right":""):t],a=l||/^find/.test(t);i&&(On.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Rn,u=o[0],s=r||ko(t),d=function(e){var t=i.apply(On,dt([e],o));return l&&c?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(r=s=!1);var c=this.__chain__,p=!!this.__actions__.length,m=a&&!c,v=r&&!p;if(!a&&s){t=v?t:new Rn(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new bn(E,c)}return m&&v?e.apply(this,o):(E=this.thru(d),m?l?E.value()[0]:E.value():E)})}),lt(["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);On.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var i=this.value();return t.apply(ko(i)?i:[],e)}return this[n](function(n){return t.apply(ko(n)?n:[],e)})}}),ul(Rn.prototype,function(e,t){var n=On[t];if(n){var l=n.name+"";he.call(yn,l)||(yn[l]=[]),yn[l].push({name:t,func:n})}}),yn[Di(void 0,2).name]=[{name:"wrapper",func:void 0}],Rn.prototype.clone=function(){var e=new Rn(this.__wrapped__);return e.__actions__=_i(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=_i(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=_i(this.__views__),e},Rn.prototype.reverse=function(){if(this.__filtered__){var e=new Rn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Rn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ko(e),l=t<0,i=n?e.length:0,a=function(e,t,n){for(var l=-1,i=n.length;++l<i;){var a=n[l],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=rn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,r=a.end,u=r-o,s=l?r:o-1,d=this.__iteratees__,c=d.length,p=0,m=rn(u,this.__takeCount__);if(!n||!l&&i==u&&m==u)return ti(e,this.__actions__);var v=[];e:for(;u--&&p<m;){for(var E=-1,_=e[s+=t];++E<c;){var S=d[E],f=S.type,y=(0,S.iteratee)(_);if(2==f)_=y;else if(!y){if(1==f)continue e;break e}}v[p++]=_}return v},On.prototype.at=lo,On.prototype.chain=function(){return to(this)},On.prototype.commit=function(){return new bn(this.value(),this.__chain__)},On.prototype.next=function(){void 0===this.__values__&&(this.__values__=nr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},On.prototype.plant=function(e){for(var t,n=this;n instanceof Pn;){var l=Oa(n);l.__index__=0,l.__values__=void 0,t?i.__wrapped__=l:t=l;var i=l;n=n.__wrapped__}return i.__wrapped__=e,t},On.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Rn){var t=e;return this.__actions__.length&&(t=new Rn(this)),(t=t.reverse()).__actions__.push({func:no,args:[Ga],thisArg:void 0}),new bn(t,this.__chain__)}return this.thru(Ga)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return ti(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,ht&&(On.prototype[ht]=function(){return this}),On}();Ke?((Ke.exports=zt)._=zt,We._=zt):Ge._=zt}).call(v)});const fe=e=>{let{path:n}=e;const o=a.useLocation(),{t:r}=i.useTranslation(),u=Digit.ComponentRegistryService.getComponent("FSMNewApplicationCitizen"),d=Digit.ComponentRegistryService.getComponent("FSMMyApplications"),c=Digit.ComponentRegistryService.getComponent("FSMEmployeeApplicationDetails"),p=Digit.ComponentRegistryService.getComponent("FSMCitizenApplicationDetails"),m=Digit.ComponentRegistryService.getComponent("FSMSelectRating"),v=Digit.ComponentRegistryService.getComponent("FSMRateView"),E=Digit.ComponentRegistryService.getComponent("FSMResponse"),_=Digit.ComponentRegistryService.getComponent("FSMDsoDashboard"),S=Digit.ComponentRegistryService.getComponent("FSMEmpInbox"),f=Digit.ComponentRegistryService.getComponent("EditVendor");return console.log(n+"/registry/modify-vendor/:id"),l.createElement(l.Fragment,null,l.createElement("div",{className:"fsm-citizen-wrapper"},o.pathname.includes("/response")||o.pathname.split("/").includes("check")?null:o.pathname.includes("/street")?l.createElement(t.BackButton,{getBackPageNumber:()=>-4},r("CS_COMMON_BACK")):l.createElement(t.BackButton,null,r("CS_COMMON_BACK")),l.createElement(a.Switch,null,l.createElement(t.PrivateRoute,{path:n+"/inbox",component:()=>Digit.UserService.hasAccess(["FSM_DSO"])?l.createElement(S,{parentRoute:n,isInbox:!0}):l.createElement(a.Redirect,{to:"/digit-ui/citizen"})}),l.createElement(t.PrivateRoute,{path:n+"/search",component:()=>Digit.UserService.hasAccess(["FSM_DSO"])?l.createElement(S,{parentRoute:n,isSearch:!0}):l.createElement(a.Redirect,{to:"/digit-ui/citizen"})}),l.createElement(t.PrivateRoute,{path:n+"/new-application",component:()=>l.createElement(u,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/my-applications",component:d}),l.createElement(t.PrivateRoute,{path:n+"/dso-application-details/:id",component:()=>l.createElement(c,{parentRoute:n,userType:"DSO"})}),l.createElement(t.PrivateRoute,{path:n+"/application-details/:id",component:()=>l.createElement(p,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/rate/:id",component:()=>l.createElement(m,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/rate-view/:id",component:()=>l.createElement(v,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/response",component:e=>l.createElement(E,s({parentRoute:n},e))}),l.createElement(t.PrivateRoute,{path:n+"/dso-dashboard",component:()=>l.createElement(_,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/dso-dashboard",component:()=>l.createElement(_,{parentRoute:n})}),l.createElement(t.PrivateRoute,{path:n+"/registry/modify-vendor/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(f,e))}))))},ye=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))},Te=e=>{var t,a,o,r,u,s,d,c,p;let{assigner:m}=e;const{t:v}=i.useTranslation(),[E,_]=n.useState(null),S=Digit.ULBService.getCurrentTenantId(),{data:f}=Digit.Hooks.useEmployeeSearch(S,{uuids:null==m?void 0:m.uuid},{enabled:"employee"===Digit.UserService.getType()&&"EMPLOYEE"===(null==m?void 0:m.type)});return l.createElement("p",null,null==m?void 0:m.name," ",null!=f&&null!==(t=f.Employees)&&void 0!==t&&null!==(a=t[0])&&void 0!==a&&null!==(o=a.assignments)&&void 0!==o&&null!==(r=o[0])&&void 0!==r&&r.designation?`(${v("COMMON_MASTERS_DESIGNATION_"+(null==f||null===(u=f.Employees)||void 0===u||null===(s=u[0])||void 0===s||null===(d=s.assignments)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.designation))})`:"","CITIZEN"===(null==m?void 0:m.type)&&null!=m&&null!==(p=m.roles)&&void 0!==p&&p.some(e=>"FSM_DSO"===e.code)?"(DSO)":"")},ge=e=>{let{data:n}=e;const{t:a}=i.useTranslation();return l.createElement("div",null,n.date&&l.createElement("p",null,n.date),l.createElement(Te,{assigner:n.name}),n.mobileNumber&&l.createElement(t.TelePhone,{mobile:n.mobileNumber}),n.source&&l.createElement("p",null,a("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+n.source.toUpperCase())),n.comment&&l.createElement(ye,{otherComment:null==n?void 0:n.otherComment,headComment:null==n?void 0:n.comment}))},he=e=>{var o,r,u,s,d,c;const{t:p}=i.useTranslation(),{isLoading:m,data:v}=Digit.Hooks.useWorkflowDetails({tenantId:null===(o=e.application)||void 0===o?void 0:o.tenantId,id:e.id,moduleCode:"FSM"}),[E,_]=n.useState(!1),S=i=>{var o;const r=null==i||null===(o=i.comment)||void 0===o?void 0:o.split("~"),u=r?r[0]:null,s=r?r[1]:null;if("CREATED"===i.status){var d,c;const t={date:null==i||null===(d=i.auditDetails)||void 0===d?void 0:d.created,source:(null===(c=e.application)||void 0===c?void 0:c.source)||""};return l.createElement(ge,{data:t})}if("PENDING_APPL_FEE_PAYMENT"===i.status||"DSO_REJECTED"===i.status||"CANCELED"===i.status||"REJECTED"===i.status){var m;const e={date:null==i||null===(m=i.auditDetails)||void 0===m?void 0:m.created,name:null==i?void 0:i.assigner,comment:u?p("ES_ACTION_REASON_"+u):null,otherComment:s||null};return l.createElement(ge,{data:e})}if("CITIZEN_FEEDBACK_PENDING"===i.status)return l.createElement(n.Fragment,null,(null==v?void 0:v.nextActions.length)>0&&l.createElement("div",null,l.createElement(a.Link,{to:"/digit-ui/citizen/fsm/rate/"+e.id},l.createElement(t.ActionLinks,null,p("CS_FSM_RATE")))));if("DSO_INPROGRESS"===i.status){var E,_,S;const t={name:null==i?void 0:i.assigner,mobileNumber:null===(E=e.application)||void 0===E||null===(_=E.dsoDetails)||void 0===_?void 0:_.mobileNumber,date:`${p("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(null===(S=e.application)||void 0===S?void 0:S.possibleServiceDate)}`};return l.createElement(ge,{data:t})}if("COMPLETED"===i.status)return l.createElement("div",null,l.createElement(t.Rating,{withText:!0,text:p("CS_FSM_YOU_RATED"),currentRating:i.rating}),l.createElement(a.Link,{to:"/digit-ui/citizen/fsm/rate-view/"+e.id},l.createElement(t.ActionLinks,null,p("CS_FSM_RATE_VIEW"))));if("DISPOSAL_IN_PROGRESS"===i.status){var f,y;const e={date:null==i||null===(f=i.auditDetails)||void 0===f?void 0:f.created,name:null==i?void 0:i.assigner,mobileNumber:null==i||null===(y=i.assigner)||void 0===y?void 0:y.mobileNumber};return null!=i&&i.numberOfTrips&&(e.comment=`${p("NUMBER_OF_TRIPS")}: ${null==i?void 0:i.numberOfTrips}`),l.createElement(ge,{data:e})}if("PENDING_PAYYY"===i.status){var T,g;const t={name:null==i?void 0:i.assigner,mobileNumber:null==i||null===(T=i.assigner)||void 0===T?void 0:T.mobileNumber,date:`${p("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(null===(g=e.application)||void 0===g?void 0:g.possibleServiceDate)}`};return l.createElement(ge,{data:t})}};return m?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,!m&&l.createElement(n.Fragment,null,(null==v||null===(r=v.timeline)||void 0===r?void 0:r.length)>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},p("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=v&&v.timeline&&1===(null==v||null===(u=v.timeline)||void 0===u?void 0:u.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:p("CS_COMMON_FSM_"+("UPDATE"===(null==v||null===(s=v.timeline[0])||void 0===s?void 0:s.performedAction)?"UPDATE_":"")+(null==v||null===(d=v.timeline[0])||void 0===d?void 0:d.status)),customChild:S(null==v?void 0:v.timeline[0])}):l.createElement(t.ConnectingCheckPoints,null,(null==v?void 0:v.timeline)&&(null==v?void 0:v.timeline.slice(0,E?v.timeline.length:2).map((e,n,i)=>l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,label:p("CS_COMMON_"+("UPDATE"===(null==e?void 0:e.performedAction)?"UPDATE_":"")+e.status),customChild:S(e)}))))),(null==v||null===(c=v.timeline)||void 0===c?void 0:c.length)>2&&l.createElement(t.LinkButton,{label:p(E?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{_(e=>!e)}})),v&&(n=>{switch(null==n?void 0:n.action){case"PAY":return l.createElement("div",{style:{marginTop:"24px"}},l.createElement(a.Link,{to:{pathname:`/digit-ui/citizen/payment/my-bills/FSM.TRIP_CHARGES/${e.id}/?tenantId=${e.application.tenantId}`,state:{tenantId:e.application.tenantId}}},window.location.href.includes("citizen/fsm/")&&l.createElement(t.SubmitBar,{label:p("CS_APPLICATION_DETAILS_MAKE_PAYMENT")})));case"SUBMIT_FEEDBACK":return l.createElement("div",{style:{marginTop:"24px"}},l.createElement(a.Link,{to:"/digit-ui/citizen/fsm/rate/"+e.id},l.createElement(t.SubmitBar,{label:p("CS_APPLICATION_DETAILS_RATE")})))}})(null==v?void 0:v.nextActions[0]))},Ie=e=>{let{application:n}=e;const{t:o}=i.useTranslation();return l.createElement(t.Card,null,l.createElement(t.KeyNote,{keyValue:o("CS_FSM_APPLICATION_APPLICATION_NO"),note:n.applicationNo}),l.createElement(t.KeyNote,{keyValue:o("CS_FSM_APPLICATION_SERVICE_CATEGORY"),note:n.serviceCategory||o("CS_TITLE_FSM")}),l.createElement(t.KeyNote,{keyValue:o("CS_FSM_APPLICATION_DETAIL_STATUS"),note:o("CS_COMMON_"+n.applicationStatus)}),l.createElement(a.Link,{to:{pathname:"/digit-ui/citizen/fsm/application-details/"+n.applicationNo,state:{tenantId:n.tenantId}}},l.createElement(t.SubmitBar,{label:o("CS_COMMON_VIEW")})))},Ce=e=>{let{jumpTo:n}=e;const{t:o}=i.useTranslation(),r=a.useHistory();return l.createElement(t.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(n)}})},Ne=e=>{var n,a,o,r,u,s,d,c;let{onSubmit:p,value:v}=e;const{t:E}=i.useTranslation(),{address:_,propertyType:S,subtype:f,pitType:y,pitDetail:T,selectGender:g,selectPaymentPreference:h,selectTripNo:I,roadWidth:C}=v,N=T?Object.values(T).filter(e=>!!e):null,A=null==N?void 0:N.reduce((e,t,n,l)=>n===l.length-1?e+t+"m":e+t+"m x ","");return l.createElement(l.Fragment,null,l.createElement(m,{currentStep:4,flow:"APPLY"}),l.createElement(t.Card,null,l.createElement(t.CardHeader,null,E("CS_CHECK_CHECK_YOUR_ANSWERS")),l.createElement(t.CardText,null,E("CS_CHECK_CHECK_YOUR_ANSWERS_TEXT")),l.createElement(t.CardSubHeader,null,E("CS_CHECK_PROPERTY_DETAILS")),l.createElement(t.StatusTable,null,I&&(null==I?void 0:I.tripNo)&&l.createElement(t.Row,{label:E("ES_FSM_ACTION_NUMBER_OF_TRIPS"),text:E(null==I||null===(n=I.tripNo)||void 0===n?void 0:n.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-trip-number"})}),I&&(null==I?void 0:I.vehicleCapacity)&&l.createElement(t.Row,{label:E("ES_VEHICLE CAPACITY"),text:E(null==I||null===(a=I.vehicleCapacity)||void 0===a?void 0:a.capacity),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-trip-number"})}),g&&l.createElement(t.Row,{label:E("ES_FSM_ACTION_GENDER_TYPE"),text:E(null==g?void 0:g.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-gender"})}),l.createElement(t.Row,{label:E("CS_CHECK_PROPERTY_ID"),text:null!=v&&null!==(o=v.cptId)&&void 0!==o&&o.id?null==v||null===(r=v.cptId)||void 0===r?void 0:r.id:"NA",actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/know-your-property"})}),l.createElement(t.Row,{label:E("CS_CHECK_PROPERTY_TYPE"),text:E(null==S?void 0:S.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/property-type"})}),l.createElement(t.Row,{label:E("CS_CHECK_PROPERTY_SUB_TYPE"),text:E(null==f?void 0:f.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/property-subtype"})}),l.createElement(t.Row,{label:E("CS_CHECK_ADDRESS"),text:((e,t)=>{var n,l,i,a,o,r,u,s,d,c,p,m,v,E,_,S,f,y,T;return console.log("address",e),"OTH1"===(null==e||null===(n=e.gramPanchayat)||void 0===n?void 0:n.code)?`${null!=e&&null!==(i=e.doorNo)&&void 0!==i&&i.trim()?(null==e||null===(a=e.doorNo)||void 0===a?void 0:a.trim())+", ":""} ${null!=e&&null!==(o=e.street)&&void 0!==o&&o.trim()?(null==e||null===(r=e.street)||void 0===r?void 0:r.trim())+", ":""}${"WITHIN_ULB_LIMITS"===(null==e||null===(u=e.propertyLocation)||void 0===u?void 0:u.code)?t(null==e||null===(s=e.locality)||void 0===s?void 0:s.i18nkey):null==e?void 0:e.newGramPanchayat},${t(null==e||null===(d=e.village)||void 0===d?void 0:d.code)}, ${t(null==e?void 0:e.city.code)}`:"WITHIN_ULB_LIMITS"===(null==e||null===(l=e.propertyLocation)||void 0===l?void 0:l.code)?(console.log("trueee",""+t(null==e||null===(c=e.locality)||void 0===c?void 0:c.code)),""+t(null==e||null===(p=e.locality)||void 0===p?void 0:p.code)):`${null!=e&&null!==(m=e.doorNo)&&void 0!==m&&m.trim()?(null==e||null===(v=e.doorNo)||void 0===v?void 0:v.trim())+", ":""} ${null!=e&&null!==(E=e.street)&&void 0!==E&&E.trim()?(null==e||null===(_=e.street)||void 0===_?void 0:_.trim())+", ":""}${"WITHIN_ULB_LIMITS"===(null==e||null===(S=e.propertyLocation)||void 0===S?void 0:S.code)?t(null==e||null===(f=e.locality)||void 0===f?void 0:f.i18nkey):null==e||null===(y=e.gramPanchayat)||void 0===y?void 0:y.i18nkey},${t(null==e||null===(T=e.village)||void 0===T?void 0:T.code)}, ${t(null==e?void 0:e.city.code)}`})(_,E),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/pincode"})}),(null==_||null===(u=_.landmark)||void 0===u?void 0:u.trim())&&l.createElement(t.Row,{label:E("CS_CHECK_LANDMARK"),text:null==_||null===(s=_.landmark)||void 0===s?void 0:s.trim(),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/landmark"})}),!0===(null==_||null===(d=_.slumArea)||void 0===d?void 0:d.code)&&l.createElement(t.Row,{label:E("CS_APPLICATION_DETAILS_SLUM_NAME"),text:E(null==_||null===(c=_.slumData)||void 0===c?void 0:c.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/slum-details"})}),y&&l.createElement(t.Row,{label:E("CS_CHECK_PIT_TYPE"),text:E(y.i18nKey),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/pit-type"})}),l.createElement(t.Row,{label:E("CS_CHECK_ROAD_WIDTH"),text:E(null==C?void 0:C.roadWidth),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/road-details"})}),l.createElement(t.Row,{label:E("CS_CHECK_DISTANCE_FROM_ROAD"),text:E(null==C?void 0:C.distancefromroad),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/road-details"})}),A&&l.createElement(t.Row,{label:E("CS_CHECK_SIZE"),text:[A],actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/tank-size"})}),((null==h?void 0:h.advanceAmount)||0===(null==h?void 0:h.advanceAmount))&&l.createElement(t.Row,{label:E("ADV_AMOUNT"),text:"₹ "+E(null==h?void 0:h.advanceAmount),actionButton:l.createElement(Ce,{jumpTo:"/digit-ui/citizen/fsm/new-application/select-payment-preference"})})),l.createElement(t.SubmitBar,{label:E("CS_COMMON_SUBMIT"),onSubmit:p})),S&&l.createElement(t.CitizenInfoLabel,{style:{marginTop:"8px",padding:"16px"},info:E("CS_FILE_APPLICATION_INFO_LABEL"),text:E("CS_FILE_APPLICATION_INFO_TEXT",{content:E("CS_DEFAULT_INFO_TEXT"),...S})}))},Ae=(e,t)=>{var n,l;return null!=e&&e.slumName?t(e.slumName):null!=e&&null!==(n=e.slum)&&void 0!==n&&n.i18nKey?t(""+(null==e||null===(l=e.slum)||void 0===l?void 0:l.i18nKey)):"N/A"},De=e=>e&&0!==e?"₹ "+e:"N/A",Oe=e=>e&&0!==e?"₹ "+e:"N/A",Le=(e,t)=>{var n,l,i,a,o,r,u;const s=null==e||null===(n=e.tenantId)||void 0===n?void 0:n.toUpperCase().split(".").join("_"),d=null==e||null===(l=e.address)||void 0===l||null===(i=l.locality)||void 0===i?void 0:i.code,c=null==e||null===(a=e.address)||void 0===a||null===(o=a.additionalDetails)||void 0===o?void 0:o.village,p=null==e||null===(r=e.address)||void 0===r||null===(u=r.additionalDetails)||void 0===u?void 0:u.newGramPanchayat;return null!=c&&c.code?t(`${s}_REVENUE_${d}`)+" "+t(null==c?void 0:c.name)||"N/A":p?t(p)+" "+t(null==c?void 0:c.name)||"N/A":t(`${s}_REVENUE_${d}`)||"N/A"},Pe=(e,t,n)=>{var l,i,a,o,r,u,s,c,p,m,v,E,_,S,f,y,T,g,h,I,C,N;const{additionalDetails:A}=e,D=null==A?void 0:A.tripAmount,O=D*(null==e?void 0:e.noOfTrips),L=null==e?void 0:e.advanceAmount;return console.log("applicationapplication",e),{t:n,tenantId:null==t?void 0:t.code,name:`${n(null==t?void 0:t.i18nKey)} ${n("ULBGRADE_"+(null==t||null===(l=t.city)||void 0===l?void 0:l.ulbGrade.toUpperCase().replace(" ","_").replace(".","_")))}`,email:null==t?void 0:t.emailId,phoneNumber:null==t?void 0:t.contactNumber,applicationNumber:(null==e?void 0:e.applicationNo)||"NA",heading:n("PDF_HEADER_DESLUDGING_REQUEST_ACKNOWLEDGEMENT"),details:[{title:n("CS_TITLE_APPLICATION_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_APPLICATION_DATE"),value:Digit.DateUtils.ConvertTimestampToDate(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.createdTime,"dd/MM/yyyy")},{title:n("CS_APPLICATION_DETAILS_APPLICATION_CHANNEL"),value:n("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+(null==e?void 0:e.source))||"N/A"}]},{title:n("CS_APPLICATION_DETAILS_APPLICANT_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_APPLICANT_NAME"),value:(null==e||null===(a=e.citizen)||void 0===a?void 0:a.name)||"N/A"},{title:n("CS_APPLICATION_DETAILS_APPLICANT_MOBILE"),value:(null==e||null===(o=e.citizen)||void 0===o?void 0:o.mobileNumber)||"N/A"},{title:n("CS_APPLICATION_DETAILS_APPLICANT_EMAIL_ID"),value:(null==e||null===(r=e.citizen)||void 0===r?void 0:r.emailId)||(null==e||null===(u=e.additionalDetails)||void 0===u?void 0:u.emailId)||"NA"}]},{title:n("CS_APPLICATION_DETAILS_PROPERTY_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_PROPERTY_ID"),value:(null==e||null===(s=e.additionalDetails)||void 0===s?void 0:s.propertyID)||"N/A"},{title:n("CS_APPLICATION_DETAILS_PROPERTY_TYPE"),value:n((R=null==e?void 0:e.propertyUsage,"PROPERTYTYPE_MASTERS_"+(null==R?void 0:R.split(".")[0])))||"N/A"},{title:n("CS_APPLICATION_DETAILS_PROPERTY_SUB_TYPE"),value:n(d(null==e?void 0:e.propertyUsage))||"N/A"}]},{title:n("CS_APPLICATION_DETAILS_PROPERTY_LOCATION_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_PINCODE"),value:(null==e||null===(c=e.address)||void 0===c?void 0:c.pincode)||"N/A"},{title:n("CS_APPLICATION_DETAILS_CITY"),value:(null==e||null===(p=e.address)||void 0===p?void 0:p.city)||"N/A"},{title:n("CS_APPLICATION_DETAILS_MOHALLA"),value:Le(e,n)},{title:n("CS_APPLICATION_DETAILS_SLUM_NAME"),value:Ae(e,n)},{title:n("CS_APPLICATION_DETAILS_STREET"),value:(null==e||null===(m=e.address)||void 0===m?void 0:m.street)||"N/A"},{title:n("CS_APPLICATION_DETAILS_DOOR_NO"),value:(null==e||null===(v=e.address)||void 0===v?void 0:v.doorNo)||"N/A"},{title:n("CS_APPLICATION_DETAILS_LANDMARK"),value:(null==e||null===(E=e.address)||void 0===E?void 0:E.landmark)||"N/A"}]},{title:n("CS_APPLICATION_DETAILS_PIT_DETAILS"),values:[{title:n("CS_APPLICATION_DETAILS_PIT_TYPE"),value:null!=e&&e.sanitationtype?n("PITTYPE_MASTERS_"+(null==e?void 0:e.sanitationtype)):"N/A"},{title:n("CS_APPLICATION_DETAILS_ROAD_WIDTH"),value:(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.roadWidth)||"N/A"},{title:n("CS_APPLICATION_DETAILS_DISTANCE_FROM_ROAD"),value:(null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.distancefromroad)||"N/A"},{title:n("CS_APPLICATION_DETAILS_DIMENSION"),value:null!=e&&null!==(f=e.pitDetail)&&void 0!==f&&f.height&&null!==(null==e||null===(y=e.pitDetail)||void 0===y?void 0:y.height)?null!=e&&null!==(T=e.pitDetail)&&void 0!==T&&T.length?`${null==e||null===(g=e.pitDetail)||void 0===g?void 0:g.length}m * ${null==e||null===(h=e.pitDetail)||void 0===h?void 0:h.width}m * ${null==e||null===(I=e.pitDetail)||void 0===I?void 0:I.height}m (${n("CS_COMMON_LENGTH")} x ${n("CS_COMMON_BREADTH")} x ${n("CS_COMMON_DEPTH")})`:`${null==e||null===(C=e.pitDetail)||void 0===C?void 0:C.diameter}m * ${null==e||null===(N=e.pitDetail)||void 0===N?void 0:N.height}m (${n("CS_COMMON_DIAMETER")} x ${n("CS_COMMON_DEPTH")})`:"N/A"},{title:n("ES_APPLICATION_DETAILS_VEHICLE_CAPACITY"),value:(b=null==e?void 0:e.vehicleCapacity,b||"N/A")},{title:n("CS_APPLICATION_DETAILS_TRIPS"),value:(null==e?void 0:e.noOfTrips)||"N/A"},{title:n("CS_APPLICATION_DETAILS_AMOUNT_PER_TRIP"),value:De(D)},{title:n("CS_APPLICATION_DETAILS_AMOUNT_DUE"),value:Oe(O)},{title:n("CS_APPLICATION_DETAILS_ADV_AMOUNT_DUE"),value:(P=L,null===P?"N/A":"₹ "+P)}]}]};var P,b,R},be=()=>{const{t:e}=i.useTranslation();return e("CS_FILE_DESLUDGING_APPLICATION_SUCCESS")},Re=e=>{var n,i,a;return l.createElement(t.Banner,{message:be(),applicationNumber:(null==e||null===(n=e.data)||void 0===n?void 0:n.fsm)&&(null==e||null===(i=e.data)||void 0===i||null===(a=i.fsm[0])||void 0===a?void 0:a.applicationNo),info:e.t("CS_FILE_DESLUDGING_APPLICATION_NO"),successful:e.isSuccess})},Me=e=>{var o,r,u,s,d,c,p,m,v,E;let{data:_,onSuccess:S}=e;const{t:f}=i.useTranslation(),y=Digit.ULBService.getCurrentTenantId(),T=Digit.Hooks.fsm.useDesludging(null!=_&&null!==(o=_.address)&&void 0!==o&&o.city?null===(r=_.address)||void 0===r||null===(u=r.city)||void 0===u?void 0:u.code:y),{data:g}=Digit.Hooks.useStore.getInitData(),{tenants:h}=g||{},[I,C,N]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[A,D,O]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[L,P,b]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),[R,M]=n.useState(null),[k,w]=n.useState(null),[F,x]=n.useState(null),H=(null==T?void 0:T.data)||L,V=null==H||null===(s=H.fsm)||void 0===s||null===(d=s[0].address)||void 0===d||null===(c=d.locality)||void 0===c?void 0:c.code,B=null==H||null===(p=H.fsm)||void 0===p||null===(m=p[0].address)||void 0===m?void 0:m.slumName,U=Digit.Hooks.fsm.useSlum(null==H||null===(v=H.fsm)||void 0===v||null===(E=v[0].address)||void 0===E?void 0:E.tenantId,B,V,{enabled:!!B,retry:!!B}),Y=(e,t)=>{var n,l,i;console.log("error",e),D((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors[0])||void 0===i?void 0:i.code)||"ERROR"),C(!0)};n.useEffect(()=>{T.data&&P(T.data)},[T.data]),n.useEffect(()=>{if(!I&&!A)try{var e,t,n,l,i,a;const o=Digit.SessionStorage.get("total_amount"),r=Digit.SessionStorage.get("amount_per_trip"),{subtype:u,propertyID:s,pitDetail:d,address:c,pitType:p,source:m,selectGender:v,selectPaymentPreference:E,selectTripNo:f}=_,{city:y,locality:g,geoLocation:h,pincode:I,street:N,doorNo:A,landmark:D,slum:O,gramPanchayat:L,village:P,propertyLocation:b,newLocality:R,newGramPanchayat:k,newVillage:F}=c;M(null==E?void 0:E.code);const H=0===o?null:null==E?void 0:E.advanceAmount;x(0===o),w(0===H);const V={fsm:{citizen:{gender:null==v?void 0:v.code},tenantId:null==y?void 0:y.code,propertyUsage:null==u?void 0:u.code,address:{tenantId:null==y?void 0:y.code,additionalDetails:{boundaryType:"FROM_GRAM_PANCHAYAT"===(null==b?void 0:b.code)?"GP":"Locality",gramPanchayat:{code:null==L?void 0:L.code,name:null==L?void 0:L.name},village:null!=P&&P.code?{code:null!=P&&P.code?null==P?void 0:P.code:"",name:null!=P&&P.name?null==P?void 0:P.name:""}:F,newLocality:R,newGramPanchayat:k},street:null==N?void 0:N.trim(),doorNo:null==A?void 0:A.trim(),landmark:D,slumName:O,city:null==y?void 0:y.name,pincode:I,locality:{code:"WITHIN_ULB_LIMITS"===(null==b?void 0:b.code)?null==g?void 0:g.code:null==L?void 0:L.code,name:"WITHIN_ULB_LIMITS"===(null==b?void 0:b.code)?null==g?void 0:g.name:null==L?void 0:L.name},geoLocation:{latitude:null==h?void 0:h.latitude,longitude:null==h?void 0:h.longitude,additionalDetails:{}}},pitDetail:{additionalDetails:{fileStoreId:{CITIZEN:null==d?void 0:d.images}}},source:m,sanitationtype:null==p?void 0:p.code,paymentPreference:0===o?null:null!=E&&E.paymentType?null==E||null===(e=E.paymentType)||void 0===e?void 0:e.code:null,noOfTrips:f?null==f||null===(t=f.tripNo)||void 0===t?void 0:t.code:1,vehicleCapacity:f?null==f||null===(n=f.vehicleCapacity)||void 0===n?void 0:n.capacity:"",additionalDetails:{totalAmount:o,tripAmount:"number"==typeof r?JSON.stringify(r):r,propertyID:null==s?void 0:s.propertyID,distancefromroad:null==_||null===(l=_.roadWidth)||void 0===l?void 0:l.distancefromroad,roadWidth:null==_||null===(i=_.roadWidth)||void 0===i?void 0:i.roadWidth,propertyID:null==_||null===(a=_.cptId)||void 0===a?void 0:a.id},advanceAmount:"number"==typeof H?JSON.stringify(H):H},workflow:null};console.log("formdata212",V,c,_),T.mutate(V,{onError:Y,onSuccess:()=>{C(!0),S()}}),sessionStorage.removeItem("Digit.total_amount"),sessionStorage.removeItem("Digit.fsm.file.address.city")}catch(e){}},[]);const G=!!L||(null==T?void 0:T.isSuccess);return T.isLoading||T.isIdle&&!I?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Re,{t:f,data:H,isSuccess:G,isLoading:T.isIdle&&!I||(null==T?void 0:T.isLoading)}),l.createElement(t.CardText,null,f(R&&"POST_PAY"==R||k?"CS_FILE_PROPERTY_RESPONSE_POST_PAY":F?"CS_FSM_RESPONSE_CREATE_DISPLAY_ZERO_PAY":"CS_FILE_PROPERTY_RESPONSE")),G&&l.createElement(t.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},f("CS_COMMON_DOWNLOAD"))),onClick:()=>{const{fsm:e}=H,[t,...n]=e,l=h.find(e=>e.code===t.tenantId),i=Pe({...t,slum:U},l,f);Digit.Utils.pdf.generate(i)},className:"w-full"}),l.createElement(a.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:f("CORE_COMMON_GO_TO_HOME")})))},ke=e=>{const{t:o}=i.useTranslation(),r=a.useHistory(),[u,s]=n.useState("");let d={texts:{cardText:"",submitBarLabel:"CS_COMMON_NEXT"},inputs:[{label:o("ES_FSM_VEHICLE_NUMBER"),type:"text",name:"vehicleNumber",validation:{pattern:"[A-Z]{2}[0-9]{2}[A-Z]{0,2}[0-9]{4}",title:o("ES_FSM_VEHICLE_FORMAT_TIP")}}],key:"vehicleNumber"};const c=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:c?{}:{marginLeft:"20px"}},l.createElement(t.Header,null,o("ES_FSM_ADD_VEHICLE_LOG"))),l.createElement(t.FormStep,{config:d,onChange:function(e){return 0!=e.target.value.trim().length?s(e.target.value):null},onSelect:e=>{r.push("/digit-ui/employee/fsm/fstp-fsm-request/"+e.vehicleNumber.trim())},t:o,isDisabled:!u,cardStyle:{margin:"10px"},textInputStyle:{maxWidth:"540px"}}))},we=()=>(i.useTranslation(),Digit.ULBService.getStateId(),Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId(),a.useHistory(),l.createElement(l.Fragment,null,l.createElement(t.ULBHomeCard,{title:"ES_COMMON_FSTP_OPERATION",module:[{name:"ES_FSM_ADD_NEW_BUTTON",link:"/digit-ui/employee/fsm/fstp-add-vehicle",icon:l.createElement(t.AddNewIcon,null)},{name:"ES_FSM_VIEW_REPORTS_BUTTON",link:"/employee/report/fsm/FSMFSTPPlantWithVehicleLogReport",hyperlink:!0,icon:l.createElement(t.ViewReportIcon,null)},{name:"ES_COMMON_INBOX",link:"/digit-ui/employee/fsm/fstp-inbox",icon:l.createElement(t.InboxIcon,null)}]}," "))),Fe=e=>{let{parentRoute:o}=e;const{t:r}=i.useTranslation(),u=[{text:r("ES_TITLE_NEW_DESULDGING_APPLICATION"),link:"/digit-ui/employee/fsm/new-application",roles:["FSM_CREATOR_EMP"]},{text:r("ES_TITILE_SEARCH_APPLICATION"),link:o+"/search"},{text:r("ES_TITLE_REPORTS"),link:"/employee/report/fsm/FSMDailyDesludingReport",roles:["FSM_ADMIN"],hyperlink:!0}],[s,d]=n.useState([]),{roles:c}=Digit.UserService.getUser().info;return n.useEffect(()=>{let e=u.filter(e=>{let{roles:t}=e;return(null==t?void 0:t.some(e=>null==c?void 0:c.map(e=>{let{code:t}=e;return t}).includes(e)))||!(null!=t&&t.length)});d(e)},[]),l.createElement(t.Card,{className:"employeeCard inboxLinksFSM"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.ShippingTruck,null))," ",l.createElement("span",{className:"text"},r("ES_TITLE_FAECAL_SLUDGE_MGMT"))),l.createElement("div",{className:"body"},s.map((e,t)=>{let{link:n,text:i,hyperlink:o=!1,accessTo:u=[]}=e;return l.createElement("span",{className:"link",key:t},o?l.createElement("a",{href:n},r(i)):l.createElement(a.Link,{to:n},r(i)))}))))},xe=e=>{let{className:n="table",t:i,currentPage:a,columns:o,data:r,getCellProps:u,disableSort:s,onSort:d,onNextPage:c,onPrevPage:p,onPageSizeChange:m,pageSizeLimit:v,sortParams:E,totalRecords:_,isPaginationRequired:S}=e;return l.createElement(t.Table,{className:n,t:i,data:r,currentPage:a,columns:o,getCellProps:u,onNextPage:c,onPrevPage:p,pageSizeLimit:v,disableSort:s,onPageSizeChange:m,onSort:d,sortParams:E,totalRecords:_,isPaginationRequired:S})},He=e=>{var n,a;let{status:o,fsmfilters:r,onAssignmentChange:u,statusMap:s}=e;const{t:d}=i.useTranslation(),c=null==s||null===(n=s.filter(e=>(null==e?void 0:e.applicationstatus)===o.code))||void 0===n||null===(a=n[0])||void 0===a?void 0:a.count;return l.createElement(t.CheckBox,{onChange:e=>u(e,o),checked:0!==(null==r?void 0:r.applicationStatus.filter(e=>e.name===o.name).length),label:`${d(o.name)} (${c||0})`})},Ve=e=>{let{onAssignmentChange:a,fsmfilters:o,mergedRoleDetails:r,statusMap:u}=e;const{t:s}=i.useTranslation(),{data:d,isLoading:c}=Digit.Hooks.fsm.useApplicationStatus(!0,!0,u),[p,m]=n.useState(!1),v=r.statuses.map(e=>null==d?void 0:d.filter(t=>t.code===e)[0]).filter(e=>null==e?void 0:e.code),E=null==d?void 0:d.filter(e=>!v.find(t=>t.code===e.code));return c?l.createElement(t.Loader,null):(null==v?void 0:v.length)>0?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label"},s("ES_INBOX_STATUS")),null==v?void 0:v.map((e,t)=>l.createElement(He,{key:t,onAssignmentChange:a,status:e,fsmfilters:o,statusMap:u})),p?null==E?void 0:E.map((e,t)=>l.createElement(He,{key:t,onAssignmentChange:a,status:e,fsmfilters:o,statusMap:u})):null,!1===r.fixed&&E.length>0?l.createElement("div",{className:"filter-button",onClick:()=>m(!p)}," ",s(p?"ES_COMMON_LESS":"ES_COMMON_MORE")," "):null):null},Be=e=>{let{onFilterChange:n,searchParams:i,paginationParms:a,tenantId:o,t:r}=e;const{data:u}=Digit.Hooks.fsm.useInbox(o,{...i,...a,fromDate:null!=i&&i.fromDate?new Date(null==i?void 0:i.fromDate).getTime():void 0,toDate:null!=i&&i.toDate?new Date(null==i?void 0:i.toDate).getTime():void 0,total:!0,uuid:{code:"ASSIGNED_TO_ALL",name:r("ES_INBOX_ASSIGNED_TO_ALL")}}),s=[{code:"ASSIGNED_TO_ME",name:r("ES_INBOX_ASSIGNED_TO_ME")+" (0)"},{code:"ASSIGNED_TO_ALL",name:`${r("ES_INBOX_ASSIGNED_TO_ALL")} (${(null==u?void 0:u.totalCount)||0})`}];return l.createElement(l.Fragment,null,l.createElement(t.RadioButtons,{onSelect:e=>n({uuid:{code:e.code}}),selectedOption:s.filter(e=>{var t;return e.code===(null==i||null===(t=i.uuid)||void 0===t?void 0:t.code)})[0],optionsKey:"name",options:s}))},Ue=e=>{var n,o,r,u;let{searchParams:s,paginationParms:d,onFilterChange:c,onSearch:p,...m}=e;const{t:v}=i.useTranslation(),E=a.useLocation(),_=Digit.UserService.hasAccess(["FSM_DSO"])||!1,S=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,f=Digit.UserService.hasAccess("FSM_EMP_FSTPO")&&E.pathname.includes("fstp-fsm-request")||!1,y=Digit.ULBService.getCurrentTenantId(),T=Digit.ULBService.getStateId(),{data:g,isFetched:h}=Digit.Hooks.fsm.useMDMS(T,"DIGIT-UI","RoleStatusMapping"),I=Digit.UserService.getUser().info.roles.map(e=>e.code),C=null==g?void 0:g.filter(e=>I.filter(t=>t===e.userRole)[0]),N=null==C?void 0:C.reduce((e,t)=>({fixed:(null==t?void 0:t.fixed)&&(null==e?void 0:e.fixed),statuses:[...null==e?void 0:e.statuses,...null==t?void 0:t.statuses].filter((e,t,n)=>n.indexOf(e)==t),zeroCheck:(null==t?void 0:t.zeroCheck)||(null==e?void 0:e.zeroCheck)}),{statuses:[]}),A=()=>{if(S)return c()};return l.createElement(l.Fragment,null,(!_&&!S&&s||(null==N||null===(n=N.statuses)||void 0===n?void 0:n.length)>0||f)&&l.createElement("div",{className:"filter",style:{marginTop:S?"-0px":"revert"}},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},v("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:A},v("ES_COMMON_CLEAR_ALL")),"desktop"===m.type&&l.createElement("span",{className:"clear-search",onClick:A},v("ES_COMMON_CLEAR_ALL")),"mobile"===m.type&&l.createElement("span",{onClick:m.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,!_&&!S&&s&&l.createElement(Be,{onFilterChange:c,searchParams:s,paginationParms:d,tenantId:y,t:v}),l.createElement("div",null)),(null==N||null===(o=N.statuses)||void 0===o?void 0:o.length)>0||f?l.createElement("div",null,l.createElement("div",{className:"filter-label"},v("ES_INBOX_LOCALITY")),l.createElement(t.Localities,{selectLocality:e=>{c(S?{locality:[e]}:{locality:[...null==s?void 0:s.locality,e]})},tenantId:y,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==s?void 0:s.locality.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:e.i18nkey,onClick:()=>{c({locality:null==s?void 0:s.locality.filter(t=>t.code!==e.code)})}})))):null,l.createElement("div",null,h&&N&&null!=m&&null!==(r=m.applications)&&void 0!==r&&r.statuses?l.createElement(Ve,{onAssignmentChange:(e,t)=>{c(e.target.checked?{applicationStatus:[...null==s?void 0:s.applicationStatus,t]}:{applicationStatus:null==s?void 0:s.applicationStatus.filter(e=>t.name!==e.name)})},fsmfilters:s,mergedRoleDetails:N,statusMap:null==m||null===(u=m.applications)||void 0===u?void 0:u.statuses}):E.pathname.includes("fstp-fsm-request")?"":l.createElement(t.Loader,null)))),"mobile"===m.type&&m.onClose&&l.createElement(t.ActionBar,null,l.createElement(t.ApplyFilterBar,{submit:!1,labelLink:v("ES_COMMON_CLEAR_ALL"),buttonLink:v("ES_COMMON_FILTER"),onClear:A,onSubmit:()=>{"mobile"===m.type?p({delete:["applicationNos"]}):p()},style:{flex:1}})))},Ye=e=>{let{onAssignmentChange:n,value:i,applicationStatuses:a,areApplicationStatus:o}=e;return o?l.createElement(t.Dropdown,{option:a,optionKey:"name",selected:i,select:n}):l.createElement(t.Loader,null)},Ge=e=>{let{onSearch:a,type:r,onClose:u,searchFields:d,searchParams:c,isInboxPage:p}=e;const m=p?Digit.SessionStorage.get("fsm/inbox/searchParams"):Digit.SessionStorage.get("fsm/search/searchParams"),{data:v,isFetched:E}=Digit.Hooks.fsm.useApplicationStatus(),{t:_}=i.useTranslation(),{register:S,handleSubmit:f,reset:y,watch:T,control:g}=o.useForm({defaultValues:m||c}),[h,I]=n.useState(!1),C=innerWidth<=640,N=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,A=T(["applicationNos","mobileNumber","fromDate","toDate"]),[D,O]=n.useState(!1);function L(){const e=d.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});y(e),p?Digit.SessionStorage.del("fsm/inbox/searchParams"):Digit.SessionStorage.del("fsm/search/searchParams"),a({})}const P=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:L},_("ES_COMMON_CLEAR_SEARCH")),b=e=>N?null:(I(!(A.applicationNos||A.mobileNumber||A.fromDate&&A.toDate)),!!(A.applicationNos||A.mobileNumber||A.fromDate&&A.toDate)),R=window.location.href.includes("employee/fsm/inbox")||window.location.href.includes("employee/fsm/fstp-inbox")||window.location.href.includes("employee/fsm/fstp-fsm-request");return l.createElement("form",{onSubmit:f(e=>{e.mobileNumber||delete e.mobileNumber,a(e),"mobile"===r&&u()})},l.createElement(l.Fragment,null,R?"":l.createElement(t.Header,{styles:C?{marginTop:"10px"}:{}},_("ACTION_TEST_SEARCH_FSM_APPLICATION")),l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:N?"":p?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||C)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,_("ES_COMMON_SEARCH_BY")),l.createElement("span",{style:{position:"absolute",top:"2%",right:"8px"},onClick:u},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:N?"complaint-input-container for-pt for-search":"complaint-input-container",style:{width:"100%"}},null==d?void 0:d.map((e,n)=>l.createElement("span",{key:n,className:0===n?"complaint-input":"mobile-input"},l.createElement(t.Label,null,e.label," ",e.labelChildren&&e.labelChildren),(e=>{switch(e.type){case"date":return l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange}),name:e.name,control:g,defaultValue:null});case"status":return l.createElement(o.Controller,{render:e=>l.createElement(Ye,{onAssignmentChange:e.onChange,value:e.value,applicationStatuses:v,areApplicationStatus:E}),name:e.name,control:g,defaultValue:null});default:return l.createElement(t.TextInput,s({},e,{inputRef:S},S(e.name,{validate:b}),{watch:T,shouldUpdate:!0}))}})(e)," ")),"desktop"===r&&!C&&l.createElement(t.SubmitBar,{className:"submit-bar-search",label:_("ES_COMMON_SEARCH"),submit:!0})),h?l.createElement(t.CardLabelError,{className:"search-error-label"},_("ES_SEARCH_APPLICATION_ERROR")):null,"desktop"===r&&!C&&l.createElement("span",{className:"clear-search"},P()))),("mobile"===r||C)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},P(C)),l.createElement(t.SubmitBar,{label:_("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},We=e=>{var n,o,r,u;const{t:s}=i.useTranslation(),d=Digit.UserService.hasAccess(["FSM_DSO"])||!1,c=e=>l.createElement("span",{className:"cell-text"},e),p=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,m=l.useMemo(()=>{if(e.isSearch)return[{Header:s("ES_INBOX_APPLICATION_NO"),accessor:"applicationNo",disableSortBy:!0,Cell:t=>{let{row:n}=t;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:`${e.parentRoute}/${d?"dso-application-details":"application-details"}/`+n.original.applicationNo},n.original.applicationNo)))}},{Header:s("ES_APPLICATION_DETAILS_APPLICANT_NAME"),disableSortBy:!0,accessor:e=>{var t;return c((null===(t=e.citizen)||void 0===t?void 0:t.name)||"")}},{Header:s("ES_APPLICATION_DETAILS_APPLICANT_MOBILE_NO"),disableSortBy:!0,accessor:e=>{var t;return c((null===(t=e.citizen)||void 0===t?void 0:t.mobileNumber)||"")}},{Header:s("ES_APPLICATION_DETAILS_PROPERTY_TYPE"),accessor:e=>s("PROPERTYTYPE_MASTERS_"+e.propertyUsage.split(".")[0]),disableSortBy:!0},{Header:s("ES_APPLICATION_DETAILS_PROPERTY_SUB-TYPE"),accessor:e=>s("PROPERTYTYPE_MASTERS_"+e.propertyUsage),disableSortBy:!0},{Header:s("ES_INBOX_LOCALITY"),accessor:e=>c(s(Digit.Utils.locale.getRevenueLocalityCode(e.address.locality.code,e.tenantId))),disableSortBy:!0},{Header:s("ES_INBOX_STATUS"),accessor:e=>c(s("CS_COMMON_FSM_"+e.applicationStatus)),disableSortBy:!0}];switch(e.userRole){case"FSM_EMP_FSTPO_REQUEST":return[{Header:s("ES_INBOX_APPLICATION_NO"),accessor:"applicationNo",Cell:t=>{var n;let{row:i}=t,o=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>i.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/fstp-operator-details/"+i.original.applicationNo}," ",null==o?void 0:o.applicationNo)))}},{Header:s("CS_COMMON_CITIZEN_NAME"),disableSortBy:!0,Cell:t=>{var n,i;let{row:a}=t,o=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>a.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",null,null==o||null===(i=o.citizen)||void 0===i?void 0:i.name))}},{Header:s("CS_COMMON_CITIZEN_NUMBER"),disableSortBy:!0,accessor:"number",Cell:t=>{var n,i;let{row:a}=t,o=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>a.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",null,null==o||null===(i=o.citizen)||void 0===i?void 0:i.mobileNumber))}},{Header:s("ES_INBOX_LOCALITY"),disableSortBy:!0,accessor:"locality",Cell:t=>{var n,i,a;let{row:o}=t,r=null==e||null===(n=e.fstprequest)||void 0===n?void 0:n.find(e=>o.original.tripDetails[0].referenceNo===e.applicationNo);return l.createElement("div",null,l.createElement("span",null,s(""+(null==r||null===(i=r.address)||void 0===i||null===(a=i.locality)||void 0===a?void 0:a.name))))}}];case"FSM_EMP_FSTPO":return[{Header:s("ES_INBOX_APPLICATION_NO"),disableSortBy:!0,accessor:"tripDetails",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/fstp-operator-details/"+t.original.applicationNo},t.original.tripDetails.map(e=>l.createElement("div",null,e.referenceNo,l.createElement("br",null))))))}},{Header:s("ES_INBOX_VEHICLE_LOG"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/fstp-operator-details/"+t.original.applicationNo},t.original.applicationNo)))}},{Header:s("ES_INBOX_APPLICATION_DATE"),accessor:"createdTime",Cell:e=>{let{row:t}=e;return c(`${new Date(t.original.auditDetails.createdTime).getDate()}/${new Date(t.original.auditDetails.createdTime).getMonth()+1}/${new Date(t.original.auditDetails.createdTime).getFullYear()}`)}},{Header:s("ES_INBOX_VEHICLE_NO"),disableSortBy:!0,accessor:e=>{var t;return null===(t=e.vehicle)||void 0===t?void 0:t.registrationNumber}},{Header:s("ES_INBOX_DSO_NAME"),disableSortBy:!0,accessor:e=>e.dsoName?`${e.dsoName} - ${e.tripOwner.name}`:""+e.tripOwner.name},{Header:s("ES_INBOX_VEHICLE_STATUS"),disableSortBy:!0,accessor:e=>e.status},{Header:s("ES_INBOX_WASTE_COLLECTED"),disableSortBy:!0,accessor:e=>{var t;return null===(t=e.tripDetails[0])||void 0===t?void 0:t.volume}}];default:return[{Header:s("CS_FILE_DESLUDGING_APPLICATION_NO"),Cell:t=>{let{row:n}=t;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:`${e.parentRoute}/${d?"dso-application-details":"application-details"}/`+n.original.applicationNo},n.original.applicationNo)))}},{Header:s("ES_INBOX_APPLICATION_DATE"),accessor:"createdTime",Cell:e=>{let{row:t}=e;return c(`${t.original.createdTime.getDate()}/${t.original.createdTime.getMonth()+1}/${t.original.createdTime.getFullYear()}`)}},{Header:s("ES_INBOX_LOCALITY"),Cell:e=>{let{row:t}=e;return c(s(Digit.Utils.locale.getRevenueLocalityCode(t.original.locality,t.original.tenantId)))}},{Header:s("ES_INBOX_STATUS"),Cell:e=>c(s("CS_COMMON_FSM_"+e.row.original.status))},{Header:s("ES_INBOX_SLA_DAYS_REMAINING"),Cell:e=>{let{row:t}=e;return"-"===(n=t.original.sla)?l.createElement("span",{className:"sla-cell-success"},"-"):isNaN(n)?l.createElement("span",{className:"sla-cell-success"},"0"):l.createElement("span",n<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},n);var n}}]}},[e.fstprequest,e.data]);let v;return e.isLoading?v=l.createElement(t.Loader,null):e.isSearch&&!e.shouldSearch||0===(null==e||null===(n=e.data)||void 0===n||null===(o=n.table)||void 0===o?void 0:o.length)?v=l.createElement(t.Card,{style:{marginTop:20}},s("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):(null==e||null===(r=e.data)||void 0===r||null===(u=r.table)||void 0===u?void 0:u.length)>0&&(v=l.createElement(xe,{t:s,data:e.data.table,columns:m,getCellProps:e=>({style:{minWidth:e.column.Header===s("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:e.onPageSizeChange,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,pageSizeLimit:e.pageSizeLimit,onSort:e.onSort,disableSort:e.disableSort,sortParams:e.sortParams,totalRecords:e.totalRecords,isPaginationRequired:e.isPaginationRequired})),l.createElement("div",{className:"inbox-container"},"FSM_EMP_FSTPO"!==e.userRole&&!e.isSearch&&l.createElement("div",{className:"filters-container"},"FSM_EMP_FSTPO_REQUEST"!==e.userRole?l.createElement(Fe,{parentRoute:e.parentRoute}):null,l.createElement("div",{style:"FSM_EMP_FSTPO_REQUEST"!==e.userRole?{marginTop:"24px"}:{}},l.createElement(Ue,{searchParams:e.searchParams,paginationParms:e.paginationParms,applications:e.data,onFilterChange:e.onFilterChange,type:"desktop"}))),l.createElement("div",{style:{flex:1,marginLeft:"24px"}},l.createElement(Ge,{onSearch:e.onSearch,type:"desktop",searchFields:e.searchFields,isInboxPage:!(null!=e&&e.isSearch),searchParams:e.searchParams}),l.createElement("div",{className:"result",style:{marginLeft:p||null!=e&&e.isSearch?"":"24px",flex:1}},v)))},Ke=e=>{const{t:a}=i.useTranslation(),[o,r]=n.useState(()=>{var t,n;return null!==(t=e.sortParams)&&void 0!==t&&null!==(n=t[0])&&void 0!==n&&n.desc?{code:"DESC",name:a("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:a("ES_INBOX_DATE_LATEST_LAST")}});function u(){}return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},a("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:u},a("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:u},a("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement(t.RadioButtons,{onSelect:function(t){e.onSort([{id:"createdTime",desc:"DESC"===t.code}]),e.onClose()},selectedOption:o,optionsKey:"name",options:[{code:"DESC",name:a("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:a("ES_INBOX_DATE_LATEST_LAST")}]})))))},ze=e=>{var i;let{t:a,data:o,onFilterChange:r,onSearch:u,onSort:s,serviceRequestIdKey:d,isFstpOperator:c,isLoading:p,isSearch:m,searchParams:v,searchFields:E,sortParams:_,linkPrefix:S,removeParam:f,filterData:y}=e;const[T,g]=n.useState(m?"SEARCH":""),[h,I]=n.useState(!!m),[C,N]=n.useState(v),[A,D]=n.useState(_),O=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:L,isFetched:P}=Digit.Hooks.fsm.useMDMS(O,"DIGIT-UI","RoleStatusMapping"),b=Digit.UserService.getUser().info.roles.map(e=>e.code),R=null==L?void 0:L.filter(e=>b.filter(t=>t===e.userRole)[0]),M=null==R?void 0:R.reduce((e,t)=>({fixed:(null==t?void 0:t.fixed)&&(null==e?void 0:e.fixed),statuses:[...null==e?void 0:e.statuses,...null==t?void 0:t.statuses].filter((e,t,n)=>n.indexOf(e)==t),zeroCheck:(null==t?void 0:t.zeroCheck)||(null==e?void 0:e.zeroCheck)}),{statuses:[]});n.useEffect(()=>{T&&I(!0)},[T]);const k=Digit.UserService.hasAccess(["FSM_DSO"])||!1,w=()=>{I(!1),g(""),N(v),D(_)};if(p||!P)return l.createElement(t.Loader,null);let F;return o&&0!==(null==o?void 0:o.length)?o&&(null==o?void 0:o.length)>0&&(F=l.createElement(t.DetailsCard,{data:o,serviceRequestIdKey:d,linkPrefix:S||(k?"/digit-ui/employee/fsm/application-details/":"/digit-ui/employee/fsm/")})):F=l.createElement(t.Card,{style:{marginTop:20}},a("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},u&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{g("SEARCH"),I(!0)}}),!m&&r&&(!k&&!c&&v||(null==M||null===(i=M.statuses)||void 0===i?void 0:i.length)>0)&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{g("FILTER"),I(!0)}}),!m&&l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{g("SORT"),I(!0)}})),F,h&&l.createElement(t.PopUp,null,"FILTER"===T&&l.createElement("div",{className:"popup-module"},l.createElement(Ue,{onFilterChange:e=>{N(t=>({...t,...e}))},onClose:w,onSearch:e=>{r({...C,...e}),g(""),I(!1)},applications:y,type:"mobile",searchParams:C,removeParam:f})),"SORT"===T&&l.createElement("div",{className:"popup-module"},l.createElement(Ke,{type:"mobile",sortParams:_,onClose:w,onSort:s})),"SEARCH"===T&&l.createElement("div",{className:"popup-module"},l.createElement(Ge,{type:"mobile",onClose:w,onSearch:u,isFstpOperator:c,searchParams:v,searchFields:E}))))},je=e=>l.createElement("span",{className:"sla-cell"},e),Xe=e=>{let{data:t,vehicleLog:n,isLoading:a,isSearch:o,onSearch:r,onFilterChange:u,onSort:s,searchParams:d,searchFields:c,linkPrefix:p,removeParam:m,sortParams:v,fstprequest:E,isFSMRequest:_}=e;const{t:S}=i.useTranslation(),f=(Digit.UserService.hasAccess(["FSM_DSO"]),Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1),y=null==n?void 0:n.map(e=>{var t,n;return{[S("ES_INBOX_APPLICATION_NO")]:null==e?void 0:e.tripDetails.map(e=>e.referenceNo),[S("ES_INBOX_VEHICLE_LOG")]:null==e?void 0:e.applicationNo,[S("ES_INBOX_VEHICLE_NO")]:null==e||null===(t=e.vehicle)||void 0===t?void 0:t.registrationNumber,[S("ES_INBOX_DSO_NAME")]:null==e?void 0:e.tripOwner.displayName,[S("ES_INBOX_VEHICLE_STATUS")]:null==e?void 0:e.status,[S("ES_INBOX_WASTE_COLLECTED")]:null==e||null===(n=e.tripDetails[0])||void 0===n?void 0:n.volume}}),T=null==E?void 0:E.map(e=>{var t,l,i,a;let o=null==n?void 0:n.find(t=>{var n;return(null==t||null===(n=t.tripDetails[0])||void 0===n?void 0:n.referenceNo)===(null==e?void 0:e.applicationNo)});return{[S("ES_INBOX_VEHICLE_LOG")]:(null==o?void 0:o.applicationNo)||"N/A",[S("CS_COMMON_CITIZEN_NAME")]:(null==e||null===(t=e.citizen)||void 0===t?void 0:t.name)||"N/A",[S("CS_COMMON_CITIZEN_NUMBER")]:(null==e||null===(l=e.citizen)||void 0===l?void 0:l.mobileNumber)||"N/A",[S("ES_INBOX_LOCALITY")]:(null==e||null===(i=e.address)||void 0===i||null===(a=i.locality)||void 0===a?void 0:a.name)||"N/A"}});return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},l.createElement("div",{style:{display:"none"}},!o&&l.createElement(Ue,{searchParams:d,applications:t,onFilterChange:u,type:"mobile"})),l.createElement(ze,{t:S,filterData:t,data:t?o?null==t||null===(g=t.table)||void 0===g?void 0:g.map(e=>{let{applicationNo:t,applicationStatus:n,propertyUsage:l,tenantId:i,address:a,citizen:o}=e;return{[S("ES_INBOX_APPLICATION_NO")]:t,[S("ES_APPLICATION_DETAILS_APPLICANT_NAME")]:je((null==o?void 0:o.name)||""),[S("ES_APPLICATION_DETAILS_APPLICANT_MOBILE_NO")]:je((null==o?void 0:o.mobileNumber)||""),[S("ES_APPLICATION_DETAILS_PROPERTY_TYPE")]:je(S("PROPERTYTYPE_MASTERS_"+l.split(".")[0])),[S("ES_APPLICATION_DETAILS_PROPERTY_SUB-TYPE")]:je(S("PROPERTYTYPE_MASTERS_"+l)),[S("ES_INBOX_LOCALITY")]:je(S(Digit.Utils.locale.getRevenueLocalityCode(a.locality.code,i))),[S("ES_INBOX_STATUS")]:je(S("CS_COMMON_FSM_"+n))}}):null==t||null===(h=t.table)||void 0===h?void 0:h.map(e=>{let{locality:t,applicationNo:n,createdTime:i,tenantId:a,status:o,sla:r}=e;return{[S("ES_INBOX_APPLICATION_NO")]:n,[S("ES_INBOX_APPLICATION_DATE")]:`${i.getDate()}/${i.getMonth()+1}/${i.getFullYear()}`,[S("ES_INBOX_LOCALITY")]:je(S(Digit.Utils.locale.getRevenueLocalityCode(t,a))),[S("ES_INBOX_STATUS")]:je(S("CS_COMMON_"+o)),[S("ES_INBOX_SLA_DAYS_REMAINING")]:(u=r,isNaN(u)?l.createElement("span",{className:"sla-cell-success"},"0"):l.createElement("span",u<0?{className:"sla-cell-error"}:{className:"sla-cell-success"},u))};var u}):f&&_?T:y,onFilterChange:!(!_&&f)&&u,serviceRequestIdKey:S(f?"ES_INBOX_VEHICLE_LOG":"ES_INBOX_APPLICATION_NO"),isFstpOperator:f,isLoading:a,isSearch:o,onSearch:r,onSort:s,searchParams:d,searchFields:c,linkPrefix:p,removeParam:m,sortParams:v}))));var g,h},$e={select:e=>({totalCount:null==e?void 0:e.totalCount,vehicleLog:null==e?void 0:e.vehicleTrip.map(e=>{const t=e.tripOwner,n=t.name+(t.userName?"- "+t.userName:""),l={...t,displayName:n};return{...e,tripOwner:l}})})},qe=()=>{var e,o,r;const u=a.useHistory(),{t:s}=i.useTranslation(),d=a.useLocation().pathname.split("/").at(-1),c=Digit.ULBService.getCurrentTenantId(),[p,m]=n.useState({applicationStatus:"WAITING_FOR_DISPOSAL"}),[v,E]=n.useState(null),[_,S]=n.useState(),[f,y]=n.useState([{id:"applicationNo",desc:!0}]),[T,g]=n.useState(0),[h,I]=n.useState(100),[C,N]=n.useState(!1),[A,D]=n.useState(null);Digit.UserService.getUser();let O=window.Digit.Utils.browser.isMobile();const{isLoading:L,data:P}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:c,filters:{registrationNumber:d},config:{enabled:(null==d?void 0:d.length)>0}});let b={businessService:"FSM_VEHICLE_TRIP",vehicleIds:void 0!==P&&(null==P||null===(e=P.vehicle[0])||void 0===e?void 0:e.id.length)>0&&(null==P||null===(o=P.vehicle[0])||void 0===o?void 0:o.id)||"null",applicationStatus:null==p?void 0:p.applicationStatus,sortOrder:!1===(null===(r=f[0])||void 0===r?void 0:r.desc)?"ASC":"DESC"};const{isLoading:R,data:{totalCount:M,vehicleLog:k}={},isSuccess:w}=Digit.Hooks.fsm.useVehicleSearch({tenantId:c,filters:b,config:$e,options:{searchWithDSO:!0}}),{isLoading:F,isIdle:x,data:{data:{table:H}={}}={}}=Digit.Hooks.fsm.useSearchAll(c,v,null,{enabled:!!C});n.useEffect(()=>{var e;const t=null==k?void 0:k.map(e=>{var t;return null==e||null===(t=e.tripDetails[0])||void 0===t?void 0:t.referenceNo}).join(",");E({applicationNos:t||"null",sortOrder:!1===(null===(e=f[0])||void 0===e?void 0:e.desc)?"ASC":"DESC"}),N(!0)},[w,F,L,k,x,R,f,P]),n.useEffect(()=>{H&&D(H)},[H,F,x]),null==k||k.map(e=>{});const V=function(e){var t,n,l;void 0===e&&(e={});const i=(null===(t=e)||void 0===t||null===(n=t.applicationNos)||void 0===n?void 0:n.length)>0?null===(l=e)||void 0===l?void 0:l.applicationNos:null;let a=H.filter(i?e=>e.applicationNo===i:e=>e.applicationNo);D(a)},B=e=>{let t=H.filter(t=>{var n,l,i,a,o;return null==t||null===(n=t.address)||void 0===n||null===(l=n.locality)||void 0===l?void 0:l.name.includes(null!=e&&null!==(i=e.locality)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&a.name?null==e||null===(o=e.locality)||void 0===o?void 0:o[0].name:"")});D(t),S(e)},U=[{label:s("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"}],Y=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&y(e)},[]);if(R&&!w&&F&&L&&!x&&!C)return l.createElement(t.Loader,null);0!==(null==k?void 0:k.length)||0!==(null==H?void 0:H.length)||!w||F||0!==(null==A?void 0:A.length)||L||u.push("/digit-ui/employee/fsm/fstp/new-vehicle-entry/"+d);let G=[];return null==A||A.map(e=>{const t=null==k?void 0:k.find(t=>{var n;return(null==t||null===(n=t.tripDetails[0])||void 0===n?void 0:n.referenceNo)===(null==e?void 0:e.applicationNo)});void 0!==t&&G.push(t)}),O?l.createElement("div",null,l.createElement(t.Header,null,s("ES_FSM_FSTP_SERVICE_REQUEST")),l.createElement(Xe,{onFilterChange:B,vehicleLog:k,fstprequest:A,isFSMRequest:!0,isLoading:R,userRole:"FSM_EMP_FSTPO",linkPrefix:"/digit-ui/employee/fsm/fstp-operator-details/",onSearch:V,searchFields:U,onSort:Y,sortParams:f}),l.createElement("span",{className:"link",style:{margin:"8px"}},l.createElement(a.Link,{to:{pathname:"/digit-ui/employee/fsm/fstp/new-vehicle-entry/"}},s("ES_FSM_FSTP_NEW_ENTRY")))):l.createElement("div",null,l.createElement(t.Header,null,s("ES_FSM_FSTP_SERVICE_REQUEST")),l.createElement(We,{data:{table:G},fstprequest:H,isLoading:R,onSort:Y,isFSMRequest:!0,disableSort:!1,sortParams:f,userRole:"FSM_EMP_FSTPO_REQUEST",onFilterChange:B,searchFields:U,onSearch:V,onNextPage:()=>{g(e=>e+h)},onPrevPage:()=>{g(e=>e-h)},currentPage:Math.floor(T/h),pageSizeLimit:h,onPageSizeChange:e=>{I(Number(e.target.value))},totalRecords:M||0,isPaginationRequired:!1,searchParams:_}),l.createElement("span",{className:"link",style:{margin:"294px",padding:"2px"}},l.createElement(a.Link,{to:{pathname:"/digit-ui/employee/fsm/fstp/new-vehicle-entry/"}},s("ES_FSM_FSTP_NEW_ENTRY"))))},Ze=e=>{let{path:o,url:r,userType:u}=e;const{t:d}=i.useTranslation(),c=a.useLocation();n.useEffect(()=>{var e,t,n;null!=c&&null!==(e=c.pathname)&&void 0!==e&&e.includes("application-details")||(null!=c&&null!==(t=c.pathname)&&void 0!==t&&t.includes("inbox")?null!=c&&null!==(n=c.pathname)&&void 0!==n&&n.includes("search")||Digit.SessionStorage.del("fsm/search/searchParams"):Digit.SessionStorage.del("fsm/inbox/searchParams"))},[c]);const p=Digit.ComponentRegistryService.getComponent("FSMEmpInbox"),m=Digit.ComponentRegistryService.getComponent("FSMFstpInbox"),v=Digit.ComponentRegistryService.getComponent("FSMNewApplicationEmp"),E=Digit.ComponentRegistryService.getComponent("FSMEditApplication"),_=Digit.ComponentRegistryService.getComponent("FSMEmployeeApplicationDetails"),S=Digit.ComponentRegistryService.getComponent("FSMFstpOperatorDetails"),f=Digit.ComponentRegistryService.getComponent("FSMResponse"),y=Digit.ComponentRegistryService.getComponent("FSMApplicationAudit"),T=Digit.ComponentRegistryService.getComponent("FSMRateView"),g=Digit.ComponentRegistryService.getComponent("FSMLinks"),h=Digit.ComponentRegistryService.getComponent("FSMRegistry"),I=Digit.ComponentRegistryService.getComponent("VendorDetails"),C=Digit.ComponentRegistryService.getComponent("AddVendor"),N=Digit.ComponentRegistryService.getComponent("EditVendor"),A=Digit.ComponentRegistryService.getComponent("VehicleDetails"),D=Digit.ComponentRegistryService.getComponent("AddVehicle"),O=Digit.ComponentRegistryService.getComponent("EditVehicle"),L=Digit.ComponentRegistryService.getComponent("DriverDetails"),P=Digit.ComponentRegistryService.getComponent("AddDriver"),b=Digit.ComponentRegistryService.getComponent("EditDriver");return l.createElement(a.Switch,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(t.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(t.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=c.pathname;let n=[{icon:t.HomeIcon,path:"/digit-ui/employee"},{label:d("TITLE_FSM"),path:"/digit-ui/employee/fsm/inbox"}];return e.includes("/registry/new-vendor")?n.push({label:d("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")}):e.includes("/search-vendor")?n.push({label:d("SEARCH_VENDOR")}):e.includes("/registry/new-driver")?n.push({label:d("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")}):e.includes("/registry/vendor-details")||e.includes("/registry/modify-vendor/")?n.push({label:d("VENDOR_VENDOR_DETAILS")}):e.includes("/registry/vehicle-details")||e.includes("/registry/modify-vehicle/")?n.push({label:d("VENDOR_VEHICLE_DETAILS")}):e.includes("/registry/new-vehicle")?n.push({label:d("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")}):e.includes("/registry/driver-details")||e.includes("/registry/modify-driver/")?n.push({label:d("VENDOR_DRIVER_DETAILS")}):e.includes("/registry/additionaldetails")?n.push({label:d("VENDOR_ADDITIONAL_DETAILS")}):e.includes("/registry/modify-vendor/:id")&&n.push({label:d("ES_TITLE_VENDOR_EDIT")}),n})()}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(g,{matchPath:o,userType:u}))}),l.createElement(t.PrivateRoute,{path:o+"/inbox",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(p,s({},e,{parentRoute:o,isInbox:!0})))}),l.createElement(t.PrivateRoute,{path:o+"/fstp-inbox",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(m,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/new-application",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(v,{parentUrl:r}))}),l.createElement(t.PrivateRoute,{path:o+"/modify-application/:id",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(E,null))}),l.createElement(t.PrivateRoute,{path:o+"/application-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(_,s({},e,{parentRoute:o,userType:"EMPLOYEE"})))}),l.createElement(t.PrivateRoute,{path:o+"/fstp-operator-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(S,e))}),l.createElement(t.PrivateRoute,{path:o+"/response",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(f,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/application-audit/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(y,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/search",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(p,s({},e,{parentRoute:o,isSearch:!0})))}),l.createElement(t.PrivateRoute,{path:o+"/rate-view/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(T,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/mark-for-disposal",component:()=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement("div",null))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/registry",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(h,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/vendor-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(I,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/new-vendor",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(C,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/modify-vendor/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(N,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/vehicle-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(A,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/new-vehicle",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(D,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/modify-vehicle/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(O,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/driver-details/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(L,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/new-driver",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(P,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{path:o+"/registry/modify-driver/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"action"},l.createElement(b,s({},e,{parentRoute:o})))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp-operations",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(we,null))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp-add-vehicle",component:l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(ke,null))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp-fsm-request/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(qe,e))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp/new-vehicle-entry",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(S,e))}),l.createElement(t.PrivateRoute,{exact:!0,path:o+"/fstp/new-vehicle-entry/:id",component:e=>l.createElement(t.LayoutWrapper,{layoutClass:"normal"},l.createElement(S,e))}))))};function Qe(e,t,n){return null==e?void 0:e.filter(e=>{var t;return null===(t=e.vehicles)||void 0===t?void 0:t.find(e=>(null==e?void 0:e.capacity)==n)})}function Je(e,t,n){return null==e?void 0:e.filter(e=>{var t;return null===(t=e.vehicles)||void 0===t?void 0:t.find(e=>(null==e?void 0:e.capacity)==n)})}const et=e=>{let{t:n,rejectMenu:i,setReason:a,reason:o,action:r}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+r,submit:"CS_COMMON_"+r,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n(`ES_FSM_ACTION_${r.toUpperCase()}_REASON`),type:"dropdown",populators:l.createElement(t.Dropdown,{t:n,option:null==i?void 0:i.sort((e,t)=>e.name.localeCompare(t.name)),id:"reason",optionKey:"i18nKey",selected:o,select:a}),isMandatory:!0},{label:n("ES_FSM_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}},tt=(e,t)=>{let n=(null==e?void 0:e.defaultValues)||1;return l.createElement(l.Fragment,null,l.createElement("div",{className:"PlusMinus"},l.createElement("button",{type:"button",onClick:()=>{n>1?(n-=1,e.onSelect(n)):(n=1,e.onSelect(n))},className:"PlusMinusbutton"},"-"),l.createElement("input",{readOnly:!0,value:n,style:{textAlign:"center",border:"1px solid #505A5F"}}),l.createElement("button",{type:"button",onClick:()=>{n>=1?(n+=1,e.onSelect(n)):(n=1,e.onSelect(n))},className:"PlusMinusbutton"},"+")))},nt=e=>l.createElement("h1",{className:"heading-m"},e.label),lt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),it=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(lt,null)),at={boxShadow:"0 -2px 8px rgb(0 0 0 / 16%)",maxWidth:"480px",zIndex:"100",left:"0",bottom:"0",width:"100%",backgroundColor:"rgba(255, 255, 255)",padding:"8px",position:"fixed",textAlign:"right",display:"flex",justifyContent:"space-around"},ot=e=>{var i,a,o;let{t:u,action:d,tenantId:c,id:p,closeModal:m,submitAction:v,actionData:E,module:_}=e;const S=!!Digit.Utils.browser.isMobile(),{data:f,isLoading:y,isSuccess:T}=Digit.Hooks.fsm.useDsoSearch(c,{limit:"-1",status:"ACTIVE"}),{isSuccess:g,data:h}=Digit.Hooks.fsm.useSearch(c,{applicationNos:p},{staleTime:Infinity,select:e=>{let{additionalDetails:t}=e;const n=e=>"object"==typeof e?e:n(JSON.parse(e));return t=n(t),{...e,additionalDetails:t}}}),I=(r.useQueryClient(),Digit.ULBService.getStateId()),{data:C,isSuccess:N}=Digit.Hooks.fsm.useMDMS(I,"Vehicle","VehicleType",{staleTime:Infinity}),{data:A,isSuccess:D}=Digit.Hooks.fsm.useMDMS(I,"FSM","PropertyType",{staleTime:Infinity}),{data:O,isSuccess:L}=Digit.Hooks.fsm.useMDMS(I,"FSM","PropertySubtype",{staleTime:Infinity}),{data:P,isSuccess:b}=Digit.Hooks.fsm.useMDMS(I,"FSM","PitType",{staleTime:Infinity}),{data:R,isLoading:M}=Digit.Hooks.fsm.useMDMS(I,"FSM","Reason",{staleTime:Infinity},["ReassignReason","RejectionReason","DeclineReason","CancelReason"]),{data:k}=Digit.Hooks.fsm.useMDMS(I,"Vehicle","FSTPORejectionReason",{staleTime:Infinity}),[w,F]=n.useState([]),[x,H]=n.useState([]),[V,B]=n.useState({}),[U,Y]=n.useState(null),[G,W]=n.useState(null),[K,z]=n.useState([]),[j,X]=n.useState(null),[$,q]=n.useState(null),[Z,Q]=n.useState(null),[J,ee]=n.useState(null),[te,ne]=n.useState(null),[le,ie]=n.useState(!1),[ae,oe]=n.useState(null),[re,ue]=n.useState([]),[se,de]=n.useState(null),[ce,pe]=n.useState(null),[me,ve]=n.useState(null),[Ee,_e]=n.useState(),[Se,fe]=n.useState(),[ye,Te]=n.useState(),[ge,he]=n.useState(null),[Ie,Ce]=n.useState({capacity:null==j?void 0:j.capacity,wasteCollected:null==j?void 0:j.capacity,propertyType:null==h?void 0:h.propertyUsage.split(".")[0],subtype:null==h?void 0:h.propertyUsage,pitType:null==h?void 0:h.sanitationtype,pitDetail:null==h?void 0:h.pitDetail,propertyID:null==h||null===(i=h.additionalDetails)||void 0===i?void 0:i.propertyID,roadWidth:null==h||null===(a=h.additionalDetails)||void 0===a?void 0:a.roadWidth,distancefromroad:null==h||null===(o=h.additionalDetails)||void 0===o?void 0:o.distancefromroad});function Ne(e){Y(e)}function Ae(e){W(e)}function De(e){X(e),Ce({capacity:null==e?void 0:e.capacity,wasteCollected:null==e?void 0:e.capacity})}function Oe(e){Te(e)}function Le(e,t,n){t.comments=n.comments?e.code+"~"+n.comments:e.code}return n.useEffect(()=>{if(g&&N&&h){const[e]=C.filter(e=>e.code===h.vehicleType);let t=Ie;t.capacity=null==h?void 0:h.vehicleCapacity,t.wasteCollected=null==h?void 0:h.vehicleCapacity,z([e]),X(e),Ce(t)}},[N,g]),n.useEffect(()=>{if(g&&D&&h){const[e]=A.filter(e=>e.code===h.propertyUsage.split(".")[0]);let t=Ie;t.propertyType=e,ue([e]),oe(e),Ce(t)}},[D,g]),n.useEffect(()=>{if(g&&L&&h){const[e]=O.filter(e=>e.code===h.propertyUsage);let t=Ie;t.subtype=e,de(e),Ce(t)}},[L,g]),n.useEffect(()=>{if(g&&b&&h){const[e]=P.filter(e=>e.code===h.sanitationtype),t=h.pitDetail;let n=Ie;n.pitType=e,n.pitDetail=t,pe(e),fe(h.pitDetail),Ce(n)}},[b,g]),n.useEffect(()=>{if(j&&T){const e=f.filter(e=>{var t;return null==e||null===(t=e.vehicles)||void 0===t?void 0:t.find(e=>e.type===j.code)});F(e)}},[j,T]),n.useEffect(()=>{if(g&&T&&h&&h.dsoId){var e;const[t]=f.filter(e=>e.id===h.dsoId),n=(null==t||null===(e=t.vehicles)||void 0===e?void 0:e.filter(e=>e.capacity==(null==h?void 0:h.vehicleCapacity))).sort((e,t)=>e.registrationNumber>t.registrationNumber?1:-1);H(n)}},[g,T]),n.useEffect(()=>{var e,t;$||E&&E[0]&&(null===(e=E[0].comment)||void 0===e?void 0:e.length)>0&&"DSO_REJECTED"===(null===(t=E[0])||void 0===t?void 0:t.status)?ie(!0):ie(!1)},[$]),n.useEffect(()=>{ie(!!Z)},[Z]),n.useEffect(()=>{ie(!!J)},[J]),n.useEffect(()=>{ie(!!te)},[te]),n.useEffect(()=>{var e,n,i,a,o;switch(d){case"UPDATE":case"SCHEDULE":case"ES_FSM_SCHEDULE":return ie(!0),B((e=>{let{t:t,noOfTrips:n,action:i}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+i,submit:"CS_COMMON_"+i,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:t("ES_FSM_ACTION_NUMBER_OF_TRIPS"),isMandatory:!0,type:"custom",populators:{name:"noOfTrips",error:t("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID"),validation:{required:!0},defaultValue:n,rules:{required:!0},customProps:{isMandatory:!0,optionsKey:"i18nKey",innerStyles:{minWidth:"33%"}},component:(e,t)=>l.createElement(tt,s({defaultValues:e.value},t,{onSelect:t=>{e.onChange(t)}}))}}]}]}})({t:u,noOfTrips:null==h?void 0:h.noOfTrips,action:d}));case"DSO_ACCEPT":case"ACCEPT":return ie(!!G),B((e=>{let{t:n,selectVehicleNo:i,vehicleNoList:a,vehicleNo:o,noOfTrips:r,action:u}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+u,submit:"CS_COMMON_"+u,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_VEHICLE_REGISTRATION_NO"),isMandatory:!0,type:"dropdown",populators:l.createElement(l.Fragment,null,null!=a&&a.length?null:l.createElement(t.CardLabelError,null,n("ES_FSM_NO_VEHICLE_AVAILABLE")),l.createElement(t.Dropdown,{option:a,autoComplete:"off",optionKey:"registrationNumber",id:"vehicle",select:i,selected:o,disable:!((null==a?void 0:a.length)>0)}))},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),isMandatory:!0,type:"text",populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_NUMBER_OF_TRIPS"),isMandatory:!0,type:"text",populators:{name:"noOfTrips",validation:{required:!0},defaultValue:r},disable:!0}]}]}})({t:u,dsoData:f,dso:U,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,noOfTrips:null==h?void 0:h.noOfTrips,vehicleNo:G,vehicleNoList:x,selectVehicleNo:Ae,action:d}));case"ASSIGN":case"GENERATE_DEMAND":case"FSM_GENERATE_DEMAND":return ie(!!U),B((e=>{let{t:n,dsoData:i,dso:a,selectDSO:o,vehicleCapacity:r,action:u}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+u,submit:"CS_COMMON_"+u,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_DSO_NAME"),isMandatory:!0,type:"dropdown",populators:l.createElement(l.Fragment,null,Qe(i,0,r)&&!Qe(i,0,r).length?l.createElement(t.CardLabelError,null,n("ES_COMMON_NO_DSO_AVAILABLE_WITH_SUCH_VEHICLE")):null,l.createElement(t.Dropdown,{option:Qe(i,0,r),autoComplete:"off",optionKey:"displayName",id:"dso",selected:a,select:o,disable:!(!Qe(i,0,r)||Qe(i,0,r).length)}))},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),isMandatory:!0,type:"text",populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!0,type:"custom",populators:{name:"date",validation:{required:!0},customProps:{min:Digit.Utils.date.getDate(),max:Digit.Utils.date.getDate(Date.now()+864e6)},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}}]}]}})({t:u,dsoData:f,dso:U,selectDSO:Ne,vehicleMenu:K,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,selectVehicle:De,action:d}));case"REASSIGN":case"REASSING":case"FSM_REASSING":return U&&($||E&&E[0]&&(null===(e=E[0].comment)||void 0===e?void 0:e.length)>0&&"DSO_REJECTED"===(null===(n=E[0])||void 0===n?void 0:n.status))?ie(!0):ie(!1),B((e=>{let{t:n,dsoData:i,dso:a,selectDSO:o,vehicleCapacity:r,reassignReasonMenu:u,reassignReason:d,selectReassignReason:c,action:p,showReassignReason:m}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+p,submit:"CS_COMMON_"+p,cancel:"CS_COMMON_CLOSE"},form:[{body:[...m?[{label:n("ES_FSM_ACTION_REASSIGN_REASON"),type:"dropdown",isMandatory:!0,populators:l.createElement(t.Dropdown,{option:u,optionKey:"i18nKey",id:"reassign-reason",selected:d,select:c,t:n})}]:[],{label:n("ES_FSM_ACTION_DSO_NAME"),isMandatory:!0,type:"dropdown",populators:l.createElement(l.Fragment,null,Je(i,0,r)&&!Je(i,0,r).length?l.createElement(t.CardLabelError,null,n("ES_COMMON_NO_DSO_AVAILABLE_WITH_SUCH_VEHICLE")):null,l.createElement(t.Dropdown,{option:Je(i,0,r),autoComplete:"off",optionKey:"displayName",id:"dso",selected:a,select:o}))},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),type:"text",populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!0,type:"custom",populators:{name:"date",validation:{required:!0},customProps:{min:Digit.Utils.date.getDate()},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}}]}]}})({t:u,dsoData:f,dso:U,selectDSO:Ne,vehicleMenu:K,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,selectVehicle:De,reassignReasonMenu:null==R?void 0:R.ReassignReason,reassignReason:$,selectReassignReason:q,action:d,showReassignReason:!(E&&E[0]&&(null===(i=E[0].comment)||void 0===i?void 0:i.length)>0&&"DSO_REJECTED"===(null===(a=E[0])||void 0===a?void 0:a.status))}));case"COMPLETE":case"COMPLETED":return ie(!0),B((e=>{let{t:n,vehicleCapacity:i,noOfTrips:a,applicationCreatedTime:o=0,action:r}=e;return{label:{submit:"CS_COMMON_"+r,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_DESLUGED_DATE_LABEL"),isMandatory:!0,type:"custom",populators:{name:"desluged",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),customProps:{min:Digit.Utils.date.getDate(o),max:Digit.Utils.date.getDate()},component:(e,n)=>l.createElement(t.DatePicker,s({disabled:!0,onChange:e.onChange,date:e.value},n))}},{label:n("ES_FSM_ACTION_VEHICLE_CAPACITY_IN_LTRS"),type:"number",isMandatory:!0,populators:{name:"capacity",validation:{required:!0}},disable:!0},{label:n("ES_FSM_ACTION_WASTE_VOLUME_LABEL"),type:"number",isMandatory:!0,populators:{name:"wasteCollected",validation:{required:!0,validate:e=>parseInt(e)<=parseInt(i)},error:`${n("ES_FSM_ACTION_INVALID_WASTE_VOLUME")} ${i} ${n("CS_COMMON_LITRES")}`}},{head:"",body:[{type:"component",route:"search-property",isMandatory:!0,component:"CPTSearchProperty",key:"cptsearchproperty",withoutLabel:!0,nextStep:"search-results",hideInEmployee:!0},{type:"component",route:"search-results",isMandatory:!0,component:"CPTSearchResults",key:"cptsearchresults",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"create-property",isMandatory:!0,component:"CPTCreateProperty",key:"cptcreateproperty",withoutLabel:!0,isSkipEnabled:!0,nextStep:"acknowledge-create-property",hideInEmployee:!0},{type:"component",route:"acknowledge-create-property",isMandatory:!0,component:"CPTAcknowledgement",key:"cptacknowledgement",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"property-details",isMandatory:!0,component:"CPTPropertyDetails",key:"propertydetails",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0}]},{head:"FSM_NEW_APPLICATION_PROPERTY",body:[{component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0}]},{label:n("ES_FSM_ACTION_ROAD_WIDTH"),type:"number",isMandatory:!0,populators:{name:"roadWidth",validation:{required:!0}},disable:!1},{label:n("ES_FSM_ACTION_DISTANCE_FROM_ROAD"),type:"number",isMandatory:!0,populators:{name:"distancefromroad",validation:{required:!0}},disable:!1},{label:"ES_NEW_APPLICATION_PROPERTY_TYPE",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",disable:!0,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",disable:!0,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!1,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_DIMENSION",isMandatory:!1,type:"component",route:"tank-size",key:"pitDetail",component:"SelectTankSize",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:null},{label:n("ES_NEW_APPLICATION_PAYMENT_NO_OF_TRIPS")+" *",type:"number",populators:{name:"noOfTrips",error:n("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID"),validation:{required:!0},defaultValue:a},disable:!0}]}]}})({t:u,vehicle:j,vehicleCapacity:null==h?void 0:h.vehicleCapacity,noOfTrips:null==h?void 0:h.noOfTrips,applicationCreatedTime:null==h||null===(o=h.auditDetails)||void 0===o?void 0:o.createdTime,action:d,module:_}));case"SUBMIT":case"FSM_SUBMIT":return history.push("/digit-ui/employee/fsm/modify-application/"+applicationNumber);case"DECLINE":case"DSO_REJECT":return ie(!!J),B(et({t:u,rejectMenu:null==R?void 0:R.DeclineReason,setTrips:he,trips:null==h?void 0:h.noOfTrips,setReason:ee,action:d}));case"REJECT":case"SENDBACK":return ie(!!Z),B(et({t:u,rejectMenu:null==R?void 0:R.RejectionReason,setReason:Q,reason:Z,action:d}));case"CANCEL":return ie(!!te),B(et({t:u,rejectMenu:null==R?void 0:R.CancelReason,setReason:ne,reason:te,action:d}));case"PAY":case"ADDITIONAL_PAY_REQUEST":case"FSM_PAY":return history.push("/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/"+applicationNumber);case"DECLINEVEHICLE":return ie(!!ye),B((e=>{let{t:n,rejectMenu:i,selectReason:a,reason:o,action:r}=e;return{label:{heading:"ES_FSM_ACTION_TITLE_"+r,submit:"CS_COMMON_"+r,cancel:"CS_COMMON_CLOSE"},form:[{body:[{label:n("ES_FSM_ACTION_DECLINE_REASON"),isMandatory:!0,type:"dropdown",populators:l.createElement(t.Dropdown,{option:null==i?void 0:i.sort((e,t)=>e.name.localeCompare(t.name)),autoComplete:"off",optionKey:"i18nKey",id:"Reason",select:a,selected:o,t:n})},"OTHERS"===(null==o?void 0:o.code)?{label:n("Comments"),isMandatory:!0,type:"text",populators:{name:"comments",validation:{required:!0}}}:{}]}]}})({t:u,rejectMenu:k,selectReason:Oe,reason:ye,action:d}))}},[d,$,y,U,K,Z,G,x,R,ye]),l.useRef(null),d&&V.form&&!y&&!M&&N?l.createElement(t.Modal,{popupStyles:S?{height:"fit-content",minHeight:"100vh"}:{height:"fit-content"},headerBarMain:l.createElement(nt,{label:u(V.label.heading)}),headerBarEnd:l.createElement(it,{onClick:m}),actionCancelLabel:u(V.label.cancel),actionCancelOnSubmit:m,actionSaveLabel:u(V.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:!le,popupModuleMianStyles:S?{paddingBottom:"60px"}:{},popupModuleActionBarStyles:S?at:{}},l.createElement(t.FormComposer,{config:V.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){const t={action:d};U&&(h.dsoId=U.id),G&&"ACCEPT"===d&&(h.vehicleId=G.id),G&&"DSO_ACCEPT"===d&&(h.vehicleId=G.id),j&&"ASSIGN"===d&&(h.vehicleType=j.code),e.date&&(h.possibleServiceDate=new Date(""+e.date).getTime()),e.desluged&&(h.completedOn=new Date(e.desluged).getTime()),e.wasteCollected&&(h.wasteCollected=e.wasteCollected),e.pitDetail&&(h.pitDetail.height=Number(e.pitDetail.height)),e.pitDetail&&(h.pitDetail.width=Number(e.pitDetail.width)),e.pitDetail&&(h.pitDetail.diameter=Number(e.pitDetail.diameter)),e.pitDetail&&(h.pitDetail.length=Number(e.pitDetail.length)),e.pitType&&(h.sanitationtype=e.pitType.code),e.subtype&&"object"==typeof e.subtype&&(h.propertyUsage=e.subtype.code),e.subtype&&"string"==typeof e.subtype&&(h.propertyUsage=e.subtype),e.noOfTrips&&(h.noOfTrips=e.noOfTrips),Ee&&(h.pitDetail.additionalDetails&&h.pitDetail.additionalDetails.fileStoreId?h.pitDetail.additionalDetails.fileStoreId={...h.pitDetail.additionalDetails.fileStoreId,FSM_DSO:Ee}:h.pitDetail.additionalDetails={fileStoreId:{FSM_DSO:Ee}}),e.noOfTrips&&(h.noOfTrips=Number(e.noOfTrips)),"REASSING"===d&&(h.vehicleId=null),$&&Le($,t,e),Z&&Le(Z,t,e),J&&Le(J,t,e),te&&Le(te,t,e),ye&&e.comments&&(t.comments=e.comments),ye&&(t.fstpoRejectionReason=null==ye?void 0:ye.code),v({fsm:h,workflow:t})},formId:"modal-action",defaultValues:Ie}),"COMPLETED"===d?l.createElement(t.UploadPitPhoto,{header:"",tenantId:c,cardText:"",onPhotoChange:e=>{(!Ee||Ee.length<4)&&_e(e)},uploadedImages:null}):null):l.createElement(t.Loader,null)},rt=e=>{const[t,i]=n.useState(null),[a,o]=n.useState(e.fileStoreIds);n.useEffect(()=>{o(e.fileStoreIds)},[e.fileStoreIds]),n.useEffect(()=>{!function(){try{const e=function(){if(null!==a)return Promise.resolve(r()).then(function(){})}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[a]);const r=n.useCallback(function(){try{const t=function(){if(null!==a&&a.length>0)return Promise.resolve(Digit.UploadServices.Filefetch(a,e.tenantId)).then(function(e){!function(e){var t=Object.keys(e.data),n=t.findIndex(e=>"fileStoreIds"===e);n>-1&&t.splice(n,1);const l=t.map(t=>({image:e.data[t].split(",")[2],key:t,fullImage:Digit.Utils.getFileUrl(e.data[t])}));i([...l])}(e)})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[a]);return l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==t?void 0:t.map((t,n)=>l.createElement("div",{key:n,style:{minWidth:"160px",marginRight:"8px",marginBottom:"8px",maxWidth:"200px"}},l.createElement("img",{src:t.image,alt:"uploaded thumbnail",onClick:()=>e.onClick(t.fullImage,n)})))))},ut=e=>"lbd"===e,st=e=>{var o,r,u,s,d,c,p,m,v,E,_;let{applicationData:S,channelMenu:f,sanitationMenu:y}=e;const{t:T}=i.useTranslation(),g=a.useHistory(),[h,I]=n.useState(!1),C=Digit.ULBService.getStateId(),{data:N,isLoading:A}=Digit.Hooks.fsm.useMDMS(C,"FSM","CommonFieldsConfig"),{data:D,isLoading:O}=Digit.Hooks.fsm.useMDMS(C,"FSM","PreFieldsConfig"),{isLoading:L}=Digit.Hooks.fsm.useMDMS(C,"FSM","PostFieldsConfig"),[P,b,R]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[M,k,w]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[F,x,H]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{b(!1),H(),w()},[]);var V,B,U,Y,G,W,K,z,j={channel:f.filter(e=>e.code===S.source)[0],applicationData:{applicantName:S.citizen.name,mobileNumber:S.citizen.mobileNumber,applicantGender:S.citizen.gender},tripData:{noOfTrips:S.noOfTrips,amountPerTrip:"null"!==S.additionalDetails.tripAmount?S.additionalDetails.tripAmount:"",amount:"null"!==S.additionalDetails.tripAmount?S.noOfTrips*S.additionalDetails.tripAmount:void 0,vehicleType:{capacity:null==S?void 0:S.vehicleCapacity},vehicleCapacity:null==S?void 0:S.vehicleCapacity,distancefromroad:null==S||null===(o=S.additionalDetails)||void 0===o?void 0:o.distancefromroad,roadWidth:null==S||null===(r=S.additionalDetails)||void 0===r?void 0:r.roadWidth},propertyType:S.propertyUsage.split(".")[0],propertyID:null==S||null===(u=S.additionalDetails)||void 0===u?void 0:u.propertyID,subtype:S.propertyUsage,address:{pincode:S.address.pincode,locality:{...S.address.locality,i18nkey:`${S.tenantId.toUpperCase().split(".").join("_")}_REVENUE_${null==S||null===(s=S.address)||void 0===s||null===(d=s.locality)||void 0===d?void 0:d.code}`},slum:S.address.slumName,street:S.address.street,doorNo:S.address.doorNo,landmark:S.address.landmark},pitType:y.filter(e=>e.code===S.sanitationtype)[0],pitDetail:S.pitDetail,paymentPreference:S.paymentPreference,advanceAmount:S.advanceAmount};if(S&&"Village"===(null==S||null===(c=S.address)||void 0===c||null===(p=c.additionalDetails)||void 0===p?void 0:p.boundaryType)||"GP"===(null==S||null===(m=S.address)||void 0===m||null===(v=m.additionalDetails)||void 0===v?void 0:v.boundaryType))j.address={...j.address,propertyLocation:{active:!0,code:"FROM_GRAM_PANCHAYAT",i18nKey:"FROM_GRAM_PANCHAYAT",name:"From Gram Panchayat"},additionalDetails:{boundaryType:null==S||null===(V=S.address)||void 0===V||null===(B=V.additionalDetails)||void 0===B?void 0:B.boundaryType,gramPanchayat:null==S||null===(U=S.address)||void 0===U||null===(Y=U.additionalDetails)||void 0===Y?void 0:Y.gramPanchayat,village:null==S||null===(G=S.address)||void 0===G||null===(W=G.additionalDetails)||void 0===W?void 0:W.village,newGp:null==S||null===(K=S.address)||void 0===K||null===(z=K.additionalDetails)||void 0===z?void 0:z.newGramPanchayat}};else if(S&&"Locality"===(null==S||null===(E=S.address)||void 0===E||null===(_=E.additionalDetails)||void 0===_?void 0:_.boundaryType)){var X,$,q,Z;j.address={...j.address,propertyLocation:{active:!0,code:"WITHIN_ULB_LIMITS",i18nKey:"WITHIN_ULB_LIMITS",name:"Witnin ULB Limits"},additionalDetails:{boundaryType:null==S||null===(X=S.address)||void 0===X||null===($=X.additionalDetails)||void 0===$?void 0:$.boundaryType,newLocality:null==S||null===(q=S.address)||void 0===q||null===(Z=q.additionalDetails)||void 0===Z?void 0:Z.newLocality}}}if(A||L||O)return l.createElement(t.Loader,null);const Q=[...D,...N];return console.log(Q,"configs"),l.createElement(t.FormComposer,{isDisabled:!h,label:T("CREATED"!=(null==S?void 0:S.applicationStatus)?"ES_FSM_APPLICATION_SCHEDULE":"ES_FSM_APPLICATION_UPDATE"),config:[{head:"ES_NEW_APPLICATION_PROPERTY_DETAILS",body:[{label:"ES_NEW_APPLICATION_PROPERTY_ID",isMandatory:!0,component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0},{label:"ES_NEW_APPLICATION_PROPERTY_TYPE",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"}]},{head:"ES_TITLE_APPLICANT_DETAILS",body:[{label:"ES_NEW_APPLICATION_APPLICATION_CHANNEL",isMandatory:!0,type:"component",key:"channel",component:"SelectChannel",nextStep:"applicantName"},{type:"component",key:"applicationData",withoutLabel:!0,component:"SelectName"}]},{head:"ES_NEW_APPLICATION_LOCATION_DETAILS",body:[{route:"address",component:"FSMSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"locality-gramPanchayat",isMandatory:!0,type:"component"},{route:"locality-gramPanchayat",component:"SelectLocalityOrGramPanchayat",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"select-trip-number",isMandatory:!0,type:"component"},{route:"pincode",component:"FSMSelectPincode",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_FILE_APPLICATION_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"check-slum",type:"component"},{type:"component",route:"check-slum",isMandatory:!0,component:"CheckSlum",texts:{header:"ES_NEW_APPLICATION_SLUM_CHECK",submitBarLabel:"CS_COMMON_NEXT"},key:"address",withoutLabel:!0,nextStep:"slum-details",hideInEmployee:!0},{type:"component",route:"slum-details",isMandatory:!0,component:"SelectSlumName",texts:{header:"CS_NEW_APPLICATION_SLUM_NAME",cardText:"CS_NEW_APPLICATION_SLUM_TEXT",submitBarLabel:"CS_COMMON_NEXT"},withoutLabel:!0,key:"address",nextStep:"street"},{type:"component",route:"street",component:"FSMSelectStreet",key:"address",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_STREET_DOOR_NO_LABEL",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"landmark"},{type:"component",route:"landmark",component:"FSMSelectLandmark",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},key:"address",nextStep:"pit-type"}]},{head:"CS_CHECK_PIT_SEPTIC_TANK_DETAILS",body:[{label:"ES_NEW_APPLICATION_ROAD_WIDTH",isMandatory:!0,type:"component",route:"road-details",key:"roadWidth",hideInEmployee:!0,component:"SelectRoadDetails",texts:{header:"CS_FILE_PROPERTY_ROAD_WIDTH",cardText:"CS_FILE_PROPERTY_ROAD_WIDTH_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!0,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"road-details"},{route:"tank-size",component:"SelectTankSize",isMandatory:!1,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},type:"component",key:"pitDetail",nextStep:"select-payment-preference",label:"ES_NEW_APPLICATION_PIT_DIMENSION"},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTrips"}]},{head:"CS_FILE_ADDITIONAL_DETAILS",hideInEmployee:!0,body:[{label:"a",isMandatory:!0,type:"component",route:"select-trip-number",key:"selectTripNo",component:"SelectTripNo",hideInEmployee:!0,texts:{headerCaption:"",header:"ES_FSM_SERVICE_REQUEST",cardText:"ES_FSM_SERVICE_REQUEST_TEXT",skipText:"CORE_COMMON_SKIP_CONTINUE",submitBarLabel:"CS_COMMON_NEXT",skipLabel:"CS_COMMON_SERVICE_SKIP_INFO"},nextStep:"property-id"},{label:"a",isMandatory:!1,type:"component",route:"select-gender",hideInEmployee:!0,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"select-payment-preference"},{label:"a",isMandatory:!1,type:"component",route:"select-payment-preference",key:"selectPaymentPreference",hideInEmployee:!0,component:"SelectPaymentPreference",texts:{headerCaption:"",header:"ES_FSM_PAYMENT_PREFERENCE_LABEL",cardText:"ES_FSM_PAYMENT_PREFERENCE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:null}]},{head:"ES_TITLE_PAYMENT_DETAILS",body:[{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTripData"},{type:"component",key:"advancepaymentPreference",withoutLabel:!0,component:"AdvanceCollection"}]}].filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,o,r,u,s,d,c,p,m,v,E,_,f,y,T,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y;const G=e.channel,W=null==e||null===(t=e.pitType)||void 0===t?void 0:t.code,K=null==e?void 0:e.pitDetail,z=null==e||null===(n=e.address)||void 0===n?void 0:n.pincode,j=null==e||null===(l=e.address)||void 0===l||null===(i=l.street)||void 0===i?void 0:i.trim(),X=null==e||null===(a=e.address)||void 0===a||null===(o=a.doorNo)||void 0===o?void 0:o.trim(),$=null==e||null===(r=e.address)||void 0===r?void 0:r.slum,q=null==e||null===(u=e.address)||void 0===u||null===(s=u.landmark)||void 0===s?void 0:s.trim(),Z=e.tripData.noOfTrips,Q=e.tripData.amountPerTrip,J=null==e||null===(d=e.address)||void 0===d||null===(c=d.city)||void 0===c?void 0:c.code,ee=null==e||null===(p=e.address)||void 0===p||null===(m=p.locality)||void 0===m?void 0:m.code,te=null==e||null===(v=e.address)||void 0===v||null===(E=v.locality)||void 0===E?void 0:E.name,ne=null==e?void 0:e.subtype,{height:le,length:ie,width:ae,diameter:oe}=K,re=0===Q?null:null!=e&&null!==(_=e.advancepaymentPreference)&&void 0!==_&&_.advanceAmount?null==e||null===(f=e.advancepaymentPreference)||void 0===f?void 0:f.advanceAmount:S.advanceAmount,ue=Q*Z,se=(null==e||null===(y=e.address)||void 0===y?void 0:y.gramPanchayat)||(null==e||null===(T=e.address)||void 0===T||null===(h=T.additionalDetails)||void 0===h?void 0:h.gramPanchayat),de=(null==e||null===(I=e.address)||void 0===I?void 0:I.village)||(null==e||null===(C=e.address)||void 0===C||null===(N=C.additionalDetails)||void 0===N?void 0:N.village),ce=null==e||null===(A=e.address)||void 0===A||null===(D=A.propertyLocation)||void 0===D?void 0:D.code,pe=(null==e||null===(O=e.address)||void 0===O?void 0:O.newGp)||(null==e||null===(L=e.address)||void 0===L||null===(P=L.additionalDetails)||void 0===P?void 0:P.newGramPanchayat),me=(null==e||null===(b=e.address)||void 0===b?void 0:b.newVillage)||(null==e||null===(R=e.address)||void 0===R||null===(M=R.additionalDetails)||void 0===M?void 0:M.village),ve=(null==e||null===(k=e.address)||void 0===k?void 0:k.newLocality)||(null==e||null===(w=e.address)||void 0===w||null===(F=w.additionalDetails)||void 0===F?void 0:F.newLocality),Ee={...S,sanitationtype:W,source:G.code,additionalDetails:{...S.additionalDetails,tripAmount:"number"==typeof Q?JSON.stringify(Q):Q,totalAmount:"number"==typeof ue?JSON.stringify(ue):ue},propertyUsage:ne,vehicleType:e.tripData.vehicleType.type,vehicleCapacity:null==e||null===(x=e.tripData)||void 0===x||null===(H=x.vehicleType)||void 0===H?void 0:H.capacity,noOfTrips:Z,pitDetail:{...S.pitDetail,distanceFromRoad:e.distanceFromRoad,height:le,length:ie,width:ae,diameter:oe},address:{...S.address,tenantId:J,landmark:q,doorNo:X,street:j,pincode:z,slumName:$,locality:{...S.address.locality,code:"FROM_GRAM_PANCHAYAT"===ce?null==se?void 0:se.code:ee,name:"FROM_GRAM_PANCHAYAT"===ce?null==se?void 0:se.name:te},geoLocation:{...S.address.geoLocation,latitude:null!=e&&null!==(V=e.address)&&void 0!==V&&V.latitude?null==e||null===(B=e.address)||void 0===B?void 0:B.latitude:S.address.geoLocation.latitude,longitude:null!=e&&null!==(U=e.address)&&void 0!==U&&U.longitude?null==e||null===(Y=e.address)||void 0===Y?void 0:Y.longitude:S.address.geoLocation.longitude},additionalDetails:{boundaryType:"FROM_GRAM_PANCHAYAT"===ce?"GP":"Locality",gramPanchayat:{code:null==se?void 0:se.code,name:null==se?void 0:se.name},village:null!=de&&de.code?{code:null!=de&&de.code?null==de?void 0:de.code:"",code:null!=de&&de.code?null==de?void 0:de.code:""}:me,newGramPanchayat:pe,newLocality:ve}},advanceAmount:"number"==typeof re?JSON.stringify(re):re};delete Ee.responseInfo,window.Digit.SessionStorage.set("propertyType",null),window.Digit.SessionStorage.set("subType",null),Digit.SessionStorage.set("city_property",null),Digit.SessionStorage.set("selected_localities",null),Digit.SessionStorage.set("locality_property",null),g.replace("/digit-ui/employee/fsm/response",{applicationData:Ee,key:"update",action:"CREATED"===(null==S?void 0:S.applicationStatus)?"SUBMIT":"SCHEDULE"})},defaultValues:j,onFormValueChange:(e,t)=>{var n,l,i,a,o,r,u,s,d,c,p,m;if(null!=t&&t.propertyType&&null!=t&&t.subtype&&(null!=t&&null!==(n=t.address)&&void 0!==n&&null!==(l=n.locality)&&void 0!==l&&l.code||"FROM_GRAM_PANCHAYAT"===(null==t||null===(i=t.address)||void 0===i||null===(a=i.propertyLocation)||void 0===a?void 0:a.code)&&(null!=t&&null!==(o=t.address)&&void 0!==o&&null!==(r=o.gramPanchayat)&&void 0!==r&&r.code||null!=t&&null!==(u=t.address)&&void 0!==u&&null!==(s=u.additionalDetails)&&void 0!==s&&null!==(d=s.gramPanchayat)&&void 0!==d&&d.code))&&null!=t&&null!==(c=t.tripData)&&void 0!==c&&c.vehicleType&&(null!=t&&null!==(p=t.tripData)&&void 0!==p&&p.amountPerTrip||0===(null==t||null===(m=t.tripData)||void 0===m?void 0:m.amountPerTrip))){I(!0);const e=null!=t&&t.pitDetail?Object.values(null==t?void 0:t.pitDetail).filter(e=>e>0):null;var v,E;null!=t&&t.pitType&&(null===e||0===(null==e?void 0:e.length)||ut(null==t||null===(v=t.pitType)||void 0===v?void 0:v.dimension)&&(null==e?void 0:e.length)>=3||!ut(null==t||null===(E=t.pitType)||void 0===E?void 0:E.dimension)&&(null==e?void 0:e.length)>=2?I(!0):I(!1))}else I(!1)}})},dt={select:e=>({totalCount:null==e?void 0:e.totalCount,vehicleLog:null==e?void 0:e.vehicleTrip.map(e=>{const t=e.tripOwner,n=t.name+(t.userName?"- "+t.userName:""),l={...t,displayName:n};return{...e,tripOwner:l}})})},ct=e=>{let{name:t,value:n,onChange:i}=e;return l.createElement(u,{name:t,onChange:i,onBlur:()=>{const e=null==n?void 0:n.split(":"),t=null==e?void 0:e[1];i(n);let l=document.getElementsByClassName("react-time-picker__inputGroup__minute");for(let e of l){let n=e.value;e.value=Number(n)<60?n:t}},value:n,locale:"en-US",disableClock:!1,clearIcon:null,format:"h:mm a"})},pt={select:e=>e.vehicleTrip[0]},mt={select:e=>e.vehicleTrip},vt=e=>"lbd"===e,Et=(e,t,n,l,i,a)=>{var o,r;const u=0===(null==a||null===(o=a.additionalDetails)||void 0===o?void 0:o.tripAmount)||null===(null==a||null===(r=a.additionalDetails)||void 0===r?void 0:r.tripAmount)||!1;return i(`${l?"E":"C"}S_FSM_RESPONSE_${t||"CREATE"}_${e}${n?"":"_ERROR"}${t?"":0===(null==a?void 0:a.advanceAmount)?"_POST_PAY":u?"_ZERO_PAY":""}`)},_t=(e,t,n,l)=>Et("ACTION",e,t,n,l),St=e=>{var n,i,a,o,r,u;let s=null!=e&&e.action?e.action:null===(n=e.data)||void 0===n||null===(i=n.fsm)||void 0===i?void 0:i[0].applicationStatus,d=((e,t,n,l)=>Et("LABEL",e,t,n,l))((null===(a=e.data)||void 0===a||null===(o=a.fsm)||void 0===o?void 0:o[0].applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t);return e.errorInfo&&null!==e.errorInfo&&""!==e.errorInfo&&"string"==typeof e.errorInfo&&"SCHEDULE"!==e.action&&(d=e.errorInfo),l.createElement(t.Banner,{message:_t(s||e.action,e.isSuccess,e.isEmployee,e.t),applicationNumber:null===(r=e.data)||void 0===r||null===(u=r.fsm)||void 0===u?void 0:u[0].applicationNo,info:d,successful:e.isSuccess})},ft=e=>{let{onSearch:r,type:u,onClose:d,onTabChange:c,searchFields:p,searchParams:m,isInboxPage:v,selectedTab:E}=e;const _=v?Digit.SessionStorage.get("fsm/inbox/searchParams"):Digit.SessionStorage.get("fsm/search/searchParams"),{t:S}=i.useTranslation(),f=a.useHistory(),{register:y,handleSubmit:T,reset:g,watch:h,control:I}=o.useForm({defaultValues:_||m}),[C,N]=n.useState(!1),[A,D]=n.useState(!1),O=innerWidth<=640,L=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1;function P(){const e=p.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});g(e),v?Digit.SessionStorage.del("fsm/inbox/searchParams"):Digit.SessionStorage.del("fsm/search/searchParams"),r({})}h(["applicationNos","mobileNumber"]);const b=e=>null;return l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===u||O)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,S("ES_COMMON_SEARCH_BY")),l.createElement("span",{style:{position:"absolute",top:"2%",right:"8px"},onClick:d},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"search-tabs-container"},l.createElement("div",null,l.createElement("button",{className:"VENDOR"===E?"search-tab-head-selected":"search-tab-head",onClick:()=>{P(),c("VENDOR")}},S("ES_FSM_REGISTRY_INBOX_TAB_VENDOR")),l.createElement("button",{className:"VEHICLE"===E?"search-tab-head-selected":"search-tab-head",onClick:()=>{P(),c("VEHICLE")}},S("ES_FSM_REGISTRY_INBOX_TAB_VEHICLE")),l.createElement("button",{className:"DRIVER"===E?"search-tab-head-selected":"search-tab-head",onClick:()=>{P(),c("DRIVER")}},S("ES_FSM_REGISTRY_INBOX_TAB_DRIVER"))),l.createElement("div",{className:"action-bar-wrap-registry"},l.createElement("div",{className:"search-add",onClick:()=>{D(!A)}},S("ES_FSM_REGISTRY_INBOX_HEADER_ADD"),l.createElement("div",{className:"search-add-icon"},l.createElement(t.AddIcon,{className:""}))),A&&l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_ACTION_CREATE",options:["VENDOR","VEHICLE","DRIVER"],t:S,onSelect:function(e){switch(e){case"VENDOR":return f.push("/digit-ui/employee/fsm/registry/new-vendor");case"VEHICLE":return f.push("/digit-ui/employee/fsm/registry/new-vehicle");case"DRIVER":return f.push("/digit-ui/employee/fsm/registry/new-driver")}}}))),l.createElement("form",{onSubmit:T(e=>{e.mobileNumber||delete e.mobileNumber,r(e),"mobile"===u&&d()})},l.createElement("div",{className:L?"complaint-input-container for-pt for-search":"complaint-input-container",style:{width:"100%",gridTemplateColumns:"33.33% 66.66% 0%"}},null==p?void 0:p.map((e,n)=>l.createElement("span",{key:n,className:0===n?"complaint-input":"mobile-input"},l.createElement(t.Label,null,e.label),(e=>{switch(e.type){case"date":return l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,onChange:e.onChange}),name:e.name,control:I,defaultValue:null});case"status":return l.createElement(o.Controller,{render:e=>l.createElement(Ye,{onAssignmentChange:e.onChange,value:e.value,applicationStatuses:applicationStatuses,areApplicationStatus:areApplicationStatus}),name:e.name,control:I,defaultValue:null});default:return l.createElement(t.TextInput,s({},e,{inputRef:y},y(e.name,{validate:b}),{watch:h,shouldUpdate:!0}))}})(e)," ")),l.createElement("div",{style:{display:"flex"}},"desktop"===u&&!O&&l.createElement(t.SubmitBar,{className:"submit-bar-search",label:S("ES_COMMON_SEARCH"),submit:!0}),"desktop"===u&&!O&&l.createElement("span",{className:"clear-search"},l.createElement(t.LinkLabel,{style:{marginTop:"40px",marginLeft:"16px"},onClick:P},S("ES_COMMON_CLEAR_SEARCH"))))),C?l.createElement(t.CardLabelError,{className:"search-error-label"},S("ES_SEARCH_APPLICATION_ERROR")):null))))},yt=e=>{const o=Digit.ULBService.getCurrentTenantId(),{t:u}=i.useTranslation(),s=a.useHistory(),d=(Digit.UserService.hasAccess(["FSM_DSO"]),e=>l.createElement("span",{className:"cell-text"},e)),c=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,[p,m]=n.useState([]),[v,E]=n.useState(null),[_,S]=n.useState([]),f=r.useQueryClient(),{data:y,refetch:T}=Digit.Hooks.fsm.useDsoSearch(o,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{enabled:!1}),{mutate:g}=Digit.Hooks.fsm.useVendorUpdate(o),{mutate:h}=Digit.Hooks.fsm.useUpdateVehicle(o),{mutate:I}=Digit.Hooks.fsm.useDriverUpdate(o);n.useEffect(()=>{var t;m((null==e||null===(t=e.data)||void 0===t?void 0:t.table)||[])},[e]),n.useEffect(()=>{"DRIVER"!==e.selectedTab&&"VEHICLE"!==e.selectedTab||T()},[e.selectedTab]),n.useEffect(()=>{if(y){let e=y.map(e=>e.dsoDetails);S(e)}},[y]);const C=()=>{E(null)},N=(e,t,n)=>{m(l=>l.map((l,i)=>{var a,o;return i==e.id&&e.id!==(null==l||null===(a=l.popup)||void 0===a?void 0:a.row)&&t.id!==(null==l||null===(o=l.popup)||void 0===o?void 0:o.column)&&n?{...l,popup:{row:e.id,column:t.id}}:{...l,popup:{}}}))},A=(e,t,n)=>{if("VEHICLE"===t)s.push("/digit-ui/employee/fsm/registry/vehicle-details/"+e);else{let t=n.find(t=>t.name===e);s.push("/digit-ui/employee/fsm/registry/driver-details/"+(null==t?void 0:t.id))}},D=()=>{switch(e.selectedTab){case"VENDOR":return s.push("/digit-ui/employee/fsm/registry/new-vendor");case"VEHICLE":return s.push("/digit-ui/employee/fsm/registry/new-vehicle");case"DRIVER":return s.push("/digit-ui/employee/fsm/registry/new-driver")}},O=l.useMemo(()=>{switch(e.selectedTab){case"VENDOR":return[{Header:u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/registry/vendor-details/"+t.original.id},l.createElement("div",null,t.original.name,l.createElement("br",null)))))}},{Header:u("ES_FSM_REGISTRY_INBOX_DATE_VENDOR_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,l,i;let{row:a}=e;return d(null!==(t=a.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(l=a.original)||void 0===l||null===(i=l.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:u("ES_FSM_REGISTRY_INBOX_TOTAL_VEHICLES"),Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.allVehicles)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.allVehicles)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.allVehicles)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.allVehicles)||void 0===p?void 0:p.map(e=>e.registrationNumber),onSelect:e=>A(e,"VEHICLE")}))}},{Header:u("ES_FSM_REGISTRY_INBOX_ACTIVE_VEHICLES"),disableSortBy:!0,Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.vehicles)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.vehicles)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.vehicles)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.vehicles)||void 0===p?void 0:p.map(e=>e.registrationNumber),onSelect:e=>A(e,"VEHICLE")}))}},{Header:u("ES_FSM_REGISTRY_INBOX_TOTAL_DRIVERS"),disableSortBy:!0,Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.drivers)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.drivers)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.drivers)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.drivers)||void 0===p?void 0:p.map(e=>e.name),onSelect:e=>{var t;return A(e,"DRIVER",null===(t=m.original)||void 0===t?void 0:t.drivers)}}))}},{Header:u("ES_FSM_REGISTRY_INBOX_ACTIVE_DRIVERS"),disableSortBy:!0,Cell:e=>{var n,i,a,o,r,u,s,d,c,p;let{row:m,column:v}=e;return l.createElement("div",{className:"action-bar-wrap-registry",style:{position:"relative"}},l.createElement("div",{className:null!==(n=m.original)&&void 0!==n&&null!==(i=n.activeDrivers)&&void 0!==i&&i.length?"link":"cell-text",style:{cursor:"pointer"},onClick:()=>{var e,t;return N(m,v,null===(e=m.original)||void 0===e||null===(t=e.activeDrivers)||void 0===t?void 0:t.length)}},(null===(a=m.original)||void 0===a||null===(o=a.activeDrivers)||void 0===o?void 0:o.length)||0,l.createElement("br",null)),m.id===(null===(r=m.original)||void 0===r||null===(u=r.popup)||void 0===u?void 0:u.row)&&v.id===(null===(s=m.original)||void 0===s||null===(d=s.popup)||void 0===d?void 0:d.column)&&l.createElement(t.Menu,{localeKeyPrefix:"",options:null===(c=m.original)||void 0===c||null===(p=c.activeDrivers)||void 0===p?void 0:p.map(e=>e.name),onSelect:e=>{var t;return A(e,"DRIVER",null===(t=m.original)||void 0===t?void 0:t.activeDrivers)}}))}},{Header:u("ES_FSM_REGISTRY_INBOX_ENABLED"),disableSortBy:!0,Cell:n=>{var i,a;let{row:o}=n;return l.createElement(t.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(i=o.original)||void 0===i||null===(a=i.dsoDetails)||void 0===a?void 0:a.status),onChange:()=>(t=>{var n,l,i,a;let o=t.original.dsoDetails;const r={vendor:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(n=o.owner)||void 0===n?void 0:n.gender)||"OTHER",dob:(null==o||null===(l=o.owner)||void 0===l?void 0:l.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(i=o.owner)||void 0===i?void 0:i.emailId)||"abc@egov.com",relationship:(null==o||null===(a=o.owner)||void 0===a?void 0:a.relationship)||"OTHER"}}};g(r,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"VENDOR"}),f.invalidateQueries("DSO_SEARCH"),e.refetchData(),setTimeout(C,3e3)}})})(o),name:"switch-"+o.id})}}];case"VEHICLE":return[{Header:u("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/registry/vehicle-details/"+t.original.registrationNumber},l.createElement("div",null,t.original.registrationNumber,l.createElement("br",null)))))}},{Header:u("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,l,i;let{row:a}=e;return d(null!==(t=a.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(l=a.original)||void 0===l||null===(i=l.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;return d((null===(t=l.original)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n.name)||"NA")}},{Header:u("ES_FSM_REGISTRY_INBOX_ENABLED"),disableSortBy:!0,Cell:n=>{var i;let{row:a}=n;return l.createElement(t.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(i=a.original)||void 0===i?void 0:i.status),onChange:()=>(t=>{let n=t.original;delete n.vendor;const l={vehicle:{...n,status:"ACTIVE"===(null==n?void 0:n.status)?"DISABLED":"ACTIVE"}};h(l,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"VEHICLE"}),f.invalidateQueries("FSM_VEICLES_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(C,3e3)}})})(a),name:"switch-"+a.id})}}];case"DRIVER":return[{Header:u("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),disableSortBy:!0,accessor:"tripDetails",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(a.Link,{to:"/digit-ui/employee/fsm/registry/driver-details/"+t.original.id},l.createElement("div",null,t.original.name,l.createElement("br",null)))))}},{Header:u("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,l,i;let{row:a}=e;return d(null!==(t=a.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(l=a.original)||void 0===l||null===(i=l.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),minWidth:250,Cell:n=>{let{row:i}=n;return l.createElement(t.Dropdown,{className:"fsm-registry-dropdown",selected:i.original.vendor,option:_,select:t=>((t,n)=>{let l=t.original,i=null==l?void 0:l.vendor,a=n;if(delete l.vendor,l.vendorDriverStatus="ACTIVE",i){const e=null==i?void 0:i.drivers;e.splice(e.findIndex(e=>e.id===l.id),1)}const o={vendor:{...a,drivers:a.drivers?[...a.drivers,l]:[l]}};g(o,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"VENDOR"}),f.invalidateQueries("DSO_SEARCH"),e.refetchData(),setTimeout(C,3e3)}})})(i,t),optionKey:"name",t:u,style:{textAlign:"left",width:"100%",minWidth:"250px"}})}},{Header:u("ES_FSM_REGISTRY_INBOX_ENABLED"),disableSortBy:!0,Cell:n=>{var i;let{row:a}=n;return l.createElement(t.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(i=a.original)||void 0===i?void 0:i.status),onChange:()=>(t=>{var n,l,i,a;let o=t.original;const r={driver:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(n=o.owner)||void 0===n?void 0:n.gender)||"OTHER",dob:(null==o||null===(l=o.owner)||void 0===l?void 0:l.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(i=o.owner)||void 0===i?void 0:i.emailId)||"abc@egov.com",relationship:(null==o||null===(a=o.owner)||void 0===a?void 0:a.relationship)||"OTHER"}}};I(r,{onError:(e,t)=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(t,n)=>{E({key:"success",action:"DRIVER"}),f.invalidateQueries("FSM_DRIVER_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(C,3e3)}})})(a),name:"switch-"+a.id})}}];default:return[]}},[e.selectedTab,_]);let L;if(e.isLoading)L=l.createElement(t.Loader,null);else if(0===p.length){let n="",i="";"VENDOR"===e.selectedTab?(n="ES_FSM_REGISTRY_EMPTY_CARD_VENDOR",i="ES_FSM_REGISTRY_EMPTY_BUTTON_VENDOR"):"VEHICLE"===e.selectedTab?(n="ES_FSM_REGISTRY_EMPTY_CARD_VEHICLE",i="ES_FSM_REGISTRY_EMPTY_BUTTON_VEHICLE"):(n="ES_FSM_REGISTRY_EMPTY_CARD_DRIVER",i="ES_FSM_REGISTRY_EMPTY_BUTTON_DRIVER"),L=l.createElement(t.Card,{style:{display:"flex",justifyContent:"center",minHeight:"250px"}},l.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},l.createElement("div",{style:{marginTop:"50px",marginBottom:"25px"}},u(n)),l.createElement(t.SubmitBar,{className:"",label:u(i),onSubmit:D})))}else p.length>0&&(L=l.createElement(xe,{className:"table registryTable",t:u,data:p,columns:O,getCellProps:e=>({style:{minWidth:e.column.Header===u("ES_INBOX_APPLICATION_NO")?"240px":"",padding:e.column.Header===u("ES_FSM_REGISTRY_INBOX_VENDOR_NAME")?"10px 18px":"20px 18px",fontSize:"16px"}}),onPageSizeChange:e.onPageSizeChange,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,pageSizeLimit:e.pageSizeLimit,onSort:e.onSort,disableSort:e.disableSort,sortParams:e.sortParams,totalRecords:e.totalRecords}));return l.createElement("div",{className:"inbox-container"},"FSM_EMP_FSTPO"!==e.userRole&&"FSM_ADMIN"!==e.userRole&&!e.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(Fe,{parentRoute:e.parentRoute}),l.createElement("div",{style:{marginTop:"24px"}},l.createElement(Ue,{searchParams:e.searchParams,paginationParms:e.paginationParms,applications:e.data,onFilterChange:e.onFilterChange,type:"desktop"}))),l.createElement("div",{style:{flex:1,marginLeft:"FSM_ADMIN"===e.userRole?"":"24px"}},l.createElement(ft,{onSearch:e.onSearch,type:"desktop",searchFields:e.searchFields,isInboxPage:!(null!=e&&e.isSearch),searchParams:e.searchParams,onTabChange:e.onTabChange,selectedTab:e.selectedTab}),l.createElement("div",{className:"result",style:{marginLeft:c||"FSM_ADMIN"===e.userRole||null!=e&&e.isSearch?"":"24px",flex:1}},L)),v&&l.createElement(t.Toast,{error:"error"===v.key,label:u("success"===v.key?`ES_FSM_REGISTRY_${v.action}_DISABLE_SUCCESS`:v.action),onClose:C}))},Tt=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null,t(""+n)," "))},gt=e=>l.createElement("h1",{className:"heading-m"},e.label),ht=()=>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"})),It=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ht,null)),{DatePicker:Ct}=require("@djb25/digit-ui-react-components"),Nt=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_VEHICLE_DETAILS",body:[{label:"ES_FSM_REGISTRY_VEHICLE_NUMBER",isMandatory:!0,type:"text",disable:t,populators:{name:"registrationNumber",ValidationRequired:!0,validation:{pattern:"^[A-Z]{2}-[0-9]{1,2}[A-Z]{0,2}-(?:[A-Z]{1,2}-)?[0-9]{1,4}$",title:e("ES_FSM_VEHICLE_FORMAT_TIP")},error:e("FSM_REGISTRY_INVALID_REGISTRATION_NUMBER"),defaultValue:"",className:"payment-form-text-input-correction"}},{route:"vehicle",component:"SelectVehicle",withoutLabel:!0,key:"vehicle",isMandatory:!0,type:"component"},{label:"ES_FSM_REGISTRY_VEHICLE_POLLUTION_CERT",isMandatory:!1,type:"custom",key:"pollutionCert",populators:{name:"pollutionCert",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_INSURANCE",isMandatory:!1,type:"custom",key:"insurance",populators:{name:"insurance",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_ROAD_TAX",isMandatory:!1,type:"custom",key:"roadTax",populators:{name:"roadTax",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_FITNESS",isMandatory:!1,type:"custom",key:"fitnessValidity",populators:{name:"fitnessValidity",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"ownerName",validation:{required:!0,pattern:/^[A-Za-z]/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction",labelStyle:{border:"1px solid black",borderRight:"none"}}},{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender"},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!1,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>l.createElement(Ct,s({onChange:e.onChange,date:e.value},t,{max:c((new Date).setFullYear((new Date).getFullYear()))}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VENDOR_ADDITIONAL_DETAILS",isMandatory:!1,type:"textarea",key:"additionalDetails",populators:{name:"additionalDetails",className:"payment-form-text-input-correction"}}]}]},At=e=>l.createElement("h1",{className:"heading-m"},e.label),Dt=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Ot=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dt,null)),{DatePicker:Lt}=require("@djb25/digit-ui-react-components"),Pt=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_DRIVER_DETAILS",body:[{label:"ES_FSM_REGISTRY_DRIVER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"driverName",validation:{required:!0,pattern:/^[A-Za-z]/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_DRIVER_LICENSE",isMandatory:!0,type:"text",key:"license",populators:{name:"license",validation:{required:!0,pattern:/^[a-zA-Z-]{0,}[- ]{0,1}[ 0-9]{1,}/},error:e("FSM_REGISTRY_INVALID_DRIVER_LICENSE"),required:!1,defaultValue:"",className:"payment-form-text-input-correction"}}]},{head:"ES_FSM_REGISTRY_PERSONAL_DETAILS",body:[{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!1,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>l.createElement(Lt,s({onChange:e.onChange,date:e.value},t,{max:c((new Date).setFullYear((new Date).getFullYear()))}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}}]}]},bt=(e,t)=>{const n=new Date(e);if(e){let e=n.getMonth()+1,l=n.getDate(),i=n.getFullYear();return e=(e>9?"":"0")+e,l=(l>9?"":"0")+l,"asset-create"===t?`${l}-${e}-${i}`:`${l}/${e}/${i}`}return null},Rt=function(e,n,i){var a,o;void 0===n&&(n=!1),void 0===i&&(i={});const r="EKYC"===(null===(a=i)||void 0===a||null===(o=a.serviceType)||void 0===o?void 0:o.code);return[{head:"ES_VRNDOR_NEW_VENDOR_DETAILS",isCollapsible:!0,isDefaultOpen:!0,body:[{label:"ES_FSM_REGISTRY_NEW_VENDOR_NAME",isMandatory:!0,type:"text",disable:n,populators:{name:"vendorName",validation:{required:!0,pattern:/^[A-Za-z\s.,/]+$/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VENDOR_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:n,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},labelStyle:{border:"1px solid black",borderRight:"none"},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",key:"serviceType",component:"SelectServiceType",disable:n,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{header:"CS_COMMON_CHOOSE_SERVICE_TYPE",submitBarLabel:"CS_COMMON_NEXT"}},...r?[{label:"ES_VENDOR_CONTRACT_START_DATE",isMandatory:!0,type:"custom",key:"contractStartDate",populators:{name:"contractStartDate",validation:{required:!0},component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}},{label:"ES_VENDOR_CONTRACT_END_DATE",isMandatory:!0,type:"custom",key:"contractEndDate",populators:{name:"contractEndDate",validation:{required:!0},component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n))}},{label:"ES_VENDOR_ZONE",isMandatory:!0,type:"component",key:"zoneIds",component:"SelectEkycZones"},{label:"ES_FSM_REGISTRY_NEW_OWNER_NAME",isMandatory:!0,type:"text",populators:{name:"ownerName",validation:{required:!0,pattern:/^[A-Za-z\s.,/]+$/},error:e("FSM_REGISTRY_INVALID_NAME"),className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",key:"gender",component:"SelectEkycDropdown",populators:{name:"gender",options:[{code:"MALE",name:"ES_COMMON_GENDER_MALE"},{code:"FEMALE",name:"ES_COMMON_GENDER_FEMALE"},{code:"OTHER",name:"ES_COMMON_GENDER_OTHER"}],optionsKey:"name"}},{label:"ES_FSM_REGISTRY_NEW_DOB",isMandatory:!0,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,n)=>l.createElement(t.DatePicker,s({onChange:e.onChange,date:e.value},n,{max:bt((new Date).setFullYear((new Date).getFullYear()))}))}}]:[]]},{isCreateConnection:!0,className:"new-application-card",body:[{type:"component",key:"propertyAddress",component:"CPTPropertyLocationDetails",withoutLabel:!0,props:{hidePropertySearch:!0,hideZRO:!0}}]}]},Mt={SelectPropertySubtype:e=>{var i,o;let{config:r,onSelect:u,t:s,userType:d,formData:c}=e;const{pathname:p}=a.useLocation();let v=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var E;"undefined"!==v&&(v=JSON.parse(null===(E=sessionStorage)||void 0===E?void 0:E.getItem("Digit_FSM_PT")));const _=Digit.ULBService.getStateId(),{isLoading:S,data:f}=Digit.Hooks.fsm.useMDMS(_,"FSM","PropertySubtype",{select:e=>e.map(e=>({...e,i18nKey:s(e.i18nKey)}))}),[y,T]=n.useState(),[g,h]=n.useState([]);console.log("propertyType",c),c.propertyType=(null===(o=v)||void 0===o?void 0:o.usageCategory)||c.propertyType;const{propertyType:I}=c||{};return n.useEffect(()=>{if(!S&&f){const e=null==f?void 0:f.filter(e=>{var t;return e.code===((null==c||null===(t=c.subtype)||void 0===t?void 0:t.code)||(null==c?void 0:c.subtype))})[0];"string"==typeof I&&(null==e?void 0:e.code.split(".")[0])===I||(null==e?void 0:e.code.split(".")[0])===(null==I?void 0:I.code)?T(e):T(null)}},[I,null==c?void 0:c.subtype,f]),n.useEffect(()=>{if(console.log("propertyType2222",I),!S&&I){const e=f.filter(e=>e.propertyType===((null==I?void 0:I.code)||I));h(e)}},[I,S,f]),S?l.createElement(t.Loader,null):"employee"===d?l.createElement(t.Dropdown,{option:null==g?void 0:g.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"i18nKey",id:"propertySubType",selected:y,select:function(e){u(r.key,e.code)},t:s,disable:!p.includes("/modify-application/")&&!p.includes("/new-application")}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:r,onSelect:()=>{sessionStorage.removeItem("Digit.total_amount"),u(r.key,y)},isDisabled:!y,t:s},l.createElement(t.CardLabel,null,s("CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL")+" *"),l.createElement(t.RadioOrSelect,{options:null==g?void 0:g.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:y,optionKey:"i18nKey",onSelect:e=>{T(e)},t:s})))},SelectPropertyType:e=>{var i,o,r,u;let{config:s,onSelect:d,t:c,userType:p,formData:v}=e;const{pathname:E}=a.useLocation(),_=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),S=Digit.Hooks.fsm.useMDMS(_,"FSM","PropertyType",{select:e=>e.map(e=>({...e,i18nKey:c(e.i18nKey)}))});let f=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var y;"undefined"!==f&&(f=JSON.parse(null===(y=sessionStorage)||void 0===y?void 0:y.getItem("Digit_FSM_PT")));const T=(null===(o=f)||void 0===o||null===(r=o.propertyDetails)||void 0===r?void 0:r.usageCategory)||(null===(u=f)||void 0===u?void 0:u.usageCategory);console.log("formData",v);const[g,h]=n.useState((null==v?void 0:v.propertyType)||"");return n.useEffect(()=>{if("employee"===p&&f&&S.data){let e=[];e=null==S?void 0:S.data.filter(e=>e.code==(null==v?void 0:v.propertyType)),console.log("SSSSSS",e,S),e.length>0&&(d(s.key,e[0].code),h(e[0]))}var e,t,n,l,i,a;f&&(console.log("property",f,S),"COMMERCIAL"!=(null===(e=f)||void 0===e||null===(t=e.propertyDetails)||void 0===t?void 0:t.usageCategory)&&"RESIDENTIAL"!=(null===(n=f)||void 0===n||null===(l=n.propertyDetails)||void 0===l?void 0:l.usageCategory)&&"INSTITUTIONAL"!=(null===(i=f)||void 0===i||null===(a=i.propertyDetails)||void 0===a?void 0:a.usageCategory)||h(T))},[S.isLoading]),n.useEffect(()=>{if(console.log("usageType",T),!S.isLoading&&S.data&&T){const e=S.data.filter(e=>{var t;return e.code===(T||(null==v||null===(t=v.propertyType)||void 0===t?void 0:t.code)||(null==v?void 0:v.propertyType))})[0];console.log("preFilledPropertyType",e),void 0!==e&&h(e)}},[f,null==v?void 0:v.propertyType,S.data]),console.log("propertyType",g),S.isLoading?l.createElement(t.Loader,null):"employee"===p?l.createElement(t.Dropdown,{option:null===(I=S.data)||void 0===I?void 0:I.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"i18nKey",id:"propertyType",selected:g,select:function(e){d(s.key,e.code)},t:c,disable:!(E.includes("/modify-application/")||E.includes("/new-application")&&void 0!==g)}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:s,onSelect:()=>{sessionStorage.removeItem("Digit.total_amount"),d(s.key,g)},isDisabled:!g,t:c},l.createElement(t.CardLabel,null,c("CS_FILE_APPLICATION_PROPERTY_LABEL")+" *"),l.createElement(t.RadioOrSelect,{options:null===(C=S.data)||void 0===C?void 0:C.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:g,optionKey:"i18nKey",onSelect:function(e){console.log("vvv",e),h(e)},t:c})),g&&l.createElement(t.CitizenInfoLabel,{info:c("CS_FILE_APPLICATION_INFO_LABEL"),text:c("CS_FILE_APPLICATION_INFO_TEXT",{content:c("CS_DEFAULT_INFO_TEXT"),...g})}));var I,C},SelectPropertyID:e=>{var i,a;let{t:o,config:r,onSelect:u,formData:s,userType:d}=e;const[c,p]=n.useState((null==s||null===(i=s.propertyID)||void 0===i?void 0:i.propertyID)||""),[v,E]=n.useState(!1),[_,S]=n.useState(""),f=[{type:"text",name:"propertyID",placeholder:"Enter a valid property ID",validation:{maxLength:256}}];function y(e){p(e.target.value),"employee"===d&&u(r.key,{...s[r.key],propertyID:e.target.value})}return n.useEffect(()=>{var e;p(null==s||null===(e=s.additionalDetails)||void 0===e?void 0:e.propertyID)},[null==s||null===(a=s.additionalDetails)||void 0===a?void 0:a.propertyID]),"employee"===d?l.createElement(t.TextInput,{className:"form-field",id:"propertyID",value:c,onChange:y,t:o}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(_e,{t:o,config:{...r,inputs:f},value:c,onSelect:e=>u(r.key,{...s[r.key],...e}),placeholder:f.placeholder,onChange:y,onSkip:()=>u(),forcedError:o(_),isDisabled:!1}))},FSMSelectAddress:e=>{let{t:i,config:o,onSelect:r,userType:u,formData:s}=e;const d=Digit.Hooks.fsm.useTenants();let c=Digit.ULBService.getCurrentTenantId();var p;"employee"!==u&&(c=null===(p=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===p?void 0:p.code);const v=a.useLocation(),E=v.pathname.includes("new-vendor"),_=v.pathname.includes("modify-vendor"),S=[{active:!0,code:"WITHIN_ULB_LIMITS",i18nKey:"WITHIN_ULB_LIMITS",name:"Witnin ULB Limits"},{active:!0,code:"FROM_GRAM_PANCHAYAT",i18nKey:"FROM_GRAM_PANCHAYAT",name:"From Gram Panchayat"}];s&&s.address&&(s.address.hasOwnProperty("propertyLocation")||(s.address.propertyLocation=S[0]));const{pincode:f}=(null==s?void 0:s.address)||"",y="employee"===u?d.filter(e=>e.code===c):f?d.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==f)}):d,[T,g]=n.useState(()=>{var e;return(null==s||null===(e=s.address)||void 0===e?void 0:e.city)||Digit.SessionStorage.get("fsm.file.address.city")||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY")}),[h,I]=n.useState(),{data:C}=Digit.Hooks.useBoundaryLocalities(null==T?void 0:T.code,"revenue",{enabled:!!T},i),{data:N}=Digit.Hooks.fsm.useMDMS(c,"FSM","UrcConfig"),A=N&&N.length>0&&N[0].URCEnable,[D,O]=n.useState(()=>{var e,t;return null!=s&&null!==(e=s.address)&&void 0!==e&&e.propertyLocation?null==s||null===(t=s.address)||void 0===t?void 0:t.propertyLocation:Digit.SessionStorage.get("locationType")?Digit.SessionStorage.get("locationType"):S[0]}),[L,P]=n.useState(),[b,R]=n.useState();function M(e){R(null),P(null),Digit.SessionStorage.set("fsm.file.address.city",e),g(e)}function k(e){O(e),Digit.SessionStorage.set("locationType",e),"employee"===u&&("FROM_GRAM_PANCHAYAT"===e.code?(r("tripData",{...s.tripData,amountPerTrip:"",amount:""}),r(o.key,{...s[o.key],propertyLocation:e})):r(o.key,{...s[o.key],propertyLocation:e}))}var w,F;return n.useEffect(()=>{y&&1===y.length&&g(y[0])},[y]),n.useEffect(()=>{if(T&&D&&"employee"===u&&r(o.key,{...s[o.key],city:T,propertyLocation:D}),(!A||E||_)&&T&&C){var e,t;let l=C,i=[];var n;null!=s&&null!==(e=s.address)&&void 0!==e&&e.locality&&R(s.address.locality),null!=s&&null!==(t=s.address)&&void 0!==t&&t.pincode&&(i=l.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==s.address.pincode)}),null!=s&&null!==(n=s.address)&&void 0!==n&&n.locality||R()),"employee"===u&&r(o.key,{...s[o.key],city:T}),P(()=>i.length>0?i:l),1===i.length&&(R(i[0]),"employee"===u&&r(o.key,{...s[o.key],locality:i[0]}))}},[T,D,C]),"employee"===u?l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i("MYCITY_CODE_LABEL"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:1===(null==y?void 0:y.length)?y[0]:T,disable:1===(null==y?void 0:y.length),option:y,select:M,optionKey:"code",t:i})),!A||E||_?l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i("ES_NEW_APPLICATION_LOCATION_MOHALLA"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:b,option:L,select:function(e){R(e),"employee"===u&&r(o.key,{...s[o.key],locality:e})},optionKey:"i18nkey",t:i})),!E&&!_&&!A&&"Other"===(null==s||null===(w=s.address)||void 0===w||null===(F=w.locality)||void 0===F?void 0:F.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"newLocality",key:"newLocality",value:h,onChange:e=>{return I(t=e.target.value),void("employee"===u&&r(o.key,{...s[o.key],newLocality:t}));var t}})))):l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,i("CS_PROPERTY_LOCATION")+" *"),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{selectedOption:D,onSelect:k,style:{display:"flex",marginBottom:0},innerStyles:{marginLeft:"10px"},options:S,optionsKey:"i18nKey"})))):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:o,onSelect:function(){r(o.key,{city:T,propertyLocation:Digit.SessionStorage.get("locationType")?Digit.SessionStorage.get("locationType"):D})},t:i,isDisabled:!D},A&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,i("CS_PROPERTY_LOCATION")+" *"),l.createElement(t.RadioOrSelect,{isMandatory:o.isMandatory,options:S,selectedOption:Digit.SessionStorage.get("locationType")?Digit.SessionStorage.get("locationType"):D,optionKey:"i18nKey",onSelect:k,t:i})),l.createElement(t.CardLabel,null,i("MYCITY_CODE_LABEL")+" *"),l.createElement(t.RadioOrSelect,{options:y,selectedOption:T,optionKey:"i18nKey",onSelect:M,t:i})))},FSMSelectStreet:e=>{var i,a,r,u,d,c,p,v;let{t:E,config:_,onSelect:S,userType:f,formData:y,formState:T,setError:g,clearErrors:h}=e;const[I,C]=n.useState({index:-1,type:""});let N=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var A;"undefined"!==N&&(N=JSON.parse(null===(A=sessionStorage)||void 0===A?void 0:A.getItem("Digit_FSM_PT")));const{control:D,formState:O,watch:L,setValue:P,getValues:b,trigger:R}=o.useForm(),M=L(),{errors:k}=O,[w,F]=(window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details")||window.location.href.includes("tl/edit-application-details/")||window.location.href.includes("/tl/tradelicence/new-application/street")||window.location.href.includes("/tl/tradelicence/renew-trade")||window.location.href.includes("/tl/tradelicence/edit-application"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useState(null===(a=N)||void 0===a||null===(r=a.propertyDetails)||void 0===r||null===(u=r.address)||void 0===u?void 0:u.street)),[x,H]=n.useState(null===(d=N)||void 0===d||null===(c=d.propertyDetails)||void 0===c||null===(p=c.address)||void 0===p?void 0:p.doorNo);let V;window.location.href.includes("tl")?(V=_.inputs,_.inputs[0].disable=window.location.href.includes("edit-application"),_.inputs[1].disable=window.location.href.includes("edit-application"),V[0].validation={minLength:0,maxLength:256},V[1].validation={minLength:0,maxLength:256}):V=[{label:"PT_PROPERTY_ADDRESS_STREET_NAME",type:"text",name:"street",isMandatory:!0,validation:{pattern:"[a-zA-Z0-9 ]{1,255}",title:E("CORE_COMMON_STREET_INVALID")}},{label:"PT_PROPERTY_ADDRESS_HOUSE_NO",type:"text",name:"doorNo",isMandatory:!0,validation:{pattern:"[A-Za-z0-9#,/ -]{1,63}",title:E("CORE_COMMON_DOOR_INVALID")}}];const B=e=>{let{validation:t,name:n,messages:l}=e;if(t){let{pattern:e,maxlength:i,minlength:a,required:o}=t||{};return{pattern:t=>{if(e){var i;if(e instanceof RegExp)return!!e.test(t)||(null==l?void 0:l.pattern)||n.toUpperCase()+"_PATTERN";if("string"==typeof e)return!(null===(i=new RegExp(e))||void 0===i||!i.test(t))||(null==l?void 0:l.pattern)||n.toUpperCase()+"_PATTERN"}return!0},required:e=>!o||!!e||(null==l?void 0:l.required)||n.toUpperCase()+"_REQUIRED",minLength:e=>!a||(null==e?void 0:e.length)>=a||(null==l?void 0:l.minlength)||n.toUpperCase()+"_MINLENGTH",maxLength:e=>!i||(null==e?void 0:e.length)<=i||(null==l?void 0:l.maxlength)||n.toUpperCase()+"_MAXLENGTH"}}return{}};var U;return n.useEffect(()=>{var e,t,n,l,i,a,o;window.location.href.includes("employee/fsm/")&&null!=y&&null!==(e=y.cpt)&&void 0!==e&&e.details&&(P("doorNo",null==y||null===(t=y.cpt)||void 0===t||null===(n=t.details)||void 0===n||null===(l=n.address)||void 0===l?void 0:l.doorNo),P("street",null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o.street))},[y]),n.useEffect(()=>{R()},[]),n.useEffect(()=>{var e,t,n,l;null!=y&&null!==(e=y.address)&&void 0!==e&&e.doorNo&&H(null==y||null===(t=y.address)||void 0===t?void 0:t.doorNo),null!=y&&null!==(n=y.address)&&void 0!==n&&n.street&&F(null==y||null===(l=y.address)||void 0===l?void 0:l.street)},[null==y?void 0:y.address]),n.useEffect(()=>{var e;"employee"===f&&(Object.keys(k).length&&!Se.isEqual((null===(e=T.errors[_.key])||void 0===e?void 0:e.type)||{},k)?g(_.key,{type:k}):!Object.keys(k).length&&T.errors[_.key]&&h(_.key))},[k]),n.useEffect(()=>{const e=Object.keys(M),t={};e.forEach(e=>{var n;return t[e]=null===(n=y[_.key])||void 0===n?void 0:n[e]}),Se.isEqual(M,t)||(S(_.key,{...y[_.key],...M}),R())},[M]),n.useEffect(()=>{var e,t;null!=y&&null!==(e=y.cpt)&&void 0!==e&&e.details&&window.location.href.includes("fsm")&&(null===(t=V)||void 0===t||t.map(e=>{var t,n,l,i,a,o,r,u,s,d,c,p,m,v;b(e.name)!==(null==y||null===(t=y.cpt)||void 0===t||null===(n=t.details)||void 0===n||null===(l=n.address)||void 0===l?void 0:l[e.name])&&P(e.name,null===(null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o[e.name])||""===(null==y||null===(r=y.cpt)||void 0===r||null===(u=r.details)||void 0===u||null===(s=u.address)||void 0===s?void 0:s[e.name])?null!=y&&null!==(d=y.address)&&void 0!==d&&d[e.name]?null==y||null===(c=y.address)||void 0===c?void 0:c[e.name]:"":null==y||null===(p=y.cpt)||void 0===p||null===(m=p.details)||void 0===m||null===(v=m.address)||void 0===v?void 0:v[e.name])}))},[null==y||null===(v=y.cpt)||void 0===v?void 0:v.details]),"employee"===f?null===(U=V)||void 0===U?void 0:U.map((e,n)=>{var i,a,r,u;return l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},E(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,defaultValue:(null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(r=a.address)||void 0===r?void 0:r[null==e?void 0:e.name])||(null==y||null===(u=y.address)||void 0===u?void 0:u[e.name]),name:e.name,rules:{validate:B(e)},render:i=>{var a,o,r,u,d,c,p,m,v,E,_,S,f,T,g,h;return l.createElement("div",{style:{display:"flex",alignItems:"baseline",marginRight:"unset"}},l.createElement(t.TextInput,s({id:e.name,key:e.name,value:i.value,onChange:e=>{C({index:n}),i.onChange(e.target.value)},onBlur:i.onBlur,disable:!(null==y||null===(a=y.cpt)||void 0===a||null===(o=a.details)||void 0===o||null===(r=o.address)||void 0===r||!r[e.name]),autoFocus:(null==I?void 0:I.index)==n},null==e?void 0:e.validation)),l.createElement("div",{style:{marginRight:"-50px",marginLeft:"10px"}},l.createElement(t.WrapUnMaskComponent,{unmaskField:e=>{i.onChange(e)},iseyevisible:!!(i.value?null===(u=i.value)||void 0===u?void 0:u.includes("*"):null==y||null===(d=y.cpt)||void 0===d||null===(c=d.details)||void 0===c||null===(p=c.address)||void 0===p||null===(m=p[e.name])||void 0===m?void 0:m.includes("*")),privacy:{uuid:null==y||null===(v=y.cpt)||void 0===v||null===(E=v.details)||void 0===E||null===(_=E.owners)||void 0===_||null===(S=_[0])||void 0===S?void 0:S.uuid,fieldName:[e.name],model:"Property",loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:null==y||null===(f=y.cpt)||void 0===f||null===(T=f.details)||void 0===T?void 0:T.tenantId,propertyIds:null==y||null===(g=y.cpt)||void 0===g||null===(h=g.details)||void 0===h?void 0:h.propertyId},jsonPath:"Properties[0].address."+e.name,isArray:!1}}})))}})))}):l.createElement(l.Fragment,null,window.location.href.includes("/fsm")?l.createElement(m,{currentStep:2}):l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:{..._,inputs:V},isMandatory:!0,_defaultValues:{street:N.propertyDetails.address.street,doorNo:N.propertyDetails.address.doorNo},onChange:e=>{let{name:t}=e.target,{value:n}=e.target;"street"===t?F(n):H(n)},onSelect:e=>S(_.key,e),onSkip:()=>S(),isDisabled:!x&&!w,t:E}))},FSMSelectLandmark:e=>{var i,a,o,r,u;let{t:d,config:c,onSelect:p,formData:v,userType:E}=e,_=null===(i=sessionStorage)||void 0===i?void 0:i.getItem("Digit_FSM_PT");var S;"undefined"!==_&&(_=JSON.parse(null===(S=sessionStorage)||void 0===S?void 0:S.getItem("Digit_FSM_PT")));const[f,y]=n.useState(null===(a=_)||void 0===a||null===(o=a.propertyDetails)||void 0===o||null===(r=o.address)||void 0===r?void 0:r.landmark),[T,g]=n.useState(""),h=[{label:"ES_NEW_APPLICATION_LOCATION_LANDMARK",type:"textarea",name:"landmark",validation:{maxLength:1024}}];function I(e){e.target.value.length>1024?g("CS_COMMON_LANDMARK_MAX_LENGTH"):(g(null),y(e.target.value),"employee"===E&&p(c.key,{...v[c.key],landmark:e.target.value}))}return n.useEffect(()=>{var e;y(null==v||null===(e=v.address)||void 0===e?void 0:e.landmark)},[null==v||null===(u=v.address)||void 0===u?void 0:u.landmark]),"employee"===E?null==h?void 0:h.map((e,n)=>l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},d(e.label),c.isMandatory?" * ":null),l.createElement(t.TextArea,s({className:"form-field",id:e.name,value:f,onChange:I,name:e.name||""},e.validation)))):l.createElement(l.Fragment,null,window.location.href.includes("/pt")?l.createElement(m,{currentStep:1,flow:"PT_APPLY"}):window.location.href.includes("/tl")?l.createElement(m,{currentStep:2}):l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:{...c,inputs:h},value:f,onChange:I,onSelect:e=>p(c.key,{...v[c.key],...e}),t:d,forcedError:d(T),isDisabled:!1}))},FSMSelectPincode:e=>{var i,o,r,u,d,c,p,v,E,_,S,f,y;let{t:T,config:g,onSelect:h,formData:I={},userType:C}=e;const N=Digit.Hooks.fsm.useTenants(),[A,D]=n.useState((null==I||null===(i=I.cpt)||void 0===i||null===(o=i.details)||void 0===o||null===(r=o.address)||void 0===r?void 0:r.pincode)||(null==I||null===(u=I.address)||void 0===u?void 0:u.pincode)||""),[O,L]=n.useState(null),{pathname:P}=a.useLocation();P.includes("modify");let b=null===(d=sessionStorage)||void 0===d?void 0:d.getItem("Digit_FSM_PT");var R;"undefined"!==b&&(b=JSON.parse(null===(R=sessionStorage)||void 0===R?void 0:R.getItem("Digit_FSM_PT")));const M=[{label:"CORE_COMMON_PINCODE",type:"text",name:"pincode",validation:{minlength:6,maxlength:6,pattern:"^[1-9][0-9]*",max:"9999999",title:T("CORE_COMMON_PINCODE_INVALID")}}];function k(e){if(D(e.target.value),L(null),"employee"===C)if(null==N?void 0:N.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)})){const t=N.filter(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==e.target.value)})[0];h(g.key,{...I.address,city:t,pincode:e.target.value,slum:null})}else h(g.key,{...I.address,pincode:e.target.value}),L("CS_COMMON_PINCODE_NOT_SERVICABLE")}return n.useEffect(()=>{var e,t,n,l,i,a;null!==(e=b)&&void 0!==e&&null!==(t=e.propertyDetails)&&void 0!==t&&null!==(n=t.address)&&void 0!==n&&n.pincode&&D(null===(l=b)||void 0===l||null===(i=l.propertyDetails)||void 0===i||null===(a=i.address)||void 0===a?void 0:a.pincode)},[null===(c=b)||void 0===c||null===(p=c.propertyDetails)||void 0===p||null===(v=p.address)||void 0===v?void 0:v.pincode]),n.useEffect(()=>{var e,t,n,l;if(null!=I&&null!==(e=I.address)&&void 0!==e&&e.pincode)D(I.address.pincode);else if(null!=I&&null!==(t=I.cpt)&&void 0!==t&&null!==(n=t.details)&&void 0!==n&&null!==(l=n.address)&&void 0!==l&&l.pincode){var i,a,o;D(null==I||null===(i=I.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o.pincode)}},[null==I||null===(E=I.address)||void 0===E?void 0:E.pincode,null==I||null===(_=I.cpt)||void 0===_||null===(S=_.details)||void 0===S||null===(f=S.address)||void 0===f?void 0:f.pincode]),n.useEffect(()=>{var e,t,n,l;(null==I||null===(e=I.address)||void 0===e||null===(t=e.locality)||void 0===t?void 0:t.pincode)!==A&&"employee"===C&&(D((null==I||null===(n=I.address)||void 0===n||null===(l=n.locality)||void 0===l?void 0:l.pincode)||""),L(null))},[null==I||null===(y=I.address)||void 0===y?void 0:y.locality]),n.useEffect(()=>{"employee"===C&&A&&h(g.key,{...I.address,pincode:(null==A?void 0:A[0])||A})},[A]),"employee"===C?null==M?void 0:M.map((e,i)=>l.createElement(n.Fragment,null,l.createElement(t.LabelFieldPair,{key:i},l.createElement(t.CardLabel,{className:"card-label-smaller"},T(e.label),g.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({key:e.name,value:A,onChange:k},e.validation)))),O&&l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},T(O)))):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{t:T,config:{...g,inputs:M},onSelect:function(e){try{return(null==N?void 0:N.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))}))?h(g.key,{pincode:A}):L("CS_COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:A,onChange:k,onSkip:()=>h(),forcedError:T(O),isDisabled:!A}))},SelectTankSize:e=>{var i,a;let{config:o,onSelect:r,t:u,formData:s={},userType:d}=e;const c=Digit.ULBService.getCurrentTenantId(),p=null==s||null===(i=s.pitType)||void 0===i?void 0:i.dimension,[v,E]=n.useState(!0),[_,S]=n.useState((null==s||null===(a=s.pitDetail)||void 0===a?void 0:a.images)||null),[f,y]=n.useState();return n.useEffect(()=>{null!=s&&s.pitType||"employee"===d||r(o.key,{},!0)},[]),n.useEffect(()=>{var e,t,n;(e=>"lbd"===e)(p)?y({...null==s?void 0:s.pitDetail,diameter:0,...0===(null==s||null===(e=s.pitDetail)||void 0===e?void 0:e.length)&&{height:0}}):y({...null==s?void 0:s.pitDetail,length:0,width:0,...0===(null==s||null===(t=s.pitDetail)||void 0===t?void 0:t.diameter)&&{height:0}}),s&&s.pitDetail&&S((null==s||null===(n=s.pitDetail)||void 0===n?void 0:n.images)||null)},[p]),n.useEffect(()=>{_&&_.length&&E(!1)},[_]),"employee"===d?l.createElement(t.PitDimension,{sanitationType:s.pitType,size:f,handleChange:e=>{const{name:t,value:n}=e.target;isNaN(n)||(y(e=>({...e,[t]:n})),"employee"===d&&setTimeout(r(o.key,{...f,[t]:n})))},t:u,disable:!(null!=s&&s.pitType)}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:o,onSkip:()=>r(),onSelect:()=>{r(o.key,{images:_})},isDisabled:v,t:u},l.createElement(t.ImageUploadHandler,{tenantId:c,onPhotoChange:e=>{S(e)},uploadedImages:_})))},SelectPitType:e=>{let{t:i,formData:a,config:o,onSelect:r,userType:u}=e;Digit.ULBService.getCurrentTenantId();const s=Digit.ULBService.getStateId(),[d,c]=n.useState(null==a?void 0:a.pitType),{data:p,isLoading:v}=Digit.Hooks.fsm.useMDMS(s,"FSM","PitType"),E=e=>{c(e),"employee"===u&&(r(o.key,e),r("pitDetail",null))};return v?l.createElement(t.Loader,null):"employee"===u?l.createElement(t.Dropdown,{isMandatory:!0,option:null==p?void 0:p.sort((e,t)=>e.name.localeCompare(t.name)),optionKey:"i18nKey",select:E,selected:d,t:i}):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:o,onSelect:()=>{r(o.key,d)},onSkip:()=>{r()},isDisabled:!d,t:i},l.createElement(t.CardLabel,null,i("CS_FILE_APPLICATION_PIT_TYPE_LABEL")),l.createElement(t.RadioOrSelect,{isMandatory:o.isMandatory,options:null==p?void 0:p.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:d,optionKey:"i18nKey",onSelect:E,t:i})))},SelectRoadDetails:e=>{var t,i,a,r;let{t:u,config:s,onSelect:d,formData:c}=e;const[p,v]=n.useState({index:-1,type:""}),{watch:E,trigger:_}=o.useForm(),S=E(),[f,y]=n.useState((null==c||null===(t=c.roadWidth)||void 0===t?void 0:t.distancefromroad)||""),[T,g]=n.useState((null==c||null===(i=c.roadWidth)||void 0===i?void 0:i.roadWidth)||"");let h;return window.location.href.includes("tl")?(h=s.inputs,s.inputs[0].disable=window.location.href.includes("edit-application"),s.inputs[1].disable=window.location.href.includes("edit-application"),h[0].validation={minLength:0,maxLength:256},h[1].validation={minLength:0,maxLength:256}):h=[{label:"ES_NEW_APPLICATION_ROAD_WIDTH",type:"text",name:"roadWidth",isMandatory:!0,placeholder:"Enter road width in meters",validation:{maxlength:256,title:u("CORE_COMMON_ROADWIDTH_INVALID")}},{label:"ES_NEW_APPLICATION_DISTANCE_FROM_ROAD",type:"text",name:"distancefromroad",isMandatory:!0,placeholder:"Enter distance of pit from road",validation:{maxlength:256,title:u("CORE_COMMON_DISTANCE_INVALID")}}],n.useEffect(()=>{_()},[]),n.useEffect(()=>{var e,t,n,l;null!=c&&null!==(e=c.roadCharges)&&void 0!==e&&e.distance&&y(null==c||null===(t=c.roadCharges)||void 0===t?void 0:t.distance),null!=c&&null!==(n=c.roadCharges)&&void 0!==n&&n.roadWidth&&g(null==c||null===(l=c.roadCharges)||void 0===l?void 0:l.roadWidth)},[null==c?void 0:c.roadCharges]),n.useEffect(()=>{const e=Object.keys(S),t={};e.forEach(e=>{var n;return t[e]=null===(n=c[s.key])||void 0===n?void 0:n[e]}),Se.isEqual(S,t)||(d(s.key,{...c[s.key],...S}),_())},[S]),l.createElement(l.Fragment,null,window.location.href.includes("/tl")?l.createElement(m,{currentStep:2}):l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(_e,{config:{...s,inputs:h},isMandatory:!0,_defaultValues:{roadWidth:(null==c||null===(a=c.roadWidth)||void 0===a?void 0:a.roadWidth)||"",distancefromroad:(null==c||null===(r=c.roadWidth)||void 0===r?void 0:r.distancefromroad)||""},onChange:e=>{let{name:t}=e.target,{value:n}=e.target;"roadWidth"===t?g(n):y(n)},onSelect:e=>d(s.key,e),isDisabled:!T||!f,t:u,onSkip:()=>d()}))},SelectTripNo:e=>{var i,a,o;let{config:r,formData:u,t:s,onSelect:d,userType:c}=e;const p=Digit.ULBService.getStateId(),m=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),v=null===(i=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===i?void 0:i.code,{data:E,isLoading:_}=Digit.Hooks.fsm.useMDMS(m,"FSM","TripNumber"),{data:S}=Digit.Hooks.fsm.useDsoSearch(v,{limit:-1,status:"ACTIVE"}),{data:f}=Digit.Hooks.fsm.useMDMS(p,"Vehicle","VehicleType",{staleTime:Infinity}),[y,T]=n.useState(null==u?void 0:u.tripNo),[g,h]=n.useState(null==u?void 0:u.capacity),[I,C]=n.useState([]);return n.useEffect(()=>{if(S&&f){const e=S.reduce((e,t)=>t.vehicles&&t.vehicles.length?e.concat(t.vehicles):e,[]),t=Array.from(new Set(e.map(e=>e.capacity))).map(t=>e.find(e=>e.capacity===t));C(t)}},[S,f]),n.useEffect(()=>{if(!_&&E){const e=E.filter(e=>{var t,n;return e.code===((null==u||null===(t=u.selectTripNo)||void 0===t||null===(n=t.tripNo)||void 0===n?void 0:n.code)||(null==u?void 0:u.selectTripNo))})[0];T(e||E.find(e=>1===e.code))}},[null==u||null===(a=u.selectTripNo)||void 0===a?void 0:a.tripNo,E]),n.useEffect(()=>{if(!_&&I){const e=I.filter(e=>{var t,n;return e.capacity===(null==u||null===(t=u.selectTripNo)||void 0===t||null===(n=t.vehicleCapacity)||void 0===n?void 0:n.capacity)})[0];let t=I.reduce((e,t)=>e.capacity<t.capacity?e:t,0);h(e||t)}},[null==u||null===(o=u.selectTripNo)||void 0===o?void 0:o.vehicleCapacity,I]),_||0===I.length?l.createElement(t.Loader,null):"employee"===c?null:l.createElement(l.Fragment,null,l.createElement(t.FormStep,{config:r,onSelect:()=>{y&&d(r.key,{tripNo:y,vehicleCapacity:g})},onSkip:()=>{y&&d(r.key,{tripNo:y,vehicleCapacity:g})},isDisabled:!y&&!g,t:s},l.createElement(t.CardText,null," ",s("ES_FSM_NUMBER_OF_TRIPS")," "),l.createElement(t.RadioOrSelect,{options:E,selectedOption:y,optionKey:"i18nKey",onSelect:e=>{if(T(e),"employee"===c)return null},optionCardStyles:{zIndex:"60"},t:s,isMandatory:r.isMandatory}),l.createElement(t.CardText,null," ",s("ES_VEHICLE CAPACITY")," "),l.createElement(t.RadioOrSelect,{options:null==I?void 0:I.map(e=>({...e,label:e.capacity})).sort((e,t)=>e.capacity-t.capacity),selectedOption:g,optionKey:"capacity",onSelect:e=>{if(h(e),"employee"===c)return null},optionCardStyles:{zIndex:"60"},t:s,isMandatory:r.isMandatory,isDropDown:!0})))},FSMSelectGeolocation:e=>{var i,a;let{t:o,config:r,onSelect:u,formData:s={}}=e;const[d,c]=n.useState((null==s||null===(i=s.address)||void 0===i?void 0:i.pincode)||""),[p,v]=n.useState((null==s||null===(a=s.address)||void 0===a?void 0:a.geoLocation)||{}),E=Digit.Hooks.fsm.useTenants(),[_,S]=n.useState(null);return l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.LocationSearchCard,{header:o("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_HEADER"),cardText:o("CS_ADDCOMPLAINT_SELECT_GEOLOCATION_TEXT"),nextText:o("CS_COMMON_NEXT"),skipAndContinueText:o("CORE_COMMON_SKIP_CONTINUE"),skip:()=>u(),t:o,position:p,onSave:()=>u(r.key,{geoLocation:p,pincode:d}),onChange:(e,t)=>((e,t)=>{S(null),(null==E?void 0:E.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==e)}))?(c(e),v(t)):(S("CS_COMMON_PINCODE_NOT_SERVICABLE"),c(""),v({}))})(e,t),disabled:""===d,forcedError:o(_)}))},SelectSlumName:e=>{var i,a,o,r,u,s,d;let{config:c,onSelect:p,t:v,userType:E,formData:_}=e;const S=Digit.ULBService.getCurrentTenantId(),[f,y]=(Digit.ULBService.getStateId(),n.useState()),T=null!=_&&null!==(i=_.address)&&void 0!==i&&i.city?null==_||null===(a=_.address)||void 0===a?void 0:a.city.code:S,{data:g,isLoading:h}=Digit.Hooks.fsm.useMDMS(T,"FSM","Slum"),[I,C]=n.useState();return n.useEffect(()=>{var e,t;"employee"!==E&&!1===(null==_||null===(e=_.address)||void 0===e||null===(t=e.slumArea)||void 0===t?void 0:t.code)&&p(c.key,{slumData:null,slum:null},!0)},[null==_||null===(o=_.address)||void 0===o?void 0:o.slumArea]),n.useEffect(()=>{if(I&&null!=_&&_.address){const e=I.filter(e=>{var t;return e.code===(null==_||null===(t=_.address)||void 0===t?void 0:t.slum)})[0];y(e)}},[null==_||null===(r=_.address)||void 0===r?void 0:r.slum,I]),n.useEffect(()=>{var e,t;const n=null==_||null===(e=_.address)||void 0===e||null===(t=e.locality)||void 0===t?void 0:t.code;if("employee"===E&&!h&&g){var l;const e=g[n]?[{code:null,active:!0,name:"Not residing in slum area",i18nKey:"ES_APPLICATION_NOT_SLUM_AREA"},...g[n]]:[{code:null,active:!0,name:"Not residing in slum area",i18nKey:"ES_APPLICATION_NOT_SLUM_AREA"},...Object.keys(g).map(e=>g[e]).reduce((e,t)=>[...e,...t])];C(e),null!=_&&null!==(l=_.address)&&void 0!==l&&l.slum||(y({code:null,active:!0,name:"Not residing in slum area",i18nKey:"ES_APPLICATION_NOT_SLUM_AREA"}),p(c.key,{..._[c.key],slum:null}))}if("employee"!==E&&!h&&g){const e=Object.keys(g).map(e=>g[e]).reduce((e,t)=>[...e,...t]);C(g[n]?g[n]:e)}},[h,null==_||null===(u=_.address)||void 0===u||null===(s=u.locality)||void 0===s?void 0:s.code]),h?l.createElement(t.Loader,null):"employee"===E?"FROM_GRAM_PANCHAYAT"!==(null==_||null===(d=_.address)||void 0===d?void 0:d.propertyLocation)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},v("ES_NEW_APPLICATION_SLUM_NAME")),l.createElement(t.Dropdown,{t:v,option:I,className:"form-field",optionKey:"i18nKey",id:"slum",selected:f,select:function(e){y(e),p(c.key,{..._[c.key],slum:e.code})}})):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{t:v,config:c,onSelect:function(){sessionStorage.removeItem("Digit.total_amount"),p(c.key,{..._[c.key],slum:f.code,slumData:f})},onSkip:function(){p()}},l.createElement(t.Dropdown,{t:v,option:I,optionKey:"i18nKey",id:"i18nKey",selected:f,select:y})))},CheckSlum:e=>{var i,a,o;let{t:r,config:u,onSelect:s,formData:d}=e;Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId();const[c,p]=n.useState(null==d||null===(i=d.address)||void 0===i?void 0:i.slumArea),v=(null==d||null===(a=d.address)||void 0===a||null===(o=a.locality)||void 0===o||o.code.split("_"),()=>s());return n.useEffect(()=>{var e;"FROM_GRAM_PANCHAYAT"===(null==d||null===(e=d.address)||void 0===e?void 0:e.propertyLocation)&&v()},[d]),l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{t:r,config:u,onSelect:function(){sessionStorage.removeItem("Digit.total_amount"),s(u.key,{slumArea:c})},onSkip:v,isDisabled:!c},l.createElement(t.RadioOrSelect,{isMandatory:u.isMandatory,options:[{code:!0,i18nKey:"CS_COMMON_YES"},{code:!1,i18nKey:"CS_COMMON_NO"}],selectedOption:c,optionKey:"i18nKey",onSelect:p})))},FSMCard:()=>{const{t:e}=i.useTranslation(),a=Digit.UserService.hasAccess(["FSM_DSO"])||!1,o=Digit.UserService.hasAccess("FSM_COLLECTOR")||!1,r=Digit.UserService.hasAccess("FSM_ADMIN")||!1,u=Digit.UserService.hasAccess("FSM_EDITOR_EMP")||!1,d=Digit.UserService.hasAccess("FSM_CREATOR_EMP")||!1,c=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,[p,m]=n.useState("-"),v=Digit.ULBService.getCurrentTenantId();if(!Digit.Utils.fsmAccess())return null;const E={enabled:!!c,select:t=>{const n=t.vehicleTrip.reduce((t,n)=>{const l=n.tripDetails.reduce((e,t)=>t.volume+e,0);return t[e("ES_READY_FOR_DISPOSAL")]+=l/1e3,t},{[e("ES_READY_FOR_DISPOSAL")]:0});return n[e("ES_READY_FOR_DISPOSAL")]=`(${n[e("ES_READY_FOR_DISPOSAL")]} KL)`,n}},{isSuccess:_}=Digit.Hooks.fsm.useVehicleSearch({tenantId:v,filters:{applicationStatus:"WAITING_FOR_DISPOSAL"},config:E}),{data:S}=Digit.Hooks.fsm.useInbox(v,{sortBy:"createdTime",sortOrder:"DESC",total:!0,limit:10,offset:0,...u||d||o||r?{uuid:{code:"ASSIGNED_TO_ALL",name:e("ES_INBOX_ASSIGNED_TO_ALL")}}:{uuid:{code:"ASSIGNED_TO_ME",name:e("ES_INBOX_ASSIGNED_TO_ME")}}},{enabled:!c});n.useEffect(()=>{S&&m((null==S?void 0:S.totalCount)||0)},[S]);const f=r?[{link:"/digit-ui/employee/fsm/registry?selectedTabs=VENDOR",label:e("ES_TITLE_FSM_REGISTRY"),icon:l.createElement(t.AddNewIcon,null)}]:[],y={Icon:l.createElement(t.ShippingTruck,null),moduleName:e("ES_TITLE_VEHICLE_LOG"),links:[{label:e("ES_COMMON_HOME"),link:"/digit-ui/employee/fsm/fstp-operations"}]};if(c&&_)return l.createElement(t.EmployeeModuleCard,y);const T=a||o||u?[]:[{label:e("ES_TITLE_NEW_DESULDGING_APPLICATION"),link:"/digit-ui/employee/fsm/new-application"}],g=c?{Icon:l.createElement(t.ShippingTruck,null),moduleName:e("ES_TITLE_VEHICLE_LOG"),links:[{label:e("ES_COMMON_HOME"),link:"/digit-ui/employee/fsm/fstp-operations"}]}:{Icon:l.createElement(t.ShippingTruck,null),moduleName:e("ES_TITLE_FAECAL_SLUDGE_MGMT"),kpis:[{count:p,label:e("TOTAL_FSM"),link:"/digit-ui/employee/fsm/inbox"},{label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/fsm/inbox"}],links:[{count:p,label:e("ES_COMMON_INBOX"),link:"/digit-ui/employee/fsm/inbox"},...T,...f]};return l.createElement(t.EmployeeModuleCard,s({},g,{FsmHideCount:!0}))},FSMModule:e=>{let{stateCode:n,userType:i,tenants:o}=e;const{path:r,url:u}=a.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:d}=Digit.Services.useStore({stateCode:n,moduleCode:"FSM",language:s});return d?l.createElement(t.Loader,null):(Digit.SessionStorage.set("FSM_TENANTS",o),"citizen"===i?l.createElement(fe,{path:r}):l.createElement(Ze,{path:r,url:u,userType:i}))},FSMLinks:e=>{let{matchPath:o,userType:r}=e;const{t:u}=i.useTranslation(),[s]=Digit.Hooks.useSessionStorage("FSM_CITIZEN_FILE_PROPERTY",{});n.useEffect(()=>"employee"===r&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]);const d=[{role:"FSM_DSO",from:"/digit-ui/citizen/fsm/dso-dashboard",dashoardLink:"CS_LINK_DSO_DASHBOARD",loginLink:"CS_LINK_LOGIN_DSO"}];if("citizen"===r){const e=[{link:o+"/new-application",i18nKey:u("CS_HOME_APPLY_FOR_DESLUDGING")},{link:o+"/my-applications",i18nKey:u("CS_HOME_MY_APPLICATIONS")}];return d.forEach(t=>{let{role:n,from:l,loginLink:i,dashoardLink:a}=t;Digit.UserService.hasAccess(n)?e.push({link:l,i18nKey:u(a)}):e.push({link:"/digit-ui/citizen/login",state:{role:"FSM_DSO",from:l},i18nKey:u(i)})}),l.createElement(t.CitizenHomeCard,{header:u("CS_HOME_FSM_SERVICES"),links:e,Icon:t.CitizenTruck})}return l.createElement("div",{className:"employee-app-container"},l.createElement("div",{className:"ground-container"},l.createElement("div",{className:"employeeCard"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z",fill:"white"}))),l.createElement("span",{className:"text"},u("ES_TITLE_FSM"))),l.createElement("div",{className:"body"},l.createElement("span",{className:"link"},l.createElement(a.Link,{to:o+"/inbox"},u("ES_TITLE_INBOX"))),l.createElement("span",{className:"link"},l.createElement(a.Link,{to:o+"/new-application/"},u("ES_TITLE_NEW_DESULDGING_APPLICATION"))))))))},SelectChannel:e=>{let{t:i,config:o,onSelect:r,formData:u={}}=e;const s=Digit.ULBService.getCurrentTenantId(),{pathname:d}=a.useLocation(),c=d.includes("/modify-application/"),{data:p}=Digit.Hooks.fsm.useMDMS(s,"FSM","EmployeeApplicationChannel"),[m,v]=n.useState(null==u?void 0:u.channel);return p?l.createElement(t.Dropdown,{option:p,optionKey:"i18nKey",id:"channel",selected:m,select:function(e){v(e),r(o.key,e)},t:i,disable:c,autoFocus:!c}):l.createElement(t.Loader,null)},SelectName:e=>{let{t:i,config:o,onSelect:r,formData:u={},errors:d}=e;const c=Digit.ULBService.getStateId(),{data:p,isLoading:m}=Digit.Hooks.fsm.useMDMS(c,"common-masters","FSMGenderType"),{pathname:v}=a.useLocation(),E=v.includes("/modify-application/"),[_,S]=n.useState(""),[f,y]=n.useState([]),[T,g]=n.useState(""),h=[{label:"ES_NEW_APPLICATION_APPLICANT_NAME",type:"text",name:"applicantName",validation:{isRequired:!0,pattern:"^[a-zA-Z]+( [a-zA-Z]+)*$",title:i("CORE_COMMON_APPLICANT_NAME_INVALID")},isMandatory:!0},{label:"ES_NEW_APPLICATION_APPLICANT_MOBILE_NO",type:"text",name:"mobileNumber",validation:{isRequired:!0,pattern:"[6-9]{1}[0-9]{9}",type:"tel",title:i("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID")},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),isMandatory:!0},{label:"ES_NEW_APPLICATION_MAIL_ID",type:"text",name:"emailId",validation:{pattern:"/^[a-zA-Z0-9._%+-]+@[a-z.-]+.(com|org|in)$/",title:i("CORE_COMMON_EMAIL_ID_INVALID")},isMandatory:!1}];function I(e){S(e),r(o.key,{...u[o.key],applicantGender:e.code})}return n.useEffect(()=>{!m&&p&&y(p)},[p]),l.createElement("div",null,null==h?void 0:h.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},"text"===e.type&&l.createElement(l.Fragment,null,d[e.name]&&l.createElement(t.CardLabelError,null,i(e.error)),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field",style:{display:"flex"}},e.componentInFront?e.componentInFront:null,l.createElement(t.TextInput,s({key:e.name,value:u&&u[o.key]?u[o.key][e.name]:null,onChange:t=>((e,t)=>{"emailId"===t&&(/^[a-zA-Z0-9._%+-]+@[a-z.-]+\.(com|org|in)$/.test(e)?g(""):g(i("CORE_INVALID_EMAIL_ID_PATTERN"))),r(o.key,{...u[o.key],[t]:e})})(t.target.value,e.name),disable:E},e.validation)))),"emailId"===e.name&&T&&l.createElement(t.CardLabelError,{style:{color:"red"}},T)),"dropdown"===e.type&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{option:null===(a=e.options)||void 0===a?void 0:a.sort((e,t)=>e.code.localeCompare(t.code)),optionKey:"i18nKey",id:"dropdown",selected:u&&u[o.key]?e.options.find(t=>t.code===u[o.key][e.name]):null,select:I,t:i,disable:E,autoFocus:!E}))))}))},SelectTripData:e=>{var i,o,r,u,d,c,p,m,v,E,_;let{t:S,config:f,onSelect:y,formData:T={}}=e;const g=Digit.ULBService.getCurrentTenantId(),h=Digit.ULBService.getStateId(),{pathname:I}=a.useLocation();I.includes("/modify-application/");let{id:C}=a.useParams();const N=Digit.UserService.getUser(),{pathname:A}=(Digit.Hooks.fsm.useSearch(g,{applicationNos:C,uuid:N.uuid},{staleTime:Infinity}),a.useLocation()),[D,O]=(A.includes("modify"),n.useState({label:null==T||null===(i=T.tripData)||void 0===i?void 0:i.vehicleCapacity})),[L,P]=n.useState(!1),{isLoading:b,data:R}=Digit.Hooks.fsm.useMDMS(h,"Vehicle","VehicleType",{staleTime:Infinity}),{data:M,isLoading:k}=Digit.Hooks.fsm.useDsoSearch(g,{limit:-1,status:"ACTIVE"}),[w,F]=n.useState([]);n.useEffect(()=>{if(M&&R){const e=M.reduce((e,t)=>t.vehicles&&t.vehicles.length?e.concat(t.vehicles):e,[]),t=Array.from(new Set(e.map(e=>e.capacity))).map(t=>e.find(e=>e.capacity===t));F(t)}},[M,R]);const x=[{label:"ES_NEW_APPLICATION_AMOUNT_PER_TRIP",type:"text",name:"amountPerTrip",error:S("ES_NEW_APPLICATION_AMOUNT_INVALID"),validation:{isRequired:!0,pattern:"[0-9]{1,10}",title:S("ES_APPLICATION_BILL_SLAB_ERROR")},default:null==T||null===(o=T.tripData)||void 0===o?void 0:o.amountPerTrip,disable:"FROM_GRAM_PANCHAYAT"!==(null==T||null===(r=T.address)||void 0===r||null===(u=r.propertyLocation)||void 0===u?void 0:u.code),isMandatory:!0},{label:"ES_PAYMENT_DETAILS_TOTAL_AMOUNT",type:"text",name:"amount",validation:{isRequired:!0,title:S("ES_APPLICATION_BILL_SLAB_ERROR")},default:null==T||null===(d=T.tripData)||void 0===d?void 0:d.amount,disable:!0,isMandatory:!0}];function H(e){let t={...T[f.key],...e};console.log("config.key",f.key,t),y(f.key,t)}return n.useEffect(()=>{!function(){try{var e,t,n;(null==T||null===(e=T.tripData)||void 0===e?void 0:e.vehicleType)!==D&&O({label:null==T||null===(t=T.tripData)||void 0===t||null===(n=t.vehicleType)||void 0===n?void 0:n.capacity});const l=function(e,t,n,l,i,a){if(null!=T&&T.propertyType&&null!=T&&T.subtype&&null!=T&&T.address&&null!=T&&null!==(e=T.tripData)&&void 0!==e&&null!==(t=e.vehicleType)&&void 0!==t&&t.capacity&&"WITHIN_ULB_LIMITS"===(null==T||null===(n=T.address)||void 0===n||null===(l=n.propertyLocation)||void 0===l?void 0:l.code)){var o;const e=null==T||null===(o=T.tripData)||void 0===o?void 0:o.vehicleType.capacity,{slum:t}=T.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(g,{propertyType:null==T?void 0:T.subtype,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;console.log("billingDetails",e);const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]);null!=n&&n.price||0===(null==n?void 0:n.price)?(H({amountPerTrip:n.price,amount:n.price*T.tripData.noOfTrips}),P(!1)):(H({amountPerTrip:"",amount:""}),P(!0))})}"FROM_GRAM_PANCHAYAT"===(null==T||null===(i=T.address)||void 0===i||null===(a=i.propertyLocation)||void 0===a?void 0:a.code)&&T.tripData.noOfTrips&&T.tripData.amountPerTrip&&H({amount:T.tripData.amountPerTrip*T.tripData.noOfTrips})}();l&&l.then&&l.then(function(){})}catch(e){Promise.reject(e)}}()},[null==T?void 0:T.propertyType,null==T?void 0:T.subtype,null==T||null===(c=T.address)||void 0===c?void 0:c.slum,null==T||null===(p=T.tripData)||void 0===p||null===(m=p.vehicleType)||void 0===m?void 0:m.capacity,(null==T||null===(v=T.tripData)||void 0===v?void 0:v.noOfTrips)&&(null==T||null===(E=T.address)||void 0===E||null===(_=E.propertyLocation)||void 0===_?void 0:_.code)]),b&&k?l.createElement(t.Loader,null):l.createElement("div",null,null==x?void 0:x.map((e,n)=>l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},S(e.label)+" (₹)",e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({type:e.type,onChange:e=>{var t,l;return 0===n&&"FROM_GRAM_PANCHAYAT"===(null===(t=T.address.propertyLocation)||void 0===t?void 0:t.code)?void y(f.key,{...T[f.key],amountPerTrip:l=e.target.value,amount:l*T.tripData.noOfTrips}):function(e){y(f.key,{...T[f.key],noOfTrips:e})}(e.target.value)},key:e.name,value:e.default?e.default:T&&T[f.key]?T[f.key][e.name]:null},e.validation,{disable:e.disable}))))),L?l.createElement(t.CardLabelError,{style:{width:"100%",textAlign:"center"}},S("ES_APPLICATION_BILL_SLAB_ERROR")):null)},SelectGender:e=>{let{config:i,onSelect:a,t:o,userType:r,formData:u}=e;Digit.ULBService.getCurrentTenantId();const s=Digit.ULBService.getStateId(),{data:d,isLoading:c}=Digit.Hooks.fsm.useMDMS(s,"common-masters","FSMGenderType"),[p,v]=n.useState(null==u?void 0:u.genderType);n.useEffect(()=>{if(!c&&d){const e=d.filter(e=>{var t;return e.code===((null==u||null===(t=u.selectGender)||void 0===t?void 0:t.code)||(null==u?void 0:u.selectGender))})[0];v(e)}},[null==u?void 0:u.selectGender,d]);const E=e=>{v(e),"employee"===r&&(a(i.key,e),a("genderDetail",null))};return c?l.createElement(t.Loader,null):"employee"===r?l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,o(i.label)),l.createElement(t.Dropdown,{className:"payment-form-text-input-correction",isMandatory:i.isMandatory,selected:p,option:null==d?void 0:d.sort((e,t)=>e.code.localeCompare(t.code)),select:E,optionKey:"i18nKey",disable:i.disable,t:o})):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:2,flow:"APPLY"}),l.createElement(t.FormStep,{config:i,onSelect:()=>{a(i.key,p)},onSkip:()=>{a()},isDisabled:!p,t:o},l.createElement(t.RadioOrSelect,{options:null==d?void 0:d.sort((e,t)=>e.code.localeCompare(t.code)),selectedOption:p,optionKey:"i18nKey",onSelect:E,t:o,isMandatory:i.isMandatory})))},SelectPaymentType:e=>{var i;let{t:o,config:r,onSelect:u,formData:s={}}=e;const d=Digit.ULBService.getStateId(),{data:c,isLoading:p}=Digit.Hooks.fsm.useMDMS(d,"FSM","PaymentType"),{pathname:m}=a.useLocation(),v=m.includes("/modify-application/"),[E,_]=n.useState(null),[S,f]=n.useState(),y=[{label:"Payment Preference",type:"RadioButton",name:"paymentPreference",options:c,isMandatory:!1}];function T(e){_(e),u(r.key,e.code)}return n.useEffect(()=>{if(!p&&c){const e=c.filter(e=>{var t;return e.code===((null==s||null===(t=s.paymentPreference)||void 0===t?void 0:t.code)||(null==s?void 0:s.paymentPreference))})[0];_(e||c.find(e=>"POST_PAY"===e.code))}},[s,null==s||null===(i=s.paymentPreference)||void 0===i?void 0:i.code,null==s?void 0:s.paymentPreference,c]),n.useEffect(()=>{if(null!=s&&s.address){const{slum:e}=s.address;f(!!e)}},[s]),l.createElement("div",null,null==y?void 0:y.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},0!==(null==s||null===(i=s.tripData)||void 0===i?void 0:i.amountPerTrip)&&"RadioButton"===e.type&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},o(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.RadioButtons,{selectedOption:E,onSelect:T,style:{display:"flex",marginBottom:0},innerStyles:{marginLeft:"10px"},options:e.options,optionsKey:"i18nKey",disabled:v}))))}))},SelectPaymentPreference:e=>{var i,a,o,r,u,d,c,p;let{config:v,formData:E,t:_,onSelect:S,userType:f}=e;const y=Digit.ULBService.getCitizenCurrentTenant(),[T,g]=(Digit.ULBService.getStateId(),n.useState(null)),[h,I]=n.useState(null),[C,N]=n.useState(null),[A,D]=n.useState(!1),O=[{label:"ES_NEW_APPLICATION_ADVANCE_COLLECTION",type:"number",name:"advanceAmount",validation:{isRequired:!0},disable:!0,default:null==E||null===(i=E.selectPaymentPreference)||void 0===i?void 0:i.advanceAmount,isMandatory:!0}],L=()=>{S(v.key,{advanceAmount:h})};if(n.useEffect(()=>{!function(){try{const e=function(e,t,n){if(null!=E&&E.propertyType&&null!=E&&E.subtype&&null!=E&&E.address&&null!=E&&null!==(e=E.selectTripNo)&&void 0!==e&&e.vehicleCapacity.capacity&&"WITHIN_ULB_LIMITS"===(null==E||null===(t=E.address)||void 0===t||null===(n=t.propertyLocation)||void 0===n?void 0:n.code)){var l,i,a,o,r,u;const e=null==E||null===(l=E.selectTripNo)||void 0===l?void 0:l.vehicleCapacity.capacity,{slum:t}=E.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(y===(null==E||null===(i=E.address)||void 0===i||null===(a=i.city)||void 0===a?void 0:a.code)?y:null==E||null===(o=E.address)||void 0===o||null===(r=o.city)||void 0===r?void 0:r.code,{propertyType:null==E||null===(u=E.subtype)||void 0===u?void 0:u.code,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]);Digit.SessionStorage.set("amount_per_trip",n.price);const l=function(){if(null!=n&&n.price){var e,t,l,i,a,o;let r=n.price*(null==E||null===(e=E.selectTripNo)||void 0===e||null===(t=e.tripNo)||void 0===t?void 0:t.code);return Promise.resolve(Digit.FSMService.advanceBalanceCalculate(y===(null==E||null===(l=E.address)||void 0===l||null===(i=l.city)||void 0===i?void 0:i.code)?y:null==E||null===(a=E.address)||void 0===a||null===(o=a.city)||void 0===o?void 0:o.code,{totalTripAmount:r})).then(function(e){var t,n;let{advanceAmount:l}=e;I(l),N(r),Digit.SessionStorage.set("total_amount",r),Digit.SessionStorage.set("advance_amount",l),null!=E&&null!==(t=E.selectPaymentPreference)&&void 0!==t&&t.advanceAmount?g(Math.ceil(null==E||null===(n=E.selectPaymentPreference)||void 0===n?void 0:n.advanceAmount)):g(Math.ceil(l)),D(!1)})}0===(null==n?void 0:n.price)?(Digit.SessionStorage.set("total_amount",0),L()):(sessionStorage.removeItem("Digit.total_amount"),sessionStorage.removeItem("Digit.advance_amount"),D(!0))}();if(l&&l.then)return l.then(function(){})})}g(0),Digit.SessionStorage.set("advance_amount",0),Digit.SessionStorage.set("amount_per_trip",null)}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[null==E?void 0:E.propertyType,null==E?void 0:E.subtype,null==E?void 0:E.address,null==E||null===(a=E.selectTripNo)||void 0===a?void 0:a.vehicleCapacity.capacity,null==E||null===(o=E.selectTripNo)||void 0===o||null===(r=o.tripNo)||void 0===r?void 0:r.code]),"employee"===f)return null;let P=T,b=Digit.SessionStorage.get("total_amount"),R=Digit.SessionStorage.get("advance_amount");return null===T?l.createElement(t.Loader,null):(console.log("advance",T,C,h),l.createElement(l.Fragment,null,l.createElement(m,{currentStep:3,flow:"APPLY"}),l.createElement(t.FormStep,{config:v,onSelect:()=>{S(v.key,{advanceAmount:T})},onSkip:L,isDisabled:P>b||P<R,t:_},l.createElement(t.KeyNote,{keyValue:_("ADV_TOTAL_AMOUNT")+" (₹)",note:"FROM_GRAM_PANCHAYAT"===(null==E||null===(u=E.address)||void 0===u||null===(d=u.propertyLocation)||void 0===d?void 0:d.code)?"N/A":b}),"FROM_GRAM_PANCHAYAT"===(null==E||null===(c=E.address)||void 0===c||null===(p=c.propertyLocation)||void 0===p?void 0:p.code)&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},_("FSM_TOTAL_AMOUNT_NOTE")),l.createElement(t.KeyNote,{keyValue:_("FSM_ADV_MIN_PAY")+" (₹)",note:Math.ceil(R)}),null==O?void 0:O.map((e,n)=>l.createElement(l.Fragment,{key:n},l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,null,_(e.label)+" (₹)",e.isMandatory?" * ":null),l.createElement("div",null,l.createElement(t.TextInput,s({type:e.type,key:e.name,disable:!0,onChange:e=>{g(e.target.value)},value:T},e.validation)),P>b&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},_("FSM_ADVANCE_AMOUNT_MAX")),P<R&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},_("FSM_ADVANCE_AMOUNT_MIN")))))))))},FSMEmpInbox:e=>{var a,o,u,s,d,c,p,m;let{parentRoute:v,isSearch:E=!1,isInbox:_=!1}=e;const S=Digit.ULBService.getCurrentTenantId(),f=Digit.UserService.getUser().info.roles,y=Digit.UserService.hasAccess(["FSM_DSO"])||!1,T=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,{t:g}=i.useTranslation(),h=r.useQueryClient(),[I,C]=n.useState(!1),[N,A]=n.useState(0),[D,O]=n.useState(10),[L,P]=n.useState([{id:"createdTime",desc:!0}]),b=_?"fsm/inbox/searchParams":"fsm/search/searchParams",R=_?{applicationStatus:[],locality:[],uuid:y||T?{code:"ASSIGNED_TO_ME",name:g("ES_INBOX_ASSIGNED_TO_ME")}:{code:"ASSIGNED_TO_ALL",name:g("ES_INBOX_ASSIGNED_TO_ALL")}}:{},[M,k]=Digit.Hooks.useSessionStorage(b,R);n.useEffect(()=>{z(M)},[]);let w=window.Digit.Utils.browser.isMobile(),F=w?{limit:100,offset:0,sortBy:null==L||null===(a=L[0])||void 0===a?void 0:a.id,sortOrder:null!=L&&null!==(o=L[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:D,offset:N,sortBy:null==L||null===(u=L[0])||void 0===u?void 0:u.id,sortOrder:null!=L&&null!==(s=L[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const{data:x,isLoading:H,isIdle:V}=Digit.Hooks.fsm.useInbox(S,{...M,...F,fromDate:null!=M&&M.fromDate?new Date(null==M?void 0:M.fromDate).getTime():void 0,toDate:null!=M&&M.toDate?new Date(null==M?void 0:M.toDate).getTime():void 0},{enabled:_},!!y),B=y?(null==x||null===(d=x.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===d?void 0:d.count)+(null==x||null===(c=x.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===c?void 0:c.count):null==x?void 0:x.totalCount,{isLoading:U,data:{data:Y,totalCount:G}={}}=Digit.Hooks.fsm.useSearchAll(S,{limit:D,offset:N,...M,applicationStatus:null==M||null===(p=M.applicationStatus)||void 0===p?void 0:p.code,fromDate:null!=M&&M.fromDate?new Date(null==M?void 0:M.fromDate).getTime():void 0,toDate:null!=M&&M.toDate?new Date(null==M?void 0:M.toDate).getTime():void 0},null,{enabled:I&&E});n.useEffect(()=>{A(0)},[M]);const W=e=>{let t=e.delete,n={...M};t&&t.forEach(e=>delete n[e]),k({...n,...e})},K=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&P(e)},[]),z=function(e){var t;void 0===e&&(e={}),E?(0===(null===(t=Object.keys(e))||void 0===t?void 0:t.length)?(C(!1),h.resetQueries("FSM_CITIZEN_SEARCH")):C(!0),k({...e})):k(t=>{let{applicationStatus:n,locality:l,uuid:i}=t;return{applicationStatus:n,locality:l,uuid:i,...e}})},j=e=>E?[{label:g("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"},{label:g("ES_SEARCH_APPLICATION_MOBILE_NO"),name:"mobileNumber",maxlength:10,pattern:"[6-9][0-9]{9}",title:g("ES_SEARCH_APPLICATION_MOBILE_INVALID")},{label:g("ES_INBOX_STATUS"),name:"applicationStatus",type:"status"},{label:g("ES_SEARCH_FROM_DATE"),name:"fromDate",type:"date"},{label:g("ES_SEARCH_TO_DATE"),name:"toDate",type:"date"}]:e.find(e=>"FSM_EMP_FSTPO"===e.code)?[{label:g("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"},{label:g("ES_FSTP_OPERATOR_VEHICLE_NO"),name:"vehicleNo"},{label:g("ES_FSTP_DSO_NAME"),name:"name"}]:[{label:g("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"applicationNos"},{label:g("ES_SEARCH_APPLICATION_MOBILE_NO"),name:"mobileNumber",maxlength:10}];if(n.useEffect(()=>{var e;const t=["CITIZEN_FEEDBACK_PENDING"];null==x||null===(e=x.table)||void 0===e||e.map(e=>{t.includes(e.status)&&(e.sla="-")})},[x]),null!==(null==x||null===(m=x.table)||void 0===m?void 0:m.length))return w?l.createElement("div",null,!E&&l.createElement(t.Header,null,g("ES_COMMON_INBOX")),l.createElement(Xe,{data:_?x:Y,isLoading:_?H||V:U,isSearch:E,searchFields:j(f),onFilterChange:W,onSearch:z,onSort:K,parentRoute:v,searchParams:M,sortParams:L,removeParam:function(e){void 0===e&&(e={});const t={...M};Object.keys(e).forEach(e=>delete t[e]),k(t)},linkPrefix:`${v}/${y?"dso-application-details":"application-details"}/`})):l.createElement("div",null,!E&&l.createElement(t.Header,null,g("ES_COMMON_INBOX"),Number(B)?l.createElement("p",{className:"inbox-count"},Number(B)):null),l.createElement(We,{data:_?x:Y,isLoading:_?H||V:U,isSearch:E,shouldSearch:I,onFilterChange:W,searchFields:j(f),onSearch:z,onSort:K,onNextPage:()=>{A(e=>e+D)},onPrevPage:()=>{A(e=>e-D)},currentPage:Math.floor(N/D),pageSizeLimit:D,disableSort:!1,searchParams:M,onPageSizeChange:e=>{O(Number(e.target.value))},parentRoute:v,paginationParms:F,sortParams:L,totalRecords:_?Number(B):G}))},FSMFstpInbox:()=>{var e,a,o,r,u,s,d,c,p,m;const{t:v}=i.useTranslation(),E=Digit.ULBService.getCurrentTenantId(),[_,S]=n.useState({applicationStatus:"WAITING_FOR_DISPOSAL"}),[f,y]=n.useState([{id:"createdTime",desc:!0}]),[T,g]=n.useState(0),[h,I]=n.useState(10),{data:C}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:E,filters:{registrationNumber:null==_?void 0:_.registrationNumber},config:{enabled:(null==_||null===(e=_.registrationNumber)||void 0===e?void 0:e.length)>0}}),N=Digit.UserService.getUser();let A=window.Digit.Utils.browser.isMobile(),D=A?{limit:100,offset:0,sortOrder:null!=f&&null!==(a=f[0])&&void 0!==a&&a.desc?"DESC":"ASC"}:{limit:h,offset:T,sortOrder:null!=f&&null!==(o=f[0])&&void 0!==o&&o.desc?"DESC":"ASC"};const{data:O}=Digit.Hooks.fsm.useSearch(E,{applicationNos:null==_?void 0:_.refernceNos,uuid:N.uuid},{staleTime:Infinity}),{data:L}=Digit.Hooks.fsm.useDsoSearch(E,{name:null==_?void 0:_.name,status:"ACTIVE"},{enabled:(null==_||null===(r=_.name)||void 0===r?void 0:r.length)>1});let P={businessService:"FSM_VEHICLE_TRIP",refernceNos:void 0!==O&&(null==_||null===(u=_.refernceNos)||void 0===u?void 0:u.length)>0?(null==O?void 0:O.applicationNo)||"null":"",vehicleIds:void 0!==C&&(null==_||null===(s=_.registrationNumber)||void 0===s?void 0:s.length)>0?(null==C||null===(d=C.vehicle)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.id)||"null":"",tripOwnerIds:void 0!==L&&(null==_||null===(p=_.name)||void 0===p?void 0:p.length)>0?(null==L||null===(m=L[0])||void 0===m?void 0:m.ownerId)||"null":"",applicationStatus:null==_?void 0:_.applicationStatus,...D};null==O&&(P={responseInfo:{apiId:"Rainmaker",ver:null,ts:null,resMsgId:"uief87324",msgId:"1645827148736|en_IN",status:"successful"},vehicle:[],totalCount:0});const{isLoading:b,data:{totalCount:R,vehicleLog:M}={}}=Digit.Hooks.fsm.useVehicleSearch({tenantId:E,filters:P,config:dt,options:{searchWithDSO:!0}}),k=function(e){void 0===e&&(e={}),S({applicationStatus:"WAITING_FOR_DISPOSAL",...e})},w=()=>{},F=[{label:v("ES_SEARCH_APPLICATION_APPLICATION_NO"),name:"refernceNos"},{label:v("ES_FSTP_OPERATOR_VEHICLE_NO"),name:"registrationNumber"},{label:v("ES_FSTP_DSO_NAME"),name:"name"}],x=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&y(e)},[]);return A?l.createElement("div",null,l.createElement(t.Header,null,v("ES_COMMON_INBOX")),l.createElement(Xe,{onFilterChange:w,vehicleLog:M,isLoading:b,userRole:"FSM_EMP_FSTPO",linkPrefix:"/digit-ui/employee/fsm/fstp-operator-details/",onSearch:k,searchFields:F,onSort:x,sortParams:f})):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"20px"}},l.createElement(t.Header,null,v("ES_COMMON_INBOX"))),l.createElement(We,{data:{table:M},isLoading:b,onSort:x,disableSort:!1,sortParams:f,userRole:"FSM_EMP_FSTPO",onFilterChange:w,searchFields:F,onSearch:k,onNextPage:()=>{g(e=>e+h)},onPrevPage:()=>{g(e=>e-h)},currentPage:Math.floor(T/h),pageSizeLimit:h,onPageSizeChange:e=>{I(Number(e.target.value))},totalRecords:R||0}))},FSMNewApplicationEmp:e=>{const o=Digit.ULBService.getCurrentTenantId(),r=Digit.ULBService.getStateId(),{isLoading:u}=Digit.Hooks.fsm.useMDMS(r,"FSM","CommonFieldsConfig"),{isLoading:s}=Digit.Hooks.fsm.useMDMS(r,"FSM","PreFieldsConfig"),{isLoading:d}=Digit.Hooks.fsm.useMDMS(r,"FSM","PostFieldsConfig"),[c,p,m]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[v,E,_]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[S,f,y]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);n.useEffect(()=>{p(!1),y(),_()},[]);const{t:T}=i.useTranslation(),g=a.useHistory(),[h,I]=n.useState(!1);if(u||d||s)return l.createElement(t.Loader,null);let C=[{head:"ES_NEW_APPLICATION_PROPERTY_DETAILS",body:[{label:"ES_NEW_APPLICATION_PROPERTY_ID",isMandatory:!0,component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0},{label:"ES_NEW_APPLICATION_PROPERTY_TYPE",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"}]},{head:"ES_TITLE_APPLICANT_DETAILS",body:[{label:"ES_NEW_APPLICATION_APPLICATION_CHANNEL",isMandatory:!0,type:"component",key:"channel",component:"SelectChannel",nextStep:"applicantName"},{type:"component",key:"applicationData",withoutLabel:!0,component:"SelectName"}]},{head:"ES_NEW_APPLICATION_LOCATION_DETAILS",body:[{route:"address",component:"FSMSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"locality-gramPanchayat",isMandatory:!0,type:"component"},{route:"locality-gramPanchayat",component:"SelectLocalityOrGramPanchayat",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"select-trip-number",isMandatory:!0,type:"component"},{route:"pincode",component:"FSMSelectPincode",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_FILE_APPLICATION_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"check-slum",type:"component"},{type:"component",route:"check-slum",isMandatory:!0,component:"CheckSlum",texts:{header:"ES_NEW_APPLICATION_SLUM_CHECK",submitBarLabel:"CS_COMMON_NEXT"},key:"address",withoutLabel:!0,nextStep:"slum-details",hideInEmployee:!0},{type:"component",route:"slum-details",isMandatory:!0,component:"SelectSlumName",texts:{header:"CS_NEW_APPLICATION_SLUM_NAME",cardText:"CS_NEW_APPLICATION_SLUM_TEXT",submitBarLabel:"CS_COMMON_NEXT"},withoutLabel:!0,key:"address",nextStep:"street"},{type:"component",route:"street",component:"FSMSelectStreet",key:"address",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_STREET_DOOR_NO_LABEL",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"landmark"},{type:"component",route:"landmark",component:"FSMSelectLandmark",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},key:"address",nextStep:"pit-type"}]},{head:"CS_CHECK_PIT_SEPTIC_TANK_DETAILS",body:[{label:"ES_NEW_APPLICATION_ROAD_WIDTH",isMandatory:!0,type:"component",route:"road-details",key:"roadWidth",hideInEmployee:!0,component:"SelectRoadDetails",texts:{header:"CS_FILE_PROPERTY_ROAD_WIDTH",cardText:"CS_FILE_PROPERTY_ROAD_WIDTH_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!0,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"road-details"},{route:"tank-size",component:"SelectTankSize",isMandatory:!1,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},type:"component",key:"pitDetail",nextStep:"select-payment-preference",label:"ES_NEW_APPLICATION_PIT_DIMENSION"},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTrips"}]},{head:"CS_FILE_ADDITIONAL_DETAILS",hideInEmployee:!0,body:[{label:"a",isMandatory:!0,type:"component",route:"select-trip-number",key:"selectTripNo",component:"SelectTripNo",hideInEmployee:!0,texts:{headerCaption:"",header:"ES_FSM_SERVICE_REQUEST",cardText:"ES_FSM_SERVICE_REQUEST_TEXT",skipText:"CORE_COMMON_SKIP_CONTINUE",submitBarLabel:"CS_COMMON_NEXT",skipLabel:"CS_COMMON_SERVICE_SKIP_INFO"},nextStep:"property-id"},{label:"a",isMandatory:!1,type:"component",route:"select-gender",hideInEmployee:!0,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"select-payment-preference"},{label:"a",isMandatory:!1,type:"component",route:"select-payment-preference",key:"selectPaymentPreference",hideInEmployee:!0,component:"SelectPaymentPreference",texts:{headerCaption:"",header:"ES_FSM_PAYMENT_PREFERENCE_LABEL",cardText:"ES_FSM_PAYMENT_PREFERENCE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:null}]},{head:"ES_TITLE_PAYMENT_DETAILS",body:[{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTripData"},{type:"component",key:"advancepaymentPreference",withoutLabel:!0,component:"AdvanceCollection"}]}];return console.log(C,"confffffffff"),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(t.Header,null,T("ES_TITLE_NEW_DESULDGING_APPLICATION"))),l.createElement(t.FormComposer,{isDisabled:!h,label:T("ES_COMMON_APPLICATION_SUBMIT"),config:C.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},formCardStyle:!0,onSubmit:e=>{var t,n,l,i,a,r,u,s,d,c,p,m,v,E,_,S,f,y,T,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y,G,W,K,z,j;console.log("data",e);const X=e.channel,$=null==e||null===(t=e.pitType)||void 0===t?void 0:t.code,q=null==e?void 0:e.pitDetail,Z=e.applicationData.applicantName,Q=e.applicationData.mobileNumber,J=e.applicationData.emailId,ee=null==e||null===(n=e.address)||void 0===n?void 0:n.pincode,te=null==e||null===(l=e.address)||void 0===l||null===(i=l.street)||void 0===i?void 0:i.trim(),ne=null==e||null===(a=e.address)||void 0===a||null===(r=a.doorNo)||void 0===r?void 0:r.trim(),le=null==e||null===(u=e.address)||void 0===u?void 0:u.slum,ie=null==e||null===(s=e.address)||void 0===s||null===(d=s.landmark)||void 0===d?void 0:d.trim(),ae=null==e||null===(c=e.tripData)||void 0===c?void 0:c.noOfTrips,oe=e.tripData.amount||(null==e||null===(p=e.tripData)||void 0===p||null===(m=p.undefined)||void 0===m?void 0:m.amount),re=null==e||null===(v=e.address)||void 0===v||null===(E=v.city)||void 0===E?void 0:E.code,ue=null==e||null===(_=e.address)||void 0===_||null===(S=_.city)||void 0===S?void 0:S.name,se=null==e||null===(f=e.address)||void 0===f||null===(y=f.city)||void 0===y?void 0:y.state,de=(null===(T=e.cpt)||void 0===T||null===(h=T.details)||void 0===h||null===(I=h.address)||void 0===I||null===(C=I.locality)||void 0===C?void 0:C.code)||(null==e||null===(N=e.address)||void 0===N||null===(A=N.locality)||void 0===A?void 0:A.code),ce=(null===(D=e.cpt)||void 0===D||null===(O=D.details)||void 0===O||null===(L=O.address)||void 0===L||null===(P=L.locality)||void 0===P?void 0:P.name)||(null==e||null===(b=e.address)||void 0===b||null===(R=b.locality)||void 0===R?void 0:R.name),pe=0===oe?null:null!=e&&e.paymentPreference?null==e?void 0:e.paymentPreference:null,me=0===oe?null:null===(null==e||null===(M=e.advancepaymentPreference)||void 0===M?void 0:M.advanceAmount)?0:null==e||null===(k=e.advancepaymentPreference)||void 0===k?void 0:k.advanceAmount,ve=null==e||null===(w=e.tripData)||void 0===w?void 0:w.distancefromroad,Ee=null==e||null===(F=e.tripData)||void 0===F?void 0:F.roadWidth,_e=null==e?void 0:e.address.gramPanchayat,Se=null==e?void 0:e.address.village,fe=null==e||null===(x=e.address)||void 0===x||null===(H=x.propertyLocation)||void 0===H?void 0:H.code,ye=null==e||null===(V=e.address)||void 0===V?void 0:V.newLocality,Te=null==e||null===(B=e.address)||void 0===B?void 0:B.newGp,ge=null==e||null===(U=e.address)||void 0===U?void 0:U.newVillage,he={fsm:{citizen:{name:Z,mobileNumber:Q,gender:e.applicationData.applicantGender,emailId:J},tenantId:o,sanitationtype:$,source:X.code,additionalDetails:{tripAmount:"number"==typeof oe?JSON.stringify(oe):oe,distancefromroad:ve,roadWidth:Ee,propertyID:null==e||null===(Y=e.cpt)||void 0===Y||null===(G=Y.details)||void 0===G?void 0:G.propertyId},propertyUsage:null==e?void 0:e.subtype,vehicleCapacity:null==e||null===(W=e.tripData)||void 0===W||null===(K=W.vehicleType)||void 0===K?void 0:K.capacity,pitDetail:{...q,distanceFromRoad:null==e?void 0:e.distanceFromRoad},address:{tenantId:re,landmark:ie,doorNo:ne,street:te,city:ue,state:se,pincode:ee,slumName:le,locality:{code:"FROM_GRAM_PANCHAYAT"===fe?null==_e?void 0:_e.code:de,name:"FROM_GRAM_PANCHAYAT"===fe?null==_e?void 0:_e.name:ce},geoLocation:{latitude:null==e||null===(z=e.address)||void 0===z?void 0:z.latitude,longitude:null==e||null===(j=e.address)||void 0===j?void 0:j.longitude},additionalDetails:{boundaryType:"FROM_GRAM_PANCHAYAT"===fe?"GP":"Locality",gramPanchayat:{code:null==_e?void 0:_e.code,name:null==_e?void 0:_e.name},village:null!=Se&&Se.code?{code:null!=Se&&Se.code?null==Se?void 0:Se.code:"",name:null!=Se&&Se.name?null==Se?void 0:Se.name:""}:ge,newLocality:ye,newGramPanchayat:Te}},noOfTrips:ae,paymentPreference:pe,advanceAmount:"number"==typeof me?JSON.stringify(me):me},workflow:null};window.Digit.SessionStorage.set("propertyType",null),window.Digit.SessionStorage.set("subType",null),Digit.SessionStorage.set("city_property",null),Digit.SessionStorage.set("selected_localities",null),Digit.SessionStorage.set("locality_property",null),g.push("/digit-ui/employee/fsm/response",he)},defaultValues:{tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var n,l,i,a,o,r,u,s,d,c,p,m,v,E,_,S;if(console.log("ProID",t),void 0!==(null==t?void 0:t.pitType)&&null!=t&&null!==(n=t.tripData)&&void 0!==n&&n.vehicleType&&void 0!==(null==t||null===(l=t.tripData)||void 0===l?void 0:l.roadWidth)&&void 0!==(null==t||null===(i=t.tripData)||void 0===i?void 0:i.distancefromroad)&&null!=t&&t.propertyType&&null!=t&&t.subtype&&null!=t&&null!==(a=t.address)&&void 0!==a&&null!==(o=a.locality)&&void 0!==o&&o.code||null!=t&&null!==(r=t.cpt)&&void 0!==r&&null!==(u=r.details)&&void 0!==u&&null!==(s=u.address)&&void 0!==s&&null!==(d=s.locality)&&void 0!==d&&d.code&&null!=t&&null!==(c=t.tripData)&&void 0!==c&&c.vehicleType&&null!=t&&t.channel&&null!=t&&t.pitType&&null!=t&&null!==(p=t.tripData)&&void 0!==p&&p.roadWidth&&null!=t&&null!==(m=t.tripData)&&void 0!==m&&m.distancefromroad&&null!=t&&null!==(v=t.address)&&void 0!==v&&v.street&&null!=t&&null!==(E=t.address)&&void 0!==E&&E.doorNo&&(null!=t&&null!==(_=t.tripData)&&void 0!==_&&_.amountPerTrip||0===(null==t||null===(S=t.tripData)||void 0===S?void 0:S.amountPerTrip))){var f,y,T,g;console.log("formDataformData",t),I(!0);const e=null!=t&&t.pitDetail?Object.values(null==t?void 0:t.pitDetail).filter(e=>e>0):null;let n=Digit.SessionStorage.get("total_amount"),l=Digit.SessionStorage.get("advance_amount");var h,C;null!=t&&t.pitType&&(null===e||0===(null==e?void 0:e.length)||vt(null==t||null===(h=t.pitType)||void 0===h?void 0:h.dimension)&&(null==e?void 0:e.length)>=3||!vt(null==t||null===(C=t.pitType)||void 0===C?void 0:C.dimension)&&(null==e?void 0:e.length)>=2?I(!0):I(!1)),0!==(null==t||null===(f=t.tripData)||void 0===f?void 0:f.amountPerTrip)&&((null==t||null===(y=t.advancepaymentPreference)||void 0===y?void 0:y.advanceAmount)<l||(null==t||null===(T=t.advancepaymentPreference)||void 0===T?void 0:T.advanceAmount)>n||""===(null==t||null===(g=t.advancepaymentPreference)||void 0===g?void 0:g.advanceAmount))&&I(!1)}else I(!1)},noBreakLine:!0,fms_inline:!0}))},FSMEditApplication:e=>{const t=Digit.ULBService.getCurrentTenantId(),n=Digit.ULBService.getStateId();let{id:i}=a.useParams();const o=Digit.UserService.getUser(),{isLoading:r,data:u}=Digit.Hooks.fsm.useSearch(t,{applicationNos:i,uuid:o.uuid},{staleTime:Infinity}),{isLoading:s,data:d}=Digit.Hooks.fsm.useMDMS(n,"Vehicle","VehicleType",{staleTime:Infinity}),{isLoading:c,data:p}=Digit.Hooks.fsm.useMDMS(t,"FSM","ApplicationChannel"),{data:m,isLoading:v}=Digit.Hooks.fsm.useMDMS(n,"FSM","PitType");return u&&!r&&d&&!s&&p&&!c&&!v&&m?l.createElement(st,{applicationData:u,vehicleMenu:d,channelMenu:p,sanitationMenu:m,tenantId:t}):null},FSMEmployeeApplicationDetails:e=>{var o,u,s,d,c,p,m,v,E,_,S,f,y,T,g,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y,G;const W=Digit.ULBService.getCurrentTenantId(),K=Digit.ULBService.getStateId(),{t:z}=i.useTranslation(),j=a.useHistory(),X=r.useQueryClient();let{id:$}=a.useParams();const[q,Z]=n.useState(!1),[Q,J]=n.useState(null),[ee,te]=n.useState(!1),[ne,le]=n.useState(null),[ie,ae]=n.useState(null),[oe,re]=n.useState(!1),{isLoading:ue,data:se}=Digit.Hooks.fsm.useApplicationDetail(z,W,$,{},"EMPLOYEE"),{isLoading:de,data:ce}=Digit.Hooks.fsm.useSearch(W,{applicationNos:$},{staleTime:Infinity}),{mutate:pe}=Digit.Hooks.fsm.useApplicationActions(W),me=Digit.Hooks.useWorkflowDetails({tenantId:(null==se?void 0:se.tenantId)||W,id:$,moduleCode:"POST_PAY"===(null==ce?void 0:ce.paymentPreference)?"FSM_POST_PAY_SERVICE":0===(null==ce?void 0:ce.advanceAmount)?"PAY_LATER_SERVICE":(null==ce?void 0:ce.advanceAmount)>0?"FSM_ADVANCE_PAY_SERVICE":null===(null==ce?void 0:ce.paymentPreference)&&0===(null==ce||null===(o=ce.additionalDetails)||void 0===o?void 0:o.tripAmount)&&null===(null==ce?void 0:ce.advanceAmount)?"FSM_ZERO_PAY_SERVICE":"FSM",role:"FSM_EMPLOYEE",serviceData:se,getTripData:!0});function ve(e){J(e),Z(!1)}n.useEffect(()=>{ne&&me.revalidate()},[ne]),n.useEffect(()=>{switch(Q){case"SCHEDULE":case"DSO_ACCEPT":case"ACCEPT":case"ASSIGN":case"GENERATE_DEMAND":case"FSM_GENERATE_DEMAND":case"REASSIGN":case"COMPLETE":case"COMPLETED":case"CANCEL":case"SENDBACK":case"DSO_REJECT":case"REJECT":case"DECLINE":case"REASSING":case"UPDATE":return te(!0);case"SUBMIT":case"FSM_SUBMIT":return j.push("/digit-ui/employee/fsm/modify-application/"+$);case"PAY":case"FSM_PAY":case"ADDITIONAL_PAY_REQUEST":return j.push(`/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/${$}?workflow=FSM`)}},[Q]);const Ee=()=>{J(null),te(!1)},_e=()=>{le(null)};function Se(e,t){ae(e)}const fe=e=>{var n;const i=null==e||null===(n=e.comment)||void 0===n?void 0:n.split("~"),o=i?i[0]:null,r=i?i[1]:null;if("CREATED"===e.status){var u,s,d;const t={date:null==e||null===(u=e.auditDetails)||void 0===u?void 0:u.created,name:null==e?void 0:e.assigner,mobileNumber:null==ce||null===(s=ce.citizen)||void 0===s?void 0:s.mobileNumber,emailId:null==ce||null===(d=ce.citizen)||void 0===d?void 0:d.emailId,source:(null==ce?void 0:ce.source)||""};return l.createElement(ge,{data:t})}if("PENDING_APPL_FEE_PAYMENT"===e.status||"DSO_REJECTED"===e.status||"CANCELED"===e.status||"REJECTED"===e.status){var c;const t={date:null==e||null===(c=e.auditDetails)||void 0===c?void 0:c.created,name:null==e?void 0:e.assigner,comment:o?z("ES_ACTION_REASON_"+o):null,otherComment:r||null};return l.createElement(ge,{data:t})}if("DSO_INPROGRESS"===e.status){var p;const t={name:null==e?void 0:e.assigner,mobileNumber:null==e||null===(p=e.assigner)||void 0===p?void 0:p.mobileNumber,date:`${z("CS_FSM_EXPECTED_DATE")} ${Digit.DateUtils.ConvertTimestampToDate(null==ce?void 0:ce.possibleServiceDate)}`};return l.createElement(ge,{data:t})}if("COMPLETED"===e.status)return l.createElement("div",null,l.createElement(t.Rating,{withText:!0,text:z("ES_FSM_YOU_RATED"),currentRating:e.rating}),l.createElement(a.Link,{to:"/digit-ui/employee/fsm/rate-view/"+$},l.createElement(t.ActionLinks,null,z("CS_FSM_RATE_VIEW"))));if("WAITING_FOR_DISPOSAL"===e.status||"DISPOSAL_IN_PROGRESS"===e.status||"DISPOSED"===e.status||"CITIZEN_FEEDBACK_PENDING"===e.status){var m,v;const t={date:null==e||null===(m=e.auditDetails)||void 0===m?void 0:m.created,name:null==e?void 0:e.assigner,mobileNumber:null==e||null===(v=e.assigner)||void 0===v?void 0:v.mobileNumber};return null!=e&&e.numberOfTrips&&(t.comment=`${z("NUMBER_OF_TRIPS")}: ${null==e?void 0:e.numberOfTrips}`),l.createElement(ge,{data:t})}};return ue?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,ue?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l.createElement(t.Header,{style:{marginBottom:"16px"}},z("ES_TITLE_APPLICATION_DETAILS")),l.createElement(t.LinkButton,{label:z("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}})),l.createElement(t.Card,{className:"fsm",style:{position:"relative"}},null==se?void 0:se.applicationDetails.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},0===n?null:l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z(e.title)),l.createElement(t.StatusTable,null,null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,i)=>{var a;return null===n?null:l.createElement(t.Row,!0===n.map&&"N/A"!==n.value?{key:z(n.title),label:z(n.title),text:l.createElement("img",{src:z(n.value),alt:""})}:{key:z(n.title),label:z(n.title),text:z(n.value)||"N/A",last:i===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:n.caption,className:"border-none"})})))}),(null==ce||null===(u=ce.pitDetail)||void 0===u||null===(s=u.additionalDetails)||void 0===s||null===(d=s.fileStoreId)||void 0===d||null===(c=d.CITIZEN)||void 0===c?void 0:c.length)&&l.createElement(n.Fragment,null,l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z("ES_FSM_SUB_HEADING_CITIZEN_UPLOADS")),l.createElement(rt,{fileStoreIds:null==ce||null===(p=ce.pitDetail)||void 0===p||null===(m=p.additionalDetails)||void 0===m||null===(v=m.fileStoreId)||void 0===v?void 0:v.CITIZEN,tenantId:K,onClick:(e,t)=>Se(e)})),(null==ce||null===(E=ce.pitDetail)||void 0===E||null===(_=E.additionalDetails)||void 0===_||null===(S=_.fileStoreId)||void 0===S||null===(f=S.FSM_DSO)||void 0===f?void 0:f.length)&&l.createElement(n.Fragment,null,l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z("ES_FSM_SUB_HEADING_DSO_UPLOADS")),l.createElement(rt,{fileStoreIds:null==ce||null===(y=ce.pitDetail)||void 0===y||null===(T=y.additionalDetails)||void 0===T||null===(g=T.fileStoreId)||void 0===g?void 0:g.FSM_DSO,tenantId:W,onClick:(e,t)=>Se(e)})),ie?l.createElement(t.ImageViewer,{imageSrc:ie,onClose:function(){ae(null)}}):null,l.createElement(t.BreakLine,null),((null==me?void 0:me.isLoading)||de)&&l.createElement(t.Loader,null),!(null!=me&&me.isLoading)&&!de&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},z("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=me&&null!==(h=me.data)&&void 0!==h&&h.timeline&&1===(null==me||null===(I=me.data)||void 0===I||null===(C=I.timeline)||void 0===C?void 0:C.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:z("CS_COMMON_"+(null==me||null===(N=me.data)||void 0===N||null===(A=N.timeline[0])||void 0===A?void 0:A.status)),customChild:fe(null==me||null===(D=me.data)||void 0===D?void 0:D.timeline[0])}):l.createElement(t.ConnectingCheckPoints,null,(null==me||null===(O=me.data)||void 0===O?void 0:O.timeline)&&(null==me||null===(L=me.data)||void 0===L?void 0:L.timeline.slice(0,oe?me.data.timeline.length:2).map((e,n,i)=>l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,label:z(`CS_COMMON_FSM_${"UPDATE"===e.performedAction?"UPDATE_":""}${e.status}`),customChild:fe(e)}))))),(null==me||null===(P=me.data)||void 0===P||null===(b=P.timeline)||void 0===b?void 0:b.length)>2&&l.createElement(t.LinkButton,{label:z(oe?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{re(e=>!e)}})))),ee?l.createElement(ot,{t:z,action:Q,tenantId:W,state:K,id:$,closeModal:Ee,submitAction:e=>{pe(e,{onError:(e,t)=>{le({key:"error",action:e}),setTimeout(_e,5e3)},onSuccess:(e,t)=>{le({key:"success",action:Q}),setTimeout(_e,5e3),X.invalidateQueries("FSM_CITIZEN_SEARCH");const n=X.getQueryData("FUNCTION_RESET_INBOX");null==n||n.revalidate()}}),Ee()},actionData:null==me||null===(R=me.data)||void 0===R?void 0:R.timeline,module:null==me||null===(M=me.data)||void 0===M?void 0:M.applicationBusinessService}):null,ne&&l.createElement(t.Toast,{error:"error"===ne.key,label:z("success"===ne.key?`ES_FSM_${ne.action}_UPDATE_SUCCESS`:ne.action),onClose:_e}),!(null!=me&&me.isLoading)&&1===(null==me||null===(k=me.data)||void 0===k||null===(w=k.nextActions)||void 0===w?void 0:w.length)&&"RATE"!==(null==me||null===(F=me.data)||void 0===F||null===(x=F.nextActions)||void 0===x||null===(H=x[0])||void 0===H?void 0:H.action)&&l.createElement(t.ActionBar,{style:{zIndex:"19"}},l.createElement(t.SubmitBar,{label:z("ES_FSM_"+(null==me||null===(V=me.data)||void 0===V?void 0:V.nextActions[0].action)),onSubmit:()=>{var e;return ve(null==me||null===(e=me.data)||void 0===e?void 0:e.nextActions[0].action)}})),!(null!=me&&me.isLoading)&&(null==me||null===(B=me.data)||void 0===B||null===(U=B.nextActions)||void 0===U?void 0:U.length)>1&&l.createElement(t.ActionBar,{style:{zIndex:"19"}},q&&null!=me&&null!==(Y=me.data)&&void 0!==Y&&Y.nextActions?l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM",options:null==me||null===(G=me.data)||void 0===G?void 0:G.nextActions.map(e=>e.action),t:z,onSelect:ve}):null,l.createElement(t.SubmitBar,{label:z("ES_COMMON_TAKE_ACTION"),onSubmit:()=>Z(!q)}))))},FSMFstpOperatorDetails:()=>{var e,o,u,s,d,c,p,m,v,E,_,S,f,y,T,g,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B,U,Y,G,W,K,z,j,X,$,q,Z,Q,J,ee,te,ne;const le=Digit.ULBService.getStateId();let ie=window.Digit.Utils.browser.isMobile();const{t:ae}=i.useTranslation(),oe=a.useHistory(),re=r.useQueryClient(),ue=Digit.ULBService.getCurrentTenantId(),se=Digit.Hooks.fsm.useTenants(),de=Digit.ULBService.getStateId();let{id:ce}=a.useParams();const pe=!!oe.location.pathname.includes("new"),{data:me}=Digit.Hooks.fsm.useMDMS(ue,"FSM","UrcConfig"),ve=me&&me.length>0&&me[0].URCEnable,[Ee,_e]=n.useState(()=>se.filter(e=>(null==e?void 0:e.code)===ue)[0]||null);let Se=[{active:!0,code:"WITHIN_ULB_LIMITS",i18nKey:"WITHIN_ULB_LIMITS",name:"Witnin ULB Limits"},{active:!0,code:"FROM_GRAM_PANCHAYAT",i18nKey:"FROM_GRAM_PANCHAYAT",name:"From Gram Panchayat"},{active:!0,code:"FROM_OTHER_ULB",i18nKey:"FROM_OTHER_ULB",name:"From Other/Outside ULBs"}];const{data:fe}=Digit.Hooks.useBoundaryLocalities(null==Ee?void 0:Ee.code,"revenue",{enabled:!!Ee},ae);var{data:ye}=Digit.Hooks.useBoundaryLocalities(null==Ee?void 0:Ee.code,"gramPanchayats",{enabled:!!Ee},ae);const[Te,ge]=n.useState(null!=ce?{applicationNos:ce}:{applicationNos:"null"}),[he,Ie]=n.useState(!1),[Ce,Ne]=n.useState({}),[Ae,De]=n.useState(null),[Oe,Le]=n.useState(null),[Pe,be]=n.useState(null),[Re,Me]=n.useState({}),[ke,we]=n.useState(null),[Fe,xe]=n.useState(()=>{const e=new Date;return`${(e.getHours()<10?"0":"")+e.getHours()}:${(e.getMinutes()<10?"0":"")+e.getMinutes()}`}),[He,Ve]=n.useState(!1),[Be,Ue]=n.useState(null),[Ye,Ge]=n.useState(!1),[We,Ke]=n.useState(),[ze,je]=n.useState(),[Xe,$e]=n.useState(),[qe,Ze]=n.useState(),Qe=n.useRef(),Je=n.useRef(),et=n.useRef(),[tt,nt]=n.useState(),[lt,it]=n.useState(null),[at,rt]=n.useState(Array),[ut,st]=n.useState(null),[dt,vt]=n.useState(ce),[Et,_t]=n.useState(null),[St,ft]=n.useState(null),[yt,Tt]=n.useState(),gt=a.useLocation(),[ht,It]=n.useState(pe?Se[0]:null),[Ct,Nt]=n.useState(),[At,Dt]=n.useState(),[Ot,Lt]=n.useState([]),[Pt,bt]=n.useState(),[Rt,Mt]=n.useState(null),[kt,wt]=n.useState(),[Ft,xt]=n.useState(),[Ht,Vt]=n.useState(),Bt=e=>{_t(e)},{isSuccess:Ut,data:Yt}=Digit.Hooks.fsm.useVehicleSearch({tenantId:ue,totalconfig:mt}),{isLoading:Gt,isSuccess:Wt,data:Kt}=Digit.Hooks.fsm.useVehicleSearch({tenantId:ue,filters:Te,config:pt}),{isLoading:zt,isIdle:jt,data:{data:{table:Xt}={}}={}}=Digit.Hooks.fsm.useSearchAll(ue,Ce,null,{enabled:!!he});n.useEffect(()=>{fe&&fe.length>0&&Vt(fe)},[fe]),n.useEffect(()=>{ye&&ye.length>0&&Nt(ye)},[ye]),n.useEffect(()=>{Ze(0==(null==Xe?void 0:Xe.length)?1:We-(null==Xe?void 0:Xe.length)+1)},[We,Xe,Yt,Ut,Wt]);const $t=Digit.Hooks.useWorkflowDetails({tenantId:ue,id:gt.pathname.includes("fstp-operator-details")?ce:null,moduleCode:"FSM_VEHICLE_TRIP",role:"FSM_EMP_FSTPO"}),qt=Digit.Hooks.fsm.useVehicleUpdate(ue),Zt=Digit.Hooks.fsm.useVehicleTripCreate(ue);n.useEffect(()=>{if(Wt){var e;be();const t=null==Kt||null===(e=Kt.tripDetails)||void 0===e?void 0:e.map(e=>e.referenceNo).join(",");Ne(t?{applicationNos:t}:{applicationNos:"null"}),Ie(!0)}},[Wt]),n.useEffect(()=>{if(Wt){var e,t;Le(null==Kt||null===(e=Kt.vehicle)||void 0===e?void 0:e.tankCapacity);const n=null==Kt||null===(t=Kt.tripDetails)||void 0===t?void 0:t.map(e=>e.referenceNo).join(",");Ne(n?{applicationNos:n}:{applicationNos:"null"}),Ie(!0)}},[Wt]),n.useEffect(()=>{var e,t;jt||zt||!Xt||(Ke(null===(e=Xt[0])||void 0===e?void 0:e.noOfTrips),je(null===(t=Xt[0])||void 0===t?void 0:t.applicationNo))},[zt,jt,Xt]),n.useEffect(()=>{switch(Be){case"DECLINEVEHICLE":return Ge(!0);case"DISPOSE":case"READY_FOR_DISPOSAL":Ue(null),oe.location.pathname.includes("new")?Jt():Qt();default:Ue()}},[Be]),n.useEffect(()=>{if(Ut){var e;const t=null==Yt||null===(e=Yt.vehicleTrip)||void 0===e?void 0:e.filter((e,t,n)=>{var l;return(null==e||null===(l=e.tripDetails[0])||void 0===l?void 0:l.referenceNo)===ze&&"WAITING_FOR_DISPOSAL"===(null==e?void 0:e.applicationStatus)});$e(t)}},[Ut,Yt,Wt,jt,ze]);const Qt=()=>{const e=Xt.reduce((e,t)=>e+t.volume,0);if(ce&&(!Pe||Pe>e||Pe>Kt.vehicle.tankCapacity))return Me({wasteRecieved:"ES_FSTP_INVALID_WASTE_AMOUNT"}),void Qe.current.scrollIntoView({behavior:"smooth",block:"center"});if(null===ke)return Me({tripStartTime:"ES_FSTP_INVALID_START_TIME"}),void Je.current.scrollIntoView({behavior:"smooth",block:"center"});if(null===Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});if(ke===Fe||ke>Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});Me({});const t=new Date,n=Date.parse(new Date(t.toString().split(":")[0].slice(0,-2)+Fe))/1e3,l=Date.parse(new Date(t.toString().split(":")[0].slice(0,-2)+ke))/1e3,i={tripNo:qe};Kt.tripStartTime=l,Kt.fstpEntryTime=l,Kt.tripEndTime=n,Kt.fstpExitTime=n,Kt.volumeCarried=Pe,Kt.tripDetails[0].additionalDetails=i,Kt.additionalDetails={fileStoreId:at,comments:yt,vehicleCapacity:Oe},qt.mutate({vehicleTrip:[Kt],workflow:{action:"DISPOSE"}},{onSuccess:tn,onError:nn})},Jt=()=>{var e,t,n,l;const i=new RegExp("[A-Z]{2}\\s{0,1}[0-9]{2}\\s{0,1}[A-Z]{0,2}\\s{0,1}[0-9]{4}"),a=new RegExp(/^[A-Za-z0-9 ]*$/),o=new RegExp(/^[A-Za-z0-9 ]*$/);if(!i.test(dt))return De({key:"error",action:"ES_FSM_VEHICLE_FORMAT_TIP"}),void setTimeout(()=>{en()},5e3);if(null===St||0===(null==St||null===(e=St.trim())||void 0===e?void 0:e.length)||!a.test(St))return De({key:"error",action:"ES_FSTP_INVALID_DSO_NAME"}),void setTimeout(()=>{en()},2e3);if(!("FROM_GRAM_PANCHAYAT"===(null==ht?void 0:ht.code)||void 0!==Ft&&"Other"!==(null==Ft?void 0:Ft.name)||null!==Et&&0!==(null==Et||null===(t=Et.trim())||void 0===t?void 0:t.length)&&o.test(Et)))return De({key:"error",action:"ES_FSTP_INVALID_LOCALITY"}),void setTimeout(()=>{en()},2e3);if(!("FROM_GRAM_PANCHAYAT"!==(null==ht?void 0:ht.code)||void 0!==At&&"Other"!==(null==At?void 0:At.name)||null!==Rt&&0!==(null==Rt||null===(n=Rt.trim())||void 0===n?void 0:n.length)))return De({key:"error",action:"ES_FSTP_SELECT_GRAMPANCHAYAT"}),void setTimeout(()=>{en()},2e3);if(null===ke)return Me({tripStartTime:"ES_FSTP_INVALID_START_TIME"}),void Je.current.scrollIntoView({behavior:"smooth",block:"center"});if(!Pe||0===(null==Pe||null===(l=Pe.trim())||void 0===l?void 0:l.length))return De({key:"error",action:"ES_FSTP_INVALID_WASTE_AMOUNT"}),void setTimeout(()=>{en()},2e3);if(null===Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});if(ke===Fe||ke>Fe)return Me({tripTime:"ES_FSTP_INVALID_TRIP_TIME"}),void et.current.scrollIntoView({behavior:"smooth",block:"center"});Me({});let r={};const u=new Date,s=Date.parse(new Date(u.toString().split(":")[0].slice(0,-2)+Fe))/1e3,d=Date.parse(new Date(u.toString().split(":")[0].slice(0,-2)+ke))/1e3;r.tenantId=ue,r.status="ACTIVE",r.tripStartTime=d,r.tripEndTime=s,r.volumeCarried=Pe,r.additionalDetails={vehicleNumber:dt||ce,dsoName:St,locality:Et,vehiclecapacity:Oe,fileStoreId:at,comments:yt,gramPanchayat:At,village:Pt,newGramPanchayat:Rt,newVillage:kt,boundaryType:"FROM_GRAM_PANCHAYAT"===(null==ht?void 0:ht.code)?"GP":"Locality",propertyLocation:null==ht?void 0:ht.code,newLocality:Et},r.businessService="FSM_VEHICLE_TRIP",r.tripDetails=[{tenantId:ue,status:"ACTIVE"}],Zt.mutate({vehicleTrip:[r]},{onSuccess:tn,onError:nn})},en=()=>{De(null)},tn=()=>{"DECLINEVEHICLE"===Be&&Ge(!1),re.invalidateQueries("FSM_VEHICLE_DATA"),De({key:"success",action:"ES_FSM_DISPOSE_UPDATE_SUCCESS"}),setTimeout(()=>{en(),oe.push("/digit-ui/employee")},5e3)},nn=()=>{"DECLINEVEHICLE"===Be&&(Ge(!1),Ue(null)),re.invalidateQueries("FSM_VEHICLE_DATA"),De({key:"error",action:"ES_FSM_DISPOSE_UPDATE_FAILURE"}),setTimeout(()=>{en()},5e3)};if(Gt)return l.createElement(t.Loader,null);const ln=[{title:ae("ES_INBOX_VEHICLE_NO")+" *",value:(null==Kt||null===(e=Kt.vehicle)||void 0===e?void 0:e.registrationNumber)||ce||l.createElement(t.TextInput,{onChange:e=>{vt(e.target.value)},value:dt})},{title:ae("ES_INBOX_DSO_NAME")+" *",value:(null==Kt||null===(o=Kt.tripOwner)||void 0===o?void 0:o.name)||l.createElement(t.TextInput,{onChange:e=>{ft(e.target.value)},value:St})}],an=(e,t)=>{"string"==typeof e&&t(e)};function on(e){Ue(e),Ve(!1)}const rn=e=>{wt(e)};return l.createElement("div",null,l.createElement(t.Header,{styles:{marginLeft:"16px"}},ae("ES_INBOX_VEHICLE_LOG")),l.createElement(t.Card,null,l.createElement(t.StatusTable,null,null==ln?void 0:ln.map((e,n)=>l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:e.title,label:e.title,text:e.value||"N/A",last:!1,labelStyle:{fontWeight:"normal"}})),pe&&ve&&l.createElement("div",{style:!ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"flex",justifyContent:"space-between",paddingBottom:"8px",marginBottom:"8px"}:{}},l.createElement(t.CardLabel,null,ae("CS_PROPERTY_LOCATION")+" *"),l.createElement("div",{style:!ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"50%"}:{}},l.createElement(t.RadioButtons,{selectedOption:ht,onSelect:function(e){It(e)},style:!ie&&oe.location.pathname.includes("new-vehicle-entry")?{marginBottom:0}:{},innerStyles:{marginLeft:"10px"},options:Se,optionsKey:"i18nKey"}))),("FROM_GRAM_PANCHAYAT"===(null==ht?void 0:ht.code)||Xt&&Xt.length>0&&"Village"===(null===(u=Xt[0])||void 0===u||null===(s=u.address)||void 0===s||null===(d=s.additionalDetails)||void 0===d?void 0:d.boundaryType)||Xt&&Xt.length>0&&"GP"===(null===(c=Xt[0])||void 0===c||null===(p=c.address)||void 0===p||null===(m=p.additionalDetails)||void 0===m?void 0:m.boundaryType))&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("CS_GRAM_PANCHAYAT"),label:ae("CS_GRAM_PANCHAYAT")+" * ",text:Xt&&Xt.length>0?null===(v=Xt[0])||void 0===v||null===(E=v.address)||void 0===E||null===(_=E.additionalDetails)||void 0===_||null===(S=_.gramPanchayat)||void 0===S?void 0:S.name:l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:At,option:Ct,select:function(e){if(Dt(e),"Other"!==e.name){var t,n=(null===(t=Ct.filter(t=>t.code===e.code)[0])||void 0===t?void 0:t.children).map(e=>({...e,i18nkey:ue.replace(".","_").toUpperCase()+"_"+e.code}));n.length>0&&(n.push({code:"OTHER",name:"Other",i18nkey:ue.replace(".","_").toUpperCase()+"_OTHER"}),Lt(n))}},optionKey:"i18nkey",style:{width:"100%"},t:ae}),last:!1,labelStyle:{fontWeight:"normal"}}),"Other"===(null==At?void 0:At.name)&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT"),label:ae("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")+" * ",text:Xt&&Xt.length>0?null===(f=Xt[0])||void 0===f||null===(y=f.address)||void 0===y||null===(T=y.locality)||void 0===T?void 0:T.name:l.createElement(t.TextInput,{onChange:e=>{Mt(e.target.value)},value:Rt}),last:!1,labelStyle:{fontWeight:"normal"}}),l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE"),label:""+ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE"),text:Xt&&Xt.length>0?null===(g=Xt[0])||void 0===g||null===(h=g.address)||void 0===h||null===(I=h.locality)||void 0===I?void 0:I.name:l.createElement(t.TextInput,{onChange:e=>rn(e.target.value),value:kt}),last:!1,labelStyle:{fontWeight:"normal"}})),"Other"!==(null==At?void 0:At.name)&&l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("CS_VILLAGE_NAME"),label:""+ae("CS_VILLAGE_NAME"),text:Xt&&Xt.length>0?null!==(C=Xt[0])&&void 0!==C&&null!==(N=C.address)&&void 0!==N&&null!==(A=N.additionalDetails)&&void 0!==A&&null!==(D=A.village)&&void 0!==D&&D.name?null===(O=Xt[0])||void 0===O||null===(L=O.address)||void 0===L||null===(P=L.additionalDetails)||void 0===P||null===(b=P.village)||void 0===b?void 0:b.name:"N/A":Ot.length>0?l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:Pt,option:Ot,select:function(e){bt(e)},optionKey:"i18nkey",style:{width:"100%"},t:ae}):l.createElement(t.TextInput,{onChange:e=>rn(e.target.value),value:kt}),last:!1,labelStyle:{fontWeight:"normal"}}),"OTHER"===(null==Pt?void 0:Pt.code)&&l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE"),label:ae("ES_INBOX_PLEASE_SPECIFY_VILLAGE")+" * ",text:Xt&&Xt.length>0?null===(R=Xt[0])||void 0===R||null===(M=R.address)||void 0===M||null===(k=M.locality)||void 0===k?void 0:k.name:l.createElement(t.TextInput,{onChange:e=>rn(e.target.value),value:kt}),last:!1,labelStyle:{fontWeight:"normal"}})),("WITHIN_ULB_LIMITS"===(null==ht?void 0:ht.code)||Xt&&Xt.length>0&&"Locality"===(null===(w=Xt[0])||void 0===w||null===(F=w.address)||void 0===F||null===(x=F.additionalDetails)||void 0===x?void 0:x.boundaryType))&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_LOCALITY"),label:ae("ES_INBOX_LOCALITY")+" * ",text:Xt&&Xt.length>0?null===(H=Xt[0])||void 0===H||null===(V=H.address)||void 0===V||null===(B=V.locality)||void 0===B?void 0:B.name:l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:Ft,option:null==Ht?void 0:Ht.sort((e,t)=>e.name.localeCompare(t.name)),select:function(e){xt(e)},optionKey:"i18nkey",style:{width:"100%"},t:ae}),last:!1,labelStyle:{fontWeight:"normal"}}),"Other"===(null==Ft?void 0:Ft.name)&&l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_PLEASE_SPECIFY_LOCALITY"),label:ae("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" * ",text:Xt&&Xt.length>0?null===(U=Xt[0])||void 0===U||null===(Y=U.address)||void 0===Y||null===(G=Y.locality)||void 0===G?void 0:G.name:l.createElement(t.TextInput,{onChange:e=>Bt(e.target.value),value:Et}),last:!1,labelStyle:{fontWeight:"normal"}})),"FROM_OTHER_ULB"===(null==ht?void 0:ht.code)&&l.createElement("div",null,l.createElement(t.Row,{rowContainerStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{display:"block"}:{justifyContent:"space-between"},textStyle:ie&&oe.location.pathname.includes("new-vehicle-entry")?{width:"100%"}:{},key:ae("ES_INBOX_LOCALITY"),label:ae("ES_INBOX_LOCALITY")+" * ",text:Xt&&Xt.length>0?null===(W=Xt[0])||void 0===W||null===(K=W.address)||void 0===K||null===(z=K.locality)||void 0===z?void 0:z.name:l.createElement(t.TextInput,{onChange:e=>Bt(e.target.value),value:Et}),last:!1,labelStyle:{fontWeight:"normal"}})),l.createElement("div",{ref:Je},l.createElement(t.CardLabelError,null,ae(Re.tripStartTime))),l.createElement("form",null,l.createElement(t.Row,{key:ae("ES_VEHICLE_IN_TIME"),label:ae("ES_VEHICLE_IN_TIME")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"},text:l.createElement("div",null,l.createElement(ct,{name:"tripStartTime",onChange:e=>an(e,we),value:ke}))}),l.createElement(t.Row,{key:ae("ES_VEHICLE_CAPACITY"),label:ae("ES_VEHICLE_CAPACITY")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},text:l.createElement("div",null,l.createElement(t.TextInput,{type:"number",name:"vehicleCapacity",value:Oe,onChange:e=>{Le(e.target.value)},disable:!0})),rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"}}),l.createElement("div",{ref:Qe},l.createElement(t.CardLabelError,null,ae(Re.wasteRecieved))),l.createElement(t.Row,{key:ae("ES_VEHICLE_SEPTAGE_DUMPED"),label:ae("ES_VEHICLE_SEPTAGE_DUMPED")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},text:l.createElement("div",null,l.createElement(t.TextInput,{type:"number",name:"wasteRecieved",value:Pe,onChange:e=>{const{name:t,value:n}=e.target;"tripTime"===t?xe(n):"wasteRecieved"===t&&be(n)}})),rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"}}),l.createElement("div",{ref:et},l.createElement(t.CardLabelError,null,ae(Re.tripTime))),l.createElement(t.Row,{key:ae("ES_VEHICLE_OUT_TIME"),label:ae("ES_VEHICLE_OUT_TIME")+" * ",labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between"},text:l.createElement("div",null,l.createElement(ct,{name:"tripTime",onChange:e=>an(e,xe),value:Fe}))}),l.createElement("div",{className:!ie&&"row",style:ie?{}:{diplay:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement(t.CardLabel,{style:{fontWeight:"normal"}}," ",ae("ES_FSM_ADDITIONAL_DETAILS")," "),l.createElement(t.TextArea,{className:"form-field",onChange:e=>{if(e.target.value.length>1024)return null;Tt(e.target.value)},style:ie?{width:"100%"}:{width:"100%",marginLeft:"35%"}})),l.createElement(t.Row,{key:ae("ES_FSM_ATTACHMENTS"),label:""+ae("ES_FSM_ATTACHMENT"),labelStyle:{minWidth:"fit-content",fontWeight:"normal"},textStyle:ie?{width:"100%"}:{},rowContainerStyle:ie?{display:"block"}:{justifyContent:"space-between",alignItems:"center"},text:l.createElement(t.MultiUploadWrapper,{t:ae,module:"fsm",tenantId:le,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);!function(e){if(e){var t;let n=[...at,null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId];rt(n),e&&it(e.file)}}(n[n.length-1])})(e)})}),!(null!=$t&&$t.isLoading)&&(null==$t||null===(j=$t.data)||void 0===j||null===(X=j.nextActions)||void 0===X?void 0:X.length)>0&&(1===(null==$t||null===($=$t.data)||void 0===$||null===(q=$.nextActions)||void 0===q?void 0:q.length)?l.createElement(t.ActionBar,null,l.createElement(t.SubmitBar,{label:ae("CS_ACTION_"+(null==$t||null===(Z=$t.data)||void 0===Z||null===(Q=Z.nextActions)||void 0===Q||null===(J=Q[0])||void 0===J?void 0:J.action)),onSubmit:()=>{var e,t,n;return on(null==$t||null===(e=$t.data)||void 0===e||null===(t=e.nextActions)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.action)}})):l.createElement(t.ActionBar,null,He&&null!=$t&&null!==(ee=$t.data)&&void 0!==ee&&ee.nextActions?l.createElement(t.Menu,{localeKeyPrefix:"",options:null==$t||null===(te=$t.data)||void 0===te?void 0:te.nextActions.map(e=>e.action),t:ae,onSelect:on}):null,l.createElement(t.SubmitBar,{label:ae("ES_COMMON_TAKE_ACTION"),onSubmit:()=>Ve(!He)})))),Ye?l.createElement(ot,{t:ae,action:Be,tenantId:ue,state:de,id:ce,closeModal:()=>{Ue(null),Ge(!1)},submitAction:e=>{var t,n;Kt.additionalDetails={comments:null==e||null===(t=e.workflow)||void 0===t?void 0:t.comments,vehicleDeclineReason:null==e||null===(n=e.workflow)||void 0===n?void 0:n.fstpoRejectionReason},qt.mutate({vehicleTrip:[Kt],workflow:{action:"DECLINEVEHICLE"}},{onSuccess:tn,onError:nn})},actionData:null==$t||null===(ne=$t.data)||void 0===ne?void 0:ne.timeline}):null)),Ae&&l.createElement(t.Toast,{error:"error"===Ae.key,label:ae(Ae.action),onClose:en}))},FSMResponse:e=>{var o,u,s,d,c,p,m,v,E,_,S,f,y,T;const g=a.useHistory(),[h,I]=n.useState(null),{t:C}=i.useTranslation(),N=r.useQueryClient(),A=Digit.UserService.hasAccess("FSM_COLLECTOR"),D=Digit.UserService.hasAccess("FSM_EDITOR_EMP")||!1,O=Digit.UserService.hasAccess("CITIZEN")||window.location.pathname.includes("citizen")||!1,L=Digit.ULBService.getCurrentTenantId(),P=Digit.ULBService.getStateId(),{state:b}=e.location,R="update"===b.key?Digit.Hooks.fsm.useApplicationActions(L):Digit.Hooks.fsm.useDesludging(L),{data:M}=Digit.Hooks.useStore.getInitData(),{tenants:k}=M||{},[w,F,x]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[H,V,B]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[U,Y,G]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),[W,K]=n.useState(!1),[z,j]=n.useState(null);sessionStorage.removeItem("Digit_FSM_PT");const X=(e,t)=>{var n,l,i;V((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(i=l.Errors[0])||void 0===i?void 0:i.code)||(null==e?void 0:e.message)||"ERROR"),F(!0)};n.useEffect(()=>{R.data&&Y(R.data)},[R.data]);const $=null==R||null===(o=R.data)||void 0===o||null===(u=o.fsm)||void 0===u||null===(s=u[0].address)||void 0===s||null===(d=s.locality)||void 0===d?void 0:d.code,q=null==R||null===(c=R.data)||void 0===c||null===(p=c.fsm)||void 0===p||null===(m=p[0].address)||void 0===m?void 0:m.slumName,Z=Digit.Hooks.fsm.useSlum(null==R||null===(v=R.data)||void 0===v||null===(E=v.fsm)||void 0===E||null===(_=E[0])||void 0===_?void 0:_.tenantId,q,$,{enabled:!!q,retry:!!q}),{data:Q}=Digit.Hooks.fsm.useMDMS(P,"Vehicle","VehicleType",{staleTime:Infinity}),J=(null==R?void 0:R.data)||U,ee=((e,t)=>(null==e?void 0:e.i18nKey)&&(null==e?void 0:e.capacity)&&`${t(e.i18nKey)} - ${e.capacity} ${t("CS_COMMON_CAPACITY_LTRS")}`||null)(null==Q?void 0:Q.find(e=>{var t,n;return(null==J||null===(t=J.fsm)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.vehicleType)===(null==e?void 0:e.code)}),C);let te=null===(S=J.fsm)||void 0===S?void 0:S[0].applicationNo;const{data:ne}=Digit.Hooks.fsm.usePaymentHistory(L,te),le=()=>{I(null)};function ie(e){j(e),K(!1)}if(n.useEffect(()=>{w||H||R.mutate("update"===b.key?{fsm:b.applicationData,workflow:{action:b.action,...b.actionData}}:b,{onError:X,onSuccess:()=>{N.clear(),F(!0),window.history.replaceState({},"FSM_CREATE_RESPONSE")}})},[]),n.useEffect(()=>{switch(z){case"GO_TO_HOME":return g.push(O?"/digit-ui/citizen":"/digit-ui/employee");case"ASSIGN_TO_DSO":return g.push("/digit-ui/employee/fsm/application-details/"+te);case"PAY":return void("POST_PAY"===(null==J||null===(e=J.fsm)||void 0===e?void 0:e[0].paymentPreference)?(I({key:"error",action:"ES_FSM_PAYMENT_BEFORE_SCHEDULE_FAILURE"}),setTimeout(()=>{le()},5e3)):g.push("/digit-ui/employee/payment/collect/FSM.TRIP_CHARGES/"+((null==b||null===(t=b.applicationData)||void 0===t?void 0:t.applicationNo)||(null==J||null===(n=J.fsm)||void 0===n?void 0:n[0].applicationNo))))}var e,t,n},[z]),R.isLoading||R.isIdle&&!w)return l.createElement(t.Loader,null);let ae=["GO_TO_HOME"];"PENDING_APPL_FEE_PAYMENT"===(null==J||null===(f=J.fsm)||void 0===f?void 0:f[0].applicationStatus)&&A?ae=[...ae,"PAY"]:"ASSING_DSO"===(null==J||null===(y=J.fsm)||void 0===y?void 0:y[0].applicationStatus)&&D&&(ae=[...ae,"ASSIGN_TO_DSO"]);const oe=!!U||(null==R?void 0:R.isSuccess);return l.createElement(t.Card,null,l.createElement(St,{t:C,data:J,action:b.action,isSuccess:oe,isLoading:R.isIdle&&!w||(null==R?void 0:R.isLoading),isEmployee:e.parentRoute.includes("employee"),errorInfo:H}),l.createElement(t.CardText,null,((e,t,n,l,i)=>Et("DISPLAY",e,t,n,l,i))(b.action,oe,e.parentRoute.includes("employee"),C,null==J||null===(T=J.fsm)||void 0===T?void 0:T[0])),oe&&l.createElement(t.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},"COMPLETED"===(null==J||null===(se=J.fsm)||void 0===se?void 0:se[0].applicationStatus)&&null!==(null==J||null===(de=J.fsm)||void 0===de?void 0:de[0].advanceAmount)?C("CS_COMMON_PAYMENT_RECEIPT"):C("CS_COMMON_DOWNLOAD")," ")),style:{width:"100px"},onClick:"COMPLETED"===(null==J||null===(re=J.fsm)||void 0===re?void 0:re[0].applicationStatus)&&null!==(null==J||null===(ue=J.fsm)||void 0===ue?void 0:ue[0].advanceAmount)?function(){try{var e;const n={filestoreIds:[null===(e=ne.Payments[0])||void 0===e?void 0:e.fileStoreId]},l=null!=n&&null!==(t=n.fileStoreIds)&&void 0!==t&&t[0]?Promise.resolve(Digit.PaymentService.printReciept(P,{fileStoreIds:n.filestoreIds[0]})).then(function(e){window.open(e[n.filestoreIds[0]],"_blank"),setShowOptions(!1)}):Promise.resolve(Digit.PaymentService.generatePdf(P,{Payments:[ne.Payments[0]]},"fsm-receipt")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(P,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[e.filestoreIds[0]],"_blank"),setShowOptions(!1)})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}var t}:()=>{const{fsm:e}=R.data||U,[t,...n]=e,l=k.find(e=>e.code===t.tenantId),i=Pe({...t,slum:Z,pdfVehicleType:ee},l,C);Digit.Utils.pdf.generate(i)}}),l.createElement(t.ActionBar,null,W?l.createElement(t.Menu,{localeKeyPrefix:"ES_COMMON",options:ae,t:C,onSelect:ie}):null,l.createElement(t.SubmitBar,1===ae.length?{label:C("ES_COMMON_"+ae[0]),onSubmit:()=>ie(ae[0])}:{label:C("ES_COMMON_TAKE_ACTION"),onSubmit:()=>K(!W)})),h&&l.createElement(t.Toast,{error:"error"===h.key,label:C("success"===h.key?h.action:"ES_FSM_PAYMENT_BEFORE_SCHEDULE_FAILURE"),onClose:le}));var re,ue,se,de},FSMApplicationAudit:e=>{var n,o,r;const{t:u}=i.useTranslation(),{id:s}=a.useParams(),{tenantId:d}=Digit.UserService.getUser().info,{data:c,isLoading:p}=Digit.Hooks.fsm.useApplicationAudit(d,{applicationNo:s}),m=l.useMemo(()=>[{Header:u("ES_AUDIT_WHEN"),accessor:"when"},{Header:u("ES_AUDIT_WHO"),accessor:"who"},{Header:u("ES_AUDIT_WHAT"),accessor:"what"}],[]),v=null==c||null===(n=c.fsmAudit)||void 0===n?void 0:n.map(e=>new Date(e.when).toLocaleString()),E=null==c||null===(o=c.fsmAudit)||void 0===o?void 0:o.map(e=>e.who),_=Digit.Hooks.useUserSearch(null,{uuid:E},{},{enabled:!!E}),S=null==c||null===(r=c.fsmAudit)||void 0===r?void 0:r.map((e,n)=>{const i=(e=>{var t;let n=null==_||null===(t=_.data)||void 0===t?void 0:t.user;return null!=n&&n.length?n.filter(t=>t.uuid===e)[0]:null})(e.who);return{when:v[n],who:`${null==i?void 0:i.name} (${null==i?void 0:i.type})`,what:0===n?l.createElement("p",null,"New Request"," ",l.createElement(a.Link,{to:"/digit-ui/employee/fsm/application-details/"+s},l.createElement(t.LinkButton,{label:u("ES_VIEW_APPLICATION"),style:{color:"#1671ba",marginLeft:"8px"}}))):l.createElement(l.Fragment,null,(o=e.what,Object.keys(o).map((e,t)=>l.createElement("p",{key:t},l.createElement("span",null,e)," : ",l.createElement("span",null,o[e])))))};var o});return p||_.isLoading?l.createElement(t.Loader,null):l.createElement("div",{style:{overflow:"auto"}},l.createElement(t.Header,null,u("ES_TITLE_APPLICATION_AUDIT")),l.createElement(t.Table,{t:u,data:S||[],columns:m,getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}})}))},FSMRateView:e=>{var n,o,r;const{t:u}=i.useTranslation(),s=Digit.ULBService.getCurrentTenantId();let{id:d}=a.useParams();const{isLoading:c,isSuccess:p,data:m}=Digit.Hooks.fsm.useSearch(s,{applicationNos:d}),{isLoading:v,data:E}=Digit.Hooks.useWorkflowDetails({tenantId:null==m?void 0:m.tenantId,id:d,moduleCode:"FSM",config:{enabled:p&&!!m}});return c||v?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(t.CardHeader,null,u("CS_RATE_HELP_US")),l.createElement(t.KeyNote,{keyValue:u("CS_FSM_YOU_RATED")},l.createElement(t.Rating,{currentRating:null==E||null===(n=E.timeline[0])||void 0===n?void 0:n.rating})),m.additionalDetails.CheckList.map(e=>l.createElement(t.KeyNote,{keyValue:u(e.code),note:e.value.split(",").map(e=>u(e)).join(", ")})),l.createElement(t.KeyNote,{keyValue:u("CS_COMMON_COMMENTS"),note:(null==E||null===(o=E.timeline[0])||void 0===o||null===(r=o.wfComment)||void 0===r?void 0:r[0])||"N/A"}))},FSMNewApplicationCitizen:e=>{let{parentRoute:o}=e;const u=r.useQueryClient(),s=a.useRouteMatch(),{t:d}=i.useTranslation(),{pathname:c}=a.useLocation(),p=a.useHistory(),m=Digit.ULBService.getStateId();let v=[],E=[];const[_,S,f]=Digit.Hooks.useSessionStorage("FSM_CITIZEN_FILE_PROPERTY",{}),{data:y,isLoading:T}=Digit.Hooks.fsm.useMDMS(m,"FSM","CommonFieldsConfig"),[,g]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,h]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,I]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);function C(e,t,n){S({..._,[e]:{..._[e],...t},source:"ONLINE"}),(e=>{const t=c.split("/").pop(),{nextStep:n}=E.find(e=>e.route===t);let l=p.push;if(e&&(l=p.replace),null===n)return l(o+"/new-application/check");l(`${s.path}/${n}`)})(n)}n.useEffect(()=>{null!=c&&c.includes("new-application/response")||(g(!1),I(),h())},[]);const N=()=>{};return T?l.createElement(t.Loader,null):(y.forEach(e=>{v=v.concat(e.body.filter(e=>!e.hideInCitizen))}),E=[{type:"component",route:"search-property",isMandatory:!0,component:"CPTSearchProperty",key:"cptsearchproperty",withoutLabel:!0,nextStep:"search-results",hideInEmployee:!0},{type:"component",route:"search-results",isMandatory:!0,component:"CPTSearchResults",key:"cptsearchresults",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"create-property",isMandatory:!0,component:"CPTCreateProperty",key:"cptcreateproperty",withoutLabel:!0,isSkipEnabled:!0,nextStep:"acknowledge-create-property",hideInEmployee:!0},{type:"component",route:"acknowledge-create-property",isMandatory:!0,component:"CPTAcknowledgement",key:"cptacknowledgement",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{type:"component",route:"property-details",isMandatory:!0,component:"CPTPropertyDetails",key:"propertydetails",withoutLabel:!0,nextStep:"property-type",hideInEmployee:!0},{head:"FSM_NEW_APPLICATION_PROPERTY",body:[{component:"CPTPropertySearchNSummary",withoutLabel:!0,key:"cpt",type:"component",hideInCitizen:!0}]},{label:"ES_NEW_APPLICATION_PROPERTY_TYPEs",isMandatory:!0,type:"component",route:"property-type",key:"propertyType",component:"SelectPropertyType",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"property-subtype"},{label:"ES_NEW_APPLICATION_PROPERTY_SUB-TYPE",isMandatory:!0,type:"component",route:"property-subtype",key:"subtype",component:"SelectPropertySubtype",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_LABEL",cardText:"CS_FILE_APPLICATION_PROPERTY_SUBTYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"map"},{route:"map",component:"FSMSelectGeolocation",nextStep:"pincode",hideInEmployee:!0,key:"address"},{route:"pincode",component:"FSMSelectPincode",texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PINCODE_LABEL",cardText:"CS_FILE_APPLICATION_PINCODE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"address",type:"component"},{route:"address",component:"FSMSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"locality-gramPanchayat",isMandatory:!0,type:"component"},{route:"locality-gramPanchayat",component:"SelectLocalityOrGramPanchayat",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"check-slum",isMandatory:!0,type:"component"},{type:"component",route:"check-slum",isMandatory:!0,component:"CheckSlum",texts:{header:"ES_NEW_APPLICATION_SLUM_CHECK",submitBarLabel:"CS_COMMON_NEXT"},key:"address",withoutLabel:!0,nextStep:"slum-details",hideInEmployee:!0},{type:"component",route:"slum-details",isMandatory:!0,component:"SelectSlumName",texts:{header:"CS_NEW_APPLICATION_SLUM_NAME",cardText:"CS_NEW_APPLICATION_SLUM_TEXT",submitBarLabel:"CS_COMMON_NEXT"},withoutLabel:!0,key:"address",nextStep:"street"},{type:"component",route:"street",component:"FSMSelectStreet",key:"address",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_STREET_DOOR_NO_LABEL",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"landmark"},{type:"component",route:"landmark",component:"FSMSelectLandmark",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TITLE",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_PROVIDE_LANDMARK_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",nextStep:"pit-type"},{label:"ES_NEW_APPLICATION_ROAD_WIDTH",isMandatory:!0,type:"component",route:"road-details",key:"roadWidth",hideInEmployee:!0,component:"SelectRoadDetails",texts:{header:"CS_FILE_PROPERTY_ROAD_WIDTH",cardText:"CS_FILE_PROPERTY_ROAD_WIDTH_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"tank-size"},{label:"ES_NEW_APPLICATION_PIT_TYPE",isMandatory:!0,type:"component",route:"pit-type",key:"pitType",component:"SelectPitType",texts:{header:"CS_FILE_PROPERTY_PIT_TYPE",cardText:"CS_FILE_PROPERTY_PIT_TYPE_TEXT",submitBarLabel:"CS_COMMON_NEXT"},nextStep:"road-details"},{route:"tank-size",component:"SelectTankSize",isMandatory:!1,texts:{headerCaption:"",header:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TITLE",cardText:"CS_FILE_APPLICATION_PIT_SEPTIC_TANK_SIZE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},type:"component",key:"pitDetail",nextStep:"select-payment-preference",label:"ES_NEW_APPLICATION_PIT_DIMENSION"},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTrips"},{label:"a",isMandatory:!0,type:"component",route:"select-trip-number",key:"selectTripNo",component:"SelectTripNo",hideInEmployee:!0,texts:{headerCaption:"",header:"ES_FSM_SERVICE_REQUEST",cardText:"ES_FSM_SERVICE_REQUEST_TEXT",skipText:"CORE_COMMON_SKIP_CONTINUE",submitBarLabel:"CS_COMMON_NEXT",skipLabel:"CS_COMMON_SERVICE_SKIP_INFO"},nextStep:"search-property"},{label:"a",isMandatory:!1,type:"component",route:"select-gender",hideInEmployee:!0,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:"select-payment-preference"},{label:"a",isMandatory:!1,type:"component",route:"select-payment-preference",key:"selectPaymentPreference",hideInEmployee:!0,component:"SelectPaymentPreference",texts:{headerCaption:"",header:"ES_FSM_PAYMENT_PREFERENCE_LABEL",cardText:"ES_FSM_PAYMENT_PREFERENCE_TEXT",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},nextStep:null},{type:"component",key:"tripData",withoutLabel:!0,component:"SelectTripData"},{type:"component",key:"advancepaymentPreference",withoutLabel:!0,component:"AdvanceCollection"}],E.indexRoute="select-trip-number",l.createElement(a.Switch,null,E.map((e,t)=>{const{component:n,texts:i,inputs:o,key:r}=e,u="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return l.createElement(a.Route,{path:`${s.path}/${e.route}`,key:t},l.createElement(u,{config:{texts:i,inputs:o,key:r},onSelect:C,onSkip:N,t:d,formData:_}))}),l.createElement(a.Route,{path:s.path+"/check"},l.createElement(Ne,{onSubmit:function(){try{return p.push(o+"/new-application/response"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:_})),l.createElement(a.Route,{path:s.path+"/response"},l.createElement(Me,{data:_,onSuccess:()=>{f(),u.invalidateQueries("FSM_CITIZEN_SEARCH"),g(!0)}})),l.createElement(a.Route,null,l.createElement(a.Redirect,{to:`${s.path}/${E.indexRoute}`}))))},FSMMyApplications:()=>{const{t:e}=i.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),{info:a}=Digit.UserService.getUser(),{isLoading:o,data:{data:{table:r}={}}={}}=Digit.Hooks.fsm.useSearchAll(n,{uuid:a.uuid,limit:100});return o?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,e("CS_FSM_APPLICATION_TITLE_MY_APPLICATION")),(null==r?void 0:r.length)>0&&r.map((e,t)=>l.createElement("div",{key:t},l.createElement(Ie,{application:e}))),0===r.length&&l.createElement(t.Card,null,l.createElement("p",{style:{textAlign:"center"}},`${e("FSM_NO_APPLICATION")} ${a.mobileNumber}`))))},FSMCitizenApplicationDetails:()=>{var e,n;const{t:o}=i.useTranslation(),{id:r}=a.useParams(),u=a.useHistory(),{state:s}=a.useLocation(),d=(null==s?void 0:s.tenantId)||Digit.ULBService.getCurrentTenantId(),{isLoading:c,data:p}=Digit.Hooks.fsm.useApplicationDetail(o,d,r,{},"CITIZEN");return c||!p?l.createElement(t.Loader,null):(0===(null==p||null===(e=p.applicationDetails)||void 0===e?void 0:e.length)&&u.goBack(),l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between",maxWidth:"960px"},className:"cardHeaderWithOptions"},l.createElement(t.Header,null,o("CS_FSM_APPLICATION_DETAIL_TITLE_APPLICATION_DETAILS")),l.createElement("div",null,l.createElement(t.LinkButton,{label:o("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}))),l.createElement(t.Card,{style:{position:"relative"}},null==p||null===(n=p.applicationDetails)||void 0===n?void 0:n.map((e,n)=>{let{title:i,value:a,child:r,caption:u,map:s}=e;return l.createElement(t.KeyNote,{key:n,keyValue:o(i),note:o(a)||(!s||!r)&&"N/A",caption:o(u)},r&&"object"==typeof r?l.createElement(r.element,{...r}):r)}),l.createElement("div",{id:"timeline"},l.createElement(he,{application:null==p?void 0:p.pdfData,id:r})))))},FSMSelectRating:e=>{var o;let{parentRoute:r}=e;const{t:u}=i.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),d=a.useHistory();let{id:c}=a.useParams();const{data:p}=Digit.Hooks.fsm.useSearch(s,{applicationNos:c}),{isLoading:m,data:v}=Digit.Hooks.fsm.useMDMS(s,"FSM","Checklist"),[E,_]=(Digit.Hooks.fsm.useApplicationUpdate(s),n.useState({})),[S,f]=n.useState(!1),[y,T]=n.useState(!1),[g,h,I]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[C,N,A]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[D,O,L]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1);if(n.useEffect(()=>{h(!1),L(),A()},[]),m)return l.createElement(t.Loader,null);const P=e=>{switch(e){case"SINGLE_SELECT":return"radio";case"MULTI_SELECT":return"checkbox";case"DROP_DOWN":return"dropDown";default:return"checkbox"}},b=(e,t)=>{if("DROP_DOWN"===e){let e=[];return t.map(t=>{e.push({active:!0,citizenOnly:!1,code:t,i18nKey:t,name:t})}),e}return t},R=(e,t,n)=>{switch(e){case"SINGLE_SELECT":return E[t];case"DROP_DOWN":return n.find(e=>e.code===E[t]);default:return null}},M=null==v||null===(o=v.FSM)||void 0===o?void 0:o.CheckList.map(e=>{return{type:P(e.type),checkLabels:b(e.type,e.options),onSelect:"SINGLE_SELECT"===e.type||"DROP_DOWN"===e.type?(n=e.type,i=e.code,"DROP_DOWN"===n?e=>{_({...E,[i]:e.code})}:e=>{_({...E,[i]:e})}):null,selectedOption:R(e.type,e.code,b(e.type,e.options)),name:e.code,label:"SPILLAGE"===e.code?u("CS_FSM_APPLICATION_RATE_HELP_TEXT"):e.code,error:y?l.createElement(t.CardLabelError,null,u("CS_FEEDBACK_SELECT_ERROR")):null,className:"hhh"};var n,i}),k={texts:{header:u("CS_APPLICATION_DETAILS_RATE_US"),submitBarLabel:u("CS_COMMON_SUBMIT")},inputs:[{type:"rate",maxRating:5,label:u("CS_FSM_APPLICATION_RATE_TEXT"),error:S?l.createElement(t.CardLabelError,null,u("CS_FEEDBACK_ENTER_RATING_ERROR")):null},...M,{type:"textarea",label:u("CS_COMMON_COMMENTS"),name:"comments",className:"Hello"}]};return l.createElement("div",{className:"fsm-citizen-rating-wrapper"},l.createElement(t.RatingCard,{config:k,t:u,onSelect:function(e){const{rating:t,comments:n,SAFETY_GEARS_USED:l}=e;if(0===t||0===l.length)return f(0===t),void T(0===l.length);const i={...e,...E};let a=Object.keys(i).reduce((e,t)=>("comments"===t||"rating"===t||e.push({code:t,value:Array.isArray(i[t])?i[t].join(","):i[t]}),e),[]);p.additionalDetails={...p.additionalDetails,CheckList:a},d.push(r+"/response",{applicationData:p,key:"update",action:"RATE",actionData:{rating:t,comments:n}})}})," ")},FSMDsoDashboard:()=>{var e,a;const o=Digit.ULBService.getCurrentTenantId(),{t:r}=i.useTranslation(),[u,s]=n.useState("-"),[d,c]=n.useState(!0),[p,m]=n.useState(!1),v={limit:10,offset:0,uuid:{code:"ASSIGNED_TO_ME",name:r("ES_INBOX_ASSIGNED_TO_ME")},sortBy:"createdTime",sortOrder:"DESC",total:!0},{data:E}=Digit.Hooks.fsm.useVendorDetail();n.useEffect(()=>{if(null!=E&&E.vendor){const{vendor:e}=E;Digit.UserService.setExtraRoleDetails(e[0]),m(!0)}},[E]);const{data:_}=Digit.Hooks.fsm.useInbox(o,{...v},{enabled:p},!0),S=n.useMemo(()=>{var e,t;return{[r("ES_COMPLETION_PENDING")]:(null==_||null===(e=_.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===e?void 0:e.count)||0,[r("ES_VEHICLE_ASSIGNMENT_PENDING")]:(null==_||null===(t=_.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===t?void 0:t.count)||0}},[null==_?void 0:_.totalCount]),f=n.useMemo(()=>[{link:"/digit-ui/citizen/fsm/inbox",label:r("ES_TITLE_INBOX"),count:u}],[u]);if(n.useEffect(()=>{if(_){var e,t;const n=(null==_||null===(e=_.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===e?void 0:e.count)+(null==_||null===(t=_.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===t?void 0:t.count);s(n),Object.keys(S).length&&c(!1)}},[S,_]),d)return l.createElement(t.Loader,null);const y={Icon:l.createElement(t.ShippingTruck,null),moduleName:r("ES_TITLE_FAECAL_SLUDGE_MGMT"),kpis:[{count:(null==_||null===(e=_.statuses.filter(e=>"DSO_INPROGRESS"===e.applicationstatus)[0])||void 0===e?void 0:e.count)||0,label:r("ES_COMPLETION_PENDING"),link:"/digit-ui/citizen/fsm/inbox"},{count:(null==_||null===(a=_.statuses.filter(e=>"PENDING_DSO_APPROVAL"===e.applicationstatus)[0])||void 0===a?void 0:a.count)||0,label:r("ES_VEHICLE_ASSIGNMENT_PENDING"),link:"/digit-ui/citizen/fsm/inbox"}],links:f};return l.createElement("div",{className:"ground-container moduleCardWrapper"},l.createElement(t.EmployeeModuleCard,y))},FSMRegistry:()=>{var e,o;const{t:r}=i.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),[s,d]=n.useState({}),[c,p]=n.useState([{id:"createdTime",desc:!0}]),[m,v]=n.useState(0),[E,_]=n.useState(10),[S,f]=n.useState("VENDOR"),[y,T]=n.useState(""),[g,h]=n.useState(""),[I,C]=n.useState([]),N=a.useHistory(),A=a.useLocation(),D=new URLSearchParams(A.search).get("selectedTabs"),[O,L]=n.useState(!1);Digit.UserService.getUser();let P={limit:E,offset:m,sortBy:null==c||null===(e=c[0])||void 0===e?void 0:e.id,sortOrder:null!=c&&null!==(o=c[0])&&void 0!==o&&o.desc?"DESC":"ASC"};const{data:b,isLoading:R,refetch:M}="VEHICLE"===D?Digit.Hooks.fsm.useVehiclesSearch({tenantId:u,filters:{...P,registrationNumber:null==s?void 0:s.registrationNumber,status:"ACTIVE,DISABLED"},config:{enabled:!1}}):"DRIVER"===D?Digit.Hooks.fsm.useDriverSearch({tenantId:u,filters:{...P,name:null==s?void 0:s.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}}):Digit.Hooks.fsm.useVendorSearch({tenantId:u,filters:{...P,name:null==s?void 0:s.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}}),{data:k,isLoading:w,refetch:F}=Digit.Hooks.fsm.useDsoSearch(u,{vehicleIds:y,driverIds:g},{enabled:!1}),x=(null==b?void 0:b.totalCount)||50;n.useEffect(()=>{M()},[]),n.useEffect(()=>{v(0),M()},[s]),n.useEffect(()=>{M()},[s,c,m,E]),n.useEffect(()=>{if(null!=b&&b.vehicle&&"VEHICLE"===D){const e=b.vehicle.map(e=>e.id).filter(Boolean).join(",");T(e),C(null==b?void 0:b.vehicle)}if(null!=b&&b.driver&&"DRIVER"===D){const e=b.driver.map(e=>e.id).filter(Boolean).join(",");h(e),C(null==b?void 0:b.driver)}if(null!=b&&b.vendor&&"VENDOR"===D){const e=b.vendor.map(e=>{var t,n,l,i;return{mobileNumber:null===(t=e.owner)||void 0===t?void 0:t.mobileNumber,name:e.name,id:e.id,auditDetails:e.auditDetails,drivers:e.drivers,activeDrivers:null===(n=e.drivers)||void 0===n?void 0:n.filter(e=>"ACTIVE"===e.status),allVehicles:e.vehicles,dsoDetails:e,vehicles:null===(l=e.vehicles)||void 0===l||null===(i=l.filter(e=>"ACTIVE"===e.status))||void 0===i?void 0:i.map(e=>({id:e.id,registrationNumber:null==e?void 0:e.registrationNumber,type:e.type,i18nKey:"FSM_VEHICLE_TYPE_"+e.type,capacity:e.tankCapacity,suctionType:e.suctionType,model:e.model}))}});C(e)}},[b]),n.useEffect(()=>{""===y&&""===g||F()},[y,g]),n.useEffect(()=>{if(k){if("VEHICLE"===D){const e=null==b?void 0:b.vehicle.map(e=>{let t=k.find(t=>{var n,l;return null===(n=t.dsoDetails)||void 0===n||null===(l=n.vehicles)||void 0===l?void 0:l.find(t=>t.id===e.id)});if(t){var n,l;let i={...e,vendor:t.dsoDetails};const a=null===(n=t.dsoDetails)||void 0===n||null===(l=n.vehicles)||void 0===l?void 0:l.find(t=>t.id===e.id);return a&&(i.driverData=a.driverData||a.driver||i.driverData),i}return e});C(e),T("")}if("DRIVER"===D){const e=null==b?void 0:b.driver.map(e=>{let t=k.find(t=>{var n,l;return null===(n=t.dsoDetails)||void 0===n||null===(l=n.drivers)||void 0===l?void 0:l.find(t=>t.id===e.id)});return t?{...e,vendor:t.dsoDetails}:e});C(e),h("")}}},[k,b]);let H="VEHICLE"===D?[{label:r("ES_FSM_REGISTRY_SEARCH_VEHICLE_NUMBER"),name:"registrationNumber",labelChildren:l.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},l.createElement(t.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{width:"150px",left:"230%",fontSize:"14px"}},r("ES_FSM_VEHICLE_FORMAT_TIP")))}]:"DRIVER"===D?[{label:r("ES_FSM_REGISTRY_SEARCH_DRIVER_NAME"),name:"name"}]:[{label:r("ES_FSM_REGISTRY_SEARCH_VENDOR_NAME"),name:"name"}];const V=n.useCallback(e=>{0!==(null==e?void 0:e.length)&&p(e)},[]);return n.useEffect(()=>{M(),F()},[]),l.createElement("div",null,l.createElement(t.Header,null,r("ES_FSM_REGISTRY")),l.createElement(yt,{data:{table:I},isLoading:R||w,onSort:V,disableSort:!1,sortParams:c,userRole:"VEHICLE_ADMIN",onFilterChange:()=>{},searchFields:H,onSearch:function(e){void 0===e&&(e={}),d({...e})},onNextPage:()=>{v(e=>e+E)},onPrevPage:()=>{v(e=>e-E)},currentPage:Math.floor(m/E),pageSizeLimit:E,onPageSizeChange:e=>{_(Number(e.target.value))},totalRecords:x||0,onTabChange:e=>{f(e),D!==e&&N.push("/digit-ui/employee/fsm/registry?selectedTabs="+e)},selectedTab:D,refetchData:()=>{M()},refetchVendor:()=>{F()}}))},VendorDetails:e=>{var i,a,r,u;let{t:s,config:d,onSelect:c,userType:p,formData:m}=e;const v=Digit.UserService.getUser().info,E=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].applicantName||(null==m||null===(i=m.ownerKey)||void 0===i?void 0:i.applicantName)||"",_=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].emailId||(null==m||null===(a=m.ownerKey)||void 0===a?void 0:a.emailId)||"",S=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].mobileNumber||(null==m||null===(r=m.ownerKey)||void 0===r?void 0:r.mobileNumber)||(null==v?void 0:v.mobileNumber),f=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].altMobileNumber||(null==m||null===(u=m.ownerKey)||void 0===u?void 0:u.altmobileNumber)||"",[y,T]=n.useState(""),[g,h]=n.useState(""),[I,C]=n.useState(""),[N,A]=n.useState(""),[D,O]=n.useState(),[L,P]=n.useState(""),[b,R]=n.useState(""),[M,k]=n.useState(""),[w,F]=n.useState(""),[x,H]=n.useState(""),[V,B]=n.useState(""),[U,Y]=n.useState(""),[G,W]=n.useState(""),[K,z]=n.useState(""),[j,X]=n.useState(""),[$,q]=n.useState(""),[Z,Q]=n.useState(""),[J,ee]=n.useState("");n.useEffect(()=>{11!==L.length||N||D||$?11===L.length&&N&&D?(A(N),O(D),q($)):(A(""),O(""),q("")):fetch("https://ifsc.razorpay.com/"+L).then(e=>e.json()).then(e=>{e&&e.BANK&&e.BRANCH&&e.MICR&&(A(e.BANK),O(e.BRANCH),q(e.MICR))}).catch(()=>{})},[L]);const te=Digit.ULBService.getCurrentTenantId(),{control:ne}=o.useForm(),{data:le}=Digit.Hooks.fsm.useDsoSearch(te,{staleTime:Infinity});n.useEffect(()=>{if(le){const e=le.find(e=>e.id);e&&(C(e.name),h(e.id))}},[le]);const ie=()=>{let e,t=m.ownerKey&&m.ownerKey[0];"citizen"===p?(e={...t,applicantName:E,mobileNumber:S,altMobileNumber:f,emailId:_},c(d.key,{...m[d.key],...e},!1,0)):(e={...t,VendorCategory:y,name:I,VendorId:g,Bank:N,BankbranchName:D,IFSC:L,AccountNo:b,PanNo:M,GstNo:w,GstState:x,RegistrationNo:V,EpfNo:U,EsiNo:G,VendorType:K,Status:j,micrNo:$,PhoneNo:Z,ContactPerson:J},c(d.key,e,!1,0))};return n.useEffect(()=>{"citizen"===p&&ie()},[y,g,I,N,D,L,b,M,w,x,V,U,G,K,j,$,Z,J,p]),l.createElement(l.Fragment,null,l.createElement(t.VerticalTimeline,{config:[{timeLine:[{actions:s("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:s("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:s("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(t.FormStep,{config:d,onSelect:ie,t:s,className:"formcomposer-grid-container-form"},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},l.createElement(t.CustomTooltip,{label:""+s("IFSC_CODE"),isMandatory:!1,message:s("INVALID_IFSC_CODE_ERROR_MESSAGE")})),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"IFSC",value:L,placeholder:"Enter IFSC Code",onChange:function(e){const t=e.target.value.replace(/[^a-zA-Z0-9]/g,"");t.length<=11&&P(t)},style:{width:"100%"},maxLength:11,ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[A-Z]{4}0[A-Z0-9]{6}$",type:"text",title:s("INVALID_IFSC_CODE_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("VENDOR_BANK_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bankName",placeholder:"Bank Name Auto Select",style:{width:"100%"},value:N,onChange:function(e){A(e.target.value)},disabled:!0})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("VENDOR_BANK_BRANCH_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BankbranchName",value:D,style:{width:"100%"},placeholder:"Bank Branch Name Auto Select",onChange:function(e){O(e.target.value)},disabled:!1})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("VENDOR_MICR_NO")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"MicrNo",value:$,style:{width:"100%"},placeholder:"MICR No",onChange:q,disabled:!1})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("ACCOUNT_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AccountNo",value:b,onChange:function(e){R(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"[0-9]{9,18}",type:"text",title:s("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("PHONE_NO")),l.createElement(t.MobileNumber,{value:Z,name:"PhoneNo",onChange:Q,style:{width:"100%"}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("CONTACT_PERSON")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"ContactPerson",value:J,onChange:function(e){ee(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("PAN_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"PanNo",value:M,onChange:function(e){k(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"[A-Z]{5}[0-9]{4}[A-Z]{1}",type:"text",title:s("INVALID_PAN_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("GST_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstNo",value:w,onChange:function(e){F(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",type:"text",title:s("INVALID_GST_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("GST_REGISTERED_STATE/UT")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstState",value:x,onChange:function(e){H(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("PT_NAME_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("REGISTRATION_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"RegistrationNo",value:V,onChange:function(e){B(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("INVALID_REGISTRATION_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("EPF_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EpfNo",value:U,onChange:function(e){Y(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,15}$",type:"text",title:s("INVALID_EPF_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,""+s("ESI_NO")),l.createElement(t.TextInput,{t:s,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EsiNo",value:G,onChange:function(e){W(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:s("INVALID_ESI_NO_ERROR_MESSAGE")}})),l.createElement(t.LabelFieldPair,null,l.createElement("div",null,s("VENDOR_TYPE"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+s("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:ne,name:"VendorType",defaultValue:K,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{selected:K,select:z,option:[{i18nKey:"Supplier",code:"SUPPLIER"},{i18nKey:"Contractor",code:"CONTRACTOR"}],optionKey:"i18nKey",placeholder:"Select",t:s})})),l.createElement(t.LabelFieldPair,null,l.createElement("div",null,s("VENOR_CATEGORY"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}}))),l.createElement(o.Controller,{control:ne,name:"VendorCategory",defaultValue:y,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{selected:y,select:T,option:[{i18nKey:"Firm",code:"FIRM"},{i18nKey:"Individual",code:"Individual"}],optionKey:"i18nKey",placeholder:"Select",t:s})})),l.createElement(t.LabelFieldPair,null,l.createElement("div",null,s("STATUS"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+s("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:ne,name:"Status",defaultValue:j,rules:{required:s("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{selected:j,select:X,option:[{i18nKey:"Active",code:"ACTIVE"},{i18nKey:"Inactive",code:"INACTIVE"}],optionKey:"i18nKey",placeholder:"Select",t:s})})))))},AddVendor:e=>{const o=Digit.ULBService.getCurrentTenantId(),{t:r}=i.useTranslation(),u=a.useHistory(),[s,d]=n.useState(1),[c,p]=n.useState(null),[,m]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,v]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,E]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:_}=Digit.Hooks.fsm.useVendorCreate(o);n.useEffect(()=>{m(!1),E(),v()},[]);const S={serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},[f,y]=n.useState(S),T=Rt(r,!1,f),g=()=>{p(null)};return l.createElement(l.Fragment,null,l.createElement(t.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:"New Vendor Details",currentStep:1}]},{route:"address-details",timeLine:[{actions:"Address Details",currentStep:2}]}],currentActiveIndex:s-1,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(t.FormComposer,{config:T,userType:"employee",onFormValueChange:(e,t)=>{var n,l,i,a;const o=(null==t||null===(n=t.zoneIds)||void 0===n?void 0:n.map(e=>{var t;return null==e||null===(t=e[1])||void 0===t?void 0:t.code}))||[],u=(null==f?void 0:f.zoneIds)||[],c=o.join(",")!==u.join(",");((null==t||null===(l=t.serviceType)||void 0===l?void 0:l.code)!==(null==f||null===(i=f.serviceType)||void 0===i?void 0:i.code)||c)&&y(e=>({...e,serviceType:null==t?void 0:t.serviceType})),c&&y(e=>({...e,zoneIds:o})),(null==t?void 0:t.vendorName)&&(null==t?void 0:t.phone)&&(null==t||null===(a=t.serviceType)||void 0===a?void 0:a.code)?1===s&&(d(2),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(r("ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100)):2===s&&(d(1),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(r("ES_VRNDOR_NEW_VENDOR_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100))},label:r("ES_COMMON_APPLICATION_SUBMIT"),onSubmit:e=>{var t,n,l,i,a,r,s,d,c,m,v,E,S,f,y,T;const h=e,I=null==h?void 0:h.propertyAddress,C=null==I?void 0:I.pincode,N=null==I?void 0:I.streetName,A=null==I?void 0:I.houseNo,D=null==I?void 0:I.landmark,O=null==I||null===(t=I.city)||void 0===t?void 0:t.name,L=null==I||null===(n=I.city)||void 0===n?void 0:n.name,P=null==I||null===(l=I.city)||void 0===l?void 0:l.name,b=null==I||null===(i=I.city)||void 0===i?void 0:i.name,R=null==I||null===(a=I.locality)||void 0===a?void 0:a.code,M=null==I||null===(r=I.locality)||void 0===r?void 0:r.name,k=null==I?void 0:I.subLocality,w=null==I||null===(s=I.ward)||void 0===s?void 0:s.code,F=null==I||null===(d=I.ward)||void 0===d?void 0:d.name,x=null==h?void 0:h.vendorName,H=null==h||null===(c=h.plotNo)||void 0===c?void 0:c.trim(),V=null==h||null===(m=h.buildingName)||void 0===m?void 0:m.trim(),B=null==h?void 0:h.emailId,U=null==h?void 0:h.phone,Y="EKYC"===(null==h||null===(v=h.serviceType)||void 0===v?void 0:v.code);let G={tenantId:o,name:x,agencyType:"ULB",paymentPreference:"post-service",address:{tenantId:o,landmark:D,doorNo:A,plotNo:H,street:N,city:O,district:P,region:b,state:L,country:"india",pincode:C,buildingName:V,locality:{code:R||"",name:M||"",label:"Locality",area:k||""},ward:w?{code:w,name:F}:void 0,geoLocation:{latitude:(null==h||null===(E=h.address)||void 0===E?void 0:E.latitude)||28.6139,longitude:(null==h||null===(S=h.address)||void 0===S?void 0:S.longitude)||77.209}},owner:{tenantId:"dl",name:(null==h?void 0:h.ownerName)||x,fatherOrHusbandName:(null==h?void 0:h.fatherOrHusbandName)||x,relationship:(null==h||null===(f=h.relationship)||void 0===f?void 0:f.code)||"OTHER",gender:(null==h||null===(y=h.gender)||void 0===y?void 0:y.code)||"MALE",dob:null!=h&&h.dob?new Date(h.dob).getTime():new Date("1/1/1970").getTime(),emailId:B||"",mobileNumber:U},additionalDetails:{serviceType:Y?"ekyc":null==h||null===(T=h.serviceType)||void 0===T?void 0:T.code},vehicles:[],drivers:[],source:Y?"eKYC Portal":"WhatsApp"};var W,K;Y&&(G={...G,zoneIds:(null==h||null===(W=h.zoneIds)||void 0===W?void 0:W.map(e=>{var t;return null==e||null===(t=e[1])||void 0===t?void 0:t.code}))||[],clusterIds:(null==h||null===(K=h.clusterIds)||void 0===K?void 0:K.map(e=>{var t;return null==e||null===(t=e[1])||void 0===t?void 0:t.code}))||[],contractStartDate:h.contractStartDate?new Date(h.contractStartDate).getTime():null,contractEndDate:h.contractEndDate?new Date(h.contractEndDate).getTime():null});const z={vendor:G};Y&&(z.RequestInfo={apiId:"Rainmaker",msgId:"ekyc-vendor-create"}),_(z,{onError:e=>{p({key:"error",action:e}),setTimeout(g,5e3)},onSuccess:(e,t)=>{p({key:"success",action:"ADD_VENDOR"}),setTimeout(()=>{g(),u.push("/digit-ui/employee/vendor/search-vendor")},2e3)}})},defaultValues:S,noCard:!0,noBreakLine:!0}),c&&l.createElement(t.Toast,{error:"error"===c.key,label:r("success"===c.key?`ES_FSM_REGISTRY_${c.action}_SUCCESS`:c.action),onClose:g})))},EditVendor:()=>{const e=Digit.ULBService.getCurrentTenantId();let{id:o}=a.useParams();const[u,s]=n.useState(null),[d,c]=n.useState(!1),[p,m]=n.useState({}),[v,E]=n.useState({}),_=r.useQueryClient(),[,S]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,f]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,y]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{data:T,isLoading:g}=Digit.Hooks.fsm.useDsoSearch(e,{ids:o},{staleTime:Infinity}),{mutate:h}=Digit.Hooks.fsm.useVendorUpdate(e);n.useEffect(()=>{S(!1),y(),f()},[]),n.useEffect(()=>{if(T&&T[0]){var e,t,n,l,i,a,o,r,u,s,d,c,p,v,_,S,f,y,g,h,I,C,N,A,D,O,L,P,b,R,M,k,w,F,x,H,V,B;let U=T[0];E(null==U?void 0:U.dsoDetails);let Y={vendorName:null==U?void 0:U.name,street:null==U||null===(e=U.dsoDetails)||void 0===e||null===(t=e.address)||void 0===t?void 0:t.street,doorNo:null==U||null===(n=U.dsoDetails)||void 0===n||null===(l=n.address)||void 0===l?void 0:l.doorNo,plotNo:null==U||null===(i=U.dsoDetails)||void 0===i||null===(a=i.address)||void 0===a?void 0:a.plotNo,landmark:null==U||null===(o=U.dsoDetails)||void 0===o||null===(r=o.address)||void 0===r?void 0:r.landmark,pincode:null==U||null===(u=U.dsoDetails)||void 0===u||null===(s=u.address)||void 0===s?void 0:s.pincode,buildingName:null==U||null===(d=U.dsoDetails)||void 0===d||null===(c=d.address)||void 0===c?void 0:c.buildingName,address:{pincode:null==U||null===(p=U.dsoDetails)||void 0===p||null===(v=p.address)||void 0===v?void 0:v.pincode,locality:{...null==U||null===(_=U.dsoDetails)||void 0===_||null===(S=_.address)||void 0===S?void 0:S.locality,i18nkey:`${null==U||null===(f=U.dsoDetails)||void 0===f?void 0:f.tenantId.toUpperCase().split(".").join("_")}_REVENUE_${null==U||null===(y=U.dsoDetails)||void 0===y?void 0:y.address.locality.code}`}},phone:null==U?void 0:U.mobileNumber,ownerName:null==U||null===(g=U.dsoDetails)||void 0===g||null===(h=g.owner)||void 0===h?void 0:h.name,fatherOrHusbandName:null==U||null===(I=U.dsoDetails)||void 0===I||null===(C=I.owner)||void 0===C?void 0:C.fatherOrHusbandName,relationship:null==U||null===(N=U.dsoDetails)||void 0===N||null===(A=N.owner)||void 0===A?void 0:A.relationship,selectGender:null==U||null===(D=U.dsoDetails)||void 0===D||null===(O=D.owner)||void 0===O?void 0:O.gender,dob:(null==U||null===(L=U.dsoDetails)||void 0===L||null===(P=L.owner)||void 0===P?void 0:P.dob)&&Digit.DateUtils.ConvertTimestampToDate(null==U||null===(b=U.dsoDetails)||void 0===b||null===(R=b.owner)||void 0===R?void 0:R.dob,"yyyy-MM-dd"),emailId:"abc@egov.com"===(null==U||null===(M=U.dsoDetails)||void 0===M||null===(k=M.owner)||void 0===k?void 0:k.emailId)?"":null==U||null===(w=U.dsoDetails)||void 0===w||null===(F=w.owner)||void 0===F?void 0:F.emailId,correspondenceAddress:null==U||null===(x=U.dsoDetails)||void 0===x||null===(H=x.owner)||void 0===H?void 0:H.correspondenceAddress,additionalDetails:null==U||null===(V=U.dsoDetails)||void 0===V||null===(B=V.additionalDetails)||void 0===B?void 0:B.description};m(Y)}},[T]);const{t:I}=i.useTranslation(),C=a.useHistory(),N=Rt(I,!0),A=()=>{s(null)};return g||0===Object.keys(p).length?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(t.VerticalTimeline,{config:[{timeLine:[{actions:I("ES_FSM_REGISTRY_TITLE_EDIT_VENDOR"),currentStep:1}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(t.FormComposer,{isDisabled:!d,label:I("ES_COMMON_APPLICATION_SUBMIT"),config:N.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,r,u,d,c,p,m,E,S,f,y,T,g,I,N,D,O,L,P,b;const R=null==e?void 0:e.vendorName,M=null==e?void 0:e.phone,k=null==e?void 0:e.pincode,w=null==e||null===(t=e.street)||void 0===t?void 0:t.trim(),F=null==e||null===(n=e.doorNo)||void 0===n?void 0:n.trim(),x=null==e||null===(l=e.plotNo)||void 0===l?void 0:l.trim(),H=null==e||null===(i=e.landmark)||void 0===i?void 0:i.trim(),V=null==e||null===(a=e.address)||void 0===a||null===(r=a.city)||void 0===r?void 0:r.name,B=null==e||null===(u=e.address)||void 0===u||null===(d=u.city)||void 0===d?void 0:d.state,U=null==e||null===(c=e.address)||void 0===c||null===(p=c.city)||void 0===p?void 0:p.name,Y=null==e||null===(m=e.address)||void 0===m||null===(E=m.city)||void 0===E?void 0:E.name,G=null==e||null===(S=e.buildingName)||void 0===S?void 0:S.trim(),W=null==e||null===(f=e.address)||void 0===f||null===(y=f.locality)||void 0===y?void 0:y.code,K=null==e||null===(T=e.address)||void 0===T||null===(g=T.locality)||void 0===g?void 0:g.name,z=null==e||null===(I=e.address)||void 0===I||null===(N=I.locality)||void 0===N?void 0:N.area,j=null==e?void 0:e.additionalDetails,X=null==e||null===(D=e.selectGender)||void 0===D?void 0:D.code,$=null==e?void 0:e.emailId,q=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime(),Z={vendor:{...v,name:R,address:{...v.address,landmark:H,doorNo:F,plotNo:x,street:w,city:V,district:U,region:Y,state:B,country:"in",pincode:k,buildingName:G,locality:{...v.address.locality,code:W||"",name:K||"",label:"Locality",area:z||""},geoLocation:{...v.address.geoLocation,latitude:(null==e||null===(O=e.address)||void 0===O?void 0:O.latitude)||0,longitude:(null==e||null===(L=e.address)||void 0===L?void 0:L.longitude)||0}},owner:{...v.owner,gender:X||(null===(P=v.owner)||void 0===P?void 0:P.gender)||"OTHER",dob:q,emailId:$||"abc@egov.com",mobileNumber:M,relationship:(null===(b=v.owner)||void 0===b?void 0:b.relationship)||"OTHER"},additionalDetails:{...v.additionalDetails,description:j}}};h(Z,{onError:(e,t)=>{s({key:"error",action:e}),setTimeout(A,5e3)},onSuccess:(e,t)=>{s({key:"success",action:"UPDATE_VENDOR"}),setTimeout(A,5e3),_.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{A(),C.push("/digit-ui/employee/fsm/registry/vendor-details/"+o)},5e3)}})},defaultValues:p,onFormValueChange:(e,t)=>{var n;null!=t&&t.phone&&null!=t&&null!==(n=t.address)&&void 0!==n&&n.locality?c(!0):c(!1)},noBreakLine:!0}),u&&l.createElement(t.Toast,{error:"error"===u.key,label:I("success"===u.key?`ES_FSM_REGISTRY_${u.action}_SUCCESS`:u.action),onClose:A})))},VehicleDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=i.useTranslation(),c=a.useHistory(),p=r.useQueryClient();let{id:m}=a.useParams();const[v,E]=n.useState(!1),[_,S]=n.useState(null),[f,y]=n.useState(!1),[T,g]=n.useState(null),[h,I]=n.useState([]),[C,N]=n.useState({}),[A,D]=n.useState(null),{data:O,isLoading:L,refetch:P}=Digit.Hooks.fsm.useVehicleDetails(s,{registrationNumber:m},{staleTime:Infinity});n.useEffect(()=>{var e,t;!L&&O&&D(null==O||null===(e=O[0])||void 0===e||null===(t=e.vehicleData)||void 0===t?void 0:t.id)},[O,L]);const{data:b}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:R}=Digit.Hooks.fsm.useUpdateVehicle(s),{mutate:M}=Digit.Hooks.fsm.useVendorUpdate(s);function k(e){S(e),E(!1)}n.useEffect(()=>{if(b){let e=b.map(e=>e.dsoDetails);I(e)}},[b]),n.useEffect(()=>{P()},[]),n.useEffect(()=>{switch(_){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return y(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-vehicle/"+m);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE")}},[_]);const w=()=>{g(null)},F=()=>{S(null),N({}),y(!1)},x=()=>"DELETE"===_||"DELETE_VENDOR"===_?l.createElement(Tt,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===_||"EDIT_VENDOR"===_?l.createElement(l.Fragment,null,l.createElement(t.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(t.Dropdown,{t:d,option:h,value:C,selected:C,select:N,optionKey:"name"})):void 0;return L||L?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(t.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==O||null===(o=O[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},n>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),l.createElement(t.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(i=e.values)||void 0===i?void 0:i.map((e,n)=>l.createElement(l.Fragment,{key:n},l.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("span",{className:"add-details-link hover-button",onClick:()=>k("ADD_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.AddIcon,{className:"",fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>k("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.EditIcon,null)),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>k("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.DeleteIcon,{className:"delete",fill:"#a82227"}))):l.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))))}))),f&&l.createElement(t.Modal,{headerBarMain:l.createElement(gt,{label:d((()=>{switch(_){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(It,{onClick:F}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:F,actionSaveLabel:d("DELETE"===_||"DELETE_VENDOR"===_?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(_){case"DELETE":return(()=>{var e;const t={vehicle:{...null==O||null===(e=O[0])||void 0===e?void 0:e.vehicleData,status:"INACTIVE"}};R(t,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VEHICLE"}),p.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{w(),c.push("/digit-ui/employee/fsm/registry")},5e3)}}),y(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n;let l={},i=null==O||null===(e=O[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],a=null==i?void 0:i.vehicles;a=a.map(e=>(e.id===A&&(e.vendorVehicleStatus="INACTIVE"),e)),l={vendor:{...i,vehicles:a}},M(l,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VENDOR"}),p.invalidateQueries("FSM_VENDOR_SEARCH"),P(),setTimeout(w,5e3)}}),y(!1)})();case"ADD_VENDOR":return(()=>{var e;let t=C,n=null==O||null===(e=O[0])||void 0===e?void 0:e.vehicleData;n.vendorVehicleStatus="ACTIVE";const l={vendor:{...t,vehicles:t.vehicles?[...t.vehicles,n]:[n]}};M(l,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"ADD_VENDOR"}),P(),p.invalidateQueries("DSO_SEARCH"),setTimeout(w,5e3)}}),y(!1),S(null)})();case"EDIT_VENDOR":return(()=>{var e;let t=C,n=null==O||null===(e=O[0])||void 0===e?void 0:e.vehicleData;n.vendorVehicleStatus="ACTIVE";const l={vendor:{...t,vehicles:t.vehicles?[...t.vehicles,n]:[n]}};M(l,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(w,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"EDIT_VENDOR"}),P(),p.invalidateQueries("DSO_SEARCH"),setTimeout(w,5e3)}}),y(!1),S(null)})()}},formId:"modal-action"},"DELETE"===_||"DELETE_VENDOR"===_?x():l.createElement(t.Card,{style:{boxShadow:"none"}},x())),T&&l.createElement(t.Toast,{error:"error"===T.key,label:d("success"===T.key?`ES_FSM_REGISTRY_${T.action}_SUCCESS`:T.action),onClose:w}),l.createElement(t.ActionBar,{style:{zIndex:"19"}},v?l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:d,onSelect:k}):null,l.createElement(t.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>E(!v)})))},AddVehicle:e=>{const o=Digit.ULBService.getCurrentTenantId(),u=Digit.ULBService.getStateId(),[s,d]=n.useState(null),c=a.useHistory(),p=r.useQueryClient(),[m,v,E]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[_,S,f]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[y,T,g]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:h}=Digit.Hooks.fsm.useVehicleCreate(o);n.useEffect(()=>{v(!1),g(),f()},[]);const{t:I}=i.useTranslation(),C=Nt(I);C[0].body.forEach(e=>{"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.label&&(e.labelChildren=l.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},l.createElement(t.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{width:"150px",left:"230%",fontSize:"14px"}},I(e.populators.validation.title))))});const[N,A]=n.useState(!1),D=()=>{d(null)},O=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,I("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"))),l.createElement("div",{style:O?{}:{marginLeft:"-15px"}},l.createElement(t.FormComposer,{isDisabled:!N,label:I("ES_COMMON_APPLICATION_SUBMIT"),config:C.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,r,s;const m=null==e?void 0:e.registrationNumber,v=null==e||null===(t=e.vehicle)||void 0===t||null===(n=t.type)||void 0===n?void 0:n.code,E=null==e||null===(l=e.vehicle)||void 0===l||null===(i=l.modal)||void 0===i?void 0:i.code,_=null==e||null===(a=e.vehicle)||void 0===a||null===(r=a.type)||void 0===r?void 0:r.capacity,S=new Date(""+(null==e?void 0:e.pollutionCert)).getTime(),f=new Date(""+(null==e?void 0:e.insurance)).getTime(),y=new Date(""+(null==e?void 0:e.roadTax)).getTime(),T=new Date(""+(null==e?void 0:e.fitnessValidity)).getTime(),g=null==e?void 0:e.ownerName,I=null==e?void 0:e.phone,C=null==e?void 0:e.additionalDetails,N=null==e||null===(s=e.selectGender)||void 0===s?void 0:s.code,A=null==e?void 0:e.emailId,O=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime();h({vehicle:{tenantId:o,registrationNumber:m,model:E,type:v,tankCapacity:_,suctionType:"SEWER_SUCTION_MACHINE",pollutionCertiValidTill:S,InsuranceCertValidTill:f,fitnessValidTill:T,roadTaxPaidTill:y,gpsEnabled:!0,source:"Municipal records",owner:{tenantId:u,name:g,fatherOrHusbandName:g,relationship:"OTHER",gender:"OTHERS",dob:O,emailId:"abc@egov.com",correspondenceAddress:"",mobileNumber:I,gender:N,dob:O,emailId:A||"abc@egov.com"},additionalDetails:{description:C}}},{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(D,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"ADD_VEHICLE"}),setTimeout(D,5e3),p.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{D(),c.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE")},5e3)}})},defaultValues:{tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var n,l;null!=t&&t.registrationNumber&&null!=t&&t.ownerName&&null!=t&&t.phone&&null!=t&&null!==(n=t.vehicle)&&void 0!==n&&n.modal&&null!=t&&null!==(l=t.vehicle)&&void 0!==l&&l.type&&null!=t&&t.selectGender?A(!0):A(!1)},noBreakLine:!0}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:I("success"===s.key?`ES_FSM_REGISTRY_${s.action}_SUCCESS`:s.action),onClose:D})))},EditVehicle:e=>{const o=Digit.ULBService.getCurrentTenantId();Digit.ULBService.getStateId();let{id:u}=a.useParams();const[s,d]=n.useState(null),[c,p]=n.useState(!1),[m,v]=n.useState({}),[E,_]=n.useState({}),S=r.useQueryClient(),[f,y,T]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[g,h,I]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[C,N,A]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{data:D,isLoading:O}=Digit.Hooks.fsm.useVehicleDetails(o,{registrationNumber:u},{staleTime:Infinity}),{mutate:L}=Digit.Hooks.fsm.useUpdateVehicle(o);n.useEffect(()=>{y(!1),A(),I()},[]),n.useEffect(()=>{if(D&&D[0]){var e,t,n,l,i,a,o,r,u,s,d,c,p,m,E,S,f,y,T,g,h,I,C,N,A,O,L,P;let b=D[0];_(null==b?void 0:b.vehicleData);let R={registrationNumber:null==b||null===(e=b.vehicleData)||void 0===e?void 0:e.registrationNumber,vehicle:{type:null==b||null===(t=b.vehicleData)||void 0===t?void 0:t.type,modal:null==b||null===(n=b.vehicleData)||void 0===n?void 0:n.model,tankCapacity:null==b||null===(l=b.vehicleData)||void 0===l?void 0:l.tankCapacity},pollutionCert:(null==b||null===(i=b.vehicleData)||void 0===i?void 0:i.pollutionCertiValidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(a=b.vehicleData)||void 0===a?void 0:a.pollutionCertiValidTill,"yyyy-MM-dd"),insurance:(null==b||null===(o=b.vehicleData)||void 0===o?void 0:o.InsuranceCertValidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(r=b.vehicleData)||void 0===r?void 0:r.InsuranceCertValidTill,"yyyy-MM-dd"),roadTax:(null==b||null===(u=b.vehicleData)||void 0===u?void 0:u.roadTaxPaidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(s=b.vehicleData)||void 0===s?void 0:s.roadTaxPaidTill,"yyyy-MM-dd"),fitnessValidity:(null==b||null===(d=b.vehicleData)||void 0===d?void 0:d.fitnessValidTill)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(c=b.vehicleData)||void 0===c?void 0:c.fitnessValidTill,"yyyy-MM-dd"),phone:null==b||null===(p=b.vehicleData)||void 0===p||null===(m=p.owner)||void 0===m?void 0:m.mobileNumber,ownerName:null==b||null===(E=b.vehicleData)||void 0===E||null===(S=E.owner)||void 0===S?void 0:S.name,selectGender:null==b||null===(f=b.vehicleData)||void 0===f||null===(y=f.owner)||void 0===y?void 0:y.gender,dob:(null==b||null===(T=b.vehicleData)||void 0===T||null===(g=T.owner)||void 0===g?void 0:g.dob)&&Digit.DateUtils.ConvertTimestampToDate(null==b||null===(h=b.vehicleData)||void 0===h||null===(I=h.owner)||void 0===I?void 0:I.dob,"yyyy-MM-dd"),emailId:"abc@egov.com"===(null==b||null===(C=b.vehicleData)||void 0===C||null===(N=C.owner)||void 0===N?void 0:N.emailId)?"":null==b||null===(A=b.vehicleData)||void 0===A||null===(O=A.owner)||void 0===O?void 0:O.emailId,additionalDetails:null==b||null===(L=b.vehicleData)||void 0===L||null===(P=L.additionalDetails)||void 0===P?void 0:P.description};v(R)}},[D]);const{t:P}=i.useTranslation(),b=a.useHistory(),R=Nt(P,!1);R[0].body.forEach(e=>{"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.label&&(e.labelChildren=l.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},l.createElement(t.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{width:"150px",left:"230%",fontSize:"14px"}},P(e.populators.validation.title))))});const M=()=>{d(null)};return O||0==Object.keys(m).length?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(t.FormComposer,{isDisabled:!c,label:P("ES_COMMON_APPLICATION_SUBMIT"),config:R.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,l,i,a,o,r,s,c,p,m,v,_,f,y,T,g,h;const I=(null==e||null===(t=e.vehicle)||void 0===t||null===(n=t.type)||void 0===n?void 0:n.code)||(null==e||null===(l=e.vehicle)||void 0===l?void 0:l.type),C=(null==e||null===(i=e.vehicle)||void 0===i||null===(a=i.modal)||void 0===a?void 0:a.code)||(null==e||null===(o=e.vehicle)||void 0===o?void 0:o.modal),N=(null==e||null===(r=e.vehicle)||void 0===r||null===(s=r.type)||void 0===s?void 0:s.capacity)||(null==e||null===(c=e.vehicle)||void 0===c?void 0:c.tankCapacity),A=(null==e?void 0:e.pollutionCert)>0||(null==e||null===(p=e.pollutionCert)||void 0===p?void 0:p.length)>0?new Date(""+(null==e?void 0:e.pollutionCert)).getTime():null,D=(null==e?void 0:e.insurance)>0||(null==e||null===(m=e.insurance)||void 0===m?void 0:m.length)>0?new Date(""+(null==e?void 0:e.insurance)).getTime():null,O=(null==e?void 0:e.roadTax)>0||(null==e||null===(v=e.roadTax)||void 0===v?void 0:v.length)>0?new Date(""+(null==e?void 0:e.roadTax)).getTime():null,P=(null==e?void 0:e.fitnessValidity)>0||(null==e||null===(_=e.fitnessValidity)||void 0===_?void 0:_.length)>0?new Date(""+(null==e?void 0:e.fitnessValidity)).getTime():null,R=null==e?void 0:e.additionalDetails,k=(null==e||null===(f=e.selectGender)||void 0===f?void 0:f.code)||(null==e?void 0:e.selectGender)||(null===(y=E.owner)||void 0===y?void 0:y.gender)||"OTHER",w=null!=e&&e.dob?new Date(""+e.dob).getTime():null===(T=E.owner)||void 0===T?void 0:T.dob,F={vehicle:{...E,registrationNumber:null==e?void 0:e.registrationNumber,model:C,type:I,tankCapacity:N,pollutionCertiValidTill:A,InsuranceCertValidTill:D,fitnessValidTill:P,roadTaxPaidTill:O,additionalDetails:{...E.additionalDetails,description:R},owner:{...E.owner,gender:k,dob:w,emailId:(null==e?void 0:e.emailId)||"abc@egov.com",name:(null==e?void 0:e.ownerName)||(null===(g=E.owner)||void 0===g?void 0:g.name),mobileNumber:(null==e?void 0:e.phone)||(null===(h=E.owner)||void 0===h?void 0:h.mobileNumber)}}};L(F,{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"UPDATE_VEHICLE"}),setTimeout(M,5e3),S.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{M(),b.push("/digit-ui/employee/fsm/registry/vehicle-details/"+((null==e?void 0:e.registrationNumber)||u))},5e3)}})},defaultValues:m,onFormValueChange:(e,t)=>{var n,l,i,a,o,r;if(null!=t&&t.registrationNumber){let n=(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"");if(t.length<=2)return t;const n=t.slice(0,2),l=t.slice(2);if(!l)return n;const i=l.match(/^(\d{1,2})/);if(!i)return n+"-"+l;const a=i[1],o=l.slice(a.length),r=o.match(/^([A-Z]*)/),u=r?r[1]:"",s=o.slice(u.length);if(!s)return n+"-"+a+u;if(u.length>=3){const e=u.length<=3?1:2;return n+"-"+a+u.slice(0,e)+"-"+u.slice(e)+"-"+s.slice(0,4)}return n+"-"+a+u+"-"+s.slice(0,4)})(t.registrationNumber);n.length>15&&(n=n.slice(0,15)),n!==t.registrationNumber&&e("registrationNumber",n)}null!=t&&t.registrationNumber&&null!=t&&t.ownerName&&null!=t&&t.phone&&(null!=t&&null!==(n=t.vehicle)&&void 0!==n&&null!==(l=n.modal)&&void 0!==l&&l.code||null!=t&&null!==(i=t.vehicle)&&void 0!==i&&i.modal)&&(null!=t&&null!==(a=t.vehicle)&&void 0!==a&&null!==(o=a.type)&&void 0!==o&&o.code||null!=t&&null!==(r=t.vehicle)&&void 0!==r&&r.type)&&null!=t&&t.selectGender&&null!=t&&t.dob&&new Date(null==t?void 0:t.dob).getTime()<=(new Date).setFullYear((new Date).getFullYear()-18)?p(!0):p(!1)},noBreakLine:!0,formClassName:"vehicle-details-card"}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:P("success"===s.key?`ES_FSM_REGISTRY_${s.action}_SUCCESS`:s.action),onClose:M}))},SelectVehicle:e=>{var i;let{t:a,config:o,onSelect:r,formData:u,setValue:s}=e;const d=Digit.ULBService.getStateId(),{data:c}=Digit.Hooks.fsm.useMDMS(d,"Vehicle","VehicleMakeModel");Digit.ULBService.getCurrentTenantId();const[p,m]=n.useState([]),[v,E]=n.useState({}),[_,S]=n.useState([]),[f,y]=n.useState({}),[T,g]=n.useState("");return n.useEffect(()=>{if(c){var e;const t=c.filter(e=>{var t,n,l;return e.code===((null==u||null===(t=u.vehicle)||void 0===t||null===(n=t.modal)||void 0===n?void 0:n.code)||(null==u||null===(l=u.vehicle)||void 0===l?void 0:l.modal))}),n=c.filter(e=>{var t,n,l;return e.code===((null==u||null===(t=u.vehicle)||void 0===t||null===(n=t.type)||void 0===n?void 0:n.code)||(null==u||null===(l=u.vehicle)||void 0===l?void 0:l.type))});E(...t),y(...n),g(null==u||null===(e=u.vehicle)||void 0===e?void 0:e.tankCapacity)}},[c]),n.useEffect(()=>{var e;null!=v&&v.code&&(null==v?void 0:v.code)!==(null==u||null===(e=u.vehicle)||void 0===e?void 0:e.modal)&&(y(""),g(""),s("additionalDetails",""),s("pollutionCert",void 0),s("insurance",void 0),s("roadTax",void 0),s("fitnessValidity",void 0))},[null==u||null===(i=u.vehicle)||void 0===i?void 0:i.modal]),n.useEffect(()=>{if(c){const e=c.filter(e=>void 0===e.make),t=c.filter(e=>{var t,n,l;return null!=(null==u||null===(t=u.vehicle)||void 0===t?void 0:t.modal)&&(null==e?void 0:e.make)===(null==u||null===(n=u.vehicle)||void 0===n||null===(l=n.modal)||void 0===l?void 0:l.code)});S(t),m(e)}},[c]),l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,a("ES_FSM_REGISTRY_VEHICLE_MODEL"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:v,disable:!1,option:null==p?void 0:p.sort((e,t)=>e.name.localeCompare(t.name)),select:e=>{const t=c.filter(t=>t.make===e.code);S(t),E(e),r(o.key,{...u[o.key],modal:e,type:""})},optionKey:"name",t:a})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,a("ES_FSM_REGISTRY_VEHICLE_TYPE"),o.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:f,option:null==_?void 0:_.sort((e,t)=>e.name.localeCompare(t.name)),select:e=>{g(e.capacity),y(e),r(o.key,{...u[o.key],type:e})},optionKey:"name",t:a})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,null,a("ES_FSM_REGISTRY_VEHICLE_CAPACITY"),o.isMandatory?" * ":null),l.createElement(t.TextInput,{className:"",value:T,onChange:()=>{},disable:!0})))},AddDriver:e=>{const o=Digit.ULBService.getCurrentTenantId(),u=Digit.ULBService.getStateId(),[s,d]=n.useState(null),c=a.useHistory(),p=r.useQueryClient(),[m,v,E]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[_,S,f]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[y,T,g]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:h}=Digit.Hooks.fsm.useDriverCreate(o);n.useEffect(()=>{v(!1),g(),f()},[]);const{t:I}=i.useTranslation(),C=Pt(I),[N,A]=n.useState(!1),D=()=>{d(null)},O=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,I("ES_FSM_REGISTRY_TITLE_NEW_DRIVER"))),l.createElement("div",{style:O?{}:{marginLeft:"-15px"}},l.createElement(t.FormComposer,{isDisabled:!N,label:I("ES_COMMON_APPLICATION_SUBMIT"),config:C.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t;const n=null==e?void 0:e.driverName,l=null==e?void 0:e.license,i=null==e||null===(t=e.selectGender)||void 0===t?void 0:t.code,a=null==e?void 0:e.emailId,r=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime();h({driver:{tenantId:o,name:n,licenseNumber:l,additionalDetails:null==e?void 0:e.additionalDetails,status:"ACTIVE",owner:{tenantId:u,name:n,fatherOrHusbandName:n,relationship:"OTHER",gender:i,dob:r,emailId:a||"abc@egov.com"},vendorDriverStatus:"INACTIVE"}},{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(D,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"ADD_DRIVER"}),setTimeout(D,5e3),p.invalidateQueries("FSM_DRIVER_SEARCH"),setTimeout(()=>{D(),c.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER")},5e3)}})},defaultValues:{tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{A(!(null==t||!t.driverName||null==t||!t.selectGender))},noBreakLine:!0}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:I("success"===s.key?`ES_FSM_${s.action}_SUCCESS`:s.action),onClose:D})))},DriverDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=i.useTranslation(),c=a.useHistory(),p=r.useQueryClient(),{id:m}=a.useParams(),[v,E]=n.useState(!1),[_,S]=n.useState(null),[f,y]=n.useState(!1),[T,g]=n.useState(null),[h,I]=n.useState([]),[C,N]=n.useState({}),{data:A,isLoading:D,refetch:O}=Digit.Hooks.fsm.useDriverDetails(s,{ids:m},{staleTime:Infinity}),{data:L}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:P}=Digit.Hooks.fsm.useDriverUpdate(s),{mutate:b}=Digit.Hooks.fsm.useVendorUpdate(s);function R(e){S(e),E(!1)}n.useEffect(()=>{if(L){let e=L.map(e=>e.dsoDetails);I(e)}},[L]),n.useEffect(()=>{O()},[]),n.useEffect(()=>{switch(_){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return y(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-driver/"+m);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER")}},[_]);const M=()=>{g(null)},k=()=>{S(null),N({}),y(!1)},w=()=>"DELETE"===_||"DELETE_VENDOR"===_?l.createElement(Tt,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===_||"EDIT_VENDOR"===_?l.createElement(l.Fragment,null,l.createElement(t.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(t.Dropdown,{t:d,option:h,value:C,selected:C,select:N,optionKey:"name"})):void 0;return D||D?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(t.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==A||null===(o=A[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,n)=>{var i;return l.createElement(l.Fragment,{key:n},n>0&&l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),l.createElement(t.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(i=e.values)||void 0===i?void 0:i.map((e,n)=>l.createElement(l.Fragment,{key:n},l.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("span",{className:"add-details-link hover-button",onClick:()=>R("ADD_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.AddIcon,{className:"",fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>R("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.EditIcon,null)),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>R("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(t.DeleteIcon,{className:"delete",fill:"#a82227"}))):l.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))))}))),f&&l.createElement(t.Modal,{headerBarMain:l.createElement(At,{label:d((()=>{switch(_){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(Ot,{onClick:k}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:k,actionSaveLabel:d("DELETE"===_||"DELETE_VENDOR"===_?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(_){case"DELETE":return(()=>{var e;const t={driver:{...null==A||null===(e=A[0])||void 0===e?void 0:e.driverData,status:"INACTIVE"}};P(t,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_DRIVER"}),p.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{M(),c.push("/digit-ui/employee/fsm/registry")},5e3)}}),y(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n,l;let i={},a=null==A||null===(e=A[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],o=null==a?void 0:a.drivers;o=o.map(e=>(e.id===m&&(e.vendorDriverStatus="INACTIVE"),e)),i={vendor:{...a,owner:{...a.owner,gender:(null===(l=a.owner)||void 0===l?void 0:l.gender)||"OTHERS"},drivers:o}},b(i,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VENDOR"}),p.invalidateQueries("FSM_VENDOR_SEARCH"),O(),setTimeout(M,5e3)}}),y(!1)})();case"ADD_VENDOR":return(()=>{var e,t;let n=C,l=null==A||null===(e=A[0])||void 0===e?void 0:e.driverData;l.vendorDriverStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:n.drivers?[...n.drivers,l]:[l]}};b(i,{onError:(e,t)=>{g({key:"error",action:e}),O(),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"ADD_VENDOR"}),p.invalidateQueries("DSO_SEARCH"),O(),setTimeout(M,5e3)}}),y(!1),S(null)})();case"EDIT_VENDOR":return(()=>{var e,t;let n=C,l=null==A||null===(e=A[0])||void 0===e?void 0:e.driverData;l.vendorDriverStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:n.drivers?[...n.drivers,l]:[l]}};b(i,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"EDIT_VENDOR"}),O(),p.invalidateQueries("DSO_SEARCH"),setTimeout(M,5e3)}}),y(!1),S(null)})()}},formId:"modal-action"},"DELETE"===_||"DELETE_VENDOR"===_?w():l.createElement(t.Card,{style:{boxShadow:"none"}},w())),T&&l.createElement(t.Toast,{error:"error"===T.key,label:d("success"===T.key?`ES_FSM_REGISTRY_${T.action}_SUCCESS`:T.action),onClose:M}),l.createElement(t.ActionBar,{style:{zIndex:"19"}},v?l.createElement(t.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:d,onSelect:R}):null,l.createElement(t.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>E(!v)})))},EditDriver:e=>{const o=Digit.ULBService.getCurrentTenantId();Digit.ULBService.getStateId();let{id:u}=a.useParams();const[s,d]=n.useState(null),[c,p]=n.useState(!1),[m,v]=n.useState({}),[E,_]=n.useState({}),S=r.useQueryClient(),[f,y,T]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[g,h,I]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[C,N,A]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{data:D,isLoading:O}=Digit.Hooks.fsm.useDriverDetails(o,{ids:u},{staleTime:Infinity}),{mutate:L}=Digit.Hooks.fsm.useDriverUpdate(o);n.useEffect(()=>{y(!1),A(),I()},[]),n.useEffect(()=>{if(D&&D[0]){var e,t,n,l,i,a,o,r,u,s,d,c,p,m;let E=D[0];_(null==E?void 0:E.driverData);let S={driverName:null==E||null===(e=E.driverData)||void 0===e?void 0:e.name,license:null==E||null===(t=E.driverData)||void 0===t?void 0:t.licenseNumber,selectGender:null==E||null===(n=E.driverData)||void 0===n||null===(l=n.owner)||void 0===l?void 0:l.gender,dob:(null==E||null===(i=E.driverData)||void 0===i||null===(a=i.owner)||void 0===a?void 0:a.dob)&&Digit.DateUtils.ConvertTimestampToDate(null==E||null===(o=E.driverData)||void 0===o||null===(r=o.owner)||void 0===r?void 0:r.dob,"yyyy-MM-dd"),emailId:"abc@egov.com"===(null==E||null===(u=E.driverData)||void 0===u||null===(s=u.owner)||void 0===s?void 0:s.emailId)?"":null==E||null===(d=E.driverData)||void 0===d||null===(c=d.owner)||void 0===c?void 0:c.emailId,additionalDetails:null==E||null===(p=E.driverData)||void 0===p||null===(m=p.additionalDetails)||void 0===m?void 0:m.description};v(S)}},[D]);const{t:P}=i.useTranslation(),b=a.useHistory(),R=Pt(P,!0),M=()=>{d(null)};return O||0==Object.keys(m).length?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(t.FormComposer,{isDisabled:!c,label:P("ES_COMMON_APPLICATION_SUBMIT"),config:R.filter(e=>!e.hideInEmployee).map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n;const l=null==e?void 0:e.license,i=null==e||null===(t=e.selectGender)||void 0===t?void 0:t.code,a=null==e?void 0:e.emailId,o=new Date(""+e.dob).getTime(),r=null==e?void 0:e.additionalDetails,s={driver:{...E,licenseNumber:l,additionalDetails:r,owner:{...E.owner,relationship:(null===(n=E.owner)||void 0===n?void 0:n.relationship)||"OTHER",gender:i||E.owner.gender||"OTHER",dob:o,emailId:a||"abc@egov.com"}}};L(s,{onError:(e,t)=>{d({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{d({key:"success",action:"UPDATE_DRIVER"}),setTimeout(M,5e3),S.invalidateQueries("FSM_DRIVER_SEARCH"),setTimeout(()=>{M(),b.push("/digit-ui/employee/fsm/registry/driver-details/"+u)},5e3)}})},defaultValues:m,onFormValueChange:(e,t)=>{p(!(null==t||!t.selectGender))},noBreakLine:!0}),s&&l.createElement(t.Toast,{error:"error"===s.key,label:P("success"===s.key?`ES_FSM_REGISTRY_${s.action}_SUCCESS`:s.action),onClose:M})))},FsmBreadCrumb:e=>{var a,o,r,u,s,d,c,p,m,v,E,_,S,f,y,T,g;let{location:h}=e;const{t:I}=i.useTranslation(),C=Digit.UserService.hasAccess(["FSM_DSO"]),N=Digit.UserService.hasAccess(["FSM_EMP_FSTPO"]),A=null==h||null===(a=h.pathname)||void 0===a?void 0:a.includes("application-details"),D=null==h||null===(o=h.pathname)||void 0===o?void 0:o.includes("fstp-operator-details"),O=null==h||null===(r=h.pathname)||void 0===r?void 0:r.includes("inbox"),L=null==h||null===(u=h.pathname)||void 0===u?void 0:u.includes("fsm"),P=null==h||null===(s=h.pathname)||void 0===s?void 0:s.includes("search"),b=null==h||null===(d=h.pathname)||void 0===d?void 0:d.includes("registry"),R=null==h||null===(c=h.pathname)||void 0===c?void 0:c.includes("vendor-details"),M=null==h||null===(p=h.pathname)||void 0===p?void 0:p.includes("modify-vendor"),k=null==h||null===(m=h.pathname)||void 0===m?void 0:m.includes("new-application"),w=null==h||null===(v=h.pathname)||void 0===v?void 0:v.includes("vehicle-details"),F=null==h||null===(E=h.pathname)||void 0===E?void 0:E.includes("modify-vehicle"),x=null==h||null===(_=h.pathname)||void 0===_?void 0:_.includes("driver-details"),H=null==h||null===(S=h.pathname)||void 0===S?void 0:S.includes("modify-driver"),V=null==h||null===(f=h.pathname)||void 0===f?void 0:f.includes("modify-application"),B=null==h||null===(y=h.pathname)||void 0===y?void 0:y.includes("new-vendor"),U=null==h||null===(T=h.pathname)||void 0===T?void 0:T.includes("new-vehicle"),Y=null==h||null===(g=h.pathname)||void 0===g?void 0:g.includes("new-driver"),[G,W]=n.useState(!1),[K,z]=n.useState(!1);n.useEffect(()=>{if(G?(L||O&&G)&&W(!1):W(P),null!=h&&h.pathname){let e=null==h?void 0:h.pathname.split("/");z(e[e.length-1])}},[h]);const j=[{path:C?"/digit-ui/citizen/fsm/dso-dashboard":"/digit-ui/employee",content:I("ES_COMMON_HOME"),show:L},{path:b?"/digit-ui/employee/fsm/registry?selectedTabs=VENDOR":N?"/digit-ui/employee/fsm/fstp-inbox":"/digit-ui/employee",content:D?I("ES_TITLE_INBOX"):"FSM",show:L},{path:k?"/digit-ui/employee/fsm/new-application":"",content:I("FSM_NEW_DESLUDGING_APPLICATION"),show:L&&k},{path:"",content:""+I("FSM_SUCCESS"),show:!!h.pathname.includes("/employee/fsm/response")},{path:O||P||A?"/digit-ui/employee/fsm/inbox":"",content:I("ES_TITLE_INBOX"),show:L&&O||P||A},{path:"/digit-ui/employee/fsm/search",content:I("ES_TITILE_SEARCH_APPLICATION"),show:G},{content:I("ES_TITLE_APPLICATION_DETAILS"),show:A},{content:I("ES_TITLE_VEHICLE_LOG"),show:D},{path:"/digit-ui/employee/fsm/registry/vendor-details/"+K,content:I("ES_TITLE_VENDOR_DETAILS"),show:b&&(R||M)},{path:"/digit-ui/employee/fsm/registry/vehicle-details/"+K,content:I("ES_TITLE_VEHICLE_DETAILS"),show:b&&(w||F)},{path:"/digit-ui/employee/fsm/registry/driver-details/"+K,content:I("ES_TITLE_DRIVER_DETAILS"),show:b&&(x||H)},{content:I("ES_TITLE_VENDOR_EDIT"),show:b&&(M||F||H)},{path:"digit-ui/employee/fsm/modify-application/"+K,content:I("ES_FSM_APPLICATION_UPDATE"),show:V},{content:B?I("ES_FSM_ACTION_CREATE_VENDOR"):U?I("ES_FSM_REGISTRY_DETAILS_TYPE_VEHICLE"):Y?I("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"):null,show:b&&(B||U||Y)}];return l.createElement(t.BreadCrumb,{crumbs:j})},AdvanceCollection:e=>{var i,o,r,u,d,c;let{t:p,config:m,onSelect:v,formData:E,FSMTextFieldStyle:_}=e;const S=Digit.ULBService.getCurrentTenantId(),f=Digit.ULBService.getStateId(),{pathname:y}=a.useLocation();let{id:T}=a.useParams();const g=Digit.UserService.getUser(),[h,I]=n.useState(),[C,N]=n.useState(),{data:A}=Digit.Hooks.fsm.useSearch(S,{applicationNos:T,uuid:g.uuid},{staleTime:Infinity}),[D,O]=n.useState({label:null==E||null===(i=E.tripData)||void 0===i?void 0:i.vehicleCapacity}),[L,P]=n.useState(!1),{isLoading:b}=Digit.Hooks.fsm.useMDMS(f,"Vehicle","VehicleType",{staleTime:Infinity}),{isLoading:R}=Digit.Hooks.fsm.useDsoSearch(S,{limit:-1,status:"ACTIVE"}),M=[{label:"ES_NEW_APPLICATION_ADVANCE_COLLECTION",type:"text",name:"advanceAmount",validation:{isRequired:!0,min:"0",pattern:"^[0-9]+",title:p("ES_NEW_APPLICATION_AMOUNT_INVALID")},default:null==E?void 0:E.advanceAmount,isMandatory:!0}];function k(e){v(m.key,{...E[m.key],...e})}return n.useEffect(()=>{!function(){try{var e,t,n;(null==E||null===(e=E.tripData)||void 0===e?void 0:e.vehicleType)!==D&&O({label:null==E||null===(t=E.tripData)||void 0===t||null===(n=t.vehicleType)||void 0===n?void 0:n.capacity});const l=function(e,t,n,l){if(null!=E&&E.propertyType&&null!=E&&E.subtype&&null!=E&&E.address&&null!=E&&null!==(e=E.tripData)&&void 0!==e&&null!==(t=e.vehicleType)&&void 0!==t&&t.capacity&&"WITHIN_ULB_LIMITS"===(null==E||null===(n=E.address)||void 0===n||null===(l=n.propertyLocation)||void 0===l?void 0:l.code)){var i;const e=null==E||null===(i=E.tripData)||void 0===i?void 0:i.vehicleType.capacity,{slum:t}=E.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(S,{propertyType:null==E?void 0:E.subtype,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]),l=function(){if(null!=n&&n.price||0===(null==n?void 0:n.price)){const e=n.price*E.tripData.noOfTrips;return Promise.resolve(Digit.FSMService.advanceBalanceCalculate(S,{totalTripAmount:e})).then(function(t){var n;let{advanceAmount:l}=t;Digit.SessionStorage.set("total_amount",e),Digit.SessionStorage.set("advance_amount",l),I(e),N(l),(!y.includes("modify")||y.includes("modify")&&l>(null==E||null===(n=E.advancepaymentPreference)||void 0===n?void 0:n.advanceAmount))&&k({advanceAmount:l}),P(!1)})}sessionStorage.removeItem("Digit.total_amount"),sessionStorage.removeItem("Digit.advance_amount"),P(!0)}();if(l&&l.then)return l.then(function(){})})}}();l&&l.then&&l.then(function(){})}catch(e){Promise.reject(e)}}()},[null==E?void 0:E.propertyType,null==E?void 0:E.subtype,null==E||null===(o=E.address)||void 0===o?void 0:o.slum,null==E||null===(r=E.tripData)||void 0===r||null===(u=r.vehicleType)||void 0===u?void 0:u.capacity,null==E||null===(d=E.tripData)||void 0===d?void 0:d.noOfTrips]),n.useEffect(()=>{!function(){try{const e=function(e,t){if("FROM_GRAM_PANCHAYAT"===(null==E||null===(e=E.address)||void 0===e||null===(t=e.propertyLocation)||void 0===t?void 0:t.code)&&E.tripData.noOfTrips&&E.tripData.amountPerTrip){const e=E.tripData.amountPerTrip*E.tripData.noOfTrips;return Promise.resolve(Digit.FSMService.advanceBalanceCalculate(S,{totalTripAmount:e})).then(function(t){var n;let{advanceAmount:l}=t;Digit.SessionStorage.set("total_amount",e),Digit.SessionStorage.set("advance_amount",l),I(e),N(l),(!y.includes("modify")||y.includes("modify")&&l>(null==E||null===(n=E.advancepaymentPreference)||void 0===n?void 0:n.advanceAmount))&&k({advanceAmount:l}),P(!1)})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[E.tripData.noOfTrips,E.tripData.amountPerTrip]),b&&R?l.createElement(t.Loader,null):l.createElement("div",null,0!==(null==E||null===(c=E.tripData)||void 0===c?void 0:c.amountPerTrip)&&(null==M?void 0:M.map((e,n)=>{let i=E&&E[m.key]&&E[m.key][e.name];return l.createElement(l.Fragment,{key:n},l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},p(e.label)+" (₹)",e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({disabled:!!y.includes("modify"),type:e.type,key:e.name,style:_,onChange:e=>{v(m.key,{...E[m.key],advanceAmount:e.target.value})},value:e.default?e.default:E&&E[m.key]?E[m.key][e.name]:0},e.validation)),i>h&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},p("FSM_ADVANCE_AMOUNT_MAX")),i<C&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},p("FSM_ADVANCE_AMOUNT_MIN")),y.includes("modify-application")&&0===Number(C)&&(null==A?void 0:A.advanceAmount)>0&&0===Number(i)&&l.createElement(t.CardLabelError,{style:{width:"100%",marginTop:"-15px",fontSize:"14px",marginBottom:"0px"}},p("FSM_ADVANCE_AMOUNT_NOT_ZERO")))))})))},SelectTrips:e=>{var i,o,r,u,d,c,p,m,v;let{t:E,config:_,onSelect:S,formData:f={},styles:y,FSMTextFieldStyle:T}=e;const g=Digit.ULBService.getCurrentTenantId(),h=Digit.ULBService.getStateId(),{pathname:I}=a.useLocation(),C=I.includes("/modify-application/");let{id:N}=a.useParams();const A=Digit.UserService.getUser(),{data:D}=Digit.Hooks.fsm.useSearch(g,{applicationNos:N,uuid:A.uuid},{staleTime:Infinity}),[O,L]=n.useState({label:null==f||null===(i=f.tripData)||void 0===i?void 0:i.vehicleCapacity}),[P,b]=n.useState(!1),{isLoading:R,data:M}=Digit.Hooks.fsm.useMDMS(h,"Vehicle","VehicleType",{staleTime:Infinity}),{data:k,isLoading:w}=Digit.Hooks.fsm.useDsoSearch(g,{limit:-1,status:"ACTIVE"}),[F,x]=n.useState([]);n.useEffect(()=>{if(k&&M){const e=k.reduce((e,t)=>t.vehicles&&t.vehicles.length?e.concat(t.vehicles):e,[]),t=Array.from(new Set(e.map(e=>e.capacity))).map(t=>e.find(e=>e.capacity===t));x(t)}},[k,M]);const H=[{label:"ES_NEW_APPLICATION_PAYMENT_NO_OF_TRIPS",type:"text",name:"noOfTrips",error:E("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID"),validation:{isRequired:!0,pattern:"^[1-9]+",min:"1",title:E("ES_NEW_APPLICATION_NO_OF_TRIPS_INVALID")},default:null==f||null===(o=f.tripData)||void 0===o?void 0:o.noOfTrips,disable:!1,isMandatory:!0},{label:"ES_NEW_APPLICATION_DISTANCE_FROM_ROAD",type:"text",name:"distancefromroad",default:null==f||null===(r=f.tripData)||void 0===r?void 0:r.distancefromroad,isMandatory:!0},{label:"ES_NEW_APPLICATION_ROAD_WIDTH",type:"text",name:"roadWidth",default:null==f||null===(u=f.tripData)||void 0===u?void 0:u.roadWidth,isMandatory:!0}];function V(e,t){e&&t&&S(_.key,{...f[_.key],[t]:e})}return n.useEffect(()=>{!function(){try{var e,t,n;(null==f||null===(e=f.tripData)||void 0===e?void 0:e.vehicleType)!==O&&L({label:null==f||null===(t=f.tripData)||void 0===t||null===(n=t.vehicleType)||void 0===n?void 0:n.capacity});const l=function(e,t){if("FROM_GRAM_PANCHAYAT"===(null==f||null===(e=f.address)||void 0===e||null===(t=e.propertyLocation)||void 0===t?void 0:t.code)&&f.tripData.noOfTrips&&f.tripData.amountPerTrip)V({amount:f.tripData.amountPerTrip*f.tripData.noOfTrips});else{const e=function(e,t,n,l){if(null!=f&&f.propertyType&&null!=f&&f.subtype&&null!=f&&f.address&&null!=f&&null!==(e=f.tripData)&&void 0!==e&&null!==(t=e.vehicleType)&&void 0!==t&&t.capacity&&"WITHIN_ULB_LIMITS"===(null==f||null===(n=f.address)||void 0===n||null===(l=n.propertyLocation)||void 0===l?void 0:l.code)){var i;const e=null==f||null===(i=f.tripData)||void 0===i?void 0:i.vehicleType.capacity,{slum:t}=f.address;return Promise.resolve(Digit.FSMService.billingSlabSearch(g,{propertyType:null==f?void 0:f.subtype,capacity:e,slum:t?"YES":"NO"})).then(function(e){var t;const n=(null==e||null===(t=e.billingSlab)||void 0===t?void 0:t.length)&&(null==e?void 0:e.billingSlab[0]);null!=n&&n.price||0===(null==n?void 0:n.price)?(V(n.price,"amountPerTrip"),V(n.price*f.tripData.noOfTrips,"amount"),b(!1)):(V({amountPerTrip:"",amount:""}),b(!0))})}}();if(e&&e.then)return e.then(function(){})}}();l&&l.then&&l.then(function(){})}catch(e){Promise.reject(e)}}()},[null==f?void 0:f.propertyType,null==f?void 0:f.subtype,null==f?void 0:f.address,null==f||null===(d=f.tripData)||void 0===d||null===(c=d.vehicleType)||void 0===c?void 0:c.capacity,null==f||null===(p=f.tripData)||void 0===p?void 0:p.noOfTrips,null==f||null===(m=f.address)||void 0===m||null===(v=m.propertyLocation)||void 0===v?void 0:v.code]),R&&w?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_NEW_APPLICATION_LOCATION_VEHICLE_REQUESTED")+" * "),l.createElement(t.Dropdown,{className:"form-field",style:y,isMandatory:!0,option:null==F?void 0:F.map(e=>({...e,label:e.capacity})).sort((e,t)=>e.capacity-t.capacity),optionKey:"label",id:"vehicle",selected:O,select:function(e){L({label:e.capacity}),S(_.key,{...f[_.key],vehicleType:e})},t:E,disable:!(!C||"CREATED"==(null==D?void 0:D.applicationStatus))})),null==H?void 0:H.map((e,n)=>l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},E(e.label),e.isMandatory?" * ":null),l.createElement("div",{className:"field"},l.createElement(t.TextInput,s({type:e.type,style:{...y,...T},onChange:t=>V(t.target.value,e.name),key:e.name,value:f&&f[_.key]?f[_.key][e.name]:null},e.validation,{disable:e.disable}))))),P?l.createElement(t.CardLabelError,{style:{width:"100%",textAlign:"center"}},E("ES_APPLICATION_BILL_SLAB_ERROR")):null)},PlusMinusInput:tt,ConfirmationBox:Tt,SelectLocalityOrGramPanchayat:e=>{var i,a,o,r,u,s,d,c,p,v;let{t:E,config:_,onSelect:S,userType:f,formData:y}=e;const T=Digit.Hooks.fsm.useTenants();let g=Digit.ULBService.getCurrentTenantId();var h;"employee"!==f&&(g=null===(h=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===h?void 0:h.code);const{data:I}=Digit.Hooks.fsm.useMDMS(g,"FSM","UrcConfig"),C=I&&I.length>0&&I[0].URCEnable,{pincode:N,propertyLocation:A}=(null==y?void 0:y.address)||"",D=window.sessionStorage.getItem("Digit_OBPS_PT"),O=JSON.parse(D),L="employee"===f?T.filter(e=>(null==e?void 0:e.code)===g):N?T.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==N)}):T,[P,b]=n.useState((null==y||null===(i=y.cpt)||void 0===i||null===(a=i.details)||void 0===a||null===(o=a.address)||void 0===o?void 0:o.locality)||(null==O||null===(r=O.address)||void 0===r?void 0:r.locality)||""),[R,M]=n.useState(),[k,w]=n.useState(),[F,x]=n.useState(()=>{var e,t;return null!=y&&null!==(e=y.address)&&void 0!==e&&e.gramPanchayat?null==y||null===(t=y.address)||void 0===t?void 0:t.gramPanchayat:{}}),[H,V]=n.useState([]),[B,U]=n.useState(()=>{var e,t;return null!=y&&null!==(e=y.address)&&void 0!==e&&e.village?null==y||null===(t=y.address)||void 0===t?void 0:t.village:{}}),[Y,G]=n.useState(),[W,K]=n.useState(),[z,j]=n.useState(),[X,$]=n.useState(()=>{var e;return(null==y||null===(e=y.address)||void 0===e?void 0:e.city)||Digit.SessionStorage.get("fsm.file.address.city")||null});n.useEffect(()=>{L&&1===L.length&&$(L[0])},[L]);var{data:q}=Digit.Hooks.useBoundaryLocalities(null==X?void 0:X.code,"gramPanchayats",{enabled:!!X},E),{data:Z}=Digit.Hooks.useBoundaryLocalities(null==X?void 0:X.code,"revenue",{enabled:!!X},E);function Q(e){b(e),"employee"===f&&S(_.key,{...y[_.key],locality:e})}function J(e){x(e);const t=null==q?void 0:q.filter(t=>(null==t?void 0:t.code)===(null==e?void 0:e.code))[0].children,n=null==t?void 0:t.map(e=>({...e,i18nkey:g.replace(".","_").toUpperCase()+"_REVENUE_"+(null==e?void 0:e.code)}));(null==n?void 0:n.length)>0&&V(n),"employee"===f&&S(_.key,{...y[_.key],gramPanchayat:e}),Digit.SessionStorage.del("locationType")}function ee(e){U(e),"employee"===f&&S(_.key,{...y[_.key],village:e})}n.useEffect(()=>{var e,t,n,l,i,a,o,r,u;null!=y&&null!==(e=y.cpt)&&void 0!==e&&null!==(t=e.details)&&void 0!==t&&null!==(n=t.address)&&void 0!==n&&n.locality&&"employee"===f&&(b(null==y||null===(l=y.cpt)||void 0===l||null===(i=l.details)||void 0===i||null===(a=i.address)||void 0===a?void 0:a.locality),S(_.key,{...y[_.key],locality:null==y||null===(o=y.cpt)||void 0===o||null===(r=o.details)||void 0===r||null===(u=r.address)||void 0===u?void 0:u.locality}))},[null==y||null===(u=y.cpt)||void 0===u||null===(s=u.details)||void 0===s||null===(d=s.address)||void 0===d?void 0:d.locality]),n.useEffect(()=>{if(X&&Z){var e,t,n,l;let r=Z,u=[];var i,a,o;null!=y&&null!==(e=y.address)&&void 0!==e&&e.locality&&"Locality"===(null==y||null===(t=y.address)||void 0===t||null===(n=t.additionalDetails)||void 0===n?void 0:n.boundaryType)&&(b(y.address.locality),j(null==y||null===(i=y.address)||void 0===i||null===(a=i.additionalDetails)||void 0===a?void 0:a.newLocality)),null!=y&&null!==(l=y.address)&&void 0!==l&&l.pincode&&(u=r.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==y.address.pincode)}),null!=y&&null!==(o=y.address)&&void 0!==o&&o.locality||b()),M(()=>u.length>0?u:r),1===u.length&&(b(u[0]),"employee"===f&&S(_.key,{...y[_.key],locality:u[0]}))}},[X,Z]),n.useEffect(()=>{var e,t;null!=y&&null!==(e=y.address)&&void 0!==e&&e.gramPanchayat&&J(null==y||null===(t=y.address)||void 0===t?void 0:t.gramPanchayat)},[q]),n.useEffect(()=>{var e,t,n;if(q&&(q&&q.length>0&&w(q),null!=y&&null!==(e=y.address)&&void 0!==e&&null!==(t=e.additionalDetails)&&void 0!==t&&null!==(n=t.gramPanchayat)&&void 0!==n&&n.code)){var l,i;const e=q.filter(e=>{var t,n,l;return(null==e?void 0:e.code)===(null==y||null===(t=y.address)||void 0===t||null===(n=t.additionalDetails)||void 0===n||null===(l=n.gramPanchayat)||void 0===l?void 0:l.code)})[0];x(e),K(null==y||null===(l=y.address)||void 0===l||null===(i=l.additionalDetails)||void 0===i?void 0:i.newGp);var a,o,r,u,s,d=null==e?void 0:e.children.filter(e=>{var t,n,l;return(null==e?void 0:e.code)===(null==y||null===(t=y.address)||void 0===t||null===(n=t.additionalDetails)||void 0===n||null===(l=n.village)||void 0===l?void 0:l.code)});d.length>0?(d[0].i18nkey=g.replace(".","_").toUpperCase()+"_REVENUE_"+(null===(a=d[0])||void 0===a?void 0:a.code),U(d[0]),V(d)):G("string"==typeof(null==y||null===(o=y.address)||void 0===o||null===(r=o.additionalDetails)||void 0===r?void 0:r.village)?null==y||null===(u=y.address)||void 0===u||null===(s=u.additionalDetails)||void 0===s?void 0:s.village:"")}},[q,null==y||null===(c=y.address)||void 0===c||null===(p=c.additionalDetails)||void 0===p||null===(v=p.gramPanchayat)||void 0===v?void 0:v.code]),"employee"!==f&&"FROM_GRAM_PANCHAYAT"===(null==A?void 0:A.code)&&(_.texts.cardText="CS_FILE_APPLICATION_PROPERTY_LOCATION_GRAM_PANCHAYAT_TEXT");const te=e=>{G(e),"employee"===f&&S(_.key,{...y[_.key],newVillage:e})},ne=e=>{K(e),"employee"===f&&S(_.key,{...y[_.key],newGp:e})},le=e=>{j(e),"employee"===f&&S(_.key,{...y[_.key],newLocality:e})};var ie,ae;return"employee"===f?l.createElement("div",null,"FROM_GRAM_PANCHAYAT"===(null==A?void 0:A.code)?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_GRAM_PANCHAYAT"),_.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:F,option:null==k?void 0:k.sort((e,t)=>e.name.localeCompare(t.name)),select:J,optionKey:"name",t:E})),"Other"===(null==F?void 0:F.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"newGp",key:"newGp",value:W,onChange:e=>ne(e.target.value)}))),H.length>0&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:B,option:null==H?void 0:H.sort((e,t)=>e.name.localeCompare(t.name)),select:ee,optionKey:"i18nkey",t:E})),0===H.length&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"village",key:"village",value:Y,onChange:e=>te(e.target.value)})))):C&&l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_CREATECOMPLAINT_MOHALLA"),_.isMandatory?" * ":null),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:P,option:null==Z?void 0:Z.sort((e,t)=>e.name.localeCompare(t.name)),select:Q,optionKey:"name",t:E})),"Other"===(null==y||null===(ie=y.address)||void 0===ie||null===(ae=ie.locality)||void 0===ae?void 0:ae.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" *"),l.createElement("div",{className:"field"},l.createElement(t.TextInput,{id:"newLocality",key:"newLocality",value:z,onChange:e=>le(e.target.value)}))))):l.createElement(l.Fragment,null,l.createElement(m,{currentStep:1,flow:"APPLY"}),l.createElement(t.FormStep,{config:_,onSelect:function(){S(_.key,"FROM_GRAM_PANCHAYAT"===(null==A?void 0:A.code)?{gramPanchayat:F,village:B,newGramPanchayat:W,newVillage:Y}:{locality:P,newLocality:z})},isDisabled:"WITHIN_ULB_LIMITS"===(null==A?void 0:A.code)?P&&"Other"===(null==P?void 0:P.name)&&!z:F&&"Other"===(null==F?void 0:F.name)&&!W,t:E},"WITHIN_ULB_LIMITS"===(null==A?void 0:A.code)?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_CREATECOMPLAINT_MOHALLA")+" *"),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:P,option:null==Z?void 0:Z.sort((e,t)=>e.name.localeCompare(t.name)),select:Q,optionKey:"name",t:E})),"Other"===(null==P?void 0:P.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_LOCALITY")+" *"),l.createElement(t.TextInput,{style:{width:"86%"},type:"text",id:"newLocality",key:"newLocality",value:z,onChange:e=>le(e.target.value)}))):l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_GRAM_PANCHAYAT")+" *"),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:F,option:null==k?void 0:k.sort((e,t)=>e.name.localeCompare(t.name)),select:J,optionKey:"i18nkey",t:E})),"Other"===(null==F?void 0:F.name)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("ES_INBOX_PLEASE_SPECIFY_GRAM_PANCHAYAT")+" *"),l.createElement(t.TextInput,{style:{width:"86%"},type:"text",id:"newGp",key:"newGp",value:W,onChange:e=>ne(e.target.value)})),H.length>0&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement(t.Dropdown,{className:"form-field",isMandatory:!0,selected:B,option:null==H?void 0:H.sort((e,t)=>e.name.localeCompare(t.name)),select:ee,optionKey:"i18nkey",t:E})),0===H.length&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},E("CS_VILLAGE_NAME")),l.createElement(t.TextInput,{style:{width:"86%"},type:"text",id:"village",key:"village",value:Y,onChange:e=>te(e.target.value)})))))}};exports.initFSMComponents=()=>{Object.entries(Mt).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};
|