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