@mseva/upyog-ui-module-asset 1.0.2 → 1.0.4
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/package.json +2 -2
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("@mseva/digit-ui-react-components"),n=require("react"),l=e(n),a=require("react-i18next"),o=require("react-router-dom"),i=require("react-hook-form"),r=e(require("jspdf")),s=e(require("qrcode")),u=require("xlsx");require("jspdf-autotable");var c=require("react-query"),d=e(require("exif-js"));function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function p(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}const v=function(){function e(){}return e.prototype.then=function(t,n){const l=new e,a=this.s;if(a){const e=1&a?t:n;if(e){try{f(l,1,e(this.v))}catch(e){f(l,2,e)}return l}return this}return this.o=function(e){try{const a=e.v;1&e.s?f(l,1,t?t(a):a):n?f(l,1,n(a)):f(l,2,a)}catch(e){f(l,2,e)}},l},e}();function f(e,t,n){if(!e.s){if(n instanceof v){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function E(e){return e instanceof v&&1&e.s}function g(e,t,n){for(var l;;){var a=e();if(E(a)&&(a=a.v),!a)return o;if(a.then){l=0;break}var o=n();if(o&&o.then){if(!E(o)){l=1;break}o=o.s}if(t){var i=t();if(i&&i.then&&!E(i)){l=2;break}}}var r=new v,s=f.bind(null,r,2);return(0===l?a.then(c):1===l?o.then(u):i.then(d)).then(void 0,s),r;function u(l){o=l;do{if(t&&(i=t())&&i.then&&!E(i))return void i.then(d).then(void 0,s);if(!(a=e())||E(a)&&!a.v)return void f(r,1,o);if(a.then)return void a.then(c).then(void 0,s);E(o=n())&&(o=o.v)}while(!o||!o.then);o.then(u).then(void 0,s)}function c(e){e?(o=n())&&o.then?o.then(u).then(void 0,s):u(o):f(r,1,o)}function d(){(a=e())?a.then?a.then(c).then(void 0,s):c(a):f(r,1,o)}}function S(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const h=e=>{let{isLoading:a,t:u,onSubmit:c,data:d,count:m,setShowToast:p,ActionBarStyle:v={},MenuStyle:f={},tenantId:E}=e;const h=window.Digit.Utils.browser.isMobile(),_=new Date,y=_.toISOString().split("T")[0],A=o.useHistory(),C=new Date(_);C.setDate(_.getDate()-7);const b=C.toISOString().split("T")[0],{register:D,control:T,handleSubmit:N,setValue:I,getValues:O,reset:x}=i.useForm({defaultValues:{offset:0,limit:!h&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:b,toDate:y}});n.useEffect(()=>{D("offset",0),D("limit",10),D("sortBy","commencementDate"),D("sortOrder","DESC"),I("fromDate",b),I("toDate",y)},[D,I,y,b]);var R=window.location.origin;const{data:L}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"Action"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Action}});let w=[];L&&L.map(e=>{w.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:P}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"ActionOption"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ActionOption;return null==n?void 0:n.filter(e=>!0===e.active)}}),M=e=>l.createElement("span",{className:"cell-text"},e),F=n.useMemo(()=>[{Header:u("ES_ASSET_RESPONSE_CREATE_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null===(t=a.original)||void 0===t?void 0:t.applicationNo)},null===(n=a.original)||void 0===n?void 0:n.applicationNo)))}},{Header:u("AST_BOOK_REF_SERIAL_NUM"),Cell:e=>{var t,n;return M(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetBookRefNo))},disableSortBy:!0},{Header:u("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:u("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:u("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+u("COMMON_MASTERS_DEPARTMENT_"+(null==n||null===(t=n.original)||void 0===t?void 0:t.department)))},disableSortBy:!0},{Header:u("AST_APPLICATION_STATUS"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.status))},disableSortBy:!0},{Header:u("AST_ACTIONS"),Cell:e=>{var a;let{row:i}=e;const[r,s]=n.useState(!1),c=n.useRef(),d=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};l.useEffect(()=>(document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}),[]);const m=(e=>{const t=[];return P&&P.map(n=>{var l,a,o,i,r;if(null!=e&&null!==(l=e.original)&&void 0!==l&&null!==(a=l.assetAssignment)&&void 0!==a&&a.isAssigned&&"AST_RETURN"===n.code||(null==e||null===(o=e.original)||void 0===o||null===(i=o.assetAssignment)||void 0===i||!i.isAssigned)&&"AST_ASSIGN"===n.code)t.push({label:u(n.code),link:""+n.url+(null==e||null===(r=e.original)||void 0===r?void 0:r.applicationNo),code:n.code});else if("AST_RETURN"!==n.code&&"AST_ASSIGN"!==n.code){var s;t.push({label:u(n.code),link:""+n.url+(null==e||null===(s=e.original)||void 0===s?void 0:s.applicationNo),code:n.code})}}),t})(i);return l.createElement("div",{ref:c},"APPROVED"===(null==i||null===(a=i.original)||void 0===a?void 0:a.status)?l.createElement(l.Fragment,null,l.createElement(t.SubmitBar,{label:u("WF_TAKE_ACTION"),onSubmit:()=>{s(!r)}}),r&&l.createElement("div",{style:{position:"absolute",backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",padding:"8px",zIndex:1e3}},m.filter(e=>{var t;return"0"!==(null==i||null===(t=i.original)||void 0===t?void 0:t.assetStatus)||"AST_CERTIFICATE"===e.code}).map((e,t)=>"AST_CERTIFICATE"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e){try{return Promise.resolve(Digit.ASSETService.search({tenantId:E,filters:{applicationNo:e}})).then(function(e){var t;return Promise.resolve(Digit.PaymentService.generatePdf(E,{Assets:[null==e||null===(t=e.Assets)||void 0===t?void 0:t[0]]},"asset-report")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(E,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[null==e?void 0:e.filestoreIds[0]],"_blank")})})})}catch(e){return Promise.reject(e)}}(null===(e=i.original)||void 0===e?void 0:e.applicationNo)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):"AST_DEPRECIATION"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e,t){try{const e=S(function(){return Promise.resolve(Digit.ASSETService.depriciationProcess({Asset:{tenantId:E,id:t,accountId:""}})).then(function(e){e&&A.replace("/digit-ui/employee/asset/assetservice/asset-process-depreciation-response",{ProcessDepreciation:e})})},function(){p({error:!0,label:u("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(0,null===(e=i.original)||void 0===e?void 0:e.id)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):l.createElement(o.Link,{key:t,to:e.link,style:{display:"block",padding:"8px",textDecoration:"none",color:"black"}},e.label)))):u("AST_SHOULD_BE_APPROVED_FIRST"))},mobileCell:e=>{var t;return GetMobCell(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],[]),B=n.useCallback(e=>{0!==e.length&&(I("sortBy",e.id),I("sortOrder",e.desc?"DESC":"ASC"))},[I]);function k(){I("offset",O("offset")-O("limit")),N(c)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,u("ASSET_APPLICATIONS")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},u("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:c,handleSubmit:N},l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_STATUS")),l.createElement(i.Controller,{control:T,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:w,optionKey:"i18nKey",t:u,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_APPLICATION_ID")),l.createElement(t.TextInput,{name:"applicationNo",inputRef:D({})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_FROM_DATE")),l.createElement(i.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:y}),name:"fromDate",control:T})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_TO_DATE")),l.createElement(i.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:y}),name:"toDate",control:T})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{x({applicationNo:"",fromDate:b,toDate:y,status:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),k()}},u("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==d?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const o=g(function(){return a<d.length},function(){return!!(a+=l)},function(){const e=d.slice(a,a+l);console.log("comming data:- ",e);const o=e.map(function(e,a){try{return Promise.resolve(n(R+"/digit-ui/citizen/assets/services?tenantId="+E+"&applicationNo="+e.applicationNo)).then(function(n){const o=a%l*90;t.addImage(n,"JPEG",10,20+o,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+o),t.text("Asset Classification: "+e.assetClassification,70,40+o),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+o),t.text("Asset Name: "+e.assetName,70,60+o),t.text("Track: "+e.location,70,70+o),t.line(10,80+o,200,80+o)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(o)).then(function(){a+l<d.length&&t.addPage()})});return Promise.resolve(o&&o.then?o.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=d&&d.display?l.createElement(t.Card,{style:{marginTop:20}},u(d.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===d?""!==d||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:u,data:d,totalRecords:m,columns:F,getCellProps:e=>({style:{minWidth:e.column.Header===u("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){I("limit",Number(e.target.value)),N(c)()},currentPage:O("offset")/O("limit"),onNextPage:function(){I("offset",O("offset")+O("limit")),N(c)()},onPrevPage:k,pageSizeLimit:O("limit"),onSort:B,disableSort:!1,sortParams:[{id:O("sortBy"),desc:"DESC"===O("sortOrder")}]})))},y=e=>{let{parentRoute:i}=e;o.useParams();const{t:r}=a.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[u,c]=n.useState({}),[d,p]=n.useState(null),v={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:f,isSuccess:E,data:{Assets:g,Count:S}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:s,filters:u},v);return n.useEffect(()=>{if(d){const e=setTimeout(()=>{p(null)},1500);return()=>clearTimeout(e)}},[d]),l.createElement(l.Fragment,null,l.createElement(h,{t:r,isLoading:f,parentRoute:i,tenantId:s,setShowToast:p,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l=m({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>m({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.applicationNo||a.creationReason||a.fromDate||a.mobileNumber||a.applicationNo||a.status||a.toDate?!(Object.entries(a).length>0&&(a.creationReason||a.status))||a.applicationNo||a.fromDate||a.mobileNumber||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?p({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):c(a):p({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):p({warning:!0,label:"ERR_VALID_FIELDS"})},data:E&&!f?g.length>0?g:{display:"ES_COMMON_NO_DATA"}:"",count:S}),d&&l.createElement(t.Toast,{error:d.error,warning:d.warning,label:r(d.label),isDleteBtn:!0,onClose:()=>{p(null)}}))},A=e=>{let{isLoading:a,t:o,onSubmit:c,data:d,count:m,setShowToast:p}=e;const v=window.Digit.Utils.browser.isMobile(),f=(new Date).toISOString().split("T")[0],E=(Digit.UserService.getUser(),Digit.Hooks.asset.useTenants()),{register:S,control:h,handleSubmit:_,setValue:y,getValues:A,reset:C}=i.useForm({defaultValues:{offset:0,limit:!v&&10,sortBy:"commencementDate",sortOrder:"DESC"}});n.useEffect(()=>{S("offset",0),S("limit",10),S("sortBy","commencementDate"),S("sortOrder","DESC")},[S]);const b=Digit.ULBService.getStateId(),{data:D}=Digit.Hooks.asset.useAssetClassification(b,"ASSET","assetClassification");let T=[];D&&D.map(e=>{T.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:N}=Digit.Hooks.asset.useAssetType(b,"ASSET","assetParentCategory");let I=[];N&&N.map(e=>{I.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const O=e=>l.createElement("span",{className:"cell-text"},e),x=n.useMemo(()=>[{Header:o("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.applicationNo))},disableSortBy:!0},{Header:o("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n;return O(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetClassification))},disableSortBy:!0},{Header:o("AST_PARENT_CATEGORY_LABELaaa"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:o("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:o("AST_TYPE"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetSubCategory))},disableSortBy:!0},{Header:o("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return O(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.department))},disableSortBy:!0}],[]),R=n.useCallback(e=>{0!==e.length&&(y("sortBy",e.id),y("sortOrder",e.desc?"DESC":"ASC"))},[]);function L(){y("offset",A("offset")-A("limit")),_(c)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,o("AST_REPORTS_CHECK")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},o("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:c,handleSubmit:_},l.createElement(t.SearchField,null,l.createElement("label",null,o("MYCITY_CODE_LABEL")),l.createElement(i.Controller,{control:h,name:"city",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:E,optionKey:"i18nKey",t:o,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,o("AST_PARENT_CATEGORY_LABEL")),l.createElement(i.Controller,{control:h,name:"assetParentCategory",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:I,optionKey:"i18nKey",t:o,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,o("AST_FROM_DATE")),l.createElement(i.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:f}),name:"fromDate",control:h})),l.createElement(t.SearchField,null,l.createElement("label",null,o("AST_TO_DATE")),l.createElement(i.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:f}),name:"toDate",control:h})),l.createElement(t.SearchField,null,l.createElement("label",null,o("AST_ASSET_CATEGORY_LABEL")),l.createElement(i.Controller,{control:h,name:"assetClassification",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:o,disable:!1})})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:o("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{C({applicationNo:"",city:"",fromDate:"",toDate:"",assetClassification:"",assetParentCategory:"",pincode:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),p(null),L()}},o("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==d?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:()=>{const e=new r("landscape"),t=["S.No",...x.map(e=>o(e.Header))],n=d.map((e,t)=>[t+1,e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,e.assetSubCategory,e.department]);e.autoTable({head:[t],body:n}),e.save("Asset-Reports.pdf")},style:{color:"maroon",border:"2px solid #333",padding:"8px 16px",cursor:"pointer",marginRight:"10px"}},"Download PDF"),l.createElement("button",{onClick:()=>{const e=x.map(e=>o(e.Header)),t=d.map(e=>{var t;return[e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,null===(t=e.addressDetails)||void 0===t?void 0:t.pincode,e.department]}),n=u.utils.aoa_to_sheet([e,...t]),l=u.utils.book_new();u.utils.book_append_sheet(l,n,"Asset Report"),u.writeFile(l,"Asset-Reports.xlsx")},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer"}},"Download XLS"),l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const o=g(function(){return a<d.length},function(){return!!(a+=l)},function(){const e=d.slice(a,a+l).map(function(e,a){try{return Promise.resolve(n("https://niuatt.niua.in/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+e.applicationNo)).then(function(n){const o=a%l*90;t.addImage(n,"JPEG",10,20+o,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+o),t.text("Asset Classification: "+e.assetClassification,70,40+o),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+o),t.text("Asset Name: "+e.assetName,70,60+o),t.text('Location: "https://www.google.com/maps/search/%7B%7BaddressDetailsLat%7D%7D,%7B%7BaddressDetailsLong/@28.588163,77.2308992,15z/data=!3m1!4b1?entry=ttu&g_ep=EgoyMDI0MTIxMS4wIKXMDSoASAFQAw%3D%3D"',70,60+o),t.line(10,80+o,200,80+o)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(e)).then(function(){a+l<d.length&&t.addPage()})});return Promise.resolve(o&&o.then?o.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=d&&d.display?l.createElement(t.Card,{style:{marginTop:20}},o(d.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===d?""!==d||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:o,data:d,totalRecords:m,columns:x,getCellProps:e=>({style:{minWidth:e.column.Header===o("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){y("limit",Number(e.target.value)),_(c)()},currentPage:A("offset")/A("limit"),onNextPage:function(){y("offset",A("offset")+A("limit")),_(c)()},onPrevPage:L,pageSizeLimit:A("limit"),onSort:R,disableSort:!1,sortParams:[{id:A("sortBy"),desc:"DESC"===A("sortOrder")}]})))},C=e=>{o.useParams();const{t:i}=a.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,u]=n.useState({}),[c,d]=n.useState(null),p={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:v,isSuccess:f,data:{Assets:E,Count:g}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:r,filters:s},p);return l.createElement(l.Fragment,null,l.createElement(A,{t:i,isLoading:v,tenantId:r,setShowToast:d,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l=m({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>m({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.fromDate||a.applicationNo||a.toDate?!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.applicationNo||a.fromDate||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?d({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):u(a):d({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):d({warning:!0,label:"ERR_VALID_FIELDS"})},data:f&&!v?E.length>0?E:{display:"ES_COMMON_NO_DATA"}:"",count:g}),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:i(c.label),isDleteBtn:!0,onClose:()=>{d(null)}}))},b=e=>{let{t:n,currentPage:a,columns:o,data:i,getCellProps:r,disableSort:s,onSort:u,onNextPage:c,onPrevPage:d,onPageSizeChange:m,pageSizeLimit:p,sortParams:v,totalRecords:f}=e;return l.createElement(t.Table,{t:n,data:i,currentPage:a,columns:o,getCellProps:r,onNextPage:c,onPrevPage:d,pageSizeLimit:p,disableSort:s,onPageSizeChange:m,onSort:u,sortParams:v,totalRecords:f})},D=()=>{const{t:e}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.PropertyHouse,null))," ",l.createElement("span",{className:"text"},e("ASSET_SERVICE")))))},T={date:t.DatePicker,mobileNumber:t.MobileNumber},N=e=>{var n;let{onSearch:o,type:r,onClose:s,searchFields:u,searchParams:c,isInboxPage:d,clearSearch:p}=e;const{t:v}=a.useTranslation(),{handleSubmit:f,reset:E,watch:g,control:S,formState:h,setValue:_}=i.useForm({defaultValues:d?c:m({locality:null,city:null},c)}),y=g(),A=innerWidth<=640;function C(){const e=u.reduce((e,t)=>m({},e,{[null==t?void 0:t.name]:""}),{});if(E(e),d){const e=m({},c);e.delete=[],u.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),o(m({},e))}else p()}const b=e=>l.createElement(t.LinkLabel,{style:m({display:"inline"},e?{margin:0}:{}),onClick:C},v("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:f(e=>{e.mobileNumber||delete e.mobileNumber,e.delete=[],u.forEach(t=>{e[t.name]||e.delete.push(t.name)}),o(e),"mobile"===r&&s()})},l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:d?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||A)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,v("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(d?"":"for-search"),style:{width:"100%",display:"grid"}},null==u||null===(n=u.filter(e=>!0))||void 0===n?void 0:n.map((e,n)=>{var a,o,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,v(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(i.Controller,e.type?{render:t=>l.createElement(null==T?void 0:T[e.type],{formValue:y,setValue:_,onChange:t.onChange,value:t.value}),name:e.name,control:S,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:S,defaultValue:""})),null!=h&&null!==(a=h.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==h||null===(o=h.errors)||void 0===o||null===(r=o[e.name])||void 0===r?void 0:r.message):null)}),d&&l.createElement("div",{style:{gridColumn:"2/3",textAlign:"right",paddingTop:"10px"},className:"input-fields"},l.createElement("div",null,b())),"desktop"===r&&!A&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:v("ES_COMMON_SEARCH"),disabled:!!Object.keys(h.errors).length||(()=>{var e;let t=!0;return Object.keys(y).forEach(e=>{!["locality","city"].includes(e)&&y[e]&&(t=!1)}),null==u||!u.find(e=>"locality"===e.name)||null!=y&&null!==(e=y.locality)&&void 0!==e&&e.code||(t=!0),t})(),submit:!0}),!d&&l.createElement("div",null,b()))))),("mobile"===r||A)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},b(A)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(h.errors).length,label:v("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},I=["tableConfig","filterComponent"],O=e=>{let{tableConfig:o,filterComponent:i}=e,r=p(e,I);const{data:s,useNewInboxAPI:u}=r,{t:c}=a.useTranslation(),[d,m]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(i)}),[v,f]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r.EmptyResultInboxComp)}),[E,g]=n.useState(!1),S=l.useMemo(()=>r.isSearch?o.searchColumns(r):o.inboxColumns(r)||[],[]);let h;return r.isLoading?h=l.createElement(t.Loader,null):E?h=null:!s||0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?h=v&&l.createElement(v,{data:s})||(0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?l.createElement(t.Card,{style:{marginTop:20}},c("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):l.createElement(t.Loader,null)):(null==s?void 0:s.length)>0&&(h=l.createElement(b,{t:c,data:s,columns:S,getCellProps:e=>({style:{minWidth:e.column.Header===c("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:r.onPageSizeChange,currentPage:r.currentPage,onNextPage:r.onNextPage,onPrevPage:r.onPrevPage,pageSizeLimit:r.pageSizeLimit,onSort:r.onSort,disableSort:r.disableSort,sortParams:r.sortParams,totalRecords:r.totalRecords})),l.createElement("div",{className:"inbox-container"},!r.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(D,{parentRoute:r.parentRoute,businessService:r.moduleCode}),l.createElement("div",null,l.createElement(d,{defaultSearchParams:r.defaultSearchParams,onFilterChange:r.onFilterChange,searchParams:r.searchParams,type:"desktop",useNewInboxAPI:u,statusMap:u?null==s?void 0:s[0].statusMap:null,moduleCode:r.moduleCode}))),l.createElement("div",{style:{flex:1}},l.createElement(N,{defaultSearchParams:r.defaultSearchParams,onSearch:e=>{r.onSearch(e),g(!1)},type:"desktop",searchFields:r.searchFields,isInboxPage:!(null!=r&&r.isSearch),searchParams:r.searchParams,clearSearch:()=>g(!0)}),l.createElement("div",{className:"result",style:{marginLeft:null!=r&&r.isSearch?"":"24px",flex:1}},h)))},x=e=>{const{t:o}=a.useTranslation(),[i,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:o("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:o("ES_INBOX_DATE_LATEST_LAST")}});function s(){}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"},o("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:s},o("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:s},o("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:i,optionsKey:"name",options:[{code:"DESC",name:o("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:o("ES_INBOX_DATE_LATEST_LAST")}]})))))},R=e=>{let{t:a,data:o,onFilterChange:i,onSearch:r,onSort:s,serviceRequestIdKey:u,isFstpOperator:c,isLoading:d,isSearch:m,searchParams:p,searchFields:v,sortParams:f,linkPrefix:E,filterComponent:g}=e;const[S,h]=n.useState(m?"SEARCH":""),[_,y]=n.useState(!!m),[A,C]=n.useState(f),[b]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{S&&y(!0)},[S]);const D=()=>{y(!1),h(""),C(f)};if(d)return l.createElement(t.Loader,null);let T;return o&&0!==(null==o?void 0:o.length)?o&&(null==o?void 0:o.length)>0&&(T=l.createElement(t.DetailsCard,{data:o,serviceRequestIdKey:u,linkPrefix:E||"/digit-ui/employee/asset/"})):T=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"},r&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{h("SEARCH"),y(!0)}}),!m&&i&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{h("FILTER"),y(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{h("SORT"),y(!0)}})),T,_&&l.createElement(t.PopUp,null,"FILTER"===S&&l.createElement("div",{className:"popup-module"},l.createElement(b,{onFilterChange:e=>{i(e),y(!1)},Close:D,type:"mobile",searchParams:p})),"SORT"===S&&l.createElement("div",{className:"popup-module"},l.createElement(x,{type:"mobile",sortParams:f,onClose:D,onSort:s})),"SEARCH"===S&&l.createElement("div",{className:"popup-module"},l.createElement(N,{type:"mobile",onClose:D,onSearch:r,isFstpOperator:c,searchParams:p,searchFields:v}))))},L=e=>{let{data:t,isLoading:n,isSearch:o,searchFields:i,onFilterChange:r,onSearch:s,onSort:u,parentRoute:c,searchParams:d,sortParams:m,linkPrefix:p,tableConfig:v,filterComponent:f}=e;const{t:E}=a.useTranslation();return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},!o&&l.createElement(D,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:c,isMobile:!0}),l.createElement(R,{t:E,data:null==t?void 0:t.map(e=>{const t={};return(o?v.searchColumns():v.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:o,onSearch:s,onSort:u,searchParams:d,searchFields:i,linkPrefix:p,sortParams:m,serviceRequestIdKey:null==v?void 0:v.serviceRequestIdKey,filterComponent:f}))))},w=["isFetching","isLoading","searchResponseKey","data","searchFields"],P=e=>{var o,i,r,s,u;let{useNewInboxAPI:c,parentRoute:d,moduleCode:v="ASSET",initialStates:f={},filterComponent:E,isInbox:g,rawWfHandler:S,rawSearchHandler:h,combineResponse:_,wfConfig:y,searchConfig:A,middlewaresWf:C,middlewareSearch:b,EmptyResultInboxComp:D}=e;const T=Digit.ULBService.getCurrentTenantId(),{t:N}=a.useTranslation(),[I,x]=n.useState(()=>g?{}:{enabled:!1}),[R,P]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("ASTInboxTableConfig")}),[M,F]=n.useState(f.pageOffset||0),[B,k]=n.useState(f.pageSize||10),[U,H]=n.useState(f.sortParams||[{id:"createdTime",desc:!0}]),[j,W]=n.useState(f.searchParams||{});let V=window.Digit.Utils.browser.isMobile(),z=V?{limit:100,offset:0,sortBy:null==U||null===(o=U[0])||void 0===o?void 0:o.id,sortOrder:null!=U&&null!==(i=U[0])&&void 0!==i&&i.desc?"DESC":"ASC"}:{limit:B,offset:M,sortBy:null==U||null===(r=U[0])||void 0===r?void 0:r.id,sortOrder:null!=U&&null!==(s=U[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const G=c?Digit.Hooks.useNewInboxGeneral({tenantId:T,ModuleCode:v,filters:m({},j,z,{sortParams:U})}):Digit.Hooks.useInboxGeneral({tenantId:T,businessService:v,isInbox:g,filters:m({},j,z,{sortParams:U}),rawWfHandler:S,rawSearchHandler:h,combineResponse:_,wfConfig:y,searchConfig:m({},I,A),middlewaresWf:C,middlewareSearch:b}),{isLoading:K,data:q,searchFields:Y}=G,$=p(G,w);n.useEffect(()=>{F(0)},[j]);const Z=e=>{let t=e.delete,n=m({},j,e);t&&t.forEach(e=>delete n[e]),delete e.delete,W(m({},n)),x({enabled:!0})},Q=n.useCallback(e=>{0!==e.length&&H(e)},[]);var X,J;if(null!==(null==$||null===(u=$.data)||void 0===u?void 0:u.length))return V?l.createElement(L,{data:q,isLoading:K,isSearch:!g,searchFields:Y,onFilterChange:Z,onSearch:Z,onSort:Q,parentRoute:d,searchParams:j,sortParams:U,linkPrefix:d+"/application-details/",tableConfig:null!=$&&$.tableConfig?null===(X=res)||void 0===X?void 0:X.tableConfig:R(N).ASSET,filterComponent:E,EmptyResultInboxComp:D,useNewInboxAPI:c}):l.createElement("div",null,g&&l.createElement(t.Header,null,N("ES_COMMON_INBOX")),l.createElement(O,{moduleCode:v,data:q,tableConfig:R(N).ASSET,isLoading:K,defaultSearchParams:f.searchParams,isSearch:!g,onFilterChange:Z,searchFields:Y,onSearch:Z,onSort:Q,onNextPage:()=>{F(e=>e+B)},onPrevPage:()=>{F(e=>e-B)},currentPage:Math.floor(M/B),pageSizeLimit:B,disableSort:!1,onPageSizeChange:e=>{k(Number(e.target.value))},parentRoute:d,searchParams:j,sortParams:U,totalRecords:Number(null==q||null===(J=q[0])||void 0===J?void 0:J.totalCount),filterComponent:E,EmptyResultInboxComp:D,useNewInboxAPI:c}))},M=e=>{var n,i,r,s,u,c,d,p,v,f,E,g,S,h,_,A,b,D,T,N,I,O,x,R;let{path:L,url:w,userType:M}=e;console.log("path",L);const{t:F}=a.useTranslation(),B=o.useLocation();sessionStorage.removeItem("revalidateddone");const k=window.Digit.Utils.browser.isMobile(),U={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},H=e=>{let{location:n}=e;const{t:i}=a.useTranslation(),r=o.useLocation().search,s=(new URLSearchParams(r).get("from"),Digit.Hooks.useQueryParams(),[{path:"/digit-ui/employee",content:i("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/asset/assetservice/inbox",content:i("ES_TITLE_INBOX"),show:(n.pathname.includes("asset/assetservice/inbox"),!1)}]);return l.createElement(t.BreadCrumb,{style:k?{display:"flex"}:{margin:"0 0 4px",color:"#000000"},spanStyle:{maxWidth:"min-content"},crumbs:s})},j=null===(n=Digit)||void 0===n||null===(i=n.ComponentRegistryService)||void 0===i?void 0:i.getComponent("AssignAssetApplication"),W=null===(r=Digit)||void 0===r||null===(s=r.ComponentRegistryService)||void 0===s?void 0:s.getComponent("DisposeApplication"),V=null===(u=Digit)||void 0===u||null===(c=u.ComponentRegistryService)||void 0===c?void 0:c.getComponent("MaintenanceApplication"),z=null===(d=Digit)||void 0===d||null===(p=d.ComponentRegistryService)||void 0===p?void 0:p.getComponent("editResponse"),G=null===(v=Digit)||void 0===v||null===(f=v.ComponentRegistryService)||void 0===f?void 0:f.getComponent("editAsset"),K=null===(E=Digit)||void 0===E||null===(g=E.ComponentRegistryService)||void 0===g?void 0:g.getComponent("returnAssets"),q=null===(S=Digit)||void 0===S||null===(h=S.ComponentRegistryService)||void 0===h?void 0:h.getComponent("ApplicationDetails"),Y=null===(_=Digit)||void 0===_||null===(A=_.ComponentRegistryService)||void 0===A?void 0:A.getComponent("AssetCreateNew"),$=null===(b=Digit)||void 0===b||null===(D=b.ComponentRegistryService)||void 0===D?void 0:D.getComponent("AssetResponse"),Z=null===(T=Digit)||void 0===T||null===(N=T.ComponentRegistryService)||void 0===N?void 0:N.getComponent("DisposeResponse"),Q=null===(I=Digit)||void 0===I||null===(O=I.ComponentRegistryService)||void 0===O?void 0:O.getComponent("ProcessDepreciationResponse"),X=null===(x=Digit)||void 0===x||null===(R=x.ComponentRegistryService)||void 0===R?void 0:R.getComponent("returnResponse"),J=window.location.href.includes("asset/response"),ee=window.location.href.includes("new-assets")||window.location.href.includes("asset/assetservice/application-details");return l.createElement(o.Switch,null,l.createElement(t.AppContainer,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},J?null:l.createElement("div",{style:ee?{marginLeft:"12px",display:"flex",alignItems:"center"}:{marginLeft:"-4px",display:"flex",alignItems:"center"}},l.createElement(t.BackButton,{location:B}),l.createElement("span",{style:{margin:"0 5px 16px",display:"inline-block"}},"|"),l.createElement(H,{location:B})),l.createElement(t.PrivateRoute,{exact:!0,path:L+"/",component:()=>l.createElement(ja,{matchPath:L,userType:M})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/inbox",component:()=>l.createElement(P,{useNewInboxAPI:!0,parentRoute:L,businessService:"asset-create",filterComponent:"AST_INBOX_FILTER",initialStates:U,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/assign-assets/:id",component:()=>l.createElement(j,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/maintenance-assets/:id",component:()=>l.createElement(V,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/dispose-assets/:id",component:()=>l.createElement(W,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/return-assets/:id",component:()=>l.createElement(K,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/edit/:id",component:()=>l.createElement(G,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/new-assets",component:()=>l.createElement(Y,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/application-details/:id",component:()=>l.createElement(q,{parentRoute:L})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/applicationsearch/application-details/:id",component:()=>l.createElement(q,{parentRoute:L})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/assign-response",component:e=>l.createElement($,m({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/asset-dispose-response",component:e=>l.createElement(Z,m({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/asset-process-depreciation-response",component:e=>l.createElement(Q,m({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/return-response",component:e=>l.createElement(X,m({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/search",component:e=>l.createElement(Search,m({},e,{t:F,parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/my-asset",component:e=>l.createElement(y,m({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/report",component:e=>l.createElement(C,m({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/edit-response",component:e=>l.createElement(z,m({},e,{parentRoute:L}))})))))},F=e=>{var n;let{status:o,searchParams:i,onAssignmentChange:r,statusMap:s}=e;return a.useTranslation(),l.createElement(t.CheckBox,{styles:{height:"unset"},onChange:e=>r(m({},e,{state:o.state}),o),checked:null==i?void 0:i.applicationStatus.some(e=>e.uuid===o.uuid),label:o.name+" ("+((null==s||null===(n=s.find(e=>e.statusid===o.uuid))||void 0===n?void 0:n.count)||"-")+")"})},B=e=>{var o,i,r,s,u;let{onAssignmentChange:c,searchParams:d,businessServices:p,statusMap:v}=e;const{t:f}=a.useTranslation(),[E,g]=n.useState(!1),{data:S,isLoading:h}=Digit.Hooks.useApplicationStatusGeneral({businessServices:p},{}),{userRoleStates:_}=S||{},y=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return h?l.createElement(t.Loader,null):null!=_&&_.filter(e=>!e.isTerminateState).length?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},f("ES_INBOX_STATUS")),null==_||null===(o=_.filter(e=>!e.isTerminateState))||void 0===o||null===(i=o.slice(0,4))||void 0===i?void 0:i.map((e,t)=>l.createElement(F,{businessServices:p,key:t,onAssignmentChange:c,status:m({name:y(e,f),code:e.applicationStatus},e),searchParams:d,statusMap:v})),(null==_||null===(r=_.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,E&&(null==_||null===(s=_.filter(e=>!e.isTerminateState))||void 0===s||null===(u=s.slice(4))||void 0===u?void 0:u.map((e,t)=>l.createElement(F,{businessServices:p,key:e.uuid,onAssignmentChange:c,status:m({name:y(e,f),code:e.applicationStatus},e),searchParams:d,statusMap:v}))),l.createElement("div",{className:"filter-button",onClick:()=>g(!E)}," ",f(E?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null};var k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function U(e,t){return e(t={exports:{}},t.exports),t.exports}var H=U(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],o="[object Arguments]",i="[object Array]",r="[object Boolean]",s="[object Date]",u="[object Error]",c="[object Function]",d="[object GeneratorFunction]",m="[object Map]",p="[object Number]",v="[object Object]",f="[object RegExp]",E="[object Set]",g="[object String]",S="[object Symbol]",h="[object WeakMap]",_="[object ArrayBuffer]",y="[object DataView]",A="[object Float32Array]",C="[object Float64Array]",b="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",N="[object Uint8Array]",I="[object Uint16Array]",O="[object Uint32Array]",x=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,M=RegExp(w.source),F=RegExp(P.source),B=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,G=RegExp(z.source),K=/^\s+/,q=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,ae=/^\[object .+?Constructor\]$/,oe=/^0o[0-7]+$/i,ie=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,se=/($^)/,ue=/['\n\r\u2028\u2029\\]/g,ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",de="\\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",me="["+de+"]",pe="["+ce+"]",ve="\\d+",fe="[a-z\\xdf-\\xf6\\xf8-\\xff]",Ee="[^\\ud800-\\udfff"+de+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",Se="[^\\ud800-\\udfff]",he="(?:\\ud83c[\\udde6-\\uddff]){2}",_e="[\\ud800-\\udbff][\\udc00-\\udfff]",ye="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ae="(?:"+fe+"|"+Ee+")",Ce="(?:"+ye+"|"+Ee+")",be="(?:"+pe+"|"+ge+")?",De="[\\ufe0e\\ufe0f]?"+be+"(?:\\u200d(?:"+[Se,he,_e].join("|")+")[\\ufe0e\\ufe0f]?"+be+")*",Te="(?:"+["[\\u2700-\\u27bf]",he,_e].join("|")+")"+De,Ne="(?:"+[Se+pe+"?",pe,he,_e,"[\\ud800-\\udfff]"].join("|")+")",Ie=RegExp("['’]","g"),Oe=RegExp(pe,"g"),xe=RegExp(ge+"(?="+ge+")|"+Ne+De,"g"),Re=RegExp([ye+"?"+fe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,ye,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,ye+Ae,"$"].join("|")+")",ye+"?"+Ae+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ye+"+(?:['’](?: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,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+ce+"\\ufe0e\\ufe0f]"),we=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Pe=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Me=-1,Fe={};Fe[A]=Fe[C]=Fe[b]=Fe[D]=Fe[T]=Fe[N]=Fe["[object Uint8ClampedArray]"]=Fe[I]=Fe[O]=!0,Fe[o]=Fe[i]=Fe[_]=Fe[r]=Fe[y]=Fe[s]=Fe[u]=Fe[c]=Fe[m]=Fe[p]=Fe[v]=Fe[f]=Fe[E]=Fe[g]=Fe[h]=!1;var Be={};Be[o]=Be[i]=Be[_]=Be[y]=Be[r]=Be[s]=Be[A]=Be[C]=Be[b]=Be[D]=Be[T]=Be[m]=Be[p]=Be[v]=Be[f]=Be[E]=Be[g]=Be[S]=Be[N]=Be["[object Uint8ClampedArray]"]=Be[I]=Be[O]=!0,Be[u]=Be[c]=Be[h]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,je="object"==typeof k&&k&&k.Object===Object&&k,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=je||We||Function("return this")(),ze=t&&!t.nodeType&&t,Ge=ze&&e&&!e.nodeType&&e,Ke=Ge&&Ge.exports===ze,qe=Ke&&je.process,Ye=function(){try{return Ge&&Ge.require&&Ge.require("util").types||qe&&qe.binding&&qe.binding("util")}catch(e){}}(),$e=Ye&&Ye.isArrayBuffer,Ze=Ye&&Ye.isDate,Qe=Ye&&Ye.isMap,Xe=Ye&&Ye.isRegExp,Je=Ye&&Ye.isSet,et=Ye&&Ye.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 a=-1,o=null==e?0:e.length;++a<o;){var i=e[a];t(l,i,n(i),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 at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function ot(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function it(e,t){for(var n=-1,l=null==e?0:e.length,a=0,o=[];++n<l;){var i=e[n];t(i,n,e)&&(o[a++]=i)}return o}function rt(e,t){return!(null==e||!e.length)&>(e,t,0)>-1}function st(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function ct(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function dt(e,t,n,l){var a=-1,o=null==e?0:e.length;for(l&&o&&(n=e[++a]);++a<o;)n=t(n,e[a],a,e);return n}function mt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function pt(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=yt("length");function ft(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function Et(e,t,n,l){for(var a=e.length,o=n+(l?1:-1);l?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):Et(e,ht,n)}function St(e,t,n,l){for(var a=n-1,o=e.length;++a<o;)if(l(e[a],t))return a;return-1}function ht(e){return e!=e}function _t(e,t){var n=null==e?0:e.length;return n?bt(e,t)/n:NaN}function yt(e){return function(t){return null==t?void 0:t[e]}}function At(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,o){n=l?(l=!1,e):t(n,e,a,o)}),n}function bt(e,t){for(var n,l=-1,a=e.length;++l<a;){var o=t(e[l]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Dt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Tt(e){return e?e.slice(0,zt(e)+1).replace(K,""):e}function Nt(e){return function(t){return e(t)}}function It(e,t){return ut(t,function(t){return e[t]})}function Ot(e,t){return e.has(t)}function xt(e,t){for(var n=-1,l=e.length;++n<l&>(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length;n--&>(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var wt=At({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Pt=At({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+ke[e]}function Ft(e){return Le.test(e)}function Bt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function kt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,o=0,i=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,i[o++]=n)}return i}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function jt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=xe.lastIndex=0;xe.test(e);)++t;return t}(e):vt(e)}function Vt(e){return Ft(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&q.test(e.charAt(t)););return t}var Gt=At({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Kt=function e(t){var k,q=(t=null==t?Ve:Kt.defaults(Ve.Object(),t,Kt.pick(Ve,Pe))).Array,ce=t.Date,de=t.Error,me=t.Function,pe=t.Math,ve=t.Object,fe=t.RegExp,Ee=t.String,ge=t.TypeError,Se=q.prototype,he=ve.prototype,_e=t["__core-js_shared__"],ye=me.prototype.toString,Ae=he.hasOwnProperty,Ce=0,be=(k=/[^.]+$/.exec(_e&&_e.keys&&_e.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"",De=he.toString,Te=ye.call(ve),Ne=Ve._,xe=fe("^"+ye.call(Ae).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ke?t.Buffer:void 0,ke=t.Symbol,je=t.Uint8Array,We=Le?Le.allocUnsafe:void 0,ze=kt(ve.getPrototypeOf,ve),Ge=ve.create,qe=he.propertyIsEnumerable,Ye=Se.splice,vt=ke?ke.isConcatSpreadable:void 0,At=ke?ke.iterator:void 0,qt=ke?ke.toStringTag:void 0,Yt=function(){try{var e=Xa(ve,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Zt=ce&&ce.now!==Ve.Date.now&&ce.now,Qt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Xt=pe.ceil,Jt=pe.floor,en=ve.getOwnPropertySymbols,tn=Le?Le.isBuffer:void 0,nn=t.isFinite,ln=Se.join,an=kt(ve.keys,ve),on=pe.max,rn=pe.min,sn=ce.now,un=t.parseInt,cn=pe.random,dn=Se.reverse,mn=Xa(t,"DataView"),pn=Xa(t,"Map"),vn=Xa(t,"Promise"),fn=Xa(t,"Set"),En=Xa(t,"WeakMap"),gn=Xa(ve,"create"),Sn=En&&new En,hn={},_n=Io(mn),yn=Io(pn),An=Io(vn),Cn=Io(fn),bn=Io(En),Dn=ke?ke.prototype:void 0,Tn=Dn?Dn.valueOf:void 0,Nn=Dn?Dn.toString:void 0;function In(e){if(Gi(e)&&!Pi(e)&&!(e instanceof Ln)){if(e instanceof Rn)return e;if(Ae.call(e,"__wrapped__"))return Oo(e)}return new Rn(e)}var On=function(){function e(){}return function(t){if(!zi(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xn(){}function Rn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function 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 Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.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 Mn;++t<n;)this.add(e[t])}function Bn(e){var t=this.__data__=new Pn(e);this.size=t.size}function kn(e,t){var n=Pi(e),l=!n&&wi(e),a=!n&&!l&&ki(e),o=!n&&!l&&!a&&Ji(e),i=n||l||a||o,r=i?Dt(e.length,Ee):[],s=r.length;for(var u in e)!t&&!Ae.call(e,u)||i&&("length"==u||a&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||oo(u,s))||r.push(u);return r}function Un(e){var t=e.length;return t?e[Ml(0,t-1)]:void 0}function Hn(e,t){return Co(Ea(e),$n(t,0,e.length))}function jn(e){return Co(Ea(e))}function Wn(e,t,n){(void 0!==n&&!xi(e[t],n)||void 0===n&&!(t in e))&&qn(e,t,n)}function Vn(e,t,n){var l=e[t];Ae.call(e,t)&&xi(l,n)&&(void 0!==n||t in e)||qn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(xi(e[n][0],t))return n;return-1}function Gn(e,t,n,l){return el(e,function(e,a,o){t(l,e,n(e),o)}),l}function Kn(e,t){return e&&ga(t,yr(t),e)}function qn(e,t,n){"__proto__"==t&&Yt?Yt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Yn(e,t){for(var n=-1,l=t.length,a=q(l),o=null==e;++n<l;)a[n]=o?void 0:Er(e,t[n]);return a}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Zn(e,t,n,l,a,i){var u,h=1&t,x=2&t,R=4&t;if(n&&(u=a?n(e,l,a,i):n(e)),void 0!==u)return u;if(!zi(e))return e;var L=Pi(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!h)return Ea(e,u)}else{var w=to(e),P=w==c||w==d;if(ki(e))return ca(e,h);if(w==v||w==o||P&&!a){if(u=x||P?{}:lo(e),!h)return x?function(e,t){return ga(e,eo(e),t)}(e,function(e,t){return e&&ga(t,Ar(t),e)}(u,e)):function(e,t){return ga(e,Ja(e),t)}(e,Kn(u,e))}else{if(!Be[w])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case _:return da(e);case r:case s:return new l(+e);case y:return function(e,t){var n=t?da(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case A:case C:case b:case D:case T:case N:case"[object Uint8ClampedArray]":case I:case O:return ma(e,n);case m:return new l;case p:case g:return new l(e);case f:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case E:return new l;case S:return Tn?ve(Tn.call(e)):{}}}(e,w,h)}}i||(i=new Bn);var M=i.get(e);if(M)return M;i.set(e,u),Zi(e)?e.forEach(function(l){u.add(Zn(l,t,n,l,e,i))}):Ki(e)&&e.forEach(function(l,a){u.set(a,Zn(l,t,n,a,e,i))});var F=L?void 0:(R?x?Ga:za:x?Ar:yr)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,Zn(l,t,n,a,e,i))}),u}function Qn(e,t,n){var l=n.length;if(null==e)return!l;for(e=ve(e);l--;){var a=n[l],o=e[a];if(void 0===o&&!(a in e)||!(0,t[a])(o))return!1}return!0}function Xn(e,t,l){if("function"!=typeof e)throw new ge(n);return ho(function(){e.apply(void 0,l)},t)}function Jn(e,t,n,l){var a=-1,o=rt,i=!0,r=e.length,s=[],u=t.length;if(!r)return s;n&&(t=ut(t,Nt(n))),l?(o=st,i=!1):t.length>=200&&(o=Ot,i=!1,t=new Fn(t));e:for(;++a<r;){var c=e[a],d=null==n?c:n(c);if(c=l||0!==c?c:0,i&&d==d){for(var m=u;m--;)if(t[m]===d)continue e;s.push(c)}else o(t,d,l)||s.push(c)}return s}In.templateSettings={escape:B,evaluate:U,interpolate:H,variable:"",imports:{_:In}},(In.prototype=xn.prototype).constructor=In,(Rn.prototype=On(xn.prototype)).constructor=Rn,(Ln.prototype=On(xn.prototype)).constructor=Ln,wn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},wn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},wn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ae.call(t,e)?t[e]:void 0},wn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:Ae.call(t,e)},wn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},Pn.prototype.clear=function(){this.__data__=[],this.size=0},Pn.prototype.delete=function(e){var t=this.__data__,n=zn(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},Pn.prototype.get=function(e){var t=this.__data__,n=zn(t,e);return n<0?void 0:t[n][1]},Pn.prototype.has=function(e){return zn(this.__data__,e)>-1},Pn.prototype.set=function(e,t){var n=this.__data__,l=zn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new wn,map:new(pn||Pn),string:new wn}},Mn.prototype.delete=function(e){var t=Za(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Za(this,e).get(e)},Mn.prototype.has=function(e){return Za(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Za(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)},Bn.prototype.clear=function(){this.__data__=new Pn,this.size=0},Bn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Bn.prototype.get=function(e){return this.__data__.get(e)},Bn.prototype.has=function(e){return this.__data__.has(e)},Bn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Pn){var l=n.__data__;if(!pn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(l)}return n.set(e,t),this.size=n.size,this};var el=_a(sl),tl=_a(ul,!0);function nl(e,t){var n=!0;return el(e,function(e,l,a){return n=!!t(e,l,a)}),n}function ll(e,t,n){for(var l=-1,a=e.length;++l<a;){var o=e[l],i=t(o);if(null!=i&&(void 0===r?i==i&&!Xi(i):n(i,r)))var r=i,s=o}return s}function al(e,t){var n=[];return el(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function ol(e,t,n,l,a){var o=-1,i=e.length;for(n||(n=ao),a||(a=[]);++o<i;){var r=e[o];t>0&&n(r)?t>1?ol(r,t-1,n,l,a):ct(a,r):l||(a[a.length]=r)}return a}var il=ya(),rl=ya(!0);function sl(e,t){return e&&il(e,t,yr)}function ul(e,t){return e&&rl(e,t,yr)}function cl(e,t){return it(t,function(t){return ji(e[t])})}function dl(e,t){for(var n=0,l=(t=ia(t,e)).length;null!=e&&n<l;)e=e[No(t[n++])];return n&&n==l?e:void 0}function ml(e,t,n){var l=t(e);return Pi(e)?l:ct(l,n(e))}function pl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qt&&qt in ve(e)?function(e){var t=Ae.call(e,qt),n=e[qt];try{e[qt]=void 0;var l=!0}catch(e){}var a=De.call(e);return l&&(t?e[qt]=n:delete e[qt]),a}(e):function(e){return De.call(e)}(e)}function vl(e,t){return e>t}function fl(e,t){return null!=e&&Ae.call(e,t)}function El(e,t){return null!=e&&t in ve(e)}function gl(e,t,n){for(var l=n?st:rt,a=e[0].length,o=e.length,i=o,r=q(o),s=Infinity,u=[];i--;){var c=e[i];i&&t&&(c=ut(c,Nt(t))),s=rn(c.length,s),r[i]=!n&&(t||a>=120&&c.length>=120)?new Fn(i&&c):void 0}c=e[0];var d=-1,m=r[0];e:for(;++d<a&&u.length<s;){var p=c[d],v=t?t(p):p;if(p=n||0!==p?p:0,!(m?Ot(m,v):l(u,v,n))){for(i=o;--i;){var f=r[i];if(!(f?Ot(f,v):l(e[i],v,n)))continue e}m&&m.push(v),u.push(p)}}return u}function Sl(e,t,n){var l=null==(e=fo(e,t=ia(t,e)))?e:e[No(Ho(t))];return null==l?void 0:tt(l,e,n)}function hl(e){return Gi(e)&&pl(e)==o}function _l(e,t,n,l,a){return e===t||(null==e||null==t||!Gi(e)&&!Gi(t)?e!=e&&t!=t:function(e,t,n,l,a,c){var d=Pi(e),h=Pi(t),A=d?i:to(e),C=h?i:to(t),b=(A=A==o?v:A)==v,D=(C=C==o?v:C)==v,T=A==C;if(T&&ki(e)){if(!ki(t))return!1;d=!0,b=!1}if(T&&!b)return c||(c=new Bn),d||Ji(e)?Wa(e,t,n,l,a,c):function(e,t,n,l,a,o,i){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!o(new je(e),new je(t)));case r:case s:case p:return xi(+e,+t);case u:return e.name==t.name&&e.message==t.message;case f:case g:return e==t+"";case m:var c=Bt;case E:if(c||(c=Ht),e.size!=t.size&&!(1&l))return!1;var d=i.get(e);if(d)return d==t;l|=2,i.set(e,t);var v=Wa(c(e),c(t),l,a,o,i);return i.delete(e),v;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,A,n,l,a,c);if(!(1&n)){var N=b&&Ae.call(e,"__wrapped__"),I=D&&Ae.call(t,"__wrapped__");if(N||I){var O=N?e.value():e,x=I?t.value():t;return c||(c=new Bn),a(O,x,n,l,c)}}return!!T&&(c||(c=new Bn),function(e,t,n,l,a,o){var i=1&n,r=za(e),s=r.length;if(s!=za(t).length&&!i)return!1;for(var u=s;u--;){var c=r[u];if(!(i?c in t:Ae.call(t,c)))return!1}var d=o.get(e),m=o.get(t);if(d&&m)return d==t&&m==e;var p=!0;o.set(e,t),o.set(t,e);for(var v=i;++u<s;){var f=e[c=r[u]],E=t[c];if(l)var g=i?l(E,f,c,t,e,o):l(f,E,c,e,t,o);if(!(void 0===g?f===E||a(f,E,n,l,o):g)){p=!1;break}v||(v="constructor"==c)}if(p&&!v){var S=e.constructor,h=t.constructor;S==h||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof h&&h instanceof h||(p=!1)}return o.delete(e),o.delete(t),p}(e,t,n,l,a,c))}(e,t,n,l,_l,a))}function yl(e,t,n,l){var a=n.length,o=a,i=!l;if(null==e)return!o;for(e=ve(e);a--;){var r=n[a];if(i&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<o;){var s=(r=n[a])[0],u=e[s],c=r[1];if(i&&r[2]){if(void 0===u&&!(s in e))return!1}else{var d=new Bn;if(l)var m=l(u,c,s,e,t,d);if(!(void 0===m?_l(c,u,3,l,d):m))return!1}}return!0}function Al(e){return!(!zi(e)||(t=e,be&&be in t))&&(ji(e)?xe:ae).test(Io(e));var t}function Cl(e){return"function"==typeof e?e:null==e?qr:"object"==typeof e?Pi(e)?Il(e[0],e[1]):Nl(e):ns(e)}function bl(e){if(!co(e))return an(e);var t=[];for(var n in ve(e))Ae.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Dl(e,t){return e<t}function Tl(e,t){var n=-1,l=Fi(e)?q(e.length):[];return el(e,function(e,a,o){l[++n]=t(e,a,o)}),l}function Nl(e){var t=Qa(e);return 1==t.length&&t[0][2]?po(t[0][0],t[0][1]):function(n){return n===e||yl(n,e,t)}}function Il(e,t){return ro(e)&&mo(t)?po(No(e),t):function(n){var l=Er(n,e);return void 0===l&&l===t?gr(n,e):_l(t,l,3)}}function Ol(e,t,n,l,a){e!==t&&il(t,function(o,i){if(a||(a=new Bn),zi(o))!function(e,t,n,l,a,o,i){var r=go(e,n),s=go(t,n),u=i.get(s);if(u)Wn(e,n,u);else{var c=o?o(r,s,n+"",e,t,i):void 0,d=void 0===c;if(d){var m=Pi(s),p=!m&&ki(s),v=!m&&!p&&Ji(s);c=s,m||p||v?Pi(r)?c=r:Bi(r)?c=Ea(r):p?(d=!1,c=ca(s,!0)):v?(d=!1,c=ma(s,!0)):c=[]:Yi(s)||wi(s)?(c=r,wi(r)?c=rr(r):zi(r)&&!ji(r)||(c=lo(s))):d=!1}d&&(i.set(s,c),a(c,s,l,o,i),i.delete(s)),Wn(e,n,c)}}(e,t,i,n,Ol,l,a);else{var r=l?l(go(e,i),o,i+"",e,t,a):void 0;void 0===r&&(r=o),Wn(e,i,r)}},Ar)}function xl(e,t){var n=e.length;if(n)return oo(t+=t<0?n:0,n)?e[t]:void 0}function Rl(e,t,n){t=t.length?ut(t,function(e){return Pi(e)?function(t){return dl(t,1===e.length?e[0]:e)}:e}):[qr];var l=-1;return t=ut(t,Nt($a())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,o=t.criteria,i=a.length,r=n.length;++l<i;){var s=pa(a[l],o[l]);if(s)return l>=r?s:s*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Tl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,o={};++l<a;){var i=t[l],r=dl(e,i);n(r,i)&&Hl(o,ia(i,e),r)}return o}function wl(e,t,n,l){var a=l?St:gt,o=-1,i=t.length,r=e;for(e===t&&(t=Ea(t)),n&&(r=ut(e,Nt(n)));++o<i;)for(var s=0,u=t[o],c=n?n(u):u;(s=a(r,c,s,l))>-1;)r!==e&&Ye.call(r,s,1),Ye.call(e,s,1);return e}function Pl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==o){var o=a;oo(a)?Ye.call(e,a,1):Xl(e,a)}}return e}function Ml(e,t){return e+Jt(cn()*(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 Bl(e,t){return _o(vo(e,t,qr),e+"")}function kl(e){return Un(xr(e))}function Ul(e,t){var n=xr(e);return Co(n,$n(t,0,n.length))}function Hl(e,t,n,l){if(!zi(e))return e;for(var a=-1,o=(t=ia(t,e)).length,i=o-1,r=e;null!=r&&++a<o;){var s=No(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=i){var c=r[s];void 0===(u=l?l(c,s,r):void 0)&&(u=zi(c)?c:oo(t[a+1])?[]:{})}Vn(r,s,u),r=r[s]}return e}var jl=Sn?function(e,t){return Sn.set(e,t),e}:qr,Wl=Yt?function(e,t){return Yt(e,"toString",{configurable:!0,enumerable:!1,value:zr(t),writable:!0})}:qr;function Vl(e){return Co(xr(e))}function zl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=q(a);++l<a;)o[l]=e[l+t];return o}function Gl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Kl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var o=l+a>>>1,i=e[o];null!==i&&!Xi(i)&&(n?i<=t:i<t)?l=o+1:a=o}return a}return ql(e,t,qr,n)}function ql(e,t,n,l){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var i=(t=n(t))!=t,r=null===t,s=Xi(t),u=void 0===t;a<o;){var c=Jt((a+o)/2),d=n(e[c]),m=void 0!==d,p=null===d,v=d==d,f=Xi(d);if(i)var E=l||v;else E=u?v&&(l||m):r?v&&m&&(l||!p):s?v&&m&&!p&&(l||!f):!p&&!f&&(l?d<=t:d<t);E?a=c+1:o=c}return rn(o,4294967294)}function Yl(e,t){for(var n=-1,l=e.length,a=0,o=[];++n<l;){var i=e[n],r=t?t(i):i;if(!n||!xi(r,s)){var s=r;o[a++]=0===i?0:i}}return o}function $l(e){return"number"==typeof e?e:Xi(e)?NaN:+e}function Zl(e){if("string"==typeof e)return e;if(Pi(e))return ut(e,Zl)+"";if(Xi(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ql(e,t,n){var l=-1,a=rt,o=e.length,i=!0,r=[],s=r;if(n)i=!1,a=st;else if(o>=200){var u=t?null:Fa(e);if(u)return Ht(u);i=!1,a=Ot,s=new Fn}else s=t?[]:r;e:for(;++l<o;){var c=e[l],d=t?t(c):c;if(c=n||0!==c?c:0,i&&d==d){for(var m=s.length;m--;)if(s[m]===d)continue e;t&&s.push(d),r.push(c)}else a(s,d,n)||(s!==r&&s.push(d),r.push(c))}return r}function Xl(e,t){return null==(e=fo(e,t=ia(t,e)))||delete e[No(Ho(t))]}function Jl(e,t,n,l){return Hl(e,t,n(dl(e,t)),l)}function ea(e,t,n,l){for(var a=e.length,o=l?a:-1;(l?o--:++o<a)&&t(e[o],o,e););return n?zl(e,l?0:o,l?o+1:a):zl(e,l?o+1:0,l?a:o)}function ta(e,t){var n=e;return n instanceof Ln&&(n=n.value()),dt(t,function(e,t){return t.func.apply(t.thisArg,ct([e],t.args))},n)}function na(e,t,n){var l=e.length;if(l<2)return l?Ql(e[0]):[];for(var a=-1,o=q(l);++a<l;)for(var i=e[a],r=-1;++r<l;)r!=a&&(o[a]=Jn(o[a]||i,e[r],t,n));return Ql(ol(o,1),t,n)}function la(e,t,n){for(var l=-1,a=e.length,o=t.length,i={};++l<a;)n(i,e[l],l<o?t[l]:void 0);return i}function aa(e){return Bi(e)?e:[]}function oa(e){return"function"==typeof e?e:qr}function ia(e,t){return Pi(e)?e:ro(e,t)?[e]:To(sr(e))}var ra=Bl;function sa(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ua=$t||function(e){return Ve.clearTimeout(e)};function ca(e,t){if(t)return e.slice();var n=e.length,l=We?We(n):new e.constructor(n);return e.copy(l),l}function da(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function ma(e,t){var n=t?da(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function pa(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,o=Xi(e),i=void 0!==t,r=null===t,s=t==t,u=Xi(t);if(!r&&!u&&!o&&e>t||o&&i&&s&&!r&&!u||l&&i&&s||!n&&s||!a)return 1;if(!l&&!o&&!u&&e<t||u&&n&&a&&!l&&!o||r&&n&&a||!i&&a||!s)return-1}return 0}function va(e,t,n,l){for(var a=-1,o=e.length,i=n.length,r=-1,s=t.length,u=on(o-i,0),c=q(s+u),d=!l;++r<s;)c[r]=t[r];for(;++a<i;)(d||a<o)&&(c[n[a]]=e[a]);for(;u--;)c[r++]=e[a++];return c}function fa(e,t,n,l){for(var a=-1,o=e.length,i=-1,r=n.length,s=-1,u=t.length,c=on(o-r,0),d=q(c+u),m=!l;++a<c;)d[a]=e[a];for(var p=a;++s<u;)d[p+s]=t[s];for(;++i<r;)(m||a<o)&&(d[p+n[i]]=e[a++]);return d}function Ea(e,t){var n=-1,l=e.length;for(t||(t=q(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?qn(n,r,s):Vn(n,r,s)}return n}function Sa(e,t){return function(n,l){var a=Pi(n)?nt:Gn,o=t?t():{};return a(n,e,$a(l,2),o)}}function ha(e){return Bl(function(t,n){var l=-1,a=n.length,o=a>1?n[a-1]:void 0,i=a>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(a--,o):void 0,i&&io(n[0],n[1],i)&&(o=a<3?void 0:o,a=1),t=ve(t);++l<a;){var r=n[l];r&&e(t,r,l,o)}return t})}function _a(e,t){return function(n,l){if(null==n)return n;if(!Fi(n))return e(n,l);for(var a=n.length,o=t?a:-1,i=ve(n);(t?o--:++o<a)&&!1!==l(i[o],o,i););return n}}function ya(e){return function(t,n,l){for(var a=-1,o=ve(t),i=l(t),r=i.length;r--;){var s=i[e?r:++a];if(!1===n(o[s],s,o))break}return t}}function Aa(e){return function(t){var n=Ft(t=sr(t))?Vt(t):void 0,l=n?n[0]:t.charAt(0),a=n?sa(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return dt(jr(wr(t).replace(Ie,"")),e,"")}}function ba(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=On(e.prototype),l=e.apply(n,t);return zi(l)?l:n}}function Da(e){return function(t,n,l){var a=ve(t);if(!Fi(t)){var o=$a(n,3);t=yr(t),n=function(e){return o(a[e],e,a)}}var i=e(t,n,l);return i>-1?a[o?t[i]:i]:void 0}}function Ta(e){return Va(function(t){var l=t.length,a=l,o=Rn.prototype.thru;for(e&&t.reverse();a--;){var i=t[a];if("function"!=typeof i)throw new ge(n);if(o&&!r&&"wrapper"==qa(i))var r=new Rn([],!0)}for(a=r?a:l;++a<l;){var s=qa(i=t[a]),u="wrapper"==s?Ka(i):void 0;r=u&&so(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[qa(u[0])].apply(r,u[3]):1==i.length&&so(i)?r[s]():r.thru(i)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&Pi(n))return r.plant(n).value();for(var a=0,o=l?t[a].apply(this,e):n;++a<l;)o=t[a].call(this,o);return o}})}function Na(e,t,n,l,a,o,i,r,s,u){var c=128&t,d=1&t,m=2&t,p=24&t,v=512&t,f=m?void 0:ba(e);return function E(){for(var g=arguments.length,S=q(g),h=g;h--;)S[h]=arguments[h];if(p)var _=Ya(E),y=Lt(S,_);if(l&&(S=va(S,l,a,p)),o&&(S=fa(S,o,i,p)),g-=y,p&&g<u){var A=Ut(S,_);return Pa(e,t,Na,E.placeholder,n,S,A,r,s,u-g)}var C=d?n:this,b=m?C[e]:e;return g=S.length,r?S=Eo(S,r):v&&g>1&&S.reverse(),c&&s<g&&(S.length=s),this&&this!==Ve&&this instanceof E&&(b=f||ba(b)),b.apply(C,S)}}function Ia(e,t){return function(n,l){return function(e,t,n,l){return sl(e,function(e,a,o){t(l,n(e),a,o)}),l}(n,e,t(l),{})}}function Oa(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Zl(n),l=Zl(l)):(n=$l(n),l=$l(l)),a=e(n,l)}return a}}function xa(e){return Va(function(t){return t=ut(t,Nt($a())),Bl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function Ra(e,t){var n=(t=void 0===t?" ":Zl(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Xt(e/Wt(t)));return Ft(t)?sa(Vt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&io(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 a=-1,o=on(Xt((t-e)/(n||1)),0),i=q(o);o--;)i[l?o:++a]=e,e+=n;return i}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function wa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ir(t),n=ir(n)),e(t,n)}}function Pa(e,t,n,l,a,o,i,r,s,u){var c=8&t;t|=c?32:64,4&(t&=~(c?64:32))||(t&=-4);var d=[e,t,a,c?o:void 0,c?i:void 0,c?void 0:o,c?void 0:i,r,s,u],m=n.apply(void 0,d);return so(e)&&So(m,d),m.placeholder=l,yo(m,e,t)}function Ma(e){var t=pe[e];return function(e,n){if(e=ir(e),(n=null==n?0:rn(ar(n),292))&&nn(e)){var l=(sr(e)+"e").split("e");return+((l=(sr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Fa=fn&&1/Ht(new fn([,-0]))[1]==1/0?function(e){return new fn(e)}:Xr;function Ba(e){return function(t){var n=to(t);return n==m?Bt(t):n==E?jt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,o,i,r,s,u){var c=2&t;if(!c&&"function"!=typeof e)throw new ge(n);var d=o?o.length:0;if(d||(t&=-97,o=i=void 0),s=void 0===s?s:on(ar(s),0),u=void 0===u?u:ar(u),d-=i?i.length:0,64&t){var m=o,p=i;o=i=void 0}var v=c?void 0:Ka(e),f=[e,t,a,o,i,m,p,r,s,u];if(v&&function(e,t){var n=e[1],a=t[1],o=n|a;if(!(o<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],o|=1&n?0:4);var i=t[3];if(i){var r=e[3];e[3]=r?va(r,i,t[4]):i,e[4]=r?Ut(e[3],l):t[4]}(i=t[5])&&(e[5]=(r=e[5])?fa(r,i,t[6]):i,e[6]=r?Ut(e[5],l):t[6]),(i=t[7])&&(e[7]=i),128&a&&(e[8]=null==e[8]?t[8]:rn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(f,v),e=f[0],t=f[1],a=f[2],o=f[3],i=f[4],!(u=f[9]=void 0===f[9]?c?0:e.length:on(f[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||16==t?function(e,t,n){var l=ba(e);return function a(){for(var o=arguments.length,i=q(o),r=o,s=Ya(a);r--;)i[r]=arguments[r];var u=o<3&&i[0]!==s&&i[o-1]!==s?[]:Ut(i,s);if((o-=u.length)<n)return Pa(e,t,Na,a.placeholder,void 0,i,u,void 0,void 0,n-o);var c=this&&this!==Ve&&this instanceof a?l:e;return tt(c,this,i)}}(e,t,u):32!=t&&33!=t||i.length?Na.apply(void 0,f):function(e,t,n,l){var a=1&t,o=ba(e);return function t(){for(var i=-1,r=arguments.length,s=-1,u=l.length,c=q(u+r),d=this&&this!==Ve&&this instanceof t?o:e;++s<u;)c[s]=l[s];for(;r--;)c[s++]=arguments[++i];return tt(d,a?n:this,c)}}(e,t,a,o);else var E=function(e,t,n){var l=1&t,a=ba(e);return function t(){var o=this&&this!==Ve&&this instanceof t?a:e;return o.apply(l?n:this,arguments)}}(e,t,a);return yo((v?jl:So)(E,f),e,t)}function Ua(e,t,n,l){return void 0===e||xi(e,he[n])&&!Ae.call(l,n)?t:e}function Ha(e,t,n,l,a,o){return zi(e)&&zi(t)&&(o.set(t,e),Ol(e,t,void 0,Ha,o),o.delete(t)),e}function ja(e){return Yi(e)?void 0:e}function Wa(e,t,n,l,a,o){var i=1&n,r=e.length,s=t.length;if(r!=s&&!(i&&s>r))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,m=!0,p=2&n?new Fn:void 0;for(o.set(e,t),o.set(t,e);++d<r;){var v=e[d],f=t[d];if(l)var E=i?l(f,v,d,t,e,o):l(v,f,d,e,t,o);if(void 0!==E){if(E)continue;m=!1;break}if(p){if(!pt(t,function(e,t){if(!Ot(p,t)&&(v===e||a(v,e,n,l,o)))return p.push(t)})){m=!1;break}}else if(v!==f&&!a(v,f,n,l,o)){m=!1;break}}return o.delete(e),o.delete(t),m}function Va(e){return _o(vo(e,void 0,Mo),e+"")}function za(e){return ml(e,yr,Ja)}function Ga(e){return ml(e,Ar,eo)}var Ka=Sn?function(e){return Sn.get(e)}:Xr;function qa(e){for(var t=e.name+"",n=hn[t],l=Ae.call(hn,t)?n.length:0;l--;){var a=n[l],o=a.func;if(null==o||o==e)return a.name}return t}function Ya(e){return(Ae.call(In,"placeholder")?In:e).placeholder}function $a(){var e=In.iteratee||Yr;return e=e===Yr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Za(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Qa(e){for(var t=yr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,mo(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Al(n)?n:void 0}var Ja=en?function(e){return null==e?[]:(e=ve(e),it(en(e),function(t){return qe.call(e,t)}))}:os,eo=en?function(e){for(var t=[];e;)ct(t,Ja(e)),e=ze(e);return t}:os,to=pl;function no(e,t,n){for(var l=-1,a=(t=ia(t,e)).length,o=!1;++l<a;){var i=No(t[l]);if(!(o=null!=e&&n(e,i)))break;e=e[i]}return o||++l!=a?o:!!(a=null==e?0:e.length)&&Vi(a)&&oo(i,a)&&(Pi(e)||wi(e))}function lo(e){return"function"!=typeof e.constructor||co(e)?{}:On(ze(e))}function ao(e){return Pi(e)||wi(e)||!!(vt&&e&&e[vt])}function oo(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ie.test(e))&&e>-1&&e%1==0&&e<t}function io(e,t,n){if(!zi(n))return!1;var l=typeof t;return!!("number"==l?Fi(n)&&oo(t,n.length):"string"==l&&t in n)&&xi(n[t],e)}function ro(e,t){if(Pi(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xi(e))||W.test(e)||!j.test(e)||null!=t&&e in ve(t)}function so(e){var t=qa(e),n=In[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Ka(n);return!!l&&e===l[0]}(mn&&to(new mn(new ArrayBuffer(1)))!=y||pn&&to(new pn)!=m||vn&&"[object Promise]"!=to(vn.resolve())||fn&&to(new fn)!=E||En&&to(new En)!=h)&&(to=function(e){var t=pl(e),n=t==v?e.constructor:void 0,l=n?Io(n):"";if(l)switch(l){case _n:return y;case yn:return m;case An:return"[object Promise]";case Cn:return E;case bn:return h}return t});var uo=_e?ji:is;function co(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||he)}function mo(e){return e==e&&!zi(e)}function po(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in ve(n))}}function vo(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,o=on(l.length-t,0),i=q(o);++a<o;)i[a]=l[t+a];a=-1;for(var r=q(t+1);++a<t;)r[a]=l[a];return r[t]=n(i),tt(e,this,r)}}function fo(e,t){return t.length<2?e:dl(e,zl(t,0,-1))}function Eo(e,t){for(var n=e.length,l=rn(t.length,n),a=Ea(e);l--;){var o=t[l];e[l]=oo(o,n)?a[o]:void 0}return e}function go(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var So=Ao(jl),ho=Qt||function(e,t){return Ve.setTimeout(e,t)},_o=Ao(Wl);function yo(e,t,n){var l=t+"";return _o(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(Y,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(a,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(Z):[]}(l),n)))}function Ao(e){var t=0,n=0;return function(){var l=sn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Co(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var o=Ml(n,a),i=e[o];e[o]=e[n],e[n]=i}return e.length=t,e}var bo,Do,To=(bo=bi(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(V,function(e,n,l,a){t.push(l?a.replace(J,"$1"):n||e)}),t},function(e){return 500===Do.size&&Do.clear(),e}),Do=bo.cache,bo);function No(e){if("string"==typeof e||Xi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Io(e){if(null!=e){try{return ye.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oo(e){if(e instanceof Ln)return e.clone();var t=new Rn(e.__wrapped__,e.__chain__);return t.__actions__=Ea(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var xo=Bl(function(e,t){return Bi(e)?Jn(e,ol(t,1,Bi,!0)):[]}),Ro=Bl(function(e,t){var n=Ho(t);return Bi(n)&&(n=void 0),Bi(e)?Jn(e,ol(t,1,Bi,!0),$a(n,2)):[]}),Lo=Bl(function(e,t){var n=Ho(t);return Bi(n)&&(n=void 0),Bi(e)?Jn(e,ol(t,1,Bi,!0),void 0,n):[]});function wo(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),Et(e,$a(t,3),a)}function Po(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=ar(n),a=n<0?on(l+a,0):rn(a,l-1)),Et(e,$a(t,3),a,!0)}function Mo(e){return null!=e&&e.length?ol(e,1):[]}function Fo(e){return e&&e.length?e[0]:void 0}var Bo=Bl(function(e){var t=ut(e,aa);return t.length&&t[0]===e[0]?gl(t):[]}),ko=Bl(function(e){var t=Ho(e),n=ut(e,aa);return t===Ho(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,$a(t,2)):[]}),Uo=Bl(function(e){var t=Ho(e),n=ut(e,aa);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Ho(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var jo=Bl(Wo);function Wo(e,t){return e&&e.length&&t&&t.length?wl(e,t):e}var Vo=Va(function(e,t){var n=null==e?0:e.length,l=Yn(e,t);return Pl(e,ut(t,function(e){return oo(e,n)?+e:e}).sort(pa)),l});function zo(e){return null==e?e:dn.call(e)}var Go=Bl(function(e){return Ql(ol(e,1,Bi,!0))}),Ko=Bl(function(e){var t=Ho(e);return Bi(t)&&(t=void 0),Ql(ol(e,1,Bi,!0),$a(t,2))}),qo=Bl(function(e){var t=Ho(e);return t="function"==typeof t?t:void 0,Ql(ol(e,1,Bi,!0),void 0,t)});function Yo(e){if(!e||!e.length)return[];var t=0;return e=it(e,function(e){if(Bi(e))return t=on(e.length,t),!0}),Dt(t,function(t){return ut(e,yt(t))})}function $o(e,t){if(!e||!e.length)return[];var n=Yo(e);return null==t?n:ut(n,function(e){return tt(t,void 0,e)})}var Zo=Bl(function(e,t){return Bi(e)?Jn(e,t):[]}),Qo=Bl(function(e){return na(it(e,Bi))}),Xo=Bl(function(e){var t=Ho(e);return Bi(t)&&(t=void 0),na(it(e,Bi),$a(t,2))}),Jo=Bl(function(e){var t=Ho(e);return t="function"==typeof t?t:void 0,na(it(e,Bi),void 0,t)}),ei=Bl(Yo),ti=Bl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$o(e,n)});function ni(e){var t=In(e);return t.__chain__=!0,t}function li(e,t){return t(e)}var ai=Va(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return Yn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&oo(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:li,args:[a],thisArg:void 0}),new Rn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),oi=Sa(function(e,t,n){Ae.call(e,n)?++e[n]:qn(e,n,1)}),ii=Da(wo),ri=Da(Po);function si(e,t){return(Pi(e)?lt:el)(e,$a(t,3))}function ui(e,t){return(Pi(e)?at:tl)(e,$a(t,3))}var ci=Sa(function(e,t,n){Ae.call(e,n)?e[n].push(t):qn(e,n,[t])}),di=Bl(function(e,t,n){var l=-1,a="function"==typeof t,o=Fi(e)?q(e.length):[];return el(e,function(e){o[++l]=a?tt(t,e,n):Sl(e,t,n)}),o}),mi=Sa(function(e,t,n){qn(e,n,t)});function pi(e,t){return(Pi(e)?ut:Tl)(e,$a(t,3))}var vi=Sa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),fi=Bl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&io(e,t[0],t[1])?t=[]:n>2&&io(t[0],t[1],t[2])&&(t=[t[0]]),Rl(e,ol(t,1),[])}),Ei=Zt||function(){return Ve.Date.now()};function gi(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function Si(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var hi=Bl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,Ya(hi));l|=32}return ka(e,l,t,n,a)}),_i=Bl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,Ya(_i));l|=32}return ka(t,l,e,n,a)});function yi(e,t,l){var a,o,i,r,s,u,c=0,d=!1,m=!1,p=!0;if("function"!=typeof e)throw new ge(n);function v(t){var n=a,l=o;return a=o=void 0,c=t,r=e.apply(l,n)}function f(e){return c=e,s=ho(g,t),d?v(e):r}function E(e){var n=e-u;return void 0===u||n>=t||n<0||m&&e-c>=i}function g(){var e=Ei();if(E(e))return S(e);s=ho(g,function(e){var n=t-(e-u);return m?rn(n,i-(e-c)):n}(e))}function S(e){return s=void 0,p&&a?v(e):(a=o=void 0,r)}function h(){var e=Ei(),n=E(e);if(a=arguments,o=this,u=e,n){if(void 0===s)return f(u);if(m)return ua(s),s=ho(g,t),v(u)}return void 0===s&&(s=ho(g,t)),r}return t=ir(t)||0,zi(l)&&(d=!!l.leading,i=(m="maxWait"in l)?on(ir(l.maxWait)||0,t):i,p="trailing"in l?!!l.trailing:p),h.cancel=function(){void 0!==s&&ua(s),c=0,a=u=o=s=void 0},h.flush=function(){return void 0===s?r:S(Ei())},h}var Ai=Bl(function(e,t){return Xn(e,1,t)}),Ci=Bl(function(e,t,n){return Xn(e,ir(t)||0,n)});function bi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],o=l.cache;if(o.has(a))return o.get(a);var i=e.apply(this,n);return l.cache=o.set(a,i)||o,i};return l.cache=new(bi.Cache||Mn),l}function Di(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}bi.Cache=Mn;var Ti=ra(function(e,t){var n=(t=1==t.length&&Pi(t[0])?ut(t[0],Nt($a())):ut(ol(t,1),Nt($a()))).length;return Bl(function(l){for(var a=-1,o=rn(l.length,n);++a<o;)l[a]=t[a].call(this,l[a]);return tt(e,this,l)})}),Ni=Bl(function(e,t){return ka(e,32,void 0,t,Ut(t,Ya(Ni)))}),Ii=Bl(function(e,t){return ka(e,64,void 0,t,Ut(t,Ya(Ii)))}),Oi=Va(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function xi(e,t){return e===t||e!=e&&t!=t}var Ri=wa(vl),Li=wa(function(e,t){return e>=t}),wi=hl(function(){return arguments}())?hl:function(e){return Gi(e)&&Ae.call(e,"callee")&&!qe.call(e,"callee")},Pi=q.isArray,Mi=$e?Nt($e):function(e){return Gi(e)&&pl(e)==_};function Fi(e){return null!=e&&Vi(e.length)&&!ji(e)}function Bi(e){return Gi(e)&&Fi(e)}var ki=tn||is,Ui=Ze?Nt(Ze):function(e){return Gi(e)&&pl(e)==s};function Hi(e){if(!Gi(e))return!1;var t=pl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Yi(e)}function ji(e){if(!zi(e))return!1;var t=pl(e);return t==c||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wi(e){return"number"==typeof e&&e==ar(e)}function Vi(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zi(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Gi(e){return null!=e&&"object"==typeof e}var Ki=Qe?Nt(Qe):function(e){return Gi(e)&&to(e)==m};function qi(e){return"number"==typeof e||Gi(e)&&pl(e)==p}function Yi(e){if(!Gi(e)||pl(e)!=v)return!1;var t=ze(e);if(null===t)return!0;var n=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ye.call(n)==Te}var $i=Xe?Nt(Xe):function(e){return Gi(e)&&pl(e)==f},Zi=Je?Nt(Je):function(e){return Gi(e)&&to(e)==E};function Qi(e){return"string"==typeof e||!Pi(e)&&Gi(e)&&pl(e)==g}function Xi(e){return"symbol"==typeof e||Gi(e)&&pl(e)==S}var Ji=et?Nt(et):function(e){return Gi(e)&&Vi(e.length)&&!!Fe[pl(e)]},er=wa(Dl),tr=wa(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fi(e))return Qi(e)?Vt(e):Ea(e);if(At&&e[At])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[At]());var t=to(e);return(t==m?Bt:t==E?Ht:xr)(e)}function lr(e){return e?(e=ir(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ar(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function or(e){return e?$n(ar(e),0,4294967295):0}function ir(e){if("number"==typeof e)return e;if(Xi(e))return NaN;if(zi(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zi(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=le.test(e);return n||oe.test(e)?He(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return ga(e,Ar(e))}function sr(e){return null==e?"":Zl(e)}var ur=ha(function(e,t){if(co(t)||Fi(t))ga(t,yr(t),e);else for(var n in t)Ae.call(t,n)&&Vn(e,n,t[n])}),cr=ha(function(e,t){ga(t,Ar(t),e)}),dr=ha(function(e,t,n,l){ga(t,Ar(t),e,l)}),mr=ha(function(e,t,n,l){ga(t,yr(t),e,l)}),pr=Va(Yn),vr=Bl(function(e,t){e=ve(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&io(t[0],t[1],a)&&(l=1);++n<l;)for(var o=t[n],i=Ar(o),r=-1,s=i.length;++r<s;){var u=i[r],c=e[u];(void 0===c||xi(c,he[u])&&!Ae.call(e,u))&&(e[u]=o[u])}return e}),fr=Bl(function(e){return e.push(void 0,Ha),tt(br,void 0,e)});function Er(e,t,n){var l=null==e?void 0:dl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&no(e,t,El)}var Sr=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),e[t]=n},zr(qr)),hr=Ia(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=De.call(t)),Ae.call(e,t)?e[t].push(n):e[t]=[n]},$a),_r=Bl(Sl);function yr(e){return Fi(e)?kn(e):bl(e)}function Ar(e){return Fi(e)?kn(e,!0):function(e){if(!zi(e))return function(e){var t=[];if(null!=e)for(var n in ve(e))t.push(n);return t}(e);var t=co(e),n=[];for(var l in e)("constructor"!=l||!t&&Ae.call(e,l))&&n.push(l);return n}(e)}var Cr=ha(function(e,t,n){Ol(e,t,n)}),br=ha(function(e,t,n,l){Ol(e,t,n,l)}),Dr=Va(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=ia(t,e),l||(l=t.length>1),t}),ga(e,Ga(e),n),l&&(n=Zn(n,7,ja));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Tr=Va(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Nr(e,t){if(null==e)return{};var n=ut(Ga(e),function(e){return[e]});return t=$a(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Ir=Ba(yr),Or=Ba(Ar);function xr(e){return null==e?[]:It(e,yr(e))}var Rr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Hr(sr(e).toLowerCase())}function wr(e){return(e=sr(e))&&e.replace(re,wt).replace(Oe,"")}var Pr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=Aa("toLowerCase"),Br=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Ca(function(e,t,n){return e+(n?" ":"")+Hr(t)}),Ur=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Hr=Aa("toUpperCase");function jr(e,t,n){return e=sr(e),void 0===(t=n?void 0:t)?function(e){return we.test(e)}(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.match(Q)||[]}(e):e.match(t)||[]}var Wr=Bl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Hi(e)?e:new de(e)}}),Vr=Va(function(e,t){return lt(t,function(t){t=No(t),qn(e,t,hi(e[t],e))}),e});function zr(e){return function(){return e}}var Gr=Ta(),Kr=Ta(!0);function qr(e){return e}function Yr(e){return Cl("function"==typeof e?e:Zn(e,1))}var $r=Bl(function(e,t){return function(n){return Sl(n,e,t)}}),Zr=Bl(function(e,t){return function(n){return Sl(e,n,t)}});function Qr(e,t,n){var l=yr(t),a=cl(t,l);null!=n||zi(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=cl(t,yr(t)));var o=!(zi(n)&&"chain"in n&&!n.chain),i=ji(e);return lt(a,function(n){var l=t[n];e[n]=l,i&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),a=n.__actions__=Ea(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,ct([this.value()],arguments))})}),e}function Xr(){}var Jr=xa(ut),es=xa(ot),ts=xa(pt);function ns(e){return ro(e)?yt(No(e)):function(e){return function(t){return dl(t,e)}}(e)}var ls=La(),as=La(!0);function os(){return[]}function is(){return!1}var rs,ss=Oa(function(e,t){return e+t},0),us=Ma("ceil"),cs=Oa(function(e,t){return e/t},1),ds=Ma("floor"),ms=Oa(function(e,t){return e*t},1),ps=Ma("round"),vs=Oa(function(e,t){return e-t},0);return In.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){if(--e<1)return t.apply(this,arguments)}},In.ary=gi,In.assign=ur,In.assignIn=cr,In.assignInWith=dr,In.assignWith=mr,In.at=pr,In.before=Si,In.bind=hi,In.bindAll=Vr,In.bindKey=_i,In.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Pi(e)?e:[e]},In.chain=ni,In.chunk=function(e,t,n){t=(n?io(e,t,n):void 0===t)?1:on(ar(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,o=0,i=q(Xt(l/t));a<l;)i[o++]=zl(e,a,a+=t);return i},In.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var o=e[t];o&&(a[l++]=o)}return a},In.concat=function(){var e=arguments.length;if(!e)return[];for(var t=q(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return ct(Pi(n)?Ea(n):[n],ol(t,1))},In.cond=function(e){var t=null==e?0:e.length,l=$a();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Bl(function(n){for(var l=-1;++l<t;){var a=e[l];if(tt(a[0],this,n))return tt(a[1],this,n)}})},In.conforms=function(e){return function(e){var t=yr(e);return function(n){return Qn(n,e,t)}}(Zn(e,1))},In.constant=zr,In.countBy=oi,In.create=function(e,t){var n=On(e);return null==t?n:Kn(n,t)},In.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},In.debounce=yi,In.defaults=vr,In.defaultsDeep=fr,In.defer=Ai,In.delay=Ci,In.difference=xo,In.differenceBy=Ro,In.differenceWith=Lo,In.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:ar(t))<0?0:t,l):[]},In.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,0,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t):[]},In.dropRightWhile=function(e,t){return e&&e.length?ea(e,$a(t,3),!0,!0):[]},In.dropWhile=function(e,t){return e&&e.length?ea(e,$a(t,3),!0):[]},In.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&io(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=ar(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:ar(l))<0&&(l+=a),l=n>l?0:or(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},In.filter=function(e,t){return(Pi(e)?it:al)(e,$a(t,3))},In.flatMap=function(e,t){return ol(pi(e,t),1)},In.flatMapDeep=function(e,t){return ol(pi(e,t),1/0)},In.flatMapDepth=function(e,t,n){return n=void 0===n?1:ar(n),ol(pi(e,t),n)},In.flatten=Mo,In.flattenDeep=function(e){return null!=e&&e.length?ol(e,1/0):[]},In.flattenDepth=function(e,t){return null!=e&&e.length?ol(e,t=void 0===t?1:ar(t)):[]},In.flip=function(e){return ka(e,512)},In.flow=Gr,In.flowRight=Kr,In.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},In.functions=function(e){return null==e?[]:cl(e,yr(e))},In.functionsIn=function(e){return null==e?[]:cl(e,Ar(e))},In.groupBy=ci,In.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},In.intersection=Bo,In.intersectionBy=ko,In.intersectionWith=Uo,In.invert=Sr,In.invertBy=hr,In.invokeMap=di,In.iteratee=Yr,In.keyBy=mi,In.keys=yr,In.keysIn=Ar,In.map=pi,In.mapKeys=function(e,t){var n={};return t=$a(t,3),sl(e,function(e,l,a){qn(n,t(e,l,a),e)}),n},In.mapValues=function(e,t){var n={};return t=$a(t,3),sl(e,function(e,l,a){qn(n,l,t(e,l,a))}),n},In.matches=function(e){return Nl(Zn(e,1))},In.matchesProperty=function(e,t){return Il(e,Zn(t,1))},In.memoize=bi,In.merge=Cr,In.mergeWith=br,In.method=$r,In.methodOf=Zr,In.mixin=Qr,In.negate=Di,In.nthArg=function(e){return e=ar(e),Bl(function(t){return xl(t,e)})},In.omit=Dr,In.omitBy=function(e,t){return Nr(e,Di($a(t)))},In.once=function(e){return Si(2,e)},In.orderBy=function(e,t,n,l){return null==e?[]:(Pi(t)||(t=null==t?[]:[t]),Pi(n=l?void 0:n)||(n=null==n?[]:[n]),Rl(e,t,n))},In.over=Jr,In.overArgs=Ti,In.overEvery=es,In.overSome=ts,In.partial=Ni,In.partialRight=Ii,In.partition=vi,In.pick=Tr,In.pickBy=Nr,In.property=ns,In.propertyOf=function(e){return function(t){return null==e?void 0:dl(e,t)}},In.pull=jo,In.pullAll=Wo,In.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?wl(e,t,$a(n,2)):e},In.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?wl(e,t,void 0,n):e},In.pullAt=Vo,In.range=ls,In.rangeRight=as,In.rearg=Oi,In.reject=function(e,t){return(Pi(e)?it:al)(e,Di($a(t,3)))},In.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],o=e.length;for(t=$a(t,3);++l<o;){var i=e[l];t(i,l,e)&&(n.push(i),a.push(l))}return Pl(e,a),n},In.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Bl(e,t=void 0===t?t:ar(t))},In.reverse=zo,In.sampleSize=function(e,t,n){return t=(n?io(e,t,n):void 0===t)?1:ar(t),(Pi(e)?Hn:Ul)(e,t)},In.set=function(e,t,n){return null==e?e:Hl(e,t,n)},In.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Hl(e,t,n,l)},In.shuffle=function(e){return(Pi(e)?jn:Vl)(e)},In.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&io(e,t,n)?(t=0,n=l):(t=null==t?0:ar(t),n=void 0===n?l:ar(n)),zl(e,t,n)):[]},In.sortBy=fi,In.sortedUniq=function(e){return e&&e.length?Yl(e):[]},In.sortedUniqBy=function(e,t){return e&&e.length?Yl(e,$a(t,2)):[]},In.split=function(e,t,n){return n&&"number"!=typeof n&&io(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=sr(e))&&("string"==typeof t||null!=t&&!$i(t))&&!(t=Zl(t))&&Ft(e)?sa(Vt(e),0,n):e.split(t,n):[]},In.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:on(ar(t),0),Bl(function(n){var l=n[t],a=sa(n,0,t);return l&&ct(a,l),tt(e,this,a)})},In.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},In.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:ar(t))<0?0:t):[]},In.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t,l):[]},In.takeRightWhile=function(e,t){return e&&e.length?ea(e,$a(t,3),!1,!0):[]},In.takeWhile=function(e,t){return e&&e.length?ea(e,$a(t,3)):[]},In.tap=function(e,t){return t(e),e},In.throttle=function(e,t,l){var a=!0,o=!0;if("function"!=typeof e)throw new ge(n);return zi(l)&&(a="leading"in l?!!l.leading:a,o="trailing"in l?!!l.trailing:o),yi(e,t,{leading:a,maxWait:t,trailing:o})},In.thru=li,In.toArray=nr,In.toPairs=Ir,In.toPairsIn=Or,In.toPath=function(e){return Pi(e)?ut(e,No):Xi(e)?[e]:Ea(To(sr(e)))},In.toPlainObject=rr,In.transform=function(e,t,n){var l=Pi(e),a=l||ki(e)||Ji(e);if(t=$a(t,4),null==n){var o=e&&e.constructor;n=a?l?new o:[]:zi(e)&&ji(o)?On(ze(e)):{}}return(a?lt:sl)(e,function(e,l,a){return t(n,e,l,a)}),n},In.unary=function(e){return gi(e,1)},In.union=Go,In.unionBy=Ko,In.unionWith=qo,In.uniq=function(e){return e&&e.length?Ql(e):[]},In.uniqBy=function(e,t){return e&&e.length?Ql(e,$a(t,2)):[]},In.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Ql(e,void 0,t):[]},In.unset=function(e,t){return null==e||Xl(e,t)},In.unzip=Yo,In.unzipWith=$o,In.update=function(e,t,n){return null==e?e:Jl(e,t,oa(n))},In.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,oa(n),l)},In.values=xr,In.valuesIn=function(e){return null==e?[]:It(e,Ar(e))},In.without=Zo,In.words=jr,In.wrap=function(e,t){return Ni(oa(t),e)},In.xor=Qo,In.xorBy=Xo,In.xorWith=Jo,In.zip=ei,In.zipObject=function(e,t){return la(e||[],t||[],Vn)},In.zipObjectDeep=function(e,t){return la(e||[],t||[],Hl)},In.zipWith=ti,In.entries=Ir,In.entriesIn=Or,In.extend=cr,In.extendWith=dr,Qr(In,In),In.add=ss,In.attempt=Wr,In.camelCase=Rr,In.capitalize=Lr,In.ceil=us,In.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=ir(n))==n?n:0),void 0!==t&&(t=(t=ir(t))==t?t:0),$n(ir(e),t,n)},In.clone=function(e){return Zn(e,4)},In.cloneDeep=function(e){return Zn(e,5)},In.cloneDeepWith=function(e,t){return Zn(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return Zn(e,4,t="function"==typeof t?t:void 0)},In.conformsTo=function(e,t){return null==t||Qn(e,t,yr(t))},In.deburr=wr,In.defaultTo=function(e,t){return null==e||e!=e?t:e},In.divide=cs,In.endsWith=function(e,t,n){e=sr(e),t=Zl(t);var l=e.length,a=n=void 0===n?l:$n(ar(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},In.eq=xi,In.escape=function(e){return(e=sr(e))&&F.test(e)?e.replace(P,Pt):e},In.escapeRegExp=function(e){return(e=sr(e))&&G.test(e)?e.replace(z,"\\$&"):e},In.every=function(e,t,n){var l=Pi(e)?ot:nl;return n&&io(e,t,n)&&(t=void 0),l(e,$a(t,3))},In.find=ii,In.findIndex=wo,In.findKey=function(e,t){return ft(e,$a(t,3),sl)},In.findLast=ri,In.findLastIndex=Po,In.findLastKey=function(e,t){return ft(e,$a(t,3),ul)},In.floor=ds,In.forEach=si,In.forEachRight=ui,In.forIn=function(e,t){return null==e?e:il(e,$a(t,3),Ar)},In.forInRight=function(e,t){return null==e?e:rl(e,$a(t,3),Ar)},In.forOwn=function(e,t){return e&&sl(e,$a(t,3))},In.forOwnRight=function(e,t){return e&&ul(e,$a(t,3))},In.get=Er,In.gt=Ri,In.gte=Li,In.has=function(e,t){return null!=e&&no(e,t,fl)},In.hasIn=gr,In.head=Fo,In.identity=qr,In.includes=function(e,t,n,l){e=Fi(e)?e:xr(e),n=n&&!l?ar(n):0;var a=e.length;return n<0&&(n=on(a+n,0)),Qi(e)?n<=a&&e.indexOf(t,n)>-1:!!a&>(e,t,n)>-1},In.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),gt(e,t,a)},In.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=ir(e),t,n)},In.invoke=_r,In.isArguments=wi,In.isArray=Pi,In.isArrayBuffer=Mi,In.isArrayLike=Fi,In.isArrayLikeObject=Bi,In.isBoolean=function(e){return!0===e||!1===e||Gi(e)&&pl(e)==r},In.isBuffer=ki,In.isDate=Ui,In.isElement=function(e){return Gi(e)&&1===e.nodeType&&!Yi(e)},In.isEmpty=function(e){if(null==e)return!0;if(Fi(e)&&(Pi(e)||"string"==typeof e||"function"==typeof e.splice||ki(e)||Ji(e)||wi(e)))return!e.length;var t=to(e);if(t==m||t==E)return!e.size;if(co(e))return!bl(e).length;for(var n in e)if(Ae.call(e,n))return!1;return!0},In.isEqual=function(e,t){return _l(e,t)},In.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?_l(e,t,void 0,n):!!l},In.isError=Hi,In.isFinite=function(e){return"number"==typeof e&&nn(e)},In.isFunction=ji,In.isInteger=Wi,In.isLength=Vi,In.isMap=Ki,In.isMatch=function(e,t){return e===t||yl(e,t,Qa(t))},In.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,yl(e,t,Qa(t),n)},In.isNaN=function(e){return qi(e)&&e!=+e},In.isNative=function(e){if(uo(e))throw new de("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Al(e)},In.isNil=function(e){return null==e},In.isNull=function(e){return null===e},In.isNumber=qi,In.isObject=zi,In.isObjectLike=Gi,In.isPlainObject=Yi,In.isRegExp=$i,In.isSafeInteger=function(e){return Wi(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=Zi,In.isString=Qi,In.isSymbol=Xi,In.isTypedArray=Ji,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return Gi(e)&&to(e)==h},In.isWeakSet=function(e){return Gi(e)&&"[object WeakSet]"==pl(e)},In.join=function(e,t){return null==e?"":ln.call(e,t)},In.kebabCase=Pr,In.last=Ho,In.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=ar(n))<0?on(l+a,0):rn(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):Et(e,ht,a,!0)},In.lowerCase=Mr,In.lowerFirst=Fr,In.lt=er,In.lte=tr,In.max=function(e){return e&&e.length?ll(e,qr,vl):void 0},In.maxBy=function(e,t){return e&&e.length?ll(e,$a(t,2),vl):void 0},In.mean=function(e){return _t(e,qr)},In.meanBy=function(e,t){return _t(e,$a(t,2))},In.min=function(e){return e&&e.length?ll(e,qr,Dl):void 0},In.minBy=function(e,t){return e&&e.length?ll(e,$a(t,2),Dl):void 0},In.stubArray=os,In.stubFalse=is,In.stubObject=function(){return{}},In.stubString=function(){return""},In.stubTrue=function(){return!0},In.multiply=ms,In.nth=function(e,t){return e&&e.length?xl(e,ar(t)):void 0},In.noConflict=function(){return Ve._===this&&(Ve._=Ne),this},In.noop=Xr,In.now=Ei,In.pad=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return Ra(Jt(a),n)+e+Ra(Xt(a),n)},In.padEnd=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?e+Ra(t-l,n):e},In.padStart=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?Ra(t-l,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(K,""),t||0)},In.random=function(e,t,n){if(n&&"boolean"!=typeof n&&io(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 a=cn();return rn(e+a*(t-e+Ue("1e-"+((a+"").length-1))),t)}return Ml(e,t)},In.reduce=function(e,t,n){var l=Pi(e)?dt:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,el)},In.reduceRight=function(e,t,n){var l=Pi(e)?mt:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,tl)},In.repeat=function(e,t,n){return t=(n?io(e,t,n):void 0===t)?1:ar(t),Fl(sr(e),t)},In.replace=function(){var e=arguments,t=sr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},In.result=function(e,t,n){var l=-1,a=(t=ia(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var o=null==e?void 0:e[No(t[l])];void 0===o&&(l=a,o=n),e=ji(o)?o.call(e):o}return e},In.round=ps,In.runInContext=e,In.sample=function(e){return(Pi(e)?Un:kl)(e)},In.size=function(e){if(null==e)return 0;if(Fi(e))return Qi(e)?Wt(e):e.length;var t=to(e);return t==m||t==E?e.size:bl(e).length},In.snakeCase=Br,In.some=function(e,t,n){var l=Pi(e)?pt:Gl;return n&&io(e,t,n)&&(t=void 0),l(e,$a(t,3))},In.sortedIndex=function(e,t){return Kl(e,t)},In.sortedIndexBy=function(e,t,n){return ql(e,t,$a(n,2))},In.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Kl(e,t);if(l<n&&xi(e[l],t))return l}return-1},In.sortedLastIndex=function(e,t){return Kl(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return ql(e,t,$a(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Kl(e,t,!0)-1;if(xi(e[n],t))return n}return-1},In.startCase=kr,In.startsWith=function(e,t,n){return e=sr(e),n=null==n?0:$n(ar(n),0,e.length),t=Zl(t),e.slice(n,n+t.length)==t},In.subtract=vs,In.sum=function(e){return e&&e.length?bt(e,qr):0},In.sumBy=function(e,t){return e&&e.length?bt(e,$a(t,2)):0},In.template=function(e,t,n){var l=In.templateSettings;n&&io(e,t,n)&&(t=void 0),e=sr(e),t=dr({},t,l,Ua);var a,o,i=dr({},t.imports,l.imports,Ua),r=yr(i),s=It(i,r),u=0,c=t.interpolate||se,d="__p += '",m=fe((t.escape||se).source+"|"+c.source+"|"+(c===H?ee:se).source+"|"+(t.evaluate||se).source+"|$","g"),p="//# sourceURL="+(Ae.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(m,function(t,n,l,i,r,s){return l||(l=i),d+=e.slice(u,s).replace(ue,Mt),n&&(a=!0,d+="' +\n__e("+n+") +\n'"),r&&(o=!0,d+="';\n"+r+";\n__p += '"),l&&(d+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),d+="';\n";var v=Ae.call(t,"variable")&&t.variable;if(v){if(X.test(v))throw new de("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(x,""):d).replace(R,"$1").replace(L,"$1;"),d="function("+(v||"obj")+") {\n"+(v?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var f=Wr(function(){return me(r,p+"return "+d).apply(void 0,s)});if(f.source=d,Hi(f))throw f;return f},In.times=function(e,t){if((e=ar(e))<1||e>9007199254740991)return[];var n=4294967295,l=rn(e,4294967295);e-=4294967295;for(var a=Dt(l,t=$a(t));++n<e;)t(n);return a},In.toFinite=lr,In.toInteger=ar,In.toLength=or,In.toLower=function(e){return sr(e).toLowerCase()},In.toNumber=ir,In.toSafeInteger=function(e){return e?$n(ar(e),-9007199254740991,9007199254740991):0===e?e:0},In.toString=sr,In.toUpper=function(e){return sr(e).toUpperCase()},In.trim=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=Zl(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,xt(l,a),Rt(l,a)+1).join("")},In.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,0,Rt(l,Vt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(K,"");if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,xt(l,Vt(t))).join("")},In.truncate=function(e,t){var n=30,l="...";if(zi(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?Zl(t.omission):l}var o=(e=sr(e)).length;if(Ft(e)){var i=Vt(e);o=i.length}if(n>=o)return e;var r=n-Wt(l);if(r<1)return l;var s=i?sa(i,0,r).join(""):e.slice(0,r);if(void 0===a)return s+l;if(i&&(r+=s.length-r),$i(a)){if(e.slice(r).search(a)){var u,c=s;for(a.global||(a=fe(a.source,sr(te.exec(a))+"g")),a.lastIndex=0;u=a.exec(c);)var d=u.index;s=s.slice(0,void 0===d?r:d)}}else if(e.indexOf(Zl(a),r)!=r){var m=s.lastIndexOf(a);m>-1&&(s=s.slice(0,m))}return s+l},In.unescape=function(e){return(e=sr(e))&&M.test(e)?e.replace(w,Gt):e},In.uniqueId=function(e){var t=++Ce;return sr(e)+t},In.upperCase=Ur,In.upperFirst=Hr,In.each=si,In.eachRight=ui,In.first=Fo,Qr(In,(rs={},sl(In,function(e,t){Ae.call(In.prototype,t)||(rs[t]=e)}),rs),{chain:!1}),In.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){In[e].placeholder=In}),lt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new Ln(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},Ln.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;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$a(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(qr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Bl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return Sl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Di($a(e)))},Ln.prototype.slice=function(e,t){e=ar(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ar(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},sl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=In[l?"take"+("last"==t?"Right":""):t],o=l||/^find/.test(t);a&&(In.prototype[t]=function(){var t=this.__wrapped__,i=l?[1]:arguments,r=t instanceof Ln,s=i[0],u=r||Pi(t),c=function(e){var t=a.apply(In,ct([e],i));return l&&d?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var d=this.__chain__,m=!!this.__actions__.length,p=o&&!d,v=r&&!m;if(!o&&u){t=v?t:new Ln(this);var f=e.apply(t,i);return f.__actions__.push({func:li,args:[c],thisArg:void 0}),new Rn(f,d)}return p&&v?e.apply(this,i):(f=this.thru(c),p?l?f.value()[0]:f.value():f)})}),lt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Se[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);In.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(Pi(a)?a:[],e)}return this[n](function(n){return t.apply(Pi(n)?n:[],e)})}}),sl(Ln.prototype,function(e,t){var n=In[t];if(n){var l=n.name+"";Ae.call(hn,l)||(hn[l]=[]),hn[l].push({name:t,func:n})}}),hn[Na(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=Ea(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ea(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ea(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Pi(e),l=t<0,a=n?e.length:0,o=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var o=n[l],i=o.size;switch(o.type){case"drop":e+=i;break;case"dropRight":t-=i;break;case"take":t=rn(t,e+i);break;case"takeRight":e=on(e,t-i)}}return{start:e,end:t}}(0,a,this.__views__),i=o.start,r=o.end,s=r-i,u=l?r:i-1,c=this.__iteratees__,d=c.length,m=0,p=rn(s,this.__takeCount__);if(!n||!l&&a==s&&p==s)return ta(e,this.__actions__);var v=[];e:for(;s--&&m<p;){for(var f=-1,E=e[u+=t];++f<d;){var g=c[f],S=g.type,h=(0,g.iteratee)(E);if(2==S)E=h;else if(!h){if(1==S)continue e;break e}}v[m++]=E}return v},In.prototype.at=ai,In.prototype.chain=function(){return ni(this)},In.prototype.commit=function(){return new Rn(this.value(),this.__chain__)},In.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__++]}},In.prototype.plant=function(e){for(var t,n=this;n instanceof xn;){var l=Oo(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},In.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:li,args:[zo],thisArg:void 0}),new Rn(t,this.__chain__)}return this.thru(zo)},In.prototype.toJSON=In.prototype.valueOf=In.prototype.value=function(){return ta(this.__wrapped__,this.__actions__)},In.prototype.first=In.prototype.head,At&&(In.prototype[At]=function(){return this}),In}();Ge?((Ge.exports=Kt)._=Kt,ze._=Kt):Ve._=Kt}).call(k)});const j=["searchParams","onFilterChange","defaultSearchParams","statusMap","moduleCode"],W=e=>{var o;let{searchParams:i,onFilterChange:r,defaultSearchParams:s,statusMap:u,moduleCode:d}=e,v=p(e,j);const{t:f}=a.useTranslation(),E=c.useQueryClient(),[g,S]=n.useState(()=>m({},i,{services:[]})),h=[{label:"AST_NEW_ASSET",value:"asset-create"}],_=e=>{let t=e.delete,n=m({},g,e);t&&t.forEach(e=>delete n[e]),delete e.delete,S(m({},n))},y=()=>{S(m({},s,{services:[]})),r(m({},s))},A=Digit.ULBService.getCurrentTenantId();return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading",style:{alignItems:"center"}},l.createElement("div",{className:"filter-label",style:{display:"flex",alignItems:"center"}},l.createElement("span",null,l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M0.66666 2.48016C3.35999 5.9335 8.33333 12.3335 8.33333 12.3335V20.3335C8.33333 21.0668 8.93333 21.6668 9.66666 21.6668H12.3333C13.0667 21.6668 13.6667 21.0668 13.6667 20.3335V12.3335C13.6667 12.3335 18.6267 5.9335 21.32 2.48016C22 1.60016 21.3733 0.333496 20.2667 0.333496H1.71999C0.613327 0.333496 -0.01334 1.60016 0.66666 2.48016Z",fill:"#505A5F"}))),l.createElement("span",{style:{marginLeft:"8px",fontWeight:"normal"}},f("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:y},f("ES_COMMON_CLEAR_ALL")),"desktop"===v.type&&l.createElement("span",{className:"clear-search",onClick:y,style:{border:"1px solid #e0e0e0",padding:"6px"}},l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 16 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M8 5V8L12 4L8 0V3C3.58 3 0 6.58 0 11C0 12.57 0.46 14.03 1.24 15.26L2.7 13.8C2.25 12.97 2 12.01 2 11C2 7.69 4.69 5 8 5ZM14.76 6.74L13.3 8.2C13.74 9.04 14 9.99 14 11C14 14.31 11.31 17 8 17V14L4 18L8 22V19C12.42 19 16 15.42 16 11C16 9.43 15.54 7.97 14.76 6.74Z",fill:"#505A5F"}))),"mobile"===v.type&&l.createElement("span",{onClick:v.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},f("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{_({locality:[...(null==g?void 0:g.locality)||[],e]})},tenantId:A,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==g||null===(o=g.locality)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:f(e.i18nkey),onClick:()=>{_({locality:null==g?void 0:g.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},f("AST_APPLICATION_TYPE")),h.map((e,n)=>{var a;const o=null==g||null===(a=g.services)||void 0===a?void 0:a.includes(e.value);return l.createElement(t.CheckBox,{key:n+"service",label:f(e.label),value:e.label,checked:o,onChange:t=>((e,t)=>{var n;_(e.target.checked?{services:Array.isArray(g.services)?[...g.services,t]:[t]}:{services:g.services.filter(e=>e!==t),applicationStatus:null===(n=g.applicationStatus)||void 0===n?void 0:n.filter(e=>e.stateBusinessService!==t)})})(t,e.value)})})),l.createElement("div",null,l.createElement(B,{searchParams:g,businessServices:g.services,statusMap:u||E.getQueryData("INBOX_STATUS_MAP_"+d),moduleCode:d,onAssignmentChange:(e,t)=>{if(e.target.checked)_({applicationStatus:[...null==g?void 0:g.applicationStatus,t]});else{let e=null==g?void 0:g.applicationStatus.filter(e=>e.state!==t.state);_({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===g.services.length?m({},g,{services:h.map(e=>e.value)}):g)},label:f("ES_COMMON_APPLY")}))))))},V=e=>l.createElement("h1",{className:"heading-m"},e.label),z=()=>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"})),G=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(z,null)),K=e=>{var a,o;let{t:i,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:p,moduleCode:v}=e;const{data:f,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:h}=Digit.Hooks.pt.useMDMS(s,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,y]=n.useState({}),[A,C]=n.useState({}),[b,D]=n.useState([]),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,w]=n.useState(null),[P,M]=n.useState([]),[F,B]=n.useState(null),[k,U]=n.useState(!1);function H(e){O(e.target.files[0])}return n.useEffect(()=>{var e;h&&h["egf-master"]&&M(null===(e=h["egf-master"])||void 0===e?void 0:e.FinancialYear)},[h]),n.useEffect(()=>{var e;D(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{w(null);const e=function(){if(I){const e=function(){if(I.size>=5242880)w(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",I,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):w(i("CS_FILE_UPLOAD_ERROR"))})},function(){w(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[I]),n.useEffect(()=>{r&&y(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:o,selectedFinancialYear:i,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+a.action+"_APPLICATION",submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:i})}]}]}})({t:i,action:r,financialYears:P,selectedFinancialYear:F,setSelectedFinancialYear:B}):(e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:p}=e;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{d(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:b,selectedApprover:T,setSelectedApprover:N,selectFile:H,uploadedFile:x,setUploadedFile:R,businessService:p}))},[r,b,P,F,x]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(V,{label:i(_.label.heading)}),headerBarEnd:l.createElement(G,{onClick:u}),actionCancelLabel:i(_.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:E||(null==r?void 0:r.docUploadRequired)&&!x,formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};d.creationReason="STATUS",c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:m({},d,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)c({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==F?void 0:F.name,propertyId:null==d?void 0:d.propertyId,tenantId:s,source:null==d?void 0:d.source,channel:null==d?void 0:d.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!T?[]:[T],x&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:x}]),c({Property:m({},d,{workflow:t})})}},defaultValues:A,formId:"modal-action"})):l.createElement(t.Loader,null)},q=e=>l.createElement("h1",{className:"heading-m"},e.label),Y=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),$=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Y,null)),Z=e=>{var a,o;let{t:i,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:p}=e;const{data:v}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:f,data:E}=Digit.Hooks.pt.useMDMS(s,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[g,h]=n.useState({}),[_,y]=n.useState({}),[A,C]=n.useState([]),[b,D]=n.useState({}),[T,N]=n.useState(null),[I,O]=n.useState(null),[x,R]=n.useState(null),[L,w]=n.useState([]),[P,M]=n.useState(null);n.useEffect(()=>{var e;E&&E["egf-master"]&&w(null===(e=E["egf-master"])||void 0===e?void 0:e.FinancialYear)},[E]);const{data:F}=Digit.Hooks.useCustomMDMS(s,"common-masters",[{name:"Department"}]);function B(e){N(e.target.files[0])}return n.useEffect(()=>{if(v&&F){var e;const t=F["common-masters"].Department;C(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const o=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,i=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===o);return console.log("matchedDept===",i),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==i?void 0:i.name)}}))}},[v]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",T,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{r&&h((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:c,businessService:d}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{c(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:A,selectedApprover:b,setSelectedApprover:D,selectFile:B,uploadedFile:I,setUploadedFile:O,businessService:p}))},[r,A,L,P,I]),r&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(q,{label:i(g.label.heading)}),headerBarEnd:l.createElement($,{onClick:u}),actionCancelLabel:i(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d=m({},d,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:I}]:null}),c({Licenses:[d]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Q=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),X=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),J=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(X,null)),ee=e=>{var a,o;let{t:i,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:p}=e;const{data:v,isLoading:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,g]=n.useState({}),[h,_]=n.useState({}),[y,A]=n.useState([]),[C,b]=n.useState({}),[D,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),R=!!Digit.Utils.browser.isMobile();function L(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))x(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",D,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(){x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:c,businessService:d,error:m}=e,p=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(p=!1),a.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==d?void 0:d.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:p?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{c(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:i,action:r,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:L,uploadedFile:N,setUploadedFile:I,businessService:p,error:O}))},[r,y,N,O]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Q,{label:i(E.label.heading)}),headerBarEnd:l.createElement(J,{onClick:u}),actionCancelLabel:i(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:R?{width:"720px"}:{},style:R?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:R?{paddingLeft:"5px"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:E.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){d=m({},d,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]:null}),c({Licenses:[d]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},te=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ne=()=>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"})),le=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ne,null)),ae=e=>{var a,o,i,r,s,u,d,p,v,f,E,g;let{t:h,action:_,tenantId:y,closeModal:A,submitAction:C,applicationDetails:b,applicationData:D,businessService:T,workflowDetails:N,blockReason:I}=e;console.log("applicationData",D),console.log("workflowDetails",N),Digit.Hooks.obps.useObpsAPI(null!==(a=D)&&void 0!==a&&null!==(o=a.landInfo)&&void 0!==o&&null!==(i=o.address)&&void 0!==i&&i.city?null===(r=D)||void 0===r||null===(s=r.landInfo)||void 0===s||null===(u=s.address)||void 0===u?void 0:u.city:y,!1);const{data:O,isLoading:x}=Digit.Hooks.useEmployeeSearch(y,{roles:null==N||null===(d=N.data)||void 0===d||null===(p=d.initialActionState)||void 0===p||null===(v=p.nextActions)||void 0===v||null===(f=v.filter(e=>(null==e?void 0:e.action)==(null==_?void 0:_.action)))||void 0===f||null===(E=f[0])||void 0===E||null===(g=E.assigneeRoles)||void 0===g?void 0:g.map(e=>({code:e})),isActive:!0},{enabled:!(null!=_&&_.isTerminateState)}),[R,L]=(c.useQueryClient(),n.useState({})),[w,P]=n.useState({}),[M,F]=n.useState([]),[B,k]=n.useState([]),[U,H]=n.useState({}),[j,W]=n.useState({}),[V,z]=n.useState(null),[G,K]=n.useState(null),[q,Y]=n.useState(null),[$,Z]=n.useState(null),Q=!!Digit.Utils.browser.isMobile();function X(e){z(e.target.files[0])}n.useEffect(()=>{var e;F(null==O||null===(e=O.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[O]),n.useEffect(()=>{!function(){try{Y(null);const e=function(){if(V){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(V.size>=5242880)Y(h("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=V&&V.type&&!e.test(null==V?void 0:V.type))Y(h("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",V,Digit.ULBService.getStateId()||(null==y?void 0:y.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?K(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):Y(h("CS_FILE_UPLOAD_ERROR"))})},function(){Y(h("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[V]);const J=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},ee=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},ne=e=>{var t,n;let l=[],a=[];var o,i;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(i=l)||void 0===i?void 0:i.length)>0&&l.map((e,t)=>{a.push({docs:J(e.Documents),date:e.InspectionDate,questions:ee(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},ae=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,o,i,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(o=e.uploadedDocuments)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},oe=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{k(null==I?void 0:I.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),_&&L((e=>{var n,a,o,i,r,s,u;let{t:c,action:d,approvers:m,selectedApprover:p,setSelectedApprover:v,selectedBlockReason:f,setBlockReason:E,selectFile:g,uploadedFile:S,setUploadedFile:h,assigneeLabel:_,businessService:y,error:A,blockReasonFiltered:C}=e,b=!1;return"REVOCATE"!=(null==d?void 0:d.action)&&"REJECT"!=(null==d?void 0:d.action)&&"SKIP_PAYMENT"!=d.action&&"SEND_BACK_TO_CITIZEN"!=(null==d?void 0:d.action)&&"APPROVE"!=(null==d?void 0:d.action)||(b=!0),{label:{heading:"WF_"+(null==d?void 0:d.action)+"_APPLICATION",submit:"WF_"+y+"_"+(null==d?void 0:d.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:d.isTerminateState||b||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(n=d.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(a=d.state)||void 0===a?void 0:a.state)?null:c(_||"WF_ROLE_"+(null===(o=d.assigneeRoles)||void 0===o?void 0:o[0])),type:"dropdown",populators:d.isTerminateState||b||"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(i=d.state)||void 0===i?void 0:i.state)||"FORWARD"==(null==d?void 0:d.action)&&"FIELDINSPECTION_PENDING"==(null==d||null===(r=d.state)||void 0===r?void 0:r.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:v,selected:p})},{label:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(s=d.state)||void 0===s?void 0:s.state)?c("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==d?void 0:d.action)&&"PENDINGAPPROVAL"==(null==d||null===(u=d.state)||void 0===u?void 0:u.state)?l.createElement(t.Dropdown,{option:C,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:E,selected:f,isMandatory:!0}):null},{label:c("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+c("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:g,onDelete:()=>{h(null)},message:S?"1 "+c("ES_PT_ACTION_FILEUPLOADED"):c("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:A})}]}]}})({t:h,action:_,approvers:M,selectedApprover:U,setSelectedApprover:H,selectedBlockReason:j,setBlockReason:W,selectFile:X,uploadedFile:G,setUploadedFile:K,businessService:T,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:q,blockReasonFiltered:B}))},[_,M,$,G,q]),_&&R.form?l.createElement(t.Modal,{headerBarMain:l.createElement(te,{label:h(R.label.heading)}),headerBarEnd:l.createElement(le,{onClick:A}),actionCancelLabel:h(R.label.cancel),actionCancelOnSubmit:A,actionSaveLabel:h(R.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Q?{width:"720px"}:{},style:Q?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Q?{paddingLeft:"5px"}:{}},x?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:R.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,o,i,r,s,u,c,d,p,v,f,E,g,S,T,I,O,x,R,L,w,P,M,F;D=m({},D,{documents:ae(),additionalDetails:m({},null===(t=D)||void 0===t?void 0:t.additionalDetails,{fieldinspection_pending:ne(D),pendingapproval:oe(),blockingReason:null==j?void 0:j.name}),workflow:{action:null==_?void 0:_.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(a=N.data)||void 0===a||null===(o=a.processInstances)||void 0===o||null===(i=o[0])||void 0===i||null===(r=i.state)||void 0===r?void 0:r.applicationStatus)?[null==N||null===(s=N.data)||void 0===s||null===(u=s.processInstances)||void 0===u||null===(c=u[0])||void 0===c||null===(d=c.assigner)||void 0===d?void 0:d.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(p=N.data)||void 0===p||null===(v=p.processInstances)||void 0===v||null===(f=v[0])||void 0===f||null===(E=f.state)||void 0===E?void 0:E.applicationStatus)?[null==N||null===(g=N.data)||void 0===g||null===(S=g.processInstances)||void 0===S||null===(T=S[0])||void 0===T||null===(I=T.assigner)||void 0===I?void 0:I.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,varificationDocuments:G?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:G}]:null},action:null==_?void 0:_.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==N||null===(O=N.data)||void 0===O||null===(x=O.processInstances)||void 0===x||null===(R=x[0])||void 0===R||null===(L=R.state)||void 0===L?void 0:L.applicationStatus)?[null==N||null===(w=N.data)||void 0===w||null===(P=w.processInstances)||void 0===P||null===(M=P[0])||void 0===M||null===(F=M.assigner)||void 0===F?void 0:F.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,wfDocuments:G?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:G}]:null});const B=function(e,t,n,l,a,o,i,r,s,u,c,d){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=D)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null===(l=D)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null===(i=D)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null===(u=D)||void 0===u||null===(c=u.additionalDetails)||void 0===c||null===(d=c.selfCertificationCharges)||void 0===d?void 0:d.BPA_GAUSHALA_CHARGES_CESS))){var p,v,f;D.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",D.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",D.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",D.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),D.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==b||null===(p=b.nocData)||void 0===p?void 0:p.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:m({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}});let t={sourceRefId:null==e||null===(v=e[0])||void 0===v||null===(f=v.Noc)||void 0===f?void 0:f.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(y,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,o,i,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let o=[];if(e&&e.map(e=>{var t,n,i,r,s,u,c,d,m,p,v,f;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(i=e.Noc)||void 0===i||null===(r=i.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(u=s.applicationStatus)||void 0===u?void 0:u.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(c=e.Noc)||void 0===c||null===(d=c.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(p=m.applicationStatus)||void 0===p?void 0:p.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(v=e.Noc)||void 0===v?void 0:v.nocType)&&l||"FIRE_NOC"===(null==e||null===(f=e.Noc)||void 0===f?void 0:f.nocType)&&a)&&o.push(e)}),"FIELDINSPECTION_INPROGRESS"==D.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?C({BPA:D},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0}):(A(),alert(h("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else C({BPA:D},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})})}A(),alert(h("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(B&&B.then?B.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:w,formId:"modal-action"})):l.createElement(t.Loader,null)},oe=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ie=()=>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"})),re=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ie,null)),se=e=>{var a,i;let{t:r,action:s,tenantId:u,closeModal:d,submitAction:p,applicationData:v,businessService:f}=e;const{data:E,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[h,_]=(c.useQueryClient(),n.useState({})),[y,A]=n.useState({}),[C,b]=n.useState([]),[D,T]=n.useState({}),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(null),w=!!Digit.Utils.browser.isMobile();function P(e){I(e.target.files[0])}return o.useHistory(),n.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(N){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(N.size>=5242880)L(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=N&&N.type&&!e.test(null==N?void 0:N.type))L(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",N,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?x(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(r("CS_FILE_UPLOAD_ERROR"))})},function(){L(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[N]),n.useEffect(()=>{s&&_((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,assigneeLabel:m,businessService:p,error:v}=e,f=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(f=!0);let E=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(E=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||E?null:a(m||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||E?null:l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:f,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{d(null)},showHint:!0,message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:v})}]}]}})({t:r,action:s,approvers:C,selectedApprover:D,setSelectedApprover:T,selectFile:P,uploadedFile:O,setUploadedFile:x,businessService:f,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:R}))},[s,C,O,R]),s&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(oe,{label:r(h.label.heading)}),headerBarEnd:l.createElement(re,{onClick:d}),actionCancelLabel:r(h.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:r(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:w?{width:"720px"}:{},style:w?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:w?{paddingLeft:"5px"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:h.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),o=(null===(t=v)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=v)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{o.push(e)}),v=m({},v,{workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,documents:O?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==N?void 0:N.name,fileStoreId:O}]:null},documents:o}),p({Noc:v},!1,{isNoc:!0})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)};var ue=function(e,t){return e===t||e!=e&&t!=t},ce=function(e,t){for(var n=e.length;n--;)if(ue(e[n][0],t))return n;return-1},de=Array.prototype.splice;function me(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])}}me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=ce(t,e);return!(n<0||(n==t.length-1?t.pop():de.call(t,n,1),--this.size,0))},me.prototype.get=function(e){var t=this.__data__,n=ce(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return ce(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,l=ce(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var pe,ve=me,fe="object"==typeof k&&k&&k.Object===Object&&k,Ee="object"==typeof self&&self&&self.Object===Object&&self,ge=fe||Ee||Function("return this")(),Se=ge.Symbol,he=Object.prototype,_e=he.hasOwnProperty,ye=he.toString,Ae=Se?Se.toStringTag:void 0,Ce=Object.prototype.toString,be=Se?Se.toStringTag:void 0,De=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":be&&be in Object(e)?function(e){var t=_e.call(e,Ae),n=e[Ae];try{e[Ae]=void 0;var l=!0}catch(e){}var a=ye.call(e);return l&&(t?e[Ae]=n:delete e[Ae]),a}(e):function(e){return Ce.call(e)}(e)},Te=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ne=function(e){if(!Te(e))return!1;var t=De(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Ie=ge["__core-js_shared__"],Oe=(pe=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+pe:"",xe=Function.prototype.toString,Re=function(e){if(null!=e){try{return xe.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Le=/^\[object .+?Constructor\]$/,we=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Te(e)||(t=e,Oe&&Oe in t))&&(Ne(e)?we:Le).test(Re(e));var t}(n)?n:void 0},Me=Pe(ge,"Map"),Fe=Pe(Object,"create"),Be=Object.prototype.hasOwnProperty,ke=Object.prototype.hasOwnProperty;function Ue(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])}}Ue.prototype.clear=function(){this.__data__=Fe?Fe(null):{},this.size=0},Ue.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ue.prototype.get=function(e){var t=this.__data__;if(Fe){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Be.call(t,e)?t[e]:void 0},Ue.prototype.has=function(e){var t=this.__data__;return Fe?void 0!==t[e]:ke.call(t,e)},Ue.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Fe&&void 0===t?"__lodash_hash_undefined__":t,this};var He=Ue,je=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function We(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])}}We.prototype.clear=function(){this.size=0,this.__data__={hash:new He,map:new(Me||ve),string:new He}},We.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},We.prototype.get=function(e){return je(this,e).get(e)},We.prototype.has=function(e){return je(this,e).has(e)},We.prototype.set=function(e,t){var n=je(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var Ve=We;function ze(e){var t=this.__data__=new ve(e);this.size=t.size}ze.prototype.clear=function(){this.__data__=new ve,this.size=0},ze.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ze.prototype.get=function(e){return this.__data__.get(e)},ze.prototype.has=function(e){return this.__data__.has(e)},ze.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ve){var l=n.__data__;if(!Me||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ve(l)}return n.set(e,t),this.size=n.size,this};var Ge=ze,Ke=function(){try{var e=Pe(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),qe=function(e,t,n){"__proto__"==t&&Ke?Ke(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Ye=Object.prototype.hasOwnProperty,$e=function(e,t,n){var l=e[t];Ye.call(e,t)&&ue(l,n)&&(void 0!==n||t in e)||qe(e,t,n)},Ze=function(e,t,n,l){var a=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var r=t[o],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?qe(n,r,s):$e(n,r,s)}return n},Qe=function(e){return null!=e&&"object"==typeof e},Xe=function(e){return Qe(e)&&"[object Arguments]"==De(e)},Je=Object.prototype,et=Je.hasOwnProperty,tt=Je.propertyIsEnumerable,nt=Xe(function(){return arguments}())?Xe:function(e){return Qe(e)&&et.call(e,"callee")&&!tt.call(e,"callee")},lt=Array.isArray,at=function(){return!1},ot=U(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?ge.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||at}),it=/^(?:0|[1-9]\d*)$/,rt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&it.test(e))&&e>-1&&e%1==0&&e<t},st=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},ut={};ut["[object Float32Array]"]=ut["[object Float64Array]"]=ut["[object Int8Array]"]=ut["[object Int16Array]"]=ut["[object Int32Array]"]=ut["[object Uint8Array]"]=ut["[object Uint8ClampedArray]"]=ut["[object Uint16Array]"]=ut["[object Uint32Array]"]=!0,ut["[object Arguments]"]=ut["[object Array]"]=ut["[object ArrayBuffer]"]=ut["[object Boolean]"]=ut["[object DataView]"]=ut["[object Date]"]=ut["[object Error]"]=ut["[object Function]"]=ut["[object Map]"]=ut["[object Number]"]=ut["[object Object]"]=ut["[object RegExp]"]=ut["[object Set]"]=ut["[object String]"]=ut["[object WeakMap]"]=!1;var ct=function(e){return function(t){return e(t)}},dt=U(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&fe.process,o=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=o}),mt=dt&&dt.isTypedArray,pt=mt?ct(mt):function(e){return Qe(e)&&st(e.length)&&!!ut[De(e)]},vt=Object.prototype.hasOwnProperty,ft=function(e,t){var n=lt(e),l=!n&&nt(e),a=!n&&!l&&ot(e),o=!n&&!l&&!a&&pt(e),i=n||l||a||o,r=i?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],s=r.length;for(var u in e)!t&&!vt.call(e,u)||i&&("length"==u||a&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||rt(u,s))||r.push(u);return r},Et=Object.prototype,gt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Et)},St=function(e,t){return function(n){return e(t(n))}},ht=St(Object.keys,Object),_t=Object.prototype.hasOwnProperty,yt=function(e){return null!=e&&st(e.length)&&!Ne(e)},At=function(e){return yt(e)?ft(e):function(e){if(!gt(e))return ht(e);var t=[];for(var n in Object(e))_t.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Ct=Object.prototype.hasOwnProperty,bt=function(e){return yt(e)?ft(e,!0):function(e){if(!Te(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=gt(e),n=[];for(var l in e)("constructor"!=l||!t&&Ct.call(e,l))&&n.push(l);return n}(e)},Dt=U(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?ge.Buffer:void 0,o=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=o?o(n):new e.constructor(n);return e.copy(l),l}}),Tt=function(){return[]},Nt=Object.prototype.propertyIsEnumerable,It=Object.getOwnPropertySymbols,Ot=It?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,o=0,i=[];++l<a;){var r=t[l];Nt.call(e,r)&&(i[o++]=r)}return i}(It(e)))}:Tt,xt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},Rt=St(Object.getPrototypeOf,Object),Lt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)xt(t,Ot(e)),e=Rt(e);return t}:Tt,wt=function(e,t,n){var l=t(e);return lt(e)?l:xt(l,n(e))},Pt=function(e){return wt(e,At,Ot)},Mt=function(e){return wt(e,bt,Lt)},Ft=Pe(ge,"DataView"),Bt=Pe(ge,"Promise"),kt=Pe(ge,"Set"),Ut=Pe(ge,"WeakMap"),Ht=Re(Ft),jt=Re(Me),Wt=Re(Bt),Vt=Re(kt),zt=Re(Ut),Gt=De;(Ft&&"[object DataView]"!=Gt(new Ft(new ArrayBuffer(1)))||Me&&"[object Map]"!=Gt(new Me)||Bt&&"[object Promise]"!=Gt(Bt.resolve())||kt&&"[object Set]"!=Gt(new kt)||Ut&&"[object WeakMap]"!=Gt(new Ut))&&(Gt=function(e){var t=De(e),n="[object Object]"==t?e.constructor:void 0,l=n?Re(n):"";if(l)switch(l){case Ht:return"[object DataView]";case jt:return"[object Map]";case Wt:return"[object Promise]";case Vt:return"[object Set]";case zt:return"[object WeakMap]"}return t});var Kt=Gt,qt=Object.prototype.hasOwnProperty,Yt=ge.Uint8Array,$t=function(e){var t=new e.constructor(e.byteLength);return new Yt(t).set(new Yt(e)),t},Zt=/\w*$/,Qt=Se?Se.prototype:void 0,Xt=Qt?Qt.valueOf:void 0,Jt=Object.create,en=function(){function e(){}return function(t){if(!Te(t))return{};if(Jt)return Jt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),tn=dt&&dt.isMap,nn=tn?ct(tn):function(e){return Qe(e)&&"[object Map]"==Kt(e)},ln=dt&&dt.isSet,an=ln?ct(ln):function(e){return Qe(e)&&"[object Set]"==Kt(e)},on={};on["[object Arguments]"]=on["[object Array]"]=on["[object ArrayBuffer]"]=on["[object DataView]"]=on["[object Boolean]"]=on["[object Date]"]=on["[object Float32Array]"]=on["[object Float64Array]"]=on["[object Int8Array]"]=on["[object Int16Array]"]=on["[object Int32Array]"]=on["[object Map]"]=on["[object Number]"]=on["[object Object]"]=on["[object RegExp]"]=on["[object Set]"]=on["[object String]"]=on["[object Symbol]"]=on["[object Uint8Array]"]=on["[object Uint8ClampedArray]"]=on["[object Uint16Array]"]=on["[object Uint32Array]"]=!0,on["[object Error]"]=on["[object Function]"]=on["[object WeakMap]"]=!1;var rn=function e(t,n,l,a,o,i){var r,s=1&n,u=2&n,c=4&n;if(l&&(r=o?l(t,a,o,i):l(t)),void 0!==r)return r;if(!Te(t))return t;var d=lt(t);if(d){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&qt.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!s)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=Kt(t),p="[object Function]"==m||"[object GeneratorFunction]"==m;if(ot(t))return Dt(t,s);if("[object Object]"==m||"[object Arguments]"==m||p&&!o){if(r=u||p?{}:function(e){return"function"!=typeof e.constructor||gt(e)?{}:en(Rt(e))}(t),!s)return u?function(e,t){return Ze(e,Lt(e),t)}(t,function(e,t){return e&&Ze(t,bt(t),e)}(r,t)):function(e,t){return Ze(e,Ot(e),t)}(t,function(e,t){return e&&Ze(t,At(t),e)}(r,t))}else{if(!on[m])return o?t:{};r=function(e,t,n){var l,a,o=e.constructor;switch(t){case"[object ArrayBuffer]":return $t(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return function(e,t){var n=t?$t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?$t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Zt.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new o;case"[object Symbol]":return Xt?Object(Xt.call(e)):{}}}(t,m,s)}}i||(i=new Ge);var v=i.get(t);if(v)return v;i.set(t,r),an(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,i))}):nn(t)&&t.forEach(function(a,o){r.set(o,e(a,n,l,o,t,i))});var f=d?void 0:(c?u?Mt:Pt:u?bt:At)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(f||t,function(a,o){f&&(a=t[o=a]),$e(r,o,e(a,n,l,o,t,i))}),r},sn=function(e){return rn(e,5)};const un=e=>l.createElement("h1",{className:"heading-m"},e.label),cn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),dn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(cn,null)),mn=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},pn=e=>{var a,o;let{t:i,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:p}=e;const{data:v,isLoading:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,g]=n.useState({}),[h,_]=n.useState({}),[y,A]=n.useState([]),[C,b]=n.useState({}),[D,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),R=window.Digit.Utils.browser.isMobile(),L=window.location.href.includes("/employee");function w(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))x(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",D,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{var e,n,a,o;"DisconnectWSConnection"==(null===(e=d)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=d)||void 0===a||null===(o=a.processInstance)||void 0===o?void 0:o.businessService)?r&&g((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,businessService:p,error:v}=e,f=!0,E=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(f=!1),o.isTerminateState&&(f=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(E=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==p?void 0:p.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:f?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:f?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:f?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},E&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!E,type:"custom",populators:E?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,m({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:w,uploadedFile:N,setUploadedFile:I,businessService:p,error:O})):r&&g((e=>{var n;let{t:a,action:o,approvers:i,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:c,setUploadedFile:d,businessService:m,error:p}=e,v=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(v=!1),o.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:v?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{d(null)},message:c?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:w,uploadedFile:N,setUploadedFile:I,businessService:p,error:O}))},[r,y,N,O]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(un,{label:i(E.label.heading)}),headerBarEnd:l.createElement(dn,{onClick:u}),actionCancelLabel:i(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:R&&L?{width:"100%",height:"auto"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,o,i,u,p,v,f;if(null!==(t=d)&&void 0!==t&&t.isBillAmend){var E,g,S,h,_,y,A,b,T;const t=m({},null===(E=d)||void 0===E||null===(g=E.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=m({},null===(S=d)||void 0===S?void 0:S.billAmendmentDetails,{workflow:{businessId:null===(h=d)||void 0===h||null===(_=h.billAmendmentDetails)||void 0===_?void 0:_.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(y=d)&&void 0!==y&&null!==(A=y.applicationType)&&void 0!==A&&A.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(b=d)&&void 0!==b&&null!==(T=b.applicationType)&&void 0!==T&&T.includes("WATER")?"WS":"SW",assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]:[]}});c({AmendmentUpdate:n})}else{if(d=m({},d,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:[],assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],wfDocuments:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]:null,processInstance:m({},null===(n=d)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:N?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]:[]})}),null!=e&&e.date&&null!==(l=d)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=sn(null==e?void 0:e.date);d.disconnectionExecutionDate=mn(t)}else if(null!=e&&e.date){const t=sn(null==e?void 0:e.date);d.connectionExecutionDate=mn(t)}var I;if("DisconnectWSConnection"==(null===(o=d)||void 0===o||null===(i=o.processInstance)||void 0===i?void 0:i.businessService)||"DisconnectSWConnection"==(null===(u=d)||void 0===u||null===(p=u.processInstance)||void 0===p?void 0:p.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(I=d)||void 0===I?void 0:I.serviceType)?c({WaterConnection:d,disconnectRequest:!0}):c({SewerageConnection:d,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=d)||void 0===v?void 0:v.applicationType))c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(f=d)||void 0===f?void 0:f.applicationType))c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!0});else{var O,x,R,L,w,P,M,F,B,k,U,H,j;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(O=t.value)&&void 0!==O&&O.adhocPenalty&&(d.additionalDetails.adhocPenalty=parseInt(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenalty)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyComment&&(d.additionalDetails.adhocPenaltyComment=(null==t||null===(L=t.value)||void 0===L?void 0:L.adhocPenaltyComment)||""),null!=t&&null!==(w=t.value)&&void 0!==w&&w.adhocPenaltyReason&&(d.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(d.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(B=t.value)&&void 0!==B&&B.adhocRebateComment&&(d.additionalDetails.adhocRebateComment=(null==t||null===(k=t.value)||void 0===k?void 0:k.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(d.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(j=d)||void 0===j?void 0:j.serviceType)?c({WaterConnection:d,disconnectRequest:!1,reconnectRequest:!1}):c({SewerageConnection:d,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},vn=e=>l.createElement("h1",{className:"heading-m"},e.label),fn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),En=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fn,null)),gn=e=>{var a,o;let{t:i,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:p,moduleCode:v}=e;console.log("applicationData",d);const{data:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,g]=n.useState({}),[h,_]=n.useState({}),[y,A]=n.useState([]),[C,b]=n.useState(null),[D,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(!1);function w(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(){x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&g((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:i,action:r,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:w,uploadedFile:N,setUploadedFile:I,businessService:p}))},[r,y,N]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(vn,{label:i(E.label.heading)}),headerBarEnd:l.createElement(En,{onClick:u}),actionCancelLabel:i(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};d.creationReason="CREATE",c({PetRegistrationApplications:[m({},d,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],N&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]),c({PetRegistrationApplications:[m({},d,{workflow:t})]})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},Sn=e=>l.createElement("h1",{className:"heading-m"},e.label),hn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_n=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(hn,null)),yn=e=>{var a,o,i;let{t:r,action:s,closeModal:u,submitAction:c,applicationData:d,businessService:p}=e;const v=Digit.ULBService.getStateId(),{data:f,isLoading:E}=Digit.Hooks.tl.useTradeLicenseMDMS(v,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==f||null===(a=f.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",d);const[g,S]=n.useState({}),[h,_]=n.useState({}),[y,A]=n.useState([]),[C,b]=n.useState(""),[D,T]=n.useState([]),[N,I]=n.useState(null),O=null===(o=d)||void 0===o||null===(i=o.tradeLicenseDetail)||void 0===i?void 0:i.tradeUnits;console.log("tradeUnits",O);const x=n.useMemo(()=>{var e;if(E||!f||!O.length)return[];const t=new Set(O.map(e=>e.tradeType)),n=(null===(e=f.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[E,f,O]);return console.log("years",x),n.useEffect(()=>{s&&S((e=>{let{t:n,action:a,years:o,selectedApprover:i,setSelectedApprover:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==s?void 0:s.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:o,autoComplete:"off",select:r,selected:i})}]}]}})({t:r,action:s,years:x,selectedApprover:C,setSelectedApprover:b,businessService:p}))},[s,x,D,N]),s&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Sn,{label:r(g.label.heading)}),headerBarEnd:l.createElement(_n,{onClick:u}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=d)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a="20"+Number(l)+"-"+(Number(l)+1);d=m({},d,{financialYear:a,action:"INITIATE",additionalDetail:m({},d.additionalDetail,{validityYears:C.length>0?parseInt(C):""})}),c({Licenses:[d]})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},An=e=>l.createElement("h1",{className:"heading-m"},e.label),Cn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),bn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Cn,null)),Dn=e=>{var a,o;let{t:i,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:p,moduleCode:v}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[E,g]=n.useState({}),[h,_]=n.useState({}),[y,A]=n.useState([]),[C,b]=n.useState(null),[D,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(!1);function w(e){L(!0),T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=function(e,t){try{var n=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",D,s)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(){x(i("CS_FILE_UPLOAD_ERROR"))})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,function(e,t){if(L(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),console.log("actyhdesh,jhfsefsef",r,d),n.useEffect(()=>{g((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,approvers:s,selectedApprover:u,setSelectedApprover:c,isUploading:d}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",d),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"name",select:c,selected:u})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:o,onDelete:()=>{r(null)},message:d?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):i?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:i,action:r,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:w,uploadedFile:N,setUploadedFile:I,businessService:p,isUploading:R}))},[r,y,N]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(An,{label:i(E.label.heading)}),headerBarEnd:l.createElement(bn,{onClick:u}),actionCancelLabel:i(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==d||null===(t=d.auditDetails)||void 0===t?void 0:t.createdBy]:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null};N&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:N}]),c({streetVendingDetail:m({},d,{workflow:n})})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},Tn=e=>l.createElement("h1",{className:"heading-m"},e.label),Nn=()=>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"})),In=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Nn,null)),On=e=>{var a,o;let{t:i,action:r,tenantId:s,closeModal:u,submitAction:c,applicationData:d,businessService:p,moduleCode:v}=e;console.log("applicationData",d);const{data:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,g]=n.useState({}),[h,_]=n.useState({}),[y,A]=n.useState([]),[C,b]=n.useState(null),[D,T]=n.useState(null),[N,I]=n.useState(null),[O,x]=n.useState(null),[R,L]=n.useState(!1);function w(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)x(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(i("CS_FILE_UPLOAD_ERROR"))})},function(){x(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+s+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:y,selectedApprover:C,setSelectedApprover:b,selectFile:w,uploadedFile:N,setUploadedFile:I,businessService:p}))},[r,y,N]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tn,{label:i(E.label.heading)}),headerBarEnd:l.createElement(In,{onClick:u}),actionCancelLabel:i(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:i(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:v};N&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,filestoreId:N}]),c({hallsBookingApplication:[m({},d,{workflow:t})]})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},xn=e=>l.createElement("h1",{className:"heading-m"},e.label),Rn=()=>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"})),Ln=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Rn,null)),wn=e=>{var a,i,r;let{t:s,action:u,tenantId:c,closeModal:d,submitAction:p,applicationData:v,businessService:f,moduleCode:E}=e;const{data:g}=Digit.Hooks.useEmployeeSearch(c,{roles:null==u||null===(a=u.roles)||void 0===a||null===(i=a[0])||void 0===i||null===(r=i.map)||void 0===r?void 0:r.call(i,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}),S=o.useHistory(),[h,_]=n.useState({}),[y,A]=n.useState({}),[C,b]=n.useState([]),[D,T]=n.useState(null),[N,I]=n.useState(null);return n.useEffect(()=>{var e;b(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{"INITIATED"===(null==u?void 0:u.state)?S.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):_((e=>{let{t:t,action:n,businessService:l}=e;return console.log("njhsegfdhjsbedwfdwe",n),{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:s,action:u,approvers:C,selectedApprover:D,setSelectedApprover:T,uploadedFile:N,setUploadedFile:I,businessService:f}))},[u,C,N]),u&&h.form?l.createElement(t.Modal,{headerBarMain:l.createElement(xn,{label:s(h.label.heading)}),headerBarEnd:l.createElement(Ln,{onClick:d}),actionCancelLabel:s(h.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:s(h.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:h.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==u?void 0:u.action,comment:null==e?void 0:e.comments,businessService:f,moduleName:E};N&&(t.documents=[]),p({Asset:m({},v,{workflow:t})})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},Pn=e=>null!=e&&e.businessService.includes("PT")?l.createElement(K,e):null!=e&&e.businessService.includes("ptr")?l.createElement(gn,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(Z,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(yn,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(ee,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(ae,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(se,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(pn,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(Dn,e):null!=e&&e.businessService.includes("chb")?l.createElement(On,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(wn,e):void 0;var Mn=function(e,t){return function(){for(var n=new Array(arguments.length),l=0;l<n.length;l++)n[l]=arguments[l];return e.apply(t,n)}},Fn=Object.prototype.toString;function Bn(e){return"[object Array]"===Fn.call(e)}function kn(e){return void 0===e}function Un(e){return null!==e&&"object"==typeof e}function Hn(e){if("[object Object]"!==Fn.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function jn(e){return"[object Function]"===Fn.call(e)}function Wn(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Bn(e))for(var n=0,l=e.length;n<l;n++)t.call(null,e[n],n,e);else for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.call(null,e[a],a,e)}var Vn={isArray:Bn,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Fn.call(e)},isBuffer:function(e){return null!==e&&!kn(e)&&null!==e.constructor&&!kn(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Un,isPlainObject:Hn,isUndefined:kn,isDate:function(e){return"[object Date]"===Fn.call(e)},isFile:function(e){return"[object File]"===Fn.call(e)},isBlob:function(e){return"[object Blob]"===Fn.call(e)},isFunction:jn,isStream:function(e){return Un(e)&&jn(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:Wn,merge:function e(){var t={};function n(n,l){t[l]=Hn(t[l])&&Hn(n)?e(t[l],n):Hn(n)?e({},n):Bn(n)?n.slice():n}for(var l=0,a=arguments.length;l<a;l++)Wn(arguments[l],n);return t},extend:function(e,t,n){return Wn(t,function(t,l){e[l]=n&&"function"==typeof t?Mn(t,n):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function zn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Gn=function(e,t,n){if(!t)return e;var l;if(n)l=n(t);else if(Vn.isURLSearchParams(t))l=t.toString();else{var a=[];Vn.forEach(t,function(e,t){null!=e&&(Vn.isArray(e)?t+="[]":e=[e],Vn.forEach(e,function(e){Vn.isDate(e)?e=e.toISOString():Vn.isObject(e)&&(e=JSON.stringify(e)),a.push(zn(t)+"="+zn(e))}))}),l=a.join("&")}if(l){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+l}return e};function Kn(){this.handlers=[]}Kn.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},Kn.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Kn.prototype.forEach=function(e){Vn.forEach(this.handlers,function(t){null!==t&&e(t)})};var qn=Kn,Yn=function(e,t,n){return Vn.forEach(n,function(n){e=n(e,t)}),e},$n=function(e){return!(!e||!e.__CANCEL__)},Zn=function(e,t){Vn.forEach(e,function(n,l){l!==t&&l.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[l])})},Qn=function(e,t,n,l,a){return function(e,t,n,l,a){return e.config=t,n&&(e.code=n),e.request=l,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,l,a)},Xn=Vn.isStandardBrowserEnv()?{write:function(e,t,n,l,a,o){var i=[];i.push(e+"="+encodeURIComponent(t)),Vn.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),Vn.isString(l)&&i.push("path="+l),Vn.isString(a)&&i.push("domain="+a),!0===o&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Jn=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],el=Vn.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function l(e){var l=e;return t&&(n.setAttribute("href",l),l=n.href),n.setAttribute("href",l),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=l(window.location.href),function(t){var n=Vn.isString(t)?l(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},tl={"Content-Type":"application/x-www-form-urlencoded"};function nl(e,t){!Vn.isUndefined(e)&&Vn.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var ll,al={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(ll=function(e){return new Promise(function(t,n){var l=e.data,a=e.headers;Vn.isFormData(l)&&delete a["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var i=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.Authorization="Basic "+btoa(i+":"+r)}var s,u,c=(u=e.url,(s=e.baseURL)&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(s,u):u);if(o.open(e.method.toUpperCase(),Gn(c,e.params,e.paramsSerializer),!0),o.timeout=e.timeout,o.onreadystatechange=function(){if(o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))){var l,a,i,r,s,u="getAllResponseHeaders"in o?(l=o.getAllResponseHeaders(),s={},l?(Vn.forEach(l.split("\n"),function(e){if(r=e.indexOf(":"),a=Vn.trim(e.substr(0,r)).toLowerCase(),i=Vn.trim(e.substr(r+1)),a){if(s[a]&&Jn.indexOf(a)>=0)return;s[a]="set-cookie"===a?(s[a]?s[a]:[]).concat([i]):s[a]?s[a]+", "+i:i}}),s):s):null;!function(e,t,n){var l=n.config.validateStatus;n.status&&l&&!l(n.status)?t(Qn("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,{data:e.responseType&&"text"!==e.responseType?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:u,config:e,request:o}),o=null}},o.onabort=function(){o&&(n(Qn("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){n(Qn("Network Error",e,null,o)),o=null},o.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(Qn(t,e,"ECONNABORTED",o)),o=null},Vn.isStandardBrowserEnv()){var d=(e.withCredentials||el(c))&&e.xsrfCookieName?Xn.read(e.xsrfCookieName):void 0;d&&(a[e.xsrfHeaderName]=d)}if("setRequestHeader"in o&&Vn.forEach(a,function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete a[t]:o.setRequestHeader(t,e)}),Vn.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),e.responseType)try{o.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&o.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){o&&(o.abort(),n(e),o=null)}),l||(l=null),o.send(l)})}),ll),transformRequest:[function(e,t){return Zn(t,"Accept"),Zn(t,"Content-Type"),Vn.isFormData(e)||Vn.isArrayBuffer(e)||Vn.isBuffer(e)||Vn.isStream(e)||Vn.isFile(e)||Vn.isBlob(e)?e:Vn.isArrayBufferView(e)?e.buffer:Vn.isURLSearchParams(e)?(nl(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Vn.isObject(e)?(nl(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Vn.forEach(["delete","get","head"],function(e){al.headers[e]={}}),Vn.forEach(["post","put","patch"],function(e){al.headers[e]=Vn.merge(tl)});var ol=al;function il(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var rl=function(e){return il(e),e.headers=e.headers||{},e.data=Yn(e.data,e.headers,e.transformRequest),e.headers=Vn.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Vn.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||ol.adapter)(e).then(function(t){return il(e),t.data=Yn(t.data,t.headers,e.transformResponse),t},function(t){return $n(t)||(il(e),t&&t.response&&(t.response.data=Yn(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})},sl=function(e,t){t=t||{};var n={},l=["url","method","data"],a=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function r(e,t){return Vn.isPlainObject(e)&&Vn.isPlainObject(t)?Vn.merge(e,t):Vn.isPlainObject(t)?Vn.merge({},t):Vn.isArray(t)?t.slice():t}function s(l){Vn.isUndefined(t[l])?Vn.isUndefined(e[l])||(n[l]=r(void 0,e[l])):n[l]=r(e[l],t[l])}Vn.forEach(l,function(e){Vn.isUndefined(t[e])||(n[e]=r(void 0,t[e]))}),Vn.forEach(a,s),Vn.forEach(o,function(l){Vn.isUndefined(t[l])?Vn.isUndefined(e[l])||(n[l]=r(void 0,e[l])):n[l]=r(void 0,t[l])}),Vn.forEach(i,function(l){l in t?n[l]=r(e[l],t[l]):l in e&&(n[l]=r(void 0,e[l]))});var u=l.concat(a).concat(o).concat(i),c=Object.keys(e).concat(Object.keys(t)).filter(function(e){return-1===u.indexOf(e)});return Vn.forEach(c,s),n};function ul(e){this.defaults=e,this.interceptors={request:new qn,response:new qn}}ul.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=sl(this.defaults,e)).method=e.method?e.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var t=[rl,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},ul.prototype.getUri=function(e){return e=sl(this.defaults,e),Gn(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Vn.forEach(["delete","get","head","options"],function(e){ul.prototype[e]=function(t,n){return this.request(sl(n||{},{method:e,url:t,data:(n||{}).data}))}}),Vn.forEach(["post","put","patch"],function(e){ul.prototype[e]=function(t,n,l){return this.request(sl(l||{},{method:e,url:t,data:n}))}});var cl=ul;function dl(e){this.message=e}dl.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},dl.prototype.__CANCEL__=!0;var ml=dl;function pl(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new ml(e),t(n.reason))})}pl.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},pl.source=function(){var e;return{token:new pl(function(t){e=t}),cancel:e}};var vl=pl;function fl(e){var t=new cl(e),n=Mn(cl.prototype.request,t);return Vn.extend(n,cl.prototype,t),Vn.extend(n,t),n}var El=fl(ol);El.Axios=cl,El.create=function(e){return fl(sl(El.defaults,e))},El.Cancel=ml,El.CancelToken=vl,El.isCancel=$n,El.all=function(e){return Promise.all(e)},El.spread=function(e){return function(t){return e.apply(null,t)}},El.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var gl=El;function Sl(e){let{documents:n,svgStyles:o={},isSendBackFlow:i=!1,isHrLine:r=!1,titleStyles:s}=e;const{t:u}=a.useTranslation(),c=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!c&&(null==n?void 0:n.map((e,a)=>{var o,c,d;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},u(null==n?void 0:n.title)),i?null!=n&&null!==(o=n.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),i?(null!==(c=value)&&void 0!==c&&null!==(d=c.documentType)&&void 0!==d&&d.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),c&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+u(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}gl.default=El,gl.interceptors.response.use(e=>e,e=>{var t,n;const l=window.location.pathname.split("/").includes("employee");if(null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&n.Errors)for(const t of e.response.data.Errors){var a,o,i,r;t.message.includes("InvalidAccessTokenException")?(localStorage.clear(),sessionStorage.clear(),window.location.href=(l?"/digit-ui/employee/user/login":"/digit-ui/citizen/login")+"?from="+encodeURIComponent(window.location.pathname+window.location.search)):null!=t&&null!==(a=t.message)&&void 0!==a&&null!==(o=a.toLowerCase())&&void 0!==o&&o.includes("internal server error")||null!=t&&null!==(i=t.message)&&void 0!==i&&null!==(r=i.toLowerCase())&&void 0!==r&&r.includes("some error occured")?window.location.href=(l?"/digit-ui/employee/user/error":"/digit-ui/citizen/error")+"?type=maintenance&from="+encodeURIComponent(window.location.pathname+window.location.search):t.message.includes("ZuulRuntimeException")&&(window.location.href=(l?"/digit-ui/employee/user/error":"/digit-ui/citizen/error")+"?type=notfound&from="+encodeURIComponent(window.location.pathname+window.location.search))}throw e}),window.Digit=window.Digit||{},window.Digit=m({},window.Digit,{RequestCache:window.Digit.RequestCache||{}});const hl=e=>{var t,a;let{t:o,formData:i,applicationData:r,docs:s,bpaActionsDetails:u}=e;const c=(null==r?void 0:r.status)||"",d=(null==u||null===(t=u.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[p,v]=n.useState((null==i||null===(a=i.documents)||void 0===a?void 0:a.documents)||[]),[f,E]=n.useState(null),[g,S]=n.useState([]),[h,_]=n.useState(!0),[y,A]=n.useState(!1),[C,b]=n.useState(!1),{isLoading:D,data:T}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:N,data:I}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var o,i;null!=T&&null!==(e=T.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==T||null===(o=T.BPA)||void 0===o||null===(i=o.DocTypeMapping)||void 0===i?void 0:i.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let u=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let o=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==I||null===(t=I["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,o.length);o===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==s||null===(l=s[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;o===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),u.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(u)),S(u)},[!D,!N]),n.useEffect(()=>{let e=0;g.map(t=>{let n=!1;p.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),_("0"!=e&&0!=e||!(p.length>0))},[p,y]),n.useEffect(()=>{b("DOC_VERIFICATION_INPROGRESS"===c&&(null==d?void 0:d.length)>0)},[r,u]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==g?void 0:g.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(_l,{key:t,index:t,document:e,t:o,error:f,setError:E,setDocuments:v,documents:p,setCheckRequiredFields:A,applicationStatus:c,actions:d,bpaTaxDocuments:g,checkEnablingDocs:C}))))};function _l(e){var a,o;let{t:i,document:r,setDocuments:s,documents:u,index:c,bpaTaxDocuments:d,checkEnablingDocs:p}=e;const v=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],f=Digit.ULBService.getStateId(),[E,g]=n.useState(v?m({},v,{active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[S,h]=n.useState(null),[_,y]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[A,C]=n.useState([]);return n.useEffect(()=>{null!=E&&E.code&&s(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==E?void 0:E.code));return 0===(null==_?void 0:_.length)||null===_?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==E?void 0:E.code,fileStoreId:_,documentUid:_,fileName:(null==S?void 0:S.name)||"",id:u?null===(t=u.find(e=>e.documentType===(null==E?void 0:E.code)))||void 0===t?void 0:t.id:void 0}]})},[_,E]),n.useEffect(()=>{try{A.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],A.map(e=>{var t,n,l;null!=E&&E.code&&r.newUploadedDocs.push({documentType:null==E?void 0:E.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),d[c]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)))}catch(e){Promise.reject(e)}},[A,E]),n.useEffect(()=>{},[S]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+i(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(Sl,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),p?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?i(null==r?void 0:r.code)+"* ":""+i(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:i,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:E,optionKey:"i18nKey",select:e=>g(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:f,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&C(l),(a=l[l.length-1])&&h(a.file)})(0,e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function yl(e){let{fiReport:n,isCitizen:o=!1}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(o?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+i("BPA_FI_REPORT")),n.map((e,a)=>{var o,r,s,u,c,d;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+i("BPA_FI_REPORT"):i("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(o=e.date)||void 0===o?void 0:o.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(s=e.date)||void 0===s?void 0:s.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(u=e.questions)||void 0===u?void 0:u.length)&&(null==e||null===(c=e.questions)||void 0===c?void 0:c.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+i(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+i("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(Sl,{documents:(d=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==d?void 0:d.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Al(e){let{t:a,document:o,setNocDocuments:i,setError:r,nocDocuments:s}=e;const u=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)})[0],c=Digit.ULBService.getStateId(),[d,m]=n.useState(),[p,v]=n.useState(null),[f,E]=n.useState(()=>(null==u?void 0:u.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&i(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==o||null===(t=o.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==f?void 0:f.length)||null===f?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==f),{documentType:null==o||null===(t=o.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:f,documentUid:f,fileName:(null==p?void 0:p.name)||""}]})},[f]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=S(function(){return E(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,n,l,o;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?E(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[p]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=o&&o.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:c,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&v(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const Cl=e=>{var a;let{t:o,noc:i,docs:r,isNoc:s,applicationData:u,NOCdata:c,bpaActionsDetails:d}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),p=(null==u?void 0:u.status)||"",v=(null==d||null===(a=d.data)||void 0===a?void 0:a.nextActions)||[],{data:f}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:s}),{data:E}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!s}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[S,h]=n.useState([]),[_,y]=n.useState([]),[A,C]=n.useState(!1),[b,D]=Digit.Hooks.useSessionStorage(null==i?void 0:i.nocType,[]),[T,N]=n.useState(null),I=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;h(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,a=[];var o,r,c,d;l=s?null==f||null===(o=f.NOC)||void 0===o||null===(r=o.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==i?void 0:i.applicationType)&&(null==e?void 0:e.nocType)===(null==i?void 0:i.nocType)):null==E||null===(c=E.BPA)||void 0===c||null===(d=c.DocTypeMapping)||void 0===d?void 0:d.filter(e=>{var t,n;return e.WFState==(null==u?void 0:u.status)&&e.RiskType==(null==u?void 0:u.riskType)&&e.ServiceType==(null==u||null===(t=u.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==i?void 0:i.additionalDetails,applicationStatus:null==i?void 0:i.applicationStatus,appNumberLink:null==i?void 0:i.applicationNo,nocNo:null==i?void 0:i.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==S||S.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),y(m))},[f,S]),n.useEffect(()=>{C("NOC_VERIFICATION_INPROGRESS"===p&&(null==v?void 0:v.length)>0)},[u,d]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:I?""+o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"):o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),c&&c.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:I?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:I?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(Sl,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),A&&(null==_?void 0:_.map((e,t)=>l.createElement(Al,{key:t,document:e,t:o,error:T,setError:N,setNocDocuments:D,nocDocuments:b,checkEnablingDocs:A}))))},bl=e=>{let{permissions:a,t:o}=e;const[i,r,s]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[u,c,d]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const p=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==i?void 0:i.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:p?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==i?void 0:i.map((e,t)=>n===t?m({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==u?void 0:u.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{c(()=>null==u?void 0:u.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:p?"96%":"830px",width:p?"96%":"830px"},style:p?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:p?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...u];t.splice(e,1),c([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:p?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{c([...u,{label:""}])}}))};function Dl(e){let{documents:o,svgStyles:i={},isSendBackFlow:r=!1}=e;const{t:s}=a.useTranslation(),[u,c]=n.useState(()=>[]),[d,m]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==o||o.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),c(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[o]),n.useEffect(()=>{var e;null!=u&&u.length&&"BillAmend"===(null==o||null===(e=o[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(u,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=u&&u.length&&Digit.UploadServices.Filefetch(u,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[u]);const p=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),v=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!v&&(null==o?void 0:o.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:p?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a,o;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:p?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},s(null==e?void 0:e.title)),r?null!=e&&null!==(o=e.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),v&&(null==o?void 0:o.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement("a",{target:"_",href:null===(a=d[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:null!=i&&i.minWidth?null==i?void 0:i.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400"}},""+s(null==e?void 0:e.title))))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}function Tl(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:o}=n,{t:i}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:i("ES_PT_TITLE_TAX_HEADS"),text:i("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==o?void 0:o.map((e,n)=>l.createElement(t.Row,{key:i(e.taxHeadCode),label:i(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==o?void 0:o.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:i("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Nl(e){let{floors:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},o(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},o(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function Il(e){let{owners:n}=e,o={};o=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:i}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let s={marginTop:"19px"},u={position:"relative",padding:"8px"},c={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?s={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(s={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},u={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(s=m({},s,{maxWidth:"950px"}),s=m({},s,{maxWidth:"950px"}),c={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},o.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:s,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?i(null==e?void 0:e.title)+" "+(n+1):i(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:u},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:i(e.title),label:""+i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:c}))}))))})))}const Ol=e=>{var o,i,r,s,u,c,d,m,p,v,f,E,g,h,_,y,A,C,b,D,T,N,I;let{scrutinyDetails:O,paymentsList:x=[],additionalDetails:R,applicationData:L}=e;const w=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==L?void 0:L.status))&&window.location.href.includes("bpa"),[P,M]=n.useState(),[F,B]=n.useState(),[k,U]=n.useState(),H=Digit.ULBService.getStateId(),[j,W]=n.useState(),[V,z]=n.useState(),[G,K]=n.useState([]),[q,Y]=n.useState(),[$,Z]=n.useState(""),[Q,X]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,oe]=n.useState(!1);n.useEffect(()=>{!function(){try{X(null);const e=function(){if(q&&null!=q&&q.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==q||null===(t=q.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(q.size>=2e6)X(ie("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",q,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?K([...G,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):X(ie("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else X(ie("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[q]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(G))},[G]),n.useEffect(()=>{var e,t,n,l,a,o,i;if(null!=R&&null!==(e=R.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==R?void 0:R.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==R||null===(n=R.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==R||null===(l=R.lessAdjustmentFeeFiles[(null==R||null===(a=R.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==R||null===(t=R.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==R||null===(n=R.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),B(null==R||null===(l=R.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==R||null===(a=R.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==R||null===(o=R.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==R||null===(i=R.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),W(null==R?void 0:R.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==R?void 0:R.otherFeesDiscription),K(null==R?void 0:R.lessAdjustmentFeeFiles)},[R]);const{t:ie}=a.useTranslation(),re=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},ie(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?ie(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void ie("NA");return l.createElement(n.Fragment,null,!(null!=O&&O.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==O||null===(o=O.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+ie(""+e.title),text:null!=e&&e.value?re(e)+" "+ie(null==e?void 0:e.isUnit):ie("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+ie(""+e.title),text:re(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},ie(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},ie(null==e?void 0:e.title))),null==O||null===(i=O.permit)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==O||null===(r=O.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!0)}},ie("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{oe(!1)}},ie("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,ie("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:ie("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==R?void 0:R.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:ie("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==R?void 0:R.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==O||null===(s=O.values[0])||void 0===s?void 0:s.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},ie("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},ie("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,ie("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==R||null===(u=R.selfCertificationCharges)||void 0===u?void 0:u.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==R||null===(c=R.selfCertificationCharges)||void 0===c?void 0:c.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==R||null===(d=R.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==R||null===(m=R.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,ie("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,ie("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==R||null===(p=R.selfCertificationCharges)||void 0===p?void 0:p.BPA_DEVELOPMENT_CHARGES)||0,value:P,disabled:!w,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,ie("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==R||null===(v=R.selfCertificationCharges)||void 0===v?void 0:v.BPA_OTHER_CHARGES)||0,value:F,disabled:!w,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(B(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:ie,type:"text",name:"otherChargesDiscription",defaultValue:null==R||null===(f=R.selfCertificationCharges)||void 0===f?void 0:f.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:j,disabled:!w,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:ie,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==R||null===(E=R.selfCertificationCharges)||void 0===E?void 0:E.BPA_LESS_ADJUSMENT_PLOT)||"",value:k,disabled:!w,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==R||null===(t=R.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==R||null===(n=R.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==R||null===(l=R.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==R||null===(a=R.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(k)>0&&w?l.createElement("div",null,l.createElement(t.CardLabel,null,ie("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){z(e.target.files[0]),Y(e.target.files[0])},disabled:!w,onDelete:()=>{z(null),Y("")},message:V?"1 "+ie("FILEUPLOADED"):ie("ES_NO_FILE_SELECTED_LABEL"),error:Q,uploadMessage:$})):null,(null==J||null===(g=J.fileStoreIds)||void 0===g?void 0:g.length)&&parseInt(null==R||null===(h=R.selfCertificationCharges)||void 0===h?void 0:h.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},ie("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(_=J.fileStoreIds)||void 0===_?void 0:_.length)&&parseInt(null==R||null===(y=R.selfCertificationCharges)||void 0===y?void 0:y.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(A=J.fileStoreIds[(null==J||null===(C=J.fileStoreIds)||void 0===C?void 0:C.length)-1])||void 0===A?void 0:A.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:ie("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(P)?parseFloat(P):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==R||null===(b=R.selfCertificationCharges)||void 0===b?void 0:b.BPA_MALBA_CHARGES)+parseFloat(null==R||null===(D=R.selfCertificationCharges)||void 0===D?void 0:D.BPA_LABOUR_CESS)+parseFloat(null==R||null===(T=R.selfCertificationCharges)||void 0===T?void 0:T.BPA_WATER_CHARGES)+parseFloat(null==R||null===(N=R.selfCertificationCharges)||void 0===N?void 0:N.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(k)?parseFloat(k):0))}))),l.createElement("div",null,null==O||null===(I=O.scruntinyDetails)||void 0===I?void 0:I.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+ie(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},ie(null==e?void 0:e.text))))))))},xl=e=>{var o,i,r,s,u;let{edcrDetails:c,applicationData:d}=e;const{t:m}=a.useTranslation(),p=window.Digit.Utils.browser.isMobile(),v=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],f=e=>{const t=e;return(e,n,l)=>e[t]},E=n.useMemo(()=>v.map(e=>({Header:m(""+e.name),accessor:f(e.id),id:e.id})));function g(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,o,i,r,s,u;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.builtUpArea,FloorArea:(null===(i=e.occupancies)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(s=e.occupancies)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function S(e){var t;let n=null==d||null===(t=d.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,o;let t=null===(a=n[e])||void 0===a||null===(o=a.usageCategory)||void 0===o?void 0:o.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==c||null===(o=c.values)||void 0===o?void 0:o.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==c||null===(i=c.subOccupancyTableDetails)||void 0===i||null===(r=i[0])||void 0===r||null===(s=r.value)||void 0===s||null===(u=s.planDetail)||void 0===u?void 0:u.blocks.map((e,n)=>{var a,o,i,r,s;return l.createElement("div",{key:n,style:(null==c||null===(a=c.subOccupancyTableDetails)||void 0===a||null===(o=a[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.planDetail)||void 0===r||null===(s=r.blocks)||void 0===s?void 0:s.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:S(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||p?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:E,getCellProps:e=>({style:{}})})))})))},Rl=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))},Ll=e=>{var o,i,r;let{data:s,OpenImage:u,privacy:c={}}=e;const[d,m]=n.useState(!1),{t:p}=a.useTranslation();return l.createElement("div",null,s.date&&l.createElement("p",null,s.date),l.createElement("p",null,s.name),s.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:s.mobileNumber,privacy:c}),l.createElement("p",null," ")),s.source&&l.createElement("p",null,p("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+s.source.toUpperCase())),s.comment&&l.createElement(Rl,{otherComment:null==s?void 0:s.otherComment,headComment:null==s?void 0:s.comment}),null!=s&&s.wfComment?l.createElement("div",null,null==s||null===(o=s.wfComment)||void 0===o?void 0:o.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("WF_COMMON_COMMENTS")),!d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},p("View More")):null),d&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},p("View Less")))))):null,(null==s||null===(i=s.thumbnailsToShow)||void 0===i||null===(r=i.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,p("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==s?void 0:s.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==s?void 0:s.thumbnailsToShow)}})):null)};function wl(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function Pl(e){let{units:n}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},o(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:""})}:{key:o(e.title),label:o(e.title)+":",text:o(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const Ml=e=>{var o,i,r,s,u;let{wsAdditionalDetails:c}=e;const{t:d}=a.useTranslation();let m=(p=location.search)?(/^[?#]/.test(p)?p.slice(1):p).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var p;const v=null==m?void 0:m.mode;var{connectionDetails:f,plumberDetails:E,roadCuttingDetails:g,roadCuttingAddlDetails:S,activationDetails:h}=(null==c?void 0:c.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==c||null===(o=c.additionalDetails)||void 0===o?void 0:o.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==f?void 0:f.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(i=c.additionalDetails)||void 0===i?void 0:i.plumberDetails)&&"MODIFY"!=v&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==c||null===(r=c.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=v&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==g?void 0:g.map(e=>{var n;return l.createElement("div",{style:(null==g?void 0:g.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==c||null===(s=c.additionalDetails)||void 0===s?void 0:s.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==c||null===(u=c.additionalDetails)||void 0===u?void 0:u.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},d("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==h?void 0:h.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},Fl=[{title:"PT_PENDING_DUES_FROM_EARLIER",value:"Pending dues from earlier"},{title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT",value:"Miscalculation of earlier Assessment"},{title:"PT_ONE_TIME_PENALITY",value:"One time penality"},{title:"PT_OTHERS",value:"Others"}],Bl=[{title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER",value:"Advanced Paid By Citizen Earlier"},{title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO",value:"Rebate provided by commissioner/EO"},{title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN",value:"Additional amount charged from the citizen"},{title:"PT_OTHERS",value:"Others"}],kl=e=>{var o,i,r,s;let{wsAdditionalDetails:u}=e;const{t:c}=a.useTranslation(),[d,p,v]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[f,E,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),S=!(null==u||null===(o=u.additionalDetails)||void 0===o||!o.isPaid),[h,y]=n.useState(!1),[A,C]=n.useState(d||{}),[b,D]=n.useState(null),[T,N]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[I,O]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),x=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(x,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=m({},null==u||null===(e=u.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==d||null===(n=d.billDetails)||void 0===n?void 0:n.length)>0){var o,i,r,s,c,v,f;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==d||null===(o=d.billDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==d||null===(r=d.billDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==d||null===(c=d.billDetails)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.taxAmount)}];O(e),N(null==d||null===(f=d.billDetails)||void 0===f?void 0:f[0])}else p(a),C(a)},[]);let R={};const L=e=>l.createElement("h1",{className:"heading-m"},e.label),w=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(w,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=m({},A);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,o;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(o=n.target)||void 0===o?void 0:o.value)||-1;l[e]=1==t?n.target.value:""}C(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},I&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==I?void 0:I.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+c("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==T?void 0:T.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+c("CS_INBOX_STATUS_FILTER"),text:c(S?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:S?{color:"#00703C"}:{color:"#D4351C"}}))),null!=u&&null!==(i=u.additionalDetails)&&void 0!==i&&i.isAdhocRebate?l.createElement("div",{onClick:e=>{y(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},c("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,h&&l.createElement(t.Modal,{headerBarMain:l.createElement(L,{label:c("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{C(d),y(!1)}}),actionCancelLabel:c("PT_CANCEL"),actionCancelOnSubmit:()=>{C(d),y(!1)},actionSaveLabel:c("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=A&&A.adhocPenalty?Number(null==A?void 0:A.adhocPenalty):0,n=null!=A&&A.adhocRebate?Number(null==A?void 0:A.adhocRebate):0;var l,a;if(t||n)if(n>(null==u||null===(l=u.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))D({isError:!1,isWarning:!0,key:"error",message:c("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var o,i,r,s,d,v,f,g,S,h;const e=null==u||null===(o=u.additionalDetails)||void 0===o||null===(i=o.appDetails)||void 0===i?void 0:i.applicationNo,t=null==u||null===(r=u.additionalDetails)||void 0===r||null===(s=r.appDetails)||void 0===s?void 0:s.tenantId,n=m({},null==u||null===(d=u.additionalDetails)||void 0===d||null===(v=d.appDetails)||void 0===v?void 0:v.additionalDetails,A);u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(f=u.additionalDetails)||void 0===f||null===(g=f.appDetails)||void 0===g?void 0:g.service)?[{applicationNo:e,tenantId:t,waterConnection:u.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:u.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==u||null===(S=u.additionalDetails)||void 0===S||null===(h=S.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,o,i,r,s,u,c,d,m,v,f,g,S;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(f=e.Calculation)||void 0===f||null===(g=f[0])||void 0===g||null===(S=g.taxHeadEstimates)||void 0===S||S.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(o=e.Calculation)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.taxHeadEstimates,"category");const h=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(u=e.Calculation)||void 0===u||null===(c=u[0])||void 0===c?void 0:c.charge},{title:"WS_TAX_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.taxAmount}];E(sn(e.Calculation[0])),N(null==e||null===(v=e.Calculation)||void 0===v?void 0:v[0]),O(h),A.billDetails=null==e?void 0:e.Calculation,p(A),y(!1)}).catch(e=>{var t,n,l,a,o,i;D({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?c(""+(null==e||null===(a=e.response)||void 0===a||null===(o=a.data)||void 0===o||null===(i=o.Errors[0])||void 0===i?void 0:i.code)):c("PT_COMMON_ADD_REBATE_PENALITY")})})}else D({isError:!1,isWarning:!0,key:"warning",message:c("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Fl,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==A?void 0:A.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:c})),"PT_OTHERS"===(null==A||null===(r=A.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==A?void 0:A.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==A?void 0:A.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},c("PT_AD_REBATE")),l.createElement(t.CardLabel,null,c("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Bl,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==A?void 0:A.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:c})),"PT_OTHERS"===(null==A||null===(s=A.adhocRebateReason_data)||void 0===s?void 0:s.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,c("PT_REASON")),l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==A?void 0:A.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:c("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,c("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:c,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==A?void 0:A.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:c("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),b&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==b?void 0:b.isWarning,error:null==b||!b.isWarning,label:c(null==b?void 0:b.message),onClose:()=>{D(!1)},isDleteBtn:!0})))},Ul=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:m({},t),display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},Hl=e=>{let{t:n,userType:a=!1,infoBannerLabel:o="",infoClickLable:i="",infoClickInfoLabel:r="",infoClickInfoLabel1:s=""}=e;a=a||Digit.SessionStorage.get("userType");const u=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:u?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(o))),n(i)+" ",l.createElement(Ul,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(s)))))},jl=e=>{var o,i,r,s,u,c,d;let{wsAdditionalDetails:m}=e;const{t:p}=a.useTranslation(),[v,f]=n.useState(!1),[E,g]=n.useState({}),S=e=>l.createElement("h1",{className:"heading-m"},e.label),h=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),_=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(h,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(o=m.additionalDetails)&&void 0!==o&&o.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),g(t),f(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},p("WS_PAYMENT_VIEW_BREAKUP"))):null,v&&l.createElement(t.Modal,{headerBarMain:l.createElement(S,{label:p("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(_,{onClick:()=>{f(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_APPLICATION_FEE_HEADER")),null==E||null===(i=E.billSlabData)||void 0===i||null===(r=i.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==E?void 0:E.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_SERVICE_FEE_HEADER")),null==E||null===(s=E.billSlabData)||void 0===s||null===(u=s.CHARGES)||void 0===u?void 0:u.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==E?void 0:E.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==E||null===(c=E.billSlabData)||void 0===c||null===(d=c.TAX)||void 0===d?void 0:d.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==E?void 0:E.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},Wl=e=>{let{assessmentData:t,applicationData:i}=e;const r=o.useHistory(),{t:s}=a.useTranslation(),[u,c]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{c(!u)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Assessment History"),l.createElement("span",{style:{fontSize:"1.2em"}},u?"<":">"))),u&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===t.length?l.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Assessments found"):t.map((e,n)=>l.createElement("div",{key:n,className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Date"),l.createElement("span",{style:{flex:"1",color:"black"}},new Date(e.assessmentDate).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-"))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Year"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.financialYear)),l.createElement("div",{className:"assessment-row with-buttons",style:{display:"flex",marginBottom:"8px",justifyContent:"space-between",alignItems:"center"}},l.createElement("div",{style:{display:"flex",gap:"75px"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Assessment Number"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},e.assessmentNumber)),l.createElement("div",{className:"button-group",style:{display:"flex",gap:"10px"}}," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",backgroundColor:"#2947a3",padding:"10px",color:"white"},onClick:()=>{r.push({pathname:"/digit-ui/citizen/pt/property/assessment-details/"+e.assessmentNumber,state:{Assessment:{channel:i.channel,financialYear:e.financialYear,propertyId:e.propertyId,source:i.source},submitLabel:s("PT_REASSESS_PROPERTY_BUTTON"),reAssess:!0}})}},"Re-assess")," ",l.createElement("button",{style:{display:"flex",borderRadius:"8px",border:"1px solid red",padding:"10px"},onClick:()=>alert("You are not allowed to perform this operation!!}")},"Cancel")," ")),n!==t.length-1&&l.createElement("hr",null)))))},Vl=e=>{var t;let{applicationData:a}=e;const[i,r]=n.useState(!1);return o.useHistory(),l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{r(!i)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Application History"),l.createElement("span",{style:{fontSize:"1.2em"}},i?"<":">"))),i&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},l.createElement("div",{className:"assessment-item",style:{marginBottom:"15px"}},l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"100px",marginBottom:"8px"}},l.createElement("span",{style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Number"),l.createElement("span",{style:{flex:"1",color:"black"}},a.acknowldgementNumber)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"132px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Property ID No."),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.propertyId)),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"120px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Application Type"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},"NEW PROPERTY")),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"140px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Creation Date"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},(s=null===(t=a.auditDetails)||void 0===t?void 0:t.createdTime,new Date(s).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}).replace(/ /g,"-")))),l.createElement("div",{className:"assessment-row",style:{display:"flex",gap:"180px",marginBottom:"8px",color:"black"}},l.createElement("span",{className:"label",style:{fontWeight:"bold",minWidth:"60px",color:"black"}},"Status"),l.createElement("span",{className:"value",style:{flex:"1",color:"black"}},a.status)),l.createElement("div",null,l.createElement(o.Link,{to:{pathname:"/digit-ui/citizen/pt/property/application-preview/"+a.acknowldgementNumber,state:{propertyId:a.propertyId}},style:{color:"#2947a3",display:"inline",border:"1px solid",padding:"8px",borderRadius:"8px"}},"View History")))));var s},zl=e=>{let{payments:t}=e;const[a,o]=n.useState(!1);return l.createElement("div",{className:"accordion",style:{width:"100%",margin:"auto",fontFamily:"Roboto, sans-serif",border:"1px solid #ccc",borderRadius:"4px",marginBottom:"10px"}},l.createElement("div",{className:"accordion-header",style:{backgroundColor:"#f0f0f0",padding:"15px",cursor:"pointer"},onClick:()=>{o(!a)}},l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l.createElement("h3",{style:{color:"#0d43a7",fontFamily:"Noto Sans,sans-serif",fontSize:"24px",fontWeight:"500"}},"Payment History"),l.createElement("span",{style:{fontSize:"1.2em"}},a?"<":">"))),a&&l.createElement("div",{className:"accordion-body",style:{padding:" 15px",backgroundColor:"#fff"}},0===(null==t?void 0:t.length)&&l.createElement("div",{style:{color:"red",fontSize:"16px"}},"No Payemnts found")))};function Gl(e){var i,r,s,u,c,d,p,v,f,E,g,S,h,y,A,C,b,D;let{applicationDetails:T,demandData:N,workflowDetails:I,isDataLoading:O,applicationData:x,timelineStatusPrefix:R,showTimeLine:L=!0,statusAttribute:w="status",paymentsList:P,oldValue:M,isInfoLabel:F=!1,propertyId:B,setIsCheck:k,isCheck:U}=e;const{t:H}=a.useTranslation(),j=o.useHistory(),W=Digit.ULBService.getCurrentTenantId(),[V,z]=n.useState(null),[G,K]=n.useState([]),[q,Y]=n.useState(!1),[$,Z]=n.useState();let Q=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");console.log("appl",T);let{data:X}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"egf-master",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e["egf-master"])||void 0===t?void 0:t.FinancialYear}});(null===(i=X)||void 0===i?void 0:i.length)>0&&(X=X.filter((e,t,n)=>t===n.findIndex(t=>t.code===e.code)),X=X.sort((e,t)=>t.endingDate-e.endingDate)),console.log("financial year",X);const J=e=>l.createElement("h1",{className:"heading-m"},e.label),ee=()=>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"})),te=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ee,null));function ne(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}const[le,ae]=n.useState({}),[oe,ie]=n.useState(),[re,se]=n.useState([]);console.log("fetch bill data",le);const[ue,ce]=n.useState({loading:!1,loaded:!1,canLoad:!1});console.log("filtered",re),"ACTIVE"!=(null==x?void 0:x.status)||ue.loading||ue.loaded||ue.canLoad||ce({loading:!1,loaded:!1,canLoad:!0}),null==ue||!ue.canLoad||ue.loading||ue.loaded||(ce({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function o(){console.log("bill Data",i),n(i),l({loading:!1,loaded:!0,canLoad:!0})}let i={};console.log("assessment data",a);const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0){const n=a.Assessments.filter(e=>"ACTIVE"===e.status),l=new Map;n.forEach(e=>{const t=function(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}(e.assessmentDate)+"_"+e.financialYear,n=l.get(t);(!n||e.createdDate>n.createdDate)&&l.set(t,e)}),console.log("grouped",l);const o=Array.from(l.values());return se(o),console.log(o),ie(null==a?void 0:a.Assessments),Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){i=e})}}();return r&&r.then?r.then(o):o()})}catch(e){return Promise.reject(e)}}((null==x?void 0:x.tenantId)||W,null==x?void 0:x.propertyId,ae,ce));const de=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+t.getFullYear()},me=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:de(null==x||null===(a=x.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==x?void 0:x.channel)||""};return l.createElement(Ll,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var o,i,r,s,u,c,d,m,p,v,f,E,g,S,h,y,A,C;const a={uuid:null==e||null===(o=e.assignes)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==T?void 0:T.tenantId,businessIds:null==T?void 0:T.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber"),n}}},b=n[t-1],D={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(s=e.assignes)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.name,mobileNumber:(null==x||null===(c=x.processInstance)||void 0===c||null===(d=c.assignes)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.uuid)===(null==e||null===(p=e.assignes)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.uuid)&&null!=x&&null!==(f=x.processInstance)&&void 0!==f&&null!==(E=f.assignes)&&void 0!==E&&null!==(g=E[0])&&void 0!==g&&g.mobileNumber?null==x||null===(S=x.processInstance)||void 0===S||null===(h=S.assignes)||void 0===h||null===(y=h[0])||void 0===y?void 0:y.mobileNumber:null==e||null===(A=e.assignes)||void 0===A||null===(C=A[0])||void 0===C?void 0:C.mobileNumber,comment:H(null==e?void 0:e.comment),wfComment:b?b.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(Ll,{data:D,OpenImage:ne,privacy:a})}{var b,D,N,I,O;const t={date:de(null==x||null===(b=x.auditDetails)||void 0===b?void 0:b.lastModifiedTime),name:null==e||null===(D=e.assignes)||void 0===D||null===(N=D[0])||void 0===N?void 0:N.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(I=e.assignes)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.mobileNumber};return l.createElement(Ll,{data:t})}},pe=(e,t)=>e?t?e:H(e):H("NA"),ve=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),fe=window.location.href.includes("employee/noc"),Ee=window.location.href.includes("employee/obps"),ge=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ve?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),Se=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?pe(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+H(null==e?void 0:e.isUnit):H("N/A"):null!=e&&e.value?pe(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):H("N/A"),[he,_e]=n.useState(!1);console.log("demand Data arr",N),null==N||N.reduce((e,t)=>e+t.demandInterest,0),null==N||N.reduce((e,t)=>e+t.demandPenality,0),null==N||N.reduce((e,t)=>e+t.collectionTax,0),null==N||N.reduce((e,t)=>e+t.collectionInterest,0),null==N||N.reduce((e,t)=>e+t.collectionPenality,0),null==N||N.reduce((e,t)=>e+t.balanceTax,0),null==N||N.reduce((e,t)=>e+t.balanceInterest,0),null==N||N.reduce((e,t)=>e+t.balancePenality,0);const ye=function(e,t,n){try{if(!window.confirm("Are you sure you want to make this property "+t+"?"))return Promise.resolve();const l=m({},e,{status:t,isactive:"ACTIVE"===t,isinactive:"INACTIVE"===t,creationReason:"STATUS",additionalDetails:m({},e.additionalDetails,{propertytobestatus:t}),workflow:m({},e.workflow,{businessService:"PT.CREATE",action:"OPEN",moduleName:"PT"})});return Promise.resolve(Digit.PTService.updatePT({Property:m({},l)},W,n)).then(function(e){console.log("response from inactive/active",e)})}catch(e){return Promise.reject(e)}},Ae=T.applicationData,Ce=(null==T||null===(r=T.applicationData)||void 0===r?void 0:r.propertyId)||"",be=null==T||null===(s=T.additionalDetails)||void 0===s?void 0:s.propertytobestatus;return console.log("applicationDetails?.applicationDetails",null==T?void 0:T.applicationDetails),console.log("infolabel",F),console.log("assessment details",oe),n.useEffect(()=>{try{Digit.PTService.paymentsearch({tenantId:W,filters:{consumerCodes:B},auth:!0}).then(e=>{K(null==e?void 0:e.Payments),console.log(e)})}catch(e){console.log(e)}},[]),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},F?l.createElement(Hl,{t:H,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==T||null===(u=T.applicationDetails)||void 0===u?void 0:u.map((e,a)=>{var i,r,s,u,c,d,m,p,v,f,E,g,S,h,_,y,A,C,b,D,N,O,x,R,L,w,F,B,j,W,V,z,G,K,q,Y,$,Z,X,J,ee,te;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:ve?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&ve?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},fe?""+H(e.title):H(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},H(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},H(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},H(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},H(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||ve?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i,r;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:H(n.title),label:null!=n&&n.labelComp?"<div>"+H(n.title)+" "+(null==n?void 0:n.labelComp)+"</div>":"t(value.title)",text:l.createElement("img",{src:H(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:H(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},H(null==n?void 0:n.title)))):fe||Ee?""+H(n.title):H(n.title),text:l.createElement("div",null,l.createElement(o.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(r=e.values)||void 0===r?void 0:r.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:ge(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+H(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:H(n.title),label:H(n.title),text:Se(n),last:a===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:ge(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}))})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(Ol,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:P,additionalDetails:null==T||null===(s=T.applicationData)||void 0===s?void 0:s.additionalDetails,applicationData:null==T?void 0:T.applicationData}),(null==T||null===(u=T.applicationData)||void 0===u||null===(c=u.additionalDetails)||void 0===c||null===(d=c.fieldinspection_pending)||void 0===d?void 0:d.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(yl,{fiReport:null==T||null===(p=T.applicationData)||void 0===p||null===(v=p.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors)&&l.createElement(Nl,{floors:null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&l.createElement(Il,{owners:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.owners}),(null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.units)&&l.createElement(Pl,{units:null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units}),(null==e||null===(y=e.additionalDetails)||void 0===y?void 0:y.accessories)&&l.createElement(wl,{units:null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories}),!Q&&(null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.permissions)&&(null==I||null===(b=I.data)||void 0===b||null===(D=b.nextActions)||void 0===D?void 0:D.length)>0&&l.createElement(bl,{applicationData:null==T?void 0:T.applicationData,t:H,permissions:null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.permissions}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(hl,{t:H,applicationData:null==T?void 0:T.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:I})),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.noc)&&l.createElement(Cl,{t:H,isNoc:!0,NOCdata:e.values,applicationData:null==T?void 0:T.applicationData,docs:e.additionalDetails.noc,noc:null===(R=e.additionalDetails)||void 0===R?void 0:R.data,bpaActionsDetails:I}),(null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.scruntinyDetails)&&l.createElement(Ol,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(w=e.additionalDetails)||void 0===w?void 0:w.buildingExtractionDetails)&&l.createElement(Ol,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(F=e.additionalDetails)||void 0===F?void 0:F.subOccupancyTableDetails)&&l.createElement(xl,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==T?void 0:T.applicationData}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.documentsWithUrl)&&l.createElement(Sl,{documents:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documentsWithUrl}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.taxHeadEstimatesCalculation)&&l.createElement(Tl,{taxHeadEstimatesCalculation:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(Ml,{wsAdditionalDetails:e,oldValue:M}),(null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(o.Link,{to:null==e||null===(G=e.additionalDetails)||void 0===G||null===(K=G.redirectUrl)||void 0===K?void 0:K.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(q=e.additionalDetails)||void 0===q||null===(Y=q.redirectUrl)||void 0===Y?void 0:Y.title))),(null==e||null===($=e.additionalDetails)||void 0===$?void 0:$.estimationDetails)&&l.createElement(kl,{wsAdditionalDetails:e,workflowDetails:I}),(null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.estimationDetails)&&l.createElement(jl,{wsAdditionalDetails:e,workflowDetails:I}),"Property Documents"===e.title&&null===(null==e||null===(X=e.additionalDetails)||void 0===X?void 0:X.assessmentDocuments)?l.createElement("p",null,"0"):l.createElement(Dl,{documents:null==e||null===(J=e.additionalDetails)||void 0===J?void 0:J.assessmentDocuments}),"DECLARATION"===e.title&&(null==e||null===(ee=e.additionalDetails)||void 0===ee?void 0:ee.declaration)&&l.createElement("div",null,l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(t.CheckBox,{onChange:e=>{k(e.target.checked)}}),l.createElement("p",null,null==e||null===(te=e.additionalDetails)||void 0===te?void 0:te.declaration)),!1===U&&l.createElement("p",{style:{color:"red"}},H("PT_CHECK_DECLARATION_BOX"))))}),!window.location.href.includes("/assessment-details")&&l.createElement(Wl,{assessmentData:re,applicationData:null==T?void 0:T.applicationData}),!window.location.href.includes("/assessment-details")&&l.createElement(zl,{payments:G}),!window.location.href.includes("/assessment-details")&&l.createElement(Vl,{applicationData:null==T?void 0:T.applicationData}),L&&(null==I||null===(c=I.data)||void 0===c||null===(d=c.timeline)||void 0===d?void 0:d.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==I?void 0:I.isLoading)||O)&&l.createElement(t.Loader,null),!(null!=I&&I.isLoading)&&!O&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},H("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=I&&null!==(p=I.data)&&void 0!==p&&p.timeline&&1===(null==I||null===(v=I.data)||void 0===v||null===(f=v.timeline)||void 0===f?void 0:f.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:H(""+R+(null==I||null===(E=I.data)||void 0===E||null===(g=E.timeline[0])||void 0===g?void 0:g.state)),customChild:me(null==I||null===(S=I.data)||void 0===S?void 0:S.timeline[0],null==I||null===(h=I.data)||void 0===h?void 0:h.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==I||null===(y=I.data)||void 0===y?void 0:y.timeline)&&(null==I||null===(A=I.data)||void 0===A?void 0:A.timeline.slice(0,he?null==I?void 0:I.data.timeline.length:2).map((e,n,a)=>{var o;let i="";var r,s,u,c,d,m;return window.location.href.includes("/obps/")&&(i=null!=I&&null!==(r=I.data)&&void 0!==r&&null!==(s=r.timeline[n-1])&&void 0!==s&&null!==(u=s.state)&&void 0!==u&&u.includes("BACK_FROM")||null!=I&&null!==(c=I.data)&&void 0!==c&&null!==(d=c.timeline[n-1])&&void 0!==d&&null!==(m=d.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:H(""+R+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[w])+i),customChild:me(e,n,null==I||null===(o=I.data)||void 0===o?void 0:o.timeline)}))}))),(null==I||null===(C=I.data)||void 0===C||null===(b=C.timeline)||void 0===b?void 0:b.length)>2&&l.createElement(t.LinkButton,{label:H(he?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{_e(e=>!e)}})))),l.createElement(t.ActionBar,{className:"clear-search-container",style:{display:"block"}},l.createElement(t.SubmitBar,{label:"Make Property Active",style:{flex:1},onSubmit:()=>{window.location.href.includes("/citizen")?alert("Action to activate property is not allowed for citizen"):"INACTIVE"==be?ye(Ae,"ACTIVE",Ce):alert("Property is already active.")}}),l.createElement(t.SubmitBar,{label:"Make Property Inactive",style:{marginLeft:"20px"},onSubmit:()=>{window.location.href.includes("/citizen")?alert("Action to Inactivate property is not allowed for citizen"):"ACTIVE"==be?ye(Ae,"INACTIVE",Ce):alert("Property is already inactive.")}}),l.createElement(t.SubmitBar,{label:"Edit Property",style:{marginLeft:"20px"},onSubmit:()=>{var e;const t=null==T||null===(e=T.applicationData)||void 0===e?void 0:e.propertyId;t&&j.push({pathname:"/digit-ui/employee/pt/edit-application/"+t})}}),l.createElement(t.SubmitBar,{label:"Access Property",style:{marginLeft:"20px"},onSubmit:()=>{Y(!0)}})),V&&l.createElement(t.Toast,{error:V.isError,label:H(V.label),onClose:()=>{z(null)},isDleteBtn:"false"}),q&&l.createElement(t.Modal,{headerBarMain:l.createElement(J,{label:H("PT_FINANCIAL_YEAR_PLACEHOLDER")}),headerBarEnd:l.createElement(te,{onClick:()=>{Y(!1)}}),actionCancelLabel:"Cancel",actionCancelOnSubmit:e=>{console.log("in Print"),Y(!1)},actionSaveLabel:"Access",actionSaveOnSubmit:()=>{console.log("in Apply")},formId:"modal-action",popupStyles:{width:"60%",marginTop:"5px"}},l.createElement(l.Fragment,null,(null===(D=X)||void 0===D?void 0:D.length)>0&&l.createElement(n.Fragment,null,X.map((e,t)=>l.createElement("div",{key:t,style:{marginBottom:"8px"}},l.createElement("label",null,l.createElement("input",{type:"radio",value:e.code,checked:$===e.code,onChange:e=>Z(e.target.value),name:"custom-radio"}),e.name)))))))}function Kl(e){var n,a,o,i,r,s,u,c,d,m,p,v,f,E,g,S,h,_;let{t:y,showToast:A,closeToast:C,businessService:b}=e;if(null!=b&&b.includes("NewTL")||null!=b&&b.includes("TL")||null!=b&&b.includes("EDITRENEWAL")){var D;let e="";switch(null==A||null===(D=A.action)||void 0===D?void 0:D.action){case"SENDBACK":e="error"===(null==A?void 0:A.key)?null==A||null===(n=A.error)||void 0===n?void 0:n.message:y("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==A?void 0:A.key)?null==A||null===(a=A.error)||void 0===a?void 0:a.message:y("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==A?void 0:A.key)?null==A||null===(o=A.error)||void 0===o?void 0:o.message:y("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==A?void 0:A.key)?null==A||null===(i=A.error)||void 0===i?void 0:i.message:y("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==A?void 0:A.key)?null==A||null===(r=A.error)||void 0===r?void 0:r.message:y("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==A?void 0:A.key)?null==A||null===(s=A.error)||void 0===s?void 0:s.message:y("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==A?void 0:A.key)?null==A||null===(u=A.error)||void 0===u?void 0:u.message:y("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==A?void 0:A.key)?null==A||null===(c=A.error)||void 0===c?void 0:c.message:y("ES_"+b+"_"+(null==A||null===(d=A.action)||void 0===d?void 0:d.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:e,onClose:C}))}if(null!=b&&b.includes("BPA")||null!=b&&b.includes("BPA_LOW")||null!=b&&b.includes("BPA_OC")){var T;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=b&&b.includes("BPA_OC")?y(e[1]):y(e[0]),n};let n="";switch(null==A||null===(T=A.action)||void 0===T?void 0:T.action){case"REVOCATE":n="error"===(null==A?void 0:A.key)?null==A||null===(m=A.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(p=A.error)||void 0===p?void 0:p.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==A?void 0:A.key)?null==A||null===(v=A.error)||void 0===v?void 0:v.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==A?void 0:A.key)?null==A||null===(f=A.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==A?void 0:A.key)?null==A||null===(E=A.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(g=A.error)||void 0===g?void 0:g.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==A?void 0:A.key)?null==A||null===(S=A.error)||void 0===S?void 0:S.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==A?void 0:A.key)?null==A||null===(h=A.error)||void 0===h?void 0:h.message:y("ES_"+b+"_"+(null==A||null===(_=A.action)||void 0===_?void 0:_.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:n,onClose:C}))}{var N,I;const e="error"===(null==A?void 0:A.key)?null==A||null===(N=A.error)||void 0===N?void 0:N.message:"ES_"+b+"_"+(null==A||null===(I=A.action)||void 0===I?void 0:I.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:y(e),onClose:C}))}}function ql(e){var o,i,r,s,u,c,d,p,v,f,E,g,S,h,_,y;let{workflowDetails:A,displayMenu:C,onActionSelect:b,setDisplayMenu:D,businessService:T,forcedActionPrefix:N,ActionBarStyle:I={},MenuStyle:O={}}=e;const{t:x}=a.useTranslation();let R=Digit.UserService.getUser();const L=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};R=null==t?void 0:t.value}const w=null===(o=R)||void 0===o||null===(i=o.info)||void 0===i||null===(r=i.roles)||void 0===r?void 0:r.map(e=>e.code);let P=!1,M=!1,F=(null==A||null===(s=A.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(c=u.nextActions)||void 0===c?void 0:c.filter(e=>(null==w?void 0:w.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==A||null===(d=A.data)||void 0===d||null===(p=d.nextActions)||void 0===p?void 0:p.filter(e=>(null==w?void 0:w.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return Digit.Hooks.useClickOutside(L,()=>{D(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(v=F[0])&&void 0!==v&&null!==(f=v.redirectionUrl)&&void 0!==f&&f.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(M=!1,P=!0):(null==F?void 0:F.length)>0&&(M=!0,P=!1),l.createElement(l.Fragment,null,!(null!=A&&A.isLoading)&&M&&!P&&l.createElement(t.ActionBar,{style:m({},I)},C&&(null!=A&&null!==(E=A.data)&&void 0!==E&&null!==(g=E.actionState)&&void 0!==g&&g.nextActions||null!=A&&null!==(S=A.data)&&void 0!==S&&S.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:N||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()),options:F,optionKey:"action",t:x,onSelect:b,style:O}):null,l.createElement(t.SubmitBar,{ref:L,label:x("WF_TAKE_ACTION"),onSubmit:()=>D(!C)})),!(null!=A&&A.isLoading)&&!M&&P&&l.createElement(t.ActionBar,{style:m({},I)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(h=F[0])||void 0===h?void 0:h.action,value:null==F||null===(_=F[0])||void 0===_?void 0:_.action,onClick:e=>{b((null==F?void 0:F[0])||{})}},x((N||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()))+"_"+(null==F||null===(y=F[0])||void 0===y?void 0:y.action)))))}const Yl=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),$l=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Yl,null));function Zl(e){let{action:n,closeWarningPopup:o}=e;const{t:i}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},i("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement($l,{onClick:()=>{o()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,i("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",i("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+i("PT_AMOUNT_DUE"),text:"₹"+i(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:i("ES_PT_COMMON_CANCEL"),onSubmit:o,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:i("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const Ql=e=>{var i,r;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const u=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),{data:p}=Digit.Hooks.obps.useMDMS(d,"BPA",["BlockReason"]),{t:v}=a.useTranslation(),f=o.useHistory();let{id:E}=o.useParams();const[g,h]=n.useState(!1),[_,y]=n.useState(null),[A,C]=n.useState(!1),[b,D]=n.useState(!1),[T,N]=n.useState(!1),{data:I}=Digit.Hooks.obps.useMDMS(d,"BPA",["RiskTypeComputation"]),{applicationDetails:O,demandData:x,totalDemandTax:R,totalBalanceTax:L,showToast:w,setShowToast:P,isLoading:M,isDataLoading:F,applicationData:B,mutate:k,nocMutation:U,workflowDetails:H,id:j,businessService:W,closeToast:V,moduleCode:z,timelineStatusPrefix:G,forcedActionPrefix:K,statusAttribute:q,ActionBarStyle:Y,MenuStyle:$,paymentsList:Z,showTimeLine:Q=!0,oldValue:X,isInfoLabel:J=!1,clearDataDetails:ee,propertyId:te,setIsCheck:ne,isCheck:le}=e;n.useEffect(()=>{w&&H.revalidate()},[w]);const ae=c.useQueryClient(),oe=()=>{y(null),C(!1)};return M||b?l.createElement(t.Loader,null):(console.log("application Details in template",O),l.createElement(l.Fragment,null,M?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(Gl,{applicationDetails:O,demandData:x,id:j,workflowDetails:H,isDataLoading:F,applicationData:B,totalDemandTax:R,totalBalanceTax:L,businessService:W,timelineStatusPrefix:G,statusAttribute:q,paymentsList:Z,showTimeLine:Q,oldValue:X,isInfoLabel:J,propertyId:te,setIsCheck:ne,isCheck:le}),A?l.createElement(Pn,{t:v,action:_,tenantId:u,state:d,id:E,applicationDetails:O,applicationData:null==O?void 0:O.applicationData,closeModal:oe,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,o,i,r,s,u,c,d,p,E,g,h,y,A,C,b,T,N){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(o=a.workflow)||void 0===o||null===(i=o.comment)||void 0===i?void 0:i.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.action)?0==(null==e||null===(u=e.Licenses)||void 0===u||null===(c=u[0])||void 0===c||null===(d=c.additionalDetail)||void 0===d||null===(p=d.validityYears)||void 0===p?void 0:p.length):0==(null==e||null===(E=e.Licenses)||void 0===E||null===(g=E[0])||void 0===g||null===(h=g.comment)||void 0===h?void 0:h.length))||0==(null==e||null===(y=e.WaterConnection)||void 0===y||null===(A=y.comment)||void 0===A?void 0:A.length)||0==(null==e||null===(C=e.SewerageConnection)||void 0===C||null===(b=C.comment)||void 0===b?void 0:b.length)||0==(null==e||null===(T=e.BPA)||void 0===T||null===(N=T.comment)||void 0===N?void 0:N.length)){var I,O;"INITIATE"===(null==e||null===(I=e.Licenses)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.action)?alert(v("Please fill in the validity before submitting")):alert(v("Please fill in the comments before submitting"))}else{const a=function(a,o,i,r,s){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(o=e.BPA)&&void 0!==o&&null!==(i=o.additionalDetails)&&void 0!==i&&i.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(s=r.workflow)||void 0===s?void 0:s.action)){function u(t){if(l)return t;k&&(D(!0),k(e,{onError:(e,t)=>{D(!1),P({key:"error",error:e}),setTimeout(V,5e3)},onSuccess:(e,t)=>{var l,a,o,i,r,s;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),D(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,f.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,f.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(o=n)&&void 0!==o&&o.isNoc&&f.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(i=e.Amendments)||void 0===i?void 0:i.length)>0){var u,c,d,m,p,E,g,S;null!=t&&null!==(u=t.AmendmentUpdate)&&void 0!==u&&null!==(c=u.workflow)&&void 0!==c&&c.action.includes("SEND_BACK")?P({key:"success",label:v("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(d=t.AmendmentUpdate)&&void 0!==d&&null!==(m=d.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?P({key:"success",label:v("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(p=t.AmendmentUpdate)&&void 0!==p&&null!==(E=p.workflow)&&void 0!==E&&E.action.includes("APPROVE")?P({key:"success",label:v("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(S=g.workflow)&&void 0!==S&&S.action.includes("REJECT")&&P({key:"success",label:v("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var h;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(s=e.Licenses[0])&&void 0!==s&&s.applicationNumber)return P({key:"success",action:_}),void f.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(h=e.Licenses[0])||void 0===h?void 0:h.applicationNumber));P({key:"success",action:_}),ee&&setTimeout(ee,3e3),setTimeout(V,5e3),ae.clear(),ae.refetchQueries("APPLICATION_SEARCH")}}})),oe()}D(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(m({},e)));const a=function(){if(!1!==t&&U){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==U?void 0:U.mutateAsync(e)),a=S(function(){return D(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,o,i,r,s,u,c,d,m,p;D(!1);let f=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(o=a[0])&&void 0!==o&&o.code?v(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r||null===(s=r.Errors)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.code):(null==e||null===(c=e.response)||void 0===c||null===(d=c.data)||void 0===d||null===(m=d.Errors)||void 0===m||null===(p=m[0])||void 0===p?void 0:p.message)||e;oe(),P({key:"error",error:{message:f}}),setTimeout(V,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(u):u(a)}alert(v("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==H||null===(i=H.data)||void 0===i?void 0:i.timeline,businessService:W,workflowDetails:H,moduleCode:z,blockReason:null==p||null===(r=p.BPA)||void 0===r?void 0:r.BlockReason}):null,T?l.createElement(Zl,{action:_,workflowDetails:H,businessService:W,isWarningPop:T,closeWarningPopup:()=>{N(!1)}}):null,l.createElement(Kl,{t:v,showToast:w,closeToast:V,businessService:W}),s?l.createElement("div",null,l.createElement(t.SubmitBar,{style:{marginRight:20},label:v("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(u,{applicationNo:null==B?void 0:B.applicationNo})).then(function(e){var t,n,l,a,o,i;const r=Digit.Utils.obps.calculateRiskType(null==I||null===(t=I.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==O||null===(n=O.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==O||null===(o=O.edcrDetails)||void 0===o||null===(i=o.planDetail)||void 0===i?void 0:i.blocks),s={BPA:e.BPA[0]};s.BPA.riskType=r,s.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null},s.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",s.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),s.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const c=function(e,t,n,l,a,o,i,r,c,d,m,p){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==s||null===(e=s.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==s||null===(l=s.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(o=a.selfCertificationCharges)||void 0===o?void 0:o.BPA_LABOUR_CESS)+parseInt(null==s||null===(i=s.BPA)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(c=r.selfCertificationCharges)||void 0===c?void 0:c.BPA_WATER_CHARGES)+parseInt(null==s||null===(d=s.BPA)||void 0===d||null===(m=d.additionalDetails)||void 0===m||null===(p=m.selfCertificationCharges)||void 0===p?void 0:p.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(s,u)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(v("Enterd Less Adjustment amount is invalid"))}();if(c&&c.then)return c.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0})):l.createElement(ql,{workflowDetails:H,displayMenu:g,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa")&&window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]),null!=e&&e.isToast)P({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(V,5e3);else if(null!=e&&e.isWarningPopUp)N(!0);else if(null!=e&&e.redirectionUrll){var a,o,i,r,s;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))f.push(""+(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(s=location)||void 0===s?void 0:s.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.action)){var u,c;f.push(""+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname),{data:null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.state})}else{var d;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))console.log("Got Inside Direct"),C(!0);else{var p,v;f.push({pathname:null===(p=e.redirectionUrl)||void 0===p?void 0:p.pathname,state:m({},null===(v=e.redirectionUrl)||void 0===v?void 0:v.state)})}else C(!0);y(e),h(!1)},setDisplayMenu:h,businessService:W,forcedActionPrefix:K,ActionBarStyle:Y,MenuStyle:$}))))};var Xl=l.memo(()=>{var e,t,i,r;const{t:s}=a.useTranslation(),u=(Digit.Hooks.useStore.getInitData(),Digit.ULBService.getCurrentTenantId()),{id:c}=o.useParams(),[d,m]=n.useState(null),[p,v]=n.useState({}),[f,E]=n.useState(!1),[g,S]=n.useState(!1),[h,_]=n.useState("asset-create"),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetApplicationDetail(s,u,c),{mutate:C}=Digit.Hooks.asset.useASSETApplicationAction(u);let b=Digit.Hooks.useWorkflowDetails({tenantId:(null==A||null===(e=A.applicationData)||void 0===e?void 0:e.tenantId)||u,id:null==A||null===(t=A.applicationData)||void 0===t||null===(i=t.applicationData)||void 0===i?void 0:i.applicationNo,moduleCode:h,role:["ASSET_INITIATOR","ASSET_VERIFIER","ASSET_APPROVER"]});return Digit.Hooks.asset.useASSETSearch({tenantId:u,filters:{applicationNo:c,audit:!0}}),n.useEffect(()=>{A&&v(H.cloneDeep(A))},[A]),n.useEffect(()=>{var e,t,n;null==b||null===(e=b.data)||void 0===e||!e.applicationBusinessService||"asset-create"===(null==b||null===(t=b.data)||void 0===t?void 0:t.applicationBusinessService)&&"asset-create"===h||_(null==b||null===(n=b.data)||void 0===n?void 0:n.applicationBusinessService)},[b.data]),s("AST_REPORT"),l.createElement("div",null,l.createElement(Ql,{applicationDetails:null==p?void 0:p.applicationData,isLoading:y,isDataLoading:y,applicationData:null==p||null===(r=p.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:b,businessService:h,moduleCode:"ASSET",showToast:d,setShowToast:m,closeToast:()=>{m(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const Jl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),ea=(e,t,n,l)=>Jl("LABEL",e,t,n,l),ta=e=>{var n,a,o,i,r,s,u,c,d,m,p,v,f;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,f=e.t,Jl("ACTION",m,p,v,f)),applicationNumber:null==e||null===(i=e.data)||void 0===i||null===(r=i.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:ea((null===(u=e.data)||void 0===u||null===(c=u.Assets)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},na=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),la=(e,t,n,l)=>na("ACTION",e,t,n,l),aa=(e,t,n,l)=>na("LABEL",e,t,n,l),oa=e=>{let{data:n,action:a,isSuccess:o,isEmployee:i,t:r}=e;return l.createElement(t.Banner,{message:la((null==n?void 0:n.assetDisposalStatus)||a,o,i,r),applicationNumber:null==n?void 0:n.disposalId,info:aa((null==n?void 0:n.assetDisposalStatus)||a,o,i,r),successful:o})},ia=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"RETURN")+"_"+e+(n?"":"_ERROR")),ra=(e,t,n,l)=>ia("LABEL",e,t,n,l),sa=e=>{var n,a,o,i,r,s,u,c,d,m,p,v,f;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,f=e.t,ia("ACTION",m,p,v,f)),applicationNumber:null==e||null===(i=e.data)||void 0===i||null===(r=i.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:ra((null===(u=e.data)||void 0===u||null===(c=u.Assets)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},ua=e=>l.createElement("span",{className:"cell-text"},e),ca=e=>l.createElement("span",{className:"sla-cell"},e),da=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],ma=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],pa=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},va=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},fa=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},Ea=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e},ga=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Sa(e){var a,o;let{t:i,document:r,setDocuments:s,setError:u,documents:c,setFormError:d,clearFormErrors:p,config:v,formState:f,comingDataFromAPI:E,id:g}=e;const h=null==c?void 0:c.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],[_,y]=n.useState(h?m({},h,{active:"ACTIVE"===(null==h?void 0:h.status),code:null==h?void 0:h.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[A,C]=n.useState(null),[b,D]=n.useState(()=>(null==h?void 0:h.fileStoreId)||null),[T,N]=n.useState(!1),I=()=>{var e,t;let n=null===(e=f.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(null==r?void 0:r.code)&&(n=n.filter(e=>e!=(null==r?void 0:r.code)),n.length?d(v.key,{type:n}):p(v.key))};return n.useEffect(()=>{null!=_&&_.code&&s(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==_?void 0:_.code));return 0===(null==b?void 0:b.length)||null===b?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==b),{documentType:null==_?void 0:_.code,fileStoreId:b,documentUid:b}]}),T?T&&I():b&&null!=_&&_.code?b&&null!=_&&_.code&&I():(()=>{var e,t;let n=null===(e=f.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(r.code)||(n.push(r.code),d(v.key,{type:n}))})()},[b,_,T]),n.useEffect(()=>{!function(){try{u(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)u(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=S(function(){return D(null),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",A,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?D(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):u(i("CS_FILE_UPLOAD_ERROR"))})},function(){u(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),n.useEffect(()=>{T&&D(null)},[T]),l.createElement("div",{style:{marginBottom:"24px"}},null!=r&&r.hasDropdown?l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i(null==r?void 0:r.code.replaceAll(".","_"))+" *")):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"}),l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:function(e){C(e.target.files[0])},selectedDocument:null==E||null===(o=E[0])||void 0===o?void 0:o.fileStoreId,onDelete:()=>{D(null)},id:g,message:b?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!b}))))}let ha=[];const _a=e=>{let{currentStep:n=1,flow:o=""}=e;const{t:i}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return(e=>{switch(e){case"STAKEHOLDER":ha=[];break;default:ha=["ASSET_GENERAL_DETAILS","AST_DETAILS","AST_ADDRESS_DETAILS","AST_DOCUMENT_DETAILS","AST_SUMMARY"]}})(o),l.createElement("div",{className:"timeline-container",style:r?{}:{maxWidth:"960px",minWidth:"640px",marginRight:"auto",marginLeft:"auto",display:"flex",justifyContent:"center"}},ha.map((e,a,o)=>l.createElement("div",{className:"timeline-checkpoint",key:a},l.createElement("div",{className:"timeline-content"},l.createElement("span",{className:"circle "+(a<=n-1&&"active")},a<n-1?l.createElement(t.TickMark,null):a+1),l.createElement("span",{className:"secondary-color"},i(e))),a<o.length-1&&l.createElement("span",{className:"line "+(a<n-1&&"active")}))))},ya=[{head:"ES_TITILE_OWNER_DETAILS",body:[{route:"info",component:"ServiceDoc",nextStep:"asset-deatils",key:"Documents"},{route:"asset-deatils",component:"NewAssetClassification",withoutLabel:!0,key:"asset",type:"component",nextStep:"assets",hideInEmployee:!0,isMandatory:!0,texts:{header:"ASSET_GENERAL_DETAILS",submitBarLabel:"COMMON_NEXT"}}]},{head:"TITLE_ASSET_DEATIL",body:[{route:"assets",component:"NewAsset",withoutLabel:!0,key:"assetDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:"pincode",texts:{header:"AST_DETAILS",submitBarLabel:"COMMON_NEXT"}}]},{head:"AST_ADDRESS_DETAILS",body:[{route:"pincode",component:"AssetPincode",texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"address",type:"component"},{route:"address",component:"AssetAddress",withoutLabel:!0,texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"COMMON_NEXT"},key:"address",nextStep:"documents",isMandatory:!0,type:"component"}]},{head:"ES_TITILE_DOCUMENT_DETAILS",body:[{route:"documents",component:"NewDocument",withoutLabel:!0,key:"documents",type:"component",nextStep:null,texts:{header:"AST_DOCUMENT_DETAILS",submitBarLabel:"COMMON_NEXT"}}]}];function Aa(e){var a;let{t:o,document:i,setDocuments:r,setError:s,documents:u,formData:c,id:p}=e;const v=null==u?void 0:u.find(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==i?void 0:i.code)}),[f,E]=n.useState(v?m({},v,{active:!0===(null==i?void 0:i.active),code:null==v?void 0:v.documentType}):1===(null==i||null===(a=i.dropdownData)||void 0===a?void 0:a.length)?null==i?void 0:i.dropdownData[0]:{}),[g,S]=n.useState(null),[h,_]=n.useState((null==v?void 0:v.fileStoreId)||null),[y,A]=n.useState((null==c?void 0:c.latitude)||null),[C,b]=n.useState((null==c?void 0:c.longitude)||null),D=e=>new Promise(t=>{d.getData(e,function(){const e=d.getTag(this,"GPSLatitude"),n=d.getTag(this,"GPSLongitude");if(e&&n){const l=T(e),a=T(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null}),"OWNER.ASSETPHOTO"===(null==i?void 0:i.code)&&alert("Please upload a photo with location details")})}),T=e=>e[0]+e[1]/60+e[2]/3600;return n.useEffect(()=>{g&&(g.size>=5242880?s(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")):(_(null),Digit.UploadServices.Filestorage("ASSET",g,Digit.ULBService.getStateId()).then(e=>{var t,n;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?_(e.data.files[0].fileStoreId):s(o("CS_FILE_UPLOAD_ERROR"))}).catch(()=>s(o("CS_FILE_UPLOAD_ERROR")))))},[g,o]),n.useEffect(()=>{null!=f&&f.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==f?void 0:f.code));return h?[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==h),{documentType:null==f?void 0:f.code,fileStoreId:h,documentUid:h,latitude:y,longitude:C}]:t})},[h,f,y,C,r]),l.createElement("div",{style:{marginBottom:"24px"}},(null==i?void 0:i.hasDropdown)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},o(null==i?void 0:i.code.replaceAll(".","_"))+" *")),l.createElement(t.LabelFieldPair,null,l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:e=>{const t=e.target.files[0];S(t),D(t).then(e=>{let{latitude:t,longitude:n}=e;A(t),b(n),"OWNER.ASSETPHOTO"!==(null==i?void 0:i.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{_(null),A(null),b(null)},id:p,message:h?"1 "+o("CS_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!h}))),"OWNER.ASSETPHOTO"===(null==i?void 0:i.code)&&y&&C&&l.createElement("div",{style:{marginTop:"10px",textAlign:"center"}},l.createElement("p",null,l.createElement("strong",null,o("Location Details"),":")),l.createElement("p",null,o("Latitude"),": ",y),l.createElement("p",null,o("Longitude"),": ",C)))}const Ca=e=>{let{jumpTo:n}=e;const{t:i}=a.useTranslation(),r=o.useHistory();return l.createElement(t.LinkButton,{label:i("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(n)}})},ba=e=>{const{t:t}=a.useTranslation();return e.isSuccess?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_SUCCESS"):t("ES_ASSET_RESPONSE_CREATE_ACTION"):e.isLoading?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_PENDING"):t("CS_AST_APPLICATION_PENDING"):e.isSuccess?void 0:window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_FAILED"):t("CS_AST_APPLICATION_FAILED")},Da={padding:"4px 0px",justifyContent:"space-between"},Ta=e=>{var n,a;return l.createElement(t.Banner,{message:ba(e),applicationNumber:null===(n=e.data)||void 0===n||null===(a=n.Assets)||void 0===a?void 0:a[0].applicationNo,info:e.isSuccess?e.t("ES_ASSET_RESPONSE_CREATE_LABEL"):"",successful:e.isSuccess,style:{width:"100%"}})},Na=e=>{var a,r,s,u,c,d,p,v,f;const{assigndetails:E,focusIndex:g,allAssets:S,setassigndetails:h,t:_,config:y,setError:A,clearErrors:C,formState:b,setFocusIndex:D,departNamefromMDMS:T,designationNamefromMDMS:N}=e,[I,O]=n.useState(null),{control:x,formState:R,watch:L,trigger:w}=i.useForm(),P=L(),{errors:M}=R,{id:F}=o.useParams(),B=Digit.ULBService.getCurrentTenantId(),{data:k}=Digit.Hooks.asset.useAssetApplicationDetail(_,B,F),[U,j]=l.useState({});n.useEffect(()=>{H.isEqual(U,P)||(j(m({},P)),h(e=>e.map(e=>e.key&&e.key===E.key?m({},e,P):m({},e))),w())},[P]),n.useEffect(()=>{var e;Object.keys(M).length&&!H.isEqual((null===(e=b.errors[y.key])||void 0===e?void 0:e.type)||{},M)?A(y.key,{type:M}):!Object.keys(M).length&&b.errors[y.key]&&C(y.key)},[M]);const W={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==S?void 0:S.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+_(pa(null==k||null===(a=k.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("AST_DEPARTMENT_LABEL"),text:""+_(pa("COMMON_MASTERS_DEPARTMENT_"+(null==k||null===(s=k.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.department)))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ASSIGNED_USER")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:x,name:"assignedUser",defaultValue:null==E?void 0:E.assignedUser,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==E?void 0:E.key)&&"assignedUser"===g.type,onChange:t=>{e.onChange(t.target.value),D({index:E.key,type:"assignedUser"})},onBlur:t=>{D({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},R.touched.assignedUser?null==M||null===(c=M.assignedUser)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_EMP_CODE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:x,name:"employeeCode",defaultValue:null==E?void 0:E.employeeCode,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==E?void 0:E.key)&&"employeeCode"===g.type,onChange:t=>{e.onChange(t.target.value),D({index:E.key,type:"employeeCode"})},onBlur:t=>{D({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},R.touched.employeeCode?null==M||null===(d=M.employeeCode)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_DESIGNATION")),l.createElement(i.Controller,{control:x,name:"designation",defaultValue:null==E?void 0:E.designation,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:N,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:W},R.touched.designation?null==M||null===(p=M.designation)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ALLOCATED_DEPARTMENT")),l.createElement(i.Controller,{control:x,name:"allocatedDepartment",defaultValue:null==E?void 0:E.allocatedDepartment,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:W},R.touched.allocatedDepartment?null==M||null===(v=M.allocatedDepartment)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_TRANSFER_DATE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:x,name:"transferDate",defaultValue:null==E?void 0:E.transferDate,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:W},R.touched.employeeCode?null==M||null===(f=M.employeeCode)||void 0===f?void 0:f.message:""))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},Ia=e=>{var a,r,s,u,c,d,p,v,f,E,g,S,h,_;const{disposeDetails:y,focusIndex:A,allAssets:C,setdisposeDetails:b,t:D,config:T,setError:N,clearErrors:I,formState:O,setFocusIndex:x}=e,[R,L]=n.useState(null),[w,P]=n.useState(!1),[M,F]=n.useState(""),{control:B,formState:k,watch:U,setValue:j,trigger:W,register:V}=i.useForm(),z=U(),{errors:G}=k,{id:K}=o.useParams(),q=Digit.ULBService.getCurrentTenantId(),[Y,$]=l.useState({}),[Z,Q]=n.useState(null),[X,J]=n.useState(""),[ee,te]=n.useState(""),[ne,le]=n.useState({}),{data:ae}=Digit.Hooks.asset.useAssetApplicationDetail(D,q,K);n.useEffect(()=>{if(ae){var e,t,n,l,a,o;const i=function(e){const t=new Date(1e3*e),n=new Date;return Math.floor((n-t)/864e5)}(null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate);V("currentAgeOfAsset"),V("assetId"),V("lifeOfAsset"),j("currentAgeOfAsset",i),j("assetId",null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.id),j("lifeOfAsset",null==ae||null===(a=ae.applicationData)||void 0===a||null===(o=a.applicationData)||void 0===o?void 0:o.lifeOfAsset)}},[ae]),n.useEffect(()=>{H.isEqual(Y,z)||($(m({},z)),b(e=>e.map(e=>e.key&&e.key===y.key?m({},e,z):m({},e))),W())},[z]),n.useEffect(()=>{var e;Object.keys(G).length&&!H.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},G)?N(T.key,{type:G}):!Object.keys(G).length&&O.errors[T.key]&&I(T.key)},[G]);const oe={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},ie=()=>{P(!w)};n.useEffect(()=>{V("fileStoreId"),X&&j("fileStoreId",X)},[X,V,j]);const re=[{code:"End of Life",i18nKey:"END_OF_LIFE"},{code:"Obsolete(outdated)",i18nKey:"OBSOLETE(OUTDATED)"},{code:"Damaged",i18nKey:"DAMAGED"},{code:"Others",i18nKey:"OTHERS"}];n.useEffect(()=>{Z&&(Z.size>=5242880?(N(D("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),J(null)):(N(""),Digit.UploadServices.Filestorage("ASSET",Z,Digit.ULBService.getStateId()).then(e=>{var t,n;console.log("Upload Response:",e),(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?J(e.data.files[0].fileStoreId):N(D("CS_FILE_UPLOAD_ERROR"))}).catch(()=>N(D("CS_FILE_UPLOAD_ERROR")))))},[Z,D]);const se=e=>{const t=e.target.files[0];if(t){if(t.size>5242880)return void te("File size should not exceed 5MB");Q(t),te("")}};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_NAME"),text:""+D(pa(null==ae||null===(a=ae.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.assetName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_CURRENT_COST"),text:""+D(pa(null==ae||null===(s=ae.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.bookValue))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_LIFE"),text:""+D(pa(null==ae||null===(c=ae.applicationData)||void 0===c||null===(d=c.applicationData)||void 0===d?void 0:d.lifeOfAsset))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_RESIDUAL_LIFE"),text:(()=>{var e,t,n,l;let a=null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate,o=(null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.lifeOfAsset)-(Date.now()-1e3*a)/315576e5;if(o<=0)return"0 years, 0 months, 0 days";let i=Math.floor(o),r=365.25*(o-i);return i+" years, "+Math.floor(r/30.44)+" months, "+Math.round(r%30.44)+" days"})()})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:B,name:"disposalDate",defaultValue:null==y?void 0:y.disposalDate,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(p=G.employeeCode)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_REASON_DISPOSAL")),l.createElement(i.Controller,{control:B,name:"reasonForDisposal",defaultValue:null==y?void 0:y.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:re,optionKey:"i18nKey",t:D})})),l.createElement(t.CardLabelError,{style:oe},k.touched.designation?null==G||null===(v=G.designation)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:B,name:"comments",defaultValue:null==y?void 0:y.comments,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"comments"===A.type,onChange:t=>{e.onChange(t.target.value),x({index:y.key,type:"comments"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.assignedUser?null==G||null===(f=G.assignedUser)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:B,name:"amountReceived",defaultValue:null==y?void 0:y.amountReceived,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"amountReceived"===A.type,onChange:t=>{e.onChange(t.target.value),x({index:y.key,type:"amountReceived"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(E=G.employeeCode)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(i.Controller,{control:B,name:"isAssetDisposedInFacility",defaultValue:null==y?void 0:y.isAssetDisposedInFacility,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:D(" If disposed in facility, amount received will become zero"),onChange:ie,styles:{height:"auto"},value:e.value,checked:!w})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(g=G.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSE_RECIPT")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:B,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onUpload:se,onDelete:()=>{Q(null),e.onChange(null)},message:Z?"1 "+D("CS_ACTION_FILEUPLOADED"):D("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:ee||!Z})}))),w&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:B,name:"purchaserName",defaultValue:null==y?void 0:y.purchaserName,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"purchaserName"===A.type,onChange:t=>{e.onChange(t.target.value),x({index:y.key,type:"purchaserName"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(S=G.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:B,name:"paymentMode",defaultValue:null==y?void 0:y.paymentMode,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"paymentMode"===A.type,onChange:t=>{e.onChange(t.target.value),x({index:y.key,type:"paymentMode"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(h=G.employeeCode)||void 0===h?void 0:h.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:B,name:"receiptNumber",defaultValue:null==y?void 0:y.receiptNumber,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"receiptNumber"===A.type,onChange:t=>{e.onChange(t.target.value),x({index:y.key,type:"receiptNumber"})},onBlur:t=>{x({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:oe},k.touched.employeeCode?null==G||null===(_=G.employeeCode)||void 0===_?void 0:_.message:"")))),(null==R?void 0:R.label)&&l.createElement(t.Toast,{label:null==R?void 0:R.label,onClose:e=>{L(e=>null)}}))},Oa=e=>{var a,r,s,u,c,d,m,p,v;const{maintenanceDetails:f,focusIndex:E,t:g,config:S,setError:h,clearErrors:_,formState:y,setFocusIndex:A}=e,[C,b]=n.useState(null),[D,T]=n.useState(!1),[N,I]=n.useState(""),{control:O,formState:x,watch:R}=i.useForm(),{errors:L}=(R(),x),{id:w}=o.useParams(),P=Digit.ULBService.getCurrentTenantId(),[M,F]=l.useState({}),[B,k]=n.useState(null),[U,j]=n.useState(""),[W,V]=n.useState(""),[z,G]=n.useState({});Digit.Hooks.asset.useAssetApplicationDetail(g,P,w),n.useEffect(()=>{var e;Object.keys(L).length&&!H.isEqual((null===(e=y.errors[S.key])||void 0===e?void 0:e.type)||{},L)?h(S.key,{type:L}):!Object.keys(L).length&&y.errors[S.key]&&_(S.key)},[L]);const K={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},q=[{code:"AMC",i18nKey:"AST_AMC"},{code:"CMC",i18nKey:"AST_CMC"},{code:"OTHER",i18nKey:"AST_OTHER"}];return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"disposalDate",defaultValue:null==f?void 0:f.disposalDate,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:K},x.touched.employeeCode?null==L||null===(a=L.employeeCode)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_TYPE_OF_SERVICE")),l.createElement(i.Controller,{control:O,name:"reasonForDisposal",defaultValue:null==f?void 0:f.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:q,optionKey:"i18nKey",t:g})})),l.createElement(t.CardLabelError,{style:K},x.touched.designation?null==L||null===(r=L.designation)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"comments",defaultValue:null==f?void 0:f.comments,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:E.index===(null==f?void 0:f.key)&&"comments"===E.type,onChange:t=>{e.onChange(t.target.value),A({index:f.key,type:"comments"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},x.touched.assignedUser?null==L||null===(s=L.assignedUser)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"amountReceived",defaultValue:null==f?void 0:f.amountReceived,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:E.index===(null==f?void 0:f.key)&&"amountReceived"===E.type,onChange:t=>{e.onChange(t.target.value),A({index:f.key,type:"amountReceived"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},x.touched.employeeCode?null==L||null===(u=L.employeeCode)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(i.Controller,{control:O,name:"isAssetDisposedInFacility",defaultValue:null==f?void 0:f.isAssetDisposedInFacility,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:g(" If disposed in facility, amount received will become zero"),styles:{height:"auto"},value:e.value,checked:!D})}))),l.createElement(t.CardLabelError,{style:K},x.touched.employeeCode?null==L||null===(c=L.employeeCode)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_SERVICE_UNDER_WARRANTY")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onDelete:()=>{k(null),e.onChange(null)},message:B?"1 "+g("CS_ACTION_FILEUPLOADED"):g("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:W||!B})}))),D&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"purchaserName",defaultValue:null==f?void 0:f.purchaserName,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:E.index===(null==f?void 0:f.key)&&"purchaserName"===E.type,onChange:t=>{e.onChange(t.target.value),A({index:f.key,type:"purchaserName"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},x.touched.employeeCode?null==L||null===(d=L.employeeCode)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"paymentMode",defaultValue:null==f?void 0:f.paymentMode,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:E.index===(null==f?void 0:f.key)&&"paymentMode"===E.type,onChange:t=>{e.onChange(t.target.value),A({index:f.key,type:"paymentMode"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},x.touched.employeeCode?null==L||null===(m=L.employeeCode)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"receiptNumber",defaultValue:null==f?void 0:f.receiptNumber,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:E.index===(null==f?void 0:f.key)&&"receiptNumber"===E.type,onChange:t=>{e.onChange(t.target.value),A({index:f.key,type:"receiptNumber"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},x.touched.employeeCode?null==L||null===(p=L.employeeCode)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:O,name:"employeeCode",defaultValue:null==f?void 0:f.employeeCode,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:E.index===(null==f?void 0:f.key)&&"employeeCode"===E.type,onChange:t=>{e.onChange(t.target.value),A({index:f.key,type:"employeeCode"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},x.touched.employeeCode?null==L||null===(v=L.employeeCode)||void 0===v?void 0:v.message:"")))),(null==C?void 0:C.label)&&l.createElement(t.Toast,{label:null==C?void 0:C.label,onClose:e=>{b(e=>null)}}))},xa=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],Ra=e=>{var a,r,s,u,c,d,p,v,f,E,g,S,h,_,y;const{returndetails:A,allAssets:C,setreturndetails:b,t:D,config:T,setError:N,clearErrors:I,formState:O}=e,[x,R]=n.useState(null),{control:L,formState:w,watch:P,trigger:M}=i.useForm(),F=P(),{errors:B}=w,{id:k}=o.useParams(),U=Digit.ULBService.getCurrentTenantId(),{data:j}=Digit.Hooks.asset.useAssetApplicationDetail(D,U,k),[W,V]=l.useState({});return n.useEffect(()=>{H.isEqual(W,F)||(V(m({},F)),b(e=>e.map(e=>e.key&&e.key===A.key?m({},e,F):m({},e))),M())},[F]),n.useEffect(()=>{var e;Object.keys(B).length&&!H.isEqual((null===(e=O.errors[T.key])||void 0===e?void 0:e.type)||{},B)?N(T.key,{type:B}):!Object.keys(B).length&&O.errors[T.key]&&I(T.key)},[B]),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+D(pa(null==j||null===(a=j.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_ASSIGNED_USER"),text:""+D(pa(null==j||null===(s=j.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u||null===(c=u.assetAssignment)||void 0===c?void 0:c.assignedUserName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_ASSIGNED_DATE"),text:""+D(pa((z=null==j||null===(d=j.applicationData)||void 0===d||null===(p=d.applicationData)||void 0===p||null===(v=p.assetAssignment)||void 0===v?void 0:v.assignedDate,z?new Date(z).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_DESIGNATION"),text:""+D(pa(null==j||null===(f=j.applicationData)||void 0===f||null===(E=f.applicationData)||void 0===E||null===(g=E.assetAssignment)||void 0===g?void 0:g.designation))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_EMP_CODE"),text:""+D(pa(null==j||null===(S=j.applicationData)||void 0===S||null===(h=S.applicationData)||void 0===h||null===(_=h.assetAssignment)||void 0===_?void 0:_.employeeCode))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_RETURN_DATE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:L,name:"returnDate",defaultValue:null==A?void 0:A.returnDate,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},w.touched.employeeCode?null==B||null===(y=B.employeeCode)||void 0===y?void 0:y.message:""))),(null==x?void 0:x.label)&&l.createElement(t.Toast,{label:null==x?void 0:x.label,onClose:e=>{R(e=>null)}}));var z},La=[{head:"ASSET_GENERAL_DETAILS",body:[{component:"EditGeneralDetails",withoutLabel:!0,key:"editAssignDetails",type:"component"}]},{head:"AST_DETAILS",body:[{component:"EditAssetDetails",withoutLabel:!0,key:"editNewAssetDetails",type:"component"}]}],wa=e=>{const t=new Date(1e3*e);return t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")},Pa=e=>{var a,o,r,s,u,c,d,p,v,f,E,g,S,h;const{editAssignDetails:_,focusIndex:y,seteditAssignDetails:A,t:C,config:b,setError:D,clearErrors:T,setFocusIndex:N,menu_Asset:I,asset_type:O,asset_sub_type:x,asset_parent_sub_category:R,departNamefromMDMS:L,financal:w,sourcefinance:P,assetType:M,comingDataFromAPI:F,assetCurrentUsage:B,modeOfAcquisition:k}=e,[U,j]=n.useState(null),{control:W,formState:V,watch:z,trigger:G}=i.useForm(),K=z(),{errors:q}=V,[Y,$]=l.useState({}),Z=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{H.isEqual(Y,K)||($(m({},K)),A(e=>e.map(e=>e.key===_.key?m({},e,K):e)),G())},[K]),n.useEffect(()=>{var e;Object.keys(q).length&&!H.isEqual((null===(e=V.errors[b.key])||void 0===e?void 0:e.type)||{},q)?D(b.key,{type:q}):!Object.keys(q).length&&V.errors[b.key]&&T(b.key)},[q]);const Q={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_FINANCIAL_YEAR")),l.createElement(i.Controller,{control:W,name:"financialYear",defaultValue:Z(null==F?void 0:F.financialYear),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:w,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.financialYear?null==q||null===(a=q.financialYear)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SOURCE_FINANCE")),l.createElement(i.Controller,{control:W,name:"sourceOfFinance",defaultValue:Z(null==F?void 0:F.sourceOfFinance),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:P,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.sourceOfFinance?null==q||null===(o=q.sourceOfFinance)||void 0===o?void 0:o.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY")),l.createElement(i.Controller,{control:W,name:"assetclassification",defaultValue:Z(null==F?void 0:F.assetClassification),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:I,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetclassification?null==q||null===(r=q.assetclassification)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PARENT_CATEGORY")),l.createElement(i.Controller,{control:W,name:"assettype",defaultValue:Z(null==F?void 0:F.assetParentCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:O,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assettype?null==q||null===(s=q.assettype)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SUB_CATEGORY")),l.createElement(i.Controller,{control:W,name:"assetsubtype",defaultValue:Z(null==F?void 0:F.assetCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:x,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetsubtype?null==q||null===(u=q.assetsubtype)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY_SUB_CATEGORY")),l.createElement(i.Controller,{control:W,name:"assetparentsubCategory",defaultValue:Z(null==F?void 0:F.assetSubCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:R,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetparentsubCategory?null==q||null===(c=q.assetparentsubCategory)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_REF_SERIAL_NUM")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"BookPagereference",defaultValue:null==F?void 0:F.assetBookRefNo,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z0-9/-\s]*$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"BookPagereference"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"BookPagereference"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.BookPagereference?null==q||null===(d=q.BookPagereference)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"AssetName",defaultValue:null==F?void 0:F.assetName,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"AssetName"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"AssetName"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.AssetName?null==q||null===(p=q.AssetName)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("ASSET_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"Assetdescription",defaultValue:null==F?void 0:F.description,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"Assetdescription"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"Assetdescription"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.Assetdescription?null==q||null===(v=q.Assetdescription)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_DEPARTMENT")),l.createElement(i.Controller,{control:W,name:"Department",defaultValue:Z("COMMON_MASTERS_DEPARTMENT_"+(null==F?void 0:F.department)),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:!1,select:e.onChange,onBlur:e.onBlur,option:L,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.Department?null==q||null===(f=q.Department)||void 0===f?void 0:f.message:""),l.createElement("br",null),l.createElement(t.CardCaption,null,"Asset Common Details "),l.createElement("br",null),l.createElement("br",null),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_TYPE")),l.createElement(i.Controller,{control:W,name:"assetType",defaultValue:Z(null==F?void 0:F.assetType),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:M,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetType?null==q||null===(E=q.assetType)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_USAGE")),l.createElement(i.Controller,{control:W,name:"assetUsage",defaultValue:Z(null==F?void 0:F.assetUsage),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:B,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetUsage?null==q||null===(g=q.assetUsage)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_MODE_OF_POSSESSION_OR_ACQUISITION")),l.createElement(i.Controller,{control:W,name:"modeOfPossessionOrAcquisition",defaultValue:Z(null==F?void 0:F.modeOfPossessionOrAcquisition),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,disable:!1,onBlur:e.onBlur,option:k,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.modeOfPossessionOrAcquisition?null==q||null===(S=q.modeOfPossessionOrAcquisition)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_DATE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"invoiceDate",defaultValue:wa(null==F?void 0:F.invoiceDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"invoiceDate"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"invoiceDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.Assetdescription?null==q||null===(h=q.Assetdescription)||void 0===h?void 0:h.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"invoiceNumber",defaultValue:null==F?void 0:F.invoiceNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"invoiceNumber"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"invoiceNumber"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_DATE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"purchaseDate",defaultValue:wa(null==F?void 0:F.purchaseDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"purchaseDate"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseDate"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_ORDER")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"purchaseOrderNumber",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"purchaseOrderNumber"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseOrderNumber"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"lifeOfAsset",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"lifeOfAsset"===y.type,onChange:t=>{if(t.target.value.length>3)return alert("Maximum limit is 3 digits only!"),!1;e.onChange(t.target.value),N({index:_.key,type:"lifeOfAsset"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LOCATION_DETAILS")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"location",defaultValue:null==F?void 0:F.location,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"location"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"location"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_COST")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"purchaseCost",defaultValue:null==F?void 0:F.purchaseCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"purchaseCost"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"purchaseCost"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_ACQUISITION_COST")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"acquisitionCost",defaultValue:null==F?void 0:F.acquisitionCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"acquisitionCost"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"acquisitionCost"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_VALUE")),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:W,name:"bookValue",defaultValue:null==F?void 0:F.bookValue,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==_?void 0:_.key)&&"bookValue"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:_.key,type:"bookValue"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{j(e=>null)}}))},Ma=e=>{var a;const{editNewAssetDetails:o,focusIndex:r,seteditAssignDetails:s,t:u,config:c,setError:d,clearErrors:p,setFocusIndex:v,comingDataFromAPI:f}=e;let E=[];const g=Digit.ULBService.getStateId(),S=Digit.ULBService.getCurrentTenantId(),h=Digit.Hooks.useCustomMDMSV2(S,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),_=Digit.Hooks.useCustomMDMSV2(g,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});let y;y=h||_||[],Array.isArray(null===(a=y)||void 0===a?void 0:a.data)&&y.data.length>0?E=y.data.filter(e=>e.assetParentCategory===(null==f?void 0:f.assetParentCategory)||"COMMON"===e.assetParentCategory).map(e=>e.fields).flat().filter(e=>!0===e.active):console.log("combinedData.data is not an array or is empty.");const[A,C]=n.useState(null),{control:b,formState:D,watch:T,trigger:N}=i.useForm(),I=T(),{errors:O}=D,[x,R]=l.useState({});n.useEffect(()=>{H.isEqual(x,I)||(R(m({},I)),s(e=>e.map(e=>e.key===o.key?m({},e,I):e)),N())},[I]),n.useEffect(()=>{var e;Object.keys(O).length&&!H.isEqual((null===(e=D.errors[c.key])||void 0===e?void 0:e.type)||{},O)?d(c.key,{type:O}):!Object.keys(O).length&&D.errors[c.key]&&p(c.key)},[O]);const L={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(l.Fragment,null,E.map((e,n)=>{var a,s,c,d;return l.createElement("div",{key:n},"date"===e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:b,name:e.name,defaultValue:(null==f?void 0:f.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:"date",max:(new Date).toISOString().split("T")[0],autoFocus:r.index===(null==o?void 0:o.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:o.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},D.touched[e.name]?null===(a=O[e.name])||void 0===a?void 0:a.message:"")):"dropdown"==e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement(i.Controller,{control:b,name:e.name,defaultValue:(null==f?void 0:f.additionalDetails[e.name])||"",render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:n.value,select:n.onChange,onBlur:n.onBlur,option:e.options,optionKey:"i18nKey",t:u})})),l.createElement(t.CardLabelError,{style:L},D.touched[e.name]?null===(s=O[e.name])||void 0===s?void 0:s.message:"")):!0===e.addCurrentLocationButton?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:b,name:e.name,defaultValue:(null==f?void 0:f.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==o?void 0:o.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:o.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)},onClick:()=>{var t;t=e.name,"geolocation"in navigator?navigator.geolocation.getCurrentPosition(e=>{const{latitude:n,longitude:l}=e.coords;setAssetDetails(e=>m({},e,{[t]:n+", "+l}))},e=>{console.error("Error getting location:",e)}):alert("Geolocation is not supported by your browser.")}})}))),l.createElement(t.CardLabelError,{style:L},D.touched[e.name]?null===(c=O[e.name])||void 0===c?void 0:c.message:"")):l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(i.Controller,{control:b,name:e.name,defaultValue:null==f?void 0:f.additionalDetails[e.name],rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==o?void 0:o.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:o.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},D.touched[e.name]?null===(d=O[e.name])||void 0===d?void 0:d.message:"")))})))),(null==A?void 0:A.label)&&l.createElement(t.Toast,{label:null==A?void 0:A.label,onClose:e=>{C(e=>null)}}))},Fa=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"EDIT")+"_"+e+(n?"":"_ERROR")),Ba=(e,t,n,l)=>Fa("LABEL",e,t,n,l),ka=e=>{var n,a,o,i,r,s,u,c,d,m,p,v,f;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.applicationStatus)||e.action,p=e.isSuccess,v=e.isEmployee,f=e.t,Fa("ACTION",m,p,v,f)),applicationNumber:null==e||null===(i=e.data)||void 0===i||null===(r=i.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:Ba((null===(u=e.data)||void 0===u||null===(c=u.Assets)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Ua={AssignAssetApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:i}=a.useTranslation(),[r,s]=n.useState(!1),u=o.useHistory(),{id:c}=o.useParams(),{data:d}=Digit.Hooks.asset.useAssetApplicationDetail(i,e,c),[p,v,f]=Digit.Hooks.useSessionStorage("store-data",null),[E,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[h,_,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),y()},[]);const A=da;return l.createElement(t.FormComposer,{heading:i("AST_ASSIGN_ASSET"),isDisabled:!r,label:i("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,o,i,r,s,c,m,p,v,f,E,g,S,h,_,y,A;const C=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.assigndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.transferDate),b={id:null==d||null===(a=d.applicationData)||void 0===a||null===(o=a.applicationData)||void 0===o?void 0:o.id,tenantId:e,applicationNo:null==d||null===(i=d.applicationData)||void 0===i||null===(r=i.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:"",assetApplicaltionNo:"",assetId:"",assignedUserName:null==t||null===(s=t.assigndetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.assignedUser,designation:null==t||null===(m=t.assigndetails)||void 0===m||null===(p=m[0])||void 0===p||null===(v=p.designation)||void 0===v?void 0:v.code,department:null==t||null===(f=t.assigndetails)||void 0===f||null===(E=f[0])||void 0===E||null===(g=E.allocatedDepartment)||void 0===g?void 0:g.code,assignedDate:C,isAssigned:!0,allocatedDepartment:null==t||null===(S=t.assigndetails)||void 0===S||null===(h=S[0])||void 0===h||null===(_=h.allocatedDepartment)||void 0===_?void 0:_.code,employeeCode:null==t||null===(y=t.assigndetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.employeeCode,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/assign-response",{Assets:b})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},DisposeApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[i,r]=n.useState(),{t:s}=a.useTranslation(),[u,c]=n.useState(!1),d=o.useHistory(),{id:p}=o.useParams(),[v,f,E]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,p),Digit.Hooks.useSessionStorage("store-data",null)),[g,h,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),b=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{h(!1),C()},[]),n.useEffect(()=>{if(i){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[i]);const D=ma;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_DISPOSE_ASSET"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:D.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,o,i,u,c,m,p,v,f,E,g,h,_,y,A,C,D,T,N,I,O,x,R,L,w;const P={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(i=t.disposeDetails)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(c=t.disposeDetails)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.currentAgeOfAsset,disposalDate:b(null==t||null===(p=t.disposeDetails)||void 0===p||null===(v=p[0])||void 0===v?void 0:v.disposalDate),reasonForDisposal:null==t||null===(f=t.disposeDetails)||void 0===f||null===(E=f[0])||void 0===E||null===(g=E.reasonForDisposal)||void 0===g?void 0:g.code,amountReceived:fa(null==t||null===(h=t.disposeDetails)||void 0===h||null===(_=h[0])||void 0===_?void 0:_.amountReceived),purchaserName:null==t||null===(y=t.disposeDetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.purchaserName,paymentMode:null==t||null===(C=t.disposeDetails)||void 0===C||null===(D=C[0])||void 0===D?void 0:D.paymentMode,receiptNumber:null==t||null===(T=t.disposeDetails)||void 0===T||null===(N=T[0])||void 0===N?void 0:N.receiptNumber,comments:null==t||null===(I=t.disposeDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"OWNER.RECIEPTPHOTO",fileStoreId:null==t||null===(x=t.disposeDetails)||void 0===x||null===(R=x[0])||void 0===R?void 0:R.fileStoreId,documentUid:null==t||null===(L=t.disposeDetails)||void 0===L||null===(w=L[0])||void 0===w?void 0:w.fileStoreId,latitude:null,longitude:null}]},M=S(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:P})).then(function(e){e&&(console.log("success data is coming"),d.replace("/digit-ui/employee/asset/assetservice/asset-dispose-response",{AssetDisposal:e}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(M&&M.then?M.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{c(!0)}}),i&&l.createElement(t.Toast,{error:i.error,warning:i.warning,label:s(i.label),onClose:()=>{r(null)}}))},MaintenanceApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[i,r]=n.useState(),{t:s}=a.useTranslation(),[u,c]=n.useState(!1),{id:d}=(o.useHistory(),o.useParams()),[p,v,f]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,d),Digit.Hooks.useSessionStorage("store-data",null)),[E,g,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,y,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),C=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{g(!1),A()},[]),n.useEffect(()=>{if(i){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[i]);const b=ga;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_MAINTENANCET_REPAIR"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:b.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,o,i,u,c,d,m,p,v,f,E,g,h,_,y,A,b,D,T,N,I,O,x,R,L;const w={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(i=t.disposeDetails)||void 0===i||null===(u=i[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(c=t.disposeDetails)||void 0===c||null===(d=c[0])||void 0===d?void 0:d.currentAgeOfAsset,disposalDate:C(null==t||null===(m=t.disposeDetails)||void 0===m||null===(p=m[0])||void 0===p?void 0:p.disposalDate),reasonForDisposal:null==t||null===(v=t.disposeDetails)||void 0===v||null===(f=v[0])||void 0===f||null===(E=f.reasonForDisposal)||void 0===E?void 0:E.code,amountReceived:fa(null==t||null===(g=t.disposeDetails)||void 0===g||null===(h=g[0])||void 0===h?void 0:h.amountReceived),purchaserName:null==t||null===(_=t.disposeDetails)||void 0===_||null===(y=_[0])||void 0===y?void 0:y.purchaserName,paymentMode:null==t||null===(A=t.disposeDetails)||void 0===A||null===(b=A[0])||void 0===b?void 0:b.paymentMode,receiptNumber:null==t||null===(D=t.disposeDetails)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.receiptNumber,comments:null==t||null===(N=t.disposeDetails)||void 0===N||null===(I=N[0])||void 0===I?void 0:I.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"OWNER.RECIEPTPHOTO",fileStoreId:null==t||null===(O=t.disposeDetails)||void 0===O||null===(x=O[0])||void 0===x?void 0:x.fileStoreId,documentUid:null==t||null===(R=t.disposeDetails)||void 0===R||null===(L=R[0])||void 0===L?void 0:L.fileStoreId,latitude:null,longitude:null}]},P=S(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:w})).then(function(e){e&&(console.log("success data is coming"),r({error:!1,label:"Asset Dispose Successfully"}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(P&&P.then?P.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{c(!0)}}),i&&l.createElement(t.Toast,{error:i.error,warning:i.warning,label:s(i.label),onClose:()=>{r(null)}}))},AssetDocuments:e=>{var a,i;let{t:r,config:s,onSelect:u,formData:c,setError:d,clearErrors:p,formState:v}=e;const f=Digit.ULBService.getStateId(),[E,g]=n.useState((null==c||null===(a=c.documents)||void 0===a?void 0:a.documents)||[]),[S,h]=n.useState(null),{id:_}=o.useParams(),y=Digit.ULBService.getCurrentTenantId(),{isLoading:A,data:C}=(Digit.Hooks.asset.useAssetApplicationDetail(r,y,_),o.useLocation(),Digit.Hooks.asset.useAssetDocumentsMDMS(f,"ASSET","Documents")),b=null==C||null===(i=C.ASSET)||void 0===i?void 0:i.Documents.map(e=>m({},e,{hasDropdown:!0}));return n.useEffect(()=>{u(s.key,{documents:E,AssetsDocumentLength:null==b?void 0:b.length})},[E]),A?l.createElement(t.Loader,null):l.createElement("div",null,null==b?void 0:b.map((e,t)=>l.createElement(Sa,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:S,setError:h,setDocuments:g,accept:".pdf, .jpeg, .jpg, .png",documents:E,formData:c,setFormError:d,clearFormErrors:p,config:s,formState:v})),S&&l.createElement(t.Toast,{label:S,onClose:()=>h(null),error:!0}))},AssetPincode:e=>{var a;let{t:i,config:r,onSelect:s,formData:u={},userType:c}=e;const d=Digit.Hooks.asset.useTenants(),{pathname:p}=o.useLocation(),v=p.includes("modify"),[f,E]=n.useState(()=>{var e,t,n;return v&&"employee"===c?(null==u||null===(e=u.originalData)||void 0===e||null===(t=e.address)||void 0===t?void 0:t.pincode)||"":(null==u||null===(n=u.address)||void 0===n?void 0:n.pincode)||""}),g=[{label:"AST_PINCODE",type:"text",name:"pincode",validation:{minlength:6,maxlength:7,pattern:"[0-9]+",max:"9999999",title:i("PTR_ADDRESS_PINCODE_INVALID")},style:{width:"50%"}}],[S,h]=n.useState(null),[_,y]=n.useState("");function A(e){E(e.target.value),h(null),y("");let t=Digit.Utils.getPattern("Pincode").test(e.target.value);"employee"===c&&(e.target.value&&!t&&y(i("ERR_DEFAULT_INPUT_FIELD_MSG")),t&&((null==d?void 0:d.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)}))||y(i("PTR_COMMON_PINCODE_NOT_SERVICABLE"))),s(r.key,m({},u.address,{pincode:e.target.value})))}return n.useEffect(()=>{var e;null!=u&&null!==(e=u.address)&&void 0!==e&&e.pincode&&E(u.address.pincode)},[null==u||null===(a=u.address)||void 0===a?void 0:a.pincode]),"employee"===c?null==g?void 0:g.map((e,n)=>l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},i(e.label)),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({key:e.name,style:e.style,value:f,onChange:A},e.validation,{disable:v,autoFocus:v})))),_?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},_):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(_a,{currentStep:3}):null,l.createElement(t.FormStep,{t:i,config:m({},r,{inputs:g}),onSelect:function(e){try{return(null==d?void 0:d.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))}))?s(r.key,{pincode:f}):h("COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},_defaultValues:{pincode:f},onChange:A,onSkip:()=>s(),forcedError:i(S)}))},AssetAddress:e=>{var a;let{t:r,config:s,onSelect:u,userType:c,formData:d}=e;const p=Digit.Hooks.asset.useTenants();let v=Digit.ULBService.getCurrentTenantId();const f=Digit.UserService.getUser().info,{pathname:E}=o.useLocation(),g=E.includes("modify");let S=(null==d?void 0:d.isEditAddress)||!1;g&&(S=!0);const{pincode:h}=(null==d?void 0:d.address)||"",_="EMPLOYEE"===f.type?p.filter(e=>e.code===v):h?p.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==h)}):p,[y,A]=n.useState(()=>{var e;return(null==d||null===(e=d.address)||void 0===e?void 0:e.city)||null}),{data:C}=Digit.Hooks.useBoundaryLocalities(null==y?void 0:y.code,"revenue",{enabled:!!y},r),[b,D]=n.useState(),[T,N]=n.useState();n.useEffect(()=>{if("employee"===c&&g&&null!=b&&b.length){var e,t,n;const l=null==d||null===(e=d.originalData)||void 0===e||null===(t=e.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code,a=null==b?void 0:b.filter(e=>e.code===l)[0];R("locality",a)}},[b]),n.useEffect(()=>{_&&1===_.length&&A(_[0])},[_]),n.useEffect(()=>{if(y&&C){var e,t;let l=C,a=[];var n;null!=d&&null!==(e=d.address)&&void 0!==e&&e.locality&&N(d.address.locality),null!=d&&null!==(t=d.address)&&void 0!==t&&t.pincode&&(a=l.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==d.address.pincode)}),null!=d&&null!==(n=d.address)&&void 0!==n&&n.locality||N()),D(()=>a.length>0?a:l),1===a.length&&N(a[0])}},[y,null==d||null===(a=d.address)||void 0===a?void 0:a.pincode,C]);const{control:I,formState:O,watch:x,setValue:R}=i.useForm(),L=x(),{errors:w}=O,P={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};var M,F;return n.useEffect(()=>{if("employee"===c){let e=Object.keys(L);const t={};e.forEach(e=>{var n;return t[e]=null===(n=d[s.key])||void 0===n?void 0:n[e]}),H.isEqual(L,t)||u(s.key,m({},d[s.key],L))}},[L]),n.useEffect(()=>{},[O]),"employee"===c?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("MYCITY_CODE_LABEL")+" *"),l.createElement(i.Controller,{name:"city",defaultValue:1===(null==_?void 0:_.length)?_[0]:y,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:S||1===(null==_?void 0:_.length),option:_,select:e.onChange,optionKey:"code",onBlur:e.onBlur,t:r})})),l.createElement(t.CardLabelError,{style:P},O.touched.city?null==w||null===(M=w.city)||void 0===M?void 0:M.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("AST_LOCALITY")+" *"),l.createElement(i.Controller,{name:"locality",defaultValue:null,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,option:b,select:e.onChange,onBlur:e.onBlur,optionKey:"i18nkey",t:r,disable:S||!1})})),l.createElement(t.CardLabelError,{style:P},O.touched.locality?null==w||null===(F=w.locality)||void 0===F?void 0:F.message:"")):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(_a,{currentStep:3}):null,l.createElement(t.FormStep,{config:s,onSelect:function(){u(s.key,{city:y,locality:T})},t:r,isDisabled:!T},l.createElement("div",null,l.createElement(t.CardLabel,null,r("MYCITY_CODE_LABEL")+" "),l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{options:_.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:y,optionKey:"i18nKey",onSelect:function(e){N(null),D(null),A(e)},t:r,isPTFlow:!0,disabled:S})),y&&b&&l.createElement(t.CardLabel,null,r("AST_LOCALITY")+" "),y&&b&&l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{dropdownStyle:{paddingBottom:"20px"},isMandatory:s.isMandatory,options:b.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:T,optionKey:"i18nkey",onSelect:function(e){var t;null!=d&&null!==(t=d.address)&&void 0!==t&&t.locality&&(d.address.locality=e),N(e),"employee"===c&&u(s.key,m({},d[s.key],{locality:e}))},t:r,labelKey:"",disabled:S})))))},AssetStreets:e=>{var a,o,r,s,u,c,d,p,v;let{t:f,config:E,onSelect:g,userType:S,formData:h,formState:_,setError:y,clearErrors:A}=e;const[C,b]=n.useState({index:-1,type:""}),[D,T]=n.useState((null==h||null===(a=h.address)||void 0===a?void 0:a.street)||""),[N,I]=n.useState((null==h||null===(o=h.address)||void 0===o?void 0:o.addressLine1)||""),[O,x]=n.useState((null==h||null===(r=h.address)||void 0===r?void 0:r.addressLine2)||""),[R,L]=n.useState((null==h||null===(s=h.address)||void 0===s?void 0:s.landmark)||""),[w,P]=n.useState((null==h||null===(u=h.address)||void 0===u?void 0:u.latitude)||""),[M,F]=n.useState((null==h||null===(c=h.address)||void 0===c?void 0:c.longitude)||""),[B,k]=n.useState((null==h||null===(d=h.address)||void 0===d?void 0:d.doorNo)||""),[U,j]=n.useState(!(null==h||null===(p=h.address)||void 0===p||!p.latitude||null==h||null===(v=h.address)||void 0===v||!v.longitude)),{formState:W,watch:V,setError:z,clearErrors:G,trigger:K}=i.useForm(),q=V(),{errors:Y}=W;return window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useEffect(()=>{K()},[]),n.useEffect(()=>{var e;"employee"===S&&(Object.keys(Y).length&&!H.isEqual((null===(e=_.errors[E.key])||void 0===e?void 0:e.type)||{},Y)?y(E.key,{type:Y}):!Object.keys(Y).length&&_.errors[E.key]&&A(E.key))},[Y]),n.useEffect(()=>{const e=Object.keys(q),t={};if(e.forEach(e=>{var n;return t[e]=null===(n=h[E.key])||void 0===n?void 0:n[e]}),!H.isEqual(q,t)){g(E.key,m({},h[E.key],q));for(let e in q)q[e]||null!=W&&W.errors[e]?q[e]&&W.errors[e]&&G([e]):z(e,{type:e.toUpperCase()+"_REQUIRED",message:f("CORE_COMMON_REQUIRED_ERRMSG")});K()}},[q]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(_a,{currentStep:3}):null,l.createElement(t.FormStep,{config:m({},E),onSelect:e=>{((e,t)=>{g(e,{street:D,doorNo:B,addressLine1:N,addressLine2:O,landmark:R,latitude:w,longitude:M})})(E.key)},onSkip:()=>g(),isDisabled:"",t:f},l.createElement(t.CardLabel,null,""+f("AST_STREET")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"street",onChange:e=>T(e.target.value),value:D,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_DOOR_NO")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"doorNo",onChange:e=>k(e.target.value),style:{width:"50%"},value:B,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_ADDRESS_LINE_1")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"addressLine1",onChange:e=>I(e.target.value),value:N,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_ADDRESS_LINE_2")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"addressLine2",onChange:e=>x(e.target.value),style:{width:"50%"},value:O,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_LANDMARK")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"landmark",onChange:e=>L(e.target.value),value:R,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),U&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,""+f("AST_LATITUDE")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"latitude",onChange:e=>P(e.target.value),style:{width:"50%"},value:w,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+f("AST_LONGITUDE")),l.createElement(t.TextInput,{t:f,type:"text",optionKey:"i18nKey",name:"longitude",onChange:e=>F(e.target.value),value:M,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:f("AST_FETCH_LOCATION"),onSubmit:()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;P(t),F(n),j(!0)},e=>{console.error("Error Code = "+e.code+" - "+e.message)}):console.error("Geolocation is not supported by this browser.")},disabled:U}),l.createElement("br",null)))},ServiceDoc:e=>{var n;let{t:a,config:o,onSelect:i}=e;Digit.ULBService.getCurrentTenantId();const r=Digit.ULBService.getStateId();sessionStorage.removeItem("docReqScreenByBack");const s=null!=o&&o.isMutation?["MutationDocuments"]:"Documents",{isLoading:u,data:c={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(r,"ASSET",s);let d=null==c||null===(n=c.ASSET)||void 0===n?void 0:n.Documents;return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement("div",null,l.createElement(t.CardSubHeader,null,a("AST_REQ_SCREEN_LABEL")),l.createElement(t.CardText,{style:{color:"red"}},a("AST_DOCUMENT_ACCEPTED_PDF_JPG_PNG")),l.createElement("div",null,u&&l.createElement(t.Loader,null),Array.isArray(d)?d.map(null!=o&&o.isMutation?(e,n)=>{let{code:o,dropdownData:i}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(o)),l.createElement(t.CardText,{className:"primaryColor"},i.map(e=>a(null==e?void 0:e.code)).join(", ")))}:(e,n)=>{let{code:o,dropdownData:i}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(Ea(o,".","_"))),i.map((e,n)=>l.createElement(t.CardText,{className:"primaryColor"},""+(n+1),". ",a(Ea(null==e?void 0:e.code,".","_")))))}):null)),l.createElement("span",null,l.createElement(t.SubmitBar,{label:a("COMMON_NEXT"),onSubmit:i}))))},AssetCreateNew:e=>{var t,n,i,r;const s=c.useQueryClient(),u=o.useRouteMatch(),{t:d}=a.useTranslation(),{pathname:p}=o.useLocation(),v=o.useHistory();Digit.ULBService.getStateId();let f=[];const[E,g,S]=Digit.Hooks.useSessionStorage("Asset_Test",{});function h(e,t,n,l,a){if(void 0===a&&(a=!1),"owners"===e){let n=E.owners||[];n[l]=t,g(m({},E,{[e]:[...n]}))}else if("units"===e){let e=E.units||[];e=t,g(m({},E,{units:e}))}else g(m({},E,{[e]:m({},E[e],t)}));((e,t,n,l)=>{let a,o=p.split("/").pop(),i=o.charAt(o.length-1),r=!1;Number(parseInt(o))||"0"==o||"-1"==o?"-1"==o||"-2"==o?(o=p.slice(0,-3),o=o.split("/").pop(),r=!0):(o=p.slice(0,-2),o=o.split("/").pop(),r=!0):r=!1,isNaN(i)||(r=!0);let{nextStep:s={}}=f.find(e=>e.route===(o||"0")),c=v.push;if(e&&(c=v.replace),n&&(s=l),null===s)return c(u.path+"/check");a=isNaN(s.split("/").pop())&&r&&"map"!==s?u.path+"/"+s+"/"+t:u.path+"/"+s,c(a)})(n,l,a,e)}E&&Object.keys(E).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(S(),s.invalidateQueries("AST_CREATE"));const _=()=>{},y=()=>{};ya.forEach(e=>{f=f.concat(e.body.filter(e=>!e.hideInCitizen))}),f.indexRoute="info";const A=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("ASTCheckPage"),C=null===(i=Digit)||void 0===i||null===(r=i.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NewResponse");return l.createElement(o.Switch,null,f.map((e,t)=>{const{component:n,texts:a,inputs:i,key:r}=e,s="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return l.createElement(o.Route,{path:u.path+"/"+e.route,key:t},l.createElement(s,{config:{texts:a,inputs:i,key:r},onSelect:h,onSkip:_,t:d,formData:E,onAdd:y}))}),l.createElement(o.Route,{path:u.path+"/check"},l.createElement(A,{onSubmit:function(){try{return v.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:E})),l.createElement(o.Route,{path:u.path+"/acknowledgement"},l.createElement(C,{data:E,onSuccess:()=>{S(),s.invalidateQueries("AST_CREATE")}})),l.createElement(o.Route,null,l.createElement(o.Redirect,{to:u.path+"/"+f.indexRoute})))},NewAssetClassification:e=>{var a,r,s,u,c,d,p,v,f,E,g,S;let{t:h,config:_,onSelect:y,userType:A,formData:C}=e;const{control:b}=i.useForm();o.useLocation();let D={};const T=(()=>{const e=new Date,t=e.getFullYear();return e.getMonth()+1>=4?t+"-"+(t+1):t-1+"-"+t})(),[N,I]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetclassification||(null==C||null===(a=C.asset)||void 0===a?void 0:a.assetclassification)||""),[O,x]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assettype||(null==C||null===(r=C.asset)||void 0===r?void 0:r.assettype)||""),[R,L]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsubtype||(null==C||null===(s=C.asset)||void 0===s?void 0:s.assetsubtype)||""),[w,P]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetparentsubCategory||(null==C||null===(u=C.asset)||void 0===u?void 0:u.assetparentsubCategory)||""),[M,F]=n.useState(C.asset&&C.asset[0]&&C.asset[0].BookPagereference||(null==C||null===(c=C.asset)||void 0===c?void 0:c.BookPagereference)||""),[B,k]=n.useState(C.asset&&C.asset[0]&&C.asset[0].AssetName||(null==C||null===(d=C.asset)||void 0===d?void 0:d.AssetName)||""),[U,H]=n.useState(C.asset&&C.asset[0]&&C.asset[0].Assetdescription||(null==C||null===(p=C.asset)||void 0===p?void 0:p.Assetdescription)||""),[j,W]=n.useState(C.asset&&C.asset[0]&&C.asset[0].Department||(null==C||null===(v=C.asset)||void 0===v?void 0:v.Department)||""),[V,z]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsOfType||(null==C||null===(f=C.asset)||void 0===f?void 0:f.assetsOfType)||""),[G,K]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsUsage||(null==C||null===(E=C.asset)||void 0===E?void 0:E.assetsUsage)||""),[q,Y]=n.useState(C.asset&&C.asset[0]&&C.asset[0].financialYear||(null==C||null===(g=C.asset)||void 0===g?void 0:g.financialYear)||T),[$,Z]=n.useState(C.asset&&C.asset[0]&&C.asset[0].sourceOfFinance||(null==C||null===(S=C.asset)||void 0===S?void 0:S.sourceOfFinance)||""),Q=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:X}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetClassification"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetClassification;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:J}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetParentCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategory;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:ee}=Digit.Hooks.asset.useAssetSubType(Q,"ASSET","assetCategory"),{data:te}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetSubCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetSubCategory;return null==n?void 0:n.filter(e=>!0===e.active)}});console.log("E data:- ",te);const{data:ne}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let le=[];ne&&ne.map(e=>{le.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ae}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let oe=[];ae&&ae.map(e=>{oe.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:ie}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let re=[];ie&&ie.map(e=>{re.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});let se=[],ue=[],ce=[],de=[];X&&X.map(e=>{se.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),J&&J.map(e=>{e.assetClassification==(null==N?void 0:N.code)&&ue.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ee&&ee.map(e=>{e.assetParentCategory==(null==O?void 0:O.code)&&ce.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),te&&te.map(e=>{e.assetCategory==(null==R?void 0:R.code)&&de.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const me=()=>{let e,t=C.asset&&C.asset[0];"citizen"===A?(e=m({},t,{financialYear:q,sourceOfFinance:$,assetclassification:N,assetparentsubCategory:w,assetsubtype:R,assettype:O}),y(_.key,m({},C[_.key],e),!1,0)):(e=m({},t,{financialYear:q,sourceOfFinance:$,assetclassification:N,assetparentsubCategory:w,assetsubtype:R,assettype:O,BookPagereference:M,AssetName:B,Department:j,assetsOfType:V,assetsUsage:G,Assetdescription:U}),y(_.key,e,!1,0))};n.useEffect(()=>{"citizen"===A&&me()},[q,$,N,R,O,w,M,B,j,V,G,U]);const{data:pe}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let ve=[];pe&&pe.map(e=>{ve.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:fe}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let Ee=[];return fe&&fe.map(e=>{Ee.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})}),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(_a,{currentStep:1}):null,l.createElement(t.FormStep,{config:_,onSelect:me,onSkip:()=>y(),t:h,isDisabled:!(N&&R&&O&&M)},l.createElement("div",null,l.createElement("div",null,h("AST_FINANCIAL_YEAR"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+h("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(i.Controller,{control:b,name:"financialYear",defaultValue:q,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:q,select:Y,option:oe,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("AST_SOURCE_FINANCE"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+h("AST_SOURCE_OF_FUNDING")))),l.createElement(i.Controller,{control:b,name:"sourceOfFinance",defaultValue:$,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:$,select:Z,option:le,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("AST_CATEGORY"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+h("AST_CLASSIFICATION_ASSET")))),l.createElement(i.Controller,{control:b,name:"assetclassification",defaultValue:N,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:N,select:I,option:se,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement(t.CardLabel,null,""+h("AST_PARENT_CATEGORY")),l.createElement(i.Controller,{control:b,name:"assettype",defaultValue:O,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:O,select:x,option:ue,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement(t.CardLabel,null,""+h("AST_SUB_CATEGORY")),l.createElement(i.Controller,{control:b,name:"assetsubtype",defaultValue:R,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:R,select:L,option:ce,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement(t.CardLabel,null,""+h("AST_CATEGORY_SUB_CATEGORY")),l.createElement(i.Controller,{control:b,name:"assetparentsubCategory",defaultValue:w,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:w,select:P,option:de,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("AST_TYPE")),l.createElement(i.Controller,{control:b,name:"assetsOfType",defaultValue:V,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:V,select:z,option:ve,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("AST_BOOK_REF_SERIAL_NUM"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+h("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,m({t:h,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:M,onChange:function(e){F(e.target.value)},style:{width:"50%"},ValidationRequired:!1},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:h("PT_NAME_ERROR_MESSAGE")})),l.createElement(t.CardLabel,null,""+h("AST_NAME")),l.createElement(t.TextInput,m({t:h,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:h("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,h("ASSET_DESCRIPTION"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+h("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,m({t:h,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:U,onChange:function(e){H(e.target.value)},ValidationRequired:!1},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:h("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,h("AST_DEPARTMENT"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+h("AST_PROCURED_DEPARTMENT")))),l.createElement(i.Controller,{control:b,name:"Department",defaultValue:j,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:j,select:W,option:re,optionKey:"i18nKey",placeholder:"Select",t:h})}),l.createElement("div",null,h("AST_USAGE")),l.createElement(i.Controller,{control:b,name:"assetsUsage",defaultValue:G,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:G,select:K,option:Ee,optionKey:"i18nKey",placeholder:"Select",t:h})}))))},NewAsset:e=>{var a,r,s,u;let{t:c,config:d,onSelect:p,formData:v}=e;const[f,E]=n.useState(v.assetDetails&&v.assetDetails.assetParentCategory===(null==v||null===(a=v.asset)||void 0===a||null===(r=a.assettype)||void 0===r?void 0:r.code)?v.assetDetails:{assetParentCategory:null==v||null===(s=v.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code}),[g,S]=n.useState(),h=Digit.ULBService.getCurrentTenantId(),_=Digit.ULBService.getStateId(),y=Digit.Hooks.useCustomMDMSV2(h,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),A=Digit.Hooks.useCustomMDMSV2(_,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});n.useEffect(()=>{let e;null!=y&&y.data?e=y.data:null!=A&&A.data?e=A.data:(e=[],console.log("Both cityResponseObject and stateResponseObject data are unavailable.")),S(e)},[y,A]);let C=[];Array.isArray(g)&&(C=g.filter(e=>{var t,n;return e.assetParentCategory===(null==v||null===(t=v.asset)||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),o.useLocation();let b=window.location.href.charAt(window.location.href.length-1),D={};const{control:T}=i.useForm(),N=e=>e&&"number"===e?"^[0-9]+(\\.[0-9]+)?$":"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",I=e=>{const{name:t,value:n}=e.target?e.target:{name:e.name,value:e};if("lifeOfAsset"===t&&n.length>3)return alert("Maximum limit is 3 digits only!"),!1;E(e=>{const l=m({},e,{[t]:n}),a=parseFloat(l.acquisitionCost)||0,o=parseFloat(l.purchaseCost)||0;return(a>=0||o>=0)&&(l.bookValue=a+o),"purchaseDate"===t&&(e=>{const t=new Date,n=new Date(e),l=t.getFullYear()-n.getFullYear(),a=t.getMonth()-n.getMonth();let o;if(l>0)o=l+" "+c("YEAR");else if(a>=0)o=a+" "+c("MONTH");else{const e=t.getDate()-n.getDate();o=e+" "+c("DAY")}E(e=>m({},e,{assetAge:o}))})(n),l})},O=e=>{"geolocation"in navigator?navigator.geolocation.getCurrentPosition(t=>{const{latitude:n,longitude:l}=t.coords;E(t=>m({},t,{[e]:n+", "+l}))},e=>{console.error("Error getting location:",e),alert("Unable to retrieve your location. Please check your browser settings.")}):alert("Geolocation is not supported by your browser.")},x=e=>{const t=e?e.trim():"",{data:n}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:t}],{select:e=>{var n;return null==e||null===(n=e.ASSET)||void 0===n?void 0:n[t]}});let l=[];return n&&n.map(e=>{l.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})}),l};return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(_a,{currentStep:2}):null,l.createElement(t.Card,null,l.createElement(t.CardCaption,null,c(v.asset.Department.value),"/",v.asset.assetclassification.value,"/",v.asset.assettype.value,"/",v.asset.assetsubtype.value,"/",v.asset.BookPagereference)),l.createElement(t.FormStep,{config:d,onSelect:()=>{f.owner=v.assetDetails&&v.assetDetails[b],p(d.key,f,!1,b)},onSkip:()=>p(),t:c,isDisabled:!f.purchaseDate||!f.modeOfPossessionOrAcquisition||!f.purchaseOrderNumber},l.createElement(l.Fragment,null,l.createElement("div",null,c("AST_MODE_OF_POSSESSION_OR_ACQUISITION")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(i.Controller,{control:T,name:"modeOfPossessionOrAcquisition",isMandatory:!1,defaultValue:f.modeOfPossessionOrAcquisition?f.modeOfPossessionOrAcquisition:"",rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:f.modeOfPossessionOrAcquisition,select:I,option:x("ModeOfPossessionOrAcquisition"),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:c})}),l.createElement("div",null,c("AST_INVOICE_DATE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,{t:c,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"invoiceDate",value:f.invoiceDate,onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||c("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,c("AST_INVOICE_NUMBER")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,m({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"invoiceNumber",value:f.invoiceNumber,onChange:I},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,c("AST_PURCHASE_DATE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,{t:c,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"purchaseDate",value:f.purchaseDate,onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||c("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,c("AST_PURCHASE_ORDER")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,m({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"purchaseOrderNumber",value:f.purchaseOrderNumber,onChange:I},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,c("AST_LIFE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,m({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lifeOfAsset",value:f.lifeOfAsset,onChange:I},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,c("AST_LOCATION_DETAILS")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"location",value:f.location||"",onChange:I,style:{flex:1},ValidationRequired:!1},D={isRequired:!0,pattern:"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",type:"text",title:c("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{O("location")},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))),l.createElement("div",null,c("AST_PURCHASE_COST")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,m({t:c,type:"number",isMandatory:!1,optionKey:"i18nKey",name:"purchaseCost",value:f.purchaseCost,onChange:I,ValidationRequired:!0},D={isRequired:!0,pattern:N("number"),type:"number",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,c("AST_ACQUISITION_COST")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,m({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"acquisitionCost",value:f.acquisitionCost,onChange:I,ValidationRequired:!0},D={isRequired:!0,pattern:N("number"),type:"number",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,c("AST_BOOK_VALUE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c("")+" "))),l.createElement(t.TextInput,m({t:c,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bookValue",value:f.bookValue,onChange:I},D={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),C.map((e,n)=>l.createElement("div",{key:n},l.createElement("div",null,c(e.code)+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},c(e.iLable)+" "))),"date"===e.type?l.createElement(t.TextInput,{t:c,type:"date",isMandatory:!1,optionKey:"i18nKey",name:e.name,value:f[e.name],onChange:I,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||c("ERR_DEFAULT_INPUT_FIELD_MSG")}}):"dropdown"==e.type?l.createElement(i.Controller,{control:T,name:e.name,isMandatory:!1,defaultValue:f[e.name]?f[e.name]:"",rules:{required:c("CORE_COMMON_REQUIRED_ERRMSG")},render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:f[e.name],select:I,option:x(e.masterName),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:c})}):!0===e.addCurrentLocationButton?l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:c,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:f[e.name]||"",onChange:I,style:{flex:1},ValidationRequired:!1},D={isRequired:!0,pattern:N(e.columnType),type:e.columnType,title:c("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{O(e.name)},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))):l.createElement(t.TextInput,m({t:c,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:f[e.name]||"",onChange:I},D={isRequired:e.isMandatory,pattern:N(e.columnType),type:e.columnType,title:c("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"},readOnly:e.isReadOnly})))))))},NewDocument:e=>{var a,o,i;let{t:r,config:s,onSelect:u,formData:c}=e;const[d,p]=n.useState((null==c||null===(a=c.documents)||void 0===a?void 0:a.documents)||[]),[v,f]=n.useState(null),[E,g]=n.useState(!0),[S,h]=n.useState(!0),_=Digit.ULBService.getStateId(),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetDocumentsMDMS(_,"ASSET","Documents");return n.useEffect(()=>{var e;let t=0;null==A||null===(e=A.ASSET)||void 0===e||e.Documents.forEach(e=>{e.hasDropdown=!0,!d.some(t=>e.required&&(null==t?void 0:t.documentType.includes(e.code)))&&e.required&&(t+=1)}),g(!(0===t&&d.length>0))},[d,S,A]),l.createElement("div",null,l.createElement(_a,{currentStep:4}),y?l.createElement(t.Loader,null):l.createElement(t.FormStep,{t:r,config:s,onSelect:()=>{let e=m({},c.documents,{documents:d});u(s.key,e)},onSkip:()=>u(),isDisabled:E},null==A||null===(o=A.ASSET)||void 0===o||null===(i=o.Documents)||void 0===i?void 0:i.map((e,t)=>l.createElement(Aa,{key:t,document:e,t:r,error:v,setError:f,setDocuments:p,documents:d,setCheckRequiredFields:h,formData:c})),v&&l.createElement(t.Toast,{label:v,onClose:()=>f(null),error:!0})))},ASTCheckPage:e=>{var i,r,s,u,c,d,m,p,v,f,E,g;let{onSubmit:S,value:h={}}=e;const{t:_}=a.useTranslation(),[y,A]=(o.useHistory(),n.useState(!1)),[C,b]=n.useState(),D=Digit.ULBService.getCurrentTenantId(),T=Digit.ULBService.getStateId(),N=Digit.Hooks.useCustomMDMS(D,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),I=Digit.Hooks.useCustomMDMS(T,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),{address:O,assetDetails:x,asset:R}=h;n.useEffect(()=>{let e;e=null!=N&&N.data?N.data:null!=I&&I.data?I.data:[],b(e)},[N,I]);let L=[];return Array.isArray(C)&&(L=C.filter(e=>{var t;return e.assetParentCategory===(null==R||null===(t=R.assettype)||void 0===t?void 0:t.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(_a,{currentStep:5}):null,l.createElement(t.Card,null,l.createElement(t.CardHeader,null,_("AST_CHECK_DETAILS")),l.createElement("div",null,l.createElement("br",null),l.createElement(t.CardSubHeader,null,_("ASSET_GENERAL_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("AST_FINANCIAL_YEAR"),text:""+_(pa(null==R||null===(i=R.financialYear)||void 0===i?void 0:i.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_SOURCE_FINANCE"),text:""+_(pa(null==R||null===(r=R.sourceOfFinance)||void 0===r?void 0:r.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_ASSET_CATEGORY_LABEL"),text:""+_(pa(null==R||null===(s=R.assetclassification)||void 0===s?void 0:s.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_PARENT_CATEGORY_LABEL"),text:""+_(pa(null==R||null===(u=R.assettype)||void 0===u?void 0:u.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_SUB_CATEGORY"),text:""+_(pa(null==R||null===(c=R.assetsubtype)||void 0===c?void 0:c.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_CATEGORY_SUB_CATEGORY"),text:""+_(pa(null==R||null===(d=R.assetparentsubCategory)||void 0===d?void 0:d.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_BOOK_REF_SERIAL_NUM"),text:""+_(pa(null==R?void 0:R.BookPagereference)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_NAME"),text:""+_(pa(null==R?void 0:R.AssetName)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("ASSET_DESCRIPTION"),text:""+_(pa(null==R?void 0:R.Assetdescription)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_DEPARTMENT"),text:""+_(pa(null==R||null===(m=R.Department)||void 0===m?void 0:m.value)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_TYPE"),text:""+_(pa(null==R||null===(p=R.assetsOfType)||void 0===p?void 0:p.value)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:_("AST_USAGE"),text:""+_(pa(null==R||null===(v=R.assetsUsage)||void 0===v?void 0:v.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})})),l.createElement("br",null),l.createElement(t.CardSubHeader,null,_("AST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(l.Fragment,null,l.createElement(t.Row,{label:_("AST_MODE_OF_POSSESSION_OR_ACQUISITION"),text:""+_(pa(null==x||null===(f=x.modeOfPossessionOrAcquisition)||void 0===f?void 0:f.code)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_INVOICE_DATE"),text:""+_(pa(null==x?void 0:x.invoiceDate)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_INVOICE_NUMBER"),text:""+_(pa(null==x?void 0:x.invoiceNumber)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_PURCHASE_DATE"),text:""+_(pa(null==x?void 0:x.purchaseDate)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_PURCHASE_ORDER"),text:""+_(pa(null==x?void 0:x.purchaseOrderNumber)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_LIFE"),text:""+_(pa(null==x?void 0:x.lifeOfAsset)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_LOCATION_DETAILS"),text:""+_(pa(null==x?void 0:x.location)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_PURCHASE_COST"),text:""+_(pa(null==x?void 0:x.purchaseCost)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_ACQUISITION_COST"),text:""+_(pa(null==x?void 0:x.acquisitionCost)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:_("AST_BOOK_VALUE"),text:""+_(pa(null==x?void 0:x.bookValue)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),L.map((e,n)=>{return l.createElement(t.Row,{key:n,label:_(e.code),text:""+(a=e.name,o=x[a],"object"==typeof o?o.code:o),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})});var a,o}))),l.createElement("br",null),l.createElement(t.CardSubHeader,null,_("AST_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("MYCITY_CODE_LABEL"),text:""+_(pa(null==O||null===(E=O.city)||void 0===E?void 0:E.name)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})}),l.createElement(t.Row,{label:_("AST_LOCALITY"),text:""+_(pa(null==O||null===(g=O.locality)||void 0===g?void 0:g.name)),actionButton:l.createElement(Ca,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})})),l.createElement("br",null),l.createElement(t.CheckBox,{label:_("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{A(!y)},styles:{height:"auto"}})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:_("COMMON_BUTTON_SUBMIT"),onSubmit:S,disabled:!y})))},NewResponse:e=>{var i,r;let{data:s,onSuccess:u}=e;const{t:c}=a.useTranslation(),d=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.asset.useAssetCreateAPI(null==s||null===(i=s.address)||void 0===i||null===(r=i.city)||void 0===r?void 0:r.code));return Digit.Hooks.useStore.getInitData(),o.useRouteMatch(),n.useEffect(()=>{try{var e,t;s.tenantId=null===(e=s.address)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code;let n=(e=>{var t,n,l,a,o,i,r,s,u,c,d,m,p,v,f,E,g,S,h,_,y,A,C,b,D,T,N,I,O,x,R,L,w,P,M,F,B,k,U,H,j,W,V,z,G,K,q,Y,$,Z,Q;const X=["acquisitionCost","assetAge","bookValue","invoiceDate","invoiceNumber","purchaseDate","purchaseOrderNumber","purchaseCost","location","lifeOfAsset"],J=(null==e?void 0:e.assetDetails)||{},ee=Object.keys(J).filter(e=>!X.includes(e)).reduce((e,t)=>(e[t]=J[t],e),{});return{Asset:{accountId:"",tenantId:null==e||null===(t=e.address)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code,assetBookRefNo:null==e||null===(l=e.asset)||void 0===l?void 0:l.BookPagereference,assetName:null==e||null===(a=e.asset)||void 0===a?void 0:a.AssetName,description:null==e||null===(o=e.asset)||void 0===o?void 0:o.Assetdescription,assetClassification:null==e||null===(i=e.asset)||void 0===i||null===(r=i.assetclassification)||void 0===r?void 0:r.code,assetParentCategory:null==e||null===(s=e.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code,assetCategory:null==e||null===(c=e.asset)||void 0===c||null===(d=c.assetsubtype)||void 0===d?void 0:d.code,assetSubCategory:null==e||null===(m=e.asset)||void 0===m||null===(p=m.assetparentsubCategory)||void 0===p?void 0:p.code,department:null==e||null===(v=e.asset)||void 0===v||null===(f=v.Department)||void 0===f?void 0:f.code,assetType:null==e||null===(E=e.asset)||void 0===E||null===(g=E.assetsOfType)||void 0===g?void 0:g.code,assetUsage:null==e||null===(S=e.asset)||void 0===S||null===(h=S.assetsUsage)||void 0===h?void 0:h.code,financialYear:null==e||null===(_=e.asset)||void 0===_||null===(y=_.financialYear)||void 0===y?void 0:y.code,sourceOfFinance:null==e||null===(A=e.asset)||void 0===A||null===(C=A.sourceOfFinance)||void 0===C?void 0:C.code,applicationNo:"",approvalDate:"",applicationDate:"",status:"",modeOfPossessionOrAcquisition:null==e||null===(b=e.assetDetails)||void 0===b||null===(D=b.modeOfPossessionOrAcquisition)||void 0===D?void 0:D.code,invoiceDate:va(null==e||null===(T=e.assetDetails)||void 0===T?void 0:T.invoiceDate),invoiceNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.invoiceNumber,purchaseDate:va(null==e||null===(I=e.assetDetails)||void 0===I?void 0:I.purchaseDate),purchaseOrderNumber:null==e||null===(O=e.assetDetails)||void 0===O?void 0:O.purchaseOrderNumber,assetAge:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.assetAge,location:null==e||null===(R=e.assetDetails)||void 0===R?void 0:R.location,lifeOfAsset:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.lifeOfAsset,purchaseCost:fa(null==e||null===(w=e.assetDetails)||void 0===w?void 0:w.purchaseCost),acquisitionCost:fa(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.acquisitionCost),bookValue:null==e||null===(M=e.assetDetails)||void 0===M?void 0:M.bookValue,originalBookValue:null==e||null===(F=e.assetDetails)||void 0===F?void 0:F.bookValue,islegacyData:!1,minimumValue:0,assetStatus:"1",action:"",businessService:"asset-create",addressDetails:{addressLine1:null==e||null===(B=e.address)||void 0===B?void 0:B.addressLine1,addressLine2:null==e||null===(k=e.address)||void 0===k?void 0:k.addressLine2,buildingName:null==e||null===(U=e.address)||void 0===U?void 0:U.buildingName,doorNo:null==e||null===(H=e.address)||void 0===H?void 0:H.doorNo,street:null==e||null===(j=e.address)||void 0===j?void 0:j.street,pincode:null==e||null===(W=e.address)||void 0===W?void 0:W.pincode,city:null==e||null===(V=e.address)||void 0===V||null===(z=V.city)||void 0===z?void 0:z.name,locality:{code:null==e||null===(G=e.address)||void 0===G||null===(K=G.locality)||void 0===K?void 0:K.code,area:null==e||null===(q=e.address)||void 0===q||null===(Y=q.locality)||void 0===Y?void 0:Y.area,latitude:null==e||null===($=e.address)||void 0===$?void 0:$.latitude,longitude:null==e||null===(Z=e.address)||void 0===Z?void 0:Z.longitude}},documents:null==e||null===(Q=e.documents)||void 0===Q?void 0:Q.documents,workflow:{action:"INITIATE",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:ee}}})(s);d.mutate(n,{onSuccess:u})}catch(e){}},[]),d.isLoading||d.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Ta,{t:c,data:d.data,isSuccess:d.isSuccess,isLoading:d.isIdle||d.isLoading}),l.createElement(t.StatusTable,null,d.isSuccess&&l.createElement(t.Row,{rowContainerStyle:Da,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),l.createElement(o.Link,{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:c("CORE_COMMON_GO_TO_HOME")})))},ApplicationDetails:Xl,AssetResponse:e=>{console.log("For coming data from props in response:- ",e);const{t:i}=a.useTranslation(),r=c.useQueryClient(),[s,u]=(o.useHistory(),n.useState(null)),[d,m]=n.useState(null),[p,v]=n.useState(!1),[f,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,h,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useAssignCreateAPI(y,"UPDATE"!==A.key),b=Digit.Hooks.asset.useAssignCreateAPI(y,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&h(b.data)},[C.data]),n.useEffect(()=>{b.data&&b.isSuccess&&h(b.data)},[b.data]),n.useEffect(()=>{f||C.mutate({Asset:null==A?void 0:A.Assets},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return E(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!f?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ta,{t:i,data:(null==C?void 0:C.data)||S,action:null==A?void 0:A.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!f||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),d&&l.createElement(t.Toast,{error:"error"===d.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:i("CORE_COMMON_GO_TO_HOME")}))))},DisposeResponse:e=>{const i=o.useLocation(),{AssetDisposal:r}=i.state||{},{t:s}=a.useTranslation(),[u,d]=(c.useQueryClient(),o.useHistory(),n.useState(null)),[m,p]=n.useState(null),[v,f]=n.useState(!1),[E,g]=n.useState(null);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status&&g(r.AssetDisposals[0])},[r]),l.createElement("div",null,l.createElement(t.Card,null,E?l.createElement(oa,{t:s,data:E,action:e.action,isSuccess:!0,isEmployee:e.parentRoute.includes("employee")}):l.createElement(t.Loader,null)),m&&l.createElement(t.Toast,{error:"error"===m.key,label:u,onClose:()=>{p(null),d(null)}}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ProcessDepreciationResponse:e=>{const i=o.useLocation(),{ProcessDepreciation:r}=i.state||{},{t:s}=a.useTranslation(),[u,c]=n.useState(null),[d,m]=n.useState(!1);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status?c(r.Message):(m(!0),c(s("CS_SOMETHING_WENT_WRONG")))},[r,s]),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(t.Banner,u&&!d?{message:((e,t)=>t("CS_DEPRECIATION_SUCCESS_MESSAGE"))(0,s),info:((e,t)=>t("CS_DEPRECIATION_SUCCESS_LABEL"))(0,s),successful:!0}:{message:"Processing...",successful:!1})),d&&u&&l.createElement(t.Toast,{error:!0,label:u,onClose:()=>{c(null),m(!1)}}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},returnResponse:e=>{const{t:i}=a.useTranslation(),r=c.useQueryClient(),[s,u]=(o.useHistory(),n.useState(null)),[d,m]=n.useState(null),[p,v]=n.useState(!1),[f,E,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,h,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useReturnAPI(y,"UPDATE"!==A.key),b=Digit.Hooks.asset.useReturnAPI(y,!1);return n.useEffect(()=>{b.data&&b.isSuccess&&h(b.data)},[C.data]),n.useEffect(()=>{b.data&&b.isSuccess&&h(b.data)},[b.data]),n.useEffect(()=>{f||C.mutate({Asset:null==A?void 0:A.Asset},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return E(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&v(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!f?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(sa,{t:i,data:(null==C?void 0:C.data)||S,action:null==A?void 0:A.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!f||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),d&&l.createElement(t.Toast,{error:"error"===d.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:i("CORE_COMMON_GO_TO_HOME")}))))},AssetAssign:e=>{let{config:t,onSelect:o,formData:i,setError:r,formState:s,clearErrors:u}=e;const{t:c}=a.useTranslation(),[d,p]=n.useState((null==i?void 0:i.assigndetails)||[{department:"",assignedUser:"",designation:"",employeeCode:"",transferDate:"",returnDate:"",allocatedDepartment:"",key:Date.now()}]),[v,f]=n.useState({index:-1,type:""});n.useEffect(()=>{o(null==t?void 0:t.key,d)},[d]);const{data:E}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let g=[];E&&E.map(e=>{g.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:S}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Designation"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Designation;return null==n?void 0:n.filter(e=>!0===e.active)}}),h=[];S&&S.map(e=>{h.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const _={focusIndex:v,allAssets:d,setFocusIndex:f,formData:i,formState:s,setassigndetails:p,t:c,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:h};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(Na,m({key:e.key,index:t,assigndetails:e},_))))},AssetDispose:e=>{let{config:t,onSelect:o,formData:i,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[c,d]=n.useState((null==i?void 0:i.disposeDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[p,v]=n.useState({index:-1,type:""}),[f,E]=n.useState(null);n.useEffect(()=>{o(null==t?void 0:t.key,c)},[c]);const g={focusIndex:p,allAssets:c,setFocusIndex:v,formData:i,formState:r,setdisposeDetails:d,t:u,setError:E,clearErrors:s,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(Ia,m({key:e.key,index:t,disposeDetails:e},g))))},AssetMaintenance:e=>{let{config:t,onSelect:o,formData:i,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[c,d]=n.useState((null==i?void 0:i.maintenanceDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[p,v]=n.useState({index:-1,type:""}),[f,E]=n.useState(null);n.useEffect(()=>{o(null==t?void 0:t.key,c)},[c]);const g={focusIndex:p,allAssets:c,setFocusIndex:v,formData:i,formState:r,setMaintenanceDetails:d,t:u,setError:E,clearErrors:s,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(Oa,m({key:e.key,index:t,maintenanceDetails:e},g))))},returnAssets:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:i}=a.useTranslation(),[r,s]=n.useState(!1),u=o.useHistory(),{id:c}=o.useParams(),{data:d}=Digit.Hooks.asset.useAssetApplicationDetail(i,e,c);console.log("Data is application from Hook:- ",d);const[p,v,f]=Digit.Hooks.useSessionStorage("store-data",null),[E,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[h,_,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),y()},[]);const A=xa;return l.createElement(t.FormComposer,{heading:i("AST_RETURN_ASSET"),isDisabled:!r,label:i("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,o,i,r,s,c,m,p,v,f,E,g,S,h,_,y,A,C,b,D,T,N;const I=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.returndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.returnDate),O={id:null==d||null===(a=d.applicationData)||void 0===a||null===(o=a.applicationData)||void 0===o?void 0:o.id,tenantId:e,applicationNo:null==d||null===(i=d.applicationData)||void 0===i||null===(r=i.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:null==d||null===(s=d.applicationData)||void 0===s||null===(c=s.applicationData)||void 0===c||null===(m=c.assetAssignment)||void 0===m?void 0:m.assignmentId,assetId:"",assignedUserName:null==d||null===(p=d.applicationData)||void 0===p||null===(v=p.applicationData)||void 0===v||null===(f=v.assetAssignment)||void 0===f?void 0:f.assignedUserName,designation:(null==d||null===(E=d.applicationData)||void 0===E||null===(g=E.applicationData)||void 0===g||null===(S=g.assetAssignment)||void 0===S?void 0:S.designation)||"",department:(null==d||null===(h=d.applicationData)||void 0===h||null===(_=h.applicationData)||void 0===_||null===(y=_.assetAssignment)||void 0===y?void 0:y.department)||"",assignedDate:null==d||null===(A=d.applicationData)||void 0===A||null===(C=A.applicationData)||void 0===C||null===(b=C.assetAssignment)||void 0===b?void 0:b.assignedDate,employeeCode:null==d||null===(D=d.applicationData)||void 0===D||null===(T=D.applicationData)||void 0===T||null===(N=T.assetAssignment)||void 0===N?void 0:N.employeeCode,isAssigned:!1,returnDate:I,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/return-response",{Asset:O})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},ReturnAssignedAsset:e=>{let{config:t,onSelect:o,formData:i,setError:r,formState:s,clearErrors:u}=e;const{t:c}=a.useTranslation(),[d,p]=n.useState((null==i?void 0:i.returndetails)||[{returnDate:"",key:Date.now()}]),[v,f]=n.useState({index:-1,type:""});n.useEffect(()=>{o(null==t?void 0:t.key,d)},[d]);const E={focusIndex:v,allAssets:d,setFocusIndex:f,formData:i,formState:s,setreturndetails:p,t:c,setError:r,clearErrors:u,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(Ra,m({key:e.key,index:t,returndetails:e},E))))},editAsset:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:i}=a.useTranslation(),[r,s]=n.useState(!1),[u,c]=n.useState(!0),d=o.useHistory(),{id:p}=o.useParams(),{data:v}=Digit.Hooks.asset.useAssetApplicationDetail(i,e,p),[f,E,g]=Digit.Hooks.useSessionStorage("store-data",null),[S,h,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});if(n.useEffect(()=>{h(!1),C()},[]),n.useEffect(()=>{v&&c(!1)},[v]),u)return l.createElement(t.Loader,null);const b=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},D=e=>{const t=String(e).replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},T=La;return l.createElement(t.FormComposer,{heading:i("AST_EDIT_ASSET"),label:i("ES_COMMON_APPLICATION_SUBMIT"),config:T.map(e=>m({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var t,n,l,a,o,i,r,s,u,c,p,f,E,g,S,h,_,y,A,C,T,N,I,O,x,R,L,w,P,M,F,B,k,U,H,j,W,V,z,G,K,q,Y,$,Z,Q,X,J,ee,te,ne,le,ae,oe,ie,re,se,ue,ce,de,me,pe,ve,fe,Ee,ge,Se,he,_e,ye,Ae,Ce,be,De,Te,Ne,Ie,Oe,xe,Re,Le,we,Pe,Me,Fe,Be,ke,Ue,He,je,We,Ve,ze,Ge,Ke,qe,Ye,$e,Ze,Qe,Xe,Je;const et={accountId:null==v||null===(t=v.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.accountId,tenantId:null==v||null===(l=v.applicationData)||void 0===l||null===(a=l.applicationData)||void 0===a?void 0:a.tenantId,assetBookRefNo:null==e||null===(o=e.editAssignDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.BookPagereference,assetName:null==e||null===(r=e.editAssignDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.AssetName,description:null==e||null===(u=e.editAssignDetails)||void 0===u||null===(c=u[0])||void 0===c?void 0:c.Assetdescription,assetClassification:null==e||null===(p=e.editAssignDetails)||void 0===p||null===(f=p[0])||void 0===f||null===(E=f.assetclassification)||void 0===E?void 0:E.code,assetParentCategory:null==e||null===(g=e.editAssignDetails)||void 0===g||null===(S=g[0])||void 0===S||null===(h=S.assettype)||void 0===h?void 0:h.code,assetCategory:null==e||null===(_=e.editAssignDetails)||void 0===_||null===(y=_[0])||void 0===y||null===(A=y.assetsubtype)||void 0===A?void 0:A.code,assetSubCategory:null==e||null===(C=e.editAssignDetails)||void 0===C||null===(T=C[0])||void 0===T||null===(N=T.assetparentsubCategory)||void 0===N?void 0:N.code,department:null==e||null===(I=e.editAssignDetails)||void 0===I||null===(O=I[0])||void 0===O||null===(x=O.Department)||void 0===x?void 0:x.code,assetType:null==e||null===(R=e.editAssignDetails)||void 0===R||null===(L=R[0])||void 0===L||null===(w=L.assetType)||void 0===w?void 0:w.code,assetUsage:null==e||null===(P=e.editAssignDetails)||void 0===P||null===(M=P[0])||void 0===M||null===(F=M.assetUsage)||void 0===F?void 0:F.code,modeOfPossessionOrAcquisition:null==e||null===(B=e.editAssignDetails)||void 0===B||null===(k=B[0])||void 0===k||null===(U=k.modeOfPossessionOrAcquisition)||void 0===U?void 0:U.code,invoiceDate:b(null==e||null===(H=e.editAssignDetails)||void 0===H||null===(j=H[0])||void 0===j?void 0:j.invoiceDate),invoiceNumber:null==e||null===(W=e.editAssignDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.invoiceNumber,purchaseDate:b(null==e||null===(z=e.editAssignDetails)||void 0===z||null===(G=z[0])||void 0===G?void 0:G.purchaseDate),purchaseOrderNumber:null==e||null===(K=e.editAssignDetails)||void 0===K||null===(q=K[0])||void 0===q?void 0:q.purchaseOrderNumber,lifeOfAsset:null==e||null===(Y=e.editAssignDetails)||void 0===Y||null===($=Y[0])||void 0===$?void 0:$.lifeOfAsset,location:null==e||null===(Z=e.editAssignDetails)||void 0===Z||null===(Q=Z[0])||void 0===Q?void 0:Q.location,purchaseCost:D(null==e||null===(X=e.editAssignDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.purchaseCost),acquisitionCost:D(null==e||null===(ee=e.editAssignDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.acquisitionCost),bookValue:D(null==e||null===(ne=e.editAssignDetails)||void 0===ne||null===(le=ne[0])||void 0===le?void 0:le.bookValue),financialYear:null==e||null===(ae=e.editAssignDetails)||void 0===ae||null===(oe=ae[0])||void 0===oe||null===(ie=oe.financialYear)||void 0===ie?void 0:ie.code,sourceOfFinance:null==e||null===(re=e.editAssignDetails)||void 0===re||null===(se=re[0])||void 0===se||null===(ue=se.sourceOfFinance)||void 0===ue?void 0:ue.code,applicationNo:null==v||null===(ce=v.applicationData)||void 0===ce||null===(de=ce.applicationData)||void 0===de?void 0:de.applicationNo,approvalDate:"",id:null==v||null===(me=v.applicationData)||void 0===me||null===(pe=me.applicationData)||void 0===pe?void 0:pe.id,applicationDate:"",status:null==v||null===(ve=v.applicationData)||void 0===ve||null===(fe=ve.applicationData)||void 0===fe?void 0:fe.status,action:"",businessService:"asset-create",addressDetails:{addressLine1:null==v||null===(Ee=v.applicationData)||void 0===Ee||null===(ge=Ee.applicationData)||void 0===ge||null===(Se=ge.addressDetails)||void 0===Se?void 0:Se.addressLine1,addressLine2:null==v||null===(he=v.applicationData)||void 0===he||null===(_e=he.applicationData)||void 0===_e||null===(ye=_e.addressDetails)||void 0===ye?void 0:ye.addressLine2,buildingName:null==v||null===(Ae=v.applicationData)||void 0===Ae||null===(Ce=Ae.applicationData)||void 0===Ce||null===(be=Ce.addressDetails)||void 0===be?void 0:be.buildingName,doorNo:null==v||null===(De=v.applicationData)||void 0===De||null===(Te=De.applicationData)||void 0===Te||null===(Ne=Te.addressDetails)||void 0===Ne?void 0:Ne.doorNo,street:null==v||null===(Ie=v.applicationData)||void 0===Ie||null===(Oe=Ie.applicationData)||void 0===Oe||null===(xe=Oe.addressDetails)||void 0===xe?void 0:xe.street,pincode:null==v||null===(Re=v.applicationData)||void 0===Re||null===(Le=Re.applicationData)||void 0===Le||null===(we=Le.addressDetails)||void 0===we?void 0:we.pincode,city:null==v||null===(Pe=v.applicationData)||void 0===Pe||null===(Me=Pe.applicationData)||void 0===Me||null===(Fe=Me.addressDetails)||void 0===Fe?void 0:Fe.city,locality:{code:null==v||null===(Be=v.applicationData)||void 0===Be||null===(ke=Be.applicationData)||void 0===ke||null===(Ue=ke.addressDetails)||void 0===Ue||null===(He=Ue.locality)||void 0===He?void 0:He.code,area:null==v||null===(je=v.applicationData)||void 0===je||null===(We=je.applicationData)||void 0===We||null===(Ve=We.addressDetails)||void 0===Ve||null===(ze=Ve.locality)||void 0===ze?void 0:ze.area,latitude:null==v||null===(Ge=v.applicationData)||void 0===Ge||null===(Ke=Ge.applicationData)||void 0===Ke||null===(qe=Ke.addressDetails)||void 0===qe?void 0:qe.latitude,longitude:null==v||null===(Ye=v.applicationData)||void 0===Ye||null===($e=Ye.applicationData)||void 0===$e||null===(Ze=$e.addressDetails)||void 0===Ze?void 0:Ze.longitude}},documents:null==v||null===(Qe=v.applicationData)||void 0===Qe||null===(Xe=Qe.applicationData)||void 0===Xe?void 0:Xe.documents,workflow:{action:"SUBMIT",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:m({},null==e||null===(Je=e.editNewAssetDetails)||void 0===Je?void 0:Je[0],{acquisitionProcessionDetails:{}})};console.log("Form Data:- ",et),d.replace("/digit-ui/employee/asset/assetservice/edit-response",{Assets:et})},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},EditGeneralDetails:e=>{var t;let{config:i,onSelect:r,formData:s,setError:u,clearErrors:c}=e;const{t:d}=a.useTranslation(),p=Digit.ULBService.getStateId(),[v,f]=n.useState((null==s?void 0:s.editAssignDetails)||[{financialYear:"",assetclassification:"",assettype:"",assetparentsubCategory:"",BookPagereference:"",AssetName:"",assetsubtype:"",Assetdescription:"",Department:"",sourceOfFinance:"",assetclassification:"",key:Date.now()}]),{id:E}=o.useParams(),g=Digit.ULBService.getCurrentTenantId(),{data:S}=Digit.Hooks.asset.useAssetApplicationDetail(d,g,E);let h=null==S||null===(t=S.applicationData)||void 0===t?void 0:t.applicationData;const[_,y]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==i?void 0:i.key,v)},[v]);const{data:A}=Digit.Hooks.asset.useAssetClassification(p,"ASSET","assetClassification"),{data:C}=Digit.Hooks.asset.useAssetType(p,"ASSET","assetParentCategory"),{data:b}=Digit.Hooks.asset.useAssetSubType(p,"ASSET","assetCategory"),{data:D}=Digit.Hooks.asset.useAssetparentSubType(p,"ASSET","assetSubCategory"),{data:T}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let N=[];T&&T.map(e=>{N.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:I}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let O=[];I&&I.map(e=>{O.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:x}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let R=[];x&&x.map(e=>{R.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:L}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let w=[];L&&L.map(e=>{w.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:P}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let M=[];P&&P.map(e=>{M.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:F}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"ModeOfPossessionOrAcquisition"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ModeOfPossessionOrAcquisition}});let B=[];F&&F.map(e=>{B.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})});let k=[],U=[],H=[],j=[];A&&A.map(e=>{k.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),C&&C.map(e=>{var t,n;e.assetClassification==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assetclassification)||void 0===n?void 0:n.code)&&U.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),b&&b.map(e=>{var t,n;e.assetParentCategory==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)&&H.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),D&&D.map(e=>{var t,n;e.assetCategory==(null==v||null===(t=v[0])||void 0===t||null===(n=t.assetsubtype)||void 0===n?void 0:n.code)&&j.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const W={focusIndex:_,allAssets:v,setFocusIndex:y,formData:s,seteditAssignDetails:f,t:d,setError:u,clearErrors:c,config:i,menu_Asset:k,asset_type:U,asset_sub_type:H,asset_parent_sub_category:j,departNamefromMDMS:R,financal:O,sourcefinance:N,comingDataFromAPI:h,assetType:w,assetCurrentUsage:M,modeOfAcquisition:B};return l.createElement(l.Fragment,null,v.map((e,t)=>l.createElement(Pa,m({key:e.key,index:t,editAssignDetails:e},W))))},EditAssetDetails:e=>{var t;let{config:i,onSelect:r,formData:s,setError:u,clearErrors:c}=e;const{t:d}=a.useTranslation(),[p,v]=n.useState((null==s?void 0:s.editNewAssetDetails)||[{key:Date.now()}]),{id:f}=o.useParams(),E=Digit.ULBService.getCurrentTenantId(),{data:g}=Digit.Hooks.asset.useAssetApplicationDetail(d,E,f);let S=null==g||null===(t=g.applicationData)||void 0===t?void 0:t.applicationData;const[h,_]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==i?void 0:i.key,p)},[p]);const{data:y}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"Warranty"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Warranty}});let A=[];y&&y.map(e=>{A.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const C={focusIndex:h,allAssets:p,setFocusIndex:_,formData:s,seteditAssignDetails:v,t:d,setError:u,clearErrors:c,config:i,comingDataFromAPI:S,warrantyTime:A};return l.createElement(l.Fragment,null,p.map((e,t)=>l.createElement(Ma,m({key:e.key,index:t,editNewAssetDetails:e},C))))},editResponse:e=>{var i,r,s;const{t:u}=a.useTranslation(),d=c.useQueryClient(),[m,p]=(o.useHistory(),n.useState(null)),[v,f]=n.useState(null),[E,g]=n.useState(!1),[S,h,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),b=Digit.ULBService.getCurrentTenantId(),{state:D}=e.location,T=Digit.Hooks.asset.useEditUpdateAPI(b,"UPDATE"!==D.key),N=Digit.Hooks.asset.useEditUpdateAPI(b,!1);return n.useEffect(()=>{N.data&&N.isSuccess&&A(N.data)},[T.data]),n.useEffect(()=>{N.data&&N.isSuccess&&A(N.data)},[N.data]),n.useEffect(()=>{S||T.mutate({Asset:null==D?void 0:D.Assets},{onError:(e,t)=>{var n,l,a;f({key:"error"}),p((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return h(!0),d.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&g(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),T.isLoading||T.isIdle&&!S?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(ka,{t:u,data:(null==T?void 0:T.data)||y,action:null==D?void 0:D.action,isSuccess:!!Object.keys(y||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!S||(null==T?void 0:T.isLoading),isEmployee:e.parentRoute.includes("employee")})),v&&l.createElement(t.Toast,{error:"error"===v.key,label:m,onClose:()=>{f(null),p(null)}}),l.createElement(t.ActionBar,null,l.createElement(o.Link,{to:""+(!!e.parentRoute.includes("employee")&&"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null==T||null===(i=T.data)||void 0===i||null===(r=i.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo))},l.createElement(t.SubmitBar,{label:u("MY_APPLICATIONS")}))))}},Ha=e=>{let{stateCode:t,userType:a,tenants:i}=e;const{path:r,url:s}=o.useRouteMatch(),u=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:t,moduleCode:"ASSET",language:u}),Object.entries(Ua).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)}),Digit.SessionStorage.set("ASSET_TENANTS",i),n.useEffect(()=>"employee"===a&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),"employee"===a?l.createElement(M,{path:r,url:s,userType:a}):l.createElement(CitizenApp,null)},ja=e=>{a.useTranslation();const[t,l,o]=Digit.Hooks.useSessionStorage("ASSET",{});return n.useEffect(()=>{o()},[]),null};exports.ASSETComponents={ASSETCard:()=>{const{t:e}=a.useTranslation(),[o,i]=n.useState("-"),{data:r,isLoading:s,isFetching:u,isSuccess:c}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"ASSET",filters:{limit:10,offset:0,services:["asset-create"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"0"),enabled:Digit.Utils.assetAccess()}});if(n.useEffect(()=>{!u&&c&&i(r)},[u]),!Digit.Utils.assetAccess())return null;const d=[{count:s?"0":null==o?void 0:o.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"},{label:e("ASSET_ADD"),link:"/digit-ui/employee/asset/assetservice/new-assets",role:"ASSET_INITIATOR"},{label:e("MY_ASSET_APPLICATION"),link:"/digit-ui/employee/asset/assetservice/my-asset"}],m=Digit.UserService.hasAccess(["ASSET_INITIATOR"])||!1,p={moduleName:e("TITLE_ASSET_MANAGEMENT"),kpis:[{count:null==o?void 0:o.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"}],links:d.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,p)},ASSETModule:Ha,ASSETLinks:ja,AST_INBOX_FILTER:e=>l.createElement(W,e),ASTInboxTableConfig:e=>({ASSET:{inboxColumns:t=>[{Header:e("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var n,a,i,r;let{row:s}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(o.Link,{to:t.parentRoute+"/assetservice/application-details/"+(null==s||null===(n=s.original)||void 0===n||null===(a=n.searchData)||void 0===a?void 0:a.applicationNo)},null===(i=s.original)||void 0===i||null===(r=i.searchData)||void 0===r?void 0:r.applicationNo)))},mobileCell:e=>{var t;return ca(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}},{Header:e("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n,l,a;return ua(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(a=l.searchData)||void 0===a?void 0:a.assetClassification))},mobileCell:e=>{var t;return ca(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetClassification)}},{Header:e("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return ua(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return ca(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetParentCategory)}},{Header:e("AST_NAME_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return ua(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return ca(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetName)}},{Header:e("AST_DEPARTMENT_LABEL"),Cell:t=>{var n,l;let{row:a}=t;return ua(e("COMMON_MASTERS_DEPARTMENT_"+(null==a||null===(n=a.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.department)))},mobileCell:t=>{var n;return ca(e("AST_COMMON_STATUS_"+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.department)))}},{Header:e("AST_ACTION"),Cell:n=>{var a,i,r,s,u,c,d,m,p;let{row:v}=n;return l.createElement("div",null,l.createElement("span",{className:"link"},"APPROVED"===(null==v||null===(a=v.original)||void 0===a||null===(i=a.searchData)||void 0===i?void 0:i.status)?null!=v&&null!==(r=v.original)&&void 0!==r&&null!==(s=r.searchData)&&void 0!==s&&null!==(u=s.assetAssignment)&&void 0!==u&&u.isAssigned?l.createElement(o.Link,{to:t.parentRoute+"/assetservice/return-assets/"+(null==v||null===(c=v.original)||void 0===c||null===(d=c.searchData)||void 0===d?void 0:d.applicationNo)},e("AST_RETURN")):l.createElement(o.Link,{to:t.parentRoute+"/assetservice/assign-assets/"+(null==v||null===(m=v.original)||void 0===m||null===(p=m.searchData)||void 0===p?void 0:p.applicationNo)},e("AST_ASSIGN")):e("AST_SHOULD_BE_APPROVED_FIRST")))},mobileCell:e=>{var t;return ca(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("AST_INBOX_UNIQUE_APPLICATION_NUMBER")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}}})},exports.ASSETLinks=ja,exports.ASSETModule=Ha;
|
|
1
|
+
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@mseva/digit-ui-react-components"),n=require("react"),l=e(n),a=require("react-i18next"),i=require("react-router-dom"),o=require("react-hook-form"),r=e(require("jspdf")),s=e(require("qrcode")),u=require("xlsx");require("jspdf-autotable");var d=require("react-query"),c=e(require("exif-js"));function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}const v=function(){function e(){}return e.prototype.then=function(t,n){const l=new e,a=this.s;if(a){const e=1&a?t:n;if(e){try{p(l,1,e(this.v))}catch(e){p(l,2,e)}return l}return this}return this.o=function(e){try{const a=e.v;1&e.s?p(l,1,t?t(a):a):n?p(l,1,n(a)):p(l,2,a)}catch(e){p(l,2,e)}},l},e}();function p(e,t,n){if(!e.s){if(n instanceof v){if(!n.s)return void(n.o=p.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function E(e){return e instanceof v&&1&e.s}function f(e,t,n){for(var l;;){var a=e();if(E(a)&&(a=a.v),!a)return i;if(a.then){l=0;break}var i=n();if(i&&i.then){if(!E(i)){l=1;break}i=i.s}if(t){var o=t();if(o&&o.then&&!E(o)){l=2;break}}}var r=new v,s=p.bind(null,r,2);return(0===l?a.then(d):1===l?i.then(u):o.then(c)).then(void 0,s),r;function u(l){i=l;do{if(t&&(o=t())&&o.then&&!E(o))return void o.then(c).then(void 0,s);if(!(a=e())||E(a)&&!a.v)return void p(r,1,i);if(a.then)return void a.then(d).then(void 0,s);E(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,s)}function d(e){e?(i=n())&&i.then?i.then(u).then(void 0,s):u(i):p(r,1,i)}function c(){(a=e())?a.then?a.then(d).then(void 0,s):d(a):p(r,1,i)}}function g(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const S=e=>{let{isLoading:a,t:u,onSubmit:d,data:c,count:m,setShowToast:v,ActionBarStyle:p={},MenuStyle:E={},tenantId:S}=e;const _=window.Digit.Utils.browser.isMobile(),h=new Date,y=h.toISOString().split("T")[0],A=i.useHistory(),C=new Date(h);C.setDate(h.getDate()-7);const D=C.toISOString().split("T")[0],{register:b,control:T,handleSubmit:I,setValue:O,getValues:N,reset:R}=o.useForm({defaultValues:{offset:0,limit:!_&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:D,toDate:y}});n.useEffect(()=>{b("offset",0),b("limit",10),b("sortBy","commencementDate"),b("sortOrder","DESC"),O("fromDate",D),O("toDate",y)},[b,O,y,D]);var x=window.location.origin;const{data:L}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"Action"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Action}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"ActionOption"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ActionOption;return null==n?void 0:n.filter(e=>!0===e.active)}}),M=e=>l.createElement("span",{className:"cell-text"},e),F=n.useMemo(()=>[{Header:u("ES_ASSET_RESPONSE_CREATE_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null===(t=a.original)||void 0===t?void 0:t.applicationNo)},null===(n=a.original)||void 0===n?void 0:n.applicationNo)))}},{Header:u("AST_BOOK_REF_SERIAL_NUM"),Cell:e=>{var t,n;return M(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetBookRefNo))},disableSortBy:!0},{Header:u("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:u("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:u("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+u("COMMON_MASTERS_DEPARTMENT_"+(null==n||null===(t=n.original)||void 0===t?void 0:t.department)))},disableSortBy:!0},{Header:u("AST_APPLICATION_STATUS"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.status))},disableSortBy:!0},{Header:u("AST_ACTIONS"),Cell:e=>{var a;let{row:o}=e;const[r,s]=n.useState(!1),d=n.useRef(),c=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};l.useEffect(()=>(document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}),[]);const m=(e=>{const t=[];return w&&w.map(n=>{var l,a,i,o,r;if(null!=e&&null!==(l=e.original)&&void 0!==l&&null!==(a=l.assetAssignment)&&void 0!==a&&a.isAssigned&&"AST_RETURN"===n.code||(null==e||null===(i=e.original)||void 0===i||null===(o=i.assetAssignment)||void 0===o||!o.isAssigned)&&"AST_ASSIGN"===n.code)t.push({label:u(n.code),link:`${n.url}${null==e||null===(r=e.original)||void 0===r?void 0:r.applicationNo}`,code:n.code});else if("AST_RETURN"!==n.code&&"AST_ASSIGN"!==n.code){var s;t.push({label:u(n.code),link:`${n.url}${null==e||null===(s=e.original)||void 0===s?void 0:s.applicationNo}`,code:n.code})}}),t})(o);return l.createElement("div",{ref:d},"APPROVED"===(null==o||null===(a=o.original)||void 0===a?void 0:a.status)?l.createElement(l.Fragment,null,l.createElement(t.SubmitBar,{label:u("WF_TAKE_ACTION"),onSubmit:()=>{s(!r)}}),r&&l.createElement("div",{style:{position:"absolute",backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",padding:"8px",zIndex:1e3}},m.filter(e=>{var t;return"0"!==(null==o||null===(t=o.original)||void 0===t?void 0:t.assetStatus)||"AST_CERTIFICATE"===e.code}).map((e,t)=>"AST_CERTIFICATE"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e){try{return Promise.resolve(Digit.ASSETService.search({tenantId:S,filters:{applicationNo:e}})).then(function(e){var t;return Promise.resolve(Digit.PaymentService.generatePdf(S,{Assets:[null==e||null===(t=e.Assets)||void 0===t?void 0:t[0]]},"asset-report")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(S,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[null==e?void 0:e.filestoreIds[0]],"_blank")})})})}catch(e){return Promise.reject(e)}}(null===(e=o.original)||void 0===e?void 0:e.applicationNo)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):"AST_DEPRECIATION"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e,t){try{const e=g(function(){return Promise.resolve(Digit.ASSETService.depriciationProcess({Asset:{tenantId:S,id:t,accountId:""}})).then(function(e){e&&A.replace("/digit-ui/employee/asset/assetservice/asset-process-depreciation-response",{ProcessDepreciation:e})})},function(){v({error:!0,label:u("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(0,null===(e=o.original)||void 0===e?void 0:e.id)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):l.createElement(i.Link,{key:t,to:e.link,style:{display:"block",padding:"8px",textDecoration:"none",color:"black"}},e.label)))):u("AST_SHOULD_BE_APPROVED_FIRST"))},mobileCell:e=>{var t;return GetMobCell(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],[]),B=n.useCallback(e=>{0!==e.length&&(O("sortBy",e.id),O("sortOrder",e.desc?"DESC":"ASC"))},[O]);function k(){O("offset",N("offset")-N("limit")),I(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,u("ASSET_APPLICATIONS")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},u("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:I},l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_STATUS")),l.createElement(o.Controller,{control:T,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:P,optionKey:"i18nKey",t:u,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_APPLICATION_ID")),l.createElement(t.TextInput,{name:"applicationNo",inputRef:b({})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:y}),name:"fromDate",control:T})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:y}),name:"toDate",control:T})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{R({applicationNo:"",fromDate:D,toDate:y,status:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),v(null),k()}},u("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=f(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l);console.log("comming data:- ",e);const i=e.map(function(e,a){try{return Promise.resolve(n(`${x}/digit-ui/citizen/assets/services?tenantId=${S}&applicationNo=${e.applicationNo}`)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text("Track: "+e.location,70,70+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(i)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},u(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:u,data:c,totalRecords:m,columns:F,getCellProps:e=>({style:{minWidth:e.column.Header===u("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){O("limit",Number(e.target.value)),I(d)()},currentPage:N("offset")/N("limit"),onNextPage:function(){O("offset",N("offset")+N("limit")),I(d)()},onPrevPage:k,pageSizeLimit:N("limit"),onSort:B,disableSort:!1,sortParams:[{id:N("sortBy"),desc:"DESC"===N("sortOrder")}]})))},h=e=>{let{parentRoute:o}=e;i.useParams();const{t:r}=a.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[u,d]=n.useState({}),[c,m]=n.useState(null),v={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:p,isSuccess:E,data:{Assets:f,Count:g}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:s,filters:u},v);return n.useEffect(()=>{if(c){const e=setTimeout(()=>{m(null)},1500);return()=>clearTimeout(e)}},[c]),l.createElement(l.Fragment,null,l.createElement(S,{t:r,isLoading:p,parentRoute:o,tenantId:s,setShowToast:m,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l={...e,...e.toDate?{toDate:null==n?void 0:n.getTime()}:{},...e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{}};let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>({...e,[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.applicationNo||a.creationReason||a.fromDate||a.mobileNumber||a.applicationNo||a.status||a.toDate?!(Object.entries(a).length>0&&(a.creationReason||a.status))||a.applicationNo||a.fromDate||a.mobileNumber||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?m({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(a):m({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):m({warning:!0,label:"ERR_VALID_FIELDS"})},data:E&&!p?f.length>0?f:{display:"ES_COMMON_NO_DATA"}:"",count:g}),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:r(c.label),isDleteBtn:!0,onClose:()=>{m(null)}}))},y=e=>{let{isLoading:a,t:i,onSubmit:d,data:c,count:m,setShowToast:v}=e;const p=window.Digit.Utils.browser.isMobile(),E=(new Date).toISOString().split("T")[0],g=(Digit.UserService.getUser(),Digit.Hooks.asset.useTenants()),{register:S,control:_,handleSubmit:h,setValue:y,getValues:A,reset:C}=o.useForm({defaultValues:{offset:0,limit:!p&&10,sortBy:"commencementDate",sortOrder:"DESC"}});n.useEffect(()=>{S("offset",0),S("limit",10),S("sortBy","commencementDate"),S("sortOrder","DESC")},[S]);const D=Digit.ULBService.getStateId(),{data:b}=Digit.Hooks.asset.useAssetClassification(D,"ASSET","assetClassification");let T=[];b&&b.map(e=>{T.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:I}=Digit.Hooks.asset.useAssetType(D,"ASSET","assetParentCategory");let O=[];I&&I.map(e=>{O.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const N=e=>l.createElement("span",{className:"cell-text"},e),R=n.useMemo(()=>[{Header:i("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var t,n;return N(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.applicationNo))},disableSortBy:!0},{Header:i("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n;return N(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetClassification))},disableSortBy:!0},{Header:i("AST_PARENT_CATEGORY_LABELaaa"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:i("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:i("AST_TYPE"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetSubCategory))},disableSortBy:!0},{Header:i("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.department))},disableSortBy:!0}],[]),x=n.useCallback(e=>{0!==e.length&&(y("sortBy",e.id),y("sortOrder",e.desc?"DESC":"ASC"))},[]);function L(){y("offset",A("offset")-A("limit")),h(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,i("AST_REPORTS_CHECK")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},i("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:h},l.createElement(t.SearchField,null,l.createElement("label",null,i("MYCITY_CODE_LABEL")),l.createElement(o.Controller,{control:_,name:"city",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:g,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_PARENT_CATEGORY_LABEL")),l.createElement(o.Controller,{control:_,name:"assetParentCategory",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:O,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"fromDate",control:_})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"toDate",control:_})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_ASSET_CATEGORY_LABEL")),l.createElement(o.Controller,{control:_,name:"assetClassification",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:i("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{C({applicationNo:"",city:"",fromDate:"",toDate:"",assetClassification:"",assetParentCategory:"",pincode:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),v(null),L()}},i("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:()=>{const e=new r("landscape"),t=["S.No",...R.map(e=>i(e.Header))],n=c.map((e,t)=>[t+1,e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,e.assetSubCategory,e.department]);e.autoTable({head:[t],body:n}),e.save("Asset-Reports.pdf")},style:{color:"maroon",border:"2px solid #333",padding:"8px 16px",cursor:"pointer",marginRight:"10px"}},"Download PDF"),l.createElement("button",{onClick:()=>{const e=R.map(e=>i(e.Header)),t=c.map(e=>{var t;return[e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,null===(t=e.addressDetails)||void 0===t?void 0:t.pincode,e.department]}),n=u.utils.aoa_to_sheet([e,...t]),l=u.utils.book_new();u.utils.book_append_sheet(l,n,"Asset Report"),u.writeFile(l,"Asset-Reports.xlsx")},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer"}},"Download XLS"),l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=f(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l).map(function(e,a){try{return Promise.resolve(n("https://niuatt.niua.in/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+e.applicationNo)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text('Location: "https://www.google.com/maps/search/%7B%7BaddressDetailsLat%7D%7D,%7B%7BaddressDetailsLong/@28.588163,77.2308992,15z/data=!3m1!4b1?entry=ttu&g_ep=EgoyMDI0MTIxMS4wIKXMDSoASAFQAw%3D%3D"',70,60+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(e)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},i(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:i,data:c,totalRecords:m,columns:R,getCellProps:e=>({style:{minWidth:e.column.Header===i("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){y("limit",Number(e.target.value)),h(d)()},currentPage:A("offset")/A("limit"),onNextPage:function(){y("offset",A("offset")+A("limit")),h(d)()},onPrevPage:L,pageSizeLimit:A("limit"),onSort:x,disableSort:!1,sortParams:[{id:A("sortBy"),desc:"DESC"===A("sortOrder")}]})))},A=e=>{i.useParams();const{t:o}=a.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,u]=n.useState({}),[d,c]=n.useState(null),m={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:v,isSuccess:p,data:{Assets:E,Count:f}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:r,filters:s},m);return l.createElement(l.Fragment,null,l.createElement(y,{t:o,isLoading:v,tenantId:r,setShowToast:c,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l={...e,...e.toDate?{toDate:null==n?void 0:n.getTime()}:{},...e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{}};let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>({...e,[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.fromDate||a.applicationNo||a.toDate?!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.applicationNo||a.fromDate||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?c({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):u(a):c({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):c({warning:!0,label:"ERR_VALID_FIELDS"})},data:p&&!v?E.length>0?E:{display:"ES_COMMON_NO_DATA"}:"",count:f}),d&&l.createElement(t.Toast,{error:d.error,warning:d.warning,label:o(d.label),isDleteBtn:!0,onClose:()=>{c(null)}}))},C=e=>{let{t:n,currentPage:a,columns:i,data:o,getCellProps:r,disableSort:s,onSort:u,onNextPage:d,onPrevPage:c,onPageSizeChange:m,pageSizeLimit:v,sortParams:p,totalRecords:E}=e;return l.createElement(t.Table,{t:n,data:o,currentPage:a,columns:i,getCellProps:r,onNextPage:d,onPrevPage:c,pageSizeLimit:v,disableSort:s,onPageSizeChange:m,onSort:u,sortParams:p,totalRecords:E})},D=()=>{const{t:e}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.PropertyHouse,null))," ",l.createElement("span",{className:"text"},e("ASSET_SERVICE")))))},b={date:t.DatePicker,mobileNumber:t.MobileNumber},T=e=>{var n;let{onSearch:i,type:r,onClose:s,searchFields:u,searchParams:d,isInboxPage:c,clearSearch:m}=e;const{t:v}=a.useTranslation(),{handleSubmit:p,reset:E,watch:f,control:g,formState:S,setValue:_}=o.useForm({defaultValues:c?d:{locality:null,city:null,...d}}),h=f(),y=innerWidth<=640;function A(){const e=u.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});if(E(e),c){const e={...d};e.delete=[],u.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),i({...e})}else m()}const C=e=>l.createElement(t.LinkLabel,{style:{display:"inline",...e?{margin:0}:{}},onClick:A},v("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:p(e=>{e.mobileNumber||delete e.mobileNumber,e.delete=[],u.forEach(t=>{e[t.name]||e.delete.push(t.name)}),i(e),"mobile"===r&&s()})},l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||y)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,v("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==u||null===(n=u.filter(e=>!0))||void 0===n?void 0:n.map((e,n)=>{var a,i,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,v(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(o.Controller,e.type?{render:t=>l.createElement(null==b?void 0:b[e.type],{formValue:h,setValue:_,onChange:t.onChange,value:t.value}),name:e.name,control:g,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:g,defaultValue:""})),null!=S&&null!==(a=S.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==S||null===(i=S.errors)||void 0===i||null===(r=i[e.name])||void 0===r?void 0:r.message):null)}),c&&l.createElement("div",{style:{gridColumn:"2/3",textAlign:"right",paddingTop:"10px"},className:"input-fields"},l.createElement("div",null,C())),"desktop"===r&&!y&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:v("ES_COMMON_SEARCH"),disabled:!!Object.keys(S.errors).length||(()=>{var e;let t=!0;return Object.keys(h).forEach(e=>{!["locality","city"].includes(e)&&h[e]&&(t=!1)}),null==u||!u.find(e=>"locality"===e.name)||null!=h&&null!==(e=h.locality)&&void 0!==e&&e.code||(t=!0),t})(),submit:!0}),!c&&l.createElement("div",null,C()))))),("mobile"===r||y)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},C(y)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(S.errors).length,label:v("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},I=e=>{let{tableConfig:i,filterComponent:o,...r}=e;const{data:s,useNewInboxAPI:u}=r,{t:d}=a.useTranslation(),[c,m]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(o)}),[v,p]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r.EmptyResultInboxComp)}),[E,f]=n.useState(!1),g=l.useMemo(()=>r.isSearch?i.searchColumns(r):i.inboxColumns(r)||[],[]);let S;return r.isLoading?S=l.createElement(t.Loader,null):E?S=null:!s||0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?S=v&&l.createElement(v,{data:s})||(0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?l.createElement(t.Card,{style:{marginTop:20}},d("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):l.createElement(t.Loader,null)):(null==s?void 0:s.length)>0&&(S=l.createElement(C,{t:d,data:s,columns:g,getCellProps:e=>({style:{minWidth:e.column.Header===d("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:r.onPageSizeChange,currentPage:r.currentPage,onNextPage:r.onNextPage,onPrevPage:r.onPrevPage,pageSizeLimit:r.pageSizeLimit,onSort:r.onSort,disableSort:r.disableSort,sortParams:r.sortParams,totalRecords:r.totalRecords})),l.createElement("div",{className:"inbox-container"},!r.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(D,{parentRoute:r.parentRoute,businessService:r.moduleCode}),l.createElement("div",null,l.createElement(c,{defaultSearchParams:r.defaultSearchParams,onFilterChange:r.onFilterChange,searchParams:r.searchParams,type:"desktop",useNewInboxAPI:u,statusMap:u?null==s?void 0:s[0].statusMap:null,moduleCode:r.moduleCode}))),l.createElement("div",{style:{flex:1}},l.createElement(T,{defaultSearchParams:r.defaultSearchParams,onSearch:e=>{r.onSearch(e),f(!1)},type:"desktop",searchFields:r.searchFields,isInboxPage:!(null!=r&&r.isSearch),searchParams:r.searchParams,clearSearch:()=>f(!0)}),l.createElement("div",{className:"result",style:{marginLeft:null!=r&&r.isSearch?"":"24px",flex:1}},S)))},O=e=>{const{t:i}=a.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:i("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}});function s(){}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"},i("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:s},i("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:s},i("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:i("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}]})))))},N=e=>{let{t:a,data:i,onFilterChange:o,onSearch:r,onSort:s,serviceRequestIdKey:u,isFstpOperator:d,isLoading:c,isSearch:m,searchParams:v,searchFields:p,sortParams:E,linkPrefix:f,filterComponent:g}=e;const[S,_]=n.useState(m?"SEARCH":""),[h,y]=n.useState(!!m),[A,C]=n.useState(E),[D]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{S&&y(!0)},[S]);const b=()=>{y(!1),_(""),C(E)};if(c)return l.createElement(t.Loader,null);let I;return i&&0!==(null==i?void 0:i.length)?i&&(null==i?void 0:i.length)>0&&(I=l.createElement(t.DetailsCard,{data:i,serviceRequestIdKey:u,linkPrefix:f||"/digit-ui/employee/asset/"})):I=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"},r&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{_("SEARCH"),y(!0)}}),!m&&o&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{_("FILTER"),y(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{_("SORT"),y(!0)}})),I,h&&l.createElement(t.PopUp,null,"FILTER"===S&&l.createElement("div",{className:"popup-module"},l.createElement(D,{onFilterChange:e=>{o(e),y(!1)},Close:b,type:"mobile",searchParams:v})),"SORT"===S&&l.createElement("div",{className:"popup-module"},l.createElement(O,{type:"mobile",sortParams:E,onClose:b,onSort:s})),"SEARCH"===S&&l.createElement("div",{className:"popup-module"},l.createElement(T,{type:"mobile",onClose:b,onSearch:r,isFstpOperator:d,searchParams:v,searchFields:p}))))},R=e=>{let{data:t,isLoading:n,isSearch:i,searchFields:o,onFilterChange:r,onSearch:s,onSort:u,parentRoute:d,searchParams:c,sortParams:m,linkPrefix:v,tableConfig:p,filterComponent:E}=e;const{t:f}=a.useTranslation();return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},!i&&l.createElement(D,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:d,isMobile:!0}),l.createElement(N,{t:f,data:null==t?void 0:t.map(e=>{const t={};return(i?p.searchColumns():p.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:i,onSearch:s,onSort:u,searchParams:c,searchFields:o,linkPrefix:v,sortParams:m,serviceRequestIdKey:null==p?void 0:p.serviceRequestIdKey,filterComponent:E}))))},x=e=>{var i,o,r,s,u;let{useNewInboxAPI:d,parentRoute:c,moduleCode:m="ASSET",initialStates:v={},filterComponent:p,isInbox:E,rawWfHandler:f,rawSearchHandler:g,combineResponse:S,wfConfig:_,searchConfig:h,middlewaresWf:y,middlewareSearch:A,EmptyResultInboxComp:C}=e;const D=Digit.ULBService.getCurrentTenantId(),{t:b}=a.useTranslation(),[T,O]=n.useState(()=>E?{}:{enabled:!1}),[N,x]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("ASTInboxTableConfig")}),[L,P]=n.useState(v.pageOffset||0),[w,M]=n.useState(v.pageSize||10),[F,B]=n.useState(v.sortParams||[{id:"createdTime",desc:!0}]),[k,U]=n.useState(v.searchParams||{});let H=window.Digit.Utils.browser.isMobile(),j=H?{limit:100,offset:0,sortBy:null==F||null===(i=F[0])||void 0===i?void 0:i.id,sortOrder:null!=F&&null!==(o=F[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:w,offset:L,sortBy:null==F||null===(r=F[0])||void 0===r?void 0:r.id,sortOrder:null!=F&&null!==(s=F[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const{isLoading:W,data:V,searchFields:z,...G}=d?Digit.Hooks.useNewInboxGeneral({tenantId:D,ModuleCode:m,filters:{...k,...j,sortParams:F}}):Digit.Hooks.useInboxGeneral({tenantId:D,businessService:m,isInbox:E,filters:{...k,...j,sortParams:F},rawWfHandler:f,rawSearchHandler:g,combineResponse:S,wfConfig:_,searchConfig:{...T,...h},middlewaresWf:y,middlewareSearch:A});n.useEffect(()=>{P(0)},[k]);const K=e=>{let t=e.delete,n={...k,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,U({...n}),O({enabled:!0})},$=n.useCallback(e=>{0!==e.length&&B(e)},[]);var q,Y;if(null!==(null==G||null===(u=G.data)||void 0===u?void 0:u.length))return H?l.createElement(R,{data:V,isLoading:W,isSearch:!E,searchFields:z,onFilterChange:K,onSearch:K,onSort:$,parentRoute:c,searchParams:k,sortParams:F,linkPrefix:c+"/application-details/",tableConfig:null!=G&&G.tableConfig?null===(q=res)||void 0===q?void 0:q.tableConfig:N(b).ASSET,filterComponent:p,EmptyResultInboxComp:C,useNewInboxAPI:d}):l.createElement("div",null,E&&l.createElement(t.Header,null,b("ES_COMMON_INBOX")),l.createElement(I,{moduleCode:m,data:V,tableConfig:N(b).ASSET,isLoading:W,defaultSearchParams:v.searchParams,isSearch:!E,onFilterChange:K,searchFields:z,onSearch:K,onSort:$,onNextPage:()=>{P(e=>e+w)},onPrevPage:()=>{P(e=>e-w)},currentPage:Math.floor(L/w),pageSizeLimit:w,disableSort:!1,onPageSizeChange:e=>{M(Number(e.target.value))},parentRoute:c,searchParams:k,sortParams:F,totalRecords:Number(null==V||null===(Y=V[0])||void 0===Y?void 0:Y.totalCount),filterComponent:p,EmptyResultInboxComp:C,useNewInboxAPI:d}))},L=e=>{var n,o,r,s,u,d,c,v,p,E,f,g,S,_,y,C,D,b,T,I,O,N,R,L;let{path:P,url:w,userType:M}=e;console.log("path",P);const{t:F}=a.useTranslation(),B=i.useLocation();sessionStorage.removeItem("revalidateddone");const k=window.Digit.Utils.browser.isMobile(),U={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},H=e=>{let{location:n}=e;const{t:o}=a.useTranslation(),r=i.useLocation().search,s=(new URLSearchParams(r).get("from"),Digit.Hooks.useQueryParams(),[{path:"/digit-ui/employee",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/asset/assetservice/inbox",content:o("ES_TITLE_INBOX"),show:(n.pathname.includes("asset/assetservice/inbox"),!1)}]);return l.createElement(t.BreadCrumb,{style:k?{display:"flex"}:{margin:"0 0 4px",color:"#000000"},spanStyle:{maxWidth:"min-content"},crumbs:s})},j=null===(n=Digit)||void 0===n||null===(o=n.ComponentRegistryService)||void 0===o?void 0:o.getComponent("AssignAssetApplication"),W=null===(r=Digit)||void 0===r||null===(s=r.ComponentRegistryService)||void 0===s?void 0:s.getComponent("DisposeApplication"),V=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("MaintenanceApplication"),z=null===(c=Digit)||void 0===c||null===(v=c.ComponentRegistryService)||void 0===v?void 0:v.getComponent("editResponse"),G=null===(p=Digit)||void 0===p||null===(E=p.ComponentRegistryService)||void 0===E?void 0:E.getComponent("editAsset"),K=null===(f=Digit)||void 0===f||null===(g=f.ComponentRegistryService)||void 0===g?void 0:g.getComponent("returnAssets"),$=null===(S=Digit)||void 0===S||null===(_=S.ComponentRegistryService)||void 0===_?void 0:_.getComponent("ApplicationDetails"),q=null===(y=Digit)||void 0===y||null===(C=y.ComponentRegistryService)||void 0===C?void 0:C.getComponent("AssetCreateNew"),Y=null===(D=Digit)||void 0===D||null===(b=D.ComponentRegistryService)||void 0===b?void 0:b.getComponent("AssetResponse"),Z=null===(T=Digit)||void 0===T||null===(I=T.ComponentRegistryService)||void 0===I?void 0:I.getComponent("DisposeResponse"),Q=null===(O=Digit)||void 0===O||null===(N=O.ComponentRegistryService)||void 0===N?void 0:N.getComponent("ProcessDepreciationResponse"),X=null===(R=Digit)||void 0===R||null===(L=R.ComponentRegistryService)||void 0===L?void 0:L.getComponent("returnResponse"),J=window.location.href.includes("asset/response"),ee=window.location.href.includes("new-assets")||window.location.href.includes("asset/assetservice/application-details");return l.createElement(i.Switch,null,l.createElement(t.AppContainer,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},J?null:l.createElement("div",{style:ee?{marginLeft:"12px",display:"flex",alignItems:"center"}:{marginLeft:"-4px",display:"flex",alignItems:"center"}},l.createElement(t.BackButton,{location:B}),l.createElement("span",{style:{margin:"0 5px 16px",display:"inline-block"}},"|"),l.createElement(H,{location:B})),l.createElement(t.PrivateRoute,{exact:!0,path:P+"/",component:()=>l.createElement(ta,{matchPath:P,userType:M})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/inbox",component:()=>l.createElement(x,{useNewInboxAPI:!0,parentRoute:P,businessService:"asset-create",filterComponent:"AST_INBOX_FILTER",initialStates:U,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/assign-assets/:id",component:()=>l.createElement(j,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/maintenance-assets/:id",component:()=>l.createElement(V,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/dispose-assets/:id",component:()=>l.createElement(W,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/return-assets/:id",component:()=>l.createElement(K,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/edit/:id",component:()=>l.createElement(G,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/new-assets",component:()=>l.createElement(q,{parentUrl:w})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/application-details/:id",component:()=>l.createElement($,{parentRoute:P})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/applicationsearch/application-details/:id",component:()=>l.createElement($,{parentRoute:P})}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/assign-response",component:e=>l.createElement(Y,m({},e,{parentRoute:P}))}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/asset-dispose-response",component:e=>l.createElement(Z,m({},e,{parentRoute:P}))}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/asset-process-depreciation-response",component:e=>l.createElement(Q,m({},e,{parentRoute:P}))}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/return-response",component:e=>l.createElement(X,m({},e,{parentRoute:P}))}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/search",component:e=>l.createElement(Search,m({},e,{t:F,parentRoute:P}))}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/my-asset",component:e=>l.createElement(h,m({},e,{parentRoute:P}))}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/report",component:e=>l.createElement(A,m({},e,{parentRoute:P}))}),l.createElement(t.PrivateRoute,{path:P+"/assetservice/edit-response",component:e=>l.createElement(z,m({},e,{parentRoute:P}))})))))},P=e=>{var n;let{status:i,searchParams:o,onAssignmentChange:r,statusMap:s}=e;return a.useTranslation(),l.createElement(t.CheckBox,{styles:{height:"unset"},onChange:e=>r({...e,state:i.state},i),checked:null==o?void 0:o.applicationStatus.some(e=>e.uuid===i.uuid),label:`${i.name} (${(null==s||null===(n=s.find(e=>e.statusid===i.uuid))||void 0===n?void 0:n.count)||"-"})`})},w=e=>{var i,o,r,s,u;let{onAssignmentChange:d,searchParams:c,businessServices:m,statusMap:v}=e;const{t:p}=a.useTranslation(),[E,f]=n.useState(!1),{data:g,isLoading:S}=Digit.Hooks.useApplicationStatusGeneral({businessServices:m},{}),{userRoleStates:_}=g||{},h=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return S?l.createElement(t.Loader,null):null!=_&&_.filter(e=>!e.isTerminateState).length?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},p("ES_INBOX_STATUS")),null==_||null===(i=_.filter(e=>!e.isTerminateState))||void 0===i||null===(o=i.slice(0,4))||void 0===o?void 0:o.map((e,t)=>l.createElement(P,{businessServices:m,key:t,onAssignmentChange:d,status:{name:h(e,p),code:e.applicationStatus,...e},searchParams:c,statusMap:v})),(null==_||null===(r=_.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,E&&(null==_||null===(s=_.filter(e=>!e.isTerminateState))||void 0===s||null===(u=s.slice(4))||void 0===u?void 0:u.map((e,t)=>l.createElement(P,{businessServices:m,key:e.uuid,onAssignmentChange:d,status:{name:h(e,p),code:e.applicationStatus,...e},searchParams:c,statusMap:v}))),l.createElement("div",{className:"filter-button",onClick:()=>f(!E)}," ",p(E?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null};var M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function F(e,t){return e(t={exports:{}},t.exports),t.exports}var B=F(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],i="[object Arguments]",o="[object Array]",r="[object Boolean]",s="[object Date]",u="[object Error]",d="[object Function]",c="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",f="[object Set]",g="[object String]",S="[object Symbol]",_="[object WeakMap]",h="[object ArrayBuffer]",y="[object DataView]",A="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",b="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",O="[object Uint16Array]",N="[object Uint32Array]",R=/\b__p \+= '';/g,x=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,w=/[&<>"']/g,F=RegExp(P.source),B=RegExp(w.source),k=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,G=RegExp(z.source),K=/^\s+/,$=/\s/,q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Y=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,ae=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,se=/($^)/,ue=/['\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",me="["+ce+"]",ve="["+de+"]",pe="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",fe="[^\\ud800-\\udfff"+ce+pe+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",Se="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",ye="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ae="(?:"+Ee+"|"+fe+")",Ce="(?:"+ye+"|"+fe+")",De="(?:"+ve+"|"+ge+")?",be="[\\ufe0e\\ufe0f]?"+De+"(?:\\u200d(?:"+[Se,_e,he].join("|")+")[\\ufe0e\\ufe0f]?"+De+")*",Te="(?:"+["[\\u2700-\\u27bf]",_e,he].join("|")+")"+be,Ie="(?:"+[Se+ve+"?",ve,_e,he,"[\\ud800-\\udfff]"].join("|")+")",Oe=RegExp("['’]","g"),Ne=RegExp(ve,"g"),Re=RegExp(ge+"(?="+ge+")|"+Ie+be,"g"),xe=RegExp([ye+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,ye,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,ye+Ae,"$"].join("|")+")",ye+"?"+Ae+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ye+"+(?:['’](?: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_])",pe,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,we=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Me=-1,Fe={};Fe[A]=Fe[C]=Fe[D]=Fe[b]=Fe[T]=Fe[I]=Fe["[object Uint8ClampedArray]"]=Fe[O]=Fe[N]=!0,Fe[i]=Fe[o]=Fe[h]=Fe[r]=Fe[y]=Fe[s]=Fe[u]=Fe[d]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[f]=Fe[g]=Fe[_]=!1;var Be={};Be[i]=Be[o]=Be[h]=Be[y]=Be[r]=Be[s]=Be[A]=Be[C]=Be[D]=Be[b]=Be[T]=Be[m]=Be[v]=Be[p]=Be[E]=Be[f]=Be[g]=Be[S]=Be[I]=Be["[object Uint8ClampedArray]"]=Be[O]=Be[N]=!0,Be[u]=Be[d]=Be[_]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,je="object"==typeof M&&M&&M.Object===Object&&M,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=je||We||Function("return this")(),ze=t&&!t.nodeType&&t,Ge=ze&&e&&!e.nodeType&&e,Ke=Ge&&Ge.exports===ze,$e=Ke&&je.process,qe=function(){try{return Ge&&Ge.require&&Ge.require("util").types||$e&&$e.binding&&$e.binding("util")}catch(e){}}(),Ye=qe&&qe.isArrayBuffer,Ze=qe&&qe.isDate,Qe=qe&&qe.isMap,Xe=qe&&qe.isRegExp,Je=qe&&qe.isSet,et=qe&&qe.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 a=-1,i=null==e?0:e.length;++a<i;){var o=e[a];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 at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function it(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,i=[];++n<l;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function rt(e,t){return!(null==e||!e.length)&>(e,t,0)>-1}function st(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function dt(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,i=null==e?0:e.length;for(l&&i&&(n=e[++a]);++a<i;)n=t(n,e[a],a,e);return n}function mt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function vt(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 pt=yt("length");function Et(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function ft(e,t,n,l){for(var a=e.length,i=n+(l?1:-1);l?i--:++i<a;)if(t(e[i],i,e))return i;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):ft(e,_t,n)}function St(e,t,n,l){for(var a=n-1,i=e.length;++a<i;)if(l(e[a],t))return a;return-1}function _t(e){return e!=e}function ht(e,t){var n=null==e?0:e.length;return n?Dt(e,t)/n:NaN}function yt(e){return function(t){return null==t?void 0:t[e]}}function At(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,i){n=l?(l=!1,e):t(n,e,a,i)}),n}function Dt(e,t){for(var n,l=-1,a=e.length;++l<a;){var i=t(e[l]);void 0!==i&&(n=void 0===n?i:n+i)}return n}function bt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Tt(e){return e?e.slice(0,zt(e)+1).replace(K,""):e}function It(e){return function(t){return e(t)}}function Ot(e,t){return ut(t,function(t){return e[t]})}function Nt(e,t){return e.has(t)}function Rt(e,t){for(var n=-1,l=e.length;++n<l&>(t,e[n],0)>-1;);return n}function xt(e,t){for(var n=e.length;n--&>(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Pt=At({"À":"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"}),wt=At({"&":"&","<":"<",">":">",'"':""","'":"'"});function Mt(e){return"\\"+ke[e]}function Ft(e){return Le.test(e)}function Bt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function kt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[i++]=n)}return o}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function jt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=Re.lastIndex=0;Re.test(e);)++t;return t}(e):pt(e)}function Vt(e){return Ft(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&$.test(e.charAt(t)););return t}var Gt=At({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Kt=function e(t){var M,$=(t=null==t?Ve:Kt.defaults(Ve.Object(),t,Kt.pick(Ve,we))).Array,de=t.Date,ce=t.Error,me=t.Function,ve=t.Math,pe=t.Object,Ee=t.RegExp,fe=t.String,ge=t.TypeError,Se=$.prototype,_e=pe.prototype,he=t["__core-js_shared__"],ye=me.prototype.toString,Ae=_e.hasOwnProperty,Ce=0,De=(M=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||""))?"Symbol(src)_1."+M:"",be=_e.toString,Te=ye.call(pe),Ie=Ve._,Re=Ee("^"+ye.call(Ae).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ke?t.Buffer:void 0,ke=t.Symbol,je=t.Uint8Array,We=Le?Le.allocUnsafe:void 0,ze=kt(pe.getPrototypeOf,pe),Ge=pe.create,$e=_e.propertyIsEnumerable,qe=Se.splice,pt=ke?ke.isConcatSpreadable:void 0,At=ke?ke.iterator:void 0,$t=ke?ke.toStringTag:void 0,qt=function(){try{var e=Xa(pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),Yt=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Zt=de&&de.now!==Ve.Date.now&&de.now,Qt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Xt=ve.ceil,Jt=ve.floor,en=pe.getOwnPropertySymbols,tn=Le?Le.isBuffer:void 0,nn=t.isFinite,ln=Se.join,an=kt(pe.keys,pe),on=ve.max,rn=ve.min,sn=de.now,un=t.parseInt,dn=ve.random,cn=Se.reverse,mn=Xa(t,"DataView"),vn=Xa(t,"Map"),pn=Xa(t,"Promise"),En=Xa(t,"Set"),fn=Xa(t,"WeakMap"),gn=Xa(pe,"create"),Sn=fn&&new fn,_n={},hn=Ii(mn),yn=Ii(vn),An=Ii(pn),Cn=Ii(En),Dn=Ii(fn),bn=ke?ke.prototype:void 0,Tn=bn?bn.valueOf:void 0,In=bn?bn.toString:void 0;function On(e){if(Go(e)&&!wo(e)&&!(e instanceof Ln)){if(e instanceof xn)return e;if(Ae.call(e,"__wrapped__"))return Oi(e)}return new xn(e)}var Nn=function(){function e(){}return function(t){if(!zo(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Rn(){}function xn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function 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 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 Fn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Mn;++t<n;)this.add(e[t])}function Bn(e){var t=this.__data__=new wn(e);this.size=t.size}function kn(e,t){var n=wo(e),l=!n&&Po(e),a=!n&&!l&&ko(e),i=!n&&!l&&!a&&Jo(e),o=n||l||a||i,r=o?bt(e.length,fe):[],s=r.length;for(var u in e)!t&&!Ae.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ii(u,s))||r.push(u);return r}function Un(e){var t=e.length;return t?e[Ml(0,t-1)]:void 0}function Hn(e,t){return Ai(fa(e),Yn(t,0,e.length))}function jn(e){return Ai(fa(e))}function Wn(e,t,n){(void 0!==n&&!Ro(e[t],n)||void 0===n&&!(t in e))&&$n(e,t,n)}function Vn(e,t,n){var l=e[t];Ae.call(e,t)&&Ro(l,n)&&(void 0!==n||t in e)||$n(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(Ro(e[n][0],t))return n;return-1}function Gn(e,t,n,l){return el(e,function(e,a,i){t(l,e,n(e),i)}),l}function Kn(e,t){return e&&ga(t,yr(t),e)}function $n(e,t,n){"__proto__"==t&&qt?qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function qn(e,t){for(var n=-1,l=t.length,a=$(l),i=null==e;++n<l;)a[n]=i?void 0:fr(e,t[n]);return a}function Yn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Zn(e,t,n,l,a,o){var u,_=1&t,R=2&t,x=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!zo(e))return e;var L=wo(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!_)return fa(e,u)}else{var P=ti(e),w=P==d||P==c;if(ko(e))return da(e,_);if(P==p||P==i||w&&!a){if(u=R||w?{}:li(e),!_)return R?function(e,t){return ga(e,ei(e),t)}(e,function(e,t){return e&&ga(t,Ar(t),e)}(u,e)):function(e,t){return ga(e,Ja(e),t)}(e,Kn(u,e))}else{if(!Be[P])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case h:return ca(e);case r:case s:return new l(+e);case y:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case A:case C:case D:case b:case T:case I:case"[object Uint8ClampedArray]":case O:case N:return ma(e,n);case m:return new l;case v:case g:return new l(e);case E:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case S:return Tn?pe(Tn.call(e)):{}}}(e,P,_)}}o||(o=new Bn);var M=o.get(e);if(M)return M;o.set(e,u),Zo(e)?e.forEach(function(l){u.add(Zn(l,t,n,l,e,o))}):Ko(e)&&e.forEach(function(l,a){u.set(a,Zn(l,t,n,a,e,o))});var F=L?void 0:(x?R?Ga:za:R?Ar:yr)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,Zn(l,t,n,a,e,o))}),u}function Qn(e,t,n){var l=n.length;if(null==e)return!l;for(e=pe(e);l--;){var a=n[l],i=e[a];if(void 0===i&&!(a in e)||!(0,t[a])(i))return!1}return!0}function Xn(e,t,l){if("function"!=typeof e)throw new ge(n);return Si(function(){e.apply(void 0,l)},t)}function Jn(e,t,n,l){var a=-1,i=rt,o=!0,r=e.length,s=[],u=t.length;if(!r)return s;n&&(t=ut(t,It(n))),l?(i=st,o=!1):t.length>=200&&(i=Nt,o=!1,t=new Fn(t));e:for(;++a<r;){var d=e[a],c=null==n?d:n(d);if(d=l||0!==d?d:0,o&&c==c){for(var m=u;m--;)if(t[m]===c)continue e;s.push(d)}else i(t,c,l)||s.push(d)}return s}On.templateSettings={escape:k,evaluate:U,interpolate:H,variable:"",imports:{_:On}},(On.prototype=Rn.prototype).constructor=On,(xn.prototype=Nn(Rn.prototype)).constructor=xn,(Ln.prototype=Nn(Rn.prototype)).constructor=Ln,Pn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},Pn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ae.call(t,e)?t[e]:void 0},Pn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:Ae.call(t,e)},Pn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&void 0===t?"__lodash_hash_undefined__":t,this},wn.prototype.clear=function(){this.__data__=[],this.size=0},wn.prototype.delete=function(e){var t=this.__data__,n=zn(t,e);return!(n<0||(n==t.length-1?t.pop():qe.call(t,n,1),--this.size,0))},wn.prototype.get=function(e){var t=this.__data__,n=zn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return zn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,l=zn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new Pn,map:new(vn||wn),string:new Pn}},Mn.prototype.delete=function(e){var t=Za(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Za(this,e).get(e)},Mn.prototype.has=function(e){return Za(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Za(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)},Bn.prototype.clear=function(){this.__data__=new wn,this.size=0},Bn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Bn.prototype.get=function(e){return this.__data__.get(e)},Bn.prototype.has=function(e){return this.__data__.has(e)},Bn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wn){var l=n.__data__;if(!vn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(l)}return n.set(e,t),this.size=n.size,this};var el=ha(sl),tl=ha(ul,!0);function nl(e,t){var n=!0;return el(e,function(e,l,a){return n=!!t(e,l,a)}),n}function ll(e,t,n){for(var l=-1,a=e.length;++l<a;){var i=e[l],o=t(i);if(null!=o&&(void 0===r?o==o&&!Xo(o):n(o,r)))var r=o,s=i}return s}function al(e,t){var n=[];return el(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function il(e,t,n,l,a){var i=-1,o=e.length;for(n||(n=ai),a||(a=[]);++i<o;){var r=e[i];t>0&&n(r)?t>1?il(r,t-1,n,l,a):dt(a,r):l||(a[a.length]=r)}return a}var ol=ya(),rl=ya(!0);function sl(e,t){return e&&ol(e,t,yr)}function ul(e,t){return e&&rl(e,t,yr)}function dl(e,t){return ot(t,function(t){return jo(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[Ti(t[n++])];return n&&n==l?e:void 0}function ml(e,t,n){var l=t(e);return wo(e)?l:dt(l,n(e))}function vl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$t&&$t in pe(e)?function(e){var t=Ae.call(e,$t),n=e[$t];try{e[$t]=void 0;var l=!0}catch(e){}var a=be.call(e);return l&&(t?e[$t]=n:delete e[$t]),a}(e):function(e){return be.call(e)}(e)}function pl(e,t){return e>t}function El(e,t){return null!=e&&Ae.call(e,t)}function fl(e,t){return null!=e&&t in pe(e)}function gl(e,t,n){for(var l=n?st:rt,a=e[0].length,i=e.length,o=i,r=$(i),s=Infinity,u=[];o--;){var d=e[o];o&&t&&(d=ut(d,It(t))),s=rn(d.length,s),r[o]=!n&&(t||a>=120&&d.length>=120)?new Fn(o&&d):void 0}d=e[0];var c=-1,m=r[0];e:for(;++c<a&&u.length<s;){var v=d[c],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?Nt(m,p):l(u,p,n))){for(o=i;--o;){var E=r[o];if(!(E?Nt(E,p):l(e[o],p,n)))continue e}m&&m.push(p),u.push(v)}}return u}function Sl(e,t,n){var l=null==(e=pi(e,t=oa(t,e)))?e:e[Ti(Ui(t))];return null==l?void 0:tt(l,e,n)}function _l(e){return Go(e)&&vl(e)==i}function hl(e,t,n,l,a){return e===t||(null==e||null==t||!Go(e)&&!Go(t)?e!=e&&t!=t:function(e,t,n,l,a,d){var c=wo(e),_=wo(t),A=c?o:ti(e),C=_?o:ti(t),D=(A=A==i?p:A)==p,b=(C=C==i?p:C)==p,T=A==C;if(T&&ko(e)){if(!ko(t))return!1;c=!0,D=!1}if(T&&!D)return d||(d=new Bn),c||Jo(e)?Wa(e,t,n,l,a,d):function(e,t,n,l,a,i,o){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case h:return!(e.byteLength!=t.byteLength||!i(new je(e),new je(t)));case r:case s:case v:return Ro(+e,+t);case u:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var d=Bt;case f:if(d||(d=Ht),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 p=Wa(d(e),d(t),l,a,i,o);return o.delete(e),p;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,A,n,l,a,d);if(!(1&n)){var I=D&&Ae.call(e,"__wrapped__"),O=b&&Ae.call(t,"__wrapped__");if(I||O){var N=I?e.value():e,R=O?t.value():t;return d||(d=new Bn),a(N,R,n,l,d)}}return!!T&&(d||(d=new Bn),function(e,t,n,l,a,i){var o=1&n,r=za(e),s=r.length;if(s!=za(t).length&&!o)return!1;for(var u=s;u--;){var d=r[u];if(!(o?d in t:Ae.call(t,d)))return!1}var c=i.get(e),m=i.get(t);if(c&&m)return c==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var p=o;++u<s;){var E=e[d=r[u]],f=t[d];if(l)var g=o?l(f,E,d,t,e,i):l(E,f,d,e,t,i);if(!(void 0===g?E===f||a(E,f,n,l,i):g)){v=!1;break}p||(p="constructor"==d)}if(v&&!p){var S=e.constructor,_=t.constructor;S==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof _&&_ instanceof _||(v=!1)}return i.delete(e),i.delete(t),v}(e,t,n,l,a,d))}(e,t,n,l,hl,a))}function yl(e,t,n,l){var a=n.length,i=a,o=!l;if(null==e)return!i;for(e=pe(e);a--;){var r=n[a];if(o&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<i;){var s=(r=n[a])[0],u=e[s],d=r[1];if(o&&r[2]){if(void 0===u&&!(s in e))return!1}else{var c=new Bn;if(l)var m=l(u,d,s,e,t,c);if(!(void 0===m?hl(d,u,3,l,c):m))return!1}}return!0}function Al(e){return!(!zo(e)||(t=e,De&&De in t))&&(jo(e)?Re:ae).test(Ii(e));var t}function Cl(e){return"function"==typeof e?e:null==e?$r:"object"==typeof e?wo(e)?Ol(e[0],e[1]):Il(e):ns(e)}function Dl(e){if(!di(e))return an(e);var t=[];for(var n in pe(e))Ae.call(e,n)&&"constructor"!=n&&t.push(n);return t}function bl(e,t){return e<t}function Tl(e,t){var n=-1,l=Fo(e)?$(e.length):[];return el(e,function(e,a,i){l[++n]=t(e,a,i)}),l}function Il(e){var t=Qa(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(n){return n===e||yl(n,e,t)}}function Ol(e,t){return ri(e)&&ci(t)?mi(Ti(e),t):function(n){var l=fr(n,e);return void 0===l&&l===t?gr(n,e):hl(t,l,3)}}function Nl(e,t,n,l,a){e!==t&&ol(t,function(i,o){if(a||(a=new Bn),zo(i))!function(e,t,n,l,a,i,o){var r=fi(e,n),s=fi(t,n),u=o.get(s);if(u)Wn(e,n,u);else{var d=i?i(r,s,n+"",e,t,o):void 0,c=void 0===d;if(c){var m=wo(s),v=!m&&ko(s),p=!m&&!v&&Jo(s);d=s,m||v||p?wo(r)?d=r:Bo(r)?d=fa(r):v?(c=!1,d=da(s,!0)):p?(c=!1,d=ma(s,!0)):d=[]:qo(s)||Po(s)?(d=r,Po(r)?d=rr(r):zo(r)&&!jo(r)||(d=li(s))):c=!1}c&&(o.set(s,d),a(d,s,l,i,o),o.delete(s)),Wn(e,n,d)}}(e,t,o,n,Nl,l,a);else{var r=l?l(fi(e,o),i,o+"",e,t,a):void 0;void 0===r&&(r=i),Wn(e,o,r)}},Ar)}function Rl(e,t){var n=e.length;if(n)return ii(t+=t<0?n:0,n)?e[t]:void 0}function xl(e,t,n){t=t.length?ut(t,function(e){return wo(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[$r];var l=-1;return t=ut(t,It(Ya())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,i=t.criteria,o=a.length,r=n.length;++l<o;){var s=va(a[l],i[l]);if(s)return l>=r?s:s*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Tl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,i={};++l<a;){var o=t[l],r=cl(e,o);n(r,o)&&Hl(i,oa(o,e),r)}return i}function Pl(e,t,n,l){var a=l?St:gt,i=-1,o=t.length,r=e;for(e===t&&(t=fa(t)),n&&(r=ut(e,It(n)));++i<o;)for(var s=0,u=t[i],d=n?n(u):u;(s=a(r,d,s,l))>-1;)r!==e&&qe.call(r,s,1),qe.call(e,s,1);return e}function wl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==i){var i=a;ii(a)?qe.call(e,a,1):Xl(e,a)}}return e}function Ml(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 Bl(e,t){return _i(vi(e,t,$r),e+"")}function kl(e){return Un(Rr(e))}function Ul(e,t){var n=Rr(e);return Ai(n,Yn(t,0,n.length))}function Hl(e,t,n,l){if(!zo(e))return e;for(var a=-1,i=(t=oa(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=Ti(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=o){var d=r[s];void 0===(u=l?l(d,s,r):void 0)&&(u=zo(d)?d:ii(t[a+1])?[]:{})}Vn(r,s,u),r=r[s]}return e}var jl=Sn?function(e,t){return Sn.set(e,t),e}:$r,Wl=qt?function(e,t){return qt(e,"toString",{configurable:!0,enumerable:!1,value:zr(t),writable:!0})}:$r;function Vl(e){return Ai(Rr(e))}function zl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=$(a);++l<a;)i[l]=e[l+t];return i}function Gl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Kl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var i=l+a>>>1,o=e[i];null!==o&&!Xo(o)&&(n?o<=t:o<t)?l=i+1:a=i}return a}return $l(e,t,$r,n)}function $l(e,t,n,l){var a=0,i=null==e?0:e.length;if(0===i)return 0;for(var o=(t=n(t))!=t,r=null===t,s=Xo(t),u=void 0===t;a<i;){var d=Jt((a+i)/2),c=n(e[d]),m=void 0!==c,v=null===c,p=c==c,E=Xo(c);if(o)var f=l||p;else f=u?p&&(l||m):r?p&&m&&(l||!v):s?p&&m&&!v&&(l||!E):!v&&!E&&(l?c<=t:c<t);f?a=d+1:i=d}return rn(i,4294967294)}function ql(e,t){for(var n=-1,l=e.length,a=0,i=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!Ro(r,s)){var s=r;i[a++]=0===o?0:o}}return i}function Yl(e){return"number"==typeof e?e:Xo(e)?NaN:+e}function Zl(e){if("string"==typeof e)return e;if(wo(e))return ut(e,Zl)+"";if(Xo(e))return In?In.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ql(e,t,n){var l=-1,a=rt,i=e.length,o=!0,r=[],s=r;if(n)o=!1,a=st;else if(i>=200){var u=t?null:Fa(e);if(u)return Ht(u);o=!1,a=Nt,s=new Fn}else s=t?[]:r;e:for(;++l<i;){var d=e[l],c=t?t(d):d;if(d=n||0!==d?d:0,o&&c==c){for(var m=s.length;m--;)if(s[m]===c)continue e;t&&s.push(c),r.push(d)}else a(s,c,n)||(s!==r&&s.push(c),r.push(d))}return r}function Xl(e,t){return null==(e=pi(e,t=oa(t,e)))||delete e[Ti(Ui(t))]}function Jl(e,t,n,l){return Hl(e,t,n(cl(e,t)),l)}function ea(e,t,n,l){for(var a=e.length,i=l?a:-1;(l?i--:++i<a)&&t(e[i],i,e););return n?zl(e,l?0:i,l?i+1:a):zl(e,l?i+1:0,l?a:i)}function ta(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))},n)}function na(e,t,n){var l=e.length;if(l<2)return l?Ql(e[0]):[];for(var a=-1,i=$(l);++a<l;)for(var o=e[a],r=-1;++r<l;)r!=a&&(i[a]=Jn(i[a]||o,e[r],t,n));return Ql(il(i,1),t,n)}function la(e,t,n){for(var l=-1,a=e.length,i=t.length,o={};++l<a;)n(o,e[l],l<i?t[l]:void 0);return o}function aa(e){return Bo(e)?e:[]}function ia(e){return"function"==typeof e?e:$r}function oa(e,t){return wo(e)?e:ri(e,t)?[e]:bi(sr(e))}var ra=Bl;function sa(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ua=Yt||function(e){return Ve.clearTimeout(e)};function da(e,t){if(t)return e.slice();var n=e.length,l=We?We(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function ma(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function va(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,i=Xo(e),o=void 0!==t,r=null===t,s=t==t,u=Xo(t);if(!r&&!u&&!i&&e>t||i&&o&&s&&!r&&!u||l&&o&&s||!n&&s||!a)return 1;if(!l&&!i&&!u&&e<t||u&&n&&a&&!l&&!i||r&&n&&a||!o&&a||!s)return-1}return 0}function pa(e,t,n,l){for(var a=-1,i=e.length,o=n.length,r=-1,s=t.length,u=on(i-o,0),d=$(s+u),c=!l;++r<s;)d[r]=t[r];for(;++a<o;)(c||a<i)&&(d[n[a]]=e[a]);for(;u--;)d[r++]=e[a++];return d}function Ea(e,t,n,l){for(var a=-1,i=e.length,o=-1,r=n.length,s=-1,u=t.length,d=on(i-r,0),c=$(d+u),m=!l;++a<d;)c[a]=e[a];for(var v=a;++s<u;)c[v+s]=t[s];for(;++o<r;)(m||a<i)&&(c[v+n[o]]=e[a++]);return c}function fa(e,t){var n=-1,l=e.length;for(t||(t=$(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?$n(n,r,s):Vn(n,r,s)}return n}function Sa(e,t){return function(n,l){var a=wo(n)?nt:Gn,i=t?t():{};return a(n,e,Ya(l,2),i)}}function _a(e){return Bl(function(t,n){var l=-1,a=n.length,i=a>1?n[a-1]:void 0,o=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,o&&oi(n[0],n[1],o)&&(i=a<3?void 0:i,a=1),t=pe(t);++l<a;){var r=n[l];r&&e(t,r,l,i)}return t})}function ha(e,t){return function(n,l){if(null==n)return n;if(!Fo(n))return e(n,l);for(var a=n.length,i=t?a:-1,o=pe(n);(t?i--:++i<a)&&!1!==l(o[i],i,o););return n}}function ya(e){return function(t,n,l){for(var a=-1,i=pe(t),o=l(t),r=o.length;r--;){var s=o[e?r:++a];if(!1===n(i[s],s,i))break}return t}}function Aa(e){return function(t){var n=Ft(t=sr(t))?Vt(t):void 0,l=n?n[0]:t.charAt(0),a=n?sa(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(jr(Pr(t).replace(Oe,"")),e,"")}}function Da(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=Nn(e.prototype),l=e.apply(n,t);return zo(l)?l:n}}function ba(e){return function(t,n,l){var a=pe(t);if(!Fo(t)){var i=Ya(n,3);t=yr(t),n=function(e){return i(a[e],e,a)}}var o=e(t,n,l);return o>-1?a[i?t[o]:o]:void 0}}function Ta(e){return Va(function(t){var l=t.length,a=l,i=xn.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new ge(n);if(i&&!r&&"wrapper"==$a(o))var r=new xn([],!0)}for(a=r?a:l;++a<l;){var s=$a(o=t[a]),u="wrapper"==s?Ka(o):void 0;r=u&&si(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[$a(u[0])].apply(r,u[3]):1==o.length&&si(o)?r[s]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&wo(n))return r.plant(n).value();for(var a=0,i=l?t[a].apply(this,e):n;++a<l;)i=t[a].call(this,i);return i}})}function Ia(e,t,n,l,a,i,o,r,s,u){var d=128&t,c=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:Da(e);return function f(){for(var g=arguments.length,S=$(g),_=g;_--;)S[_]=arguments[_];if(v)var h=qa(f),y=Lt(S,h);if(l&&(S=pa(S,l,a,v)),i&&(S=Ea(S,i,o,v)),g-=y,v&&g<u){var A=Ut(S,h);return wa(e,t,Ia,f.placeholder,n,S,A,r,s,u-g)}var C=c?n:this,D=m?C[e]:e;return g=S.length,r?S=Ei(S,r):p&&g>1&&S.reverse(),d&&s<g&&(S.length=s),this&&this!==Ve&&this instanceof f&&(D=E||Da(D)),D.apply(C,S)}}function Oa(e,t){return function(n,l){return function(e,t,n,l){return sl(e,function(e,a,i){t(l,n(e),a,i)}),l}(n,e,t(l),{})}}function Na(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Zl(n),l=Zl(l)):(n=Yl(n),l=Yl(l)),a=e(n,l)}return a}}function Ra(e){return Va(function(t){return t=ut(t,It(Ya())),Bl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function xa(e,t){var n=(t=void 0===t?" ":Zl(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Xt(e/Wt(t)));return Ft(t)?sa(Vt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oi(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 a=-1,i=on(Xt((t-e)/(n||1)),0),o=$(i);i--;)o[l?i:++a]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function Pa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function wa(e,t,n,l,a,i,o,r,s,u){var d=8&t;t|=d?32:64,4&(t&=~(d?64:32))||(t&=-4);var c=[e,t,a,d?i:void 0,d?o:void 0,d?void 0:i,d?void 0:o,r,s,u],m=n.apply(void 0,c);return si(e)&&gi(m,c),m.placeholder=l,hi(m,e,t)}function Ma(e){var t=ve[e];return function(e,n){if(e=or(e),(n=null==n?0:rn(ar(n),292))&&nn(e)){var l=(sr(e)+"e").split("e");return+((l=(sr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Fa=En&&1/Ht(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Xr;function Ba(e){return function(t){var n=ti(t);return n==m?Bt(t):n==f?jt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,i,o,r,s,u){var d=2&t;if(!d&&"function"!=typeof e)throw new ge(n);var c=i?i.length:0;if(c||(t&=-97,i=o=void 0),s=void 0===s?s:on(ar(s),0),u=void 0===u?u:ar(u),c-=o?o.length:0,64&t){var m=i,v=o;i=o=void 0}var p=d?void 0:Ka(e),E=[e,t,a,i,o,m,v,r,s,u];if(p&&function(e,t){var n=e[1],a=t[1],i=n|a;if(!(i<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],i|=1&n?0:4);var o=t[3];if(o){var r=e[3];e[3]=r?pa(r,o,t[4]):o,e[4]=r?Ut(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?Ea(r,o,t[6]):o,e[6]=r?Ut(e[5],l):t[6]),(o=t[7])&&(e[7]=o),128&a&&(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]=i}(E,p),e=E[0],t=E[1],a=E[2],i=E[3],o=E[4],!(u=E[9]=void 0===E[9]?d?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=Da(e);return function a(){for(var i=arguments.length,o=$(i),r=i,s=qa(a);r--;)o[r]=arguments[r];var u=i<3&&o[0]!==s&&o[i-1]!==s?[]:Ut(o,s);if((i-=u.length)<n)return wa(e,t,Ia,a.placeholder,void 0,o,u,void 0,void 0,n-i);var d=this&&this!==Ve&&this instanceof a?l:e;return tt(d,this,o)}}(e,t,u):32!=t&&33!=t||o.length?Ia.apply(void 0,E):function(e,t,n,l){var a=1&t,i=Da(e);return function t(){for(var o=-1,r=arguments.length,s=-1,u=l.length,d=$(u+r),c=this&&this!==Ve&&this instanceof t?i:e;++s<u;)d[s]=l[s];for(;r--;)d[s++]=arguments[++o];return tt(c,a?n:this,d)}}(e,t,a,i);else var f=function(e,t,n){var l=1&t,a=Da(e);return function t(){var i=this&&this!==Ve&&this instanceof t?a:e;return i.apply(l?n:this,arguments)}}(e,t,a);return hi((p?jl:gi)(f,E),e,t)}function Ua(e,t,n,l){return void 0===e||Ro(e,_e[n])&&!Ae.call(l,n)?t:e}function Ha(e,t,n,l,a,i){return zo(e)&&zo(t)&&(i.set(t,e),Nl(e,t,void 0,Ha,i),i.delete(t)),e}function ja(e){return qo(e)?void 0:e}function Wa(e,t,n,l,a,i){var o=1&n,r=e.length,s=t.length;if(r!=s&&!(o&&s>r))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var c=-1,m=!0,v=2&n?new Fn:void 0;for(i.set(e,t),i.set(t,e);++c<r;){var p=e[c],E=t[c];if(l)var f=o?l(E,p,c,t,e,i):l(p,E,c,e,t,i);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!vt(t,function(e,t){if(!Nt(v,t)&&(p===e||a(p,e,n,l,i)))return v.push(t)})){m=!1;break}}else if(p!==E&&!a(p,E,n,l,i)){m=!1;break}}return i.delete(e),i.delete(t),m}function Va(e){return _i(vi(e,void 0,wi),e+"")}function za(e){return ml(e,yr,Ja)}function Ga(e){return ml(e,Ar,ei)}var Ka=Sn?function(e){return Sn.get(e)}:Xr;function $a(e){for(var t=e.name+"",n=_n[t],l=Ae.call(_n,t)?n.length:0;l--;){var a=n[l],i=a.func;if(null==i||i==e)return a.name}return t}function qa(e){return(Ae.call(On,"placeholder")?On:e).placeholder}function Ya(){var e=On.iteratee||qr;return e=e===qr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Za(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Qa(e){for(var t=yr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,ci(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Al(n)?n:void 0}var Ja=en?function(e){return null==e?[]:(e=pe(e),ot(en(e),function(t){return $e.call(e,t)}))}:is,ei=en?function(e){for(var t=[];e;)dt(t,Ja(e)),e=ze(e);return t}:is,ti=vl;function ni(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,i=!1;++l<a;){var o=Ti(t[l]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++l!=a?i:!!(a=null==e?0:e.length)&&Vo(a)&&ii(o,a)&&(wo(e)||Po(e))}function li(e){return"function"!=typeof e.constructor||di(e)?{}:Nn(ze(e))}function ai(e){return wo(e)||Po(e)||!!(pt&&e&&e[pt])}function ii(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 oi(e,t,n){if(!zo(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&ii(t,n.length):"string"==l&&t in n)&&Ro(n[t],e)}function ri(e,t){if(wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xo(e))||W.test(e)||!j.test(e)||null!=t&&e in pe(t)}function si(e){var t=$a(e),n=On[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Ka(n);return!!l&&e===l[0]}(mn&&ti(new mn(new ArrayBuffer(1)))!=y||vn&&ti(new vn)!=m||pn&&"[object Promise]"!=ti(pn.resolve())||En&&ti(new En)!=f||fn&&ti(new fn)!=_)&&(ti=function(e){var t=vl(e),n=t==p?e.constructor:void 0,l=n?Ii(n):"";if(l)switch(l){case hn:return y;case yn:return m;case An:return"[object Promise]";case Cn:return f;case Dn:return _}return t});var ui=he?jo:os;function di(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function ci(e){return e==e&&!zo(e)}function mi(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in pe(n))}}function vi(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,i=on(l.length-t,0),o=$(i);++a<i;)o[a]=l[t+a];a=-1;for(var r=$(t+1);++a<t;)r[a]=l[a];return r[t]=n(o),tt(e,this,r)}}function pi(e,t){return t.length<2?e:cl(e,zl(t,0,-1))}function Ei(e,t){for(var n=e.length,l=rn(t.length,n),a=fa(e);l--;){var i=t[l];e[l]=ii(i,n)?a[i]:void 0}return e}function fi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gi=yi(jl),Si=Qt||function(e,t){return Ve.setTimeout(e,t)},_i=yi(Wl);function hi(e,t,n){var l=t+"";return _i(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(q,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(a,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match(Y);return t?t[1].split(Z):[]}(l),n)))}function yi(e){var t=0,n=0;return function(){var l=sn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Ai(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var i=Ml(n,a),o=e[i];e[i]=e[n],e[n]=o}return e.length=t,e}var Ci,Di,bi=(Ci=Do(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(V,function(e,n,l,a){t.push(l?a.replace(J,"$1"):n||e)}),t},function(e){return 500===Di.size&&Di.clear(),e}),Di=Ci.cache,Ci);function Ti(e){if("string"==typeof e||Xo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ii(e){if(null!=e){try{return ye.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oi(e){if(e instanceof Ln)return e.clone();var t=new xn(e.__wrapped__,e.__chain__);return t.__actions__=fa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ni=Bl(function(e,t){return Bo(e)?Jn(e,il(t,1,Bo,!0)):[]}),Ri=Bl(function(e,t){var n=Ui(t);return Bo(n)&&(n=void 0),Bo(e)?Jn(e,il(t,1,Bo,!0),Ya(n,2)):[]}),xi=Bl(function(e,t){var n=Ui(t);return Bo(n)&&(n=void 0),Bo(e)?Jn(e,il(t,1,Bo,!0),void 0,n):[]});function Li(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),ft(e,Ya(t,3),a)}function Pi(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=ar(n),a=n<0?on(l+a,0):rn(a,l-1)),ft(e,Ya(t,3),a,!0)}function wi(e){return null!=e&&e.length?il(e,1):[]}function Mi(e){return e&&e.length?e[0]:void 0}var Fi=Bl(function(e){var t=ut(e,aa);return t.length&&t[0]===e[0]?gl(t):[]}),Bi=Bl(function(e){var t=Ui(e),n=ut(e,aa);return t===Ui(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,Ya(t,2)):[]}),ki=Bl(function(e){var t=Ui(e),n=ut(e,aa);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Hi=Bl(ji);function ji(e,t){return e&&e.length&&t&&t.length?Pl(e,t):e}var Wi=Va(function(e,t){var n=null==e?0:e.length,l=qn(e,t);return wl(e,ut(t,function(e){return ii(e,n)?+e:e}).sort(va)),l});function Vi(e){return null==e?e:cn.call(e)}var zi=Bl(function(e){return Ql(il(e,1,Bo,!0))}),Gi=Bl(function(e){var t=Ui(e);return Bo(t)&&(t=void 0),Ql(il(e,1,Bo,!0),Ya(t,2))}),Ki=Bl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Ql(il(e,1,Bo,!0),void 0,t)});function $i(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Bo(e))return t=on(e.length,t),!0}),bt(t,function(t){return ut(e,yt(t))})}function qi(e,t){if(!e||!e.length)return[];var n=$i(e);return null==t?n:ut(n,function(e){return tt(t,void 0,e)})}var Yi=Bl(function(e,t){return Bo(e)?Jn(e,t):[]}),Zi=Bl(function(e){return na(ot(e,Bo))}),Qi=Bl(function(e){var t=Ui(e);return Bo(t)&&(t=void 0),na(ot(e,Bo),Ya(t,2))}),Xi=Bl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,na(ot(e,Bo),void 0,t)}),Ji=Bl($i),eo=Bl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,qi(e,n)});function to(e){var t=On(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var lo=Va(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return qn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&ii(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[a],thisArg:void 0}),new xn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ao=Sa(function(e,t,n){Ae.call(e,n)?++e[n]:$n(e,n,1)}),io=ba(Li),oo=ba(Pi);function ro(e,t){return(wo(e)?lt:el)(e,Ya(t,3))}function so(e,t){return(wo(e)?at:tl)(e,Ya(t,3))}var uo=Sa(function(e,t,n){Ae.call(e,n)?e[n].push(t):$n(e,n,[t])}),co=Bl(function(e,t,n){var l=-1,a="function"==typeof t,i=Fo(e)?$(e.length):[];return el(e,function(e){i[++l]=a?tt(t,e,n):Sl(e,t,n)}),i}),mo=Sa(function(e,t,n){$n(e,n,t)});function vo(e,t){return(wo(e)?ut:Tl)(e,Ya(t,3))}var po=Sa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Eo=Bl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oi(e,t[0],t[1])?t=[]:n>2&&oi(t[0],t[1],t[2])&&(t=[t[0]]),xl(e,il(t,1),[])}),fo=Zt||function(){return Ve.Date.now()};function go(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function So(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var _o=Bl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,qa(_o));l|=32}return ka(e,l,t,n,a)}),ho=Bl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,qa(ho));l|=32}return ka(t,l,e,n,a)});function yo(e,t,l){var a,i,o,r,s,u,d=0,c=!1,m=!1,v=!0;if("function"!=typeof e)throw new ge(n);function p(t){var n=a,l=i;return a=i=void 0,d=t,r=e.apply(l,n)}function E(e){return d=e,s=Si(g,t),c?p(e):r}function f(e){var n=e-u;return void 0===u||n>=t||n<0||m&&e-d>=o}function g(){var e=fo();if(f(e))return S(e);s=Si(g,function(e){var n=t-(e-u);return m?rn(n,o-(e-d)):n}(e))}function S(e){return s=void 0,v&&a?p(e):(a=i=void 0,r)}function _(){var e=fo(),n=f(e);if(a=arguments,i=this,u=e,n){if(void 0===s)return E(u);if(m)return ua(s),s=Si(g,t),p(u)}return void 0===s&&(s=Si(g,t)),r}return t=or(t)||0,zo(l)&&(c=!!l.leading,o=(m="maxWait"in l)?on(or(l.maxWait)||0,t):o,v="trailing"in l?!!l.trailing:v),_.cancel=function(){void 0!==s&&ua(s),d=0,a=u=i=s=void 0},_.flush=function(){return void 0===s?r:S(fo())},_}var Ao=Bl(function(e,t){return Xn(e,1,t)}),Co=Bl(function(e,t,n){return Xn(e,or(t)||0,n)});function Do(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=l.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return l.cache=i.set(a,o)||i,o};return l.cache=new(Do.Cache||Mn),l}function bo(e){if("function"!=typeof e)throw new ge(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Do.Cache=Mn;var To=ra(function(e,t){var n=(t=1==t.length&&wo(t[0])?ut(t[0],It(Ya())):ut(il(t,1),It(Ya()))).length;return Bl(function(l){for(var a=-1,i=rn(l.length,n);++a<i;)l[a]=t[a].call(this,l[a]);return tt(e,this,l)})}),Io=Bl(function(e,t){return ka(e,32,void 0,t,Ut(t,qa(Io)))}),Oo=Bl(function(e,t){return ka(e,64,void 0,t,Ut(t,qa(Oo)))}),No=Va(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function Ro(e,t){return e===t||e!=e&&t!=t}var xo=Pa(pl),Lo=Pa(function(e,t){return e>=t}),Po=_l(function(){return arguments}())?_l:function(e){return Go(e)&&Ae.call(e,"callee")&&!$e.call(e,"callee")},wo=$.isArray,Mo=Ye?It(Ye):function(e){return Go(e)&&vl(e)==h};function Fo(e){return null!=e&&Vo(e.length)&&!jo(e)}function Bo(e){return Go(e)&&Fo(e)}var ko=tn||os,Uo=Ze?It(Ze):function(e){return Go(e)&&vl(e)==s};function Ho(e){if(!Go(e))return!1;var t=vl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!qo(e)}function jo(e){if(!zo(e))return!1;var t=vl(e);return t==d||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wo(e){return"number"==typeof e&&e==ar(e)}function Vo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Go(e){return null!=e&&"object"==typeof e}var Ko=Qe?It(Qe):function(e){return Go(e)&&ti(e)==m};function $o(e){return"number"==typeof e||Go(e)&&vl(e)==v}function qo(e){if(!Go(e)||vl(e)!=p)return!1;var t=ze(e);if(null===t)return!0;var n=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ye.call(n)==Te}var Yo=Xe?It(Xe):function(e){return Go(e)&&vl(e)==E},Zo=Je?It(Je):function(e){return Go(e)&&ti(e)==f};function Qo(e){return"string"==typeof e||!wo(e)&&Go(e)&&vl(e)==g}function Xo(e){return"symbol"==typeof e||Go(e)&&vl(e)==S}var Jo=et?It(et):function(e){return Go(e)&&Vo(e.length)&&!!Fe[vl(e)]},er=Pa(bl),tr=Pa(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fo(e))return Qo(e)?Vt(e):fa(e);if(At&&e[At])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[At]());var t=ti(e);return(t==m?Bt:t==f?Ht:Rr)(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 ar(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function ir(e){return e?Yn(ar(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Xo(e))return NaN;if(zo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=le.test(e);return n||ie.test(e)?He(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return ga(e,Ar(e))}function sr(e){return null==e?"":Zl(e)}var ur=_a(function(e,t){if(di(t)||Fo(t))ga(t,yr(t),e);else for(var n in t)Ae.call(t,n)&&Vn(e,n,t[n])}),dr=_a(function(e,t){ga(t,Ar(t),e)}),cr=_a(function(e,t,n,l){ga(t,Ar(t),e,l)}),mr=_a(function(e,t,n,l){ga(t,yr(t),e,l)}),vr=Va(qn),pr=Bl(function(e,t){e=pe(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oi(t[0],t[1],a)&&(l=1);++n<l;)for(var i=t[n],o=Ar(i),r=-1,s=o.length;++r<s;){var u=o[r],d=e[u];(void 0===d||Ro(d,_e[u])&&!Ae.call(e,u))&&(e[u]=i[u])}return e}),Er=Bl(function(e){return e.push(void 0,Ha),tt(Dr,void 0,e)});function fr(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&ni(e,t,fl)}var Sr=Oa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),e[t]=n},zr($r)),_r=Oa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),Ae.call(e,t)?e[t].push(n):e[t]=[n]},Ya),hr=Bl(Sl);function yr(e){return Fo(e)?kn(e):Dl(e)}function Ar(e){return Fo(e)?kn(e,!0):function(e){if(!zo(e))return function(e){var t=[];if(null!=e)for(var n in pe(e))t.push(n);return t}(e);var t=di(e),n=[];for(var l in e)("constructor"!=l||!t&&Ae.call(e,l))&&n.push(l);return n}(e)}var Cr=_a(function(e,t,n){Nl(e,t,n)}),Dr=_a(function(e,t,n,l){Nl(e,t,n,l)}),br=Va(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,Ga(e),n),l&&(n=Zn(n,7,ja));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Tr=Va(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Ir(e,t){if(null==e)return{};var n=ut(Ga(e),function(e){return[e]});return t=Ya(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Or=Ba(yr),Nr=Ba(Ar);function Rr(e){return null==e?[]:Ot(e,yr(e))}var xr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Hr(sr(e).toLowerCase())}function Pr(e){return(e=sr(e))&&e.replace(re,Pt).replace(Ne,"")}var wr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=Aa("toLowerCase"),Br=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Ca(function(e,t,n){return e+(n?" ":"")+Hr(t)}),Ur=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Hr=Aa("toUpperCase");function jr(e,t,n){return e=sr(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.match(Q)||[]}(e):e.match(t)||[]}var Wr=Bl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Ho(e)?e:new ce(e)}}),Vr=Va(function(e,t){return lt(t,function(t){t=Ti(t),$n(e,t,_o(e[t],e))}),e});function zr(e){return function(){return e}}var Gr=Ta(),Kr=Ta(!0);function $r(e){return e}function qr(e){return Cl("function"==typeof e?e:Zn(e,1))}var Yr=Bl(function(e,t){return function(n){return Sl(n,e,t)}}),Zr=Bl(function(e,t){return function(n){return Sl(e,n,t)}});function Qr(e,t,n){var l=yr(t),a=dl(t,l);null!=n||zo(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=dl(t,yr(t)));var i=!(zo(n)&&"chain"in n&&!n.chain),o=jo(e);return lt(a,function(n){var l=t[n];e[n]=l,o&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),a=n.__actions__=fa(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,dt([this.value()],arguments))})}),e}function Xr(){}var Jr=Ra(ut),es=Ra(it),ts=Ra(vt);function ns(e){return ri(e)?yt(Ti(e)):function(e){return function(t){return cl(t,e)}}(e)}var ls=La(),as=La(!0);function is(){return[]}function os(){return!1}var rs,ss=Na(function(e,t){return e+t},0),us=Ma("ceil"),ds=Na(function(e,t){return e/t},1),cs=Ma("floor"),ms=Na(function(e,t){return e*t},1),vs=Ma("round"),ps=Na(function(e,t){return e-t},0);return On.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){if(--e<1)return t.apply(this,arguments)}},On.ary=go,On.assign=ur,On.assignIn=dr,On.assignInWith=cr,On.assignWith=mr,On.at=vr,On.before=So,On.bind=_o,On.bindAll=Vr,On.bindKey=ho,On.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return wo(e)?e:[e]},On.chain=to,On.chunk=function(e,t,n){t=(n?oi(e,t,n):void 0===t)?1:on(ar(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,i=0,o=$(Xt(l/t));a<l;)o[i++]=zl(e,a,a+=t);return o},On.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var i=e[t];i&&(a[l++]=i)}return a},On.concat=function(){var e=arguments.length;if(!e)return[];for(var t=$(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return dt(wo(n)?fa(n):[n],il(t,1))},On.cond=function(e){var t=null==e?0:e.length,l=Ya();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Bl(function(n){for(var l=-1;++l<t;){var a=e[l];if(tt(a[0],this,n))return tt(a[1],this,n)}})},On.conforms=function(e){return function(e){var t=yr(e);return function(n){return Qn(n,e,t)}}(Zn(e,1))},On.constant=zr,On.countBy=ao,On.create=function(e,t){var n=Nn(e);return null==t?n:Kn(n,t)},On.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},On.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},On.debounce=yo,On.defaults=pr,On.defaultsDeep=Er,On.defer=Ao,On.delay=Co,On.difference=Ni,On.differenceBy=Ri,On.differenceWith=xi,On.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:ar(t))<0?0:t,l):[]},On.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,0,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t):[]},On.dropRightWhile=function(e,t){return e&&e.length?ea(e,Ya(t,3),!0,!0):[]},On.dropWhile=function(e,t){return e&&e.length?ea(e,Ya(t,3),!0):[]},On.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oi(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=ar(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:ar(l))<0&&(l+=a),l=n>l?0:ir(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},On.filter=function(e,t){return(wo(e)?ot:al)(e,Ya(t,3))},On.flatMap=function(e,t){return il(vo(e,t),1)},On.flatMapDeep=function(e,t){return il(vo(e,t),1/0)},On.flatMapDepth=function(e,t,n){return n=void 0===n?1:ar(n),il(vo(e,t),n)},On.flatten=wi,On.flattenDeep=function(e){return null!=e&&e.length?il(e,1/0):[]},On.flattenDepth=function(e,t){return null!=e&&e.length?il(e,t=void 0===t?1:ar(t)):[]},On.flip=function(e){return ka(e,512)},On.flow=Gr,On.flowRight=Kr,On.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},On.functions=function(e){return null==e?[]:dl(e,yr(e))},On.functionsIn=function(e){return null==e?[]:dl(e,Ar(e))},On.groupBy=uo,On.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},On.intersection=Fi,On.intersectionBy=Bi,On.intersectionWith=ki,On.invert=Sr,On.invertBy=_r,On.invokeMap=co,On.iteratee=qr,On.keyBy=mo,On.keys=yr,On.keysIn=Ar,On.map=vo,On.mapKeys=function(e,t){var n={};return t=Ya(t,3),sl(e,function(e,l,a){$n(n,t(e,l,a),e)}),n},On.mapValues=function(e,t){var n={};return t=Ya(t,3),sl(e,function(e,l,a){$n(n,l,t(e,l,a))}),n},On.matches=function(e){return Il(Zn(e,1))},On.matchesProperty=function(e,t){return Ol(e,Zn(t,1))},On.memoize=Do,On.merge=Cr,On.mergeWith=Dr,On.method=Yr,On.methodOf=Zr,On.mixin=Qr,On.negate=bo,On.nthArg=function(e){return e=ar(e),Bl(function(t){return Rl(t,e)})},On.omit=br,On.omitBy=function(e,t){return Ir(e,bo(Ya(t)))},On.once=function(e){return So(2,e)},On.orderBy=function(e,t,n,l){return null==e?[]:(wo(t)||(t=null==t?[]:[t]),wo(n=l?void 0:n)||(n=null==n?[]:[n]),xl(e,t,n))},On.over=Jr,On.overArgs=To,On.overEvery=es,On.overSome=ts,On.partial=Io,On.partialRight=Oo,On.partition=po,On.pick=Tr,On.pickBy=Ir,On.property=ns,On.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},On.pull=Hi,On.pullAll=ji,On.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,Ya(n,2)):e},On.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,void 0,n):e},On.pullAt=Wi,On.range=ls,On.rangeRight=as,On.rearg=No,On.reject=function(e,t){return(wo(e)?ot:al)(e,bo(Ya(t,3)))},On.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],i=e.length;for(t=Ya(t,3);++l<i;){var o=e[l];t(o,l,e)&&(n.push(o),a.push(l))}return wl(e,a),n},On.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Bl(e,t=void 0===t?t:ar(t))},On.reverse=Vi,On.sampleSize=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),(wo(e)?Hn:Ul)(e,t)},On.set=function(e,t,n){return null==e?e:Hl(e,t,n)},On.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Hl(e,t,n,l)},On.shuffle=function(e){return(wo(e)?jn:Vl)(e)},On.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oi(e,t,n)?(t=0,n=l):(t=null==t?0:ar(t),n=void 0===n?l:ar(n)),zl(e,t,n)):[]},On.sortBy=Eo,On.sortedUniq=function(e){return e&&e.length?ql(e):[]},On.sortedUniqBy=function(e,t){return e&&e.length?ql(e,Ya(t,2)):[]},On.split=function(e,t,n){return n&&"number"!=typeof n&&oi(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=sr(e))&&("string"==typeof t||null!=t&&!Yo(t))&&!(t=Zl(t))&&Ft(e)?sa(Vt(e),0,n):e.split(t,n):[]},On.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:on(ar(t),0),Bl(function(n){var l=n[t],a=sa(n,0,t);return l&&dt(a,l),tt(e,this,a)})},On.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},On.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:ar(t))<0?0:t):[]},On.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t,l):[]},On.takeRightWhile=function(e,t){return e&&e.length?ea(e,Ya(t,3),!1,!0):[]},On.takeWhile=function(e,t){return e&&e.length?ea(e,Ya(t,3)):[]},On.tap=function(e,t){return t(e),e},On.throttle=function(e,t,l){var a=!0,i=!0;if("function"!=typeof e)throw new ge(n);return zo(l)&&(a="leading"in l?!!l.leading:a,i="trailing"in l?!!l.trailing:i),yo(e,t,{leading:a,maxWait:t,trailing:i})},On.thru=no,On.toArray=nr,On.toPairs=Or,On.toPairsIn=Nr,On.toPath=function(e){return wo(e)?ut(e,Ti):Xo(e)?[e]:fa(bi(sr(e)))},On.toPlainObject=rr,On.transform=function(e,t,n){var l=wo(e),a=l||ko(e)||Jo(e);if(t=Ya(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:zo(e)&&jo(i)?Nn(ze(e)):{}}return(a?lt:sl)(e,function(e,l,a){return t(n,e,l,a)}),n},On.unary=function(e){return go(e,1)},On.union=zi,On.unionBy=Gi,On.unionWith=Ki,On.uniq=function(e){return e&&e.length?Ql(e):[]},On.uniqBy=function(e,t){return e&&e.length?Ql(e,Ya(t,2)):[]},On.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Ql(e,void 0,t):[]},On.unset=function(e,t){return null==e||Xl(e,t)},On.unzip=$i,On.unzipWith=qi,On.update=function(e,t,n){return null==e?e:Jl(e,t,ia(n))},On.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,ia(n),l)},On.values=Rr,On.valuesIn=function(e){return null==e?[]:Ot(e,Ar(e))},On.without=Yi,On.words=jr,On.wrap=function(e,t){return Io(ia(t),e)},On.xor=Zi,On.xorBy=Qi,On.xorWith=Xi,On.zip=Ji,On.zipObject=function(e,t){return la(e||[],t||[],Vn)},On.zipObjectDeep=function(e,t){return la(e||[],t||[],Hl)},On.zipWith=eo,On.entries=Or,On.entriesIn=Nr,On.extend=dr,On.extendWith=cr,Qr(On,On),On.add=ss,On.attempt=Wr,On.camelCase=xr,On.capitalize=Lr,On.ceil=us,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),Yn(or(e),t,n)},On.clone=function(e){return Zn(e,4)},On.cloneDeep=function(e){return Zn(e,5)},On.cloneDeepWith=function(e,t){return Zn(e,5,t="function"==typeof t?t:void 0)},On.cloneWith=function(e,t){return Zn(e,4,t="function"==typeof t?t:void 0)},On.conformsTo=function(e,t){return null==t||Qn(e,t,yr(t))},On.deburr=Pr,On.defaultTo=function(e,t){return null==e||e!=e?t:e},On.divide=ds,On.endsWith=function(e,t,n){e=sr(e),t=Zl(t);var l=e.length,a=n=void 0===n?l:Yn(ar(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},On.eq=Ro,On.escape=function(e){return(e=sr(e))&&B.test(e)?e.replace(w,wt):e},On.escapeRegExp=function(e){return(e=sr(e))&&G.test(e)?e.replace(z,"\\$&"):e},On.every=function(e,t,n){var l=wo(e)?it:nl;return n&&oi(e,t,n)&&(t=void 0),l(e,Ya(t,3))},On.find=io,On.findIndex=Li,On.findKey=function(e,t){return Et(e,Ya(t,3),sl)},On.findLast=oo,On.findLastIndex=Pi,On.findLastKey=function(e,t){return Et(e,Ya(t,3),ul)},On.floor=cs,On.forEach=ro,On.forEachRight=so,On.forIn=function(e,t){return null==e?e:ol(e,Ya(t,3),Ar)},On.forInRight=function(e,t){return null==e?e:rl(e,Ya(t,3),Ar)},On.forOwn=function(e,t){return e&&sl(e,Ya(t,3))},On.forOwnRight=function(e,t){return e&&ul(e,Ya(t,3))},On.get=fr,On.gt=xo,On.gte=Lo,On.has=function(e,t){return null!=e&&ni(e,t,El)},On.hasIn=gr,On.head=Mi,On.identity=$r,On.includes=function(e,t,n,l){e=Fo(e)?e:Rr(e),n=n&&!l?ar(n):0;var a=e.length;return n<0&&(n=on(a+n,0)),Qo(e)?n<=a&&e.indexOf(t,n)>-1:!!a&>(e,t,n)>-1},On.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),gt(e,t,a)},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=hr,On.isArguments=Po,On.isArray=wo,On.isArrayBuffer=Mo,On.isArrayLike=Fo,On.isArrayLikeObject=Bo,On.isBoolean=function(e){return!0===e||!1===e||Go(e)&&vl(e)==r},On.isBuffer=ko,On.isDate=Uo,On.isElement=function(e){return Go(e)&&1===e.nodeType&&!qo(e)},On.isEmpty=function(e){if(null==e)return!0;if(Fo(e)&&(wo(e)||"string"==typeof e||"function"==typeof e.splice||ko(e)||Jo(e)||Po(e)))return!e.length;var t=ti(e);if(t==m||t==f)return!e.size;if(di(e))return!Dl(e).length;for(var n in e)if(Ae.call(e,n))return!1;return!0},On.isEqual=function(e,t){return hl(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?hl(e,t,void 0,n):!!l},On.isError=Ho,On.isFinite=function(e){return"number"==typeof e&&nn(e)},On.isFunction=jo,On.isInteger=Wo,On.isLength=Vo,On.isMap=Ko,On.isMatch=function(e,t){return e===t||yl(e,t,Qa(t))},On.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,yl(e,t,Qa(t),n)},On.isNaN=function(e){return $o(e)&&e!=+e},On.isNative=function(e){if(ui(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Al(e)},On.isNil=function(e){return null==e},On.isNull=function(e){return null===e},On.isNumber=$o,On.isObject=zo,On.isObjectLike=Go,On.isPlainObject=qo,On.isRegExp=Yo,On.isSafeInteger=function(e){return Wo(e)&&e>=-9007199254740991&&e<=9007199254740991},On.isSet=Zo,On.isString=Qo,On.isSymbol=Xo,On.isTypedArray=Jo,On.isUndefined=function(e){return void 0===e},On.isWeakMap=function(e){return Go(e)&&ti(e)==_},On.isWeakSet=function(e){return Go(e)&&"[object WeakSet]"==vl(e)},On.join=function(e,t){return null==e?"":ln.call(e,t)},On.kebabCase=wr,On.last=Ui,On.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=ar(n))<0?on(l+a,0):rn(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):ft(e,_t,a,!0)},On.lowerCase=Mr,On.lowerFirst=Fr,On.lt=er,On.lte=tr,On.max=function(e){return e&&e.length?ll(e,$r,pl):void 0},On.maxBy=function(e,t){return e&&e.length?ll(e,Ya(t,2),pl):void 0},On.mean=function(e){return ht(e,$r)},On.meanBy=function(e,t){return ht(e,Ya(t,2))},On.min=function(e){return e&&e.length?ll(e,$r,bl):void 0},On.minBy=function(e,t){return e&&e.length?ll(e,Ya(t,2),bl):void 0},On.stubArray=is,On.stubFalse=os,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=ms,On.nth=function(e,t){return e&&e.length?Rl(e,ar(t)):void 0},On.noConflict=function(){return Ve._===this&&(Ve._=Ie),this},On.noop=Xr,On.now=fo,On.pad=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return xa(Jt(a),n)+e+xa(Xt(a),n)},On.padEnd=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?e+xa(t-l,n):e},On.padStart=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?xa(t-l,n)+e:e},On.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(K,""),t||0)},On.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oi(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 a=dn();return rn(e+a*(t-e+Ue("1e-"+((a+"").length-1))),t)}return Ml(e,t)},On.reduce=function(e,t,n){var l=wo(e)?ct:Ct,a=arguments.length<3;return l(e,Ya(t,4),n,a,el)},On.reduceRight=function(e,t,n){var l=wo(e)?mt:Ct,a=arguments.length<3;return l(e,Ya(t,4),n,a,tl)},On.repeat=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),Fl(sr(e),t)},On.replace=function(){var e=arguments,t=sr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},On.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var i=null==e?void 0:e[Ti(t[l])];void 0===i&&(l=a,i=n),e=jo(i)?i.call(e):i}return e},On.round=vs,On.runInContext=e,On.sample=function(e){return(wo(e)?Un:kl)(e)},On.size=function(e){if(null==e)return 0;if(Fo(e))return Qo(e)?Wt(e):e.length;var t=ti(e);return t==m||t==f?e.size:Dl(e).length},On.snakeCase=Br,On.some=function(e,t,n){var l=wo(e)?vt:Gl;return n&&oi(e,t,n)&&(t=void 0),l(e,Ya(t,3))},On.sortedIndex=function(e,t){return Kl(e,t)},On.sortedIndexBy=function(e,t,n){return $l(e,t,Ya(n,2))},On.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Kl(e,t);if(l<n&&Ro(e[l],t))return l}return-1},On.sortedLastIndex=function(e,t){return Kl(e,t,!0)},On.sortedLastIndexBy=function(e,t,n){return $l(e,t,Ya(n,2),!0)},On.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Kl(e,t,!0)-1;if(Ro(e[n],t))return n}return-1},On.startCase=kr,On.startsWith=function(e,t,n){return e=sr(e),n=null==n?0:Yn(ar(n),0,e.length),t=Zl(t),e.slice(n,n+t.length)==t},On.subtract=ps,On.sum=function(e){return e&&e.length?Dt(e,$r):0},On.sumBy=function(e,t){return e&&e.length?Dt(e,Ya(t,2)):0},On.template=function(e,t,n){var l=On.templateSettings;n&&oi(e,t,n)&&(t=void 0),e=sr(e),t=cr({},t,l,Ua);var a,i,o=cr({},t.imports,l.imports,Ua),r=yr(o),s=Ot(o,r),u=0,d=t.interpolate||se,c="__p += '",m=Ee((t.escape||se).source+"|"+d.source+"|"+(d===H?ee:se).source+"|"+(t.evaluate||se).source+"|$","g"),v="//# sourceURL="+(Ae.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(m,function(t,n,l,o,r,s){return l||(l=o),c+=e.slice(u,s).replace(ue,Mt),n&&(a=!0,c+="' +\n__e("+n+") +\n'"),r&&(i=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),c+="';\n";var p=Ae.call(t,"variable")&&t.variable;if(p){if(X.test(p))throw new ce("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(i?c.replace(R,""):c).replace(x,"$1").replace(L,"$1;"),c="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Wr(function(){return me(r,v+"return "+c).apply(void 0,s)});if(E.source=c,Ho(E))throw E;return E},On.times=function(e,t){if((e=ar(e))<1||e>9007199254740991)return[];var n=4294967295,l=rn(e,4294967295);e-=4294967295;for(var a=bt(l,t=Ya(t));++n<e;)t(n);return a},On.toFinite=lr,On.toInteger=ar,On.toLength=ir,On.toLower=function(e){return sr(e).toLowerCase()},On.toNumber=or,On.toSafeInteger=function(e){return e?Yn(ar(e),-9007199254740991,9007199254740991):0===e?e:0},On.toString=sr,On.toUpper=function(e){return sr(e).toUpperCase()},On.trim=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=Zl(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,Rt(l,a),xt(l,a)+1).join("")},On.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,0,xt(l,Vt(t))+1).join("")},On.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(K,"");if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,Rt(l,Vt(t))).join("")},On.truncate=function(e,t){var n=30,l="...";if(zo(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?Zl(t.omission):l}var i=(e=sr(e)).length;if(Ft(e)){var o=Vt(e);i=o.length}if(n>=i)return e;var r=n-Wt(l);if(r<1)return l;var s=o?sa(o,0,r).join(""):e.slice(0,r);if(void 0===a)return s+l;if(o&&(r+=s.length-r),Yo(a)){if(e.slice(r).search(a)){var u,d=s;for(a.global||(a=Ee(a.source,sr(te.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var c=u.index;s=s.slice(0,void 0===c?r:c)}}else if(e.indexOf(Zl(a),r)!=r){var m=s.lastIndexOf(a);m>-1&&(s=s.slice(0,m))}return s+l},On.unescape=function(e){return(e=sr(e))&&F.test(e)?e.replace(P,Gt):e},On.uniqueId=function(e){var t=++Ce;return sr(e)+t},On.upperCase=Ur,On.upperFirst=Hr,On.each=ro,On.eachRight=so,On.first=Mi,Qr(On,(rs={},sl(On,function(e,t){Ae.call(On.prototype,t)||(rs[t]=e)}),rs),{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){Ln.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new Ln(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},Ln.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;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Ya(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter($r)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Bl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return Sl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(bo(Ya(e)))},Ln.prototype.slice=function(e,t){e=ar(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ar(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},sl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=On[l?"take"+("last"==t?"Right":""):t],i=l||/^find/.test(t);a&&(On.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Ln,s=o[0],u=r||wo(t),d=function(e){var t=a.apply(On,dt([e],o));return l&&c?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var c=this.__chain__,m=!!this.__actions__.length,v=i&&!c,p=r&&!m;if(!i&&u){t=p?t:new Ln(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new xn(E,c)}return v&&p?e.apply(this,o):(E=this.thru(d),v?l?E.value()[0]:E.value():E)})}),lt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Se[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 a=this.value();return t.apply(wo(a)?a:[],e)}return this[n](function(n){return t.apply(wo(n)?n:[],e)})}}),sl(Ln.prototype,function(e,t){var n=On[t];if(n){var l=n.name+"";Ae.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Ia(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=fa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=fa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=fa(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=wo(e),l=t<0,a=n?e.length:0,i=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var i=n[l],o=i.size;switch(i.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=rn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,a,this.__views__),o=i.start,r=i.end,s=r-o,u=l?r:o-1,d=this.__iteratees__,c=d.length,m=0,v=rn(s,this.__takeCount__);if(!n||!l&&a==s&&v==s)return ta(e,this.__actions__);var p=[];e:for(;s--&&m<v;){for(var E=-1,f=e[u+=t];++E<c;){var g=d[E],S=g.type,_=(0,g.iteratee)(f);if(2==S)f=_;else if(!_){if(1==S)continue e;break e}}p[m++]=f}return p},On.prototype.at=lo,On.prototype.chain=function(){return to(this)},On.prototype.commit=function(){return new xn(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 Rn;){var l=Oi(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},On.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:no,args:[Vi],thisArg:void 0}),new xn(t,this.__chain__)}return this.thru(Vi)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return ta(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,At&&(On.prototype[At]=function(){return this}),On}();Ge?((Ge.exports=Kt)._=Kt,ze._=Kt):Ve._=Kt}).call(M)});const k=e=>{var i;let{searchParams:o,onFilterChange:r,defaultSearchParams:s,statusMap:u,moduleCode:c,...m}=e;const{t:v}=a.useTranslation(),p=d.useQueryClient(),[E,f]=n.useState(()=>({...o,services:[]})),g=[{label:"AST_NEW_ASSET",value:"asset-create"}],S=e=>{let t=e.delete,n={...E,...e};t&&t.forEach(e=>delete n[e]),delete e.delete,f({...n})},_=()=>{f({...s,services:[]}),r({...s})},h=Digit.ULBService.getCurrentTenantId();return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading",style:{alignItems:"center"}},l.createElement("div",{className:"filter-label",style:{display:"flex",alignItems:"center"}},l.createElement("span",null,l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M0.66666 2.48016C3.35999 5.9335 8.33333 12.3335 8.33333 12.3335V20.3335C8.33333 21.0668 8.93333 21.6668 9.66666 21.6668H12.3333C13.0667 21.6668 13.6667 21.0668 13.6667 20.3335V12.3335C13.6667 12.3335 18.6267 5.9335 21.32 2.48016C22 1.60016 21.3733 0.333496 20.2667 0.333496H1.71999C0.613327 0.333496 -0.01334 1.60016 0.66666 2.48016Z",fill:"#505A5F"}))),l.createElement("span",{style:{marginLeft:"8px",fontWeight:"normal"}},v("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:_},v("ES_COMMON_CLEAR_ALL")),"desktop"===m.type&&l.createElement("span",{className:"clear-search",onClick:_,style:{border:"1px solid #e0e0e0",padding:"6px"}},l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 16 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M8 5V8L12 4L8 0V3C3.58 3 0 6.58 0 11C0 12.57 0.46 14.03 1.24 15.26L2.7 13.8C2.25 12.97 2 12.01 2 11C2 7.69 4.69 5 8 5ZM14.76 6.74L13.3 8.2C13.74 9.04 14 9.99 14 11C14 14.31 11.31 17 8 17V14L4 18L8 22V19C12.42 19 16 15.42 16 11C16 9.43 15.54 7.97 14.76 6.74Z",fill:"#505A5F"}))),"mobile"===m.type&&l.createElement("span",{onClick:m.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},v("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{S({locality:[...(null==E?void 0:E.locality)||[],e]})},tenantId:h,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==E||null===(i=E.locality)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:v(e.i18nkey),onClick:()=>{S({locality:null==E?void 0:E.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},v("AST_APPLICATION_TYPE")),g.map((e,n)=>{var a;const i=null==E||null===(a=E.services)||void 0===a?void 0:a.includes(e.value);return l.createElement(t.CheckBox,{key:n+"service",label:v(e.label),value:e.label,checked:i,onChange:t=>((e,t)=>{var n;S(e.target.checked?{services:Array.isArray(E.services)?[...E.services,t]:[t]}:{services:E.services.filter(e=>e!==t),applicationStatus:null===(n=E.applicationStatus)||void 0===n?void 0:n.filter(e=>e.stateBusinessService!==t)})})(t,e.value)})})),l.createElement("div",null,l.createElement(w,{searchParams:E,businessServices:E.services,statusMap:u||p.getQueryData("INBOX_STATUS_MAP_"+c),moduleCode:c,onAssignmentChange:(e,t)=>{if(e.target.checked)S({applicationStatus:[...null==E?void 0:E.applicationStatus,t]});else{let e=null==E?void 0:E.applicationStatus.filter(e=>e.state!==t.state);S({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===E.services.length?{...E,services:g.map(e=>e.value)}:E)},label:v("ES_COMMON_APPLY")}))))))},U=e=>l.createElement("h1",{className:"heading-m"},e.label),H=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),j=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(H,null)),W=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:f,data:S}=Digit.Hooks.pt.useMDMS(s,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,h]=n.useState({}),[y,A]=n.useState({}),[C,D]=n.useState([]),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),[x,L]=n.useState(null),[P,w]=n.useState([]),[M,F]=n.useState(null),[B,k]=n.useState(!1);function H(e){O(e.target.files[0])}return n.useEffect(()=>{var e;S&&S["egf-master"]&&w(null===(e=S["egf-master"])||void 0===e?void 0:e.FinancialYear)},[S]),n.useEffect(()=>{var e;D(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(I){const e=function(){if(I.size>=5242880)L(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",I,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(o("CS_FILE_UPLOAD_ERROR"))})},function(){L(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[I]),n.useEffect(()=>{r&&h(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:i,selectedFinancialYear:o,setSelectedFinancialYear:r}=e;return{label:{heading:`WF_${a.action}_APPLICATION`,submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:i,optionsKey:"name",onSelect:r,selectedOption:o})}]}]}})({t:o,action:r,financialYears:P,selectedFinancialYear:M,setSelectedFinancialYear:F}):(e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:v}=e;return{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${v}_${null==i?void 0:i.action}`,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${a("ES_PT_ATTACH_FILE")}${i.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:C,selectedApprover:b,setSelectedApprover:T,selectFile:H,uploadedFile:N,setUploadedFile:R,businessService:m}))},[r,C,P,M,N]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(U,{label:o(_.label.heading)}),headerBarEnd:l.createElement(j,{onClick:u}),actionCancelLabel:o(_.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!M:E||(null==r?void 0:r.docUploadRequired)&&!N,formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:{...c,workflow:t}})}else if(null!=r&&r.showFinancialYearsModal)d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.name,propertyId:null==c?void 0:c.propertyId,tenantId:s,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:m,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!b?[]:[b],N&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:N}]),d({Property:{...c,workflow:t}})}},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)},V=e=>l.createElement("h1",{className:"heading-m"},e.label),z=()=>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"})),G=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(z,null)),K=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const{data:v}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:p,data:E}=Digit.Hooks.pt.useMDMS(s,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[f,S]=n.useState({}),[_,h]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),[x,L]=n.useState([]),[P,w]=n.useState(null);n.useEffect(()=>{var e;E&&E["egf-master"]&&L(null===(e=E["egf-master"])||void 0===e?void 0:e.FinancialYear)},[E]);const{data:M}=Digit.Hooks.useCustomMDMS(s,"common-masters",[{name:"Department"}]);function F(e){T(e.target.files[0])}return n.useEffect(()=>{if(v&&M){var e;const t=M["common-masters"].Department;A(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const i=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,o=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return console.log("matchedDept===",o),{uuid:null==e?void 0:e.uuid,name:`${null==e||null===(a=e.user)||void 0===a?void 0:a.name} - ${null==o?void 0:o.name}`}}))}},[v]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&S((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:`WF_${null==a?void 0:a.action}_APPLICATION`,submit:`WF_${null==c?void 0:c.toUpperCase()}_${null==a?void 0:a.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:F,uploadedFile:I,setUploadedFile:O,businessService:m}))},[r,y,x,P,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(V,{label:o(f.label.heading)}),headerBarEnd:l.createElement(G,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:null},d({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},$=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),q=()=>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"})),Y=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(q,null)),Z=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const{data:v,isLoading:p}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[S,_]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState({}),[D,b]=n.useState(null),[T,I]=n.useState(null),[O,N]=n.useState(null),R=!!Digit.Utils.browser.isMobile();function x(e){b(e.target.files[0])}return n.useEffect(()=>{var e;y(null==v||null===(e=v.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[v]),n.useEffect(()=>{!function(){try{N(null);const e=function(){if(D){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(D.size>=5242880)N(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=D&&D.type&&!e.test(null==D?void 0:D.type))N(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",D,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):N(o("CS_FILE_UPLOAD_ERROR"))})},function(){N(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(v=!1),a.isTerminateState&&(v=!1),{label:{heading:`WF_${null==a?void 0:a.action}_APPLICATION`,submit:`WF_${null==c?void 0:c.toUpperCase()}_${null==a?void 0:a.action}`,cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:x,uploadedFile:T,setUploadedFile:I,businessService:m,error:O}))},[r,h,T,O]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement($,{label:o(E.label.heading)}),headerBarEnd:l.createElement(Y,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:R?{width:"720px"}:{},style:R?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:R?{paddingLeft:"5px"}:{}},p?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:E.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c={...c,action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=A&&A.uuid?[null==A?void 0:A.uuid]:null,wfDocuments:T?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:T}]:null},d({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Q=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),X=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),J=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(X,null)),ee=e=>{var a,i,o,r,s,u,c,m,v,p,E,f;let{t:S,action:_,tenantId:h,closeModal:y,submitAction:A,applicationDetails:C,applicationData:D,businessService:b,workflowDetails:T,blockReason:I}=e;console.log("applicationData",D),console.log("workflowDetails",T),Digit.Hooks.obps.useObpsAPI(null!==(a=D)&&void 0!==a&&null!==(i=a.landInfo)&&void 0!==i&&null!==(o=i.address)&&void 0!==o&&o.city?null===(r=D)||void 0===r||null===(s=r.landInfo)||void 0===s||null===(u=s.address)||void 0===u?void 0:u.city:h,!1);const{data:O,isLoading:N}=Digit.Hooks.useEmployeeSearch(h,{roles:null==T||null===(c=T.data)||void 0===c||null===(m=c.initialActionState)||void 0===m||null===(v=m.nextActions)||void 0===v||null===(p=v.filter(e=>(null==e?void 0:e.action)==(null==_?void 0:_.action)))||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.assigneeRoles)||void 0===f?void 0:f.map(e=>({code:e})),isActive:!0},{enabled:!(null!=_&&_.isTerminateState)}),[R,x]=(d.useQueryClient(),n.useState({})),[L,P]=n.useState({}),[w,M]=n.useState([]),[F,B]=n.useState([]),[k,U]=n.useState({}),[H,j]=n.useState({}),[W,V]=n.useState(null),[z,G]=n.useState(null),[K,$]=n.useState(null),[q,Y]=n.useState(null),Z=!!Digit.Utils.browser.isMobile();function X(e){V(e.target.files[0])}n.useEffect(()=>{var e;M(null==O||null===(e=O.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[O]),n.useEffect(()=>{!function(){try{$(null);const e=function(){if(W){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(W.size>=5242880)$(S("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=W&&W.type&&!e.test(null==W?void 0:W.type))$(S("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",W,Digit.ULBService.getStateId()||(null==h?void 0:h.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?G(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):$(S("CS_FILE_UPLOAD_ERROR"))})},function(){$(S("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[W]);const ee=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},te=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},ne=e=>{var t,n;let l=[],a=[];var i,o;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(o=l)||void 0===o?void 0:o.length)>0&&l.map((e,t)=>{a.push({docs:ee(e.Documents),date:e.InspectionDate,questions:te(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},le=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,i,o,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(i=e.uploadedDocuments)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},ae=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{B(null==I?void 0:I.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),_&&x((e=>{var n,a,i,o,r,s,u;let{t:d,action:c,approvers:m,selectedApprover:v,setSelectedApprover:p,selectedBlockReason:E,setBlockReason:f,selectFile:g,uploadedFile:S,setUploadedFile:_,assigneeLabel:h,businessService:y,error:A,blockReasonFiltered:C}=e,D=!1;return"REVOCATE"!=(null==c?void 0:c.action)&&"REJECT"!=(null==c?void 0:c.action)&&"SKIP_PAYMENT"!=c.action&&"SEND_BACK_TO_CITIZEN"!=(null==c?void 0:c.action)&&"APPROVE"!=(null==c?void 0:c.action)||(D=!0),{label:{heading:`WF_${null==c?void 0:c.action}_APPLICATION`,submit:`WF_${y}_${null==c?void 0:c.action}`,cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(n=c.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(a=c.state)||void 0===a?void 0:a.state)?null:d(h||"WF_ROLE_"+(null===(i=c.assigneeRoles)||void 0===i?void 0:i[0])),type:"dropdown",populators:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(o=c.state)||void 0===o?void 0:o.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(r=c.state)||void 0===r?void 0:r.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:p,selected:v})},{label:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(s=c.state)||void 0===s?void 0:s.state)?d("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(u=c.state)||void 0===u?void 0:u.state)?l.createElement(t.Dropdown,{option:C,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:f,selected:E,isMandatory:!0}):null},{label:d("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+d("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:g,onDelete:()=>{_(null)},message:S?"1 "+d("ES_PT_ACTION_FILEUPLOADED"):d("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:A})}]}]}})({t:S,action:_,approvers:w,selectedApprover:k,setSelectedApprover:U,selectedBlockReason:H,setBlockReason:j,selectFile:X,uploadedFile:z,setUploadedFile:G,businessService:b,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:K,blockReasonFiltered:F}))},[_,w,q,z,K]),_&&R.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Q,{label:S(R.label.heading)}),headerBarEnd:l.createElement(J,{onClick:y}),actionCancelLabel:S(R.label.cancel),actionCancelOnSubmit:y,actionSaveLabel:S(R.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Z?{width:"720px"}:{},style:Z?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Z?{paddingLeft:"5px"}:{}},N?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:R.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,i,o,r,s,u,d,c,m,v,p,E,f,g,b,I,O,N,R,x,L,P,w,M;D={...D,documents:le(),additionalDetails:{...null===(t=D)||void 0===t?void 0:t.additionalDetails,fieldinspection_pending:ne(D),pendingapproval:ae(),blockingReason:null==H?void 0:H.name},workflow:{action:null==_?void 0:_.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(a=T.data)||void 0===a||null===(i=a.processInstances)||void 0===i||null===(o=i[0])||void 0===o||null===(r=o.state)||void 0===r?void 0:r.applicationStatus)?[null==T||null===(s=T.data)||void 0===s||null===(u=s.processInstances)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.assigner)||void 0===c?void 0:c.uuid]:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(m=T.data)||void 0===m||null===(v=m.processInstances)||void 0===v||null===(p=v[0])||void 0===p||null===(E=p.state)||void 0===E?void 0:E.applicationStatus)?[null==T||null===(f=T.data)||void 0===f||null===(g=f.processInstances)||void 0===g||null===(b=g[0])||void 0===b||null===(I=b.assigner)||void 0===I?void 0:I.uuid]:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,varificationDocuments:z?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:z}]:null},action:null==_?void 0:_.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==T||null===(O=T.data)||void 0===O||null===(N=O.processInstances)||void 0===N||null===(R=N[0])||void 0===R||null===(x=R.state)||void 0===x?void 0:x.applicationStatus)?[null==T||null===(L=T.data)||void 0===L||null===(P=L.processInstances)||void 0===P||null===(w=P[0])||void 0===w||null===(M=w.assigner)||void 0===M?void 0:M.uuid]:null!=k&&k.uuid?[null==k?void 0:k.uuid]:null,wfDocuments:z?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==W?void 0:W.name,fileStoreId:z}]:null};const F=function(e,t,n,l,a,i,o,r,s,u,d,c){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=D)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null===(l=D)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null===(o=D)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null===(u=D)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.selfCertificationCharges)||void 0===c?void 0:c.BPA_GAUSHALA_CHARGES_CESS))){var m,v,p;D.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",D.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",D.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",D.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),D.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==C||null===(m=C.nocData)||void 0===m?void 0:m.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:{...e,documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]}}});let t={sourceRefId:null==e||null===(v=e[0])||void 0===v||null===(p=v.Noc)||void 0===p?void 0:p.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(h,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,i,o,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let i=[];if(e&&e.map(e=>{var t,n,o,r,s,u,d,c,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(o=e.Noc)||void 0===o||null===(r=o.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(u=s.applicationStatus)||void 0===u?void 0:u.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(d=e.Noc)||void 0===d||null===(c=d.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&l||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&a)&&i.push(e)}),"FIELDINSPECTION_INPROGRESS"==D.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?A({BPA:D},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0}):(y(),alert(S("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else A({BPA:D},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0})})}y(),alert(S("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(F&&F.then?F.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:L,formId:"modal-action"})):l.createElement(t.Loader,null)},te=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ne=()=>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"})),le=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ne,null)),ae=e=>{var a,o;let{t:r,action:s,tenantId:u,closeModal:c,submitAction:m,applicationData:v,businessService:p}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(u,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[S,_]=(d.useQueryClient(),n.useState({})),[h,y]=n.useState({}),[A,C]=n.useState([]),[D,b]=n.useState({}),[T,I]=n.useState(null),[O,N]=n.useState(null),[R,x]=n.useState(null),L=!!Digit.Utils.browser.isMobile();function P(e){I(e.target.files[0])}return i.useHistory(),n.useEffect(()=>{var e;C(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(T.size>=5242880)x(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))x(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",T,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?N(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(r("CS_FILE_UPLOAD_ERROR"))})},function(){x(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{s&&_((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(E=!0);let f=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(f=!0),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${v}_${null==i?void 0:i.action}`,cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:i.isTerminateState||f?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||f?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:r,action:s,approvers:A,selectedApprover:D,setSelectedApprover:b,selectFile:P,uploadedFile:O,setUploadedFile:N,businessService:p,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:R}))},[s,A,O,R]),s&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(te,{label:r(S.label.heading)}),headerBarEnd:l.createElement(le,{onClick:c}),actionCancelLabel:r(S.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:r(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:L?{width:"720px"}:{},style:L?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:L?{paddingLeft:"5px"}:{}},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(t=v)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=v)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),v={...v,workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,documents:O?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:O}]:null},documents:i},m({Noc:v},!1,{isNoc:!0})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)};var ie=function(e,t){return e===t||e!=e&&t!=t},oe=function(e,t){for(var n=e.length;n--;)if(ie(e[n][0],t))return n;return-1},re=Array.prototype.splice;function se(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])}}se.prototype.clear=function(){this.__data__=[],this.size=0},se.prototype.delete=function(e){var t=this.__data__,n=oe(t,e);return!(n<0||(n==t.length-1?t.pop():re.call(t,n,1),--this.size,0))},se.prototype.get=function(e){var t=this.__data__,n=oe(t,e);return n<0?void 0:t[n][1]},se.prototype.has=function(e){return oe(this.__data__,e)>-1},se.prototype.set=function(e,t){var n=this.__data__,l=oe(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var ue,de=se,ce="object"==typeof M&&M&&M.Object===Object&&M,me="object"==typeof self&&self&&self.Object===Object&&self,ve=ce||me||Function("return this")(),pe=ve.Symbol,Ee=Object.prototype,fe=Ee.hasOwnProperty,ge=Ee.toString,Se=pe?pe.toStringTag:void 0,_e=Object.prototype.toString,he=pe?pe.toStringTag:void 0,ye=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":he&&he in Object(e)?function(e){var t=fe.call(e,Se),n=e[Se];try{e[Se]=void 0;var l=!0}catch(e){}var a=ge.call(e);return l&&(t?e[Se]=n:delete e[Se]),a}(e):function(e){return _e.call(e)}(e)},Ae=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ce=function(e){if(!Ae(e))return!1;var t=ye(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},De=ve["__core-js_shared__"],be=(ue=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||""))?"Symbol(src)_1."+ue:"",Te=Function.prototype.toString,Ie=function(e){if(null!=e){try{return Te.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Oe=/^\[object .+?Constructor\]$/,Ne=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ae(e)||(t=e,be&&be in t))&&(Ce(e)?Ne:Oe).test(Ie(e));var t}(n)?n:void 0},xe=Re(ve,"Map"),Le=Re(Object,"create"),Pe=Object.prototype.hasOwnProperty,we=Object.prototype.hasOwnProperty;function Me(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])}}Me.prototype.clear=function(){this.__data__=Le?Le(null):{},this.size=0},Me.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Me.prototype.get=function(e){var t=this.__data__;if(Le){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Pe.call(t,e)?t[e]:void 0},Me.prototype.has=function(e){var t=this.__data__;return Le?void 0!==t[e]:we.call(t,e)},Me.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Le&&void 0===t?"__lodash_hash_undefined__":t,this};var Fe=Me,Be=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function ke(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])}}ke.prototype.clear=function(){this.size=0,this.__data__={hash:new Fe,map:new(xe||de),string:new Fe}},ke.prototype.delete=function(e){var t=Be(this,e).delete(e);return this.size-=t?1:0,t},ke.prototype.get=function(e){return Be(this,e).get(e)},ke.prototype.has=function(e){return Be(this,e).has(e)},ke.prototype.set=function(e,t){var n=Be(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var Ue=ke;function He(e){var t=this.__data__=new de(e);this.size=t.size}He.prototype.clear=function(){this.__data__=new de,this.size=0},He.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},He.prototype.get=function(e){return this.__data__.get(e)},He.prototype.has=function(e){return this.__data__.has(e)},He.prototype.set=function(e,t){var n=this.__data__;if(n instanceof de){var l=n.__data__;if(!xe||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ue(l)}return n.set(e,t),this.size=n.size,this};var je=He,We=function(){try{var e=Re(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ve=function(e,t,n){"__proto__"==t&&We?We(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},ze=Object.prototype.hasOwnProperty,Ge=function(e,t,n){var l=e[t];ze.call(e,t)&&ie(l,n)&&(void 0!==n||t in e)||Ve(e,t,n)},Ke=function(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?Ve(n,r,s):Ge(n,r,s)}return n},$e=function(e){return null!=e&&"object"==typeof e},qe=function(e){return $e(e)&&"[object Arguments]"==ye(e)},Ye=Object.prototype,Ze=Ye.hasOwnProperty,Qe=Ye.propertyIsEnumerable,Xe=qe(function(){return arguments}())?qe:function(e){return $e(e)&&Ze.call(e,"callee")&&!Qe.call(e,"callee")},Je=Array.isArray,et=function(){return!1},tt=F(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?ve.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||et}),nt=/^(?:0|[1-9]\d*)$/,lt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&nt.test(e))&&e>-1&&e%1==0&&e<t},at=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},it={};it["[object Float32Array]"]=it["[object Float64Array]"]=it["[object Int8Array]"]=it["[object Int16Array]"]=it["[object Int32Array]"]=it["[object Uint8Array]"]=it["[object Uint8ClampedArray]"]=it["[object Uint16Array]"]=it["[object Uint32Array]"]=!0,it["[object Arguments]"]=it["[object Array]"]=it["[object ArrayBuffer]"]=it["[object Boolean]"]=it["[object DataView]"]=it["[object Date]"]=it["[object Error]"]=it["[object Function]"]=it["[object Map]"]=it["[object Number]"]=it["[object Object]"]=it["[object RegExp]"]=it["[object Set]"]=it["[object String]"]=it["[object WeakMap]"]=!1;var ot=function(e){return function(t){return e(t)}},rt=F(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&ce.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),st=rt&&rt.isTypedArray,ut=st?ot(st):function(e){return $e(e)&&at(e.length)&&!!it[ye(e)]},dt=Object.prototype.hasOwnProperty,ct=function(e,t){var n=Je(e),l=!n&&Xe(e),a=!n&&!l&&tt(e),i=!n&&!l&&!a&&ut(e),o=n||l||a||i,r=o?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],s=r.length;for(var u in e)!t&&!dt.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||lt(u,s))||r.push(u);return r},mt=Object.prototype,vt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||mt)},pt=function(e,t){return function(n){return e(t(n))}},Et=pt(Object.keys,Object),ft=Object.prototype.hasOwnProperty,gt=function(e){return null!=e&&at(e.length)&&!Ce(e)},St=function(e){return gt(e)?ct(e):function(e){if(!vt(e))return Et(e);var t=[];for(var n in Object(e))ft.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},_t=Object.prototype.hasOwnProperty,ht=function(e){return gt(e)?ct(e,!0):function(e){if(!Ae(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=vt(e),n=[];for(var l in e)("constructor"!=l||!t&&_t.call(e,l))&&n.push(l);return n}(e)},yt=F(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?ve.Buffer:void 0,i=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=i?i(n):new e.constructor(n);return e.copy(l),l}}),At=function(){return[]},Ct=Object.prototype.propertyIsEnumerable,Dt=Object.getOwnPropertySymbols,bt=Dt?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,i=0,o=[];++l<a;){var r=t[l];Ct.call(e,r)&&(o[i++]=r)}return o}(Dt(e)))}:At,Tt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},It=pt(Object.getPrototypeOf,Object),Ot=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Tt(t,bt(e)),e=It(e);return t}:At,Nt=function(e,t,n){var l=t(e);return Je(e)?l:Tt(l,n(e))},Rt=function(e){return Nt(e,St,bt)},xt=function(e){return Nt(e,ht,Ot)},Lt=Re(ve,"DataView"),Pt=Re(ve,"Promise"),wt=Re(ve,"Set"),Mt=Re(ve,"WeakMap"),Ft=Ie(Lt),Bt=Ie(xe),kt=Ie(Pt),Ut=Ie(wt),Ht=Ie(Mt),jt=ye;(Lt&&"[object DataView]"!=jt(new Lt(new ArrayBuffer(1)))||xe&&"[object Map]"!=jt(new xe)||Pt&&"[object Promise]"!=jt(Pt.resolve())||wt&&"[object Set]"!=jt(new wt)||Mt&&"[object WeakMap]"!=jt(new Mt))&&(jt=function(e){var t=ye(e),n="[object Object]"==t?e.constructor:void 0,l=n?Ie(n):"";if(l)switch(l){case Ft:return"[object DataView]";case Bt:return"[object Map]";case kt:return"[object Promise]";case Ut:return"[object Set]";case Ht:return"[object WeakMap]"}return t});var Wt=jt,Vt=Object.prototype.hasOwnProperty,zt=ve.Uint8Array,Gt=function(e){var t=new e.constructor(e.byteLength);return new zt(t).set(new zt(e)),t},Kt=/\w*$/,$t=pe?pe.prototype:void 0,qt=$t?$t.valueOf:void 0,Yt=Object.create,Zt=function(){function e(){}return function(t){if(!Ae(t))return{};if(Yt)return Yt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Qt=rt&&rt.isMap,Xt=Qt?ot(Qt):function(e){return $e(e)&&"[object Map]"==Wt(e)},Jt=rt&&rt.isSet,en=Jt?ot(Jt):function(e){return $e(e)&&"[object Set]"==Wt(e)},tn={};tn["[object Arguments]"]=tn["[object Array]"]=tn["[object ArrayBuffer]"]=tn["[object DataView]"]=tn["[object Boolean]"]=tn["[object Date]"]=tn["[object Float32Array]"]=tn["[object Float64Array]"]=tn["[object Int8Array]"]=tn["[object Int16Array]"]=tn["[object Int32Array]"]=tn["[object Map]"]=tn["[object Number]"]=tn["[object Object]"]=tn["[object RegExp]"]=tn["[object Set]"]=tn["[object String]"]=tn["[object Symbol]"]=tn["[object Uint8Array]"]=tn["[object Uint8ClampedArray]"]=tn["[object Uint16Array]"]=tn["[object Uint32Array]"]=!0,tn["[object Error]"]=tn["[object Function]"]=tn["[object WeakMap]"]=!1;var nn=function e(t,n,l,a,i,o){var r,s=1&n,u=2&n,d=4&n;if(l&&(r=i?l(t,a,i,o):l(t)),void 0!==r)return r;if(!Ae(t))return t;var c=Je(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Vt.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!s)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=Wt(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(tt(t))return yt(t,s);if("[object Object]"==m||"[object Arguments]"==m||v&&!i){if(r=u||v?{}:function(e){return"function"!=typeof e.constructor||vt(e)?{}:Zt(It(e))}(t),!s)return u?function(e,t){return Ke(e,Ot(e),t)}(t,function(e,t){return e&&Ke(t,ht(t),e)}(r,t)):function(e,t){return Ke(e,bt(e),t)}(t,function(e,t){return e&&Ke(t,St(t),e)}(r,t))}else{if(!tn[m])return i?t:{};r=function(e,t,n){var l,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Gt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var n=t?Gt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?Gt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Kt.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return qt?Object(qt.call(e)):{}}}(t,m,s)}}o||(o=new je);var p=o.get(t);if(p)return p;o.set(t,r),en(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):Xt(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var E=c?void 0:(d?u?xt:Rt:u?ht:St)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,i){E&&(a=t[i=a]),Ge(r,i,e(a,n,l,i,t,o))}),r},ln=function(e){return nn(e,5)};const an=e=>l.createElement("h1",{className:"heading-m"},e.label),on=()=>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"})),rn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(on,null)),sn=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},un=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:v}=e;const{data:p,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,S]=n.useState({}),[_,h]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),x=window.Digit.Utils.browser.isMobile(),L=window.location.href.includes("/employee");function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))R(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",b,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{var e,n,a,i;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=c)||void 0===a||null===(i=a.processInstance)||void 0===i?void 0:i.businessService)?r&&S((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:v,error:p}=e,E=!0,f=!1;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==i?void 0:i.action)||"RESUBMIT_APPLICATION"==(null==i?void 0:i.action))&&(E=!1),i.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(f=!0),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==v?void 0:v.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},f&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,m({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:v,error:N})):r&&S((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:m,error:v}=e,p=!0;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(p=!1),i.isTerminateState&&(p=!1),{label:{heading:`WF_${null==i?void 0:i.action}_APPLICATION`,submit:`WF_${null==m?void 0:m.toUpperCase()}_${null==i?void 0:i.action}`,cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:v,error:N}))},[r,y,I,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(an,{label:o(f.label.heading)}),headerBarEnd:l.createElement(rn,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:x&&L?{width:"100%",height:"auto"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,i,o,u,m,v,p;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var E,f,g,S,_,h,y,A,D;const t={...null===(E=c)||void 0===E||null===(f=E.billAmendmentDetails)||void 0===f?void 0:f.additionalDetails,comments:null!=e&&e.comments?e.comments:null},n={...null===(g=c)||void 0===g?void 0:g.billAmendmentDetails,workflow:{businessId:null===(S=c)||void 0===S||null===(_=S.billAmendmentDetails)||void 0===_?void 0:_.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(h=c)&&void 0!==h&&null!==(y=h.applicationType)&&void 0!==y&&y.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(A=c)&&void 0!==A&&null!==(D=A.applicationType)&&void 0!==D&&D.includes("WATER")?"WS":"SW",assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:[]}};d({AmendmentUpdate:n})}else{if(c={...c,action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:[],assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:null,processInstance:{...null===(n=c)||void 0===n?void 0:n.processInstance,action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:[]}},null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=ln(null==e?void 0:e.date);c.disconnectionExecutionDate=sn(t)}else if(null!=e&&e.date){const t=ln(null==e?void 0:e.date);c.connectionExecutionDate=sn(t)}var T;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)||"DisconnectSWConnection"==(null===(u=c)||void 0===u||null===(m=u.processInstance)||void 0===m?void 0:m.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(T=c)||void 0===T?void 0:T.serviceType)?d({WaterConnection:c,disconnectRequest:!0}):d({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(v=c)||void 0===v?void 0:v.applicationType))d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(p=c)||void 0===p?void 0:p.applicationType))d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var O,N,R,x,L,P,w,M,F,B,k,U,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(O=t.value)&&void 0!==O&&O.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(N=t.value)||void 0===N?void 0:N.adhocPenalty)||""),null!=t&&null!==(R=t.value)&&void 0!==R&&R.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==t||null===(x=t.value)||void 0===x?void 0:x.adhocPenaltyComment)||""),null!=t&&null!==(L=t.value)&&void 0!==L&&L.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(P=t.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=t&&null!==(w=t.value)&&void 0!==w&&w.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(M=t.value)||void 0===M?void 0:M.adhocRebate)||""),null!=t&&null!==(F=t.value)&&void 0!==F&&F.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(B=t.value)||void 0===B?void 0:B.adhocRebateComment)||""),null!=t&&null!==(k=t.value)&&void 0!==k&&k.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(U=t.value)||void 0===U?void 0:U.adhocRebateReason)||""),"WATER"==(null===(H=c)||void 0===H?void 0:H.serviceType)?d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},dn=e=>l.createElement("h1",{className:"heading-m"},e.label),cn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),mn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(cn,null)),vn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:v}=e;console.log("applicationData",c);const{data:p}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[S,_]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState(null),[D,b]=n.useState(null),[T,I]=n.useState(null),[O,N]=n.useState(null),[R,x]=n.useState(!1);function L(e){b(e.target.files[0])}return n.useEffect(()=>{var e;y(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{N(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)N(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):N(o("CS_FILE_UPLOAD_ERROR"))})},function(){N(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&f((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:`WF_${null==n?void 0:n.action}_APPLICATION`,submit:`WF_${l}_${null==n?void 0:n.action}`,cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:L,uploadedFile:T,setUploadedFile:I,businessService:m}))},[r,h,T]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(dn,{label:o(E.label.heading)}),headerBarEnd:l.createElement(mn,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};c.creationReason="CREATE",d({PetRegistrationApplications:[{...c,workflow:t}]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v};t.assignes=null!=r&&r.isTerminateState||!A?[]:[A],T&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:T}]),d({PetRegistrationApplications:[{...c,workflow:t}]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},pn=e=>l.createElement("h1",{className:"heading-m"},e.label),En=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),fn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(En,null)),gn=e=>{var a,i,o;let{t:r,action:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const v=Digit.ULBService.getStateId(),{data:p,isLoading:E}=Digit.Hooks.tl.useTradeLicenseMDMS(v,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==p||null===(a=p.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",c);const[f,g]=n.useState({}),[S,_]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState(""),[D,b]=n.useState([]),[T,I]=n.useState(null),O=null===(i=c)||void 0===i||null===(o=i.tradeLicenseDetail)||void 0===o?void 0:o.tradeUnits;console.log("tradeUnits",O);const N=n.useMemo(()=>{var e;if(E||!p||!O.length)return[];const t=new Set(O.map(e=>e.tradeType)),n=(null===(e=p.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[E,p,O]);return console.log("years",N),n.useEffect(()=>{s&&g((e=>{let{t:n,action:a,years:i,selectedApprover:o,setSelectedApprover:r,businessService:s}=e;return{label:{heading:`WF_${null==a?void 0:a.action}_APPLICATION`,submit:`WF_${null==s?void 0:s.toUpperCase()}_${null==a?void 0:a.action}`,cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:i,autoComplete:"off",select:r,selected:o})}]}]}})({t:r,action:s,years:N,selectedApprover:A,setSelectedApprover:C,businessService:m}))},[s,N,D,T]),s&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(pn,{label:r(f.label.heading)}),headerBarEnd:l.createElement(fn,{onClick:u}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=c)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a=`20${Number(l)}-${Number(l)+1}`;c={...c,financialYear:a,action:"INITIATE",additionalDetail:{...c.additionalDetail,validityYears:A.length>0?parseInt(A):""}},d({Licenses:[c]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Sn=e=>l.createElement("h1",{className:"heading-m"},e.label),_n=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),hn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(_n,null)),yn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:v}=e;const{data:p}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[E,f]=n.useState({}),[S,_]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState(null),[D,b]=n.useState(null),[T,I]=n.useState(null),[O,N]=n.useState(null),[R,x]=n.useState(!1);function L(e){x(!0),b(e.target.files[0])}return n.useEffect(()=>{var e;y(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{N(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)N(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=function(e,t){try{var n=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",D,s)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):N(o("CS_FILE_UPLOAD_ERROR"))})},function(){N(o("CS_FILE_UPLOAD_ERROR"))})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,function(e,t){if(x(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),console.log("actyhdesh,jhfsefsef",r,c),n.useEffect(()=>{f((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,approvers:s,selectedApprover:u,setSelectedApprover:d,isUploading:c}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{label:{heading:`WF_${null==a?void 0:a.action}_APPLICATION`,submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"name",select:d,selected:u})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:`${n("SV_ATTATCH_FILE")}${a.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{r(null)},message:c?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):o?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:L,uploadedFile:T,setUploadedFile:I,businessService:m,isUploading:R}))},[r,h,T]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Sn,{label:o(E.label.heading)}),headerBarEnd:l.createElement(hn,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=A&&A.uuid?[null==A?void 0:A.uuid]:null};T&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,fileStoreId:T}]),d({streetVendingDetail:{...c,workflow:n}})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},An=e=>l.createElement("h1",{className:"heading-m"},e.label),Cn=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Dn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Cn,null)),bn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:v}=e;console.log("applicationData",c);const{data:p}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[E,f]=n.useState({}),[S,_]=n.useState({}),[h,y]=n.useState([]),[A,C]=n.useState(null),[D,b]=n.useState(null),[T,I]=n.useState(null),[O,N]=n.useState(null),[R,x]=n.useState(!1);function L(e){b(e.target.files[0])}return n.useEffect(()=>{var e;y(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{N(null);const e=function(){if(D){const e=function(){if(D.size>=5242880)N(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",D,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):N(o("CS_FILE_UPLOAD_ERROR"))})},function(){N(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[D]),n.useEffect(()=>{r&&f((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,businessService:s}=e;return{label:{heading:`WF_${null==a?void 0:a.action}_APPLICATION`,submit:`WF_${s}_${null==a?void 0:a.action}`,cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:`${n("ES_CHB_ATTACH_FILE")}${a.docUploadRequired?" *":""}`,populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:o?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:h,selectedApprover:A,setSelectedApprover:C,selectFile:L,uploadedFile:T,setUploadedFile:I,businessService:m}))},[r,h,T]),r&&E.form?l.createElement(t.Modal,{headerBarMain:l.createElement(An,{label:o(E.label.heading)}),headerBarEnd:l.createElement(Dn,{onClick:u}),actionCancelLabel:o(E.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(E.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:E.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:v};T&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==D?void 0:D.name,filestoreId:T}]),d({hallsBookingApplication:[{...c,workflow:t}]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},Tn=e=>l.createElement("h1",{className:"heading-m"},e.label),In=()=>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"})),On=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(In,null)),Nn=e=>{var a,o,r;let{t:s,action:u,tenantId:d,closeModal:c,submitAction:m,applicationData:v,businessService:p,moduleCode:E}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(d,{roles:null==u||null===(a=u.roles)||void 0===a||null===(o=a[0])||void 0===o||null===(r=o.map)||void 0===r?void 0:r.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}),g=i.useHistory(),[S,_]=n.useState({}),[h,y]=n.useState({}),[A,C]=n.useState([]),[D,b]=n.useState(null),[T,I]=n.useState(null);return n.useEffect(()=>{var e;C(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{"INITIATED"===(null==u?void 0:u.state)?g.push("/digit-ui/employee/asset/assetservice/edit/"+(null==v?void 0:v.applicationNo)):_((e=>{let{t:t,action:n,businessService:l}=e;return console.log("njhsegfdhjsbedwfdwe",n),{label:{heading:`WF_${null==n?void 0:n.action}_APPLICATION`,submit:`WF_${l}_${null==n?void 0:n.action}`,cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:s,action:u,approvers:A,selectedApprover:D,setSelectedApprover:b,uploadedFile:T,setUploadedFile:I,businessService:p}))},[u,A,T]),u&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Tn,{label:s(S.label.heading)}),headerBarEnd:l.createElement(On,{onClick:c}),actionCancelLabel:s(S.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:s(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==u?void 0:u.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:E};T&&(t.documents=[]),m({Asset:{...v,workflow:t}})},defaultValues:h,formId:"modal-action"})):l.createElement(t.Loader,null)},Rn=e=>null!=e&&e.businessService.includes("PT")?l.createElement(W,e):null!=e&&e.businessService.includes("ptr")?l.createElement(vn,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(K,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(gn,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(Z,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(ee,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(ae,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(un,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(yn,e):null!=e&&e.businessService.includes("chb")?l.createElement(bn,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Nn,e):void 0;function xn(e){let{documents:n,svgStyles:i={},isSendBackFlow:o=!1,isHrLine:r=!1,titleStyles:s}=e;const{t:u}=a.useTranslation(),d=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!d&&(null==n?void 0:n.map((e,a)=>{var i,d,c;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},u(null==n?void 0:n.title)),o?null!=n&&null!==(i=n.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),o?(null!==(d=value)&&void 0!==d&&null!==(c=d.documentType)&&void 0!==c&&c.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),d&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=i&&i.minWidth?null==i?void 0:i.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+u(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const Ln=e=>{var t,a;let{t:i,formData:o,applicationData:r,docs:s,bpaActionsDetails:u}=e;const d=(null==r?void 0:r.status)||"",c=(null==u||null===(t=u.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,p]=n.useState((null==o||null===(a=o.documents)||void 0===a?void 0:a.documents)||[]),[E,f]=n.useState(null),[g,S]=n.useState([]),[_,h]=n.useState(!0),[y,A]=n.useState(!1),[C,D]=n.useState(!1),{isLoading:b,data:T}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:I,data:O}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var i,o;null!=T&&null!==(e=T.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==T||null===(i=T.BPA)||void 0===i||null===(o=i.DocTypeMapping)||void 0===o?void 0:o.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let u=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==O||null===(t=O["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,i.length);i===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==s||null===(l=s[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;i===`${null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0]}.${null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1]}`&&e.uploadedDocuments[0].values.push(t)}),u.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(u)),S(u)},[!b,!I]),n.useEffect(()=>{let e=0;g.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==`${e.documentType.split(".")[0]}.${e.documentType.split(".")[1]}`&&(n=!0)}),!n&&t.required&&(e+=1)}),h("0"!=e&&0!=e||!(v.length>0))},[v,y]),n.useEffect(()=>{D("DOC_VERIFICATION_INPROGRESS"===d&&(null==c?void 0:c.length)>0)},[r,u]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==g?void 0:g.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(Pn,{key:t,index:t,document:e,t:i,error:E,setError:f,setDocuments:p,documents:v,setCheckRequiredFields:A,applicationStatus:d,actions:c,bpaTaxDocuments:g,checkEnablingDocs:C}))))};function Pn(e){var a,i;let{t:o,document:r,setDocuments:s,documents:u,index:d,bpaTaxDocuments:c,checkEnablingDocs:m}=e;const v=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],p=Digit.ULBService.getStateId(),[E,f]=n.useState(v?{...v,active:!0,code:null==v?void 0:v.documentType,i18nKey:null==v?void 0:v.documentType}:1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[g,S]=n.useState(null),[_,h]=n.useState(()=>(null==v?void 0:v.fileStoreId)||null),[y,A]=n.useState([]);return n.useEffect(()=>{null!=E&&E.code&&s(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==E?void 0:E.code));return 0===(null==_?void 0:_.length)||null===_?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==E?void 0:E.code,fileStoreId:_,documentUid:_,fileName:(null==g?void 0:g.name)||"",id:u?null===(t=u.find(e=>e.documentType===(null==E?void 0:E.code)))||void 0===t?void 0:t.id:void 0}]})},[_,E]),n.useEffect(()=>{try{y.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],y.map(e=>{var t,n,l;null!=E&&E.code&&r.newUploadedDocs.push({documentType:null==E?void 0:E.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[d]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[y,E]),n.useEffect(()=>{},[g]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+o(null==r?void 0:r.code)),(null==r||null===(i=r.uploadedDocuments)||void 0===i?void 0:i.length)&&l.createElement(xn,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?o(null==r?void 0:r.code)+"* ":""+o(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:o,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:E,optionKey:"i18nKey",select:e=>f(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:p,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&A(l),(a=l[l.length-1])&&S(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function wn(e){let{fiReport:n,isCitizen:i=!1}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(i?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+o("BPA_FI_REPORT")),n.map((e,a)=>{var i,r,s,u,d,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+o("BPA_FI_REPORT"):`${o("BPA_FI_REPORT")} - ${a+1}`),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?`${null===(i=e.date)||void 0===i?void 0:i.split("-")[2]}/${null===(r=e.date)||void 0===r?void 0:r.split("-")[1]}/${null===(s=e.date)||void 0===s?void 0:s.split("-")[0]}`:null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(u=e.questions)||void 0===u?void 0:u.length)&&(null==e||null===(d=e.questions)||void 0===d?void 0:d.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+o(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(xn,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Mn(e){let{t:a,document:i,setNocDocuments:o,setError:r,nocDocuments:s}=e;const u=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==i?void 0:i.code)})[0],d=Digit.ULBService.getStateId(),[c,m]=n.useState(),[v,p]=n.useState(null),[E,f]=n.useState(()=>(null==u?void 0:u.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=i&&null!==(e=i.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&o(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==i||null===(t=i.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==E?void 0:E.length)||null===E?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:E,documentUid:E,fileName:(null==v?void 0:v.name)||""}]})},[E]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(v){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(v.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=v&&v.type&&!e.test(null==v?void 0:v.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=g(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",v,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[v]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=i&&i.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:d,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&p(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const Fn=e=>{var a;let{t:i,noc:o,docs:r,isNoc:s,applicationData:u,NOCdata:d,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==u?void 0:u.status)||"",p=(null==c||null===(a=c.data)||void 0===a?void 0:a.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:s}),{data:f}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!s}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[S,_]=n.useState([]),[h,y]=n.useState([]),[A,C]=n.useState(!1),[D,b]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[T,I]=n.useState(null),O=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;_(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,a=[];var i,r,d,c;l=s?null==E||null===(i=E.NOC)||void 0===i||null===(r=i.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==o?void 0:o.applicationType)&&(null==e?void 0:e.nocType)===(null==o?void 0:o.nocType)):null==f||null===(d=f.BPA)||void 0===d||null===(c=d.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var t,n;return e.WFState==(null==u?void 0:u.status)&&e.RiskType==(null==u?void 0:u.riskType)&&e.ServiceType==(null==u||null===(t=u.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==o?void 0:o.additionalDetails,applicationStatus:null==o?void 0:o.applicationStatus,appNumberLink:null==o?void 0:o.applicationNo,nocNo:null==o?void 0:o.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==S||S.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),y(m))},[E,S]),n.useEffect(()=>{C("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[u,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:O?""+i(`BPA_${null==o?void 0:o.nocType}_HEADER`):i(`BPA_${null==o?void 0:o.nocType}_HEADER`),labelStyle:{fontSize:"20px",width:"150%"}}),d&&d.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:O?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:O?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(xn,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),A&&(null==h?void 0:h.map((e,t)=>l.createElement(Mn,{key:t,document:e,t:i,error:T,setError:I,setNocDocuments:b,nocDocuments:D,checkEnablingDocs:A}))))},Bn=e=>{let{permissions:a,t:i}=e;const[o,r,s]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[u,d,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const m=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},i("BPA_PERMIT_CONDITIONS")),null==o?void 0:o.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:m?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==o?void 0:o.map((e,t)=>n===t?{...e,checked:l}:e))})(e,0,n),isLabelFirst:!0,index:n})),null==u?void 0:u.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{d(()=>null==u?void 0:u.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:i("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...u];t.splice(e,1),d([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{d([...u,{label:""}])}}))};function kn(e){let{documents:i,svgStyles:o={},isSendBackFlow:r=!1}=e;const{t:s}=a.useTranslation(),[u,d]=n.useState(()=>[]),[c,m]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==i||i.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),d(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[i]),n.useEffect(()=>{var e;null!=u&&u.length&&"BillAmend"===(null==i||null===(e=i[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(u,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=u&&u.length&&Digit.UploadServices.Filefetch(u,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[u]);const v=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),p=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!p&&(null==i?void 0:i.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:v?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a,i;return l.createElement("a",{target:"_",href:null===(a=c[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:v?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},s(null==e?void 0:e.title)),r?null!=e&&null!==(i=e.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),p&&(null==i?void 0:i.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement("a",{target:"_",href:null===(a=c[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400"}},""+s(null==e?void 0:e.title))))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}function Un(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:i}=n,{t:o}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:o("ES_PT_TITLE_TAX_HEADS"),text:o("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==i?void 0:i.map((e,n)=>l.createElement(t.Row,{key:o(e.taxHeadCode),label:o(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==i?void 0:i.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:o("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Hn(e){let{floors:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},i(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},i(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function jn(e){let{owners:n}=e,i={};i=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:o}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let s={marginTop:"19px"},u={position:"relative",padding:"8px"},d={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?s={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(s={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},u={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(s={...s,maxWidth:"950px"},s={...s,maxWidth:"950px"},d={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},i.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:s,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?`${o(null==e?void 0:e.title)} ${n+1}`:o(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:u},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:o(e.title),label:""+o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:d}))}))))})))}const Wn=e=>{var i,o,r,s,u,d,c,m,v,p,E,f,S,_,h,y,A,C,D,b,T,I,O;let{scrutinyDetails:N,paymentsList:R=[],additionalDetails:x,applicationData:L}=e;const P=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==L?void 0:L.status))&&window.location.href.includes("bpa"),[w,M]=n.useState(),[F,B]=n.useState(),[k,U]=n.useState(),H=Digit.ULBService.getStateId(),[j,W]=n.useState(),[V,z]=n.useState(),[G,K]=n.useState([]),[$,q]=n.useState(),[Y,Z]=n.useState(""),[Q,X]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,ie]=n.useState(!1);n.useEffect(()=>{!function(){try{X(null);const e=function(){if($&&null!=$&&$.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==$||null===(t=$.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if($.size>=2e6)X(oe("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",$,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?K([...G,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):X(oe("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else X(oe("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[$]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(G))},[G]),n.useEffect(()=>{var e,t,n,l,a,i,o;if(null!=x&&null!==(e=x.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==x?void 0:x.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==x||null===(n=x.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==x||null===(l=x.lessAdjustmentFeeFiles[(null==x||null===(a=x.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==x||null===(t=x.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==x||null===(n=x.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),B(null==x||null===(l=x.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==x||null===(a=x.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==x||null===(i=x.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==x||null===(o=x.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),W(null==x?void 0:x.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==x?void 0:x.otherFeesDiscription),K(null==x?void 0:x.lessAdjustmentFeeFiles)},[x]);const{t:oe}=a.useTranslation(),re=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},oe(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?oe(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void oe("NA");return l.createElement(n.Fragment,null,!(null!=N&&N.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==N||null===(i=N.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+oe(""+e.title),text:null!=e&&e.value?`${re(e)} ${oe(null==e?void 0:e.isUnit)}`:oe("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+oe(""+e.title),text:re(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},oe(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},oe(null==e?void 0:e.title))),null==N||null===(o=N.permit)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==N||null===(r=N.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!0)}},oe("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!1)}},oe("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==x?void 0:x.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:oe("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==x?void 0:x.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==N||null===(s=N.values[0])||void 0===s?void 0:s.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},oe("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},oe("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==x||null===(u=x.selfCertificationCharges)||void 0===u?void 0:u.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==x||null===(d=x.selfCertificationCharges)||void 0===d?void 0:d.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==x||null===(c=x.selfCertificationCharges)||void 0===c?void 0:c.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==x||null===(m=x.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,oe("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==x||null===(v=x.selfCertificationCharges)||void 0===v?void 0:v.BPA_DEVELOPMENT_CHARGES)||0,value:w,disabled:!P,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==x||null===(p=x.selfCertificationCharges)||void 0===p?void 0:p.BPA_OTHER_CHARGES)||0,value:F,disabled:!P,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(B(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:oe,type:"text",name:"otherChargesDiscription",defaultValue:null==x||null===(E=x.selfCertificationCharges)||void 0===E?void 0:E.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:j,disabled:!P,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==x||null===(f=x.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:k,disabled:!P,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==x||null===(t=x.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==x||null===(n=x.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==x||null===(l=x.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==x||null===(a=x.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(k)>0&&P?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){z(e.target.files[0]),q(e.target.files[0])},disabled:!P,onDelete:()=>{z(null),q("")},message:V?"1 "+oe("FILEUPLOADED"):oe("ES_NO_FILE_SELECTED_LABEL"),error:Q,uploadMessage:Y})):null,(null==J||null===(S=J.fileStoreIds)||void 0===S?void 0:S.length)&&parseInt(null==x||null===(_=x.selfCertificationCharges)||void 0===_?void 0:_.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},oe("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(h=J.fileStoreIds)||void 0===h?void 0:h.length)&&parseInt(null==x||null===(y=x.selfCertificationCharges)||void 0===y?void 0:y.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(A=J.fileStoreIds[(null==J||null===(C=J.fileStoreIds)||void 0===C?void 0:C.length)-1])||void 0===A?void 0:A.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==x||null===(D=x.selfCertificationCharges)||void 0===D?void 0:D.BPA_MALBA_CHARGES)+parseFloat(null==x||null===(b=x.selfCertificationCharges)||void 0===b?void 0:b.BPA_LABOUR_CESS)+parseFloat(null==x||null===(T=x.selfCertificationCharges)||void 0===T?void 0:T.BPA_WATER_CHARGES)+parseFloat(null==x||null===(I=x.selfCertificationCharges)||void 0===I?void 0:I.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(k)?parseFloat(k):0))}))),l.createElement("div",null,null==N||null===(O=N.scruntinyDetails)||void 0===O?void 0:O.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+oe(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},oe(null==e?void 0:e.text))))))))},Vn=e=>{var i,o,r,s,u;let{edcrDetails:d,applicationData:c}=e;const{t:m}=a.useTranslation(),v=window.Digit.Utils.browser.isMobile(),p=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,i,o,r,s,u;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.builtUpArea,FloorArea:(null===(o=e.occupancies)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(s=e.occupancies)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function S(e){var t;let n=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,i;let t=null===(a=n[e])||void 0===a||null===(i=a.usageCategory)||void 0===i?void 0:i.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==d||null===(i=d.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==d||null===(o=d.subOccupancyTableDetails)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.value)||void 0===s||null===(u=s.planDetail)||void 0===u?void 0:u.blocks.map((e,n)=>{var a,i,o,r,s;return l.createElement("div",{key:n,style:(null==d||null===(a=d.subOccupancyTableDetails)||void 0===a||null===(i=a[0])||void 0===i||null===(o=i.value)||void 0===o||null===(r=o.planDetail)||void 0===r||null===(s=r.blocks)||void 0===s?void 0:s.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:S(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},zn=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))},Gn=e=>{var i,o,r;let{data:s,OpenImage:u,privacy:d={}}=e;const[c,m]=n.useState(!1),{t:v}=a.useTranslation();return l.createElement("div",null,s.date&&l.createElement("p",null,s.date),l.createElement("p",null,s.name),s.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:s.mobileNumber,privacy:d}),l.createElement("p",null," ")),s.source&&l.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+s.source.toUpperCase())),s.comment&&l.createElement(zn,{otherComment:null==s?void 0:s.otherComment,headComment:null==s?void 0:s.comment}),null!=s&&s.wfComment?l.createElement("div",null,null==s||null===(i=s.wfComment)||void 0===i?void 0:i.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("WF_COMMON_COMMENTS")),!c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==s||null===(o=s.thumbnailsToShow)||void 0===o||null===(r=o.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==s?void 0:s.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==s?void 0:s.thumbnailsToShow)}})):null)};function Kn(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${i(null==e?void 0:e.title)} ${n+1}`),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function $n(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},`${i(null==e?void 0:e.title)} ${n+1}`),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const qn=e=>{var i,o,r,s,u;let{wsAdditionalDetails:d}=e;const{t:c}=a.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:f,roadCuttingDetails:g,roadCuttingAddlDetails:S,activationDetails:_}=(null==d?void 0:d.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==d||null===(i=d.additionalDetails)||void 0===i?void 0:i.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(o=d.additionalDetails)||void 0===o?void 0:o.plumberDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==f?void 0:f.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==d||null===(r=d.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==g?void 0:g.map(e=>{var n;return l.createElement("div",{style:(null==g?void 0:g.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==d||null===(s=d.additionalDetails)||void 0===s?void 0:s.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(u=d.additionalDetails)||void 0===u?void 0:u.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==_?void 0:_.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},Yn=[{title:"PT_PENDING_DUES_FROM_EARLIER",value:"Pending dues from earlier"},{title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT",value:"Miscalculation of earlier Assessment"},{title:"PT_ONE_TIME_PENALITY",value:"One time penality"},{title:"PT_OTHERS",value:"Others"}],Zn=[{title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER",value:"Advanced Paid By Citizen Earlier"},{title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO",value:"Rebate provided by commissioner/EO"},{title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN",value:"Additional amount charged from the citizen"},{title:"PT_OTHERS",value:"Others"}],Qn=e=>{var i,o,r,s;let{wsAdditionalDetails:u}=e;const{t:d}=a.useTranslation(),[c,v,p]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),S=!(null==u||null===(i=u.additionalDetails)||void 0===i||!i.isPaid),[h,y]=n.useState(!1),[A,C]=n.useState(c||{}),[D,b]=n.useState(null),[T,I]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[O,N]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),R=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(R,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a={...null==u||null===(e=u.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails};if((null==c||null===(n=c.billDetails)||void 0===n?void 0:n.length)>0){var i,o,r,s,d,m,p;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(i=c.billDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(d=c.billDetails)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.taxAmount)}];N(e),I(null==c||null===(p=c.billDetails)||void 0===p?void 0:p[0])}else v(a),C(a)},[]);let x={};const L=e=>l.createElement("h1",{className:"heading-m"},e.label),P=()=>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"})),w=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(P,null)),M=function(e,t,n){void 0===t&&(t=!1);let l={...A};if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,i;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(i=n.target)||void 0===i?void 0:i.value)||-1;l[e]=1==t?n.target.value:""}C(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},O&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==O?void 0:O.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+d("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==T?void 0:T.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+d("CS_INBOX_STATUS_FILTER"),text:d(S?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:S?{color:"#00703C"}:{color:"#D4351C"}}))),null!=u&&null!==(o=u.additionalDetails)&&void 0!==o&&o.isAdhocRebate?l.createElement("div",{onClick:e=>{y(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},d("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,h&&l.createElement(t.Modal,{headerBarMain:l.createElement(L,{label:d("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(w,{onClick:()=>{C(c),y(!1)}}),actionCancelLabel:d("PT_CANCEL"),actionCancelOnSubmit:()=>{C(c),y(!1)},actionSaveLabel:d("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=A&&A.adhocPenalty?Number(null==A?void 0:A.adhocPenalty):0,n=null!=A&&A.adhocRebate?Number(null==A?void 0:A.adhocRebate):0;var l,a;if(t||n)if(n>(null==u||null===(l=u.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))b({isError:!1,isWarning:!0,key:"error",message:d("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,o,r,s,c,m,p,E,g,S;const e=null==u||null===(i=u.additionalDetails)||void 0===i||null===(o=i.appDetails)||void 0===o?void 0:o.applicationNo,t=null==u||null===(r=u.additionalDetails)||void 0===r||null===(s=r.appDetails)||void 0===s?void 0:s.tenantId,n={...null==u||null===(c=u.additionalDetails)||void 0===c||null===(m=c.appDetails)||void 0===m?void 0:m.additionalDetails,...A};u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(p=u.additionalDetails)||void 0===p||null===(E=p.appDetails)||void 0===E?void 0:E.service)?[{applicationNo:e,tenantId:t,waterConnection:u.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:u.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==u||null===(g=u.additionalDetails)||void 0===g||null===(S=g.appDetails)||void 0===S?void 0:S.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,i,o,r,s,u,d,c,m,p,E,g,S;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(g=E[0])||void 0===g||null===(S=g.taxHeadEstimates)||void 0===S||S.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(i=e.Calculation)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.taxHeadEstimates,"category");const h=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(u=e.Calculation)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.taxAmount}];f(ln(e.Calculation[0])),I(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),N(h),A.billDetails=null==e?void 0:e.Calculation,v(A),y(!1)}).catch(e=>{var t,n,l,a,i,o;b({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?d(""+(null==e||null===(a=e.response)||void 0===a||null===(i=a.data)||void 0===i||null===(o=i.Errors[0])||void 0===o?void 0:o.code)):d("PT_COMMON_ADD_REBATE_PENALITY")})})}else b({isError:!1,isWarning:!0,key:"warning",message:d("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Yn,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==A?void 0:A.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:d})),"PT_OTHERS"===(null==A||null===(r=A.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==A?void 0:A.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},x={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==A?void 0:A.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},x={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_REBATE")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:Zn,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==A?void 0:A.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:d})),"PT_OTHERS"===(null==A||null===(s=A.adhocRebateReason_data)||void 0===s?void 0:s.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==A?void 0:A.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},x={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==A?void 0:A.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},x={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),D&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==D?void 0:D.isWarning,error:null==D||!D.isWarning,label:d(null==D?void 0:D.message),onClose:()=>{b(!1)},isDleteBtn:!0})))},Xn=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:{...t},display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},Jn=e=>{let{t:n,userType:a=!1,infoBannerLabel:i="",infoClickLable:o="",infoClickInfoLabel:r="",infoClickInfoLabel1:s=""}=e;a=a||Digit.SessionStorage.get("userType");const u=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:u?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(i))),n(o)+" ",l.createElement(Xn,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(s)))))},el=e=>{var i,o,r,s,u,d,c;let{wsAdditionalDetails:m}=e;const{t:v}=a.useTranslation(),[p,E]=n.useState(!1),[f,g]=n.useState({}),S=e=>l.createElement("h1",{className:"heading-m"},e.label),_=()=>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"})),h=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(_,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(i=m.additionalDetails)&&void 0!==i&&i.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),g(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&l.createElement(t.Modal,{headerBarMain:l.createElement(S,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(h,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==f||null===(o=f.billSlabData)||void 0===o||null===(r=o.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==f||null===(s=f.billSlabData)||void 0===s||null===(u=s.CHARGES)||void 0===u?void 0:u.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==f||null===(d=f.billSlabData)||void 0===d||null===(c=d.TAX)||void 0===c?void 0:c.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},tl={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},nl=e=>{let{className:t="table",headers:n=[],values:i=[],arrears:o=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:tl.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:tl.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:{...tl.cell,...tl.cellLeft,...tl.cellHeader}},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:{...tl.cell,...n.length==t+1?tl.cellRight:{},...tl.cellHeader},key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:{...tl.cell,...tl.cellLeft},component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:{...tl.cell,textAlign:"left",...n.length==a+1?tl.cellRight:{},whiteSpace:"pre"},key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:{...tl.cell,...tl.cellLeft}}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:{...tl.cell,...tl.cellRight,textAlign:"left",fontWeight:"700",whiteSpace:"pre"},key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:{...tl.cell,textAlign:"left"},key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:tl.cell,key:t,numeric:!0})))))))},ll={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},al=e=>{var t,i,o;let{bill:r={}}=e;const{t:s}=a.useTranslation();let u={},d=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];d=[...d];const c=(null===(i=d)||void 0===i?void 0:i.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==c||null===(o=c.toFixed)||void 0===o?void 0:o.call(c,0))||Number(0).toFixed(0));d.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:i=[]}=e;return i.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);u[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?`FY${n.getYear()+1900}-${l.getYear()-100}`:`${n.toLocaleDateString()}-${l.toLocaleDateString()}`})(e.fromPeriod,e.toPeriod)]=t});let v={};!u||Object.keys(u).map((e,t)=>{Object.keys(u[e]).map(t=>{v[t]=u[e]&&u[e][t]&&u[e][t].order||0})});let p=[];p=Object.keys(v),p.sort((e,t)=>v[e]-v[t]);const[E,f]=n.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:ll.headerStyle},s("CS_ARREARS_DETAILS")),E&&l.createElement(nl,{headers:[...p],values:u,arrears:m}),!E&&l.createElement("div",{style:ll.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},s("CS_SHOW_CARD"))),E&&l.createElement("div",{style:ll.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},s("CS_HIDE_CARD"))))};function il(e){var o,r,s,u,d,c,m,v,p,E,f,g,S,h;let{applicationDetails:y,demandData:A,workflowDetails:C,isDataLoading:D,applicationData:b,totalDemandTax:T,timelineStatusPrefix:I,showTimeLine:O=!0,statusAttribute:N="status",paymentsList:R,oldValue:x,isInfoLabel:L=!1}=e;const{t:P}=a.useTranslation();let w=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function M(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",y);const[F,B]=n.useState({}),[k,U]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==b?void 0:b.status)||k.loading||k.loaded||k.canLoad||U({loading:!1,loaded:!1,canLoad:!0}),null==k||!k.canLoad||k.loading||k.loaded||(U({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function i(){n(o),l({loading:!1,loaded:!0,canLoad:!0})}let o={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){o=e})}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==b?void 0:b.tenantId)||tenantId,null==b?void 0:b.propertyId,B,U));const H=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,`${l}/${n}/${t.getFullYear()}`},j=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:H(null==b||null===(a=b.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==b?void 0:b.channel)||""};return l.createElement(Gn,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,o,r,s,u,d,c,m,v,p,E,f,g,S,h,A,C,D;const a={uuid:null==e||null===(i=e.assignes)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==y?void 0:y.tenantId,businessIds:null==y?void 0:y.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,`ProcessInstances[${t}].assignes[0].mobileNumber`),n}}},T=n[t-1],I={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(s=e.assignes)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.name,mobileNumber:(null==b||null===(d=b.processInstance)||void 0===d||null===(c=d.assignes)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.uuid)===(null==e||null===(v=e.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)&&null!=b&&null!==(E=b.processInstance)&&void 0!==E&&null!==(f=E.assignes)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber?null==b||null===(S=b.processInstance)||void 0===S||null===(h=S.assignes)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.mobileNumber:null==e||null===(C=e.assignes)||void 0===C||null===(D=C[0])||void 0===D?void 0:D.mobileNumber,comment:P(null==e?void 0:e.comment),wfComment:T?T.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(Gn,{data:I,OpenImage:M,privacy:a})}{var T,I,O,N,R;const t={date:H(null==b||null===(T=b.auditDetails)||void 0===T?void 0:T.lastModifiedTime),name:null==e||null===(I=e.assignes)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(N=e.assignes)||void 0===N||null===(R=N[0])||void 0===R?void 0:R.mobileNumber};return l.createElement(Gn,{data:t})}},W=(e,t)=>e?t?e:P(e):P("NA"),V=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),z=window.location.href.includes("employee/noc"),G=window.location.href.includes("employee/obps"),K=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||V?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),$={table:{border:"2px solid black",width:"100%",fontFamily:"sans-serif"},td:{padding:"10px",border:"1px solid black",textAlign:"center"},th:{padding:"10px",border:"1px solid black",textAlign:"center"}},q=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?`${W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)} ${P(null==e?void 0:e.isUnit)}`:P("N/A"):null!=e&&e.value?W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):P("N/A"),[Y,Z]=n.useState(!1);console.log("demand Data arr",A);const Q=null==A?void 0:A.reduce((e,t)=>e+t.demandInterest,0),X=null==A?void 0:A.reduce((e,t)=>e+t.demandPenality,0),J=null==A?void 0:A.reduce((e,t)=>e+t.collectionTax,0),ee=null==A?void 0:A.reduce((e,t)=>e+t.collectionInterest,0),te=null==A?void 0:A.reduce((e,t)=>e+t.collectionPenality,0),ne=null==A?void 0:A.reduce((e,t)=>e+t.balanceTax,0);return null==A||A.reduce((e,t)=>e+t.balanceInterest,0),null==A||A.reduce((e,t)=>e+t.balancePenality,0),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},L?l.createElement(Jn,{t:P,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==y||null===(o=y.applicationDetails)||void 0===o?void 0:o.map((e,a)=>{var o,r,s,u,d,c,m,v,p,E,f,g,S,_,h,A,D,b,T,I,O,N,L,M,B,k,U,H,j,W,$,Y,Z,Q,X,J,ee,te,ne,le;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:V?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&V?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},z?""+P(e.title):P(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},P(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},P(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},P(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},P(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||V?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o,r,s;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:P(n.title),label:P(n.title),text:l.createElement("img",{src:P(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:P(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},P(null==n?void 0:n.title)))):z||G?""+P(n.title):P(n.title),text:l.createElement("div",null,l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(s=e.values)||void 0===s?void 0:s.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:K(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+P(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:P(n.title),label:P(n.title),text:q(n),last:a===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:K(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(al,{bill:null===(r=F.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(Wn,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:R,additionalDetails:null==y||null===(s=y.applicationData)||void 0===s?void 0:s.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==y||null===(u=y.applicationData)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.fieldinspection_pending)||void 0===c?void 0:c.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(wn,{fiReport:null==y||null===(v=y.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(Hn,{floors:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&l.createElement(jn,{owners:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&l.createElement($n,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&l.createElement(Kn,{units:null==e||null===(D=e.additionalDetails)||void 0===D?void 0:D.accessories}),!w&&(null==e||null===(b=e.additionalDetails)||void 0===b?void 0:b.permissions)&&(null==C||null===(T=C.data)||void 0===T||null===(I=T.nextActions)||void 0===I?void 0:I.length)>0&&l.createElement(Bn,{applicationData:null==y?void 0:y.applicationData,t:P,permissions:null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.permissions}),(null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(Ln,{t:P,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:C})),(null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.noc)&&l.createElement(Fn,{t:P,isNoc:!0,NOCdata:e.values,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.noc,noc:null===(M=e.additionalDetails)||void 0===M?void 0:M.data,bpaActionsDetails:C}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.scruntinyDetails)&&l.createElement(Wn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.buildingExtractionDetails)&&l.createElement(Wn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.subOccupancyTableDetails)&&l.createElement(Vn,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.documentsWithUrl)&&l.createElement(xn,{documents:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documentsWithUrl}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.documents)&&l.createElement(kn,{documents:null==e||null===($=e.additionalDetails)||void 0===$?void 0:$.documents}),(null==e||null===(Y=e.additionalDetails)||void 0===Y?void 0:Y.taxHeadEstimatesCalculation)&&l.createElement(Un,{taxHeadEstimatesCalculation:null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(qn,{wsAdditionalDetails:e,oldValue:x}),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(X=e.additionalDetails)||void 0===X||null===(J=X.redirectUrl)||void 0===J?void 0:J.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(ee=e.additionalDetails)||void 0===ee||null===(te=ee.redirectUrl)||void 0===te?void 0:te.title))),(null==e||null===(ne=e.additionalDetails)||void 0===ne?void 0:ne.estimationDetails)&&l.createElement(Qn,{wsAdditionalDetails:e,workflowDetails:C}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(el,{wsAdditionalDetails:e,workflowDetails:C}))}),O&&(null==C||null===(r=C.data)||void 0===r||null===(s=r.timeline)||void 0===s?void 0:s.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==C?void 0:C.isLoading)||D)&&l.createElement(t.Loader,null),!(null!=C&&C.isLoading)&&!D&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},P("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=C&&null!==(u=C.data)&&void 0!==u&&u.timeline&&1===(null==C||null===(d=C.data)||void 0===d||null===(c=d.timeline)||void 0===c?void 0:c.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:P(`${I}${null==C||null===(m=C.data)||void 0===m||null===(v=m.timeline[0])||void 0===v?void 0:v.state}`),customChild:j(null==C||null===(p=C.data)||void 0===p?void 0:p.timeline[0],null==C||null===(E=C.data)||void 0===E?void 0:E.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==C||null===(f=C.data)||void 0===f?void 0:f.timeline)&&(null==C||null===(g=C.data)||void 0===g?void 0:g.timeline.slice(0,Y?null==C?void 0:C.data.timeline.length:2).map((e,n,a)=>{var i;let o="";var r,s,u,d,c,m;return window.location.href.includes("/obps/")&&(o=null!=C&&null!==(r=C.data)&&void 0!==r&&null!==(s=r.timeline[n-1])&&void 0!==s&&null!==(u=s.state)&&void 0!==u&&u.includes("BACK_FROM")||null!=C&&null!==(d=C.data)&&void 0!==d&&null!==(c=d.timeline[n-1])&&void 0!==c&&null!==(m=c.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:P(`${I}${"REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[N]}${o}`),customChild:j(e,n,null==C||null===(i=C.data)||void 0===i?void 0:i.timeline)}))}))),(null==C||null===(S=C.data)||void 0===S||null===(h=S.timeline)||void 0===h?void 0:h.length)>2&&l.createElement(t.LinkButton,{label:P(Y?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{Z(e=>!e)}})))),l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"16px",fontSize:"24px"}},"DCB Details"),l.createElement("table",{border:"1px",style:$.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:$.th},"Installments"),l.createElement("th",{colSpan:"3",style:$.th},"Demand"),l.createElement("th",{colSpan:"3",style:$.th},"Collection"),l.createElement("th",{colSpan:"3",style:$.th},"Balance"),l.createElement("th",{style:$.th},"Advance")),l.createElement("tr",null,l.createElement("th",{style:$.th}),l.createElement("th",{style:$.th},"Tax"),l.createElement("th",{style:$.th},"Interest"),l.createElement("th",{style:$.th},"Penalty"),l.createElement("th",{style:$.th},"Tax"),l.createElement("th",{style:$.th},"Interest"),l.createElement("th",{style:$.th},"Penalty"),l.createElement("th",{style:$.th},"Tax"),l.createElement("th",{style:$.th},"Interest"),l.createElement("th",{style:$.th},"Penalty"),l.createElement("th",{style:$.th},"Advance"))),l.createElement("tbody",null,null==A?void 0:A.map(e=>l.createElement("tr",null,l.createElement("td",{style:$.td},e.taxPeriodFrom,"-",e.taxPeriodTo),l.createElement("td",{style:$.td},e.demandTax),l.createElement("td",{style:$.td},e.demandInterest),l.createElement("td",{style:$.td},e.demandPenality),l.createElement("td",{style:$.td},e.collectionTax),l.createElement("td",{style:$.td},e.collectionInterest),l.createElement("td",{style:$.td},e.collectionPenality),l.createElement("td",{style:$.td},e.balanceTax),l.createElement("td",{style:$.td},e.balanceInterest),l.createElement("td",{style:$.td},e.balancePenality),l.createElement("td",{style:$.td},e.advance))),l.createElement("tr",null,l.createElement("th",{style:$.th},"Total"),l.createElement("td",{style:$.td},T),l.createElement("td",{style:$.td},Q),l.createElement("td",{style:$.td},X),l.createElement("td",{style:$.td},J),l.createElement("td",{style:$.td},ee),l.createElement("td",{style:$.td},te),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td})),l.createElement("tr",null,l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("th",{style:$.th},"Total"),l.createElement("td",{style:$.td},ne),l.createElement("td",{style:$.td},"0"),l.createElement("td",{style:$.td},"0"),l.createElement("td",{style:$.td},"0")),l.createElement("tr",null,l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("td",{style:$.td}),l.createElement("th",{style:$.th},"Total Balance"),l.createElement("td",{style:$.td},ne)))))}function ol(e){var n,a,i,o,r,s,u,d,c,m,v,p,E,f,g,S,_,h;let{t:y,showToast:A,closeToast:C,businessService:D}=e;if(null!=D&&D.includes("NewTL")||null!=D&&D.includes("TL")||null!=D&&D.includes("EDITRENEWAL")){var b;let e="";switch(null==A||null===(b=A.action)||void 0===b?void 0:b.action){case"SENDBACK":e="error"===(null==A?void 0:A.key)?null==A||null===(n=A.error)||void 0===n?void 0:n.message:y("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==A?void 0:A.key)?null==A||null===(a=A.error)||void 0===a?void 0:a.message:y("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==A?void 0:A.key)?null==A||null===(i=A.error)||void 0===i?void 0:i.message:y("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==A?void 0:A.key)?null==A||null===(o=A.error)||void 0===o?void 0:o.message:y("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==A?void 0:A.key)?null==A||null===(r=A.error)||void 0===r?void 0:r.message:y("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==A?void 0:A.key)?null==A||null===(s=A.error)||void 0===s?void 0:s.message:y("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==A?void 0:A.key)?null==A||null===(u=A.error)||void 0===u?void 0:u.message:y("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==A?void 0:A.key)?null==A||null===(d=A.error)||void 0===d?void 0:d.message:y(`ES_${D}_${null==A||null===(c=A.action)||void 0===c?void 0:c.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:e,onClose:C}))}if(null!=D&&D.includes("BPA")||null!=D&&D.includes("BPA_LOW")||null!=D&&D.includes("BPA_OC")){var T;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=D&&D.includes("BPA_OC")?y(e[1]):y(e[0]),n};let n="";switch(null==A||null===(T=A.action)||void 0===T?void 0:T.action){case"REVOCATE":n="error"===(null==A?void 0:A.key)?null==A||null===(m=A.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(v=A.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==A?void 0:A.key)?null==A||null===(p=A.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==A?void 0:A.key)?null==A||null===(E=A.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==A?void 0:A.key)?null==A||null===(f=A.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(g=A.error)||void 0===g?void 0:g.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==A?void 0:A.key)?null==A||null===(S=A.error)||void 0===S?void 0:S.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==A?void 0:A.key)?null==A||null===(_=A.error)||void 0===_?void 0:_.message:y(`ES_${D}_${null==A||null===(h=A.action)||void 0===h?void 0:h.action}_UPDATE_SUCCESS`)}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:n,onClose:C}))}{var I,O;const e="error"===(null==A?void 0:A.key)?null==A||null===(I=A.error)||void 0===I?void 0:I.message:`ES_${D}_${null==A||null===(O=A.action)||void 0===O?void 0:O.action}_UPDATE_SUCCESS`;return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:y(e),onClose:C}))}}function rl(e){var i,o,r,s,u,d,c,m,v,p,E,f,g,S,_,h;let{workflowDetails:y,displayMenu:A,onActionSelect:C,setDisplayMenu:D,businessService:b,forcedActionPrefix:T,ActionBarStyle:I={},MenuStyle:O={}}=e;const{t:N}=a.useTranslation();let R=Digit.UserService.getUser();const x=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};R=null==t?void 0:t.value}const L=null===(i=R)||void 0===i||null===(o=i.info)||void 0===o||null===(r=o.roles)||void 0===r?void 0:r.map(e=>e.code);let P=!1,w=!1,M=(null==y||null===(s=y.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(d=u.nextActions)||void 0===d?void 0:d.filter(e=>(null==L?void 0:L.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==y||null===(c=y.data)||void 0===c||null===(m=c.nextActions)||void 0===m?void 0:m.filter(e=>(null==L?void 0:L.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return Digit.Hooks.useClickOutside(x,()=>{D(!1)},A),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==M?void 0:M.length)||null!=M&&null!==(v=M[0])&&void 0!==v&&null!==(p=v.redirectionUrl)&&void 0!==p&&p.pathname.includes("/pt/property-details/")&&1==(null==M?void 0:M.length)?(w=!1,P=!0):(null==M?void 0:M.length)>0&&(w=!0,P=!1),l.createElement(l.Fragment,null,!(null!=y&&y.isLoading)&&w&&!P&&l.createElement(t.ActionBar,{style:{...I}},A&&(null!=y&&null!==(E=y.data)&&void 0!==E&&null!==(f=E.actionState)&&void 0!==f&&f.nextActions||null!=y&&null!==(g=y.data)&&void 0!==g&&g.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:T||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase()),options:M,optionKey:"action",t:N,onSelect:C,style:O}):null,l.createElement(t.SubmitBar,{ref:x,label:N("WF_TAKE_ACTION"),onSubmit:()=>D(!A)})),!(null!=y&&y.isLoading)&&!w&&P&&l.createElement(t.ActionBar,{style:{...I}},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==M||null===(S=M[0])||void 0===S?void 0:S.action,value:null==M||null===(_=M[0])||void 0===_?void 0:_.action,onClick:e=>{C((null==M?void 0:M[0])||{})}},N(`${T||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase())}_${null==M||null===(h=M[0])||void 0===h?void 0:h.action}`))))}const sl=()=>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"})),ul=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(sl,null));function dl(e){let{action:n,closeWarningPopup:i}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},o("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(ul,{onClick:()=>{i()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,o("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",o("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+o("PT_AMOUNT_DUE"),text:"₹"+o(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:o("ES_PT_COMMON_CANCEL"),onSubmit:i,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:o("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(`${window.location.origin}${null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname}`)},style:{marginLeft:"10px"}})))),")")}const cl=e=>{var o,r;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const u=Digit.ULBService.getCurrentTenantId(),c=Digit.ULBService.getStateId(),{data:m}=Digit.Hooks.obps.useMDMS(c,"BPA",["BlockReason"]),{t:v}=a.useTranslation(),p=i.useHistory();let{id:E}=i.useParams();const[f,S]=n.useState(!1),[_,h]=n.useState(null),[y,A]=n.useState(!1),[C,D]=n.useState(!1),[b,T]=n.useState(!1),{data:I}=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]),{applicationDetails:O,demandData:N,totalDemandTax:R,totalBalanceTax:x,showToast:L,setShowToast:P,isLoading:w,isDataLoading:M,applicationData:F,mutate:B,nocMutation:k,workflowDetails:U,id:H,businessService:j,closeToast:W,moduleCode:V,timelineStatusPrefix:z,forcedActionPrefix:G,statusAttribute:K,ActionBarStyle:$,MenuStyle:q,paymentsList:Y,showTimeLine:Z=!0,oldValue:Q,isInfoLabel:X=!1,clearDataDetails:J}=e;n.useEffect(()=>{L&&U.revalidate()},[L]);const ee=d.useQueryClient(),te=()=>{h(null),A(!1)};return w||C?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,w?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(il,{applicationDetails:O,demandData:N,id:H,workflowDetails:U,isDataLoading:M,applicationData:F,totalDemandTax:R,totalBalanceTax:x,businessService:j,timelineStatusPrefix:z,statusAttribute:K,paymentsList:Y,showTimeLine:Z,oldValue:Q,isInfoLabel:X}),y?l.createElement(Rn,{t:v,action:_,tenantId:u,state:c,id:E,applicationDetails:O,applicationData:null==O?void 0:O.applicationData,closeModal:te,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,i,o,r,s,u,d,c,m,E,f,S,h,y,A,C,b,T){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(i=a.workflow)||void 0===i||null===(o=i.comment)||void 0===o?void 0:o.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.action)?0==(null==e||null===(u=e.Licenses)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.additionalDetail)||void 0===c||null===(m=c.validityYears)||void 0===m?void 0:m.length):0==(null==e||null===(E=e.Licenses)||void 0===E||null===(f=E[0])||void 0===f||null===(S=f.comment)||void 0===S?void 0:S.length))||0==(null==e||null===(h=e.WaterConnection)||void 0===h||null===(y=h.comment)||void 0===y?void 0:y.length)||0==(null==e||null===(A=e.SewerageConnection)||void 0===A||null===(C=A.comment)||void 0===C?void 0:C.length)||0==(null==e||null===(b=e.BPA)||void 0===b||null===(T=b.comment)||void 0===T?void 0:T.length)){var I,O;"INITIATE"===(null==e||null===(I=e.Licenses)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.action)?alert(v("Please fill in the validity before submitting")):alert(v("Please fill in the comments before submitting"))}else{const a=function(a,i,o,r,s){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(i=e.BPA)&&void 0!==i&&null!==(o=i.additionalDetails)&&void 0!==o&&o.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(s=r.workflow)||void 0===s?void 0:s.action)){function u(t){if(l)return t;B&&(D(!0),B(e,{onError:(e,t)=>{D(!1),P({key:"error",error:e}),setTimeout(W,5e3)},onSuccess:(e,t)=>{var l,a,i,o,r,s;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),D(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,p.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,p.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=n)&&void 0!==i&&i.isNoc&&p.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(o=e.Amendments)||void 0===o?void 0:o.length)>0){var u,d,c,m,E,f,g,S;null!=t&&null!==(u=t.AmendmentUpdate)&&void 0!==u&&null!==(d=u.workflow)&&void 0!==d&&d.action.includes("SEND_BACK")?P({key:"success",label:v("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(c=t.AmendmentUpdate)&&void 0!==c&&null!==(m=c.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?P({key:"success",label:v("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(E=t.AmendmentUpdate)&&void 0!==E&&null!==(f=E.workflow)&&void 0!==f&&f.action.includes("APPROVE")?P({key:"success",label:v("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(S=g.workflow)&&void 0!==S&&S.action.includes("REJECT")&&P({key:"success",label:v("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var h;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(s=e.Licenses[0])&&void 0!==s&&s.applicationNumber)return P({key:"success",action:_}),void p.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(h=e.Licenses[0])||void 0===h?void 0:h.applicationNumber));P({key:"success",action:_}),J&&setTimeout(J,3e3),setTimeout(W,5e3),ee.clear(),ee.refetchQueries("APPLICATION_SEARCH")}}})),te()}D(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute({...e}));const a=function(){if(!1!==t&&k){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==k?void 0:k.mutateAsync(e)),a=g(function(){return D(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,i,o,r,s,u,d,c,m,p;D(!1);let E=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(i=a[0])&&void 0!==i&&i.code?v(null==e||null===(o=e.response)||void 0===o||null===(r=o.data)||void 0===r||null===(s=r.Errors)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.code):(null==e||null===(d=e.response)||void 0===d||null===(c=d.data)||void 0===c||null===(m=c.Errors)||void 0===m||null===(p=m[0])||void 0===p?void 0:p.message)||e;te(),P({key:"error",error:{message:E}}),setTimeout(W,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(u):u(a)}alert(v("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==U||null===(o=U.data)||void 0===o?void 0:o.timeline,businessService:j,workflowDetails:U,moduleCode:V,blockReason:null==m||null===(r=m.BPA)||void 0===r?void 0:r.BlockReason}):null,b?l.createElement(dl,{action:_,workflowDetails:U,businessService:j,isWarningPop:b,closeWarningPopup:()=>{T(!1)}}):null,l.createElement(ol,{t:v,showToast:L,closeToast:W,businessService:j}),s?l.createElement("div",null,l.createElement(t.SubmitBar,{style:{marginRight:20},label:v("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(u,{applicationNo:null==F?void 0:F.applicationNo})).then(function(e){var t,n,l,a,i,o;const r=Digit.Utils.obps.calculateRiskType(null==I||null===(t=I.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==O||null===(n=O.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==O||null===(i=O.edcrDetails)||void 0===i||null===(o=i.planDetail)||void 0===o?void 0:o.blocks),s={BPA:e.BPA[0]};s.BPA.riskType=r,s.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null},s.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",s.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),s.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const d=function(e,t,n,l,a,i,o,r,d,c,m,p){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==s||null===(e=s.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==s||null===(l=s.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null==s||null===(o=s.BPA)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(d=r.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)+parseInt(null==s||null===(c=s.BPA)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(p=m.selfCertificationCharges)||void 0===p?void 0:p.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(s,u)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(v("Enterd Less Adjustment amount is invalid"))}();if(d&&d.then)return d.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0})):l.createElement(rl,{workflowDetails:U,displayMenu:f,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa")&&window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]),null!=e&&e.isToast)P({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(W,5e3);else if(null!=e&&e.isWarningPopUp)T(!0);else if(null!=e&&e.redirectionUrll){var a,i,o,r,s;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))p.push(""+(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:`${null===(s=location)||void 0===s?void 0:s.pathname}${location.search}`}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.action)){var u,d;p.push(""+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname),{data:null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.state})}else{var c;window.location.assign(`${window.location.origin}/digit-ui/employee/payment/collect/${null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.pathname}`)}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))console.log("Got Inside Direct"),A(!0);else{var m,v;p.push({pathname:null===(m=e.redirectionUrl)||void 0===m?void 0:m.pathname,state:{...null===(v=e.redirectionUrl)||void 0===v?void 0:v.state}})}else A(!0);h(e),S(!1)},setDisplayMenu:S,businessService:j,forcedActionPrefix:G,ActionBarStyle:$,MenuStyle:q})))};var ml=l.memo(()=>{var e,t,o,r;const{t:s}=a.useTranslation(),u=(Digit.Hooks.useStore.getInitData(),Digit.ULBService.getCurrentTenantId()),{id:d}=i.useParams(),[c,m]=n.useState(null),[v,p]=n.useState({}),[E,f]=n.useState(!1),[g,S]=n.useState(!1),[_,h]=n.useState("asset-create"),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetApplicationDetail(s,u,d),{mutate:C}=Digit.Hooks.asset.useASSETApplicationAction(u);let D=Digit.Hooks.useWorkflowDetails({tenantId:(null==A||null===(e=A.applicationData)||void 0===e?void 0:e.tenantId)||u,id:null==A||null===(t=A.applicationData)||void 0===t||null===(o=t.applicationData)||void 0===o?void 0:o.applicationNo,moduleCode:_,role:["ASSET_INITIATOR","ASSET_VERIFIER","ASSET_APPROVER"]});return Digit.Hooks.asset.useASSETSearch({tenantId:u,filters:{applicationNo:d,audit:!0}}),n.useEffect(()=>{A&&p(B.cloneDeep(A))},[A]),n.useEffect(()=>{var e,t,n;null==D||null===(e=D.data)||void 0===e||!e.applicationBusinessService||"asset-create"===(null==D||null===(t=D.data)||void 0===t?void 0:t.applicationBusinessService)&&"asset-create"===_||h(null==D||null===(n=D.data)||void 0===n?void 0:n.applicationBusinessService)},[D.data]),s("AST_REPORT"),l.createElement("div",null,l.createElement(cl,{applicationDetails:null==v?void 0:v.applicationData,isLoading:y,isDataLoading:y,applicationData:null==v||null===(r=v.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:D,businessService:_,moduleCode:"ASSET",showToast:c,setShowToast:m,closeToast:()=>{m(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const vl=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"ASSIGN"}_${e}${n?"":"_ERROR"}`),pl=(e,t,n,l)=>vl("LABEL",e,t,n,l),El=e=>{var n,a,i,o,r,s,u,d,c,m,v,p,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,v=e.isSuccess,p=e.isEmployee,E=e.t,vl("ACTION",m,v,p,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:pl((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},fl=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"ASSIGN"}_${e}${n?"":"_ERROR"}`),gl=(e,t,n,l)=>fl("ACTION",e,t,n,l),Sl=(e,t,n,l)=>fl("LABEL",e,t,n,l),_l=e=>{let{data:n,action:a,isSuccess:i,isEmployee:o,t:r}=e;return l.createElement(t.Banner,{message:gl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),applicationNumber:null==n?void 0:n.disposalId,info:Sl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),successful:i})},hl=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"RETURN"}_${e}${n?"":"_ERROR"}`),yl=(e,t,n,l)=>hl("LABEL",e,t,n,l),Al=e=>{var n,a,i,o,r,s,u,d,c,m,v,p,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,v=e.isSuccess,p=e.isEmployee,E=e.t,hl("ACTION",m,v,p,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:yl((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Cl=e=>l.createElement("span",{className:"cell-text"},e),Dl=e=>l.createElement("span",{className:"sla-cell"},e),bl=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],Tl=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],Il=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},Ol=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},Nl=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},Rl=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e},xl=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Ll(e){var a,i;let{t:o,document:r,setDocuments:s,setError:u,documents:d,setFormError:c,clearFormErrors:m,config:v,formState:p,comingDataFromAPI:E,id:f}=e;const S=null==d?void 0:d.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],[_,h]=n.useState(S?{...S,active:"ACTIVE"===(null==S?void 0:S.status),code:null==S?void 0:S.documentType}:1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[y,A]=n.useState(null),[C,D]=n.useState(()=>(null==S?void 0:S.fileStoreId)||null),[b,T]=n.useState(!1),I=()=>{var e,t;let n=null===(e=p.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(null==r?void 0:r.code)&&(n=n.filter(e=>e!=(null==r?void 0:r.code)),n.length?c(v.key,{type:n}):m(v.key))};return n.useEffect(()=>{null!=_&&_.code&&s(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==_?void 0:_.code));return 0===(null==C?void 0:C.length)||null===C?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==C),{documentType:null==_?void 0:_.code,fileStoreId:C,documentUid:C}]}),b?b&&I():C&&null!=_&&_.code?C&&null!=_&&_.code&&I():(()=>{var e,t;let n=null===(e=p.errors)||void 0===e||null===(t=e[v.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(r.code)||(n.push(r.code),c(v.key,{type:n}))})()},[C,_,b]),n.useEffect(()=>{!function(){try{u(null);const e=function(){if(y){const e=function(){if(y.size>=5242880)u(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=g(function(){return D(null),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",y,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?D(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):u(o("CS_FILE_UPLOAD_ERROR"))})},function(){u(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[y]),n.useEffect(()=>{b&&D(null)},[b]),l.createElement("div",{style:{marginBottom:"24px"}},null!=r&&r.hasDropdown?l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},o(null==r?void 0:r.code.replaceAll(".","_"))+" *")):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"}),l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:function(e){A(e.target.files[0])},selectedDocument:null==E||null===(i=E[0])||void 0===i?void 0:i.fileStoreId,onDelete:()=>{D(null)},id:f,message:C?"1 "+o("CS_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!C}))))}let Pl=[];const wl=e=>{let{currentStep:n=1,flow:i=""}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return(e=>{switch(e){case"STAKEHOLDER":Pl=[];break;default:Pl=["ASSET_GENERAL_DETAILS","AST_DETAILS","AST_ADDRESS_DETAILS","AST_DOCUMENT_DETAILS","AST_SUMMARY"]}})(i),l.createElement("div",{className:"timeline-container",style:r?{}:{maxWidth:"960px",minWidth:"640px",marginRight:"auto",marginLeft:"auto",display:"flex",justifyContent:"center"}},Pl.map((e,a,i)=>l.createElement("div",{className:"timeline-checkpoint",key:a},l.createElement("div",{className:"timeline-content"},l.createElement("span",{className:"circle "+(a<=n-1&&"active")},a<n-1?l.createElement(t.TickMark,null):a+1),l.createElement("span",{className:"secondary-color"},o(e))),a<i.length-1&&l.createElement("span",{className:"line "+(a<n-1&&"active")}))))},Ml=[{head:"ES_TITILE_OWNER_DETAILS",body:[{route:"info",component:"ServiceDoc",nextStep:"asset-deatils",key:"Documents"},{route:"asset-deatils",component:"NewAssetClassification",withoutLabel:!0,key:"asset",type:"component",nextStep:"assets",hideInEmployee:!0,isMandatory:!0,texts:{header:"ASSET_GENERAL_DETAILS",submitBarLabel:"COMMON_NEXT"}}]},{head:"TITLE_ASSET_DEATIL",body:[{route:"assets",component:"NewAsset",withoutLabel:!0,key:"assetDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:"pincode",texts:{header:"AST_DETAILS",submitBarLabel:"COMMON_NEXT"}}]},{head:"AST_ADDRESS_DETAILS",body:[{route:"pincode",component:"AssetPincode",texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"address",type:"component"},{route:"address",component:"AssetAddress",withoutLabel:!0,texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"COMMON_NEXT"},key:"address",nextStep:"documents",isMandatory:!0,type:"component"}]},{head:"ES_TITILE_DOCUMENT_DETAILS",body:[{route:"documents",component:"NewDocument",withoutLabel:!0,key:"documents",type:"component",nextStep:null,texts:{header:"AST_DOCUMENT_DETAILS",submitBarLabel:"COMMON_NEXT"}}]}];function Fl(e){var a;let{t:i,document:o,setDocuments:r,setError:s,documents:u,formData:d,id:m}=e;const v=null==u?void 0:u.find(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)}),[p,E]=n.useState(v?{...v,active:!0===(null==o?void 0:o.active),code:null==v?void 0:v.documentType}:1===(null==o||null===(a=o.dropdownData)||void 0===a?void 0:a.length)?null==o?void 0:o.dropdownData[0]:{}),[f,g]=n.useState(null),[S,_]=n.useState((null==v?void 0:v.fileStoreId)||null),[h,y]=n.useState((null==d?void 0:d.latitude)||null),[A,C]=n.useState((null==d?void 0:d.longitude)||null),D=e=>new Promise(t=>{c.getData(e,function(){const e=c.getTag(this,"GPSLatitude"),n=c.getTag(this,"GPSLongitude");if(e&&n){const l=b(e),a=b(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null}),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&alert("Please upload a photo with location details")})}),b=e=>e[0]+e[1]/60+e[2]/3600;return n.useEffect(()=>{f&&(f.size>=5242880?s(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")):(_(null),Digit.UploadServices.Filestorage("ASSET",f,Digit.ULBService.getStateId()).then(e=>{var t,n;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?_(e.data.files[0].fileStoreId):s(i("CS_FILE_UPLOAD_ERROR"))}).catch(()=>s(i("CS_FILE_UPLOAD_ERROR")))))},[f,i]),n.useEffect(()=>{null!=p&&p.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==p?void 0:p.code));return S?[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==S),{documentType:null==p?void 0:p.code,fileStoreId:S,documentUid:S,latitude:h,longitude:A}]:t})},[S,p,h,A,r]),l.createElement("div",{style:{marginBottom:"24px"}},(null==o?void 0:o.hasDropdown)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i(null==o?void 0:o.code.replaceAll(".","_"))+" *")),l.createElement(t.LabelFieldPair,null,l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:e=>{const t=e.target.files[0];g(t),D(t).then(e=>{let{latitude:t,longitude:n}=e;y(t),C(n),"OWNER.ASSETPHOTO"!==(null==o?void 0:o.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{_(null),y(null),C(null)},id:m,message:S?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!S}))),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&h&&A&&l.createElement("div",{style:{marginTop:"10px",textAlign:"center"}},l.createElement("p",null,l.createElement("strong",null,i("Location Details"),":")),l.createElement("p",null,i("Latitude"),": ",h),l.createElement("p",null,i("Longitude"),": ",A)))}const Bl=e=>{let{jumpTo:n}=e;const{t:o}=a.useTranslation(),r=i.useHistory();return l.createElement(t.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(n)}})},kl=e=>{const{t:t}=a.useTranslation();return e.isSuccess?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_SUCCESS"):t("ES_ASSET_RESPONSE_CREATE_ACTION"):e.isLoading?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_PENDING"):t("CS_AST_APPLICATION_PENDING"):e.isSuccess?void 0:window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_FAILED"):t("CS_AST_APPLICATION_FAILED")},Ul={padding:"4px 0px",justifyContent:"space-between"},Hl=e=>{var n,a;return l.createElement(t.Banner,{message:kl(e),applicationNumber:null===(n=e.data)||void 0===n||null===(a=n.Assets)||void 0===a?void 0:a[0].applicationNo,info:e.isSuccess?e.t("ES_ASSET_RESPONSE_CREATE_LABEL"):"",successful:e.isSuccess,style:{width:"100%"}})},jl=e=>{var a,r,s,u,d,c,m,v,p;const{assigndetails:E,focusIndex:f,allAssets:g,setassigndetails:S,t:_,config:h,setError:y,clearErrors:A,formState:C,setFocusIndex:D,departNamefromMDMS:b,designationNamefromMDMS:T}=e,[I,O]=n.useState(null),{control:N,formState:R,watch:x,trigger:L}=o.useForm(),P=x(),{errors:w}=R,{id:M}=i.useParams(),F=Digit.ULBService.getCurrentTenantId(),{data:k}=Digit.Hooks.asset.useAssetApplicationDetail(_,F,M),[U,H]=l.useState({});n.useEffect(()=>{B.isEqual(U,P)||(H({...P}),S(e=>e.map(e=>e.key&&e.key===E.key?{...e,...P}:{...e})),L())},[P]),n.useEffect(()=>{var e;Object.keys(w).length&&!B.isEqual((null===(e=C.errors[h.key])||void 0===e?void 0:e.type)||{},w)?y(h.key,{type:w}):!Object.keys(w).length&&C.errors[h.key]&&A(h.key)},[w]);const j={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==g?void 0:g.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+_(Il(null==k||null===(a=k.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:_("AST_DEPARTMENT_LABEL"),text:""+_(Il("COMMON_MASTERS_DEPARTMENT_"+(null==k||null===(s=k.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.department)))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ASSIGNED_USER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"assignedUser",defaultValue:null==E?void 0:E.assignedUser,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"assignedUser"===f.type,onChange:t=>{e.onChange(t.target.value),D({index:E.key,type:"assignedUser"})},onBlur:t=>{D({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:j},R.touched.assignedUser?null==w||null===(d=w.assignedUser)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_EMP_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"employeeCode",defaultValue:null==E?void 0:E.employeeCode,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"employeeCode"===f.type,onChange:t=>{e.onChange(t.target.value),D({index:E.key,type:"employeeCode"})},onBlur:t=>{D({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:j},R.touched.employeeCode?null==w||null===(c=w.employeeCode)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_DESIGNATION")),l.createElement(o.Controller,{control:N,name:"designation",defaultValue:null==E?void 0:E.designation,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:j},R.touched.designation?null==w||null===(m=w.designation)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_ALLOCATED_DEPARTMENT")),l.createElement(o.Controller,{control:N,name:"allocatedDepartment",defaultValue:null==E?void 0:E.allocatedDepartment,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:b,optionKey:"i18nKey",t:_})})),l.createElement(t.CardLabelError,{style:j},R.touched.allocatedDepartment?null==w||null===(v=w.allocatedDepartment)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},_("AST_TRANSFER_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"transferDate",defaultValue:null==E?void 0:E.transferDate,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||_("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:j},R.touched.employeeCode?null==w||null===(p=w.employeeCode)||void 0===p?void 0:p.message:""))),(null==I?void 0:I.label)&&l.createElement(t.Toast,{label:null==I?void 0:I.label,onClose:e=>{O(e=>null)}}))},Wl=e=>{var a,r,s,u,d,c,m,v,p,E,f,g,S,_;const{disposeDetails:h,focusIndex:y,allAssets:A,setdisposeDetails:C,t:D,config:b,setError:T,clearErrors:I,formState:O,setFocusIndex:N}=e,[R,x]=n.useState(null),[L,P]=n.useState(!1),[w,M]=n.useState(""),{control:F,formState:k,watch:U,setValue:H,trigger:j,register:W}=o.useForm(),V=U(),{errors:z}=k,{id:G}=i.useParams(),K=Digit.ULBService.getCurrentTenantId(),[$,q]=l.useState({}),[Y,Z]=n.useState(null),[Q,X]=n.useState(""),[J,ee]=n.useState(""),[te,ne]=n.useState({}),{data:le}=Digit.Hooks.asset.useAssetApplicationDetail(D,K,G);n.useEffect(()=>{if(le){var e,t,n,l,a,i;const o=function(e){const t=new Date(1e3*e),n=new Date;return Math.floor((n-t)/864e5)}(null==le||null===(e=le.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate);W("currentAgeOfAsset"),W("assetId"),W("lifeOfAsset"),H("currentAgeOfAsset",o),H("assetId",null==le||null===(n=le.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.id),H("lifeOfAsset",null==le||null===(a=le.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.lifeOfAsset)}},[le]),n.useEffect(()=>{B.isEqual($,V)||(q({...V}),C(e=>e.map(e=>e.key&&e.key===h.key?{...e,...V}:{...e})),j())},[V]),n.useEffect(()=>{var e;Object.keys(z).length&&!B.isEqual((null===(e=O.errors[b.key])||void 0===e?void 0:e.type)||{},z)?T(b.key,{type:z}):!Object.keys(z).length&&O.errors[b.key]&&I(b.key)},[z]);const ae={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},ie=()=>{P(!L)};n.useEffect(()=>{W("fileStoreId"),Q&&H("fileStoreId",Q)},[Q,W,H]);const oe=[{code:"End of Life",i18nKey:"END_OF_LIFE"},{code:"Obsolete(outdated)",i18nKey:"OBSOLETE(OUTDATED)"},{code:"Damaged",i18nKey:"DAMAGED"},{code:"Others",i18nKey:"OTHERS"}];n.useEffect(()=>{Y&&(Y.size>=5242880?(T(D("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),X(null)):(T(""),Digit.UploadServices.Filestorage("ASSET",Y,Digit.ULBService.getStateId()).then(e=>{var t,n;console.log("Upload Response:",e),(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?X(e.data.files[0].fileStoreId):T(D("CS_FILE_UPLOAD_ERROR"))}).catch(()=>T(D("CS_FILE_UPLOAD_ERROR")))))},[Y,D]);const re=e=>{const t=e.target.files[0];if(t){if(t.size>5242880)return void ee("File size should not exceed 5MB");Z(t),ee("")}};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==A?void 0:A.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_NAME"),text:""+D(Il(null==le||null===(a=le.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.assetName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_CURRENT_COST"),text:""+D(Il(null==le||null===(s=le.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.bookValue))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_LIFE"),text:""+D(Il(null==le||null===(d=le.applicationData)||void 0===d||null===(c=d.applicationData)||void 0===c?void 0:c.lifeOfAsset))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_RESIDUAL_LIFE"),text:(()=>{var e,t,n,l;let a=null==le||null===(e=le.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate,i=(null==le||null===(n=le.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.lifeOfAsset)-(Date.now()-1e3*a)/315576e5;if(i<=0)return"0 years, 0 months, 0 days";let o=Math.floor(i),r=365.25*(i-o);return`${o} years, ${Math.floor(r/30.44)} months, ${Math.round(r%30.44)} days`})()})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"disposalDate",defaultValue:null==h?void 0:h.disposalDate,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:ae},k.touched.employeeCode?null==z||null===(m=z.employeeCode)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_REASON_DISPOSAL")),l.createElement(o.Controller,{control:F,name:"reasonForDisposal",defaultValue:null==h?void 0:h.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:oe,optionKey:"i18nKey",t:D})})),l.createElement(t.CardLabelError,{style:ae},k.touched.designation?null==z||null===(v=z.designation)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"comments",defaultValue:null==h?void 0:h.comments,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:y.index===(null==h?void 0:h.key)&&"comments"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"comments"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ae},k.touched.assignedUser?null==z||null===(p=z.assignedUser)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"amountReceived",defaultValue:null==h?void 0:h.amountReceived,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:y.index===(null==h?void 0:h.key)&&"amountReceived"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"amountReceived"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ae},k.touched.employeeCode?null==z||null===(E=z.employeeCode)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(o.Controller,{control:F,name:"isAssetDisposedInFacility",defaultValue:null==h?void 0:h.isAssetDisposedInFacility,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:D(" If disposed in facility, amount received will become zero"),onChange:ie,styles:{height:"auto"},value:e.value,checked:!L})}))),l.createElement(t.CardLabelError,{style:ae},k.touched.employeeCode?null==z||null===(f=z.employeeCode)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_DISPOSE_RECIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onUpload:re,onDelete:()=>{Z(null),e.onChange(null)},message:Y?"1 "+D("CS_ACTION_FILEUPLOADED"):D("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:J||!Y})}))),L&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"purchaserName",defaultValue:null==h?void 0:h.purchaserName,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:y.index===(null==h?void 0:h.key)&&"purchaserName"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"purchaserName"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ae},k.touched.employeeCode?null==z||null===(g=z.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"paymentMode",defaultValue:null==h?void 0:h.paymentMode,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:y.index===(null==h?void 0:h.key)&&"paymentMode"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"paymentMode"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ae},k.touched.employeeCode?null==z||null===(S=z.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:F,name:"receiptNumber",defaultValue:null==h?void 0:h.receiptNumber,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:y.index===(null==h?void 0:h.key)&&"receiptNumber"===y.type,onChange:t=>{e.onChange(t.target.value),N({index:h.key,type:"receiptNumber"})},onBlur:t=>{N({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ae},k.touched.employeeCode?null==z||null===(_=z.employeeCode)||void 0===_?void 0:_.message:"")))),(null==R?void 0:R.label)&&l.createElement(t.Toast,{label:null==R?void 0:R.label,onClose:e=>{x(e=>null)}}))},Vl=e=>{var a,r,s,u,d,c,m,v,p;const{maintenanceDetails:E,focusIndex:f,t:g,config:S,setError:_,clearErrors:h,formState:y,setFocusIndex:A}=e,[C,D]=n.useState(null),[b,T]=n.useState(!1),[I,O]=n.useState(""),{control:N,formState:R,watch:x}=o.useForm(),{errors:L}=(x(),R),{id:P}=i.useParams(),w=Digit.ULBService.getCurrentTenantId(),[M,F]=l.useState({}),[k,U]=n.useState(null),[H,j]=n.useState(""),[W,V]=n.useState(""),[z,G]=n.useState({});Digit.Hooks.asset.useAssetApplicationDetail(g,w,P),n.useEffect(()=>{var e;Object.keys(L).length&&!B.isEqual((null===(e=y.errors[S.key])||void 0===e?void 0:e.type)||{},L)?_(S.key,{type:L}):!Object.keys(L).length&&y.errors[S.key]&&h(S.key)},[L]);const K={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},$=[{code:"AMC",i18nKey:"AST_AMC"},{code:"CMC",i18nKey:"AST_CMC"},{code:"OTHER",i18nKey:"AST_OTHER"}];return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"disposalDate",defaultValue:null==E?void 0:E.disposalDate,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(a=L.employeeCode)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_TYPE_OF_SERVICE")),l.createElement(o.Controller,{control:N,name:"reasonForDisposal",defaultValue:null==E?void 0:E.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:$,optionKey:"i18nKey",t:g})})),l.createElement(t.CardLabelError,{style:K},R.touched.designation?null==L||null===(r=L.designation)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"comments",defaultValue:null==E?void 0:E.comments,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"comments"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"comments"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.assignedUser?null==L||null===(s=L.assignedUser)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"amountReceived",defaultValue:null==E?void 0:E.amountReceived,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"amountReceived"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"amountReceived"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(u=L.employeeCode)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(o.Controller,{control:N,name:"isAssetDisposedInFacility",defaultValue:null==E?void 0:E.isAssetDisposedInFacility,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:g(" If disposed in facility, amount received will become zero"),styles:{height:"auto"},value:e.value,checked:!b})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(d=L.employeeCode)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_SERVICE_UNDER_WARRANTY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onDelete:()=>{U(null),e.onChange(null)},message:k?"1 "+g("CS_ACTION_FILEUPLOADED"):g("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:W||!k})}))),b&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"purchaserName",defaultValue:null==E?void 0:E.purchaserName,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"purchaserName"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"purchaserName"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(c=L.employeeCode)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"paymentMode",defaultValue:null==E?void 0:E.paymentMode,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"paymentMode"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"paymentMode"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(m=L.employeeCode)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"receiptNumber",defaultValue:null==E?void 0:E.receiptNumber,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"receiptNumber"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"receiptNumber"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(v=L.employeeCode)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"employeeCode",defaultValue:null==E?void 0:E.employeeCode,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"employeeCode"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"employeeCode"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(p=L.employeeCode)||void 0===p?void 0:p.message:"")))),(null==C?void 0:C.label)&&l.createElement(t.Toast,{label:null==C?void 0:C.label,onClose:e=>{D(e=>null)}}))},zl=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],Gl=e=>{var a,r,s,u,d,c,m,v,p,E,f,g,S,_,h;const{returndetails:y,allAssets:A,setreturndetails:C,t:D,config:b,setError:T,clearErrors:I,formState:O}=e,[N,R]=n.useState(null),{control:x,formState:L,watch:P,trigger:w}=o.useForm(),M=P(),{errors:F}=L,{id:k}=i.useParams(),U=Digit.ULBService.getCurrentTenantId(),{data:H}=Digit.Hooks.asset.useAssetApplicationDetail(D,U,k),[j,W]=l.useState({});return n.useEffect(()=>{B.isEqual(j,M)||(W({...M}),C(e=>e.map(e=>e.key&&e.key===y.key?{...e,...M}:{...e})),w())},[M]),n.useEffect(()=>{var e;Object.keys(F).length&&!B.isEqual((null===(e=O.errors[b.key])||void 0===e?void 0:e.type)||{},F)?T(b.key,{type:F}):!Object.keys(F).length&&O.errors[b.key]&&I(b.key)},[F]),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==A?void 0:A.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+D(Il(null==H||null===(a=H.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_ASSIGNED_USER"),text:""+D(Il(null==H||null===(s=H.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u||null===(d=u.assetAssignment)||void 0===d?void 0:d.assignedUserName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_ASSIGNED_DATE"),text:""+D(Il((V=null==H||null===(c=H.applicationData)||void 0===c||null===(m=c.applicationData)||void 0===m||null===(v=m.assetAssignment)||void 0===v?void 0:v.assignedDate,V?new Date(V).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_DESIGNATION"),text:""+D(Il(null==H||null===(p=H.applicationData)||void 0===p||null===(E=p.applicationData)||void 0===E||null===(f=E.assetAssignment)||void 0===f?void 0:f.designation))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:D("AST_EMP_CODE"),text:""+D(Il(null==H||null===(g=H.applicationData)||void 0===g||null===(S=g.applicationData)||void 0===S||null===(_=S.assetAssignment)||void 0===_?void 0:_.employeeCode))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},D("AST_RETURN_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:x,name:"returnDate",defaultValue:null==y?void 0:y.returnDate,rules:{required:D("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||D("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},L.touched.employeeCode?null==F||null===(h=F.employeeCode)||void 0===h?void 0:h.message:""))),(null==N?void 0:N.label)&&l.createElement(t.Toast,{label:null==N?void 0:N.label,onClose:e=>{R(e=>null)}}));var V},Kl=[{head:"ASSET_GENERAL_DETAILS",body:[{component:"EditGeneralDetails",withoutLabel:!0,key:"editAssignDetails",type:"component"}]},{head:"AST_DETAILS",body:[{component:"EditAssetDetails",withoutLabel:!0,key:"editNewAssetDetails",type:"component"}]}],$l=e=>{const t=new Date(1e3*e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},ql=e=>{var a,i,r,s,u,d,c,m,v,p,E,f,g,S;const{editAssignDetails:_,focusIndex:h,seteditAssignDetails:y,t:A,config:C,setError:D,clearErrors:b,setFocusIndex:T,menu_Asset:I,asset_type:O,asset_sub_type:N,asset_parent_sub_category:R,departNamefromMDMS:x,financal:L,sourcefinance:P,assetType:w,comingDataFromAPI:M,assetCurrentUsage:F,modeOfAcquisition:k}=e,[U,H]=n.useState(null),{control:j,formState:W,watch:V,trigger:z}=o.useForm(),G=V(),{errors:K}=W,[$,q]=l.useState({}),Y=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{B.isEqual($,G)||(q({...G}),y(e=>e.map(e=>e.key===_.key?{...e,...G}:e)),z())},[G]),n.useEffect(()=>{var e;Object.keys(K).length&&!B.isEqual((null===(e=W.errors[C.key])||void 0===e?void 0:e.type)||{},K)?D(C.key,{type:K}):!Object.keys(K).length&&W.errors[C.key]&&b(C.key)},[K]);const Z={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_FINANCIAL_YEAR")),l.createElement(o.Controller,{control:j,name:"financialYear",defaultValue:Y(null==M?void 0:M.financialYear),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:L,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.financialYear?null==K||null===(a=K.financialYear)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_SOURCE_FINANCE")),l.createElement(o.Controller,{control:j,name:"sourceOfFinance",defaultValue:Y(null==M?void 0:M.sourceOfFinance),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:P,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.sourceOfFinance?null==K||null===(i=K.sourceOfFinance)||void 0===i?void 0:i.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assetclassification",defaultValue:Y(null==M?void 0:M.assetClassification),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:I,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.assetclassification?null==K||null===(r=K.assetclassification)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_PARENT_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assettype",defaultValue:Y(null==M?void 0:M.assetParentCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:O,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.assettype?null==K||null===(s=K.assettype)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_SUB_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assetsubtype",defaultValue:Y(null==M?void 0:M.assetCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:N,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.assetsubtype?null==K||null===(u=K.assetsubtype)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:j,name:"assetparentsubCategory",defaultValue:Y(null==M?void 0:M.assetSubCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:R,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.assetparentsubCategory?null==K||null===(d=K.assetparentsubCategory)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_BOOK_REF_SERIAL_NUM")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"BookPagereference",defaultValue:null==M?void 0:M.assetBookRefNo,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z0-9/-\s]*$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"BookPagereference"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"BookPagereference"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},W.touched.BookPagereference?null==K||null===(c=K.BookPagereference)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"AssetName",defaultValue:null==M?void 0:M.assetName,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"AssetName"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"AssetName"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},W.touched.AssetName?null==K||null===(m=K.AssetName)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("ASSET_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"Assetdescription",defaultValue:null==M?void 0:M.description,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"Assetdescription"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"Assetdescription"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},W.touched.Assetdescription?null==K||null===(v=K.Assetdescription)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_DEPARTMENT")),l.createElement(o.Controller,{control:j,name:"Department",defaultValue:Y("COMMON_MASTERS_DEPARTMENT_"+(null==M?void 0:M.department)),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:!1,select:e.onChange,onBlur:e.onBlur,option:x,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.Department?null==K||null===(p=K.Department)||void 0===p?void 0:p.message:""),l.createElement("br",null),l.createElement(t.CardCaption,null,"Asset Common Details "),l.createElement("br",null),l.createElement("br",null),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_TYPE")),l.createElement(o.Controller,{control:j,name:"assetType",defaultValue:Y(null==M?void 0:M.assetType),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:w,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.assetType?null==K||null===(E=K.assetType)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_USAGE")),l.createElement(o.Controller,{control:j,name:"assetUsage",defaultValue:Y(null==M?void 0:M.assetUsage),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:F,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.assetUsage?null==K||null===(f=K.assetUsage)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_MODE_OF_POSSESSION_OR_ACQUISITION")),l.createElement(o.Controller,{control:j,name:"modeOfPossessionOrAcquisition",defaultValue:Y(null==M?void 0:M.modeOfPossessionOrAcquisition),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,disable:!1,onBlur:e.onBlur,option:k,optionKey:"i18nKey",t:A})})),l.createElement(t.CardLabelError,{style:Z},W.touched.modeOfPossessionOrAcquisition?null==K||null===(g=K.modeOfPossessionOrAcquisition)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_INVOICE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"invoiceDate",defaultValue:$l(null==M?void 0:M.invoiceDate),rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"invoiceDate"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"invoiceDate"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Z},W.touched.Assetdescription?null==K||null===(S=K.Assetdescription)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_INVOICE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"invoiceNumber",defaultValue:null==M?void 0:M.invoiceNumber,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"invoiceNumber"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"invoiceNumber"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_PURCHASE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"purchaseDate",defaultValue:$l(null==M?void 0:M.purchaseDate),rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"purchaseDate"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"purchaseDate"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_PURCHASE_ORDER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"purchaseOrderNumber",defaultValue:null==M?void 0:M.purchaseOrderNumber,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"purchaseOrderNumber"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"purchaseOrderNumber"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"lifeOfAsset",defaultValue:null==M?void 0:M.purchaseOrderNumber,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"lifeOfAsset"===h.type,onChange:t=>{if(t.target.value.length>3)return alert("Maximum limit is 3 digits only!"),!1;e.onChange(t.target.value),T({index:_.key,type:"lifeOfAsset"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_LOCATION_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"location",defaultValue:null==M?void 0:M.location,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"location"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"location"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_PURCHASE_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"purchaseCost",defaultValue:null==M?void 0:M.purchaseCost,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"purchaseCost"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"purchaseCost"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_ACQUISITION_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"acquisitionCost",defaultValue:null==M?void 0:M.acquisitionCost,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"acquisitionCost"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"acquisitionCost"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},A("AST_BOOK_VALUE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:j,name:"bookValue",defaultValue:null==M?void 0:M.bookValue,rules:{required:A("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||A("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:h.index===(null==_?void 0:_.key)&&"bookValue"===h.type,onChange:t=>{e.onChange(t.target.value),T({index:_.key,type:"bookValue"})},onBlur:t=>{T({index:-1}),e.onBlur(t)}})}))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{H(e=>null)}}))},Yl=e=>{var a;const{editNewAssetDetails:i,focusIndex:r,seteditAssignDetails:s,t:u,config:d,setError:c,clearErrors:m,setFocusIndex:v,comingDataFromAPI:p}=e;let E=[];const f=Digit.ULBService.getStateId(),g=Digit.ULBService.getCurrentTenantId(),S=Digit.Hooks.useCustomMDMSV2(g,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),_=Digit.Hooks.useCustomMDMSV2(f,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});let h;h=S||_||[],Array.isArray(null===(a=h)||void 0===a?void 0:a.data)&&h.data.length>0?E=h.data.filter(e=>e.assetParentCategory===(null==p?void 0:p.assetParentCategory)||"COMMON"===e.assetParentCategory).map(e=>e.fields).flat().filter(e=>!0===e.active):console.log("combinedData.data is not an array or is empty.");const[y,A]=n.useState(null),{control:C,formState:D,watch:b,trigger:T}=o.useForm(),I=b(),{errors:O}=D,[N,R]=l.useState({});n.useEffect(()=>{B.isEqual(N,I)||(R({...I}),s(e=>e.map(e=>e.key===i.key?{...e,...I}:e)),T())},[I]),n.useEffect(()=>{var e;Object.keys(O).length&&!B.isEqual((null===(e=D.errors[d.key])||void 0===e?void 0:e.type)||{},O)?c(d.key,{type:O}):!Object.keys(O).length&&D.errors[d.key]&&m(d.key)},[O]);const x={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(l.Fragment,null,E.map((e,n)=>{var a,s,d,c;return l.createElement("div",{key:n},"date"===e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:C,name:e.name,defaultValue:(null==p?void 0:p.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:"date",max:(new Date).toISOString().split("T")[0],autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:x},D.touched[e.name]?null===(a=O[e.name])||void 0===a?void 0:a.message:"")):"dropdown"==e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement(o.Controller,{control:C,name:e.name,defaultValue:(null==p?void 0:p.additionalDetails[e.name])||"",render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:n.value,select:n.onChange,onBlur:n.onBlur,option:e.options,optionKey:"i18nKey",t:u})})),l.createElement(t.CardLabelError,{style:x},D.touched[e.name]?null===(s=O[e.name])||void 0===s?void 0:s.message:"")):!0===e.addCurrentLocationButton?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:C,name:e.name,defaultValue:(null==p?void 0:p.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)},onClick:()=>{var t;t=e.name,"geolocation"in navigator?navigator.geolocation.getCurrentPosition(e=>{const{latitude:n,longitude:l}=e.coords;setAssetDetails(e=>({...e,[t]:`${n}, ${l}`}))},e=>{console.error("Error getting location:",e)}):alert("Geolocation is not supported by your browser.")}})}))),l.createElement(t.CardLabelError,{style:x},D.touched[e.name]?null===(d=O[e.name])||void 0===d?void 0:d.message:"")):l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:C,name:e.name,defaultValue:null==p?void 0:p.additionalDetails[e.name],rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),v({index:i.key,type:e.name})},onBlur:e=>{v({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:x},D.touched[e.name]?null===(c=O[e.name])||void 0===c?void 0:c.message:"")))})))),(null==y?void 0:y.label)&&l.createElement(t.Toast,{label:null==y?void 0:y.label,onClose:e=>{A(e=>null)}}))},Zl=(e,t,n,l,a)=>a(`${l?"E":"C"}S_ASSET_RESPONSE_${t||"EDIT"}_${e}${n?"":"_ERROR"}`),Ql=(e,t,n,l)=>Zl("LABEL",e,t,n,l),Xl=e=>{var n,a,i,o,r,s,u,d,c,m,v,p,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,v=e.isSuccess,p=e.isEmployee,E=e.t,Zl("ACTION",m,v,p,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:Ql((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Jl={AssignAssetApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d),[m,v,p]=Digit.Hooks.useSessionStorage("store-data",null),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{f(!1),h()},[]);const y=bl;return l.createElement(t.FormComposer,{heading:o("AST_ASSIGN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:y.map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,v,p,E,f,g,S,_,h,y,A;const C=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.assigndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.transferDate),D={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:"",assetApplicaltionNo:"",assetId:"",assignedUserName:null==t||null===(s=t.assigndetails)||void 0===s||null===(d=s[0])||void 0===d?void 0:d.assignedUser,designation:null==t||null===(m=t.assigndetails)||void 0===m||null===(v=m[0])||void 0===v||null===(p=v.designation)||void 0===p?void 0:p.code,department:null==t||null===(E=t.assigndetails)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.allocatedDepartment)||void 0===g?void 0:g.code,assignedDate:C,isAssigned:!0,allocatedDepartment:null==t||null===(S=t.assigndetails)||void 0===S||null===(_=S[0])||void 0===_||null===(h=_.allocatedDepartment)||void 0===h?void 0:h.code,employeeCode:null==t||null===(y=t.assigndetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.employeeCode,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/assign-response",{Assets:D})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},DisposeApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[o,r]=n.useState(),{t:s}=a.useTranslation(),[u,d]=n.useState(!1),c=i.useHistory(),{id:m}=i.useParams(),[v,p,E]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,m),Digit.Hooks.useSessionStorage("store-data",null)),[f,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[h,y,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),C=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{S(!1),A()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const D=Tl;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_DISPOSE_ASSET"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:D.map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,i,o,u,d,m,v,p,E,f,S,_,h,y,A,D,b,T,I,O,N,R,x,L,P;const w={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(o=t.disposeDetails)||void 0===o||null===(u=o[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(d=t.disposeDetails)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.currentAgeOfAsset,disposalDate:C(null==t||null===(v=t.disposeDetails)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.disposalDate),reasonForDisposal:null==t||null===(E=t.disposeDetails)||void 0===E||null===(f=E[0])||void 0===f||null===(S=f.reasonForDisposal)||void 0===S?void 0:S.code,amountReceived:Nl(null==t||null===(_=t.disposeDetails)||void 0===_||null===(h=_[0])||void 0===h?void 0:h.amountReceived),purchaserName:null==t||null===(y=t.disposeDetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.purchaserName,paymentMode:null==t||null===(D=t.disposeDetails)||void 0===D||null===(b=D[0])||void 0===b?void 0:b.paymentMode,receiptNumber:null==t||null===(T=t.disposeDetails)||void 0===T||null===(I=T[0])||void 0===I?void 0:I.receiptNumber,comments:null==t||null===(O=t.disposeDetails)||void 0===O||null===(N=O[0])||void 0===N?void 0:N.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"OWNER.RECIEPTPHOTO",fileStoreId:null==t||null===(R=t.disposeDetails)||void 0===R||null===(x=R[0])||void 0===x?void 0:x.fileStoreId,documentUid:null==t||null===(L=t.disposeDetails)||void 0===L||null===(P=L[0])||void 0===P?void 0:P.fileStoreId,latitude:null,longitude:null}]},M=g(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:w})).then(function(e){e&&(console.log("success data is coming"),c.replace("/digit-ui/employee/asset/assetservice/asset-dispose-response",{AssetDisposal:e}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(M&&M.then?M.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{d(!0)}}),o&&l.createElement(t.Toast,{error:o.error,warning:o.warning,label:s(o.label),onClose:()=>{r(null)}}))},MaintenanceApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[o,r]=n.useState(),{t:s}=a.useTranslation(),[u,d]=n.useState(!1),{id:c}=(i.useHistory(),i.useParams()),[m,v,p]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,c),Digit.Hooks.useSessionStorage("store-data",null)),[E,f,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,h,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),A=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{f(!1),y()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const C=xl;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_MAINTENANCET_REPAIR"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:C.map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,i,o,u,d,c,m,v,p,E,f,S,_,h,y,C,D,b,T,I,O,N,R,x,L;const P={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(o=t.disposeDetails)||void 0===o||null===(u=o[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(d=t.disposeDetails)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.currentAgeOfAsset,disposalDate:A(null==t||null===(m=t.disposeDetails)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.disposalDate),reasonForDisposal:null==t||null===(p=t.disposeDetails)||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.reasonForDisposal)||void 0===f?void 0:f.code,amountReceived:Nl(null==t||null===(S=t.disposeDetails)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.amountReceived),purchaserName:null==t||null===(h=t.disposeDetails)||void 0===h||null===(y=h[0])||void 0===y?void 0:y.purchaserName,paymentMode:null==t||null===(C=t.disposeDetails)||void 0===C||null===(D=C[0])||void 0===D?void 0:D.paymentMode,receiptNumber:null==t||null===(b=t.disposeDetails)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.receiptNumber,comments:null==t||null===(I=t.disposeDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"OWNER.RECIEPTPHOTO",fileStoreId:null==t||null===(N=t.disposeDetails)||void 0===N||null===(R=N[0])||void 0===R?void 0:R.fileStoreId,documentUid:null==t||null===(x=t.disposeDetails)||void 0===x||null===(L=x[0])||void 0===L?void 0:L.fileStoreId,latitude:null,longitude:null}]},w=g(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:P})).then(function(e){e&&(console.log("success data is coming"),r({error:!1,label:"Asset Dispose Successfully"}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(w&&w.then?w.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{d(!0)}}),o&&l.createElement(t.Toast,{error:o.error,warning:o.warning,label:s(o.label),onClose:()=>{r(null)}}))},AssetDocuments:e=>{var a,o;let{t:r,config:s,onSelect:u,formData:d,setError:c,clearErrors:m,formState:v}=e;const p=Digit.ULBService.getStateId(),[E,f]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[g,S]=n.useState(null),{id:_}=i.useParams(),h=Digit.ULBService.getCurrentTenantId(),{isLoading:y,data:A}=(Digit.Hooks.asset.useAssetApplicationDetail(r,h,_),i.useLocation(),Digit.Hooks.asset.useAssetDocumentsMDMS(p,"ASSET","Documents")),C=null==A||null===(o=A.ASSET)||void 0===o?void 0:o.Documents.map(e=>({...e,hasDropdown:!0}));return n.useEffect(()=>{u(s.key,{documents:E,AssetsDocumentLength:null==C?void 0:C.length})},[E]),y?l.createElement(t.Loader,null):l.createElement("div",null,null==C?void 0:C.map((e,t)=>l.createElement(Ll,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:g,setError:S,setDocuments:f,accept:".pdf, .jpeg, .jpg, .png",documents:E,formData:d,setFormError:c,clearFormErrors:m,config:s,formState:v})),g&&l.createElement(t.Toast,{label:g,onClose:()=>S(null),error:!0}))},AssetPincode:e=>{var a;let{t:o,config:r,onSelect:s,formData:u={},userType:d}=e;const c=Digit.Hooks.asset.useTenants(),{pathname:v}=i.useLocation(),p=v.includes("modify"),[E,f]=n.useState(()=>{var e,t,n;return p&&"employee"===d?(null==u||null===(e=u.originalData)||void 0===e||null===(t=e.address)||void 0===t?void 0:t.pincode)||"":(null==u||null===(n=u.address)||void 0===n?void 0:n.pincode)||""}),g=[{label:"AST_PINCODE",type:"text",name:"pincode",validation:{minlength:6,maxlength:7,pattern:"[0-9]+",max:"9999999",title:o("PTR_ADDRESS_PINCODE_INVALID")},style:{width:"50%"}}],[S,_]=n.useState(null),[h,y]=n.useState("");function A(e){f(e.target.value),_(null),y("");let t=Digit.Utils.getPattern("Pincode").test(e.target.value);"employee"===d&&(e.target.value&&!t&&y(o("ERR_DEFAULT_INPUT_FIELD_MSG")),t&&((null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)}))||y(o("PTR_COMMON_PINCODE_NOT_SERVICABLE"))),s(r.key,{...u.address,pincode:e.target.value}))}return n.useEffect(()=>{var e;null!=u&&null!==(e=u.address)&&void 0!==e&&e.pincode&&f(u.address.pincode)},[null==u||null===(a=u.address)||void 0===a?void 0:a.pincode]),"employee"===d?null==g?void 0:g.map((e,n)=>l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},o(e.label)),l.createElement("div",{className:"field"},l.createElement(t.TextInput,m({key:e.name,style:e.style,value:E,onChange:A},e.validation,{disable:p,autoFocus:p})))),h?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},h):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(wl,{currentStep:3}):null,l.createElement(t.FormStep,{t:o,config:{...r,inputs:g},onSelect:function(e){try{return(null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))}))?s(r.key,{pincode:E}):_("COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},_defaultValues:{pincode:E},onChange:A,onSkip:()=>s(),forcedError:o(S)}))},AssetAddress:e=>{var a;let{t:r,config:s,onSelect:u,userType:d,formData:c}=e;const m=Digit.Hooks.asset.useTenants();let v=Digit.ULBService.getCurrentTenantId();const p=Digit.UserService.getUser().info,{pathname:E}=i.useLocation(),f=E.includes("modify");let g=(null==c?void 0:c.isEditAddress)||!1;f&&(g=!0);const{pincode:S}=(null==c?void 0:c.address)||"",_="EMPLOYEE"===p.type?m.filter(e=>e.code===v):S?m.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==S)}):m,[h,y]=n.useState(()=>{var e;return(null==c||null===(e=c.address)||void 0===e?void 0:e.city)||null}),{data:A}=Digit.Hooks.useBoundaryLocalities(null==h?void 0:h.code,"revenue",{enabled:!!h},r),[C,D]=n.useState(),[b,T]=n.useState();n.useEffect(()=>{if("employee"===d&&f&&null!=C&&C.length){var e,t,n;const l=null==c||null===(e=c.originalData)||void 0===e||null===(t=e.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code,a=null==C?void 0:C.filter(e=>e.code===l)[0];R("locality",a)}},[C]),n.useEffect(()=>{_&&1===_.length&&y(_[0])},[_]),n.useEffect(()=>{if(h&&A){var e,t;let l=A,a=[];var n;null!=c&&null!==(e=c.address)&&void 0!==e&&e.locality&&T(c.address.locality),null!=c&&null!==(t=c.address)&&void 0!==t&&t.pincode&&(a=l.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==c.address.pincode)}),null!=c&&null!==(n=c.address)&&void 0!==n&&n.locality||T()),D(()=>a.length>0?a:l),1===a.length&&T(a[0])}},[h,null==c||null===(a=c.address)||void 0===a?void 0:a.pincode,A]);const{control:I,formState:O,watch:N,setValue:R}=o.useForm(),x=N(),{errors:L}=O,P={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};var w,M;return n.useEffect(()=>{if("employee"===d){let e=Object.keys(x);const t={};e.forEach(e=>{var n;return t[e]=null===(n=c[s.key])||void 0===n?void 0:n[e]}),B.isEqual(x,t)||u(s.key,{...c[s.key],...x})}},[x]),n.useEffect(()=>{},[O]),"employee"===d?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("MYCITY_CODE_LABEL")+" *"),l.createElement(o.Controller,{name:"city",defaultValue:1===(null==_?void 0:_.length)?_[0]:h,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:g||1===(null==_?void 0:_.length),option:_,select:e.onChange,optionKey:"code",onBlur:e.onBlur,t:r})})),l.createElement(t.CardLabelError,{style:P},O.touched.city?null==L||null===(w=L.city)||void 0===w?void 0:w.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("AST_LOCALITY")+" *"),l.createElement(o.Controller,{name:"locality",defaultValue:null,control:I,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,option:C,select:e.onChange,onBlur:e.onBlur,optionKey:"i18nkey",t:r,disable:g||!1})})),l.createElement(t.CardLabelError,{style:P},O.touched.locality?null==L||null===(M=L.locality)||void 0===M?void 0:M.message:"")):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(wl,{currentStep:3}):null,l.createElement(t.FormStep,{config:s,onSelect:function(){u(s.key,{city:h,locality:b})},t:r,isDisabled:!b},l.createElement("div",null,l.createElement(t.CardLabel,null,r("MYCITY_CODE_LABEL")+" "),l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{options:_.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:h,optionKey:"i18nKey",onSelect:function(e){T(null),D(null),y(e)},t:r,isPTFlow:!0,disabled:g})),h&&C&&l.createElement(t.CardLabel,null,r("AST_LOCALITY")+" "),h&&C&&l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{dropdownStyle:{paddingBottom:"20px"},isMandatory:s.isMandatory,options:C.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:b,optionKey:"i18nkey",onSelect:function(e){var t;null!=c&&null!==(t=c.address)&&void 0!==t&&t.locality&&(c.address.locality=e),T(e),"employee"===d&&u(s.key,{...c[s.key],locality:e})},t:r,labelKey:"",disabled:g})))))},AssetStreets:e=>{var a,i,r,s,u,d,c,m,v;let{t:p,config:E,onSelect:f,userType:g,formData:S,formState:_,setError:h,clearErrors:y}=e;const[A,C]=n.useState({index:-1,type:""}),[D,b]=n.useState((null==S||null===(a=S.address)||void 0===a?void 0:a.street)||""),[T,I]=n.useState((null==S||null===(i=S.address)||void 0===i?void 0:i.addressLine1)||""),[O,N]=n.useState((null==S||null===(r=S.address)||void 0===r?void 0:r.addressLine2)||""),[R,x]=n.useState((null==S||null===(s=S.address)||void 0===s?void 0:s.landmark)||""),[L,P]=n.useState((null==S||null===(u=S.address)||void 0===u?void 0:u.latitude)||""),[w,M]=n.useState((null==S||null===(d=S.address)||void 0===d?void 0:d.longitude)||""),[F,k]=n.useState((null==S||null===(c=S.address)||void 0===c?void 0:c.doorNo)||""),[U,H]=n.useState(!(null==S||null===(m=S.address)||void 0===m||!m.latitude||null==S||null===(v=S.address)||void 0===v||!v.longitude)),{formState:j,watch:W,setError:V,clearErrors:z,trigger:G}=o.useForm(),K=W(),{errors:$}=j;return window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useEffect(()=>{G()},[]),n.useEffect(()=>{var e;"employee"===g&&(Object.keys($).length&&!B.isEqual((null===(e=_.errors[E.key])||void 0===e?void 0:e.type)||{},$)?h(E.key,{type:$}):!Object.keys($).length&&_.errors[E.key]&&y(E.key))},[$]),n.useEffect(()=>{const e=Object.keys(K),t={};if(e.forEach(e=>{var n;return t[e]=null===(n=S[E.key])||void 0===n?void 0:n[e]}),!B.isEqual(K,t)){f(E.key,{...S[E.key],...K});for(let e in K)K[e]||null!=j&&j.errors[e]?K[e]&&j.errors[e]&&z([e]):V(e,{type:e.toUpperCase()+"_REQUIRED",message:p("CORE_COMMON_REQUIRED_ERRMSG")});G()}},[K]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(wl,{currentStep:3}):null,l.createElement(t.FormStep,{config:{...E},onSelect:e=>{((e,t)=>{f(e,{street:D,doorNo:F,addressLine1:T,addressLine2:O,landmark:R,latitude:L,longitude:w})})(E.key)},onSkip:()=>f(),isDisabled:"",t:p},l.createElement(t.CardLabel,null,""+p("AST_STREET")),l.createElement(t.TextInput,{t:p,type:"text",optionKey:"i18nKey",name:"street",onChange:e=>b(e.target.value),value:D,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==A?void 0:A.index)}),l.createElement(t.CardLabel,null,""+p("AST_DOOR_NO")),l.createElement(t.TextInput,{t:p,type:"text",optionKey:"i18nKey",name:"doorNo",onChange:e=>k(e.target.value),style:{width:"50%"},value:F,errorStyle:!1,autoFocus:1==(null==A?void 0:A.index)}),l.createElement(t.CardLabel,null,""+p("AST_ADDRESS_LINE_1")),l.createElement(t.TextInput,{t:p,type:"text",optionKey:"i18nKey",name:"addressLine1",onChange:e=>I(e.target.value),value:T,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==A?void 0:A.index)}),l.createElement(t.CardLabel,null,""+p("AST_ADDRESS_LINE_2")),l.createElement(t.TextInput,{t:p,type:"text",optionKey:"i18nKey",name:"addressLine2",onChange:e=>N(e.target.value),style:{width:"50%"},value:O,errorStyle:!1,autoFocus:1==(null==A?void 0:A.index)}),l.createElement(t.CardLabel,null,""+p("AST_LANDMARK")),l.createElement(t.TextInput,{t:p,type:"text",optionKey:"i18nKey",name:"landmark",onChange:e=>x(e.target.value),value:R,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==A?void 0:A.index)}),U&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,""+p("AST_LATITUDE")),l.createElement(t.TextInput,{t:p,type:"text",optionKey:"i18nKey",name:"latitude",onChange:e=>P(e.target.value),style:{width:"50%"},value:L,errorStyle:!1,autoFocus:1==(null==A?void 0:A.index)}),l.createElement(t.CardLabel,null,""+p("AST_LONGITUDE")),l.createElement(t.TextInput,{t:p,type:"text",optionKey:"i18nKey",name:"longitude",onChange:e=>M(e.target.value),value:w,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==A?void 0:A.index)})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:p("AST_FETCH_LOCATION"),onSubmit:()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;P(t),M(n),H(!0)},e=>{console.error("Error Code = "+e.code+" - "+e.message)}):console.error("Geolocation is not supported by this browser.")},disabled:U}),l.createElement("br",null)))},ServiceDoc:e=>{var n;let{t:a,config:i,onSelect:o}=e;Digit.ULBService.getCurrentTenantId();const r=Digit.ULBService.getStateId();sessionStorage.removeItem("docReqScreenByBack");const s=null!=i&&i.isMutation?["MutationDocuments"]:"Documents",{isLoading:u,data:d={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(r,"ASSET",s);let c=null==d||null===(n=d.ASSET)||void 0===n?void 0:n.Documents;return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement("div",null,l.createElement(t.CardSubHeader,null,a("AST_REQ_SCREEN_LABEL")),l.createElement(t.CardText,{style:{color:"red"}},a("AST_DOCUMENT_ACCEPTED_PDF_JPG_PNG")),l.createElement("div",null,u&&l.createElement(t.Loader,null),Array.isArray(c)?c.map(null!=i&&i.isMutation?(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(i)),l.createElement(t.CardText,{className:"primaryColor"},o.map(e=>a(null==e?void 0:e.code)).join(", ")))}:(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(Rl(i,".","_"))),o.map((e,n)=>l.createElement(t.CardText,{className:"primaryColor"},""+(n+1),". ",a(Rl(null==e?void 0:e.code,".","_")))))}):null)),l.createElement("span",null,l.createElement(t.SubmitBar,{label:a("COMMON_NEXT"),onSubmit:o}))))},AssetCreateNew:e=>{var t,n,o,r;const s=d.useQueryClient(),u=i.useRouteMatch(),{t:c}=a.useTranslation(),{pathname:m}=i.useLocation(),v=i.useHistory();Digit.ULBService.getStateId();let p=[];const[E,f,g]=Digit.Hooks.useSessionStorage("Asset_Test",{});function S(e,t,n,l,a){if(void 0===a&&(a=!1),"owners"===e){let n=E.owners||[];n[l]=t,f({...E,[e]:[...n]})}else if("units"===e){let e=E.units||[];e=t,f({...E,units:e})}else f({...E,[e]:{...E[e],...t}});((e,t,n,l)=>{let a,i=m.split("/").pop(),o=i.charAt(i.length-1),r=!1;Number(parseInt(i))||"0"==i||"-1"==i?"-1"==i||"-2"==i?(i=m.slice(0,-3),i=i.split("/").pop(),r=!0):(i=m.slice(0,-2),i=i.split("/").pop(),r=!0):r=!1,isNaN(o)||(r=!0);let{nextStep:s={}}=p.find(e=>e.route===(i||"0")),d=v.push;if(e&&(d=v.replace),n&&(s=l),null===s)return d(u.path+"/check");a=isNaN(s.split("/").pop())&&r&&"map"!==s?`${u.path}/${s}/${t}`:`${u.path}/${s}`,d(a)})(n,l,a,e)}E&&Object.keys(E).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(g(),s.invalidateQueries("AST_CREATE"));const _=()=>{},h=()=>{};Ml.forEach(e=>{p=p.concat(e.body.filter(e=>!e.hideInCitizen))}),p.indexRoute="info";const y=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("ASTCheckPage"),A=null===(o=Digit)||void 0===o||null===(r=o.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NewResponse");return l.createElement(i.Switch,null,p.map((e,t)=>{const{component:n,texts:a,inputs:o,key:r}=e,s="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return l.createElement(i.Route,{path:`${u.path}/${e.route}`,key:t},l.createElement(s,{config:{texts:a,inputs:o,key:r},onSelect:S,onSkip:_,t:c,formData:E,onAdd:h}))}),l.createElement(i.Route,{path:u.path+"/check"},l.createElement(y,{onSubmit:function(){try{return v.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:E})),l.createElement(i.Route,{path:u.path+"/acknowledgement"},l.createElement(A,{data:E,onSuccess:()=>{g(),s.invalidateQueries("AST_CREATE")}})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:`${u.path}/${p.indexRoute}`})))},NewAssetClassification:e=>{var a,r,s,u,d,c,v,p,E,f,g,S;let{t:_,config:h,onSelect:y,userType:A,formData:C}=e;const{control:D}=o.useForm();i.useLocation();let b={};const T=(()=>{const e=new Date,t=e.getFullYear();return e.getMonth()+1>=4?`${t}-${t+1}`:`${t-1}-${t}`})(),[I,O]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetclassification||(null==C||null===(a=C.asset)||void 0===a?void 0:a.assetclassification)||""),[N,R]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assettype||(null==C||null===(r=C.asset)||void 0===r?void 0:r.assettype)||""),[x,L]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsubtype||(null==C||null===(s=C.asset)||void 0===s?void 0:s.assetsubtype)||""),[P,w]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetparentsubCategory||(null==C||null===(u=C.asset)||void 0===u?void 0:u.assetparentsubCategory)||""),[M,F]=n.useState(C.asset&&C.asset[0]&&C.asset[0].BookPagereference||(null==C||null===(d=C.asset)||void 0===d?void 0:d.BookPagereference)||""),[B,k]=n.useState(C.asset&&C.asset[0]&&C.asset[0].AssetName||(null==C||null===(c=C.asset)||void 0===c?void 0:c.AssetName)||""),[U,H]=n.useState(C.asset&&C.asset[0]&&C.asset[0].Assetdescription||(null==C||null===(v=C.asset)||void 0===v?void 0:v.Assetdescription)||""),[j,W]=n.useState(C.asset&&C.asset[0]&&C.asset[0].Department||(null==C||null===(p=C.asset)||void 0===p?void 0:p.Department)||""),[V,z]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsOfType||(null==C||null===(E=C.asset)||void 0===E?void 0:E.assetsOfType)||""),[G,K]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsUsage||(null==C||null===(f=C.asset)||void 0===f?void 0:f.assetsUsage)||""),[$,q]=n.useState(C.asset&&C.asset[0]&&C.asset[0].financialYear||(null==C||null===(g=C.asset)||void 0===g?void 0:g.financialYear)||T),[Y,Z]=n.useState(C.asset&&C.asset[0]&&C.asset[0].sourceOfFinance||(null==C||null===(S=C.asset)||void 0===S?void 0:S.sourceOfFinance)||""),Q=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:X}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetClassification"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetClassification;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:J}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetParentCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategory;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:ee}=Digit.Hooks.asset.useAssetSubType(Q,"ASSET","assetCategory"),{data:te}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetSubCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetSubCategory;return null==n?void 0:n.filter(e=>!0===e.active)}});console.log("E data:- ",te);const{data:ne}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let le=[];ne&&ne.map(e=>{le.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ae}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let ie=[];ae&&ae.map(e=>{ie.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:oe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let re=[];oe&&oe.map(e=>{re.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});let se=[],ue=[],de=[],ce=[];X&&X.map(e=>{se.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),J&&J.map(e=>{e.assetClassification==(null==I?void 0:I.code)&&ue.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ee&&ee.map(e=>{e.assetParentCategory==(null==N?void 0:N.code)&&de.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),te&&te.map(e=>{e.assetCategory==(null==x?void 0:x.code)&&ce.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const me=()=>{let e,t=C.asset&&C.asset[0];"citizen"===A?(e={...t,financialYear:$,sourceOfFinance:Y,assetclassification:I,assetparentsubCategory:P,assetsubtype:x,assettype:N},y(h.key,{...C[h.key],...e},!1,0)):(e={...t,financialYear:$,sourceOfFinance:Y,assetclassification:I,assetparentsubCategory:P,assetsubtype:x,assettype:N,BookPagereference:M,AssetName:B,Department:j,assetsOfType:V,assetsUsage:G,Assetdescription:U},y(h.key,e,!1,0))};n.useEffect(()=>{"citizen"===A&&me()},[$,Y,I,x,N,P,M,B,j,V,G,U]);const{data:ve}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let pe=[];ve&&ve.map(e=>{pe.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:Ee}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let fe=[];return Ee&&Ee.map(e=>{fe.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})}),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(wl,{currentStep:1}):null,l.createElement(t.FormStep,{config:h,onSelect:me,onSkip:()=>y(),t:_,isDisabled:!(I&&x&&N&&M)},l.createElement("div",null,l.createElement("div",null,_("AST_FINANCIAL_YEAR"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(o.Controller,{control:D,name:"financialYear",defaultValue:$,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:$,select:q,option:ie,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_SOURCE_FINANCE"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_SOURCE_OF_FUNDING")))),l.createElement(o.Controller,{control:D,name:"sourceOfFinance",defaultValue:Y,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:Y,select:Z,option:le,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_CATEGORY"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:D,name:"assetclassification",defaultValue:I,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:I,select:O,option:se,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement(t.CardLabel,null,""+_("AST_PARENT_CATEGORY")),l.createElement(o.Controller,{control:D,name:"assettype",defaultValue:N,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:N,select:R,option:ue,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement(t.CardLabel,null,""+_("AST_SUB_CATEGORY")),l.createElement(o.Controller,{control:D,name:"assetsubtype",defaultValue:x,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:x,select:L,option:de,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement(t.CardLabel,null,""+_("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:D,name:"assetparentsubCategory",defaultValue:P,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:P,select:w,option:ce,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_TYPE")),l.createElement(o.Controller,{control:D,name:"assetsOfType",defaultValue:V,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:V,select:z,option:pe,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_BOOK_REF_SERIAL_NUM"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,m({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:M,onChange:function(e){F(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement(t.CardLabel,null,""+_("AST_NAME")),l.createElement(t.TextInput,m({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,_("ASSET_DESCRIPTION"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,m({t:_,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:U,onChange:function(e){H(e.target.value)},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,_("AST_DEPARTMENT"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_PROCURED_DEPARTMENT")))),l.createElement(o.Controller,{control:D,name:"Department",defaultValue:j,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:j,select:W,option:re,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_USAGE")),l.createElement(o.Controller,{control:D,name:"assetsUsage",defaultValue:G,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:G,select:K,option:fe,optionKey:"i18nKey",placeholder:"Select",t:_})}))))},NewAsset:e=>{var a,r,s,u;let{t:d,config:c,onSelect:v,formData:p}=e;const[E,f]=n.useState(p.assetDetails&&p.assetDetails.assetParentCategory===(null==p||null===(a=p.asset)||void 0===a||null===(r=a.assettype)||void 0===r?void 0:r.code)?p.assetDetails:{assetParentCategory:null==p||null===(s=p.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code}),[g,S]=n.useState(),_=Digit.ULBService.getCurrentTenantId(),h=Digit.ULBService.getStateId(),y=Digit.Hooks.useCustomMDMSV2(_,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),A=Digit.Hooks.useCustomMDMSV2(h,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});n.useEffect(()=>{let e;null!=y&&y.data?e=y.data:null!=A&&A.data?e=A.data:(e=[],console.log("Both cityResponseObject and stateResponseObject data are unavailable.")),S(e)},[y,A]);let C=[];Array.isArray(g)&&(C=g.filter(e=>{var t,n;return e.assetParentCategory===(null==p||null===(t=p.asset)||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),i.useLocation();let D=window.location.href.charAt(window.location.href.length-1),b={};const{control:T}=o.useForm(),I=e=>e&&"number"===e?"^[0-9]+(\\.[0-9]+)?$":"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",O=e=>{const{name:t,value:n}=e.target?e.target:{name:e.name,value:e};if("lifeOfAsset"===t&&n.length>3)return alert("Maximum limit is 3 digits only!"),!1;f(e=>{const l={...e,[t]:n},a=parseFloat(l.acquisitionCost)||0,i=parseFloat(l.purchaseCost)||0;return(a>=0||i>=0)&&(l.bookValue=a+i),"purchaseDate"===t&&(e=>{const t=new Date,n=new Date(e),l=t.getFullYear()-n.getFullYear(),a=t.getMonth()-n.getMonth();let i;if(l>0)i=l+" "+d("YEAR");else if(a>=0)i=a+" "+d("MONTH");else{const e=t.getDate()-n.getDate();i=e+" "+d("DAY")}f(e=>({...e,assetAge:i}))})(n),l})},N=e=>{"geolocation"in navigator?navigator.geolocation.getCurrentPosition(t=>{const{latitude:n,longitude:l}=t.coords;f(t=>({...t,[e]:`${n}, ${l}`}))},e=>{console.error("Error getting location:",e),alert("Unable to retrieve your location. Please check your browser settings.")}):alert("Geolocation is not supported by your browser.")},R=e=>{const t=e?e.trim():"",{data:n}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:t}],{select:e=>{var n;return null==e||null===(n=e.ASSET)||void 0===n?void 0:n[t]}});let l=[];return n&&n.map(e=>{l.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})}),l};return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(wl,{currentStep:2}):null,l.createElement(t.Card,null,l.createElement(t.CardCaption,null,d(p.asset.Department.value),"/",p.asset.assetclassification.value,"/",p.asset.assettype.value,"/",p.asset.assetsubtype.value,"/",p.asset.BookPagereference)),l.createElement(t.FormStep,{config:c,onSelect:()=>{E.owner=p.assetDetails&&p.assetDetails[D],v(c.key,E,!1,D)},onSkip:()=>v(),t:d,isDisabled:!E.purchaseDate||!E.modeOfPossessionOrAcquisition||!E.purchaseOrderNumber},l.createElement(l.Fragment,null,l.createElement("div",null,d("AST_MODE_OF_POSSESSION_OR_ACQUISITION")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(o.Controller,{control:T,name:"modeOfPossessionOrAcquisition",isMandatory:!1,defaultValue:E.modeOfPossessionOrAcquisition?E.modeOfPossessionOrAcquisition:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:E.modeOfPossessionOrAcquisition,select:O,option:R("ModeOfPossessionOrAcquisition"),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}),l.createElement("div",null,d("AST_INVOICE_DATE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"invoiceDate",value:E.invoiceDate,onChange:O,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,d("AST_INVOICE_NUMBER")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"invoiceNumber",value:E.invoiceNumber,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_PURCHASE_DATE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"purchaseDate",value:E.purchaseDate,onChange:O,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,d("AST_PURCHASE_ORDER")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"purchaseOrderNumber",value:E.purchaseOrderNumber,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_LIFE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lifeOfAsset",value:E.lifeOfAsset,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_LOCATION_DETAILS")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"location",value:E.location||"",onChange:O,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",type:"text",title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{N("location")},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))),l.createElement("div",null,d("AST_PURCHASE_COST")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,m({t:d,type:"number",isMandatory:!1,optionKey:"i18nKey",name:"purchaseCost",value:E.purchaseCost,onChange:O,ValidationRequired:!0},b={isRequired:!0,pattern:I("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_ACQUISITION_COST")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"acquisitionCost",value:E.acquisitionCost,onChange:O,ValidationRequired:!0},b={isRequired:!0,pattern:I("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_BOOK_VALUE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,m({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bookValue",value:E.bookValue,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),C.map((e,n)=>l.createElement("div",{key:n},l.createElement("div",null,d(e.code)+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d(e.iLable)+" "))),"date"===e.type?l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:e.name,value:E[e.name],onChange:O,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}):"dropdown"==e.type?l.createElement(o.Controller,{control:T,name:e.name,isMandatory:!1,defaultValue:E[e.name]?E[e.name]:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:E[e.name],select:O,option:R(e.masterName),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}):!0===e.addCurrentLocationButton?l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,m({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:O,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:I(e.columnType),type:e.columnType,title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{N(e.name)},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))):l.createElement(t.TextInput,m({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:O},b={isRequired:e.isMandatory,pattern:I(e.columnType),type:e.columnType,title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"},readOnly:e.isReadOnly})))))))},NewDocument:e=>{var a,i,o;let{t:r,config:s,onSelect:u,formData:d}=e;const[c,m]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[v,p]=n.useState(null),[E,f]=n.useState(!0),[g,S]=n.useState(!0),_=Digit.ULBService.getStateId(),{isLoading:h,data:y}=Digit.Hooks.asset.useAssetDocumentsMDMS(_,"ASSET","Documents");return n.useEffect(()=>{var e;let t=0;null==y||null===(e=y.ASSET)||void 0===e||e.Documents.forEach(e=>{e.hasDropdown=!0,!c.some(t=>e.required&&(null==t?void 0:t.documentType.includes(e.code)))&&e.required&&(t+=1)}),f(!(0===t&&c.length>0))},[c,g,y]),l.createElement("div",null,l.createElement(wl,{currentStep:4}),h?l.createElement(t.Loader,null):l.createElement(t.FormStep,{t:r,config:s,onSelect:()=>{let e={...d.documents,documents:c};u(s.key,e)},onSkip:()=>u(),isDisabled:E},null==y||null===(i=y.ASSET)||void 0===i||null===(o=i.Documents)||void 0===o?void 0:o.map((e,t)=>l.createElement(Fl,{key:t,document:e,t:r,error:v,setError:p,setDocuments:m,documents:c,setCheckRequiredFields:S,formData:d})),v&&l.createElement(t.Toast,{label:v,onClose:()=>p(null),error:!0})))},ASTCheckPage:e=>{var o,r,s,u,d,c,m,v,p,E,f,g;let{onSubmit:S,value:_={}}=e;const{t:h}=a.useTranslation(),[y,A]=(i.useHistory(),n.useState(!1)),[C,D]=n.useState(),b=Digit.ULBService.getCurrentTenantId(),T=Digit.ULBService.getStateId(),I=Digit.Hooks.useCustomMDMS(b,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),O=Digit.Hooks.useCustomMDMS(T,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),{address:N,assetDetails:R,asset:x}=_;n.useEffect(()=>{let e;e=null!=I&&I.data?I.data:null!=O&&O.data?O.data:[],D(e)},[I,O]);let L=[];return Array.isArray(C)&&(L=C.filter(e=>{var t;return e.assetParentCategory===(null==x||null===(t=x.assettype)||void 0===t?void 0:t.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(wl,{currentStep:5}):null,l.createElement(t.Card,null,l.createElement(t.CardHeader,null,h("AST_CHECK_DETAILS")),l.createElement("div",null,l.createElement("br",null),l.createElement(t.CardSubHeader,null,h("ASSET_GENERAL_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:h("AST_FINANCIAL_YEAR"),text:""+h(Il(null==x||null===(o=x.financialYear)||void 0===o?void 0:o.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_SOURCE_FINANCE"),text:""+h(Il(null==x||null===(r=x.sourceOfFinance)||void 0===r?void 0:r.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_ASSET_CATEGORY_LABEL"),text:""+h(Il(null==x||null===(s=x.assetclassification)||void 0===s?void 0:s.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_PARENT_CATEGORY_LABEL"),text:""+h(Il(null==x||null===(u=x.assettype)||void 0===u?void 0:u.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_SUB_CATEGORY"),text:""+h(Il(null==x||null===(d=x.assetsubtype)||void 0===d?void 0:d.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_CATEGORY_SUB_CATEGORY"),text:""+h(Il(null==x||null===(c=x.assetparentsubCategory)||void 0===c?void 0:c.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_BOOK_REF_SERIAL_NUM"),text:""+h(Il(null==x?void 0:x.BookPagereference)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_NAME"),text:""+h(Il(null==x?void 0:x.AssetName)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("ASSET_DESCRIPTION"),text:""+h(Il(null==x?void 0:x.Assetdescription)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_DEPARTMENT"),text:""+h(Il(null==x||null===(m=x.Department)||void 0===m?void 0:m.value)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_TYPE"),text:""+h(Il(null==x||null===(v=x.assetsOfType)||void 0===v?void 0:v.value)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_USAGE"),text:""+h(Il(null==x||null===(p=x.assetsUsage)||void 0===p?void 0:p.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})})),l.createElement("br",null),l.createElement(t.CardSubHeader,null,h("AST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(l.Fragment,null,l.createElement(t.Row,{label:h("AST_MODE_OF_POSSESSION_OR_ACQUISITION"),text:""+h(Il(null==R||null===(E=R.modeOfPossessionOrAcquisition)||void 0===E?void 0:E.code)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_INVOICE_DATE"),text:""+h(Il(null==R?void 0:R.invoiceDate)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_INVOICE_NUMBER"),text:""+h(Il(null==R?void 0:R.invoiceNumber)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_PURCHASE_DATE"),text:""+h(Il(null==R?void 0:R.purchaseDate)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_PURCHASE_ORDER"),text:""+h(Il(null==R?void 0:R.purchaseOrderNumber)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_LIFE"),text:""+h(Il(null==R?void 0:R.lifeOfAsset)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_LOCATION_DETAILS"),text:""+h(Il(null==R?void 0:R.location)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_PURCHASE_COST"),text:""+h(Il(null==R?void 0:R.purchaseCost)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_ACQUISITION_COST"),text:""+h(Il(null==R?void 0:R.acquisitionCost)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_BOOK_VALUE"),text:""+h(Il(null==R?void 0:R.bookValue)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),L.map((e,n)=>{return l.createElement(t.Row,{key:n,label:h(e.code),text:""+(a=e.name,i=R[a],"object"==typeof i?i.code:i),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})});var a,i}))),l.createElement("br",null),l.createElement(t.CardSubHeader,null,h("AST_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:h("MYCITY_CODE_LABEL"),text:""+h(Il(null==N||null===(f=N.city)||void 0===f?void 0:f.name)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})}),l.createElement(t.Row,{label:h("AST_LOCALITY"),text:""+h(Il(null==N||null===(g=N.locality)||void 0===g?void 0:g.name)),actionButton:l.createElement(Bl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})})),l.createElement("br",null),l.createElement(t.CheckBox,{label:h("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{A(!y)},styles:{height:"auto"}})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:h("COMMON_BUTTON_SUBMIT"),onSubmit:S,disabled:!y})))},NewResponse:e=>{var o,r;let{data:s,onSuccess:u}=e;const{t:d}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.asset.useAssetCreateAPI(null==s||null===(o=s.address)||void 0===o||null===(r=o.city)||void 0===r?void 0:r.code));return Digit.Hooks.useStore.getInitData(),i.useRouteMatch(),n.useEffect(()=>{try{var e,t;s.tenantId=null===(e=s.address)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code;let n=(e=>{var t,n,l,a,i,o,r,s,u,d,c,m,v,p,E,f,g,S,_,h,y,A,C,D,b,T,I,O,N,R,x,L,P,w,M,F,B,k,U,H,j,W,V,z,G,K,$,q,Y,Z,Q;const X=["acquisitionCost","assetAge","bookValue","invoiceDate","invoiceNumber","purchaseDate","purchaseOrderNumber","purchaseCost","location","lifeOfAsset"],J=(null==e?void 0:e.assetDetails)||{},ee=Object.keys(J).filter(e=>!X.includes(e)).reduce((e,t)=>(e[t]=J[t],e),{});return{Asset:{accountId:"",tenantId:null==e||null===(t=e.address)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code,assetBookRefNo:null==e||null===(l=e.asset)||void 0===l?void 0:l.BookPagereference,assetName:null==e||null===(a=e.asset)||void 0===a?void 0:a.AssetName,description:null==e||null===(i=e.asset)||void 0===i?void 0:i.Assetdescription,assetClassification:null==e||null===(o=e.asset)||void 0===o||null===(r=o.assetclassification)||void 0===r?void 0:r.code,assetParentCategory:null==e||null===(s=e.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code,assetCategory:null==e||null===(d=e.asset)||void 0===d||null===(c=d.assetsubtype)||void 0===c?void 0:c.code,assetSubCategory:null==e||null===(m=e.asset)||void 0===m||null===(v=m.assetparentsubCategory)||void 0===v?void 0:v.code,department:null==e||null===(p=e.asset)||void 0===p||null===(E=p.Department)||void 0===E?void 0:E.code,assetType:null==e||null===(f=e.asset)||void 0===f||null===(g=f.assetsOfType)||void 0===g?void 0:g.code,assetUsage:null==e||null===(S=e.asset)||void 0===S||null===(_=S.assetsUsage)||void 0===_?void 0:_.code,financialYear:null==e||null===(h=e.asset)||void 0===h||null===(y=h.financialYear)||void 0===y?void 0:y.code,sourceOfFinance:null==e||null===(A=e.asset)||void 0===A||null===(C=A.sourceOfFinance)||void 0===C?void 0:C.code,applicationNo:"",approvalDate:"",applicationDate:"",status:"",modeOfPossessionOrAcquisition:null==e||null===(D=e.assetDetails)||void 0===D||null===(b=D.modeOfPossessionOrAcquisition)||void 0===b?void 0:b.code,invoiceDate:Ol(null==e||null===(T=e.assetDetails)||void 0===T?void 0:T.invoiceDate),invoiceNumber:null==e||null===(I=e.assetDetails)||void 0===I?void 0:I.invoiceNumber,purchaseDate:Ol(null==e||null===(O=e.assetDetails)||void 0===O?void 0:O.purchaseDate),purchaseOrderNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.purchaseOrderNumber,assetAge:null==e||null===(R=e.assetDetails)||void 0===R?void 0:R.assetAge,location:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.location,lifeOfAsset:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.lifeOfAsset,purchaseCost:Nl(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.purchaseCost),acquisitionCost:Nl(null==e||null===(w=e.assetDetails)||void 0===w?void 0:w.acquisitionCost),bookValue:null==e||null===(M=e.assetDetails)||void 0===M?void 0:M.bookValue,originalBookValue:null==e||null===(F=e.assetDetails)||void 0===F?void 0:F.bookValue,islegacyData:!1,minimumValue:0,assetStatus:"1",action:"",businessService:"asset-create",addressDetails:{addressLine1:null==e||null===(B=e.address)||void 0===B?void 0:B.addressLine1,addressLine2:null==e||null===(k=e.address)||void 0===k?void 0:k.addressLine2,buildingName:null==e||null===(U=e.address)||void 0===U?void 0:U.buildingName,doorNo:null==e||null===(H=e.address)||void 0===H?void 0:H.doorNo,street:null==e||null===(j=e.address)||void 0===j?void 0:j.street,pincode:null==e||null===(W=e.address)||void 0===W?void 0:W.pincode,city:null==e||null===(V=e.address)||void 0===V||null===(z=V.city)||void 0===z?void 0:z.name,locality:{code:null==e||null===(G=e.address)||void 0===G||null===(K=G.locality)||void 0===K?void 0:K.code,area:null==e||null===($=e.address)||void 0===$||null===(q=$.locality)||void 0===q?void 0:q.area,latitude:null==e||null===(Y=e.address)||void 0===Y?void 0:Y.latitude,longitude:null==e||null===(Z=e.address)||void 0===Z?void 0:Z.longitude}},documents:null==e||null===(Q=e.documents)||void 0===Q?void 0:Q.documents,workflow:{action:"INITIATE",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:ee}}})(s);c.mutate(n,{onSuccess:u})}catch(e){}},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Hl,{t:d,data:c.data,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading}),l.createElement(t.StatusTable,null,c.isSuccess&&l.createElement(t.Row,{rowContainerStyle:Ul,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:d("CORE_COMMON_GO_TO_HOME")})))},ApplicationDetails:ml,AssetResponse:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[v,p]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useAssignCreateAPI(y,"UPDATE"!==A.key),D=Digit.Hooks.asset.useAssignCreateAPI(y,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==A?void 0:A.Assets},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&p(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(El,{t:o,data:(null==C?void 0:C.data)||S,action:null==A?void 0:A.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},DisposeResponse:e=>{const o=i.useLocation(),{AssetDisposal:r}=o.state||{},{t:s}=a.useTranslation(),[u,c]=(d.useQueryClient(),i.useHistory(),n.useState(null)),[m,v]=n.useState(null),[p,E]=n.useState(!1),[f,g]=n.useState(null);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status&&g(r.AssetDisposals[0])},[r]),l.createElement("div",null,l.createElement(t.Card,null,f?l.createElement(_l,{t:s,data:f,action:e.action,isSuccess:!0,isEmployee:e.parentRoute.includes("employee")}):l.createElement(t.Loader,null)),m&&l.createElement(t.Toast,{error:"error"===m.key,label:u,onClose:()=>{v(null),c(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ProcessDepreciationResponse:e=>{const o=i.useLocation(),{ProcessDepreciation:r}=o.state||{},{t:s}=a.useTranslation(),[u,d]=n.useState(null),[c,m]=n.useState(!1);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status?d(r.Message):(m(!0),d(s("CS_SOMETHING_WENT_WRONG")))},[r,s]),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(t.Banner,u&&!c?{message:((e,t)=>t("CS_DEPRECIATION_SUCCESS_MESSAGE"))(0,s),info:((e,t)=>t("CS_DEPRECIATION_SUCCESS_LABEL"))(0,s),successful:!0}:{message:"Processing...",successful:!1})),c&&u&&l.createElement(t.Toast,{error:!0,label:u,onClose:()=>{d(null),m(!1)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},returnResponse:e=>{const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[v,p]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useReturnAPI(y,"UPDATE"!==A.key),D=Digit.Hooks.asset.useReturnAPI(y,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==A?void 0:A.Asset},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&p(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Al,{t:o,data:(null==C?void 0:C.data)||S,action:null==A?void 0:A.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},AssetAssign:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,v]=n.useState((null==o?void 0:o.assigndetails)||[{department:"",assignedUser:"",designation:"",employeeCode:"",transferDate:"",returnDate:"",allocatedDepartment:"",key:Date.now()}]),[p,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const{data:f}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let g=[];f&&f.map(e=>{g.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:S}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Designation"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Designation;return null==n?void 0:n.filter(e=>!0===e.active)}}),_=[];S&&S.map(e=>{_.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const h={focusIndex:p,allAssets:c,setFocusIndex:E,formData:o,formState:s,setassigndetails:v,t:d,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:_};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(jl,m({key:e.key,index:t,assigndetails:e},h))))},AssetDispose:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[d,c]=n.useState((null==o?void 0:o.disposeDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[v,p]=n.useState({index:-1,type:""}),[E,f]=n.useState(null);n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const g={focusIndex:v,allAssets:d,setFocusIndex:p,formData:o,formState:r,setdisposeDetails:c,t:u,setError:f,clearErrors:s,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(Wl,m({key:e.key,index:t,disposeDetails:e},g))))},AssetMaintenance:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[d,c]=n.useState((null==o?void 0:o.maintenanceDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[v,p]=n.useState({index:-1,type:""}),[E,f]=n.useState(null);n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const g={focusIndex:v,allAssets:d,setFocusIndex:p,formData:o,formState:r,setMaintenanceDetails:c,t:u,setError:f,clearErrors:s,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(Vl,m({key:e.key,index:t,maintenanceDetails:e},g))))},returnAssets:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d);console.log("Data is application from Hook:- ",c);const[m,v,p]=Digit.Hooks.useSessionStorage("store-data",null),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{f(!1),h()},[]);const y=zl;return l.createElement(t.FormComposer,{heading:o("AST_RETURN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:y.map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,v,p,E,f,g,S,_,h,y,A,C,D,b,T,I;const O=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.returndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.returnDate),N={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:null==c||null===(s=c.applicationData)||void 0===s||null===(d=s.applicationData)||void 0===d||null===(m=d.assetAssignment)||void 0===m?void 0:m.assignmentId,assetId:"",assignedUserName:null==c||null===(v=c.applicationData)||void 0===v||null===(p=v.applicationData)||void 0===p||null===(E=p.assetAssignment)||void 0===E?void 0:E.assignedUserName,designation:(null==c||null===(f=c.applicationData)||void 0===f||null===(g=f.applicationData)||void 0===g||null===(S=g.assetAssignment)||void 0===S?void 0:S.designation)||"",department:(null==c||null===(_=c.applicationData)||void 0===_||null===(h=_.applicationData)||void 0===h||null===(y=h.assetAssignment)||void 0===y?void 0:y.department)||"",assignedDate:null==c||null===(A=c.applicationData)||void 0===A||null===(C=A.applicationData)||void 0===C||null===(D=C.assetAssignment)||void 0===D?void 0:D.assignedDate,employeeCode:null==c||null===(b=c.applicationData)||void 0===b||null===(T=b.applicationData)||void 0===T||null===(I=T.assetAssignment)||void 0===I?void 0:I.employeeCode,isAssigned:!1,returnDate:O,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/return-response",{Asset:N})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},ReturnAssignedAsset:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,v]=n.useState((null==o?void 0:o.returndetails)||[{returnDate:"",key:Date.now()}]),[p,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const f={focusIndex:p,allAssets:c,setFocusIndex:E,formData:o,formState:s,setreturndetails:v,t:d,setError:r,clearErrors:u,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(Gl,m({key:e.key,index:t,returndetails:e},f))))},editAsset:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),[u,d]=n.useState(!0),c=i.useHistory(),{id:m}=i.useParams(),{data:v}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,m),[p,E,f]=Digit.Hooks.useSessionStorage("store-data",null),[g,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[h,y,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});if(n.useEffect(()=>{S(!1),A()},[]),n.useEffect(()=>{v&&d(!1)},[v]),u)return l.createElement(t.Loader,null);const C=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},D=e=>{const t=String(e).replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},b=Kl;return l.createElement(t.FormComposer,{heading:o("AST_EDIT_ASSET"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:b.map(e=>({...e,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var t,n,l,a,i,o,r,s,u,d,m,p,E,f,g,S,_,h,y,A,b,T,I,O,N,R,x,L,P,w,M,F,B,k,U,H,j,W,V,z,G,K,$,q,Y,Z,Q,X,J,ee,te,ne,le,ae,ie,oe,re,se,ue,de,ce,me,ve,pe,Ee,fe,ge,Se,_e,he,ye,Ae,Ce,De,be,Te,Ie,Oe,Ne,Re,xe,Le,Pe,we,Me,Fe,Be,ke,Ue,He,je,We,Ve,ze,Ge,Ke,$e,qe,Ye,Ze,Qe,Xe;const Je={accountId:null==v||null===(t=v.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.accountId,tenantId:null==v||null===(l=v.applicationData)||void 0===l||null===(a=l.applicationData)||void 0===a?void 0:a.tenantId,assetBookRefNo:null==e||null===(i=e.editAssignDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.BookPagereference,assetName:null==e||null===(r=e.editAssignDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.AssetName,description:null==e||null===(u=e.editAssignDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.Assetdescription,assetClassification:null==e||null===(m=e.editAssignDetails)||void 0===m||null===(p=m[0])||void 0===p||null===(E=p.assetclassification)||void 0===E?void 0:E.code,assetParentCategory:null==e||null===(f=e.editAssignDetails)||void 0===f||null===(g=f[0])||void 0===g||null===(S=g.assettype)||void 0===S?void 0:S.code,assetCategory:null==e||null===(_=e.editAssignDetails)||void 0===_||null===(h=_[0])||void 0===h||null===(y=h.assetsubtype)||void 0===y?void 0:y.code,assetSubCategory:null==e||null===(A=e.editAssignDetails)||void 0===A||null===(b=A[0])||void 0===b||null===(T=b.assetparentsubCategory)||void 0===T?void 0:T.code,department:null==e||null===(I=e.editAssignDetails)||void 0===I||null===(O=I[0])||void 0===O||null===(N=O.Department)||void 0===N?void 0:N.code,assetType:null==e||null===(R=e.editAssignDetails)||void 0===R||null===(x=R[0])||void 0===x||null===(L=x.assetType)||void 0===L?void 0:L.code,assetUsage:null==e||null===(P=e.editAssignDetails)||void 0===P||null===(w=P[0])||void 0===w||null===(M=w.assetUsage)||void 0===M?void 0:M.code,modeOfPossessionOrAcquisition:null==e||null===(F=e.editAssignDetails)||void 0===F||null===(B=F[0])||void 0===B||null===(k=B.modeOfPossessionOrAcquisition)||void 0===k?void 0:k.code,invoiceDate:C(null==e||null===(U=e.editAssignDetails)||void 0===U||null===(H=U[0])||void 0===H?void 0:H.invoiceDate),invoiceNumber:null==e||null===(j=e.editAssignDetails)||void 0===j||null===(W=j[0])||void 0===W?void 0:W.invoiceNumber,purchaseDate:C(null==e||null===(V=e.editAssignDetails)||void 0===V||null===(z=V[0])||void 0===z?void 0:z.purchaseDate),purchaseOrderNumber:null==e||null===(G=e.editAssignDetails)||void 0===G||null===(K=G[0])||void 0===K?void 0:K.purchaseOrderNumber,lifeOfAsset:null==e||null===($=e.editAssignDetails)||void 0===$||null===(q=$[0])||void 0===q?void 0:q.lifeOfAsset,location:null==e||null===(Y=e.editAssignDetails)||void 0===Y||null===(Z=Y[0])||void 0===Z?void 0:Z.location,purchaseCost:D(null==e||null===(Q=e.editAssignDetails)||void 0===Q||null===(X=Q[0])||void 0===X?void 0:X.purchaseCost),acquisitionCost:D(null==e||null===(J=e.editAssignDetails)||void 0===J||null===(ee=J[0])||void 0===ee?void 0:ee.acquisitionCost),bookValue:D(null==e||null===(te=e.editAssignDetails)||void 0===te||null===(ne=te[0])||void 0===ne?void 0:ne.bookValue),financialYear:null==e||null===(le=e.editAssignDetails)||void 0===le||null===(ae=le[0])||void 0===ae||null===(ie=ae.financialYear)||void 0===ie?void 0:ie.code,sourceOfFinance:null==e||null===(oe=e.editAssignDetails)||void 0===oe||null===(re=oe[0])||void 0===re||null===(se=re.sourceOfFinance)||void 0===se?void 0:se.code,applicationNo:null==v||null===(ue=v.applicationData)||void 0===ue||null===(de=ue.applicationData)||void 0===de?void 0:de.applicationNo,approvalDate:"",id:null==v||null===(ce=v.applicationData)||void 0===ce||null===(me=ce.applicationData)||void 0===me?void 0:me.id,applicationDate:"",status:null==v||null===(ve=v.applicationData)||void 0===ve||null===(pe=ve.applicationData)||void 0===pe?void 0:pe.status,action:"",businessService:"asset-create",addressDetails:{addressLine1:null==v||null===(Ee=v.applicationData)||void 0===Ee||null===(fe=Ee.applicationData)||void 0===fe||null===(ge=fe.addressDetails)||void 0===ge?void 0:ge.addressLine1,addressLine2:null==v||null===(Se=v.applicationData)||void 0===Se||null===(_e=Se.applicationData)||void 0===_e||null===(he=_e.addressDetails)||void 0===he?void 0:he.addressLine2,buildingName:null==v||null===(ye=v.applicationData)||void 0===ye||null===(Ae=ye.applicationData)||void 0===Ae||null===(Ce=Ae.addressDetails)||void 0===Ce?void 0:Ce.buildingName,doorNo:null==v||null===(De=v.applicationData)||void 0===De||null===(be=De.applicationData)||void 0===be||null===(Te=be.addressDetails)||void 0===Te?void 0:Te.doorNo,street:null==v||null===(Ie=v.applicationData)||void 0===Ie||null===(Oe=Ie.applicationData)||void 0===Oe||null===(Ne=Oe.addressDetails)||void 0===Ne?void 0:Ne.street,pincode:null==v||null===(Re=v.applicationData)||void 0===Re||null===(xe=Re.applicationData)||void 0===xe||null===(Le=xe.addressDetails)||void 0===Le?void 0:Le.pincode,city:null==v||null===(Pe=v.applicationData)||void 0===Pe||null===(we=Pe.applicationData)||void 0===we||null===(Me=we.addressDetails)||void 0===Me?void 0:Me.city,locality:{code:null==v||null===(Fe=v.applicationData)||void 0===Fe||null===(Be=Fe.applicationData)||void 0===Be||null===(ke=Be.addressDetails)||void 0===ke||null===(Ue=ke.locality)||void 0===Ue?void 0:Ue.code,area:null==v||null===(He=v.applicationData)||void 0===He||null===(je=He.applicationData)||void 0===je||null===(We=je.addressDetails)||void 0===We||null===(Ve=We.locality)||void 0===Ve?void 0:Ve.area,latitude:null==v||null===(ze=v.applicationData)||void 0===ze||null===(Ge=ze.applicationData)||void 0===Ge||null===(Ke=Ge.addressDetails)||void 0===Ke?void 0:Ke.latitude,longitude:null==v||null===($e=v.applicationData)||void 0===$e||null===(qe=$e.applicationData)||void 0===qe||null===(Ye=qe.addressDetails)||void 0===Ye?void 0:Ye.longitude}},documents:null==v||null===(Ze=v.applicationData)||void 0===Ze||null===(Qe=Ze.applicationData)||void 0===Qe?void 0:Qe.documents,workflow:{action:"SUBMIT",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:{...null==e||null===(Xe=e.editNewAssetDetails)||void 0===Xe?void 0:Xe[0],acquisitionProcessionDetails:{}}};console.log("Form Data:- ",Je),c.replace("/digit-ui/employee/asset/assetservice/edit-response",{Assets:Je})},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},EditGeneralDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),v=Digit.ULBService.getStateId(),[p,E]=n.useState((null==s?void 0:s.editAssignDetails)||[{financialYear:"",assetclassification:"",assettype:"",assetparentsubCategory:"",BookPagereference:"",AssetName:"",assetsubtype:"",Assetdescription:"",Department:"",sourceOfFinance:"",assetclassification:"",key:Date.now()}]),{id:f}=i.useParams(),g=Digit.ULBService.getCurrentTenantId(),{data:S}=Digit.Hooks.asset.useAssetApplicationDetail(c,g,f);let _=null==S||null===(t=S.applicationData)||void 0===t?void 0:t.applicationData;const[h,y]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,p)},[p]);const{data:A}=Digit.Hooks.asset.useAssetClassification(v,"ASSET","assetClassification"),{data:C}=Digit.Hooks.asset.useAssetType(v,"ASSET","assetParentCategory"),{data:D}=Digit.Hooks.asset.useAssetSubType(v,"ASSET","assetCategory"),{data:b}=Digit.Hooks.asset.useAssetparentSubType(v,"ASSET","assetSubCategory"),{data:T}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let I=[];T&&T.map(e=>{I.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:O}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let N=[];O&&O.map(e=>{N.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:R}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let x=[];R&&R.map(e=>{x.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:L}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let M=[];w&&w.map(e=>{M.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:F}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"ModeOfPossessionOrAcquisition"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ModeOfPossessionOrAcquisition}});let B=[];F&&F.map(e=>{B.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})});let k=[],U=[],H=[],j=[];A&&A.map(e=>{k.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),C&&C.map(e=>{var t,n;e.assetClassification==(null==p||null===(t=p[0])||void 0===t||null===(n=t.assetclassification)||void 0===n?void 0:n.code)&&U.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),D&&D.map(e=>{var t,n;e.assetParentCategory==(null==p||null===(t=p[0])||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)&&H.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),b&&b.map(e=>{var t,n;e.assetCategory==(null==p||null===(t=p[0])||void 0===t||null===(n=t.assetsubtype)||void 0===n?void 0:n.code)&&j.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const W={focusIndex:h,allAssets:p,setFocusIndex:y,formData:s,seteditAssignDetails:E,t:c,setError:u,clearErrors:d,config:o,menu_Asset:k,asset_type:U,asset_sub_type:H,asset_parent_sub_category:j,departNamefromMDMS:x,financal:N,sourcefinance:I,comingDataFromAPI:_,assetType:P,assetCurrentUsage:M,modeOfAcquisition:B};return l.createElement(l.Fragment,null,p.map((e,t)=>l.createElement(ql,m({key:e.key,index:t,editAssignDetails:e},W))))},EditAssetDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),[v,p]=n.useState((null==s?void 0:s.editNewAssetDetails)||[{key:Date.now()}]),{id:E}=i.useParams(),f=Digit.ULBService.getCurrentTenantId(),{data:g}=Digit.Hooks.asset.useAssetApplicationDetail(c,f,E);let S=null==g||null===(t=g.applicationData)||void 0===t?void 0:t.applicationData;const[_,h]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,v)},[v]);const{data:y}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"Warranty"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Warranty}});let A=[];y&&y.map(e=>{A.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const C={focusIndex:_,allAssets:v,setFocusIndex:h,formData:s,seteditAssignDetails:p,t:c,setError:u,clearErrors:d,config:o,comingDataFromAPI:S,warrantyTime:A};return l.createElement(l.Fragment,null,v.map((e,t)=>l.createElement(Yl,m({key:e.key,index:t,editNewAssetDetails:e},C))))},editResponse:e=>{var o,r,s;const{t:u}=a.useTranslation(),c=d.useQueryClient(),[m,v]=(i.useHistory(),n.useState(null)),[p,E]=n.useState(null),[f,g]=n.useState(!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),D=Digit.ULBService.getCurrentTenantId(),{state:b}=e.location,T=Digit.Hooks.asset.useEditUpdateAPI(D,"UPDATE"!==b.key),I=Digit.Hooks.asset.useEditUpdateAPI(D,!1);return n.useEffect(()=>{I.data&&I.isSuccess&&A(I.data)},[T.data]),n.useEffect(()=>{I.data&&I.isSuccess&&A(I.data)},[I.data]),n.useEffect(()=>{S||T.mutate({Asset:null==b?void 0:b.Assets},{onError:(e,t)=>{var n,l,a;E({key:"error"}),v((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return _(!0),c.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&g(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),T.isLoading||T.isIdle&&!S?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Xl,{t:u,data:(null==T?void 0:T.data)||y,action:null==b?void 0:b.action,isSuccess:!!Object.keys(y||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!S||(null==T?void 0:T.isLoading),isEmployee:e.parentRoute.includes("employee")})),p&&l.createElement(t.Toast,{error:"error"===p.key,label:m,onClose:()=>{E(null),v(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:""+(!!e.parentRoute.includes("employee")&&"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null==T||null===(o=T.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo))},l.createElement(t.SubmitBar,{label:u("MY_APPLICATIONS")}))))}},ea=e=>{let{stateCode:t,userType:a,tenants:o}=e;const{path:r,url:s}=i.useRouteMatch(),u=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:t,moduleCode:"ASSET",language:u}),Object.entries(Jl).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)}),Digit.SessionStorage.set("ASSET_TENANTS",o),n.useEffect(()=>"employee"===a&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),"employee"===a?l.createElement(L,{path:r,url:s,userType:a}):l.createElement(CitizenApp,null)},ta=e=>{a.useTranslation();const[t,l,i]=Digit.Hooks.useSessionStorage("ASSET",{});return n.useEffect(()=>{i()},[]),null};exports.ASSETComponents={ASSETCard:()=>{const{t:e}=a.useTranslation(),[i,o]=n.useState("-"),{data:r,isLoading:s,isFetching:u,isSuccess:d}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"ASSET",filters:{limit:10,offset:0,services:["asset-create"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"0"),enabled:Digit.Utils.assetAccess()}});if(n.useEffect(()=>{!u&&d&&o(r)},[u]),!Digit.Utils.assetAccess())return null;const c=[{count:s?"0":null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"},{label:e("ASSET_ADD"),link:"/digit-ui/employee/asset/assetservice/new-assets",role:"ASSET_INITIATOR"},{label:e("MY_ASSET_APPLICATION"),link:"/digit-ui/employee/asset/assetservice/my-asset"}],m=Digit.UserService.hasAccess(["ASSET_INITIATOR"])||!1,v={moduleName:e("TITLE_ASSET_MANAGEMENT"),kpis:[{count:null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},ASSETModule:ea,ASSETLinks:ta,AST_INBOX_FILTER:e=>l.createElement(k,e),ASTInboxTableConfig:e=>({ASSET:{inboxColumns:t=>[{Header:e("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var n,a,o,r;let{row:s}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:t.parentRoute+"/assetservice/application-details/"+(null==s||null===(n=s.original)||void 0===n||null===(a=n.searchData)||void 0===a?void 0:a.applicationNo)},null===(o=s.original)||void 0===o||null===(r=o.searchData)||void 0===r?void 0:r.applicationNo)))},mobileCell:e=>{var t;return Dl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}},{Header:e("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n,l,a;return Cl(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(a=l.searchData)||void 0===a?void 0:a.assetClassification))},mobileCell:e=>{var t;return Dl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetClassification)}},{Header:e("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return Cl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return Dl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetParentCategory)}},{Header:e("AST_NAME_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return Cl(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return Dl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetName)}},{Header:e("AST_DEPARTMENT_LABEL"),Cell:t=>{var n,l;let{row:a}=t;return Cl(e("COMMON_MASTERS_DEPARTMENT_"+(null==a||null===(n=a.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.department)))},mobileCell:t=>{var n;return Dl(e("AST_COMMON_STATUS_"+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.department)))}},{Header:e("AST_ACTION"),Cell:n=>{var a,o,r,s,u,d,c,m,v;let{row:p}=n;return l.createElement("div",null,l.createElement("span",{className:"link"},"APPROVED"===(null==p||null===(a=p.original)||void 0===a||null===(o=a.searchData)||void 0===o?void 0:o.status)?null!=p&&null!==(r=p.original)&&void 0!==r&&null!==(s=r.searchData)&&void 0!==s&&null!==(u=s.assetAssignment)&&void 0!==u&&u.isAssigned?l.createElement(i.Link,{to:t.parentRoute+"/assetservice/return-assets/"+(null==p||null===(d=p.original)||void 0===d||null===(c=d.searchData)||void 0===c?void 0:c.applicationNo)},e("AST_RETURN")):l.createElement(i.Link,{to:t.parentRoute+"/assetservice/assign-assets/"+(null==p||null===(m=p.original)||void 0===m||null===(v=m.searchData)||void 0===v?void 0:v.applicationNo)},e("AST_ASSIGN")):e("AST_SHOULD_BE_APPROVED_FIRST")))},mobileCell:e=>{var t;return Dl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("AST_INBOX_UNIQUE_APPLICATION_NUMBER")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}}})},exports.ASSETLinks=ta,exports.ASSETModule=ea;
|