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.umd.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@reduxjs/toolkit"),require("react"),require("react-intl"),require("ehr-components"),require("axios"),require("react-redux"),require("moment"),require("reactstrap")):"function"==typeof define&&define.amd?define(["@reduxjs/toolkit","react","react-intl","ehr-components","axios","react-redux","moment","reactstrap"],t):"object"==typeof exports?exports.ehrDocumentUI=t(require("@reduxjs/toolkit"),require("react"),require("react-intl"),require("ehr-components"),require("axios"),require("react-redux"),require("moment"),require("reactstrap")):e.ehrDocumentUI=t(e["@reduxjs/toolkit"],e.react,e["react-intl"],e["ehr-components"],e.axios,e["react-redux"],e.moment,e.reactstrap)}(this,((e,t,n,s,o,i,r,a)=>(()=>{"use strict";var l={20:(e,t,n)=>{var s=n(932),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)},306:t=>{t.exports=e},674:e=>{e.exports=o},114:e=>{e.exports=s},558:e=>{e.exports=r},932:e=>{e.exports=t},480:e=>{e.exports=n},130:e=>{e.exports=i},572:e=>{e.exports=a}},d={};function c(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return l[e](n,n.exports,c),n.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};c.r(u),c.d(u,{DetailSearch:()=>$s,MyAdministrativeProceedings:()=>on,MyApprovals:()=>Is,MyDocuments:()=>Hn,MyInvolvements:()=>Es,MyOpinions:()=>Ts,MyProceedings:()=>fs,documentsReducer:()=>M,filterReducer:()=>T,myOperationsReducer:()=>P,proceedingsReducer:()=>U,rootReducer:()=>G});var p=c(306);const h=(0,p.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:m,documentTypesLoaded:g,institutionUsersLoaded:S,institutionsLoaded:f,usageClassifierTypesLoaded:I}=h.actions,T=h.reducer;const v=(0,p.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:E,signingDocumentsLoaded:_,finishedDocumentsLoaded:y,deleteDocument:b,allowedDocumentTypesLoaded:D}=v.actions,M=v.reducer;const x=(0,p.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:O,proceedingsToCommentLoaded:N,incomingDocumentsLoaded:A}=x.actions,U=x.reducer;const j=(0,p.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:w,toCommentOperationsLoaded:C,operationInvitationsLoaded:L}=j.actions,P=j.reducer;const R=(0,p.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:K,documentsLoaded:k,proceedingsLoaded:F}=R.actions,Y=R.reducer,G=(0,p.combineReducers)({filter:T,myDocuments:M,myProceedings:U,myOperations:P,detailSearch:Y});var B=c(932),V=c.n(B),H=c(480),J=c(114);const W="SIGNING_DOCUMENTS",q="WORKING_DOCUMENTS",$="FINISHED_DOCUMENTS",z="INCOMING_DOCUMENTS",X="MY_APPROVALS",Q="MY_OPINIONS",Z="MY_INVOLVEMENTS",ee="MY_OPERATIONS",te="OPERATIONS_TO_COMMENT",ne="OPERATION_INVITATIONS",se="PROCEEDINGS_TO_COMMENT",oe="BUILDINGS_SEARCH";let ie=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const re="BUILDING",ae="PROCEEDING",le="DOCUMENT",de="ADMIN_PROCEEDING";let ce=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 ue=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}({});var pe=c(674),he=c.n(pe);const me="https://devkluster.ehr.ee".replace(/\/+$/,"");class ge{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:me,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Se extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const fe="https://example.com",Ie=function(e,t,n){if(null==n)throw new Se(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Te=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()},ve=function(e){return e.pathname+e.search+e.hash},Ee=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)}},_e=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",fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Te(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ve(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Te(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ve(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ie("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Te(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ve(o),options:r}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ie("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Te(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ve(o),options:r}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ie("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Te(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ve(o),options:r}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Te(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ve(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Te(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ve(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Te(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ve(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Te(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ve(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Te(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ve(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return Ee(s,he(),me,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return Ee(s,he(),me,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return Ee(o,he(),me,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return Ee(o,he(),me,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return Ee(o,he(),me,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return Ee(s,he(),me,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return Ee(s,he(),me,e)},async getHealth(n){const s=await t.getHealth(n);return Ee(s,he(),me,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return Ee(s,he(),me,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return Ee(s,he(),me,e)}}};class ye extends ge{getAllDocumentTypes(e){return _e(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return _e(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return _e(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return _e(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return _e(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return _e(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return _e(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return _e(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return _e(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return _e(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class be{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 De="http://localhost:8080".replace(/\/+$/,"");class Me{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:De,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class xe extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Oe="https://example.com",Ne=function(e,t,n){if(null==n)throw new xe(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Ae(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Ae(e,t,n))):Object.keys(t).forEach((s=>Ae(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const 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];Ae(t,s),e.search=t.toString()},je=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||""},we=function(e){return e.pathname+e.search+e.hash},Ce=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 Le=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",Oe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Ne("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,Oe);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ue(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:we(i),options:a}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return Ce(s,he(),De,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return Ce(o,he(),De,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return Ce(o,he(),De,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return Ce(i,he(),De,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return Ce(o,he(),De,e)}}};class Pe extends Me{getJurKovPersons(e){return Le(this.configuration).getJurKovPersons(e).then((e=>e(this.axios,this.basePath)))}getJurPersonCoordRelJurs(e,t){return Le(this.configuration).getJurPersonCoordRelJurs(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByEHAKCode(e,t){return Le(this.configuration).getUserPossibleProceedingSupervisorsByEHAKCode(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n){return Le(this.configuration).getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByJurId(e,t){return Le(this.configuration).getUserPossibleProceedingSupervisorsByJurId(e,t).then((e=>e(this.axios,this.basePath)))}}const Re=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",Oe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ue(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=je(t,i,e),{url:we(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",Oe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ue(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=je(t,i,e),{url:we(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ne("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),r=new URL(i,Oe);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",Ue(r,c);let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...o.headers},l.data=je(s,l,e),{url:we(r),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,Oe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ue(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=je(n,a,e),{url:we(i),options:a}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",Oe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",Oe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",Oe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",Oe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"PUT",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,Oe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ue(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=je(n,a,e),{url:we(i),options:a}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return Ce(o,he(),De,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return Ce(o,he(),De,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return Ce(o,he(),De,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const r=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return Ce(r,he(),De,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return Ce(i,he(),De,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return Ce(s,he(),De,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return Ce(s,he(),De,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return Ce(s,he(),De,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return Ce(o,he(),De,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return Ce(o,he(),De,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return Ce(o,he(),De,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return Ce(o,he(),De,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return Ce(o,he(),De,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return Ce(s,he(),De,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return Ce(o,he(),De,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return Ce(o,he(),De,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return Ce(i,he(),De,e)}}};class Ke extends Me{addAllyksusToJurPerson(e,t){return Re(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return Re(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return Re(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return Re(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return Re(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return Re(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return Re(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return Re(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return Re(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return Re(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return Re(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return Re(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return Re(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return Re(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return Re(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return Re(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return Re(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const ke=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ne("searchPerson","input",t);const i=new URL("/search/searchPerson",Oe);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),Ue(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...o.headers},{url:we(i),options:a}}}}(e);return{async searchPerson(n,s,o,i){const r=await t.searchPerson(n,s,o,i);return Ce(r,he(),De,e)}}};class Fe extends Me{searchPerson(e,t,n,s){return ke(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const Ye=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",Oe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ue(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=je(t,i,e),{url:we(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",Oe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ue(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=je(t,i,e),{url:we(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",Oe);let o;e&&(o=e.baseOptions);const i={method:"PUT",...o,...n},r={"Content-Type":"application/json"};Ue(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=je(t,i,e),{url:we(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",Oe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Oe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne("getJurUsersWithoutGivenRole","personId",t),Ne("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,Oe);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ue(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:we(i),options:a}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",Oe);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.searchInput=t),Ue(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:we(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ne("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Oe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Oe);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};void 0!==n&&(l.valid=n),Ue(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...s.headers},{url:we(i),options:a}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Oe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ue(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=je(n,a,e),{url:we(i),options:a}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ne("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,Oe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ue(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=je(n,a,e),{url:we(i),options:a}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return Ce(o,he(),De,e)},async addUser(n,s){const o=await t.addUser(n,s);return Ce(o,he(),De,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return Ce(o,he(),De,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return Ce(o,he(),De,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return Ce(o,he(),De,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return Ce(o,he(),De,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return Ce(s,he(),De,e)},async getHealth(n){const s=await t.getHealth(n);return Ce(s,he(),De,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return Ce(o,he(),De,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return Ce(i,he(),De,e)},async getUser(n,s){const o=await t.getUser(n,s);return Ce(o,he(),De,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return Ce(o,he(),De,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return Ce(o,he(),De,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return Ce(i,he(),De,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return Ce(i,he(),De,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return Ce(i,he(),De,e)}}};class Ge extends Me{addRoleToUser(e,t){return Ye(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return Ye(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return Ye(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return Ye(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return Ye(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return Ye(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return Ye(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Ye(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return Ye(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return Ye(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return Ye(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return Ye(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return Ye(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return Ye(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return Ye(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return Ye(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class Be{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 Ve="http://localhost:8080".replace(/\/+$/,"");class He{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ve,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he();var s;(this.basePath=t,this.axios=n,e)&&(this.configuration=e,this.basePath=null!==(s=e.basePath)&&void 0!==s?s:t)}}class Je extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const We={},qe="https://example.com",$e=function(e,t,n){if(null==n)throw new Je(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function ze(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>ze(e,t,n))):Object.keys(t).forEach((s=>ze(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Xe=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];ze(t,s),e.search=t.toString()},Qe=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||""},Ze=function(e){return e.pathname+e.search+e.hash},et=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)}},tt=function(e){const t=function(e){return{findIncomingBaseDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("findIncomingBaseDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(s),options:i}},findWorkingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("findWorkingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(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=We["BaseMyDocumentsApi.findIncomingBaseDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,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=We["BaseMyDocumentsApi.findWorkingDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,e)(t,d||n)}}};class nt extends He{findIncomingBaseDocuments(e,t){return tt(this.configuration).findIncomingBaseDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments(e,t){return tt(this.configuration).findWorkingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}}const st=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(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=We["DetailSearchesApi.searchDetailBuildings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,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=We["DetailSearchesApi.searchDetailDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,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=We["DetailSearchesApi.searchDetailProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,e)(t,d||n)}}};class ot extends He{searchDetailBuildings(e,t){return st(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return st(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return st(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const it=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(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=We["MyOperationsApi.findOperationInvitations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,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=We["MyOperationsApi.findOperations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,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=We["MyOperationsApi.findOperationsToComment"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,e)(t,d||n)}}};class rt extends He{findOperationInvitations(e,t){return it(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return it(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return it(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const at=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};$e("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",qe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Xe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Qe(t,i,e),{url:Ze(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=We["MyProceedingsApi.findAreaProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,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=We["MyProceedingsApi.findProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>et(a,he(),Ve,e)(t,d||n)}}};class lt extends He{findAreaProceedings(e,t){return at(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return at(this.configuration).findProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}class dt{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 ct="https://devkluster.ehr.ee/api/document/v1".replace(/\/+$/,"");class ut{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class pt extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const ht="https://example.com",mt=function(e,t,n){if(null==n)throw new pt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},gt=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()},St=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||""},ft=function(e){return e.pathname+e.search+e.hash},It=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 Tt=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};mt("addAuthz","documentType",t),mt("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,ht);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};gt(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ft(i),options:a}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",ht);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};gt(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ft(n),options:o}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};mt("createDocument","dotyId",t);const o="/document/{dotyId}".replace("{dotyId}",encodeURIComponent(String(t))),i=new URL(o,ht);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={"Content-Type":"application/json"};gt(i,{},s.query);let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=St(n,a,e),{url:ft(i),options:a}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};mt("createNewVersion","documentType",t),mt("createNewVersion","applicationNumber",n),mt("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,ht);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={"Content-Type":"application/json"};gt(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=St(s,l,e),{url:ft(r),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};mt("deleteApplicationByNumber","documentType",t),mt("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,ht);let r;e&&(r=e.baseOptions);const a={method:"DELETE",...r,...s};gt(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ft(i),options:a}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};mt("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,ht);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};gt(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ft(o),options:r}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};mt("getApplicationByNumber","documentType",t),mt("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,ht);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};gt(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ft(i),options:a}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};mt("getApplicationByNumberOld","ehrCode",t),mt("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,ht);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};gt(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ft(i),options:a}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};mt("getApplicationByNumberWithVersion","documentType",t),mt("getApplicationByNumberWithVersion","applicationNumber",n),mt("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,ht);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...o};gt(r,{},o.query);let d=a&&a.headers?a.headers:{};return l.headers={...d,...o.headers},{url:ft(r),options:l}},getDotysBasedOnUserRights:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/starting_rights",ht);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};gt(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ft(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",ht);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};gt(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ft(n),options:o}},reSubmit:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};mt("reSubmit","documentType",t),mt("reSubmit","applicationNumber",n),mt("reSubmit","proceedingNumber",s),mt("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,ht);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={"Content-Type":"application/json"};gt(a,{},i.query);let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=St(o,d,e),{url:ft(a),options:d}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};mt("saveAndValidate","documentType",t),mt("saveAndValidate","applicationNumber",n),mt("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,ht);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={"Content-Type":"application/json"};gt(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=St(s,l,e),{url:ft(r),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};mt("saveApplicationByNumber","documentType",t),mt("saveApplicationByNumber","applicationNumber",n),mt("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,ht);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={"Content-Type":"application/json"};gt(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=St(s,l,e),{url:ft(r),options:l}},submitStraightToRegistry:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};mt("submitStraightToRegistry","documentType",t),mt("submitStraightToRegistry","applicationNumber",n),mt("submitStraightToRegistry","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,ht);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={"Content-Type":"application/json"};gt(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=St(s,l,e),{url:ft(r),options:l}},submitToProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};mt("submitToProcessing","documentType",t),mt("submitToProcessing","applicationNumber",n),mt("submitToProcessing","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,ht);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={"Content-Type":"application/json"};gt(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=St(s,l,e),{url:ft(r),options:l}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};mt("submitToSigning","documentType",t),mt("submitToSigning","applicationNumber",n),mt("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,ht);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={"Content-Type":"application/json"};gt(r,{},o.query);let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=St(s,l,e),{url:ft(r),options:l}},submitToSupervisorProcessing:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};mt("submitToSupervisorProcessing","documentType",t),mt("submitToSupervisorProcessing","applicationNumber",n),mt("submitToSupervisorProcessing","supervisorIdCode",s),mt("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,ht);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={"Content-Type":"application/json"};gt(a,{},i.query);let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=St(o,d,e),{url:ft(a),options:d}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};mt("validateSavedDocument","documentType",t),mt("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,ht);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};gt(i,{},s.query);let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ft(i),options:a}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return It(i,he(),ct,e)},async apiVersion(n){const s=await t.apiVersion(n);return It(s,he(),ct,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return It(i,he(),ct,e)},async createNewVersion(n,s,o,i){const r=await t.createNewVersion(n,s,o,i);return It(r,he(),ct,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return It(i,he(),ct,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return It(o,he(),ct,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return It(i,he(),ct,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return It(i,he(),ct,e)},async getApplicationByNumberWithVersion(n,s,o,i){const r=await t.getApplicationByNumberWithVersion(n,s,o,i);return It(r,he(),ct,e)},async getDotysBasedOnUserRights(n){const s=await t.getDotysBasedOnUserRights(n);return It(s,he(),ct,e)},async getHealth(n){const s=await t.getHealth(n);return It(s,he(),ct,e)},async reSubmit(n,s,o,i,r){const a=await t.reSubmit(n,s,o,i,r);return It(a,he(),ct,e)},async saveAndValidate(n,s,o,i){const r=await t.saveAndValidate(n,s,o,i);return It(r,he(),ct,e)},async saveApplicationByNumber(n,s,o,i){const r=await t.saveApplicationByNumber(n,s,o,i);return It(r,he(),ct,e)},async submitStraightToRegistry(n,s,o,i){const r=await t.submitStraightToRegistry(n,s,o,i);return It(r,he(),ct,e)},async submitToProcessing(n,s,o,i){const r=await t.submitToProcessing(n,s,o,i);return It(r,he(),ct,e)},async submitToSigning(n,s,o,i){const r=await t.submitToSigning(n,s,o,i);return It(r,he(),ct,e)},async submitToSupervisorProcessing(n,s,o,i,r){const a=await t.submitToSupervisorProcessing(n,s,o,i,r);return It(a,he(),ct,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return It(i,he(),ct,e)}}};class vt extends ut{addAuthz(e,t,n){return Tt(this.configuration).addAuthz(e,t,n).then((e=>e(this.axios,this.basePath)))}apiVersion(e){return Tt(this.configuration).apiVersion(e).then((e=>e(this.axios,this.basePath)))}createDocument(e,t,n){return Tt(this.configuration).createDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}createNewVersion(e,t,n,s){return Tt(this.configuration).createNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteApplicationByNumber(e,t,n){return Tt(this.configuration).deleteApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationById(e,t){return Tt(this.configuration).getApplicationById(e,t).then((e=>e(this.axios,this.basePath)))}getApplicationByNumber(e,t,n){return Tt(this.configuration).getApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberOld(e,t,n){return Tt(this.configuration).getApplicationByNumberOld(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberWithVersion(e,t,n,s){return Tt(this.configuration).getApplicationByNumberWithVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRights(e){return Tt(this.configuration).getDotysBasedOnUserRights(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Tt(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s,o){return Tt(this.configuration).reSubmit(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}saveAndValidate(e,t,n,s){return Tt(this.configuration).saveAndValidate(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveApplicationByNumber(e,t,n,s){return Tt(this.configuration).saveApplicationByNumber(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitStraightToRegistry(e,t,n,s){return Tt(this.configuration).submitStraightToRegistry(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n,s){return Tt(this.configuration).submitToProcessing(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSigning(e,t,n,s){return Tt(this.configuration).submitToSigning(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSupervisorProcessing(e,t,n,s,o){return Tt(this.configuration).submitToSupervisorProcessing(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}validateSavedDocument(e,t,n){return Tt(this.configuration).validateSavedDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}}class Et{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const _t="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class yt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class bt extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Dt="https://example.com",Mt=function(e,t,n){if(null==n)throw new bt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},xt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},Ot=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()},Nt=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||""},At=function(e){return e.pathname+e.search+e.hash},Ut=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},jt=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",Dt);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...o},l={},d={};await xt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),Ot(i,d);let c=r&&r.headers?r.headers:{};return a.headers={...l,...c,...o.headers},{url:At(i),options:a}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mt("deleteFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Dt);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n},a={};await xt(a,e),Ot(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:At(o),options:r}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mt("downloadFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Dt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await xt(a,e),Ot(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:At(o),options:r}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("updateFile","fileId",t);const o="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await xt(l,e),l["Content-Type"]="application/json",Ot(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Nt(n,a,e),{url:At(i),options:a}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mt("updateFileInfo","doFail",t);const s=new URL("/file/info",Dt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};await xt(r,e),r["Content-Type"]="application/json",Ot(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Nt(t,i,e),{url:At(s),options:i}},uploadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/file",Dt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={},a=new(e&&e.formDataCtor||FormData);await xt(r,e),void 0!==t&&a.append("file",t),r["Content-Type"]="multipart/form-data",Ot(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},i.data=a,{url:At(s),options:i}},uploadFileWithFileInfo:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/fileWithInfo",Dt);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...s},a={},l=new(e&&e.formDataCtor||FormData);await xt(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",Ot(o,{});let d=i&&i.headers?i.headers:{};return r.headers={...a,...d,...s.headers},r.data=l,{url:At(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",Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...i},d={},c=new(e&&e.formDataCtor||FormData);await xt(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",Ot(r,{});let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:At(r),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const r=await t.cloneFilesAndCreateRels(n,s,o,i);return Ut(r,he(),_t,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return Ut(o,he(),_t,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return Ut(o,he(),_t,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return Ut(i,he(),_t,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return Ut(o,he(),_t,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return Ut(o,he(),_t,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return Ut(i,he(),_t,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,r){const a=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,r);return Ut(a,he(),_t,e)}}};class wt extends yt{cloneFilesAndCreateRels(e,t,n,s){return jt(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return jt(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return jt(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return jt(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return jt(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return jt(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return jt(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return jt(this.configuration).uploadFileWithFileInfoAndDocRel(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}}class Ct{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 Lt="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class Pt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Lt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Rt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Kt="https://example.com",kt=function(e,t,n){if(null==n)throw new Rt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Ft(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Ft(e,t,n))):Object.keys(t).forEach((s=>Ft(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Yt=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];Ft(t,s),e.search=t.toString()},Gt=function(e){return e.pathname+e.search+e.hash},Bt=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const Vt=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};kt("esileht","id",t),kt("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,Kt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Yt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Gt(i),options:a}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",Kt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Yt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Gt(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",Kt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Yt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Gt(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kt("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,Kt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Yt(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Gt(o),options:r}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};kt("lehtdSave","esileht",t);const s=new URL("/api/pages",Kt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};r["Content-Type"]="application/json",Yt(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:Gt(s),options:i}}}},Ht=function(e){const t=Vt(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return Bt(i,he(),Lt,e)},async lehed(n){const s=await t.lehed(n);return Bt(s,he(),Lt,e)},async lehedId(n){const s=await t.lehedId(n);return Bt(s,he(),Lt,e)},async leht(n,s){const o=await t.leht(n,s);return Bt(o,he(),Lt,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return Bt(o,he(),Lt,e)}}};class Jt extends Pt{esileht(e,t,n){return Ht(this.configuration).esileht(e,t,n).then((e=>e(this.axios,this.basePath)))}lehed(e){return Ht(this.configuration).lehed(e).then((e=>e(this.axios,this.basePath)))}lehedId(e){return Ht(this.configuration).lehedId(e).then((e=>e(this.axios,this.basePath)))}leht(e,t){return Ht(this.configuration).leht(e,t).then((e=>e(this.axios,this.basePath)))}lehtdSave(e,t){return Ht(this.configuration).lehtdSave(e,t).then((e=>e(this.axios,this.basePath)))}}class Wt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const qt={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},$t={proceedingApiService:new lt(new dt({basePath:qt.myViewsApiEndpoint})),classifierApiService:new ye(new be({basePath:qt.classifierApiEndpoint})),personApiService:new Ke(new Be({basePath:qt.userApiEndpoint})),userApiService:new Ge(new Be({basePath:qt.userApiEndpoint})),myDocumentBaseApiService:new nt(new dt({basePath:qt.myViewsApiEndpoint})),documentApiService:new vt(new Et({basePath:qt.documentApiEndpoint})),fileApiService:new wt(new Ct({basePath:qt.fileUploadApiEndpoint})),frontPageApi:new Jt(new Wt({basePath:qt.frontPageApiEndpoint})),institutionKovEndpointApi:new Pe(new Be({basePath:qt.userApiEndpoint}))};var zt=c(848);const Xt=11272,Qt=e=>{var t;let{userInfo:n}=e;const s=(0,H.useIntl)(),[o,i]=(0,B.useState)(!0),[r,a]=(0,B.useState)(""),[l,d]=(0,B.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===ce.MKM;(0,B.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{$t.frontPageApi.leht(Xt).then((e=>{const t=e.data;t[0].body&&(a(t[0].body),d(t[0].body))}))},p=async()=>{$t.frontPageApi.esileht(Xt,"ee").then((e=>{const t=e.data;t.body&&(a(t.body),d(t.body))}))};return(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,zt.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,zt.jsx)(J.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,zt.jsx)(J.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,zt.jsxs)("div",{className:"pt-2",children:[(0,zt.jsx)(J.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(r),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),a(l),$t.frontPageApi.lehtdSave({id:Xt,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},Zt={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},en=e=>(0,zt.jsx)(J.Tooltip,{content:(0,zt.jsx)(J.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,zt.jsx)(J.Link,{onClick:t=>{var n;return null===(n=e.functionCall)||void 0===n?void 0:n.call(e,t)},text:e.linkName,href:e.href}):(0,zt.jsx)(J.Link,{text:e.linkName,href:e.href,onClick:t=>{t.preventDefault(),t.stopPropagation();const n=window.open(e.href,"_blank");null==n||n.focus()}})},e.linkName),tn=e=>{let{proceedings:t,linkGen:n}=e;const s=(0,H.useIntl)(),o=[{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{return(t=e).proceedingNr?(0,zt.jsx)(en,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,zt.jsx)(zt.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,zt.jsx)(en,{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,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(en,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,zt.jsx)("span",{children:", "}):""]}))):""},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>e.address&&null!==e.address?e.address.map((e=>(0,zt.jsx)("div",{children:e}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,zt.jsx)(J.TableComponent,{config:{thead:{headers:o.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:s.formatMessage({id:"my_admin_proceedings.table.header."+e.id}),tooltip:{text:s.formatMessage({id:"my_admin_proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,type:"input",valueFormatter:t=>e.getValue(t)}))),icons:Zt,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},nn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,B.useState)(!1),[o,i]=(0,B.useState)(void 0),[r,a]=(0,B.useState)([]);(0,B.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===ce.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await $t.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}},sn=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,H.useIntl)(),[o,i]=(0,B.useState)(!1),{loading:r,error:a,proceedings:l}=nn(t,o);return(0,zt.jsxs)(J.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[a&&(0,zt.jsx)(J.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:a})}),r&&(0,zt.jsxs)(J.Row,{className:"mb-4 justify-content-center",children:[(0,zt.jsx)("br",{}),(0,zt.jsx)(J.Loader,{}),(0,zt.jsx)("br",{})]}),!r&&!(null==l||!l.length)&&!a&&(0,zt.jsx)(tn,{proceedings:l,linkGen:n}),(0,zt.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,zt.jsx)(J.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},on=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,H.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===ce.TJA;return(0,zt.jsxs)("div",{children:[(0,zt.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,zt.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,zt.jsx)(J.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,zt.jsx)(Qt,{userInfo:n}),i&&(0,zt.jsx)(sn,{userInfo:n,linkGen:s})]})};var rn=c(130),an=c(558),ln=c.n(an);function dn(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 cn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function un(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 pn(e,t,n){const s=n(e),o=n(t),i=un(s),r=un(o);return r===i?0:i>r?1:-1}function hn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function mn(e,t,n){if(0===e.length)return e;const s={string:dn,number:cn,object:pn,date:hn}[typeof t(e[0])];return[...e].sort(((e,o)=>s(e,o,t)*n))}const gn=0,Sn=1,fn=-1;function In(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case gn:return Sn;case Sn:return fn;case fn:return Sn}}(t.direction):Sn}}const Tn=e=>-1===e.sortDirection?(0,zt.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,zt.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,zt.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,zt.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,zt.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,zt.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"})}),vn=e=>{const[t,n]=(0,B.useState)(!1);return(0,zt.jsx)(zt.Fragment,{children:e.fileId&&(0,zt.jsx)(J.ControlledPopover,{content:(0,zt.jsxs)("div",{style:{width:"250px"},children:[(0,zt.jsx)("h4",{children:(0,zt.jsx)(H.FormattedMessage,{id:"download.file"})}),(0,zt.jsx)("br",{}),(0,zt.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,zt.jsx)(J.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.cancel"})}),(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",onClick:()=>{e.fileId&&e.fileApi.downloadFile(e.fileId,{responseType:"blob"}).then((e=>{const s=e.headers["content-disposition"];let o="download";if(s){const e=s.match(/filename\*=UTF-8''(.+?)(;|$)/);e&&e.length>=2&&(o=decodeURIComponent(e[1].replace(/\+/g," ")))}const i=new Blob([e.data],{}),r=document.createElement("a");r.download=o,r.href=URL.createObjectURL(i),r.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(r.href)),3e4)})),r.click(),n(!t)})).catch((e=>console.log(e)))},squared:!0,type:"submit",children:(0,zt.jsx)(H.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,zt.jsx)(J.Icon,{tooltipText:(0,zt.jsx)(H.FormattedMessage,{id:"tooltip.download"}),type:"download"})})})};let En=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 _n=[{code:En.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:En.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:En.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:En.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:En.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"}],yn=[{code:En.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:En.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:En.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:En.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"}];function bn(e){const t=(e,t)=>({name:e,type:t});switch(En[e]){case En.DO_DOKUSEIS_ESITATUD:return t("Esitatud",ie.INFO);case En.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",ie.DEFAULT);case En.DO_DOKUSEIS_KOOSTAMISEL:case En.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",ie.INFO);case En.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",ie.INFO);case En.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",ie.INFO);case En.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",ie.INFO);case En.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",ie.WARNING);case En.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",ie.DEFAULT);case En.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",ie.DEFAULT);case En.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",ie.DEFAULT);case En.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",ie.INFO);case En.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",ie.SUCCESS);case En.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",ie.SUCCESS);case En.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",ie.WARNING);case En.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",ie.DANGER);case En.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",ie.SUCCESS);case En.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",ie.SUCCESS);case En.DO_DOKUSEIS_ANTUD:return t("Antud",ie.SUCCESS);case En.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case En.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",ie.SUCCESS);case En.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",ie.DEFAULT);case En.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",ie.INFO);default:return t(e,ie.DEFAULT)}}function Dn(e){let t=[];e===q?t=_n:e===$&&(t=yn);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 Mn(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)&&[En.DO_DOKUSEIS_MENETLETUD,En.DO_DOKUSEIS_LUBATUD,En.DO_DOKUSEIS_LUB_TEAV,En.DO_DOKUSEIS_KEELDUTUD,En.DO_DOKUSEIS_TEAVITATUD,En.DO_DOKUSEIS_REG_KANTUD,En.DO_DOKUSEIS_ANTUD,En.DO_DOKUSEIS_KEHTIV].includes(n)?t.documentStates.includes(En.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(ln()(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(ln()(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(ln()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(ln()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function xn(e){return null!=e}function On(e,t){return Object.keys(e).find((n=>e[n]===Object.values(e).find((e=>e.includes(t)))))}function Nn(e){var t,n,s,o;const[i,r]=(0,B.useState)(!1);function a(){r(!i)}const l=(0,zt.jsxs)("div",{children:[(0,zt.jsx)("h4",{children:(0,zt.jsx)(H.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,zt.jsx)("p",{children:(0,zt.jsx)(H.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,zt.jsxs)("div",{children:[(0,zt.jsx)(J.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,zt.jsx)(H.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void a()),squared:!0,type:"submit",children:(0,zt.jsx)(H.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,zt.jsx)(J.ControlledPopover,{delegateFocusOnOpen:null===(s=e.delegateFocusOnOpen)||void 0===s||s,className:"popover-confirm",content:e.content||l,open:i,placement:"top-end",theme:"danger",toggle:()=>a(),wrapperClassName:null!==(o=e.wrapperClassName)&&void 0!==o?o:"",children:e.children})}function An(e){return(0,zt.jsx)(Nn,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,zt.jsx)(J.Icon,{tooltipText:(0,zt.jsx)(H.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const Un=e=>{const t=(0,H.useIntl)(),[n,s]=(0,B.useState)({offset:0,limit:10}),[o,i]=(0,B.useState)([]),[r,a]=(0,B.useState)({column:0,direction:gn}),[l,d]=(0,B.useState)(!1),[c,u]=(0,B.useState)(!1),[p,h]=(0,B.useState)(!1),m=(0,rn.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),g=(0,rn.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),S=(0,rn.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),f=(0,rn.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments));(0,B.useEffect)((()=>{m&&e.documentType===q&&(Object.keys(e.filter).length>0?(i(Mn(m,e.filter)),s({offset:0,limit:10})):i(m))}),[m,e.filter]),(0,B.useEffect)((()=>{g&&e.documentType===W&&(Object.keys(e.filter).length>0?(i(Mn(g,e.filter)),s({offset:0,limit:10})):i(g))}),[g,e.filter]),(0,B.useEffect)((()=>{S&&e.documentType===$&&(Object.keys(e.filter).length>0?(i(Mn(S,e.filter)),s({offset:0,limit:10})):i(S))}),[S,e.filter]),(0,B.useEffect)((()=>{f&&e.documentType===z&&(Object.keys(e.filter).length>0?(i(Mn(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=>xn(e.docDate)?new Date(ln()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,t=>e.documentType===z?xn(t.deadlineDate)?new Date(ln()(t.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:xn(t.regDate)?new Date(ln()(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&&xn(e.buildingName[0])?e.buildingName[0]:"",e=>e.ehrCode&&xn(e.ehrCode[0])?e.ehrCode[0]:"",e=>e.buildingAddress&&xn(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,zt.jsxs)(J.Section,{form:!0,children:[o&&(0,zt.jsx)(J.CollapseTable,{content:o.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,o,i,r,a,m,g,S;return(0,zt.jsx)(J.CollapseTableRow,{fields:[t.docDate,e.documentType===z?ln()(t.deadlineDate,"DD.MM.YYYY").valueOf()<ln()().valueOf()?(0,zt.jsx)("div",{className:"red-text",children:null===(n=t.deadlineDate)||void 0===n?void 0:n.toString()}):t.deadlineDate:t.regDate,(0,zt.jsx)(J.Tooltip,{content:(0,zt.jsx)(J.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,zt.jsx)(J.Link,{onClick:n=>{e.linkGen(!0,n,le,t.docNr)},text:t.docNr,href:e.linkGen(!1,void 0,le,t.docNr)})},t.docNr),t.documentType,t.buildingName?(0,zt.jsx)("div",{children:p?(0,zt.jsxs)("div",{children:[t.buildingName.map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.jsx)("br",{})]},t))),t.buildingName.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,zt.jsxs)("div",{children:[null===(s=t.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.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,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,zt.jsx)("div",{children:c?(0,zt.jsxs)("div",{children:[t.ehrCode.map(((t,n)=>(0,zt.jsxs)(V().Fragment,{children:[(0,zt.jsx)(en,{linkName:t,tooltipText:"my_documents.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,re,t)},href:e.linkGen(!1,void 0,re,t)}),(0,zt.jsx)("br",{})]},n))),t.ehrCode.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,zt.jsxs)("div",{children:[null===(i=t.ehrCode)||void 0===i?void 0:i.slice(0,4).map(((t,n)=>(0,zt.jsxs)(V().Fragment,{children:[(0,zt.jsx)(en,{linkName:t,tooltipText:"my_documents.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,re,t)},href:e.linkGen(!1,void 0,re,t)}),(0,zt.jsx)("br",{})]},n))),null===(r=t.ehrCode)||void 0===r?void 0:r.slice(4,5).map((t=>(0,zt.jsx)(en,{linkName:t,tooltipText:"my_documents.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,re,t)},href:e.linkGen(!1,void 0,re,t)}))),t.ehrCode.length>5?" ...":"",t.ehrCode.length>5&&(0,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",t.buildingAddress?(0,zt.jsx)("div",{children:l?(0,zt.jsxs)("div",{children:[t.buildingAddress.map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.jsx)("br",{})]},t))),t.buildingAddress.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===t.buildingAddress.length?t.buildingAddress:(0,zt.jsxs)("div",{children:[null===(a=t.buildingAddress)||void 0===a?void 0:a.slice(0,4).map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.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,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",t.stateCode?(0,zt.jsx)(J.Status,{type:bn(t.stateCode).type,children:bn(t.stateCode).name}):"",e.documentType===W?(0,zt.jsx)(J.Tooltip,{content:(0,zt.jsx)(J.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,zt.jsx)(J.Link,{onClick:n=>{e.linkGen(!0,n,ae,t.proceedingNr)},text:t.proceedingNr,href:e.linkGen(!1,void 0,ae,t.proceedingNr)})},t.proceedingNr):t.proceedingNr,t.presenter?t.presenter.map(((e,n)=>(0,zt.jsxs)("div",{children:[e,n!==t.presenter.length-1?(0,zt.jsx)("span",{children:", "}):""]}))):""],tools:e.documentType===q&&t.stateCode===En.DO_DOKUSEIS_KOOSTAMISEL?[(0,zt.jsx)(vn,{fileApi:e.fileApi,fileId:t.generatedFileId,docNr:null!==(g=t.docNr)&&void 0!==g?g:""},t.docId+"download"),(0,zt.jsx)(An,{onConfirm:()=>{e.onDocumentDelete(t.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},t.docNr)]:[(0,zt.jsx)(vn,{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===z?n:I).map(((e,n)=>(0,zt.jsxs)("div",{children:[(0,zt.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=In(n,r);a(e),e.direction!==gn&&i(mn(o,T[n],e.direction))},children:r.column===n?(0,zt.jsx)(Tn,{sortDirection:r.direction}):(0,zt.jsx)(Tn,{sortDirection:gn})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s,editable:!0}),(0,zt.jsx)(J.Row,{children:e.isKov&&e.documentType!==z?(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,zt.jsx)(J.Text,{raw:"my_documents.view_all_institution_documents"}),checked:e.isAllUsersChecked})}):(0,zt.jsx)(J.Col,{})})]})};var jn=c(572);function wn(e,t,n,s){return s?(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsxs)(jn.Row,{className:"checkboxTooltip",children:[(0,zt.jsx)(jn.Col,{md:1,children:(0,zt.jsx)(J.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",onChange:e=>t(e),text:"",checked:e})}),(0,zt.jsx)(jn.Col,{md:8,style:{padding:"0 0 0 5px"},children:(0,zt.jsx)(J.Text,{raw:(0,zt.jsx)(H.FormattedMessage,{id:n})})})]}),label:(0,zt.jsx)(H.FormattedMessage,{id:"label.empty"})}):(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,zt.jsx)(J.Text,{raw:(0,zt.jsx)(H.FormattedMessage,{id:n})}),checked:e}),label:(0,zt.jsx)(H.FormattedMessage,{id:"label.empty"}),labelCol:{sm:20,md:8,lg:8}})}const Cn=["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 Ln(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&&ln()(n.validTo).isBefore(ln()(new Date))?" (kuni "+ln()(n.validTo).format("DD.MM.YYYY")+")":""),level:s.level+1,children:[],selectable:!0,value:!1})}return t.children?t.children:[]}(e.filter((e=>Cn.includes(e.id.toString()))).sort(((e,t)=>e.id-t.id)))}function Pn(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 Rn(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 Kn(e){var t,n,s,o;return(0,zt.jsxs)("div",{className:"d-flex align-items-center",children:[(0,zt.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,zt.jsx)(J.DatePicker,{disabled:null!==(t=e.disabled)&&void 0!==t&&t,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.from=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(n=e.value)||void 0===n?void 0:n.from})}),(0,zt.jsx)("span",{className:"px-1",children:"—"}),(0,zt.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,zt.jsx)(J.DatePicker,{disabled:null!==(s=e.disabled)&&void 0!==s&&s,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.to=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(o=e.value)||void 0===o?void 0:o.to})})]})}const kn=e=>{const t=(0,H.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",documentNumber:"",cadastralNumber:"",documentStates:[],institutionUsers:[],proceedingNumber:"",institutions:[],proceedingMissing:!1,documentDate:{from:"",to:""}},[i,r]=(0,B.useState)(o);(0,B.useEffect)((()=>{Object.keys(e.filterState).length>0&&r(e.filterState)}),[e.documentType]);const[a,l]=(0,B.useState)(!0),[d,c]=(0,B.useState)(!0),[u,p]=(0,B.useState)(""),[h,m]=(0,B.useState)([]),[g,S]=(0,B.useState)([]),[f,I]=(0,B.useState)([]),[T,v]=(0,B.useState)(Dn(e.documentType)),[E,_]=(0,B.useState)([]),y=(0,rn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutions));function M(e){return n.test(e)}function x(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function O(e,t){var n;i[t]=e,"ehrCode"===t&&M(e)?l(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&c(!0),r((e=>({...e})))}(0,B.useEffect)((()=>{v(Dn(e.documentType))}),[e.documentType]),(0,B.useEffect)((()=>{if(y){const e=Ln(y);m(e)}if(b&&e.isKov){const e=Pn(b?[...b]:[]);I(e)}if(D){const e=Rn([...D]);S(e)}}),[y,b,D]);return(0,zt.jsxs)(J.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,zt.jsxs)(J.Row,{className:"align-items-start",children:[(0,zt.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:h,onSelect:e=>x(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>x(e,"documentTypes"),value:i.documentTypes,selectedOptions:E}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_type",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>O(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.building_name",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>O(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_number",placement:"top-start"}}),e.documentType!==z&&e.documentType!==W&&(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:T,onSelect:e=>x(e,"documentStates"),allSelection:!0,onRemoveItem:e=>x(e,"documentStates"),value:i.documentStates,selectedOptions:E}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>O(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.proceeding_number",placement:"top-start"}}),wn(i.proceedingMissing,(function(e){r((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(Kn,{onChange:e=>(e=>{""!==e.from&&!ln()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!ln()(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,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.document_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_date",placement:"top-start"}})]}),(0,zt.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>O(e,"ehrCode"),onBlur:e=>l(M(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!a&&(0,zt.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.ehrCode",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>O(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.word_in_address",placement:"top-start"}}),e.documentType!==z&&e.documentType!==W&&e.isKov&&(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:f,onSelect:e=>x(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>x(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}}),e.documentType!==z&&(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:g,onSelect:e=>x(e,"institutions"),allSelection:!0,onRemoveItem:e=>x(e,"institutions"),value:i.institutions,selectedOptions:E}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===W&&(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:f,onSelect:e=>x(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>x(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}})]})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{onClick:()=>(_([]),void r(o)),colourScheme:"light",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(a&&d),squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},Fn=["11566","11567","11569","11576","11577"],Yn=e=>{const[t,n]=(0,B.useState)(!1),[s,o]=(0,B.useState)(""),[i,r]=(0,B.useState)(!1),[a,l]=(0,B.useState)([]),d=(0,rn.useSelector)((e=>e.myViewsPage.myDocuments.allowedDocumentTypesToStart)),c=e=>null==e||Number.isNaN(e)||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length;(0,B.useEffect)((()=>{if(d){const e=d.filter((e=>!Fn.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,zt.jsx)(J.ControlledPopover,{maxWidth:900,open:t,content:(0,zt.jsx)("div",{style:{width:"600px"},children:(0,zt.jsxs)(J.Form,{onSubmit:()=>{r(!0)},children:[(0,zt.jsx)("h2",{children:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:a,value:s}),errorMessage:i&&c(s)&&(0,zt.jsx)(J.Text,{raw:"common.select.required"}),label:(0,zt.jsx)(J.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,zt.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,zt.jsx)(J.Button,{colourScheme:"light",onClick:()=>{r(!1),o("")},children:(0,zt.jsx)(H.FormattedMessage,{id:"button.cancel"})}),(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,zt.jsx)(J.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,zt.jsx)(H.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},Gn=["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"],Bn=["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"],Vn=["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"],Hn=e=>{var t,n,s,o,i,r,a;let{linkGen:l,userInfo:d}=e;const c=(0,rn.useDispatch)(),[u,p]=(0,B.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[h,m]=(0,B.useState)(!1),[I,T]=(0,B.useState)(!0),[v,M]=(0,B.useState)(!0),[x,O]=(0,B.useState)([]),[N,A]=(0,B.useState)([]),[U,j]=(0,B.useState)([]),[w,C]=(0,B.useState)({}),[L,P]=(0,B.useState)({}),[R,K]=(0,B.useState)({}),k="A"!==(null===(t=d.activeRole)||void 0===t?void 0:t.businessType);const F={userId:null===(n=d.activeRole)||void 0===n?void 0:n.userId,personId:null===(s=d.activeRole)||void 0===s?void 0:s.businessId,dotys:Gn,states:[En.DO_DOKUSEIS_ESITATUD,En.DO_DOKUSEIS_KOOSTAMISEL,En.DO_DOKUSEIS_EELNOU_AKTIIVNE,En.DO_DOKUSEIS_ALLKIRJASTAMISEL,En.DO_DOKUSEIS_MENETLUSES,En.DO_DOKUSEIS_TAIENDAMISEL,En.DO_DOKUSEIS_MUUTMISEL]},Y={userId:null===(o=d.activeRole)||void 0===o?void 0:o.userId,personId:null===(i=d.activeRole)||void 0===i?void 0:i.businessId,dotys:Bn,states:[En.DO_DOKUSEIS_KEHTETU,En.DO_DOKUSEIS_TUNNIST_KEHTETUKS,En.DO_DOKUSEIS_REG_KANTUD,"DO_DOKUSEIS_TAGASTATUD",En.DO_DOKUSEIS_KEELDUTUD,En.DO_DOKUSEIS_TYHISTATUD,En.DO_DOKUSEIS_LOOBUTUD,En.DO_DOKUSEIS_ALLKIRJASTATUD,En.DO_DOKUSEIS_MENETLETUD,En.DO_DOKUSEIS_LUBATUD,En.DO_DOKUSEIS_LUB_TEAV,En.DO_DOKUSEIS_TEAVITATUD,En.DO_DOKUSEIS_ANTUD,En.DO_DOKUSEIS_KEHTIV]},G={userId:null===(r=d.activeRole)||void 0===r?void 0:r.userId,personId:null===(a=d.activeRole)||void 0===a?void 0:a.businessId,roles:["DO_DOKU_ISIK_ROLL_ALLAK"],dotys:Vn,states:[En.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,B.useEffect)((()=>{var e,t;$t.classifierApiService.getAllDocumentTypes().then((e=>{c(g(e.data))})).catch((e=>{console.log(e)})),$t.institutionKovEndpointApi.getJurKovPersons().then((e=>{c(f(e.data))})).catch((e=>{console.log(e)})),k&&$t.userApiService.getUsersJurPerson(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.userId)&&void 0!==e?e:0).then((e=>{c(S(e.data))})).catch((e=>{console.log(e)})),$t.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));c(D(t))})).catch((e=>{console.log("Following error occured:",e)}))}),[d]),(0,B.useEffect)((()=>{(()=>{const e=F;u.workingDocs&&(e.userId=void 0),T(!0),$t.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(E(e.data)),T(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))})()}),[u.workingDocs,d]),(0,B.useEffect)((()=>{!function(){const e=Y;u.finishedDocs&&(e.userId=void 0),M(!0),$t.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(y(e.data)),M(!1),j(e.data)})).catch((e=>{console.log("Following error occured:",e),M(!1)}))}()}),[u.finishedDocs,d]),(0,B.useEffect)((()=>{!function(){const e=G;u.signingDocs&&(e.userId=void 0),m(!0),$t.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{console.log(e),c(_(e.data)),m(!1),O(e.data)})).catch((e=>{console.log("Following error occured:",e),m(!1)}))}()}),[u.signingDocs,d]),(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,zt.jsx)(Yn,{linkGen:l})}),k&&(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,zt.jsx)(kn,{documentType:W,filterState:w,onSubmit:e=>C(e),isKov:k}),children:h?(0,zt.jsx)(J.SectionLoader,{}):0===x.length?(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,zt.jsx)(Un,{linkGen:l,isKov:k,documentType:W,onAllUsersChecked:e=>{p({signingDocs:e,workingDocs:u.workingDocs,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.signingDocs,filter:w,fileApi:$t.fileApiService,hidePresenter:!0})}),(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,zt.jsx)(kn,{documentType:q,filterState:L,onSubmit:e=>P(e),isKov:k}),children:I?(0,zt.jsx)(J.SectionLoader,{}):0===N.length?(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_documents.working_documents.no_docs"})}),k&&(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:!0,finishedDocs:u.finishedDocs})}})}),(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(Yn,{linkGen:l})})]}):(0,zt.jsx)(Un,{linkGen:l,isKov:k,documentType:q,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:e,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.workingDocs,filter:L,onDocumentDelete:e=>function(e){const t=e.slice(0,e.indexOf("/")),n=e.slice(e.indexOf("/")+1);$t.documentApiService.deleteApplicationByNumber(t,n),c(b(e))}(e),fileApi:$t.fileApiService})}),(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,zt.jsx)(kn,{documentType:$,filterState:R,onSubmit:e=>K(e),isKov:k}),children:v?(0,zt.jsx)(J.SectionLoader,{}):0===U.length?(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_documents.finished_documents.no_docs"})}),k&&(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:!0})}})}),(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(Yn,{linkGen:l})})]}):(0,zt.jsx)(Un,{linkGen:l,isKov:k,documentType:$,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:e}),M(!0)},isAllUsersChecked:u.finishedDocs,filter:R,fileApi:$t.fileApiService})})]})},Jn={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 Wn(e){return On(Jn,e)}function qn(e){const t=Wn(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 $n=[{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 zn(){return $n.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Xn(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(Wn(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(ln()(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(ln()(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(ln()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(ln()(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(ln()(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function Qn(){return $n.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}const Zn=e=>{const t=(0,H.useIntl)(),[n,s]=(0,B.useState)({offset:0,limit:50}),[o,i]=(0,B.useState)([]),[r,a]=(0,B.useState)({column:5,direction:Sn}),[l,d]=(0,B.useState)(!1),[c,u]=(0,B.useState)(!1),[p,h]=(0,B.useState)(!1),m=(0,rn.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>xn(e.dateStart)?new Date(ln()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>xn(e.deadline)?new Date(ln()(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=>xn(e.innerCommentDeadline)?new Date(e.innerCommentDeadline).getTime():Number.MAX_SAFE_INTEGER,e=>xn(e.lastEventDate)?new Date(e.lastEventDate).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.document)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&e.buildingName[0]?e.buildingName[0]:"",e=>e.ehrCode&&e.ehrCode[0]?e.ehrCode[0]:"",e=>e.address&&e.address[0]?e.address[0]:"",e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentPresenter)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.archived)&&void 0!==t?t:""},e=>e.proceedingLength?e.proceedingLength:Number.MAX_SAFE_INTEGER];(0,B.useEffect)((()=>{if(m){const e=5,t=In(e,r);t.direction===gn&&(t.direction=Sn),a(t),i(mn(m,g[e],t.direction))}}),[m]),(0,B.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(r.direction===gn?i(Xn(m,e.filter)):i(mn(Xn(m,e.filter),g[r.column],r.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,B.useEffect)((()=>{r&&r.direction!==gn&&0!==o.length&&i(mn(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,zt.jsxs)(J.Section,{form:!0,children:[o&&(0,zt.jsx)(J.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,zt.jsx)(J.CollapseTableRow,{fields:[t.dateStart,ln()(t.deadline,"DD.MM.YYYY").valueOf()<ln()().valueOf()?(0,zt.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,zt.jsx)(J.Tooltip,{content:(0,zt.jsx)(J.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,zt.jsx)(J.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,zt.jsx)(J.Status,{type:qn(t.stateCode).type,children:qn(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?ln()(t.innerCommentDeadline).valueOf()<=ln()().valueOf()?(0,zt.jsx)("div",{style:{color:"#00b649"},children:ln()(t.innerCommentDeadline).format("DD.MM.YYYY")}):ln()(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?ln()(t.lastEventDate).format("DD.MM.YYYY"):"",(0,zt.jsx)(en,{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,zt.jsx)("div",{children:p?(0,zt.jsxs)("div",{children:[m.buildingNames.map((e=>(0,zt.jsxs)(zt.Fragment,{children:[e,";",(0,zt.jsx)("br",{})]}))),t.buildingName.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,zt.jsxs)("div",{children:[null===(i=m.buildingNames)||void 0===i?void 0:i.slice(0,4).map((e=>(0,zt.jsxs)(zt.Fragment,{children:[e,";",(0,zt.jsx)("br",{})]}))),null===(r=m.buildingNames)||void 0===r?void 0:r.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,zt.jsx)("div",{children:c?(0,zt.jsxs)("div",{children:[m.ehrCodes.map((t=>(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(en,{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,zt.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,zt.jsx)(en,{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,zt.jsxs)("div",{children:[m.ehrCodes.slice(0,4).map(((t,n)=>(0,zt.jsxs)(V().Fragment,{children:[(0,zt.jsx)(en,{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,zt.jsx)("br",{})]},n))),m.ehrCodes.slice(4,5).map((t=>(0,zt.jsx)(en,{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,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,zt.jsx)("div",{style:{width:125},children:l?(0,zt.jsxs)("div",{children:[m.addresses.map((e=>(0,zt.jsxs)(zt.Fragment,{children:[e,";",(0,zt.jsx)("br",{})]}))),t.address.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,zt.jsxs)("div",{children:[m.addresses.slice(0,4).map((e=>(0,zt.jsxs)(zt.Fragment,{children:[e,";",(0,zt.jsx)("br",{})]}))),null===(a=m.addresses)||void 0===a?void 0:a.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.link.view_all_addresses"})})})]})}):"",t.proceedingName,t.supervisor,t.documentPresenter,t.archived,t.proceedingLength]},t.id)})))(o),headers:S.map(((e,n)=>(0,zt.jsxs)("div",{children:[(0,zt.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=In(n,r);a(e)},children:r.column===n?(0,zt.jsx)(Tn,{sortDirection:r.direction}):(0,zt.jsx)(Tn,{sortDirection:gn})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,zt.jsx)(zt.Fragment,{children:e.isKov?(0,zt.jsx)("div",{className:"d-flex justify-content-start",children:(0,zt.jsx)(J.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,zt.jsx)(J.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},es={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},ts=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,H.useIntl)(),i=/^[\\s0-9]{0,9}$/,r=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,[a,l]=(0,B.useState)(s),[d,c]=(0,B.useState)(!0),[u,p]=(0,B.useState)(!0),[h,m]=(0,B.useState)(""),[g,S]=(0,B.useState)(""),[f,I]=(0,B.useState)([]),[T,v]=(0,B.useState)([]),[E]=(0,B.useState)(zn()),[_,y]=(0,B.useState)([]),[b,D]=(0,B.useState)(Qn()),M=(0,rn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),x=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutionUsers));function O(e){return i.test(e)}function N(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],D(n.map((e=>({id:e})))),l((e=>({...e,[t]:n})))}function A(e,t){var n;"ehrCode"===t&&O(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||r.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,B.useEffect)((()=>{if(M){const e=Ln(M);I(e)}if(x&&n){const e=Pn([...x]);v(e)}}),[M,x]);return(0,zt.jsxs)(J.Form,{onSubmit:()=>t(a),children:[(0,zt.jsxs)(J.Row,{className:"align-items-start",children:[(0,zt.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:f,onSelect:e=>N(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>N(e,"documentTypes"),value:a.documentTypes,selectedOptions:_}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.document_type",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.proceedingNumber}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:E,onSelect:e=>{N(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>N(e,"proceedingStates"),value:a.proceedingStates,selectedOptions:b}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),wn(a.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)("div",{className:"daterange_in_form",children:(0,zt.jsx)(J.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!ln()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!ln()(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,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.proceeding_date",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.DatePicker,{name:"datepicker-field",value:a.lastEventDate,onChange:e=>function(e){""===e||ln()(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,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.last_event_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.last_event_date",placement:"top-start"}})]}),(0,zt.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(O(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.ehrCode}),errorMessage:!d&&(0,zt.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.ehrCode",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.buildingName}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.building_name",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.wordInAddress}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.word_in_address",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.connectedPerson}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.connected_person"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.connected_person",placement:"top-start"}}),n&&(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:T,onSelect:e=>N(e,"supervisors"),allSelection:!0,onRemoveItem:e=>N(e,"supervisors"),value:a.supervisors,selectedOptions:_}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{onClick:()=>(y([]),l(es),void D(Qn())),colourScheme:"light",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},ns={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 ss=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 os(e){return On(ns,e)}const is={[ss.MENTOIMSEIS_OOTEL]:"info",[ss.MENTOIMSEIS_TEOSTAMISEL]:"info",[ss.MENTOIMSEIS_TYHISTATUD]:"default",[ss.MENTOIMSEIS_TEOSTATUD]:"success",[ss.MENTOIMSEIS_LOOBUTUD]:"default",[ss.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},rs={[ss.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[ss.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[ss.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[ss.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[ss.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[ss.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function as(e,t){return((e,t)=>({state:Object.keys(rs).includes(e)?t.formatMessage({id:rs[e]}):e,type:Object.keys(is).includes(e)?is[e]:"default"}))(os(e),t)}const ls=(e,t)=>({code:e,value:t.formatMessage({id:rs[e]})});function ds(e,t){let n;return n=e===Z?[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_TYHISTATUD,ss.MENTOIMSEIS_TEOSTATUD,ss.MENTOIMSEIS_LOOBUTUD,ss.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>ls(e,t))):e===ne?[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_TYHISTATUD,ss.MENTOIMSEIS_LOOBUTUD,ss.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>ls(e,t))):e===se?[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_TEOSTATUD,ss.MENTOIMSEIS_LOOBUTUD].map((e=>ls(e,t))):[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_TEOSTATUD,ss.MENTOIMSEIS_LOOBUTUD,ss.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>ls(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function cs(){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 us(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(os(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(ln()(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(ln()(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(ln()(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(ln()(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(ln()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(ln()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function ps(e){return[{id:ss.MENTOIMSEIS_OOTEL},{id:ss.MENTOIMSEIS_TEOSTAMISEL},{id:ss.MENTOIMSEIS_TEOSTATUD},{id:ss.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let hs=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 ms=["11273","11272"],gs=e=>{const t=(0,H.useIntl)(),[n,s]=(0,B.useState)({offset:0,limit:10}),[o,i]=(0,B.useState)([]),[r,a]=(0,B.useState)({column:1,direction:fn}),[l,d]=(0,B.useState)(!1),[c,u]=(0,B.useState)(!1),[p,h]=(0,B.useState)(!1),m=(0,rn.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,rn.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),S=(0,rn.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),f=(0,rn.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,rn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),v=[e=>xn(e.invitationDate)?new Date(ln()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>xn(e.deadline)?new Date(ln()(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&&xn(e.buildingName[0])?e.buildingName[0]:"",e=>void 0!==e.ehrCode&&null!==e.ehrCode&&xn(e.ehrCode[0])?e.ehrCode[0]:"",e=>void 0!==e.address&&null!==e.address&&xn(e.address[0])?e.address[0]:"",e=>{var t,n;return null!==(t=null===(n=I.find((t=>t.id===e.supervisorJurId)))||void 0===n?void 0:n.regName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""}];(0,B.useEffect)((()=>{!m||e.viewType!==Q&&e.viewType!==X||(i(us(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,B.useEffect)((()=>{m&&e.viewType===Z&&(i(mn(us(m,e.filter),v[0],fn)),s({offset:0,limit:10}))}),[m,e.filter]),(0,B.useEffect)((()=>{g&&e.viewType===te&&(r.direction===gn?i(us(g,e.filter)):i(mn(us(g,e.filter),v[r.column],r.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,B.useEffect)((()=>{S&&e.viewType===ne&&(i(us(S,e.filter)),s({offset:0,limit:10}))}),[S,e.filter]),(0,B.useEffect)((()=>{f&&e.viewType===se&&(r.direction===gn?i(us(f,e.filter)):i(mn(us(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=>xn(e.deadline)?new Date(ln()(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&&xn(e.address[0])?e.address[0]:""];const b=t=>{let n=hs.Operation;return e.viewType===se?(n=t.doty&&ms.includes(t.doty)?hs.AdminProceeding:hs.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&ms.includes(t.doty)||t.typeCode===ue.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=hs.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,zt.jsxs)(J.Section,{form:!0,children:[o&&(0,zt.jsx)(J.CollapseTable,{content:(s=>s.slice(n.offset,n.offset+n.limit).map((n=>{var s,o,i,r,a,m,g,S;const f=[n.invitationDate,ln()(n.deadline,"DD.MM.YYYY").valueOf()<ln()().valueOf()?(0,zt.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,zt.jsx)(J.Tooltip,{content:(0,zt.jsx)(J.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,zt.jsx)(J.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,zt.jsx)(J.Status,{type:as(n.stateCode,t).type,children:as(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,zt.jsx)("div",{children:p?(0,zt.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,zt.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.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,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,zt.jsx)("div",{children:c?(0,zt.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,zt.jsxs)(V().Fragment,{children:[(0,zt.jsx)(en,{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,zt.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,zt.jsxs)("div",{children:[null===(r=n.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((t,n)=>(0,zt.jsxs)(V().Fragment,{children:[(0,zt.jsx)(en,{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,zt.jsx)("br",{})]},n))),null===(a=n.ehrCode)||void 0===a?void 0:a.slice(4,5).map((t=>(0,zt.jsx)(en,{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,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,zt.jsx)("div",{children:l?(0,zt.jsxs)("div",{children:[n.address.map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.jsx)("br",{})]},t))),n.address.length>5&&(0,zt.jsx)(J.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,zt.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,zt.jsxs)(V().Fragment,{children:[e,";",(0,zt.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,zt.jsx)("div",{className:"pr-3",children:(0,zt.jsx)(J.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.link.view_all_addresses"})})})]})}):"",n.supervisorJurId?null===(S=I.find((e=>e.id===n.supervisorJurId)))||void 0===S?void 0:S.regName:"",n.supervisor],v=[...f];v.splice(4,1);const E=[...f].slice(1,4).concat(f[10]).concat(f[5]).concat(f[8]);return(0,zt.jsx)(J.CollapseTableRow,{fields:e.viewType===Z?v:e.viewType===se?E:f},n.id)})))(o),headers:function(){const n=[...E];n.splice(4,1);const s=e.viewType===Z?n:e.viewType===se?_:E,l=[...v];l.splice(4,1);const d=e.viewType===Z?l:e.viewType===se?y:v;return s.map(((e,n)=>(0,zt.jsxs)("div",{children:[(0,zt.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=In(n,r);a(e),e.direction!==gn&&i(mn(o,d[n],e.direction))},children:r.column===n?(0,zt.jsx)(Tn,{sortDirection:r.direction}):(0,zt.jsx)(Tn,{sortDirection:gn})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===X||e.viewType===Q)&&(0,zt.jsx)("div",{className:"d-flex justify-content-start",children:(0,zt.jsx)(J.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===X?(0,zt.jsx)(J.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,zt.jsx)(J.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},Ss=e=>{var t;const n=(0,H.useIntl)(),s=/^[\\s0-9]{0,9}$/,o=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,i=null!==(t=e.initialFilter)&&void 0!==t?t:{documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},r={...i,operationStates:[ss.MENTOIMSEIS_TEOSTAMISEL]},a={...i,operationStates:[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[ss.MENTOIMSEIS_OOTEL]},[d,c]=(0,B.useState)(e.filterState),[u,p]=(0,B.useState)(ps(d.operationStates)),[h,m]=(0,B.useState)(!0),[g,S]=(0,B.useState)(!0),[f,I]=(0,B.useState)(""),[T,v]=(0,B.useState)(""),E=(0,B.useMemo)((()=>cs()),[]),[_,y]=(0,B.useState)([]),[b,D]=(0,B.useState)([]),M=(0,B.useMemo)((()=>ds(e.viewType,n)),[e.viewType]),[x,O]=(0,B.useState)([]),N=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,rn.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,B.useEffect)((()=>{if(N){const e=Pn(N?[...N]:[]);D(e)}if(A){const e=Rn([...A]);y(e)}}),[N,A]);return(0,zt.jsxs)(J.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,zt.jsx)(J.Row,{className:"align-items-start",children:(0,zt.jsx)(J.Col,{sm:10,className:"mx-0 px-0",children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:E,onSelect:e=>j(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>j(e,"documentTypes"),value:d.documentTypes,selectedOptions:x}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,zt.jsx)(J.Row,{className:"align-items-start",children:(0,zt.jsx)(J.Col,{sm:10,className:"mx-0 px-0",children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.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,zt.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,zt.jsxs)(J.Row,{className:"align-items-start",children:[(0,zt.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:_,onSelect:e=>j(e,"institutions"),allSelection:!0,onRemoveItem:e=>j(e,"institutions"),value:d.institutions,selectedOptions:x}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>w(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:M,onSelect:e=>j(e,"operationStates"),allSelection:!0,onRemoveItem:e=>j(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(Kn,{onChange:e=>(e=>{""!==e.from&&!ln()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!ln()(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,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,zt.jsxs)(J.Col,{sm:10,className:"mx-0 px-0",children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>w(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:b,onSelect:e=>j(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>j(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:x}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(Kn,{onChange:e=>(e=>{""!==e.from&&!ln()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!ln()(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,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{onClick:()=>function(){let t;switch(O([]),e.viewType){case ee:t=r;break;case te:case se:t=a;break;case ne:t=l;break;default:t=i}c(t),p(ps(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},fs=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:r,linkGen:a,myViewsApiEndpoint:l,userInfo:d,userApiEndpoint:c}=e;const u=(0,rn.useDispatch)(),[p,h]=(0,B.useState)({proceedings:!1}),[m,f]=(0,B.useState)(!0),[I,T]=(0,B.useState)(!0),[v,E]=(0,B.useState)(!0),[_,y]=(0,B.useState)([]),[b,D]=(0,B.useState)([]),[M,x]=(0,B.useState)([]),U=new ye(new dt({basePath:i})),j=new Ge(new dt({basePath:c})),w=new lt(new dt({basePath:l})),C=new nt(new dt({basePath:l})),L=new rt(new dt({basePath:l})),P=new wt(new Ct({basePath:r})),R="A"!==(null===(t=d.activeRole)||void 0===t?void 0:t.businessType);let K=new Date;K.setDate(K.getDate()-7);const k={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_TEOSTAMISEL"],institutionUsers:[(null===(n=d.activeRole)||void 0===n?void 0:n.userId)+""],operationDate:{from:"",to:""},operationDeadline:{from:K.toISOString().split("T")[0],to:""}},[F,Y]=(0,B.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[G,V]=(0,B.useState)(k),[H,W]=(0,B.useState)({});const q={userId:null===(s=d.activeRole)||void 0===s?void 0:s.userId,personId:null===(o=d.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:[En.DO_DOKUSEIS_ESITATUD,En.DO_DOKUSEIS_MENETLUSES]};return(0,B.useEffect)((()=>{!function(e){var t,n;const s={userId:e.institutionUsers?Number(e.institutionUsers[0]):null===(t=d.activeRole)||void 0===t?void 0:t.userId,personId:null===(n=d.activeRole)||void 0===n?void 0:n.businessId,states:e.operationStates,type:[ue.MENTOIMLIIK_MEN_MARKUS]};T(!0),L.findOperationsToComment(s).then((e=>{u(N(e.data)),D(e.data),T(!1)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))}(G)}),[d,G]),(0,B.useEffect)((()=>{(()=>{const e=q;p.proceedings&&(e.userId=void 0),f(!0),w.findProceedings(e).then((e=>{u(O(e.data)),y(e.data),f(!1)})).catch((e=>{console.log("Following error occured:",e),f(!1)}))})()}),[p.proceedings]),(0,B.useEffect)((()=>{!function(){const e=q;e.userId=void 0,E(!0),C.findIncomingBaseDocuments(e).then((e=>{u(A(e.data)),E(!1),x(e.data)})).catch((e=>{console.log("Following error occured:",e),E(!1)}))}()}),[d]),(0,B.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{u(g(e.data))})).catch((e=>{console.log(e)})),R&&j.getJurUsers(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{u(S(e.data))})).catch((e=>{console.log(e)}))}),[d]),(0,zt.jsxs)("div",{children:[(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,zt.jsx)(ts,{onSubmit:e=>{Y(e)},isKov:R,filterState:F}),children:m?(0,zt.jsx)(J.SectionLoader,{}):0===_.length?(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_proceedings.no_proceedings"})}),R&&(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{h({proceedings:!0})}})})]}):(0,zt.jsx)(Zn,{linkGen:a,isKov:R,onAllUsersChecked:e=>{h({proceedings:e})},isAllUsersChecked:p.proceedings,filter:F})}),R&&(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,zt.jsx)(Ss,{viewType:se,initialFilter:k,filterState:G,onSubmit:e=>V(e)}),children:I?(0,zt.jsx)(J.SectionLoader,{}):0===b.length?(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,zt.jsx)(gs,{linkGen:a,viewType:se,filter:G})}),R&&(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,zt.jsx)(kn,{documentType:z,filterState:H,onSubmit:e=>W(e),isKov:R}),children:v?(0,zt.jsx)(J.SectionLoader,{}):0===M.length?(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,zt.jsx)(Un,{linkGen:a,isKov:R,documentType:z,filter:H,fileApi:P})})]})},Is=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,rn.useDispatch)(),[a,l]=(0,B.useState)(!0),[d,c]=(0,B.useState)(!1),[u,p]=(0,B.useState)(!1),[h,m]=(0,B.useState)(null),[I,T]=(0,B.useState)(null),[v,E]=(0,B.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[ss.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[ss.MENTOIMSEIS_OOTEL]},[M,x]=(0,B.useState)(y),[O,N]=(0,B.useState)(b),[A,U]=(0,B.useState)(D),[j,P]=(0,B.useState)(!1),R=new Pe(new dt({basePath:o})),K=new Ge(new dt({basePath:o})),k=new rt(new dt({basePath:s})),F=new ye(new dt({basePath:t}));return(0,B.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(S(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),F.getAllDocumentTypes().then((e=>{r(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,B.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[ue.MENTOIMLIIK_VALINE_KOOSK],states:ns.MENTOIMSEIS_TEOSTAMISEL.concat(ns.MENTOIMSEIS_TEOSTATUD,ns.MENTOIMSEIS_LOOBUTUD,ns.MENTOIMSEIS_TAHTAEG_MOODUNUD)};j&&(e.userId=void 0),l(!0),k.findOperations(e).then((e=>{r(w(e.data)),m(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[j]),(0,B.useEffect)((()=>{c(!0),k.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ue.MENTOIMLIIK_VALINE_KOOSK],states:ns.MENTOIMSEIS_TEOSTAMISEL.concat(ns.MENTOIMSEIS_TEOSTATUD,ns.MENTOIMSEIS_LOOBUTUD,ns.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(C(e.data)),T(e.data),c(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),c(!1)})),p(!0),k.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[ue.MENTOIMLIIK_VALINE_KOOSK],states:ns.MENTOIMSEIS_OOTEL.concat(ns.MENTOIMSEIS_TEOSTAMISEL,ns.MENTOIMSEIS_TYHISTATUD,ns.MENTOIMSEIS_LOOBUTUD,ns.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(L(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,zt.jsxs)("div",{children:[(0,zt.jsxs)(J.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,zt.jsx)(Ss,{viewType:ee,filterState:M,onSubmit:e=>x(e)}),children:[a&&(0,zt.jsx)(J.SectionLoader,{}),a||h?(0,zt.jsx)(gs,{linkGen:n,viewType:X,filter:M,isAllUsersChecked:j,onAllUsersChecked:e=>{P(e)}}):(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_approvals.no_approvals"})}),(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{P(!0)}})})]})]}),(0,zt.jsxs)(J.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,zt.jsx)(Ss,{viewType:te,filterState:O,onSubmit:e=>N(e)}),children:[d&&(0,zt.jsx)(J.SectionLoader,{}),d||I?(0,zt.jsx)(gs,{linkGen:n,viewType:te,filter:O}):(0,zt.jsx)("div",{children:(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,zt.jsxs)(J.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,zt.jsx)(Ss,{viewType:ne,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,zt.jsx)(J.SectionLoader,{}),u||v?(0,zt.jsx)(gs,{linkGen:n,viewType:ne,filter:A}):(0,zt.jsx)("div",{children:(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},Ts=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,rn.useDispatch)(),[a,l]=(0,B.useState)(!1),[d,c]=(0,B.useState)(!1),[u,p]=(0,B.useState)(!1),[h,m]=(0,B.useState)(null),[I,T]=(0,B.useState)(null),[v,E]=(0,B.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[ss.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[ss.MENTOIMSEIS_OOTEL]},[M,x]=(0,B.useState)(y),[O,N]=(0,B.useState)(b),[A,U]=(0,B.useState)(D),[j,P]=(0,B.useState)(!1),R=new Pe(new dt({basePath:o})),K=new Ge(new dt({basePath:o})),k=new rt(new dt({basePath:s})),F=new ye(new dt({basePath:t}));return(0,B.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(S(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),F.getAllDocumentTypes().then((e=>{r(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,B.useEffect)((()=>{!function(){const e=j?null==i?void 0:i.businessId:null==i?void 0:i.userId;l(!0),k.findOperations({personId:j?e:void 0,userId:j?void 0:e,type:[ue.MENTOIMLIIK_ARVAMUS],states:ns.MENTOIMSEIS_TEOSTAMISEL.concat(ns.MENTOIMSEIS_TEOSTATUD,ns.MENTOIMSEIS_LOOBUTUD,ns.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(w(e.data)),m(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[j]),(0,B.useEffect)((()=>{c(!0),k.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ue.MENTOIMLIIK_ARVAMUS],states:ns.MENTOIMSEIS_TEOSTAMISEL.concat(ns.MENTOIMSEIS_TEOSTATUD,ns.MENTOIMSEIS_LOOBUTUD,ns.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(C(e.data)),T(e.data),c(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),c(!1)})),p(!0),k.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[ue.MENTOIMLIIK_ARVAMUS],states:ns.MENTOIMSEIS_OOTEL.concat(ns.MENTOIMSEIS_TEOSTAMISEL,ns.MENTOIMSEIS_TYHISTATUD,ns.MENTOIMSEIS_LOOBUTUD,ns.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(L(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,zt.jsxs)("div",{children:[(0,zt.jsxs)(J.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,zt.jsx)(Ss,{viewType:ee,filterState:M,onSubmit:e=>x(e)}),children:[a&&(0,zt.jsx)(J.SectionLoader,{}),a||h?(0,zt.jsx)(gs,{linkGen:n,viewType:Q,filter:M,isAllUsersChecked:j,onAllUsersChecked:e=>{P(e)}}):(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_opinions.no_opinions"})}),(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{P(!0)}})})]})]}),(0,zt.jsxs)(J.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,zt.jsx)(Ss,{viewType:te,filterState:O,onSubmit:e=>N(e)}),children:[d&&(0,zt.jsx)(J.SectionLoader,{}),d||I?(0,zt.jsx)(gs,{linkGen:n,viewType:te,filter:O}):(0,zt.jsx)("div",{children:(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,zt.jsxs)(J.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,zt.jsx)(Ss,{viewType:ne,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,zt.jsx)(J.SectionLoader,{}),u||v?(0,zt.jsx)(gs,{linkGen:n,viewType:ne,filter:A}):(0,zt.jsx)("div",{children:(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},vs=e=>{const t=(0,H.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_TEOSTATUD,ss.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,r]=(0,B.useState)(e.filterState),[a,l]=(0,B.useState)(ps(i.operationStates)),[d,c]=(0,B.useState)(!0),[u,p]=(0,B.useState)(!0),[h,m]=(0,B.useState)(""),g=(0,B.useMemo)((()=>cs()),[]),[S,f]=(0,B.useState)([]),I=(0,B.useMemo)((()=>ds(Z,t)),[]),[T,v]=(0,B.useState)([]),E=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutions));function _(e){return n.test(e)}function y(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function b(e,t){var n;i[t]=e,"ehrCode"===t&&_(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&p(!0),r((e=>({...e})))}(0,B.useEffect)((()=>{if(E){const e=Rn([...E]);f(e)}}),[E]);return(0,zt.jsxs)(J.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:g,onSelect:e=>y(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>y(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,zt.jsx)(J.Col,{})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.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,zt.jsx)(J.Text,{raw:"filter.invalid_building_code"}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:S,onSelect:e=>y(e,"institutions"),allSelection:!0,onRemoveItem:e=>y(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,zt.jsx)(J.Col,{})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:I,onSelect:e=>y(e,"operationStates"),allSelection:!0,onRemoveItem:e=>y(e,"operationStates"),value:i.operationStates,selectedOptions:a}),label:(0,zt.jsx)(H.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(Kn,{onChange:e=>(e=>{""!==e.from&&!ln()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!ln()(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,zt.jsx)(H.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,zt.jsx)(J.Col,{})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{onClick:()=>(v([]),r(o),void l(ps(o.operationStates))),colourScheme:"light",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},Es=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:r}=e;const a=(0,rn.useDispatch)(),[l,d]=(0,B.useState)(!1),[c,u]=(0,B.useState)([]),p=!(void 0===i||"A"===(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)),h={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_TEOSTATUD,ss.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[m,S]=(0,B.useState)(h),I=new Pe(new dt({basePath:r})),T=new rt(new dt({basePath:o})),v=new ye(new dt({basePath:n}));return(0,B.useEffect)((()=>{var e;I.getJurKovPersons().then((e=>{a(f(e.data))})).catch((e=>{console.log(e)})),v.getAllDocumentTypes().then((e=>{a(g(e.data))})).catch((e=>{console.log(e)})),d(!0),T.findOperations({userId:void 0,personId:p?null===(e=i.activeRole)||void 0===e?void 0:e.businessId:i.personId,type:[ue.MENTOIMLIIK_KAASAMINE,ue.MENTOIMLIIK_KAAS_TAGASISIDE],states:[ss.MENTOIMSEIS_OOTEL,ss.MENTOIMSEIS_TEOSTAMISEL,ss.MENTOIMSEIS_TEOSTATUD,ss.MENTOIMSEIS_VALMIS,ss.MENTOIMSEIS_JATKAMINE,ss.MENTOIMSEIS_TYHISTATUD,ss.MENTOIMSEIS_LOOBUTUD,ss.MENTOIMSEIS_KEELDUTUD,ss.MENTOIMSEIS_TAGASI_LYKATUD,ss.MENTOIMSEIS_TAHTAEG_MOODUNUD]}).then((e=>{a(w(e.data)),u(e.data),d(!1)})).catch((e=>{console.log("Following error occured:",e),d(!1)}))}),[i]),(0,zt.jsx)("div",{children:(0,zt.jsx)(J.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,zt.jsx)(vs,{filterState:m,onSubmit:e=>S(e)}),children:l?(0,zt.jsx)(J.SectionLoader,{}):0===c.length?(0,zt.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,zt.jsx)(J.Text,{raw:"my_involvements.no_involvements"})}):(0,zt.jsx)(gs,{linkGen:s,viewType:Z,filter:m})})})};function _s(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function ys(e){let t=_s([{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 bs=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function Ds(){return _s(bs)}function Ms(e){let t=[];for(let n of e)t.push(n.id),t.push(...Ms(n.children?n.children:[]));return t}const xs=e=>{const t=(0,H.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],owner:void 0,isPrivatePerson:!1,searchType:oe},s=(0,rn.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,rn.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[i,r]=(0,B.useState)(n),[a,l]=(0,B.useState)([]),[d,c]=(0,B.useState)(ys(e.isAdminRole)),[u]=(0,B.useState)(_s([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[p]=(0,B.useState)(Ds()),[h,m]=(0,B.useState)([]),[g,S]=(0,B.useState)({}),[f,I]=(0,B.useState)(""),[T,v]=(0,B.useState)({}),[E,_]=(0,B.useState)(""),[y,b]=(0,B.useState)(!1),[D,M]=(0,B.useState)({code:"",value:""}),x=(0,B.useRef)(),[O,N]=(0,B.useState)({});function A(e,t){let n;n=e.selectedData.length>0?void 0!==e.selectedData[0].data?e.selectedData[0].data.map((e=>e.id)):e.selectedData.map((e=>e.id)).flat():[],i[t]=n,r((e=>({...e})))}function U(e,t){let n;if(e.selectedData.length>0){n=Ms(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,B.useEffect)((()=>{if(s.length>0){const e=function(e){let t={id:"00000",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){const{code:e,name:s,validTo:o}=n;let i=e.replace(/0/g,""),r=i.slice(0,i.length-1),a=t;for(let e=2;e<=r.length;e++)if(a.children){let t=a.children.find((t=>t.id.replace(/0/g,"")===r.slice(0,e)));t&&(a=t)}if(a.children){const t=`${e} ${s}${null!=o&&o.trim()?` (kuni ${o})`:""}`;a.children.push({id:n.id+"",parentId:a.id,label:t,level:a.level+1,children:[],selectable:!0,value:!1})}}return t.children?t.children:[]}([...s].sort(((e,t)=>Number(e.code)-Number(t.code))));m(e)}}),[s]),(0,B.useEffect)((()=>{c(ys(e.isAdminRole))}),[e.isAdminRole]),(0,zt.jsxs)(J.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,zt.jsx)(J.MessageBlock,{dismissible:!0,header:(0,zt.jsx)(H.FormattedMessage,{id:T.header}),onDismiss:()=>v({header:"",message:""}),theme:"danger",messages:[(0,zt.jsx)(H.FormattedMessage,{id:T.message})]}),o&&o.length>=500&&(0,zt.jsx)(J.MessageBlock,{dismissible:!0,header:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,zt.jsxs)("div",{className:"twoColumnLayout",children:[(0,zt.jsxs)(J.Col,{children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>j(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:i.buildingLocation}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>j(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>A(e,"buildingStates"),value:i.buildingStates,selectedOptions:a}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)("div",{className:"daterange_in_form",children:(0,zt.jsx)(J.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,zt.jsx)(H.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,zt.jsx)("div",{style:{paddingRight:90},children:wn(i.firstUseMissing,(function(e){r((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing")})]}),(0,zt.jsxs)(J.Col,{children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"buildingType"),allSelection:!0,onRemoveItem:e=>A(e,"buildingType"),value:i.buildingType,selectedOptions:a}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.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,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:p,onSelect:e=>A(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>A(e,"ownershipType"),value:i.ownershipType,selectedOptions:a}),label:(0,zt.jsx)(H.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,zt.jsxs)("div",{className:"d-flex",style:{flexWrap:"wrap"},children:[(0,zt.jsx)("div",{className:"col-17",style:{paddingLeft:30,flex:"1 1 200px"},children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.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=O.id)||void 0===n?void 0:n.toString()))e||(i.owner=void 0,r((e=>({...e}))));else{var o;i.owner=null===(o=O.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:x,isOptionalField:!0,isPrivateOwner:i.isPrivatePerson}),label:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.owner"}),labelCol:{sm:20,md:8,lg:4},info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,zt.jsx)(J.FieldWrapper,{children:(0,zt.jsx)("div",{className:"col-auto",style:{paddingRight:120,paddingTop:8,flexDirection:"row",whiteSpace:"nowrap",flex:"1 1 200px"},children:wn(i.isPrivatePerson,(function(e){r((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","")})})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{onClick:()=>(l([]),r(n),x.current.clearTypeahead(),void S({})),colourScheme:"light",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(f.length>0||y),squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},Os=e=>{const t=(0,H.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,B.useState)(n),[i,r]=(0,B.useState)(""),[a,l]=(0,B.useState)([]),[d,c]=(0,B.useState)([]),[u,p]=(0,B.useState)([]),[h]=(0,B.useState)(_s([{code:En.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:En.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:En.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:En.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:En.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"},{code:En.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:En.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:En.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:En.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"},{code:En.DO_DOKUSEIS_ALLKIRJASTAMISEL,value:"Allkirjastamisel"},{code:En.DO_DOKUSEIS_VANA_VERSIOON,value:"Vana versioon"}].sort(((e,t)=>e.value.localeCompare(t.value))))),[m,g]=(0,B.useState)({}),[S,f]=(0,B.useState)(""),[I,T]=(0,B.useState)(!1),[v,E]=(0,B.useState)({code:"",value:""}),[_,y]=(0,B.useState)({}),[b,D]=(0,B.useState)(!1),M=(0,B.useRef)(),x=(0,rn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),O=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutions)),N=(0,rn.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!(!ln()(e,"YYYY-MM-DD",!0).isValid()&&!ln()(e,"D.M.YYYY",!0).isValid())}(0,B.useEffect)((()=>{if(x){const e=Ln(x);c(e)}if(O){const e=Rn([...O]);p(e)}}),[x,O]);return(0,zt.jsxs)(J.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,zt.jsx)(J.MessageBlock,{dismissible:!0,header:(0,zt.jsx)(H.FormattedMessage,{id:_.header}),onDismiss:()=>y({header:"",message:""}),theme:"danger",messages:[(0,zt.jsx)(H.FormattedMessage,{id:_.message})]}),N&&N.length>500&&(0,zt.jsx)(J.MessageBlock,{dismissible:!0,header:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,zt.jsxs)("div",{className:"twoColumnLayout",children:[(0,zt.jsxs)(J.Col,{children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:a}),label:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)("div",{className:"daterange_in_form",children:(0,zt.jsx)(J.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&&ln()(e.from)>ln()(e.to)?r(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(ln()(e.from)<ln()("01.01.1990")||ln()(e.from)>ln()())||""!==e.to&&(ln()(e.to)<ln()("01.01.1990")||ln()(e.to)>ln()())?r(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:ln()().format("DD.MM.YYYY")})):ln()(e.to).diff(ln()(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,zt.jsx)(H.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,zt.jsxs)(J.Col,{children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:a}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:a}),label:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}})]})]}),!e.isNonAuthenticatedUser&&(0,zt.jsx)("div",{className:"d-flex",children:(0,zt.jsx)("div",{className:"col-20",style:{paddingLeft:20},children:(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.PersonSearchPageExtended,{person:m,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){f(e),v.code.length>0&&E({code:"",value:""})}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t;g(e),e&&(S===e.idCode||S===(null===(t=e.id)||void 0===t?void 0:t.toString())||S===e.regCode)||e&&v.code===e.regCode?(s.connectedPerson=e.id,o((e=>({...e})))):e||(s.connectedPerson=void 0,o((e=>({...e}))))}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>E(e),isShowError:e=>{T(e),e||y({header:"",message:""})},searchOnBlur:!0,ref:M,isOptionalField:!0}),label:(0,zt.jsx)(H.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,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{onClick:()=>(l([]),o(n),M.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},Ns=e=>{const t=(0,H.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,B.useState)(n),[i,r]=(0,B.useState)([]),[a,l]=(0,B.useState)([]),[d,c]=(0,B.useState)([]),[u,p]=(0,B.useState)(""),[h,m]=(0,B.useState)({}),[g,S]=(0,B.useState)(!1),f=(0,rn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,rn.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!(!ln()(e,"YYYY-MM-DD",!0).isValid()&&!ln()(e,"D.M.YYYY",!0).isValid())}(0,B.useEffect)((()=>{if(f){const e=Ln(f);l(e)}if(I){const e=Rn([...I]);c(e)}}),[f,I]);return(0,zt.jsxs)(J.Form,{onSubmit:()=>{u.length>0?S(!0):JSON.stringify(n)===JSON.stringify(s)?m({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),m({header:"",message:""}))},children:[h.header&&h.header.length>0&&h.message&&h.message.length>0&&(0,zt.jsx)(J.MessageBlock,{dismissible:!0,header:(0,zt.jsx)(H.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,zt.jsx)(H.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,zt.jsx)(J.MessageBlock,{dismissible:!0,header:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,zt.jsxs)("div",{className:"twoColumnLayout",children:[(0,zt.jsxs)(J.Col,{children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:a,onSelect:e=>v(e,"documentType"),allSelection:!0,onRemoveItem:e=>v(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>E(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,zt.jsx)(H.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,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)("div",{className:"daterange_in_form",children:(0,zt.jsx)(J.DateRange,{onChange:e=>(e=>{""!==e.from&&!_(e.from)||""!==e.to&&!_(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&ln()(e.from)>ln()(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(ln()(e.from)<ln()("01.01.1990")||ln()(e.from)>ln()())||""!==e.to&&(ln()(e.to)<ln()("01.01.1990")||ln()(e.to)>ln()())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:ln()().format("DD.MM.YYYY")})):ln()(e.to).diff(ln()(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,zt.jsx)(H.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,zt.jsxs)(J.Col,{children:[(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Input,{name:"input",onChange:e=>E(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"}),labelCol:{sm:20,md:8,lg:8}}),(0,zt.jsx)(J.FieldWrapper,{component:(0,zt.jsx)(J.Multiselect,{name:"multiselect",options:d,onSelect:e=>v(e,"institutions"),allSelection:!0,onRemoveItem:e=>v(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,zt.jsx)(H.FormattedMessage,{id:"detailsearch.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,zt.jsxs)(J.Row,{children:[(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{onClick:()=>(r([]),void o(n)),colourScheme:"light",squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.epmty_fields"})})}),(0,zt.jsx)(J.Col,{children:(0,zt.jsx)(J.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,zt.jsx)(H.FormattedMessage,{id:"button.search"})})})]})]})},As={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 Us(e){const t=function(e){return On(As,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 js=e=>{const t=(0,H.useIntl)(),[n,s]=(0,B.useState)([]),o=(0,rn.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,B.useEffect)((()=>{if(o&&o.length>0){const t=e.isAdminRole?o:o.filter((e=>"EHITIS_SEISUND_KUSTU"!==e.buildingState.code));s(t)}}),[o]);const i=[{id:"ehr_code",property:"ehrCode",size:130,isFrozen:!0,getValue:e=>e.ehrCode?e.ehrCode:"",getFormattedValue:t=>{const{generateLink:n}=e,s=t.ehrCode?n(re,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,zt.jsx)(en,{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,zt.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,zt.jsx)(J.Status,{type:Us(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,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,zt.jsx)("div",{children:i}):n?(0,zt.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,zt.jsx)("div",{children:(0,zt.jsx)(J.TableComponent,{config:{thead:{headers:(e.isAdminPlusRole?i:i.slice(0,-1)).map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:t.formatMessage({id:"detailsearch.buildings.table.header."+e.id}),tooltip:{text:t.formatMessage({id:"detailsearch.buildings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:Zt,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})})},ws="DD.MM.YYYY",Cs="YYYY-MM-DD";class Ls{static dateToStr(e){return Ls.formatDate(ws,e)}static dateToStrForDatepicker(e){return Ls.formatDate(Cs,e)}static dateWithTimeToStr(e){return Ls.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?ln()(t).format(e):""}static dateToMs(e,t){const n=ln()(t,e);return t&&n.isValid()?n.valueOf():void 0}}const Ps=e=>{var t,n,s,o,i,r;const a=(0,H.useIntl)(),[l,d]=(0,B.useState)([]),c=(0,rn.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutions)),p=null!==(t=null===(n=e.userInfo)||void 0===n||null===(s=n.activeRole)||void 0===s?void 0:s.businessType)&&void 0!==t?t:"",h=null!==(o=null===(i=e.userInfo)||void 0===i||null===(r=i.activeRole)||void 0===r?void 0:r.businessId)&&void 0!==o?o:0;(0,B.useEffect)((()=>{c&&c.length>0&&d(c)}),[c]);const m=e.filterStateDocumentsSearch.buildingLocation,g=e.filterStateDocumentsSearch.buildingName;const S=m?m.toString().toLowerCase().replace(/[&|=;~!$>*%_()?.+:'"\\]/g,"").replace(/\t/g," ").replace(/\s{2,}/g," ").replace(/\s?-\s?/g,"-"):"";function f(e,t){const n=(s=function(e){return e.replace(/\btn\b/g,"").replace(/\btänav\b/g,"").replace(/\btee\b/g,"").replace(/\bmaantee\b/g,"").replace(/\bmnt\b/g,"").replace(/\bküla\b/g,"").replace(/\blinnaosa\b/g,"").replace(/\blinn\b/g,"").replace(/\bpuiestee\b/g,"").replace(/\bpst\b/g,"").replace(/\bvald\b/g,"").replace(/\balevik\b/g,"").replace(/\balev\b/g,"").replace(/\bpõik\b/g,"").replace(/\blõik\b/g,"")}(e),s.replaceAll("//","").replaceAll(",","").split(/\s+/g).reduce(((e,t)=>{if(Number.isNaN(Number(t[0]))&&Number.isNaN(Number(t[1])))e.push(t);else{const n=` ${t}`;e[e.length-1]+=n}return e}),[]));var s;const o=t.replace(/\s+/g," ").split(/\/\/\s+(?=[a-z]+\b)/gi);return n.every((e=>{const t=e.trim().split(/\s+/);return o.some((e=>t.every((t=>new RegExp(`(?<![\\/\\-])\\b${t}\\b`,"i").test(e)))))}))}const I=["tn","tänav","tee","maantee","mnt","küla","linnaosa","linn","puiestee","pst","vald","alevik","alev","põik","lõik"];function T(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>function(e,t){return I.some((n=>{const s=new RegExp(`\\b(\\w+)\\s+${n}\\b`,"i"),o=e.match(s);if(o){const e=o[1];return new RegExp(`\\b${e}\\s+${n}\\b`,"i").test(t)}return!1}))}(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}function v(e){const t=e.filter((e=>function(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>f(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}(S,e)));return I.some((e=>function(e){return!new RegExp(`\\b${e}\\b`,"gi").test(e)}(e)))?t.filter((e=>T(S,e))):t}function E(){return!Number.isNaN(Number(S))}function _(){if(S&&S.indexOf(", ")>-1){return S.split(", ").reverse().join(", ")}return S}function y(e){const t=e.buildingName,n=e.buildingAddress;return t&&n&&(n.some((e=>e.toLowerCase().split(" ").some((e=>t.some((t=>t.toLowerCase().includes(e)))))))||t.some((e=>e.toLowerCase().split(" ").some((e=>n.some((t=>t.toLowerCase().includes(e))))))))}function b(e){let t=0;if(e.buildingAddress&&e.buildingAddress.length>0&&e.buildingAddress[0].length<200){const n=S.replace(",","").split(" ");let s=e.buildingAddress[0].toLowerCase().split(", ");const o=new Set;s.forEach((e=>{const t=e.split(" ")[0];return o.add(t)})),s=Array.from(o),s.forEach((e=>(n.includes(e)&&(t+=1),t)))}else t=-1;return t}const D=new RegExp(`\\b${S}\\b(?![\\/\\-])`,"i"),M=new RegExp(`\\b${_()}\\b(?![\\/\\-])`,"i"),x=S.replace(",","").split(/(?:\/|\s)+/g);function O(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 x.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:O(t),addressRank:b(t)};var t})).sort(((e,t)=>{const n=N.indexOf(e.addressMatch),s=N.indexOf(t.addressMatch);return n!==s?n-s:e.addressWithBuilding!==t.addressWithBuilding?""===g?e.addressWithBuilding?1:-1:e.addressWithBuilding?-1:1:t.addressRank-e.addressRank}))}const U=[{id:"doc_date",property:"docDate",size:130,getValue:e=>Ls.dateToStr(e.docDate),isFrozen:!0},{id:"reg_date",property:"regDate",size:130,getValue:e=>Ls.dateToStr(e.regDate)},{id:"doc_nr",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(le,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,zt.jsx)(en,{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,zt.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(re,String(e),null,!1,!1,null):null;return(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(en,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,zt.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,zt.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,zt.jsx)(J.Status,{type:bn(e.stateCode).type,children:bn(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?de:ae}(t),o=t.proceedingNr?n(s,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr?p===ce.MKM||t.institutionId&&h===t.institutionId?(0,zt.jsx)(en,{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,zt.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,zt.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,zt.jsx)(J.TableComponent,{config:{thead:{headers:U.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:a.formatMessage({id:"detailsearch.documents.table.header."+e.id}),tooltip:{text:a.formatMessage({id:"detailsearch.documents.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):null==e?void 0:e.getValue(t)}))),icons:Zt,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=Ls.dateToMs(ws,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=Ls.dateToMs(ws,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 Rs=e=>{var t,n,s,o;const i=(0,H.useIntl)(),[r,a]=(0,B.useState)([]),l=(0,rn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,rn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,rn.useSelector)((e=>e.myViewsPage.filter.institutions)),u=e.userInfo&&e.userInfo.activeRole&&null!==(t=e.userInfo.activeRole)&&void 0!==t&&t.businessType?null===(n=e.userInfo.activeRole)||void 0===n?void 0:n.businessType:"",p=e.userInfo&&e.userInfo.activeRole&&null!==(s=e.userInfo.activeRole)&&void 0!==s&&s.businessId?null===(o=e.userInfo.activeRole)||void 0===o?void 0:o.businessId:0;(0,B.useEffect)((()=>{l&&l.length>0&&a(l)}),[l]);const h=[{id:"date_start",property:"dateStart",size:130,getValue:e=>Ls.dateToStr(e.dateStart),isFrozen:!0},{id:"date_end",property:"dateEnd",size:130,getValue:e=>Ls.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?de:ae}(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,zt.jsx)(en,{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,zt.jsx)(J.Status,{type:qn(e.proceedingStateCode).type,children:qn(e.proceedingStateCode).name}):""},{id:"document",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(le,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,zt.jsx)(en,{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,zt.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode&&null!==t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(re,String(e),null,!1,!1,null):null;return(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(en,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,zt.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,zt.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,zt.jsx)(J.TableComponent,{config:{thead:{headers:h.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:i.formatMessage({id:"detailsearch.proceedings.table.header."+e.id}),tooltip:{text:i.formatMessage({id:"detailsearch.proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:Zt,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=Ls.dateToMs(ws,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=Ls.dateToMs(ws,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})},Ks="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class ks{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ks,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:he();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Fs extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Ys="https://example.com",Gs=function(e,t,n){if(null==n)throw new Fs(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Bs=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()},Vs=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||""},Hs=function(e){return e.pathname+e.search+e.hash},Js=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)}},Ws=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Gs("buildingChangesGet","ehrCode",t),Gs("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",Ys);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),Bs(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Hs(o),options:r}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Gs("buildingCompareGet","doEhitisId1",t),Gs("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",Ys);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),Bs(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Hs(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",Ys);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),Bs(r,d,i.query);let c=a&&a.headers?a.headers:{};return l.headers={...c,...i.headers},{url:Hs(r),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Gs("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",Ys);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Bs(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Vs(t,i,e),{url:Hs(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Gs("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",Ys);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Bs(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Vs(t,i,e),{url:Hs(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Gs("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",Ys);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Bs(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Vs(t,i,e),{url:Hs(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Gs("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",Ys);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Bs(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Vs(t,i,e),{url:Hs(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",Ys);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),Bs(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Hs(o),options:r}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Gs("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",Ys);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehr_code=t),Bs(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Hs(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Gs("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",Ys);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Bs(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Vs(t,i,e),{url:Hs(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Gs("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",Ys);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),Bs(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Hs(o),options:r}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Gs("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",Ys);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.id=t),Bs(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Hs(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return Js(i,he(),Ks,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return Js(i,he(),Ks,e)},async buildingDataGet(n,s,o,i,r){const a=await t.buildingDataGet(n,s,o,i,r);return Js(a,he(),Ks,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return Js(o,he(),Ks,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return Js(o,he(),Ks,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return Js(o,he(),Ks,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return Js(o,he(),Ks,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return Js(i,he(),Ks,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return Js(o,he(),Ks,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return Js(o,he(),Ks,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return Js(i,he(),Ks,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return Js(o,he(),Ks,e)}}};class qs extends ks{buildingChangesGet(e,t,n){return Ws(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return Ws(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return Ws(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return Ws(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return Ws(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return Ws(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return Ws(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return Ws(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return Ws(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return Ws(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return Ws(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return Ws(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const $s=e=>{var t,n,s,o;let{buildingsActualDataApiEndpoint:i,classifierApiEndpoint:r,linkGen:a,generateLink:l,myViewsApiEndpoint:d,searchType:c,userApiEndpoint:u,userInfo:p}=e;const h=(0,rn.useDispatch)(),m=["MKM","KOV","TJA"].includes(p&&p.activeRole&&null!==(t=p.activeRole)&&void 0!==t&&t.businessType?null===(n=p.activeRole)||void 0===n?void 0:n.businessType:""),S=["MKM","KOV","TJA","N","KT"].includes(p&&p.activeRole&&null!==(s=p.activeRole)&&void 0!==s&&s.businessType?null===(o=p.activeRole)||void 0===o?void 0:o.businessType:""),T=!p,[v,E]=(0,B.useState)({}),[_,y]=(0,B.useState)({}),[b,D]=(0,B.useState)({}),[M,x]=(0,B.useState)([]),[O,N]=(0,B.useState)([]),[A,U]=(0,B.useState)([]),[j,w]=(0,B.useState)(!1),[C,L]=(0,B.useState)(!1),[P,R]=(0,B.useState)(!1),Y=new ye(new dt({basePath:r})),G=new Pe(new Be({basePath:u})),V=new ot(new dt({basePath:d})),H=new Fe(new Be({basePath:u})),W=new qs(new dt({basePath:i})),q=async(e,t,n)=>{try{const s=await H.searchPerson(e,t,n);return s.data}catch(e){console.log("= = = callSearchPerson error occured:",e)}};return(0,B.useEffect)((()=>{Y.getAllDocumentTypes().then((e=>{h(g(e.data))})).catch((e=>{console.log(e)})),G.getJurKovPersons().then((e=>{h(f(e.data))})).catch((e=>{console.log(e)})),Y.getUsageClassifierTypes().then((e=>{h(I(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,B.useEffect)((()=>{if(Object.keys(b).length>0){R(!0);V.searchDetailProceedings(b).then((e=>{h(F(e.data)),U(e.data),R(!1)})).catch((e=>{console.log(e),R(!1)}))}}),[b]),(0,B.useEffect)((()=>{if(Object.keys(_).length>0){L(!0);V.searchDetailDocuments(_).then((e=>{h(k(e.data)),N(e.data),L(!1)})).catch((e=>{console.log(e),L(!1)}))}}),[_]),(0,B.useEffect)((()=>{if(Object.keys(v).length>0){let e;w(!0),e=S?W.buildingOwnerSearchPost(v):W.buildingSearchPost(v),e.then((e=>{h(K(e.data)),x(e.data),w(!1)})).catch((e=>{console.log(e),w(!1)}))}}),[v,S]),(0,zt.jsxs)("div",{children:[(0,zt.jsx)(J.Section,{collapsed:c!==oe,title:"detailsearch.buildings_detail_search",children:(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,zt.jsx)(xs,{onSubmit:e=>{E(e)},isAdminRole:m,isAdminPlusRole:S,callSearchPerson:q})}),Object.keys(v).length>0&&0===M.length&&!j?(0,zt.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,zt.jsx)(J.Text,{raw:"detailsearch.empty_search_result"})}):j?(0,zt.jsx)(J.SectionLoader,{}):(0,zt.jsx)(js,{linkGen:a,generateLink:l,isAdminRole:m,isAdminPlusRole:S})]})}),(0,zt.jsx)(J.Section,{collapsed:"DOCUMENTS_SEARCH"!==c,title:"detailsearch.documents_detail_search",children:(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,zt.jsx)(Os,{onSubmit:e=>{y(e)},callSearchPerson:q,isNonAuthenticatedUser:T})}),Object.keys(_).length>0&&0===O.length&&!C?(0,zt.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,zt.jsx)(J.Text,{raw:"detailsearch.empty_search_result"})}):C?(0,zt.jsx)(J.SectionLoader,{}):(0,zt.jsx)(Ps,{linkGen:a,generateLink:l,userInfo:p,filterStateDocumentsSearch:_})]})}),m&&(0,zt.jsx)(J.Section,{collapsed:"PROCEEDINGS_SEARCH"!==c,title:"detailsearch.proceedings_detail_search",children:(0,zt.jsxs)("div",{children:[(0,zt.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,zt.jsx)(Ns,{onSubmit:e=>{D(e)}})}),Object.keys(b).length>0&&0===A.length&&!P?(0,zt.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,zt.jsx)(J.Text,{raw:"detailsearch.empty_search_result"})}):P?(0,zt.jsx)(J.SectionLoader,{}):(0,zt.jsx)(Rs,{linkGen:a,userInfo:p,generateLink:l})]})})]})};return u})()));