eehitus-my-task-list-ui 0.6.5

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.
Files changed (161) hide show
  1. package/README.md +41 -0
  2. package/dist/index.cjs.js +2 -0
  3. package/dist/index.cjs.js.LICENSE.txt +9 -0
  4. package/dist/index.esm.js +2 -0
  5. package/dist/index.esm.js.LICENSE.txt +9 -0
  6. package/dist/index.umd.js +2 -0
  7. package/dist/index.umd.js.LICENSE.txt +9 -0
  8. package/dist/l10n/eehitus-my-proceeding-ui-combined_translations_en.json +1 -0
  9. package/dist/l10n/eehitus-my-proceeding-ui-combined_translations_et.json +1 -0
  10. package/dist/l10n/eehitus-my-proceeding-ui-combined_translations_ru.json +1 -0
  11. package/dist/types/App.d.ts +5 -0
  12. package/dist/types/Reducer.d.ts +2 -0
  13. package/dist/types/__mocks__/fileMock.d.ts +2 -0
  14. package/dist/types/components/Demo.d.ts +3 -0
  15. package/dist/types/components/DemoAdministrativeProceedings.d.ts +3 -0
  16. package/dist/types/components/DemoApprovals.d.ts +3 -0
  17. package/dist/types/components/DemoDetailSearch.d.ts +3 -0
  18. package/dist/types/components/DemoDocuments.d.ts +3 -0
  19. package/dist/types/components/DemoInvolvements.d.ts +3 -0
  20. package/dist/types/components/DemoOpinions.d.ts +3 -0
  21. package/dist/types/components/DemoProceedings.d.ts +3 -0
  22. package/dist/types/components/common/AddressesService.d.ts +5 -0
  23. package/dist/types/components/common/CommonServices.d.ts +5 -0
  24. package/dist/types/components/common/TableService.d.ts +18 -0
  25. package/dist/types/components/common/classificators/BuildingStates.d.ts +9 -0
  26. package/dist/types/components/common/classificators/DocumentStates.d.ts +25 -0
  27. package/dist/types/components/common/classificators/OperationStates.d.ts +34 -0
  28. package/dist/types/components/common/classificators/ProceedingStates.d.ts +9 -0
  29. package/dist/types/components/common/components/DateRangeExtended.d.ts +14 -0
  30. package/dist/types/components/common/components/DeletePopoverExtended.d.ts +12 -0
  31. package/dist/types/components/common/components/DeleteTableRow.d.ts +7 -0
  32. package/dist/types/components/common/components/DownloadTableRow.d.ts +9 -0
  33. package/dist/types/components/common/components/LinkWithDarkTooltip.d.ts +9 -0
  34. package/dist/types/components/common/components/LinkWithTooltip.d.ts +7 -0
  35. package/dist/types/components/common/components/Phone.d.ts +13 -0
  36. package/dist/types/components/common/components/TableSortingArrows.d.ts +6 -0
  37. package/dist/types/components/common/components/operation/filter/OperationsFilter.d.ts +10 -0
  38. package/dist/types/components/common/components/operation/filter/OperationsFilterService.d.ts +10 -0
  39. package/dist/types/components/common/components/operation/operationsTable/OperationsTable.d.ts +11 -0
  40. package/dist/types/components/common/components/operation/types/OperationsFilterType.d.ts +18 -0
  41. package/dist/types/components/common/components/personalCodeValidator.d.ts +2 -0
  42. package/dist/types/components/common/components/tablecomponent/TableComponentUtils.d.ts +2 -0
  43. package/dist/types/components/common/constants/Constants.d.ts +72 -0
  44. package/dist/types/components/common/filterService/CommonFilterService.d.ts +6 -0
  45. package/dist/types/components/common/stateServices/BuildingStateService.d.ts +9 -0
  46. package/dist/types/components/common/stateServices/DocumentStateService.d.ts +6 -0
  47. package/dist/types/components/common/stateServices/OperationStateService.d.ts +25 -0
  48. package/dist/types/components/common/stateServices/ProceedingStateService.d.ts +9 -0
  49. package/dist/types/components/common/types/MultiselectTypeOption.d.ts +9 -0
  50. package/dist/types/components/dto/MyDocuments.d.ts +40 -0
  51. package/dist/types/components/form/checkBox.d.ts +2 -0
  52. package/dist/types/components/model/StatusTypes.d.ts +15 -0
  53. package/dist/types/components/page/detailsearch/detailsearch.d.ts +14 -0
  54. package/dist/types/components/page/detailsearch/detailsearch.test.d.ts +1 -0
  55. package/dist/types/components/page/detailsearch/filter/BuildingsDetailSearchFilter.d.ts +10 -0
  56. package/dist/types/components/page/detailsearch/filter/BuildingsDetailSearchFilter.test.d.ts +1 -0
  57. package/dist/types/components/page/detailsearch/filter/DetailSearchFilterService.d.ts +12 -0
  58. package/dist/types/components/page/detailsearch/filter/DocumentsDetailSearchFilter.d.ts +9 -0
  59. package/dist/types/components/page/detailsearch/filter/DocumentsDetailSearchFilter.test.d.ts +1 -0
  60. package/dist/types/components/page/detailsearch/filter/ProceedingsDetailSearchFilter.d.ts +6 -0
  61. package/dist/types/components/page/detailsearch/tables/DetailSearchBuildings.d.ts +9 -0
  62. package/dist/types/components/page/detailsearch/tables/DetailSearchBuildings.test.d.ts +1 -0
  63. package/dist/types/components/page/detailsearch/tables/DetailSearchDocuments.d.ts +12 -0
  64. package/dist/types/components/page/detailsearch/tables/DetailSearchDocuments.test.d.ts +1 -0
  65. package/dist/types/components/page/detailsearch/tables/DetailSearchProceedings.d.ts +11 -0
  66. package/dist/types/components/page/detailsearch/tables/DetailSearchProceedings.test.d.ts +1 -0
  67. package/dist/types/components/page/detailsearch/tables/linkGenMock.d.ts +2 -0
  68. package/dist/types/components/page/detailsearch/types/BuildingsDetailSearchFilterType.d.ts +16 -0
  69. package/dist/types/components/page/detailsearch/types/DocumentsDetailSearchFilterType.d.ts +13 -0
  70. package/dist/types/components/page/detailsearch/types/ProceedingsDetailSearchFilterType.d.ts +10 -0
  71. package/dist/types/components/page/myAdministrativeProceedings/AdministrativeProceedingsTable.d.ts +8 -0
  72. package/dist/types/components/page/myAdministrativeProceedings/MyAdministrativeProceedings.d.ts +8 -0
  73. package/dist/types/components/page/myAdministrativeProceedings/components/AdminProceedingsReminderSection.d.ts +6 -0
  74. package/dist/types/components/page/myAdministrativeProceedings/components/AdminProceedingsSection.d.ts +7 -0
  75. package/dist/types/components/page/myapprovals/myapprovals.d.ts +11 -0
  76. package/dist/types/components/page/mydocuments/common/AddNewDocumentButton.d.ts +5 -0
  77. package/dist/types/components/page/mydocuments/common/FinishedDocDotys.d.ts +1 -0
  78. package/dist/types/components/page/mydocuments/common/SigningDocDocys.d.ts +1 -0
  79. package/dist/types/components/page/mydocuments/common/WorkingDocDotys.d.ts +1 -0
  80. package/dist/types/components/page/mydocuments/documentTable/DocumentTableMoreActionsPopover.d.ts +8 -0
  81. package/dist/types/components/page/mydocuments/documentTable/DocumentsTable.d.ts +17 -0
  82. package/dist/types/components/page/mydocuments/filter/DocumentsFilter.d.ts +10 -0
  83. package/dist/types/components/page/mydocuments/filter/DocumentsFilterService.d.ts +5 -0
  84. package/dist/types/components/page/mydocuments/filter/FilterDocumentStatesBasedOnDocTypes.d.ts +9 -0
  85. package/dist/types/components/page/mydocuments/filter/FilterDocumentTypes.d.ts +1 -0
  86. package/dist/types/components/page/mydocuments/mydocuments.d.ts +8 -0
  87. package/dist/types/components/page/mydocuments/types/DocumentsFilterType.d.ts +17 -0
  88. package/dist/types/components/page/myinvolvements/filter/InvolvementsFilter.d.ts +8 -0
  89. package/dist/types/components/page/myinvolvements/myinvolvements.d.ts +11 -0
  90. package/dist/types/components/page/myopinions/myopinions.d.ts +11 -0
  91. package/dist/types/components/page/myproceedings/filter/ProceedingsFilter.d.ts +9 -0
  92. package/dist/types/components/page/myproceedings/filter/ProceedingsFilterService.d.ts +12 -0
  93. package/dist/types/components/page/myproceedings/myproceedings.d.ts +12 -0
  94. package/dist/types/components/page/myproceedings/proceedingTable/MyProceedingsTable.d.ts +11 -0
  95. package/dist/types/components/page/myproceedings/types/ProceedingsFilterType.d.ts +17 -0
  96. package/dist/types/components/services/buildings_actual_data_api_client/api.d.ts +8403 -0
  97. package/dist/types/components/services/buildings_actual_data_api_client/base.d.ts +55 -0
  98. package/dist/types/components/services/buildings_actual_data_api_client/common.d.ts +65 -0
  99. package/dist/types/components/services/buildings_actual_data_api_client/configuration.d.ts +83 -0
  100. package/dist/types/components/services/buildings_actual_data_api_client/index.d.ts +13 -0
  101. package/dist/types/components/services/classifier_api_client/api.d.ts +499 -0
  102. package/dist/types/components/services/classifier_api_client/base.d.ts +55 -0
  103. package/dist/types/components/services/classifier_api_client/common.d.ts +65 -0
  104. package/dist/types/components/services/classifier_api_client/configuration.d.ts +83 -0
  105. package/dist/types/components/services/classifier_api_client/index.d.ts +13 -0
  106. package/dist/types/components/services/document_api_client/api.d.ts +8727 -0
  107. package/dist/types/components/services/document_api_client/base.d.ts +55 -0
  108. package/dist/types/components/services/document_api_client/common.d.ts +65 -0
  109. package/dist/types/components/services/document_api_client/configuration.d.ts +83 -0
  110. package/dist/types/components/services/document_api_client/index.d.ts +13 -0
  111. package/dist/types/components/services/file_api_client/api.d.ts +782 -0
  112. package/dist/types/components/services/file_api_client/base.d.ts +55 -0
  113. package/dist/types/components/services/file_api_client/common.d.ts +65 -0
  114. package/dist/types/components/services/file_api_client/configuration.d.ts +83 -0
  115. package/dist/types/components/services/file_api_client/index.d.ts +13 -0
  116. package/dist/types/components/services/my_views_api_client/api.d.ts +1806 -0
  117. package/dist/types/components/services/my_views_api_client/base.d.ts +66 -0
  118. package/dist/types/components/services/my_views_api_client/common.d.ts +65 -0
  119. package/dist/types/components/services/my_views_api_client/configuration.d.ts +91 -0
  120. package/dist/types/components/services/my_views_api_client/index.d.ts +13 -0
  121. package/dist/types/components/services/user_api_client/api.d.ts +4706 -0
  122. package/dist/types/components/services/user_api_client/base.d.ts +54 -0
  123. package/dist/types/components/services/user_api_client/common.d.ts +65 -0
  124. package/dist/types/components/services/user_api_client/configuration.d.ts +83 -0
  125. package/dist/types/components/services/user_api_client/index.d.ts +13 -0
  126. package/dist/types/components/services/yld_esi_api_client/api.d.ts +401 -0
  127. package/dist/types/components/services/yld_esi_api_client/base.d.ts +54 -0
  128. package/dist/types/components/services/yld_esi_api_client/common.d.ts +65 -0
  129. package/dist/types/components/services/yld_esi_api_client/configuration.d.ts +83 -0
  130. package/dist/types/components/services/yld_esi_api_client/index.d.ts +13 -0
  131. package/dist/types/components/util/DateFormatUtils.d.ts +12 -0
  132. package/dist/types/components/util/link-utils.d.ts +18 -0
  133. package/dist/types/components/util/redirect-utils.d.ts +19 -0
  134. package/dist/types/hooks/useAreaProceedings.d.ts +8 -0
  135. package/dist/types/index.d.ts +1 -0
  136. package/dist/types/indexExport.d.ts +13 -0
  137. package/dist/types/mocks/kaosClassifierMock.d.ts +20 -0
  138. package/dist/types/rbac-rules.d.ts +57 -0
  139. package/dist/types/redux/actions/parametersAction.d.ts +4 -0
  140. package/dist/types/redux/api/index.d.ts +25 -0
  141. package/dist/types/redux/constants/action.d.ts +2 -0
  142. package/dist/types/redux/middleware/middleware.d.ts +4 -0
  143. package/dist/types/redux/parametersService.d.ts +5 -0
  144. package/dist/types/redux/reducers/detailSearchSlice.d.ts +6 -0
  145. package/dist/types/redux/reducers/detailSearchState.d.ts +7 -0
  146. package/dist/types/redux/reducers/documentsSlice.d.ts +6 -0
  147. package/dist/types/redux/reducers/documentsState.d.ts +8 -0
  148. package/dist/types/redux/reducers/filterSlice.d.ts +8 -0
  149. package/dist/types/redux/reducers/filterState.d.ts +11 -0
  150. package/dist/types/redux/reducers/myOperationsSlice.d.ts +5 -0
  151. package/dist/types/redux/reducers/myOperationsState.d.ts +6 -0
  152. package/dist/types/redux/reducers/parametersReducer.d.ts +2 -0
  153. package/dist/types/redux/reducers/proceedingsSlice.d.ts +5 -0
  154. package/dist/types/redux/reducers/proceedingsState.d.ts +6 -0
  155. package/dist/types/redux/reducers/reducer.d.ts +4 -0
  156. package/dist/types/redux/reducers/rootReducer.d.ts +9 -0
  157. package/dist/types/redux/store.d.ts +2 -0
  158. package/dist/types/redux/types/parameters.d.ts +3 -0
  159. package/dist/types/serviceWorker.d.ts +2 -0
  160. package/dist/types/setupTests.d.ts +2 -0
  161. package/package.json +256 -0
