eehitus-my-task-list-ui 1.2.5 → 1.2.6
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.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/l10n/eehitus-my-task-list-ui-combined_translations_et.json +1 -1
- package/dist/types/components/page/detailsearch/detailsearch.d.ts +2 -1
- package/dist/types/components/page/detailsearch/filter/DetailSearchFilterService.d.ts +2 -0
- package/dist/types/components/services/buildings_actual_data_api_client/api.d.ts +31 -0
- package/dist/types/redux/reducers/filterSlice.d.ts +1 -1
- package/dist/types/redux/reducers/filterState.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.cjs.js.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";var e={20:(e,t,n)=>{var s=n(953),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,n){var s,i={},d=null,c=null;for(s in void 0!==n&&(d=""+n),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)r.call(t,s)&&!l.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===i[s]&&(i[s]=t[s]);return{$$typeof:o,type:e,key:d,ref:c,props:i,_owner:a.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},848:(e,t,n)=>{e.exports=n(20)},953:e=>{e.exports=require("react")}},t={};function n(s){var o=t[s];if(void 0!==o)return o.exports;var i=t[s]={exports:{}};return e[s](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};n.r(s),n.d(s,{DetailSearch:()=>xo,MyAdministrativeProceedings:()=>Sn,MyApprovals:()=>qs,MyDocuments:()=>Ts,MyInvolvements:()=>Xs,MyOpinions:()=>$s,MyProceedings:()=>Ws,documentsReducer:()=>I,filterReducer:()=>u,myOperationsReducer:()=>N,proceedingsReducer:()=>y,rootReducer:()=>Y});const o=require("@reduxjs/toolkit");const i=(0,o.createSlice)({name:"filter",initialState:{classifiers:{},documentTypes:[],institutionUsers:[],institutions:[],usageClassifierTypes:[]},reducers:{classifiersLoaded:(e,t)=>{e.classifiers=t.payload},documentTypesLoaded:(e,t)=>{e.documentTypes=t.payload},institutionUsersLoaded:(e,t)=>{e.institutionUsers=t.payload},institutionsLoaded:(e,t)=>{e.institutions=t.payload},usageClassifierTypesLoaded:(e,t)=>{e.usageClassifierTypes=t.payload}}}),{classifiersLoaded:r,documentTypesLoaded:a,institutionUsersLoaded:l,institutionsLoaded:d,usageClassifierTypesLoaded:c}=i.actions,u=i.reducer;const p=(0,o.createSlice)({name:"documents",initialState:{workingDocuments:[],signingDocuments:[],finishedDocuments:[],allowedDocumentTypesToStart:[]},reducers:{workingDocumentsLoaded:(e,t)=>{e.workingDocuments=t.payload},signingDocumentsLoaded:(e,t)=>{e.signingDocuments=t.payload},finishedDocumentsLoaded:(e,t)=>{e.finishedDocuments=t.payload},deleteDocument(e,t){e.workingDocuments=e.workingDocuments.filter((e=>e.docNr!==t.payload))},allowedDocumentTypesLoaded:(e,t)=>{e.allowedDocumentTypesToStart=t.payload}}}),{workingDocumentsLoaded:h,signingDocumentsLoaded:m,finishedDocumentsLoaded:g,deleteDocument:S,allowedDocumentTypesLoaded:f}=p.actions,I=p.reducer;const T=(0,o.createSlice)({name:"proceedings",initialState:{myProceedings:[],proceedingsToComment:[],incomingDocuments:[]},reducers:{myProceedingsLoaded:(e,t)=>{e.myProceedings=t.payload},proceedingsToCommentLoaded:(e,t)=>{e.proceedingsToComment=t.payload},incomingDocumentsLoaded:(e,t)=>{e.incomingDocuments=t.payload}}}),{myProceedingsLoaded:v,proceedingsToCommentLoaded:E,incomingDocumentsLoaded:_}=T.actions,y=T.reducer;const b=(0,o.createSlice)({name:"myOperations",initialState:{myOperations:[],toCommentOperations:[],operationInvitations:[]},reducers:{myOperationsLoaded:(e,t)=>{e.myOperations=t.payload},toCommentOperationsLoaded:(e,t)=>{e.toCommentOperations=t.payload},operationInvitationsLoaded:(e,t)=>{e.operationInvitations=t.payload}}}),{myOperationsLoaded:D,toCommentOperationsLoaded:x,operationInvitationsLoaded:M}=b.actions,N=b.reducer;const O=(0,o.createSlice)({name:"detailSearch",initialState:{buildings:[],documents:[],proceedings:[]},reducers:{buildingsLoaded:(e,t)=>{e.buildings=t.payload},documentsLoaded:(e,t)=>{e.documents=t.payload},proceedingsLoaded:(e,t)=>{e.proceedings=t.payload}}}),{buildingsLoaded:A,documentsLoaded:U,proceedingsLoaded:w}=O.actions,j=O.reducer,C={notices:[]},L=(0,o.createSlice)({name:"notification",initialState:C,reducers:{setNotifications:(e,t)=>{e.notices=t.payload},removeNotification:(e,t)=>{const n=e.notices.filter((e=>e.id!==t.payload));e.notices=n},cleanState:e=>C}}),P=(0,o.createSelector)((e=>e.myViewsPage.notifications.notices),(e=>e)),{cleanState:R,setNotifications:K,removeNotification:F}=L.actions,k=L.reducer,Y=(0,o.combineReducers)({filter:u,myDocuments:I,myProceedings:y,myOperations:N,detailSearch:j,notifications:k});var B=n(953),G=n.n(B);const V=require("react-intl"),H=require("ehr-components"),J="SIGNING_DOCUMENTS",W="WORKING_DOCUMENTS",q="FINISHED_DOCUMENTS",$="INCOMING_DOCUMENTS",z="MY_APPROVALS",X="MY_OPINIONS",Q="MY_INVOLVEMENTS",Z="MY_OPERATIONS",ee="OPERATIONS_TO_COMMENT",te="OPERATION_INVITATIONS",ne="PROCEEDINGS_TO_COMMENT",se="BUILDINGS_SEARCH";let oe=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const ie="BUILDING",re="PROCEEDING",ae="DOCUMENT";let le=function(e){return e.KOV="KOV",e.MKM="MKM",e.A="A",e.N="N",e.KT="KT",e.JUR="JUR",e.AMAS="AMAS",e.TJA="TJA",e}({});let de=function(e){return e.MENTOIMLIIK_AUTO_REG="MENTOIMLIIK_AUTO_REG",e.MENTOIMLIIK_KAASAMINE="MENTOIMLIIK_KAASAMINE",e.MENTOIMLIIK_MASSKAASAMINE="MENTOIMLIIK_MASSKAASAMINE",e.MENTOIMLIIK_YKSIKKAASAMINE="MENTOIMLIIK_YKSIKKAASAMINE",e.MENTOIMLIIK_ARVAMUS="MENTOIMLIIK_ARVAMUS",e.MENTOIMLIIK_VALINE_KOOSK="MENTOIMLIIK_VALINE_KOOSK",e.MENTOIMLIIK_SISENE_KOOSK="MENTOIMLIIK_SISENE_KOOSK",e.MENTOIMLIIK_KOOSK="MENTOIMLIIK_KOOSK",e.MENTOIMLIIK_MARKUS_TAIEND="MENTOIMLIIK_MARKUS_TAIEND",e.MENTOIMLIIK_MEN_MARKUS="MENTOIMLIIK_MEN_MARKUS",e.MENTOIMLIIK_EHIT_KK_RING="MENTOIMLIIK_EHIT_KK_RING",e.MENTOIMLIIK_ADS="MENTOIMLIIK_ADS",e.MENTOIMLIIK_ADS_SAADA="MENTOIMLIIK_ADS_SAADA",e.MENTOIMLIIK_ADS_ESIT="MENTOIMLIIK_ADS_ESIT",e.MENTOIMLIIK_AVALIK="MENTOIMLIIK_AVALIK",e.MENTOIMLIIK_AVALIK_TAGASISIDE="MENTOIMLIIK_AVALIK_TAGASISIDE",e.MENTOIMLIIK_RAHV_KAASAMINE="MENTOIMLIIK_RAHV_KAASAMINE",e.MENTOIMLIIK_KAAS_TAGASISIDE="MENTOIMLIIK_KAAS_TAGASISIDE",e.MENTOIMLIIK_ALLKIRJASTAMINE="MENTOIMLIIK_ALLKIRJASTAMINE",e.MENTOIMLIIK_KMH_PR="MENTOIMLIIK_KMH_PR",e.MENTOIMLIIK_KMH_AR="MENTOIMLIIK_KMH_AR",e}({});const ce="12975",ue="12976",pe="11274",he="11275",me="12977",ge="12978",Se=["11272","12972",ce,"12974",ge,he],fe=["11273","12973",ue,"12971",me,pe],Ie=[ce,ue],Te={[ue]:me,[ce]:ge},ve={[ue]:pe,[ce]:he},Ee=require("axios");var _e=n.n(Ee);const ye="https://devkluster.ehr.ee".replace(/\/+$/,"");class be{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ye,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class De extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const xe="https://example.com",Me=function(e,t,n){if(null==n)throw new De(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Ne=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},Oe=function(e){return e.pathname+e.search+e.hash},Ae=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Ue=function(e){const t=function(e){return{getAllDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/alldocumenttypes",xe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Oe(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",xe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Oe(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Me("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,xe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ne(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Oe(o),options:r}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Me("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,xe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ne(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Oe(o),options:r}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Me("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,xe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ne(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Oe(o),options:r}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",xe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Oe(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",xe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Oe(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",xe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Oe(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",xe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Oe(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",xe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Oe(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return Ae(s,_e(),ye,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return Ae(s,_e(),ye,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return Ae(o,_e(),ye,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return Ae(o,_e(),ye,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return Ae(o,_e(),ye,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return Ae(s,_e(),ye,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return Ae(s,_e(),ye,e)},async getHealth(n){const s=await t.getHealth(n);return Ae(s,_e(),ye,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return Ae(s,_e(),ye,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return Ae(s,_e(),ye,e)}}};class we extends be{getAllDocumentTypes(e){return Ue(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return Ue(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return Ue(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return Ue(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return Ue(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return Ue(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return Ue(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Ue(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return Ue(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return Ue(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class je{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Ce="http://localhost:8080".replace(/\/+$/,"");class Le{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ce,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Pe extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Re="https://example.com",Ke=function(e,t,n){if(null==n)throw new Pe(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Fe(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Fe(e,t,n))):Object.keys(t).forEach((s=>Fe(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const ke=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];Fe(t,s),e.search=t.toString()},Ye=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Be=function(e){return e.pathname+e.search+e.hash},Ge=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}};const Ve=function(e){const t=function(e){return{getJurKovPersons:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/kov",Re);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ke(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Be(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Ke("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,Re);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};ke(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Be(i),options:a}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return Ge(s,_e(),Ce,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return Ge(o,_e(),Ce,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return Ge(o,_e(),Ce,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return Ge(i,_e(),Ce,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return Ge(o,_e(),Ce,e)}}};class He extends Le{getJurKovPersons(e){return Ve(this.configuration).getJurKovPersons(e).then((e=>e(this.axios,this.basePath)))}getJurPersonCoordRelJurs(e,t){return Ve(this.configuration).getJurPersonCoordRelJurs(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByEHAKCode(e,t){return Ve(this.configuration).getUserPossibleProceedingSupervisorsByEHAKCode(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n){return Ve(this.configuration).getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByJurId(e,t){return Ve(this.configuration).getUserPossibleProceedingSupervisorsByJurId(e,t).then((e=>e(this.axios,this.basePath)))}}const Je=function(e){const t=function(e){return{addAllyksusToJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person/jur/addAllyksus",Re);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};ke(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ye(t,i,e),{url:Be(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",Re);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};ke(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ye(t,i,e),{url:Be(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ke("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),r=new URL(i,Re);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={},c={};void 0!==n&&(c.searchFromAll=n),d["Content-Type"]="application/json",ke(r,c);let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...o.headers},l.data=Ye(s,l,e),{url:Be(r),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,Re);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};ke(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ye(n,a,e),{url:Be(i),options:a}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",Re);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ke(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Be(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",Re);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ke(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Be(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",Re);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ke(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Be(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",Re);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ke(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Be(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"PUT",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,Re);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};ke(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ye(n,a,e),{url:Be(i),options:a}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return Ge(o,_e(),Ce,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return Ge(o,_e(),Ce,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return Ge(o,_e(),Ce,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const r=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return Ge(r,_e(),Ce,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return Ge(i,_e(),Ce,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return Ge(s,_e(),Ce,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return Ge(s,_e(),Ce,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return Ge(s,_e(),Ce,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return Ge(o,_e(),Ce,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return Ge(o,_e(),Ce,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return Ge(o,_e(),Ce,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return Ge(o,_e(),Ce,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return Ge(o,_e(),Ce,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return Ge(s,_e(),Ce,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return Ge(o,_e(),Ce,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return Ge(o,_e(),Ce,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return Ge(i,_e(),Ce,e)}}};class We extends Le{addAllyksusToJurPerson(e,t){return Je(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return Je(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return Je(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return Je(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return Je(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return Je(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return Je(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return Je(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return Je(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return Je(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return Je(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return Je(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return Je(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return Je(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return Je(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return Je(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return Je(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const qe=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ke("searchPerson","input",t);const i=new URL("/search/searchPerson",Re);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...o},l={};void 0!==t&&(l.input=t),void 0!==n&&(l.xRoad=n),void 0!==s&&(l.isPrivate=s),ke(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...o.headers},{url:Be(i),options:a}}}}(e);return{async searchPerson(n,s,o,i){const r=await t.searchPerson(n,s,o,i);return Ge(r,_e(),Ce,e)}}};class $e extends Le{searchPerson(e,t,n,s){return qe(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const ze=function(e){const t=function(e){return{addRoleToUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/addrole",Re);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};ke(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ye(t,i,e),{url:Be(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",Re);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};ke(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ye(t,i,e),{url:Be(s),options:i}},appointSubstituteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user-substitution/appoint-substitute",Re);let o;e&&(o=e.baseOptions);const i={method:"PUT",...o,...n},r={"Content-Type":"application/json"};ke(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ye(t,i,e),{url:Be(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",Re);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ke(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Be(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Re);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ke(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Be(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke("getJurUsersWithoutGivenRole","personId",t),Ke("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,Re);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};ke(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Be(i),options:a}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",Re);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.searchInput=t),ke(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Be(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ke("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Re);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ke(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Be(o),options:r}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Re);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};void 0!==n&&(l.valid=n),ke(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...s.headers},{url:Be(i),options:a}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Re);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};ke(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ye(n,a,e),{url:Be(i),options:a}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,Re);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};ke(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ye(n,a,e),{url:Be(i),options:a}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return Ge(o,_e(),Ce,e)},async addUser(n,s){const o=await t.addUser(n,s);return Ge(o,_e(),Ce,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return Ge(o,_e(),Ce,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return Ge(o,_e(),Ce,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return Ge(o,_e(),Ce,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return Ge(o,_e(),Ce,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return Ge(s,_e(),Ce,e)},async getHealth(n){const s=await t.getHealth(n);return Ge(s,_e(),Ce,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return Ge(o,_e(),Ce,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return Ge(i,_e(),Ce,e)},async getUser(n,s){const o=await t.getUser(n,s);return Ge(o,_e(),Ce,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return Ge(o,_e(),Ce,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return Ge(o,_e(),Ce,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return Ge(i,_e(),Ce,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return Ge(i,_e(),Ce,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return Ge(i,_e(),Ce,e)}}};class Xe extends Le{addRoleToUser(e,t){return ze(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return ze(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return ze(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return ze(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return ze(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return ze(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return ze(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return ze(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return ze(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return ze(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return ze(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return ze(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return ze(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return ze(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return ze(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return ze(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class Qe{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Ze="http://localhost:8080".replace(/\/+$/,"");class et{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ze,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();var s;(this.basePath=t,this.axios=n,e)&&(this.configuration=e,this.basePath=null!==(s=e.basePath)&&void 0!==s?s:t)}}class tt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const nt={},st="https://example.com",ot=function(e,t,n){if(null==n)throw new tt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function it(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>it(e,t,n))):Object.keys(t).forEach((s=>it(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const rt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];it(t,s),e.search=t.toString()},at=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},lt=function(e){return e.pathname+e.search+e.hash},dt=function(e,t,n,s){return function(){var o;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const a={...e.options,url:(i.defaults.baseURL?"":null!==(o=null==s?void 0:s.basePath)&&void 0!==o?o:r)+e.url};return i.request(a)}},ct=function(e){const t=function(e){return{findIncomingBaseDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("findIncomingBaseDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}},findWorkingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("findWorkingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}}}}(e);return{async findIncomingBaseDocuments(n,s){var o,i,r;const a=await t.findIncomingBaseDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["BaseMyDocumentsApi.findIncomingBaseDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)},async findWorkingDocuments(n,s){var o,i,r;const a=await t.findWorkingDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["BaseMyDocumentsApi.findWorkingDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)}}};class ut extends et{findIncomingBaseDocuments(e,t){return ct(this.configuration).findIncomingBaseDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments(e,t){return ct(this.configuration).findWorkingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}}const pt=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}}}}(e);return{async searchDetailBuildings(n,s){var o,i,r;const a=await t.searchDetailBuildings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["DetailSearchesApi.searchDetailBuildings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)},async searchDetailDocuments(n,s){var o,i,r;const a=await t.searchDetailDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["DetailSearchesApi.searchDetailDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)},async searchDetailProceedings(n,s){var o,i,r;const a=await t.searchDetailProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["DetailSearchesApi.searchDetailProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)}}};class ht extends et{searchDetailBuildings(e,t){return pt(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return pt(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return pt(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const mt=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}}}}(e);return{async findOperationInvitations(n,s){var o,i,r;const a=await t.findOperationInvitations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["MyOperationsApi.findOperationInvitations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)},async findOperations(n,s){var o,i,r;const a=await t.findOperations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["MyOperationsApi.findOperations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)},async findOperationsToComment(n,s){var o,i,r;const a=await t.findOperationsToComment(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["MyOperationsApi.findOperationsToComment"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)}}};class gt extends et{findOperationInvitations(e,t){return mt(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return mt(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return mt(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const St=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ot("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",st);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};rt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=at(t,i,e),{url:lt(s),options:i}}}}(e);return{async findAreaProceedings(n,s){var o,i,r;const a=await t.findAreaProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["MyProceedingsApi.findAreaProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)},async findProceedings(n,s){var o,i,r;const a=await t.findProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=nt["MyProceedingsApi.findProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>dt(a,_e(),Ze,e)(t,d||n)}}};class ft extends et{findAreaProceedings(e,t){return St(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return St(this.configuration).findProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}class It{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.serverIndex=e.serverIndex,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Tt="http://localhost:8080".replace(/\/+$/,"");class vt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Et extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const _t="https://example.com",yt=function(e,t,n){if(null==n)throw new Et(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},bt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function Dt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Dt(e,t,n))):Object.keys(t).forEach((s=>Dt(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const xt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];Dt(t,s),e.search=t.toString()},Mt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Nt=function(e){return e.pathname+e.search+e.hash},Ot=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const At=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("addAuthz","documentType",t),yt("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};xt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};xt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}},autoUpdateOwnershipType:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/updateOwnershipType",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};xt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}},createDoDokuDokuRel:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("createDoDokuDokuRel","documentId",t),yt("createDoDokuDokuRel","addEntityDto",n);const o="/document/{documentId}/createDoDokuDokuRel".replace("{documentId}",encodeURIComponent(String(t))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await bt(l,e),l["Content-Type"]="application/json",xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Mt(n,a,e),{url:Nt(i),options:a}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("createDocument","documentType",t);const o="/document/{documentType}".replace("{documentType}",encodeURIComponent(String(t))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await bt(l,e),l["Content-Type"]="application/json",xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Mt(n,a,e),{url:Nt(i),options:a}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("createNewVersion","documentType",t),yt("createNewVersion","applicationNumber",n),yt("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await bt(d,e),d["Content-Type"]="application/json",xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Mt(s,l,e),{url:Nt(r),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("deleteApplicationByNumber","documentType",t),yt("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"DELETE",...r,...s},l={};await bt(l,e),xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},endProceedingCircleDocuments:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("endProceedingCircleDocuments","documentType",t),yt("endProceedingCircleDocuments","applicationNumber",n),yt("endProceedingCircleDocuments","proceedingId",s);const i="/document/{documentType}/{applicationNumber}/proceeding/{proceedingId}/endCircle".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingId}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await bt(d,e),xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},getAccessRights:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("getAccessRights","documentType",t),yt("getAccessRights","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/rights".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await bt(l,e),xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yt("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,_t);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await bt(a,e),xt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Nt(o),options:r}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("getApplicationByNumber","documentType",t),yt("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await bt(l,e),xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("getApplicationByNumberOld","ehrCode",t),yt("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await bt(l,e),xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("getApplicationByNumberWithVersion","documentType",t),yt("getApplicationByNumberWithVersion","applicationNumber",n),yt("getApplicationByNumberWithVersion","version",s);const i="/document/{documentType}/{applicationNumber}/{version}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...o},d={};await bt(d,e),xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},getApplicationStateFee:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("getApplicationStateFee","documentType",t),yt("getApplicationStateFee","applicationNumber",n),yt("getApplicationStateFee","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await bt(d,e),d["Content-Type"]="application/json",xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Mt(s,l,e),{url:Nt(r),options:l}},getApplicationStateFeeOfVersion:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};yt("getApplicationStateFeeOfVersion","documentType",t),yt("getApplicationStateFeeOfVersion","applicationNumber",n),yt("getApplicationStateFeeOfVersion","version",s),yt("getApplicationStateFeeOfVersion","applicationDto",o);const r="/document/{documentType}/{applicationNumber}/{version}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),a=new URL(r,_t);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={};await bt(c,e),c["Content-Type"]="application/json",xt(a,{});let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=Mt(o,d,e),{url:Nt(a),options:d}},getDocumentFileRels:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yt("getDocumentFileRels","docNr",t);const s=new URL("/document/fileRels",_t);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={},a={};await bt(r,e),void 0!==t&&(a.docNr=t),xt(s,a);let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},{url:Nt(s),options:i}},getDotysBasedOnUserRights:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/document/starting_rights",_t);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehrCode=t),xt(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Nt(s),options:i}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};xt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}},getLastStateHistory:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("getLastStateHistory","documentType",t),yt("getLastStateHistory","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/state-history/last".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};xt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},initializeAds:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("initializeAds","documentType",t),yt("initializeAds","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/initAds".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};xt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},mergeInstitutions:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yt("mergeInstitutions","mergeInstitutionsDTO",t);const s=new URL("/document/merge",_t);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};xt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Mt(t,i,e),{url:Nt(s),options:i}},reSubmit:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("reSubmit","documentType",t),yt("reSubmit","applicationNumber",n),yt("reSubmit","proceedingNumber",s);const i="/document/{documentType}/{applicationNumber}/resubmit/{proceedingNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingNumber}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await bt(d,e),xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},recalculatestate:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("recalculatestate","documentType",t),yt("recalculatestate","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/recalculatedetailstate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};xt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},revertCreateNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("revertCreateNewVersion","documentType",t),yt("revertCreateNewVersion","applicationNumber",n),yt("revertCreateNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/revert".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await bt(d,e),d["Content-Type"]="application/json",xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Mt(s,l,e),{url:Nt(r),options:l}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("saveAndValidate","documentType",t),yt("saveAndValidate","applicationNumber",n),yt("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await bt(d,e),d["Content-Type"]="application/json",xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Mt(s,l,e),{url:Nt(r),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("saveApplicationByNumber","documentType",t),yt("saveApplicationByNumber","applicationNumber",n),yt("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await bt(d,e),d["Content-Type"]="application/json",xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Mt(s,l,e),{url:Nt(r),options:l}},setWaterExtractionPointsTestDates:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("setWaterExtractionPointsTestDates","documentType",t),yt("setWaterExtractionPointsTestDates","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await bt(l,e),xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},setWaterExtractionPointsTestDatesForBuilding:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("setWaterExtractionPointsTestDatesForBuilding","documentType",t),yt("setWaterExtractionPointsTestDatesForBuilding","applicationNumber",n),yt("setWaterExtractionPointsTestDatesForBuilding","ehrCode",s);const i="/document/{documentType}/{applicationNumber}/building/{ehrCode}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{ehrCode}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await bt(d,e),xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},submitStraightToRegistry:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("submitStraightToRegistry","documentType",t),yt("submitStraightToRegistry","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await bt(l,e),xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},submitToProcessing:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("submitToProcessing","documentType",t),yt("submitToProcessing","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await bt(l,e),xt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("submitToSigning","documentType",t),yt("submitToSigning","applicationNumber",n),yt("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await bt(d,e),d["Content-Type"]="application/json",xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Mt(s,l,e),{url:Nt(r),options:l}},submitToSupervisorProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};yt("submitToSupervisorProcessing","documentType",t),yt("submitToSupervisorProcessing","applicationNumber",n),yt("submitToSupervisorProcessing","supervisorId",s);const i="/document/{documentType}/{applicationNumber}/submitToSupervisor/{supervisorId}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{supervisorId}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await bt(d,e),xt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yt("validateSavedDocument","documentType",t),yt("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};xt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return Ot(i,_e(),Tt,e)},async apiVersion(n){const s=await t.apiVersion(n);return Ot(s,_e(),Tt,e)},async autoUpdateOwnershipType(n){const s=await t.autoUpdateOwnershipType(n);return Ot(s,_e(),Tt,e)},async createDoDokuDokuRel(n,s,o){const i=await t.createDoDokuDokuRel(n,s,o);return Ot(i,_e(),Tt,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return Ot(i,_e(),Tt,e)},async createNewVersion(n,s,o,i){const r=await t.createNewVersion(n,s,o,i);return Ot(r,_e(),Tt,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return Ot(i,_e(),Tt,e)},async endProceedingCircleDocuments(n,s,o,i){const r=await t.endProceedingCircleDocuments(n,s,o,i);return Ot(r,_e(),Tt,e)},async getAccessRights(n,s,o){const i=await t.getAccessRights(n,s,o);return Ot(i,_e(),Tt,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return Ot(o,_e(),Tt,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return Ot(i,_e(),Tt,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return Ot(i,_e(),Tt,e)},async getApplicationByNumberWithVersion(n,s,o,i){const r=await t.getApplicationByNumberWithVersion(n,s,o,i);return Ot(r,_e(),Tt,e)},async getApplicationStateFee(n,s,o,i){const r=await t.getApplicationStateFee(n,s,o,i);return Ot(r,_e(),Tt,e)},async getApplicationStateFeeOfVersion(n,s,o,i,r){const a=await t.getApplicationStateFeeOfVersion(n,s,o,i,r);return Ot(a,_e(),Tt,e)},async getDocumentFileRels(n,s){const o=await t.getDocumentFileRels(n,s);return Ot(o,_e(),Tt,e)},async getDotysBasedOnUserRights(n,s){const o=await t.getDotysBasedOnUserRights(n,s);return Ot(o,_e(),Tt,e)},async getHealth(n){const s=await t.getHealth(n);return Ot(s,_e(),Tt,e)},async getLastStateHistory(n,s,o){const i=await t.getLastStateHistory(n,s,o);return Ot(i,_e(),Tt,e)},async initializeAds(n,s,o){const i=await t.initializeAds(n,s,o);return Ot(i,_e(),Tt,e)},async mergeInstitutions(n,s){const o=await t.mergeInstitutions(n,s);return Ot(o,_e(),Tt,e)},async reSubmit(n,s,o,i){const r=await t.reSubmit(n,s,o,i);return Ot(r,_e(),Tt,e)},async recalculatestate(n,s,o){const i=await t.recalculatestate(n,s,o);return Ot(i,_e(),Tt,e)},async revertCreateNewVersion(n,s,o,i){const r=await t.revertCreateNewVersion(n,s,o,i);return Ot(r,_e(),Tt,e)},async saveAndValidate(n,s,o,i){const r=await t.saveAndValidate(n,s,o,i);return Ot(r,_e(),Tt,e)},async saveApplicationByNumber(n,s,o,i){const r=await t.saveApplicationByNumber(n,s,o,i);return Ot(r,_e(),Tt,e)},async setWaterExtractionPointsTestDates(n,s,o){const i=await t.setWaterExtractionPointsTestDates(n,s,o);return Ot(i,_e(),Tt,e)},async setWaterExtractionPointsTestDatesForBuilding(n,s,o,i){const r=await t.setWaterExtractionPointsTestDatesForBuilding(n,s,o,i);return Ot(r,_e(),Tt,e)},async submitStraightToRegistry(n,s,o){const i=await t.submitStraightToRegistry(n,s,o);return Ot(i,_e(),Tt,e)},async submitToProcessing(n,s,o){const i=await t.submitToProcessing(n,s,o);return Ot(i,_e(),Tt,e)},async submitToSigning(n,s,o,i){const r=await t.submitToSigning(n,s,o,i);return Ot(r,_e(),Tt,e)},async submitToSupervisorProcessing(n,s,o,i){const r=await t.submitToSupervisorProcessing(n,s,o,i);return Ot(r,_e(),Tt,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return Ot(i,_e(),Tt,e)}}};class Ut extends vt{addAuthz(e,t,n){return At(this.configuration).addAuthz(e,t,n).then((e=>e(this.axios,this.basePath)))}apiVersion(e){return At(this.configuration).apiVersion(e).then((e=>e(this.axios,this.basePath)))}autoUpdateOwnershipType(e){return At(this.configuration).autoUpdateOwnershipType(e).then((e=>e(this.axios,this.basePath)))}createDoDokuDokuRel(e,t,n){return At(this.configuration).createDoDokuDokuRel(e,t,n).then((e=>e(this.axios,this.basePath)))}createDocument(e,t,n){return At(this.configuration).createDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}createNewVersion(e,t,n,s){return At(this.configuration).createNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteApplicationByNumber(e,t,n){return At(this.configuration).deleteApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}endProceedingCircleDocuments(e,t,n,s){return At(this.configuration).endProceedingCircleDocuments(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getAccessRights(e,t,n){return At(this.configuration).getAccessRights(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationById(e,t){return At(this.configuration).getApplicationById(e,t).then((e=>e(this.axios,this.basePath)))}getApplicationByNumber(e,t,n){return At(this.configuration).getApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberOld(e,t,n){return At(this.configuration).getApplicationByNumberOld(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberWithVersion(e,t,n,s){return At(this.configuration).getApplicationByNumberWithVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFee(e,t,n,s){return At(this.configuration).getApplicationStateFee(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFeeOfVersion(e,t,n,s,o){return At(this.configuration).getApplicationStateFeeOfVersion(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}getDocumentFileRels(e,t){return At(this.configuration).getDocumentFileRels(e,t).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRights(e,t){return At(this.configuration).getDotysBasedOnUserRights(e,t).then((e=>e(this.axios,this.basePath)))}getHealth(e){return At(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getLastStateHistory(e,t,n){return At(this.configuration).getLastStateHistory(e,t,n).then((e=>e(this.axios,this.basePath)))}initializeAds(e,t,n){return At(this.configuration).initializeAds(e,t,n).then((e=>e(this.axios,this.basePath)))}mergeInstitutions(e,t){return At(this.configuration).mergeInstitutions(e,t).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s){return At(this.configuration).reSubmit(e,t,n,s).then((e=>e(this.axios,this.basePath)))}recalculatestate(e,t,n){return At(this.configuration).recalculatestate(e,t,n).then((e=>e(this.axios,this.basePath)))}revertCreateNewVersion(e,t,n,s){return At(this.configuration).revertCreateNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveAndValidate(e,t,n,s){return At(this.configuration).saveAndValidate(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveApplicationByNumber(e,t,n,s){return At(this.configuration).saveApplicationByNumber(e,t,n,s).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDates(e,t,n){return At(this.configuration).setWaterExtractionPointsTestDates(e,t,n).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDatesForBuilding(e,t,n,s){return At(this.configuration).setWaterExtractionPointsTestDatesForBuilding(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitStraightToRegistry(e,t,n){return At(this.configuration).submitStraightToRegistry(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n){return At(this.configuration).submitToProcessing(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToSigning(e,t,n,s){return At(this.configuration).submitToSigning(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSupervisorProcessing(e,t,n,s){return At(this.configuration).submitToSupervisorProcessing(e,t,n,s).then((e=>e(this.axios,this.basePath)))}validateSavedDocument(e,t,n){return At(this.configuration).validateSavedDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}}class wt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const jt="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class Ct{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Lt extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Pt="https://example.com",Rt=function(e,t,n){if(null==n)throw new Lt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Kt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},Ft=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},kt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Yt=function(e){return e.pathname+e.search+e.hash},Bt=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Gt=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Rt("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",Pt);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...o},l={},d={};await Kt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),Ft(i,d);let c=r&&r.headers?r.headers:{};return a.headers={...l,...c,...o.headers},{url:Yt(i),options:a}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Rt("deleteFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Pt);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n},a={};await Kt(a,e),Ft(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Yt(o),options:r}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Rt("downloadFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Pt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await Kt(a,e),Ft(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Yt(o),options:r}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Rt("updateFile","fileId",t);const o="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),i=new URL(o,Pt);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Kt(l,e),l["Content-Type"]="application/json",Ft(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=kt(n,a,e),{url:Yt(i),options:a}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Rt("updateFileInfo","doFail",t);const s=new URL("/file/info",Pt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};await Kt(r,e),r["Content-Type"]="application/json",Ft(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=kt(t,i,e),{url:Yt(s),options:i}},uploadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/file",Pt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={},a=new(e&&e.formDataCtor||FormData);await Kt(r,e),void 0!==t&&a.append("file",t),r["Content-Type"]="multipart/form-data",Ft(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},i.data=a,{url:Yt(s),options:i}},uploadFileWithFileInfo:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/fileWithInfo",Pt);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...s},a={},l=new(e&&e.formDataCtor||FormData);await Kt(a,e),void 0!==t&&l.append("file",t),void 0!==n&&l.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),a["Content-Type"]="multipart/form-data",Ft(o,{});let d=i&&i.headers?i.headers:{};return r.headers={...a,...d,...s.headers},r.data=l,{url:Yt(o),options:r}},uploadFileWithFileInfoAndDocRel:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/fileWithInfoAndDocRel",Pt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...i},d={},c=new(e&&e.formDataCtor||FormData);await Kt(d,e),void 0!==t&&c.append("file",t),void 0!==n&&c.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),void 0!==s&&c.append("docNr",s),void 0!==o&&c.append("relType",o),d["Content-Type"]="multipart/form-data",Ft(r,{});let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:Yt(r),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const r=await t.cloneFilesAndCreateRels(n,s,o,i);return Bt(r,_e(),jt,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return Bt(o,_e(),jt,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return Bt(o,_e(),jt,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return Bt(i,_e(),jt,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return Bt(o,_e(),jt,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return Bt(o,_e(),jt,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return Bt(i,_e(),jt,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,r){const a=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,r);return Bt(a,_e(),jt,e)}}};class Vt extends Ct{cloneFilesAndCreateRels(e,t,n,s){return Gt(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return Gt(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return Gt(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return Gt(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return Gt(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return Gt(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return Gt(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return Gt(this.configuration).uploadFileWithFileInfoAndDocRel(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}}class Ht{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Jt="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class Wt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Jt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class qt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const $t="https://example.com",zt=function(e,t,n){if(null==n)throw new qt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Xt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Xt(e,t,n))):Object.keys(t).forEach((s=>Xt(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Qt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];Xt(t,s),e.search=t.toString()},Zt=function(e){return e.pathname+e.search+e.hash},en=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const tn=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};zt("esileht","id",t),zt("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,$t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Qt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Zt(i),options:a}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",$t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Qt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Zt(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",$t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Qt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Zt(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};zt("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,$t);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Qt(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Zt(o),options:r}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};zt("lehtdSave","esileht",t);const s=new URL("/api/pages",$t);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};r["Content-Type"]="application/json",Qt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""}(t,i,e),{url:Zt(s),options:i}}}},nn=function(e){const t=tn(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return en(i,_e(),Jt,e)},async lehed(n){const s=await t.lehed(n);return en(s,_e(),Jt,e)},async lehedId(n){const s=await t.lehedId(n);return en(s,_e(),Jt,e)},async leht(n,s){const o=await t.leht(n,s);return en(o,_e(),Jt,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return en(o,_e(),Jt,e)}}};class sn extends Wt{esileht(e,t,n){return nn(this.configuration).esileht(e,t,n).then((e=>e(this.axios,this.basePath)))}lehed(e){return nn(this.configuration).lehed(e).then((e=>e(this.axios,this.basePath)))}lehedId(e){return nn(this.configuration).lehedId(e).then((e=>e(this.axios,this.basePath)))}leht(e,t){return nn(this.configuration).leht(e,t).then((e=>e(this.axios,this.basePath)))}lehtdSave(e,t){return nn(this.configuration).lehtdSave(e,t).then((e=>e(this.axios,this.basePath)))}}class on{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const rn={myViewsApiEndpoint:window.REACT_APP_MY_VIEWS_API_PATH,classifierApiEndpoint:window.REACT_APP_CLASSIFIER_SERVICE_ENDPOINT,userApiEndpoint:window.REACT_APP_USER_SERVICE_ENDPOINT,documentApiEndpoint:window.REACT_APP_DOCUMENT_SERVICE_ENDPOINT,fileUploadApiEndpoint:window.REACT_APP_FILE_UPLOAD_API_ENDPOINT,frontPageApiEndpoint:window.REACT_APP_YLD_API},an={proceedingApiService:new ft(new It({basePath:rn.myViewsApiEndpoint})),classifierApiService:new we(new je({basePath:rn.classifierApiEndpoint})),personApiService:new We(new Qe({basePath:rn.userApiEndpoint})),userApiService:new Xe(new Qe({basePath:rn.userApiEndpoint})),myDocumentBaseApiService:new ut(new It({basePath:rn.myViewsApiEndpoint})),documentApiService:new Ut(new wt({basePath:rn.documentApiEndpoint})),fileApiService:new Vt(new Ht({basePath:rn.fileUploadApiEndpoint})),frontPageApi:new sn(new on({basePath:rn.frontPageApiEndpoint})),institutionKovEndpointApi:new He(new Qe({basePath:rn.userApiEndpoint}))};var ln=n(848);const dn=11272,cn=e=>{var t;let{userInfo:n}=e;const s=(0,V.useIntl)(),[o,i]=(0,B.useState)(!0),[r,a]=(0,B.useState)(""),[l,d]=(0,B.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===le.MKM;(0,B.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{an.frontPageApi.leht(dn).then((e=>{const t=e.data;t[0].body&&(a(t[0].body),d(t[0].body))}))},p=async()=>{an.frontPageApi.esileht(dn,"ee").then((e=>{const t=e.data;t.body&&(a(t.body),d(t.body))}))};return(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,ln.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,ln.jsx)(H.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,ln.jsx)(H.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,ln.jsxs)("div",{className:"pt-2",children:[(0,ln.jsx)(H.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(r),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),a(l),an.frontPageApi.lehtdSave({id:dn,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},un={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},pn=e=>(0,ln.jsx)(H.Tooltip,{content:(0,ln.jsx)(H.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,ln.jsx)(H.Link,{onClick:t=>{var n;return null===(n=e.functionCall)||void 0===n?void 0:n.call(e,t)},text:e.linkName,href:e.href}):(0,ln.jsx)(H.Link,{text:e.linkName,href:e.href,onClick:t=>{t.preventDefault(),t.stopPropagation();const n=window.open(e.href,"_blank");null==n||n.focus()}})},e.linkName),hn=e=>{let{proceedings:t,linkGen:n}=e;const s=(0,V.useIntl)(),o=[{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{return(t=e).proceedingNr?(0,ln.jsx)(pn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,ln.jsx)(ln.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,ln.jsx)(pn,{linkName:e.document,tooltipText:"detailsearch.tooltip.open_document",functionCall:t=>{n(!0,t,"DOCUMENT",e.document)}}):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>e.ehrCode&&null!==e.ehrCode?e.ehrCode.map(((t,s)=>(0,ln.jsxs)(ln.Fragment,{children:[(0,ln.jsx)(pn,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,ln.jsx)("span",{children:", "}):""]}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,ln.jsx)(H.TableComponent,{config:{thead:{headers:o.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:s.formatMessage({id:"my_admin_proceedings.table.header."+e.id}),tooltip:{text:s.formatMessage({id:"my_admin_proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,type:"input",valueFormatter:t=>e.getValue(t)}))),icons:un,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},mn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,B.useState)(!1),[o,i]=(0,B.useState)(void 0),[r,a]=(0,B.useState)([]);(0,B.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===le.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await an.proceedingApiService.findAreaProceedings(n);a(null!==(o=null==s?void 0:s.data)&&void 0!==o?o:[])}catch(e){i("my_admin_proceedings.proceedings_request.error")}finally{s(!1)}}else a([])};return{loading:n,proceedings:r,error:o}},gn=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,V.useIntl)(),[o,i]=(0,B.useState)(!1),{loading:r,error:a,proceedings:l}=mn(t,o);return(0,ln.jsxs)(H.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[a&&(0,ln.jsx)(H.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:a})}),r&&(0,ln.jsxs)(H.Row,{className:"mb-4 justify-content-center",children:[(0,ln.jsx)("br",{}),(0,ln.jsx)(H.Loader,{}),(0,ln.jsx)("br",{})]}),!r&&!(null==l||!l.length)&&!a&&(0,ln.jsx)(hn,{proceedings:l,linkGen:n}),(0,ln.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,ln.jsx)(H.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},Sn=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,V.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===le.TJA;return(0,ln.jsxs)("div",{children:[(0,ln.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,ln.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,ln.jsx)(H.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,ln.jsx)(cn,{userInfo:n}),i&&(0,ln.jsx)(gn,{userInfo:n,linkGen:s})]})},fn=require("react-redux"),In=require("moment");var Tn=n.n(In);function vn(e,t,n){const s=n(e).trim(),o=n(t).trim();return s.toLowerCase()===o.toLowerCase()?0:""===s?1:""===o?-1:s.toLowerCase()>o.toLowerCase()?1:-1}function En(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function _n(e){if("0"===e.done&&"0"===e.all)return 15;if(e.done===e.all)return 9;let t=parseInt(e.done)/parseInt(e.all);return 1===t&&(t+=parseInt(e.all)/1e4),t}function yn(e,t,n){const s=n(e),o=n(t),i=_n(s),r=_n(o);return r===i?0:i>r?1:-1}function bn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function Dn(e,t,n){if(0===e.length)return e;const s={string:vn,number:En,object:yn,date:bn}[typeof t(e[0])];return[...e].sort(((e,o)=>s(e,o,t)*n))}const xn=0,Mn=1,Nn=-1;function On(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case xn:return Mn;case Mn:return Nn;case Nn:return Mn}}(t.direction):Mn}}const An=e=>-1===e.sortDirection?(0,ln.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ln.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):1===e.sortDirection?(0,ln.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ln.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):(0,ln.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,ln.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}),Un=e=>{const[t,n]=(0,B.useState)(!1);return(0,ln.jsx)(ln.Fragment,{children:e.fileId&&(0,ln.jsx)(H.ControlledPopover,{content:(0,ln.jsxs)("div",{style:{width:"250px"},children:[(0,ln.jsx)("h4",{children:(0,ln.jsx)(V.FormattedMessage,{id:"download.file"})}),(0,ln.jsx)("br",{}),(0,ln.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,ln.jsx)(H.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.cancel"})}),(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",onClick:()=>{e.fileId&&e.fileApi.downloadFile(e.fileId,{responseType:"blob"}).then((e=>{const s=e.headers["content-disposition"];let o="download";if(s){const e=s.match(/filename\*=UTF-8''(.+?)(;|$)/);e&&e.length>=2&&(o=decodeURIComponent(e[1].replace(/\+/g," ")))}const i=new Blob([e.data],{}),r=document.createElement("a");r.download=o,r.href=URL.createObjectURL(i),r.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(r.href)),3e4)})),r.click(),n(!t)})).catch((e=>console.log(e)))},squared:!0,type:"submit",children:(0,ln.jsx)(V.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,ln.jsx)(H.Icon,{tooltipText:(0,ln.jsx)(V.FormattedMessage,{id:"tooltip.download"}),type:"download"})})})};let wn=function(e){return e.DO_DOKUSEIS_ESITATUD="DO_DOKUSEIS_ESITATUD",e.DO_DOKUSEIS_KEHTETU="DO_DOKUSEIS_KEHTETU",e.DO_DOKUSEIS_KOOSTAMISEL="DO_DOKUSEIS_KOOSTAMISEL",e.DO_DOKUSEIS_EELNOU_AKTIIVNE="DO_DOKUSEIS_EELNOU_AKTIIVNE",e.DO_DOKUSEIS_ALLKIRJASTAMISEL="DO_DOKUSEIS_ALLKIRJASTAMISEL",e.DO_DOKUSEIS_MENETLUSES="DO_DOKUSEIS_MENETLUSES",e.DO_DOKUSEIS_MUUTMISEL="DO_DOKUSEIS_MUUTMISEL",e.DO_DOKUSEIS_TAIENDAMISEL="DO_DOKUSEIS_TAIENDAMISEL",e.DO_DOKUSEIS_TYHISTATUD="DO_DOKUSEIS_TYHISTATUD",e.DO_DOKUSEIS_VANA_VERSIOON="DO_DOKUSEIS_VANA_VERSIOON",e.DO_DOKUSEIS_LOOBUTUD="DO_DOKUSEIS_LOOBUTUD",e.DO_DOKUSEIS_ALLKIRJASTATUD="DO_DOKUSEIS_ALLKIRJASTATUD",e.DO_DOKUSEIS_MENETLETUD="DO_DOKUSEIS_MENETLETUD",e.DO_DOKUSEIS_LUBATUD="DO_DOKUSEIS_LUBATUD",e.DO_DOKUSEIS_LUB_TEAV="DO_DOKUSEIS_LUB_TEAV",e.DO_DOKUSEIS_KEELDUTUD="DO_DOKUSEIS_KEELDUTUD",e.DO_DOKUSEIS_TEAVITATUD="DO_DOKUSEIS_TEAVITATUD",e.DO_DOKUSEIS_REG_KANTUD="DO_DOKUSEIS_REG_KANTUD",e.DO_DOKUSEIS_ANTUD="DO_DOKUSEIS_ANTUD",e.DO_DOKUSEIS_KEHTIV="DO_DOKUSEIS_KEHTIV",e.DO_DOKUSEIS_TUNNIST_KEHTETUKS="DO_DOKUSEIS_TUNNIST_KEHTETUKS",e.DO_DOKUSEIS_KOOSK_RINGIL="DO_DOKUSEIS_KOOSK_RINGIL",e.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL="DO_DOKUSEIS_EM_KINNITATUD_AKTUAL",e}({});const jn=[{code:wn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:wn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:wn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:wn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:wn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"}],Cn=[{code:wn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:wn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:wn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:wn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"}];function Ln(e){const t=(e,t)=>({name:e,type:t});switch(wn[e]){case wn.DO_DOKUSEIS_ESITATUD:return t("Esitatud",oe.INFO);case wn.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",oe.DEFAULT);case wn.DO_DOKUSEIS_KOOSTAMISEL:case wn.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",oe.INFO);case wn.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",oe.INFO);case wn.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",oe.INFO);case wn.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",oe.INFO);case wn.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",oe.WARNING);case wn.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",oe.DEFAULT);case wn.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",oe.DEFAULT);case wn.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",oe.DEFAULT);case wn.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",oe.INFO);case wn.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",oe.SUCCESS);case wn.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",oe.SUCCESS);case wn.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",oe.WARNING);case wn.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",oe.DANGER);case wn.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",oe.SUCCESS);case wn.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",oe.SUCCESS);case wn.DO_DOKUSEIS_ANTUD:return t("Antud",oe.SUCCESS);case wn.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case wn.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",oe.SUCCESS);case wn.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",oe.DEFAULT);case wn.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",oe.INFO);default:return t(e,oe.DEFAULT)}}function Pn(e){let t=[];e===W?t=jn:e===q&&(t=Cn);return function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(t.sort(((e,t)=>e.value.localeCompare(t.value))))}function Rn(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null==e||null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.buildingAddress)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.documentNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.docNr)||void 0===s?void 0:s.includes(t.documentNumber.trim()))&&void 0!==n&&n}))),t.documentStates.length>0&&(e=e.filter((e=>{return(n=e.stateCode)&&[wn.DO_DOKUSEIS_MENETLETUD,wn.DO_DOKUSEIS_LUBATUD,wn.DO_DOKUSEIS_LUB_TEAV,wn.DO_DOKUSEIS_KEELDUTUD,wn.DO_DOKUSEIS_TEAVITATUD,wn.DO_DOKUSEIS_REG_KANTUD,wn.DO_DOKUSEIS_ANTUD,wn.DO_DOKUSEIS_KEHTIV].includes(n)?t.documentStates.includes(wn.DO_DOKUSEIS_REG_KANTUD):e.stateCode&&t.documentStates.includes(e.stateCode);var n}))),t.institutionUsers.length>0&&(e=e.filter((e=>(void 0!==e.presenter||null!==e.presenter)&&t.institutionUsers.find((t=>{var n;return!0===(null===(n=e.connectedPersonId)||void 0===n?void 0:n.includes(t))}))))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.institutions.length>0&&(e=e.filter((e=>void 0!==e.institutionId&&t.institutions.includes(e.institutionId)))),!0===t.proceedingMissing&&(e=e.filter((e=>null===e.proceedingNr||void 0===e.proceedingNr))),t.documentDate.from.length>0&&0===t.documentDate.to.length){const n=new Date(t.documentDate.from).getTime();e=e.filter((e=>new Date(Tn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.documentDate.to.length>0&&0===t.documentDate.from.length){const n=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(Tn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.documentDate.from.length>0&&t.documentDate.to.length>0){const n=new Date(t.documentDate.from).getTime(),s=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(Tn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Tn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Kn(e){return null!=e}function Fn(e,t){return Object.keys(e).find((n=>e[n]===Object.values(e).find((e=>e.includes(t)))))}function kn(e){var t,n,s,o;const[i,r]=(0,B.useState)(!1);function a(){r(!i)}const l=(0,ln.jsxs)("div",{children:[(0,ln.jsx)("h4",{children:(0,ln.jsx)(V.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,ln.jsx)("p",{children:(0,ln.jsx)(V.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,ln.jsxs)("div",{children:[(0,ln.jsx)(H.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,ln.jsx)(V.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void a()),squared:!0,type:"submit",children:(0,ln.jsx)(V.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,ln.jsx)(H.ControlledPopover,{delegateFocusOnOpen:null===(s=e.delegateFocusOnOpen)||void 0===s||s,className:"popover-confirm",content:e.content||l,open:i,placement:"top-end",theme:"danger",toggle:()=>a(),wrapperClassName:null!==(o=e.wrapperClassName)&&void 0!==o?o:"",children:e.children})}function Yn(e){return(0,ln.jsx)(kn,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,ln.jsx)(H.Icon,{tooltipText:(0,ln.jsx)(V.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const Bn=e=>{let{linkName:t,functionCall:n,tooltipText:s}=e;return(0,ln.jsxs)(ln.Fragment,{children:[(0,ln.jsx)(H.Link,{onClick:e=>null==n?void 0:n(e),text:(0,ln.jsx)(H.Text,{raw:t})}),(0,ln.jsx)(H.Info,{tooltipText:s})]})};var Gn,Vn=new Uint8Array(16);function Hn(){if(!Gn&&!(Gn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gn(Vn)}const Jn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Wn=function(e){return"string"==typeof e&&Jn.test(e)};for(var qn=[],$n=0;$n<256;++$n)qn.push(($n+256).toString(16).substr(1));const zn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(qn[e[t+0]]+qn[e[t+1]]+qn[e[t+2]]+qn[e[t+3]]+"-"+qn[e[t+4]]+qn[e[t+5]]+"-"+qn[e[t+6]]+qn[e[t+7]]+"-"+qn[e[t+8]]+qn[e[t+9]]+"-"+qn[e[t+10]]+qn[e[t+11]]+qn[e[t+12]]+qn[e[t+13]]+qn[e[t+14]]+qn[e[t+15]]).toLowerCase();if(!Wn(n))throw TypeError("Stringified UUID is invalid");return n};const Xn=function(e,t,n){var s=(e=e||{}).random||(e.rng||Hn)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=s[o];return t}return zn(s)},Qn=e=>{let{notificationStyle:t,header:n,link:s,body:o,onCloseNotification:i,isNotClosable:r,customBody:a}=e;const l=(0,V.useIntl)(),d=null!=a?a:(0,ln.jsxs)("div",{children:[(0,ln.jsx)("h3",{className:"alert-heading",children:n}),(0,ln.jsx)("p",{className:"alert-body mb-0",children:o}),s&&(0,ln.jsx)("div",{className:"mx-2",children:(0,ln.jsx)(H.Link,{onClick:s.onClick,text:l.formatMessage({id:s.text})})})]});return r?(0,ln.jsx)("div",{id:"danger-toast",className:`alert ${t}`,children:d}):(0,ln.jsxs)("div",{id:"danger-toast",className:`alert alert-toast-box ${t}`,children:[(0,ln.jsx)("a",{className:"toast-close icon-close",role:"button","data-toggle":"tooltip","data-tooltip-placement":"bottom","data-tooltip-class":"tooltip-icon","data-tooltip-trigger":"hover focus","data-tooltip-title":"Sulgen","aria-label":"Sulgen","data-animation":"false",onClick:i}),d]})};let Zn=function(e){return e.Danger="danger",e.Warning="warning",e.Info="info",e.Success="success",e}({});const es=()=>{const e=(0,V.useIntl)(),t=(0,fn.useDispatch)(),n=(0,fn.useSelector)(P),[s,o]=(0,B.useState)();(0,B.useEffect)((()=>{n&&o(n)}),[n]);const i=t=>{if(t)return"string"==typeof t?e.formatMessage({id:t}):t.values?e.formatMessage({id:t.id},{...t.values}):e.formatMessage({id:t.id})};return(0,ln.jsx)(ln.Fragment,{children:(0,ln.jsx)("div",{className:"notification-alert-box",children:(0,ln.jsx)("ul",{children:(null==s?void 0:s.length)>0&&s.map((e=>{var n;return(0,ln.jsx)("li",{children:e.theme&&(0,ln.jsx)(Qn,{notificationStyle:"alert-"+e.theme+" show",header:i(null!==(n=e.messageCode)&&void 0!==n?n:e.header),body:e.messageCode?void 0:i(e.body),onCloseNotification:()=>{return n=e.id,void t(F(n));var n},link:e.link})},e.id)}))})})})},ts=(0,o.createAsyncThunk)("globalUI/handleNotification",(async(e,t)=>{let{dispatch:n,getState:s}=t;const o=s().myViewsPage.notifications.notices,i=Xn(),r={...e,id:i};n(K([...o,r])),e.theme!==Zn.Danger&&setTimeout((()=>{n(F(i))}),7e3)})),ns=(0,o.createAsyncThunk)("document/createDocument",(async(e,t)=>{let{addEntityDto:n,successCallback:s}=e,{dispatch:o}=t;try{const e=await an.documentApiService.createDocument(n.documentType,n);return s&&s(e.data),o(R()),e.data}catch(e){o(ts({header:"request.error.create_document.title",body:"request.error.create_document.message",theme:Zn.Danger}))}})),ss=e=>{var t;let{doty:n,documentId:s,linkGen:o,userInfo:i}=e;const r=(0,fn.useDispatch)(),[a,l]=(0,B.useState)(!1),d=(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)===le.TJA,c=(e,t)=>{if(!t)return;r(ns({addEntityDto:{documentType:t,baseDocumentId:s},successCallback:t=>((e,t)=>{const n=`${e.documentTypeWithYear}/${e.documentNumber}`;e&&o(!0,t,ae,n)})(t,e)}))};return(0,ln.jsx)(H.ControlledPopover,{content:(()=>{const e=n,t=Te[e],s=ve[e];return(0,ln.jsxs)("div",{children:[(0,ln.jsxs)("ul",{children:[(0,ln.jsx)("li",{className:"d-flex justify-content-between",children:(0,ln.jsx)(Bn,{linkName:"my_documents.document_table.more_actions.request_document_cancellation",tooltipText:`my_documents.document_table.more_actions.request_document_cancellation.tooltip.${e}`,functionCall:e=>{c(e,s),l(!a)}})}),d&&(0,ln.jsx)("li",{className:"d-flex justify-content-between",children:(0,ln.jsx)(Bn,{linkName:"my_documents.document_table.more_actions.cancel_document",tooltipText:`my_documents.document_table.more_actions.cancel_document.tooltip.${e}`,functionCall:e=>{c(e,t),l(!a)}})})]}),(0,ln.jsx)(H.Button,{onClick:()=>{l(!1)},squared:!0,colourScheme:"light",children:(0,ln.jsx)(V.FormattedMessage,{id:"button.cancel"})})]})})(),open:a,placement:"bottom-end",toggle:()=>l(!a),children:(0,ln.jsx)("div",{className:"pl-2",children:(0,ln.jsx)(H.Icon,{tooltipText:(0,ln.jsx)(V.FormattedMessage,{id:"tooltip.more_actions"}),type:"more"})})})},os=e=>{var t;let{linkGen:n,userInfo:s,documentType:o,onAllUsersChecked:i,isAllUsersChecked:r,filter:a,onDocumentDelete:l,fileApi:d,hidePresenter:c}=e;const u=(0,V.useIntl)(),[p,h]=(0,B.useState)({offset:0,limit:10}),[m,g]=(0,B.useState)([]),[S,f]=(0,B.useState)({column:0,direction:xn}),[I,T]=(0,B.useState)(!1),[v,E]=(0,B.useState)(!1),[_,y]=(0,B.useState)(!1),b=(0,fn.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),D=(0,fn.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),x=(0,fn.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),M=(0,fn.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments)),N=(null===(t=s.activeRole)||void 0===t?void 0:t.businessType)!==le.A;(0,B.useEffect)((()=>{b&&o===W&&(Object.keys(a).length>0?(g(Rn(b,a)),h({offset:0,limit:10})):g(b))}),[b,a]),(0,B.useEffect)((()=>{D&&o===J&&(Object.keys(a).length>0?(g(Rn(D,a)),h({offset:0,limit:10})):g(D))}),[D,a]),(0,B.useEffect)((()=>{x&&o===q&&(Object.keys(a).length>0?(g(Rn(x,a)),h({offset:0,limit:10})):g(x))}),[x,a]),(0,B.useEffect)((()=>{M&&o===$&&(Object.keys(a).length>0?(g(Rn(M,a)),h({offset:0,limit:10})):g(M))}),[M,a]);const O=["my_documents.doc_date","my_documents.reg_date","my_documents.doc_nr","my_documents.document_type","my_documents.building_name","my_documents.ehr_code","my_documents.building_address","my_documents.state","my_documents.proceeding_nr"];c||O.push("my_documents.presenter");const A=[e=>Kn(e.docDate)?new Date(Tn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>o===$?Kn(e.deadlineDate)?new Date(Tn()(e.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:Kn(e.regDate)?new Date(Tn()(e.regDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&Kn(e.buildingName[0])?e.buildingName[0]:"",e=>e.ehrCode&&Kn(e.ehrCode[0])?e.ehrCode[0]:"",e=>e.buildingAddress&&Kn(e.buildingAddress[0])?e.buildingAddress[0]:"",e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>e.presenter?e.presenter.join(","):""];const U=e=>{var t;const i=[(0,ln.jsx)(Un,{fileApi:d,fileId:e.generatedFileId,docNr:null!==(t=e.docNr)&&void 0!==t?t:""},e.docId+"download")];return o===W&&e.stateCode===wn.DO_DOKUSEIS_KOOSTAMISEL?i.push((0,ln.jsx)(Yn,{onConfirm:()=>{l(e.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},e.docNr)):o===q&&e.doty&&Ie.includes(e.doty)&&![wn.DO_DOKUSEIS_TYHISTATUD,wn.DO_DOKUSEIS_TUNNIST_KEHTETUKS].includes(e.stateCode)&&i.push((0,ln.jsx)(ss,{doty:e.doty,documentId:e.docId,linkGen:n,userInfo:s})),i};return(0,ln.jsxs)(H.Section,{form:!0,children:[m&&(0,ln.jsx)(H.CollapseTable,{content:m.slice(p.offset,p.offset+p.limit).map((e=>{var t,s,i,r,a,l,d;return(0,ln.jsx)(H.CollapseTableRow,{fields:[e.docDate,o===$?Tn()(e.deadlineDate,"DD.MM.YYYY").valueOf()<Tn()().valueOf()?(0,ln.jsx)("div",{className:"red-text",children:null===(t=e.deadlineDate)||void 0===t?void 0:t.toString()}):e.deadlineDate:e.regDate,(0,ln.jsx)(H.Tooltip,{content:(0,ln.jsx)(H.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,ln.jsx)(H.Link,{onClick:t=>{n(!0,t,ae,e.docNr)},text:e.docNr,href:n(!1,void 0,ae,e.docNr)})},e.docNr),e.documentType,e.buildingName?(0,ln.jsx)("div",{children:_?(0,ln.jsxs)("div",{children:[e.buildingName.map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),e.buildingName.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),y(!_)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===e.buildingName.length?e.buildingName:(0,ln.jsxs)("div",{children:[null===(s=e.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),null===(i=e.buildingName)||void 0===i?void 0:i.slice(4,5),e.buildingName.length>5?" ...":"",e.buildingName.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),y(!_)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",e.ehrCode?(0,ln.jsx)("div",{children:v?(0,ln.jsxs)("div",{children:[e.ehrCode.map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[(0,ln.jsx)(pn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ie,e)},href:n(!1,void 0,ie,e)}),(0,ln.jsx)("br",{})]},t))),e.ehrCode.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),E(!v)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,ln.jsxs)("div",{children:[null===(r=e.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[(0,ln.jsx)(pn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ie,e)},href:n(!1,void 0,ie,e)}),(0,ln.jsx)("br",{})]},t))),null===(a=e.ehrCode)||void 0===a?void 0:a.slice(4,5).map((e=>(0,ln.jsx)(pn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ie,e)},href:n(!1,void 0,ie,e)}))),e.ehrCode.length>5?" ...":"",e.ehrCode.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),E(!v)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",e.buildingAddress?(0,ln.jsx)("div",{children:I?(0,ln.jsxs)("div",{children:[e.buildingAddress.map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),e.buildingAddress.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),T(!I)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===e.buildingAddress.length?e.buildingAddress:(0,ln.jsxs)("div",{children:[null===(l=e.buildingAddress)||void 0===l?void 0:l.slice(0,4).map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),null===(d=e.buildingAddress)||void 0===d?void 0:d.slice(4,5),e.buildingAddress.length>5?" ...":"",e.buildingAddress.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),T(!I)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",e.stateCode?(0,ln.jsx)(H.Status,{type:Ln(e.stateCode).type,children:Ln(e.stateCode).name}):"",o===J?(0,ln.jsx)(H.Tooltip,{content:(0,ln.jsx)(H.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,ln.jsx)(H.Link,{onClick:t=>{n(!0,t,re,e.proceedingNr)},text:e.proceedingNr,href:n(!1,void 0,re,e.proceedingNr)})},e.proceedingNr):e.proceedingNr,e.presenter?e.presenter.map(((t,n)=>(0,ln.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,ln.jsx)("span",{children:", "}):""]}))):""],tools:U(e),editable:!0},e.docId)})),headers:function(){const e=[...O];return e[1]="my_documents.deadline",(o===$?e:O).map(((e,t)=>(0,ln.jsxs)("div",{children:[(0,ln.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=On(t,S);f(e),e.direction!==xn&&g(Dn(m,A[t],e.direction))},children:S.column===t?(0,ln.jsx)(An,{sortDirection:S.direction}):(0,ln.jsx)(An,{sortDirection:xn})}),u.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:p.offset,limit:p.limit,total:m.length},onPaginationReload:h,editable:!0}),(0,ln.jsx)(H.Row,{children:N&&o!==$?(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Checkbox,{name:"checkbox",onChange:e=>i(e),text:(0,ln.jsx)(H.Text,{raw:"my_documents.view_all_institution_documents"}),checked:r})}):(0,ln.jsx)(H.Col,{})})]})},is=require("reactstrap");function rs(e,t,n,s,o){return s?(0,ln.jsx)(H.FieldWrapper,{labelCol:o,component:(0,ln.jsxs)(is.Row,{className:"w-100 px-0 mx-0",children:[(0,ln.jsx)(is.Col,{xs:"auto",md:1.5,className:"pl-0 px-0",children:(0,ln.jsx)(H.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",text:"",checked:e})}),(0,ln.jsx)(is.Col,{className:"px-0",children:(0,ln.jsx)(H.Text,{raw:(0,ln.jsx)(V.FormattedMessage,{id:n})})})]}),label:(0,ln.jsx)(V.FormattedMessage,{id:"label.empty"})}):(0,ln.jsx)(H.FieldWrapper,{labelCol:o,component:(0,ln.jsx)(H.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,ln.jsx)(H.Text,{raw:(0,ln.jsx)(V.FormattedMessage,{id:n})}),checked:e}),label:(0,ln.jsx)(V.FormattedMessage,{id:"label.empty"})})}const as=["110","11002","111","11119","11129","11139","11149","11158","11159","11191","11199","112","11201","11202","11203","11204","11205","11206","11211","11212","11213","11214","11219","11229","11231","11232","11233","11234","11239","11241","11249","11251","11271","11272","11273","11274","11275","11291","11299","113","11301","11302","11303","11304","11305","11306","11311","11312","11313","11314","11318","11319","11328","11329","11331","11332","11333","11334","11338","11339","11341","11348","11349","11351","11359","11371","11381","11391","11399","114","11411","11412","11413","11430","115","11511","11512","11513","11514","11515","11516","11518","11521","11522","11523","11524","11525","11526","11527","11531","11542","11551","11561","11563","11564","11565","11566","11567","11569","11571","11573","11574","11576","11577","11578","11581","11582","11584","11601","118","11802","11811","11821","11831","120","121","12119","12129","12139","12149","12158","12159","12199","122","12211","12212","12213","12214","12219","12229","12231","12232","12233","12234","12239","12241","12249","12251","12271","12291","12299","123","12311","12312","12313","12314","12318","12319","12328","12329","12331","12332","12333","12334","12338","12339","12341","12348","12349","12351","12359","12371","12381","12391","12399","127","12711","12731","12741","12742","12743","12744","12745","12899","129","12902","12911","12912","12921","12922","12931","12932","12942","12972","12973","12971","12974","12975","12976","12977","12978","12994","12999","130","13001","13002","13003","13009","131","13101","900","91511","91561","92731","92741","92743","92744","92745","11583"];function ls(e){return function(e){let t={id:"0",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){let e=n.id.toString(),s=t;for(let t=1;t<=n.id;t++)if(s.children){let n=s.children.find((n=>n.id.toString()===e.slice(0,t)));n&&(s=n)}s.children&&s.children.push({id:e+"",parentId:s.id,label:n.name+(null!==n.validTo&&Tn()(n.validTo).isBefore(Tn()(new Date))?" (kuni "+Tn()(n.validTo).format("DD.MM.YYYY")+")":""),level:s.level+1,children:[],selectable:!0,value:!1})}return t.children?t.children:[]}(e.filter((e=>as.includes(e.id.toString()))).sort(((e,t)=>e.id-t.id)))}function ds(e){return function(e){return e.map((e=>({id:e.id+"",label:e.firstName+" "+e.lastName+" ("+e.personalCode+")",level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.firstName.localeCompare(t.firstName))))}function cs(e){return function(e){return e.map((e=>({id:e.id+"",label:e.regName,level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.regName.localeCompare(t.regName))))}function us(e){var t,n,s,o;return(0,ln.jsxs)("div",{className:"d-flex align-items-center",children:[(0,ln.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,ln.jsx)(H.DatePicker,{disabled:null!==(t=e.disabled)&&void 0!==t&&t,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.from=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(n=e.value)||void 0===n?void 0:n.from})}),(0,ln.jsx)("span",{className:"px-1",children:"—"}),(0,ln.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,ln.jsx)(H.DatePicker,{disabled:null!==(s=e.disabled)&&void 0!==s&&s,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.to=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(o=e.value)||void 0===o?void 0:o.to})})]})}const ps=e=>{const t=(0,V.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",documentNumber:"",cadastralNumber:"",documentStates:[],institutionUsers:[],proceedingNumber:"",institutions:[],proceedingMissing:!1,documentDate:{from:"",to:""}},[i,r]=(0,B.useState)(o);(0,B.useEffect)((()=>{Object.keys(e.filterState).length>0&&r(e.filterState)}),[e.documentType]);const[a,l]=(0,B.useState)(!0),[d,c]=(0,B.useState)(!0),[u,p]=(0,B.useState)(""),[h,m]=(0,B.useState)([]),[g,S]=(0,B.useState)([]),[f,I]=(0,B.useState)([]),[T,v]=(0,B.useState)(Pn(e.documentType)),[E,_]=(0,B.useState)([]),y=(0,fn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions));function x(e){return n.test(e)}function M(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function N(e,t){var n;i[t]=e,"ehrCode"===t&&x(e)?l(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&c(!0),r((e=>({...e})))}(0,B.useEffect)((()=>{v(Pn(e.documentType))}),[e.documentType]),(0,B.useEffect)((()=>{if(y){const e=ls(y);m(e)}if(b&&e.isKov){const e=ds(b?[...b]:[]);I(e)}if(D){const e=cs([...D]);S(e)}}),[y,b,D]);return(0,ln.jsxs)(H.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,ln.jsxs)(H.Row,{className:"align-items-start",children:[(0,ln.jsxs)(H.Col,{sm:10,className:"mx-0 px-0",children:[(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:h,onSelect:e=>M(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>M(e,"documentTypes"),value:i.documentTypes,selectedOptions:E}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_type",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>N(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.building_name",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>N(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.document_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_number",placement:"top-start"}}),e.documentType!==$&&e.documentType!==J&&(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:T,onSelect:e=>M(e,"documentStates"),allSelection:!0,onRemoveItem:e=>M(e,"documentStates"),value:i.documentStates,selectedOptions:E}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>N(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.proceeding_number",placement:"top-start"}}),rs(i.proceedingMissing,(function(e){r((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(us,{onChange:e=>(e=>{""!==e.from&&!Tn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Tn()(e.to,"YYYY-MM-DD",!0).isValid()?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?p(t.formatMessage({id:"filter.invalid_date_range"})):p(""),r((t=>({...t,documentDate:e})))})(e),value:i.documentDate}),errorMessage:u.length>0?u:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.document_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_date",placement:"top-start"}})]}),(0,ln.jsxs)(H.Col,{sm:10,className:"mx-0 px-0",children:[(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>N(e,"ehrCode"),onBlur:e=>l(x(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!a&&(0,ln.jsx)(H.Text,{raw:"filter.invalid_building_code"}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.ehrCode",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>N(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.word_in_address",placement:"top-start"}}),e.documentType!==$&&e.documentType!==J&&e.isKov&&(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}}),e.documentType!==$&&(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:g,onSelect:e=>M(e,"institutions"),allSelection:!0,onRemoveItem:e=>M(e,"institutions"),value:i.institutions,selectedOptions:E}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===J&&(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}})]})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{onClick:()=>(_([]),void r(o)),colourScheme:"light",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.epmty_fields"})})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(a&&d),squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.search"})})})]})]})},hs=["11566","11567","11569","11576","11577"],ms=[pe,he,me,ge],gs=e=>{const[t,n]=(0,B.useState)(!1),[s,o]=(0,B.useState)(""),[i,r]=(0,B.useState)(!1),[a,l]=(0,B.useState)([]),d=(0,fn.useSelector)((e=>e.myViewsPage.myDocuments.allowedDocumentTypesToStart)),c=e=>null==e||Number.isNaN(e)||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length;(0,B.useEffect)((()=>{if(d){const e=d.filter((e=>!hs.includes(e.code)&&!ms.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,ln.jsx)(H.ControlledPopover,{maxWidth:900,open:t,content:(0,ln.jsx)("div",{style:{width:"600px"},children:(0,ln.jsxs)(H.Form,{onSubmit:()=>{r(!0)},children:[(0,ln.jsx)("h2",{children:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:a,value:s}),errorMessage:i&&c(s)&&(0,ln.jsx)(H.Text,{raw:"common.select.required"}),label:(0,ln.jsx)(H.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,ln.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,ln.jsx)(H.Button,{colourScheme:"light",onClick:()=>{r(!1),o("")},children:(0,ln.jsx)(V.FormattedMessage,{id:"button.cancel"})}),(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,ln.jsx)(H.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,ln.jsx)(V.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},Ss=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12973","12975","12976","12977","12978","12999","11526","11601","11583"],fs=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11573","11574","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12951","12952","12953","12973","12975","12976","12977","12978","12999","11526","11601","11583"],Is=["11273","11272","11582","11525","11271","11201","11301","11371","11002","11581","12271","12371","12921","12931","12995","12996","12902","11802","12999","12922","12932","12942","12899","11526","12972","12973"],Ts=e=>{var t,n,s,o,i,r,c;let{linkGen:u,userInfo:p}=e;const I=(0,fn.useDispatch)(),[T,v]=(0,B.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[E,_]=(0,B.useState)(!1),[y,b]=(0,B.useState)(!0),[D,x]=(0,B.useState)(!0),[M,N]=(0,B.useState)([]),[O,A]=(0,B.useState)([]),[U,w]=(0,B.useState)([]),[j,C]=(0,B.useState)({}),[L,P]=(0,B.useState)({}),[R,K]=(0,B.useState)({}),F="A"!==(null===(t=p.activeRole)||void 0===t?void 0:t.businessType);const k={userId:null===(n=p.activeRole)||void 0===n?void 0:n.userId,personId:null===(s=p.activeRole)||void 0===s?void 0:s.businessId,dotys:Ss,states:[wn.DO_DOKUSEIS_ESITATUD,wn.DO_DOKUSEIS_KOOSTAMISEL,wn.DO_DOKUSEIS_EELNOU_AKTIIVNE,wn.DO_DOKUSEIS_ALLKIRJASTAMISEL,wn.DO_DOKUSEIS_MENETLUSES,wn.DO_DOKUSEIS_TAIENDAMISEL,wn.DO_DOKUSEIS_MUUTMISEL]},Y={userId:null===(o=p.activeRole)||void 0===o?void 0:o.userId,personId:null===(i=p.activeRole)||void 0===i?void 0:i.businessId,dotys:fs,states:[wn.DO_DOKUSEIS_KEHTETU,wn.DO_DOKUSEIS_TUNNIST_KEHTETUKS,wn.DO_DOKUSEIS_REG_KANTUD,"DO_DOKUSEIS_TAGASTATUD",wn.DO_DOKUSEIS_KEELDUTUD,wn.DO_DOKUSEIS_TYHISTATUD,wn.DO_DOKUSEIS_LOOBUTUD,wn.DO_DOKUSEIS_ALLKIRJASTATUD,wn.DO_DOKUSEIS_MENETLETUD,wn.DO_DOKUSEIS_LUBATUD,wn.DO_DOKUSEIS_LUB_TEAV,wn.DO_DOKUSEIS_TEAVITATUD,wn.DO_DOKUSEIS_ANTUD,wn.DO_DOKUSEIS_KEHTIV]},G={userId:null===(r=p.activeRole)||void 0===r?void 0:r.userId,personId:null===(c=p.activeRole)||void 0===c?void 0:c.businessId,roles:["DO_DOKU_ISIK_ROLL_ALLAK"],dotys:Is,states:[wn.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,B.useEffect)((()=>{var e,t;an.classifierApiService.getAllDocumentTypes().then((e=>{I(a(e.data))})).catch((e=>{console.log(e)})),an.institutionKovEndpointApi.getJurKovPersons().then((e=>{I(d(e.data))})).catch((e=>{console.log(e)})),F&&an.userApiService.getJurUsers(null!==(e=null===(t=p.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{I(l(e.data))})).catch((e=>{console.log(e)})),an.documentApiService.getDotysBasedOnUserRights().then((e=>{const t=e.data.filter((e=>"12922"!==e.code&&"11412"!==e.code&&"11413"!==e.code&&"12932"!==e.code&&"11430"!==e.code&&"12942"!==e.code));I(f(t))})).catch((e=>{console.log("Following error occured:",e)}))}),[p]),(0,B.useEffect)((()=>{(()=>{const e=k;T.workingDocs&&(e.userId=void 0),b(!0),an.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{I(h(e.data)),b(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),b(!1)}))})()}),[T.workingDocs,p]),(0,B.useEffect)((()=>{!function(){const e=Y;T.finishedDocs&&(e.userId=void 0),x(!0),an.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{I(g(e.data)),x(!1),w(e.data)})).catch((e=>{console.log("Following error occured:",e),x(!1)}))}()}),[T.finishedDocs,p]),(0,B.useEffect)((()=>{!function(){const e=G;T.signingDocs&&(e.userId=void 0),_(!0),an.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{I(m(e.data)),_(!1),N(e.data)})).catch((e=>{console.log("Following error occured:",e),_(!1)}))}()}),[T.signingDocs,p]),(0,ln.jsxs)("div",{children:[(0,ln.jsx)(es,{}),(0,ln.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,ln.jsx)(gs,{linkGen:u})}),F&&(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,ln.jsx)(ps,{documentType:J,filterState:j,onSubmit:e=>C(e),isKov:F}),children:E?(0,ln.jsx)(H.SectionLoader,{}):0===M.length?(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,ln.jsx)(os,{linkGen:u,userInfo:p,documentType:J,onAllUsersChecked:e=>{v({signingDocs:e,workingDocs:T.workingDocs,finishedDocs:T.finishedDocs})},isAllUsersChecked:T.signingDocs,filter:j,fileApi:an.fileApiService,hidePresenter:!0})}),(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,ln.jsx)(ps,{documentType:W,filterState:L,onSubmit:e=>P(e),isKov:F}),children:y?(0,ln.jsx)(H.SectionLoader,{}):0===O.length?(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_documents.working_documents.no_docs"})}),F&&(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{v({signingDocs:T.signingDocs,workingDocs:!0,finishedDocs:T.finishedDocs})}})}),(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(gs,{linkGen:u})})]}):(0,ln.jsx)(os,{linkGen:u,userInfo:p,documentType:W,onAllUsersChecked:e=>{v({signingDocs:T.signingDocs,workingDocs:e,finishedDocs:T.finishedDocs})},isAllUsersChecked:T.workingDocs,filter:L,onDocumentDelete:e=>function(e){const t=e.slice(0,e.indexOf("/")),n=e.slice(e.indexOf("/")+1);an.documentApiService.deleteApplicationByNumber(t,n),I(S(e))}(e),fileApi:an.fileApiService})}),(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,ln.jsx)(ps,{documentType:q,filterState:R,onSubmit:e=>K(e),isKov:F}),children:D?(0,ln.jsx)(H.SectionLoader,{}):0===U.length?(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_documents.finished_documents.no_docs"})}),F&&(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{v({signingDocs:T.signingDocs,workingDocs:T.workingDocs,finishedDocs:!0})}})}),(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(gs,{linkGen:u})})]}):(0,ln.jsx)(os,{linkGen:u,userInfo:p,documentType:q,onAllUsersChecked:e=>{v({signingDocs:T.signingDocs,workingDocs:T.workingDocs,finishedDocs:e}),x(!0)},isAllUsersChecked:T.finishedDocs,filter:R,fileApi:an.fileApiService})})]})},vs={MENSEIS_TAIENDAMISEL:["MENSEIS_TAIENDAMISEL","MENSEIS_ESITATUD_TAPSUST","MENSEIS_MEN_EHITUSL_TAOT_TAPS","MENSEIS_MEN_KASUTUSL_TAOT_TAPS","MENSEIS_MEN_EDASTATUD_MARK_LAHEND"],MENSEIS_ALGATATUD:["MENSEIS_ALGATATUD","MENSEIS_ESITATUD"],MENSEIS_KAIMASOLEV:["MENSEIS_KAIMASOLEV","MENSEIS_MEN","MENSEIS_MEN_KNT_TAOT","MENSEIS_EHITUSTEGEVUS_ALANUD","MENSEIS_EHITUSTEGEVUS_LOPPENUD","MENSEIS_EHITUSTEG_LOPP","MENSEIS_LAMMUTATUD","MENSEIS_MEN_EHITUSL_TAOT","MENSEIS_MEN_KASUTUSL_TAOT","MENSEIS_MEN_LAMMUTUSL_TAOT"],MENSEIS_LOPETATUD:["MENSEIS_LOPETATUD","MENSEIS_MEN_ALLKIRJASTATUD","MENSEIS_MEN_KNT_ANTUD","MENSEIS_MEN_KNT_KEELD","MENSEIS_EHITUSL_KEHTETU","MENSEIS_KASUTUSL_KEHTETU","MENSEIS_KNT_KEHTETU","MENSEIS_MEN_EHITUSL_ANTUD","MENSEIS_MEN_EHITUSL_KEELD","MENSEIS_MEN_KASUTUSL_ANTUD","MENSEIS_MEN_KASUTUSL_KEELD","MENSEIS_MEN_LAMMUTUSL_ANTUD","MENSEIS_MEN_LAMMUTUSL_KEELD","MENSEIS_MEN_PRO_TING_ANTUD","MENSEIS_MEN_TEAVITATUD"],MENSEIS_MUUTMISEL:["MENSEIS_MUUTMISEL","MENSEIS_MEN_TAIENDAB"],MENSEIS_PEATATUD:["MENSEIS_PEATATUD"],MENSEIS_ARHIIVIS:["MENSEIS_ARHIIVIS"]};function Es(e){return Fn(vs,e)}function _s(e){const t=Es(e);return t?function(e){switch(e){case"MENSEIS_TAIENDAMISEL":return{name:"Algdokument täiendamisel",type:"warning"};case"MENSEIS_ALGATATUD":return{name:"Algatatud",type:"info"};case"MENSEIS_KAIMASOLEV":return{name:"Käimasolev",type:"info"};case"MENSEIS_LOPETATUD":return{name:"Lõpetatud",type:"success"};case"MENSEIS_MUUTMISEL":return{name:"Algdokument muutmisel",type:"info"};case"MENSEIS_PEATATUD":return{name:"Peatatud",type:"warning"};case"MENSEIS_ARHIIVIS":return{name:"Arhiivis",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const ys=[{code:"MENSEIS_TAIENDAMISEL",value:"Algdokument täiendamisel"},{code:"MENSEIS_ALGATATUD",value:"Algatatud"},{code:"MENSEIS_KAIMASOLEV",value:"Käimasolev"},{code:"MENSEIS_LOPETATUD",value:"Lõpetatud"},{code:"MENSEIS_MUUTMISEL",value:"Algdokument muutmisel"},{code:"MENSEIS_PEATATUD",value:"Peatatud"}];function bs(){return ys.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Ds(e,t){if(console.log("filterService",t),t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.proceedingStates.length>0&&(e=e.filter((e=>void 0!==e.stateCode&&t.proceedingStates.includes(Es(e.stateCode))))),t.connectedPerson.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.supervisor)||void 0===s?void 0:s.startsWith(t.connectedPerson))&&void 0!==n&&n}))),!1===t.showProceedingInArchive&&(e=e.filter((e=>"Ei"===e.archived))),t.supervisors.length>0&&(e=e.filter((e=>void 0!==e.supervisorId&&t.supervisors.includes(e.supervisorId.toString())))),t.proceedingDate.from.length>0&&0===t.proceedingDate.to.length){const n=new Date(t.proceedingDate.from).getTime();e=e.filter((e=>new Date(Tn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.proceedingDate.to.length>0&&0===t.proceedingDate.from.length){const n=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(Tn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.proceedingDate.from.length>0&&t.proceedingDate.to.length>0){const n=new Date(t.proceedingDate.from).getTime(),s=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(Tn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Tn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}if(t.lastEventDate.length>0){const n=new Date(t.lastEventDate).getTime();e=e.filter((e=>e.lastEventDate&&new Date(Tn()(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function xs(){return ys.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}let Ms=function(e){return e.Document="DOCUMENT",e.Proceeding="PROCEEDING",e.AdminProceeding="ADMIN_PROCEEDING",e.ProceedingDecision="PROCEEDING_DECISION",e.Operation="OPERATION",e.MyDocuments="MY_DOCUMENTS",e.MyProceedings="MY_PROCEEDINGS",e.MyAdministrativeProceedings="MY_ADMIN_PROCEEDINGS",e.Building="BUILDING",e.NewEnergy="NEW_ENERGY",e.ArchiveBuildingRegistryFile="ARCHIVE_BUILDINGREGISTRYFILE",e.ArchiveBuildingDatasOf2003="ARCHIVE_BUILDINGDATAASOF2003",e.ArchiveBuildingDatasOf2014="ARCHIVE_BUILDINGDATAASOF2014",e.Restriction="RESTRICTION",e.NotFound="404",e}({});const Ns=e=>e?(e=>[...Se,...fe].includes(e))(e)?Ms.AdminProceeding:Ms.Proceeding:Ms.NotFound,Os=e=>{const t=(0,V.useIntl)(),[n,s]=(0,B.useState)({offset:0,limit:50}),[o,i]=(0,B.useState)([]),[r,a]=(0,B.useState)({column:5,direction:Mn}),[l,d]=(0,B.useState)(!1),[c,u]=(0,B.useState)(!1),[p,h]=(0,B.useState)(!1),m=(0,fn.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>Kn(e.dateStart)?new Date(Tn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Kn(e.deadline)?new Date(Tn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingCircleNr)&&void 0!==t?t:""},e=>e.operationsCount?{done:e.operationsCount.split("/")[0],all:e.operationsCount.split("/")[1]}:"",e=>Kn(e.innerCommentDeadline)?new Date(e.innerCommentDeadline).getTime():Number.MAX_SAFE_INTEGER,e=>Kn(e.lastEventDate)?new Date(e.lastEventDate).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.document)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&e.buildingName[0]?e.buildingName[0]:"",e=>e.ehrCode&&e.ehrCode[0]?e.ehrCode[0]:"",e=>e.address&&e.address[0]?e.address[0]:"",e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentPresenter)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.archived)&&void 0!==t?t:""},e=>e.proceedingLength?e.proceedingLength:Number.MAX_SAFE_INTEGER];(0,B.useEffect)((()=>{if(m){const e=5,t=On(e,r);t.direction===xn&&(t.direction=Mn),a(t),i(Dn(m,g[e],t.direction))}}),[m]),(0,B.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(r.direction===xn?i(Ds(m,e.filter)):i(Dn(Ds(m,e.filter),g[r.column],r.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,B.useEffect)((()=>{r&&r.direction!==xn&&0!==o.length&&i(Dn(o,g[r.column],r.direction))}),[r]);const S=["my_proceedings.date_start","my_proceedings.deadline","my_proceedings.proceeding_nr","my_proceedings.state","my_proceedings.proceeding_circle_nr","my_proceedings.operations_count","my_proceedings.inner_comment_deadline","my_proceedings.last_event","my_proceedings.document","my_proceedings.document_type","my_proceedings.building_name","my_proceedings.ehr_code","my_proceedings.address","my_proceedings.proceeding_name","my_proceedings.supervisor","my_proceedings.document_presenter","my_proceedings.archived","my_proceedings.proceeding_length"];return(0,ln.jsxs)(H.Section,{form:!0,children:[o&&(0,ln.jsx)(H.CollapseTable,{content:(t=>{const s=t,{linkGen:o}=e;return s.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,i,r,a,m;let g={addresses:[],ehrCodes:[],buildingNames:[]};t.address&&(null===(n=t.address)||void 0===n?void 0:n.length)>1&&(g=function(e,t,n){let s={addresses:[],ehrCodes:[],buildingNames:[]};if(e&&e.length>1){let o=[];for(let s=0;s<e.length;s++){let i=e[s].split(",");o.push({county:i[0],city:i[1]?i[1].trimStart():"",other:i[2]?i[2].trimStart()+","+i[3]:"",ehrCode:t?t[s]:"",buildingName:n?n[s]:""})}const i=o.reduce(((e,t)=>{var n;const{county:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});let r=[];o.forEach((e=>{const t=e.county;r.includes(t)||r.push(t)}));let a=[];o.forEach((e=>{const t=e.city;a.includes(t)||a.push(t)})),r.forEach((e=>{const t=i[e].reduce(((e,t)=>{var n;const{city:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});i[e]=t}));let l=[],d=[],c=[];r.forEach((e=>{a.forEach((t=>{let n="";if(i[e][t]){n+=e+", "+t;for(let s=0;s<i[e][t].length;s++){const o=i[e][t][s];n+=", "+o.other,0===s?l.push(n):l.push(o.other),d.push(o.ehrCode),c.push(o.buildingName)}}}))})),s={addresses:l,ehrCodes:d,buildingNames:c}}return s}(t.address,t.ehrCode,t.buildingName));const S=Ns(t.doty);return(0,ln.jsx)(H.CollapseTableRow,{fields:[t.dateStart,Tn()(t.deadline,"DD.MM.YYYY").valueOf()<Tn()().valueOf()?(0,ln.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,ln.jsx)(H.Tooltip,{content:(0,ln.jsx)(H.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,ln.jsx)(H.Link,{onClick:e=>{o(!0,e,S,t.proceedingNr)},text:t.proceedingNr,href:o(!1,void 0,S,t.proceedingNr)})},t.proceedingNr),t.stateCode?(0,ln.jsx)(H.Status,{type:_s(t.stateCode).type,children:_s(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?Tn()(t.innerCommentDeadline).valueOf()<=Tn()().valueOf()?(0,ln.jsx)("div",{style:{color:"#00b649"},children:Tn()(t.innerCommentDeadline).format("DD.MM.YYYY")}):Tn()(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?Tn()(t.lastEventDate).format("DD.MM.YYYY"):"",(0,ln.jsx)(pn,{linkName:t.document,tooltipText:"my_proceedings.tooltip.open_document",functionCall:n=>{e.linkGen(!0,n,"DOCUMENT",t.document)}}),t.documentType,t.buildingName&&(null===(i=t.buildingName)||void 0===i?void 0:i.length)>0?(0,ln.jsx)("div",{children:p?(0,ln.jsxs)("div",{children:[g.buildingNames.map((e=>(0,ln.jsxs)(ln.Fragment,{children:[e,";",(0,ln.jsx)("br",{})]}))),t.buildingName.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,ln.jsxs)("div",{children:[null===(r=g.buildingNames)||void 0===r?void 0:r.slice(0,4).map((e=>(0,ln.jsxs)(ln.Fragment,{children:[e,";",(0,ln.jsx)("br",{})]}))),null===(a=g.buildingNames)||void 0===a?void 0:a.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,ln.jsx)("div",{children:c?(0,ln.jsxs)("div",{children:[g.ehrCodes.map((t=>(0,ln.jsxs)(ln.Fragment,{children:[(0,ln.jsx)(pn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,ln.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,ln.jsx)(pn,{linkName:t.ehrCode[0],tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t.ehrCode)},href:e.linkGen(!1,void 0,"BUILDING",t.ehrCode)}):(0,ln.jsxs)("div",{children:[g.ehrCodes.slice(0,4).map(((t,n)=>(0,ln.jsxs)(G().Fragment,{children:[(0,ln.jsx)(pn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,ln.jsx)("br",{})]},n))),g.ehrCodes.slice(4,5).map((t=>(0,ln.jsx)(pn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),t.ehrCode.length>5?" ...":"",t.ehrCode.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,ln.jsx)("div",{style:{width:125},children:l?(0,ln.jsxs)("div",{children:[g.addresses.map((e=>(0,ln.jsxs)(ln.Fragment,{children:[e,";",(0,ln.jsx)("br",{})]}))),t.address.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,ln.jsxs)("div",{children:[g.addresses.slice(0,4).map((e=>(0,ln.jsxs)(ln.Fragment,{children:[e,";",(0,ln.jsx)("br",{})]}))),null===(m=g.addresses)||void 0===m?void 0:m.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.link.view_all_addresses"})})})]})}):"",t.proceedingName,t.supervisor,t.documentPresenter,t.archived,t.proceedingLength]},t.id)}))})(o),headers:S.map(((e,n)=>(0,ln.jsxs)("div",{children:[(0,ln.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=On(n,r);a(e)},children:r.column===n?(0,ln.jsx)(An,{sortDirection:r.direction}):(0,ln.jsx)(An,{sortDirection:xn})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,ln.jsx)(ln.Fragment,{children:e.isKov?(0,ln.jsx)("div",{className:"d-flex justify-content-start",children:(0,ln.jsx)(H.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,ln.jsx)(H.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},As={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},Us=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,V.useIntl)(),i=/^[\\s0-9]{0,9}$/,r=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,[a,l]=(0,B.useState)(s),[d,c]=(0,B.useState)(!0),[u,p]=(0,B.useState)(!0),[h,m]=(0,B.useState)(""),[g,S]=(0,B.useState)(""),[f,I]=(0,B.useState)([]),[T,v]=(0,B.useState)([]),[E]=(0,B.useState)(bs()),[_,y]=(0,B.useState)([]),[b,D]=(0,B.useState)(xs()),x=(0,fn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),M=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutionUsers));function N(e){return i.test(e)}function O(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],D(n.map((e=>({id:e})))),l((e=>({...e,[t]:n})))}function A(e,t){var n;"ehrCode"===t&&N(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||r.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,B.useEffect)((()=>{if(x){const e=ls(x);I(e)}if(M&&n){const e=ds([...M]);v(e)}}),[x,M]);return(0,ln.jsxs)(H.Form,{onSubmit:()=>t(a),children:[(0,ln.jsxs)(H.Row,{className:"align-items-start",children:[(0,ln.jsxs)(H.Col,{sm:10,className:"mx-0 px-0",children:[(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:f,onSelect:e=>O(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>O(e,"documentTypes"),value:a.documentTypes,selectedOptions:_}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.document_type",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.proceedingNumber}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:E,onSelect:e=>{O(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>O(e,"proceedingStates"),value:a.proceedingStates,selectedOptions:b}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),rs(a.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)("div",{className:"daterange_in_form",children:(0,ln.jsx)(H.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!Tn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Tn()(e.to,"YYYY-MM-DD",!0).isValid()?m(o.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(o.formatMessage({id:"filter.invalid_date_range"})):m(""),l((t=>({...t,proceedingDate:e})))})(e),value:a.proceedingDate})}),errorMessage:h.length>0?h:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.proceeding_date",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.DatePicker,{name:"datepicker-field",value:a.lastEventDate,onChange:e=>function(e){""===e||Tn()(e,"YYYY-MM-DD",!0).isValid()?S(""):S(o.formatMessage({id:"filter.invalid_date_format"})),l((t=>({...t,lastEventDate:e})))}(e)}),errorMessage:g.length>0?g:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.last_event_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.last_event_date",placement:"top-start"}})]}),(0,ln.jsxs)(H.Col,{sm:10,className:"mx-0 px-0",children:[(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(N(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.ehrCode}),errorMessage:!d&&(0,ln.jsx)(H.Text,{raw:"filter.invalid_building_code"}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.ehrCode",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.buildingName}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.building_name",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.wordInAddress}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.word_in_address",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.connectedPerson}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.connected_person"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.connected_person",placement:"top-start"}}),n&&(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:T,onSelect:e=>O(e,"supervisors"),allSelection:!0,onRemoveItem:e=>O(e,"supervisors"),value:a.supervisors,selectedOptions:_}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{onClick:()=>(y([]),l(As),void D(xs())),colourScheme:"light",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.epmty_fields"})})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.search"})})})]})]})},ws={MENTOIMSEIS_OOTEL:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_JATKAMINE"],MENTOIMSEIS_TEOSTAMISEL:["MENTOIMSEIS_TEOSTAMISEL"],MENTOIMSEIS_TYHISTATUD:["MENTOIMSEIS_TYHISTATUD"],MENTOIMSEIS_TEOSTATUD:["MENTOIMSEIS_TEOSTATUD","MENTOIMSEIS_KOOSKOLA","MENTOIMSEIS_KOOSKOLA_MARK","MENTOIMSEIS_VALMIS","MENTOIMSEIS_VANA_VERSIOON","MENTOIMSEIS_ARHIIVIS","MENTOIMSEIS_EDASTATUD"],MENTOIMSEIS_LOOBUTUD:["MENTOIMSEIS_LOOBUTUD","MENTOIMSEIS_KEELDUTUD","MENTOIMSEIS_TAGASI_LYKATUD"],MENTOIMSEIS_TAHTAEG_MOODUNUD:["MENTOIMSEIS_TAHTAEG_MOODUNUD"]};let js=function(e){return e.MENTOIMSEIS_ARHIIVIS="MENTOIMSEIS_ARHIIVIS",e.MENTOIMSEIS_TYISTATUD="MENTOIMSEIS_TYISTATUD",e.MENTOIMSEIS_EDASTATUD="MENTOIMSEIS_EDASTATUD",e.MENTOIMSEIS_TEOSTAMISEL="MENTOIMSEIS_TEOSTAMISEL",e.MENTOIMSEIS_TYHISTATUD="MENTOIMSEIS_TYHISTATUD",e.MENTOIMSEIS_VALMIS="MENTOIMSEIS_VALMIS",e.MENTOIMSEIS_KEELDUTUD="MENTOIMSEIS_KEELDUTUD",e.MENTOIMSEIS_KOOSKOLA="MENTOIMSEIS_KOOSKOLA",e.MENTOIMSEIS_KOOSKOLA_MARK="MENTOIMSEIS_KOOSKOLA_MARK",e.MENTOIMSEIS_OOTEL="MENTOIMSEIS_OOTEL",e.MENTOIMSEIS_TAGASI_LYKATUD="MENTOIMSEIS_TAGASI_LYKATUD",e.MENTOIMSEIS_ADS="MENTOIMSEIS_ADS",e.MENTOIMSEIS_ADS_ESITAMATA="MENTOIMSEIS_ADS_ESITAMATA",e.MENTOIMSEIS_ADS_JOUSTUNUD="MENTOIMSEIS_ADS_JOUSTUNUD",e.MENTOIMSEIS_ADS_KONTROLL="MENTOIMSEIS_ADS_KONTROLL",e.MENTOIMSEIS_ADS_PROBLEEM="MENTOIMSEIS_ADS_PROBLEEM",e.MENTOIMSEIS_ADS_TYHISTATUD="MENTOIMSEIS_ADS_TYHISTATUD",e.MENTOIMSEIS_ADS_TYISTATUD="MENTOIMSEIS_ADS_TYISTATUD",e.MENTOIMSEIS_VANA_VERSIOON="MENTOIMSEIS_VANA_VERSIOON",e.MENTOIMSEIS_LOOBUTUD="MENTOIMSEIS_LOOBUTUD",e.MENTOIMSEIS_TEOSTATUD="MENTOIMSEIS_TEOSTATUD",e.MENTOIMSEIS_TAHTAEG_MOODUNUD="MENTOIMSEIS_TAHTAEG_MOODUNUD",e.MENTOIMSEIS_JATKAMINE="MENTOIMSEIS_JATKAMINE",e}({});function Cs(e){return Fn(ws,e)}const Ls={[js.MENTOIMSEIS_OOTEL]:"info",[js.MENTOIMSEIS_TEOSTAMISEL]:"info",[js.MENTOIMSEIS_TYHISTATUD]:"default",[js.MENTOIMSEIS_TEOSTATUD]:"success",[js.MENTOIMSEIS_LOOBUTUD]:"default",[js.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},Ps={[js.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[js.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[js.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[js.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[js.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[js.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function Rs(e,t){return((e,t)=>({state:Object.keys(Ps).includes(e)?t.formatMessage({id:Ps[e]}):e,type:Object.keys(Ls).includes(e)?Ls[e]:"default"}))(Cs(e),t)}const Ks=(e,t)=>({code:e,value:t.formatMessage({id:Ps[e]})});function Fs(e,t){let n;return n=e===Q?[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TYHISTATUD,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ks(e,t))):e===te?[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TYHISTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ks(e,t))):e===ne?[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD].map((e=>Ks(e,t))):[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ks(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function ks(){return[{code:"11271",value:"Ehitusluba"},{code:"11201",value:"Ehitusteatis"},{code:"11371",value:"Kasutusluba"},{code:"11301",value:"Kasutusteatis"},{code:"11002",value:"Projekteerimistingimused"},{code:"11051",value:"5G pääsupunkti taotlus"}].map((e=>({id:`${e.code}`,label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Ys(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>e.doty&&void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.institutions.length>0&&(e=e.filter((e=>{var n;return e.supervisorJurId&&void 0!==e.supervisorJurId&&t.institutions.includes(null===(n=e.supervisorJurId)||void 0===n?void 0:n.toString())}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.operationStates.length>0&&(e=e.filter((e=>e.stateCode&&void 0!==e.stateCode&&t.operationStates.includes(Cs(e.stateCode))))),t.institutionUsers&&t.institutionUsers.length>0&&(e=e.filter((e=>e.operationExecutorId&&void 0!==e.operationExecutorId&&t.institutionUsers.includes(e.operationExecutorId.toString())))),t.operationDate.from.length>0&&0===t.operationDate.to.length){const n=new Date(t.operationDate.from).getTime();e=e.filter((e=>new Date(Tn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDate.to.length>0&&0===t.operationDate.from.length){const n=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(Tn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDeadline.from.length>0){const n=new Date(t.operationDeadline.from).getTime();e=e.filter((e=>!e.deadline||new Date(Tn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDeadline.to.length>0){const n=new Date(t.operationDeadline.to).getTime();e=e.filter((e=>!e.deadline||new Date(Tn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDate.from.length>0&&t.operationDate.to.length>0){const n=new Date(t.operationDate.from).getTime(),s=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(Tn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Tn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Bs(e){return[{id:js.MENTOIMSEIS_OOTEL},{id:js.MENTOIMSEIS_TEOSTAMISEL},{id:js.MENTOIMSEIS_TEOSTATUD},{id:js.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let Gs=function(e){return e.Document="DOCUMENT",e.Proceeding="PROCEEDING",e.AdminProceeding="ADMIN_PROCEEDING",e.AdminOperation="ADMIN_OPERATION",e.ProceedingDecision="PROCEEDING_DECISION",e.Operation="OPERATION",e.MyDocuments="MY_DOCUMENTS",e.MyProceedings="MY_PROCEEDINGS",e.MyAdministrativeProceedings="MY_ADMIN_PROCEEDINGS",e.Building="BUILDING",e.NewEnergy="NEW_ENERGY",e.ArchiveBuildingRegistryFile="ARCHIVE_BUILDINGREGISTRYFILE",e.ArchiveBuildingDatasOf2003="ARCHIVE_BUILDINGDATAASOF2003",e.ArchiveBuildingDatasOf2014="ARCHIVE_BUILDINGDATAASOF2014",e.Restriction="RESTRICTION",e.NotFound="404",e}({});const Vs=["11273","11272"],Hs=e=>{const t=(0,V.useIntl)(),[n,s]=(0,B.useState)({offset:0,limit:10}),[o,i]=(0,B.useState)([]),[r,a]=(0,B.useState)({column:1,direction:Nn}),[l,d]=(0,B.useState)(!1),[c,u]=(0,B.useState)(!1),[p,h]=(0,B.useState)(!1),m=(0,fn.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,fn.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),S=(0,fn.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),f=(0,fn.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,fn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),v=[e=>Kn(e.invitationDate)?new Date(Tn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Kn(e.deadline)?new Date(Tn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.operationExecutor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.buildingName&&null!==e.buildingName&&Kn(e.buildingName[0])?e.buildingName[0]:"",e=>void 0!==e.ehrCode&&null!==e.ehrCode&&Kn(e.ehrCode[0])?e.ehrCode[0]:"",e=>void 0!==e.address&&null!==e.address&&Kn(e.address[0])?e.address[0]:"",e=>{var t,n;return null!==(t=null===(n=I.find((t=>t.id===e.supervisorJurId)))||void 0===n?void 0:n.regName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""}];(0,B.useEffect)((()=>{!m||e.viewType!==X&&e.viewType!==z||(i(Ys(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,B.useEffect)((()=>{m&&e.viewType===Q&&(i(Dn(Ys(m,e.filter),v[0],Nn)),s({offset:0,limit:10}))}),[m,e.filter]),(0,B.useEffect)((()=>{g&&e.viewType===ee&&(r.direction===xn?i(Ys(g,e.filter)):i(Dn(Ys(g,e.filter),v[r.column],r.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,B.useEffect)((()=>{S&&e.viewType===te&&(i(Ys(S,e.filter)),s({offset:0,limit:10}))}),[S,e.filter]),(0,B.useEffect)((()=>{f&&e.viewType===ne&&(r.direction===xn?i(Ys(f,e.filter)):i(Dn(Ys(f,e.filter),v[r.column],r.direction)))}),[f,e.filter]);const E=["my_operations.invitation_date","my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.operation_executor","my_operations.connected_document_type","my_operations.building_name","my_operations.ehr_code","my_operations.building_address","my_operations.institution","my_operations.supervisor"],_=["my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.supervisor","my_operations.connected_document_type","my_operations.building_address"],y=[e=>Kn(e.deadline)?new Date(Tn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.address&&null!==e.address&&Kn(e.address[0])?e.address[0]:""];const b=t=>{let n=Gs.Operation;return e.viewType===ne?(n=t.doty&&Vs.includes(t.doty)?Gs.AdminProceeding:Gs.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&Vs.includes(t.doty)||t.typeCode===de.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=Gs.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,ln.jsxs)(H.Section,{form:!0,children:[o&&(0,ln.jsx)(H.CollapseTable,{content:(s=>s.slice(n.offset,n.offset+n.limit).map((n=>{var s,o,i,r,a,m,g,S;const f=[n.invitationDate,Tn()(n.deadline,"DD.MM.YYYY").valueOf()<Tn()().valueOf()?(0,ln.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,ln.jsx)(H.Tooltip,{content:(0,ln.jsx)(H.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,ln.jsx)(H.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,ln.jsx)(H.Status,{type:Rs(n.stateCode,t).type,children:Rs(n.stateCode,t).state}):"",n.operationExecutor,n.doty?null===(s=T.find((e=>e.id.toString()===n.doty)))||void 0===s?void 0:s.name:"",n.buildingName?(0,ln.jsx)("div",{children:p?(0,ln.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,ln.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),null===(i=n.buildingName)||void 0===i?void 0:i.slice(4,5),n.buildingName.length>5?" ...":"",n.buildingName.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,ln.jsx)("div",{children:c?(0,ln.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,ln.jsxs)(G().Fragment,{children:[(0,ln.jsx)(pn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,ln.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,ln.jsxs)("div",{children:[null===(r=n.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((t,n)=>(0,ln.jsxs)(G().Fragment,{children:[(0,ln.jsx)(pn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,ln.jsx)("br",{})]},n))),null===(a=n.ehrCode)||void 0===a?void 0:a.slice(4,5).map((t=>(0,ln.jsx)(pn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),n.ehrCode.length>5?" ...":"",n.ehrCode.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,ln.jsx)("div",{children:l?(0,ln.jsxs)("div",{children:[n.address.map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),n.address.length>5&&(0,ln.jsx)(H.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,ln.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,ln.jsxs)(G().Fragment,{children:[e,";",(0,ln.jsx)("br",{})]},t))),null===(g=n.address)||void 0===g?void 0:g.slice(4,5),n.address.length>5?" ...":"",n.address.length>5&&(0,ln.jsx)("div",{className:"pr-3",children:(0,ln.jsx)(H.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.link.view_all_addresses"})})})]})}):"",n.supervisorJurId?null===(S=I.find((e=>e.id===n.supervisorJurId)))||void 0===S?void 0:S.regName:"",n.supervisor],v=[...f];v.splice(4,1);const E=[...f].slice(1,4).concat(f[10]).concat(f[5]).concat(f[8]);return(0,ln.jsx)(H.CollapseTableRow,{fields:e.viewType===Q?v:e.viewType===ne?E:f},n.id)})))(o),headers:function(){const n=[...E];n.splice(4,1);const s=e.viewType===Q?n:e.viewType===ne?_:E,l=[...v];l.splice(4,1);const d=e.viewType===Q?l:e.viewType===ne?y:v;return s.map(((e,n)=>(0,ln.jsxs)("div",{children:[(0,ln.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=On(n,r);a(e),e.direction!==xn&&i(Dn(o,d[n],e.direction))},children:r.column===n?(0,ln.jsx)(An,{sortDirection:r.direction}):(0,ln.jsx)(An,{sortDirection:xn})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===z||e.viewType===X)&&(0,ln.jsx)("div",{className:"d-flex justify-content-start",children:(0,ln.jsx)(H.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===z?(0,ln.jsx)(H.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,ln.jsx)(H.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},Js=e=>{var t;const n=(0,V.useIntl)(),s=/^[\\s0-9]{0,9}$/,o=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,i=null!==(t=e.initialFilter)&&void 0!==t?t:{documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},r={...i,operationStates:[js.MENTOIMSEIS_TEOSTAMISEL]},a={...i,operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[js.MENTOIMSEIS_OOTEL]},[d,c]=(0,B.useState)(e.filterState),[u,p]=(0,B.useState)(Bs(d.operationStates)),[h,m]=(0,B.useState)(!0),[g,S]=(0,B.useState)(!0),[f,I]=(0,B.useState)(""),[T,v]=(0,B.useState)(""),E=(0,B.useMemo)((()=>ks()),[]),[_,y]=(0,B.useState)([]),[b,D]=(0,B.useState)([]),x=(0,B.useMemo)((()=>Fs(e.viewType,n)),[e.viewType]),[M,N]=(0,B.useState)([]),O=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions));function U(e){return s.test(e)}function w(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],d[t]=n,c((e=>({...e})))}function j(e,t){var n;d[t]=e,"ehrCode"===t&&U(e)?m(!0):"cadastralNumber"===t&&(0===(n=e).length||o.test(n))&&S(!0),c((e=>({...e})))}(0,B.useEffect)((()=>{if(O){const e=ds(O?[...O]:[]);D(e)}if(A){const e=cs([...A]);y(e)}}),[O,A]);return(0,ln.jsxs)(H.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,ln.jsx)(H.Row,{className:"align-items-start",children:(0,ln.jsx)(H.Col,{sm:10,className:"mx-0 px-0",children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:E,onSelect:e=>w(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>w(e,"documentTypes"),value:d.documentTypes,selectedOptions:M}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,ln.jsx)(H.Row,{className:"align-items-start",children:(0,ln.jsx)(H.Col,{sm:10,className:"mx-0 px-0",children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>j(e,"ehrCode"),onBlur:e=>S(U(e.trim())),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.ehrCode}),errorMessage:!h&&(0,ln.jsx)(H.Text,{raw:"filter.invalid_building_code"}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,ln.jsxs)(H.Row,{className:"align-items-start",children:[(0,ln.jsxs)(H.Col,{sm:10,className:"mx-0 px-0",children:[(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:_,onSelect:e=>w(e,"institutions"),allSelection:!0,onRemoveItem:e=>w(e,"institutions"),value:d.institutions,selectedOptions:M}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>j(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:x,onSelect:e=>w(e,"operationStates"),allSelection:!0,onRemoveItem:e=>w(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(us,{onChange:e=>(e=>{""!==e.from&&!Tn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Tn()(e.to,"YYYY-MM-DD",!0).isValid()?I(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?I(n.formatMessage({id:"filter.invalid_date_range"})):I(""),c((t=>({...t,operationDate:e})))})(e),value:d.operationDate}),errorMessage:f.length>0?f:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,ln.jsxs)(H.Col,{sm:10,className:"mx-0 px-0",children:[(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>j(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:b,onSelect:e=>w(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>w(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:M}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(us,{onChange:e=>(e=>{""!==e.from&&!Tn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Tn()(e.to,"YYYY-MM-DD",!0).isValid()?v(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?v(n.formatMessage({id:"filter.invalid_date_range"})):v(""),c((t=>({...t,operationDeadline:e})))})(e),value:d.operationDeadline}),errorMessage:T.length>0?T:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{onClick:()=>function(){let t;switch(N([]),e.viewType){case Z:t=r;break;case ee:case ne:t=a;break;case te:t=l;break;default:t=i}c(t),p(Bs(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.epmty_fields"})})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.search"})})})]})]})},Ws=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:r,linkGen:d,myViewsApiEndpoint:c,userInfo:u,userApiEndpoint:p}=e;const h=(0,fn.useDispatch)(),[m,g]=(0,B.useState)({proceedings:!1}),[S,f]=(0,B.useState)(!0),[I,T]=(0,B.useState)(!0),[y,b]=(0,B.useState)(!0),[D,x]=(0,B.useState)([]),[M,N]=(0,B.useState)([]),[O,A]=(0,B.useState)([]),U=new we(new It({basePath:i})),w=new Xe(new It({basePath:p})),j=new ft(new It({basePath:c})),C=new ut(new It({basePath:c})),L=new gt(new It({basePath:c})),P=new Vt(new Ht({basePath:r})),R="A"!==(null===(t=u.activeRole)||void 0===t?void 0:t.businessType);let K=new Date;K.setDate(K.getDate()-7);const F={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_TEOSTAMISEL"],institutionUsers:[(null===(n=u.activeRole)||void 0===n?void 0:n.userId)+""],operationDate:{from:"",to:""},operationDeadline:{from:K.toISOString().split("T")[0],to:""}},[k,Y]=(0,B.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[G,V]=(0,B.useState)(F),[J,W]=(0,B.useState)({});const q={userId:null===(s=u.activeRole)||void 0===s?void 0:s.userId,personId:null===(o=u.activeRole)||void 0===o?void 0:o.businessId,dotys:["11525","11271","11201","11301","11271","11371","11002","11582","11581","12271","12371","11413","11412","11430","11583","11274","11275"],states:[wn.DO_DOKUSEIS_ESITATUD,wn.DO_DOKUSEIS_MENETLUSES]};return(0,B.useEffect)((()=>{!function(e){var t,n;const s={userId:e.institutionUsers?Number(e.institutionUsers[0]):null===(t=u.activeRole)||void 0===t?void 0:t.userId,personId:null===(n=u.activeRole)||void 0===n?void 0:n.businessId,states:e.operationStates,type:[de.MENTOIMLIIK_MEN_MARKUS]};T(!0),L.findOperationsToComment(s).then((e=>{h(E(e.data)),N(e.data),T(!1)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))}(G)}),[u,G]),(0,B.useEffect)((()=>{(()=>{const e=q;m.proceedings&&(e.userId=void 0),f(!0),j.findProceedings(e).then((e=>{h(v(e.data)),x(e.data),f(!1)})).catch((e=>{console.log("Following error occured:",e),f(!1)}))})()}),[m.proceedings]),(0,B.useEffect)((()=>{!function(){const e=q;e.userId=void 0,b(!0),C.findIncomingBaseDocuments(e).then((e=>{h(_(e.data)),b(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),b(!1)}))}()}),[u]),(0,B.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{h(a(e.data))})).catch((e=>{console.log(e)})),R&&w.getJurUsers(null!==(e=null===(t=u.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{h(l(e.data))})).catch((e=>{console.log(e)}))}),[u]),(0,ln.jsxs)("div",{children:[(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,ln.jsx)(Us,{onSubmit:e=>{Y(e)},isKov:R,filterState:k}),children:S?(0,ln.jsx)(H.SectionLoader,{}):0===D.length?(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_proceedings.no_proceedings"})}),R&&(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{g({proceedings:!0})}})})]}):(0,ln.jsx)(Os,{linkGen:d,isKov:R,onAllUsersChecked:e=>{g({proceedings:e})},isAllUsersChecked:m.proceedings,filter:k})}),R&&(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,ln.jsx)(Js,{viewType:ne,initialFilter:F,filterState:G,onSubmit:e=>V(e)}),children:I?(0,ln.jsx)(H.SectionLoader,{}):0===M.length?(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,ln.jsx)(Hs,{linkGen:d,viewType:ne,filter:G})}),R&&(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,ln.jsx)(ps,{documentType:$,filterState:J,onSubmit:e=>W(e),isKov:R}),children:y?(0,ln.jsx)(H.SectionLoader,{}):0===O.length?(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,ln.jsx)(os,{linkGen:d,userInfo:u,documentType:$,filter:J,fileApi:P})})]})},qs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,fn.useDispatch)(),[c,u]=(0,B.useState)(!0),[p,h]=(0,B.useState)(!1),[m,g]=(0,B.useState)(!1),[S,f]=(0,B.useState)(null),[I,T]=(0,B.useState)(null),[v,E]=(0,B.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[js.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_JATKAMINE]},N={..._,operationStates:[js.MENTOIMSEIS_OOTEL]},[O,A]=(0,B.useState)(y),[U,w]=(0,B.useState)(b),[j,C]=(0,B.useState)(N),[L,P]=(0,B.useState)(!1),R=new He(new It({basePath:o})),K=new Xe(new It({basePath:o})),F=new gt(new It({basePath:s})),k=new we(new It({basePath:t}));return(0,B.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(d(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(l(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{r(a(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,B.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[de.MENTOIMLIIK_VALINE_KOOSK],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)};L&&(e.userId=void 0),u(!0),F.findOperations(e).then((e=>{r(D(e.data)),f(e.data),u(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),u(!1)}))}()}),[L]),(0,B.useEffect)((()=>{h(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[de.MENTOIMLIIK_VALINE_KOOSK],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(x(e.data)),T(e.data),h(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),h(!1)})),g(!0),F.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[de.MENTOIMLIIK_VALINE_KOOSK],states:ws.MENTOIMSEIS_OOTEL.concat(ws.MENTOIMSEIS_TEOSTAMISEL,ws.MENTOIMSEIS_TYHISTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(M(e.data)),E(e.data),g(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),g(!1)}))}),[]),(0,ln.jsxs)("div",{children:[(0,ln.jsxs)(H.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,ln.jsx)(Js,{viewType:Z,filterState:O,onSubmit:e=>A(e)}),children:[c&&(0,ln.jsx)(H.SectionLoader,{}),c||S?(0,ln.jsx)(Hs,{linkGen:n,viewType:z,filter:O,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_approvals.no_approvals"})}),(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{P(!0)}})})]})]}),(0,ln.jsxs)(H.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,ln.jsx)(Js,{viewType:ee,filterState:U,onSubmit:e=>w(e)}),children:[p&&(0,ln.jsx)(H.SectionLoader,{}),p||I?(0,ln.jsx)(Hs,{linkGen:n,viewType:ee,filter:U}):(0,ln.jsx)("div",{children:(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,ln.jsxs)(H.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,ln.jsx)(Js,{viewType:te,filterState:j,onSubmit:e=>C(e)}),children:[m&&(0,ln.jsx)(H.SectionLoader,{}),m||v?(0,ln.jsx)(Hs,{linkGen:n,viewType:te,filter:j}):(0,ln.jsx)("div",{children:(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},$s=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,fn.useDispatch)(),[c,u]=(0,B.useState)(!1),[p,h]=(0,B.useState)(!1),[m,g]=(0,B.useState)(!1),[S,f]=(0,B.useState)(null),[I,T]=(0,B.useState)(null),[v,E]=(0,B.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[js.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_JATKAMINE]},N={..._,operationStates:[js.MENTOIMSEIS_OOTEL]},[O,A]=(0,B.useState)(y),[U,w]=(0,B.useState)(b),[j,C]=(0,B.useState)(N),[L,P]=(0,B.useState)(!1),R=new He(new It({basePath:o})),K=new Xe(new It({basePath:o})),F=new gt(new It({basePath:s})),k=new we(new It({basePath:t}));return(0,B.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(d(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(l(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{r(a(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,B.useEffect)((()=>{!function(){const e=L?null==i?void 0:i.businessId:null==i?void 0:i.userId;u(!0),F.findOperations({personId:L?e:void 0,userId:L?void 0:e,type:[de.MENTOIMLIIK_ARVAMUS],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(D(e.data)),f(e.data),u(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),u(!1)}))}()}),[L]),(0,B.useEffect)((()=>{h(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[de.MENTOIMLIIK_ARVAMUS],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(x(e.data)),T(e.data),h(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),h(!1)})),g(!0),F.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[de.MENTOIMLIIK_ARVAMUS],states:ws.MENTOIMSEIS_OOTEL.concat(ws.MENTOIMSEIS_TEOSTAMISEL,ws.MENTOIMSEIS_TYHISTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(M(e.data)),E(e.data),g(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),g(!1)}))}),[]),(0,ln.jsxs)("div",{children:[(0,ln.jsxs)(H.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,ln.jsx)(Js,{viewType:Z,filterState:O,onSubmit:e=>A(e)}),children:[c&&(0,ln.jsx)(H.SectionLoader,{}),c||S?(0,ln.jsx)(Hs,{linkGen:n,viewType:X,filter:O,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_opinions.no_opinions"})}),(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{P(!0)}})})]})]}),(0,ln.jsxs)(H.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,ln.jsx)(Js,{viewType:ee,filterState:U,onSubmit:e=>w(e)}),children:[p&&(0,ln.jsx)(H.SectionLoader,{}),p||I?(0,ln.jsx)(Hs,{linkGen:n,viewType:ee,filter:U}):(0,ln.jsx)("div",{children:(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,ln.jsxs)(H.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,ln.jsx)(Js,{viewType:te,filterState:j,onSubmit:e=>C(e)}),children:[m&&(0,ln.jsx)(H.SectionLoader,{}),m||v?(0,ln.jsx)(Hs,{linkGen:n,viewType:te,filter:j}):(0,ln.jsx)("div",{children:(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},zs=e=>{const t=(0,V.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,r]=(0,B.useState)(e.filterState),[a,l]=(0,B.useState)(Bs(i.operationStates)),[d,c]=(0,B.useState)(!0),[u,p]=(0,B.useState)(!0),[h,m]=(0,B.useState)(""),g=(0,B.useMemo)((()=>ks()),[]),[S,f]=(0,B.useState)([]),I=(0,B.useMemo)((()=>Fs(Q,t)),[]),[T,v]=(0,B.useState)([]),E=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions));function _(e){return n.test(e)}function y(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function b(e,t){var n;i[t]=e,"ehrCode"===t&&_(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&p(!0),r((e=>({...e})))}(0,B.useEffect)((()=>{if(E){const e=cs([...E]);f(e)}}),[E]);return(0,ln.jsxs)(H.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:g,onSelect:e=>y(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>y(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,ln.jsx)(H.Col,{})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>b(e,"ehrCode"),onBlur:e=>c(_(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!d&&(0,ln.jsx)(H.Text,{raw:"filter.invalid_building_code"}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:S,onSelect:e=>y(e,"institutions"),allSelection:!0,onRemoveItem:e=>y(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,ln.jsx)(H.Col,{})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:I,onSelect:e=>y(e,"operationStates"),allSelection:!0,onRemoveItem:e=>y(e,"operationStates"),value:i.operationStates,selectedOptions:a}),label:(0,ln.jsx)(V.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.FieldWrapper,{component:(0,ln.jsx)(us,{onChange:e=>(e=>{""!==e.from&&!Tn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Tn()(e.to,"YYYY-MM-DD",!0).isValid()?m(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(t.formatMessage({id:"filter.invalid_date_range"})):m(""),r((t=>({...t,operationDate:e})))})(e),value:i.operationDate}),errorMessage:h.length>0?h:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,ln.jsx)(H.Col,{})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{onClick:()=>(v([]),r(o),void l(Bs(o.operationStates))),colourScheme:"light",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.epmty_fields"})})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.search"})})})]})]})},Xs=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:r}=e;const l=(0,fn.useDispatch)(),[c,u]=(0,B.useState)(!1),[p,h]=(0,B.useState)([]),m=!(void 0===i||"A"===(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)),g={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[S,f]=(0,B.useState)(g),I=new He(new It({basePath:r})),T=new gt(new It({basePath:o})),v=new we(new It({basePath:n}));return(0,B.useEffect)((()=>{var e;I.getJurKovPersons().then((e=>{l(d(e.data))})).catch((e=>{console.log(e)})),v.getAllDocumentTypes().then((e=>{l(a(e.data))})).catch((e=>{console.log(e)})),u(!0),T.findOperations({userId:void 0,personId:m?null===(e=i.activeRole)||void 0===e?void 0:e.businessId:i.personId,type:[de.MENTOIMLIIK_KAASAMINE,de.MENTOIMLIIK_KAAS_TAGASISIDE],states:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_VALMIS,js.MENTOIMSEIS_JATKAMINE,js.MENTOIMSEIS_TYHISTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_KEELDUTUD,js.MENTOIMSEIS_TAGASI_LYKATUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD]}).then((e=>{l(D(e.data)),h(e.data),u(!1)})).catch((e=>{console.log("Following error occured:",e),u(!1)}))}),[i]),(0,ln.jsx)("div",{children:(0,ln.jsx)(H.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,ln.jsx)(zs,{filterState:S,onSubmit:e=>f(e)}),children:c?(0,ln.jsx)(H.SectionLoader,{}):0===p.length?(0,ln.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,ln.jsx)(H.Text,{raw:"my_involvements.no_involvements"})}):(0,ln.jsx)(Hs,{linkGen:s,viewType:Q,filter:S})})})};function Qs(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Zs(e){let t=Qs([{code:"EHITIS_SEISUND_KAVAN",value:"Kavandatav"},{code:"EHITIS_SEISUND_PYSTI",value:"Püstitamisel"},{code:"EHITIS_SEISUND_OLEMA",value:"Olemas"},{code:"EHITIS_SEISUND_LAMEL",value:"Lammutamisel"},{code:"EHITIS_SEISUND_LAMUT",value:"Lammutatud"},{code:"EHITIS_SEISUND_REATA",value:"Realiseerimata"},{code:"EHITIS_SEISUND_KUSTU",value:"Kustutatud"}]);return e?t:t.slice(0,-1)}const eo=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function to(){return Qs(eo)}function no(e){let t=[];for(let n of e)t.push(n.id),t.push(...no(n.children?n.children:[]));return t}const so=e=>{const t=(0,V.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],owner:void 0,isPrivatePerson:!1,searchType:se},s=(0,fn.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,fn.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[i,r]=(0,B.useState)(n),[a,l]=(0,B.useState)([]),[d,c]=(0,B.useState)(Zs(e.isAdminRole)),[u]=(0,B.useState)(Qs([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[p]=(0,B.useState)(to()),[h,m]=(0,B.useState)([]),[g,S]=(0,B.useState)({}),[f,I]=(0,B.useState)(""),[T,v]=(0,B.useState)({}),[E,_]=(0,B.useState)(""),[y,b]=(0,B.useState)(!1),[D,x]=(0,B.useState)({code:"",value:""}),M=(0,B.useRef)(),[N,O]=(0,B.useState)({});function A(e,t){let n;n=e.selectedData.length>0?void 0!==e.selectedData[0].data?e.selectedData[0].data.map((e=>e.id)):e.selectedData.map((e=>e.id)).flat():[],i[t]=n,r((e=>({...e})))}function U(e,t){let n;if(e.selectedData.length>0){n=no(void 0===e.selectedData[0].data?e.selectedData:e.selectedData[0].data)}else n=[];i[t]=n,r((e=>({...e})))}function w(e,t){i[t]=e,r((e=>({...e})))}(0,B.useEffect)((()=>{if(s.length>0){const e=function(e){let t={id:"00000",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){const{code:e,name:s,validTo:o}=n;let i=e.replace(/0/g,""),r=i.slice(0,i.length-1),a=t;for(let e=2;e<=r.length;e++)if(a.children){let t=a.children.find((t=>t.id.replace(/0/g,"")===r.slice(0,e)));t&&(a=t)}if(a.children){const t=`${e} ${s}${null!=o&&o.trim()?` (kuni ${o})`:""}`;a.children.push({id:n.id+"",parentId:a.id,label:t,level:a.level+1,children:[],selectable:!0,value:!1})}}return t.children?t.children:[]}([...s].sort(((e,t)=>Number(e.code)-Number(t.code))));m(e)}}),[s]),(0,B.useEffect)((()=>{c(Zs(e.isAdminRole))}),[e.isAdminRole]);const j={sm:20,md:8,lg:8};return(0,ln.jsxs)(H.Form,{onSubmit:()=>function(){if(JSON.stringify(n)===JSON.stringify(i))v({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"});else if(i.firstUseMissing){let t={...i};t.firstUseDate={from:"",to:""},e.onSubmit(t)}else v({header:"",message:""}),e.onSubmit(i)}(),children:[T.header&&T.header.length>0&&T.message&&T.message.length>0&&(0,ln.jsx)(H.MessageBlock,{dismissible:!0,header:(0,ln.jsx)(V.FormattedMessage,{id:T.header}),onDismiss:()=>v({header:"",message:""}),theme:"danger",messages:[(0,ln.jsx)(V.FormattedMessage,{id:T.message})]}),o&&o.length>=500&&(0,ln.jsx)(H.MessageBlock,{dismissible:!0,header:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,ln.jsxs)(H.Row,{className:"align-items-start",children:[(0,ln.jsxs)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>w(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:i.buildingLocation}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.building_location",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>w(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>A(e,"buildingStates"),value:i.buildingStates,selectedOptions:a}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.building_state"}),info:{content:"detailsearch.filter.tooltip.building_state",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)("div",{className:"daterange_in_form",children:(0,ln.jsx)(H.NumberRangeExtended,{value:{from:i.firstUseDate.from,to:i.firstUseDate.to},onChange:e=>function(e){I(""),v({header:"",message:""});let t=null!==e.from?e.from:"",n=null!==e.to?e.to:"";r((e=>({...e,firstUseDate:{from:t,to:n}})))}(e),onBlur:e=>function(e){let n=Number(e.from),s=Number(e.to);n<0||n>2100||s<0||s>2100?I(t.formatMessage({id:"detailsearch.error_field.year-between"})):null!==e.from&&null!==e.to&&n>s?I(t.formatMessage({id:"detailsearch.error_field.beginning-bigger"})):(I(""),v({header:"",message:""}))}(e),onlyPositive:!0,disabled:i.firstUseMissing})}),errorMessage:f,label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.first_use"}),info:{content:"detailsearch.filter.tooltip.first_use",placement:"top-start"}}),(0,ln.jsx)(ln.Fragment,{children:rs(i.firstUseMissing,(function(e){r((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing",j)})]}),(0,ln.jsxs)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"buildingType"),allSelection:!0,onRemoveItem:e=>A(e,"buildingType"),value:i.buildingType,selectedOptions:a}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.building_type"}),info:{content:"detailsearch.filter.tooltip.building_type",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:h,onSelect:e=>U(e,"purposeOfUse"),allSelection:!0,onRemoveItem:e=>U(e,"purposeOfUse"),value:i.purposeOfUse,selectedOptions:a,isSearchExactMatch:!0}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.purpose_of_use"}),info:{content:"detailsearch.filter.tooltip.purpose_of_use",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:p,onSelect:e=>A(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>A(e,"ownershipType"),value:i.ownershipType,selectedOptions:a}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.ownershiptype"}),info:{content:"detailsearch.filter.tooltip.ownershiptype",placement:"top-start"}})]}),e.isAdminPlusRole&&(0,ln.jsx)(ln.Fragment,{children:(0,ln.jsxs)(H.Row,{className:"align-items-center w-100",children:[(0,ln.jsx)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.PersonSearchPageExtended,{person:g,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){_(e)}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t,n,s;if(S(e),e&&e.id&&e.id>0&&O(e),e&&(E===e.idCode||E===(null===(t=e.id)||void 0===t?void 0:t.toString())||E===e.regCode)||e&&D.code===e.regCode)i.owner=null===(s=e.id)||void 0===s?void 0:s.toString(),r((e=>({...e})));else if(e||E.substring(4)!==(null===(n=N.id)||void 0===n?void 0:n.toString()))e||(i.owner=void 0,r((e=>({...e}))));else{var o;i.owner=null===(o=N.id)||void 0===o?void 0:o.toString(),r((e=>({...e})))}}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>x(e),isShowError:e=>{b(e),e||v({header:"",message:""})},searchOnBlur:!0,ref:M,isOptionalField:!0,isPrivateOwner:i.isPrivatePerson}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.owner"}),info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,ln.jsx)(H.Col,{xs:20,md:20,lg:10,children:rs(i.isPrivatePerson,(function(e){r((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","",{xs:20,md:1})})]})})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{onClick:()=>(l([]),r(n),M.current.clearTypeahead(),void S({})),colourScheme:"light",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.epmty_fields"})})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(f.length>0||y),squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.search"})})})]})]})},oo=e=>{const t=(0,V.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,B.useState)(n),[i,r]=(0,B.useState)(""),[a,l]=(0,B.useState)([]),[d,c]=(0,B.useState)([]),[u,p]=(0,B.useState)([]),[h]=(0,B.useState)(Qs([{code:wn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:wn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:wn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:wn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:wn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"},{code:wn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:wn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:wn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:wn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"},{code:wn.DO_DOKUSEIS_ALLKIRJASTAMISEL,value:"Allkirjastamisel"},{code:wn.DO_DOKUSEIS_VANA_VERSIOON,value:"Vana versioon"}].sort(((e,t)=>e.value.localeCompare(t.value))))),[m,g]=(0,B.useState)({}),[S,f]=(0,B.useState)(""),[I,T]=(0,B.useState)(!1),[v,E]=(0,B.useState)({code:"",value:""}),[_,y]=(0,B.useState)({}),[b,D]=(0,B.useState)(!1),x=(0,B.useRef)(),M=(0,fn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),N=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions)),O=(0,fn.useSelector)((e=>e.myViewsPage.detailSearch.documents));function A(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function U(e,t){s[t]=e.trim(),o((e=>({...e})))}function w(e){return!(!Tn()(e,"YYYY-MM-DD",!0).isValid()&&!Tn()(e,"D.M.YYYY",!0).isValid())}(0,B.useEffect)((()=>{if(M){const e=ls(M);c(e)}if(N){const e=cs([...N]);p(e)}}),[M,N]);const j={sm:20,md:8,lg:8};return(0,ln.jsxs)(H.Form,{onSubmit:()=>{i.length>0?D(!0):JSON.stringify(n)===JSON.stringify(s)?y({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),y({header:"",message:""}))},children:[_.header&&_.header.length>0&&_.message&&_.message.length>0&&(0,ln.jsx)(H.MessageBlock,{dismissible:!0,header:(0,ln.jsx)(V.FormattedMessage,{id:_.header}),onDismiss:()=>y({header:"",message:""}),theme:"danger",messages:[(0,ln.jsx)(V.FormattedMessage,{id:_.message})]}),O&&O.length>500&&(0,ln.jsx)(H.MessageBlock,{dismissible:!0,header:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,ln.jsxs)(H.Row,{className:"align-items-start",children:[(0,ln.jsxs)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.address_catastralUnit_ehrCode.extended",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:a}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.institution"})}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)("div",{className:"daterange_in_form",children:(0,ln.jsx)(H.DateRange,{onBlur:()=>{D(!0)},value:s.documentDate,onChange:e=>(e=>{""!==e.from&&!w(e.from)||""!==e.to&&!w(e.to)?r(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&Tn()(e.from)>Tn()(e.to)?r(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(Tn()(e.from)<Tn()("01.01.1990")||Tn()(e.from)>Tn()())||""!==e.to&&(Tn()(e.to)<Tn()("01.01.1990")||Tn()(e.to)>Tn()())?r(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:Tn()().format("DD.MM.YYYY")})):Tn()(e.to).diff(Tn()(e.from),"days")>367?r(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(r(""),D(!1)),o((t=>({...t,documentDate:e})))})(e)})}),errorMessage:b&&i.length>0?i:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.document_date"}),info:{content:"detailsearch.filter.tooltip.document_date",placement:"top-start"}})]}),(0,ln.jsxs)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:a}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:a}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.document_state"})})]})]}),!e.isNonAuthenticatedUser&&(0,ln.jsx)(H.Row,{children:(0,ln.jsx)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,ln.jsx)(H.FieldWrapper,{labelCol:j,component:(0,ln.jsx)(H.PersonSearchPageExtended,{person:m,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){f(e),v.code.length>0&&E({code:"",value:""})}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t;g(e),e&&(S===e.idCode||S===(null===(t=e.id)||void 0===t?void 0:t.toString())||S===e.regCode)||e&&v.code===e.regCode?(s.connectedPerson=e.id,o((e=>({...e})))):e||(s.connectedPerson=void 0,o((e=>({...e}))))}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>E(e),isShowError:e=>{T(e),e||y({header:"",message:""})},searchOnBlur:!0,ref:x,isOptionalField:!0}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.connected_person"}),info:{content:"detailsearch.filter.tooltip.connected_person.extended",placement:"top-start"}})})}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{onClick:()=>(l([]),o(n),x.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.epmty_fields"})})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.search"})})})]})]})},io=e=>{const t=(0,V.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,B.useState)(n),[i,r]=(0,B.useState)([]),[a,l]=(0,B.useState)([]),[d,c]=(0,B.useState)([]),[u,p]=(0,B.useState)(""),[h,m]=(0,B.useState)({}),[g,S]=(0,B.useState)(!1),f=(0,fn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,fn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings));function v(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function E(e,t){s[t]=e,o((e=>({...e})))}function _(e){return!(!Tn()(e,"YYYY-MM-DD",!0).isValid()&&!Tn()(e,"D.M.YYYY",!0).isValid())}(0,B.useEffect)((()=>{if(f){const e=ls(f);l(e)}if(I){const e=cs([...I]);c(e)}}),[f,I]);const y={sm:20,md:8,lg:8};return(0,ln.jsxs)(H.Form,{onSubmit:()=>{u.length>0?S(!0):JSON.stringify(n)===JSON.stringify(s)?m({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),m({header:"",message:""}))},children:[h.header&&h.header.length>0&&h.message&&h.message.length>0&&(0,ln.jsx)(H.MessageBlock,{dismissible:!0,header:(0,ln.jsx)(V.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,ln.jsx)(V.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,ln.jsx)(H.MessageBlock,{dismissible:!0,header:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,ln.jsxs)(H.Row,{className:"align-items-start",children:[(0,ln.jsxs)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,ln.jsx)(H.FieldWrapper,{labelCol:y,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:a,onSelect:e=>v(e,"documentType"),allSelection:!0,onRemoveItem:e=>v(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:y,component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>E(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,ln.jsx)(H.FieldWrapper,{labelCol:y,component:(0,ln.jsx)("div",{className:"daterange_in_form",children:(0,ln.jsx)(H.DateRange,{onChange:e=>(e=>{""!==e.from&&!_(e.from)||""!==e.to&&!_(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&Tn()(e.from)>Tn()(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(Tn()(e.from)<Tn()("01.01.1990")||Tn()(e.from)>Tn()())||""!==e.to&&(Tn()(e.to)<Tn()("01.01.1990")||Tn()(e.to)>Tn()())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:Tn()().format("DD.MM.YYYY")})):Tn()(e.to).diff(Tn()(e.from),"days")>367?p(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(p(""),S(!1)),o((t=>({...t,proceedingDate:e})))})(e),value:s.proceedingDate,onBlur:()=>{S(!0)}})}),errorMessage:g&&u.length>0?u:null,label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.proceeding_date"}),info:{content:"detailsearch.filter.tooltip.proceeding_date",placement:"top-start"}})]}),(0,ln.jsxs)(H.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,ln.jsx)(H.FieldWrapper,{labelCol:y,component:(0,ln.jsx)(H.Input,{name:"input",onChange:e=>E(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"})}),(0,ln.jsx)(H.FieldWrapper,{labelCol:y,component:(0,ln.jsx)(H.Multiselect,{name:"multiselect",options:d,onSelect:e=>v(e,"institutions"),allSelection:!0,onRemoveItem:e=>v(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,ln.jsx)(V.FormattedMessage,{id:"detailsearch.filter.label.institution"})})]})]}),(0,ln.jsxs)(H.Row,{children:[(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{onClick:()=>(r([]),void o(n)),colourScheme:"light",squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.epmty_fields"})})}),(0,ln.jsx)(H.Col,{children:(0,ln.jsx)(H.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,ln.jsx)(V.FormattedMessage,{id:"button.search"})})})]})]})},ro={EHITIS_SEISUND_KAVAN:["EHITIS_SEISUND_KAVAN","EHITIS_SEISUND_EHITAM_LUBA","EHITIS_SEISUND_MENETLUSES"],EHITIS_SEISUND_PYSTI:["EHITIS_SEISUND_PYSTI","EHITIS_SEISUND_EHITAMISEL"],EHITIS_SEISUND_OLEMA:["EHITIS_SEISUND_OLEMA","EHITIS_SEISUND_KASUTUSEL","EHITIS_SEISUND_KASUT_OSALINE","EHITIS_SEISUND_KASUT_LUBA_EIKEH","EHITIS_SEISUND_LAMMUT_LUBA","EHITIS_SEISUND_KASUT_MAAS","EHITIS_SEISUND_EBASEADUSLIK","EHITIS_SEISUND_MAARAMATA"],EHITIS_SEISUND_LAMEL:["EHITIS_SEISUND_LAMEL","EHITIS_SEISUND_LAMMUTAMISEL"],EHITIS_SEISUND_LAMUT:["EHITIS_SEISUND_LAMUT","EHITIS_SEISUND_LAMMUTATUD"],EHITIS_SEISUND_REATA:["EHITIS_SEISUND_REATA","EHITIS_SEISUND_EHITAM_LUBA_EIKEH"],EHITIS_SEISUND_KUSTU:["EHITIS_SEISUND_KUSTU","EHITIS_SEISUND_KUSTUTATUD","EHITIS_SEISUND_REG_OBJ_LOPP","EHITIS_SEISUND_ARHIIVIS"]};function ao(e){const t=function(e){return Fn(ro,e)}(e);return t?function(e){switch(e){case"EHITIS_SEISUND_KAVAN":return{name:"Kavandatav",type:"info"};case"EHITIS_SEISUND_PYSTI":return{name:"EHITIS_SEISUND_PYSTI",type:"info"};case"EHITIS_SEISUND_OLEMA":return{name:"On",type:"success"};case"EHITIS_SEISUND_LAMEL":return{name:"Lammutamisel",type:"info"};case"EHITIS_SEISUND_LAMUT":return{name:"Lammutatud",type:"default"};case"EHITIS_SEISUND_REATA":return{name:"Realiseerimata",type:"default"};case"EHITIS_SEISUND_KUSTU":return{name:"Kustutatud",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const lo=e=>{const t=(0,V.useIntl)(),[n,s]=(0,B.useState)([]),o=(0,fn.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,B.useEffect)((()=>{if(o&&o.length>0){const t=e.isAdminRole?o:o.filter((e=>"EHITIS_SEISUND_KUSTU"!==e.buildingState.code));s(t)}}),[o]);const i=[{id:"ehr_code",property:"ehrCode",size:130,isFrozen:!0,getValue:e=>e.ehrCode?e.ehrCode:"",getFormattedValue:t=>{const{generateLink:n}=e,s=t.ehrCode?n(ie,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,ln.jsx)(pn,{linkName:t.ehrCode,tooltipText:"detailsearch.tooltip.open_building",href:s||void 0}):""}},{id:"building_address",property:"buildingaddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingaddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingaddress&&null!==e.buildingaddress?e.buildingaddress.map((e=>(0,ln.jsx)("div",{children:e}))):""},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""}},{id:"building_state",property:"buildingState",size:130,getValue:e=>{var t;return null!==(t=e.buildingState)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingState&&null!==e.buildingState?(0,ln.jsx)(H.Status,{type:ao(e.buildingState.code).type,children:e.buildingState.value}):""},{id:"purpose_of_use",property:"purposeOfUse",size:150,getValue:e=>{var t,n;return null!==(t=null===(n=e.purposeOfUse)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"first_use_date",property:"firstUseDate",size:150,getValue:e=>{var t;return null!==(t=e.firstUseDate)&&void 0!==t?t:""}},{id:"under_area",property:"underArea",size:130,getValue:e=>e.underArea?e.underArea:""},{id:"floor_count",property:"floorCount",size:130,getValue:e=>e.floorCount?e.floorCount:""},{id:"ownership_type",property:"ownershipType",size:130,getValue:e=>{var t,n;return null!==(t=null===(n=e.ownershipType)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"owner",property:"owner",size:130,getValue:e=>{var t;return null!==(t=e.owner)&&void 0!==t?t:""},getFormattedValue:e=>e.owner?e.owner.map((e=>function(e){var t;const n=e.eesnimi?e.eesnimi+" "+e.perenimi:void 0,s=e.isikukood?(0,ln.jsxs)(ln.Fragment,{children:[(0,ln.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,ln.jsx)("div",{children:i}):n?(0,ln.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,ln.jsx)("div",{children:(0,ln.jsx)(H.TableComponent,{config:{thead:{headers:(e.isAdminPlusRole?i:i.slice(0,-1)).map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:t.formatMessage({id:"detailsearch.buildings.table.header."+e.id}),tooltip:{text:t.formatMessage({id:"detailsearch.buildings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:un,expandableRow:!1,isFilter:!1}},data:function(e){return e.map((e=>({buildingaddress:e.buildingaddress,buildingId:e.buildingId,buildingName:e.buildingName,buildingType:e.buildingType,ehrCode:e.ehrCode,firstUseDate:e.firstUseDate,owner:e.owner,ownershipType:e.ownershipType,purposeOfUse:e.purposeOfUse,buildingState:e.buildingState,floorCount:e.floorCount,underArea:e.underArea})))}(n),handleEvent:()=>!0})})},co="DD.MM.YYYY",uo="YYYY-MM-DD";class po{static dateToStr(e){return po.formatDate(co,e)}static dateToStrForDatepicker(e){return po.formatDate(uo,e)}static dateWithTimeToStr(e){return po.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?Tn()(t).format(e):""}static dateToMs(e,t){const n=Tn()(t,e);return t&&n.isValid()?n.valueOf():void 0}}const ho=e=>{var t,n,s,o,i,r;const a=(0,V.useIntl)(),[l,d]=(0,B.useState)([]),c=(0,fn.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions)),p=null!==(t=null===(n=e.userInfo)||void 0===n||null===(s=n.activeRole)||void 0===s?void 0:s.businessType)&&void 0!==t?t:"",h=null!==(o=null===(i=e.userInfo)||void 0===i||null===(r=i.activeRole)||void 0===r?void 0:r.businessId)&&void 0!==o?o:0;(0,B.useEffect)((()=>{c&&c.length>0&&d(c)}),[c]);const m=e.filterStateDocumentsSearch.buildingLocation,g=e.filterStateDocumentsSearch.buildingName;const S=m?m.toString().toLowerCase().replace(/[&|=;~!$>*%_()?.+:'"\\]/g,"").replace(/\t/g," ").replace(/\s{2,}/g," ").replace(/\s?-\s?/g,"-"):"";function f(e,t){const n=(s=function(e){return e.replace(/\btn\b/g,"").replace(/\btänav\b/g,"").replace(/\btee\b/g,"").replace(/\bmaantee\b/g,"").replace(/\bmnt\b/g,"").replace(/\bküla\b/g,"").replace(/\blinnaosa\b/g,"").replace(/\blinn\b/g,"").replace(/\bpuiestee\b/g,"").replace(/\bpst\b/g,"").replace(/\bvald\b/g,"").replace(/\balevik\b/g,"").replace(/\balev\b/g,"").replace(/\bpõik\b/g,"").replace(/\blõik\b/g,"")}(e),s.replaceAll("//","").replaceAll(",","").split(/\s+/g).reduce(((e,t)=>{if(Number.isNaN(Number(t[0]))&&Number.isNaN(Number(t[1])))e.push(t);else{const n=` ${t}`;e[e.length-1]+=n}return e}),[]));var s;const o=t.replace(/\s+/g," ").split(/\/\/\s+(?=[a-z]+\b)/gi);return n.every((e=>{const t=e.trim().split(/\s+/);return o.some((e=>t.every((t=>new RegExp(`(?<![\\/\\-])\\b${t}\\b`,"i").test(e)))))}))}const I=["tn","tänav","tee","maantee","mnt","küla","linnaosa","linn","puiestee","pst","vald","alevik","alev","põik","lõik"];function T(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>function(e,t){return I.some((n=>{const s=new RegExp(`\\b(\\w+)\\s+${n}\\b`,"i"),o=e.match(s);if(o){const e=o[1];return new RegExp(`\\b${e}\\s+${n}\\b`,"i").test(t)}return!1}))}(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}function v(e){const t=e.filter((e=>function(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>f(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}(S,e)));return I.some((e=>function(e){return!new RegExp(`\\b${e}\\b`,"gi").test(e)}(e)))?t.filter((e=>T(S,e))):t}function E(){return!Number.isNaN(Number(S))}function _(){if(S&&S.indexOf(", ")>-1){return S.split(", ").reverse().join(", ")}return S}function y(e){const t=e.buildingName,n=e.buildingAddress;return t&&n&&(n.some((e=>e.toLowerCase().split(" ").some((e=>t.some((t=>t.toLowerCase().includes(e)))))))||t.some((e=>e.toLowerCase().split(" ").some((e=>n.some((t=>t.toLowerCase().includes(e))))))))}function b(e){let t=0;if(e.buildingAddress&&e.buildingAddress.length>0&&e.buildingAddress[0].length<200){const n=S.replace(",","").split(" ");let s=e.buildingAddress[0].toLowerCase().split(", ");const o=new Set;s.forEach((e=>{const t=e.split(" ")[0];return o.add(t)})),s=Array.from(o),s.forEach((e=>(n.includes(e)&&(t+=1),t)))}else t=-1;return t}const D=new RegExp(`\\b${S}\\b(?![\\/\\-])`,"i"),x=new RegExp(`\\b${_()}\\b(?![\\/\\-])`,"i"),M=S.replace(",","").split(/(?:\/|\s)+/g);function N(e){const t=e.buildingAddress;return t?t.findIndex((e=>e.toLowerCase()===S||e.toLowerCase()===_()))>-1?"exact":t.findIndex((e=>D.test(e.toLowerCase())||x.test(e.toLowerCase())))>-1?"partial":t.findIndex((e=>{const t=e.toLowerCase().replace(",","").replace(/\/\//g," ");return M.every((e=>t.includes(e)))}))>-1?"vague":"other":""}const O=["exact","partial","vague","other"];function A(e){return e.map((e=>{return t=e,{...t,title:t.docId,addressWithBuilding:y(t),addressMatch:N(t),addressRank:b(t)};var t})).sort(((e,t)=>{const n=O.indexOf(e.addressMatch),s=O.indexOf(t.addressMatch);return n!==s?n-s:e.addressWithBuilding!==t.addressWithBuilding?""===g?e.addressWithBuilding?1:-1:e.addressWithBuilding?-1:1:t.addressRank-e.addressRank}))}const U=[{id:"doc_date",property:"docDate",size:130,getValue:e=>po.dateToStr(e.docDate),isFrozen:!0},{id:"reg_date",property:"regDate",size:130,getValue:e=>po.dateToStr(e.regDate)},{id:"doc_nr",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(ae,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,ln.jsx)(pn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:160,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,ln.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(ie,String(e),null,!1,!1,null):null;return(0,ln.jsxs)(ln.Fragment,{children:[(0,ln.jsx)(pn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,ln.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:130,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,ln.jsx)("div",{children:e}))):""},{id:"doc_state",property:"stateCode",size:180,getValue:e=>{var t;return null!==(t=e.stateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.stateCode&&null!==e.stateCode?(0,ln.jsx)(H.Status,{type:Ln(e.stateCode).type,children:Ln(e.stateCode).name}):""},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{var n;const{generateLink:s}=e,o=Ns(null===(n=t.doty)||void 0===n?void 0:n.toString()),i=t.proceedingNr?s(o,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr?p===le.MKM||t.institutionId&&h===t.institutionId?(0,ln.jsx)(pn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:i||void 0}):t.proceedingNr:""}},{id:"presenter",property:"presenter",size:130,getValue:e=>{var t;return null!==(t=e.presenter)&&void 0!==t?t:""},getFormattedValue:e=>e.presenter?e.presenter.map(((t,n)=>(0,ln.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,ln.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,ln.jsx)(H.TableComponent,{config:{thead:{headers:U.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:a.formatMessage({id:"detailsearch.documents.table.header."+e.id}),tooltip:{text:a.formatMessage({id:"detailsearch.documents.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):null==e?void 0:e.getValue(t)}))),icons:un,expandableRow:!1,isFilter:!1}},data:function(e){let t;if(0===(null==m?void 0:m.indexOf('"'))&&(null==m?void 0:m.lastIndexOf('"'))===m.length-1){const n=v(e);t=E()||S.length<2?n:A(n)}else t=E()||S.length<2?e:A(e);const n=t.map((e=>{var t,n,s,o;return{docId:e.docId,docDate:null!==(t=po.dateToMs(co,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=po.dateToMs(co,e.regDate))&&void 0!==n?n:"",deadlineDate:e.deadlineDate,docNr:e.docNr,documentType:e.documentType,doty:e.doty,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress,state:e.state,stateCode:e.stateCode,proceedingNr:e.proceedingNr,presenter:e.presenter,institutionId:e.institutionId,institutionName:null!==(s=null===(o=u.find((t=>t.id===e.institutionId)))||void 0===o?void 0:o.regName)&&void 0!==s?s:""}}));return n}(l),handleEvent:()=>!0})},mo=e=>{var t,n,s,o;const i=(0,V.useIntl)(),[r,a]=(0,B.useState)([]),l=(0,fn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,fn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,fn.useSelector)((e=>e.myViewsPage.filter.institutions)),u=e.userInfo&&e.userInfo.activeRole&&null!==(t=e.userInfo.activeRole)&&void 0!==t&&t.businessType?null===(n=e.userInfo.activeRole)||void 0===n?void 0:n.businessType:"",p=e.userInfo&&e.userInfo.activeRole&&null!==(s=e.userInfo.activeRole)&&void 0!==s&&s.businessId?null===(o=e.userInfo.activeRole)||void 0===o?void 0:o.businessId:0;(0,B.useEffect)((()=>{l&&l.length>0&&a(l)}),[l]);const h=[{id:"date_start",property:"dateStart",size:130,getValue:e=>po.dateToStr(e.dateStart),isFrozen:!0},{id:"date_end",property:"dateEnd",size:130,getValue:e=>po.dateToStr(e.dateEnd)},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=Ns(t.doty),o=t.proceedingNr?n(s,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr&&null!==t.proceedingNr?"MKM"===u||t.institutionId&&p===t.institutionId?(0,ln.jsx)(pn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:o||void 0}):t.proceedingNr:""}},{id:"proceeding_state",property:"proceedingState",size:200,getValue:e=>{var t;return null!==(t=e.proceedingStateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.proceedingStateCode&&null!==e.proceedingStateCode?(0,ln.jsx)(H.Status,{type:_s(e.proceedingStateCode).type,children:_s(e.proceedingStateCode).name}):""},{id:"document",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(ae,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,ln.jsx)(pn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,ln.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode&&null!==t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(ie,String(e),null,!1,!1,null):null;return(0,ln.jsxs)(ln.Fragment,{children:[(0,ln.jsx)(pn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,ln.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,ln.jsx)("div",{children:e}))):""},{id:"proceeding_name",property:"proceedingName",size:160,getValue:e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""}},{id:"supervisor",property:"supervisorName",size:130,getValue:e=>{var t;return null!==(t=e.supervisorName)&&void 0!==t?t:""}},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}},{id:"archived",property:"archived",size:130,getValue:e=>e.archived&&"2"===e.archived?"Jah":"Ei"}];return(0,ln.jsx)(H.TableComponent,{config:{thead:{headers:h.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:i.formatMessage({id:"detailsearch.proceedings.table.header."+e.id}),tooltip:{text:i.formatMessage({id:"detailsearch.proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:un,expandableRow:!1,isFilter:!1}},data:function(e){const t=e.map((e=>{var t,n,s,o,i,r;return{proceedingId:e.proceedingId,dateStart:null!==(t=po.dateToMs(co,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=po.dateToMs(co,e.dateEnd))&&void 0!==n?n:"",proceedingNr:e.proceedingNr,proceedingState:e.proceedingState,proceedingStateCode:e.proceedingStateCode,docNr:e.docNr,documentType:null!==(s=null===(o=d.find((t=>t.id.toString()===e.documentType)))||void 0===o?void 0:o.name)&&void 0!==s?s:"",doty:e.documentType,proceedingName:e.proceedingName,institutionId:e.institutionId,institutionName:null!==(i=null===(r=c.find((t=>t.id===e.institutionId)))||void 0===r?void 0:r.regName)&&void 0!==i?i:"",supervisorId:e.supervisorId,supervisorName:e.supervisorName,archived:e.archived,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress}}));return t}(r),handleEvent:()=>!0})},go="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:go,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class fo extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Io="https://example.com",To=function(e,t,n){if(null==n)throw new fo(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},vo=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},Eo=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},_o=function(e){return e.pathname+e.search+e.hash},yo=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},bo=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};To("buildingChangesGet","ehrCode",t),To("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.dok_nr=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};To("buildingCompareGet","doEhitisId1",t),To("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.do_ehitis_id1=t),void 0!==n&&(a.do_ehitis_id2=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},buildingDataGet:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/buildingData",Io);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...i},d={};void 0!==t&&(d.ehr_code=t),void 0!==n&&(d.ehr_id=n),void 0!==s&&(d.version=s),void 0!==o&&(d.json=o),vo(r,d,i.query);let c=a&&a.headers?a.headers:{};return l.headers={...c,...i.headers},{url:_o(r),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.ehr_id=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",Io);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehr_code=t),vo(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:_o(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};To("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.timestamp=t instanceof Date?t.toISOString():t),void 0!==n&&(a.offset=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",Io);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.id=t),vo(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:_o(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return yo(i,_e(),go,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return yo(i,_e(),go,e)},async buildingDataGet(n,s,o,i,r){const a=await t.buildingDataGet(n,s,o,i,r);return yo(a,_e(),go,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return yo(o,_e(),go,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return yo(o,_e(),go,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return yo(o,_e(),go,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return yo(o,_e(),go,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return yo(i,_e(),go,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return yo(o,_e(),go,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return yo(o,_e(),go,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return yo(i,_e(),go,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return yo(o,_e(),go,e)}}};class Do extends So{buildingChangesGet(e,t,n){return bo(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return bo(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return bo(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return bo(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return bo(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return bo(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return bo(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return bo(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return bo(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return bo(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return bo(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return bo(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const xo=e=>{var t,n,s,o;let{buildingsActualDataApiEndpoint:i,classifierApiEndpoint:r,linkGen:l,generateLink:u,myViewsApiEndpoint:p,searchType:h,userApiEndpoint:m,userInfo:g}=e;const S=(0,fn.useDispatch)(),f=["MKM","KOV","TJA"].includes(g&&g.activeRole&&null!==(t=g.activeRole)&&void 0!==t&&t.businessType?null===(n=g.activeRole)||void 0===n?void 0:n.businessType:""),I=["MKM","KOV","TJA","N","KT"].includes(g&&g.activeRole&&null!==(s=g.activeRole)&&void 0!==s&&s.businessType?null===(o=g.activeRole)||void 0===o?void 0:o.businessType:""),T=!g,[v,E]=(0,B.useState)({}),[_,y]=(0,B.useState)({}),[b,D]=(0,B.useState)({}),[x,M]=(0,B.useState)([]),[N,O]=(0,B.useState)([]),[j,C]=(0,B.useState)([]),[L,P]=(0,B.useState)(!1),[R,K]=(0,B.useState)(!1),[F,k]=(0,B.useState)(!1),Y=new we(new It({basePath:r})),G=new He(new Qe({basePath:m})),V=new ht(new It({basePath:p})),J=new $e(new Qe({basePath:m})),W=new Do(new It({basePath:i})),q=async(e,t,n)=>{try{const s=await J.searchPerson(e,t,n);return s.data}catch(e){console.log("= = = callSearchPerson error occured:",e)}};return(0,B.useEffect)((()=>{Y.getAllDocumentTypes().then((e=>{S(a(e.data))})).catch((e=>{console.log(e)})),G.getJurKovPersons().then((e=>{S(d(e.data))})).catch((e=>{console.log(e)})),Y.getUsageClassifierTypes().then((e=>{S(c(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,B.useEffect)((()=>{if(Object.keys(b).length>0){k(!0);V.searchDetailProceedings(b).then((e=>{S(w(e.data)),C(e.data),k(!1)})).catch((e=>{console.log(e),k(!1)}))}}),[b]),(0,B.useEffect)((()=>{if(Object.keys(_).length>0){K(!0);V.searchDetailDocuments(_).then((e=>{S(U(e.data)),O(e.data),K(!1)})).catch((e=>{console.log(e),K(!1)}))}}),[_]),(0,B.useEffect)((()=>{if(Object.keys(v).length>0){let e;P(!0),e=I?W.buildingOwnerSearchPost(v):W.buildingSearchPost(v),e.then((e=>{S(A(e.data)),M(e.data),P(!1)})).catch((e=>{console.log(e),P(!1)}))}}),[v,I]),(0,ln.jsxs)("div",{children:[(0,ln.jsx)(H.Section,{collapsed:h!==se,title:"detailsearch.buildings_detail_search",children:(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,ln.jsx)(so,{onSubmit:e=>{E(e)},isAdminRole:f,isAdminPlusRole:I,callSearchPerson:q})}),Object.keys(v).length>0&&0===x.length&&!L?(0,ln.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,ln.jsx)(H.Text,{raw:"detailsearch.empty_search_result"})}):L?(0,ln.jsx)(H.SectionLoader,{}):(0,ln.jsx)(lo,{linkGen:l,generateLink:u,isAdminRole:f,isAdminPlusRole:I})]})}),(0,ln.jsx)(H.Section,{collapsed:"DOCUMENTS_SEARCH"!==h,title:"detailsearch.documents_detail_search",children:(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,ln.jsx)(oo,{onSubmit:e=>{y(e)},callSearchPerson:q,isNonAuthenticatedUser:T})}),Object.keys(_).length>0&&0===N.length&&!R?(0,ln.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,ln.jsx)(H.Text,{raw:"detailsearch.empty_search_result"})}):R?(0,ln.jsx)(H.SectionLoader,{}):(0,ln.jsx)(ho,{linkGen:l,generateLink:u,userInfo:g,filterStateDocumentsSearch:_})]})}),f&&(0,ln.jsx)(H.Section,{collapsed:"PROCEEDINGS_SEARCH"!==h,title:"detailsearch.proceedings_detail_search",children:(0,ln.jsxs)("div",{children:[(0,ln.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,ln.jsx)(io,{onSubmit:e=>{D(e)}})}),Object.keys(b).length>0&&0===j.length&&!F?(0,ln.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,ln.jsx)(H.Text,{raw:"detailsearch.empty_search_result"})}):F?(0,ln.jsx)(H.SectionLoader,{}):(0,ln.jsx)(mo,{linkGen:l,userInfo:g,generateLink:u})]})})]})};module.exports=s})();
|
|
2
|
+
(()=>{"use strict";var e={20:(e,t,n)=>{var s=n(953),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,n){var s,i={},d=null,c=null;for(s in void 0!==n&&(d=""+n),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)r.call(t,s)&&!l.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===i[s]&&(i[s]=t[s]);return{$$typeof:o,type:e,key:d,ref:c,props:i,_owner:a.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},848:(e,t,n)=>{e.exports=n(20)},953:e=>{e.exports=require("react")}},t={};function n(s){var o=t[s];if(void 0!==o)return o.exports;var i=t[s]={exports:{}};return e[s](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};n.r(s),n.d(s,{DetailSearch:()=>No,MyAdministrativeProceedings:()=>Tn,MyApprovals:()=>Xs,MyDocuments:()=>ys,MyInvolvements:()=>eo,MyOpinions:()=>Qs,MyProceedings:()=>zs,documentsReducer:()=>T,filterReducer:()=>p,myOperationsReducer:()=>N,proceedingsReducer:()=>b,rootReducer:()=>B});const o=require("@reduxjs/toolkit");const i=(0,o.createSlice)({name:"filter",initialState:{classifiers:{},documentTypes:[],institutionUsers:[],institutions:[],usageClassifierTypes:[],heritageClassifierTypes:[]},reducers:{classifiersLoaded:(e,t)=>{e.classifiers=t.payload},documentTypesLoaded:(e,t)=>{e.documentTypes=t.payload},institutionUsersLoaded:(e,t)=>{e.institutionUsers=t.payload},institutionsLoaded:(e,t)=>{e.institutions=t.payload},usageClassifierTypesLoaded:(e,t)=>{e.usageClassifierTypes=t.payload},heritageClassifierTypesLoaded:(e,t)=>{e.heritageClassifierTypes=t.payload}}}),{classifiersLoaded:r,documentTypesLoaded:a,institutionUsersLoaded:l,institutionsLoaded:d,usageClassifierTypesLoaded:c,heritageClassifierTypesLoaded:u}=i.actions,p=i.reducer;const h=(0,o.createSlice)({name:"documents",initialState:{workingDocuments:[],signingDocuments:[],finishedDocuments:[],allowedDocumentTypesToStart:[]},reducers:{workingDocumentsLoaded:(e,t)=>{e.workingDocuments=t.payload},signingDocumentsLoaded:(e,t)=>{e.signingDocuments=t.payload},finishedDocumentsLoaded:(e,t)=>{e.finishedDocuments=t.payload},deleteDocument(e,t){e.workingDocuments=e.workingDocuments.filter((e=>e.docNr!==t.payload))},allowedDocumentTypesLoaded:(e,t)=>{e.allowedDocumentTypesToStart=t.payload}}}),{workingDocumentsLoaded:m,signingDocumentsLoaded:g,finishedDocumentsLoaded:S,deleteDocument:f,allowedDocumentTypesLoaded:I}=h.actions,T=h.reducer;const v=(0,o.createSlice)({name:"proceedings",initialState:{myProceedings:[],proceedingsToComment:[],incomingDocuments:[]},reducers:{myProceedingsLoaded:(e,t)=>{e.myProceedings=t.payload},proceedingsToCommentLoaded:(e,t)=>{e.proceedingsToComment=t.payload},incomingDocumentsLoaded:(e,t)=>{e.incomingDocuments=t.payload}}}),{myProceedingsLoaded:E,proceedingsToCommentLoaded:y,incomingDocumentsLoaded:_}=v.actions,b=v.reducer;const D=(0,o.createSlice)({name:"myOperations",initialState:{myOperations:[],toCommentOperations:[],operationInvitations:[]},reducers:{myOperationsLoaded:(e,t)=>{e.myOperations=t.payload},toCommentOperationsLoaded:(e,t)=>{e.toCommentOperations=t.payload},operationInvitationsLoaded:(e,t)=>{e.operationInvitations=t.payload}}}),{myOperationsLoaded:x,toCommentOperationsLoaded:M,operationInvitationsLoaded:O}=D.actions,N=D.reducer;const A=(0,o.createSlice)({name:"detailSearch",initialState:{buildings:[],documents:[],proceedings:[]},reducers:{buildingsLoaded:(e,t)=>{e.buildings=t.payload},documentsLoaded:(e,t)=>{e.documents=t.payload},proceedingsLoaded:(e,t)=>{e.proceedings=t.payload}}}),{buildingsLoaded:U,documentsLoaded:w,proceedingsLoaded:j}=A.actions,C=A.reducer,L={notices:[]},P=(0,o.createSlice)({name:"notification",initialState:L,reducers:{setNotifications:(e,t)=>{e.notices=t.payload},removeNotification:(e,t)=>{const n=e.notices.filter((e=>e.id!==t.payload));e.notices=n},cleanState:e=>L}}),R=(0,o.createSelector)((e=>e.myViewsPage.notifications.notices),(e=>e)),{cleanState:K,setNotifications:F,removeNotification:k}=P.actions,Y=P.reducer,B=(0,o.combineReducers)({filter:p,myDocuments:T,myProceedings:b,myOperations:N,detailSearch:C,notifications:Y});var G=n(953),V=n.n(G);const H=require("react-intl"),J=require("ehr-components"),W="SIGNING_DOCUMENTS",q="WORKING_DOCUMENTS",$="FINISHED_DOCUMENTS",z="INCOMING_DOCUMENTS",X="MY_APPROVALS",Q="MY_OPINIONS",Z="MY_INVOLVEMENTS",ee="MY_OPERATIONS",te="OPERATIONS_TO_COMMENT",ne="OPERATION_INVITATIONS",se="PROCEEDINGS_TO_COMMENT",oe="BUILDINGS_SEARCH";let ie=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const re="BUILDING",ae="PROCEEDING",le="DOCUMENT";let de=function(e){return e.KOV="KOV",e.MKM="MKM",e.A="A",e.N="N",e.KT="KT",e.JUR="JUR",e.AMAS="AMAS",e.TJA="TJA",e}({});let ce=function(e){return e.MENTOIMLIIK_AUTO_REG="MENTOIMLIIK_AUTO_REG",e.MENTOIMLIIK_KAASAMINE="MENTOIMLIIK_KAASAMINE",e.MENTOIMLIIK_MASSKAASAMINE="MENTOIMLIIK_MASSKAASAMINE",e.MENTOIMLIIK_YKSIKKAASAMINE="MENTOIMLIIK_YKSIKKAASAMINE",e.MENTOIMLIIK_ARVAMUS="MENTOIMLIIK_ARVAMUS",e.MENTOIMLIIK_VALINE_KOOSK="MENTOIMLIIK_VALINE_KOOSK",e.MENTOIMLIIK_SISENE_KOOSK="MENTOIMLIIK_SISENE_KOOSK",e.MENTOIMLIIK_KOOSK="MENTOIMLIIK_KOOSK",e.MENTOIMLIIK_MARKUS_TAIEND="MENTOIMLIIK_MARKUS_TAIEND",e.MENTOIMLIIK_MEN_MARKUS="MENTOIMLIIK_MEN_MARKUS",e.MENTOIMLIIK_EHIT_KK_RING="MENTOIMLIIK_EHIT_KK_RING",e.MENTOIMLIIK_ADS="MENTOIMLIIK_ADS",e.MENTOIMLIIK_ADS_SAADA="MENTOIMLIIK_ADS_SAADA",e.MENTOIMLIIK_ADS_ESIT="MENTOIMLIIK_ADS_ESIT",e.MENTOIMLIIK_AVALIK="MENTOIMLIIK_AVALIK",e.MENTOIMLIIK_AVALIK_TAGASISIDE="MENTOIMLIIK_AVALIK_TAGASISIDE",e.MENTOIMLIIK_RAHV_KAASAMINE="MENTOIMLIIK_RAHV_KAASAMINE",e.MENTOIMLIIK_KAAS_TAGASISIDE="MENTOIMLIIK_KAAS_TAGASISIDE",e.MENTOIMLIIK_ALLKIRJASTAMINE="MENTOIMLIIK_ALLKIRJASTAMINE",e.MENTOIMLIIK_KMH_PR="MENTOIMLIIK_KMH_PR",e.MENTOIMLIIK_KMH_AR="MENTOIMLIIK_KMH_AR",e}({});const ue="12975",pe="12976",he="11274",me="11275",ge="12977",Se="12978",fe=["11272","12972",ue,"12974",Se,me],Ie=["11273","12973",pe,"12971",ge,he],Te=[ue,pe],ve={[pe]:ge,[ue]:Se},Ee={[pe]:he,[ue]:me},ye=require("axios");var _e=n.n(ye);const be="https://devkluster.ehr.ee".replace(/\/+$/,"");class De{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:be,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class xe extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Me="https://example.com",Oe=function(e,t,n){if(null==n)throw new xe(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Ne=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},Ae=function(e){return e.pathname+e.search+e.hash},Ue=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},we=function(e){const t=function(e){return{getAllDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/alldocumenttypes",Me);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ae(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",Me);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ae(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Oe("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,Me);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ne(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ae(o),options:r}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Oe("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,Me);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ne(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ae(o),options:r}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Oe("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,Me);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ne(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ae(o),options:r}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",Me);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ae(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",Me);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ae(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Me);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ae(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",Me);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ae(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",Me);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ne(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ae(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return Ue(s,_e(),be,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return Ue(s,_e(),be,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return Ue(o,_e(),be,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return Ue(o,_e(),be,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return Ue(o,_e(),be,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return Ue(s,_e(),be,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return Ue(s,_e(),be,e)},async getHealth(n){const s=await t.getHealth(n);return Ue(s,_e(),be,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return Ue(s,_e(),be,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return Ue(s,_e(),be,e)}}};class je extends De{getAllDocumentTypes(e){return we(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return we(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return we(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return we(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return we(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return we(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return we(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return we(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return we(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return we(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class Ce{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Le="http://localhost:8080".replace(/\/+$/,"");class Pe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Re extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Ke="https://example.com",Fe=function(e,t,n){if(null==n)throw new Re(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function ke(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>ke(e,t,n))):Object.keys(t).forEach((s=>ke(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Ye=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];ke(t,s),e.search=t.toString()},Be=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Ge=function(e){return e.pathname+e.search+e.hash},Ve=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}};const He=function(e){const t=function(e){return{getJurKovPersons:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/kov",Ke);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ye(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ge(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Fe("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Fe("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,Ke);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ye(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ge(i),options:a}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return Ve(s,_e(),Le,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return Ve(o,_e(),Le,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return Ve(o,_e(),Le,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return Ve(i,_e(),Le,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return Ve(o,_e(),Le,e)}}};class Je extends Pe{getJurKovPersons(e){return He(this.configuration).getJurKovPersons(e).then((e=>e(this.axios,this.basePath)))}getJurPersonCoordRelJurs(e,t){return He(this.configuration).getJurPersonCoordRelJurs(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByEHAKCode(e,t){return He(this.configuration).getUserPossibleProceedingSupervisorsByEHAKCode(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n){return He(this.configuration).getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByJurId(e,t){return He(this.configuration).getUserPossibleProceedingSupervisorsByJurId(e,t).then((e=>e(this.axios,this.basePath)))}}const We=function(e){const t=function(e){return{addAllyksusToJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person/jur/addAllyksus",Ke);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ye(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Be(t,i,e),{url:Ge(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",Ke);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ye(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Be(t,i,e),{url:Ge(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Fe("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),r=new URL(i,Ke);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={},c={};void 0!==n&&(c.searchFromAll=n),d["Content-Type"]="application/json",Ye(r,c);let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...o.headers},l.data=Be(s,l,e),{url:Ge(r),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Fe("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,Ke);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ye(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Be(n,a,e),{url:Ge(i),options:a}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",Ke);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ye(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ge(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",Ke);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ye(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ge(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",Ke);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ye(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ge(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",Ke);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ye(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ge(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"PUT",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Fe("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,Ke);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ye(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Be(n,a,e),{url:Ge(i),options:a}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return Ve(o,_e(),Le,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return Ve(o,_e(),Le,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return Ve(o,_e(),Le,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const r=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return Ve(r,_e(),Le,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return Ve(i,_e(),Le,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return Ve(s,_e(),Le,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return Ve(s,_e(),Le,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return Ve(s,_e(),Le,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return Ve(o,_e(),Le,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return Ve(o,_e(),Le,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return Ve(o,_e(),Le,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return Ve(o,_e(),Le,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return Ve(o,_e(),Le,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return Ve(s,_e(),Le,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return Ve(o,_e(),Le,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return Ve(o,_e(),Le,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return Ve(i,_e(),Le,e)}}};class qe extends Pe{addAllyksusToJurPerson(e,t){return We(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return We(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return We(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return We(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return We(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return We(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return We(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return We(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return We(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return We(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return We(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return We(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return We(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return We(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return We(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return We(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return We(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const $e=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Fe("searchPerson","input",t);const i=new URL("/search/searchPerson",Ke);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...o},l={};void 0!==t&&(l.input=t),void 0!==n&&(l.xRoad=n),void 0!==s&&(l.isPrivate=s),Ye(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...o.headers},{url:Ge(i),options:a}}}}(e);return{async searchPerson(n,s,o,i){const r=await t.searchPerson(n,s,o,i);return Ve(r,_e(),Le,e)}}};class ze extends Pe{searchPerson(e,t,n,s){return $e(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const Xe=function(e){const t=function(e){return{addRoleToUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/addrole",Ke);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ye(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Be(t,i,e),{url:Ge(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",Ke);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ye(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Be(t,i,e),{url:Ge(s),options:i}},appointSubstituteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user-substitution/appoint-substitute",Ke);let o;e&&(o=e.baseOptions);const i={method:"PUT",...o,...n},r={"Content-Type":"application/json"};Ye(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Be(t,i,e),{url:Ge(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",Ke);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ye(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ge(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Ke);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ye(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ge(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Fe("getJurUsersWithoutGivenRole","personId",t),Fe("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,Ke);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ye(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ge(i),options:a}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",Ke);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.searchInput=t),Ye(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Ge(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Fe("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Ke);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ye(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ge(o),options:r}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Fe("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Ke);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};void 0!==n&&(l.valid=n),Ye(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...s.headers},{url:Ge(i),options:a}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Fe("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Ke);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ye(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Be(n,a,e),{url:Ge(i),options:a}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Fe("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,Ke);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ye(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Be(n,a,e),{url:Ge(i),options:a}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return Ve(o,_e(),Le,e)},async addUser(n,s){const o=await t.addUser(n,s);return Ve(o,_e(),Le,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return Ve(o,_e(),Le,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return Ve(o,_e(),Le,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return Ve(o,_e(),Le,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return Ve(o,_e(),Le,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return Ve(s,_e(),Le,e)},async getHealth(n){const s=await t.getHealth(n);return Ve(s,_e(),Le,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return Ve(o,_e(),Le,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return Ve(i,_e(),Le,e)},async getUser(n,s){const o=await t.getUser(n,s);return Ve(o,_e(),Le,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return Ve(o,_e(),Le,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return Ve(o,_e(),Le,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return Ve(i,_e(),Le,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return Ve(i,_e(),Le,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return Ve(i,_e(),Le,e)}}};class Qe extends Pe{addRoleToUser(e,t){return Xe(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return Xe(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return Xe(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return Xe(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return Xe(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return Xe(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return Xe(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Xe(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return Xe(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return Xe(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return Xe(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return Xe(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return Xe(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return Xe(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return Xe(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return Xe(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class Ze{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const et="http://localhost:8080".replace(/\/+$/,"");class tt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:et,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();var s;(this.basePath=t,this.axios=n,e)&&(this.configuration=e,this.basePath=null!==(s=e.basePath)&&void 0!==s?s:t)}}class nt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const st={},ot="https://example.com",it=function(e,t,n){if(null==n)throw new nt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function rt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>rt(e,t,n))):Object.keys(t).forEach((s=>rt(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const at=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];rt(t,s),e.search=t.toString()},lt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},dt=function(e){return e.pathname+e.search+e.hash},ct=function(e,t,n,s){return function(){var o;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const a={...e.options,url:(i.defaults.baseURL?"":null!==(o=null==s?void 0:s.basePath)&&void 0!==o?o:r)+e.url};return i.request(a)}},ut=function(e){const t=function(e){return{findIncomingBaseDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("findIncomingBaseDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}},findWorkingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("findWorkingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}}}}(e);return{async findIncomingBaseDocuments(n,s){var o,i,r;const a=await t.findIncomingBaseDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["BaseMyDocumentsApi.findIncomingBaseDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)},async findWorkingDocuments(n,s){var o,i,r;const a=await t.findWorkingDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["BaseMyDocumentsApi.findWorkingDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)}}};class pt extends tt{findIncomingBaseDocuments(e,t){return ut(this.configuration).findIncomingBaseDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments(e,t){return ut(this.configuration).findWorkingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}}const ht=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}}}}(e);return{async searchDetailBuildings(n,s){var o,i,r;const a=await t.searchDetailBuildings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["DetailSearchesApi.searchDetailBuildings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)},async searchDetailDocuments(n,s){var o,i,r;const a=await t.searchDetailDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["DetailSearchesApi.searchDetailDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)},async searchDetailProceedings(n,s){var o,i,r;const a=await t.searchDetailProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["DetailSearchesApi.searchDetailProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)}}};class mt extends tt{searchDetailBuildings(e,t){return ht(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return ht(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return ht(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const gt=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}}}}(e);return{async findOperationInvitations(n,s){var o,i,r;const a=await t.findOperationInvitations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["MyOperationsApi.findOperationInvitations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)},async findOperations(n,s){var o,i,r;const a=await t.findOperations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["MyOperationsApi.findOperations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)},async findOperationsToComment(n,s){var o,i,r;const a=await t.findOperationsToComment(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["MyOperationsApi.findOperationsToComment"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)}}};class St extends tt{findOperationInvitations(e,t){return gt(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return gt(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return gt(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const ft=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};it("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",ot);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};at(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=lt(t,i,e),{url:dt(s),options:i}}}}(e);return{async findAreaProceedings(n,s){var o,i,r;const a=await t.findAreaProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["MyProceedingsApi.findAreaProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)},async findProceedings(n,s){var o,i,r;const a=await t.findProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=st["MyProceedingsApi.findProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ct(a,_e(),et,e)(t,d||n)}}};class It extends tt{findAreaProceedings(e,t){return ft(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return ft(this.configuration).findProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}class Tt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.serverIndex=e.serverIndex,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const vt="http://localhost:8080".replace(/\/+$/,"");class Et{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class yt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const _t="https://example.com",bt=function(e,t,n){if(null==n)throw new yt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Dt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function xt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>xt(e,t,n))):Object.keys(t).forEach((s=>xt(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Mt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];xt(t,s),e.search=t.toString()},Ot=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Nt=function(e){return e.pathname+e.search+e.hash},At=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const Ut=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("addAuthz","documentType",t),bt("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Mt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Mt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}},autoUpdateOwnershipType:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/updateOwnershipType",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Mt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}},createDoDokuDokuRel:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("createDoDokuDokuRel","documentId",t),bt("createDoDokuDokuRel","addEntityDto",n);const o="/document/{documentId}/createDoDokuDokuRel".replace("{documentId}",encodeURIComponent(String(t))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await Dt(l,e),l["Content-Type"]="application/json",Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ot(n,a,e),{url:Nt(i),options:a}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("createDocument","documentType",t);const o="/document/{documentType}".replace("{documentType}",encodeURIComponent(String(t))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await Dt(l,e),l["Content-Type"]="application/json",Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ot(n,a,e),{url:Nt(i),options:a}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("createNewVersion","documentType",t),bt("createNewVersion","applicationNumber",n),bt("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Dt(d,e),d["Content-Type"]="application/json",Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ot(s,l,e),{url:Nt(r),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("deleteApplicationByNumber","documentType",t),bt("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"DELETE",...r,...s},l={};await Dt(l,e),Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},endProceedingCircleDocuments:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("endProceedingCircleDocuments","documentType",t),bt("endProceedingCircleDocuments","applicationNumber",n),bt("endProceedingCircleDocuments","proceedingId",s);const i="/document/{documentType}/{applicationNumber}/proceeding/{proceedingId}/endCircle".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingId}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Dt(d,e),Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},getAccessRights:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("getAccessRights","documentType",t),bt("getAccessRights","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/rights".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await Dt(l,e),Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,_t);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await Dt(a,e),Mt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Nt(o),options:r}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("getApplicationByNumber","documentType",t),bt("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await Dt(l,e),Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("getApplicationByNumberOld","ehrCode",t),bt("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await Dt(l,e),Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("getApplicationByNumberWithVersion","documentType",t),bt("getApplicationByNumberWithVersion","applicationNumber",n),bt("getApplicationByNumberWithVersion","version",s);const i="/document/{documentType}/{applicationNumber}/{version}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...o},d={};await Dt(d,e),Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},getApplicationStateFee:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("getApplicationStateFee","documentType",t),bt("getApplicationStateFee","applicationNumber",n),bt("getApplicationStateFee","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Dt(d,e),d["Content-Type"]="application/json",Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ot(s,l,e),{url:Nt(r),options:l}},getApplicationStateFeeOfVersion:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};bt("getApplicationStateFeeOfVersion","documentType",t),bt("getApplicationStateFeeOfVersion","applicationNumber",n),bt("getApplicationStateFeeOfVersion","version",s),bt("getApplicationStateFeeOfVersion","applicationDto",o);const r="/document/{documentType}/{applicationNumber}/{version}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),a=new URL(r,_t);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={};await Dt(c,e),c["Content-Type"]="application/json",Mt(a,{});let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=Ot(o,d,e),{url:Nt(a),options:d}},getDocumentFileRels:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt("getDocumentFileRels","docNr",t);const s=new URL("/document/fileRels",_t);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={},a={};await Dt(r,e),void 0!==t&&(a.docNr=t),Mt(s,a);let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},{url:Nt(s),options:i}},getDotysBasedOnUserRights:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/document/starting_rights",_t);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehrCode=t),Mt(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Nt(s),options:i}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Mt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}},getLastStateHistory:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("getLastStateHistory","documentType",t),bt("getLastStateHistory","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/state-history/last".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Mt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},initializeAds:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("initializeAds","documentType",t),bt("initializeAds","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/initAds".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Mt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},mergeInstitutions:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt("mergeInstitutions","mergeInstitutionsDTO",t);const s=new URL("/document/merge",_t);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ot(t,i,e),{url:Nt(s),options:i}},reSubmit:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("reSubmit","documentType",t),bt("reSubmit","applicationNumber",n),bt("reSubmit","proceedingNumber",s);const i="/document/{documentType}/{applicationNumber}/resubmit/{proceedingNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingNumber}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Dt(d,e),Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},recalculatestate:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("recalculatestate","documentType",t),bt("recalculatestate","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/recalculatedetailstate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Mt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}},revertCreateNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("revertCreateNewVersion","documentType",t),bt("revertCreateNewVersion","applicationNumber",n),bt("revertCreateNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/revert".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Dt(d,e),d["Content-Type"]="application/json",Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ot(s,l,e),{url:Nt(r),options:l}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("saveAndValidate","documentType",t),bt("saveAndValidate","applicationNumber",n),bt("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Dt(d,e),d["Content-Type"]="application/json",Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ot(s,l,e),{url:Nt(r),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("saveApplicationByNumber","documentType",t),bt("saveApplicationByNumber","applicationNumber",n),bt("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await Dt(d,e),d["Content-Type"]="application/json",Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ot(s,l,e),{url:Nt(r),options:l}},setWaterExtractionPointsTestDates:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("setWaterExtractionPointsTestDates","documentType",t),bt("setWaterExtractionPointsTestDates","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Dt(l,e),Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},setWaterExtractionPointsTestDatesForBuilding:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("setWaterExtractionPointsTestDatesForBuilding","documentType",t),bt("setWaterExtractionPointsTestDatesForBuilding","applicationNumber",n),bt("setWaterExtractionPointsTestDatesForBuilding","ehrCode",s);const i="/document/{documentType}/{applicationNumber}/building/{ehrCode}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{ehrCode}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await Dt(d,e),Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},submitStraightToRegistry:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("submitStraightToRegistry","documentType",t),bt("submitStraightToRegistry","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await Dt(l,e),Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},submitToProcessing:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("submitToProcessing","documentType",t),bt("submitToProcessing","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Dt(l,e),Mt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Nt(i),options:a}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("submitToSigning","documentType",t),bt("submitToSigning","applicationNumber",n),bt("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await Dt(d,e),d["Content-Type"]="application/json",Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ot(s,l,e),{url:Nt(r),options:l}},submitToSupervisorProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};bt("submitToSupervisorProcessing","documentType",t),bt("submitToSupervisorProcessing","applicationNumber",n),bt("submitToSupervisorProcessing","supervisorId",s);const i="/document/{documentType}/{applicationNumber}/submitToSupervisor/{supervisorId}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{supervisorId}",encodeURIComponent(String(s))),r=new URL(i,_t);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Dt(d,e),Mt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Nt(r),options:l}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("validateSavedDocument","documentType",t),bt("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,_t);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Mt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Nt(i),options:a}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return At(i,_e(),vt,e)},async apiVersion(n){const s=await t.apiVersion(n);return At(s,_e(),vt,e)},async autoUpdateOwnershipType(n){const s=await t.autoUpdateOwnershipType(n);return At(s,_e(),vt,e)},async createDoDokuDokuRel(n,s,o){const i=await t.createDoDokuDokuRel(n,s,o);return At(i,_e(),vt,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return At(i,_e(),vt,e)},async createNewVersion(n,s,o,i){const r=await t.createNewVersion(n,s,o,i);return At(r,_e(),vt,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return At(i,_e(),vt,e)},async endProceedingCircleDocuments(n,s,o,i){const r=await t.endProceedingCircleDocuments(n,s,o,i);return At(r,_e(),vt,e)},async getAccessRights(n,s,o){const i=await t.getAccessRights(n,s,o);return At(i,_e(),vt,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return At(o,_e(),vt,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return At(i,_e(),vt,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return At(i,_e(),vt,e)},async getApplicationByNumberWithVersion(n,s,o,i){const r=await t.getApplicationByNumberWithVersion(n,s,o,i);return At(r,_e(),vt,e)},async getApplicationStateFee(n,s,o,i){const r=await t.getApplicationStateFee(n,s,o,i);return At(r,_e(),vt,e)},async getApplicationStateFeeOfVersion(n,s,o,i,r){const a=await t.getApplicationStateFeeOfVersion(n,s,o,i,r);return At(a,_e(),vt,e)},async getDocumentFileRels(n,s){const o=await t.getDocumentFileRels(n,s);return At(o,_e(),vt,e)},async getDotysBasedOnUserRights(n,s){const o=await t.getDotysBasedOnUserRights(n,s);return At(o,_e(),vt,e)},async getHealth(n){const s=await t.getHealth(n);return At(s,_e(),vt,e)},async getLastStateHistory(n,s,o){const i=await t.getLastStateHistory(n,s,o);return At(i,_e(),vt,e)},async initializeAds(n,s,o){const i=await t.initializeAds(n,s,o);return At(i,_e(),vt,e)},async mergeInstitutions(n,s){const o=await t.mergeInstitutions(n,s);return At(o,_e(),vt,e)},async reSubmit(n,s,o,i){const r=await t.reSubmit(n,s,o,i);return At(r,_e(),vt,e)},async recalculatestate(n,s,o){const i=await t.recalculatestate(n,s,o);return At(i,_e(),vt,e)},async revertCreateNewVersion(n,s,o,i){const r=await t.revertCreateNewVersion(n,s,o,i);return At(r,_e(),vt,e)},async saveAndValidate(n,s,o,i){const r=await t.saveAndValidate(n,s,o,i);return At(r,_e(),vt,e)},async saveApplicationByNumber(n,s,o,i){const r=await t.saveApplicationByNumber(n,s,o,i);return At(r,_e(),vt,e)},async setWaterExtractionPointsTestDates(n,s,o){const i=await t.setWaterExtractionPointsTestDates(n,s,o);return At(i,_e(),vt,e)},async setWaterExtractionPointsTestDatesForBuilding(n,s,o,i){const r=await t.setWaterExtractionPointsTestDatesForBuilding(n,s,o,i);return At(r,_e(),vt,e)},async submitStraightToRegistry(n,s,o){const i=await t.submitStraightToRegistry(n,s,o);return At(i,_e(),vt,e)},async submitToProcessing(n,s,o){const i=await t.submitToProcessing(n,s,o);return At(i,_e(),vt,e)},async submitToSigning(n,s,o,i){const r=await t.submitToSigning(n,s,o,i);return At(r,_e(),vt,e)},async submitToSupervisorProcessing(n,s,o,i){const r=await t.submitToSupervisorProcessing(n,s,o,i);return At(r,_e(),vt,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return At(i,_e(),vt,e)}}};class wt extends Et{addAuthz(e,t,n){return Ut(this.configuration).addAuthz(e,t,n).then((e=>e(this.axios,this.basePath)))}apiVersion(e){return Ut(this.configuration).apiVersion(e).then((e=>e(this.axios,this.basePath)))}autoUpdateOwnershipType(e){return Ut(this.configuration).autoUpdateOwnershipType(e).then((e=>e(this.axios,this.basePath)))}createDoDokuDokuRel(e,t,n){return Ut(this.configuration).createDoDokuDokuRel(e,t,n).then((e=>e(this.axios,this.basePath)))}createDocument(e,t,n){return Ut(this.configuration).createDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}createNewVersion(e,t,n,s){return Ut(this.configuration).createNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteApplicationByNumber(e,t,n){return Ut(this.configuration).deleteApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}endProceedingCircleDocuments(e,t,n,s){return Ut(this.configuration).endProceedingCircleDocuments(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getAccessRights(e,t,n){return Ut(this.configuration).getAccessRights(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationById(e,t){return Ut(this.configuration).getApplicationById(e,t).then((e=>e(this.axios,this.basePath)))}getApplicationByNumber(e,t,n){return Ut(this.configuration).getApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberOld(e,t,n){return Ut(this.configuration).getApplicationByNumberOld(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberWithVersion(e,t,n,s){return Ut(this.configuration).getApplicationByNumberWithVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFee(e,t,n,s){return Ut(this.configuration).getApplicationStateFee(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFeeOfVersion(e,t,n,s,o){return Ut(this.configuration).getApplicationStateFeeOfVersion(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}getDocumentFileRels(e,t){return Ut(this.configuration).getDocumentFileRels(e,t).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRights(e,t){return Ut(this.configuration).getDotysBasedOnUserRights(e,t).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Ut(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getLastStateHistory(e,t,n){return Ut(this.configuration).getLastStateHistory(e,t,n).then((e=>e(this.axios,this.basePath)))}initializeAds(e,t,n){return Ut(this.configuration).initializeAds(e,t,n).then((e=>e(this.axios,this.basePath)))}mergeInstitutions(e,t){return Ut(this.configuration).mergeInstitutions(e,t).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s){return Ut(this.configuration).reSubmit(e,t,n,s).then((e=>e(this.axios,this.basePath)))}recalculatestate(e,t,n){return Ut(this.configuration).recalculatestate(e,t,n).then((e=>e(this.axios,this.basePath)))}revertCreateNewVersion(e,t,n,s){return Ut(this.configuration).revertCreateNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveAndValidate(e,t,n,s){return Ut(this.configuration).saveAndValidate(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveApplicationByNumber(e,t,n,s){return Ut(this.configuration).saveApplicationByNumber(e,t,n,s).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDates(e,t,n){return Ut(this.configuration).setWaterExtractionPointsTestDates(e,t,n).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDatesForBuilding(e,t,n,s){return Ut(this.configuration).setWaterExtractionPointsTestDatesForBuilding(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitStraightToRegistry(e,t,n){return Ut(this.configuration).submitStraightToRegistry(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n){return Ut(this.configuration).submitToProcessing(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToSigning(e,t,n,s){return Ut(this.configuration).submitToSigning(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSupervisorProcessing(e,t,n,s){return Ut(this.configuration).submitToSupervisorProcessing(e,t,n,s).then((e=>e(this.axios,this.basePath)))}validateSavedDocument(e,t,n){return Ut(this.configuration).validateSavedDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}}const jt=function(e){const t=function(e){return{getAllEnergySourcesAndCarriers:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifiers/all-tech-systems-options",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Mt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,_t);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Mt(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Nt(o),options:r}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,_t);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Mt(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Nt(o),options:r}},getDotysBasedOnUserRightsWithBaseDotys:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};bt("getDotysBasedOnUserRightsWithBaseDotys","dotys",t);const o=new URL("/classifiers/starting_rights/base",_t);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={},l={};await Dt(a,e),t&&(l.dotys=t),void 0!==n&&(l.ehrCode=n),Mt(o,l);let d=i&&i.headers?i.headers:{};return r.headers={...a,...d,...s.headers},{url:Nt(o),options:r}},getEnergySourcesAndCarriers:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifiers/tech-systems-options",_t);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Mt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Nt(n),options:o}}}}(e);return{async getAllEnergySourcesAndCarriers(n){const s=await t.getAllEnergySourcesAndCarriers(n);return At(s,_e(),vt,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return At(o,_e(),vt,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return At(o,_e(),vt,e)},async getDotysBasedOnUserRightsWithBaseDotys(n,s,o){const i=await t.getDotysBasedOnUserRightsWithBaseDotys(n,s,o);return At(i,_e(),vt,e)},async getEnergySourcesAndCarriers(n){const s=await t.getEnergySourcesAndCarriers(n);return At(s,_e(),vt,e)}}};class Ct extends Et{getAllEnergySourcesAndCarriers(e){return jt(this.configuration).getAllEnergySourcesAndCarriers(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return jt(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return jt(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRightsWithBaseDotys(e,t,n){return jt(this.configuration).getDotysBasedOnUserRightsWithBaseDotys(e,t,n).then((e=>e(this.axios,this.basePath)))}getEnergySourcesAndCarriers(e){return jt(this.configuration).getEnergySourcesAndCarriers(e).then((e=>e(this.axios,this.basePath)))}}class Lt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Pt="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class Rt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Kt extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Ft="https://example.com",kt=function(e,t,n){if(null==n)throw new Kt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Yt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},Bt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},Gt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Vt=function(e){return e.pathname+e.search+e.hash},Ht=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Jt=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};kt("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",Ft);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...o},l={},d={};await Yt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),Bt(i,d);let c=r&&r.headers?r.headers:{};return a.headers={...l,...c,...o.headers},{url:Vt(i),options:a}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kt("deleteFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Ft);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n},a={};await Yt(a,e),Bt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Vt(o),options:r}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kt("downloadFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Ft);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await Yt(a,e),Bt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Vt(o),options:r}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};kt("updateFile","fileId",t);const o="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),i=new URL(o,Ft);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Yt(l,e),l["Content-Type"]="application/json",Bt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Gt(n,a,e),{url:Vt(i),options:a}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kt("updateFileInfo","doFail",t);const s=new URL("/file/info",Ft);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};await Yt(r,e),r["Content-Type"]="application/json",Bt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Gt(t,i,e),{url:Vt(s),options:i}},uploadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/file",Ft);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={},a=new(e&&e.formDataCtor||FormData);await Yt(r,e),void 0!==t&&a.append("file",t),r["Content-Type"]="multipart/form-data",Bt(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},i.data=a,{url:Vt(s),options:i}},uploadFileWithFileInfo:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/fileWithInfo",Ft);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...s},a={},l=new(e&&e.formDataCtor||FormData);await Yt(a,e),void 0!==t&&l.append("file",t),void 0!==n&&l.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),a["Content-Type"]="multipart/form-data",Bt(o,{});let d=i&&i.headers?i.headers:{};return r.headers={...a,...d,...s.headers},r.data=l,{url:Vt(o),options:r}},uploadFileWithFileInfoAndDocRel:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/fileWithInfoAndDocRel",Ft);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...i},d={},c=new(e&&e.formDataCtor||FormData);await Yt(d,e),void 0!==t&&c.append("file",t),void 0!==n&&c.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),void 0!==s&&c.append("docNr",s),void 0!==o&&c.append("relType",o),d["Content-Type"]="multipart/form-data",Bt(r,{});let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:Vt(r),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const r=await t.cloneFilesAndCreateRels(n,s,o,i);return Ht(r,_e(),Pt,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return Ht(o,_e(),Pt,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return Ht(o,_e(),Pt,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return Ht(i,_e(),Pt,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return Ht(o,_e(),Pt,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return Ht(o,_e(),Pt,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return Ht(i,_e(),Pt,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,r){const a=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,r);return Ht(a,_e(),Pt,e)}}};class Wt extends Rt{cloneFilesAndCreateRels(e,t,n,s){return Jt(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return Jt(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return Jt(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return Jt(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return Jt(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return Jt(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return Jt(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return Jt(this.configuration).uploadFileWithFileInfoAndDocRel(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}}class qt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const $t="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class zt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Xt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Qt="https://example.com",Zt=function(e,t,n){if(null==n)throw new Xt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function en(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>en(e,t,n))):Object.keys(t).forEach((s=>en(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const tn=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];en(t,s),e.search=t.toString()},nn=function(e){return e.pathname+e.search+e.hash},sn=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const on=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Zt("esileht","id",t),Zt("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,Qt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};tn(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:nn(i),options:a}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",Qt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};tn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:nn(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",Qt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};tn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:nn(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,Qt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};tn(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:nn(o),options:r}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt("lehtdSave","esileht",t);const s=new URL("/api/pages",Qt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};r["Content-Type"]="application/json",tn(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""}(t,i,e),{url:nn(s),options:i}}}},rn=function(e){const t=on(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return sn(i,_e(),$t,e)},async lehed(n){const s=await t.lehed(n);return sn(s,_e(),$t,e)},async lehedId(n){const s=await t.lehedId(n);return sn(s,_e(),$t,e)},async leht(n,s){const o=await t.leht(n,s);return sn(o,_e(),$t,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return sn(o,_e(),$t,e)}}};class an extends zt{esileht(e,t,n){return rn(this.configuration).esileht(e,t,n).then((e=>e(this.axios,this.basePath)))}lehed(e){return rn(this.configuration).lehed(e).then((e=>e(this.axios,this.basePath)))}lehedId(e){return rn(this.configuration).lehedId(e).then((e=>e(this.axios,this.basePath)))}leht(e,t){return rn(this.configuration).leht(e,t).then((e=>e(this.axios,this.basePath)))}lehtdSave(e,t){return rn(this.configuration).lehtdSave(e,t).then((e=>e(this.axios,this.basePath)))}}class ln{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const dn={myViewsApiEndpoint:window.REACT_APP_MY_VIEWS_API_PATH,classifierApiEndpoint:window.REACT_APP_CLASSIFIER_SERVICE_ENDPOINT,userApiEndpoint:window.REACT_APP_USER_SERVICE_ENDPOINT,documentApiEndpoint:window.REACT_APP_DOCUMENT_SERVICE_ENDPOINT,fileUploadApiEndpoint:window.REACT_APP_FILE_UPLOAD_API_ENDPOINT,frontPageApiEndpoint:window.REACT_APP_YLD_API},cn={proceedingApiService:new It(new Tt({basePath:dn.myViewsApiEndpoint})),classifierApiService:new je(new Ce({basePath:dn.classifierApiEndpoint})),personApiService:new qe(new Ze({basePath:dn.userApiEndpoint})),userApiService:new Qe(new Ze({basePath:dn.userApiEndpoint})),myDocumentBaseApiService:new pt(new Tt({basePath:dn.myViewsApiEndpoint})),documentApiService:new wt(new Lt({basePath:dn.documentApiEndpoint})),fileApiService:new Wt(new qt({basePath:dn.fileUploadApiEndpoint})),frontPageApi:new an(new ln({basePath:dn.frontPageApiEndpoint})),institutionKovEndpointApi:new Je(new Ze({basePath:dn.userApiEndpoint}))};var un=n(848);const pn=11272,hn=e=>{var t;let{userInfo:n}=e;const s=(0,H.useIntl)(),[o,i]=(0,G.useState)(!0),[r,a]=(0,G.useState)(""),[l,d]=(0,G.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===de.MKM;(0,G.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{cn.frontPageApi.leht(pn).then((e=>{const t=e.data;t[0].body&&(a(t[0].body),d(t[0].body))}))},p=async()=>{cn.frontPageApi.esileht(pn,"ee").then((e=>{const t=e.data;t.body&&(a(t.body),d(t.body))}))};return(0,un.jsx)(J.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,un.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,un.jsx)(J.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,un.jsx)(J.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,un.jsxs)("div",{className:"pt-2",children:[(0,un.jsx)(J.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(r),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),a(l),cn.frontPageApi.lehtdSave({id:pn,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},mn={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},gn=e=>(0,un.jsx)(J.Tooltip,{content:(0,un.jsx)(J.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,un.jsx)(J.Link,{onClick:t=>{var n;return null===(n=e.functionCall)||void 0===n?void 0:n.call(e,t)},text:e.linkName,href:e.href}):(0,un.jsx)(J.Link,{text:e.linkName,href:e.href,onClick:t=>{t.preventDefault(),t.stopPropagation();const n=window.open(e.href,"_blank");null==n||n.focus()}})},e.linkName),Sn=e=>{let{proceedings:t,linkGen:n}=e;const s=(0,H.useIntl)(),o=[{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{return(t=e).proceedingNr?(0,un.jsx)(gn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,un.jsx)(un.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,un.jsx)(gn,{linkName:e.document,tooltipText:"detailsearch.tooltip.open_document",functionCall:t=>{n(!0,t,"DOCUMENT",e.document)}}):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>e.ehrCode&&null!==e.ehrCode?e.ehrCode.map(((t,s)=>(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,un.jsx)("span",{children:", "}):""]}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,un.jsx)(J.TableComponent,{config:{thead:{headers:o.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:s.formatMessage({id:"my_admin_proceedings.table.header."+e.id}),tooltip:{text:s.formatMessage({id:"my_admin_proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,type:"input",valueFormatter:t=>e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},fn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,G.useState)(!1),[o,i]=(0,G.useState)(void 0),[r,a]=(0,G.useState)([]);(0,G.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===de.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await cn.proceedingApiService.findAreaProceedings(n);a(null!==(o=null==s?void 0:s.data)&&void 0!==o?o:[])}catch(e){i("my_admin_proceedings.proceedings_request.error")}finally{s(!1)}}else a([])};return{loading:n,proceedings:r,error:o}},In=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,H.useIntl)(),[o,i]=(0,G.useState)(!1),{loading:r,error:a,proceedings:l}=fn(t,o);return(0,un.jsxs)(J.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[a&&(0,un.jsx)(J.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:a})}),r&&(0,un.jsxs)(J.Row,{className:"mb-4 justify-content-center",children:[(0,un.jsx)("br",{}),(0,un.jsx)(J.Loader,{}),(0,un.jsx)("br",{})]}),!r&&!(null==l||!l.length)&&!a&&(0,un.jsx)(Sn,{proceedings:l,linkGen:n}),(0,un.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,un.jsx)(J.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},Tn=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,H.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===de.TJA;return(0,un.jsxs)("div",{children:[(0,un.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,un.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,un.jsx)(J.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,un.jsx)(hn,{userInfo:n}),i&&(0,un.jsx)(In,{userInfo:n,linkGen:s})]})},vn=require("react-redux"),En=require("moment");var yn=n.n(En);function _n(e,t,n){const s=n(e).trim(),o=n(t).trim();return s.toLowerCase()===o.toLowerCase()?0:""===s?1:""===o?-1:s.toLowerCase()>o.toLowerCase()?1:-1}function bn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function Dn(e){if("0"===e.done&&"0"===e.all)return 15;if(e.done===e.all)return 9;let t=parseInt(e.done)/parseInt(e.all);return 1===t&&(t+=parseInt(e.all)/1e4),t}function xn(e,t,n){const s=n(e),o=n(t),i=Dn(s),r=Dn(o);return r===i?0:i>r?1:-1}function Mn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function On(e,t,n){if(0===e.length)return e;const s={string:_n,number:bn,object:xn,date:Mn}[typeof t(e[0])];return[...e].sort(((e,o)=>s(e,o,t)*n))}const Nn=0,An=1,Un=-1;function wn(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case Nn:return An;case An:return Un;case Un:return An}}(t.direction):An}}const jn=e=>-1===e.sortDirection?(0,un.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,un.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):1===e.sortDirection?(0,un.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,un.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):(0,un.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,un.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}),Cn=e=>{const[t,n]=(0,G.useState)(!1);return(0,un.jsx)(un.Fragment,{children:e.fileId&&(0,un.jsx)(J.ControlledPopover,{content:(0,un.jsxs)("div",{style:{width:"250px"},children:[(0,un.jsx)("h4",{children:(0,un.jsx)(H.FormattedMessage,{id:"download.file"})}),(0,un.jsx)("br",{}),(0,un.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,un.jsx)(J.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.cancel"})}),(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",onClick:()=>{e.fileId&&e.fileApi.downloadFile(e.fileId,{responseType:"blob"}).then((e=>{const s=e.headers["content-disposition"];let o="download";if(s){const e=s.match(/filename\*=UTF-8''(.+?)(;|$)/);e&&e.length>=2&&(o=decodeURIComponent(e[1].replace(/\+/g," ")))}const i=new Blob([e.data],{}),r=document.createElement("a");r.download=o,r.href=URL.createObjectURL(i),r.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(r.href)),3e4)})),r.click(),n(!t)})).catch((e=>console.log(e)))},squared:!0,type:"submit",children:(0,un.jsx)(H.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,un.jsx)(J.Icon,{tooltipText:(0,un.jsx)(H.FormattedMessage,{id:"tooltip.download"}),type:"download"})})})};let Ln=function(e){return e.DO_DOKUSEIS_ESITATUD="DO_DOKUSEIS_ESITATUD",e.DO_DOKUSEIS_KEHTETU="DO_DOKUSEIS_KEHTETU",e.DO_DOKUSEIS_KOOSTAMISEL="DO_DOKUSEIS_KOOSTAMISEL",e.DO_DOKUSEIS_EELNOU_AKTIIVNE="DO_DOKUSEIS_EELNOU_AKTIIVNE",e.DO_DOKUSEIS_ALLKIRJASTAMISEL="DO_DOKUSEIS_ALLKIRJASTAMISEL",e.DO_DOKUSEIS_MENETLUSES="DO_DOKUSEIS_MENETLUSES",e.DO_DOKUSEIS_MUUTMISEL="DO_DOKUSEIS_MUUTMISEL",e.DO_DOKUSEIS_TAIENDAMISEL="DO_DOKUSEIS_TAIENDAMISEL",e.DO_DOKUSEIS_TYHISTATUD="DO_DOKUSEIS_TYHISTATUD",e.DO_DOKUSEIS_VANA_VERSIOON="DO_DOKUSEIS_VANA_VERSIOON",e.DO_DOKUSEIS_LOOBUTUD="DO_DOKUSEIS_LOOBUTUD",e.DO_DOKUSEIS_ALLKIRJASTATUD="DO_DOKUSEIS_ALLKIRJASTATUD",e.DO_DOKUSEIS_MENETLETUD="DO_DOKUSEIS_MENETLETUD",e.DO_DOKUSEIS_LUBATUD="DO_DOKUSEIS_LUBATUD",e.DO_DOKUSEIS_LUB_TEAV="DO_DOKUSEIS_LUB_TEAV",e.DO_DOKUSEIS_KEELDUTUD="DO_DOKUSEIS_KEELDUTUD",e.DO_DOKUSEIS_TEAVITATUD="DO_DOKUSEIS_TEAVITATUD",e.DO_DOKUSEIS_REG_KANTUD="DO_DOKUSEIS_REG_KANTUD",e.DO_DOKUSEIS_ANTUD="DO_DOKUSEIS_ANTUD",e.DO_DOKUSEIS_KEHTIV="DO_DOKUSEIS_KEHTIV",e.DO_DOKUSEIS_TUNNIST_KEHTETUKS="DO_DOKUSEIS_TUNNIST_KEHTETUKS",e.DO_DOKUSEIS_KOOSK_RINGIL="DO_DOKUSEIS_KOOSK_RINGIL",e.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL="DO_DOKUSEIS_EM_KINNITATUD_AKTUAL",e}({});const Pn=[{code:Ln.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:Ln.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:Ln.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:Ln.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:Ln.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"}],Rn=[{code:Ln.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:Ln.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:Ln.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:Ln.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"}];function Kn(e){const t=(e,t)=>({name:e,type:t});switch(Ln[e]){case Ln.DO_DOKUSEIS_ESITATUD:return t("Esitatud",ie.INFO);case Ln.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",ie.DEFAULT);case Ln.DO_DOKUSEIS_KOOSTAMISEL:case Ln.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",ie.INFO);case Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",ie.INFO);case Ln.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",ie.INFO);case Ln.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",ie.INFO);case Ln.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",ie.WARNING);case Ln.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",ie.DEFAULT);case Ln.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",ie.DEFAULT);case Ln.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",ie.DEFAULT);case Ln.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",ie.INFO);case Ln.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",ie.SUCCESS);case Ln.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",ie.SUCCESS);case Ln.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",ie.WARNING);case Ln.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",ie.DANGER);case Ln.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",ie.SUCCESS);case Ln.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",ie.SUCCESS);case Ln.DO_DOKUSEIS_ANTUD:return t("Antud",ie.SUCCESS);case Ln.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case Ln.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",ie.SUCCESS);case Ln.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",ie.DEFAULT);case Ln.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",ie.INFO);default:return t(e,ie.DEFAULT)}}function Fn(e){let t=[];e===q?t=Pn:e===$&&(t=Rn);return function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(t.sort(((e,t)=>e.value.localeCompare(t.value))))}function kn(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null==e||null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.buildingAddress)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.documentNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.docNr)||void 0===s?void 0:s.includes(t.documentNumber.trim()))&&void 0!==n&&n}))),t.documentStates.length>0&&(e=e.filter((e=>{return(n=e.stateCode)&&[Ln.DO_DOKUSEIS_MENETLETUD,Ln.DO_DOKUSEIS_LUBATUD,Ln.DO_DOKUSEIS_LUB_TEAV,Ln.DO_DOKUSEIS_KEELDUTUD,Ln.DO_DOKUSEIS_TEAVITATUD,Ln.DO_DOKUSEIS_REG_KANTUD,Ln.DO_DOKUSEIS_ANTUD,Ln.DO_DOKUSEIS_KEHTIV].includes(n)?t.documentStates.includes(Ln.DO_DOKUSEIS_REG_KANTUD):e.stateCode&&t.documentStates.includes(e.stateCode);var n}))),t.institutionUsers.length>0&&(e=e.filter((e=>(void 0!==e.presenter||null!==e.presenter)&&t.institutionUsers.find((t=>{var n;return!0===(null===(n=e.connectedPersonId)||void 0===n?void 0:n.includes(t))}))))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.institutions.length>0&&(e=e.filter((e=>void 0!==e.institutionId&&t.institutions.includes(e.institutionId)))),!0===t.proceedingMissing&&(e=e.filter((e=>null===e.proceedingNr||void 0===e.proceedingNr))),t.documentDate.from.length>0&&0===t.documentDate.to.length){const n=new Date(t.documentDate.from).getTime();e=e.filter((e=>new Date(yn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.documentDate.to.length>0&&0===t.documentDate.from.length){const n=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(yn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.documentDate.from.length>0&&t.documentDate.to.length>0){const n=new Date(t.documentDate.from).getTime(),s=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(yn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(yn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Yn(e){return null!=e}function Bn(e,t){return Object.keys(e).find((n=>e[n]===Object.values(e).find((e=>e.includes(t)))))}function Gn(e){var t,n,s,o;const[i,r]=(0,G.useState)(!1);function a(){r(!i)}const l=(0,un.jsxs)("div",{children:[(0,un.jsx)("h4",{children:(0,un.jsx)(H.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,un.jsx)("p",{children:(0,un.jsx)(H.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,un.jsxs)("div",{children:[(0,un.jsx)(J.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,un.jsx)(H.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void a()),squared:!0,type:"submit",children:(0,un.jsx)(H.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,un.jsx)(J.ControlledPopover,{delegateFocusOnOpen:null===(s=e.delegateFocusOnOpen)||void 0===s||s,className:"popover-confirm",content:e.content||l,open:i,placement:"top-end",theme:"danger",toggle:()=>a(),wrapperClassName:null!==(o=e.wrapperClassName)&&void 0!==o?o:"",children:e.children})}function Vn(e){return(0,un.jsx)(Gn,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,un.jsx)(J.Icon,{tooltipText:(0,un.jsx)(H.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const Hn=e=>{let{linkName:t,functionCall:n,tooltipText:s}=e;return(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(J.Link,{onClick:e=>null==n?void 0:n(e),text:(0,un.jsx)(J.Text,{raw:t})}),(0,un.jsx)(J.Info,{tooltipText:s})]})};var Jn,Wn=new Uint8Array(16);function qn(){if(!Jn&&!(Jn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jn(Wn)}const $n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const zn=function(e){return"string"==typeof e&&$n.test(e)};for(var Xn=[],Qn=0;Qn<256;++Qn)Xn.push((Qn+256).toString(16).substr(1));const Zn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Xn[e[t+0]]+Xn[e[t+1]]+Xn[e[t+2]]+Xn[e[t+3]]+"-"+Xn[e[t+4]]+Xn[e[t+5]]+"-"+Xn[e[t+6]]+Xn[e[t+7]]+"-"+Xn[e[t+8]]+Xn[e[t+9]]+"-"+Xn[e[t+10]]+Xn[e[t+11]]+Xn[e[t+12]]+Xn[e[t+13]]+Xn[e[t+14]]+Xn[e[t+15]]).toLowerCase();if(!zn(n))throw TypeError("Stringified UUID is invalid");return n};const es=function(e,t,n){var s=(e=e||{}).random||(e.rng||qn)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=s[o];return t}return Zn(s)},ts=e=>{let{notificationStyle:t,header:n,link:s,body:o,onCloseNotification:i,isNotClosable:r,customBody:a}=e;const l=(0,H.useIntl)(),d=null!=a?a:(0,un.jsxs)("div",{children:[(0,un.jsx)("h3",{className:"alert-heading",children:n}),(0,un.jsx)("p",{className:"alert-body mb-0",children:o}),s&&(0,un.jsx)("div",{className:"mx-2",children:(0,un.jsx)(J.Link,{onClick:s.onClick,text:l.formatMessage({id:s.text})})})]});return r?(0,un.jsx)("div",{id:"danger-toast",className:`alert ${t}`,children:d}):(0,un.jsxs)("div",{id:"danger-toast",className:`alert alert-toast-box ${t}`,children:[(0,un.jsx)("a",{className:"toast-close icon-close",role:"button","data-toggle":"tooltip","data-tooltip-placement":"bottom","data-tooltip-class":"tooltip-icon","data-tooltip-trigger":"hover focus","data-tooltip-title":"Sulgen","aria-label":"Sulgen","data-animation":"false",onClick:i}),d]})};let ns=function(e){return e.Danger="danger",e.Warning="warning",e.Info="info",e.Success="success",e}({});const ss=()=>{const e=(0,H.useIntl)(),t=(0,vn.useDispatch)(),n=(0,vn.useSelector)(R),[s,o]=(0,G.useState)();(0,G.useEffect)((()=>{n&&o(n)}),[n]);const i=t=>{if(t)return"string"==typeof t?e.formatMessage({id:t}):t.values?e.formatMessage({id:t.id},{...t.values}):e.formatMessage({id:t.id})};return(0,un.jsx)(un.Fragment,{children:(0,un.jsx)("div",{className:"notification-alert-box",children:(0,un.jsx)("ul",{children:(null==s?void 0:s.length)>0&&s.map((e=>{var n;return(0,un.jsx)("li",{children:e.theme&&(0,un.jsx)(ts,{notificationStyle:"alert-"+e.theme+" show",header:i(null!==(n=e.messageCode)&&void 0!==n?n:e.header),body:e.messageCode?void 0:i(e.body),onCloseNotification:()=>{return n=e.id,void t(k(n));var n},link:e.link})},e.id)}))})})})},os=(0,o.createAsyncThunk)("globalUI/handleNotification",(async(e,t)=>{let{dispatch:n,getState:s}=t;const o=s().myViewsPage.notifications.notices,i=es(),r={...e,id:i};n(F([...o,r])),e.theme!==ns.Danger&&setTimeout((()=>{n(k(i))}),7e3)})),is=(0,o.createAsyncThunk)("document/createDocument",(async(e,t)=>{let{addEntityDto:n,successCallback:s}=e,{dispatch:o}=t;try{const e=await cn.documentApiService.createDocument(n.documentType,n);return s&&s(e.data),o(K()),e.data}catch(e){o(os({header:"request.error.create_document.title",body:"request.error.create_document.message",theme:ns.Danger}))}})),rs=e=>{var t;let{doty:n,documentId:s,linkGen:o,userInfo:i}=e;const r=(0,vn.useDispatch)(),[a,l]=(0,G.useState)(!1),d=(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)===de.TJA,c=(e,t)=>{if(!t)return;r(is({addEntityDto:{documentType:t,baseDocumentId:s},successCallback:t=>((e,t)=>{const n=`${e.documentTypeWithYear}/${e.documentNumber}`;e&&o(!0,t,le,n)})(t,e)}))};return(0,un.jsx)(J.ControlledPopover,{content:(()=>{const e=n,t=ve[e],s=Ee[e];return(0,un.jsxs)("div",{children:[(0,un.jsxs)("ul",{children:[(0,un.jsx)("li",{className:"d-flex justify-content-between",children:(0,un.jsx)(Hn,{linkName:"my_documents.document_table.more_actions.request_document_cancellation",tooltipText:`my_documents.document_table.more_actions.request_document_cancellation.tooltip.${e}`,functionCall:e=>{c(e,s),l(!a)}})}),d&&(0,un.jsx)("li",{className:"d-flex justify-content-between",children:(0,un.jsx)(Hn,{linkName:"my_documents.document_table.more_actions.cancel_document",tooltipText:`my_documents.document_table.more_actions.cancel_document.tooltip.${e}`,functionCall:e=>{c(e,t),l(!a)}})})]}),(0,un.jsx)(J.Button,{onClick:()=>{l(!1)},squared:!0,colourScheme:"light",children:(0,un.jsx)(H.FormattedMessage,{id:"button.cancel"})})]})})(),open:a,placement:"bottom-end",toggle:()=>l(!a),children:(0,un.jsx)("div",{className:"pl-2",children:(0,un.jsx)(J.Icon,{tooltipText:(0,un.jsx)(H.FormattedMessage,{id:"tooltip.more_actions"}),type:"more"})})})},as=e=>{var t;let{linkGen:n,userInfo:s,documentType:o,onAllUsersChecked:i,isAllUsersChecked:r,filter:a,onDocumentDelete:l,fileApi:d,hidePresenter:c}=e;const u=(0,H.useIntl)(),[p,h]=(0,G.useState)({offset:0,limit:10}),[m,g]=(0,G.useState)([]),[S,f]=(0,G.useState)({column:0,direction:Nn}),[I,T]=(0,G.useState)(!1),[v,E]=(0,G.useState)(!1),[y,_]=(0,G.useState)(!1),b=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),D=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),x=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),M=(0,vn.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments)),O=(null===(t=s.activeRole)||void 0===t?void 0:t.businessType)!==de.A;(0,G.useEffect)((()=>{b&&o===q&&(Object.keys(a).length>0?(g(kn(b,a)),h({offset:0,limit:10})):g(b))}),[b,a]),(0,G.useEffect)((()=>{D&&o===W&&(Object.keys(a).length>0?(g(kn(D,a)),h({offset:0,limit:10})):g(D))}),[D,a]),(0,G.useEffect)((()=>{x&&o===$&&(Object.keys(a).length>0?(g(kn(x,a)),h({offset:0,limit:10})):g(x))}),[x,a]),(0,G.useEffect)((()=>{M&&o===z&&(Object.keys(a).length>0?(g(kn(M,a)),h({offset:0,limit:10})):g(M))}),[M,a]);const N=["my_documents.doc_date","my_documents.reg_date","my_documents.doc_nr","my_documents.document_type","my_documents.building_name","my_documents.ehr_code","my_documents.building_address","my_documents.state","my_documents.proceeding_nr"];c||N.push("my_documents.presenter");const A=[e=>Yn(e.docDate)?new Date(yn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>o===z?Yn(e.deadlineDate)?new Date(yn()(e.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:Yn(e.regDate)?new Date(yn()(e.regDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&Yn(e.buildingName[0])?e.buildingName[0]:"",e=>e.ehrCode&&Yn(e.ehrCode[0])?e.ehrCode[0]:"",e=>e.buildingAddress&&Yn(e.buildingAddress[0])?e.buildingAddress[0]:"",e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>e.presenter?e.presenter.join(","):""];const U=e=>{var t;const i=[(0,un.jsx)(Cn,{fileApi:d,fileId:e.generatedFileId,docNr:null!==(t=e.docNr)&&void 0!==t?t:""},e.docId+"download")];return o===q&&e.stateCode===Ln.DO_DOKUSEIS_KOOSTAMISEL?i.push((0,un.jsx)(Vn,{onConfirm:()=>{l(e.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},e.docNr)):o===$&&e.doty&&Te.includes(e.doty)&&![Ln.DO_DOKUSEIS_TYHISTATUD,Ln.DO_DOKUSEIS_TUNNIST_KEHTETUKS].includes(e.stateCode)&&i.push((0,un.jsx)(rs,{doty:e.doty,documentId:e.docId,linkGen:n,userInfo:s})),i};return(0,un.jsxs)(J.Section,{form:!0,children:[m&&(0,un.jsx)(J.CollapseTable,{content:m.slice(p.offset,p.offset+p.limit).map((e=>{var t,s,i,r,a,l,d;return(0,un.jsx)(J.CollapseTableRow,{fields:[e.docDate,o===z?yn()(e.deadlineDate,"DD.MM.YYYY").valueOf()<yn()().valueOf()?(0,un.jsx)("div",{className:"red-text",children:null===(t=e.deadlineDate)||void 0===t?void 0:t.toString()}):e.deadlineDate:e.regDate,(0,un.jsx)(J.Tooltip,{content:(0,un.jsx)(J.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(J.Link,{onClick:t=>{n(!0,t,le,e.docNr)},text:e.docNr,href:n(!1,void 0,le,e.docNr)})},e.docNr),e.documentType,e.buildingName?(0,un.jsx)("div",{children:y?(0,un.jsxs)("div",{children:[e.buildingName.map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),e.buildingName.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),_(!y)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===e.buildingName.length?e.buildingName:(0,un.jsxs)("div",{children:[null===(s=e.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(i=e.buildingName)||void 0===i?void 0:i.slice(4,5),e.buildingName.length>5?" ...":"",e.buildingName.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),_(!y)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",e.ehrCode?(0,un.jsx)("div",{children:v?(0,un.jsxs)("div",{children:[e.ehrCode.map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,re,e)},href:n(!1,void 0,re,e)}),(0,un.jsx)("br",{})]},t))),e.ehrCode.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),E(!v)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,un.jsxs)("div",{children:[null===(r=e.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,re,e)},href:n(!1,void 0,re,e)}),(0,un.jsx)("br",{})]},t))),null===(a=e.ehrCode)||void 0===a?void 0:a.slice(4,5).map((e=>(0,un.jsx)(gn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,re,e)},href:n(!1,void 0,re,e)}))),e.ehrCode.length>5?" ...":"",e.ehrCode.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),E(!v)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",e.buildingAddress?(0,un.jsx)("div",{children:I?(0,un.jsxs)("div",{children:[e.buildingAddress.map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),e.buildingAddress.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),T(!I)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===e.buildingAddress.length?e.buildingAddress:(0,un.jsxs)("div",{children:[null===(l=e.buildingAddress)||void 0===l?void 0:l.slice(0,4).map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(d=e.buildingAddress)||void 0===d?void 0:d.slice(4,5),e.buildingAddress.length>5?" ...":"",e.buildingAddress.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),T(!I)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",e.stateCode?(0,un.jsx)(J.Status,{type:Kn(e.stateCode).type,children:Kn(e.stateCode).name}):"",o===W?(0,un.jsx)(J.Tooltip,{content:(0,un.jsx)(J.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(J.Link,{onClick:t=>{n(!0,t,ae,e.proceedingNr)},text:e.proceedingNr,href:n(!1,void 0,ae,e.proceedingNr)})},e.proceedingNr):e.proceedingNr,e.presenter?e.presenter.map(((t,n)=>(0,un.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,un.jsx)("span",{children:", "}):""]}))):""],tools:U(e),editable:!0},e.docId)})),headers:function(){const e=[...N];return e[1]="my_documents.deadline",(o===z?e:N).map(((e,t)=>(0,un.jsxs)("div",{children:[(0,un.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(t,S);f(e),e.direction!==Nn&&g(On(m,A[t],e.direction))},children:S.column===t?(0,un.jsx)(jn,{sortDirection:S.direction}):(0,un.jsx)(jn,{sortDirection:Nn})}),u.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:p.offset,limit:p.limit,total:m.length},onPaginationReload:h,editable:!0}),(0,un.jsx)(J.Row,{children:O&&o!==z?(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Checkbox,{name:"checkbox",onChange:e=>i(e),text:(0,un.jsx)(J.Text,{raw:"my_documents.view_all_institution_documents"}),checked:r})}):(0,un.jsx)(J.Col,{})})]})},ls=require("reactstrap");function ds(e,t,n,s,o){return s?(0,un.jsx)(J.FieldWrapper,{labelCol:o,component:(0,un.jsxs)(ls.Row,{className:"w-100 px-0 mx-0",children:[(0,un.jsx)(ls.Col,{xs:"auto",md:1.5,className:"pl-0 px-0",children:(0,un.jsx)(J.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",text:"",checked:e})}),(0,un.jsx)(ls.Col,{className:"px-0",children:(0,un.jsx)(J.Text,{raw:(0,un.jsx)(H.FormattedMessage,{id:n})})})]}),label:" "}):(0,un.jsx)(J.FieldWrapper,{labelCol:o,component:(0,un.jsx)(J.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,un.jsx)(J.Text,{raw:(0,un.jsx)(H.FormattedMessage,{id:n})}),checked:e}),label:" "})}const cs=["110","11002","111","11119","11129","11139","11149","11158","11159","11191","11199","112","11201","11202","11203","11204","11205","11206","11211","11212","11213","11214","11219","11229","11231","11232","11233","11234","11239","11241","11249","11251","11271","11272","11273","11274","11275","11291","11299","113","11301","11302","11303","11304","11305","11306","11311","11312","11313","11314","11318","11319","11328","11329","11331","11332","11333","11334","11338","11339","11341","11348","11349","11351","11359","11371","11381","11391","11399","114","11411","11412","11413","11430","115","11511","11512","11513","11514","11515","11516","11518","11521","11522","11523","11524","11525","11526","11527","11531","11542","11551","11561","11563","11564","11565","11566","11567","11569","11571","11573","11574","11576","11577","11578","11581","11582","11584","11601","118","11802","11811","11821","11831","120","121","12119","12129","12139","12149","12158","12159","12199","122","12211","12212","12213","12214","12219","12229","12231","12232","12233","12234","12239","12241","12249","12251","12271","12291","12299","123","12311","12312","12313","12314","12318","12319","12328","12329","12331","12332","12333","12334","12338","12339","12341","12348","12349","12351","12359","12371","12381","12391","12399","127","12711","12731","12741","12742","12743","12744","12745","12899","129","12902","12911","12912","12921","12922","12931","12932","12942","12972","12973","12971","12974","12975","12976","12977","12978","12994","12999","130","13001","13002","13003","13009","131","13101","900","91511","91561","92731","92741","92743","92744","92745","11583"];function us(e){return function(e){let t={id:"0",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){let e=n.id.toString(),s=t;for(let t=1;t<=n.id;t++)if(s.children){let n=s.children.find((n=>n.id.toString()===e.slice(0,t)));n&&(s=n)}s.children&&s.children.push({id:e+"",parentId:s.id,label:n.name+(null!==n.validTo&&yn()(n.validTo).isBefore(yn()(new Date))?" (kuni "+yn()(n.validTo).format("DD.MM.YYYY")+")":""),level:s.level+1,children:[],selectable:!0,value:!1})}return t.children?t.children:[]}(e.filter((e=>cs.includes(e.id.toString()))).sort(((e,t)=>e.id-t.id)))}function ps(e){return function(e){return e.map((e=>({id:e.id+"",label:e.firstName+" "+e.lastName+" ("+e.personalCode+")",level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.firstName.localeCompare(t.firstName))))}function hs(e){return function(e){return e.map((e=>({id:e.id+"",label:e.regName,level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.regName.localeCompare(t.regName))))}function ms(e){var t,n,s,o;return(0,un.jsxs)("div",{className:"d-flex align-items-center",children:[(0,un.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,un.jsx)(J.DatePicker,{disabled:null!==(t=e.disabled)&&void 0!==t&&t,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.from=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(n=e.value)||void 0===n?void 0:n.from})}),(0,un.jsx)("span",{className:"px-1",children:"—"}),(0,un.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,un.jsx)(J.DatePicker,{disabled:null!==(s=e.disabled)&&void 0!==s&&s,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.to=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(o=e.value)||void 0===o?void 0:o.to})})]})}const gs=e=>{const t=(0,H.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",documentNumber:"",cadastralNumber:"",documentStates:[],institutionUsers:[],proceedingNumber:"",institutions:[],proceedingMissing:!1,documentDate:{from:"",to:""}},[i,r]=(0,G.useState)(o);(0,G.useEffect)((()=>{Object.keys(e.filterState).length>0&&r(e.filterState)}),[e.documentType]);const[a,l]=(0,G.useState)(!0),[d,c]=(0,G.useState)(!0),[u,p]=(0,G.useState)(""),[h,m]=(0,G.useState)([]),[g,S]=(0,G.useState)([]),[f,I]=(0,G.useState)([]),[T,v]=(0,G.useState)(Fn(e.documentType)),[E,y]=(0,G.useState)([]),_=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions));function x(e){return n.test(e)}function M(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function O(e,t){var n;i[t]=e,"ehrCode"===t&&x(e)?l(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&c(!0),r((e=>({...e})))}(0,G.useEffect)((()=>{v(Fn(e.documentType))}),[e.documentType]),(0,G.useEffect)((()=>{if(_){const e=us(_);m(e)}if(b&&e.isKov){const e=ps(b?[...b]:[]);I(e)}if(D){const e=hs([...D]);S(e)}}),[_,b,D]);return(0,un.jsxs)(J.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,un.jsxs)(J.Row,{className:"align-items-start",children:[(0,un.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:h,onSelect:e=>M(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>M(e,"documentTypes"),value:i.documentTypes,selectedOptions:E}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>O(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>O(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_number",placement:"top-start"}}),e.documentType!==z&&e.documentType!==W&&(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:T,onSelect:e=>M(e,"documentStates"),allSelection:!0,onRemoveItem:e=>M(e,"documentStates"),value:i.documentStates,selectedOptions:E}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>O(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.proceeding_number",placement:"top-start"}}),ds(i.proceedingMissing,(function(e){r((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!yn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!yn()(e.to,"YYYY-MM-DD",!0).isValid()?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?p(t.formatMessage({id:"filter.invalid_date_range"})):p(""),r((t=>({...t,documentDate:e})))})(e),value:i.documentDate}),errorMessage:u.length>0?u:null,label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_date",placement:"top-start"}})]}),(0,un.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>O(e,"ehrCode"),onBlur:e=>l(x(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!a&&(0,un.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.ehrCode",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>O(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.word_in_address",placement:"top-start"}}),e.documentType!==z&&e.documentType!==W&&e.isKov&&(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}}),e.documentType!==z&&(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:g,onSelect:e=>M(e,"institutions"),allSelection:!0,onRemoveItem:e=>M(e,"institutions"),value:i.institutions,selectedOptions:E}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===W&&(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}})]})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{onClick:()=>(y([]),void r(o)),colourScheme:"light",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(a&&d),squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},Ss=["11566","11567","11569","11576","11577"],fs=[he,me,ge,Se],Is=e=>{const[t,n]=(0,G.useState)(!1),[s,o]=(0,G.useState)(""),[i,r]=(0,G.useState)(!1),[a,l]=(0,G.useState)([]),d=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.allowedDocumentTypesToStart)),c=e=>null==e||Number.isNaN(e)||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length;(0,G.useEffect)((()=>{if(d){const e=d.filter((e=>!Ss.includes(e.code)&&!fs.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,un.jsx)(J.ControlledPopover,{maxWidth:900,open:t,content:(0,un.jsx)("div",{style:{width:"600px"},children:(0,un.jsxs)(J.Form,{onSubmit:()=>{r(!0)},children:[(0,un.jsx)("h2",{children:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:a,value:s}),errorMessage:i&&c(s)&&(0,un.jsx)(J.Text,{raw:"common.select.required"}),label:(0,un.jsx)(J.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,un.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,un.jsx)(J.Button,{colourScheme:"light",onClick:()=>{r(!1),o("")},children:(0,un.jsx)(H.FormattedMessage,{id:"button.cancel"})}),(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,un.jsx)(J.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,un.jsx)(H.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},Ts=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12973","12975","12976","12977","12978","12999","11526","11601","11583"],vs=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11573","11574","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12951","12952","12953","12973","12975","12976","12977","12978","12999","11526","11601","11583"],Es=["11273","11272","11582","11525","11271","11201","11301","11371","11002","11581","12271","12371","12921","12931","12995","12996","12902","11802","12999","12922","12932","12942","12899","11526","12972","12973"],ys=e=>{var t,n,s,o,i,r,c;let{linkGen:u,userInfo:p}=e;const h=(0,vn.useDispatch)(),[T,v]=(0,G.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[E,y]=(0,G.useState)(!1),[_,b]=(0,G.useState)(!0),[D,x]=(0,G.useState)(!0),[M,O]=(0,G.useState)([]),[N,A]=(0,G.useState)([]),[U,w]=(0,G.useState)([]),[j,C]=(0,G.useState)({}),[L,P]=(0,G.useState)({}),[R,K]=(0,G.useState)({}),F="A"!==(null===(t=p.activeRole)||void 0===t?void 0:t.businessType);const k={userId:null===(n=p.activeRole)||void 0===n?void 0:n.userId,personId:null===(s=p.activeRole)||void 0===s?void 0:s.businessId,dotys:Ts,states:[Ln.DO_DOKUSEIS_ESITATUD,Ln.DO_DOKUSEIS_KOOSTAMISEL,Ln.DO_DOKUSEIS_EELNOU_AKTIIVNE,Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL,Ln.DO_DOKUSEIS_MENETLUSES,Ln.DO_DOKUSEIS_TAIENDAMISEL,Ln.DO_DOKUSEIS_MUUTMISEL]},Y={userId:null===(o=p.activeRole)||void 0===o?void 0:o.userId,personId:null===(i=p.activeRole)||void 0===i?void 0:i.businessId,dotys:vs,states:[Ln.DO_DOKUSEIS_KEHTETU,Ln.DO_DOKUSEIS_TUNNIST_KEHTETUKS,Ln.DO_DOKUSEIS_REG_KANTUD,"DO_DOKUSEIS_TAGASTATUD",Ln.DO_DOKUSEIS_KEELDUTUD,Ln.DO_DOKUSEIS_TYHISTATUD,Ln.DO_DOKUSEIS_LOOBUTUD,Ln.DO_DOKUSEIS_ALLKIRJASTATUD,Ln.DO_DOKUSEIS_MENETLETUD,Ln.DO_DOKUSEIS_LUBATUD,Ln.DO_DOKUSEIS_LUB_TEAV,Ln.DO_DOKUSEIS_TEAVITATUD,Ln.DO_DOKUSEIS_ANTUD,Ln.DO_DOKUSEIS_KEHTIV]},B={userId:null===(r=p.activeRole)||void 0===r?void 0:r.userId,personId:null===(c=p.activeRole)||void 0===c?void 0:c.businessId,roles:["DO_DOKU_ISIK_ROLL_ALLAK"],dotys:Es,states:[Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,G.useEffect)((()=>{var e,t;cn.classifierApiService.getAllDocumentTypes().then((e=>{h(a(e.data))})).catch((e=>{console.log(e)})),cn.institutionKovEndpointApi.getJurKovPersons().then((e=>{h(d(e.data))})).catch((e=>{console.log(e)})),F&&cn.userApiService.getJurUsers(null!==(e=null===(t=p.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{h(l(e.data))})).catch((e=>{console.log(e)})),cn.documentApiService.getDotysBasedOnUserRights().then((e=>{const t=e.data.filter((e=>"12922"!==e.code&&"11412"!==e.code&&"11413"!==e.code&&"12932"!==e.code&&"11430"!==e.code&&"12942"!==e.code));h(I(t))})).catch((e=>{console.log("Following error occured:",e)}))}),[p]),(0,G.useEffect)((()=>{(()=>{const e=k;T.workingDocs&&(e.userId=void 0),b(!0),cn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{h(m(e.data)),b(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),b(!1)}))})()}),[T.workingDocs,p]),(0,G.useEffect)((()=>{!function(){const e=Y;T.finishedDocs&&(e.userId=void 0),x(!0),cn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{h(S(e.data)),x(!1),w(e.data)})).catch((e=>{console.log("Following error occured:",e),x(!1)}))}()}),[T.finishedDocs,p]),(0,G.useEffect)((()=>{!function(){const e=B;T.signingDocs&&(e.userId=void 0),y(!0),cn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{h(g(e.data)),y(!1),O(e.data)})).catch((e=>{console.log("Following error occured:",e),y(!1)}))}()}),[T.signingDocs,p]),(0,un.jsxs)("div",{children:[(0,un.jsx)(ss,{}),(0,un.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,un.jsx)(Is,{linkGen:u})}),F&&(0,un.jsx)(J.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:W,filterState:j,onSubmit:e=>C(e),isKov:F}),children:E?(0,un.jsx)(J.SectionLoader,{}):0===M.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,un.jsx)(as,{linkGen:u,userInfo:p,documentType:W,onAllUsersChecked:e=>{v({signingDocs:e,workingDocs:T.workingDocs,finishedDocs:T.finishedDocs})},isAllUsersChecked:T.signingDocs,filter:j,fileApi:cn.fileApiService,hidePresenter:!0})}),(0,un.jsx)(J.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:q,filterState:L,onSubmit:e=>P(e),isKov:F}),children:_?(0,un.jsx)(J.SectionLoader,{}):0===N.length?(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_documents.working_documents.no_docs"})}),F&&(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{v({signingDocs:T.signingDocs,workingDocs:!0,finishedDocs:T.finishedDocs})}})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Is,{linkGen:u})})]}):(0,un.jsx)(as,{linkGen:u,userInfo:p,documentType:q,onAllUsersChecked:e=>{v({signingDocs:T.signingDocs,workingDocs:e,finishedDocs:T.finishedDocs})},isAllUsersChecked:T.workingDocs,filter:L,onDocumentDelete:e=>function(e){const t=e.slice(0,e.indexOf("/")),n=e.slice(e.indexOf("/")+1);cn.documentApiService.deleteApplicationByNumber(t,n),h(f(e))}(e),fileApi:cn.fileApiService})}),(0,un.jsx)(J.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:$,filterState:R,onSubmit:e=>K(e),isKov:F}),children:D?(0,un.jsx)(J.SectionLoader,{}):0===U.length?(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_documents.finished_documents.no_docs"})}),F&&(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{v({signingDocs:T.signingDocs,workingDocs:T.workingDocs,finishedDocs:!0})}})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Is,{linkGen:u})})]}):(0,un.jsx)(as,{linkGen:u,userInfo:p,documentType:$,onAllUsersChecked:e=>{v({signingDocs:T.signingDocs,workingDocs:T.workingDocs,finishedDocs:e}),x(!0)},isAllUsersChecked:T.finishedDocs,filter:R,fileApi:cn.fileApiService})})]})},_s={MENSEIS_TAIENDAMISEL:["MENSEIS_TAIENDAMISEL","MENSEIS_ESITATUD_TAPSUST","MENSEIS_MEN_EHITUSL_TAOT_TAPS","MENSEIS_MEN_KASUTUSL_TAOT_TAPS","MENSEIS_MEN_EDASTATUD_MARK_LAHEND"],MENSEIS_ALGATATUD:["MENSEIS_ALGATATUD","MENSEIS_ESITATUD"],MENSEIS_KAIMASOLEV:["MENSEIS_KAIMASOLEV","MENSEIS_MEN","MENSEIS_MEN_KNT_TAOT","MENSEIS_EHITUSTEGEVUS_ALANUD","MENSEIS_EHITUSTEGEVUS_LOPPENUD","MENSEIS_EHITUSTEG_LOPP","MENSEIS_LAMMUTATUD","MENSEIS_MEN_EHITUSL_TAOT","MENSEIS_MEN_KASUTUSL_TAOT","MENSEIS_MEN_LAMMUTUSL_TAOT"],MENSEIS_LOPETATUD:["MENSEIS_LOPETATUD","MENSEIS_MEN_ALLKIRJASTATUD","MENSEIS_MEN_KNT_ANTUD","MENSEIS_MEN_KNT_KEELD","MENSEIS_EHITUSL_KEHTETU","MENSEIS_KASUTUSL_KEHTETU","MENSEIS_KNT_KEHTETU","MENSEIS_MEN_EHITUSL_ANTUD","MENSEIS_MEN_EHITUSL_KEELD","MENSEIS_MEN_KASUTUSL_ANTUD","MENSEIS_MEN_KASUTUSL_KEELD","MENSEIS_MEN_LAMMUTUSL_ANTUD","MENSEIS_MEN_LAMMUTUSL_KEELD","MENSEIS_MEN_PRO_TING_ANTUD","MENSEIS_MEN_TEAVITATUD"],MENSEIS_MUUTMISEL:["MENSEIS_MUUTMISEL","MENSEIS_MEN_TAIENDAB"],MENSEIS_PEATATUD:["MENSEIS_PEATATUD"],MENSEIS_ARHIIVIS:["MENSEIS_ARHIIVIS"]};function bs(e){return Bn(_s,e)}function Ds(e){const t=bs(e);return t?function(e){switch(e){case"MENSEIS_TAIENDAMISEL":return{name:"Algdokument täiendamisel",type:"warning"};case"MENSEIS_ALGATATUD":return{name:"Algatatud",type:"info"};case"MENSEIS_KAIMASOLEV":return{name:"Käimasolev",type:"info"};case"MENSEIS_LOPETATUD":return{name:"Lõpetatud",type:"success"};case"MENSEIS_MUUTMISEL":return{name:"Algdokument muutmisel",type:"info"};case"MENSEIS_PEATATUD":return{name:"Peatatud",type:"warning"};case"MENSEIS_ARHIIVIS":return{name:"Arhiivis",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const xs=[{code:"MENSEIS_TAIENDAMISEL",value:"Algdokument täiendamisel"},{code:"MENSEIS_ALGATATUD",value:"Algatatud"},{code:"MENSEIS_KAIMASOLEV",value:"Käimasolev"},{code:"MENSEIS_LOPETATUD",value:"Lõpetatud"},{code:"MENSEIS_MUUTMISEL",value:"Algdokument muutmisel"},{code:"MENSEIS_PEATATUD",value:"Peatatud"}];function Ms(){return xs.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Os(e,t){if(console.log("filterService",t),t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.proceedingStates.length>0&&(e=e.filter((e=>void 0!==e.stateCode&&t.proceedingStates.includes(bs(e.stateCode))))),t.connectedPerson.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.supervisor)||void 0===s?void 0:s.startsWith(t.connectedPerson))&&void 0!==n&&n}))),!1===t.showProceedingInArchive&&(e=e.filter((e=>"Ei"===e.archived))),t.supervisors.length>0&&(e=e.filter((e=>void 0!==e.supervisorId&&t.supervisors.includes(e.supervisorId.toString())))),t.proceedingDate.from.length>0&&0===t.proceedingDate.to.length){const n=new Date(t.proceedingDate.from).getTime();e=e.filter((e=>new Date(yn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.proceedingDate.to.length>0&&0===t.proceedingDate.from.length){const n=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(yn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.proceedingDate.from.length>0&&t.proceedingDate.to.length>0){const n=new Date(t.proceedingDate.from).getTime(),s=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(yn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(yn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}if(t.lastEventDate.length>0){const n=new Date(t.lastEventDate).getTime();e=e.filter((e=>e.lastEventDate&&new Date(yn()(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function Ns(){return xs.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}let As=function(e){return e.Document="DOCUMENT",e.Proceeding="PROCEEDING",e.AdminProceeding="ADMIN_PROCEEDING",e.ProceedingDecision="PROCEEDING_DECISION",e.Operation="OPERATION",e.MyDocuments="MY_DOCUMENTS",e.MyProceedings="MY_PROCEEDINGS",e.MyAdministrativeProceedings="MY_ADMIN_PROCEEDINGS",e.Building="BUILDING",e.NewEnergy="NEW_ENERGY",e.ArchiveBuildingRegistryFile="ARCHIVE_BUILDINGREGISTRYFILE",e.ArchiveBuildingDatasOf2003="ARCHIVE_BUILDINGDATAASOF2003",e.ArchiveBuildingDatasOf2014="ARCHIVE_BUILDINGDATAASOF2014",e.Restriction="RESTRICTION",e.NotFound="404",e}({});const Us=e=>e?(e=>[...fe,...Ie].includes(e))(e)?As.AdminProceeding:As.Proceeding:As.NotFound,ws=e=>{const t=(0,H.useIntl)(),[n,s]=(0,G.useState)({offset:0,limit:50}),[o,i]=(0,G.useState)([]),[r,a]=(0,G.useState)({column:5,direction:An}),[l,d]=(0,G.useState)(!1),[c,u]=(0,G.useState)(!1),[p,h]=(0,G.useState)(!1),m=(0,vn.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>Yn(e.dateStart)?new Date(yn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.deadline)?new Date(yn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingCircleNr)&&void 0!==t?t:""},e=>e.operationsCount?{done:e.operationsCount.split("/")[0],all:e.operationsCount.split("/")[1]}:"",e=>Yn(e.innerCommentDeadline)?new Date(e.innerCommentDeadline).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.lastEventDate)?new Date(e.lastEventDate).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.document)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&e.buildingName[0]?e.buildingName[0]:"",e=>e.ehrCode&&e.ehrCode[0]?e.ehrCode[0]:"",e=>e.address&&e.address[0]?e.address[0]:"",e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentPresenter)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.archived)&&void 0!==t?t:""},e=>e.proceedingLength?e.proceedingLength:Number.MAX_SAFE_INTEGER];(0,G.useEffect)((()=>{if(m){const e=5,t=wn(e,r);t.direction===Nn&&(t.direction=An),a(t),i(On(m,g[e],t.direction))}}),[m]),(0,G.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(r.direction===Nn?i(Os(m,e.filter)):i(On(Os(m,e.filter),g[r.column],r.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,G.useEffect)((()=>{r&&r.direction!==Nn&&0!==o.length&&i(On(o,g[r.column],r.direction))}),[r]);const S=["my_proceedings.date_start","my_proceedings.deadline","my_proceedings.proceeding_nr","my_proceedings.state","my_proceedings.proceeding_circle_nr","my_proceedings.operations_count","my_proceedings.inner_comment_deadline","my_proceedings.last_event","my_proceedings.document","my_proceedings.document_type","my_proceedings.building_name","my_proceedings.ehr_code","my_proceedings.address","my_proceedings.proceeding_name","my_proceedings.supervisor","my_proceedings.document_presenter","my_proceedings.archived","my_proceedings.proceeding_length"];return(0,un.jsxs)(J.Section,{form:!0,children:[o&&(0,un.jsx)(J.CollapseTable,{content:(t=>{const s=t,{linkGen:o}=e;return s.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,i,r,a,m;let g={addresses:[],ehrCodes:[],buildingNames:[]};t.address&&(null===(n=t.address)||void 0===n?void 0:n.length)>1&&(g=function(e,t,n){let s={addresses:[],ehrCodes:[],buildingNames:[]};if(e&&e.length>1){let o=[];for(let s=0;s<e.length;s++){let i=e[s].split(",");o.push({county:i[0],city:i[1]?i[1].trimStart():"",other:i[2]?i[2].trimStart()+","+i[3]:"",ehrCode:t?t[s]:"",buildingName:n?n[s]:""})}const i=o.reduce(((e,t)=>{var n;const{county:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});let r=[];o.forEach((e=>{const t=e.county;r.includes(t)||r.push(t)}));let a=[];o.forEach((e=>{const t=e.city;a.includes(t)||a.push(t)})),r.forEach((e=>{const t=i[e].reduce(((e,t)=>{var n;const{city:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});i[e]=t}));let l=[],d=[],c=[];r.forEach((e=>{a.forEach((t=>{let n="";if(i[e][t]){n+=e+", "+t;for(let s=0;s<i[e][t].length;s++){const o=i[e][t][s];n+=", "+o.other,0===s?l.push(n):l.push(o.other),d.push(o.ehrCode),c.push(o.buildingName)}}}))})),s={addresses:l,ehrCodes:d,buildingNames:c}}return s}(t.address,t.ehrCode,t.buildingName));const S=Us(t.doty);return(0,un.jsx)(J.CollapseTableRow,{fields:[t.dateStart,yn()(t.deadline,"DD.MM.YYYY").valueOf()<yn()().valueOf()?(0,un.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,un.jsx)(J.Tooltip,{content:(0,un.jsx)(J.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(J.Link,{onClick:e=>{o(!0,e,S,t.proceedingNr)},text:t.proceedingNr,href:o(!1,void 0,S,t.proceedingNr)})},t.proceedingNr),t.stateCode?(0,un.jsx)(J.Status,{type:Ds(t.stateCode).type,children:Ds(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?yn()(t.innerCommentDeadline).valueOf()<=yn()().valueOf()?(0,un.jsx)("div",{style:{color:"#00b649"},children:yn()(t.innerCommentDeadline).format("DD.MM.YYYY")}):yn()(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?yn()(t.lastEventDate).format("DD.MM.YYYY"):"",(0,un.jsx)(gn,{linkName:t.document,tooltipText:"my_proceedings.tooltip.open_document",functionCall:n=>{e.linkGen(!0,n,"DOCUMENT",t.document)}}),t.documentType,t.buildingName&&(null===(i=t.buildingName)||void 0===i?void 0:i.length)>0?(0,un.jsx)("div",{children:p?(0,un.jsxs)("div",{children:[g.buildingNames.map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),t.buildingName.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,un.jsxs)("div",{children:[null===(r=g.buildingNames)||void 0===r?void 0:r.slice(0,4).map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),null===(a=g.buildingNames)||void 0===a?void 0:a.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,un.jsx)("div",{children:c?(0,un.jsxs)("div",{children:[g.ehrCodes.map((t=>(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,un.jsx)(gn,{linkName:t.ehrCode[0],tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t.ehrCode)},href:e.linkGen(!1,void 0,"BUILDING",t.ehrCode)}):(0,un.jsxs)("div",{children:[g.ehrCodes.slice(0,4).map(((t,n)=>(0,un.jsxs)(V().Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]},n))),g.ehrCodes.slice(4,5).map((t=>(0,un.jsx)(gn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),t.ehrCode.length>5?" ...":"",t.ehrCode.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,un.jsx)("div",{style:{width:125},children:l?(0,un.jsxs)("div",{children:[g.addresses.map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),t.address.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,un.jsxs)("div",{children:[g.addresses.slice(0,4).map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),null===(m=g.addresses)||void 0===m?void 0:m.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_all_addresses"})})})]})}):"",t.proceedingName,t.supervisor,t.documentPresenter,t.archived,t.proceedingLength]},t.id)}))})(o),headers:S.map(((e,n)=>(0,un.jsxs)("div",{children:[(0,un.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(n,r);a(e)},children:r.column===n?(0,un.jsx)(jn,{sortDirection:r.direction}):(0,un.jsx)(jn,{sortDirection:Nn})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,un.jsx)(un.Fragment,{children:e.isKov?(0,un.jsx)("div",{className:"d-flex justify-content-start",children:(0,un.jsx)(J.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,un.jsx)(J.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},js={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},Cs=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,H.useIntl)(),i=/^[\\s0-9]{0,9}$/,r=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,[a,l]=(0,G.useState)(s),[d,c]=(0,G.useState)(!0),[u,p]=(0,G.useState)(!0),[h,m]=(0,G.useState)(""),[g,S]=(0,G.useState)(""),[f,I]=(0,G.useState)([]),[T,v]=(0,G.useState)([]),[E]=(0,G.useState)(Ms()),[y,_]=(0,G.useState)([]),[b,D]=(0,G.useState)(Ns()),x=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),M=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutionUsers));function O(e){return i.test(e)}function N(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],D(n.map((e=>({id:e})))),l((e=>({...e,[t]:n})))}function A(e,t){var n;"ehrCode"===t&&O(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||r.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,G.useEffect)((()=>{if(x){const e=us(x);I(e)}if(M&&n){const e=ps([...M]);v(e)}}),[x,M]);return(0,un.jsxs)(J.Form,{onSubmit:()=>t(a),children:[(0,un.jsxs)(J.Row,{className:"align-items-start",children:[(0,un.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:f,onSelect:e=>N(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>N(e,"documentTypes"),value:a.documentTypes,selectedOptions:y}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.proceedingNumber}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:E,onSelect:e=>{N(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>N(e,"proceedingStates"),value:a.proceedingStates,selectedOptions:b}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),ds(a.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(J.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!yn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!yn()(e.to,"YYYY-MM-DD",!0).isValid()?m(o.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(o.formatMessage({id:"filter.invalid_date_range"})):m(""),l((t=>({...t,proceedingDate:e})))})(e),value:a.proceedingDate})}),errorMessage:h.length>0?h:null,label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.proceeding_date",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.DatePicker,{name:"datepicker-field",value:a.lastEventDate,onChange:e=>function(e){""===e||yn()(e,"YYYY-MM-DD",!0).isValid()?S(""):S(o.formatMessage({id:"filter.invalid_date_format"})),l((t=>({...t,lastEventDate:e})))}(e)}),errorMessage:g.length>0?g:null,label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.last_event_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.last_event_date",placement:"top-start"}})]}),(0,un.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(O(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.ehrCode}),errorMessage:!d&&(0,un.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.ehrCode",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.buildingName}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.wordInAddress}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.word_in_address",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.connectedPerson}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.connected_person"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.connected_person",placement:"top-start"}}),n&&(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:T,onSelect:e=>N(e,"supervisors"),allSelection:!0,onRemoveItem:e=>N(e,"supervisors"),value:a.supervisors,selectedOptions:y}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{onClick:()=>(_([]),l(js),void D(Ns())),colourScheme:"light",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},Ls={MENTOIMSEIS_OOTEL:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_JATKAMINE"],MENTOIMSEIS_TEOSTAMISEL:["MENTOIMSEIS_TEOSTAMISEL"],MENTOIMSEIS_TYHISTATUD:["MENTOIMSEIS_TYHISTATUD"],MENTOIMSEIS_TEOSTATUD:["MENTOIMSEIS_TEOSTATUD","MENTOIMSEIS_KOOSKOLA","MENTOIMSEIS_KOOSKOLA_MARK","MENTOIMSEIS_VALMIS","MENTOIMSEIS_VANA_VERSIOON","MENTOIMSEIS_ARHIIVIS","MENTOIMSEIS_EDASTATUD"],MENTOIMSEIS_LOOBUTUD:["MENTOIMSEIS_LOOBUTUD","MENTOIMSEIS_KEELDUTUD","MENTOIMSEIS_TAGASI_LYKATUD"],MENTOIMSEIS_TAHTAEG_MOODUNUD:["MENTOIMSEIS_TAHTAEG_MOODUNUD"]};let Ps=function(e){return e.MENTOIMSEIS_ARHIIVIS="MENTOIMSEIS_ARHIIVIS",e.MENTOIMSEIS_TYISTATUD="MENTOIMSEIS_TYISTATUD",e.MENTOIMSEIS_EDASTATUD="MENTOIMSEIS_EDASTATUD",e.MENTOIMSEIS_TEOSTAMISEL="MENTOIMSEIS_TEOSTAMISEL",e.MENTOIMSEIS_TYHISTATUD="MENTOIMSEIS_TYHISTATUD",e.MENTOIMSEIS_VALMIS="MENTOIMSEIS_VALMIS",e.MENTOIMSEIS_KEELDUTUD="MENTOIMSEIS_KEELDUTUD",e.MENTOIMSEIS_KOOSKOLA="MENTOIMSEIS_KOOSKOLA",e.MENTOIMSEIS_KOOSKOLA_MARK="MENTOIMSEIS_KOOSKOLA_MARK",e.MENTOIMSEIS_OOTEL="MENTOIMSEIS_OOTEL",e.MENTOIMSEIS_TAGASI_LYKATUD="MENTOIMSEIS_TAGASI_LYKATUD",e.MENTOIMSEIS_ADS="MENTOIMSEIS_ADS",e.MENTOIMSEIS_ADS_ESITAMATA="MENTOIMSEIS_ADS_ESITAMATA",e.MENTOIMSEIS_ADS_JOUSTUNUD="MENTOIMSEIS_ADS_JOUSTUNUD",e.MENTOIMSEIS_ADS_KONTROLL="MENTOIMSEIS_ADS_KONTROLL",e.MENTOIMSEIS_ADS_PROBLEEM="MENTOIMSEIS_ADS_PROBLEEM",e.MENTOIMSEIS_ADS_TYHISTATUD="MENTOIMSEIS_ADS_TYHISTATUD",e.MENTOIMSEIS_ADS_TYISTATUD="MENTOIMSEIS_ADS_TYISTATUD",e.MENTOIMSEIS_VANA_VERSIOON="MENTOIMSEIS_VANA_VERSIOON",e.MENTOIMSEIS_LOOBUTUD="MENTOIMSEIS_LOOBUTUD",e.MENTOIMSEIS_TEOSTATUD="MENTOIMSEIS_TEOSTATUD",e.MENTOIMSEIS_TAHTAEG_MOODUNUD="MENTOIMSEIS_TAHTAEG_MOODUNUD",e.MENTOIMSEIS_JATKAMINE="MENTOIMSEIS_JATKAMINE",e}({});function Rs(e){return Bn(Ls,e)}const Ks={[Ps.MENTOIMSEIS_OOTEL]:"info",[Ps.MENTOIMSEIS_TEOSTAMISEL]:"info",[Ps.MENTOIMSEIS_TYHISTATUD]:"default",[Ps.MENTOIMSEIS_TEOSTATUD]:"success",[Ps.MENTOIMSEIS_LOOBUTUD]:"default",[Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},Fs={[Ps.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[Ps.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[Ps.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[Ps.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[Ps.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function ks(e,t){return((e,t)=>({state:Object.keys(Fs).includes(e)?t.formatMessage({id:Fs[e]}):e,type:Object.keys(Ks).includes(e)?Ks[e]:"default"}))(Rs(e),t)}const Ys=(e,t)=>({code:e,value:t.formatMessage({id:Fs[e]})});function Bs(e,t){let n;return n=e===Z?[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ys(e,t))):e===ne?[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ys(e,t))):e===se?[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD].map((e=>Ys(e,t))):[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ys(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function Gs(){return[{code:"11271",value:"Ehitusluba"},{code:"11201",value:"Ehitusteatis"},{code:"11371",value:"Kasutusluba"},{code:"11301",value:"Kasutusteatis"},{code:"11002",value:"Projekteerimistingimused"},{code:"11051",value:"5G pääsupunkti taotlus"}].map((e=>({id:`${e.code}`,label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Vs(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>e.doty&&void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.institutions.length>0&&(e=e.filter((e=>{var n;return e.supervisorJurId&&void 0!==e.supervisorJurId&&t.institutions.includes(null===(n=e.supervisorJurId)||void 0===n?void 0:n.toString())}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.operationStates.length>0&&(e=e.filter((e=>e.stateCode&&void 0!==e.stateCode&&t.operationStates.includes(Rs(e.stateCode))))),t.institutionUsers&&t.institutionUsers.length>0&&(e=e.filter((e=>e.operationExecutorId&&void 0!==e.operationExecutorId&&t.institutionUsers.includes(e.operationExecutorId.toString())))),t.operationDate.from.length>0&&0===t.operationDate.to.length){const n=new Date(t.operationDate.from).getTime();e=e.filter((e=>new Date(yn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDate.to.length>0&&0===t.operationDate.from.length){const n=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(yn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDeadline.from.length>0){const n=new Date(t.operationDeadline.from).getTime();e=e.filter((e=>!e.deadline||new Date(yn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDeadline.to.length>0){const n=new Date(t.operationDeadline.to).getTime();e=e.filter((e=>!e.deadline||new Date(yn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDate.from.length>0&&t.operationDate.to.length>0){const n=new Date(t.operationDate.from).getTime(),s=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(yn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(yn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Hs(e){return[{id:Ps.MENTOIMSEIS_OOTEL},{id:Ps.MENTOIMSEIS_TEOSTAMISEL},{id:Ps.MENTOIMSEIS_TEOSTATUD},{id:Ps.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let Js=function(e){return e.Document="DOCUMENT",e.Proceeding="PROCEEDING",e.AdminProceeding="ADMIN_PROCEEDING",e.AdminOperation="ADMIN_OPERATION",e.ProceedingDecision="PROCEEDING_DECISION",e.Operation="OPERATION",e.MyDocuments="MY_DOCUMENTS",e.MyProceedings="MY_PROCEEDINGS",e.MyAdministrativeProceedings="MY_ADMIN_PROCEEDINGS",e.Building="BUILDING",e.NewEnergy="NEW_ENERGY",e.ArchiveBuildingRegistryFile="ARCHIVE_BUILDINGREGISTRYFILE",e.ArchiveBuildingDatasOf2003="ARCHIVE_BUILDINGDATAASOF2003",e.ArchiveBuildingDatasOf2014="ARCHIVE_BUILDINGDATAASOF2014",e.Restriction="RESTRICTION",e.NotFound="404",e}({});const Ws=["11273","11272"],qs=e=>{const t=(0,H.useIntl)(),[n,s]=(0,G.useState)({offset:0,limit:10}),[o,i]=(0,G.useState)([]),[r,a]=(0,G.useState)({column:1,direction:Un}),[l,d]=(0,G.useState)(!1),[c,u]=(0,G.useState)(!1),[p,h]=(0,G.useState)(!1),m=(0,vn.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,vn.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),S=(0,vn.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),f=(0,vn.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),v=[e=>Yn(e.invitationDate)?new Date(yn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.deadline)?new Date(yn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.operationExecutor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.buildingName&&null!==e.buildingName&&Yn(e.buildingName[0])?e.buildingName[0]:"",e=>void 0!==e.ehrCode&&null!==e.ehrCode&&Yn(e.ehrCode[0])?e.ehrCode[0]:"",e=>void 0!==e.address&&null!==e.address&&Yn(e.address[0])?e.address[0]:"",e=>{var t,n;return null!==(t=null===(n=I.find((t=>t.id===e.supervisorJurId)))||void 0===n?void 0:n.regName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""}];(0,G.useEffect)((()=>{!m||e.viewType!==Q&&e.viewType!==X||(i(Vs(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,G.useEffect)((()=>{m&&e.viewType===Z&&(i(On(Vs(m,e.filter),v[0],Un)),s({offset:0,limit:10}))}),[m,e.filter]),(0,G.useEffect)((()=>{g&&e.viewType===te&&(r.direction===Nn?i(Vs(g,e.filter)):i(On(Vs(g,e.filter),v[r.column],r.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,G.useEffect)((()=>{S&&e.viewType===ne&&(i(Vs(S,e.filter)),s({offset:0,limit:10}))}),[S,e.filter]),(0,G.useEffect)((()=>{f&&e.viewType===se&&(r.direction===Nn?i(Vs(f,e.filter)):i(On(Vs(f,e.filter),v[r.column],r.direction)))}),[f,e.filter]);const E=["my_operations.invitation_date","my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.operation_executor","my_operations.connected_document_type","my_operations.building_name","my_operations.ehr_code","my_operations.building_address","my_operations.institution","my_operations.supervisor"],y=["my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.supervisor","my_operations.connected_document_type","my_operations.building_address"],_=[e=>Yn(e.deadline)?new Date(yn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.address&&null!==e.address&&Yn(e.address[0])?e.address[0]:""];const b=t=>{let n=Js.Operation;return e.viewType===se?(n=t.doty&&Ws.includes(t.doty)?Js.AdminProceeding:Js.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&Ws.includes(t.doty)||t.typeCode===ce.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=Js.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,un.jsxs)(J.Section,{form:!0,children:[o&&(0,un.jsx)(J.CollapseTable,{content:(s=>s.slice(n.offset,n.offset+n.limit).map((n=>{var s,o,i,r,a,m,g,S;const f=[n.invitationDate,yn()(n.deadline,"DD.MM.YYYY").valueOf()<yn()().valueOf()?(0,un.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,un.jsx)(J.Tooltip,{content:(0,un.jsx)(J.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(J.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,un.jsx)(J.Status,{type:ks(n.stateCode,t).type,children:ks(n.stateCode,t).state}):"",n.operationExecutor,n.doty?null===(s=T.find((e=>e.id.toString()===n.doty)))||void 0===s?void 0:s.name:"",n.buildingName?(0,un.jsx)("div",{children:p?(0,un.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,un.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(i=n.buildingName)||void 0===i?void 0:i.slice(4,5),n.buildingName.length>5?" ...":"",n.buildingName.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,un.jsx)("div",{children:c?(0,un.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,un.jsxs)(V().Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,un.jsxs)("div",{children:[null===(r=n.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((t,n)=>(0,un.jsxs)(V().Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]},n))),null===(a=n.ehrCode)||void 0===a?void 0:a.slice(4,5).map((t=>(0,un.jsx)(gn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),n.ehrCode.length>5?" ...":"",n.ehrCode.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,un.jsx)("div",{children:l?(0,un.jsxs)("div",{children:[n.address.map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),n.address.length>5&&(0,un.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,un.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,un.jsxs)(V().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(g=n.address)||void 0===g?void 0:g.slice(4,5),n.address.length>5?" ...":"",n.address.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.link.view_all_addresses"})})})]})}):"",n.supervisorJurId?null===(S=I.find((e=>e.id===n.supervisorJurId)))||void 0===S?void 0:S.regName:"",n.supervisor],v=[...f];v.splice(4,1);const E=[...f].slice(1,4).concat(f[10]).concat(f[5]).concat(f[8]);return(0,un.jsx)(J.CollapseTableRow,{fields:e.viewType===Z?v:e.viewType===se?E:f},n.id)})))(o),headers:function(){const n=[...E];n.splice(4,1);const s=e.viewType===Z?n:e.viewType===se?y:E,l=[...v];l.splice(4,1);const d=e.viewType===Z?l:e.viewType===se?_:v;return s.map(((e,n)=>(0,un.jsxs)("div",{children:[(0,un.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(n,r);a(e),e.direction!==Nn&&i(On(o,d[n],e.direction))},children:r.column===n?(0,un.jsx)(jn,{sortDirection:r.direction}):(0,un.jsx)(jn,{sortDirection:Nn})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===X||e.viewType===Q)&&(0,un.jsx)("div",{className:"d-flex justify-content-start",children:(0,un.jsx)(J.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===X?(0,un.jsx)(J.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,un.jsx)(J.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},$s=e=>{var t;const n=(0,H.useIntl)(),s=/^[\\s0-9]{0,9}$/,o=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,i=null!==(t=e.initialFilter)&&void 0!==t?t:{documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},r={...i,operationStates:[Ps.MENTOIMSEIS_TEOSTAMISEL]},a={...i,operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[Ps.MENTOIMSEIS_OOTEL]},[d,c]=(0,G.useState)(e.filterState),[u,p]=(0,G.useState)(Hs(d.operationStates)),[h,m]=(0,G.useState)(!0),[g,S]=(0,G.useState)(!0),[f,I]=(0,G.useState)(""),[T,v]=(0,G.useState)(""),E=(0,G.useMemo)((()=>Gs()),[]),[y,_]=(0,G.useState)([]),[b,D]=(0,G.useState)([]),x=(0,G.useMemo)((()=>Bs(e.viewType,n)),[e.viewType]),[M,O]=(0,G.useState)([]),N=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions));function U(e){return s.test(e)}function w(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],d[t]=n,c((e=>({...e})))}function j(e,t){var n;d[t]=e,"ehrCode"===t&&U(e)?m(!0):"cadastralNumber"===t&&(0===(n=e).length||o.test(n))&&S(!0),c((e=>({...e})))}(0,G.useEffect)((()=>{if(N){const e=ps(N?[...N]:[]);D(e)}if(A){const e=hs([...A]);_(e)}}),[N,A]);return(0,un.jsxs)(J.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,un.jsx)(J.Row,{className:"align-items-start",children:(0,un.jsx)(J.Col,{sm:10,className:"mx-0 px-0",children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:E,onSelect:e=>w(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>w(e,"documentTypes"),value:d.documentTypes,selectedOptions:M}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,un.jsx)(J.Row,{className:"align-items-start",children:(0,un.jsx)(J.Col,{sm:10,className:"mx-0 px-0",children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>j(e,"ehrCode"),onBlur:e=>S(U(e.trim())),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.ehrCode}),errorMessage:!h&&(0,un.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,un.jsxs)(J.Row,{className:"align-items-start",children:[(0,un.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:y,onSelect:e=>w(e,"institutions"),allSelection:!0,onRemoveItem:e=>w(e,"institutions"),value:d.institutions,selectedOptions:M}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>j(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:x,onSelect:e=>w(e,"operationStates"),allSelection:!0,onRemoveItem:e=>w(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!yn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!yn()(e.to,"YYYY-MM-DD",!0).isValid()?I(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?I(n.formatMessage({id:"filter.invalid_date_range"})):I(""),c((t=>({...t,operationDate:e})))})(e),value:d.operationDate}),errorMessage:f.length>0?f:null,label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,un.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>j(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:b,onSelect:e=>w(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>w(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:M}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!yn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!yn()(e.to,"YYYY-MM-DD",!0).isValid()?v(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?v(n.formatMessage({id:"filter.invalid_date_range"})):v(""),c((t=>({...t,operationDeadline:e})))})(e),value:d.operationDeadline}),errorMessage:T.length>0?T:null,label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{onClick:()=>function(){let t;switch(O([]),e.viewType){case ee:t=r;break;case te:case se:t=a;break;case ne:t=l;break;default:t=i}c(t),p(Hs(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},zs=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:r,linkGen:d,myViewsApiEndpoint:c,userInfo:u,userApiEndpoint:p}=e;const h=(0,vn.useDispatch)(),[m,g]=(0,G.useState)({proceedings:!1}),[S,f]=(0,G.useState)(!0),[I,T]=(0,G.useState)(!0),[v,b]=(0,G.useState)(!0),[D,x]=(0,G.useState)([]),[M,O]=(0,G.useState)([]),[N,A]=(0,G.useState)([]),U=new je(new Tt({basePath:i})),w=new Qe(new Tt({basePath:p})),j=new It(new Tt({basePath:c})),C=new pt(new Tt({basePath:c})),L=new St(new Tt({basePath:c})),P=new Wt(new qt({basePath:r})),R="A"!==(null===(t=u.activeRole)||void 0===t?void 0:t.businessType);let K=new Date;K.setDate(K.getDate()-7);const F={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_TEOSTAMISEL"],institutionUsers:[(null===(n=u.activeRole)||void 0===n?void 0:n.userId)+""],operationDate:{from:"",to:""},operationDeadline:{from:K.toISOString().split("T")[0],to:""}},[k,Y]=(0,G.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[B,V]=(0,G.useState)(F),[H,W]=(0,G.useState)({});const q={userId:null===(s=u.activeRole)||void 0===s?void 0:s.userId,personId:null===(o=u.activeRole)||void 0===o?void 0:o.businessId,dotys:["11525","11271","11201","11301","11271","11371","11002","11582","11581","12271","12371","11413","11412","11430","11583","11274","11275"],states:[Ln.DO_DOKUSEIS_ESITATUD,Ln.DO_DOKUSEIS_MENETLUSES]};return(0,G.useEffect)((()=>{!function(e){var t,n;const s={userId:e.institutionUsers?Number(e.institutionUsers[0]):null===(t=u.activeRole)||void 0===t?void 0:t.userId,personId:null===(n=u.activeRole)||void 0===n?void 0:n.businessId,states:e.operationStates,type:[ce.MENTOIMLIIK_MEN_MARKUS]};T(!0),L.findOperationsToComment(s).then((e=>{h(y(e.data)),O(e.data),T(!1)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))}(B)}),[u,B]),(0,G.useEffect)((()=>{(()=>{const e=q;m.proceedings&&(e.userId=void 0),f(!0),j.findProceedings(e).then((e=>{h(E(e.data)),x(e.data),f(!1)})).catch((e=>{console.log("Following error occured:",e),f(!1)}))})()}),[m.proceedings]),(0,G.useEffect)((()=>{!function(){const e=q;e.userId=void 0,b(!0),C.findIncomingBaseDocuments(e).then((e=>{h(_(e.data)),b(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),b(!1)}))}()}),[u]),(0,G.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{h(a(e.data))})).catch((e=>{console.log(e)})),R&&w.getJurUsers(null!==(e=null===(t=u.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{h(l(e.data))})).catch((e=>{console.log(e)}))}),[u]),(0,un.jsxs)("div",{children:[(0,un.jsx)(J.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,un.jsx)(Cs,{onSubmit:e=>{Y(e)},isKov:R,filterState:k}),children:S?(0,un.jsx)(J.SectionLoader,{}):0===D.length?(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_proceedings.no_proceedings"})}),R&&(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{g({proceedings:!0})}})})]}):(0,un.jsx)(ws,{linkGen:d,isKov:R,onAllUsersChecked:e=>{g({proceedings:e})},isAllUsersChecked:m.proceedings,filter:k})}),R&&(0,un.jsx)(J.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,un.jsx)($s,{viewType:se,initialFilter:F,filterState:B,onSubmit:e=>V(e)}),children:I?(0,un.jsx)(J.SectionLoader,{}):0===M.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,un.jsx)(qs,{linkGen:d,viewType:se,filter:B})}),R&&(0,un.jsx)(J.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:z,filterState:H,onSubmit:e=>W(e),isKov:R}),children:v?(0,un.jsx)(J.SectionLoader,{}):0===N.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,un.jsx)(as,{linkGen:d,userInfo:u,documentType:z,filter:H,fileApi:P})})]})},Xs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,vn.useDispatch)(),[c,u]=(0,G.useState)(!0),[p,h]=(0,G.useState)(!1),[m,g]=(0,G.useState)(!1),[S,f]=(0,G.useState)(null),[I,T]=(0,G.useState)(null),[v,E]=(0,G.useState)(null),y={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},_={...y,operationStates:[Ps.MENTOIMSEIS_TEOSTAMISEL]},b={...y,operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_JATKAMINE]},D={...y,operationStates:[Ps.MENTOIMSEIS_OOTEL]},[N,A]=(0,G.useState)(_),[U,w]=(0,G.useState)(b),[j,C]=(0,G.useState)(D),[L,P]=(0,G.useState)(!1),R=new Je(new Tt({basePath:o})),K=new Qe(new Tt({basePath:o})),F=new St(new Tt({basePath:s})),k=new je(new Tt({basePath:t}));return(0,G.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(d(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(l(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{r(a(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,G.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[ce.MENTOIMLIIK_VALINE_KOOSK],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)};L&&(e.userId=void 0),u(!0),F.findOperations(e).then((e=>{r(x(e.data)),f(e.data),u(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),u(!1)}))}()}),[L]),(0,G.useEffect)((()=>{h(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ce.MENTOIMLIIK_VALINE_KOOSK],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(M(e.data)),T(e.data),h(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),h(!1)})),g(!0),F.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[ce.MENTOIMLIIK_VALINE_KOOSK],states:Ls.MENTOIMSEIS_OOTEL.concat(Ls.MENTOIMSEIS_TEOSTAMISEL,Ls.MENTOIMSEIS_TYHISTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(O(e.data)),E(e.data),g(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),g(!1)}))}),[]),(0,un.jsxs)("div",{children:[(0,un.jsxs)(J.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,un.jsx)($s,{viewType:ee,filterState:N,onSubmit:e=>A(e)}),children:[c&&(0,un.jsx)(J.SectionLoader,{}),c||S?(0,un.jsx)(qs,{linkGen:n,viewType:X,filter:N,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_approvals.no_approvals"})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{P(!0)}})})]})]}),(0,un.jsxs)(J.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,un.jsx)($s,{viewType:te,filterState:U,onSubmit:e=>w(e)}),children:[p&&(0,un.jsx)(J.SectionLoader,{}),p||I?(0,un.jsx)(qs,{linkGen:n,viewType:te,filter:U}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,un.jsxs)(J.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,un.jsx)($s,{viewType:ne,filterState:j,onSubmit:e=>C(e)}),children:[m&&(0,un.jsx)(J.SectionLoader,{}),m||v?(0,un.jsx)(qs,{linkGen:n,viewType:ne,filter:j}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},Qs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,vn.useDispatch)(),[c,u]=(0,G.useState)(!1),[p,h]=(0,G.useState)(!1),[m,g]=(0,G.useState)(!1),[S,f]=(0,G.useState)(null),[I,T]=(0,G.useState)(null),[v,E]=(0,G.useState)(null),y={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},_={...y,operationStates:[Ps.MENTOIMSEIS_TEOSTAMISEL]},b={...y,operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_JATKAMINE]},D={...y,operationStates:[Ps.MENTOIMSEIS_OOTEL]},[N,A]=(0,G.useState)(_),[U,w]=(0,G.useState)(b),[j,C]=(0,G.useState)(D),[L,P]=(0,G.useState)(!1),R=new Je(new Tt({basePath:o})),K=new Qe(new Tt({basePath:o})),F=new St(new Tt({basePath:s})),k=new je(new Tt({basePath:t}));return(0,G.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(d(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(l(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{r(a(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,G.useEffect)((()=>{!function(){const e=L?null==i?void 0:i.businessId:null==i?void 0:i.userId;u(!0),F.findOperations({personId:L?e:void 0,userId:L?void 0:e,type:[ce.MENTOIMLIIK_ARVAMUS],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(x(e.data)),f(e.data),u(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),u(!1)}))}()}),[L]),(0,G.useEffect)((()=>{h(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ce.MENTOIMLIIK_ARVAMUS],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(M(e.data)),T(e.data),h(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),h(!1)})),g(!0),F.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[ce.MENTOIMLIIK_ARVAMUS],states:Ls.MENTOIMSEIS_OOTEL.concat(Ls.MENTOIMSEIS_TEOSTAMISEL,Ls.MENTOIMSEIS_TYHISTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(O(e.data)),E(e.data),g(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),g(!1)}))}),[]),(0,un.jsxs)("div",{children:[(0,un.jsxs)(J.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,un.jsx)($s,{viewType:ee,filterState:N,onSubmit:e=>A(e)}),children:[c&&(0,un.jsx)(J.SectionLoader,{}),c||S?(0,un.jsx)(qs,{linkGen:n,viewType:Q,filter:N,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_opinions.no_opinions"})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{P(!0)}})})]})]}),(0,un.jsxs)(J.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,un.jsx)($s,{viewType:te,filterState:U,onSubmit:e=>w(e)}),children:[p&&(0,un.jsx)(J.SectionLoader,{}),p||I?(0,un.jsx)(qs,{linkGen:n,viewType:te,filter:U}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,un.jsxs)(J.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,un.jsx)($s,{viewType:ne,filterState:j,onSubmit:e=>C(e)}),children:[m&&(0,un.jsx)(J.SectionLoader,{}),m||v?(0,un.jsx)(qs,{linkGen:n,viewType:ne,filter:j}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},Zs=e=>{const t=(0,H.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,r]=(0,G.useState)(e.filterState),[a,l]=(0,G.useState)(Hs(i.operationStates)),[d,c]=(0,G.useState)(!0),[u,p]=(0,G.useState)(!0),[h,m]=(0,G.useState)(""),g=(0,G.useMemo)((()=>Gs()),[]),[S,f]=(0,G.useState)([]),I=(0,G.useMemo)((()=>Bs(Z,t)),[]),[T,v]=(0,G.useState)([]),E=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions));function y(e){return n.test(e)}function _(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function b(e,t){var n;i[t]=e,"ehrCode"===t&&y(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&p(!0),r((e=>({...e})))}(0,G.useEffect)((()=>{if(E){const e=hs([...E]);f(e)}}),[E]);return(0,un.jsxs)(J.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:g,onSelect:e=>_(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>_(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(J.Col,{})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>b(e,"ehrCode"),onBlur:e=>c(y(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!d&&(0,un.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:S,onSelect:e=>_(e,"institutions"),allSelection:!0,onRemoveItem:e=>_(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(J.Col,{})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:I,onSelect:e=>_(e,"operationStates"),allSelection:!0,onRemoveItem:e=>_(e,"operationStates"),value:i.operationStates,selectedOptions:a}),label:(0,un.jsx)(H.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!yn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!yn()(e.to,"YYYY-MM-DD",!0).isValid()?m(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(t.formatMessage({id:"filter.invalid_date_range"})):m(""),r((t=>({...t,operationDate:e})))})(e),value:i.operationDate}),errorMessage:h.length>0?h:null,label:(0,un.jsx)(H.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(J.Col,{})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{onClick:()=>(v([]),r(o),void l(Hs(o.operationStates))),colourScheme:"light",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},eo=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:r}=e;const l=(0,vn.useDispatch)(),[c,u]=(0,G.useState)(!1),[p,h]=(0,G.useState)([]),m=!(void 0===i||"A"===(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)),g={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[S,f]=(0,G.useState)(g),I=new Je(new Tt({basePath:r})),T=new St(new Tt({basePath:o})),v=new je(new Tt({basePath:n}));return(0,G.useEffect)((()=>{var e;I.getJurKovPersons().then((e=>{l(d(e.data))})).catch((e=>{console.log(e)})),v.getAllDocumentTypes().then((e=>{l(a(e.data))})).catch((e=>{console.log(e)})),u(!0),T.findOperations({userId:void 0,personId:m?null===(e=i.activeRole)||void 0===e?void 0:e.businessId:i.personId,type:[ce.MENTOIMLIIK_KAASAMINE,ce.MENTOIMLIIK_KAAS_TAGASISIDE],states:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_VALMIS,Ps.MENTOIMSEIS_JATKAMINE,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_KEELDUTUD,Ps.MENTOIMSEIS_TAGASI_LYKATUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD]}).then((e=>{l(x(e.data)),h(e.data),u(!1)})).catch((e=>{console.log("Following error occured:",e),u(!1)}))}),[i]),(0,un.jsx)("div",{children:(0,un.jsx)(J.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,un.jsx)(Zs,{filterState:S,onSubmit:e=>f(e)}),children:c?(0,un.jsx)(J.SectionLoader,{}):0===p.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(J.Text,{raw:"my_involvements.no_involvements"})}):(0,un.jsx)(qs,{linkGen:s,viewType:Z,filter:S})})})};function to(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function no(e){let t=to([{code:"EHITIS_SEISUND_KAVAN",value:"Kavandatav"},{code:"EHITIS_SEISUND_PYSTI",value:"Püstitamisel"},{code:"EHITIS_SEISUND_OLEMA",value:"Olemas"},{code:"EHITIS_SEISUND_LAMEL",value:"Lammutamisel"},{code:"EHITIS_SEISUND_LAMUT",value:"Lammutatud"},{code:"EHITIS_SEISUND_REATA",value:"Realiseerimata"},{code:"EHITIS_SEISUND_KUSTU",value:"Kustutatud"}]);return e?t:t.slice(0,-1)}const so=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function oo(){return to(so)}function io(e){let t=[];for(let n of e)t.push(n.id),t.push(...io(n.children?n.children:[]));return t}const ro=e=>{const t=(0,H.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],heritage:[],owner:void 0,isPrivatePerson:!1,searchType:oe},s=(0,vn.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,vn.useSelector)((e=>e.myViewsPage.filter.heritageClassifierTypes)),i=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[r,a]=(0,G.useState)(n),[l,d]=(0,G.useState)([]),[c,u]=(0,G.useState)(no(e.isAdminRole)),[p]=(0,G.useState)(to([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[h]=(0,G.useState)(oo()),[m,g]=(0,G.useState)([]),[S,f]=(0,G.useState)([]),[I,T]=(0,G.useState)({}),[v,E]=(0,G.useState)(""),[y,_]=(0,G.useState)({}),[b,D]=(0,G.useState)(""),[x,M]=(0,G.useState)(!1),[O,N]=(0,G.useState)({code:"",value:""}),A=(0,G.useRef)(),[U,w]=(0,G.useState)({});function j(e,t){let n;n=e.selectedData.length>0?void 0!==e.selectedData[0].data?e.selectedData[0].data.map((e=>e.id)):e.selectedData.map((e=>e.id)).flat():[],r[t]=n,a((e=>({...e})))}function C(e,t){let n;if(e.selectedData.length>0){n=io(void 0===e.selectedData[0].data?e.selectedData:e.selectedData[0].data)}else n=[];r[t]=n,a((e=>({...e})))}function L(e,t){r[t]=e,a((e=>({...e})))}(0,G.useEffect)((()=>{if(s.length>0){const e=function(e){let t={id:"00000",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){const{code:e,name:s,validTo:o}=n;let i=e.replace(/0/g,""),r=i.slice(0,i.length-1),a=t;for(let e=2;e<=r.length;e++)if(a.children){let t=a.children.find((t=>t.id.replace(/0/g,"")===r.slice(0,e)));t&&(a=t)}if(a.children){const t=`${e} ${s}${null!=o&&o.trim()?` (kuni ${o})`:""}`;a.children.push({id:n.id+"",parentId:a.id,label:t,level:a.level+1,children:[],selectable:!0,value:!1})}}return t.children?t.children:[]}([...s].sort(((e,t)=>Number(e.code)-Number(t.code))));g(e)}}),[s]),(0,G.useEffect)((()=>{if(o.length>0){const e=o.map((e=>{var t;return{id:e.value+"",label:null!==(t=e.description)&&void 0!==t?t:"",level:2,children:[],selectable:!0,value:!1}}));f(e)}}),[o]),(0,G.useEffect)((()=>{u(no(e.isAdminRole))}),[e.isAdminRole]);const P={sm:20,md:8,lg:8};return(0,un.jsxs)(J.Form,{onSubmit:()=>function(){if(JSON.stringify(n)===JSON.stringify(r))_({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"});else if(r.firstUseMissing){let t={...r};t.firstUseDate={from:"",to:""},e.onSubmit(t)}else _({header:"",message:""}),e.onSubmit(r)}(),children:[y.header&&y.header.length>0&&y.message&&y.message.length>0&&(0,un.jsx)(J.MessageBlock,{dismissible:!0,header:(0,un.jsx)(H.FormattedMessage,{id:y.header}),onDismiss:()=>_({header:"",message:""}),theme:"danger",messages:[(0,un.jsx)(H.FormattedMessage,{id:y.message})]}),i&&i.length>=500&&(0,un.jsx)(J.MessageBlock,{dismissible:!0,header:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,un.jsxs)(J.Row,{className:"align-items-start",children:[(0,un.jsxs)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>L(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:r.buildingLocation}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.building_location",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>L(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:r.buildingName}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:c,onSelect:e=>j(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>j(e,"buildingStates"),value:r.buildingStates,selectedOptions:l}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.building_state"}),info:{content:"detailsearch.filter.tooltip.building_state",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(J.NumberRangeExtended,{value:{from:r.firstUseDate.from,to:r.firstUseDate.to},onChange:e=>function(e){E(""),_({header:"",message:""});let t=null!==e.from?e.from:"",n=null!==e.to?e.to:"";a((e=>({...e,firstUseDate:{from:t,to:n}})))}(e),onBlur:e=>function(e){let n=Number(e.from),s=Number(e.to);n<0||n>2100||s<0||s>2100?E(t.formatMessage({id:"detailsearch.error_field.year-between"})):null!==e.from&&null!==e.to&&n>s?E(t.formatMessage({id:"detailsearch.error_field.beginning-bigger"})):(E(""),_({header:"",message:""}))}(e),onlyPositive:!0,disabled:r.firstUseMissing})}),errorMessage:v,label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.first_use"}),info:{content:"detailsearch.filter.tooltip.first_use",placement:"top-start"}}),(0,un.jsx)(un.Fragment,{children:ds(r.firstUseMissing,(function(e){a((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing",P)})]}),(0,un.jsxs)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:p,onSelect:e=>j(e,"buildingType"),allSelection:!0,onRemoveItem:e=>j(e,"buildingType"),value:r.buildingType,selectedOptions:l}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.building_type"}),info:{content:"detailsearch.filter.tooltip.building_type",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:m,onSelect:e=>C(e,"purposeOfUse"),allSelection:!0,onRemoveItem:e=>C(e,"purposeOfUse"),value:r.purposeOfUse,selectedOptions:l,isSearchExactMatch:!0}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.purpose_of_use"}),info:{content:"detailsearch.filter.tooltip.purpose_of_use",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:h,onSelect:e=>j(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>j(e,"ownershipType"),value:r.ownershipType,selectedOptions:l}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.ownershiptype"}),info:{content:"detailsearch.filter.tooltip.ownershiptype",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:S,onSelect:e=>j(e,"heritage"),allSelection:!0,onRemoveItem:e=>j(e,"heritage"),value:r.ownershipType,selectedOptions:l}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.heritage"}),info:{content:"detailsearch.filter.tooltip.heritage",placement:"top-start"}})]}),e.isAdminPlusRole&&(0,un.jsx)(un.Fragment,{children:(0,un.jsxs)(J.Row,{className:"align-items-center w-100",children:[(0,un.jsx)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,un.jsx)(J.FieldWrapper,{labelCol:P,component:(0,un.jsx)(J.PersonSearchPageExtended,{person:I,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){D(e)}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t,n,s;if(T(e),e&&e.id&&e.id>0&&w(e),e&&(b===e.idCode||b===(null===(t=e.id)||void 0===t?void 0:t.toString())||b===e.regCode)||e&&O.code===e.regCode)r.owner=null===(s=e.id)||void 0===s?void 0:s.toString(),a((e=>({...e})));else if(e||b.substring(4)!==(null===(n=U.id)||void 0===n?void 0:n.toString()))e||(r.owner=void 0,a((e=>({...e}))));else{var o;r.owner=null===(o=U.id)||void 0===o?void 0:o.toString(),a((e=>({...e})))}}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>N(e),isShowError:e=>{M(e),e||_({header:"",message:""})},searchOnBlur:!0,ref:A,isOptionalField:!0,isPrivateOwner:r.isPrivatePerson}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.owner"}),info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,un.jsx)(J.Col,{xs:20,md:20,lg:10,children:ds(r.isPrivatePerson,(function(e){a((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","",{xs:20,md:1})})]})})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{onClick:()=>(d([]),a(n),A.current.clearTypeahead(),void T({})),colourScheme:"light",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(v.length>0||x),squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},ao=e=>{const t=(0,H.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,G.useState)(n),[i,r]=(0,G.useState)(""),[a,l]=(0,G.useState)([]),[d,c]=(0,G.useState)([]),[u,p]=(0,G.useState)([]),[h]=(0,G.useState)(to([{code:Ln.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:Ln.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:Ln.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:Ln.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:Ln.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"},{code:Ln.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:Ln.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:Ln.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:Ln.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"},{code:Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL,value:"Allkirjastamisel"},{code:Ln.DO_DOKUSEIS_VANA_VERSIOON,value:"Vana versioon"}].sort(((e,t)=>e.value.localeCompare(t.value))))),[m,g]=(0,G.useState)({}),[S,f]=(0,G.useState)(""),[I,T]=(0,G.useState)(!1),[v,E]=(0,G.useState)({code:"",value:""}),[y,_]=(0,G.useState)({}),[b,D]=(0,G.useState)(!1),x=(0,G.useRef)(),M=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),O=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),N=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.documents));function A(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function U(e,t){s[t]=e.trim(),o((e=>({...e})))}function w(e){return!(!yn()(e,"YYYY-MM-DD",!0).isValid()&&!yn()(e,"D.M.YYYY",!0).isValid())}(0,G.useEffect)((()=>{if(M){const e=us(M);c(e)}if(O){const e=hs([...O]);p(e)}}),[M,O]);const j={sm:20,md:8,lg:8};return(0,un.jsxs)(J.Form,{onSubmit:()=>{i.length>0?D(!0):JSON.stringify(n)===JSON.stringify(s)?_({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),_({header:"",message:""}))},children:[y.header&&y.header.length>0&&y.message&&y.message.length>0&&(0,un.jsx)(J.MessageBlock,{dismissible:!0,header:(0,un.jsx)(H.FormattedMessage,{id:y.header}),onDismiss:()=>_({header:"",message:""}),theme:"danger",messages:[(0,un.jsx)(H.FormattedMessage,{id:y.message})]}),N&&N.length>500&&(0,un.jsx)(J.MessageBlock,{dismissible:!0,header:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,un.jsxs)(J.Row,{className:"align-items-start",children:[(0,un.jsxs)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.address_catastralUnit_ehrCode.extended",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:a}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.institution"})}),(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(J.DateRange,{onBlur:()=>{D(!0)},value:s.documentDate,onChange:e=>(e=>{""!==e.from&&!w(e.from)||""!==e.to&&!w(e.to)?r(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&yn()(e.from)>yn()(e.to)?r(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(yn()(e.from)<yn()("01.01.1990")||yn()(e.from)>yn()())||""!==e.to&&(yn()(e.to)<yn()("01.01.1990")||yn()(e.to)>yn()())?r(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:yn()().format("DD.MM.YYYY")})):yn()(e.to).diff(yn()(e.from),"days")>367?r(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(r(""),D(!1)),o((t=>({...t,documentDate:e})))})(e)})}),errorMessage:b&&i.length>0?i:null,label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.document_date"}),info:{content:"detailsearch.filter.tooltip.document_date",placement:"top-start"}})]}),(0,un.jsxs)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:a}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:a}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.document_state"})})]})]}),!e.isNonAuthenticatedUser&&(0,un.jsx)(J.Row,{children:(0,un.jsx)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,un.jsx)(J.FieldWrapper,{labelCol:j,component:(0,un.jsx)(J.PersonSearchPageExtended,{person:m,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){f(e),v.code.length>0&&E({code:"",value:""})}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t;g(e),e&&(S===e.idCode||S===(null===(t=e.id)||void 0===t?void 0:t.toString())||S===e.regCode)||e&&v.code===e.regCode?(s.connectedPerson=e.id,o((e=>({...e})))):e||(s.connectedPerson=void 0,o((e=>({...e}))))}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>E(e),isShowError:e=>{T(e),e||_({header:"",message:""})},searchOnBlur:!0,ref:x,isOptionalField:!0}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.connected_person"}),info:{content:"detailsearch.filter.tooltip.connected_person.extended",placement:"top-start"}})})}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{onClick:()=>(l([]),o(n),x.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},lo=e=>{const t=(0,H.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,G.useState)(n),[i,r]=(0,G.useState)([]),[a,l]=(0,G.useState)([]),[d,c]=(0,G.useState)([]),[u,p]=(0,G.useState)(""),[h,m]=(0,G.useState)({}),[g,S]=(0,G.useState)(!1),f=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings));function v(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function E(e,t){s[t]=e,o((e=>({...e})))}function y(e){return!(!yn()(e,"YYYY-MM-DD",!0).isValid()&&!yn()(e,"D.M.YYYY",!0).isValid())}(0,G.useEffect)((()=>{if(f){const e=us(f);l(e)}if(I){const e=hs([...I]);c(e)}}),[f,I]);const _={sm:20,md:8,lg:8};return(0,un.jsxs)(J.Form,{onSubmit:()=>{u.length>0?S(!0):JSON.stringify(n)===JSON.stringify(s)?m({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),m({header:"",message:""}))},children:[h.header&&h.header.length>0&&h.message&&h.message.length>0&&(0,un.jsx)(J.MessageBlock,{dismissible:!0,header:(0,un.jsx)(H.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,un.jsx)(H.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,un.jsx)(J.MessageBlock,{dismissible:!0,header:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,un.jsxs)(J.Row,{className:"align-items-start",children:[(0,un.jsxs)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(J.FieldWrapper,{labelCol:_,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:a,onSelect:e=>v(e,"documentType"),allSelection:!0,onRemoveItem:e=>v(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:_,component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>E(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,un.jsx)(J.FieldWrapper,{labelCol:_,component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(J.DateRange,{onChange:e=>(e=>{""!==e.from&&!y(e.from)||""!==e.to&&!y(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&yn()(e.from)>yn()(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(yn()(e.from)<yn()("01.01.1990")||yn()(e.from)>yn()())||""!==e.to&&(yn()(e.to)<yn()("01.01.1990")||yn()(e.to)>yn()())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:yn()().format("DD.MM.YYYY")})):yn()(e.to).diff(yn()(e.from),"days")>367?p(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(p(""),S(!1)),o((t=>({...t,proceedingDate:e})))})(e),value:s.proceedingDate,onBlur:()=>{S(!0)}})}),errorMessage:g&&u.length>0?u:null,label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.proceeding_date"}),info:{content:"detailsearch.filter.tooltip.proceeding_date",placement:"top-start"}})]}),(0,un.jsxs)(J.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(J.FieldWrapper,{labelCol:_,component:(0,un.jsx)(J.Input,{name:"input",onChange:e=>E(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"})}),(0,un.jsx)(J.FieldWrapper,{labelCol:_,component:(0,un.jsx)(J.Multiselect,{name:"multiselect",options:d,onSelect:e=>v(e,"institutions"),allSelection:!0,onRemoveItem:e=>v(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,un.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.institution"})})]})]}),(0,un.jsxs)(J.Row,{children:[(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{onClick:()=>(r([]),void o(n)),colourScheme:"light",squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(J.Col,{children:(0,un.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,un.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},co={EHITIS_SEISUND_KAVAN:["EHITIS_SEISUND_KAVAN","EHITIS_SEISUND_EHITAM_LUBA","EHITIS_SEISUND_MENETLUSES"],EHITIS_SEISUND_PYSTI:["EHITIS_SEISUND_PYSTI","EHITIS_SEISUND_EHITAMISEL"],EHITIS_SEISUND_OLEMA:["EHITIS_SEISUND_OLEMA","EHITIS_SEISUND_KASUTUSEL","EHITIS_SEISUND_KASUT_OSALINE","EHITIS_SEISUND_KASUT_LUBA_EIKEH","EHITIS_SEISUND_LAMMUT_LUBA","EHITIS_SEISUND_KASUT_MAAS","EHITIS_SEISUND_EBASEADUSLIK","EHITIS_SEISUND_MAARAMATA"],EHITIS_SEISUND_LAMEL:["EHITIS_SEISUND_LAMEL","EHITIS_SEISUND_LAMMUTAMISEL"],EHITIS_SEISUND_LAMUT:["EHITIS_SEISUND_LAMUT","EHITIS_SEISUND_LAMMUTATUD"],EHITIS_SEISUND_REATA:["EHITIS_SEISUND_REATA","EHITIS_SEISUND_EHITAM_LUBA_EIKEH"],EHITIS_SEISUND_KUSTU:["EHITIS_SEISUND_KUSTU","EHITIS_SEISUND_KUSTUTATUD","EHITIS_SEISUND_REG_OBJ_LOPP","EHITIS_SEISUND_ARHIIVIS"]};function uo(e){const t=function(e){return Bn(co,e)}(e);return t?function(e){switch(e){case"EHITIS_SEISUND_KAVAN":return{name:"Kavandatav",type:"info"};case"EHITIS_SEISUND_PYSTI":return{name:"EHITIS_SEISUND_PYSTI",type:"info"};case"EHITIS_SEISUND_OLEMA":return{name:"On",type:"success"};case"EHITIS_SEISUND_LAMEL":return{name:"Lammutamisel",type:"info"};case"EHITIS_SEISUND_LAMUT":return{name:"Lammutatud",type:"default"};case"EHITIS_SEISUND_REATA":return{name:"Realiseerimata",type:"default"};case"EHITIS_SEISUND_KUSTU":return{name:"Kustutatud",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const po=e=>{const t=(0,H.useIntl)(),[n,s]=(0,G.useState)([]),o=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,G.useEffect)((()=>{if(o&&o.length>0){const t=e.isAdminRole?o:o.filter((e=>"EHITIS_SEISUND_KUSTU"!==e.buildingState.code));s(t)}}),[o]);const i=[{id:"ehr_code",property:"ehrCode",size:130,isFrozen:!0,getValue:e=>e.ehrCode?e.ehrCode:"",getFormattedValue:t=>{const{generateLink:n}=e,s=t.ehrCode?n(re,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,un.jsx)(gn,{linkName:t.ehrCode,tooltipText:"detailsearch.tooltip.open_building",href:s||void 0}):""}},{id:"building_address",property:"buildingaddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingaddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingaddress&&null!==e.buildingaddress?e.buildingaddress.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""}},{id:"building_state",property:"buildingState",size:130,getValue:e=>{var t;return null!==(t=e.buildingState)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingState&&null!==e.buildingState?(0,un.jsx)(J.Status,{type:uo(e.buildingState.code).type,children:e.buildingState.value}):""},{id:"purpose_of_use",property:"purposeOfUse",size:150,getValue:e=>{var t,n;return null!==(t=null===(n=e.purposeOfUse)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"first_use_date",property:"firstUseDate",size:150,getValue:e=>{var t;return null!==(t=e.firstUseDate)&&void 0!==t?t:""}},{id:"under_area",property:"underArea",size:130,getValue:e=>e.underArea?e.underArea:""},{id:"floor_count",property:"floorCount",size:130,getValue:e=>e.floorCount?e.floorCount:""},{id:"ownership_type",property:"ownershipType",size:130,getValue:e=>{var t,n;return null!==(t=null===(n=e.ownershipType)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"heritage",property:"heritage",size:130,getValue:e=>{var t;return null!==(t=e.heritage)&&void 0!==t?t:""},getFormattedValue:e=>e.heritage&&null!==e.heritage?e.heritage.map((e=>(0,un.jsxs)("div",{children:[e.name," ",e.value]},e.value))):""},{id:"owner",property:"owner",size:130,getValue:e=>{var t;return null!==(t=e.owner)&&void 0!==t?t:""},getFormattedValue:e=>e.owner?e.owner.map((e=>function(e){var t;const n=e.eesnimi?e.eesnimi+" "+e.perenimi:void 0,s=e.isikukood?(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,un.jsx)("div",{children:i}):n?(0,un.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,un.jsx)("div",{children:(0,un.jsx)(J.TableComponent,{config:{thead:{headers:(e.isAdminPlusRole?i:i.slice(0,-1)).map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:t.formatMessage({id:"detailsearch.buildings.table.header."+e.id}),tooltip:{text:t.formatMessage({id:"detailsearch.buildings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:function(e){return e.map((e=>({buildingaddress:e.buildingaddress,buildingId:e.buildingId,buildingName:e.buildingName,buildingType:e.buildingType,ehrCode:e.ehrCode,firstUseDate:e.firstUseDate,owner:e.owner,heritage:e.heritage,ownershipType:e.ownershipType,purposeOfUse:e.purposeOfUse,buildingState:e.buildingState,floorCount:e.floorCount,underArea:e.underArea})))}(n),handleEvent:()=>!0})})},ho="DD.MM.YYYY",mo="YYYY-MM-DD";class go{static dateToStr(e){return go.formatDate(ho,e)}static dateToStrForDatepicker(e){return go.formatDate(mo,e)}static dateWithTimeToStr(e){return go.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?yn()(t).format(e):""}static dateToMs(e,t){const n=yn()(t,e);return t&&n.isValid()?n.valueOf():void 0}}const So=e=>{var t,n,s,o,i,r;const a=(0,H.useIntl)(),[l,d]=(0,G.useState)([]),c=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),p=null!==(t=null===(n=e.userInfo)||void 0===n||null===(s=n.activeRole)||void 0===s?void 0:s.businessType)&&void 0!==t?t:"",h=null!==(o=null===(i=e.userInfo)||void 0===i||null===(r=i.activeRole)||void 0===r?void 0:r.businessId)&&void 0!==o?o:0;(0,G.useEffect)((()=>{c&&c.length>0&&d(c)}),[c]);const m=e.filterStateDocumentsSearch.buildingLocation,g=e.filterStateDocumentsSearch.buildingName;const S=m?m.toString().toLowerCase().replace(/[&|=;~!$>*%_()?.+:'"\\]/g,"").replace(/\t/g," ").replace(/\s{2,}/g," ").replace(/\s?-\s?/g,"-"):"";function f(e,t){const n=(s=function(e){return e.replace(/\btn\b/g,"").replace(/\btänav\b/g,"").replace(/\btee\b/g,"").replace(/\bmaantee\b/g,"").replace(/\bmnt\b/g,"").replace(/\bküla\b/g,"").replace(/\blinnaosa\b/g,"").replace(/\blinn\b/g,"").replace(/\bpuiestee\b/g,"").replace(/\bpst\b/g,"").replace(/\bvald\b/g,"").replace(/\balevik\b/g,"").replace(/\balev\b/g,"").replace(/\bpõik\b/g,"").replace(/\blõik\b/g,"")}(e),s.replaceAll("//","").replaceAll(",","").split(/\s+/g).reduce(((e,t)=>{if(Number.isNaN(Number(t[0]))&&Number.isNaN(Number(t[1])))e.push(t);else{const n=` ${t}`;e[e.length-1]+=n}return e}),[]));var s;const o=t.replace(/\s+/g," ").split(/\/\/\s+(?=[a-z]+\b)/gi);return n.every((e=>{const t=e.trim().split(/\s+/);return o.some((e=>t.every((t=>new RegExp(`(?<![\\/\\-])\\b${t}\\b`,"i").test(e)))))}))}const I=["tn","tänav","tee","maantee","mnt","küla","linnaosa","linn","puiestee","pst","vald","alevik","alev","põik","lõik"];function T(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>function(e,t){return I.some((n=>{const s=new RegExp(`\\b(\\w+)\\s+${n}\\b`,"i"),o=e.match(s);if(o){const e=o[1];return new RegExp(`\\b${e}\\s+${n}\\b`,"i").test(t)}return!1}))}(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}function v(e){const t=e.filter((e=>function(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>f(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}(S,e)));return I.some((e=>function(e){return!new RegExp(`\\b${e}\\b`,"gi").test(e)}(e)))?t.filter((e=>T(S,e))):t}function E(){return!Number.isNaN(Number(S))}function y(){if(S&&S.indexOf(", ")>-1){return S.split(", ").reverse().join(", ")}return S}function _(e){const t=e.buildingName,n=e.buildingAddress;return t&&n&&(n.some((e=>e.toLowerCase().split(" ").some((e=>t.some((t=>t.toLowerCase().includes(e)))))))||t.some((e=>e.toLowerCase().split(" ").some((e=>n.some((t=>t.toLowerCase().includes(e))))))))}function b(e){let t=0;if(e.buildingAddress&&e.buildingAddress.length>0&&e.buildingAddress[0].length<200){const n=S.replace(",","").split(" ");let s=e.buildingAddress[0].toLowerCase().split(", ");const o=new Set;s.forEach((e=>{const t=e.split(" ")[0];return o.add(t)})),s=Array.from(o),s.forEach((e=>(n.includes(e)&&(t+=1),t)))}else t=-1;return t}const D=new RegExp(`\\b${S}\\b(?![\\/\\-])`,"i"),x=new RegExp(`\\b${y()}\\b(?![\\/\\-])`,"i"),M=S.replace(",","").split(/(?:\/|\s)+/g);function O(e){const t=e.buildingAddress;return t?t.findIndex((e=>e.toLowerCase()===S||e.toLowerCase()===y()))>-1?"exact":t.findIndex((e=>D.test(e.toLowerCase())||x.test(e.toLowerCase())))>-1?"partial":t.findIndex((e=>{const t=e.toLowerCase().replace(",","").replace(/\/\//g," ");return M.every((e=>t.includes(e)))}))>-1?"vague":"other":""}const N=["exact","partial","vague","other"];function A(e){return e.map((e=>{return t=e,{...t,title:t.docId,addressWithBuilding:_(t),addressMatch:O(t),addressRank:b(t)};var t})).sort(((e,t)=>{const n=N.indexOf(e.addressMatch),s=N.indexOf(t.addressMatch);return n!==s?n-s:e.addressWithBuilding!==t.addressWithBuilding?""===g?e.addressWithBuilding?1:-1:e.addressWithBuilding?-1:1:t.addressRank-e.addressRank}))}const U=[{id:"doc_date",property:"docDate",size:130,getValue:e=>go.dateToStr(e.docDate),isFrozen:!0},{id:"reg_date",property:"regDate",size:130,getValue:e=>go.dateToStr(e.regDate)},{id:"doc_nr",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(le,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,un.jsx)(gn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:160,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(re,String(e),null,!1,!1,null):null;return(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,un.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:130,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"doc_state",property:"stateCode",size:180,getValue:e=>{var t;return null!==(t=e.stateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.stateCode&&null!==e.stateCode?(0,un.jsx)(J.Status,{type:Kn(e.stateCode).type,children:Kn(e.stateCode).name}):""},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{var n;const{generateLink:s}=e,o=Us(null===(n=t.doty)||void 0===n?void 0:n.toString()),i=t.proceedingNr?s(o,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr?p===de.MKM||t.institutionId&&h===t.institutionId?(0,un.jsx)(gn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:i||void 0}):t.proceedingNr:""}},{id:"presenter",property:"presenter",size:130,getValue:e=>{var t;return null!==(t=e.presenter)&&void 0!==t?t:""},getFormattedValue:e=>e.presenter?e.presenter.map(((t,n)=>(0,un.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,un.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,un.jsx)(J.TableComponent,{config:{thead:{headers:U.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:a.formatMessage({id:"detailsearch.documents.table.header."+e.id}),tooltip:{text:a.formatMessage({id:"detailsearch.documents.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):null==e?void 0:e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:function(e){let t;if(0===(null==m?void 0:m.indexOf('"'))&&(null==m?void 0:m.lastIndexOf('"'))===m.length-1){const n=v(e);t=E()||S.length<2?n:A(n)}else t=E()||S.length<2?e:A(e);const n=t.map((e=>{var t,n,s,o;return{docId:e.docId,docDate:null!==(t=go.dateToMs(ho,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=go.dateToMs(ho,e.regDate))&&void 0!==n?n:"",deadlineDate:e.deadlineDate,docNr:e.docNr,documentType:e.documentType,doty:e.doty,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress,state:e.state,stateCode:e.stateCode,proceedingNr:e.proceedingNr,presenter:e.presenter,institutionId:e.institutionId,institutionName:null!==(s=null===(o=u.find((t=>t.id===e.institutionId)))||void 0===o?void 0:o.regName)&&void 0!==s?s:""}}));return n}(l),handleEvent:()=>!0})},fo=e=>{var t,n,s,o;const i=(0,H.useIntl)(),[r,a]=(0,G.useState)([]),l=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),u=e.userInfo&&e.userInfo.activeRole&&null!==(t=e.userInfo.activeRole)&&void 0!==t&&t.businessType?null===(n=e.userInfo.activeRole)||void 0===n?void 0:n.businessType:"",p=e.userInfo&&e.userInfo.activeRole&&null!==(s=e.userInfo.activeRole)&&void 0!==s&&s.businessId?null===(o=e.userInfo.activeRole)||void 0===o?void 0:o.businessId:0;(0,G.useEffect)((()=>{l&&l.length>0&&a(l)}),[l]);const h=[{id:"date_start",property:"dateStart",size:130,getValue:e=>go.dateToStr(e.dateStart),isFrozen:!0},{id:"date_end",property:"dateEnd",size:130,getValue:e=>go.dateToStr(e.dateEnd)},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=Us(t.doty),o=t.proceedingNr?n(s,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr&&null!==t.proceedingNr?"MKM"===u||t.institutionId&&p===t.institutionId?(0,un.jsx)(gn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:o||void 0}):t.proceedingNr:""}},{id:"proceeding_state",property:"proceedingState",size:200,getValue:e=>{var t;return null!==(t=e.proceedingStateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.proceedingStateCode&&null!==e.proceedingStateCode?(0,un.jsx)(J.Status,{type:Ds(e.proceedingStateCode).type,children:Ds(e.proceedingStateCode).name}):""},{id:"document",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(le,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,un.jsx)(gn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode&&null!==t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(re,String(e),null,!1,!1,null):null;return(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,un.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"proceeding_name",property:"proceedingName",size:160,getValue:e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""}},{id:"supervisor",property:"supervisorName",size:130,getValue:e=>{var t;return null!==(t=e.supervisorName)&&void 0!==t?t:""}},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}},{id:"archived",property:"archived",size:130,getValue:e=>e.archived&&"2"===e.archived?"Jah":"Ei"}];return(0,un.jsx)(J.TableComponent,{config:{thead:{headers:h.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:i.formatMessage({id:"detailsearch.proceedings.table.header."+e.id}),tooltip:{text:i.formatMessage({id:"detailsearch.proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:function(e){const t=e.map((e=>{var t,n,s,o,i,r;return{proceedingId:e.proceedingId,dateStart:null!==(t=go.dateToMs(ho,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=go.dateToMs(ho,e.dateEnd))&&void 0!==n?n:"",proceedingNr:e.proceedingNr,proceedingState:e.proceedingState,proceedingStateCode:e.proceedingStateCode,docNr:e.docNr,documentType:null!==(s=null===(o=d.find((t=>t.id.toString()===e.documentType)))||void 0===o?void 0:o.name)&&void 0!==s?s:"",doty:e.documentType,proceedingName:e.proceedingName,institutionId:e.institutionId,institutionName:null!==(i=null===(r=c.find((t=>t.id===e.institutionId)))||void 0===r?void 0:r.regName)&&void 0!==i?i:"",supervisorId:e.supervisorId,supervisorName:e.supervisorName,archived:e.archived,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress}}));return t}(r),handleEvent:()=>!0})},Io="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class To{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Io,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_e();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class vo extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Eo="https://example.com",yo=function(e,t,n){if(null==n)throw new vo(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},_o=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},bo=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Do=function(e){return e.pathname+e.search+e.hash},xo=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Mo=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yo("buildingChangesGet","ehrCode",t),yo("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",Eo);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.dok_nr=n),_o(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Do(o),options:r}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yo("buildingCompareGet","doEhitisId1",t),yo("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",Eo);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.do_ehitis_id1=t),void 0!==n&&(a.do_ehitis_id2=n),_o(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Do(o),options:r}},buildingDataGet:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/buildingData",Eo);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...i},d={};void 0!==t&&(d.ehr_code=t),void 0!==n&&(d.ehr_id=n),void 0!==s&&(d.version=s),void 0!==o&&(d.json=o),_o(r,d,i.query);let c=a&&a.headers?a.headers:{};return l.headers={...c,...i.headers},{url:Do(r),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",Eo);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};_o(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",Eo);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};_o(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",Eo);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};_o(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",Eo);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};_o(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",Eo);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.ehr_id=n),_o(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Do(o),options:r}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",Eo);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehr_code=t),_o(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Do(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",Eo);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};_o(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yo("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",Eo);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.timestamp=t instanceof Date?t.toISOString():t),void 0!==n&&(a.offset=n),_o(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Do(o),options:r}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",Eo);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.id=t),_o(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Do(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return xo(i,_e(),Io,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return xo(i,_e(),Io,e)},async buildingDataGet(n,s,o,i,r){const a=await t.buildingDataGet(n,s,o,i,r);return xo(a,_e(),Io,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return xo(o,_e(),Io,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return xo(o,_e(),Io,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return xo(o,_e(),Io,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return xo(o,_e(),Io,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return xo(i,_e(),Io,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return xo(o,_e(),Io,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return xo(o,_e(),Io,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return xo(i,_e(),Io,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return xo(o,_e(),Io,e)}}};class Oo extends To{buildingChangesGet(e,t,n){return Mo(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return Mo(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return Mo(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return Mo(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return Mo(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return Mo(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return Mo(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return Mo(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return Mo(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return Mo(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return Mo(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return Mo(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const No=e=>{var t,n,s,o;let{buildingsActualDataApiEndpoint:i,classifierApiEndpoint:r,documentApiEndpoint:l,linkGen:p,generateLink:h,myViewsApiEndpoint:m,searchType:g,userApiEndpoint:S,userInfo:f}=e;const I=(0,vn.useDispatch)(),T=["MKM","KOV","TJA"].includes(f&&f.activeRole&&null!==(t=f.activeRole)&&void 0!==t&&t.businessType?null===(n=f.activeRole)||void 0===n?void 0:n.businessType:""),v=["MKM","KOV","TJA","N","KT"].includes(f&&f.activeRole&&null!==(s=f.activeRole)&&void 0!==s&&s.businessType?null===(o=f.activeRole)||void 0===o?void 0:o.businessType:""),E=!f,[y,_]=(0,G.useState)({}),[b,D]=(0,G.useState)({}),[x,M]=(0,G.useState)({}),[O,N]=(0,G.useState)([]),[A,C]=(0,G.useState)([]),[L,P]=(0,G.useState)([]),[R,K]=(0,G.useState)(!1),[F,k]=(0,G.useState)(!1),[Y,B]=(0,G.useState)(!1),V=new je(new Tt({basePath:r})),H=new Ct(new Tt({basePath:l})),W=new Je(new Ze({basePath:S})),q=new mt(new Tt({basePath:m})),$=new ze(new Ze({basePath:S})),z=new Oo(new Tt({basePath:i})),X=async(e,t,n)=>{try{const s=await $.searchPerson(e,t,n);return s.data}catch(e){console.log("= = = callSearchPerson error occured:",e)}};return(0,G.useEffect)((()=>{V.getAllDocumentTypes().then((e=>{I(a(e.data))})).catch((e=>{console.log(e)})),W.getJurKovPersons().then((e=>{I(d(e.data))})).catch((e=>{console.log(e)})),V.getUsageClassifierTypes().then((e=>{I(c(e.data))})).catch((e=>{console.log(e)})),H.getClassifierByType("EHITIS_MALESTIS").then((e=>{I(u(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,G.useEffect)((()=>{if(Object.keys(x).length>0){B(!0);q.searchDetailProceedings(x).then((e=>{I(j(e.data)),P(e.data),B(!1)})).catch((e=>{console.log(e),B(!1)}))}}),[x]),(0,G.useEffect)((()=>{if(Object.keys(b).length>0){k(!0);q.searchDetailDocuments(b).then((e=>{I(w(e.data)),C(e.data),k(!1)})).catch((e=>{console.log(e),k(!1)}))}}),[b]),(0,G.useEffect)((()=>{if(Object.keys(y).length>0){let e;K(!0),e=v?z.buildingOwnerSearchPost(y):z.buildingSearchPost(y),e.then((e=>{I(U(e.data)),N(e.data),K(!1)})).catch((e=>{console.log(e),K(!1)}))}}),[y,v]),(0,un.jsxs)("div",{children:[(0,un.jsx)(J.Section,{collapsed:g!==oe,title:"detailsearch.buildings_detail_search",children:(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,un.jsx)(ro,{onSubmit:e=>{_(e)},isAdminRole:T,isAdminPlusRole:v,callSearchPerson:X})}),Object.keys(y).length>0&&0===O.length&&!R?(0,un.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,un.jsx)(J.Text,{raw:"detailsearch.empty_search_result"})}):R?(0,un.jsx)(J.SectionLoader,{}):(0,un.jsx)(po,{linkGen:p,generateLink:h,isAdminRole:T,isAdminPlusRole:v})]})}),(0,un.jsx)(J.Section,{collapsed:"DOCUMENTS_SEARCH"!==g,title:"detailsearch.documents_detail_search",children:(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,un.jsx)(ao,{onSubmit:e=>{D(e)},callSearchPerson:X,isNonAuthenticatedUser:E})}),Object.keys(b).length>0&&0===A.length&&!F?(0,un.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,un.jsx)(J.Text,{raw:"detailsearch.empty_search_result"})}):F?(0,un.jsx)(J.SectionLoader,{}):(0,un.jsx)(So,{linkGen:p,generateLink:h,userInfo:f,filterStateDocumentsSearch:b})]})}),T&&(0,un.jsx)(J.Section,{collapsed:"PROCEEDINGS_SEARCH"!==g,title:"detailsearch.proceedings_detail_search",children:(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,un.jsx)(lo,{onSubmit:e=>{M(e)}})}),Object.keys(x).length>0&&0===L.length&&!Y?(0,un.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,un.jsx)(J.Text,{raw:"detailsearch.empty_search_result"})}):Y?(0,un.jsx)(J.SectionLoader,{}):(0,un.jsx)(fo,{linkGen:p,userInfo:f,generateLink:h})]})})]})};module.exports=s})();
|