@openmrs/esm-patient-tests-app 13.0.2-pre.12947 → 13.0.2-pre.12955
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/6271.js +1 -0
- package/dist/6271.js.map +1 -0
- package/dist/8659.js +1 -1
- package/dist/8659.js.map +1 -1
- package/dist/openmrs-esm-patient-tests-app.js +2 -2
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/translations/es_419.json +139 -0
package/.turbo/turbo-build.log
CHANGED
package/dist/6271.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_patient_tests_app=globalThis.webpackChunk_openmrs_esm_patient_tests_app||[]).push([["6271"],{1842(e){e.exports=JSON.parse('{"add":"Add","additionalInstructions":"Additional instructions","addOrderableForOrderType":"Add {{orderTypeDisplay}}","age":"Age","back":"Back","backToOrderBasket":"Back to order basket","backToTimeline":"Back to timeline","cancel":"Cancel","checkFilters":"Check the filters above","clear":"Clear","clearFilters":"Clear filters","clearSearchResults":"Clear results","closeSearchBar":"Close search","collapseAll":"Collapse all","confirmEditResults":"Do you want to edit test results for the following patient?","data":"data","dataLoadError":"Data load error","dataTimelineText":"Data timeline","date":"Date","dateCollected":"Displaying date collected","dateOrdered":"Date ordered","dateTime":"Date and time","directlyAddToBasket":"Add to basket","discard":"Discard","discontinued":"Discontinued","editLabResults":"Edit laboratory tests","editOrderableForOrderType":"Edit {{orderTypeDisplay}}","editTestResults":"Edit test results","endDate":"End date","error":"Error","errorFetchingTestTypes":"Error fetching results for \\"{{searchTerm}}\\"","errorSavingLabOrder":"Error saving lab order","expandAll":"Expand all","female":"Female","gender":"Gender","goToDrugOrderForm":"Order form","hideResultsTable":"Hide results table","individualTests":"Individual tests","labOrders":"Lab orders","location":"Location","male":"Male","moreResultsAvailable":"More results available","name":"Name","noPanelsFound":"No panels found","noResultsForTestTypeSearch":"No results to display for \\"{{searchTerm}}\\"","noResultsToDisplay":"No results to display","noTestResultsWithinSpecifiedRange":"No test results found within the specified range","observationsDisplayText":"observations","onDate":"on","or":"or","orderActionDiscontinue":"Discontinue","orderActionIncomplete":"Incomplete","orderActionNew":"New","orderActionRenew":"Renew","orderActionRevise":"Modify","orderDetails":"Order details","orderDiscontinued":"Order discontinued","ordered":"Placed order for","orderedFor":"Placed order for","orderNumber":"Order number","orderPlaced":"Order placed","orderReason":"Order reason","orderReasonRequired":"Order reason is required","ordersCompleted":"Orders completed","ordersDiscontinued":"Orders discontinued","ordersPlaced":"Orders placed","ordersUpdated":"Orders updated","orderUpdated":"Order updated","other":"Other","overTime":"Over time","panels":"panels","patientDetails":"Patient details","print":"Print","printedBy":"Printed by","printTestResults":"Print test results","priority":"Priority","priorityRequired":"Priority is required","recentResults":"Recent Results","recentTestResults":"recent test results","referenceNumber":"Reference number","referenceRange":"Reference range","refreshData":"Refresh data","refreshingData":"Refreshing data","removeFromBasket":"Remove from basket","reset":"Reset","resetTreeText":"Reset tree","resetView":"to reset this view","resultDate":"Result date","resulted":"Resulted","results":"Results","Results":"Results","resultsText":"results","returnToOrderBasket":"Return to order basket","returnToTimeline":"Return to timeline","saveOrder":"Save order","scheduledDate":"Scheduled date","scheduledDateRequired":"Scheduled date is required","search":"Search","searchAgain":"search again","searchByTestName":"Search by test name","searchFieldPlaceholder":"Search for a test type","searchResultsMatchesForTerm_one":"{{count}} result for \\"{{searchTerm}}\\"","searchResultsMatchesForTerm_other":"{{count}} results for \\"{{searchTerm}}\\"","searchResultsTextFor_one":"{{count}} search result for {{searchTerm}}","searchResultsTextFor_other":"{{count}} search results for {{searchTerm}}","seeAllResults":"See all results","selectTestPrompt":"Please select which test you would like to edit for the following patient:","selectTestToEdit":"Select test to edit","showResultsTable":"Show results table","showTree":"Show tree","startDate":"Start date","testName":"Test name","testResults":"test results","testResults_title":"Test Results","testResultsData":"test results data","tests":"Tests","testType":"Test type","testTypeRequired":"Test type is required","tree":"Tree","trendline":"Trendline","trendlineRangeSelector1Day":"1 day","trendlineRangeSelector1Month":"1 month","trendlineRangeSelector1Year":"1 year","trendlineRangeSelector5Days":"5 days","trendlineRangeSelector5Years":"5 years","trendlineRangeSelectorAll":"All","trendlineRangeSelectorMonths":"6 months","trendlineTooltipDate":"Date","trendlineTooltipRange":"Range","trendlineTooltipValue":"Value","trySearchingAgain":"Please try searching again","tryTo":"Try to","unknown":"Unknown","updated":"Updated","usingADifferentTerm":"using a different term","value":"Value","view":"View"}')}}]);
|
package/dist/6271.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"6271.js","sources":["webpack://@openmrs/esm-patient-tests-app/json|/home/runner/work/openmrs-esm-patient-chart/openmrs-esm-patient-chart/packages/esm-patient-tests-app/translations/es_419.json"],"names":["JSON"],"mappings":"uJAAA,EAAO,OAAO,CAAGA,KAAK,KAAK,CAAC,6jJ"}
|
package/dist/8659.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_patient_tests_app=globalThis.webpackChunk_openmrs_esm_patient_tests_app||[]).push([["8659"],{8742(e,t,s){"use strict";function a(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function l(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?a(Object(s),!0).forEach(function(t){var a,l;a=t,l=s[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t);if("object"!=typeof a)return a;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in e?Object.defineProperty(e,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[a]=l}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):a(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function n(e,t){if(null==e)return{};var s,a,l=function(e,t){if(null==e)return{};var s={};for(var a in e)if(({}).hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;s[a]=e[a]}return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)s=n[a],-1===t.indexOf(s)&&({}).propertyIsEnumerable.call(e,s)&&(l[s]=e[s])}return l}s.d(t,{A:()=>p});var i=["width","height","viewBox"],r=["tabindex"],_={focusable:"false",preserveAspectRatio:"xMidYMid meet"},o=s(9067),c=s.n(o),d=s(5399),m=s.n(d);let p=m().forwardRef(function({className:e,children:t,tabIndex:s,xmlns:a="http://www.w3.org/2000/svg",preserveAspectRatio:o="xMidYMid meet",...c},d){let{tabindex:p,...u}=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.width,s=e.height,a=e.viewBox,o=void 0===a?"0 0 ".concat(t," ").concat(s):a,c=n(e,i),d=c.tabindex,m=n(c,r),p=l(l(l({},_),m),{},{width:t,height:s,viewBox:o});return p["aria-label"]||p["aria-labelledby"]||p.title?(p.role="img",null!=d&&(p.focusable="true",p.tabindex=d)):p["aria-hidden"]=!0,p}({...c,tabindex:s});return e&&(u.className=e),null!=p&&("number"==typeof p?u.tabIndex=p:u.tabIndex=Number(s)),d&&(u.ref=d),a&&(u.xmlns=a),o&&(u.preserveAspectRatio=o),m().createElement("svg",u,t)});p.displayName="Icon",p.propTypes={"aria-hidden":c().oneOfType([c().bool,c().oneOf(["true","false"])]),"aria-label":c().string,"aria-labelledby":c().string,children:c().node,className:c().string,height:c().oneOfType([c().number,c().string]),preserveAspectRatio:c().string,tabIndex:c().oneOfType([c().number,c().string]),viewBox:c().string,width:c().oneOfType([c().number,c().string]),xmlns:c().string}},7995(e,t,s){"use strict";s.d(t,{A:()=>a});let a={"cds--grid":"-esm-patient-tests__lab-set-panel__cds--grid___nMrb-","cds--grid--full-width":"-esm-patient-tests__lab-set-panel__cds--grid--full-width___wzZtd","cds--row":"-esm-patient-tests__lab-set-panel__cds--row___Qy216","cds--row-padding":"-esm-patient-tests__lab-set-panel__cds--row-padding___he3g6","cds--col-padding":"-esm-patient-tests__lab-set-panel__cds--col-padding___vt8z+","cds--grid--condensed":"-esm-patient-tests__lab-set-panel__cds--grid--condensed___i6BEg","cds--grid--with-row-gap":"-esm-patient-tests__lab-set-panel__cds--grid--with-row-gap___TsJyv","cds--grid--narrow":"-esm-patient-tests__lab-set-panel__cds--grid--narrow___cBBS6","cds--col":"-esm-patient-tests__lab-set-panel__cds--col___aT7YR","cds--row--condensed":"-esm-patient-tests__lab-set-panel__cds--row--condensed___rvW12","cds--row--narrow":"-esm-patient-tests__lab-set-panel__cds--row--narrow___-7YkV","cds--col-sm-0":"-esm-patient-tests__lab-set-panel__cds--col-sm-0___yGR6c","cds--col-sm-1":"-esm-patient-tests__lab-set-panel__cds--col-sm-1___iEF2g","cds--col-sm-2":"-esm-patient-tests__lab-set-panel__cds--col-sm-2___VoYoB","cds--col-sm-3":"-esm-patient-tests__lab-set-panel__cds--col-sm-3___VQ3uq","cds--col-sm-4":"-esm-patient-tests__lab-set-panel__cds--col-sm-4___EgRI4","cds--col-sm":"-esm-patient-tests__lab-set-panel__cds--col-sm___VcN8j","cds--col-sm--auto":"-esm-patient-tests__lab-set-panel__cds--col-sm--auto___cr+Ry","cds--col--auto":"-esm-patient-tests__lab-set-panel__cds--col--auto___WedvY","cds--offset-sm-0":"-esm-patient-tests__lab-set-panel__cds--offset-sm-0___+c5Sz","cds--offset-sm-1":"-esm-patient-tests__lab-set-panel__cds--offset-sm-1___Kt69y","cds--offset-sm-2":"-esm-patient-tests__lab-set-panel__cds--offset-sm-2___xAqR7","cds--offset-sm-3":"-esm-patient-tests__lab-set-panel__cds--offset-sm-3___Uf4zM","cds--col-md-0":"-esm-patient-tests__lab-set-panel__cds--col-md-0___dkym5","cds--col-md-1":"-esm-patient-tests__lab-set-panel__cds--col-md-1___bOv7d","cds--col-md-2":"-esm-patient-tests__lab-set-panel__cds--col-md-2___-OGtv","cds--col-md-3":"-esm-patient-tests__lab-set-panel__cds--col-md-3___M8w-B","cds--col-md-4":"-esm-patient-tests__lab-set-panel__cds--col-md-4___xBuet","cds--col-md-5":"-esm-patient-tests__lab-set-panel__cds--col-md-5___bg4Yb","cds--col-md-6":"-esm-patient-tests__lab-set-panel__cds--col-md-6___himGH","cds--col-md-7":"-esm-patient-tests__lab-set-panel__cds--col-md-7___Ot25H","cds--col-md-8":"-esm-patient-tests__lab-set-panel__cds--col-md-8___l0cR+","cds--col-md":"-esm-patient-tests__lab-set-panel__cds--col-md___Bczgy","cds--col-md--auto":"-esm-patient-tests__lab-set-panel__cds--col-md--auto___YXBHD","cds--offset-md-0":"-esm-patient-tests__lab-set-panel__cds--offset-md-0___8av5d","cds--offset-md-1":"-esm-patient-tests__lab-set-panel__cds--offset-md-1___4tR3O","cds--offset-md-2":"-esm-patient-tests__lab-set-panel__cds--offset-md-2___HNh3B","cds--offset-md-3":"-esm-patient-tests__lab-set-panel__cds--offset-md-3___r7-nE","cds--offset-md-4":"-esm-patient-tests__lab-set-panel__cds--offset-md-4___jjgvX","cds--offset-md-5":"-esm-patient-tests__lab-set-panel__cds--offset-md-5___JLqL3","cds--offset-md-6":"-esm-patient-tests__lab-set-panel__cds--offset-md-6___xcTp2","cds--offset-md-7":"-esm-patient-tests__lab-set-panel__cds--offset-md-7___2UzKB","cds--col-lg-0":"-esm-patient-tests__lab-set-panel__cds--col-lg-0___FJt2C","cds--col-lg-1":"-esm-patient-tests__lab-set-panel__cds--col-lg-1___zZ7UW","cds--col-lg-2":"-esm-patient-tests__lab-set-panel__cds--col-lg-2___XARr7","cds--col-lg-3":"-esm-patient-tests__lab-set-panel__cds--col-lg-3___vobkK","cds--col-lg-4":"-esm-patient-tests__lab-set-panel__cds--col-lg-4___ZofES","cds--col-lg-5":"-esm-patient-tests__lab-set-panel__cds--col-lg-5___lgUz+","cds--col-lg-6":"-esm-patient-tests__lab-set-panel__cds--col-lg-6___IxSOR","cds--col-lg-7":"-esm-patient-tests__lab-set-panel__cds--col-lg-7___lz-9u","cds--col-lg-8":"-esm-patient-tests__lab-set-panel__cds--col-lg-8___lt8h6","cds--col-lg-9":"-esm-patient-tests__lab-set-panel__cds--col-lg-9___mORaq","cds--col-lg-10":"-esm-patient-tests__lab-set-panel__cds--col-lg-10___ldOGF","cds--col-lg-11":"-esm-patient-tests__lab-set-panel__cds--col-lg-11___4a5Sc","cds--col-lg-12":"-esm-patient-tests__lab-set-panel__cds--col-lg-12___0SQts","cds--col-lg-13":"-esm-patient-tests__lab-set-panel__cds--col-lg-13___PalMa","cds--col-lg-14":"-esm-patient-tests__lab-set-panel__cds--col-lg-14___e5yRC","cds--col-lg-15":"-esm-patient-tests__lab-set-panel__cds--col-lg-15___6Ng-U","cds--col-lg-16":"-esm-patient-tests__lab-set-panel__cds--col-lg-16___XoSUz","cds--col-lg":"-esm-patient-tests__lab-set-panel__cds--col-lg___fTMA7","cds--col-lg--auto":"-esm-patient-tests__lab-set-panel__cds--col-lg--auto___wKnQx","cds--offset-lg-0":"-esm-patient-tests__lab-set-panel__cds--offset-lg-0___OSn2B","cds--offset-lg-1":"-esm-patient-tests__lab-set-panel__cds--offset-lg-1___ylXRI","cds--offset-lg-2":"-esm-patient-tests__lab-set-panel__cds--offset-lg-2___EWSZR","cds--offset-lg-3":"-esm-patient-tests__lab-set-panel__cds--offset-lg-3___0nyz-","cds--offset-lg-4":"-esm-patient-tests__lab-set-panel__cds--offset-lg-4___HZrlz","cds--offset-lg-5":"-esm-patient-tests__lab-set-panel__cds--offset-lg-5___OTQsM","cds--offset-lg-6":"-esm-patient-tests__lab-set-panel__cds--offset-lg-6___6pjxJ","cds--offset-lg-7":"-esm-patient-tests__lab-set-panel__cds--offset-lg-7___dzEqR","cds--offset-lg-8":"-esm-patient-tests__lab-set-panel__cds--offset-lg-8___l+oKM","cds--offset-lg-9":"-esm-patient-tests__lab-set-panel__cds--offset-lg-9___h+0PL","cds--offset-lg-10":"-esm-patient-tests__lab-set-panel__cds--offset-lg-10___xCKQJ","cds--offset-lg-11":"-esm-patient-tests__lab-set-panel__cds--offset-lg-11___QomFu","cds--offset-lg-12":"-esm-patient-tests__lab-set-panel__cds--offset-lg-12___lR+Hk","cds--offset-lg-13":"-esm-patient-tests__lab-set-panel__cds--offset-lg-13___6u-pn","cds--offset-lg-14":"-esm-patient-tests__lab-set-panel__cds--offset-lg-14___c1Idr","cds--offset-lg-15":"-esm-patient-tests__lab-set-panel__cds--offset-lg-15___1iSAk","cds--col-xlg-0":"-esm-patient-tests__lab-set-panel__cds--col-xlg-0___7cEPi","cds--col-xlg-1":"-esm-patient-tests__lab-set-panel__cds--col-xlg-1___io8+G","cds--col-xlg-2":"-esm-patient-tests__lab-set-panel__cds--col-xlg-2___ZIJ2N","cds--col-xlg-3":"-esm-patient-tests__lab-set-panel__cds--col-xlg-3___hhHFq","cds--col-xlg-4":"-esm-patient-tests__lab-set-panel__cds--col-xlg-4___-M598","cds--col-xlg-5":"-esm-patient-tests__lab-set-panel__cds--col-xlg-5___5QOp9","cds--col-xlg-6":"-esm-patient-tests__lab-set-panel__cds--col-xlg-6___3Z0Un","cds--col-xlg-7":"-esm-patient-tests__lab-set-panel__cds--col-xlg-7___53WSI","cds--col-xlg-8":"-esm-patient-tests__lab-set-panel__cds--col-xlg-8___jyjrg","cds--col-xlg-9":"-esm-patient-tests__lab-set-panel__cds--col-xlg-9___p3Oxz","cds--col-xlg-10":"-esm-patient-tests__lab-set-panel__cds--col-xlg-10___Dr0uJ","cds--col-xlg-11":"-esm-patient-tests__lab-set-panel__cds--col-xlg-11___trITQ","cds--col-xlg-12":"-esm-patient-tests__lab-set-panel__cds--col-xlg-12___YOFaT","cds--col-xlg-13":"-esm-patient-tests__lab-set-panel__cds--col-xlg-13___vU2yL","cds--col-xlg-14":"-esm-patient-tests__lab-set-panel__cds--col-xlg-14___Kbi0b","cds--col-xlg-15":"-esm-patient-tests__lab-set-panel__cds--col-xlg-15___ltFYH","cds--col-xlg-16":"-esm-patient-tests__lab-set-panel__cds--col-xlg-16___pzOb8","cds--col-xlg":"-esm-patient-tests__lab-set-panel__cds--col-xlg___jew+w","cds--col-xlg--auto":"-esm-patient-tests__lab-set-panel__cds--col-xlg--auto___p2mLu","cds--offset-xlg-0":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-0___r1dbh","cds--offset-xlg-1":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-1___9zNX-","cds--offset-xlg-2":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-2___Vf96M","cds--offset-xlg-3":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-3___tac7f","cds--offset-xlg-4":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-4___E-Ur7","cds--offset-xlg-5":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-5___Lzo4J","cds--offset-xlg-6":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-6___IJZSk","cds--offset-xlg-7":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-7___ED8cc","cds--offset-xlg-8":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-8___cBwYn","cds--offset-xlg-9":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-9___d84kC","cds--offset-xlg-10":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-10___N+Rdy","cds--offset-xlg-11":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-11___aFpO6","cds--offset-xlg-12":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-12___mdaR4","cds--offset-xlg-13":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-13___xa1PT","cds--offset-xlg-14":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-14___s48kX","cds--offset-xlg-15":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-15___jkhqX","cds--col-max-0":"-esm-patient-tests__lab-set-panel__cds--col-max-0___vbwQ1","cds--col-max-1":"-esm-patient-tests__lab-set-panel__cds--col-max-1___7NiNt","cds--col-max-2":"-esm-patient-tests__lab-set-panel__cds--col-max-2___WfezX","cds--col-max-3":"-esm-patient-tests__lab-set-panel__cds--col-max-3___skbHk","cds--col-max-4":"-esm-patient-tests__lab-set-panel__cds--col-max-4___axNsg","cds--col-max-5":"-esm-patient-tests__lab-set-panel__cds--col-max-5___zQ56E","cds--col-max-6":"-esm-patient-tests__lab-set-panel__cds--col-max-6___MLM6P","cds--col-max-7":"-esm-patient-tests__lab-set-panel__cds--col-max-7___JLhee","cds--col-max-8":"-esm-patient-tests__lab-set-panel__cds--col-max-8___EjooU","cds--col-max-9":"-esm-patient-tests__lab-set-panel__cds--col-max-9___4T00Z","cds--col-max-10":"-esm-patient-tests__lab-set-panel__cds--col-max-10___NDABT","cds--col-max-11":"-esm-patient-tests__lab-set-panel__cds--col-max-11___Qh0UG","cds--col-max-12":"-esm-patient-tests__lab-set-panel__cds--col-max-12___MI6z6","cds--col-max-13":"-esm-patient-tests__lab-set-panel__cds--col-max-13___YqZgD","cds--col-max-14":"-esm-patient-tests__lab-set-panel__cds--col-max-14___3Q-5K","cds--col-max-15":"-esm-patient-tests__lab-set-panel__cds--col-max-15___E2jO3","cds--col-max-16":"-esm-patient-tests__lab-set-panel__cds--col-max-16___IYiGB","cds--col-max":"-esm-patient-tests__lab-set-panel__cds--col-max___4jG8Z","cds--col-max--auto":"-esm-patient-tests__lab-set-panel__cds--col-max--auto___8NKEB","cds--offset-max-0":"-esm-patient-tests__lab-set-panel__cds--offset-max-0___It5qq","cds--offset-max-1":"-esm-patient-tests__lab-set-panel__cds--offset-max-1___u0cG+","cds--offset-max-2":"-esm-patient-tests__lab-set-panel__cds--offset-max-2___aVrtN","cds--offset-max-3":"-esm-patient-tests__lab-set-panel__cds--offset-max-3___06kDu","cds--offset-max-4":"-esm-patient-tests__lab-set-panel__cds--offset-max-4___YxkC5","cds--offset-max-5":"-esm-patient-tests__lab-set-panel__cds--offset-max-5___46lWT","cds--offset-max-6":"-esm-patient-tests__lab-set-panel__cds--offset-max-6___pCj09","cds--offset-max-7":"-esm-patient-tests__lab-set-panel__cds--offset-max-7___+TZIf","cds--offset-max-8":"-esm-patient-tests__lab-set-panel__cds--offset-max-8___KOYc0","cds--offset-max-9":"-esm-patient-tests__lab-set-panel__cds--offset-max-9___dqddn","cds--offset-max-10":"-esm-patient-tests__lab-set-panel__cds--offset-max-10___1Z7gO","cds--offset-max-11":"-esm-patient-tests__lab-set-panel__cds--offset-max-11___-OsZ5","cds--offset-max-12":"-esm-patient-tests__lab-set-panel__cds--offset-max-12___NIgud","cds--offset-max-13":"-esm-patient-tests__lab-set-panel__cds--offset-max-13___2XRfF","cds--offset-max-14":"-esm-patient-tests__lab-set-panel__cds--offset-max-14___0Cbtx","cds--offset-max-15":"-esm-patient-tests__lab-set-panel__cds--offset-max-15___iGCdd","cds--no-gutter":"-esm-patient-tests__lab-set-panel__cds--no-gutter___jdGI+","cds--no-gutter--start":"-esm-patient-tests__lab-set-panel__cds--no-gutter--start___AYJNs","cds--no-gutter--end":"-esm-patient-tests__lab-set-panel__cds--no-gutter--end___AwANM","cds--hang--start":"-esm-patient-tests__lab-set-panel__cds--hang--start___83aGe","cds--hang--end":"-esm-patient-tests__lab-set-panel__cds--hang--end___fNqkt",labSetPanel:"-esm-patient-tests__lab-set-panel__labSetPanel___TaVqX",activePanel:"-esm-patient-tests__lab-set-panel__activePanel___G3cps",panelHeader:"-esm-patient-tests__lab-set-panel__panelHeader___0z6a4",productiveHeading02:"-esm-patient-tests__lab-set-panel__productiveHeading02___sCIi6",subtitleText:"-esm-patient-tests__lab-set-panel__subtitleText___rjhvf","off-scale-high":"-esm-patient-tests__lab-set-panel__off-scale-high___zM5mP","off-scale-low":"-esm-patient-tests__lab-set-panel__off-scale-low___iQzqb","critically-high":"-esm-patient-tests__lab-set-panel__critically-high___65fwt","critically-low":"-esm-patient-tests__lab-set-panel__critically-low___aDNEt",high:"-esm-patient-tests__lab-set-panel__high___HVjwe",low:"-esm-patient-tests__lab-set-panel__low___vrdEb",table:"-esm-patient-tests__lab-set-panel__table___wm8Mn","col-testName":"-esm-patient-tests__lab-set-panel__col-testName___HMPpt",tableWithRange:"-esm-patient-tests__lab-set-panel__tableWithRange___THIrO","col-resultDate":"-esm-patient-tests__lab-set-panel__col-resultDate___6sh6e","col-value":"-esm-patient-tests__lab-set-panel__col-value___JJyN2","col-referenceRange":"-esm-patient-tests__lab-set-panel__col-referenceRange___AvYAZ",tableWithoutRange:"-esm-patient-tests__lab-set-panel__tableWithoutRange___g053k"}},6999(e,t,s){"use strict";var a=s(6848);function l(){}function n(){}n.resetWarningCache=l,e.exports=function(){function e(e,t,s,l,n,i){if(i!==a){var r=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw r.name="Invariant Violation",r}}function t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:l};return s.PropTypes=s,s}},9067(e,t,s){e.exports=s(6999)()},6848(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4767(e,t,s){var a={"./uk.json":["3104","9072"],"./ar.json":["4132","7045"],"./ru_RU.json":["986","8359"],"./uz_UZ.json":["890","7175"],"./fr.json":["4055","6508"],"./sw_KE.json":["8618","903"],"./uz.json":["3584","6377"],"./en.json":["4300","5117"],"./ky.json":["8163","2416"],"./pl.json":["1119","6724"],"./sq.json":["8371","4928"],"./ka.json":["795","1480"],"./si.json":["6859","6904"],"./zh_TW.json":["439","556"],"./de.json":["4944","5145"],"./lg.json":["4618","8695"],"./vi.json":["9214","6371"],"./tr.json":["5241","434"],"./es_MX.json":["8349","1646"],"./tr_TR.json":["9900","1869"],"./zh_CN.json":["9879","5644"],"./en_US.json":["9569","4106"],"./he.json":["4652","2317"],"./id.json":["2690","6047"],"./ku.json":["9895","4348"],"./es.json":["3099","7912"],"./ne.json":["2146","5503"],"./ar_SY.json":["7617","282"],"./uz@Latn.json":["7097","4658"],"./bn.json":["7159","6444"],"./cs.json":["6589","7182"],"./zh.json":["1690","7742"],"./hi_IN.json":["5442","4383"],"./pt_BR.json":["4087","1877"],"./qu.json":["5173","8358"],"./ro_RO.json":["6022","3963"],"./sw.json":["9913","3378"],"./am.json":["1197","9806"],"./pt.json":["6679","5132"],"./it.json":["9538","4111"],"./km.json":["4335","5940"],"./hi.json":["6840","2881"]};function l(e){if(!s.o(a,e))return Promise.resolve().then(function(){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=a[e],l=t[0];return s.e(t[1]).then(function(){return s(l)})}l.keys=()=>Object.keys(a),l.id=4767,e.exports=l},6631(e,t,s){"use strict";s.r(t),s.d(t,{resultsViewer:()=>eL,addLabOrderWorkspace:()=>ek,externalOverview:()=>eO,exportedAddLabOrderWorkspace:()=>eD,labOrderPanel:()=>eH,importTranslation:()=>eS,testResultsDashboardLink:()=>eI,timelineResultsModal:()=>eE,startupApp:()=>eA,editLabResultsModal:()=>eM,printModal:()=>eR});var a,l=s(2664),n=s(6717);let i={resultsViewerConcepts:{_type:l.Type.Array,_elements:{_type:l.Type.Object,conceptUuid:{_type:l.Type.UUID,_description:"UUID of a test or a concept set containing tests as members, members' members, and so on. Test results will be loaded by querying the REST /obstree endpoint with this concept."},defaultOpen:{_type:l.Type.Boolean,_description:"Each concept set displays the test results it contains in an accordion. Should the accordion be open by default?"}},_default:[{conceptUuid:"ae485e65-2e3f-4297-b35e-c818bbefe894",defaultOpen:!1},{conceptUuid:"8904fa2b-6a8f-437d-89ec-6fce3cd99093",defaultOpen:!1},{conceptUuid:"856AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",defaultOpen:!1}]},orderTypeUuid:{_type:l.Type.UUID,_description:"UUID identifying this extension's order type for order basket panel filtering. Must match orders.labOrderTypeUuid if that value is overridden.",_default:"52a447d3-a64a-11e3-9aeb-50e549534c5e"},orders:{labOrderTypeUuid:{_type:l.Type.UUID,_description:"UUID for the 'Lab' order type",_default:"52a447d3-a64a-11e3-9aeb-50e549534c5e"},labOrderableConcepts:{_type:l.Type.Array,_elements:{_type:l.Type.UUID},_description:"UUIDs of concepts that represent orderable lab tests or lab sets.",_default:["1748a953-d12e-4be1-914c-f6b096c6cdef"]}},showReferenceNumberField:{_type:l.Type.Boolean,_default:!0,_description:"Whether to display the Reference number field in the Test Order form. This field maps to the accesion_number property in the Order data model"},additionalTestOrderTypes:{_type:l.Type.Array,_elements:{_type:l.Type.Object,orderTypeUuid:{_type:l.Type.UUID,_description:"UUID for the new order type"},label:{_type:l.Type.String,_description:"The custom label to be shown for the order type. The label will be translated using the label as the key itself."},orderableConceptSets:{_type:l.Type.Array,_elements:{_type:l.Type.UUID},_description:"UUIDs of concepts that represent orderable concept sets. If an empty array `[]` is provided, every concept with class mentioned in the `orderableConceptClasses` will be considered orderable."},icon:{_type:l.Type.String,_description:"Icon to be shown for the order type. Icons are from the OpenMRS icon library.",_default:""}},_description:"List of various order types, each associated with the Java class name `org.openmrs.TestOrder`.",_default:[]},labTestsWithOrderReasons:{_type:l.Type.Array,_elements:{_type:l.Type.Object,labTestUuid:{_type:l.Type.UUID,_description:"UUID of the lab test that requires a reason for ordering",_default:""},required:{_type:l.Type.Boolean,_description:"Whether the order reason is required or not",_default:!1},orderReasons:{_type:l.Type.Array,_elements:{_type:l.Type.ConceptUuid,_description:"Array of coded concepts that represent reasons for ordering a lab test"},_description:"Coded Lab test order reason options",_default:[]}},_description:"Whether to allow for provision of coded order reason. This feature requires webservices.rest 3.1.0 or later.",_default:[]}};var r=s(4989);let _="@openmrs/esm-patient-tests-app";var o=s(3338),c=s(5399),d=s.n(c),m=s(3373),p=s.n(m),u=s(7807),h=s(324),f=s(8547),b=s(6955),g=s(3886);async function x(e){let t=await (0,b.$u)(e),s=(await (0,b.dY)(t)).filter(e=>"Test"===e.conceptClass.name||"LabSet"===e.conceptClass.name),a=s.map(e=>e.uuid),l=Object.fromEntries(s.map(({uuid:e,display:t})=>[e,t])),n=Object.fromEntries(a.map(e=>[e,[]])),i=(0,b.tt)(s),r=[],_={},o=e=>{e.conceptClass=(0,b.mL)(e);let t=(0,b.lf)(e),s=(0,b.Yq)(e);if(e.hasMember)e.members=Array(e.hasMember.length),e.hasMember.forEach((t,s)=>{_[t.reference.split("/")[1]]=[e.members,s]});else{e.valueQuantity?(e.value=String(e.valueQuantity.value),delete e.valueQuantity):e.valueCodeableConcept?(e.value=e.valueCodeableConcept.coding?.[0]?.display,delete e.valueCodeableConcept):e.valueString&&(e.value=e.valueString,delete e.valueString);let a=i[e.conceptClass],l={hiAbsolute:a.hiAbsolute,hiCritical:a.hiCritical,hiNormal:a.hiNormal,lowAbsolute:a.lowAbsolute,lowCritical:a.lowCritical,lowNormal:a.lowNormal,units:a.units},n=(0,g.Tq)(t,l),r={...a,hiAbsolute:n?.hiAbsolute??a.hiAbsolute,hiCritical:n?.hiCritical??a.hiCritical,hiNormal:n?.hiNormal??a.hiNormal,lowAbsolute:n?.lowAbsolute??a.lowAbsolute,lowCritical:n?.lowCritical??a.lowCritical,lowNormal:n?.lowNormal??a.lowNormal,units:n?.units??a.units,range:n?(0,g.ys)(n,n.units):a.range};r.assessValue=(0,b.EF)(r),e.meta=r,e.interpretation=s??(r.assessValue?r.assessValue(e.value):"NORMAL")}e.name=l[e.conceptClass]};t.forEach(e=>{a.includes((0,b.mL)(e))&&(o(e),e.members?n[e.conceptClass].push(e):r.push(e))}),r.forEach(e=>{let{id:t}=e,s=_[t];s&&(s[0][s[1]]=e),n[e.conceptClass]&&n[e.conceptClass].push(e)}),Object.values(n).filter(e=>e.some(e=>e.members)).forEach(e=>{var t;let s=e.flatMap(e=>e.members);for(let a of(t=s.map(e=>e.conceptClass))&&t.length?(0,f.A)(t):[])for(let t of r.filter(e=>e.conceptClass===a&&!s.some(t=>t.id===e.id)))e.push({...t,members:[t]})});let c=Object.fromEntries(Object.entries(n).filter(e=>e[1].length).map(([e,t])=>{let{display:a,conceptClass:{display:l}}=s.find(t=>t.uuid===e);return[a,{entries:t.sort((e,t)=>Date.parse(t.effectiveDateTime)-Date.parse(e.effectiveDateTime)),type:l,uuid:e}]}));return t.length>0&&(0,b.Yz)(e,c,t[0].id),c}let v=function(e){let[t,s]=(0,b.UY)(e);return[t,s.then(s=>s?x(e):t)]};var y=s(4807),w=s(7774);let j="-esm-patient-tests__common-overview__label___Z8FnH",T=({...e})=>(0,o.jsx)("div",{...e,className:"-esm-patient-tests__common-overview__separator___hXDBi"}),N=({effectiveDateTime:e,issuedDateTime:t})=>{let{t:s}=(0,u.useTranslation)();return(0,o.jsxs)(h.Toggletip,{align:"bottom",className:"-esm-patient-tests__common-overview__tooltipContainer___dux6M",children:[(0,o.jsx)(h.ToggletipButton,{label:"Additional information",children:(0,o.jsx)(y.$$,{})}),(0,o.jsx)(h.ToggletipContent,{children:(0,o.jsxs)("div",{className:"-esm-patient-tests__common-overview__tooltip___fhxzj",children:[(0,o.jsx)("p",{children:s("dateCollected","Displaying date collected")}),(0,o.jsxs)("p",{children:[(0,o.jsxs)("span",{className:j,children:[s("ordered","Ordered"),": "]})," ",(0,l.formatDatetime)(e,{mode:"wide"})]}),(0,o.jsxs)("p",{children:[(0,o.jsxs)("span",{className:j,children:[s("resulted","Resulted"),": "]})," ",(0,l.formatDatetime)(t,{mode:"wide"})]})]})})]})},C=({patientUuid:e,overviewData:t=[]})=>{let{t:s}=(0,u.useTranslation)(),a=[{key:"name",header:s("testName","Test Name")},{key:"value",header:s("value","Value")},{key:"range",header:s("referenceRange","Reference range")}],i=(0,c.useCallback)(()=>{(0,l.navigate)({to:`\${openmrsSpaBase}/patient/${e}/chart/results`})},[e]);return t.length?(0,o.jsx)(o.Fragment,{children:t.map(([e,t,n,r,_,c])=>(0,o.jsxs)("article",{children:[(0,o.jsx)(w.A,{title:e,data:n,description:(0,o.jsx)("div",{children:(0,o.jsxs)("div",{className:"-esm-patient-tests__common-overview__meta___uZKDR",children:[(0,l.formatDatetime)(r,{mode:"wide"}),(0,o.jsx)(N,{effectiveDateTime:r,issuedDateTime:_})]})}),tableHeaders:a}),n.length>5&&(0,o.jsx)(h.Button,{onClick:i,kind:"ghost",children:s("moreResultsAvailable","More results available")})]},c)).reduce((e,t,s,{length:a})=>(e.push(t),s<a-1&&e.push((0,o.jsx)(T,{},s)),e),[])}):(0,o.jsx)(n.EmptyState,{headerTitle:s("testResults_title","Test Results"),displayText:s("testResults","test results")})},S={productiveHeading03:"-esm-patient-tests__external-overview__productiveHeading03___mo9Ip","recent-results-grid":"-esm-patient-tests__external-overview__recent-results-grid___fkVjE",text02:"-esm-patient-tests__external-overview__text02___IvRD9"},A=e=>(0,o.jsx)("div",{...e,className:S["recent-results-grid"]});var O=s(1619);let L=({width:e="64",height:t="64"})=>(0,o.jsx)("svg",{width:e,height:t,viewBox:"0 0 58 58",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,o.jsx)("g",{fill:"#CEE6E5",children:(0,o.jsx)("path",{d:"M15 15h14v14H15zM43 43h14v14H43zM29 29h14v14H29zM29 1h14v14H29zM1 29h14v14H1zM43 15h14v14H43zM15 43h14v14H15zM1 1h14v14H1z"})}),(0,o.jsx)("path",{d:"M57 57H1V1h56v56zM1 29h56M1 15h56M1 43h56M29 1v56M15 1v56M43 1v56",stroke:"#9ACBCA",strokeWidth:"1.44",strokeLinejoin:"round"})]})}),R=e=>{let{t}=(0,u.useTranslation)();return(0,o.jsx)(h.Layer,{children:(0,o.jsxs)(h.Tile,{className:"-esm-patient-tests__filter-empty-state__tile___xfv+V",children:[(0,o.jsx)(L,{}),(0,o.jsx)("p",{className:"-esm-patient-tests__filter-empty-state__content___TS4pE",children:t("noResultsToDisplay","No results to display")}),e.clearFilter&&(0,o.jsxs)("p",{className:"-esm-patient-tests__filter-empty-state__action___4Wvi+",children:[(0,o.jsx)("span",{className:"-esm-patient-tests__filter-empty-state__link___Yjv0T",role:"button",tabIndex:0,onClick:()=>e.clearFilter(),children:t("clearFilters","Clear filters")})," ",(0,o.jsx)("span",{children:t("resetView","to reset this view")})]})]})})};var I=((a={}).INITIALIZE="INITIALIZE",a.TOGGLE_CHECKBOX="TOGGLE_CHECKBOX",a.TOGGLE_PARENT="TOGGLE_PARENT",a.RESET_TREE="RESET_TREE",a);function H(e,t){let s=[...e],a=new Map;for(let t of e){let e=`${t.obsDatetime}|${t.value}`;a.set(e,(a.get(e)??0)+1)}let l=new Map;for(let e of t){let t=`${e.obsDatetime}|${e.value}`,n=(l.get(t)??0)+1;l.set(t,n),n>(a.get(t)??0)&&s.push(e)}return s}let k=(e,t)=>{let s={},a=[],l=[],n=[];return t?.obs&&Array.isArray(t.obs)&&t.obs.length>0?(a.push(t.flatName),l.push([t.flatName,t])):t?.subSets&&Array.isArray(t.subSets)&&t.subSets.length>0?(t.subSets.map(t=>t?k(e,t):null).filter(Boolean).forEach(e=>{e&&(s={...s,...e.parents},a.push(...e.leaves),l.push(...e.tests),n.push(...e.lowestParents))}),t.subSets.some(e=>e?.hasData)&&n.push(t)):(a.push(t.flatName),l.push([t.flatName,t])),s[t.flatName||t.display]=a,{parents:s,leaves:a,tests:l,lowestParents:n}},D=function(e,t){switch(t.type){case I.INITIALIZE:{let s={},a=[],l=[],n=[];t.trees.forEach(e=>{let{parents:t,leaves:i,tests:r,lowestParents:_}=k("",e);s={...s,...t},a=[...a,...i],l=[...l,...r],n=[...n,..._]});let i={};return l.forEach(([e,t])=>{let s=i[e];s?t.obs&&Array.isArray(t.obs)&&(s.obs=H(s.obs??[],t.obs)):i[e]={...t,obs:t.obs?[...t.obs]:t.obs}}),{checkboxes:Object.fromEntries(a.map(t=>[t,e.checkboxes[t]??!1])),parents:s,roots:t.trees,tests:i,lowestParents:n}}case I.TOGGLE_CHECKBOX:return{...e,checkboxes:{...e.checkboxes,[t.name]:!e.checkboxes[t.name]}};case I.TOGGLE_PARENT:{let s=e.parents[t.name],a={...e.checkboxes};if(s&&Array.isArray(s)){let e=s.every(e=>a[e]);s.forEach(t=>a[t]=!e)}return{...e,checkboxes:a}}case I.RESET_TREE:return{...e,checkboxes:Object.fromEntries(Object.keys(e.checkboxes).map(e=>[e,!1]))};default:return e}};function E(e){let t=e.split("-");return t.length>=2?t[1]:t[0]}let M={checkboxes:{},parents:{},roots:[{display:"",flatName:""}],tests:{},lowestParents:[]},F={state:M,...M,timelineData:null,tableData:null,trendlineData:null,activeTests:[],someChecked:!1,totalResultsCount:0,filteredResultsCount:0,isLoading:!1,initialize:()=>{},toggleVal:()=>{},updateParent:()=>{},resetTree:()=>{}},U=(0,c.createContext)(F),z=({roots:e,isLoading:t,children:s})=>{let[a,n]=(0,c.useReducer)(D,M),i=(0,c.useMemo)(()=>({initialize:e=>n({type:I.INITIALIZE,trees:e}),toggleVal:e=>n({type:I.TOGGLE_CHECKBOX,name:e}),updateParent:e=>n({type:I.TOGGLE_PARENT,name:e}),resetTree:()=>n({type:I.RESET_TREE})}),[n]),r=(0,c.useMemo)(()=>Object.keys(a?.checkboxes)?.filter(e=>a.checkboxes[e])||[],[a.checkboxes]),_=!!r.length,d=(0,c.useMemo)(()=>{let e=new Map;for(let t in a.tests){let s=a.tests[t];if(!s.obs||!Array.isArray(s.obs)||0===s.obs.length)continue;let l=E(s.flatName),n=`${l}_${s.conceptUuid??s.flatName}`,i=e.get(n);i?(i.flatNames.push(s.flatName),i.obs=H(i.obs,s.obs)):e.set(n,{test:s,stateKey:t,flatNames:[s.flatName],obs:[...s.obs]})}return[...e.values()]},[a.tests]),m=(0,c.useMemo)(()=>{let e,t,s;if(!a?.tests)return{data:{parsedTime:{},rowData:[],panelName:""},loaded:!1};let n=r.length?d.filter(e=>e.flatNames.some(e=>r.includes(e))):d,i=[...new Set(n.map(({obs:e})=>e.map(e=>e.obsDatetime)).flat().filter(Boolean))];i.sort((e,t)=>new Date(t).getTime()-new Date(e).getTime());let _=[];return n.forEach(({test:e,stateKey:t,flatNames:s,obs:a})=>{let l=i.map(e=>a.find(t=>t.obsDatetime===e));_.push({...e,key:t,flatNames:s,obs:a,entries:l})}),{data:{parsedTime:(e=[],t=[],s=[],i.forEach(a=>{let n=(0,l.parseDate)(a),i=n.getFullYear().toString(),r=(0,l.formatDate)(n,{mode:"wide",year:!1,time:!1}),_=(0,l.formatTime)(n),o=e.find(({year:e})=>i===e);o?o.size++:e.push({year:i,size:1});let c=t.find(({year:e,day:t})=>r===t&&i===e);c?c.size++:t.push({day:r,year:i,size:1}),s.push(_)}),{yearColumns:e,dayColumns:t,timeColumns:s,sortedTimes:i}),rowData:_,panelName:"timeline"},loaded:!0}},[r,d,a.tests]),p=(0,c.useMemo)(()=>{let e=[];d.forEach(({test:t,stateKey:s,flatNames:a,obs:l})=>{l.forEach(l=>{let n={...t,...l,key:s,flatNames:a};e.push(n)})});let t={};return e.forEach(e=>{let s=E(e.flatName),a=new Date(e.obsDatetime).toISOString().split("T")[0],l=`${s}__${a}`;t[l]||(t[l]={key:s,date:a,flatName:e.flatName,entries:[]}),t[l].entries.push(e)}),Object.values(t).sort((e,t)=>new Date(t.date).getTime()-new Date(e.date).getTime())},[d]);(0,c.useEffect)(()=>{e.length&&i.initialize(e)},[i,e]);let u=(0,c.useMemo)(()=>d.reduce((e,t)=>e+t.obs.length,0),[d]),h=(0,c.useMemo)(()=>_?d.reduce((e,t)=>t.flatNames.some(e=>r.includes(e))?e+t.obs.length:e,0):u,[_,r,d,u]);return(0,o.jsx)(U.Provider,{value:{...a,timelineData:m,tableData:p,trendlineData:null,activeTests:r,someChecked:_,totalResultsCount:u,filteredResultsCount:h,isLoading:t,initialize:i.initialize,toggleVal:i.toggleVal,updateParent:i.updateParent,resetTree:i.resetTree},children:s})},B={filterSetContent:"-esm-patient-tests__filter-set__filterSetContent___+Yurf",treeNodeHeader:"-esm-patient-tests__filter-set__treeNodeHeader___80akr",nestedAccordion:"-esm-patient-tests__filter-set__nestedAccordion___AjLtg",treeNodeHeaderTablet:"-esm-patient-tests__filter-set__treeNodeHeaderTablet___kwuvR",nestedAccordionTablet:"-esm-patient-tests__filter-set__nestedAccordionTablet___ooXaJ",filterItem:"-esm-patient-tests__filter-set__filterItem___02zdB"},P=({root:e,itemNumber:t})=>{let s=(0,l.useConfig)(),{t:a}=(0,u.useTranslation)(),n="tablet"===(0,l.useLayoutType)(),[i,r]=(0,c.useState)(void 0);if(!e.subSets)return;let _=e.subSets.map((e,a)=>e?.obs&&Array.isArray(e.obs)&&e.obs.length>0?(0,o.jsx)("div",{children:(0,o.jsx)(G,{leaf:e})},a):e?.subSets&&Array.isArray(e.subSets)?(0,o.jsx)("div",{children:(0,o.jsx)($,{root:e,level:0,open:void 0===i?s?.resultsViewerConcepts?.[t]?.defaultOpen:i})},a):(0,o.jsx)("div",{children:(0,o.jsx)(G,{leaf:e})},a)),d=e.subSets&&e.subSets.length>0;return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:p()(B.treeNodeHeader,{[B.treeNodeHeaderTablet]:n}),children:[(0,o.jsx)("h5",{children:a(e.display)}),d&&(0,o.jsx)(h.Button,{className:B.button,kind:"ghost",size:n?"md":"sm",onClick:()=>r(e=>!e),children:(0,o.jsx)("span",{children:i?a("collapseAll","Collapse all"):a("expandAll","Expand all")})})]}),_]})},$=({root:e,level:t,open:s})=>{let a,n="tablet"===(0,l.useLayoutType)(),{checkboxes:i,parents:r,updateParent:_,toggleVal:d}=(0,c.useContext)(U),m=(a=r[e.flatName],a&&!a?.every(e=>i[e])&&!a?.every(e=>!i[e])),p=r[e.flatName]?.every(e=>i[e]),u=r[e.flatName]&&r[e.flatName].length>0;return(0,o.jsx)(h.Accordion,{align:"start",size:n?"md":"sm",children:(0,o.jsx)(h.AccordionItem,{disabled:!e.hasData,title:(0,o.jsx)(h.Checkbox,{id:e?.flatName,checked:e.hasData&&(u?p:i[e.flatName]),indeterminate:!!u&&m,labelText:e?.display,onChange:()=>u?_(e.flatName):d(e.flatName),disabled:!e.hasData}),style:{paddingLeft:`${+(t>0)}rem`},open:s??!1,children:e?.obs&&Array.isArray(e.obs)&&e.obs.length>0?(0,o.jsx)(G,{leaf:e}):e?.subSets&&Array.isArray(e.subSets)&&e.subSets.length>0?e.subSets.map((e,s)=>e?.obs&&Array.isArray(e.obs)&&e.obs.length>0?(0,o.jsx)(G,{leaf:e},s):e?.subSets&&Array.isArray(e.subSets)&&e.subSets.length>0?(0,o.jsx)($,{root:e,level:t+1},s):(0,o.jsx)(G,{leaf:e},s)):(0,o.jsx)("div",{})})})},G=({leaf:e})=>{let{checkboxes:t,toggleVal:s}=(0,c.useContext)(U);return(0,o.jsx)("div",{className:B.filterItem,children:(0,o.jsx)(h.Checkbox,{id:e?.flatName,labelText:e?.display,checked:t?.[e.flatName],onChange:()=>s(e.flatName),disabled:!e.hasData})})},W=()=>{let{roots:e}=(0,c.useContext)(U),t=(0,l.useConfig)(),[s,a]=(0,c.useState)(""),[n,i]=(0,c.useState)(e);return(0,c.useEffect)(()=>{let a=t?.resultsViewerConcepts?.map(e=>e.conceptUuid)??[];i(e.filter(e=>{if(!e.subSets||!Array.isArray(e.subSets))return!1;let t=!!(e.conceptUuid&&a.includes(e.conceptUuid))||(e.subSets?.some(e=>e.conceptUuid&&a.includes(e.conceptUuid))??!1);return(0!==e.subSets.length||!!t)&&function e(t,s){if(!s)return!1;let a=s.display.toLowerCase().includes(t.toLowerCase()),l=s.subSets?.some(s=>e(t,s))??!1;return a||l}(s,e)}))},[s,e,t]),(0,o.jsx)("div",{className:B.filterSetContent,children:n?.length>0?n?.map((e,t)=>(0,o.jsx)("div",{className:`${B.nestedAccordion} ${B.nestedAccordionTablet}`,children:(0,o.jsx)(P,{root:e,itemNumber:t})},`filter-node-${t}`)):(0,o.jsx)(R,{clearFilter:()=>a("")})})},Y=({dataColumns:e,style:t={},padding:s=!1,...a})=>(0,o.jsx)("div",{style:{...t,gridTemplateColumns:`${s?"9rem ":""} repeat(${e}, minmax(8rem, 1fr))`,overflow:"hidden",width:"100%",minWidth:"100%"},className:"-esm-patient-tests__grid__grid___W5COR",...a});var V=s(5365);let q={timelineDataContainer:"-esm-patient-tests__grouped-timeline__timelineDataContainer___d1vR3",grid:"-esm-patient-tests__grouped-timeline__grid___G1-60",dayColumn:"-esm-patient-tests__grouped-timeline__dayColumn___-Ic2O",yearColumn:"-esm-patient-tests__grouped-timeline__yearColumn___j-dTd",timeColumn:"-esm-patient-tests__grouped-timeline__timeColumn___nBsCr",paddedMain:"-esm-patient-tests__grouped-timeline__paddedMain___6LtPO",timelineCell:"-esm-patient-tests__grouped-timeline__timelineCell___M7nQq",rowStartCell:"-esm-patient-tests__grouped-timeline__rowStartCell___WUGuQ",timelineDataCell:"-esm-patient-tests__grouped-timeline__timelineDataCell___Jl24u",gridContainer:"-esm-patient-tests__grouped-timeline__gridContainer___MFu+d",timelineCellZebra:"-esm-patient-tests__grouped-timeline__timelineCellZebra___Upzu0",dateHeaderInner:"-esm-patient-tests__grouped-timeline__dateHeaderInner___J0TJ9",timeSlotInner:"-esm-patient-tests__grouped-timeline__timeSlotInner___VzbS0",cornerGridElement:"-esm-patient-tests__grouped-timeline__cornerGridElement___YI6Ov",panelHeader:"-esm-patient-tests__grouped-timeline__panelHeader___22rTs",panelHeaderOverlay:"-esm-patient-tests__grouped-timeline__panelHeaderOverlay___2+dfX",panelNameText:"-esm-patient-tests__grouped-timeline__panelNameText___IkNm-",shadow:"-esm-patient-tests__grouped-timeline__shadow___aMDgg",trendlineLink:"-esm-patient-tests__grouped-timeline__trendlineLink___c0SXD","trendline-link-view":"-esm-patient-tests__grouped-timeline__trendline-link-view___ylBku",rangeUnits:"-esm-patient-tests__grouped-timeline__rangeUnits___IEMOb",offScaleHigh:"-esm-patient-tests__grouped-timeline__offScaleHigh___hTGFb",offScaleLow:"-esm-patient-tests__grouped-timeline__offScaleLow___+s20X",criticallyHigh:"-esm-patient-tests__grouped-timeline__criticallyHigh___037xI",criticallyLow:"-esm-patient-tests__grouped-timeline__criticallyLow___TUihK",high:"-esm-patient-tests__grouped-timeline__high___s-FHL",low:"-esm-patient-tests__grouped-timeline__low___RSw-b",shadowBox:"-esm-patient-tests__grouped-timeline__shadowBox___eLF-a"},Z=()=>(0,o.jsx)("div",{className:q["shadow-box"]}),J=({children:e,className:t,...s})=>(0,o.jsx)("div",{className:p()(q.timeSlotInner,t),...s,children:e}),X=({panelName:e,panelDates:t,inOverlay:s})=>(0,o.jsx)("div",{className:p()(q.panelHeader,{[q.panelHeaderOverlay]:s}),"data-panel-name":e,children:(0,o.jsx)("div",{className:q.dateHeaderContainer,children:(0,o.jsx)("div",{className:q.dateHeaderInner,style:{overflowX:"auto"},children:(0,o.jsxs)(Y,{dataColumns:t.timeColumns.length,padding:!0,style:{gridTemplateRows:"repeat(3, 24px)",zIndex:1,boxShadow:"8px 0 20px 0 rgba(0,0,0,0.15)"},children:[(0,o.jsx)(J,{className:p()(q.cornerGridElement,q.shadow,q.panelNameText),children:e}),t.yearColumns.map(({year:e,size:t})=>(0,o.jsx)(J,{className:q.yearColumn,style:{gridColumn:`${t} span`},children:e},e)),t.dayColumns.map(({day:e,year:t,size:s})=>(0,o.jsx)(J,{className:q.dayColumn,style:{gridColumn:`${s} span`},children:e},`${e} - ${t}`)),t.timeColumns.map((e,t)=>(0,o.jsx)(J,{className:q.timeColumn,children:e},e+t))]})})})}),K=({title:e,range:t,units:s,conceptUuid:a,patientUuid:n,shadow:i=!1,isString:r=!1,zebra:_=!1})=>{let d=(0,c.useCallback)(()=>{let t=(0,l.showModal)("timeline-results-modal",{closeDeleteModal:()=>t(),patientUuid:n,testUuid:a,title:e})},[n,a,e]),m=(0,g.Mi)(t,s);return(0,o.jsxs)("div",{className:p()(q.rowStartCell,{[q.timelineCellZebra]:_}),style:{boxShadow:i?"8px 0 20px 0 rgba(0,0,0,0.15)":void 0},children:[(0,o.jsx)("span",{className:q["trendline-link"],children:r?(0,o.jsx)("span",{className:q.trendlineLink,children:e}):(0,o.jsx)("span",{className:q["trendline-link-view"],onClick:d,children:e})}),(0,o.jsx)("span",{className:q.rangeUnits,children:m})]})},Q={OFF_SCALE_HIGH:"offScaleHigh",CRITICALLY_HIGH:"criticallyHigh",HIGH:"high",OFF_SCALE_LOW:"offScaleLow",CRITICALLY_LOW:"criticallyLow",LOW:"low",NORMAL:""},ee=({text:e,interpretation:t="NORMAL",zebra:s})=>{let a=Q[t]?q[Q[t]]:"";return(0,o.jsx)("div",{className:p()(q.timelineDataCell,{[q.timelineCellZebra]:s},a),children:(0,o.jsx)("p",{children:e})})},et=d().memo(({sortedTimes:e,obs:t,zebra:s})=>(0,o.jsx)(o.Fragment,{children:e.map((e,a)=>{let l=t.find(t=>t?.obsDatetime===e);return l?(0,o.jsx)(ee,{text:l.value,interpretation:l.interpretation,zebra:s},a):(0,o.jsx)(ee,{text:"",zebra:s},a)})})),es=({patientUuid:e,timeColumns:t,rowData:s,sortedTimes:a,showShadow:l})=>(0,o.jsx)(Y,{dataColumns:t.length,padding:!0,style:{gridColumn:"span 2"},children:s.map((t,s)=>{let n=t.entries,{obs:i}=t,r=isNaN(parseFloat(i?.[0]?.value)),_=(0,g.qE)(t.entries),c=_?.range??t.range??"",m=t.units??"";return(0,o.jsxs)(d().Fragment,{children:[(0,o.jsx)(K,{units:m,range:c,title:t.display,shadow:l,conceptUuid:t.conceptUuid,patientUuid:e,isString:r,zebra:!!(s%2)}),(0,o.jsx)(et,{sortedTimes:a,obs:n,zebra:!!(s%2)})]},s)})});function ea({patientUuid:e,parent:t,subRows:s,xScroll:a,setXScroll:l,inOverlay:n}){let i=(0,c.useMemo)(()=>{let e=[...new Set(s.filter(e=>e?.entries&&Array.isArray(e.entries)).map(e=>e.entries.filter(e=>e).map(e=>e.obsDatetime)).flat())];e.sort((e,t)=>new Date(t).getTime()-new Date(e).getTime());let t=[],a=[],l=[];return e.forEach(e=>{let s=new Date(e),n=s.getFullYear().toString(),i=s.toLocaleDateString("en-US",{month:"short",day:"numeric"}),r=s.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),_=t.find(({year:e})=>n===e);_?_.size++:t.push({year:n,size:1});let o=a.find(({year:e,day:t})=>i===t&&n===e);o?o.size++:a.push({day:i,year:n,size:1}),l.push(r)}),{yearColumns:t,dayColumns:a,timeColumns:l,sortedTimes:e}},[s]),r=(0,c.useRef)(),_=r.current;return _&&(_.scrollLeft=a),(0,c.useEffect)(()=>{let e=(0,V.Fc)(e=>{l(e.target.scrollLeft)},200),t=r.current;if(t)return t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)},[l]),(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{children:[(0,o.jsx)(X,{panelName:t.display,panelDates:i,inOverlay:n}),(0,o.jsxs)("div",{className:q.gridContainer,ref:r,children:[(0,o.jsx)(es,{patientUuid:e,rowData:s,showShadow:!!a,sortedTimes:i.sortedTimes,timeColumns:i.timeColumns}),(0,o.jsx)(Z,{})]})]})})}var el=s(682),en=s.n(el);let ei=(e,t)=>{let s=JSON.parse(JSON.stringify(e));return t&&"Bloodwork"!==t?s.flatName=`${t.trim()}-${e.display.trim()}`:s.flatName=e.display.trim(),s.hasData=!1,s?.subSets?.length&&(s.subSets=s.subSets.map(e=>ei(e,s.flatName)),s.hasData=s.subSets.some(e=>e.hasData)),(0,b.qU)(s?.hiNormal,s?.lowNormal)&&(s.range=(0,g.ys)({lowNormal:s.lowNormal,hiNormal:s.hiNormal,units:s.units},s.units)),s?.obs?.length&&(s.obs=s.obs.map(e=>{let t=void 0!==e.lowNormal||void 0!==e.hiNormal?{hiAbsolute:e.hiAbsolute,hiCritical:e.hiCritical,hiNormal:e.hiNormal,lowAbsolute:e.lowAbsolute,lowCritical:e.lowCritical,lowNormal:e.lowNormal}:void 0,a={hiAbsolute:s.hiAbsolute,hiCritical:s.hiCritical,hiNormal:s.hiNormal,lowAbsolute:s.lowAbsolute,lowCritical:s.lowCritical,lowNormal:s.lowNormal,units:s.units},l=(0,g.Tq)(t,a),n=l?(0,b.EF)(l):(0,b.EF)(a),i=e.interpretation??n(e.value),r=t?(0,g.ys)(t,s.units):s.range||"--";return{...e,interpretation:i,range:r}}),s.hasData=!0),{...s}},er=e=>{if(void 0!==e.obs)return e.hasData?e:null;if(e.subSets&&e.subSets.length>0){let t=e.subSets.map(e=>er(e)).filter(e=>null!==e);return{...e,subSets:t}}return e},e_=(e,t)=>{let{data:s,error:a}=en()(s=>s<t.length&&e?`${l.restBaseUrl}/obstree?patient=${e}&concept=${t[s]}`:null,l.openmrsFetch,{initialSize:t.length,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!0}),n=(0,c.useMemo)(()=>s?.map((e,s)=>{if(!e?.data)return{data:{},error:!1,loading:!0};{let{data:a,...l}=e,n=ei(a,"");return s<t.length&&n&&(n.conceptUuid=t[s]),{...l,loading:!1,data:n}}})||[{data:{},error:!1,loading:!0}],[s,t]);return{roots:n.map(e=>e.data).filter(e=>"display"in e).map(e=>er(e)).filter(Boolean),isLoading:n.some(e=>e.loading),error:a}},eo=({patientUuid:e})=>{let{t}=(0,u.useTranslation)(),{activeTests:s,timelineData:a,tableData:l}=(0,c.useContext)(U),[i,r]=(0,c.useState)(0),{data:{rowData:_},loaded:d}=a;return _&&_?.length===0?(0,o.jsx)(n.EmptyState,{displayText:t("data","data"),headerTitle:t("dataTimelineText","Data timeline")}):s&&a&&d&&l?(0,o.jsx)("div",{className:q.timelineDataContainer,children:l.map((t,s)=>{let a=new Set(t.entries.flatMap(e=>[...e.flatNames??[],e.flatName])),l=_?.filter(e=>a.has(e.flatName));return l?.length>0&&(0,o.jsx)("div",{children:(0,o.jsx)(ea,{groupNumber:s+1,parent:{display:t.key,flatName:t.key},patientUuid:e,setXScroll:r,subRows:l,xScroll:i})},s)})}):null};var ec=s(4863),ed=s(7995);let em=({panel:e,activePanel:t,setActivePanel:s})=>{let{t:a}=(0,u.useTranslation)(),n=e.entries[0]?.obsDatetime?(0,l.parseDate)(e.entries[0].obsDatetime):new Date(e.date),i=(0,l.useLayoutType)(),r=e=>ed.A[`col-${e}`],_=e.entries.some(e=>e.range),d=(0,c.useMemo)(()=>_?[{id:"testName",key:"testName",header:a("testName","Test name")},{id:"resultDate",key:"resultDate",header:a("resultDate","Result date")},{id:"value",key:"value",header:a("value","Value")},{id:"referenceRange",key:"referenceRange",header:a("referenceRange","Reference range")}]:[{id:"testName",key:"testName",header:a("testName","Test name")},{id:"resultDate",key:"resultDate",header:a("resultDate","Result date")},{id:"value",key:"value",header:a("value","Value")}],[a,_]),m=(0,c.useMemo)(()=>_?e.entries.map(e=>{let t=e.units??"",s=(0,g.Mi)(e.range,t);return{id:e.conceptUuid,testName:e.display,resultDate:(0,V.rI)(e.obsDatetime),value:{content:(0,o.jsx)("span",{children:`${e.value} ${t}`})},interpretation:e.interpretation,referenceRange:s}}):e.entries.map(e=>{let t=e.units??"";return{id:e.conceptUuid,testName:e.display,resultDate:(0,V.rI)(e.obsDatetime),value:{content:(0,o.jsx)("span",{children:`${e.value} ${t}`})},interpretation:e.interpretation}}),[e,_]);return(0,o.jsx)(h.Layer,{className:p()(ed.A.labSetPanel,{[ed.A.activePanel]:t?.key===e.key}),children:(0,o.jsxs)("div",{onClick:()=>s(e),role:"button",tabIndex:0,children:[(0,o.jsxs)("div",{className:ed.A.panelHeader,children:[(0,o.jsx)("h2",{className:ed.A.productiveHeading02,children:e.key}),(0,o.jsx)("p",{className:ed.A.subtitleText,children:(0,l.formatDate)(n,{mode:"wide",time:!0})})]}),(0,o.jsx)(h.DataTable,{rows:m,headers:d,useZebraStyles:!0,children:({rows:e,headers:t,getHeaderProps:s,getTableProps:a})=>(0,o.jsx)(h.TableContainer,{children:(0,o.jsxs)(h.Table,{className:p()(ed.A.table,_?ed.A.tableWithRange:ed.A.tableWithoutRange),...a(),size:(0,l.isDesktop)(i)?"sm":"md",children:[(0,o.jsx)(h.TableHead,{children:(0,o.jsx)(h.TableRow,{children:t.map(e=>{let t=s({header:e});return(0,o.jsx)(h.TableHeader,{...t,className:p()(t.className,r(e.key)),children:e.header})})})}),(0,o.jsx)(h.TableBody,{children:e.map((e,t)=>(0,o.jsx)(h.TableRow,{className:(0,ec.t0)(m[t]?.interpretation),children:e.cells.map(e=>(0,o.jsx)(h.TableCell,{className:r(e.info.header),children:e?.value?.content??e.value},e.id))},e.id))})]})})})]})})},ep=({close:e,children:t,headerText:s,buttonsGroup:a})=>{let{t:n}=(0,u.useTranslation)();return(0,o.jsxs)("div",{className:"-esm-patient-tests__tablet-overlay__tabletOverlay___4JwF+",children:[(0,o.jsxs)(h.Header,{"aria-label":"string"==typeof s?s:"",className:"-esm-patient-tests__tablet-overlay__tabletOverlayHeader___nKvFG",children:[(0,o.jsx)(h.IconButton,{className:"-esm-patient-tests__tablet-overlay__backButton___cOSCX",label:n("back","Back"),onClick:e,children:(0,o.jsx)(l.ArrowLeftIcon,{size:16})}),(0,o.jsx)("div",{className:"-esm-patient-tests__tablet-overlay__headerContent___6aJXi",children:s})]}),(0,o.jsx)("div",{className:"-esm-patient-tests__tablet-overlay__overlayContent___EIJLe",children:t}),(0,o.jsx)("div",{className:"-esm-patient-tests__tablet-overlay__buttonsGroup___OxhPf",children:a})]})},eu={panelViewHeader:"-esm-patient-tests__individual-results-table-tablet__panelViewHeader___yPb6N",flex:"-esm-patient-tests__individual-results-table-tablet__flex___cfx4u",productiveHeading02:"-esm-patient-tests__individual-results-table-tablet__productiveHeading02___xzZKS",stickySection:"-esm-patient-tests__individual-results-table-tablet__stickySection___9sWjf",headerMargin:"-esm-patient-tests__individual-results-table-tablet__headerMargin___-T1K9",headerMarginTablet:"-esm-patient-tests__individual-results-table-tablet__headerMarginTablet___ZM4nV",clearButton:"-esm-patient-tests__individual-results-table-tablet__clearButton___vdSQp",leftSection:"-esm-patient-tests__individual-results-table-tablet__leftSection___rT9TJ",rightSection:"-esm-patient-tests__individual-results-table-tablet__rightSection___NSWbq",rightSectionHeader:"-esm-patient-tests__individual-results-table-tablet__rightSectionHeader___pyexA",fullView:"-esm-patient-tests__individual-results-table-tablet__fullView___xn48e",flexBaseline:"-esm-patient-tests__individual-results-table-tablet__flexBaseline___nwtLz",overlay:"-esm-patient-tests__individual-results-table-tablet__overlay___Nx5bb"},eh=({isTablet:e,searchTerm:t,setSearchTerm:s,totalSearchResults:a})=>{let{t:n}=(0,u.useTranslation)(),[i,r]=(0,c.useState)(!1),[_,d]=(0,c.useState)(t),m=(0,c.useCallback)(()=>{r(e=>!e)},[r]),f=(0,c.useCallback)(e=>{e.preventDefault(),s(_),m()},[_,s,m]),b=(0,c.useCallback)(()=>{s(""),d("")},[s,d]);return(0,o.jsx)("div",{className:eu.panelViewHeader,children:i?e?(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(ep,{close:m,headerText:n("search","Search"),children:(0,o.jsxs)(h.Form,{onSubmit:f,className:p()(eu.flex),children:[(0,o.jsx)(h.Search,{autoFocus:!0,labelText:n("searchByTestName","Search by test name"),onChange:e=>d(e.target.value),placeholder:n("searchByTestName","Search by test name"),size:"lg",value:_}),(0,o.jsx)(h.Button,{"data-testid":"execute-search-button",kind:"secondary",onClick:()=>f(null),children:n("search","Search")})]})})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(h.Form,{onSubmit:f,className:eu.flexBaseline,children:[(0,o.jsx)(h.Search,{autoFocus:!0,labelText:n("searchByTestName","Search by test name"),onChange:e=>d(e.target.value),placeholder:n("searchByTestName","Search by test name"),size:"sm",value:_}),(0,o.jsx)(h.Button,{"data-testid":"execute-search-button",kind:"secondary",size:"sm",onClick:()=>f(null),children:n("search","Search")})]}),(0,o.jsx)(h.Button,{hasIconOnly:!0,renderIcon:l.CloseIcon,iconDescription:n("closeSearchBar","Close search"),onClick:m,size:"sm",kind:"ghost"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:eu.flexBaseline,children:[t&&a>0&&(0,o.jsx)("h4",{className:eu.heading,children:n("searchResultsTextFor","{{count}} search results for {{searchTerm}}",{searchTerm:t,count:a})}),t?(0,o.jsx)(h.Button,{className:eu.clearButton,kind:"ghost",size:e?"md":"sm",onClick:b,children:n("clear","Clear")}):null]}),(0,o.jsx)(h.Button,{"data-testid":"toggle-search-button",kind:"ghost",size:e?"md":"sm",renderIcon:l.SearchIcon,onClick:m,children:n("search","Search")})]})})},ef=({expanded:e,patientUuid:t})=>{let{t:s}=(0,u.useTranslation)(),a=(0,l.useLayoutType)(),i="tablet"===a,[r,_]=(0,c.useState)(""),[d,m]=(0,c.useState)(null),{tableData:f,timelineData:b,lowestParents:g,isLoading:x}=(0,c.useContext)(U),v=(0,c.useMemo)(()=>d?d.entries.map(e=>b.data.rowData.filter(t=>t.flatName==e.flatName)).flat():[],[b,d]),y=(0,c.useMemo)(()=>d?g.find(e=>e.display==d.key):null,[g,d]),w=(0,c.useMemo)(()=>r?f?.filter(e=>e.flatName.toLowerCase().includes(r.toLowerCase())||e.entries.some(e=>e.display.toLowerCase().includes(r.toLowerCase()))):f,[f,r]);return((0,c.useEffect)(()=>{"tablet"!==a&&w?.length&&m(w[0])},[w,a]),i)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{children:[(0,o.jsx)(eh,{isTablet:i,setSearchTerm:_,searchTerm:r,totalSearchResults:w?.length??0}),x?(0,o.jsx)(h.DataTableSkeleton,{"data-testid":"cds--data-table-container"}):f?.length>0?w?.length?w.map(e=>(0,o.jsx)(em,{panel:e,setActivePanel:m,activePanel:d},e.key)):(0,o.jsx)(R,{clearFilter:()=>_("")}):(0,o.jsx)(n.EmptyState,{displayText:s("panels","panels"),headerTitle:s("noPanelsFound","No panels found")})]}),d?(0,o.jsx)(ep,{close:()=>m(null),headerText:d?.key,children:(0,o.jsx)("div",{className:eu.overlay,children:(0,o.jsx)(ea,{groupNumber:1,inOverlay:!0,parent:y,patientUuid:t,setXScroll:()=>{},subRows:v,xScroll:0})})}):null]}):(0,o.jsxs)(o.Fragment,{children:[e?null:(0,o.jsx)("div",{className:eu.leftSection,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(eh,{isTablet:i,setSearchTerm:_,searchTerm:r,totalSearchResults:w?.length??0}),x?(0,o.jsx)(h.DataTableSkeleton,{"data-testid":"cds--data-table-container"}):f?.length>0?w?.length?w.map(e=>(0,o.jsx)(em,{panel:e,activePanel:d,setActivePanel:m},e.key)):(0,o.jsx)(R,{clearFilter:()=>_("")}):(0,o.jsx)(n.EmptyState,{displayText:s("panels","panels"),headerTitle:s("noPanelsFound","No panels found")})]})}),(0,o.jsx)("div",{className:p()(eu.headerMargin,eu.rightSection,e?eu.fullView:eu.splitView),children:(0,o.jsx)("div",{className:eu.stickySection,children:x?(0,o.jsx)(h.DataTableSkeleton,{"data-testid":"cds--data-table-container"}):d?(0,o.jsx)("div",{className:eu.overlay,children:(0,o.jsx)(ea,{patientUuid:t,parent:y,subRows:v,groupNumber:1,xScroll:0,setXScroll:()=>{}})}):null})})]})},eb={table:"-esm-patient-tests__individual-results-table__table___QxP12","off-scale-high":"-esm-patient-tests__individual-results-table__off-scale-high___CFZfi","off-scale-low":"-esm-patient-tests__individual-results-table__off-scale-low___N4ZtL","critically-high":"-esm-patient-tests__individual-results-table__critically-high___i7dml","critically-low":"-esm-patient-tests__individual-results-table__critically-low___xN1El",high:"-esm-patient-tests__individual-results-table__high___LN+tA",low:"-esm-patient-tests__individual-results-table__low___bMqg5","trendline-link-view":"-esm-patient-tests__individual-results-table__trendline-link-view___q4ZKL",resultType:"-esm-patient-tests__individual-results-table__resultType___w19-e",date:"-esm-patient-tests__individual-results-table__date___dK7xc",displayFlex:"-esm-patient-tests__individual-results-table__displayFlex___0boOT",cardTitle:"-esm-patient-tests__individual-results-table__cardTitle___DANSg",tableContainer:"-esm-patient-tests__individual-results-table__tableContainer___lrytE","col-testName":"-esm-patient-tests__individual-results-table__col-testName___wmcKX","col-resultDate":"-esm-patient-tests__individual-results-table__col-resultDate___7bHot","col-value":"-esm-patient-tests__individual-results-table__col-value___zwzJl","col-referenceRange":"-esm-patient-tests__individual-results-table__col-referenceRange___kY2v-"},eg=({patientUuid:e,isLoading:t,subRows:s,index:a,title:n})=>{let{t:i}=(0,u.useTranslation)(),r=(0,l.useLayoutType)(),_="small-desktop"===r||"large-desktop"===r,d=e=>eb[`col-${e}`],m=i(n),f=(0,c.useCallback)((t,s)=>{let a=(0,l.showModal)("timeline-results-modal",{closeDeleteModal:()=>a(),patientUuid:e,testUuid:s,title:t})},[e]),b=(0,c.useMemo)(()=>[{key:"testName",header:i("testName","Test name")},{key:"resultDate",header:i("resultDate","Result date")},{key:"value",header:i("value","Value")},{key:"referenceRange",header:i("referenceRange","Reference range")}],[i]),x=(0,c.useMemo)(()=>s?.entries?.map((e,t)=>{let s=e.range??"",l=e.units??"",n=isNaN(parseFloat(e.value)),i=(0,g.Mi)(s,l);return{...e,id:`${t}-${a}`,testName:(0,o.jsx)("span",{className:eb["trendline-link"],children:n?(0,o.jsx)("span",{className:eb.trendlineLink,children:e.display}):(0,o.jsx)("span",{className:eb["trendline-link-view"],onClick:()=>f(e.display,e.conceptUuid),children:e.display})}),resultDate:(0,V.rI)(e.obsDatetime),value:{value:`${e.value} ${l}`,interpretation:e?.interpretation},referenceRange:i}})??[],[a,s,f]);return t?(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar",compact:_,zebra:!0}):s.entries?.length?(0,o.jsx)(h.DataTable,{rows:x,headers:b,"data-floating-menu-container":!0,useZebraStyles:!0,children:({rows:e,headers:t,getHeaderProps:a,getTableProps:n})=>(0,o.jsxs)(h.TableContainer,{children:[(0,o.jsxs)("div",{className:eb.cardTitle,children:[(0,o.jsx)("h4",{className:eb.resultType,children:m}),(0,o.jsx)("div",{className:eb.displayFlex,children:(0,o.jsx)("span",{className:eb.date,children:(0,l.formatDate)((0,l.parseDate)(s.date),{mode:"standard",time:!1})})})]}),(0,o.jsxs)(h.Table,{className:eb.table,...n(),size:_?"md":"sm",children:[(0,o.jsx)(h.TableHead,{children:(0,o.jsx)(h.TableRow,{children:t.map(e=>{let t=a({header:e});return(0,o.jsx)(h.TableHeader,{...t,className:p()(t.className,d(e.key)),children:e.header})})})}),(0,o.jsx)(h.TableBody,{children:e.map(e=>(0,o.jsx)(h.TableRow,{children:e.cells.map(e=>e?.value?.interpretation?(0,o.jsx)(h.TableCell,{className:p()((e=>{switch(e){case"OFF_SCALE_HIGH":return eb["off-scale-high"];case"CRITICALLY_HIGH":return eb["critically-high"];case"HIGH":return eb.high;case"OFF_SCALE_LOW":return eb["off-scale-low"];case"CRITICALLY_LOW":return eb["critically-low"];case"LOW":return eb.low;default:return""}})(e?.value?.interpretation),d(e.info.header)),children:(0,o.jsx)("p",{children:e?.value?.value??e?.value})},e.id):(0,o.jsx)(h.TableCell,{className:d(e.info.header),children:(0,o.jsx)("p",{children:e?.value})},e.id))},e.id))})]})]})}):void 0},ex={overlay:"-esm-patient-tests__results-viewer__overlay___9L-px",resultsContainer:"-esm-patient-tests__results-viewer__resultsContainer___dm+6G",flex:"-esm-patient-tests__results-viewer__flex___LOFzH",resultsHeaderTablet:"-esm-patient-tests__results-viewer__resultsHeaderTablet___7zISI",resultsHeader:"-esm-patient-tests__results-viewer__resultsHeader___9cgzt",resultsHeaderScrolled:"-esm-patient-tests__results-viewer__resultsHeaderScrolled___zdOJt",headerSentinel:"-esm-patient-tests__results-viewer__headerSentinel___PHFQo",leftHeaderSection:"-esm-patient-tests__results-viewer__leftHeaderSection___lsd4N",viewOptsContentSwitcherContainer:"-esm-patient-tests__results-viewer__viewOptsContentSwitcherContainer___aKsnX",viewOptionsText:"-esm-patient-tests__results-viewer__viewOptionsText___XhhP4",contentSwitcherLabel:"-esm-patient-tests__results-viewer__contentSwitcherLabel___0vHXD",viewOptionsSwitcher:"-esm-patient-tests__results-viewer__viewOptionsSwitcher___eJYlw",leftSection:"-esm-patient-tests__results-viewer__leftSection___tJ9NK",rightSection:"-esm-patient-tests__results-viewer__rightSection___eRaIZ",rightSectionHeader:"-esm-patient-tests__results-viewer__rightSectionHeader___4gM2J",fullView:"-esm-patient-tests__results-viewer__fullView___31eTV",leftHeaderActions:"-esm-patient-tests__results-viewer__leftHeaderActions___4QAVe",trendlineOverlayHeader:"-esm-patient-tests__results-viewer__trendlineOverlayHeader___9Ix-d",trendlineOverlayHeaderTitle:"-esm-patient-tests__results-viewer__trendlineOverlayHeaderTitle___hqbMp",trendlineOverlayHeaderReferenceRange:"-esm-patient-tests__results-viewer__trendlineOverlayHeaderReferenceRange___L5W7O",filterSetHeader:"-esm-patient-tests__results-viewer__filterSetHeader___grd85",filterSetActions:"-esm-patient-tests__results-viewer__filterSetActions___VyOyy",floatingTreeButton:"-esm-patient-tests__results-viewer__floatingTreeButton___OOeS+",panelViewTimeline:"-esm-patient-tests__results-viewer__panelViewTimeline___PSSB4",border:"-esm-patient-tests__results-viewer__border___NiLpF",groupPanelsTables:"-esm-patient-tests__results-viewer__groupPanelsTables___3uffy",buttonsContainer:"-esm-patient-tests__results-viewer__buttonsContainer___EocB3",button:"-esm-patient-tests__results-viewer__button___3YqMq"},ev=({className:e,loadingPanelData:t,patientUuid:s})=>{let{t:a}=(0,u.useTranslation)(),{checkboxes:l,someChecked:i,tableData:r}=(0,c.useContext)(U),_=Object.keys(l).filter(e=>l[e]),d=(e,t)=>(e.flatNames??[e.flatName]).includes(t)||e.key===t,m=(0,c.useMemo)(()=>r?.filter(e=>!i||e.entries&&Array.isArray(e.entries)&&e.entries.some(e=>_.some(t=>d(e,t)))).map((e,t)=>({...e,entries:e.entries&&Array.isArray(e.entries)?e.entries.filter(e=>!i||_.some(t=>d(e,t))):[]})),[r,i,_]);return r?.length?(0,o.jsx)(h.Layer,{className:e,children:m.map((e,a)=>e.entries?.length>0?(0,o.jsx)("div",{className:p()({[ex.border]:e?.entries.length}),children:(0,o.jsx)(eg,{patientUuid:s,isLoading:t,subRows:e,index:a,title:e.key})},a):null)}):(0,o.jsx)(n.EmptyState,{displayText:a("data","data"),headerTitle:a("dataTimelineText","Data timeline")})},ey=({patientUuid:e,expanded:t,view:s})=>{let{t:a}=(0,u.useTranslation)(),i="tablet"===(0,l.useLayoutType)(),[r,_]=(0,c.useState)(!1),d=(0,l.useConfig)(),{roots:m,error:f}=e_(e,d?.resultsViewerConcepts?.map(e=>e.conceptUuid)??[]),{timelineData:b,tableData:g,totalResultsCount:x,filteredResultsCount:v,resetTree:y,isLoading:w}=(0,c.useContext)(U);return f?(0,o.jsx)(n.ErrorState,{error:f,headerTitle:a("dataLoadError","Data Load Error")}):w?(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar"}):m&&0!==m.length?i?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{children:w||"over-time"!==s?"individual-test"===s?(0,o.jsx)(ev,{className:ex.groupPanelsTables,loadingPanelData:w,patientUuid:e}):(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar"}):(0,o.jsx)(eo,{patientUuid:e})}),(0,o.jsx)("div",{className:ex.floatingTreeButton,children:(0,o.jsx)(h.Button,{renderIcon:l.TreeViewAltIcon,hasIconOnly:!0,onClick:()=>_(!0),iconDescription:a("showTree","Show tree")})}),r&&(0,o.jsx)(ep,{headerText:a("tree","Tree"),close:()=>_(!1),buttonsGroup:(0,o.jsxs)("div",{className:ex.overlay,children:[(0,o.jsx)(h.Button,{kind:"secondary",size:"xl",onClick:y,disabled:w,children:a("resetTreeText","Reset tree")}),(0,o.jsx)(h.Button,{kind:"primary",size:"xl",onClick:()=>_(!1),disabled:w,children:`${a("view","View")} ${!w?v:""} ${a("resultsText","results")}`})]}),children:w?(0,o.jsx)(h.AccordionSkeleton,{open:!0,count:4,align:"start"}):(0,o.jsx)(W,{hideFilterSetHeader:!0})})]}):(0,o.jsxs)(o.Fragment,{children:[!t&&(0,o.jsx)("div",{className:ex.leftSection,children:w?(0,o.jsx)(h.AccordionSkeleton,{open:!0,count:4,align:"start"}):(0,o.jsx)(W,{})}),(0,o.jsx)("div",{className:p()(ex.rightSection,t?ex.fullView:ex.splitView),children:w?(0,o.jsx)(h.DataTableSkeleton,{}):"individual-test"===s?g&&g.length>0?(0,o.jsx)("div",{className:ex.panelViewTimeline,children:(0,o.jsx)(ev,{patientUuid:e,className:ex.groupPanelsTables,loadingPanelData:w})}):(0,o.jsx)(ev,{patientUuid:e,className:ex.groupPanelsTables,loadingPanelData:w}):"over-time"===s?(0,o.jsx)(eo,{patientUuid:e}):null})]}):(0,o.jsx)(n.EmptyState,{headerTitle:a("testResults_title","Test Results"),displayText:a("testResultsData","test results data")})},ew=({patientUuid:e})=>{let{t}=(0,u.useTranslation)(),s="tablet"===(0,l.useLayoutType)(),[a,n]=(0,c.useState)("individual-test"),[i,r]=(0,c.useState)("tree"),{totalResultsCount:_,filteredResultsCount:d,resetTree:m,isLoading:f}=(0,c.useContext)(U),b="full"===a,g=s?"lg":"md",[x,v]=(0,c.useState)(!0),y=(0,c.useRef)(null);return((0,c.useEffect)(()=>{let e=new IntersectionObserver(e=>{let[t]=e;v(t.isIntersecting)},{threshold:1,rootMargin:"-1px 0px 0px 0px"}),t=y.current;return t&&e.observe(t),()=>{t&&e.unobserve(t),e.disconnect()}},[]),s)?(0,o.jsxs)("div",{className:ex.resultsContainer,children:[(0,o.jsx)("div",{ref:y,className:ex.headerSentinel}),(0,o.jsxs)("div",{className:p()(ex.resultsHeader,{[ex.resultsHeaderScrolled]:!x}),children:[(0,o.jsx)("h4",{style:{flexGrow:1},children:`${t("results","Results")} ${d?`(${d})`:""}`}),(0,o.jsxs)("div",{className:ex.leftHeaderActions,children:[(0,o.jsx)(ej,{isTablet:s,patientUuid:e,t:t}),(0,o.jsxs)("span",{className:ex.contentSwitcherLabel,children:[t("view","View"),": "]}),(0,o.jsxs)(h.ContentSwitcher,{selectedIndex:["panel","tree"].indexOf(i),onChange:({name:e})=>r(e),size:g,children:[(0,o.jsx)(h.Switch,{name:"panel",children:t("individualTests","Individual tests")}),(0,o.jsx)(h.Switch,{name:"tree",children:t("overTime","Over time")})]})]})]}),"tree"===i?(0,o.jsx)(ey,{patientUuid:e,expanded:b,view:a}):"panel"===i?(0,o.jsx)(ef,{expanded:b,patientUuid:e}):null]}):(0,o.jsxs)("div",{className:ex.resultsContainer,children:[(0,o.jsx)("div",{className:ex.headerSentinel,ref:y}),(0,o.jsxs)("div",{className:p()(ex.resultsHeader,{[ex.resultsHeaderScrolled]:!x}),children:[(0,o.jsxs)("div",{className:p()(ex.leftSection,ex.leftHeaderSection),children:[(0,o.jsx)("h4",{children:t("tests","Tests")}),(0,o.jsx)(h.Button,{className:ex.button,kind:"ghost",onClick:m,size:s?"md":"sm",children:(0,o.jsx)("span",{children:t("reset","Reset")})})]}),(0,o.jsx)("div",{className:ex.rightSectionHeader,children:(0,o.jsxs)("div",{className:ex.viewOptsContentSwitcherContainer,children:[(0,o.jsx)("h4",{className:ex.viewOptionsText,children:`${t("results","Results")} ${d?`(${d})`:""}`}),(0,o.jsxs)("div",{className:ex.buttonsContainer,children:[(0,o.jsx)(ej,{isTablet:s,patientUuid:e,t:t}),(0,o.jsxs)("span",{className:ex.contentSwitcherLabel,children:[t("view","View"),": "]}),(0,o.jsxs)(h.ContentSwitcher,{className:ex.viewOptionsSwitcher,onChange:({name:e})=>n(e),selectedIndex:+!!b,size:g,children:[(0,o.jsx)(h.Switch,{name:"individual-test",disabled:f,children:t("individualTests","Individual tests")}),(0,o.jsx)(h.Switch,{name:"over-time",disabled:f,children:t("overTime","Over time")})]})]})]})})]}),(0,o.jsx)("div",{className:ex.flex,children:(0,o.jsx)(ey,{patientUuid:e,expanded:!1,view:a})})]})};function ej({isTablet:e,patientUuid:t,t:s}){let{cache:a,mutate:n}=(0,O.useSWRConfig)(),[i,r]=(0,c.useState)(!1),_=(0,c.useCallback)(async()=>{r(!0);let e=[];for(let s of a.keys())s.includes(`patient=${t}`)&&(s.includes(`${l.restBaseUrl}/obstree`)||s.includes("/ws/fhir2/R4/Observation"))&&e.push(s);await Promise.allSettled(e.map(e=>n(e))),r(!1)},[a,n,t]);return(0,o.jsx)(h.Button,{className:ex.button,disabled:i,kind:"ghost",onClick:_,renderIcon:l.RenewIcon,size:e?"md":"sm",children:(0,o.jsx)("span",{children:i?s("refreshingData","Refreshing data")+"...":s("refreshData","Refresh data")})})}let eT=({basePath:e,patientUuid:t})=>{let{t:s}=(0,u.useTranslation)(),{roots:a,isLoading:i,error:r}=e_(t,(0,l.useConfig)().resultsViewerConcepts.map(e=>e.conceptUuid)??[]);return r?(0,o.jsx)(n.ErrorState,{error:r,headerTitle:s("dataLoadError","Data Load Error")}):i?(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar"}):a?.length?(0,o.jsx)(z,{roots:a,isLoading:i,children:(0,o.jsx)(ew,{patientUuid:t,basePath:e})}):(0,o.jsx)(n.EmptyState,{headerTitle:s("testResults_title","Test Results"),displayText:s("testResultsData","test results data")})};var eN=s(5571);let eC={featureName:"patient-tests",moduleName:_},eS=s(4767);function eA(){(0,l.defineConfigSchema)(_,i)}let eO=(0,l.getSyncLifecycle)(({patientUuid:e,filter:t})=>{let{t:s}=(0,u.useTranslation)(),{overviewData:a,loaded:i}=function(e,t=()=>!0){let{sortedObs:s,loaded:a,error:l}=(e=>{let[t,s]=(0,c.useState)({sortedObs:{},loaded:!1,error:void 0}),a=(0,c.useRef)(!0);return(0,c.useEffect)(()=>{if(a.current=!0,e){let[t,l]=v(e);t&&a.current&&s({sortedObs:t,loaded:!0,error:void 0}),l.then(e=>{e!==t&&a.current&&s({sortedObs:e,loaded:!0,error:void 0})}).catch(e=>{a.current&&s({sortedObs:{},loaded:!0,error:e})})}return()=>{a.current=!1}},[e]),t})(e);return{overviewData:(0,c.useMemo)(()=>Object.entries(s).flatMap(([e,{entries:t,type:s,uuid:a}])=>t.map(t=>[t,a,s,e])).filter(t).map(([e,t,s,a])=>[a,s,function(e,t,s){if("Test"!==t)return e.members.map(e=>{let t=e.interpretation||"NORMAL";return{id:e.id,key:e.id,name:e.name,range:e.meta?.range||"--",interpretation:t,value:{value:e.value,interpretation:t}}});{let t=e.interpretation||"NORMAL";return[{id:e.id,name:s,range:e.meta?.range||"--",interpretation:t,value:{value:e.value,interpretation:t}}]}}(e,s,a),new Date(e.effectiveDateTime),new Date(e.issued),t]).sort(([,,,e],[,,,t])=>t.getTime()-e.getTime()),[t,s]),loaded:a,error:l}}(e,t),r=s("recentResults","Recent Results"),_=(0,c.useCallback)(()=>{(0,l.navigate)({to:`\${openmrsSpaBase}/patient/${e}/chart/results`})},[e]);return(0,o.jsx)(A,{children:i?(0,o.jsx)(o.Fragment,{children:a.length?(0,o.jsxs)("div",{className:S.widgetCard,children:[(0,o.jsxs)("div",{className:S.externalOverviewHeader,children:[(0,o.jsx)("h4",{className:p()(S.productiveHeading03,S.text02),children:r}),(0,o.jsx)(h.Button,{kind:"ghost",renderIcon:e=>(0,o.jsx)(l.ArrowRightIcon,{size:16,...e}),iconDescription:"See all results",onClick:_,children:s("seeAllResults","See all results")})]}),(0,o.jsx)(C,{patientUuid:e,overviewData:a.slice(0,3)}),a.length>3&&(0,o.jsx)(h.Button,{onClick:_,kind:"ghost",children:s("moreResultsAvailable","More results available")})]}):(0,o.jsx)(n.EmptyState,{headerTitle:r,displayText:s("recentTestResults","recent test results")})}):(0,o.jsx)(h.DataTableSkeleton,{columnCount:3})})},eC),eL=(0,l.getSyncLifecycle)(({basePath:e,patientUuid:t})=>(0,o.jsx)(eN.BrowserRouter,{basename:`${window.getOpenmrsSpaBase()}patient/${t}/chart/${encodeURIComponent(e)}`,children:(0,o.jsxs)(eN.Routes,{children:[(0,o.jsx)(eN.Route,{path:"",element:(0,o.jsx)(eT,{basePath:e,patientUuid:t})}),(0,o.jsx)(eN.Route,{path:":type/:testUuid",element:(0,o.jsx)(eT,{basePath:e,patientUuid:t})})]})}),eC),eR=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("9489"),s.e("7468"),s.e("1630")]).then(s.bind(s,4669)),eC),eI=(0,l.getSyncLifecycle)((0,n.createDashboardLink)({...r._}),eC),eH=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("9837"),s.e("5390")]).then(s.bind(s,6845)),eC),ek=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("781"),s.e("2304"),s.e("9837"),s.e("5528")]).then(s.bind(s,6395)),eC),eD=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("781"),s.e("2304"),s.e("9837"),s.e("5528")]).then(s.bind(s,6395)),eC),eE=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("3538"),s.e("5771")]).then(s.bind(s,5115)),{featureName:"Timeline results",moduleName:_}),eM=(0,l.getAsyncLifecycle)(()=>s.e("9850").then(s.bind(s,2817)),eC)},4989(e,t,s){"use strict";s.d(t,{_:()=>a});let a={slot:"patient-chart-test-results-dashboard-slot",columns:1,path:"results",title:"Results",icon:"omrs-icon-chart-average",hideDashboardTitle:!0}},3886(e,t,s){"use strict";s.d(t,{Mi:()=>i,Tq:()=>l,qE:()=>r,ys:()=>n});var a=s(6955);function l(e,t){return e||t?e?t?{hiAbsolute:e.hiAbsolute??t.hiAbsolute,hiCritical:e.hiCritical??t.hiCritical,hiNormal:e.hiNormal??t.hiNormal,lowAbsolute:e.lowAbsolute??t.lowAbsolute,lowCritical:e.lowCritical??t.lowCritical,lowNormal:e.lowNormal??t.lowNormal,units:e.units??t.units}:e:t||null:null}function n(e,t){if(!e)return"--";let{lowNormal:s,hiNormal:l}=e,n=e.units||t||"";return(0,a.qU)(s,l)?`${s} – ${l}${n?` ${n}`:""}`:"--"}function i(e,t){let s=e?.trim()||"",a=t?.trim()||"";return s?function(e,t){if(!e||!t)return!1;let s=e.trim(),a=t.trim();return s.endsWith(a)||s.endsWith(` ${a}`)}(s,a)||function(e){if(!e)return!1;let t=e.trim();return/\s+[a-zA-Z\/%°]+$/.test(t)}(s)?s:a?`${s} ${a}`:s:"--"}function r(e){if(!e||0===e.length)return null;let t=e.filter(e=>void 0!==e&&(void 0!==e.lowNormal||void 0!==e.hiNormal));return 0===t.length?null:[...t].sort((e,t)=>{let s=new Date(e.obsDatetime).getTime();return new Date(t.obsDatetime).getTime()-s})[0]}},5365(e,t,s){"use strict";s.d(t,{Fc:()=>n,VL:()=>i,rI:()=>r});var a=s(2664),l=s(4989);let n=(e,t=1e3)=>{let s=!1,a=!1,l=null,n=(...i)=>{s?(a=!0,l=i):(s=!0,setTimeout(()=>{s=!1,a&&(a=!1,n(...l))},t),e(...i))};return n},i=e=>`${window.spaBase}${e}/${l._.path}`;function r(e){return e?(0,a.formatDate)((0,a.parseDate)(e),{mode:"standard",time:!0}):"--"}},4863(e,t,s){"use strict";s.d(t,{ev:()=>i,t0:()=>r,tt:()=>o});var a,l=((a={}).NORMAL="NORMAL",a.HIGH="HIGH",a.CRITICALLY_HIGH="CRITICALLY_HIGH",a.OFF_SCALE_HIGH="OFF_SCALE_HIGH",a.LOW="LOW",a.CRITICALLY_LOW="CRITICALLY_LOW",a.OFF_SCALE_LOW="OFF_SCALE_LOW",a),n=s(7995);let i=e=>e?.code?.coding?.[0]?.code,r=e=>{switch(e){case"OFF_SCALE_HIGH":return n.A["off-scale-high"];case"CRITICALLY_HIGH":return n.A["critically-high"];case"HIGH":return n.A.high;case"OFF_SCALE_LOW":return n.A["off-scale-low"];case"CRITICALLY_LOW":return n.A["critically-low"];case"LOW":return n.A.low;default:return""}};function _(...e){for(let t of e)if(null==t)return!1;return!0}function o(e){let t,{display:s,hiAbsolute:a,hiCritical:n,hiNormal:i,lowAbsolute:r,lowCritical:o,lowNormal:c,units:d}=e,m=null;_(i,c)&&(m=`${c} – ${i}`);let p=(t={hiAbsolute:a,hiCritical:n,hiNormal:i,lowAbsolute:r,lowCritical:o,lowNormal:c,units:d,range:m},e=>{let s=parseFloat(e);return isNaN(s)?l.NORMAL:_(t.hiAbsolute)&&s>t.hiAbsolute?l.OFF_SCALE_HIGH:_(t.hiCritical)&&s>t.hiCritical?l.CRITICALLY_HIGH:_(t.hiNormal)&&s>t.hiNormal?l.HIGH:_(t.lowAbsolute)&&s<t.lowAbsolute?l.OFF_SCALE_LOW:_(t.lowCritical)&&s<t.lowCritical?l.CRITICALLY_LOW:_(t.lowNormal)&&s<t.lowNormal?l.LOW:l.NORMAL});return{display:s,hiAbsolute:a,hiCritical:n,hiNormal:i,lowAbsolute:r,lowCritical:o,lowNormal:c,units:d,range:m,getInterpretation:p}}},6955(e,t,s){"use strict";s.d(t,{$u:()=>c,EF:()=>b,UY:()=>_,Yq:()=>f,Yz:()=>i,dY:()=>p,lf:()=>h,mL:()=>d,qU:()=>u,tt:()=>g});var a=s(2664);let l=(e,t)=>{let s=e[Symbol.iterator]();return Array.from({length:t},()=>s.next().value)},n={};function i(e,t,s){n[e]=[t,Date.now(),s];let a=Object.entries(n);a.length>5&&(a.sort(([,[,e]],[,[,t]])=>t-e),n=Object.fromEntries(a.slice(0,5)))}async function r(e){let t=o({patient:e,category:"laboratory",_sort:"-_date",_summary:"data",_format:"json",_count:"1"}),s=await t.next().value;return s?.entry?.[0]?.resource?.id}function _(e){let[t,,s]=n[e]||[];return[t,t&&s?r(e).then(e=>e!==s):Promise.resolve(!0)]}function*o(e){let t=`${window.openmrsBase}/ws/fhir2/R4/Observation?`+Object.entries(e).map(([e,t])=>e+"="+t).join("&"),s=e=>t+"&_getpagesoffset="+300*e,a=0;for(;;)yield fetch(s(a++)).then(e=>e.json())}let c=async e=>{let t=o({patient:e,category:"laboratory",_sort:"-_date",_summary:"data",_format:"json",_count:"300"}),s=await Promise.all(l(t,1)),a=s[0]?.total??0;if(a>300){let e=Math.ceil(a/300)-1;s=[...s,...await Promise.all(l(t,e))]}return s.slice(0,Math.ceil(a/300)).flatMap(e=>e?.entry?.map(e=>e.resource)??[])},d=e=>e?.code?.coding?.[0]?.code??"",m={};function p(e){return Promise.allSettled([...new Set(e.map(d).filter(Boolean))].map(e=>m[e]||(m[e]=fetch(`${window.openmrsBase}${a.restBaseUrl}/concept/${e}?v=full`).then(t=>{if(!t.ok)throw Error(`Failed to fetch concept ${e}: ${t.statusText}`);return t.json()}).catch(t=>{throw delete m[e],t})))).then(e=>e.filter(e=>"fulfilled"===e.status).map(e=>e.value))}function u(...e){for(let t of e)if(null==t)return!1;return!0}function h(e){if(!e.referenceRange||0===e.referenceRange.length)return;let t={units:e.valueQuantity?.unit};if(e.referenceRange.forEach(e=>{let s=e.type?.coding?.[0]?.code,a=e.type?.coding?.[0]?.system;"http://terminology.hl7.org/CodeSystem/referencerange-meaning"===a?"normal"===s?(t.hiNormal=e.high?.value,t.lowNormal=e.low?.value):"treatment"===s&&(t.hiCritical=e.high?.value,t.lowCritical=e.low?.value):"http://fhir.openmrs.org/ext/obs/reference-range"===a&&"absolute"===s&&(t.hiAbsolute=e.high?.value,t.lowAbsolute=e.low?.value)}),void 0!==t.hiNormal||void 0!==t.lowNormal||void 0!==t.hiCritical||void 0!==t.lowCritical||void 0!==t.hiAbsolute||void 0!==t.lowAbsolute)return t}function f(e){if(!e.interpretation||0===e.interpretation.length)return;let t=e.interpretation[0],s=t.coding?.[0]?.code,a=t.coding?.[0]?.display||t.text;if(s)switch(s.toUpperCase()){case"LL":return"CRITICALLY_LOW";case"HH":return"CRITICALLY_HIGH";case"L":return"LOW";case"H":return"HIGH";case"N":return"NORMAL";case"LU":return"OFF_SCALE_LOW";case"HU":return"OFF_SCALE_HIGH"}if(a)switch(a.trim().toLowerCase()){case"critically low":return"CRITICALLY_LOW";case"critically high":return"CRITICALLY_HIGH";case"low":return"LOW";case"high":return"HIGH";case"normal":return"NORMAL";case"off scale low":return"OFF_SCALE_LOW";case"off scale high":return"OFF_SCALE_HIGH"}}let b=e=>t=>{if(isNaN(parseFloat(t)))return"NORMAL";let s=parseFloat(t);return u(e.hiAbsolute)&&s>e.hiAbsolute?"OFF_SCALE_HIGH":u(e.hiCritical)&&s>e.hiCritical?"CRITICALLY_HIGH":u(e.hiNormal)&&s>e.hiNormal?"HIGH":u(e.lowAbsolute)&&s<e.lowAbsolute?"OFF_SCALE_LOW":u(e.lowCritical)&&s<e.lowCritical?"CRITICALLY_LOW":u(e.lowNormal)&&s<e.lowNormal?"LOW":"NORMAL"};function g(e){return Object.fromEntries(e.map(({uuid:e,hiAbsolute:t,hiCritical:s,hiNormal:a,lowAbsolute:l,lowCritical:n,lowNormal:i,units:r,datatype:{display:_}})=>{let o={hiAbsolute:t,hiCritical:s,hiNormal:a,lowAbsolute:l,lowCritical:n,lowNormal:i,units:r,datatype:_};return u(a,i)&&(o.range=`${i} – ${a}`),o.assessValue=b(o),[e,o]}))}},7774(e,t,s){"use strict";s.d(t,{A:()=>d});var a=s(3338);s(5399);var l=s(3373),n=s.n(l),i=s(324),r=s(2664);let _={tableContainer:"-esm-patient-tests__common-datatable__tableContainer___zMtM9",desktop:"-esm-patient-tests__common-datatable__desktop___DBWFL",table:"-esm-patient-tests__common-datatable__table___gT-hJ","col-name":"-esm-patient-tests__common-datatable__col-name___v+OHb","col-value":"-esm-patient-tests__common-datatable__col-value___SjYUn","col-range":"-esm-patient-tests__common-datatable__col-range___7mqr0",offScaleHigh:"-esm-patient-tests__common-datatable__offScaleHigh___uOYu2",offScaleLow:"-esm-patient-tests__common-datatable__offScaleLow___Pu9+I",criticallyHigh:"-esm-patient-tests__common-datatable__criticallyHigh___BhGOR",criticallyLow:"-esm-patient-tests__common-datatable__criticallyLow___Mednc",high:"-esm-patient-tests__common-datatable__high___Ja3pV",low:"-esm-patient-tests__common-datatable__low___UmVO0"},o=e=>_[`col-${e}`],c=({interpretation:e,...t})=>{switch(e){case"OFF_SCALE_HIGH":return(0,a.jsx)(i.TableRow,{...t,className:_["off-scale-high"]});case"CRITICALLY_HIGH":return(0,a.jsx)(i.TableRow,{...t,className:_["critically-high"]});case"HIGH":return(0,a.jsx)(i.TableRow,{...t,className:_.high});case"OFF_SCALE_LOW":return(0,a.jsx)(i.TableRow,{...t,className:_["off-scale-low"]});case"CRITICALLY_LOW":return(0,a.jsx)(i.TableRow,{...t,className:_["critically-low"]});case"LOW":return(0,a.jsx)(i.TableRow,{...t,className:_.low});default:return(0,a.jsx)(i.TableRow,{...t})}},d=({title:e,data:t,description:s,toolbar:l,tableHeaders:d})=>{let m={OFF_SCALE_HIGH:"offScaleHigh",CRITICALLY_HIGH:"criticallyHigh",HIGH:"high",OFF_SCALE_LOW:"offScaleLow",CRITICALLY_LOW:"criticallyLow",LOW:"low",NORMAL:""},p="tablet"===(0,r.useLayoutType)();return t=t.map(e=>({...e,dateTime:(0,r.formatDate)((0,r.parseDate)(e?.dateTime),{mode:"standard",time:!0})})),(0,a.jsx)(i.DataTable,{rows:t,headers:d,size:"sm",useZebraStyles:!0,children:({rows:r,headers:d,getHeaderProps:u,getRowProps:h,getTableProps:f,getTableContainerProps:b})=>(0,a.jsxs)(i.TableContainer,{className:n()(_.tableContainer,p?_.tablet:_.desktop),title:e,description:s,...b(),children:[l,(0,a.jsxs)(i.Table,{className:_.table,...f(),isSortable:!0,children:[(0,a.jsx)(i.TableHead,{children:(0,a.jsx)(i.TableRow,{children:d.map(e=>(0,a.jsx)(i.TableHeader,{className:o(e.key),...u({header:e}),isSortable:!0,children:e.header},e.key))})}),(0,a.jsx)(i.TableBody,{children:r.map((e,s)=>(0,a.jsx)(c,{interpretation:t[s]?.interpretation,...h({row:e}),children:e.cells.map(e=>e.value?.interpretation?(0,a.jsx)(i.TableCell,{className:n()(_[m[e.value.interpretation]],o(e.info.header)),children:(0,a.jsx)("span",{children:e.value?.value??e.value})},e.id):(0,a.jsx)(i.TableCell,{className:o(e.info.header),children:e?.value},e.id))},e.id))})]})]})})}},8547(e,t,s){"use strict";s.d(t,{A:()=>p});var a=s(4644);let l=function(e,t,s,a){for(var l=e.length,n=s+(a?1:-1);a?n--:++n<l;)if(t(e[n],n,e))return n;return -1},n=function(e){return e!=e},i=function(e,t,s){for(var a=s-1,l=e.length;++a<l;)if(e[a]===t)return a;return -1},r=function(e,t){return!!(null==e?0:e.length)&&(t==t?i(e,t,0):l(e,n,0))>-1},_=function(e,t,s){for(var a=-1,l=null==e?0:e.length;++a<l;)if(s(t,e[a]))return!0;return!1};var o=s(2026),c=s(8574),d=s(9922),m=c.A&&1/(0,d.A)(new c.A([,-0]))[1]==1/0?function(e){return new c.A(e)}:function(){};let p=function(e,t,s){var l=-1,n=r,i=e.length,c=!0,p=[],u=p;if(s)c=!1,n=_;else if(i>=200){var h=t?null:m(e);if(h)return(0,d.A)(h);c=!1,n=o.A,u=new a.A}else u=t?[]:p;e:for(;++l<i;){var f=e[l],b=t?t(f):f;if(f=s||0!==f?f:0,c&&b==b){for(var g=u.length;g--;)if(u[g]===b)continue e;t&&u.push(b),p.push(f)}else n(u,b,s)||(u!==p&&u.push(b),p.push(f))}return p}}}]);
|
|
1
|
+
(globalThis.webpackChunk_openmrs_esm_patient_tests_app=globalThis.webpackChunk_openmrs_esm_patient_tests_app||[]).push([["8659"],{8742(e,t,s){"use strict";function a(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,a)}return s}function l(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?a(Object(s),!0).forEach(function(t){var a,l;a=t,l=s[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var a=s.call(e,t);if("object"!=typeof a)return a;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in e?Object.defineProperty(e,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[a]=l}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):a(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function n(e,t){if(null==e)return{};var s,a,l=function(e,t){if(null==e)return{};var s={};for(var a in e)if(({}).hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;s[a]=e[a]}return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)s=n[a],-1===t.indexOf(s)&&({}).propertyIsEnumerable.call(e,s)&&(l[s]=e[s])}return l}s.d(t,{A:()=>p});var i=["width","height","viewBox"],r=["tabindex"],_={focusable:"false",preserveAspectRatio:"xMidYMid meet"},o=s(9067),c=s.n(o),d=s(5399),m=s.n(d);let p=m().forwardRef(function({className:e,children:t,tabIndex:s,xmlns:a="http://www.w3.org/2000/svg",preserveAspectRatio:o="xMidYMid meet",...c},d){let{tabindex:p,...u}=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.width,s=e.height,a=e.viewBox,o=void 0===a?"0 0 ".concat(t," ").concat(s):a,c=n(e,i),d=c.tabindex,m=n(c,r),p=l(l(l({},_),m),{},{width:t,height:s,viewBox:o});return p["aria-label"]||p["aria-labelledby"]||p.title?(p.role="img",null!=d&&(p.focusable="true",p.tabindex=d)):p["aria-hidden"]=!0,p}({...c,tabindex:s});return e&&(u.className=e),null!=p&&("number"==typeof p?u.tabIndex=p:u.tabIndex=Number(s)),d&&(u.ref=d),a&&(u.xmlns=a),o&&(u.preserveAspectRatio=o),m().createElement("svg",u,t)});p.displayName="Icon",p.propTypes={"aria-hidden":c().oneOfType([c().bool,c().oneOf(["true","false"])]),"aria-label":c().string,"aria-labelledby":c().string,children:c().node,className:c().string,height:c().oneOfType([c().number,c().string]),preserveAspectRatio:c().string,tabIndex:c().oneOfType([c().number,c().string]),viewBox:c().string,width:c().oneOfType([c().number,c().string]),xmlns:c().string}},7995(e,t,s){"use strict";s.d(t,{A:()=>a});let a={"cds--grid":"-esm-patient-tests__lab-set-panel__cds--grid___nMrb-","cds--grid--full-width":"-esm-patient-tests__lab-set-panel__cds--grid--full-width___wzZtd","cds--row":"-esm-patient-tests__lab-set-panel__cds--row___Qy216","cds--row-padding":"-esm-patient-tests__lab-set-panel__cds--row-padding___he3g6","cds--col-padding":"-esm-patient-tests__lab-set-panel__cds--col-padding___vt8z+","cds--grid--condensed":"-esm-patient-tests__lab-set-panel__cds--grid--condensed___i6BEg","cds--grid--with-row-gap":"-esm-patient-tests__lab-set-panel__cds--grid--with-row-gap___TsJyv","cds--grid--narrow":"-esm-patient-tests__lab-set-panel__cds--grid--narrow___cBBS6","cds--col":"-esm-patient-tests__lab-set-panel__cds--col___aT7YR","cds--row--condensed":"-esm-patient-tests__lab-set-panel__cds--row--condensed___rvW12","cds--row--narrow":"-esm-patient-tests__lab-set-panel__cds--row--narrow___-7YkV","cds--col-sm-0":"-esm-patient-tests__lab-set-panel__cds--col-sm-0___yGR6c","cds--col-sm-1":"-esm-patient-tests__lab-set-panel__cds--col-sm-1___iEF2g","cds--col-sm-2":"-esm-patient-tests__lab-set-panel__cds--col-sm-2___VoYoB","cds--col-sm-3":"-esm-patient-tests__lab-set-panel__cds--col-sm-3___VQ3uq","cds--col-sm-4":"-esm-patient-tests__lab-set-panel__cds--col-sm-4___EgRI4","cds--col-sm":"-esm-patient-tests__lab-set-panel__cds--col-sm___VcN8j","cds--col-sm--auto":"-esm-patient-tests__lab-set-panel__cds--col-sm--auto___cr+Ry","cds--col--auto":"-esm-patient-tests__lab-set-panel__cds--col--auto___WedvY","cds--offset-sm-0":"-esm-patient-tests__lab-set-panel__cds--offset-sm-0___+c5Sz","cds--offset-sm-1":"-esm-patient-tests__lab-set-panel__cds--offset-sm-1___Kt69y","cds--offset-sm-2":"-esm-patient-tests__lab-set-panel__cds--offset-sm-2___xAqR7","cds--offset-sm-3":"-esm-patient-tests__lab-set-panel__cds--offset-sm-3___Uf4zM","cds--col-md-0":"-esm-patient-tests__lab-set-panel__cds--col-md-0___dkym5","cds--col-md-1":"-esm-patient-tests__lab-set-panel__cds--col-md-1___bOv7d","cds--col-md-2":"-esm-patient-tests__lab-set-panel__cds--col-md-2___-OGtv","cds--col-md-3":"-esm-patient-tests__lab-set-panel__cds--col-md-3___M8w-B","cds--col-md-4":"-esm-patient-tests__lab-set-panel__cds--col-md-4___xBuet","cds--col-md-5":"-esm-patient-tests__lab-set-panel__cds--col-md-5___bg4Yb","cds--col-md-6":"-esm-patient-tests__lab-set-panel__cds--col-md-6___himGH","cds--col-md-7":"-esm-patient-tests__lab-set-panel__cds--col-md-7___Ot25H","cds--col-md-8":"-esm-patient-tests__lab-set-panel__cds--col-md-8___l0cR+","cds--col-md":"-esm-patient-tests__lab-set-panel__cds--col-md___Bczgy","cds--col-md--auto":"-esm-patient-tests__lab-set-panel__cds--col-md--auto___YXBHD","cds--offset-md-0":"-esm-patient-tests__lab-set-panel__cds--offset-md-0___8av5d","cds--offset-md-1":"-esm-patient-tests__lab-set-panel__cds--offset-md-1___4tR3O","cds--offset-md-2":"-esm-patient-tests__lab-set-panel__cds--offset-md-2___HNh3B","cds--offset-md-3":"-esm-patient-tests__lab-set-panel__cds--offset-md-3___r7-nE","cds--offset-md-4":"-esm-patient-tests__lab-set-panel__cds--offset-md-4___jjgvX","cds--offset-md-5":"-esm-patient-tests__lab-set-panel__cds--offset-md-5___JLqL3","cds--offset-md-6":"-esm-patient-tests__lab-set-panel__cds--offset-md-6___xcTp2","cds--offset-md-7":"-esm-patient-tests__lab-set-panel__cds--offset-md-7___2UzKB","cds--col-lg-0":"-esm-patient-tests__lab-set-panel__cds--col-lg-0___FJt2C","cds--col-lg-1":"-esm-patient-tests__lab-set-panel__cds--col-lg-1___zZ7UW","cds--col-lg-2":"-esm-patient-tests__lab-set-panel__cds--col-lg-2___XARr7","cds--col-lg-3":"-esm-patient-tests__lab-set-panel__cds--col-lg-3___vobkK","cds--col-lg-4":"-esm-patient-tests__lab-set-panel__cds--col-lg-4___ZofES","cds--col-lg-5":"-esm-patient-tests__lab-set-panel__cds--col-lg-5___lgUz+","cds--col-lg-6":"-esm-patient-tests__lab-set-panel__cds--col-lg-6___IxSOR","cds--col-lg-7":"-esm-patient-tests__lab-set-panel__cds--col-lg-7___lz-9u","cds--col-lg-8":"-esm-patient-tests__lab-set-panel__cds--col-lg-8___lt8h6","cds--col-lg-9":"-esm-patient-tests__lab-set-panel__cds--col-lg-9___mORaq","cds--col-lg-10":"-esm-patient-tests__lab-set-panel__cds--col-lg-10___ldOGF","cds--col-lg-11":"-esm-patient-tests__lab-set-panel__cds--col-lg-11___4a5Sc","cds--col-lg-12":"-esm-patient-tests__lab-set-panel__cds--col-lg-12___0SQts","cds--col-lg-13":"-esm-patient-tests__lab-set-panel__cds--col-lg-13___PalMa","cds--col-lg-14":"-esm-patient-tests__lab-set-panel__cds--col-lg-14___e5yRC","cds--col-lg-15":"-esm-patient-tests__lab-set-panel__cds--col-lg-15___6Ng-U","cds--col-lg-16":"-esm-patient-tests__lab-set-panel__cds--col-lg-16___XoSUz","cds--col-lg":"-esm-patient-tests__lab-set-panel__cds--col-lg___fTMA7","cds--col-lg--auto":"-esm-patient-tests__lab-set-panel__cds--col-lg--auto___wKnQx","cds--offset-lg-0":"-esm-patient-tests__lab-set-panel__cds--offset-lg-0___OSn2B","cds--offset-lg-1":"-esm-patient-tests__lab-set-panel__cds--offset-lg-1___ylXRI","cds--offset-lg-2":"-esm-patient-tests__lab-set-panel__cds--offset-lg-2___EWSZR","cds--offset-lg-3":"-esm-patient-tests__lab-set-panel__cds--offset-lg-3___0nyz-","cds--offset-lg-4":"-esm-patient-tests__lab-set-panel__cds--offset-lg-4___HZrlz","cds--offset-lg-5":"-esm-patient-tests__lab-set-panel__cds--offset-lg-5___OTQsM","cds--offset-lg-6":"-esm-patient-tests__lab-set-panel__cds--offset-lg-6___6pjxJ","cds--offset-lg-7":"-esm-patient-tests__lab-set-panel__cds--offset-lg-7___dzEqR","cds--offset-lg-8":"-esm-patient-tests__lab-set-panel__cds--offset-lg-8___l+oKM","cds--offset-lg-9":"-esm-patient-tests__lab-set-panel__cds--offset-lg-9___h+0PL","cds--offset-lg-10":"-esm-patient-tests__lab-set-panel__cds--offset-lg-10___xCKQJ","cds--offset-lg-11":"-esm-patient-tests__lab-set-panel__cds--offset-lg-11___QomFu","cds--offset-lg-12":"-esm-patient-tests__lab-set-panel__cds--offset-lg-12___lR+Hk","cds--offset-lg-13":"-esm-patient-tests__lab-set-panel__cds--offset-lg-13___6u-pn","cds--offset-lg-14":"-esm-patient-tests__lab-set-panel__cds--offset-lg-14___c1Idr","cds--offset-lg-15":"-esm-patient-tests__lab-set-panel__cds--offset-lg-15___1iSAk","cds--col-xlg-0":"-esm-patient-tests__lab-set-panel__cds--col-xlg-0___7cEPi","cds--col-xlg-1":"-esm-patient-tests__lab-set-panel__cds--col-xlg-1___io8+G","cds--col-xlg-2":"-esm-patient-tests__lab-set-panel__cds--col-xlg-2___ZIJ2N","cds--col-xlg-3":"-esm-patient-tests__lab-set-panel__cds--col-xlg-3___hhHFq","cds--col-xlg-4":"-esm-patient-tests__lab-set-panel__cds--col-xlg-4___-M598","cds--col-xlg-5":"-esm-patient-tests__lab-set-panel__cds--col-xlg-5___5QOp9","cds--col-xlg-6":"-esm-patient-tests__lab-set-panel__cds--col-xlg-6___3Z0Un","cds--col-xlg-7":"-esm-patient-tests__lab-set-panel__cds--col-xlg-7___53WSI","cds--col-xlg-8":"-esm-patient-tests__lab-set-panel__cds--col-xlg-8___jyjrg","cds--col-xlg-9":"-esm-patient-tests__lab-set-panel__cds--col-xlg-9___p3Oxz","cds--col-xlg-10":"-esm-patient-tests__lab-set-panel__cds--col-xlg-10___Dr0uJ","cds--col-xlg-11":"-esm-patient-tests__lab-set-panel__cds--col-xlg-11___trITQ","cds--col-xlg-12":"-esm-patient-tests__lab-set-panel__cds--col-xlg-12___YOFaT","cds--col-xlg-13":"-esm-patient-tests__lab-set-panel__cds--col-xlg-13___vU2yL","cds--col-xlg-14":"-esm-patient-tests__lab-set-panel__cds--col-xlg-14___Kbi0b","cds--col-xlg-15":"-esm-patient-tests__lab-set-panel__cds--col-xlg-15___ltFYH","cds--col-xlg-16":"-esm-patient-tests__lab-set-panel__cds--col-xlg-16___pzOb8","cds--col-xlg":"-esm-patient-tests__lab-set-panel__cds--col-xlg___jew+w","cds--col-xlg--auto":"-esm-patient-tests__lab-set-panel__cds--col-xlg--auto___p2mLu","cds--offset-xlg-0":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-0___r1dbh","cds--offset-xlg-1":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-1___9zNX-","cds--offset-xlg-2":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-2___Vf96M","cds--offset-xlg-3":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-3___tac7f","cds--offset-xlg-4":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-4___E-Ur7","cds--offset-xlg-5":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-5___Lzo4J","cds--offset-xlg-6":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-6___IJZSk","cds--offset-xlg-7":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-7___ED8cc","cds--offset-xlg-8":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-8___cBwYn","cds--offset-xlg-9":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-9___d84kC","cds--offset-xlg-10":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-10___N+Rdy","cds--offset-xlg-11":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-11___aFpO6","cds--offset-xlg-12":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-12___mdaR4","cds--offset-xlg-13":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-13___xa1PT","cds--offset-xlg-14":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-14___s48kX","cds--offset-xlg-15":"-esm-patient-tests__lab-set-panel__cds--offset-xlg-15___jkhqX","cds--col-max-0":"-esm-patient-tests__lab-set-panel__cds--col-max-0___vbwQ1","cds--col-max-1":"-esm-patient-tests__lab-set-panel__cds--col-max-1___7NiNt","cds--col-max-2":"-esm-patient-tests__lab-set-panel__cds--col-max-2___WfezX","cds--col-max-3":"-esm-patient-tests__lab-set-panel__cds--col-max-3___skbHk","cds--col-max-4":"-esm-patient-tests__lab-set-panel__cds--col-max-4___axNsg","cds--col-max-5":"-esm-patient-tests__lab-set-panel__cds--col-max-5___zQ56E","cds--col-max-6":"-esm-patient-tests__lab-set-panel__cds--col-max-6___MLM6P","cds--col-max-7":"-esm-patient-tests__lab-set-panel__cds--col-max-7___JLhee","cds--col-max-8":"-esm-patient-tests__lab-set-panel__cds--col-max-8___EjooU","cds--col-max-9":"-esm-patient-tests__lab-set-panel__cds--col-max-9___4T00Z","cds--col-max-10":"-esm-patient-tests__lab-set-panel__cds--col-max-10___NDABT","cds--col-max-11":"-esm-patient-tests__lab-set-panel__cds--col-max-11___Qh0UG","cds--col-max-12":"-esm-patient-tests__lab-set-panel__cds--col-max-12___MI6z6","cds--col-max-13":"-esm-patient-tests__lab-set-panel__cds--col-max-13___YqZgD","cds--col-max-14":"-esm-patient-tests__lab-set-panel__cds--col-max-14___3Q-5K","cds--col-max-15":"-esm-patient-tests__lab-set-panel__cds--col-max-15___E2jO3","cds--col-max-16":"-esm-patient-tests__lab-set-panel__cds--col-max-16___IYiGB","cds--col-max":"-esm-patient-tests__lab-set-panel__cds--col-max___4jG8Z","cds--col-max--auto":"-esm-patient-tests__lab-set-panel__cds--col-max--auto___8NKEB","cds--offset-max-0":"-esm-patient-tests__lab-set-panel__cds--offset-max-0___It5qq","cds--offset-max-1":"-esm-patient-tests__lab-set-panel__cds--offset-max-1___u0cG+","cds--offset-max-2":"-esm-patient-tests__lab-set-panel__cds--offset-max-2___aVrtN","cds--offset-max-3":"-esm-patient-tests__lab-set-panel__cds--offset-max-3___06kDu","cds--offset-max-4":"-esm-patient-tests__lab-set-panel__cds--offset-max-4___YxkC5","cds--offset-max-5":"-esm-patient-tests__lab-set-panel__cds--offset-max-5___46lWT","cds--offset-max-6":"-esm-patient-tests__lab-set-panel__cds--offset-max-6___pCj09","cds--offset-max-7":"-esm-patient-tests__lab-set-panel__cds--offset-max-7___+TZIf","cds--offset-max-8":"-esm-patient-tests__lab-set-panel__cds--offset-max-8___KOYc0","cds--offset-max-9":"-esm-patient-tests__lab-set-panel__cds--offset-max-9___dqddn","cds--offset-max-10":"-esm-patient-tests__lab-set-panel__cds--offset-max-10___1Z7gO","cds--offset-max-11":"-esm-patient-tests__lab-set-panel__cds--offset-max-11___-OsZ5","cds--offset-max-12":"-esm-patient-tests__lab-set-panel__cds--offset-max-12___NIgud","cds--offset-max-13":"-esm-patient-tests__lab-set-panel__cds--offset-max-13___2XRfF","cds--offset-max-14":"-esm-patient-tests__lab-set-panel__cds--offset-max-14___0Cbtx","cds--offset-max-15":"-esm-patient-tests__lab-set-panel__cds--offset-max-15___iGCdd","cds--no-gutter":"-esm-patient-tests__lab-set-panel__cds--no-gutter___jdGI+","cds--no-gutter--start":"-esm-patient-tests__lab-set-panel__cds--no-gutter--start___AYJNs","cds--no-gutter--end":"-esm-patient-tests__lab-set-panel__cds--no-gutter--end___AwANM","cds--hang--start":"-esm-patient-tests__lab-set-panel__cds--hang--start___83aGe","cds--hang--end":"-esm-patient-tests__lab-set-panel__cds--hang--end___fNqkt",labSetPanel:"-esm-patient-tests__lab-set-panel__labSetPanel___TaVqX",activePanel:"-esm-patient-tests__lab-set-panel__activePanel___G3cps",panelHeader:"-esm-patient-tests__lab-set-panel__panelHeader___0z6a4",productiveHeading02:"-esm-patient-tests__lab-set-panel__productiveHeading02___sCIi6",subtitleText:"-esm-patient-tests__lab-set-panel__subtitleText___rjhvf","off-scale-high":"-esm-patient-tests__lab-set-panel__off-scale-high___zM5mP","off-scale-low":"-esm-patient-tests__lab-set-panel__off-scale-low___iQzqb","critically-high":"-esm-patient-tests__lab-set-panel__critically-high___65fwt","critically-low":"-esm-patient-tests__lab-set-panel__critically-low___aDNEt",high:"-esm-patient-tests__lab-set-panel__high___HVjwe",low:"-esm-patient-tests__lab-set-panel__low___vrdEb",table:"-esm-patient-tests__lab-set-panel__table___wm8Mn","col-testName":"-esm-patient-tests__lab-set-panel__col-testName___HMPpt",tableWithRange:"-esm-patient-tests__lab-set-panel__tableWithRange___THIrO","col-resultDate":"-esm-patient-tests__lab-set-panel__col-resultDate___6sh6e","col-value":"-esm-patient-tests__lab-set-panel__col-value___JJyN2","col-referenceRange":"-esm-patient-tests__lab-set-panel__col-referenceRange___AvYAZ",tableWithoutRange:"-esm-patient-tests__lab-set-panel__tableWithoutRange___g053k"}},6999(e,t,s){"use strict";var a=s(6848);function l(){}function n(){}n.resetWarningCache=l,e.exports=function(){function e(e,t,s,l,n,i){if(i!==a){var r=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw r.name="Invariant Violation",r}}function t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:l};return s.PropTypes=s,s}},9067(e,t,s){e.exports=s(6999)()},6848(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4767(e,t,s){var a={"./uk.json":["3104","9072"],"./ar.json":["4132","7045"],"./es_419.json":["1842","6271"],"./ru_RU.json":["986","8359"],"./uz_UZ.json":["890","7175"],"./fr.json":["4055","6508"],"./sw_KE.json":["8618","903"],"./uz.json":["3584","6377"],"./en.json":["4300","5117"],"./ky.json":["8163","2416"],"./pl.json":["1119","6724"],"./sq.json":["8371","4928"],"./ka.json":["795","1480"],"./si.json":["6859","6904"],"./zh_TW.json":["439","556"],"./de.json":["4944","5145"],"./lg.json":["4618","8695"],"./vi.json":["9214","6371"],"./tr.json":["5241","434"],"./es_MX.json":["8349","1646"],"./tr_TR.json":["9900","1869"],"./zh_CN.json":["9879","5644"],"./en_US.json":["9569","4106"],"./he.json":["4652","2317"],"./id.json":["2690","6047"],"./ku.json":["9895","4348"],"./es.json":["3099","7912"],"./ne.json":["2146","5503"],"./ar_SY.json":["7617","282"],"./uz@Latn.json":["7097","4658"],"./bn.json":["7159","6444"],"./cs.json":["6589","7182"],"./zh.json":["1690","7742"],"./hi_IN.json":["5442","4383"],"./pt_BR.json":["4087","1877"],"./qu.json":["5173","8358"],"./ro_RO.json":["6022","3963"],"./sw.json":["9913","3378"],"./am.json":["1197","9806"],"./pt.json":["6679","5132"],"./it.json":["9538","4111"],"./km.json":["4335","5940"],"./hi.json":["6840","2881"]};function l(e){if(!s.o(a,e))return Promise.resolve().then(function(){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=a[e],l=t[0];return s.e(t[1]).then(function(){return s(l)})}l.keys=()=>Object.keys(a),l.id=4767,e.exports=l},6631(e,t,s){"use strict";s.r(t),s.d(t,{resultsViewer:()=>eL,addLabOrderWorkspace:()=>ek,externalOverview:()=>eO,exportedAddLabOrderWorkspace:()=>eD,labOrderPanel:()=>eH,importTranslation:()=>eS,testResultsDashboardLink:()=>eI,timelineResultsModal:()=>eE,startupApp:()=>eA,editLabResultsModal:()=>eM,printModal:()=>eR});var a,l=s(2664),n=s(6717);let i={resultsViewerConcepts:{_type:l.Type.Array,_elements:{_type:l.Type.Object,conceptUuid:{_type:l.Type.UUID,_description:"UUID of a test or a concept set containing tests as members, members' members, and so on. Test results will be loaded by querying the REST /obstree endpoint with this concept."},defaultOpen:{_type:l.Type.Boolean,_description:"Each concept set displays the test results it contains in an accordion. Should the accordion be open by default?"}},_default:[{conceptUuid:"ae485e65-2e3f-4297-b35e-c818bbefe894",defaultOpen:!1},{conceptUuid:"8904fa2b-6a8f-437d-89ec-6fce3cd99093",defaultOpen:!1},{conceptUuid:"856AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",defaultOpen:!1}]},orderTypeUuid:{_type:l.Type.UUID,_description:"UUID identifying this extension's order type for order basket panel filtering. Must match orders.labOrderTypeUuid if that value is overridden.",_default:"52a447d3-a64a-11e3-9aeb-50e549534c5e"},orders:{labOrderTypeUuid:{_type:l.Type.UUID,_description:"UUID for the 'Lab' order type",_default:"52a447d3-a64a-11e3-9aeb-50e549534c5e"},labOrderableConcepts:{_type:l.Type.Array,_elements:{_type:l.Type.UUID},_description:"UUIDs of concepts that represent orderable lab tests or lab sets.",_default:["1748a953-d12e-4be1-914c-f6b096c6cdef"]}},showReferenceNumberField:{_type:l.Type.Boolean,_default:!0,_description:"Whether to display the Reference number field in the Test Order form. This field maps to the accesion_number property in the Order data model"},additionalTestOrderTypes:{_type:l.Type.Array,_elements:{_type:l.Type.Object,orderTypeUuid:{_type:l.Type.UUID,_description:"UUID for the new order type"},label:{_type:l.Type.String,_description:"The custom label to be shown for the order type. The label will be translated using the label as the key itself."},orderableConceptSets:{_type:l.Type.Array,_elements:{_type:l.Type.UUID},_description:"UUIDs of concepts that represent orderable concept sets. If an empty array `[]` is provided, every concept with class mentioned in the `orderableConceptClasses` will be considered orderable."},icon:{_type:l.Type.String,_description:"Icon to be shown for the order type. Icons are from the OpenMRS icon library.",_default:""}},_description:"List of various order types, each associated with the Java class name `org.openmrs.TestOrder`.",_default:[]},labTestsWithOrderReasons:{_type:l.Type.Array,_elements:{_type:l.Type.Object,labTestUuid:{_type:l.Type.UUID,_description:"UUID of the lab test that requires a reason for ordering",_default:""},required:{_type:l.Type.Boolean,_description:"Whether the order reason is required or not",_default:!1},orderReasons:{_type:l.Type.Array,_elements:{_type:l.Type.ConceptUuid,_description:"Array of coded concepts that represent reasons for ordering a lab test"},_description:"Coded Lab test order reason options",_default:[]}},_description:"Whether to allow for provision of coded order reason. This feature requires webservices.rest 3.1.0 or later.",_default:[]}};var r=s(4989);let _="@openmrs/esm-patient-tests-app";var o=s(3338),c=s(5399),d=s.n(c),m=s(3373),p=s.n(m),u=s(7807),h=s(324),f=s(8547),b=s(6955),g=s(3886);async function x(e){let t=await (0,b.$u)(e),s=(await (0,b.dY)(t)).filter(e=>"Test"===e.conceptClass.name||"LabSet"===e.conceptClass.name),a=s.map(e=>e.uuid),l=Object.fromEntries(s.map(({uuid:e,display:t})=>[e,t])),n=Object.fromEntries(a.map(e=>[e,[]])),i=(0,b.tt)(s),r=[],_={},o=e=>{e.conceptClass=(0,b.mL)(e);let t=(0,b.lf)(e),s=(0,b.Yq)(e);if(e.hasMember)e.members=Array(e.hasMember.length),e.hasMember.forEach((t,s)=>{_[t.reference.split("/")[1]]=[e.members,s]});else{e.valueQuantity?(e.value=String(e.valueQuantity.value),delete e.valueQuantity):e.valueCodeableConcept?(e.value=e.valueCodeableConcept.coding?.[0]?.display,delete e.valueCodeableConcept):e.valueString&&(e.value=e.valueString,delete e.valueString);let a=i[e.conceptClass],l={hiAbsolute:a.hiAbsolute,hiCritical:a.hiCritical,hiNormal:a.hiNormal,lowAbsolute:a.lowAbsolute,lowCritical:a.lowCritical,lowNormal:a.lowNormal,units:a.units},n=(0,g.Tq)(t,l),r={...a,hiAbsolute:n?.hiAbsolute??a.hiAbsolute,hiCritical:n?.hiCritical??a.hiCritical,hiNormal:n?.hiNormal??a.hiNormal,lowAbsolute:n?.lowAbsolute??a.lowAbsolute,lowCritical:n?.lowCritical??a.lowCritical,lowNormal:n?.lowNormal??a.lowNormal,units:n?.units??a.units,range:n?(0,g.ys)(n,n.units):a.range};r.assessValue=(0,b.EF)(r),e.meta=r,e.interpretation=s??(r.assessValue?r.assessValue(e.value):"NORMAL")}e.name=l[e.conceptClass]};t.forEach(e=>{a.includes((0,b.mL)(e))&&(o(e),e.members?n[e.conceptClass].push(e):r.push(e))}),r.forEach(e=>{let{id:t}=e,s=_[t];s&&(s[0][s[1]]=e),n[e.conceptClass]&&n[e.conceptClass].push(e)}),Object.values(n).filter(e=>e.some(e=>e.members)).forEach(e=>{var t;let s=e.flatMap(e=>e.members);for(let a of(t=s.map(e=>e.conceptClass))&&t.length?(0,f.A)(t):[])for(let t of r.filter(e=>e.conceptClass===a&&!s.some(t=>t.id===e.id)))e.push({...t,members:[t]})});let c=Object.fromEntries(Object.entries(n).filter(e=>e[1].length).map(([e,t])=>{let{display:a,conceptClass:{display:l}}=s.find(t=>t.uuid===e);return[a,{entries:t.sort((e,t)=>Date.parse(t.effectiveDateTime)-Date.parse(e.effectiveDateTime)),type:l,uuid:e}]}));return t.length>0&&(0,b.Yz)(e,c,t[0].id),c}let v=function(e){let[t,s]=(0,b.UY)(e);return[t,s.then(s=>s?x(e):t)]};var y=s(4807),w=s(7774);let j="-esm-patient-tests__common-overview__label___Z8FnH",T=({...e})=>(0,o.jsx)("div",{...e,className:"-esm-patient-tests__common-overview__separator___hXDBi"}),N=({effectiveDateTime:e,issuedDateTime:t})=>{let{t:s}=(0,u.useTranslation)();return(0,o.jsxs)(h.Toggletip,{align:"bottom",className:"-esm-patient-tests__common-overview__tooltipContainer___dux6M",children:[(0,o.jsx)(h.ToggletipButton,{label:"Additional information",children:(0,o.jsx)(y.$$,{})}),(0,o.jsx)(h.ToggletipContent,{children:(0,o.jsxs)("div",{className:"-esm-patient-tests__common-overview__tooltip___fhxzj",children:[(0,o.jsx)("p",{children:s("dateCollected","Displaying date collected")}),(0,o.jsxs)("p",{children:[(0,o.jsxs)("span",{className:j,children:[s("ordered","Ordered"),": "]})," ",(0,l.formatDatetime)(e,{mode:"wide"})]}),(0,o.jsxs)("p",{children:[(0,o.jsxs)("span",{className:j,children:[s("resulted","Resulted"),": "]})," ",(0,l.formatDatetime)(t,{mode:"wide"})]})]})})]})},C=({patientUuid:e,overviewData:t=[]})=>{let{t:s}=(0,u.useTranslation)(),a=[{key:"name",header:s("testName","Test Name")},{key:"value",header:s("value","Value")},{key:"range",header:s("referenceRange","Reference range")}],i=(0,c.useCallback)(()=>{(0,l.navigate)({to:`\${openmrsSpaBase}/patient/${e}/chart/results`})},[e]);return t.length?(0,o.jsx)(o.Fragment,{children:t.map(([e,t,n,r,_,c])=>(0,o.jsxs)("article",{children:[(0,o.jsx)(w.A,{title:e,data:n,description:(0,o.jsx)("div",{children:(0,o.jsxs)("div",{className:"-esm-patient-tests__common-overview__meta___uZKDR",children:[(0,l.formatDatetime)(r,{mode:"wide"}),(0,o.jsx)(N,{effectiveDateTime:r,issuedDateTime:_})]})}),tableHeaders:a}),n.length>5&&(0,o.jsx)(h.Button,{onClick:i,kind:"ghost",children:s("moreResultsAvailable","More results available")})]},c)).reduce((e,t,s,{length:a})=>(e.push(t),s<a-1&&e.push((0,o.jsx)(T,{},s)),e),[])}):(0,o.jsx)(n.EmptyState,{headerTitle:s("testResults_title","Test Results"),displayText:s("testResults","test results")})},S={productiveHeading03:"-esm-patient-tests__external-overview__productiveHeading03___mo9Ip","recent-results-grid":"-esm-patient-tests__external-overview__recent-results-grid___fkVjE",text02:"-esm-patient-tests__external-overview__text02___IvRD9"},A=e=>(0,o.jsx)("div",{...e,className:S["recent-results-grid"]});var O=s(1619);let L=({width:e="64",height:t="64"})=>(0,o.jsx)("svg",{width:e,height:t,viewBox:"0 0 58 58",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,o.jsx)("g",{fill:"#CEE6E5",children:(0,o.jsx)("path",{d:"M15 15h14v14H15zM43 43h14v14H43zM29 29h14v14H29zM29 1h14v14H29zM1 29h14v14H1zM43 15h14v14H43zM15 43h14v14H15zM1 1h14v14H1z"})}),(0,o.jsx)("path",{d:"M57 57H1V1h56v56zM1 29h56M1 15h56M1 43h56M29 1v56M15 1v56M43 1v56",stroke:"#9ACBCA",strokeWidth:"1.44",strokeLinejoin:"round"})]})}),R=e=>{let{t}=(0,u.useTranslation)();return(0,o.jsx)(h.Layer,{children:(0,o.jsxs)(h.Tile,{className:"-esm-patient-tests__filter-empty-state__tile___xfv+V",children:[(0,o.jsx)(L,{}),(0,o.jsx)("p",{className:"-esm-patient-tests__filter-empty-state__content___TS4pE",children:t("noResultsToDisplay","No results to display")}),e.clearFilter&&(0,o.jsxs)("p",{className:"-esm-patient-tests__filter-empty-state__action___4Wvi+",children:[(0,o.jsx)("span",{className:"-esm-patient-tests__filter-empty-state__link___Yjv0T",role:"button",tabIndex:0,onClick:()=>e.clearFilter(),children:t("clearFilters","Clear filters")})," ",(0,o.jsx)("span",{children:t("resetView","to reset this view")})]})]})})};var I=((a={}).INITIALIZE="INITIALIZE",a.TOGGLE_CHECKBOX="TOGGLE_CHECKBOX",a.TOGGLE_PARENT="TOGGLE_PARENT",a.RESET_TREE="RESET_TREE",a);function H(e,t){let s=[...e],a=new Map;for(let t of e){let e=`${t.obsDatetime}|${t.value}`;a.set(e,(a.get(e)??0)+1)}let l=new Map;for(let e of t){let t=`${e.obsDatetime}|${e.value}`,n=(l.get(t)??0)+1;l.set(t,n),n>(a.get(t)??0)&&s.push(e)}return s}let k=(e,t)=>{let s={},a=[],l=[],n=[];return t?.obs&&Array.isArray(t.obs)&&t.obs.length>0?(a.push(t.flatName),l.push([t.flatName,t])):t?.subSets&&Array.isArray(t.subSets)&&t.subSets.length>0?(t.subSets.map(t=>t?k(e,t):null).filter(Boolean).forEach(e=>{e&&(s={...s,...e.parents},a.push(...e.leaves),l.push(...e.tests),n.push(...e.lowestParents))}),t.subSets.some(e=>e?.hasData)&&n.push(t)):(a.push(t.flatName),l.push([t.flatName,t])),s[t.flatName||t.display]=a,{parents:s,leaves:a,tests:l,lowestParents:n}},D=function(e,t){switch(t.type){case I.INITIALIZE:{let s={},a=[],l=[],n=[];t.trees.forEach(e=>{let{parents:t,leaves:i,tests:r,lowestParents:_}=k("",e);s={...s,...t},a=[...a,...i],l=[...l,...r],n=[...n,..._]});let i={};return l.forEach(([e,t])=>{let s=i[e];s?t.obs&&Array.isArray(t.obs)&&(s.obs=H(s.obs??[],t.obs)):i[e]={...t,obs:t.obs?[...t.obs]:t.obs}}),{checkboxes:Object.fromEntries(a.map(t=>[t,e.checkboxes[t]??!1])),parents:s,roots:t.trees,tests:i,lowestParents:n}}case I.TOGGLE_CHECKBOX:return{...e,checkboxes:{...e.checkboxes,[t.name]:!e.checkboxes[t.name]}};case I.TOGGLE_PARENT:{let s=e.parents[t.name],a={...e.checkboxes};if(s&&Array.isArray(s)){let e=s.every(e=>a[e]);s.forEach(t=>a[t]=!e)}return{...e,checkboxes:a}}case I.RESET_TREE:return{...e,checkboxes:Object.fromEntries(Object.keys(e.checkboxes).map(e=>[e,!1]))};default:return e}};function E(e){let t=e.split("-");return t.length>=2?t[1]:t[0]}let M={checkboxes:{},parents:{},roots:[{display:"",flatName:""}],tests:{},lowestParents:[]},F={state:M,...M,timelineData:null,tableData:null,trendlineData:null,activeTests:[],someChecked:!1,totalResultsCount:0,filteredResultsCount:0,isLoading:!1,initialize:()=>{},toggleVal:()=>{},updateParent:()=>{},resetTree:()=>{}},U=(0,c.createContext)(F),z=({roots:e,isLoading:t,children:s})=>{let[a,n]=(0,c.useReducer)(D,M),i=(0,c.useMemo)(()=>({initialize:e=>n({type:I.INITIALIZE,trees:e}),toggleVal:e=>n({type:I.TOGGLE_CHECKBOX,name:e}),updateParent:e=>n({type:I.TOGGLE_PARENT,name:e}),resetTree:()=>n({type:I.RESET_TREE})}),[n]),r=(0,c.useMemo)(()=>Object.keys(a?.checkboxes)?.filter(e=>a.checkboxes[e])||[],[a.checkboxes]),_=!!r.length,d=(0,c.useMemo)(()=>{let e=new Map;for(let t in a.tests){let s=a.tests[t];if(!s.obs||!Array.isArray(s.obs)||0===s.obs.length)continue;let l=E(s.flatName),n=`${l}_${s.conceptUuid??s.flatName}`,i=e.get(n);i?(i.flatNames.push(s.flatName),i.obs=H(i.obs,s.obs)):e.set(n,{test:s,stateKey:t,flatNames:[s.flatName],obs:[...s.obs]})}return[...e.values()]},[a.tests]),m=(0,c.useMemo)(()=>{let e,t,s;if(!a?.tests)return{data:{parsedTime:{},rowData:[],panelName:""},loaded:!1};let n=r.length?d.filter(e=>e.flatNames.some(e=>r.includes(e))):d,i=[...new Set(n.map(({obs:e})=>e.map(e=>e.obsDatetime)).flat().filter(Boolean))];i.sort((e,t)=>new Date(t).getTime()-new Date(e).getTime());let _=[];return n.forEach(({test:e,stateKey:t,flatNames:s,obs:a})=>{let l=i.map(e=>a.find(t=>t.obsDatetime===e));_.push({...e,key:t,flatNames:s,obs:a,entries:l})}),{data:{parsedTime:(e=[],t=[],s=[],i.forEach(a=>{let n=(0,l.parseDate)(a),i=n.getFullYear().toString(),r=(0,l.formatDate)(n,{mode:"wide",year:!1,time:!1}),_=(0,l.formatTime)(n),o=e.find(({year:e})=>i===e);o?o.size++:e.push({year:i,size:1});let c=t.find(({year:e,day:t})=>r===t&&i===e);c?c.size++:t.push({day:r,year:i,size:1}),s.push(_)}),{yearColumns:e,dayColumns:t,timeColumns:s,sortedTimes:i}),rowData:_,panelName:"timeline"},loaded:!0}},[r,d,a.tests]),p=(0,c.useMemo)(()=>{let e=[];d.forEach(({test:t,stateKey:s,flatNames:a,obs:l})=>{l.forEach(l=>{let n={...t,...l,key:s,flatNames:a};e.push(n)})});let t={};return e.forEach(e=>{let s=E(e.flatName),a=new Date(e.obsDatetime).toISOString().split("T")[0],l=`${s}__${a}`;t[l]||(t[l]={key:s,date:a,flatName:e.flatName,entries:[]}),t[l].entries.push(e)}),Object.values(t).sort((e,t)=>new Date(t.date).getTime()-new Date(e.date).getTime())},[d]);(0,c.useEffect)(()=>{e.length&&i.initialize(e)},[i,e]);let u=(0,c.useMemo)(()=>d.reduce((e,t)=>e+t.obs.length,0),[d]),h=(0,c.useMemo)(()=>_?d.reduce((e,t)=>t.flatNames.some(e=>r.includes(e))?e+t.obs.length:e,0):u,[_,r,d,u]);return(0,o.jsx)(U.Provider,{value:{...a,timelineData:m,tableData:p,trendlineData:null,activeTests:r,someChecked:_,totalResultsCount:u,filteredResultsCount:h,isLoading:t,initialize:i.initialize,toggleVal:i.toggleVal,updateParent:i.updateParent,resetTree:i.resetTree},children:s})},B={filterSetContent:"-esm-patient-tests__filter-set__filterSetContent___+Yurf",treeNodeHeader:"-esm-patient-tests__filter-set__treeNodeHeader___80akr",nestedAccordion:"-esm-patient-tests__filter-set__nestedAccordion___AjLtg",treeNodeHeaderTablet:"-esm-patient-tests__filter-set__treeNodeHeaderTablet___kwuvR",nestedAccordionTablet:"-esm-patient-tests__filter-set__nestedAccordionTablet___ooXaJ",filterItem:"-esm-patient-tests__filter-set__filterItem___02zdB"},P=({root:e,itemNumber:t})=>{let s=(0,l.useConfig)(),{t:a}=(0,u.useTranslation)(),n="tablet"===(0,l.useLayoutType)(),[i,r]=(0,c.useState)(void 0);if(!e.subSets)return;let _=e.subSets.map((e,a)=>e?.obs&&Array.isArray(e.obs)&&e.obs.length>0?(0,o.jsx)("div",{children:(0,o.jsx)(G,{leaf:e})},a):e?.subSets&&Array.isArray(e.subSets)?(0,o.jsx)("div",{children:(0,o.jsx)($,{root:e,level:0,open:void 0===i?s?.resultsViewerConcepts?.[t]?.defaultOpen:i})},a):(0,o.jsx)("div",{children:(0,o.jsx)(G,{leaf:e})},a)),d=e.subSets&&e.subSets.length>0;return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:p()(B.treeNodeHeader,{[B.treeNodeHeaderTablet]:n}),children:[(0,o.jsx)("h5",{children:a(e.display)}),d&&(0,o.jsx)(h.Button,{className:B.button,kind:"ghost",size:n?"md":"sm",onClick:()=>r(e=>!e),children:(0,o.jsx)("span",{children:i?a("collapseAll","Collapse all"):a("expandAll","Expand all")})})]}),_]})},$=({root:e,level:t,open:s})=>{let a,n="tablet"===(0,l.useLayoutType)(),{checkboxes:i,parents:r,updateParent:_,toggleVal:d}=(0,c.useContext)(U),m=(a=r[e.flatName],a&&!a?.every(e=>i[e])&&!a?.every(e=>!i[e])),p=r[e.flatName]?.every(e=>i[e]),u=r[e.flatName]&&r[e.flatName].length>0;return(0,o.jsx)(h.Accordion,{align:"start",size:n?"md":"sm",children:(0,o.jsx)(h.AccordionItem,{disabled:!e.hasData,title:(0,o.jsx)(h.Checkbox,{id:e?.flatName,checked:e.hasData&&(u?p:i[e.flatName]),indeterminate:!!u&&m,labelText:e?.display,onChange:()=>u?_(e.flatName):d(e.flatName),disabled:!e.hasData}),style:{paddingLeft:`${+(t>0)}rem`},open:s??!1,children:e?.obs&&Array.isArray(e.obs)&&e.obs.length>0?(0,o.jsx)(G,{leaf:e}):e?.subSets&&Array.isArray(e.subSets)&&e.subSets.length>0?e.subSets.map((e,s)=>e?.obs&&Array.isArray(e.obs)&&e.obs.length>0?(0,o.jsx)(G,{leaf:e},s):e?.subSets&&Array.isArray(e.subSets)&&e.subSets.length>0?(0,o.jsx)($,{root:e,level:t+1},s):(0,o.jsx)(G,{leaf:e},s)):(0,o.jsx)("div",{})})})},G=({leaf:e})=>{let{checkboxes:t,toggleVal:s}=(0,c.useContext)(U);return(0,o.jsx)("div",{className:B.filterItem,children:(0,o.jsx)(h.Checkbox,{id:e?.flatName,labelText:e?.display,checked:t?.[e.flatName],onChange:()=>s(e.flatName),disabled:!e.hasData})})},W=()=>{let{roots:e}=(0,c.useContext)(U),t=(0,l.useConfig)(),[s,a]=(0,c.useState)(""),[n,i]=(0,c.useState)(e);return(0,c.useEffect)(()=>{let a=t?.resultsViewerConcepts?.map(e=>e.conceptUuid)??[];i(e.filter(e=>{if(!e.subSets||!Array.isArray(e.subSets))return!1;let t=!!(e.conceptUuid&&a.includes(e.conceptUuid))||(e.subSets?.some(e=>e.conceptUuid&&a.includes(e.conceptUuid))??!1);return(0!==e.subSets.length||!!t)&&function e(t,s){if(!s)return!1;let a=s.display.toLowerCase().includes(t.toLowerCase()),l=s.subSets?.some(s=>e(t,s))??!1;return a||l}(s,e)}))},[s,e,t]),(0,o.jsx)("div",{className:B.filterSetContent,children:n?.length>0?n?.map((e,t)=>(0,o.jsx)("div",{className:`${B.nestedAccordion} ${B.nestedAccordionTablet}`,children:(0,o.jsx)(P,{root:e,itemNumber:t})},`filter-node-${t}`)):(0,o.jsx)(R,{clearFilter:()=>a("")})})},Y=({dataColumns:e,style:t={},padding:s=!1,...a})=>(0,o.jsx)("div",{style:{...t,gridTemplateColumns:`${s?"9rem ":""} repeat(${e}, minmax(8rem, 1fr))`,overflow:"hidden",width:"100%",minWidth:"100%"},className:"-esm-patient-tests__grid__grid___W5COR",...a});var V=s(5365);let q={timelineDataContainer:"-esm-patient-tests__grouped-timeline__timelineDataContainer___d1vR3",grid:"-esm-patient-tests__grouped-timeline__grid___G1-60",dayColumn:"-esm-patient-tests__grouped-timeline__dayColumn___-Ic2O",yearColumn:"-esm-patient-tests__grouped-timeline__yearColumn___j-dTd",timeColumn:"-esm-patient-tests__grouped-timeline__timeColumn___nBsCr",paddedMain:"-esm-patient-tests__grouped-timeline__paddedMain___6LtPO",timelineCell:"-esm-patient-tests__grouped-timeline__timelineCell___M7nQq",rowStartCell:"-esm-patient-tests__grouped-timeline__rowStartCell___WUGuQ",timelineDataCell:"-esm-patient-tests__grouped-timeline__timelineDataCell___Jl24u",gridContainer:"-esm-patient-tests__grouped-timeline__gridContainer___MFu+d",timelineCellZebra:"-esm-patient-tests__grouped-timeline__timelineCellZebra___Upzu0",dateHeaderInner:"-esm-patient-tests__grouped-timeline__dateHeaderInner___J0TJ9",timeSlotInner:"-esm-patient-tests__grouped-timeline__timeSlotInner___VzbS0",cornerGridElement:"-esm-patient-tests__grouped-timeline__cornerGridElement___YI6Ov",panelHeader:"-esm-patient-tests__grouped-timeline__panelHeader___22rTs",panelHeaderOverlay:"-esm-patient-tests__grouped-timeline__panelHeaderOverlay___2+dfX",panelNameText:"-esm-patient-tests__grouped-timeline__panelNameText___IkNm-",shadow:"-esm-patient-tests__grouped-timeline__shadow___aMDgg",trendlineLink:"-esm-patient-tests__grouped-timeline__trendlineLink___c0SXD","trendline-link-view":"-esm-patient-tests__grouped-timeline__trendline-link-view___ylBku",rangeUnits:"-esm-patient-tests__grouped-timeline__rangeUnits___IEMOb",offScaleHigh:"-esm-patient-tests__grouped-timeline__offScaleHigh___hTGFb",offScaleLow:"-esm-patient-tests__grouped-timeline__offScaleLow___+s20X",criticallyHigh:"-esm-patient-tests__grouped-timeline__criticallyHigh___037xI",criticallyLow:"-esm-patient-tests__grouped-timeline__criticallyLow___TUihK",high:"-esm-patient-tests__grouped-timeline__high___s-FHL",low:"-esm-patient-tests__grouped-timeline__low___RSw-b",shadowBox:"-esm-patient-tests__grouped-timeline__shadowBox___eLF-a"},Z=()=>(0,o.jsx)("div",{className:q["shadow-box"]}),J=({children:e,className:t,...s})=>(0,o.jsx)("div",{className:p()(q.timeSlotInner,t),...s,children:e}),X=({panelName:e,panelDates:t,inOverlay:s})=>(0,o.jsx)("div",{className:p()(q.panelHeader,{[q.panelHeaderOverlay]:s}),"data-panel-name":e,children:(0,o.jsx)("div",{className:q.dateHeaderContainer,children:(0,o.jsx)("div",{className:q.dateHeaderInner,style:{overflowX:"auto"},children:(0,o.jsxs)(Y,{dataColumns:t.timeColumns.length,padding:!0,style:{gridTemplateRows:"repeat(3, 24px)",zIndex:1,boxShadow:"8px 0 20px 0 rgba(0,0,0,0.15)"},children:[(0,o.jsx)(J,{className:p()(q.cornerGridElement,q.shadow,q.panelNameText),children:e}),t.yearColumns.map(({year:e,size:t})=>(0,o.jsx)(J,{className:q.yearColumn,style:{gridColumn:`${t} span`},children:e},e)),t.dayColumns.map(({day:e,year:t,size:s})=>(0,o.jsx)(J,{className:q.dayColumn,style:{gridColumn:`${s} span`},children:e},`${e} - ${t}`)),t.timeColumns.map((e,t)=>(0,o.jsx)(J,{className:q.timeColumn,children:e},e+t))]})})})}),K=({title:e,range:t,units:s,conceptUuid:a,patientUuid:n,shadow:i=!1,isString:r=!1,zebra:_=!1})=>{let d=(0,c.useCallback)(()=>{let t=(0,l.showModal)("timeline-results-modal",{closeDeleteModal:()=>t(),patientUuid:n,testUuid:a,title:e})},[n,a,e]),m=(0,g.Mi)(t,s);return(0,o.jsxs)("div",{className:p()(q.rowStartCell,{[q.timelineCellZebra]:_}),style:{boxShadow:i?"8px 0 20px 0 rgba(0,0,0,0.15)":void 0},children:[(0,o.jsx)("span",{className:q["trendline-link"],children:r?(0,o.jsx)("span",{className:q.trendlineLink,children:e}):(0,o.jsx)("span",{className:q["trendline-link-view"],onClick:d,children:e})}),(0,o.jsx)("span",{className:q.rangeUnits,children:m})]})},Q={OFF_SCALE_HIGH:"offScaleHigh",CRITICALLY_HIGH:"criticallyHigh",HIGH:"high",OFF_SCALE_LOW:"offScaleLow",CRITICALLY_LOW:"criticallyLow",LOW:"low",NORMAL:""},ee=({text:e,interpretation:t="NORMAL",zebra:s})=>{let a=Q[t]?q[Q[t]]:"";return(0,o.jsx)("div",{className:p()(q.timelineDataCell,{[q.timelineCellZebra]:s},a),children:(0,o.jsx)("p",{children:e})})},et=d().memo(({sortedTimes:e,obs:t,zebra:s})=>(0,o.jsx)(o.Fragment,{children:e.map((e,a)=>{let l=t.find(t=>t?.obsDatetime===e);return l?(0,o.jsx)(ee,{text:l.value,interpretation:l.interpretation,zebra:s},a):(0,o.jsx)(ee,{text:"",zebra:s},a)})})),es=({patientUuid:e,timeColumns:t,rowData:s,sortedTimes:a,showShadow:l})=>(0,o.jsx)(Y,{dataColumns:t.length,padding:!0,style:{gridColumn:"span 2"},children:s.map((t,s)=>{let n=t.entries,{obs:i}=t,r=isNaN(parseFloat(i?.[0]?.value)),_=(0,g.qE)(t.entries),c=_?.range??t.range??"",m=t.units??"";return(0,o.jsxs)(d().Fragment,{children:[(0,o.jsx)(K,{units:m,range:c,title:t.display,shadow:l,conceptUuid:t.conceptUuid,patientUuid:e,isString:r,zebra:!!(s%2)}),(0,o.jsx)(et,{sortedTimes:a,obs:n,zebra:!!(s%2)})]},s)})});function ea({patientUuid:e,parent:t,subRows:s,xScroll:a,setXScroll:l,inOverlay:n}){let i=(0,c.useMemo)(()=>{let e=[...new Set(s.filter(e=>e?.entries&&Array.isArray(e.entries)).map(e=>e.entries.filter(e=>e).map(e=>e.obsDatetime)).flat())];e.sort((e,t)=>new Date(t).getTime()-new Date(e).getTime());let t=[],a=[],l=[];return e.forEach(e=>{let s=new Date(e),n=s.getFullYear().toString(),i=s.toLocaleDateString("en-US",{month:"short",day:"numeric"}),r=s.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),_=t.find(({year:e})=>n===e);_?_.size++:t.push({year:n,size:1});let o=a.find(({year:e,day:t})=>i===t&&n===e);o?o.size++:a.push({day:i,year:n,size:1}),l.push(r)}),{yearColumns:t,dayColumns:a,timeColumns:l,sortedTimes:e}},[s]),r=(0,c.useRef)(),_=r.current;return _&&(_.scrollLeft=a),(0,c.useEffect)(()=>{let e=(0,V.Fc)(e=>{l(e.target.scrollLeft)},200),t=r.current;if(t)return t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)},[l]),(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{children:[(0,o.jsx)(X,{panelName:t.display,panelDates:i,inOverlay:n}),(0,o.jsxs)("div",{className:q.gridContainer,ref:r,children:[(0,o.jsx)(es,{patientUuid:e,rowData:s,showShadow:!!a,sortedTimes:i.sortedTimes,timeColumns:i.timeColumns}),(0,o.jsx)(Z,{})]})]})})}var el=s(682),en=s.n(el);let ei=(e,t)=>{let s=JSON.parse(JSON.stringify(e));return t&&"Bloodwork"!==t?s.flatName=`${t.trim()}-${e.display.trim()}`:s.flatName=e.display.trim(),s.hasData=!1,s?.subSets?.length&&(s.subSets=s.subSets.map(e=>ei(e,s.flatName)),s.hasData=s.subSets.some(e=>e.hasData)),(0,b.qU)(s?.hiNormal,s?.lowNormal)&&(s.range=(0,g.ys)({lowNormal:s.lowNormal,hiNormal:s.hiNormal,units:s.units},s.units)),s?.obs?.length&&(s.obs=s.obs.map(e=>{let t=void 0!==e.lowNormal||void 0!==e.hiNormal?{hiAbsolute:e.hiAbsolute,hiCritical:e.hiCritical,hiNormal:e.hiNormal,lowAbsolute:e.lowAbsolute,lowCritical:e.lowCritical,lowNormal:e.lowNormal}:void 0,a={hiAbsolute:s.hiAbsolute,hiCritical:s.hiCritical,hiNormal:s.hiNormal,lowAbsolute:s.lowAbsolute,lowCritical:s.lowCritical,lowNormal:s.lowNormal,units:s.units},l=(0,g.Tq)(t,a),n=l?(0,b.EF)(l):(0,b.EF)(a),i=e.interpretation??n(e.value),r=t?(0,g.ys)(t,s.units):s.range||"--";return{...e,interpretation:i,range:r}}),s.hasData=!0),{...s}},er=e=>{if(void 0!==e.obs)return e.hasData?e:null;if(e.subSets&&e.subSets.length>0){let t=e.subSets.map(e=>er(e)).filter(e=>null!==e);return{...e,subSets:t}}return e},e_=(e,t)=>{let{data:s,error:a}=en()(s=>s<t.length&&e?`${l.restBaseUrl}/obstree?patient=${e}&concept=${t[s]}`:null,l.openmrsFetch,{initialSize:t.length,revalidateIfStale:!0,revalidateOnFocus:!1,revalidateOnReconnect:!0}),n=(0,c.useMemo)(()=>s?.map((e,s)=>{if(!e?.data)return{data:{},error:!1,loading:!0};{let{data:a,...l}=e,n=ei(a,"");return s<t.length&&n&&(n.conceptUuid=t[s]),{...l,loading:!1,data:n}}})||[{data:{},error:!1,loading:!0}],[s,t]);return{roots:n.map(e=>e.data).filter(e=>"display"in e).map(e=>er(e)).filter(Boolean),isLoading:n.some(e=>e.loading),error:a}},eo=({patientUuid:e})=>{let{t}=(0,u.useTranslation)(),{activeTests:s,timelineData:a,tableData:l}=(0,c.useContext)(U),[i,r]=(0,c.useState)(0),{data:{rowData:_},loaded:d}=a;return _&&_?.length===0?(0,o.jsx)(n.EmptyState,{displayText:t("data","data"),headerTitle:t("dataTimelineText","Data timeline")}):s&&a&&d&&l?(0,o.jsx)("div",{className:q.timelineDataContainer,children:l.map((t,s)=>{let a=new Set(t.entries.flatMap(e=>[...e.flatNames??[],e.flatName])),l=_?.filter(e=>a.has(e.flatName));return l?.length>0&&(0,o.jsx)("div",{children:(0,o.jsx)(ea,{groupNumber:s+1,parent:{display:t.key,flatName:t.key},patientUuid:e,setXScroll:r,subRows:l,xScroll:i})},s)})}):null};var ec=s(4863),ed=s(7995);let em=({panel:e,activePanel:t,setActivePanel:s})=>{let{t:a}=(0,u.useTranslation)(),n=e.entries[0]?.obsDatetime?(0,l.parseDate)(e.entries[0].obsDatetime):new Date(e.date),i=(0,l.useLayoutType)(),r=e=>ed.A[`col-${e}`],_=e.entries.some(e=>e.range),d=(0,c.useMemo)(()=>_?[{id:"testName",key:"testName",header:a("testName","Test name")},{id:"resultDate",key:"resultDate",header:a("resultDate","Result date")},{id:"value",key:"value",header:a("value","Value")},{id:"referenceRange",key:"referenceRange",header:a("referenceRange","Reference range")}]:[{id:"testName",key:"testName",header:a("testName","Test name")},{id:"resultDate",key:"resultDate",header:a("resultDate","Result date")},{id:"value",key:"value",header:a("value","Value")}],[a,_]),m=(0,c.useMemo)(()=>_?e.entries.map(e=>{let t=e.units??"",s=(0,g.Mi)(e.range,t);return{id:e.conceptUuid,testName:e.display,resultDate:(0,V.rI)(e.obsDatetime),value:{content:(0,o.jsx)("span",{children:`${e.value} ${t}`})},interpretation:e.interpretation,referenceRange:s}}):e.entries.map(e=>{let t=e.units??"";return{id:e.conceptUuid,testName:e.display,resultDate:(0,V.rI)(e.obsDatetime),value:{content:(0,o.jsx)("span",{children:`${e.value} ${t}`})},interpretation:e.interpretation}}),[e,_]);return(0,o.jsx)(h.Layer,{className:p()(ed.A.labSetPanel,{[ed.A.activePanel]:t?.key===e.key}),children:(0,o.jsxs)("div",{onClick:()=>s(e),role:"button",tabIndex:0,children:[(0,o.jsxs)("div",{className:ed.A.panelHeader,children:[(0,o.jsx)("h2",{className:ed.A.productiveHeading02,children:e.key}),(0,o.jsx)("p",{className:ed.A.subtitleText,children:(0,l.formatDate)(n,{mode:"wide",time:!0})})]}),(0,o.jsx)(h.DataTable,{rows:m,headers:d,useZebraStyles:!0,children:({rows:e,headers:t,getHeaderProps:s,getTableProps:a})=>(0,o.jsx)(h.TableContainer,{children:(0,o.jsxs)(h.Table,{className:p()(ed.A.table,_?ed.A.tableWithRange:ed.A.tableWithoutRange),...a(),size:(0,l.isDesktop)(i)?"sm":"md",children:[(0,o.jsx)(h.TableHead,{children:(0,o.jsx)(h.TableRow,{children:t.map(e=>{let t=s({header:e});return(0,o.jsx)(h.TableHeader,{...t,className:p()(t.className,r(e.key)),children:e.header})})})}),(0,o.jsx)(h.TableBody,{children:e.map((e,t)=>(0,o.jsx)(h.TableRow,{className:(0,ec.t0)(m[t]?.interpretation),children:e.cells.map(e=>(0,o.jsx)(h.TableCell,{className:r(e.info.header),children:e?.value?.content??e.value},e.id))},e.id))})]})})})]})})},ep=({close:e,children:t,headerText:s,buttonsGroup:a})=>{let{t:n}=(0,u.useTranslation)();return(0,o.jsxs)("div",{className:"-esm-patient-tests__tablet-overlay__tabletOverlay___4JwF+",children:[(0,o.jsxs)(h.Header,{"aria-label":"string"==typeof s?s:"",className:"-esm-patient-tests__tablet-overlay__tabletOverlayHeader___nKvFG",children:[(0,o.jsx)(h.IconButton,{className:"-esm-patient-tests__tablet-overlay__backButton___cOSCX",label:n("back","Back"),onClick:e,children:(0,o.jsx)(l.ArrowLeftIcon,{size:16})}),(0,o.jsx)("div",{className:"-esm-patient-tests__tablet-overlay__headerContent___6aJXi",children:s})]}),(0,o.jsx)("div",{className:"-esm-patient-tests__tablet-overlay__overlayContent___EIJLe",children:t}),(0,o.jsx)("div",{className:"-esm-patient-tests__tablet-overlay__buttonsGroup___OxhPf",children:a})]})},eu={panelViewHeader:"-esm-patient-tests__individual-results-table-tablet__panelViewHeader___yPb6N",flex:"-esm-patient-tests__individual-results-table-tablet__flex___cfx4u",productiveHeading02:"-esm-patient-tests__individual-results-table-tablet__productiveHeading02___xzZKS",stickySection:"-esm-patient-tests__individual-results-table-tablet__stickySection___9sWjf",headerMargin:"-esm-patient-tests__individual-results-table-tablet__headerMargin___-T1K9",headerMarginTablet:"-esm-patient-tests__individual-results-table-tablet__headerMarginTablet___ZM4nV",clearButton:"-esm-patient-tests__individual-results-table-tablet__clearButton___vdSQp",leftSection:"-esm-patient-tests__individual-results-table-tablet__leftSection___rT9TJ",rightSection:"-esm-patient-tests__individual-results-table-tablet__rightSection___NSWbq",rightSectionHeader:"-esm-patient-tests__individual-results-table-tablet__rightSectionHeader___pyexA",fullView:"-esm-patient-tests__individual-results-table-tablet__fullView___xn48e",flexBaseline:"-esm-patient-tests__individual-results-table-tablet__flexBaseline___nwtLz",overlay:"-esm-patient-tests__individual-results-table-tablet__overlay___Nx5bb"},eh=({isTablet:e,searchTerm:t,setSearchTerm:s,totalSearchResults:a})=>{let{t:n}=(0,u.useTranslation)(),[i,r]=(0,c.useState)(!1),[_,d]=(0,c.useState)(t),m=(0,c.useCallback)(()=>{r(e=>!e)},[r]),f=(0,c.useCallback)(e=>{e.preventDefault(),s(_),m()},[_,s,m]),b=(0,c.useCallback)(()=>{s(""),d("")},[s,d]);return(0,o.jsx)("div",{className:eu.panelViewHeader,children:i?e?(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(ep,{close:m,headerText:n("search","Search"),children:(0,o.jsxs)(h.Form,{onSubmit:f,className:p()(eu.flex),children:[(0,o.jsx)(h.Search,{autoFocus:!0,labelText:n("searchByTestName","Search by test name"),onChange:e=>d(e.target.value),placeholder:n("searchByTestName","Search by test name"),size:"lg",value:_}),(0,o.jsx)(h.Button,{"data-testid":"execute-search-button",kind:"secondary",onClick:()=>f(null),children:n("search","Search")})]})})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(h.Form,{onSubmit:f,className:eu.flexBaseline,children:[(0,o.jsx)(h.Search,{autoFocus:!0,labelText:n("searchByTestName","Search by test name"),onChange:e=>d(e.target.value),placeholder:n("searchByTestName","Search by test name"),size:"sm",value:_}),(0,o.jsx)(h.Button,{"data-testid":"execute-search-button",kind:"secondary",size:"sm",onClick:()=>f(null),children:n("search","Search")})]}),(0,o.jsx)(h.Button,{hasIconOnly:!0,renderIcon:l.CloseIcon,iconDescription:n("closeSearchBar","Close search"),onClick:m,size:"sm",kind:"ghost"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:eu.flexBaseline,children:[t&&a>0&&(0,o.jsx)("h4",{className:eu.heading,children:n("searchResultsTextFor","{{count}} search results for {{searchTerm}}",{searchTerm:t,count:a})}),t?(0,o.jsx)(h.Button,{className:eu.clearButton,kind:"ghost",size:e?"md":"sm",onClick:b,children:n("clear","Clear")}):null]}),(0,o.jsx)(h.Button,{"data-testid":"toggle-search-button",kind:"ghost",size:e?"md":"sm",renderIcon:l.SearchIcon,onClick:m,children:n("search","Search")})]})})},ef=({expanded:e,patientUuid:t})=>{let{t:s}=(0,u.useTranslation)(),a=(0,l.useLayoutType)(),i="tablet"===a,[r,_]=(0,c.useState)(""),[d,m]=(0,c.useState)(null),{tableData:f,timelineData:b,lowestParents:g,isLoading:x}=(0,c.useContext)(U),v=(0,c.useMemo)(()=>d?d.entries.map(e=>b.data.rowData.filter(t=>t.flatName==e.flatName)).flat():[],[b,d]),y=(0,c.useMemo)(()=>d?g.find(e=>e.display==d.key):null,[g,d]),w=(0,c.useMemo)(()=>r?f?.filter(e=>e.flatName.toLowerCase().includes(r.toLowerCase())||e.entries.some(e=>e.display.toLowerCase().includes(r.toLowerCase()))):f,[f,r]);return((0,c.useEffect)(()=>{"tablet"!==a&&w?.length&&m(w[0])},[w,a]),i)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{children:[(0,o.jsx)(eh,{isTablet:i,setSearchTerm:_,searchTerm:r,totalSearchResults:w?.length??0}),x?(0,o.jsx)(h.DataTableSkeleton,{"data-testid":"cds--data-table-container"}):f?.length>0?w?.length?w.map(e=>(0,o.jsx)(em,{panel:e,setActivePanel:m,activePanel:d},e.key)):(0,o.jsx)(R,{clearFilter:()=>_("")}):(0,o.jsx)(n.EmptyState,{displayText:s("panels","panels"),headerTitle:s("noPanelsFound","No panels found")})]}),d?(0,o.jsx)(ep,{close:()=>m(null),headerText:d?.key,children:(0,o.jsx)("div",{className:eu.overlay,children:(0,o.jsx)(ea,{groupNumber:1,inOverlay:!0,parent:y,patientUuid:t,setXScroll:()=>{},subRows:v,xScroll:0})})}):null]}):(0,o.jsxs)(o.Fragment,{children:[e?null:(0,o.jsx)("div",{className:eu.leftSection,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(eh,{isTablet:i,setSearchTerm:_,searchTerm:r,totalSearchResults:w?.length??0}),x?(0,o.jsx)(h.DataTableSkeleton,{"data-testid":"cds--data-table-container"}):f?.length>0?w?.length?w.map(e=>(0,o.jsx)(em,{panel:e,activePanel:d,setActivePanel:m},e.key)):(0,o.jsx)(R,{clearFilter:()=>_("")}):(0,o.jsx)(n.EmptyState,{displayText:s("panels","panels"),headerTitle:s("noPanelsFound","No panels found")})]})}),(0,o.jsx)("div",{className:p()(eu.headerMargin,eu.rightSection,e?eu.fullView:eu.splitView),children:(0,o.jsx)("div",{className:eu.stickySection,children:x?(0,o.jsx)(h.DataTableSkeleton,{"data-testid":"cds--data-table-container"}):d?(0,o.jsx)("div",{className:eu.overlay,children:(0,o.jsx)(ea,{patientUuid:t,parent:y,subRows:v,groupNumber:1,xScroll:0,setXScroll:()=>{}})}):null})})]})},eb={table:"-esm-patient-tests__individual-results-table__table___QxP12","off-scale-high":"-esm-patient-tests__individual-results-table__off-scale-high___CFZfi","off-scale-low":"-esm-patient-tests__individual-results-table__off-scale-low___N4ZtL","critically-high":"-esm-patient-tests__individual-results-table__critically-high___i7dml","critically-low":"-esm-patient-tests__individual-results-table__critically-low___xN1El",high:"-esm-patient-tests__individual-results-table__high___LN+tA",low:"-esm-patient-tests__individual-results-table__low___bMqg5","trendline-link-view":"-esm-patient-tests__individual-results-table__trendline-link-view___q4ZKL",resultType:"-esm-patient-tests__individual-results-table__resultType___w19-e",date:"-esm-patient-tests__individual-results-table__date___dK7xc",displayFlex:"-esm-patient-tests__individual-results-table__displayFlex___0boOT",cardTitle:"-esm-patient-tests__individual-results-table__cardTitle___DANSg",tableContainer:"-esm-patient-tests__individual-results-table__tableContainer___lrytE","col-testName":"-esm-patient-tests__individual-results-table__col-testName___wmcKX","col-resultDate":"-esm-patient-tests__individual-results-table__col-resultDate___7bHot","col-value":"-esm-patient-tests__individual-results-table__col-value___zwzJl","col-referenceRange":"-esm-patient-tests__individual-results-table__col-referenceRange___kY2v-"},eg=({patientUuid:e,isLoading:t,subRows:s,index:a,title:n})=>{let{t:i}=(0,u.useTranslation)(),r=(0,l.useLayoutType)(),_="small-desktop"===r||"large-desktop"===r,d=e=>eb[`col-${e}`],m=i(n),f=(0,c.useCallback)((t,s)=>{let a=(0,l.showModal)("timeline-results-modal",{closeDeleteModal:()=>a(),patientUuid:e,testUuid:s,title:t})},[e]),b=(0,c.useMemo)(()=>[{key:"testName",header:i("testName","Test name")},{key:"resultDate",header:i("resultDate","Result date")},{key:"value",header:i("value","Value")},{key:"referenceRange",header:i("referenceRange","Reference range")}],[i]),x=(0,c.useMemo)(()=>s?.entries?.map((e,t)=>{let s=e.range??"",l=e.units??"",n=isNaN(parseFloat(e.value)),i=(0,g.Mi)(s,l);return{...e,id:`${t}-${a}`,testName:(0,o.jsx)("span",{className:eb["trendline-link"],children:n?(0,o.jsx)("span",{className:eb.trendlineLink,children:e.display}):(0,o.jsx)("span",{className:eb["trendline-link-view"],onClick:()=>f(e.display,e.conceptUuid),children:e.display})}),resultDate:(0,V.rI)(e.obsDatetime),value:{value:`${e.value} ${l}`,interpretation:e?.interpretation},referenceRange:i}})??[],[a,s,f]);return t?(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar",compact:_,zebra:!0}):s.entries?.length?(0,o.jsx)(h.DataTable,{rows:x,headers:b,"data-floating-menu-container":!0,useZebraStyles:!0,children:({rows:e,headers:t,getHeaderProps:a,getTableProps:n})=>(0,o.jsxs)(h.TableContainer,{children:[(0,o.jsxs)("div",{className:eb.cardTitle,children:[(0,o.jsx)("h4",{className:eb.resultType,children:m}),(0,o.jsx)("div",{className:eb.displayFlex,children:(0,o.jsx)("span",{className:eb.date,children:(0,l.formatDate)((0,l.parseDate)(s.date),{mode:"standard",time:!1})})})]}),(0,o.jsxs)(h.Table,{className:eb.table,...n(),size:_?"md":"sm",children:[(0,o.jsx)(h.TableHead,{children:(0,o.jsx)(h.TableRow,{children:t.map(e=>{let t=a({header:e});return(0,o.jsx)(h.TableHeader,{...t,className:p()(t.className,d(e.key)),children:e.header})})})}),(0,o.jsx)(h.TableBody,{children:e.map(e=>(0,o.jsx)(h.TableRow,{children:e.cells.map(e=>e?.value?.interpretation?(0,o.jsx)(h.TableCell,{className:p()((e=>{switch(e){case"OFF_SCALE_HIGH":return eb["off-scale-high"];case"CRITICALLY_HIGH":return eb["critically-high"];case"HIGH":return eb.high;case"OFF_SCALE_LOW":return eb["off-scale-low"];case"CRITICALLY_LOW":return eb["critically-low"];case"LOW":return eb.low;default:return""}})(e?.value?.interpretation),d(e.info.header)),children:(0,o.jsx)("p",{children:e?.value?.value??e?.value})},e.id):(0,o.jsx)(h.TableCell,{className:d(e.info.header),children:(0,o.jsx)("p",{children:e?.value})},e.id))},e.id))})]})]})}):void 0},ex={overlay:"-esm-patient-tests__results-viewer__overlay___9L-px",resultsContainer:"-esm-patient-tests__results-viewer__resultsContainer___dm+6G",flex:"-esm-patient-tests__results-viewer__flex___LOFzH",resultsHeaderTablet:"-esm-patient-tests__results-viewer__resultsHeaderTablet___7zISI",resultsHeader:"-esm-patient-tests__results-viewer__resultsHeader___9cgzt",resultsHeaderScrolled:"-esm-patient-tests__results-viewer__resultsHeaderScrolled___zdOJt",headerSentinel:"-esm-patient-tests__results-viewer__headerSentinel___PHFQo",leftHeaderSection:"-esm-patient-tests__results-viewer__leftHeaderSection___lsd4N",viewOptsContentSwitcherContainer:"-esm-patient-tests__results-viewer__viewOptsContentSwitcherContainer___aKsnX",viewOptionsText:"-esm-patient-tests__results-viewer__viewOptionsText___XhhP4",contentSwitcherLabel:"-esm-patient-tests__results-viewer__contentSwitcherLabel___0vHXD",viewOptionsSwitcher:"-esm-patient-tests__results-viewer__viewOptionsSwitcher___eJYlw",leftSection:"-esm-patient-tests__results-viewer__leftSection___tJ9NK",rightSection:"-esm-patient-tests__results-viewer__rightSection___eRaIZ",rightSectionHeader:"-esm-patient-tests__results-viewer__rightSectionHeader___4gM2J",fullView:"-esm-patient-tests__results-viewer__fullView___31eTV",leftHeaderActions:"-esm-patient-tests__results-viewer__leftHeaderActions___4QAVe",trendlineOverlayHeader:"-esm-patient-tests__results-viewer__trendlineOverlayHeader___9Ix-d",trendlineOverlayHeaderTitle:"-esm-patient-tests__results-viewer__trendlineOverlayHeaderTitle___hqbMp",trendlineOverlayHeaderReferenceRange:"-esm-patient-tests__results-viewer__trendlineOverlayHeaderReferenceRange___L5W7O",filterSetHeader:"-esm-patient-tests__results-viewer__filterSetHeader___grd85",filterSetActions:"-esm-patient-tests__results-viewer__filterSetActions___VyOyy",floatingTreeButton:"-esm-patient-tests__results-viewer__floatingTreeButton___OOeS+",panelViewTimeline:"-esm-patient-tests__results-viewer__panelViewTimeline___PSSB4",border:"-esm-patient-tests__results-viewer__border___NiLpF",groupPanelsTables:"-esm-patient-tests__results-viewer__groupPanelsTables___3uffy",buttonsContainer:"-esm-patient-tests__results-viewer__buttonsContainer___EocB3",button:"-esm-patient-tests__results-viewer__button___3YqMq"},ev=({className:e,loadingPanelData:t,patientUuid:s})=>{let{t:a}=(0,u.useTranslation)(),{checkboxes:l,someChecked:i,tableData:r}=(0,c.useContext)(U),_=Object.keys(l).filter(e=>l[e]),d=(e,t)=>(e.flatNames??[e.flatName]).includes(t)||e.key===t,m=(0,c.useMemo)(()=>r?.filter(e=>!i||e.entries&&Array.isArray(e.entries)&&e.entries.some(e=>_.some(t=>d(e,t)))).map((e,t)=>({...e,entries:e.entries&&Array.isArray(e.entries)?e.entries.filter(e=>!i||_.some(t=>d(e,t))):[]})),[r,i,_]);return r?.length?(0,o.jsx)(h.Layer,{className:e,children:m.map((e,a)=>e.entries?.length>0?(0,o.jsx)("div",{className:p()({[ex.border]:e?.entries.length}),children:(0,o.jsx)(eg,{patientUuid:s,isLoading:t,subRows:e,index:a,title:e.key})},a):null)}):(0,o.jsx)(n.EmptyState,{displayText:a("data","data"),headerTitle:a("dataTimelineText","Data timeline")})},ey=({patientUuid:e,expanded:t,view:s})=>{let{t:a}=(0,u.useTranslation)(),i="tablet"===(0,l.useLayoutType)(),[r,_]=(0,c.useState)(!1),d=(0,l.useConfig)(),{roots:m,error:f}=e_(e,d?.resultsViewerConcepts?.map(e=>e.conceptUuid)??[]),{timelineData:b,tableData:g,totalResultsCount:x,filteredResultsCount:v,resetTree:y,isLoading:w}=(0,c.useContext)(U);return f?(0,o.jsx)(n.ErrorState,{error:f,headerTitle:a("dataLoadError","Data Load Error")}):w?(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar"}):m&&0!==m.length?i?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{children:w||"over-time"!==s?"individual-test"===s?(0,o.jsx)(ev,{className:ex.groupPanelsTables,loadingPanelData:w,patientUuid:e}):(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar"}):(0,o.jsx)(eo,{patientUuid:e})}),(0,o.jsx)("div",{className:ex.floatingTreeButton,children:(0,o.jsx)(h.Button,{renderIcon:l.TreeViewAltIcon,hasIconOnly:!0,onClick:()=>_(!0),iconDescription:a("showTree","Show tree")})}),r&&(0,o.jsx)(ep,{headerText:a("tree","Tree"),close:()=>_(!1),buttonsGroup:(0,o.jsxs)("div",{className:ex.overlay,children:[(0,o.jsx)(h.Button,{kind:"secondary",size:"xl",onClick:y,disabled:w,children:a("resetTreeText","Reset tree")}),(0,o.jsx)(h.Button,{kind:"primary",size:"xl",onClick:()=>_(!1),disabled:w,children:`${a("view","View")} ${!w?v:""} ${a("resultsText","results")}`})]}),children:w?(0,o.jsx)(h.AccordionSkeleton,{open:!0,count:4,align:"start"}):(0,o.jsx)(W,{hideFilterSetHeader:!0})})]}):(0,o.jsxs)(o.Fragment,{children:[!t&&(0,o.jsx)("div",{className:ex.leftSection,children:w?(0,o.jsx)(h.AccordionSkeleton,{open:!0,count:4,align:"start"}):(0,o.jsx)(W,{})}),(0,o.jsx)("div",{className:p()(ex.rightSection,t?ex.fullView:ex.splitView),children:w?(0,o.jsx)(h.DataTableSkeleton,{}):"individual-test"===s?g&&g.length>0?(0,o.jsx)("div",{className:ex.panelViewTimeline,children:(0,o.jsx)(ev,{patientUuid:e,className:ex.groupPanelsTables,loadingPanelData:w})}):(0,o.jsx)(ev,{patientUuid:e,className:ex.groupPanelsTables,loadingPanelData:w}):"over-time"===s?(0,o.jsx)(eo,{patientUuid:e}):null})]}):(0,o.jsx)(n.EmptyState,{headerTitle:a("testResults_title","Test Results"),displayText:a("testResultsData","test results data")})},ew=({patientUuid:e})=>{let{t}=(0,u.useTranslation)(),s="tablet"===(0,l.useLayoutType)(),[a,n]=(0,c.useState)("individual-test"),[i,r]=(0,c.useState)("tree"),{totalResultsCount:_,filteredResultsCount:d,resetTree:m,isLoading:f}=(0,c.useContext)(U),b="full"===a,g=s?"lg":"md",[x,v]=(0,c.useState)(!0),y=(0,c.useRef)(null);return((0,c.useEffect)(()=>{let e=new IntersectionObserver(e=>{let[t]=e;v(t.isIntersecting)},{threshold:1,rootMargin:"-1px 0px 0px 0px"}),t=y.current;return t&&e.observe(t),()=>{t&&e.unobserve(t),e.disconnect()}},[]),s)?(0,o.jsxs)("div",{className:ex.resultsContainer,children:[(0,o.jsx)("div",{ref:y,className:ex.headerSentinel}),(0,o.jsxs)("div",{className:p()(ex.resultsHeader,{[ex.resultsHeaderScrolled]:!x}),children:[(0,o.jsx)("h4",{style:{flexGrow:1},children:`${t("results","Results")} ${d?`(${d})`:""}`}),(0,o.jsxs)("div",{className:ex.leftHeaderActions,children:[(0,o.jsx)(ej,{isTablet:s,patientUuid:e,t:t}),(0,o.jsxs)("span",{className:ex.contentSwitcherLabel,children:[t("view","View"),": "]}),(0,o.jsxs)(h.ContentSwitcher,{selectedIndex:["panel","tree"].indexOf(i),onChange:({name:e})=>r(e),size:g,children:[(0,o.jsx)(h.Switch,{name:"panel",children:t("individualTests","Individual tests")}),(0,o.jsx)(h.Switch,{name:"tree",children:t("overTime","Over time")})]})]})]}),"tree"===i?(0,o.jsx)(ey,{patientUuid:e,expanded:b,view:a}):"panel"===i?(0,o.jsx)(ef,{expanded:b,patientUuid:e}):null]}):(0,o.jsxs)("div",{className:ex.resultsContainer,children:[(0,o.jsx)("div",{className:ex.headerSentinel,ref:y}),(0,o.jsxs)("div",{className:p()(ex.resultsHeader,{[ex.resultsHeaderScrolled]:!x}),children:[(0,o.jsxs)("div",{className:p()(ex.leftSection,ex.leftHeaderSection),children:[(0,o.jsx)("h4",{children:t("tests","Tests")}),(0,o.jsx)(h.Button,{className:ex.button,kind:"ghost",onClick:m,size:s?"md":"sm",children:(0,o.jsx)("span",{children:t("reset","Reset")})})]}),(0,o.jsx)("div",{className:ex.rightSectionHeader,children:(0,o.jsxs)("div",{className:ex.viewOptsContentSwitcherContainer,children:[(0,o.jsx)("h4",{className:ex.viewOptionsText,children:`${t("results","Results")} ${d?`(${d})`:""}`}),(0,o.jsxs)("div",{className:ex.buttonsContainer,children:[(0,o.jsx)(ej,{isTablet:s,patientUuid:e,t:t}),(0,o.jsxs)("span",{className:ex.contentSwitcherLabel,children:[t("view","View"),": "]}),(0,o.jsxs)(h.ContentSwitcher,{className:ex.viewOptionsSwitcher,onChange:({name:e})=>n(e),selectedIndex:+!!b,size:g,children:[(0,o.jsx)(h.Switch,{name:"individual-test",disabled:f,children:t("individualTests","Individual tests")}),(0,o.jsx)(h.Switch,{name:"over-time",disabled:f,children:t("overTime","Over time")})]})]})]})})]}),(0,o.jsx)("div",{className:ex.flex,children:(0,o.jsx)(ey,{patientUuid:e,expanded:!1,view:a})})]})};function ej({isTablet:e,patientUuid:t,t:s}){let{cache:a,mutate:n}=(0,O.useSWRConfig)(),[i,r]=(0,c.useState)(!1),_=(0,c.useCallback)(async()=>{r(!0);let e=[];for(let s of a.keys())s.includes(`patient=${t}`)&&(s.includes(`${l.restBaseUrl}/obstree`)||s.includes("/ws/fhir2/R4/Observation"))&&e.push(s);await Promise.allSettled(e.map(e=>n(e))),r(!1)},[a,n,t]);return(0,o.jsx)(h.Button,{className:ex.button,disabled:i,kind:"ghost",onClick:_,renderIcon:l.RenewIcon,size:e?"md":"sm",children:(0,o.jsx)("span",{children:i?s("refreshingData","Refreshing data")+"...":s("refreshData","Refresh data")})})}let eT=({basePath:e,patientUuid:t})=>{let{t:s}=(0,u.useTranslation)(),{roots:a,isLoading:i,error:r}=e_(t,(0,l.useConfig)().resultsViewerConcepts.map(e=>e.conceptUuid)??[]);return r?(0,o.jsx)(n.ErrorState,{error:r,headerTitle:s("dataLoadError","Data Load Error")}):i?(0,o.jsx)(h.DataTableSkeleton,{role:"progressbar"}):a?.length?(0,o.jsx)(z,{roots:a,isLoading:i,children:(0,o.jsx)(ew,{patientUuid:t,basePath:e})}):(0,o.jsx)(n.EmptyState,{headerTitle:s("testResults_title","Test Results"),displayText:s("testResultsData","test results data")})};var eN=s(5571);let eC={featureName:"patient-tests",moduleName:_},eS=s(4767);function eA(){(0,l.defineConfigSchema)(_,i)}let eO=(0,l.getSyncLifecycle)(({patientUuid:e,filter:t})=>{let{t:s}=(0,u.useTranslation)(),{overviewData:a,loaded:i}=function(e,t=()=>!0){let{sortedObs:s,loaded:a,error:l}=(e=>{let[t,s]=(0,c.useState)({sortedObs:{},loaded:!1,error:void 0}),a=(0,c.useRef)(!0);return(0,c.useEffect)(()=>{if(a.current=!0,e){let[t,l]=v(e);t&&a.current&&s({sortedObs:t,loaded:!0,error:void 0}),l.then(e=>{e!==t&&a.current&&s({sortedObs:e,loaded:!0,error:void 0})}).catch(e=>{a.current&&s({sortedObs:{},loaded:!0,error:e})})}return()=>{a.current=!1}},[e]),t})(e);return{overviewData:(0,c.useMemo)(()=>Object.entries(s).flatMap(([e,{entries:t,type:s,uuid:a}])=>t.map(t=>[t,a,s,e])).filter(t).map(([e,t,s,a])=>[a,s,function(e,t,s){if("Test"!==t)return e.members.map(e=>{let t=e.interpretation||"NORMAL";return{id:e.id,key:e.id,name:e.name,range:e.meta?.range||"--",interpretation:t,value:{value:e.value,interpretation:t}}});{let t=e.interpretation||"NORMAL";return[{id:e.id,name:s,range:e.meta?.range||"--",interpretation:t,value:{value:e.value,interpretation:t}}]}}(e,s,a),new Date(e.effectiveDateTime),new Date(e.issued),t]).sort(([,,,e],[,,,t])=>t.getTime()-e.getTime()),[t,s]),loaded:a,error:l}}(e,t),r=s("recentResults","Recent Results"),_=(0,c.useCallback)(()=>{(0,l.navigate)({to:`\${openmrsSpaBase}/patient/${e}/chart/results`})},[e]);return(0,o.jsx)(A,{children:i?(0,o.jsx)(o.Fragment,{children:a.length?(0,o.jsxs)("div",{className:S.widgetCard,children:[(0,o.jsxs)("div",{className:S.externalOverviewHeader,children:[(0,o.jsx)("h4",{className:p()(S.productiveHeading03,S.text02),children:r}),(0,o.jsx)(h.Button,{kind:"ghost",renderIcon:e=>(0,o.jsx)(l.ArrowRightIcon,{size:16,...e}),iconDescription:"See all results",onClick:_,children:s("seeAllResults","See all results")})]}),(0,o.jsx)(C,{patientUuid:e,overviewData:a.slice(0,3)}),a.length>3&&(0,o.jsx)(h.Button,{onClick:_,kind:"ghost",children:s("moreResultsAvailable","More results available")})]}):(0,o.jsx)(n.EmptyState,{headerTitle:r,displayText:s("recentTestResults","recent test results")})}):(0,o.jsx)(h.DataTableSkeleton,{columnCount:3})})},eC),eL=(0,l.getSyncLifecycle)(({basePath:e,patientUuid:t})=>(0,o.jsx)(eN.BrowserRouter,{basename:`${window.getOpenmrsSpaBase()}patient/${t}/chart/${encodeURIComponent(e)}`,children:(0,o.jsxs)(eN.Routes,{children:[(0,o.jsx)(eN.Route,{path:"",element:(0,o.jsx)(eT,{basePath:e,patientUuid:t})}),(0,o.jsx)(eN.Route,{path:":type/:testUuid",element:(0,o.jsx)(eT,{basePath:e,patientUuid:t})})]})}),eC),eR=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("9489"),s.e("7468"),s.e("1630")]).then(s.bind(s,4669)),eC),eI=(0,l.getSyncLifecycle)((0,n.createDashboardLink)({...r._}),eC),eH=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("9837"),s.e("5390")]).then(s.bind(s,6845)),eC),ek=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("781"),s.e("2304"),s.e("9837"),s.e("5528")]).then(s.bind(s,6395)),eC),eD=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("781"),s.e("2304"),s.e("9837"),s.e("5528")]).then(s.bind(s,6395)),eC),eE=(0,l.getAsyncLifecycle)(()=>Promise.all([s.e("3538"),s.e("5771")]).then(s.bind(s,5115)),{featureName:"Timeline results",moduleName:_}),eM=(0,l.getAsyncLifecycle)(()=>s.e("9850").then(s.bind(s,2817)),eC)},4989(e,t,s){"use strict";s.d(t,{_:()=>a});let a={slot:"patient-chart-test-results-dashboard-slot",columns:1,path:"results",title:"Results",icon:"omrs-icon-chart-average",hideDashboardTitle:!0}},3886(e,t,s){"use strict";s.d(t,{Mi:()=>i,Tq:()=>l,qE:()=>r,ys:()=>n});var a=s(6955);function l(e,t){return e||t?e?t?{hiAbsolute:e.hiAbsolute??t.hiAbsolute,hiCritical:e.hiCritical??t.hiCritical,hiNormal:e.hiNormal??t.hiNormal,lowAbsolute:e.lowAbsolute??t.lowAbsolute,lowCritical:e.lowCritical??t.lowCritical,lowNormal:e.lowNormal??t.lowNormal,units:e.units??t.units}:e:t||null:null}function n(e,t){if(!e)return"--";let{lowNormal:s,hiNormal:l}=e,n=e.units||t||"";return(0,a.qU)(s,l)?`${s} – ${l}${n?` ${n}`:""}`:"--"}function i(e,t){let s=e?.trim()||"",a=t?.trim()||"";return s?function(e,t){if(!e||!t)return!1;let s=e.trim(),a=t.trim();return s.endsWith(a)||s.endsWith(` ${a}`)}(s,a)||function(e){if(!e)return!1;let t=e.trim();return/\s+[a-zA-Z\/%°]+$/.test(t)}(s)?s:a?`${s} ${a}`:s:"--"}function r(e){if(!e||0===e.length)return null;let t=e.filter(e=>void 0!==e&&(void 0!==e.lowNormal||void 0!==e.hiNormal));return 0===t.length?null:[...t].sort((e,t)=>{let s=new Date(e.obsDatetime).getTime();return new Date(t.obsDatetime).getTime()-s})[0]}},5365(e,t,s){"use strict";s.d(t,{Fc:()=>n,VL:()=>i,rI:()=>r});var a=s(2664),l=s(4989);let n=(e,t=1e3)=>{let s=!1,a=!1,l=null,n=(...i)=>{s?(a=!0,l=i):(s=!0,setTimeout(()=>{s=!1,a&&(a=!1,n(...l))},t),e(...i))};return n},i=e=>`${window.spaBase}${e}/${l._.path}`;function r(e){return e?(0,a.formatDate)((0,a.parseDate)(e),{mode:"standard",time:!0}):"--"}},4863(e,t,s){"use strict";s.d(t,{ev:()=>i,t0:()=>r,tt:()=>o});var a,l=((a={}).NORMAL="NORMAL",a.HIGH="HIGH",a.CRITICALLY_HIGH="CRITICALLY_HIGH",a.OFF_SCALE_HIGH="OFF_SCALE_HIGH",a.LOW="LOW",a.CRITICALLY_LOW="CRITICALLY_LOW",a.OFF_SCALE_LOW="OFF_SCALE_LOW",a),n=s(7995);let i=e=>e?.code?.coding?.[0]?.code,r=e=>{switch(e){case"OFF_SCALE_HIGH":return n.A["off-scale-high"];case"CRITICALLY_HIGH":return n.A["critically-high"];case"HIGH":return n.A.high;case"OFF_SCALE_LOW":return n.A["off-scale-low"];case"CRITICALLY_LOW":return n.A["critically-low"];case"LOW":return n.A.low;default:return""}};function _(...e){for(let t of e)if(null==t)return!1;return!0}function o(e){let t,{display:s,hiAbsolute:a,hiCritical:n,hiNormal:i,lowAbsolute:r,lowCritical:o,lowNormal:c,units:d}=e,m=null;_(i,c)&&(m=`${c} – ${i}`);let p=(t={hiAbsolute:a,hiCritical:n,hiNormal:i,lowAbsolute:r,lowCritical:o,lowNormal:c,units:d,range:m},e=>{let s=parseFloat(e);return isNaN(s)?l.NORMAL:_(t.hiAbsolute)&&s>t.hiAbsolute?l.OFF_SCALE_HIGH:_(t.hiCritical)&&s>t.hiCritical?l.CRITICALLY_HIGH:_(t.hiNormal)&&s>t.hiNormal?l.HIGH:_(t.lowAbsolute)&&s<t.lowAbsolute?l.OFF_SCALE_LOW:_(t.lowCritical)&&s<t.lowCritical?l.CRITICALLY_LOW:_(t.lowNormal)&&s<t.lowNormal?l.LOW:l.NORMAL});return{display:s,hiAbsolute:a,hiCritical:n,hiNormal:i,lowAbsolute:r,lowCritical:o,lowNormal:c,units:d,range:m,getInterpretation:p}}},6955(e,t,s){"use strict";s.d(t,{$u:()=>c,EF:()=>b,UY:()=>_,Yq:()=>f,Yz:()=>i,dY:()=>p,lf:()=>h,mL:()=>d,qU:()=>u,tt:()=>g});var a=s(2664);let l=(e,t)=>{let s=e[Symbol.iterator]();return Array.from({length:t},()=>s.next().value)},n={};function i(e,t,s){n[e]=[t,Date.now(),s];let a=Object.entries(n);a.length>5&&(a.sort(([,[,e]],[,[,t]])=>t-e),n=Object.fromEntries(a.slice(0,5)))}async function r(e){let t=o({patient:e,category:"laboratory",_sort:"-_date",_summary:"data",_format:"json",_count:"1"}),s=await t.next().value;return s?.entry?.[0]?.resource?.id}function _(e){let[t,,s]=n[e]||[];return[t,t&&s?r(e).then(e=>e!==s):Promise.resolve(!0)]}function*o(e){let t=`${window.openmrsBase}/ws/fhir2/R4/Observation?`+Object.entries(e).map(([e,t])=>e+"="+t).join("&"),s=e=>t+"&_getpagesoffset="+300*e,a=0;for(;;)yield fetch(s(a++)).then(e=>e.json())}let c=async e=>{let t=o({patient:e,category:"laboratory",_sort:"-_date",_summary:"data",_format:"json",_count:"300"}),s=await Promise.all(l(t,1)),a=s[0]?.total??0;if(a>300){let e=Math.ceil(a/300)-1;s=[...s,...await Promise.all(l(t,e))]}return s.slice(0,Math.ceil(a/300)).flatMap(e=>e?.entry?.map(e=>e.resource)??[])},d=e=>e?.code?.coding?.[0]?.code??"",m={};function p(e){return Promise.allSettled([...new Set(e.map(d).filter(Boolean))].map(e=>m[e]||(m[e]=fetch(`${window.openmrsBase}${a.restBaseUrl}/concept/${e}?v=full`).then(t=>{if(!t.ok)throw Error(`Failed to fetch concept ${e}: ${t.statusText}`);return t.json()}).catch(t=>{throw delete m[e],t})))).then(e=>e.filter(e=>"fulfilled"===e.status).map(e=>e.value))}function u(...e){for(let t of e)if(null==t)return!1;return!0}function h(e){if(!e.referenceRange||0===e.referenceRange.length)return;let t={units:e.valueQuantity?.unit};if(e.referenceRange.forEach(e=>{let s=e.type?.coding?.[0]?.code,a=e.type?.coding?.[0]?.system;"http://terminology.hl7.org/CodeSystem/referencerange-meaning"===a?"normal"===s?(t.hiNormal=e.high?.value,t.lowNormal=e.low?.value):"treatment"===s&&(t.hiCritical=e.high?.value,t.lowCritical=e.low?.value):"http://fhir.openmrs.org/ext/obs/reference-range"===a&&"absolute"===s&&(t.hiAbsolute=e.high?.value,t.lowAbsolute=e.low?.value)}),void 0!==t.hiNormal||void 0!==t.lowNormal||void 0!==t.hiCritical||void 0!==t.lowCritical||void 0!==t.hiAbsolute||void 0!==t.lowAbsolute)return t}function f(e){if(!e.interpretation||0===e.interpretation.length)return;let t=e.interpretation[0],s=t.coding?.[0]?.code,a=t.coding?.[0]?.display||t.text;if(s)switch(s.toUpperCase()){case"LL":return"CRITICALLY_LOW";case"HH":return"CRITICALLY_HIGH";case"L":return"LOW";case"H":return"HIGH";case"N":return"NORMAL";case"LU":return"OFF_SCALE_LOW";case"HU":return"OFF_SCALE_HIGH"}if(a)switch(a.trim().toLowerCase()){case"critically low":return"CRITICALLY_LOW";case"critically high":return"CRITICALLY_HIGH";case"low":return"LOW";case"high":return"HIGH";case"normal":return"NORMAL";case"off scale low":return"OFF_SCALE_LOW";case"off scale high":return"OFF_SCALE_HIGH"}}let b=e=>t=>{if(isNaN(parseFloat(t)))return"NORMAL";let s=parseFloat(t);return u(e.hiAbsolute)&&s>e.hiAbsolute?"OFF_SCALE_HIGH":u(e.hiCritical)&&s>e.hiCritical?"CRITICALLY_HIGH":u(e.hiNormal)&&s>e.hiNormal?"HIGH":u(e.lowAbsolute)&&s<e.lowAbsolute?"OFF_SCALE_LOW":u(e.lowCritical)&&s<e.lowCritical?"CRITICALLY_LOW":u(e.lowNormal)&&s<e.lowNormal?"LOW":"NORMAL"};function g(e){return Object.fromEntries(e.map(({uuid:e,hiAbsolute:t,hiCritical:s,hiNormal:a,lowAbsolute:l,lowCritical:n,lowNormal:i,units:r,datatype:{display:_}})=>{let o={hiAbsolute:t,hiCritical:s,hiNormal:a,lowAbsolute:l,lowCritical:n,lowNormal:i,units:r,datatype:_};return u(a,i)&&(o.range=`${i} – ${a}`),o.assessValue=b(o),[e,o]}))}},7774(e,t,s){"use strict";s.d(t,{A:()=>d});var a=s(3338);s(5399);var l=s(3373),n=s.n(l),i=s(324),r=s(2664);let _={tableContainer:"-esm-patient-tests__common-datatable__tableContainer___zMtM9",desktop:"-esm-patient-tests__common-datatable__desktop___DBWFL",table:"-esm-patient-tests__common-datatable__table___gT-hJ","col-name":"-esm-patient-tests__common-datatable__col-name___v+OHb","col-value":"-esm-patient-tests__common-datatable__col-value___SjYUn","col-range":"-esm-patient-tests__common-datatable__col-range___7mqr0",offScaleHigh:"-esm-patient-tests__common-datatable__offScaleHigh___uOYu2",offScaleLow:"-esm-patient-tests__common-datatable__offScaleLow___Pu9+I",criticallyHigh:"-esm-patient-tests__common-datatable__criticallyHigh___BhGOR",criticallyLow:"-esm-patient-tests__common-datatable__criticallyLow___Mednc",high:"-esm-patient-tests__common-datatable__high___Ja3pV",low:"-esm-patient-tests__common-datatable__low___UmVO0"},o=e=>_[`col-${e}`],c=({interpretation:e,...t})=>{switch(e){case"OFF_SCALE_HIGH":return(0,a.jsx)(i.TableRow,{...t,className:_["off-scale-high"]});case"CRITICALLY_HIGH":return(0,a.jsx)(i.TableRow,{...t,className:_["critically-high"]});case"HIGH":return(0,a.jsx)(i.TableRow,{...t,className:_.high});case"OFF_SCALE_LOW":return(0,a.jsx)(i.TableRow,{...t,className:_["off-scale-low"]});case"CRITICALLY_LOW":return(0,a.jsx)(i.TableRow,{...t,className:_["critically-low"]});case"LOW":return(0,a.jsx)(i.TableRow,{...t,className:_.low});default:return(0,a.jsx)(i.TableRow,{...t})}},d=({title:e,data:t,description:s,toolbar:l,tableHeaders:d})=>{let m={OFF_SCALE_HIGH:"offScaleHigh",CRITICALLY_HIGH:"criticallyHigh",HIGH:"high",OFF_SCALE_LOW:"offScaleLow",CRITICALLY_LOW:"criticallyLow",LOW:"low",NORMAL:""},p="tablet"===(0,r.useLayoutType)();return t=t.map(e=>({...e,dateTime:(0,r.formatDate)((0,r.parseDate)(e?.dateTime),{mode:"standard",time:!0})})),(0,a.jsx)(i.DataTable,{rows:t,headers:d,size:"sm",useZebraStyles:!0,children:({rows:r,headers:d,getHeaderProps:u,getRowProps:h,getTableProps:f,getTableContainerProps:b})=>(0,a.jsxs)(i.TableContainer,{className:n()(_.tableContainer,p?_.tablet:_.desktop),title:e,description:s,...b(),children:[l,(0,a.jsxs)(i.Table,{className:_.table,...f(),isSortable:!0,children:[(0,a.jsx)(i.TableHead,{children:(0,a.jsx)(i.TableRow,{children:d.map(e=>(0,a.jsx)(i.TableHeader,{className:o(e.key),...u({header:e}),isSortable:!0,children:e.header},e.key))})}),(0,a.jsx)(i.TableBody,{children:r.map((e,s)=>(0,a.jsx)(c,{interpretation:t[s]?.interpretation,...h({row:e}),children:e.cells.map(e=>e.value?.interpretation?(0,a.jsx)(i.TableCell,{className:n()(_[m[e.value.interpretation]],o(e.info.header)),children:(0,a.jsx)("span",{children:e.value?.value??e.value})},e.id):(0,a.jsx)(i.TableCell,{className:o(e.info.header),children:e?.value},e.id))},e.id))})]})]})})}},8547(e,t,s){"use strict";s.d(t,{A:()=>p});var a=s(4644);let l=function(e,t,s,a){for(var l=e.length,n=s+(a?1:-1);a?n--:++n<l;)if(t(e[n],n,e))return n;return -1},n=function(e){return e!=e},i=function(e,t,s){for(var a=s-1,l=e.length;++a<l;)if(e[a]===t)return a;return -1},r=function(e,t){return!!(null==e?0:e.length)&&(t==t?i(e,t,0):l(e,n,0))>-1},_=function(e,t,s){for(var a=-1,l=null==e?0:e.length;++a<l;)if(s(t,e[a]))return!0;return!1};var o=s(2026),c=s(8574),d=s(9922),m=c.A&&1/(0,d.A)(new c.A([,-0]))[1]==1/0?function(e){return new c.A(e)}:function(){};let p=function(e,t,s){var l=-1,n=r,i=e.length,c=!0,p=[],u=p;if(s)c=!1,n=_;else if(i>=200){var h=t?null:m(e);if(h)return(0,d.A)(h);c=!1,n=o.A,u=new a.A}else u=t?[]:p;e:for(;++l<i;){var f=e[l],b=t?t(f):f;if(f=s||0!==f?f:0,c&&b==b){for(var g=u.length;g--;)if(u[g]===b)continue e;t&&u.push(b),p.push(f)}else n(u,b,s)||(u!==p&&u.push(b),p.push(f))}return p}}}]);
|