@@ -0,0 +1,2 @@
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:()=>Ys,MyAdministrativeProceedings:()=>zt,MyApprovals:()=>cs,MyDocuments:()=>Rn,MyInvolvements:()=>hs,MyOpinions:()=>us,MyProceedings:()=>ds,documentsReducer:()=>I,filterReducer:()=>u,myOperationsReducer:()=>x,proceedingsReducer:()=>y,rootReducer:()=>C});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:M,operationInvitationsLoaded:O}=b.actions,x=b.reducer;const N=(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:j}=N.actions,w=N.reducer,C=(0,o.combineReducers)({filter:u,myDocuments:I,myProceedings:y,myOperations:x,detailSearch:w});var L=n(953),P=n.n(L);const R=require("react-intl"),K=require("ehr-components"),k="SIGNING_DOCUMENTS",F="WORKING_DOCUMENTS",Y="FINISHED_DOCUMENTS",G="INCOMING_DOCUMENTS",B="MY_APPROVALS",V="MY_OPINIONS",H="MY_INVOLVEMENTS",J="MY_OPERATIONS",W="OPERATIONS_TO_COMMENT",q="OPERATION_INVITATIONS",$="PROCEEDINGS_TO_COMMENT",z="BUILDINGS_SEARCH";let X=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const Q="BUILDING",Z="PROCEEDING",ee="DOCUMENT",te="ADMIN_PROCEEDING";let ne=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 se=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 oe=require("axios");var ie=n.n(oe);const re="https://devkluster.ehr.ee".replace(/\/+$/,"");class ae{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:re,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class le extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const de="https://example.com",ce=function(e,t,n){if(null==n)throw new le(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},ue=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()},pe=function(e){return e.pathname+e.search+e.hash},he=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)}},me=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",de);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:pe(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",de);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:pe(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ce("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,de);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ue(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:pe(o),options:r}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ce("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,de);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ue(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:pe(o),options:r}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ce("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,de);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};ue(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:pe(o),options:r}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",de);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:pe(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",de);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:pe(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",de);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:pe(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",de);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:pe(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",de);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:pe(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return he(s,ie(),re,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return he(s,ie(),re,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return he(o,ie(),re,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return he(o,ie(),re,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return he(o,ie(),re,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return he(s,ie(),re,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return he(s,ie(),re,e)},async getHealth(n){const s=await t.getHealth(n);return he(s,ie(),re,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return he(s,ie(),re,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return he(s,ie(),re,e)}}};class ge extends ae{getAllDocumentTypes(e){return me(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return me(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return me(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return me(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return me(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return me(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return me(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return me(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return me(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return me(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class Se{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 fe="http://localhost:8080".replace(/\/+$/,"");class Ie{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fe,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Te extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const ve="https://example.com",Ee=function(e,t,n){if(null==n)throw new Te(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function _e(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>_e(e,t,n))):Object.keys(t).forEach((s=>_e(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];_e(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||""},De=function(e){return e.pathname+e.search+e.hash},Me=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 Oe=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",ve);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:De(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ee("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Ee("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,ve);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:De(i),options:a}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return Me(s,ie(),fe,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return Me(o,ie(),fe,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return Me(o,ie(),fe,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return Me(i,ie(),fe,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return Me(o,ie(),fe,e)}}};class xe extends Ie{getJurKovPersons(e){return Oe(this.configuration).getJurKovPersons(e).then((e=>e(this.axios,this.basePath)))}getJurPersonCoordRelJurs(e,t){return Oe(this.configuration).getJurPersonCoordRelJurs(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByEHAKCode(e,t){return Oe(this.configuration).getUserPossibleProceedingSupervisorsByEHAKCode(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n){return Oe(this.configuration).getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByJurId(e,t){return Oe(this.configuration).getUserPossibleProceedingSupervisorsByJurId(e,t).then((e=>e(this.axios,this.basePath)))}}const Ne=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",ve);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:De(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",ve);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:De(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ee("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),r=new URL(i,ve);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:De(r),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ee("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,ve);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:De(i),options:a}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",ve);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:De(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",ve);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:De(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",ve);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:De(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",ve);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:De(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ee("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,ve);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:De(i),options:a}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return Me(o,ie(),fe,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return Me(o,ie(),fe,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return Me(o,ie(),fe,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const r=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return Me(r,ie(),fe,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return Me(i,ie(),fe,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return Me(s,ie(),fe,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return Me(s,ie(),fe,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return Me(s,ie(),fe,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return Me(o,ie(),fe,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return Me(o,ie(),fe,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return Me(o,ie(),fe,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return Me(o,ie(),fe,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return Me(o,ie(),fe,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return Me(s,ie(),fe,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return Me(o,ie(),fe,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return Me(o,ie(),fe,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return Me(i,ie(),fe,e)}}};class Ae extends Ie{addAllyksusToJurPerson(e,t){return Ne(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return Ne(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return Ne(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return Ne(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return Ne(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return Ne(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return Ne(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return Ne(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return Ne(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return Ne(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return Ne(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return Ne(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return Ne(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return Ne(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return Ne(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return Ne(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return Ne(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const Ue=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ee("searchPerson","input",t);const i=new URL("/search/searchPerson",ve);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:De(i),options:a}}}}(e);return{async searchPerson(n,s,o,i){const r=await t.searchPerson(n,s,o,i);return Me(r,ie(),fe,e)}}};class je extends Ie{searchPerson(e,t,n,s){return Ue(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const we=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",ve);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:De(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",ve);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:De(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",ve);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:De(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",ve);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:De(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",ve);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:De(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ee("getJurUsersWithoutGivenRole","personId",t),Ee("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,ve);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:De(i),options:a}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",ve);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:De(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,ve);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:De(o),options:r}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ee("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,ve);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:De(i),options:a}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ee("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,ve);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:De(i),options:a}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ee("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,ve);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:De(i),options:a}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return Me(o,ie(),fe,e)},async addUser(n,s){const o=await t.addUser(n,s);return Me(o,ie(),fe,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return Me(o,ie(),fe,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return Me(o,ie(),fe,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return Me(o,ie(),fe,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return Me(o,ie(),fe,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return Me(s,ie(),fe,e)},async getHealth(n){const s=await t.getHealth(n);return Me(s,ie(),fe,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return Me(o,ie(),fe,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return Me(i,ie(),fe,e)},async getUser(n,s){const o=await t.getUser(n,s);return Me(o,ie(),fe,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return Me(o,ie(),fe,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return Me(o,ie(),fe,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return Me(i,ie(),fe,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return Me(i,ie(),fe,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return Me(i,ie(),fe,e)}}};class Ce extends Ie{addRoleToUser(e,t){return we(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return we(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return we(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return we(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return we(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return we(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return we(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return we(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return we(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return we(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return we(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return we(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return we(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return we(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return we(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return we(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class Le{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 Pe="http://localhost:8080".replace(/\/+$/,"");class Re{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pe,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie();var s;(this.basePath=t,this.axios=n,e)&&(this.configuration=e,this.basePath=null!==(s=e.basePath)&&void 0!==s?s:t)}}class Ke extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const ke={},Fe="https://example.com",Ye=function(e,t,n){if(null==n)throw new Ke(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Ge(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Ge(e,t,n))):Object.keys(t).forEach((s=>Ge(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Be=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];Ge(t,s),e.search=t.toString()},Ve=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||""},He=function(e){return e.pathname+e.search+e.hash},Je=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)}},We=function(e){const t=function(e){return{findIncomingBaseDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findIncomingBaseDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(s),options:i}},findWorkingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findWorkingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(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=ke["BaseMyDocumentsApi.findIncomingBaseDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,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=ke["BaseMyDocumentsApi.findWorkingDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,e)(t,d||n)}}};class qe extends Re{findIncomingBaseDocuments(e,t){return We(this.configuration).findIncomingBaseDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments(e,t){return We(this.configuration).findWorkingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}}const $e=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(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=ke["DetailSearchesApi.searchDetailBuildings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,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=ke["DetailSearchesApi.searchDetailDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,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=ke["DetailSearchesApi.searchDetailProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,e)(t,d||n)}}};class ze extends Re{searchDetailBuildings(e,t){return $e(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return $e(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return $e(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const Xe=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(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=ke["MyOperationsApi.findOperationInvitations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,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=ke["MyOperationsApi.findOperations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,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=ke["MyOperationsApi.findOperationsToComment"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,e)(t,d||n)}}};class Qe extends Re{findOperationInvitations(e,t){return Xe(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return Xe(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return Xe(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const Ze=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Be(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ve(t,i,e),{url:He(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=ke["MyProceedingsApi.findAreaProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,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=ke["MyProceedingsApi.findProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>Je(a,ie(),Pe,e)(t,d||n)}}};class et extends Re{findAreaProceedings(e,t){return Ze(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return Ze(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 nt="https://devkluster.ehr.ee/api/document/v1".replace(/\/+$/,"");class st{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class ot extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const it="https://example.com",rt=function(e,t,n){if(null==n)throw new ot(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},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];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()},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(){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 ut=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};rt("addAuthz","documentType",t),rt("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,it);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};at(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:dt(i),options:a}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",it);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};at(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:dt(n),options:o}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};rt("createDocument","dotyId",t);const o="/document/{dotyId}".replace("{dotyId}",encodeURIComponent(String(t))),i=new URL(o,it);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={"Content-Type":"application/json"};at(i,{},s.query);let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=lt(n,a,e),{url:dt(i),options:a}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};rt("createNewVersion","documentType",t),rt("createNewVersion","applicationNumber",n),rt("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,it);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={"Content-Type":"application/json"};at(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=lt(s,l,e),{url:dt(r),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};rt("deleteApplicationByNumber","documentType",t),rt("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,it);let r;e&&(r=e.baseOptions);const a={method:"DELETE",...r,...s};at(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:dt(i),options:a}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};rt("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,it);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};at(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:dt(o),options:r}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};rt("getApplicationByNumber","documentType",t),rt("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,it);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};at(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:dt(i),options:a}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};rt("getApplicationByNumberOld","ehrCode",t),rt("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,it);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};at(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:dt(i),options:a}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};rt("getApplicationByNumberWithVersion","documentType",t),rt("getApplicationByNumberWithVersion","applicationNumber",n),rt("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,it);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...o};at(r,{},o.query);let d=a&&a.headers?a.headers:{};return l.headers={...d,...o.headers},{url:dt(r),options:l}},getDotysBasedOnUserRights:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/starting_rights",it);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};at(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:dt(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",it);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};at(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:dt(n),options:o}},reSubmit:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};rt("reSubmit","documentType",t),rt("reSubmit","applicationNumber",n),rt("reSubmit","proceedingNumber",s),rt("reSubmit","applicationDto",o);const r="/document/{documentType}/{applicationNumber}/resubmit/{proceedingNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingNumber}",encodeURIComponent(String(s))),a=new URL(r,it);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={"Content-Type":"application/json"};at(a,{},i.query);let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=lt(o,d,e),{url:dt(a),options:d}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};rt("saveAndValidate","documentType",t),rt("saveAndValidate","applicationNumber",n),rt("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,it);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={"Content-Type":"application/json"};at(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=lt(s,l,e),{url:dt(r),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};rt("saveApplicationByNumber","documentType",t),rt("saveApplicationByNumber","applicationNumber",n),rt("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,it);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={"Content-Type":"application/json"};at(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=lt(s,l,e),{url:dt(r),options:l}},submitStraightToRegistry:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};rt("submitStraightToRegistry","documentType",t),rt("submitStraightToRegistry","applicationNumber",n),rt("submitStraightToRegistry","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,it);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={"Content-Type":"application/json"};at(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=lt(s,l,e),{url:dt(r),options:l}},submitToProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};rt("submitToProcessing","documentType",t),rt("submitToProcessing","applicationNumber",n),rt("submitToProcessing","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,it);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={"Content-Type":"application/json"};at(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=lt(s,l,e),{url:dt(r),options:l}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};rt("submitToSigning","documentType",t),rt("submitToSigning","applicationNumber",n),rt("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,it);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={"Content-Type":"application/json"};at(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=lt(s,l,e),{url:dt(r),options:l}},submitToSupervisorProcessing:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};rt("submitToSupervisorProcessing","documentType",t),rt("submitToSupervisorProcessing","applicationNumber",n),rt("submitToSupervisorProcessing","supervisorIdCode",s),rt("submitToSupervisorProcessing","applicationDto",o);const r="/document/{documentType}/{applicationNumber}/submitToSupervisor/{supervisorIdCode}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{supervisorIdCode}",encodeURIComponent(String(s))),a=new URL(r,it);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={"Content-Type":"application/json"};at(a,{},i.query);let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=lt(o,d,e),{url:dt(a),options:d}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};rt("validateSavedDocument","documentType",t),rt("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,it);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};at(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:dt(i),options:a}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return ct(i,ie(),nt,e)},async apiVersion(n){const s=await t.apiVersion(n);return ct(s,ie(),nt,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return ct(i,ie(),nt,e)},async createNewVersion(n,s,o,i){const r=await t.createNewVersion(n,s,o,i);return ct(r,ie(),nt,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return ct(i,ie(),nt,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return ct(o,ie(),nt,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return ct(i,ie(),nt,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return ct(i,ie(),nt,e)},async getApplicationByNumberWithVersion(n,s,o,i){const r=await t.getApplicationByNumberWithVersion(n,s,o,i);return ct(r,ie(),nt,e)},async getDotysBasedOnUserRights(n){const s=await t.getDotysBasedOnUserRights(n);return ct(s,ie(),nt,e)},async getHealth(n){const s=await t.getHealth(n);return ct(s,ie(),nt,e)},async reSubmit(n,s,o,i,r){const a=await t.reSubmit(n,s,o,i,r);return ct(a,ie(),nt,e)},async saveAndValidate(n,s,o,i){const r=await t.saveAndValidate(n,s,o,i);return ct(r,ie(),nt,e)},async saveApplicationByNumber(n,s,o,i){const r=await t.saveApplicationByNumber(n,s,o,i);return ct(r,ie(),nt,e)},async submitStraightToRegistry(n,s,o,i){const r=await t.submitStraightToRegistry(n,s,o,i);return ct(r,ie(),nt,e)},async submitToProcessing(n,s,o,i){const r=await t.submitToProcessing(n,s,o,i);return ct(r,ie(),nt,e)},async submitToSigning(n,s,o,i){const r=await t.submitToSigning(n,s,o,i);return ct(r,ie(),nt,e)},async submitToSupervisorProcessing(n,s,o,i,r){const a=await t.submitToSupervisorProcessing(n,s,o,i,r);return ct(a,ie(),nt,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return ct(i,ie(),nt,e)}}};class pt extends st{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)))}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)))}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)))}getDotysBasedOnUserRights(e){return ut(this.configuration).getDotysBasedOnUserRights(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return ut(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s,o){return ut(this.configuration).reSubmit(e,t,n,s,o).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)))}submitStraightToRegistry(e,t,n,s){return ut(this.configuration).submitStraightToRegistry(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n,s){return ut(this.configuration).submitToProcessing(e,t,n,s).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,o){return ut(this.configuration).submitToSupervisorProcessing(e,t,n,s,o).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)))}}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 mt="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class gt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class St extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const ft="https://example.com",It=function(e,t,n){if(null==n)throw new St(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Tt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},vt=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()},Et=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=function(e){return e.pathname+e.search+e.hash},yt=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)}},bt=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};It("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",ft);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...o},l={},d={};await Tt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),vt(i,d);let c=r&&r.headers?r.headers:{};return a.headers={...l,...c,...o.headers},{url:_t(i),options:a}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};It("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 Tt(a,e),vt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:_t(o),options:r}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};It("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 Tt(a,e),vt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:_t(o),options:r}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};It("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 Tt(l,e),l["Content-Type"]="application/json",vt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Et(n,a,e),{url:_t(i),options:a}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};It("updateFileInfo","doFail",t);const s=new URL("/file/info",ft);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};await Tt(r,e),r["Content-Type"]="application/json",vt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Et(t,i,e),{url:_t(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 Tt(r,e),void 0!==t&&a.append("file",t),r["Content-Type"]="multipart/form-data",vt(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},i.data=a,{url:_t(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 Tt(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",vt(o,{});let d=i&&i.headers?i.headers:{};return r.headers={...a,...d,...s.headers},r.data=l,{url:_t(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 Tt(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",vt(r,{});let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:_t(r),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const r=await t.cloneFilesAndCreateRels(n,s,o,i);return yt(r,ie(),mt,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return yt(o,ie(),mt,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return yt(o,ie(),mt,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return yt(i,ie(),mt,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return yt(o,ie(),mt,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return yt(o,ie(),mt,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return yt(i,ie(),mt,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,r){const a=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,r);return yt(a,ie(),mt,e)}}};class Dt extends gt{cloneFilesAndCreateRels(e,t,n,s){return bt(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return bt(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return bt(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return bt(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return bt(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return bt(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return bt(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return bt(this.configuration).uploadFileWithFileInfoAndDocRel(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}}class Mt{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 Ot="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class xt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ot,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Nt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const At="https://example.com",Ut=function(e,t,n){if(null==n)throw new Nt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function jt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>jt(e,t,n))):Object.keys(t).forEach((s=>jt(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const wt=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];jt(t,s),e.search=t.toString()},Ct=function(e){return e.pathname+e.search+e.hash},Lt=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 Pt=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("esileht","id",t),Ut("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};wt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ct(i),options:a}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",At);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};wt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ct(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",At);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};wt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ct(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ut("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,At);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};wt(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Ct(o),options:r}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ut("lehtdSave","esileht",t);const s=new URL("/api/pages",At);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};r["Content-Type"]="application/json",wt(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:Ct(s),options:i}}}},Rt=function(e){const t=Pt(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return Lt(i,ie(),Ot,e)},async lehed(n){const s=await t.lehed(n);return Lt(s,ie(),Ot,e)},async lehedId(n){const s=await t.lehedId(n);return Lt(s,ie(),Ot,e)},async leht(n,s){const o=await t.leht(n,s);return Lt(o,ie(),Ot,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return Lt(o,ie(),Ot,e)}}};class Kt extends xt{esileht(e,t,n){return Rt(this.configuration).esileht(e,t,n).then((e=>e(this.axios,this.basePath)))}lehed(e){return Rt(this.configuration).lehed(e).then((e=>e(this.axios,this.basePath)))}lehedId(e){return Rt(this.configuration).lehedId(e).then((e=>e(this.axios,this.basePath)))}leht(e,t){return Rt(this.configuration).leht(e,t).then((e=>e(this.axios,this.basePath)))}lehtdSave(e,t){return Rt(this.configuration).lehtdSave(e,t).then((e=>e(this.axios,this.basePath)))}}class kt{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 Ft={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},Yt={proceedingApiService:new et(new tt({basePath:Ft.myViewsApiEndpoint})),classifierApiService:new ge(new Se({basePath:Ft.classifierApiEndpoint})),personApiService:new Ae(new Le({basePath:Ft.userApiEndpoint})),userApiService:new Ce(new Le({basePath:Ft.userApiEndpoint})),myDocumentBaseApiService:new qe(new tt({basePath:Ft.myViewsApiEndpoint})),documentApiService:new pt(new ht({basePath:Ft.documentApiEndpoint})),fileApiService:new Dt(new Mt({basePath:Ft.fileUploadApiEndpoint})),frontPageApi:new Kt(new kt({basePath:Ft.frontPageApiEndpoint})),institutionKovEndpointApi:new xe(new Le({basePath:Ft.userApiEndpoint}))};var Gt=n(848);const Bt=11272,Vt=e=>{var t;let{userInfo:n}=e;const s=(0,R.useIntl)(),[o,i]=(0,L.useState)(!0),[r,a]=(0,L.useState)(""),[l,d]=(0,L.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===ne.MKM;(0,L.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{Yt.frontPageApi.leht(Bt).then((e=>{const t=e.data;t[0].body&&(a(t[0].body),d(t[0].body))}))},p=async()=>{Yt.frontPageApi.esileht(Bt,"ee").then((e=>{const t=e.data;t.body&&(a(t.body),d(t.body))}))};return(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,Gt.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,Gt.jsx)(K.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,Gt.jsx)(K.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,Gt.jsxs)("div",{className:"pt-2",children:[(0,Gt.jsx)(K.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(r),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),a(l),Yt.frontPageApi.lehtdSave({id:Bt,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},Ht={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},Jt=e=>(0,Gt.jsx)(K.Tooltip,{content:(0,Gt.jsx)(K.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,Gt.jsx)(K.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,Gt.jsx)(K.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),Wt=e=>{let{proceedings:t,linkGen:n}=e;const s=(0,R.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,Gt.jsx)(Jt,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,Gt.jsx)(Gt.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,Gt.jsx)(Jt,{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,Gt.jsxs)(Gt.Fragment,{children:[(0,Gt.jsx)(Jt,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,Gt.jsx)("span",{children:", "}):""]}))):""},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>e.address&&null!==e.address?e.address.map((e=>(0,Gt.jsx)("div",{children:e}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,Gt.jsx)(K.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:Ht,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},qt=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,L.useState)(!1),[o,i]=(0,L.useState)(void 0),[r,a]=(0,L.useState)([]);(0,L.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===ne.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await Yt.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}},$t=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,R.useIntl)(),[o,i]=(0,L.useState)(!1),{loading:r,error:a,proceedings:l}=qt(t,o);return(0,Gt.jsxs)(K.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[a&&(0,Gt.jsx)(K.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:a})}),r&&(0,Gt.jsxs)(K.Row,{className:"mb-4 justify-content-center",children:[(0,Gt.jsx)("br",{}),(0,Gt.jsx)(K.Loader,{}),(0,Gt.jsx)("br",{})]}),!r&&!(null==l||!l.length)&&!a&&(0,Gt.jsx)(Wt,{proceedings:l,linkGen:n}),(0,Gt.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,Gt.jsx)(K.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},zt=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,R.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===ne.TJA;return(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,Gt.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,Gt.jsx)(K.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,Gt.jsx)(Vt,{userInfo:n}),i&&(0,Gt.jsx)($t,{userInfo:n,linkGen:s})]})},Xt=require("react-redux"),Qt=require("moment");var Zt=n.n(Qt);function en(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 tn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function nn(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 sn(e,t,n){const s=n(e),o=n(t),i=nn(s),r=nn(o);return r===i?0:i>r?1:-1}function on(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function rn(e,t,n){if(0===e.length)return e;const s={string:en,number:tn,object:sn,date:on}[typeof t(e[0])];return[...e].sort(((e,o)=>s(e,o,t)*n))}const an=0,ln=1,dn=-1;function cn(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case an:return ln;case ln:return dn;case dn:return ln}}(t.direction):ln}}const un=e=>-1===e.sortDirection?(0,Gt.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Gt.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,Gt.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Gt.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,Gt.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Gt.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"})}),pn=e=>{const[t,n]=(0,L.useState)(!1);return(0,Gt.jsx)(Gt.Fragment,{children:e.fileId&&(0,Gt.jsx)(K.ControlledPopover,{content:(0,Gt.jsxs)("div",{style:{width:"250px"},children:[(0,Gt.jsx)("h4",{children:(0,Gt.jsx)(R.FormattedMessage,{id:"download.file"})}),(0,Gt.jsx)("br",{}),(0,Gt.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,Gt.jsx)(K.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.cancel"})}),(0,Gt.jsx)(K.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,Gt.jsx)(R.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,Gt.jsx)(K.Icon,{tooltipText:(0,Gt.jsx)(R.FormattedMessage,{id:"tooltip.download"}),type:"download"})})})};let hn=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 mn=[{code:hn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:hn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:hn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:hn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:hn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"}],gn=[{code:hn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:hn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:hn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:hn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"}];function Sn(e){const t=(e,t)=>({name:e,type:t});switch(hn[e]){case hn.DO_DOKUSEIS_ESITATUD:return t("Esitatud",X.INFO);case hn.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",X.DEFAULT);case hn.DO_DOKUSEIS_KOOSTAMISEL:case hn.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",X.INFO);case hn.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",X.INFO);case hn.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",X.INFO);case hn.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",X.INFO);case hn.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",X.WARNING);case hn.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",X.DEFAULT);case hn.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",X.DEFAULT);case hn.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",X.DEFAULT);case hn.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",X.INFO);case hn.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",X.SUCCESS);case hn.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",X.SUCCESS);case hn.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",X.WARNING);case hn.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",X.DANGER);case hn.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",X.SUCCESS);case hn.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",X.SUCCESS);case hn.DO_DOKUSEIS_ANTUD:return t("Antud",X.SUCCESS);case hn.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case hn.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",X.SUCCESS);case hn.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",X.DEFAULT);case hn.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",X.INFO);default:return t(e,X.DEFAULT)}}function fn(e){let t=[];e===F?t=mn:e===Y&&(t=gn);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 In(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)&&[hn.DO_DOKUSEIS_MENETLETUD,hn.DO_DOKUSEIS_LUBATUD,hn.DO_DOKUSEIS_LUB_TEAV,hn.DO_DOKUSEIS_KEELDUTUD,hn.DO_DOKUSEIS_TEAVITATUD,hn.DO_DOKUSEIS_REG_KANTUD,hn.DO_DOKUSEIS_ANTUD,hn.DO_DOKUSEIS_KEHTIV].includes(n)?t.documentStates.includes(hn.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(Zt()(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(Zt()(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(Zt()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Zt()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Tn(e){return null!=e}function vn(e,t){return Object.keys(e).find((n=>e[n]===Object.values(e).find((e=>e.includes(t)))))}function En(e){var t,n,s,o;const[i,r]=(0,L.useState)(!1);function a(){r(!i)}const l=(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("h4",{children:(0,Gt.jsx)(R.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,Gt.jsx)("p",{children:(0,Gt.jsx)(R.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)(K.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,Gt.jsx)(R.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void a()),squared:!0,type:"submit",children:(0,Gt.jsx)(R.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,Gt.jsx)(K.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 _n(e){return(0,Gt.jsx)(En,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,Gt.jsx)(K.Icon,{tooltipText:(0,Gt.jsx)(R.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const yn=e=>{const t=(0,R.useIntl)(),[n,s]=(0,L.useState)({offset:0,limit:10}),[o,i]=(0,L.useState)([]),[r,a]=(0,L.useState)({column:0,direction:an}),[l,d]=(0,L.useState)(!1),[c,u]=(0,L.useState)(!1),[p,h]=(0,L.useState)(!1),m=(0,Xt.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),g=(0,Xt.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),S=(0,Xt.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),f=(0,Xt.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments));(0,L.useEffect)((()=>{m&&e.documentType===F&&(Object.keys(e.filter).length>0?(i(In(m,e.filter)),s({offset:0,limit:10})):i(m))}),[m,e.filter]),(0,L.useEffect)((()=>{g&&e.documentType===k&&(Object.keys(e.filter).length>0?(i(In(g,e.filter)),s({offset:0,limit:10})):i(g))}),[g,e.filter]),(0,L.useEffect)((()=>{S&&e.documentType===Y&&(Object.keys(e.filter).length>0?(i(In(S,e.filter)),s({offset:0,limit:10})):i(S))}),[S,e.filter]),(0,L.useEffect)((()=>{f&&e.documentType===G&&(Object.keys(e.filter).length>0?(i(In(f,e.filter)),s({offset:0,limit:10})):i(f))}),[f,e.filter]);const I=["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"];e.hidePresenter||I.push("my_documents.presenter");const T=[e=>Tn(e.docDate)?new Date(Zt()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,t=>e.documentType===G?Tn(t.deadlineDate)?new Date(Zt()(t.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:Tn(t.regDate)?new Date(Zt()(t.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&&Tn(e.buildingName[0])?e.buildingName[0]:"",e=>e.ehrCode&&Tn(e.ehrCode[0])?e.ehrCode[0]:"",e=>e.buildingAddress&&Tn(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(","):""];return(0,Gt.jsxs)(K.Section,{form:!0,children:[o&&(0,Gt.jsx)(K.CollapseTable,{content:o.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,o,i,r,a,m,g,S;return(0,Gt.jsx)(K.CollapseTableRow,{fields:[t.docDate,e.documentType===G?Zt()(t.deadlineDate,"DD.MM.YYYY").valueOf()<Zt()().valueOf()?(0,Gt.jsx)("div",{className:"red-text",children:null===(n=t.deadlineDate)||void 0===n?void 0:n.toString()}):t.deadlineDate:t.regDate,(0,Gt.jsx)(K.Tooltip,{content:(0,Gt.jsx)(K.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,Gt.jsx)(K.Link,{onClick:n=>{e.linkGen(!0,n,ee,t.docNr)},text:t.docNr,href:e.linkGen(!1,void 0,ee,t.docNr)})},t.docNr),t.documentType,t.buildingName?(0,Gt.jsx)("div",{children:p?(0,Gt.jsxs)("div",{children:[t.buildingName.map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]},t))),t.buildingName.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,Gt.jsxs)("div",{children:[null===(s=t.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]},t))),null===(o=t.buildingName)||void 0===o?void 0:o.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,Gt.jsx)("div",{children:c?(0,Gt.jsxs)("div",{children:[t.ehrCode.map(((t,n)=>(0,Gt.jsxs)(P().Fragment,{children:[(0,Gt.jsx)(Jt,{linkName:t,tooltipText:"my_documents.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,Q,t)},href:e.linkGen(!1,void 0,Q,t)}),(0,Gt.jsx)("br",{})]},n))),t.ehrCode.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,Gt.jsxs)("div",{children:[null===(i=t.ehrCode)||void 0===i?void 0:i.slice(0,4).map(((t,n)=>(0,Gt.jsxs)(P().Fragment,{children:[(0,Gt.jsx)(Jt,{linkName:t,tooltipText:"my_documents.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,Q,t)},href:e.linkGen(!1,void 0,Q,t)}),(0,Gt.jsx)("br",{})]},n))),null===(r=t.ehrCode)||void 0===r?void 0:r.slice(4,5).map((t=>(0,Gt.jsx)(Jt,{linkName:t,tooltipText:"my_documents.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,Q,t)},href:e.linkGen(!1,void 0,Q,t)}))),t.ehrCode.length>5?" ...":"",t.ehrCode.length>5&&(0,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",t.buildingAddress?(0,Gt.jsx)("div",{children:l?(0,Gt.jsxs)("div",{children:[t.buildingAddress.map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]},t))),t.buildingAddress.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===t.buildingAddress.length?t.buildingAddress:(0,Gt.jsxs)("div",{children:[null===(a=t.buildingAddress)||void 0===a?void 0:a.slice(0,4).map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]},t))),null===(m=t.buildingAddress)||void 0===m?void 0:m.slice(4,5),t.buildingAddress.length>5?" ...":"",t.buildingAddress.length>5&&(0,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",t.stateCode?(0,Gt.jsx)(K.Status,{type:Sn(t.stateCode).type,children:Sn(t.stateCode).name}):"",e.documentType===k?(0,Gt.jsx)(K.Tooltip,{content:(0,Gt.jsx)(K.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,Gt.jsx)(K.Link,{onClick:n=>{e.linkGen(!0,n,Z,t.proceedingNr)},text:t.proceedingNr,href:e.linkGen(!1,void 0,Z,t.proceedingNr)})},t.proceedingNr):t.proceedingNr,t.presenter?t.presenter.map(((e,n)=>(0,Gt.jsxs)("div",{children:[e,n!==t.presenter.length-1?(0,Gt.jsx)("span",{children:", "}):""]}))):""],tools:e.documentType===F&&t.stateCode===hn.DO_DOKUSEIS_KOOSTAMISEL?[(0,Gt.jsx)(pn,{fileApi:e.fileApi,fileId:t.generatedFileId,docNr:null!==(g=t.docNr)&&void 0!==g?g:""},t.docId+"download"),(0,Gt.jsx)(_n,{onConfirm:()=>{e.onDocumentDelete(t.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},t.docNr)]:[(0,Gt.jsx)(pn,{fileApi:e.fileApi,fileId:t.generatedFileId,docNr:null!==(S=t.docNr)&&void 0!==S?S:""},t.docId+"download")],editable:!0},t.docId)})),headers:function(){const n=[...I];return n[1]="my_documents.deadline",(e.documentType===G?n:I).map(((e,n)=>(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=cn(n,r);a(e),e.direction!==an&&i(rn(o,T[n],e.direction))},children:r.column===n?(0,Gt.jsx)(un,{sortDirection:r.direction}):(0,Gt.jsx)(un,{sortDirection:an})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s,editable:!0}),(0,Gt.jsx)(K.Row,{children:e.isKov&&e.documentType!==G?(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,Gt.jsx)(K.Text,{raw:"my_documents.view_all_institution_documents"}),checked:e.isAllUsersChecked})}):(0,Gt.jsx)(K.Col,{})})]})},bn=require("reactstrap");function Dn(e,t,n,s){return s?(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsxs)(bn.Row,{className:"checkboxTooltip",children:[(0,Gt.jsx)(bn.Col,{md:1,children:(0,Gt.jsx)(K.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",onChange:e=>t(e),text:"",checked:e})}),(0,Gt.jsx)(bn.Col,{md:8,style:{padding:"0 0 0 5px"},children:(0,Gt.jsx)(K.Text,{raw:(0,Gt.jsx)(R.FormattedMessage,{id:n})})})]}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"label.empty"})}):(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,Gt.jsx)(K.Text,{raw:(0,Gt.jsx)(R.FormattedMessage,{id:n})}),checked:e}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"label.empty"}),labelCol:{sm:20,md:8,lg:8}})}const Mn=["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","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","12994","12999","130","13001","13002","13003","13009","131","13101","900","91511","91561","92731","92741","92743","92744","92745","11583"];function On(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&&Zt()(n.validTo).isBefore(Zt()(new Date))?" (kuni "+Zt()(n.validTo).format("DD.MM.YYYY")+")":""),level:s.level+1,children:[],selectable:!0,value:!1})}return t.children?t.children:[]}(e.filter((e=>Mn.includes(e.id.toString()))).sort(((e,t)=>e.id-t.id)))}function xn(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 Nn(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 An(e){var t,n,s,o;return(0,Gt.jsxs)("div",{className:"d-flex align-items-center",children:[(0,Gt.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,Gt.jsx)(K.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,Gt.jsx)("span",{className:"px-1",children:"—"}),(0,Gt.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,Gt.jsx)(K.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 Un=e=>{const t=(0,R.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,L.useState)(o);(0,L.useEffect)((()=>{Object.keys(e.filterState).length>0&&r(e.filterState)}),[e.documentType]);const[a,l]=(0,L.useState)(!0),[d,c]=(0,L.useState)(!0),[u,p]=(0,L.useState)(""),[h,m]=(0,L.useState)([]),[g,S]=(0,L.useState)([]),[f,I]=(0,L.useState)([]),[T,v]=(0,L.useState)(fn(e.documentType)),[E,_]=(0,L.useState)([]),y=(0,Xt.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutions));function M(e){return n.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=[],i[t]=n,r((e=>({...e})))}function x(e,t){var n;i[t]=e,"ehrCode"===t&&M(e)?l(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&c(!0),r((e=>({...e})))}(0,L.useEffect)((()=>{v(fn(e.documentType))}),[e.documentType]),(0,L.useEffect)((()=>{if(y){const e=On(y);m(e)}if(b&&e.isKov){const e=xn(b?[...b]:[]);I(e)}if(D){const e=Nn([...D]);S(e)}}),[y,b,D]);return(0,Gt.jsxs)(K.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,Gt.jsxs)(K.Row,{className:"align-items-start",children:[(0,Gt.jsxs)(K.Col,{sm:10,className:"mx-0 px-0",children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:h,onSelect:e=>O(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>O(e,"documentTypes"),value:i.documentTypes,selectedOptions:E}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>x(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>x(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,Gt.jsx)(R.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!==G&&e.documentType!==k&&(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:T,onSelect:e=>O(e,"documentStates"),allSelection:!0,onRemoveItem:e=>O(e,"documentStates"),value:i.documentStates,selectedOptions:E}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>x(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,Gt.jsx)(R.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"}}),Dn(i.proceedingMissing,(function(e){r((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(An,{onChange:e=>(e=>{""!==e.from&&!Zt()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Zt()(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,Gt.jsx)(R.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,Gt.jsxs)(K.Col,{sm:10,className:"mx-0 px-0",children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>x(e,"ehrCode"),onBlur:e=>l(M(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!a&&(0,Gt.jsx)(K.Text,{raw:"filter.invalid_building_code"}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>x(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,Gt.jsx)(R.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!==G&&e.documentType!==k&&e.isKov&&(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:f,onSelect:e=>O(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>O(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,Gt.jsx)(R.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!==G&&(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:g,onSelect:e=>O(e,"institutions"),allSelection:!0,onRemoveItem:e=>O(e,"institutions"),value:i.institutions,selectedOptions:E}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===k&&(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:f,onSelect:e=>O(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>O(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,Gt.jsx)(R.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,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{onClick:()=>(_([]),void r(o)),colourScheme:"light",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(a&&d),squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.search"})})})]})]})},jn=["11566","11567","11569","11576","11577"],wn=e=>{const[t,n]=(0,L.useState)(!1),[s,o]=(0,L.useState)(""),[i,r]=(0,L.useState)(!1),[a,l]=(0,L.useState)([]),d=(0,Xt.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,L.useEffect)((()=>{if(d){const e=d.filter((e=>!jn.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,Gt.jsx)(K.ControlledPopover,{maxWidth:900,open:t,content:(0,Gt.jsx)("div",{style:{width:"600px"},children:(0,Gt.jsxs)(K.Form,{onSubmit:()=>{r(!0)},children:[(0,Gt.jsx)("h2",{children:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:a,value:s}),errorMessage:i&&c(s)&&(0,Gt.jsx)(K.Text,{raw:"common.select.required"}),label:(0,Gt.jsx)(K.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,Gt.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,Gt.jsx)(K.Button,{colourScheme:"light",onClick:()=>{r(!1),o("")},children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.cancel"})}),(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,Gt.jsx)(K.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,Gt.jsx)(R.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},Cn=["11273","11272","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","12999","11526","11601","11583"],Ln=["11273","11272","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","12999","11526","11601","11583"],Pn=["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"],Rn=e=>{var t,n,s,o,i,r,c;let{linkGen:u,userInfo:p}=e;const I=(0,Xt.useDispatch)(),[T,v]=(0,L.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[E,_]=(0,L.useState)(!1),[y,b]=(0,L.useState)(!0),[D,M]=(0,L.useState)(!0),[O,x]=(0,L.useState)([]),[N,A]=(0,L.useState)([]),[U,j]=(0,L.useState)([]),[w,C]=(0,L.useState)({}),[P,R]=(0,L.useState)({}),[G,B]=(0,L.useState)({}),V="A"!==(null===(t=p.activeRole)||void 0===t?void 0:t.businessType);const H={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:Cn,states:[hn.DO_DOKUSEIS_ESITATUD,hn.DO_DOKUSEIS_KOOSTAMISEL,hn.DO_DOKUSEIS_EELNOU_AKTIIVNE,hn.DO_DOKUSEIS_ALLKIRJASTAMISEL,hn.DO_DOKUSEIS_MENETLUSES,hn.DO_DOKUSEIS_TAIENDAMISEL,hn.DO_DOKUSEIS_MUUTMISEL]},J={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:Ln,states:[hn.DO_DOKUSEIS_KEHTETU,hn.DO_DOKUSEIS_TUNNIST_KEHTETUKS,hn.DO_DOKUSEIS_REG_KANTUD,"DO_DOKUSEIS_TAGASTATUD",hn.DO_DOKUSEIS_KEELDUTUD,hn.DO_DOKUSEIS_TYHISTATUD,hn.DO_DOKUSEIS_LOOBUTUD,hn.DO_DOKUSEIS_ALLKIRJASTATUD,hn.DO_DOKUSEIS_MENETLETUD,hn.DO_DOKUSEIS_LUBATUD,hn.DO_DOKUSEIS_LUB_TEAV,hn.DO_DOKUSEIS_TEAVITATUD,hn.DO_DOKUSEIS_ANTUD,hn.DO_DOKUSEIS_KEHTIV]},W={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:Pn,states:[hn.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,L.useEffect)((()=>{var e,t;Yt.classifierApiService.getAllDocumentTypes().then((e=>{I(a(e.data))})).catch((e=>{console.log(e)})),Yt.institutionKovEndpointApi.getJurKovPersons().then((e=>{I(d(e.data))})).catch((e=>{console.log(e)})),V&&Yt.userApiService.getUsersJurPerson(null!==(e=null===(t=p.activeRole)||void 0===t?void 0:t.userId)&&void 0!==e?e:0).then((e=>{I(l(e.data))})).catch((e=>{console.log(e)})),Yt.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,L.useEffect)((()=>{(()=>{const e=H;T.workingDocs&&(e.userId=void 0),b(!0),Yt.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,L.useEffect)((()=>{!function(){const e=J;T.finishedDocs&&(e.userId=void 0),M(!0),Yt.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{I(g(e.data)),M(!1),j(e.data)})).catch((e=>{console.log("Following error occured:",e),M(!1)}))}()}),[T.finishedDocs,p]),(0,L.useEffect)((()=>{!function(){const e=W;T.signingDocs&&(e.userId=void 0),_(!0),Yt.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{console.log(e),I(m(e.data)),_(!1),x(e.data)})).catch((e=>{console.log("Following error occured:",e),_(!1)}))}()}),[T.signingDocs,p]),(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,Gt.jsx)(wn,{linkGen:u})}),V&&(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,Gt.jsx)(Un,{documentType:k,filterState:w,onSubmit:e=>C(e),isKov:V}),children:E?(0,Gt.jsx)(K.SectionLoader,{}):0===O.length?(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,Gt.jsx)(yn,{linkGen:u,isKov:V,documentType:k,onAllUsersChecked:e=>{v({signingDocs:e,workingDocs:T.workingDocs,finishedDocs:T.finishedDocs})},isAllUsersChecked:T.signingDocs,filter:w,fileApi:Yt.fileApiService,hidePresenter:!0})}),(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,Gt.jsx)(Un,{documentType:F,filterState:P,onSubmit:e=>R(e),isKov:V}),children:y?(0,Gt.jsx)(K.SectionLoader,{}):0===N.length?(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_documents.working_documents.no_docs"})}),V&&(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{v({signingDocs:T.signingDocs,workingDocs:!0,finishedDocs:T.finishedDocs})}})}),(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(wn,{linkGen:u})})]}):(0,Gt.jsx)(yn,{linkGen:u,isKov:V,documentType:F,onAllUsersChecked:e=>{v({signingDocs:T.signingDocs,workingDocs:e,finishedDocs:T.finishedDocs})},isAllUsersChecked:T.workingDocs,filter:P,onDocumentDelete:e=>function(e){const t=e.slice(0,e.indexOf("/")),n=e.slice(e.indexOf("/")+1);Yt.documentApiService.deleteApplicationByNumber(t,n),I(S(e))}(e),fileApi:Yt.fileApiService})}),(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,Gt.jsx)(Un,{documentType:Y,filterState:G,onSubmit:e=>B(e),isKov:V}),children:D?(0,Gt.jsx)(K.SectionLoader,{}):0===U.length?(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_documents.finished_documents.no_docs"})}),V&&(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{v({signingDocs:T.signingDocs,workingDocs:T.workingDocs,finishedDocs:!0})}})}),(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(wn,{linkGen:u})})]}):(0,Gt.jsx)(yn,{linkGen:u,isKov:V,documentType:Y,onAllUsersChecked:e=>{v({signingDocs:T.signingDocs,workingDocs:T.workingDocs,finishedDocs:e}),M(!0)},isAllUsersChecked:T.finishedDocs,filter:G,fileApi:Yt.fileApiService})})]})},Kn={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 kn(e){return vn(Kn,e)}function Fn(e){const t=kn(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 Yn=[{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 Gn(){return Yn.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Bn(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(kn(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(Zt()(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(Zt()(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(Zt()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Zt()(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(Zt()(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function Vn(){return Yn.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}const Hn=e=>{const t=(0,R.useIntl)(),[n,s]=(0,L.useState)({offset:0,limit:50}),[o,i]=(0,L.useState)([]),[r,a]=(0,L.useState)({column:5,direction:ln}),[l,d]=(0,L.useState)(!1),[c,u]=(0,L.useState)(!1),[p,h]=(0,L.useState)(!1),m=(0,Xt.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>Tn(e.dateStart)?new Date(Zt()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Tn(e.deadline)?new Date(Zt()(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=>Tn(e.innerCommentDeadline)?new Date(e.innerCommentDeadline).getTime():Number.MAX_SAFE_INTEGER,e=>Tn(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,L.useEffect)((()=>{if(m){const e=5,t=cn(e,r);t.direction===an&&(t.direction=ln),a(t),i(rn(m,g[e],t.direction))}}),[m]),(0,L.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(r.direction===an?i(Bn(m,e.filter)):i(rn(Bn(m,e.filter),g[r.column],r.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,L.useEffect)((()=>{r&&r.direction!==an&&0!==o.length&&i(rn(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,Gt.jsxs)(K.Section,{form:!0,children:[o&&(0,Gt.jsx)(K.CollapseTable,{content:(t=>t.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,o,i,r,a;let m={addresses:[],ehrCodes:[],buildingNames:[]};return t.address&&(null===(n=t.address)||void 0===n?void 0:n.length)>1&&(m=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)),(0,Gt.jsx)(K.CollapseTableRow,{fields:[t.dateStart,Zt()(t.deadline,"DD.MM.YYYY").valueOf()<Zt()().valueOf()?(0,Gt.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,Gt.jsx)(K.Tooltip,{content:(0,Gt.jsx)(K.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,Gt.jsx)(K.Link,{onClick:n=>{e.linkGen(!0,n,"PROCEEDING",t.proceedingNr)},text:t.proceedingNr,href:e.linkGen(!1,void 0,"PROCEEDING",t.proceedingNr)})},t.proceedingNr),t.stateCode?(0,Gt.jsx)(K.Status,{type:Fn(t.stateCode).type,children:Fn(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?Zt()(t.innerCommentDeadline).valueOf()<=Zt()().valueOf()?(0,Gt.jsx)("div",{style:{color:"#00b649"},children:Zt()(t.innerCommentDeadline).format("DD.MM.YYYY")}):Zt()(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?Zt()(t.lastEventDate).format("DD.MM.YYYY"):"",(0,Gt.jsx)(Jt,{linkName:t.document,tooltipText:"my_proceedings.tooltip.open_document",functionCall:n=>{e.linkGen(!0,n,"DOCUMENT",t.document)}}),t.documentType,t.buildingName&&(null===(o=t.buildingName)||void 0===o?void 0:o.length)>0?(0,Gt.jsx)("div",{children:p?(0,Gt.jsxs)("div",{children:[m.buildingNames.map((e=>(0,Gt.jsxs)(Gt.Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]}))),t.buildingName.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,Gt.jsxs)("div",{children:[null===(i=m.buildingNames)||void 0===i?void 0:i.slice(0,4).map((e=>(0,Gt.jsxs)(Gt.Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]}))),null===(r=m.buildingNames)||void 0===r?void 0:r.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,Gt.jsx)("div",{children:c?(0,Gt.jsxs)("div",{children:[m.ehrCodes.map((t=>(0,Gt.jsxs)(Gt.Fragment,{children:[(0,Gt.jsx)(Jt,{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,Gt.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,Gt.jsx)(Jt,{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,Gt.jsxs)("div",{children:[m.ehrCodes.slice(0,4).map(((t,n)=>(0,Gt.jsxs)(P().Fragment,{children:[(0,Gt.jsx)(Jt,{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,Gt.jsx)("br",{})]},n))),m.ehrCodes.slice(4,5).map((t=>(0,Gt.jsx)(Jt,{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,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,Gt.jsx)("div",{style:{width:125},children:l?(0,Gt.jsxs)("div",{children:[m.addresses.map((e=>(0,Gt.jsxs)(Gt.Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]}))),t.address.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,Gt.jsxs)("div",{children:[m.addresses.slice(0,4).map((e=>(0,Gt.jsxs)(Gt.Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]}))),null===(a=m.addresses)||void 0===a?void 0:a.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Gt.jsx)(R.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,Gt.jsxs)("div",{children:[(0,Gt.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=cn(n,r);a(e)},children:r.column===n?(0,Gt.jsx)(un,{sortDirection:r.direction}):(0,Gt.jsx)(un,{sortDirection:an})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,Gt.jsx)(Gt.Fragment,{children:e.isKov?(0,Gt.jsx)("div",{className:"d-flex justify-content-start",children:(0,Gt.jsx)(K.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,Gt.jsx)(K.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},Jn={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},Wn=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,R.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,L.useState)(s),[d,c]=(0,L.useState)(!0),[u,p]=(0,L.useState)(!0),[h,m]=(0,L.useState)(""),[g,S]=(0,L.useState)(""),[f,I]=(0,L.useState)([]),[T,v]=(0,L.useState)([]),[E]=(0,L.useState)(Gn()),[_,y]=(0,L.useState)([]),[b,D]=(0,L.useState)(Vn()),M=(0,Xt.useSelector)((e=>e.myViewsPage.filter.documentTypes)),O=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutionUsers));function x(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&&x(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||r.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,L.useEffect)((()=>{if(M){const e=On(M);I(e)}if(O&&n){const e=xn([...O]);v(e)}}),[M,O]);return(0,Gt.jsxs)(K.Form,{onSubmit:()=>t(a),children:[(0,Gt.jsxs)(K.Row,{className:"align-items-start",children:[(0,Gt.jsxs)(K.Col,{sm:10,className:"mx-0 px-0",children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:f,onSelect:e=>N(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>N(e,"documentTypes"),value:a.documentTypes,selectedOptions:_}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.proceedingNumber}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:E,onSelect:e=>{N(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>N(e,"proceedingStates"),value:a.proceedingStates,selectedOptions:b}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),Dn(a.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)("div",{className:"daterange_in_form",children:(0,Gt.jsx)(K.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!Zt()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Zt()(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,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.DatePicker,{name:"datepicker-field",value:a.lastEventDate,onChange:e=>function(e){""===e||Zt()(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,Gt.jsx)(R.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,Gt.jsxs)(K.Col,{sm:10,className:"mx-0 px-0",children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(x(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.ehrCode}),errorMessage:!d&&(0,Gt.jsx)(K.Text,{raw:"filter.invalid_building_code"}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.buildingName}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.wordInAddress}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.connectedPerson}),label:(0,Gt.jsx)(R.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,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:T,onSelect:e=>N(e,"supervisors"),allSelection:!0,onRemoveItem:e=>N(e,"supervisors"),value:a.supervisors,selectedOptions:_}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{onClick:()=>(y([]),l(Jn),void D(Vn())),colourScheme:"light",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.search"})})})]})]})},qn={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 $n=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 zn(e){return vn(qn,e)}const Xn={[$n.MENTOIMSEIS_OOTEL]:"info",[$n.MENTOIMSEIS_TEOSTAMISEL]:"info",[$n.MENTOIMSEIS_TYHISTATUD]:"default",[$n.MENTOIMSEIS_TEOSTATUD]:"success",[$n.MENTOIMSEIS_LOOBUTUD]:"default",[$n.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},Qn={[$n.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[$n.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[$n.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[$n.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[$n.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[$n.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function Zn(e,t){return((e,t)=>({state:Object.keys(Qn).includes(e)?t.formatMessage({id:Qn[e]}):e,type:Object.keys(Xn).includes(e)?Xn[e]:"default"}))(zn(e),t)}const es=(e,t)=>({code:e,value:t.formatMessage({id:Qn[e]})});function ts(e,t){let n;return n=e===H?[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_TYHISTATUD,$n.MENTOIMSEIS_TEOSTATUD,$n.MENTOIMSEIS_LOOBUTUD,$n.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>es(e,t))):e===q?[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_TYHISTATUD,$n.MENTOIMSEIS_LOOBUTUD,$n.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>es(e,t))):e===$?[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_TEOSTATUD,$n.MENTOIMSEIS_LOOBUTUD].map((e=>es(e,t))):[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_TEOSTATUD,$n.MENTOIMSEIS_LOOBUTUD,$n.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>es(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function ns(){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 ss(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(zn(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(Zt()(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(Zt()(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(Zt()(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(Zt()(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(Zt()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Zt()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function os(e){return[{id:$n.MENTOIMSEIS_OOTEL},{id:$n.MENTOIMSEIS_TEOSTAMISEL},{id:$n.MENTOIMSEIS_TEOSTATUD},{id:$n.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let is=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 rs=["11273","11272"],as=e=>{const t=(0,R.useIntl)(),[n,s]=(0,L.useState)({offset:0,limit:10}),[o,i]=(0,L.useState)([]),[r,a]=(0,L.useState)({column:1,direction:dn}),[l,d]=(0,L.useState)(!1),[c,u]=(0,L.useState)(!1),[p,h]=(0,L.useState)(!1),m=(0,Xt.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,Xt.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),S=(0,Xt.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),f=(0,Xt.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,Xt.useSelector)((e=>e.myViewsPage.filter.documentTypes)),v=[e=>Tn(e.invitationDate)?new Date(Zt()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Tn(e.deadline)?new Date(Zt()(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&&Tn(e.buildingName[0])?e.buildingName[0]:"",e=>void 0!==e.ehrCode&&null!==e.ehrCode&&Tn(e.ehrCode[0])?e.ehrCode[0]:"",e=>void 0!==e.address&&null!==e.address&&Tn(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,L.useEffect)((()=>{!m||e.viewType!==V&&e.viewType!==B||(i(ss(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,L.useEffect)((()=>{m&&e.viewType===H&&(i(rn(ss(m,e.filter),v[0],dn)),s({offset:0,limit:10}))}),[m,e.filter]),(0,L.useEffect)((()=>{g&&e.viewType===W&&(r.direction===an?i(ss(g,e.filter)):i(rn(ss(g,e.filter),v[r.column],r.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,L.useEffect)((()=>{S&&e.viewType===q&&(i(ss(S,e.filter)),s({offset:0,limit:10}))}),[S,e.filter]),(0,L.useEffect)((()=>{f&&e.viewType===$&&(r.direction===an?i(ss(f,e.filter)):i(rn(ss(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=>Tn(e.deadline)?new Date(Zt()(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&&Tn(e.address[0])?e.address[0]:""];const b=t=>{let n=is.Operation;return e.viewType===$?(n=t.doty&&rs.includes(t.doty)?is.AdminProceeding:is.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&rs.includes(t.doty)||t.typeCode===se.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=is.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,Gt.jsxs)(K.Section,{form:!0,children:[o&&(0,Gt.jsx)(K.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,Zt()(n.deadline,"DD.MM.YYYY").valueOf()<Zt()().valueOf()?(0,Gt.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,Gt.jsx)(K.Tooltip,{content:(0,Gt.jsx)(K.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,Gt.jsx)(K.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,Gt.jsx)(K.Status,{type:Zn(n.stateCode,t).type,children:Zn(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,Gt.jsx)("div",{children:p?(0,Gt.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,Gt.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.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,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,Gt.jsx)("div",{children:c?(0,Gt.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,Gt.jsxs)(P().Fragment,{children:[(0,Gt.jsx)(Jt,{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,Gt.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,Gt.jsxs)("div",{children:[null===(r=n.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((t,n)=>(0,Gt.jsxs)(P().Fragment,{children:[(0,Gt.jsx)(Jt,{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,Gt.jsx)("br",{})]},n))),null===(a=n.ehrCode)||void 0===a?void 0:a.slice(4,5).map((t=>(0,Gt.jsx)(Jt,{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,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,Gt.jsx)("div",{children:l?(0,Gt.jsxs)("div",{children:[n.address.map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.jsx)("br",{})]},t))),n.address.length>5&&(0,Gt.jsx)(K.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,Gt.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,Gt.jsxs)(P().Fragment,{children:[e,";",(0,Gt.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,Gt.jsx)("div",{className:"pr-3",children:(0,Gt.jsx)(K.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Gt.jsx)(R.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,Gt.jsx)(K.CollapseTableRow,{fields:e.viewType===H?v:e.viewType===$?E:f},n.id)})))(o),headers:function(){const n=[...E];n.splice(4,1);const s=e.viewType===H?n:e.viewType===$?_:E,l=[...v];l.splice(4,1);const d=e.viewType===H?l:e.viewType===$?y:v;return s.map(((e,n)=>(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=cn(n,r);a(e),e.direction!==an&&i(rn(o,d[n],e.direction))},children:r.column===n?(0,Gt.jsx)(un,{sortDirection:r.direction}):(0,Gt.jsx)(un,{sortDirection:an})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===B||e.viewType===V)&&(0,Gt.jsx)("div",{className:"d-flex justify-content-start",children:(0,Gt.jsx)(K.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===B?(0,Gt.jsx)(K.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,Gt.jsx)(K.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},ls=e=>{var t;const n=(0,R.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:[$n.MENTOIMSEIS_TEOSTAMISEL]},a={...i,operationStates:[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[$n.MENTOIMSEIS_OOTEL]},[d,c]=(0,L.useState)(e.filterState),[u,p]=(0,L.useState)(os(d.operationStates)),[h,m]=(0,L.useState)(!0),[g,S]=(0,L.useState)(!0),[f,I]=(0,L.useState)(""),[T,v]=(0,L.useState)(""),E=(0,L.useMemo)((()=>ns()),[]),[_,y]=(0,L.useState)([]),[b,D]=(0,L.useState)([]),M=(0,L.useMemo)((()=>ts(e.viewType,n)),[e.viewType]),[O,x]=(0,L.useState)([]),N=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutions));function U(e){return s.test(e)}function j(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 w(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,L.useEffect)((()=>{if(N){const e=xn(N?[...N]:[]);D(e)}if(A){const e=Nn([...A]);y(e)}}),[N,A]);return(0,Gt.jsxs)(K.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,Gt.jsx)(K.Row,{className:"align-items-start",children:(0,Gt.jsx)(K.Col,{sm:10,className:"mx-0 px-0",children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:E,onSelect:e=>j(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>j(e,"documentTypes"),value:d.documentTypes,selectedOptions:O}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,Gt.jsx)(K.Row,{className:"align-items-start",children:(0,Gt.jsx)(K.Col,{sm:10,className:"mx-0 px-0",children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>w(e,"ehrCode"),onBlur:e=>S(U(e.trim())),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.ehrCode}),errorMessage:!h&&(0,Gt.jsx)(K.Text,{raw:"filter.invalid_building_code"}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,Gt.jsxs)(K.Row,{className:"align-items-start",children:[(0,Gt.jsxs)(K.Col,{sm:10,className:"mx-0 px-0",children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:_,onSelect:e=>j(e,"institutions"),allSelection:!0,onRemoveItem:e=>j(e,"institutions"),value:d.institutions,selectedOptions:O}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>w(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:M,onSelect:e=>j(e,"operationStates"),allSelection:!0,onRemoveItem:e=>j(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(An,{onChange:e=>(e=>{""!==e.from&&!Zt()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Zt()(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,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,Gt.jsxs)(K.Col,{sm:10,className:"mx-0 px-0",children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>w(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:b,onSelect:e=>j(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>j(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:O}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(An,{onChange:e=>(e=>{""!==e.from&&!Zt()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Zt()(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,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{onClick:()=>function(){let t;switch(x([]),e.viewType){case J:t=r;break;case W:case $:t=a;break;case q:t=l;break;default:t=i}c(t),p(os(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.search"})})})]})]})},ds=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:r,linkGen:d,myViewsApiEndpoint:c,userInfo:u,userApiEndpoint:p}=e;const h=(0,Xt.useDispatch)(),[m,g]=(0,L.useState)({proceedings:!1}),[S,f]=(0,L.useState)(!0),[I,T]=(0,L.useState)(!0),[y,b]=(0,L.useState)(!0),[D,M]=(0,L.useState)([]),[O,x]=(0,L.useState)([]),[N,A]=(0,L.useState)([]),U=new ge(new tt({basePath:i})),j=new Ce(new tt({basePath:p})),w=new et(new tt({basePath:c})),C=new qe(new tt({basePath:c})),P=new Qe(new tt({basePath:c})),R=new Dt(new Mt({basePath:r})),k="A"!==(null===(t=u.activeRole)||void 0===t?void 0:t.businessType);let F=new Date;F.setDate(F.getDate()-7);const Y={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:F.toISOString().split("T")[0],to:""}},[B,V]=(0,L.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[H,J]=(0,L.useState)(Y),[W,q]=(0,L.useState)({});const z={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"],states:[hn.DO_DOKUSEIS_ESITATUD,hn.DO_DOKUSEIS_MENETLUSES]};return(0,L.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:[se.MENTOIMLIIK_MEN_MARKUS]};T(!0),P.findOperationsToComment(s).then((e=>{h(E(e.data)),x(e.data),T(!1)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))}(H)}),[u,H]),(0,L.useEffect)((()=>{(()=>{const e=z;m.proceedings&&(e.userId=void 0),f(!0),w.findProceedings(e).then((e=>{h(v(e.data)),M(e.data),f(!1)})).catch((e=>{console.log("Following error occured:",e),f(!1)}))})()}),[m.proceedings]),(0,L.useEffect)((()=>{!function(){const e=z;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,L.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{h(a(e.data))})).catch((e=>{console.log(e)})),k&&j.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,Gt.jsxs)("div",{children:[(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,Gt.jsx)(Wn,{onSubmit:e=>{V(e)},isKov:k,filterState:B}),children:S?(0,Gt.jsx)(K.SectionLoader,{}):0===D.length?(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_proceedings.no_proceedings"})}),k&&(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{g({proceedings:!0})}})})]}):(0,Gt.jsx)(Hn,{linkGen:d,isKov:k,onAllUsersChecked:e=>{g({proceedings:e})},isAllUsersChecked:m.proceedings,filter:B})}),k&&(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,Gt.jsx)(ls,{viewType:$,initialFilter:Y,filterState:H,onSubmit:e=>J(e)}),children:I?(0,Gt.jsx)(K.SectionLoader,{}):0===O.length?(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,Gt.jsx)(as,{linkGen:d,viewType:$,filter:H})}),k&&(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,Gt.jsx)(Un,{documentType:G,filterState:W,onSubmit:e=>q(e),isKov:k}),children:y?(0,Gt.jsx)(K.SectionLoader,{}):0===N.length?(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,Gt.jsx)(yn,{linkGen:d,isKov:k,documentType:G,filter:W,fileApi:R})})]})},cs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,Xt.useDispatch)(),[c,u]=(0,L.useState)(!0),[p,h]=(0,L.useState)(!1),[m,g]=(0,L.useState)(!1),[S,f]=(0,L.useState)(null),[I,T]=(0,L.useState)(null),[v,E]=(0,L.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[$n.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_JATKAMINE]},x={..._,operationStates:[$n.MENTOIMSEIS_OOTEL]},[N,A]=(0,L.useState)(y),[U,j]=(0,L.useState)(b),[w,C]=(0,L.useState)(x),[P,R]=(0,L.useState)(!1),k=new xe(new tt({basePath:o})),F=new Ce(new tt({basePath:o})),Y=new Qe(new tt({basePath:s})),G=new ge(new tt({basePath:t}));return(0,L.useEffect)((()=>{var e;k.getJurKovPersons().then((e=>{r(d(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),F.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}`)})),G.getAllDocumentTypes().then((e=>{r(a(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,L.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[se.MENTOIMLIIK_VALINE_KOOSK],states:qn.MENTOIMSEIS_TEOSTAMISEL.concat(qn.MENTOIMSEIS_TEOSTATUD,qn.MENTOIMSEIS_LOOBUTUD,qn.MENTOIMSEIS_TAHTAEG_MOODUNUD)};P&&(e.userId=void 0),u(!0),Y.findOperations(e).then((e=>{r(D(e.data)),f(e.data),u(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),u(!1)}))}()}),[P]),(0,L.useEffect)((()=>{h(!0),Y.findOperationsToComment({userId:null==i?void 0:i.userId,type:[se.MENTOIMLIIK_VALINE_KOOSK],states:qn.MENTOIMSEIS_TEOSTAMISEL.concat(qn.MENTOIMSEIS_TEOSTATUD,qn.MENTOIMSEIS_LOOBUTUD,qn.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),Y.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[se.MENTOIMLIIK_VALINE_KOOSK],states:qn.MENTOIMSEIS_OOTEL.concat(qn.MENTOIMSEIS_TEOSTAMISEL,qn.MENTOIMSEIS_TYHISTATUD,qn.MENTOIMSEIS_LOOBUTUD,qn.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,Gt.jsxs)("div",{children:[(0,Gt.jsxs)(K.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,Gt.jsx)(ls,{viewType:J,filterState:N,onSubmit:e=>A(e)}),children:[c&&(0,Gt.jsx)(K.SectionLoader,{}),c||S?(0,Gt.jsx)(as,{linkGen:n,viewType:B,filter:N,isAllUsersChecked:P,onAllUsersChecked:e=>{R(e)}}):(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_approvals.no_approvals"})}),(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{R(!0)}})})]})]}),(0,Gt.jsxs)(K.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,Gt.jsx)(ls,{viewType:W,filterState:U,onSubmit:e=>j(e)}),children:[p&&(0,Gt.jsx)(K.SectionLoader,{}),p||I?(0,Gt.jsx)(as,{linkGen:n,viewType:W,filter:U}):(0,Gt.jsx)("div",{children:(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,Gt.jsxs)(K.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,Gt.jsx)(ls,{viewType:q,filterState:w,onSubmit:e=>C(e)}),children:[m&&(0,Gt.jsx)(K.SectionLoader,{}),m||v?(0,Gt.jsx)(as,{linkGen:n,viewType:q,filter:w}):(0,Gt.jsx)("div",{children:(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},us=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,Xt.useDispatch)(),[c,u]=(0,L.useState)(!1),[p,h]=(0,L.useState)(!1),[m,g]=(0,L.useState)(!1),[S,f]=(0,L.useState)(null),[I,T]=(0,L.useState)(null),[v,E]=(0,L.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[$n.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_JATKAMINE]},x={..._,operationStates:[$n.MENTOIMSEIS_OOTEL]},[N,A]=(0,L.useState)(y),[U,j]=(0,L.useState)(b),[w,C]=(0,L.useState)(x),[P,R]=(0,L.useState)(!1),k=new xe(new tt({basePath:o})),F=new Ce(new tt({basePath:o})),Y=new Qe(new tt({basePath:s})),G=new ge(new tt({basePath:t}));return(0,L.useEffect)((()=>{var e;k.getJurKovPersons().then((e=>{r(d(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),F.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}`)})),G.getAllDocumentTypes().then((e=>{r(a(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,L.useEffect)((()=>{!function(){const e=P?null==i?void 0:i.businessId:null==i?void 0:i.userId;u(!0),Y.findOperations({personId:P?e:void 0,userId:P?void 0:e,type:[se.MENTOIMLIIK_ARVAMUS],states:qn.MENTOIMSEIS_TEOSTAMISEL.concat(qn.MENTOIMSEIS_TEOSTATUD,qn.MENTOIMSEIS_LOOBUTUD,qn.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(D(e.data)),f(e.data),u(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),u(!1)}))}()}),[P]),(0,L.useEffect)((()=>{h(!0),Y.findOperationsToComment({userId:null==i?void 0:i.userId,type:[se.MENTOIMLIIK_ARVAMUS],states:qn.MENTOIMSEIS_TEOSTAMISEL.concat(qn.MENTOIMSEIS_TEOSTATUD,qn.MENTOIMSEIS_LOOBUTUD,qn.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),Y.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[se.MENTOIMLIIK_ARVAMUS],states:qn.MENTOIMSEIS_OOTEL.concat(qn.MENTOIMSEIS_TEOSTAMISEL,qn.MENTOIMSEIS_TYHISTATUD,qn.MENTOIMSEIS_LOOBUTUD,qn.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,Gt.jsxs)("div",{children:[(0,Gt.jsxs)(K.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,Gt.jsx)(ls,{viewType:J,filterState:N,onSubmit:e=>A(e)}),children:[c&&(0,Gt.jsx)(K.SectionLoader,{}),c||S?(0,Gt.jsx)(as,{linkGen:n,viewType:V,filter:N,isAllUsersChecked:P,onAllUsersChecked:e=>{R(e)}}):(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_opinions.no_opinions"})}),(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{R(!0)}})})]})]}),(0,Gt.jsxs)(K.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,Gt.jsx)(ls,{viewType:W,filterState:U,onSubmit:e=>j(e)}),children:[p&&(0,Gt.jsx)(K.SectionLoader,{}),p||I?(0,Gt.jsx)(as,{linkGen:n,viewType:W,filter:U}):(0,Gt.jsx)("div",{children:(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,Gt.jsxs)(K.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,Gt.jsx)(ls,{viewType:q,filterState:w,onSubmit:e=>C(e)}),children:[m&&(0,Gt.jsx)(K.SectionLoader,{}),m||v?(0,Gt.jsx)(as,{linkGen:n,viewType:q,filter:w}):(0,Gt.jsx)("div",{children:(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},ps=e=>{const t=(0,R.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:[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_TEOSTATUD,$n.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,r]=(0,L.useState)(e.filterState),[a,l]=(0,L.useState)(os(i.operationStates)),[d,c]=(0,L.useState)(!0),[u,p]=(0,L.useState)(!0),[h,m]=(0,L.useState)(""),g=(0,L.useMemo)((()=>ns()),[]),[S,f]=(0,L.useState)([]),I=(0,L.useMemo)((()=>ts(H,t)),[]),[T,v]=(0,L.useState)([]),E=(0,Xt.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,L.useEffect)((()=>{if(E){const e=Nn([...E]);f(e)}}),[E]);return(0,Gt.jsxs)(K.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:g,onSelect:e=>y(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>y(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Gt.jsx)(K.Col,{})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.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,Gt.jsx)(K.Text,{raw:"filter.invalid_building_code"}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:S,onSelect:e=>y(e,"institutions"),allSelection:!0,onRemoveItem:e=>y(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Gt.jsx)(K.Col,{})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:I,onSelect:e=>y(e,"operationStates"),allSelection:!0,onRemoveItem:e=>y(e,"operationStates"),value:i.operationStates,selectedOptions:a}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(An,{onChange:e=>(e=>{""!==e.from&&!Zt()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Zt()(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,Gt.jsx)(R.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Gt.jsx)(K.Col,{})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{onClick:()=>(v([]),r(o),void l(os(o.operationStates))),colourScheme:"light",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.search"})})})]})]})},hs=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:r}=e;const l=(0,Xt.useDispatch)(),[c,u]=(0,L.useState)(!1),[p,h]=(0,L.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:[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_TEOSTATUD,$n.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[S,f]=(0,L.useState)(g),I=new xe(new tt({basePath:r})),T=new Qe(new tt({basePath:o})),v=new ge(new tt({basePath:n}));return(0,L.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:[se.MENTOIMLIIK_KAASAMINE,se.MENTOIMLIIK_KAAS_TAGASISIDE],states:[$n.MENTOIMSEIS_OOTEL,$n.MENTOIMSEIS_TEOSTAMISEL,$n.MENTOIMSEIS_TEOSTATUD,$n.MENTOIMSEIS_VALMIS,$n.MENTOIMSEIS_JATKAMINE,$n.MENTOIMSEIS_TYHISTATUD,$n.MENTOIMSEIS_LOOBUTUD,$n.MENTOIMSEIS_KEELDUTUD,$n.MENTOIMSEIS_TAGASI_LYKATUD,$n.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,Gt.jsx)("div",{children:(0,Gt.jsx)(K.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,Gt.jsx)(ps,{filterState:S,onSubmit:e=>f(e)}),children:c?(0,Gt.jsx)(K.SectionLoader,{}):0===p.length?(0,Gt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Gt.jsx)(K.Text,{raw:"my_involvements.no_involvements"})}):(0,Gt.jsx)(as,{linkGen:s,viewType:H,filter:S})})})};function ms(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function gs(e){let t=ms([{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 Ss=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function fs(){return ms(Ss)}function Is(e){let t=[];for(let n of e)t.push(n.id),t.push(...Is(n.children?n.children:[]));return t}const Ts=e=>{const t=(0,R.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],owner:void 0,isPrivatePerson:!1,searchType:z},s=(0,Xt.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,Xt.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[i,r]=(0,L.useState)(n),[a,l]=(0,L.useState)([]),[d,c]=(0,L.useState)(gs(e.isAdminRole)),[u]=(0,L.useState)(ms([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[p]=(0,L.useState)(fs()),[h,m]=(0,L.useState)([]),[g,S]=(0,L.useState)({}),[f,I]=(0,L.useState)(""),[T,v]=(0,L.useState)({}),[E,_]=(0,L.useState)(""),[y,b]=(0,L.useState)(!1),[D,M]=(0,L.useState)({code:"",value:""}),O=(0,L.useRef)(),[x,N]=(0,L.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=Is(void 0===e.selectedData[0].data?e.selectedData:e.selectedData[0].data)}else n=[];i[t]=n,r((e=>({...e})))}function j(e,t){i[t]=e,r((e=>({...e})))}return(0,L.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,L.useEffect)((()=>{c(gs(e.isAdminRole))}),[e.isAdminRole]),(0,Gt.jsxs)(K.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,Gt.jsx)(K.MessageBlock,{dismissible:!0,header:(0,Gt.jsx)(R.FormattedMessage,{id:T.header}),onDismiss:()=>v({header:"",message:""}),theme:"danger",messages:[(0,Gt.jsx)(R.FormattedMessage,{id:T.message})]}),o&&o.length>=500&&(0,Gt.jsx)(K.MessageBlock,{dismissible:!0,header:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,Gt.jsxs)("div",{className:"twoColumnLayout",children:[(0,Gt.jsxs)(K.Col,{children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>j(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:i.buildingLocation}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.building_location",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>j(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>A(e,"buildingStates"),value:i.buildingStates,selectedOptions:a}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.building_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.building_state",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)("div",{className:"daterange_in_form",children:(0,Gt.jsx)(K.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,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.first_use"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.first_use",placement:"top-start"}}),(0,Gt.jsx)("div",{style:{paddingRight:90},children:Dn(i.firstUseMissing,(function(e){r((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing")})]}),(0,Gt.jsxs)(K.Col,{children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"buildingType"),allSelection:!0,onRemoveItem:e=>A(e,"buildingType"),value:i.buildingType,selectedOptions:a}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.building_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.building_type",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.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,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.purpose_of_use"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.purpose_of_use",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:p,onSelect:e=>A(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>A(e,"ownershipType"),value:i.ownershipType,selectedOptions:a}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.ownershiptype"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.ownershiptype",placement:"top-start"}})]})]}),e.isAdminPlusRole&&(0,Gt.jsxs)("div",{className:"d-flex",style:{flexWrap:"wrap"},children:[(0,Gt.jsx)("div",{className:"col-17",style:{paddingLeft:30,flex:"1 1 200px"},children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.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&&N(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=x.id)||void 0===n?void 0:n.toString()))e||(i.owner=void 0,r((e=>({...e}))));else{var o;i.owner=null===(o=x.id)||void 0===o?void 0:o.toString(),r((e=>({...e})))}}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>M(e),isShowError:e=>{b(e),e||v({header:"",message:""})},searchOnBlur:!0,ref:O,isOptionalField:!0,isPrivateOwner:i.isPrivatePerson}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.owner"}),labelCol:{sm:20,md:8,lg:4},info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,Gt.jsx)(K.FieldWrapper,{children:(0,Gt.jsx)("div",{className:"col-auto",style:{paddingRight:120,paddingTop:8,flexDirection:"row",whiteSpace:"nowrap",flex:"1 1 200px"},children:Dn(i.isPrivatePerson,(function(e){r((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","")})})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{onClick:()=>(l([]),r(n),O.current.clearTypeahead(),void S({})),colourScheme:"light",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(f.length>0||y),squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.search"})})})]})]})},vs=e=>{const t=(0,R.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,L.useState)(n),[i,r]=(0,L.useState)(""),[a,l]=(0,L.useState)([]),[d,c]=(0,L.useState)([]),[u,p]=(0,L.useState)([]),[h]=(0,L.useState)(ms([{code:hn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:hn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:hn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:hn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:hn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"},{code:hn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:hn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:hn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:hn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"},{code:hn.DO_DOKUSEIS_ALLKIRJASTAMISEL,value:"Allkirjastamisel"},{code:hn.DO_DOKUSEIS_VANA_VERSIOON,value:"Vana versioon"}].sort(((e,t)=>e.value.localeCompare(t.value))))),[m,g]=(0,L.useState)({}),[S,f]=(0,L.useState)(""),[I,T]=(0,L.useState)(!1),[v,E]=(0,L.useState)({code:"",value:""}),[_,y]=(0,L.useState)({}),[b,D]=(0,L.useState)(!1),M=(0,L.useRef)(),O=(0,Xt.useSelector)((e=>e.myViewsPage.filter.documentTypes)),x=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutions)),N=(0,Xt.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 j(e){return!(!Zt()(e,"YYYY-MM-DD",!0).isValid()&&!Zt()(e,"D.M.YYYY",!0).isValid())}(0,L.useEffect)((()=>{if(O){const e=On(O);c(e)}if(x){const e=Nn([...x]);p(e)}}),[O,x]);return(0,Gt.jsxs)(K.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,Gt.jsx)(K.MessageBlock,{dismissible:!0,header:(0,Gt.jsx)(R.FormattedMessage,{id:_.header}),onDismiss:()=>y({header:"",message:""}),theme:"danger",messages:[(0,Gt.jsx)(R.FormattedMessage,{id:_.message})]}),N&&N.length>500&&(0,Gt.jsx)(K.MessageBlock,{dismissible:!0,header:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,Gt.jsxs)("div",{className:"twoColumnLayout",children:[(0,Gt.jsxs)(K.Col,{children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.address_catastralUnit_ehrCode.extended",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:a}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)("div",{className:"daterange_in_form",children:(0,Gt.jsx)(K.DateRange,{onBlur:()=>{D(!0)},value:s.documentDate,onChange:e=>(e=>{""!==e.from&&!j(e.from)||""!==e.to&&!j(e.to)?r(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&Zt()(e.from)>Zt()(e.to)?r(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(Zt()(e.from)<Zt()("01.01.1990")||Zt()(e.from)>Zt()())||""!==e.to&&(Zt()(e.to)<Zt()("01.01.1990")||Zt()(e.to)>Zt()())?r(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:Zt()().format("DD.MM.YYYY")})):Zt()(e.to).diff(Zt()(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,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.document_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.document_date",placement:"top-start"}})]}),(0,Gt.jsxs)(K.Col,{children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:a}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:a}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}})]})]}),!e.isNonAuthenticatedUser&&(0,Gt.jsx)("div",{className:"d-flex",children:(0,Gt.jsx)("div",{className:"col-20",style:{paddingLeft:20},children:(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.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:M,isOptionalField:!0}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.connected_person"}),labelCol:{sm:20,md:8,lg:4},info:{content:"detailsearch.filter.tooltip.connected_person.extended",placement:"top-start"}})})}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{onClick:()=>(l([]),o(n),M.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.search"})})})]})]})},Es=e=>{const t=(0,R.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,L.useState)(n),[i,r]=(0,L.useState)([]),[a,l]=(0,L.useState)([]),[d,c]=(0,L.useState)([]),[u,p]=(0,L.useState)(""),[h,m]=(0,L.useState)({}),[g,S]=(0,L.useState)(!1),f=(0,Xt.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,Xt.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,Xt.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!(!Zt()(e,"YYYY-MM-DD",!0).isValid()&&!Zt()(e,"D.M.YYYY",!0).isValid())}(0,L.useEffect)((()=>{if(f){const e=On(f);l(e)}if(I){const e=Nn([...I]);c(e)}}),[f,I]);return(0,Gt.jsxs)(K.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,Gt.jsx)(K.MessageBlock,{dismissible:!0,header:(0,Gt.jsx)(R.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,Gt.jsx)(R.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,Gt.jsx)(K.MessageBlock,{dismissible:!0,header:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,Gt.jsxs)("div",{className:"twoColumnLayout",children:[(0,Gt.jsxs)(K.Col,{children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:a,onSelect:e=>v(e,"documentType"),allSelection:!0,onRemoveItem:e=>v(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>E(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)("div",{className:"daterange_in_form",children:(0,Gt.jsx)(K.DateRange,{onChange:e=>(e=>{""!==e.from&&!_(e.from)||""!==e.to&&!_(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&Zt()(e.from)>Zt()(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(Zt()(e.from)<Zt()("01.01.1990")||Zt()(e.from)>Zt()())||""!==e.to&&(Zt()(e.to)<Zt()("01.01.1990")||Zt()(e.to)>Zt()())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:Zt()().format("DD.MM.YYYY")})):Zt()(e.to).diff(Zt()(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,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.proceeding_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"detailsearch.filter.tooltip.proceeding_date",placement:"top-start"}})]}),(0,Gt.jsxs)(K.Col,{children:[(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Input,{name:"input",onChange:e=>E(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"}),labelCol:{sm:20,md:8,lg:8}}),(0,Gt.jsx)(K.FieldWrapper,{component:(0,Gt.jsx)(K.Multiselect,{name:"multiselect",options:d,onSelect:e=>v(e,"institutions"),allSelection:!0,onRemoveItem:e=>v(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,Gt.jsx)(R.FormattedMessage,{id:"detailsearch.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,Gt.jsxs)(K.Row,{children:[(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{onClick:()=>(r([]),void o(n)),colourScheme:"light",squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Gt.jsx)(K.Col,{children:(0,Gt.jsx)(K.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,Gt.jsx)(R.FormattedMessage,{id:"button.search"})})})]})]})},_s={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 ys(e){const t=function(e){return vn(_s,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 bs=e=>{const t=(0,R.useIntl)(),[n,s]=(0,L.useState)([]),o=(0,Xt.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,L.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(Q,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,Gt.jsx)(Jt,{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,Gt.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,Gt.jsx)(K.Status,{type:ys(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,Gt.jsxs)(Gt.Fragment,{children:[(0,Gt.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,Gt.jsx)("div",{children:i}):n?(0,Gt.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,Gt.jsx)("div",{children:(0,Gt.jsx)(K.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:Ht,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})})},Ds="DD.MM.YYYY",Ms="YYYY-MM-DD";class Os{static dateToStr(e){return Os.formatDate(Ds,e)}static dateToStrForDatepicker(e){return Os.formatDate(Ms,e)}static dateWithTimeToStr(e){return Os.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?Zt()(t).format(e):""}static dateToMs(e,t){const n=Zt()(t,e);return t&&n.isValid()?n.valueOf():void 0}}const xs=e=>{var t,n,s,o,i,r;const a=(0,R.useIntl)(),[l,d]=(0,L.useState)([]),c=(0,Xt.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,Xt.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,L.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"),M=new RegExp(`\\b${_()}\\b(?![\\/\\-])`,"i"),O=S.replace(",","").split(/(?:\/|\s)+/g);function x(e){const t=e.buildingAddress;return t?t.findIndex((e=>e.toLowerCase()===S||e.toLowerCase()===_()))>-1?"exact":t.findIndex((e=>D.test(e.toLowerCase())||M.test(e.toLowerCase())))>-1?"partial":t.findIndex((e=>{const t=e.toLowerCase().replace(",","").replace(/\/\//g," ");return O.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:y(t),addressMatch:x(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=>Os.dateToStr(e.docDate),isFrozen:!0},{id:"reg_date",property:"regDate",size:130,getValue:e=>Os.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(ee,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,Gt.jsx)(Jt,{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,Gt.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(Q,String(e),null,!1,!1,null):null;return(0,Gt.jsxs)(Gt.Fragment,{children:[(0,Gt.jsx)(Jt,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,Gt.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,Gt.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,Gt.jsx)(K.Status,{type:Sn(e.stateCode).type,children:Sn(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=>{const{generateLink:n}=e,s=function(e){return"Meretuulepargi hoonestusloa taotlus"===e.documentType||"Hoonestusloa taotlus"===e.documentType?te:Z}(t),o=t.proceedingNr?n(s,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr?p===ne.MKM||t.institutionId&&h===t.institutionId?(0,Gt.jsx)(Jt,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:o||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,Gt.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,Gt.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,Gt.jsx)(K.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:Ht,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);return t.map((e=>{var t,n,s,o;return{docId:e.docId,docDate:null!==(t=Os.dateToMs(Ds,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=Os.dateToMs(Ds,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:""}}))}(l),handleEvent:()=>!0})};const Ns=e=>{var t,n,s,o;const i=(0,R.useIntl)(),[r,a]=(0,L.useState)([]),l=(0,Xt.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,Xt.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,Xt.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,L.useEffect)((()=>{l&&l.length>0&&a(l)}),[l]);const h=[{id:"date_start",property:"dateStart",size:130,getValue:e=>Os.dateToStr(e.dateStart),isFrozen:!0},{id:"date_end",property:"dateEnd",size:130,getValue:e=>Os.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=function(e){return"Meretuulepargi hoonestusloa taotlus"===e.documentType||"Hoonestusloa taotlus"===e.documentType?te:Z}(t),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,Gt.jsx)(Jt,{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,Gt.jsx)(K.Status,{type:Fn(e.proceedingStateCode).type,children:Fn(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(ee,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,Gt.jsx)(Jt,{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,Gt.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(Q,String(e),null,!1,!1,null):null;return(0,Gt.jsxs)(Gt.Fragment,{children:[(0,Gt.jsx)(Jt,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,Gt.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,Gt.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,Gt.jsx)(K.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:Ht,expandableRow:!1,isFilter:!1}},data:function(e){return e.map((e=>{var t,n,s,o,i,r;return{proceedingId:e.proceedingId,dateStart:null!==(t=Os.dateToMs(Ds,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=Os.dateToMs(Ds,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:"",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}}))}(r),handleEvent:()=>!0})},As="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class Us{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:As,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class js extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const ws="https://example.com",Cs=function(e,t,n){if(null==n)throw new js(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Ls=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()},Ps=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||""},Rs=function(e){return e.pathname+e.search+e.hash},Ks=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)}},ks=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Cs("buildingChangesGet","ehrCode",t),Cs("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",ws);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),Ls(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Rs(o),options:r}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Cs("buildingCompareGet","doEhitisId1",t),Cs("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",ws);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),Ls(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Rs(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",ws);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),Ls(r,d,i.query);let c=a&&a.headers?a.headers:{};return l.headers={...c,...i.headers},{url:Rs(r),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cs("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",ws);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ls(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ps(t,i,e),{url:Rs(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cs("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",ws);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ls(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ps(t,i,e),{url:Rs(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cs("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",ws);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ls(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ps(t,i,e),{url:Rs(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cs("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",ws);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ls(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ps(t,i,e),{url:Rs(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",ws);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),Ls(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Rs(o),options:r}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cs("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",ws);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehr_code=t),Ls(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Rs(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cs("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",ws);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ls(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ps(t,i,e),{url:Rs(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Cs("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",ws);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),Ls(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Rs(o),options:r}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cs("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",ws);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.id=t),Ls(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Rs(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return Ks(i,ie(),As,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return Ks(i,ie(),As,e)},async buildingDataGet(n,s,o,i,r){const a=await t.buildingDataGet(n,s,o,i,r);return Ks(a,ie(),As,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return Ks(o,ie(),As,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return Ks(o,ie(),As,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return Ks(o,ie(),As,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return Ks(o,ie(),As,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return Ks(i,ie(),As,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return Ks(o,ie(),As,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return Ks(o,ie(),As,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return Ks(i,ie(),As,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return Ks(o,ie(),As,e)}}};class Fs extends Us{buildingChangesGet(e,t,n){return ks(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return ks(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return ks(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return ks(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return ks(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return ks(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return ks(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return ks(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return ks(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return ks(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return ks(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return ks(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const Ys=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,Xt.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,L.useState)({}),[_,y]=(0,L.useState)({}),[b,D]=(0,L.useState)({}),[M,O]=(0,L.useState)([]),[x,N]=(0,L.useState)([]),[w,C]=(0,L.useState)([]),[P,R]=(0,L.useState)(!1),[k,F]=(0,L.useState)(!1),[Y,G]=(0,L.useState)(!1),B=new ge(new tt({basePath:r})),V=new xe(new Le({basePath:m})),H=new ze(new tt({basePath:p})),J=new je(new Le({basePath:m})),W=new Fs(new tt({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,L.useEffect)((()=>{B.getAllDocumentTypes().then((e=>{S(a(e.data))})).catch((e=>{console.log(e)})),V.getJurKovPersons().then((e=>{S(d(e.data))})).catch((e=>{console.log(e)})),B.getUsageClassifierTypes().then((e=>{S(c(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,L.useEffect)((()=>{if(Object.keys(b).length>0){G(!0);H.searchDetailProceedings(b).then((e=>{S(j(e.data)),C(e.data),G(!1)})).catch((e=>{console.log(e),G(!1)}))}}),[b]),(0,L.useEffect)((()=>{if(Object.keys(_).length>0){F(!0);H.searchDetailDocuments(_).then((e=>{S(U(e.data)),N(e.data),F(!1)})).catch((e=>{console.log(e),F(!1)}))}}),[_]),(0,L.useEffect)((()=>{if(Object.keys(v).length>0){let e;R(!0),e=I?W.buildingOwnerSearchPost(v):W.buildingSearchPost(v),e.then((e=>{S(A(e.data)),O(e.data),R(!1)})).catch((e=>{console.log(e),R(!1)}))}}),[v,I]),(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)(K.Section,{collapsed:h!==z,title:"detailsearch.buildings_detail_search",children:(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,Gt.jsx)(Ts,{onSubmit:e=>{E(e)},isAdminRole:f,isAdminPlusRole:I,callSearchPerson:q})}),Object.keys(v).length>0&&0===M.length&&!P?(0,Gt.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,Gt.jsx)(K.Text,{raw:"detailsearch.empty_search_result"})}):P?(0,Gt.jsx)(K.SectionLoader,{}):(0,Gt.jsx)(bs,{linkGen:l,generateLink:u,isAdminRole:f,isAdminPlusRole:I})]})}),(0,Gt.jsx)(K.Section,{collapsed:"DOCUMENTS_SEARCH"!==h,title:"detailsearch.documents_detail_search",children:(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,Gt.jsx)(vs,{onSubmit:e=>{y(e)},callSearchPerson:q,isNonAuthenticatedUser:T})}),Object.keys(_).length>0&&0===x.length&&!k?(0,Gt.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,Gt.jsx)(K.Text,{raw:"detailsearch.empty_search_result"})}):k?(0,Gt.jsx)(K.SectionLoader,{}):(0,Gt.jsx)(xs,{linkGen:l,generateLink:u,userInfo:g,filterStateDocumentsSearch:_})]})}),f&&(0,Gt.jsx)(K.Section,{collapsed:"PROCEEDINGS_SEARCH"!==h,title:"detailsearch.proceedings_detail_search",children:(0,Gt.jsxs)("div",{children:[(0,Gt.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,Gt.jsx)(Es,{onSubmit:e=>{D(e)}})}),Object.keys(b).length>0&&0===w.length&&!Y?(0,Gt.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,Gt.jsx)(K.Text,{raw:"detailsearch.empty_search_result"})}):Y?(0,Gt.jsx)(K.SectionLoader,{}):(0,Gt.jsx)(Ns,{linkGen:l,userInfo:g,generateLink:u})]})})]})};module.exports=s})();